From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags
Date: Thu, 20 Apr 2017 20:36:25 +0200 [thread overview]
Message-ID: <1492713388-310-2-git-send-email-noltari@gmail.com> (raw)
In-Reply-To: <1492713388-310-1-git-send-email-noltari@gmail.com>
This is needed in order to allow building it for other archs.
Move relocation comment to a better place.
Remove no longer needed dts FIXME.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
v4: no changes
v3: Introduce changes suggested by Daniel Schwierzeck:
- Split patches.
- Avoid building it unconditionally.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Avoid using a linker script.
- Reuse aarch64 u-boot.elf generation for other archs.
Makefile | 12 +++++-------
arch/arm/config.mk | 6 ++++++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 131d62e..8730550 100644
--- a/Makefile
+++ b/Makefile
@@ -747,6 +747,9 @@ BOARD_SIZE_CHECK =
endif
# Statically apply RELA-style relocations (currently arm64 only)
+# 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).
ifneq ($(CONFIG_STATIC_RELA),)
# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
DO_STATIC_RELA = \
@@ -1180,14 +1183,9 @@ OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
$(call if_changed,pad_cat)
-# 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
+# Create a new ELF from a raw binary file.
u-boot.elf: u-boot.bin
- @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
- $< u-boot-elf.o
+ @$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
@$(LD) u-boot-elf.o -o $@ \
--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 907c693..257ad09 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -30,6 +30,12 @@ PLATFORM_RELFLAGS += $(LLVM_RELFLAGS)
PLATFORM_CPPFLAGS += -D__ARM__
+ifdef CONFIG_ARM64
+PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64
+else
+PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
+endif
+
# Choose between ARM/Thumb instruction sets
ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always)
--
2.1.4
next prev parent reply other threads:[~2017-04-20 18:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 18:36 [U-Boot] [PATCH v4 0/4] u-boot.elf: support other archs Álvaro Fernández Rojas
2017-04-20 18:36 ` Álvaro Fernández Rojas [this message]
2017-04-30 18:41 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Daniel Schwierzeck
2017-04-20 18:36 ` [U-Boot] [PATCH v4 2/4] u-boot.elf: allow overriding entry symbol Álvaro Fernández Rojas
2017-04-20 19:57 ` Tom Rini
2017-04-30 18:41 ` Daniel Schwierzeck
2017-04-20 18:36 ` [U-Boot] [PATCH v4 3/4] MIPS: add support for generating u-boot.elf Álvaro Fernández Rojas
2017-04-30 18:41 ` Daniel Schwierzeck
2017-04-20 18:36 ` [U-Boot] [PATCH v4 4/4] u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf Álvaro Fernández Rojas
2017-04-20 20:06 ` Tom Rini
2017-04-30 18:41 ` Daniel Schwierzeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492713388-310-2-git-send-email-noltari@gmail.com \
--to=noltari@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox