boot/uboot/uboot.mk: add binary u-boot.elf support
PATCH v4 1/1 boot/uboot/uboot.mk: add binary u-boot.elf support
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.
---V1->V2:
- reduced scope to only 64-bit ARM arch platforms
- non-ARM platforms may not have a u-boot.elf by defaultV2->V3:
- test and verify u-boot.elf exists before copyingV3->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(+)
boot/uboot/Config.in +8 -0
@@ -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"
boot/uboot/uboot.mk +4 -0
@@ -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
Signature · 6 lines
2.17.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Neal,
Quoted 5 lines · On Wed, 23 Nov 2022 07:31:26 -0700 Neal Frager via buildroot…
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 <[email protected]>
I've applied to next, after doing some further fixes.
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_NAND_BIN · line 282
Quoted 4 lines
config
BR2_TARGET_UBOOT_FORMAT_ELFboot/uboot/Config.in +3
-0+ 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.
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_NAND_BIN · line 288
Quoted 5 lines
boot/uboot/Config.in +4
-0+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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Quoted 7 lines
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 <[email protected]>I've applied to next, after doing some further fixes.
Great, thanks!
Review
Quoted 9 lines
config
BR2_TARGET_UBOOT_FORMAT_ELFboot/uboot/Config.in +3
-0+ 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:
(quoted diff) +2
-0+ 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.
Quoted 17 lines
boot/uboot/Config.in +4
-0+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=yin U-Boot. So I changed this to:(quoted diff) +7
-0+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.
Quoted 1 line
The description was taken from the
CONFIG_REMAKE_ELFhelp 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
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot