[PATCH 1/5] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature

Simon Glass sjg at chromium.org
Sun Apr 12 14:04:17 CEST 2026


Hi Michael,

On Mon, 6 Apr 2026 at 16:44, Michael Srba <Michael.Srba at seznam.cz> wrote:
>
> On 4/6/26 17:50, Simon Glass wrote:
> > 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.
> Hi,
> slowly going through the reviews, I think when I originally worked on this
> u-boot didn't support remaking SPL into an ELF at all. I completely missed
> this change when rebasing (or didn't miss it, made a mental note, and
> completely forgot... hard to say at this point).
>
> I could certainly just
> add a conditional, though there's probably cleaner ways to do this where
> only the linker script is conditional (not sure what to do about the page
> size, would need to test to double check if it's even actually necessary).
>
> Actually, making the linker script path default to the standard one would be
> the cleanest option by some measures, but since you didn't suggest it
> I assume that's not your preferred solution?

Actually that seems better, something like:

  config SPL_REMAKE_ELF_LDSCRIPT
      string "Linker script for SPL ELF"
      depends on SPL_REMAKE_ELF
      default "arch/$(ARCH)/u-boot-spl-elf.lds"

Then your platform can override it and there is only a single
cmd_u-boot-spl-elf with no problems with ?= !

Regards,
Simon


More information about the U-Boot mailing list