[PATCH v2 09/21] Makefile: add barebox.elf build target

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jan 6 05:13:59 PST 2026


Hi,

On 1/6/26 1:53 PM, Sascha Hauer wrote:
> Add a build target to create barebox.elf, which provides an ELF format
> version of barebox that can be used for debugging or alternative boot
> scenarios.

I don't find my feedback re: different name for barebox.elf (e.g.
vmbarebox) and use of --strip-all/--strip-section-headers addressed here.

Cheers,
Ahmad

> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> Co-Authored-By: Claude Sonnet 4.5 <noreply at anthropic.com>
> ---
>  Makefile | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 3b31cecc22c431a063b8d2d3c387da487b698e74..aa12b385c779512fe20d33792f4968fed2eec29a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -853,6 +853,9 @@ all: barebox-flash-images
>  endif
>  
>  all: $(symlink-y)
> +ifeq ($(CONFIG_PBL_IMAGE)-$(CONFIG_PBL_IMAGE_NO_PIGGY),y-)
> +all: barebox.elf
> +endif
>  
>  .SECONDEXPANSION:
>  $(symlink-y): $$(or $$(SYMLINK_DEP_$$(@F)),$$(SYMLINK_TARGET_$$(@F))) FORCE
> @@ -1096,6 +1099,14 @@ barebox.fit: images/barebox-$(CONFIG_ARCH_LINUX_NAME).fit
>  barebox.srec: barebox
>  	$(OBJCOPY) -O srec $< $@
>  
> +OBJCOPYFLAGS_barebox.elf = --strip-debug --strip-unneeded \
> +			   --remove-section=.comment \
> +			   --remove-section=.note* \
> +			   --remove-section=.gnu.hash
> +
> +barebox.elf: barebox FORCE
> +	$(call if_changed,objcopy)
> +
>  quiet_cmd_barebox_proper__ = CC      $@
>        cmd_barebox_proper__ = $(CC) -r -o $@ -Wl,--whole-archive $(BAREBOX_OBJS)
>  
> @@ -1378,7 +1389,7 @@ CLEAN_FILES +=	barebox System.map include/generated/barebox_default_env.h \
>                  .tmp_version .tmp_barebox* barebox.bin barebox.map \
>  		.tmp_kallsyms* compile_commands.json \
>  		.tmp_barebox.o barebox.o barebox-flash-image \
> -		barebox.srec barebox.efi
> +		barebox.srec barebox.efi barebox.elf
>  
>  CLEAN_FILES +=	scripts/bareboxenv-target scripts/kernel-install-target \
>  		scripts/bareboxcrc32-target scripts/bareboximd-target \
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list