mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] boot/barebox: install all barebox images if none were specified
@ 2024-02-19 21:06 Ahmad Fatoum
  2024-02-25  7:48 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-02-19 21:06 UTC (permalink / raw)
  To: buildroot; +Cc: barebox, Ahmad Fatoum

When selecting barebox in menuconfig, BR2_TARGET_BAREBOX_IMAGE_FILE will
be empty by default, which causes Buildroot to install whatever the
barebox-flash-image symlink points at for barebox versions >= v2012.10.0.

This is an outdated fallback, because barebox-flash-image is only valid
when the barebox build produces a single binary. Virtually all new
defconfigs added in the last couple of years are multiconfig
(CONFIG_PBL_IMAGE=y) however, meaning that a single imx_v7_defconfig
or multi_v8_defconfig will produce many images that support different
boards or even platforms.

As there is no single valid target for barebox-flash-image to point at
in this case, this symlink will point at a non-existing
'multi-image-build' to alert the user to this fact.

As replacement for barebox-flash-image, barebox commit 550cf79c216a
("Make list of flash images and fix link all single image cases") first
released with v2015.12.0 creates a barebox-flash-images file with a list
of all images built by barebox.

Have buildroot use that file as a fallback before trying
barebox-flash-image to have a fallback that works for any recent barebox
defconfig as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 boot/barebox/barebox-aux/Config.in | 9 +++++++--
 boot/barebox/barebox.mk            | 2 ++
 boot/barebox/barebox/Config.in     | 9 +++++++--
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/boot/barebox/barebox-aux/Config.in b/boot/barebox/barebox-aux/Config.in
index d39d24f763e0..4b0201ea6758 100644
--- a/boot/barebox/barebox-aux/Config.in
+++ b/boot/barebox/barebox-aux/Config.in
@@ -36,8 +36,13 @@ config BR2_TARGET_BAREBOX_AUX_IMAGE_FILE
 	  the images directory.
 
 	  If left empty, defaults to:
-	  - barebox.bin for barebox versions older than 2012.10.
-	  - barebox-flash-image for later versions.
+	  - all images as listed in barebox-flash-images (>= v2015.12.0)
+	  - the image pointed at by barebox-flash-image (>= v2012.10.0)
+	  - barebox.bin for even older barebox versions
+
+	  In any case, this only influences the artifacts collected by
+	  Buildroot. They will still need to be referenced from image
+	  packages or flashed separately onto the hardware.
 
 config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV
 	bool "Generate an environment image"
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 4c9df8d6180b..fe366989b9d8 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -151,6 +151,8 @@ $(1)_IMAGE_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_IMAGE_FILE))
 define $(1)_INSTALL_IMAGES_CMDS
 	if test -n "$$($(1)_IMAGE_FILES)"; then \
 		cp -L $$(foreach image,$$($(1)_IMAGE_FILES),$$(@D)/$$(image)) $$(BINARIES_DIR) ; \
+	elif test -e $$(@D)/barebox-flash-images ; then \
+		cp -L $$(foreach image,$$(shell cat $$(@D)/barebox-flash-images),$$(@D)/$$(image)) $$(BINARIES_DIR) ; \
 	elif test -h $$(@D)/barebox-flash-image ; then \
 		cp -L $$(@D)/barebox-flash-image $$(BINARIES_DIR)/barebox.bin ; \
 	else \
diff --git a/boot/barebox/barebox/Config.in b/boot/barebox/barebox/Config.in
index 958e294e40b6..2fd70a84aec3 100644
--- a/boot/barebox/barebox/Config.in
+++ b/boot/barebox/barebox/Config.in
@@ -36,8 +36,13 @@ config BR2_TARGET_BAREBOX_IMAGE_FILE
 	  the images directory.
 
 	  If left empty, defaults to:
-	  - barebox.bin for barebox versions older than 2012.10.
-	  - barebox-flash-image for later versions.
+	  - all images as listed in barebox-flash-images (>= v2015.12.0)
+	  - the image pointed at by barebox-flash-image (>= v2012.10.0)
+	  - barebox.bin for even older barebox versions
+
+	  In any case, this only influences the artifacts collected by
+	  Buildroot. They will still need to be referenced from image
+	  packages or flashed separately onto the hardware.
 
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
-- 
2.39.2




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

end of thread, other threads:[~2024-02-25  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 21:06 [PATCH] boot/barebox: install all barebox images if none were specified Ahmad Fatoum
2024-02-25  7:48 ` Peter Korsgaard

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