|
|
@@ -1,49 +1,44 @@
|
|
|
--- a/include/image-commands.mk
|
|
|
+++ b/include/image-commands.mk
|
|
|
-@@ -494,6 +494,24 @@ define Build/lzma-no-dict
|
|
|
- @mv [email protected] $@
|
|
|
+@@ -502,6 +502,34 @@ define Build/kernel-bin
|
|
|
+ cp $< $@
|
|
|
endef
|
|
|
|
|
|
-+define Build/gl-factory
|
|
|
-+ $(eval GL_NAME := $(subst $(comma),_,$(word 1,$(SUPPORTED_DEVICES))))
|
|
|
++define Build/gl-qsdk-factory
|
|
|
++ $(eval GL_NAME := $(call param_get_default,type,$(1),$(DEVICE_NAME)))
|
|
|
+ $(eval GL_IMGK := $(KDIR_TMP)/$(DEVICE_IMG_PREFIX)-squashfs-factory.img)
|
|
|
+ $(eval GL_ITS := $(KDIR_TMP)/$(GL_NAME).its)
|
|
|
-+ $(if $(wildcard $(BOOT_SCRIPT)),$(CP) $(BOOT_SCRIPT) $(KDIR_TMP)/) \
|
|
|
++ $(eval GL_UBI := "ubi")
|
|
|
+
|
|
|
-+ $(TOPDIR)/scripts/mkits-glinet.sh \
|
|
|
-+ $(if $(and $(wildcard $(BOOT_SCRIPT)),\
|
|
|
-+ $(findstring --with-uboot-scr,$(word 1,$(1)))),\
|
|
|
-+ -s $(BOOT_SCRIPT)) \
|
|
|
-+ -f $(GL_IMGK) \
|
|
|
-+ -o $(GL_ITS) \
|
|
|
++ $(CP) $(BOOT_SCRIPT) $(KDIR_TMP)/
|
|
|
++ $(shell mv $(GL_IMGK) $(GL_IMGK).tmp)
|
|
|
++
|
|
|
++ sed -i "s/rootfs_size/`wc -c $(GL_IMGK) | \
|
|
|
++ cut -d " " -f 1 | xargs printf "0x%x"`/g" $(KDIR_TMP)/$(BOOT_SCRIPT);
|
|
|
++
|
|
|
++ $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
|
|
|
++ $(GL_ITS) \
|
|
|
++ $(GL_UBI) \
|
|
|
++ $(GL_IMGK) \
|
|
|
++ $(BOOT_SCRIPT)
|
|
|
+
|
|
|
+ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f \
|
|
|
+ $(GL_ITS) \
|
|
|
+ $(GL_IMGK)
|
|
|
++
|
|
|
++ $(RM) \
|
|
|
++ $(GL_ITS) \
|
|
|
++ $(GL_IMGK).tmp \
|
|
|
++ $(KDIR_TMP)/$(notdir $(BOOT_SCRIPT))
|
|
|
+endef
|
|
|
+
|
|
|
- define Build/moxa-encode-fw
|
|
|
- $(TOPDIR)/scripts/moxa-encode-fw.py \
|
|
|
- --input $@ \
|
|
|
-
|
|
|
---- a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx
|
|
|
-+++ b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx
|
|
|
-@@ -8,6 +8,11 @@ touch /etc/config/ubootenv
|
|
|
- board=$(board_name)
|
|
|
-
|
|
|
- case "$board" in
|
|
|
-+glinet,gl-b3000)
|
|
|
-+ idx="$(find_mtd_index 0:APPSBLENV)"
|
|
|
-+ [ -n "$idx" ] && \
|
|
|
-+ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
|
|
|
-+ ;;
|
|
|
- linksys,mr5500|\
|
|
|
- linksys,mx2000|\
|
|
|
- linksys,mx5500|\
|
|
|
+ define Build/linksys-image
|
|
|
+ let \
|
|
|
+ size="$$(stat -c%s $@)" \
|
|
|
|
|
|
--- a/target/linux/qualcommax/image/ipq50xx.mk
|
|
|
+++ b/target/linux/qualcommax/image/ipq50xx.mk
|
|
|
-@@ -41,6 +41,55 @@ define Device/linksys_mx5500
|
|
|
+@@ -41,6 +41,33 @@ define Device/linksys_mx5500
|
|
|
endef
|
|
|
TARGET_DEVICES += linksys_mx5500
|
|
|
|
|
|
@@ -60,28 +55,6 @@
|
|
|
+endef
|
|
|
+TARGET_DEVICES += cmcc_rax3000q
|
|
|
+
|
|
|
-+define Device/glinet_gl-b3000
|
|
|
-+ $(call Device/FitImage)
|
|
|
-+ $(call Device/UbiFit)
|
|
|
-+ DEVICE_VENDOR := GL.iNET
|
|
|
-+ DEVICE_MODEL := GL-B3000
|
|
|
-+ SOC := ipq5018
|
|
|
-+ KERNEL_LOADADDR := 0x41080000
|
|
|
-+ BLOCKSIZE := 128k
|
|
|
-+ PAGESIZE := 2048
|
|
|
-+ NAND_SIZE := 128
|
|
|
-+ DEVICE_DTS_CONFIG := [email protected]
|
|
|
-+ SUPPORTED_DEVICES += b3000
|
|
|
-+ BOOT_SCRIPT:= glinet_gl-b3000.scr
|
|
|
-+ IMAGES := factory.img
|
|
|
-+ IMAGE/factory.img := append-ubi | gl-factory --with-uboot-scr | append-metadata
|
|
|
-+ DEVICE_PACKAGES := \
|
|
|
-+ ath11k-firmware-qcn6122 \
|
|
|
-+ ipq-wifi-glinet_gl-b3000 \
|
|
|
-+ dumpimage
|
|
|
-+endef
|
|
|
-+TARGET_DEVICES += glinet_gl-b3000
|
|
|
-+
|
|
|
+define Device/jdcloud_re-cs-03
|
|
|
+ $(call Device/FitImage)
|
|
|
+ $(call Device/EmmcImage)
|
|
|
@@ -102,13 +75,7 @@
|
|
|
|
|
|
--- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network
|
|
|
+++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network
|
|
|
-@@ -7,9 +7,14 @@ ipq50xx_setup_interfaces()
|
|
|
- {
|
|
|
- local board="$1"
|
|
|
- case $board in
|
|
|
-+ glinet,gl-b3000)
|
|
|
-+ ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
|
|
|
-+ ;;
|
|
|
+@@ -13,6 +13,8 @@ ipq50xx_setup_interfaces()
|
|
|
linksys,mr5500)
|
|
|
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
|
|
;;
|
|
|
@@ -117,143 +84,13 @@
|
|
|
linksys,mx2000|\
|
|
|
linksys,mx5500|\
|
|
|
linksys,spnmx56)
|
|
|
-@@ -18,9 +23,24 @@ ipq50xx_setup_interfaces()
|
|
|
- esac
|
|
|
- }
|
|
|
-
|
|
|
-+ipq50xx_setup_macs()
|
|
|
-+{
|
|
|
-+ local board="$1"
|
|
|
-+ local lan_mac=""
|
|
|
-+
|
|
|
-+ case "$board" in
|
|
|
-+ glinet,gl-b3000)
|
|
|
-+ lan_mac=$(macaddr_add $(get_mac_label_dt) 2)
|
|
|
-+ ;;
|
|
|
-+ esac
|
|
|
-+
|
|
|
-+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
|
|
-+}
|
|
|
-+
|
|
|
- board_config_update
|
|
|
- board=$(board_name)
|
|
|
- ipq50xx_setup_interfaces $board
|
|
|
-+ipq50xx_setup_macs $board
|
|
|
- board_config_flush
|
|
|
-
|
|
|
- exit 0
|
|
|
|
|
|
--- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh
|
|
|
+++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh
|
|
|
-@@ -1,7 +1,9 @@
|
|
|
-+. /lib/upgrade/common.sh
|
|
|
-+
|
|
|
- PART_NAME=firmware
|
|
|
- REQUIRE_IMAGE_METADATA=1
|
|
|
-
|
|
|
--RAMFS_COPY_BIN='fw_printenv fw_setenv head'
|
|
|
-+RAMFS_COPY_BIN='dumpimage fw_printenv fw_setenv head'
|
|
|
- RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
|
|
|
-
|
|
|
- remove_oem_ubi_volume() {
|
|
|
-@@ -69,8 +71,105 @@ platform_check_image() {
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
-+glinet_validate_firmware() {
|
|
|
-+ local type=$(identify_magic_long $(get_magic_long $1))
|
|
|
-+ if [ "$type" = "unknown 73797375" ]; then type="sys"; fi
|
|
|
-+
|
|
|
-+ echo "$type"
|
|
|
-+}
|
|
|
-+
|
|
|
-+glinet_do_fit_upgrade() {
|
|
|
-+ echo -n "fit: Extract [ FIT IMAGE ] -x-x-> [ ubi.bin ] ... "
|
|
|
-+ local ubi=/tmp/ubi.bin
|
|
|
-+ local part=$(dumpimage -l /tmp/firmware.bin | grep -o "Image [0-9] (ubi)" | cut -f2 -d" ")
|
|
|
-+
|
|
|
-+ local ubibin=$( dumpimage -T flat_dt -p ${part} -o "$ubi" $1 )
|
|
|
-+ if [ -s "$ubi" ]; then
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ local ubiMd5=$(cat $ubi | md5sum | cut -f1 -d" ")
|
|
|
-+ local ubi_size=$( cat "$ubi" | wc -c )
|
|
|
-+ echo -n "fit-copy: [ ubi.bin ] -c-c-> [ firmware.bin ] ... "
|
|
|
-+ mv "$ubi" "$1"
|
|
|
-+ local firmMd5=$(cat $1 | md5sum | cut -f1 -d" ")
|
|
|
-+ local firm_size=$( cat $1 | wc -c )
|
|
|
-+ if [ ${firm_size} -eq ${ubi_size} ] && [ "$ubiMd5" = "$firmMd5" ]; then
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ echo "fit-copy: Copied "$firm_size" / "$ubi_size" bytes into firmware.bin"
|
|
|
-+ echo "fit-copy: MD5 CHECK: [ OK ]"
|
|
|
-+ echo "$ubiMd5 <=> $firmMd5"
|
|
|
-+ echo "fit: Successfully Extracted UBI from FIT IMAGE"
|
|
|
-+ echo "fit: Proceeding with sysupgrade .."
|
|
|
-+ nand_do_upgrade "$1"
|
|
|
-+ return
|
|
|
-+ fi
|
|
|
-+ echo "[ FAILED ] !!"
|
|
|
-+ echo "fit-copy: Copied "$firm_size" / "$ubi_size" bytes into firmware.bin"
|
|
|
-+ echo "ERROR: Failed to Copy UBI into firmware.bin !!"
|
|
|
-+ echo "fit: Terminating sysupgrade .."
|
|
|
-+ exit 1
|
|
|
-+ fi
|
|
|
-+ echo "[ FAILED ] !!"
|
|
|
-+ echo "fit-extract: Failed to Create Temp File ubi.bin !!"
|
|
|
-+ echo "ERROR: Failed to Extract UBI from FIT IMAGE !!"
|
|
|
-+ echo "fit: Terminating sysupgrade .."
|
|
|
-+ exit 1
|
|
|
-+}
|
|
|
-+
|
|
|
-+glinet_do_ubi_upgrade() {
|
|
|
-+ echo -n "ubi: Removing Metadata Trailer from the UBI Volume ... "
|
|
|
-+
|
|
|
-+ local metadata=$(fwtool -q -t -i /dev/null "$1")
|
|
|
-+ if [ -s $1 ]; then
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ echo "ubi-meta: Successfully Removed Metadata from UBI Volume"
|
|
|
-+ echo "ubi: Proceeding with sysupgrade .."
|
|
|
-+ nand_do_upgrade "$1"
|
|
|
-+ return
|
|
|
-+ fi
|
|
|
-+ echo "[ FAILED ] !!"
|
|
|
-+ echo "ubi-meta: Cannot remove Metadata, the Files is Empty !!"
|
|
|
-+ echo "ERROR: Failed to Remove Metadata Trailer from UBI Volume !!"
|
|
|
-+ echo "ubi: Terminating sysupgrade .."
|
|
|
-+ exit 1
|
|
|
-+}
|
|
|
-+
|
|
|
- platform_do_upgrade() {
|
|
|
- case "$(board_name)" in
|
|
|
-+ glinet,gl-b3000)
|
|
|
-+ CI_UBIPART="rootfs"
|
|
|
-+ echo -n "Validating Firmware ... "
|
|
|
-+ case $(glinet_validate_firmware $1) in
|
|
|
-+ ubi)
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ echo "ubi-main: Firmware is Valid: ubi"
|
|
|
-+ echo "ubi-main: Upgrading Firmware via [ UBI BIN ]"
|
|
|
-+ glinet_do_ubi_upgrade $1
|
|
|
-+ ;;
|
|
|
-+ fit)
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ echo "fit-main: Firmware is Valid: fit"
|
|
|
-+ echo "fit-main: Upgrading Firmware via [ FIT IMAGE ]"
|
|
|
-+ glinet_do_fit_upgrade $1
|
|
|
-+ ;;
|
|
|
-+ sys)
|
|
|
-+ echo "[ OK ]"
|
|
|
-+ echo "sys-main: Firmware is Valid: sysupgrade-tar"
|
|
|
-+ echo "sys-main: Upgrading Firmware via [ SYSUPGRADE-TAR ]"
|
|
|
-+ nand_do_upgrade $1
|
|
|
-+ ;;
|
|
|
-+ *)
|
|
|
-+ echo "[ FAILED ] !!"
|
|
|
-+ echo "main: Firmware Validation Failed !!"
|
|
|
-+ echo "main: Terminating sysupgrade .."
|
|
|
-+ exit 1
|
|
|
-+ ;;
|
|
|
-+ esac
|
|
|
-+ ;;
|
|
|
+@@ -74,6 +74,11 @@ platform_do_upgrade() {
|
|
|
+ glinet,gl-b3000)
|
|
|
+ glinet_do_upgrade "$1"
|
|
|
+ ;;
|
|
|
+ jdcloud,re-cs-03)
|
|
|
+ CI_KERNPART="0:HLOS"
|
|
|
+ CI_ROOTPART="rootfs"
|
|
|
@@ -262,7 +99,7 @@
|
|
|
linksys,mr5500|\
|
|
|
linksys,mx2000|\
|
|
|
linksys,mx5500|\
|
|
|
-@@ -84,3 +202,12 @@ platform_do_upgrade() {
|
|
|
+@@ -87,3 +92,13 @@ platform_do_upgrade() {
|
|
|
;;
|
|
|
esac
|
|
|
}
|
|
|
@@ -275,35 +112,38 @@
|
|
|
+ esac
|
|
|
+ return 0;
|
|
|
+}
|
|
|
++
|
|
|
|
|
|
--- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
|
|
|
+++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
|
|
|
-@@ -9,6 +9,15 @@ board=$(board_name)
|
|
|
- case "$FIRMWARE" in
|
|
|
- "ath11k/IPQ5018/hw1.0/cal-ahb-c000000.wifi.bin")
|
|
|
- case "$board" in
|
|
|
-+ cmcc,rax3000q|\
|
|
|
-+ glinet,gl-b3000)
|
|
|
-+ caldata_extract "0:art" 0x1000 0x20000
|
|
|
-+ ath11k_patch_mac $(macaddr_add $(get_mac_label_dt) 3) 0
|
|
|
-+ ath11k_set_macflag
|
|
|
-+ ;;
|
|
|
+@@ -15,11 +15,15 @@ case "$FIRMWARE" in
|
|
|
+ ath11k_patch_mac $wlan_mac 0
|
|
|
+ ath11k_set_macflag
|
|
|
+ ;;
|
|
|
+- glinet,gl-b3000)
|
|
|
++ glinet,gl-b3000|\
|
|
|
++ cmcc,rax3000q)
|
|
|
+ caldata_extract "0:art" 0x1000 0x20000
|
|
|
+ ath11k_patch_mac $(macaddr_add $(get_mac_label_dt) 3) 0
|
|
|
+ ath11k_set_macflag
|
|
|
+ ;;
|
|
|
+ jdcloud,re-cs-03)
|
|
|
+ caldata_extract_mmc "0:ART" 0x1000 0x20000
|
|
|
+ ;;
|
|
|
linksys,mr5500|\
|
|
|
linksys,mx2000|\
|
|
|
linksys,mx5500|\
|
|
|
-@@ -23,6 +33,15 @@ case "$FIRMWARE" in
|
|
|
- ;;
|
|
|
- "ath11k/QCN6122/hw1.0/cal-ahb-b00a040.wifi1.bin")
|
|
|
- case "$board" in
|
|
|
-+ cmcc,rax3000q|\
|
|
|
-+ glinet,gl-b3000)
|
|
|
-+ caldata_extract "0:art" 0x26800 0x20000
|
|
|
-+ ath11k_patch_mac $(macaddr_add $(get_mac_label_dt) 4) 0
|
|
|
-+ ath11k_set_macflag
|
|
|
-+ ;;
|
|
|
+@@ -40,11 +44,15 @@ case "$FIRMWARE" in
|
|
|
+ ath11k_patch_mac $wlan_mac 0
|
|
|
+ ath11k_set_macflag
|
|
|
+ ;;
|
|
|
+- glinet,gl-b3000)
|
|
|
++ glinet,gl-b3000|\
|
|
|
++ cmcc,rax3000q)
|
|
|
+ caldata_extract "0:art" 0x26800 0x20000
|
|
|
+ ath11k_patch_mac $(macaddr_add $(get_mac_label_dt) 4) 0
|
|
|
+ ath11k_set_macflag
|
|
|
+ ;;
|
|
|
+ jdcloud,re-cs-03)
|
|
|
+ caldata_extract_mmc "0:ART" 0x26800 0x20000
|
|
|
+ ;;
|
|
|
@@ -321,16 +161,15 @@
|
|
|
cmcc_rm2-6 \
|
|
|
compex_wpq873 \
|
|
|
dynalink_dl-wrx36 \
|
|
|
-@@ -40,6 +41,8 @@ ALLWIFIBOARDS:= \
|
|
|
- edimax_cax1800 \
|
|
|
+@@ -41,6 +42,7 @@ ALLWIFIBOARDS:= \
|
|
|
glinet_gl-ax1800 \
|
|
|
glinet_gl-axt1800 \
|
|
|
-+ glinet_gl-b3000 \
|
|
|
+ glinet_gl-b3000 \
|
|
|
+ jdcloud_re-cs-03 \
|
|
|
linksys_homewrk \
|
|
|
linksys_mr5500 \
|
|
|
linksys_mr7350 \
|
|
|
-@@ -178,6 +181,7 @@ $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000))
|
|
|
+@@ -183,6 +185,7 @@ $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000))
|
|
|
$(eval $(call generate-ipq-wifi-package,asus_rt-ax89x,Asus RT-AX89X))
|
|
|
$(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
|
|
|
$(eval $(call generate-ipq-wifi-package,cambiumnetworks_xe34,Cambium Networks XE3-4))
|
|
|
@@ -338,115 +177,73 @@
|
|
|
$(eval $(call generate-ipq-wifi-package,cmcc_rm2-6,CMCC RM2-6))
|
|
|
$(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873))
|
|
|
$(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))
|
|
|
-@@ -185,6 +189,8 @@ $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102))
|
|
|
- $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800))
|
|
|
+@@ -191,6 +194,7 @@ $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800))
|
|
|
$(eval $(call generate-ipq-wifi-package,glinet_gl-ax1800,GL.iNet GL-AX1800))
|
|
|
$(eval $(call generate-ipq-wifi-package,glinet_gl-axt1800,GL.iNet GL-AXT1800))
|
|
|
-+$(eval $(call generate-ipq-wifi-package,glinet_gl-b3000,GL.iNET B3000))
|
|
|
+ $(eval $(call generate-ipq-wifi-package,glinet_gl-b3000,GL.iNet GL-B3000))
|
|
|
+$(eval $(call generate-ipq-wifi-package,jdcloud_re-cs-03,JDCloud RE-CS-03))
|
|
|
$(eval $(call generate-ipq-wifi-package,linksys_homewrk,Linksys HomeWRK))
|
|
|
$(eval $(call generate-ipq-wifi-package,linksys_mr5500,Linksys MR5500))
|
|
|
$(eval $(call generate-ipq-wifi-package,linksys_mr7350,Linksys MR7350))
|
|
|
-diff --git a/scripts/mkits-glinet.sh b/scripts/mkits-glinet.sh
|
|
|
-new file mode 100755
|
|
|
-index 00000000000000..d91c7ef1f94090
|
|
|
---- /dev/null
|
|
|
-+++ b/scripts/mkits-glinet.sh
|
|
|
-@@ -0,0 +1,96 @@
|
|
|
-+#!/bin/sh
|
|
|
-+#
|
|
|
-+# Licensed under the terms of the GNU GPL License version 2 or later.
|
|
|
-+#
|
|
|
-+# Author: Peter Tyser <[email protected]>
|
|
|
-+#
|
|
|
-+# U-Boot firmware supports the booting of images in the Flattened Image
|
|
|
-+# Tree (FIT) format. The FIT format uses a device tree structure to
|
|
|
-+# describe a kernel image, device tree blob, ramdisk, etc. This script
|
|
|
-+# creates an Image Tree Source (.its file) which can be passed to the
|
|
|
-+# 'mkimage' utility to generate an Image Tree Blob (.itb file). The .itb
|
|
|
-+# file can then be booted by U-Boot (or other bootloaders which support
|
|
|
-+# FIT images). See doc/uImage.FIT/howto.txt in U-Boot source code for
|
|
|
-+# additional information on FIT images.
|
|
|
-+#
|
|
|
-+# ^ Original mkits.sh ^
|
|
|
-+################################################################################
|
|
|
-+#
|
|
|
-+# **This script is a Modified Version of mkits.sh**
|
|
|
-+# It has been moddified to produce legacy MultiFit format its files
|
|
|
-+# This script is used,in combination with the oem uboot "flash.scr",to enable uboot
|
|
|
-+# in Openwrt for some new devices.
|
|
|
-+#
|
|
|
-+# At this time, this script is intended for use with the GL.iNet GL-B3000 device only.
|
|
|
-+# If more devices that deploy this method are dicovered, this script can be easily updated
|
|
|
-+# to accomidate support for these additional devices.
|
|
|
-+
|
|
|
-+usage() {
|
|
|
-+ printf "\nUsage: %s -s script -f firmware -d desc -o output" "$(basename "$0")"
|
|
|
-+ printf "\n\t-s ==> path to uboot flash script '</path/to/device_name>.scr'"
|
|
|
-+ printf "\n\t-f ==> path to firmware file: </path/to/firmware> )'"
|
|
|
-+ printf "\n\t-o ==> **Optional**, set the output file name 'Default: flash.its'\n\n"
|
|
|
-+ exit 1
|
|
|
-+}
|
|
|
-+
|
|
|
-+REFERENCE_CHAR='-'
|
|
|
-+SCRIPTNUM=1
|
|
|
-+FIRMNUM=1
|
|
|
+
|
|
|
+--- a/scripts/mkits-qsdk-ipq-image.sh
|
|
|
++++ b/scripts/mkits-qsdk-ipq-image.sh
|
|
|
+@@ -15,16 +15,19 @@
|
|
|
+ #
|
|
|
+
|
|
|
+ usage() {
|
|
|
+- echo "Usage: `basename $0` output img0_name img0_file [[img1_name img1_file] ...]"
|
|
|
++ echo "Usage: `basename $0` output [[device].bootscript] img0_name img0_file [[img1_name img1_file] ...]"
|
|
|
+ exit 1
|
|
|
+ }
|
|
|
+
|
|
|
+ # We need at least 3 arguments
|
|
|
+-[ "$#" -lt 3 ] && usage
|
|
|
++[ "$#" -lt 3 ] && usage || node_type="firmware"
|
|
|
+
|
|
|
+ # Target output file
|
|
|
+ OUTPUT="$1"; shift
|
|
|
+
|
|
|
++# check for bootscript
|
|
|
++[ "${1##*.}" = "bootscript" ] && has_script=true && node_type="script"
|
|
|
+
|
|
|
-+while getopts ":s:f:o:" OPTION
|
|
|
-+do
|
|
|
-+ case $OPTION in
|
|
|
-+ s ) SCRIPT=$OPTARG;;
|
|
|
-+ f ) FIRM=$OPTARG;;
|
|
|
-+ o ) OUTPUT=$OPTARG;;
|
|
|
-+ * ) echo "Invalid option passed to '$0' (options:$*)"
|
|
|
-+ usage;;
|
|
|
+ # Create a default, fully populated DTS file
|
|
|
+ echo "\
|
|
|
+ /dts-v1/;
|
|
|
+@@ -35,17 +38,30 @@ echo "\
|
|
|
+
|
|
|
+ images {" > ${OUTPUT}
|
|
|
+
|
|
|
+-while [ -n "$1" -a -n "$2" ]; do
|
|
|
+- [ -f "$2" ] || usage
|
|
|
++while [ -n "$1" -a -n "$2" ] || [ $has_script ]; do
|
|
|
++ [ -f "$2" ] || [ $has_script ] && has_script= || usage
|
|
|
+
|
|
|
+- name="$1"; shift
|
|
|
+- file="$1"; shift
|
|
|
++ case "$node_type" in
|
|
|
++ script)
|
|
|
++ name="$node_type"
|
|
|
++ file="$1"; shift
|
|
|
++ desc="${file%.*} uboot ${file##*.}"
|
|
|
++ type="$node_type"
|
|
|
++ node_type="firmware"
|
|
|
++ ;;
|
|
|
++ firmware)
|
|
|
++ name="$1"; shift
|
|
|
++ file="$1"; shift
|
|
|
++ desc="$name"
|
|
|
++ type="$node_type"
|
|
|
++ ;;
|
|
|
+ esac
|
|
|
-+done
|
|
|
-+
|
|
|
-+# Make sure user entered required parameter
|
|
|
-+if [ -z "${FIRM}" ]; then usage; fi
|
|
|
-+
|
|
|
-+# use default if no output file name provided
|
|
|
-+if [ -z "${OUTPUT}" ]; then OUTPUT="flash.its"; fi
|
|
|
-+
|
|
|
-+# create uboot script node
|
|
|
-+if [ -n "${SCRIPT}" ]; then
|
|
|
-+SCRIPT_NODE="
|
|
|
-+ script {
|
|
|
-+ description = \"GL.iNET UBOOT UPGRADE V2\";
|
|
|
-+ data = /incbin/(\"$(basename ${SCRIPT})\");
|
|
|
-+ type = \"script\";
|
|
|
-+ arch = \"arm\";
|
|
|
-+ os = \"linux\";
|
|
|
-+ compression = \"none\";
|
|
|
-+ hash${REFERENCE_CHAR}1 {
|
|
|
-+ algo = \"crc32\";
|
|
|
-+ };
|
|
|
-+ };
|
|
|
-+"
|
|
|
-+fi
|
|
|
-+
|
|
|
-+# Create a default, fully populated DTS file
|
|
|
-+DATA="/dts-v1/;
|
|
|
-+/ {
|
|
|
-+ description = \"Flashing nand 800 20000\";
|
|
|
-+ #address-cells = <1>;
|
|
|
-+ images {
|
|
|
-+ ${SCRIPT_NODE}
|
|
|
-+ ubi {
|
|
|
-+ description = \"$(basename ${FIRM})\";
|
|
|
-+ data = /incbin/(\"$(basename ${FIRM})\");
|
|
|
-+ type = \"firmware\";
|
|
|
-+ arch = \"arm\";
|
|
|
-+ os = \"linux\";
|
|
|
-+ compression = \"none\";
|
|
|
-+ hash${REFERENCE_CHAR}1 {
|
|
|
-+ algo = \"crc32\";
|
|
|
-+ };
|
|
|
-+ };
|
|
|
-+ };
|
|
|
-+};"
|
|
|
-+
|
|
|
-+# Write .its file to disk
|
|
|
-+echo "$DATA" > "${OUTPUT}"
|
|
|
-
|
|
|
+
|
|
|
+ echo \
|
|
|
+ " ${name} {
|
|
|
+- description = \"${name}\";
|
|
|
++ description = \"${desc}\";
|
|
|
+ data = /incbin/(\"${file}\");
|
|
|
+- type = \"Firmware\";
|
|
|
++ type = \"${type}\";
|
|
|
+ arch = \"ARM\";
|
|
|
+ compression = \"none\";
|
|
|
+ hash@1 {
|