[PATCH 06/21] kbuild: allow customizing barebox proper binary

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jun 5 04:35:15 PDT 2025


We usually objcopy barebox proper into a linear binary, but for sandbox,
we are going to rely on the OS to do loading and relocation, so let's
make it possible, which BAREBOX_PROPER binary should be the target.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 Makefile        | 10 ++++++----
 images/Makefile |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index ecaf195b726d..8fbe9e9622c2 100644
--- a/Makefile
+++ b/Makefile
@@ -815,18 +815,20 @@ export KBUILD_BINARY ?= barebox.bin
 # Also any assignments in arch/$(SRCARCH)/Makefile take precedence over
 # the default value.
 
+export BAREBOX_PROPER ?= barebox.bin
+
 barebox-flash-images: $(KBUILD_IMAGE)
 	@echo $^ > $@
 
-images: barebox.bin FORCE
+images: $(BAREBOX_PROPER) FORCE
 	$(Q)$(MAKE) $(build)=images $@
-images/%: barebox.bin FORCE
+images/%: $(BAREBOX_PROPER) FORCE
 	$(Q)$(MAKE) $(build)=images $@
 
 ifdef CONFIG_PBL_IMAGE
 SYMLINK_TARGET_barebox.efi = images/barebox-dt-2nd.img
 symlink-$(CONFIG_EFI_STUB) += barebox.efi
-all: barebox.bin images
+all: $(BAREBOX_PROPER) images
 else
 SYMLINK_TARGET_barebox-flash-image = $(KBUILD_IMAGE)
 symlink-y += barebox-flash-image
@@ -1030,7 +1032,7 @@ ifeq ($(INSTALL_PATH),)
 endif
 ifdef CONFIG_PBL_IMAGE
 	$(Q)$(MAKE) $(build)=images __images_install
-	@install -t "$(INSTALL_PATH)" barebox.bin
+	@install -t "$(INSTALL_PATH)" $(BAREBOX_PROPER)
 else
 	@install -t "$(INSTALL_PATH)" $(KBUILD_IMAGE)
 endif
diff --git a/images/Makefile b/images/Makefile
index ca37c054ae9c..40400a95a935 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -143,7 +143,7 @@ $(obj)/barebox.sum: $(obj)/barebox.z FORCE
 
 # barebox.z - compressed barebox binary
 # ----------------------------------------------------------------
-$(obj)/barebox.z: $(obj)/../barebox.bin FORCE
+$(obj)/barebox.z: $(obj)/../$(BAREBOX_PROPER) FORCE
 	$(call if_changed,$(suffix_y))
 
 # %.img - create a copy from another file
-- 
2.39.5




More information about the barebox mailing list