[OpenWrt-Devel] [PATCH 1/2] build: make device-tree arg optional in mkits.sh

Mathieu Olivari mathieu at qca.qualcomm.com
Thu Apr 30 19:35:24 EDT 2015


mkits.sh help currently shows dtb file as optional, but generates an
invalid its file when this option is unspecified.

We're fixing this problem by removing the use of the sed command and
just including variables instead.

Signed-off-by: Mathieu Olivari <mathieu at qca.qualcomm.com>
---
 scripts/mkits.sh | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index c360c73..6b5100e 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -55,6 +55,25 @@ fi
 
 ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'`
 
+# Conditionally create fdt information
+if [ -n "${DTB}" ]; then
+	FDT="
+		fdt at 1 {
+			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
+			data = /incbin/(\"${DTB}\");
+			type = \"flat_dt\";
+			arch = \"${ARCH}\";
+			compression = \"none\";
+			hash at 1 {
+				algo = \"crc32\";
+			};
+			hash at 2 {
+				algo = \"sha1\";
+			};
+		};
+"
+fi
+
 # Create a default, fully populated DTS file
 DATA="/dts-v1/;
 
@@ -80,19 +99,8 @@ DATA="/dts-v1/;
 			};
 		};
 
-		fdt at 1 {
-			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
-			data = /incbin/(\"${DTB}\");
-			type = \"flat_dt\";
-			arch = \"${ARCH}\";
-			compression = \"none\";
-			hash at 1 {
-				algo = \"crc32\";
-			};
-			hash at 2 {
-				algo = \"sha1\";
-			};
-		};
+${FDT}
+
 	};
 
 	configurations {
@@ -105,11 +113,5 @@ DATA="/dts-v1/;
 	};
 };"
 
-# Conditionally strip fdt information out of tree
-if [ -z "${DTB}" ]; then
-	DATA=`echo "$DATA" | sed '/start fdt/,/end fdt/d'`
-	DATA=`echo "$DATA" | sed '/fdt/d'`
-fi
-
 # Write .its file to disk
 echo "$DATA" > ${OUTPUT}
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list