[PATCH 1/5] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature

Simon Glass sjg at chromium.org
Mon Apr 6 17:50:22 CEST 2026


Hi Michael,

On 2026-04-03T23:18:18, Michael Srba <michael.srba at seznam.cz> wrote:
> Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature
>
> On some platforms (at least Qualcomm), the bootrom expects an ELF file.
> Since the contents of the ELF file are platform specific, add a config
> option that allows specifying a linker script to use to produce the
> ELF file.
>
> Signed-off-by: Michael Srba <Michael.Srba at seznam.cz>

> diff --git a/Makefile b/Makefile
> @@ -2014,6 +2017,26 @@ u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
> +quiet_cmd_u-boot-spl-elf ?= LD      $@
> +     cmd_u-boot-spl-elf ?= $(LD) spl/u-boot-spl-elf.o -o $@ \
> +     -T spl/u-boot-spl-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SPL_TEXT_BASE) \
> +     -Ttext=$(CONFIG_SPL_TEXT_BASE) -z max-page-size=0x1000

The existing cmd_u-boot-spl-elf includes $(if
$(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) for endianness. Please can you add
the same here for consistency.

Since this redefines cmd_u-boot-spl-elf using ?=, the earlier
definition takes precedence if both SPL_REMAKE_ELF and
SPL_REMAKE_ELF_LDSCRIPT are enabled. This is probably fine since
enabling both does not make sense, but maybe add 'depends on
!SPL_REMAKE_ELF' or a note in the Kconfig help text.

> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> @@ -247,6 +247,12 @@ config SPL_HANDOFF
> +config SPL_REMAKE_ELF_LDSCRIPT
> +     string "Linker script to run with u-boot-spl.bin as input"
> +     help
> +       This allows specifying a linker script that will act on u-boot-spl.bin
> +       (see also REMAKE_ELF)

Can you explain when you would need a custom linker script rather than
just using SPL_REMAKE_ELF ?. Something like:

Some platforms (e.g. Qualcomm) require the bootrom to load a custom
ELF format. Unlike SPL_REMAKE_ELF which uses a standard linker script,
this allows a platform-specific one.

Regards,
Simon


More information about the U-Boot mailing list