[OpenWrt-Devel] [PATCH 1/3] build: allow custom config names in mkits.sh

Thomas Hebb tommyhebb at gmail.com
Wed Jan 10 05:15:08 EST 2018


This allows us to support the Netgear EX6100v2 and EX6150v2, whose
bootloaders look for specific config names and refuse to boot if
they're not present.

Signed-off-by: Thomas Hebb <tommyhebb at gmail.com>
---
 include/image-commands.mk |  3 ++-
 scripts/mkits.sh          | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 5f0ac6164d..6ad782922a 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -121,7 +121,8 @@ endef
 define Build/fit
 	$(TOPDIR)/scripts/mkits.sh \
 		-D $(DEVICE_NAME) -o $@.its -k $@ \
-		$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
+		$(if $(word 2,$(1)),-d $(word 2,$(1))) \
+		$(if $(word 3,$(1)),-c $(word 3,$(1))) -C $(word 1,$(1)) \
 		-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
 		-A $(LINUX_KARCH) -v $(LINUX_VERSION)
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 8857996eba..e74b5866e8 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -16,7 +16,7 @@
 
 usage() {
 	echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \
-		"-v version -k kernel [-D name -d dtb] -o its_file"
+		"-v version -k kernel [-D name -d dtb -c cfgname] -o its_file"
 	echo -e "\t-A ==> set architecture to 'arch'"
 	echo -e "\t-C ==> set compression type 'comp'"
 	echo -e "\t-a ==> set load address to 'addr' (hex)"
@@ -25,11 +25,14 @@ usage() {
 	echo -e "\t-k ==> include kernel image 'kernel'"
 	echo -e "\t-D ==> human friendly Device Tree Blob 'name'"
 	echo -e "\t-d ==> include Device Tree Blob 'dtb'"
+	echo -e "\t-c ==> name the default config 'cfgname'"
 	echo -e "\t-o ==> create output file 'its_file'"
 	exit 1
 }
 
-while getopts ":A:a:C:D:d:e:k:o:v:" OPTION
+CFGNAME='config at 1'
+
+while getopts ":A:a:C:D:d:e:k:c:o:v:" OPTION
 do
 	case $OPTION in
 		A ) ARCH=$OPTARG;;
@@ -39,6 +42,7 @@ do
 		d ) DTB=$OPTARG;;
 		e ) ENTRY_ADDR=$OPTARG;;
 		k ) KERNEL=$OPTARG;;
+		c ) CFGNAME=$OPTARG;;
 		o ) OUTPUT=$OPTARG;;
 		v ) VERSION=$OPTARG;;
 		* ) echo "Invalid option passed to '$0' (options:$@)"
@@ -104,8 +108,8 @@ ${FDT}
 	};
 
 	configurations {
-		default = \"config at 1\";
-		config at 1 {
+		default = \"${CFGNAME}\";
+		${CFGNAME} {
 			description = \"OpenWrt\";
 			kernel = \"kernel at 1\";
 			fdt = \"fdt at 1\";
-- 
2.15.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