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

Michal Simek michal.simek at amd.com
Tue May 5 08:38:31 CEST 2026



On 5/5/26 02:47, michael.srba at seznam.cz wrote:
> From: Michael Srba <Michael.Srba at seznam.cz>
> 
> Some platforms (e.g. at 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>

emails are lower case only.

> ---
>   Makefile           |  9 +++++++--
>   common/spl/Kconfig | 11 +++++++++++
>   2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 49d9740327e..8fe722f6c0d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2008,12 +2008,17 @@ u-boot.elf: u-boot.bin u-boot-elf.lds FORCE
>   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 u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SPL_TEXT_BASE) \
> +	-T spl/u-boot-spl-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SPL_TEXT_BASE) \
>   	-Ttext=$(CONFIG_SPL_TEXT_BASE)
> -spl/u-boot-spl.elf: spl/u-boot-spl.bin u-boot-elf.lds
> +spl/u-boot-spl.elf: spl/u-boot-spl.bin spl/u-boot-spl-elf.lds
>   	$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< spl/u-boot-spl-elf.o
>   	$(call if_changed,u-boot-spl-elf)
>   
> +SPL_REMAKE_ELF_LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_SPL_REMAKE_ELF_LDSCRIPT:"%"=%))
> +
> +spl/u-boot-spl-elf.lds: $(SPL_REMAKE_ELF_LDSCRIPT) prepare FORCE
> +	$(call if_changed_dep,cpp_lds)
> +
>   u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
>   	$(call if_changed_dep,cpp_lds)
>   
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 5fa94098e49..08a4d2a75e9 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -238,6 +238,17 @@ config SPL_HANDOFF
>   	  proper. Also SPL can receive information from TPL in the same place
>   	  if that is enabled.
>   
> +config SPL_REMAKE_ELF_LDSCRIPT
> +	string "Linker script for SPL ELF"
> +	depends on SPL_REMAKE_ELF
> +	default "arch/u-boot-spl-elf.lds"

When is this file defined?

I have CC'ed you on
https://lore.kernel.org/all/aa144c8002ba86154dcb62624a1d9d7cbe8c2cdf.1777962845.git.michal.simek@amd.com/

when 1/11 is applied I am getting.

[u-boot]$ make xilinx_mbv64_smode_defconfig
generated_defconfig:59:warning: override: reassigning to symbol DEFAULT_DEVICE_TREE
#
# configuration written to .config
#
[u-boot]$ make -j8
scripts/kconfig/conf  --syncconfig Kconfig
   CFG     u-boot.cfg
   GEN     include/autoconf.mk.dep
   CFG     spl/u-boot.cfg
   GEN     include/autoconf.mk
   GEN     spl/include/autoconf.mk
   UPD     include/generated/timestamp_autogenerated.h
   ENVC    include/generated/env.txt
make: *** No rule to make target 'arch/u-boot-spl-elf.lds', needed by 
'spl/u-boot-spl-elf.lds'.  Stop.
make: *** Waiting for unfinished jobs....


Thanks,
Michal


More information about the U-Boot mailing list