diff mbox series

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

Message ID ade0e80d1533359b62664ac98adfbc374d199d90.1515579309.git.tommyhebb@gmail.com
State Superseded
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,1/3] build: allow custom config names in mkits.sh | expand

Commit Message

Tom Hebb Jan. 10, 2018, 10:15 a.m. UTC
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@gmail.com>
---
 include/image-commands.mk |  3 ++-
 scripts/mkits.sh          | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
diff mbox series

Patch

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@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@1\";
-		config@1 {
+		default = \"${CFGNAME}\";
+		${CFGNAME} {
 			description = \"OpenWrt\";
 			kernel = \"kernel@1\";
 			fdt = \"fdt@1\";