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
+
+       @$(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


Reply via email to