u-boot.elf: support other archs
Subsystems (3)
v4 cover u-boot.elf: support other archs
Provide an u-boot.elf binary for Broadcom MIPS platforms by re-using the already existing Makefile target for aarch64.
This u-boot.elf binary should be used as a stage 2 loader until U-Boot can be replace the original Broadcom boot loader.
Split patches from main BMIPS support.
Álvaro Fernández Rojas (4):
u-boot.elf: remove hard-coded arm64 flags u-boot.elf: allow overriding entry symbol
MIPS: add support for generating u-boot.elf u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
Makefile | 23 +++++++++++++---------- arch/arm/config.mk | 6 ++++++ arch/mips/config.mk | 2 ++ 3 files changed, 21 insertions(+), 10 deletions(-)
Signature · 1 line
2.1.4
PATCH v4 1/4 u-boot.elf: remove hard-coded arm64 flags
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.
---
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(-)
Makefile +5 -7
@@ -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)
arch/arm/config.mk +6 -0
@@ -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)
Signature · 1 line
2.1.4
PATCH v4 1/4 u-boot.elf: remove hard-coded arm64 flags
Am 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
Quoted 15 lines
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 <[email protected]>Reviewed-by Tom Rini <[email protected]>---
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.
Quoted 4 lines
Makefile | 12 +++++------- arch/arm/config.mk | 6 ++++++ 2 files changed, 11 insertions(+), 7 deletions(-)
applied to u-boot-mips/next, thanks!
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170430/6879ffe7/attachment.sig>
PATCH v4 2/4 u-boot.elf: allow overriding entry symbol
In reply to Álvaro Fernández RojasLD gives the following warning when trying to process u-boot-elf.o
warning: cannot find entry symbol __start; defaulting to 0000000080010000 According to gnu-libc the entry symbol for mips is __start and not _start:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258
---
v4: Introduce changes suggested by Tom Rini:
- __start is the standard for MIPS, not ARM.
v3: Introduce changes suggested by Daniel Schwierzeck:
- Split patches.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Fix _start vs __start symbol.
Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Makefile +4 -1
@@ -1184,10 +1184,13 @@ 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. +ifndef PLATFORM_ELFENTRY + PLATFORM_ELFENTRY = "_start" +endif u-boot.elf: u-boot.bin @$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o @$(LD) u-boot-elf.o -o $@ \ - --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ + --defsym=$(PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \ -Ttext=$(CONFIG_SYS_TEXT_BASE) # Rule to link u-boot
Signature · 1 line
2.1.4
PATCH v4 2/4 u-boot.elf: allow overriding entry symbol
Quoted 6 lines · Álvaro Fernández Rojas
LD gives the following warning when trying to process u-boot-elf.o
warning: cannot find entry symbol__start; defaulting to 0000000080010000 According to gnu-libc the entry symbol for mips is__startand not_start:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258Signed-off-by Álvaro Fernández Rojas <[email protected]>
After a little reading of other platforms, _start seems a reasonable default so:
Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170420/264453b2/attachment.sig>
PATCH v4 2/4 u-boot.elf: allow overriding entry symbol
In reply to Álvaro Fernández RojasAm 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
Quoted 14 lines
LD gives the following warning when trying to process u-boot-elf.o
warning: cannot find entry symbol__start; defaulting to 0000000080010000 According to gnu-libc the entry symbol for mips is__startand not_start:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v4: Introduce changes suggested by Tom Rini:
-__startis the standard for MIPS, not ARM.
v3: Introduce changes suggested by Daniel Schwierzeck:
- Split patches.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Fix_startvs__startsymbol.
Quoted 3 lines
Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
applied to u-boot-mips/next, thanks!
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170430/38280809/attachment.sig>
PATCH v4 3/4 MIPS: add support for generating u-boot.elf
In reply to Álvaro Fernández RojasDefine PLATFORM_ELFFLAGS for MIPS in order to be able to generate u-boot.elf
---
v4: Introduce changes suggested by Tom Rini:
- __start is the standard for MIPS, not ARM.
v3: Introduce changes suggested by Daniel Schwierzeck:
- Add new patch.
arch/mips/config.mk | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/config.mk +2 -0
@@ -36,6 +36,8 @@ OBJCOPYFLAGS += -O $(64bit-bfd) endif PLATFORM_CPPFLAGS += -D__MIPS__ +PLATFORM_ELFENTRY = "__start" +PLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS) # # From Linux arch/mips/Makefile
Signature · 1 line
2.1.4
PATCH v4 3/4 MIPS: add support for generating u-boot.elf
Am 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
Quoted 12 lines
Define
PLATFORM_ELFFLAGSfor MIPS in order to be able to generate u-boot.elfSigned-off-by Álvaro Fernández Rojas <[email protected]>---
v4: Introduce changes suggested by Tom Rini:
-__startis the standard for MIPS, not ARM.
v3: Introduce changes suggested by Daniel Schwierzeck:
- Add new patch.arch/mips/config.mk | 2 ++ 1 file changed, 2 insertions(+)
applied to u-boot-mips/next, thanks!
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170430/9ca104e6/attachment.sig>
PATCH v4 4/4 u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
In reply to Álvaro Fernández RojasThis way we can see output about u-boot.elf being built or not.
---
v4: Introduce changes suggested by Tom Rini:
- Add new patch to output u-boot.elf build.
Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Makefile +6 -4
@@ -1187,11 +1187,13 @@ u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE ifndef PLATFORM_ELFENTRY PLATFORM_ELFENTRY = "_start" endif +quiet_cmd_u-boot-elf ?= LD $@ + cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \ + --defsym=$(PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \ + -Ttext=$(CONFIG_SYS_TEXT_BASE) u-boot.elf: u-boot.bin - @$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o - @$(LD) u-boot-elf.o -o $@ \ - --defsym=$(PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \ - -Ttext=$(CONFIG_SYS_TEXT_BASE) + $(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o + $(call if_changed,u-boot-elf) # Rule to link u-boot # May be overridden by arch/$(ARCH)/config.mk
Signature · 1 line
2.1.4
PATCH v4 4/4 u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
Quoted 3 lines · Álvaro Fernández Rojas
This way we can see output about u-boot.elf being built or not.
Signed-off-by Álvaro Fernández Rojas <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170420/f5cab316/attachment.sig>
PATCH v4 4/4 u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
In reply to Álvaro Fernández RojasAm 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
Quoted 10 lines
This way we can see output about u-boot.elf being built or not.
Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v4: Introduce changes suggested by Tom Rini:
- Add new patch to output u-boot.elf build.Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
applied to u-boot-mips/next, thanks!
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170430/13348027/attachment.sig>