diff mbox series

mach-imx: bootaux: fix building with disabled bootelf

Message ID 20230826132410.378846-1-oleksandr.suvorov@foundries.io
State Changes Requested
Delegated to: Heinrich Schuchardt
Headers show
Series mach-imx: bootaux: fix building with disabled bootelf | expand

Commit Message

Oleksandr Suvorov Aug. 26, 2023, 1:24 p.m. UTC
If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends
up with a linking error [1]. Select LIB_ELF for all cases when
valid_elf_image() is used in the imx_bootaux module.

[1]
ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux':
arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image'

Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
---

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Heinrich Schuchardt Aug. 26, 2023, 1:47 p.m. UTC | #1
On 8/26/23 15:24, Oleksandr Suvorov wrote:
> If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends
> up with a linking error [1]. Select LIB_ELF for all cases when
> valid_elf_image() is used in the imx_bootaux module.
>
> [1]
> ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux':
> arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image'
>
> Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support")
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> ---
>
>   arch/arm/mach-imx/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index d94b5828d0d..cbe62d6b8f9 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -32,6 +32,7 @@ config IMX_RDC
>   config IMX_BOOTAUX
>   	bool "Support boot auxiliary core"
>   	depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M
> +	select LIB_ELF if !ARCH_IMX8 || IMX8QXP

For CONFIG_IMX8QXP=y arch/arm/mach-imx/imx8/cpu.c uses valid_elf_image().

Shouldn't the IMX8QXP case be handled in arch/arm/mach-imx/imx8/Kconfig?

config IMX8QXP
	select LIB_ELF

Best regards

Heinrich

>   	help
>   	  bootaux [addr] to boot auxiliary core.
>
Oleksandr Suvorov Aug. 26, 2023, 3:16 p.m. UTC | #2
Hi Heinrich,

On Sat, Aug 26, 2023 at 4:46 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 8/26/23 15:24, Oleksandr Suvorov wrote:
> > If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends
> > up with a linking error [1]. Select LIB_ELF for all cases when
> > valid_elf_image() is used in the imx_bootaux module.
> >
> > [1]
> > ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux':
> > arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image'
> >
> > Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support")
> > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> > ---
> >
> >   arch/arm/mach-imx/Kconfig | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> > index d94b5828d0d..cbe62d6b8f9 100644
> > --- a/arch/arm/mach-imx/Kconfig
> > +++ b/arch/arm/mach-imx/Kconfig
> > @@ -32,6 +32,7 @@ config IMX_RDC
> >   config IMX_BOOTAUX
> >       bool "Support boot auxiliary core"
> >       depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M
> > +     select LIB_ELF if !ARCH_IMX8 || IMX8QXP
>
> For CONFIG_IMX8QXP=y arch/arm/mach-imx/imx8/cpu.c uses valid_elf_image().
>
> Shouldn't the IMX8QXP case be handled in arch/arm/mach-imx/imx8/Kconfig?
>
> config IMX8QXP
>         select LIB_ELF

We need to select LIB_ELF for this SoC only if IMX_BOOTAUX is enabled:
the arch/arm/mach-imx/imx8/cpu.c guards with #ifdef CONFIG_IMX_BOOTAUX
functions that
call lib/elf.o members.

Cheers,

Oleksandr

> Best regards
>
> Heinrich
>
> >       help
> >         bootaux [addr] to boot auxiliary core.
> >
>
Tom Rini Aug. 26, 2023, 11:50 p.m. UTC | #3
On Sat, Aug 26, 2023 at 06:16:36PM +0300, Oleksandr Suvorov wrote:
> Hi Heinrich,
> 
> On Sat, Aug 26, 2023 at 4:46 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > On 8/26/23 15:24, Oleksandr Suvorov wrote:
> > > If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends
> > > up with a linking error [1]. Select LIB_ELF for all cases when
> > > valid_elf_image() is used in the imx_bootaux module.
> > >
> > > [1]
> > > ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux':
> > > arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image'
> > >
> > > Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support")
> > > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> > > ---
> > >
> > >   arch/arm/mach-imx/Kconfig | 1 +
> > >   1 file changed, 1 insertion(+)
> > >
> > > diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> > > index d94b5828d0d..cbe62d6b8f9 100644
> > > --- a/arch/arm/mach-imx/Kconfig
> > > +++ b/arch/arm/mach-imx/Kconfig
> > > @@ -32,6 +32,7 @@ config IMX_RDC
> > >   config IMX_BOOTAUX
> > >       bool "Support boot auxiliary core"
> > >       depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M
> > > +     select LIB_ELF if !ARCH_IMX8 || IMX8QXP
> >
> > For CONFIG_IMX8QXP=y arch/arm/mach-imx/imx8/cpu.c uses valid_elf_image().
> >
> > Shouldn't the IMX8QXP case be handled in arch/arm/mach-imx/imx8/Kconfig?
> >
> > config IMX8QXP
> >         select LIB_ELF
> 
> We need to select LIB_ELF for this SoC only if IMX_BOOTAUX is enabled:
> the arch/arm/mach-imx/imx8/cpu.c guards with #ifdef CONFIG_IMX_BOOTAUX
> functions that
> call lib/elf.o members.

And what about the rest of the platforms above?  There's certainly some
missing Kconfig enforcement of requirements, but I suspect it's wider
than just one set of SoC families for a long-standing feature.
Oleksandr Suvorov Aug. 31, 2023, 1:56 p.m. UTC | #4
Hi Tom,

On Sun, Aug 27, 2023 at 2:50 AM Tom Rini <trini@konsulko.com> wrote:
>
> On Sat, Aug 26, 2023 at 06:16:36PM +0300, Oleksandr Suvorov wrote:
> > Hi Heinrich,
> >
> > On Sat, Aug 26, 2023 at 4:46 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > >
> > > On 8/26/23 15:24, Oleksandr Suvorov wrote:
> > > > If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends
> > > > up with a linking error [1]. Select LIB_ELF for all cases when
> > > > valid_elf_image() is used in the imx_bootaux module.
> > > >
> > > > [1]
> > > > ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux':
> > > > arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image'
> > > >
> > > > Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support")
> > > > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> > > > ---
> > > >
> > > >   arch/arm/mach-imx/Kconfig | 1 +
> > > >   1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> > > > index d94b5828d0d..cbe62d6b8f9 100644
> > > > --- a/arch/arm/mach-imx/Kconfig
> > > > +++ b/arch/arm/mach-imx/Kconfig
> > > > @@ -32,6 +32,7 @@ config IMX_RDC
> > > >   config IMX_BOOTAUX
> > > >       bool "Support boot auxiliary core"
> > > >       depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M
> > > > +     select LIB_ELF if !ARCH_IMX8 || IMX8QXP
> > >
> > > For CONFIG_IMX8QXP=y arch/arm/mach-imx/imx8/cpu.c uses valid_elf_image().
> > >
> > > Shouldn't the IMX8QXP case be handled in arch/arm/mach-imx/imx8/Kconfig?
> > >
> > > config IMX8QXP
> > >         select LIB_ELF
> >
> > We need to select LIB_ELF for this SoC only if IMX_BOOTAUX is enabled:
> > the arch/arm/mach-imx/imx8/cpu.c guards with #ifdef CONFIG_IMX_BOOTAUX
> > functions that
> > call lib/elf.o members.
>
> And what about the rest of the platforms above?  There's certainly some
> missing Kconfig enforcement of requirements, but I suspect it's wider
> than just one set of SoC families for a long-standing feature.

You may be right. As bootaux command implementation for other boards
may use elf functionality in future, it
would be better to enable LIB_ELF unconditionally.

>
> --
> Tom
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d94b5828d0d..cbe62d6b8f9 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -32,6 +32,7 @@  config IMX_RDC
 config IMX_BOOTAUX
 	bool "Support boot auxiliary core"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M
+	select LIB_ELF if !ARCH_IMX8 || IMX8QXP
 	help
 	  bootaux [addr] to boot auxiliary core.