summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2013-12-14 11:47:33 +0800
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2014-01-09 16:08:28 +0100
commitf4dc714aaa2d86b84724ec01fb848da63aa63666 (patch)
tree4bb820afccf3f4e199454831be12325bca97c201 /Makefile
parent8137af19e75a761d4d9e3ada6820ea7824078a54 (diff)
downloadu-boot-imx-f4dc714aaa2d86b84724ec01fb848da63aa63666.zip
u-boot-imx-f4dc714aaa2d86b84724ec01fb848da63aa63666.tar.gz
u-boot-imx-f4dc714aaa2d86b84724ec01fb848da63aa63666.tar.bz2
arm64: Turn u-boot.bin back into an ELF file after relocate-rela
While performing relocations on u-boot.bin should be good enough for booting on real hardware, some simulators insist on booting an ELF file (and yet don't perform ELF relocations), so convert the relocated binary back into an ELF file. This can go away in the future if we change relocate-rela to operate directly on the ELF file, or if and when we stop caring about a simulator with this restriction. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: David Feng <fenghua@phytium.com.cn>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 85a9330..a4c2928 100644
--- a/Makefile
+++ b/Makefile
@@ -358,6 +358,7 @@ ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
ifneq ($(CONFIG_SPL_TARGET),)
ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
endif
+ALL-$(CONFIG_REMAKE_ELF) += $(obj)u-boot.elf
# enable combined SPL/u-boot/dtb rules for tegra
ifneq ($(CONFIG_TEGRA),)
@@ -528,6 +529,18 @@ $(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
conv=notrunc 2>/dev/null
cat $(obj)u-boot-pad.img $(obj)spl/u-boot-spl.bin > $@
+# Create a new ELF from a raw binary file. This is useful for arm64
+# where static relocation needs to be performed on the raw binary,
+# but certain simulators only accept an ELF file (but don't do the
+# relocation).
+# FIXME refactor dts/Makefile to share target/arch detection
+$(obj)u-boot.elf: $(obj)u-boot.bin
+ @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
+ $< $(obj)u-boot-elf.o
+ @$(LD) $(obj)u-boot-elf.o -o $@ \
+ --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
+ -Ttext=$(CONFIG_SYS_TEXT_BASE)
+
ifeq ($(CONFIG_SANDBOX),y)
GEN_UBOOT = \
cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \