mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations.
@ 2022-06-07  9:03 Christian Melki
  2022-06-07  9:03 ` [ptxdist] [PATCH 2/2] barebox: Add option to install barebox generated dtbs Christian Melki
  2022-06-09 18:54 ` [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Michael Olbrich
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Melki @ 2022-06-07  9:03 UTC (permalink / raw)
  To: ptxdist

Barebox has been carrying a descriptive barebox-flash-images file
for a while now.
This file contains the generated image files.
So instead of searching for images, let barebox tell us.

Also remove some legacy image and environment handling.
This means that only Barebox >= 2015.12 is supported.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 rules/barebox.make | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/rules/barebox.make b/rules/barebox.make
index 753a47b59..581fd1ff9 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -179,31 +179,16 @@ ifneq ($(strip $(BAREBOX_PROGS_TARGET_y)),)
 endif
 
 	@$(call world/image-clean, BAREBOX)
-	@if [ -d $(BAREBOX_BUILD_DIR)/images ]; then \
-		find $(BAREBOX_BUILD_DIR)/images/ -name "barebox-*.img" | sort | while read image; do \
-			$(call ptx/image-install, BAREBOX, $$image); \
-			if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
-				$(call ptx/image-install-link, BAREBOX, `basename $$image`, barebox-image); \
-			fi; \
-		done; \
-	fi
-	@if [ -e $(IMAGEDIR)/barebox-image ]; then \
-		:; \
-	elif [ -e $(BAREBOX_BUILD_DIR)/barebox-flash-image ]; then \
-		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox-flash-image, barebox-image); \
-	else \
-		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox.bin, barebox-image); \
-	fi
-	@if [ -e $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env ]; then \
-		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env, \
-			barebox-default-environment); \
-	elif [ -e $(BAREBOX_BUILD_DIR)/common/barebox_default_env ]; then \
-		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/common/barebox_default_env, \
-			barebox-default-environment); \
-	elif [ -e $(BAREBOX_BUILD_DIR)/barebox_default_env ]; then \
-		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox_default_env, \
-			barebox-default-environment); \
-	fi
+
+	@$(foreach image, $(shell cat $(BAREBOX_BUILD_DIR)/barebox-flash-images), \
+		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/$(image)); \
+		if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
+			$(call ptx/image-install-link, BAREBOX, $(notdir $(image)), barebox-image); \
+		fi; )
+
+	$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env, \
+		barebox-default-environment); \
+
 	@$(call touch)
 
 # ----------------------------------------------------------------------------
-- 
2.34.1




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

* [ptxdist] [PATCH 2/2] barebox: Add option to install barebox generated dtbs.
  2022-06-07  9:03 [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Christian Melki
@ 2022-06-07  9:03 ` Christian Melki
  2022-06-09 18:54 ` [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Michael Olbrich
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Melki @ 2022-06-07  9:03 UTC (permalink / raw)
  To: ptxdist

Sometimes it's useful to be able to include the barebox-
generated dtb. An example would be the FIP image target
for TF-A and stm32mp1 targets.

Prefix the barebox-installed dtbs with "barebox-" as they can
have the same name as kernel dtbs for example.

This can partly go away if/when barebox decides to promote
dtbs to the barebox-flash-images file.
Although one would probably still want to rename the dtbs
to avoid a name collision.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 platforms/barebox.in | 8 ++++++++
 rules/barebox.make   | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/platforms/barebox.in b/platforms/barebox.in
index c8192f0c9..2a89df074 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -89,6 +89,14 @@ config BAREBOX_BAREBOXENV
 	  environment. Enable this option to access the barebox environment
 	  from the target Linux system.
 
+config BAREBOX_INSTALL_DTBS
+       prompt "install dtbs"
+       bool
+       help
+         Install barebox generated dtbs into the image directory.
+	 These dtbs can, for example, be used when constructing a
+	 FIP image for TF-A boot.
+
 config BAREBOX_BAREBOXCRC32
 	prompt "install 'bareboxcrc32'"
 	bool
diff --git a/rules/barebox.make b/rules/barebox.make
index 581fd1ff9..7aa04f02c 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -180,6 +180,11 @@ endif
 
 	@$(call world/image-clean, BAREBOX)
 
+ifdef PTXCONF_BAREBOX_INSTALL_DTBS
+	@$(foreach dtb, $(shell find $(BAREBOX_BUILD_DIR) -name "*.dtb"), \
+		$(call ptx/image-install, BAREBOX, $(dtb), barebox-$(notdir $(dtb)));)
+endif
+
 	@$(foreach image, $(shell cat $(BAREBOX_BUILD_DIR)/barebox-flash-images), \
 		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/$(image)); \
 		if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
-- 
2.34.1




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

* Re: [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations.
  2022-06-07  9:03 [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Christian Melki
  2022-06-07  9:03 ` [ptxdist] [PATCH 2/2] barebox: Add option to install barebox generated dtbs Christian Melki
@ 2022-06-09 18:54 ` Michael Olbrich
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Olbrich @ 2022-06-09 18:54 UTC (permalink / raw)
  To: Christian Melki; +Cc: ptxdist

On Tue, Jun 07, 2022 at 11:03:49AM +0200, Christian Melki wrote:
> Barebox has been carrying a descriptive barebox-flash-images file
> for a while now.
> This file contains the generated image files.
> So instead of searching for images, let barebox tell us.
> 
> Also remove some legacy image and environment handling.
> This means that only Barebox >= 2015.12 is supported.
> 
> Signed-off-by: Christian Melki <christian.melki@t2data.com>
> ---
>  rules/barebox.make | 35 ++++++++++-------------------------
>  1 file changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/rules/barebox.make b/rules/barebox.make
> index 753a47b59..581fd1ff9 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -179,31 +179,16 @@ ifneq ($(strip $(BAREBOX_PROGS_TARGET_y)),)
>  endif
>  
>  	@$(call world/image-clean, BAREBOX)
> -	@if [ -d $(BAREBOX_BUILD_DIR)/images ]; then \
> -		find $(BAREBOX_BUILD_DIR)/images/ -name "barebox-*.img" | sort | while read image; do \
> -			$(call ptx/image-install, BAREBOX, $$image); \
> -			if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
> -				$(call ptx/image-install-link, BAREBOX, `basename $$image`, barebox-image); \
> -			fi; \
> -		done; \
> -	fi
> -	@if [ -e $(IMAGEDIR)/barebox-image ]; then \
> -		:; \
> -	elif [ -e $(BAREBOX_BUILD_DIR)/barebox-flash-image ]; then \
> -		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox-flash-image, barebox-image); \
> -	else \
> -		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox.bin, barebox-image); \
> -	fi
> -	@if [ -e $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env ]; then \
> -		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env, \
> -			barebox-default-environment); \
> -	elif [ -e $(BAREBOX_BUILD_DIR)/common/barebox_default_env ]; then \
> -		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/common/barebox_default_env, \
> -			barebox-default-environment); \
> -	elif [ -e $(BAREBOX_BUILD_DIR)/barebox_default_env ]; then \
> -		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/barebox_default_env, \
> -			barebox-default-environment); \
> -	fi
> +

For some reason I get "make: /usr/bin/bash: Argument list too long" with
this now. Not sure why this didn't happen with the old version. Please do
the following to fix that:

> +	@$(foreach image, $(shell cat $(BAREBOX_BUILD_DIR)/barebox-flash-images), \
> +		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/$(image)); \

		$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/$(image))$(ptx/nl) \

> +		if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
> +			$(call ptx/image-install-link, BAREBOX, $(notdir $(image)), barebox-image); \
> +		fi; )

		fi$(ptx/nl))

This creates multiple lines and the commands are executed separately. This
shortens the argument list and the error is gone.
As a side benefit, errors are no longer ignored.

> +	$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env, \
> +		barebox-default-environment); \

	@$(call ptx/image-install, BAREBOX, $(BAREBOX_BUILD_DIR)/defaultenv/barebox_zero_env, \
		barebox-default-environment)

Michael

> +
>  	@$(call touch)
>  
>  # ----------------------------------------------------------------------------
> -- 
> 2.34.1
> 
> 
> 

-- 
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 |



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

end of thread, other threads:[~2022-06-09 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07  9:03 [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Christian Melki
2022-06-07  9:03 ` [ptxdist] [PATCH 2/2] barebox: Add option to install barebox generated dtbs Christian Melki
2022-06-09 18:54 ` [ptxdist] [PATCH 1/2] barebox: Simplify/cleanup barebox image installations Michael Olbrich

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