[PATCH 1/5] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature
Michal Simek
michal.simek at amd.com
Mon Apr 13 08:22:48 CEST 2026
On 4/12/26 14:04, Simon Glass wrote:
> 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 ?= !
Keep in your mind that SPL elf remake patch has been recently merged.
Passing custom linker script needs to be done on the top of this.
Thanks,
Michal
commit 60ef345b1a10ec859f29ebc706724f907e8771cb
Author: Michal Simek <michal.simek at amd.com>
AuthorDate: Thu Feb 26 10:27:16 2026 +0100
Commit: Tom Rini <trini at konsulko.com>
CommitDate: Fri Mar 13 13:21:52 2026 -0600
spl: Remake SPL elf from bin
On Xilinx MB-V there is a need to use ELF file for SPL which is placed
in BRAM (Block RAM) because tools for placing code to bitstream requires to
use ELF. That's why introduce SPL_REMAKE_ELF similar to REMAKE_ELF option
as was originally done by commit f4dc714aaa2d ("arm64: Turn u-boot.bin back
into an ELF file after relocate-rela").
There is already generic and simple linker script (arch/u-boot-elf.lds)
which can be also used without any modification.
Signed-off-by: Michal Simek <michal.simek at amd.com>
More information about the U-Boot
mailing list