All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 0/4] u-boot.elf: support other archs
@ 2017-04-20 18:36 Álvaro Fernández Rojas
  2017-04-20 18:36 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Álvaro Fernández Rojas
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Álvaro Fernández Rojas @ 2017-04-20 18:36 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags
  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
  2017-04-30 18:41   ` Daniel Schwierzeck
  2017-04-20 18:36 ` [U-Boot] [PATCH v4 2/4] u-boot.elf: allow overriding entry symbol Álvaro Fernández Rojas
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Álvaro Fernández Rojas @ 2017-04-20 18:36 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 2/4] u-boot.elf: allow overriding entry symbol
  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 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Álvaro Fernández Rojas
@ 2017-04-20 18:36 ` Á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-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
  3 siblings, 2 replies; 11+ messages in thread
From: Álvaro Fernández Rojas @ 2017-04-20 18:36 UTC (permalink / raw)
  To: u-boot

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 __start and not _start:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 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(-)

diff --git a/Makefile b/Makefile
index 8730550..6cf2568 100644
--- a/Makefile
+++ b/Makefile
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 3/4] MIPS: add support for generating u-boot.elf
  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 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Álvaro Fernández Rojas
  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 18:36 ` Á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
  3 siblings, 1 reply; 11+ messages in thread
From: Álvaro Fernández Rojas @ 2017-04-20 18:36 UTC (permalink / raw)
  To: u-boot

Define PLATFORM_ELFFLAGS for MIPS in order to be able to generate u-boot.elf

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 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(+)

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index dcd3460..2c72c15 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 4/4] u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
  2017-04-20 18:36 [U-Boot] [PATCH v4 0/4] u-boot.elf: support other archs Álvaro Fernández Rojas
                   ` (2 preceding siblings ...)
  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-20 18:36 ` Álvaro Fernández Rojas
  2017-04-20 20:06   ` Tom Rini
  2017-04-30 18:41   ` Daniel Schwierzeck
  3 siblings, 2 replies; 11+ messages in thread
From: Álvaro Fernández Rojas @ 2017-04-20 18:36 UTC (permalink / raw)
  To: u-boot

This way we can see output about u-boot.elf being built or not.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 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(-)

diff --git a/Makefile b/Makefile
index 6cf2568..3722b19 100644
--- a/Makefile
+++ b/Makefile
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 2/4] u-boot.elf: allow overriding entry symbol
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Rini @ 2017-04-20 19:57 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 20, 2017 at 08:36:26PM +0200, Álvaro Fernández Rojas wrote:

> 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 __start and not _start:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

After a little reading of other platforms, _start seems a reasonable
default so:

Reviewed-by: Tom Rini <trini@konsulko.com>

Thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 4/4] u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Rini @ 2017-04-20 20:06 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 20, 2017 at 08:36:28PM +0200, Álvaro Fernández Rojas wrote:

> This way we can see output about u-boot.elf being built or not.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags
  2017-04-20 18:36 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Álvaro Fernández Rojas
@ 2017-04-30 18:41   ` Daniel Schwierzeck
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Schwierzeck @ 2017-04-30 18:41 UTC (permalink / raw)
  To: u-boot



Am 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
> 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(-)
> 

applied to u-boot-mips/next, thanks!

-- 
- 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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 2/4] u-boot.elf: allow overriding entry symbol
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Daniel Schwierzeck @ 2017-04-30 18:41 UTC (permalink / raw)
  To: u-boot



Am 20.04.2017 um 20:36 schrieb Á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 __start and not _start:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-machine.h;h=ed47513ccc1d23d23d32ee640053d2f351f3990b;hb=HEAD#l258
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  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(-)
> 

applied to u-boot-mips/next, thanks!

-- 
- 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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 3/4] MIPS: add support for generating u-boot.elf
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Schwierzeck @ 2017-04-30 18:41 UTC (permalink / raw)
  To: u-boot



Am 20.04.2017 um 20:36 schrieb Álvaro Fernández Rojas:
> Define PLATFORM_ELFFLAGS for MIPS in order to be able to generate u-boot.elf
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  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(+)
> 

applied to u-boot-mips/next, thanks!

-- 
- 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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v4 4/4] u-boot.elf: add quiet_cmd_u-boot-elf and cmd_u-boot-elf
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Daniel Schwierzeck @ 2017-04-30 18:41 UTC (permalink / raw)
  To: u-boot



Am 20.04.2017 um 20:36 schrieb Á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 <noltari@gmail.com>
> ---
>  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!

-- 
- 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>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-04-30 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [U-Boot] [PATCH v4 1/4] u-boot.elf: remove hard-coded arm64 flags Álvaro Fernández Rojas
2017-04-30 18:41   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.