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 f4dc714aaa ("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@amd.com>
This commit is contained in:
Michal Simek
2026-02-26 10:27:16 +01:00
committed by Tom Rini
parent 7f35a4251d
commit 60ef345b1a
2 changed files with 17 additions and 0 deletions

View File

@@ -1231,6 +1231,7 @@ ifneq ($(CONFIG_SPL_TARGET),)
INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
endif
INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf
INPUTS-$(CONFIG_SPL_REMAKE_ELF) += spl/u-boot-spl.elf
INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi
INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
@@ -2000,6 +2001,15 @@ u-boot.elf: u-boot.bin u-boot-elf.lds FORCE
$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
$(call if_changed,u-boot-elf)
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) \
-Ttext=$(CONFIG_SPL_TEXT_BASE)
spl/u-boot-spl.elf: spl/u-boot-spl.bin u-boot-elf.lds
$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< spl/u-boot-spl-elf.o
$(call if_changed,u-boot-spl-elf)
u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
$(call if_changed_dep,cpp_lds)

View File

@@ -707,6 +707,13 @@ config SPL_DRIVERS_MISC
option to build the drivers in drivers/misc as part of an SPL
build, for those that support building in SPL (not all drivers do).
config SPL_REMAKE_ELF
bool "Recreate an ELF image from raw SPL binary"
help
Enable this to recreate an ELF image (spl/u-boot-spl.elf) from the raw
SPL binary (spl/u-boot-spl.bin), which may already have been statically
relocated and may already have a device-tree appended to it.
config SPL_ENV_SUPPORT
bool "Support an environment"
help