[U-Boot] [PATCH] imx: mkimage: avoid stop CI when required files not exists

Peng Fan peng.fan at nxp.com
Wed Oct 24 09:49:04 UTC 2018


Introduce a new script to check whether file exists and
use that check in Makefile to avoid break CI system.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/Makefile |  8 ++++++--
 tools/imx8_cntr_image.sh   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100755 tools/imx8_cntr_image.sh

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 2d79c71371..f0157ca93b 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -86,9 +86,11 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cpp_cfg)
 
-IMAGE_TYPE = imximage
+IMAGE_TYPE := imximage
+DEPFILE_EXITS := 1
 ifeq ($(CONFIG_ARCH_IMX8), y)
-IMAGE_TYPE = imx8image
+IMAGE_TYPE := imx8image
+DEPFILE_EXITS := $(shell $(srctree)/tools/imx8_cntr_image.sh $(IMX_CONFIG); echo $$?)
 endif
 
 MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
@@ -104,8 +106,10 @@ MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
 u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log
 
 u-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE
+ifeq ($(DEPFILE_EXITS),1)
 	$(call if_changed,mkimage)
 endif
+endif
 
 MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
 		   -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
diff --git a/tools/imx8_cntr_image.sh b/tools/imx8_cntr_image.sh
new file mode 100755
index 0000000000..f6725d0444
--- /dev/null
+++ b/tools/imx8_cntr_image.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# script to generate FIT image source for K3 Family boards with
+# ATF, OPTEE, SPL and multiple device trees (given on the command line).
+# Inspired from board/sunxi/mksunxi_fit_atf.sh
+#
+# usage: $0 <imximage.cfg>
+
+file=$1
+
+linecount=`cat ${file} | wc -l`
+
+for ((i=1; i<=${linecount}; i++));
+do
+	name=`awk  -F '\t' -F ' '  'NR=='${i}' && /^APPEND/ {print $2}' ${file}`
+	if [ -n "${name}" ]; then
+		if [ ! -f "${name}" ]; then
+			echo "WARNING ${name} not found, resulting binary is not-functional" >&2
+			exit 0
+		fi;
+	fi;
+	name=`awk  -F '\t' -F ' '  'NR=='${i}' && (/^IMAGE/ || /^DATA/) {print $3}' ${file}`
+	if [ -n "${name}" ]; then
+		if [ ! -f "${name}" ]; then
+			echo "WARNING ${name} not found, resulting binary is not-functional" >&2
+			exit 0
+		fi;
+	fi;
+done
+
+exit 1
-- 
2.14.1



More information about the U-Boot mailing list