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 <[email protected]>
> ---
>  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 |

Reply via email to