public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] imx: mkimage: avoid stop CI when required files not exists
@ 2018-10-25  8:32 Peng Fan
  2018-10-25 14:28 ` Anatolij Gustschin
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2018-10-25  8:32 UTC (permalink / raw)
  To: u-boot

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

The script return 1 when the required files not exists, return 0
when files exists. The script will ignore check to u-boot-dtb.bin,
because if there is something wrong to generate u-boot-dtb.bin,
there must be some code error.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2: 
  refine scripts according to Anatolij's suggest.
  Add a check to u-boot-dtb.cfgout when assign DEPFILE_EXISTS
  CI build: https://travis-ci.org/MrVan/u-boot/builds/446043677

 arch/arm/mach-imx/Makefile | 10 ++++++++--
 tools/imx_cntr_image.sh    | 29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100755 tools/imx_cntr_image.sh

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 2d79c71371..72fe23a2b9 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -86,9 +86,13 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cpp_cfg)
 
-IMAGE_TYPE = imximage
 ifeq ($(CONFIG_ARCH_IMX8), y)
-IMAGE_TYPE = imx8image
+CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh
+IMAGE_TYPE := imx8image
+DEPFILE_EXISTS := $(shell if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) u-boot-dtb.cfgout; echo $$?; fi)
+else
+IMAGE_TYPE := imximage
+DEPFILE_EXISTS := 0
 endif
 
 MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
@@ -104,8 +108,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_EXISTS),0)
 	$(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/imx_cntr_image.sh b/tools/imx_cntr_image.sh
new file mode 100755
index 0000000000..4c629e8694
--- /dev/null
+++ b/tools/imx_cntr_image.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# script to check whether the file exists in imximage.cfg for i.MX8
+#
+# usage: $0 <imximage.cfg>
+
+file=$1
+
+blobs=`awk '/^APPEND/ {print $2} /^IMAGE/ || /^DATA/ {print $3}' $file`
+for f in $blobs; do
+	tmp=$srctree/$f
+	if [ $f == "u-boot-dtb.bin" ]; then
+		continue
+	fi
+
+	if [ -f $f ]; then
+		continue
+	fi
+
+	if [ ! -f $tmp ]; then
+		echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2
+		exit 1
+	fi
+
+	sed -in "s;$f;$tmp;" $file
+done
+
+exit 0
-- 
2.14.1

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

* [U-Boot] [PATCH V2] imx: mkimage: avoid stop CI when required files not exists
  2018-10-25  8:32 [U-Boot] [PATCH V2] imx: mkimage: avoid stop CI when required files not exists Peng Fan
@ 2018-10-25 14:28 ` Anatolij Gustschin
  0 siblings, 0 replies; 2+ messages in thread
From: Anatolij Gustschin @ 2018-10-25 14:28 UTC (permalink / raw)
  To: u-boot

On Thu, 25 Oct 2018 08:32:40 +0000
Peng Fan peng.fan at nxp.com wrote:
...
> diff --git a/tools/imx_cntr_image.sh b/tools/imx_cntr_image.sh
> new file mode 100755
> index 0000000000..4c629e8694
> --- /dev/null
> +++ b/tools/imx_cntr_image.sh
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# script to check whether the file exists in imximage.cfg for i.MX8
> +#
> +# usage: $0 <imximage.cfg>
> +
> +file=$1
> +
> +blobs=`awk '/^APPEND/ {print $2} /^IMAGE/ || /^DATA/ {print $3}' $file`

If we want to skip checking for u-boot-dtb.bin, then better drop
DATA pattern matching. This should be okay since we have only one
DATA field and it is for u-boot-dtb.bin.

Please use blobs=`awk '/^APPEND/ {print $2} /^IMAGE/ {print $3}'`

> +for f in $blobs; do
> +	tmp=$srctree/$f
> +	if [ $f == "u-boot-dtb.bin" ]; then
> +		continue
> +	fi

and drop the above string check.

> +
> +	if [ -f $f ]; then
> +		continue
> +	fi
> +
> +	if [ ! -f $tmp ]; then
> +		echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2
> +		exit 1
> +	fi
> +
> +	sed -in "s;$f;$tmp;" $file
> +done
> +
> +exit 0


--
Anatolij

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

end of thread, other threads:[~2018-10-25 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-25  8:32 [U-Boot] [PATCH V2] imx: mkimage: avoid stop CI when required files not exists Peng Fan
2018-10-25 14:28 ` Anatolij Gustschin

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