Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 1/1] boot/uboot/uboot.mk: add binary u-boot.elf support
@ 2022-11-23 14:31 Neal Frager via buildroot
  2022-11-23 22:30 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Frager via buildroot @ 2022-11-23 14:31 UTC (permalink / raw)
  To: buildroot; +Cc: luca.ceresoli, thomas.petazzoni, Neal Frager

If a user requests a u-boot binary in elf format,
they may actually want the stripped u-boot.elf version.
This patch provides the stripped u-boot.elf binary.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V2:
  - reduced scope to only 64-bit ARM arch platforms
  - non-ARM platforms may not have a u-boot.elf by default
V2->V3:
  - test and verify u-boot.elf exists before copying
V3->V4:
  - added a new BR2_TARGET_UBOOT_FORMAT_BIN_ELF config
---
 boot/uboot/Config.in | 8 ++++++++
 boot/uboot/uboot.mk  | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 557472b58b..b7591d4542 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -277,7 +277,15 @@ config BR2_TARGET_UBOOT_FORMAT_NAND_BIN
 	bool "u-boot-nand.bin"
 
 config BR2_TARGET_UBOOT_FORMAT_ELF
+	bool "u-boot"
+	help
+	  Configures the u-boot ELF file with debug symbols.
+
+config BR2_TARGET_UBOOT_FORMAT_BIN_ELF
 	bool "u-boot.elf"
+	help
+	  Configures the u-boot.elf binary version of ELF file.
+	  Debug symbols are not included in this ELF file.
 
 config BR2_TARGET_UBOOT_FORMAT_IMG
 	bool "u-boot.img"
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 9e073daa38..55ed6b1ba2 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -60,6 +60,10 @@ UBOOT_MAKE_TARGET += mdbtrick
 endif
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_BIN_ELF),y)
+UBOOT_BINS += u-boot.elf
+endif
+
 # Call 'make all' unconditionally
 UBOOT_MAKE_TARGET += all
 
-- 
2.17.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v4 1/1] boot/uboot/uboot.mk: add binary u-boot.elf support
  2022-11-23 14:31 [Buildroot] [PATCH v4 1/1] boot/uboot/uboot.mk: add binary u-boot.elf support Neal Frager via buildroot
@ 2022-11-23 22:30 ` Thomas Petazzoni via buildroot
  2022-11-24 10:24   ` Frager, Neal via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-11-23 22:30 UTC (permalink / raw)
  To: Neal Frager via buildroot; +Cc: luca.ceresoli, Neal Frager

Hello Neal,

On Wed, 23 Nov 2022 07:31:26 -0700
Neal Frager via buildroot <buildroot@buildroot.org> wrote:

> If a user requests a u-boot binary in elf format,
> they may actually want the stripped u-boot.elf version.
> This patch provides the stripped u-boot.elf binary.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>

I've applied to next, after doing some further fixes.

>  config BR2_TARGET_UBOOT_FORMAT_ELF
> +	bool "u-boot"
> +	help
> +	  Configures the u-boot ELF file with debug symbols.

This option does not "configure", it "installs". Also, I'm not sure
having debugging symbols in u-boot is guaranteed, I suppose it depends
on whether debugging is enabled or not. So I changed this to:

+         Install the u-boot image, which is directly the ELF binary
+         for the main U-Boot, potentially with debugging symbols.

> +config BR2_TARGET_UBOOT_FORMAT_BIN_ELF
>  	bool "u-boot.elf"
> +	help
> +	  Configures the u-boot.elf binary version of ELF file.
> +	  Debug symbols are not included in this ELF file.

So I researched a bit more, and this u-boot.elf is produced when
CONFIG_REMAKE_ELF=y in U-Boot. So I changed this to:

+config BR2_TARGET_UBOOT_FORMAT_REMAKE_ELF
        bool "u-boot.elf"
+       help
+         Install the u-boot.elf image, which is produced when
+         CONFIG_REMAKE_ELF=y. It is an ELF image (u-boot.elf)
+         produced from the raw U-Boot binary (u-boot.bin), which may
+         already have been statically relocated and may already have
+         a device-tree appended to it.

The description was taken from the CONFIG_REMAKE_ELF help text in U-Boot.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v4 1/1] boot/uboot/uboot.mk: add binary u-boot.elf support
  2022-11-23 22:30 ` Thomas Petazzoni via buildroot
@ 2022-11-24 10:24   ` Frager, Neal via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Frager, Neal via buildroot @ 2022-11-24 10:24 UTC (permalink / raw)
  To: Thomas Petazzoni, Neal Frager via buildroot; +Cc: luca.ceresoli@bootlin.com

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

Hi Thomas,

> If a user requests a u-boot binary in elf format, they may actually 
> want the stripped u-boot.elf version.
> This patch provides the stripped u-boot.elf binary.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>

> I've applied to next, after doing some further fixes.

Great, thanks!

>  config BR2_TARGET_UBOOT_FORMAT_ELF
> +	bool "u-boot"
> +	help
> +	  Configures the u-boot ELF file with debug symbols.

> This option does not "configure", it "installs". Also, I'm not sure having debugging symbols in u-boot is guaranteed, I suppose it depends on whether debugging is enabled or not. So I changed this to:

> +         Install the u-boot image, which is directly the ELF binary
> +         for the main U-Boot, potentially with debugging symbols.

Good point.  Thanks for correcting this.

> +config BR2_TARGET_UBOOT_FORMAT_BIN_ELF
>  	bool "u-boot.elf"
> +	help
> +	  Configures the u-boot.elf binary version of ELF file.
> +	  Debug symbols are not included in this ELF file.

> So I researched a bit more, and this u-boot.elf is produced when CONFIG_REMAKE_ELF=y in U-Boot. So I changed this to:

> +config BR2_TARGET_UBOOT_FORMAT_REMAKE_ELF
>        bool "u-boot.elf"
> +       help
> +         Install the u-boot.elf image, which is produced when
> +         CONFIG_REMAKE_ELF=y. It is an ELF image (u-boot.elf)
> +         produced from the raw U-Boot binary (u-boot.bin), which may
> +         already have been statically relocated and may already have
> +         a device-tree appended to it.

> The description was taken from the CONFIG_REMAKE_ELF help text in U-Boot.

I agree that using a name that matches the u-boot config option is the right thing to do.  Thanks for verifying this!

Best regards,
Neal Frager
AMD

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 14586 bytes --]

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-11-24 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 14:31 [Buildroot] [PATCH v4 1/1] boot/uboot/uboot.mk: add binary u-boot.elf support Neal Frager via buildroot
2022-11-23 22:30 ` Thomas Petazzoni via buildroot
2022-11-24 10:24   ` Frager, Neal via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox