[PATCH v2 01/10] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature

Simon Glass sjg at chromium.org
Sat Apr 11 17:39:28 CEST 2026


Hi Michael,

On 2026-04-11T00:00:12, 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>
>
> Makefile           | 28 ++++++++++++++++++++++++++++
>  common/spl/Kconfig |  9 +++++++++
>  2 files changed, 37 insertions(+)

> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> @@ -247,6 +247,15 @@ config SPL_HANDOFF
> +config SPL_REMAKE_ELF_LDSCRIPT
> +     string "Linker script to run with u-boot-spl.bin as input"
> +     depends on !SPL_REMAKE_ELF
> +     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. Unlike SPL_REMAKE_ELF which uses a standard
> +       linker script, this allows specifying a platorm-specific one.

Typo: platform-specific

> diff --git a/Makefile b/Makefile
> @@ -2010,10 +2015,33 @@ spl/u-boot-spl.elf: spl/u-boot-spl.bin u-boot-elf.lds
> +quiet_cmd_u-boot-spl-elf ?= LD      $@
> +     cmd_u-boot-spl-elf ?= $(LD) spl/u-boot-spl-elf.o -o $@ \
> +     $(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
> +     -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 -z max-page-size=0x1000 flag is only added to the new path. If
needed for correct ELF generation, perhaps add it to the existing
cmd_u-boot-spl-elf too? If it is Qualcomm-specific, please add a
comment explaining why.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list