[PATCH v4 01/11] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature

Simon Glass sjg at chromium.org
Tue Apr 28 20:27:35 CEST 2026


Hi Michael,

On 2026-04-25T23:26:13, Michael Srba <michael.srba at seznam.cz> wrote:
> Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature
>
> Some platforms (e.g. least Qualcomm), use the ELF format in creative
> ways, including in the bootrom. Make SPL_REMAKE_ELF use a linker script
> specified in SPL_REMAKE_ELF_LDSCRIPT (with the previously hardcoded path
> as the default).
>
> Signed-off-by: Michael Srba <Michael.Srba at seznam.cz>
>
> Makefile           | 10 ++++++++--
>  common/spl/Kconfig | 10 ++++++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)

> diff --git a/Makefile b/Makefile
> @@ -2004,16 +2004,22 @@ u-boot.elf: u-boot.bin u-boot-elf.lds FORCE
> +spl/u-boot-spl-elf.lds: $(SPL_REMAKE_ELF_LDSCRIPT) FORCE
> +     $(call if_changed_dep,cpp_lds)
> +
>  u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
>       $(call if_changed_dep,cpp_lds)

Please keep the 'prepare' prerequisite - cpp_lds may pull in generated
headers (autoconf.h etc.), matching the u-boot.lds rule below.

> diff --git a/Makefile b/Makefile
> @@ -2004,16 +2004,22 @@ u-boot.elf: u-boot.bin u-boot-elf.lds FORCE
>  PHONY += prepare0
> +
>  # MediaTek's ARM-based u-boot needs a header to contains its load address

Stray blank line - please drop it.

> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> @@ -247,6 +247,16 @@ config SPL_HANDOFF
> +config SPL_REMAKE_ELF_LDSCRIPT
> +     string "Linker script for SPL ELF"
> +     depends on SPL_REMAKE_ELF
> +     default 'arch/$(ARCH)/u-boot-spl-elf.lds'
> +     help
> +       This allows specifying a linker script that will act on u-boot-spl.bin.
> +       Some platforms (e.g Qualcomm) use the ELF format in creative ways,
> +       including in the bootrom. For such platforms, you can change the default
> +       linker script to a platform-specific one.

The previous hardcoded source was arch/u-boot-elf.lds, but the new
default arch/$(ARCH)/u-boot-spl-elf.lds does not exist for any in-tree
architecture, so any board enabling SPL_REMAKE_ELF without overriding
will fail to build. Either set the default to arch/u-boot-elf.lds or
add the per-arch files.

Also the help text is misleading - the script does not act on
u-boot-spl.bin, it is the linker script used when re-wrapping the SPL
binary into an ELF. Also 'e.g Qualcomm' is missing the period after
'e.g'.

> Some platforms (e.g. least Qualcomm), use the ELF format in creative
> ways, including in the bootrom. Make SPL_REMAKE_ELF use a linker script
> specified in SPL_REMAKE_ELF_LDSCRIPT (with the previously hardcoded path
> as the default).

e.g. at least Qualcomm

The stray comma after the parenthesis can go, and the 'previously
hardcoded path as the default' does not match what Kconfig actually
points at.

Regards,
Simon


More information about the U-Boot mailing list