kiddin9 6 hónapja
szülő
commit
57c0c84096

+ 1 - 1
devices/common/diy.sh

@@ -36,7 +36,7 @@ git_clone_path openwrt-24.10 https://github.com/immortalwrt/immortalwrt package/
 echo "$(date +"%s")" >version.date
 sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' package/Makefile
 sed -i "s/DEFAULT_PACKAGES:=/DEFAULT_PACKAGES:=luci-app-advancedplus luci-app-firewall luci-app-package-manager luci-app-upnp luci-app-syscontrol luci-proto-wireguard \
-luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs luci-app-log \
+luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs luci-app-log-viewer \
 coremark wget-ssl curl autocore htop nano zram-swap kmod-lib-zstd kmod-tcp-bbr bash openssh-sftp-server block-mount resolveip ds-lite swconfig luci-app-fan luci-app-filemanager /" include/target.mk
 
 sed -i "s/procd-ujail//" include/target.mk

+ 1 - 1
devices/common/patches/wireless.patch

@@ -5,7 +5,7 @@
  					o.rmempty = true;
  
 +					o = ss.taboption("advanced", form.Flag, 'mu_beamformer', _('MU-MIMO'));
-+					o.default = o.disabled;
++					o.default = '1';
 +
 +					o = ss.taboption('advanced', form.Flag, 'vendor_vht', _('Enable 256-QAM'), _('802.11n 2.4Ghz Only'));
 +					o.default = o.disabled;

+ 4 - 7
devices/ipq40xx_generic/diy/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts

@@ -7,8 +7,8 @@
 #include <dt-bindings/soc/qcom,tcsr.h>
 
 / {
-	compatible = "alibaba,ap4220", "qcom,ipq4019";
-	model = "Alibaba AP4220";
+	compatible = "aliyun,ap4220", "qcom,ipq4019";
+	model = "Aliyun AP4220";
 
 	aliases {
 		label-mac-device = &gmac;
@@ -60,7 +60,6 @@
 
 	reg_usb: regulator-usb {
 		compatible = "regulator-fixed";
-		enable-active-low;
 		gpios = <&tlmm 1 GPIO_ACTIVE_LOW>;
 
 		regulator-max-microvolt = <5000000>;
@@ -197,8 +196,6 @@
 	};
 
 	spi-nand@1 {
-		status = "okay";
-
 		compatible = "spi-nand";
 		reg = <1>;
 		spi-max-frequency = <24000000>;
@@ -359,11 +356,11 @@
 &wifi0 {
 	status = "okay";
 
-	qcom,ath10k-calibration-variant = "Alibaba-AP4220";
+	qcom,ath10k-calibration-variant = "Aliyun-AP4220";
 };
 
 &wifi1 {
 	status = "okay";
 
-	qcom,ath10k-calibration-variant = "Alibaba-AP4220";
+	qcom,ath10k-calibration-variant = "Aliyun-AP4220";
 };

+ 12 - 12
devices/ipq40xx_generic/patches/ap4220.patch

@@ -51,7 +51,7 @@ index 717158b0425ea5..dfa22e4ed0e68e 100644
  
  case "$board" in
  alfa-network,ap120c-ac|\
-+alibaba,ap4220|\
++aliyun,ap4220|\
  devolo,magic-2-wifi-next|\
  edgecore,ecw5211|\
  glinet,gl-a1300 |\
@@ -63,7 +63,7 @@ index 07d5c90c441558..d8b6abbb3b087e 100644
  
  ALLWIFIBOARDS:= \
  	8devices_mango \
-+	alibaba_ap4220 \
++	aliyun_ap4220 \
  	arcadyan_aw1000 \
  	asus_rt-ax89x \
  	buffalo_wxr-5950ax12 \
@@ -71,7 +71,7 @@ index 07d5c90c441558..d8b6abbb3b087e 100644
  #   board-<devicename>.<qca4019|qca9888|qca9889|qca9984|qca99x0|ipq8074>
  
  $(eval $(call generate-ipq-wifi-package,8devices_mango,8devices Mango))
-+$(eval $(call generate-ipq-wifi-package,alibaba_ap4220,Alibaba AP4220))
++$(eval $(call generate-ipq-wifi-package,aliyun_ap4220,Aliyun AP4220))
  $(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))
@@ -83,7 +83,7 @@ index 57dca0e1a2a93a..e26b4aed50b8d1 100644
  		;;
  	8dev,jalapeno|\
  	alfa-network,ap120c-ac|\
-+	alibaba,ap4220|\
++	aliyun,ap4220|\
  	asus,map-ac2200|\
  	cilab,meshpoint-one|\
  	edgecore,ecw5211|\
@@ -91,7 +91,7 @@ index 57dca0e1a2a93a..e26b4aed50b8d1 100644
  	8dev,habanero-dvk)
  		label_mac=$(mtd_get_mac_binary "ART" 0x1006)
  		;;
-+	alibaba,ap4220)
++	aliyun,ap4220)
 +		wan_mac=$(mtd_get_mac_text product_info 0x40)
 +		lan_mac=$(macaddr_add "$wan_mac" 1)
 +		label_mac="$wan_mac"
@@ -107,7 +107,7 @@ index 4a1a0ff31118a3..b40f7a1ba6cc0b 100644
  	;;
  "ath10k/pre-cal-ahb-a000000.wifi.bin")
  	case "$board" in
-+	alibaba,ap4220)
++	aliyun,ap4220)
 +		caldata_extract "ART" 0x1000 0x2f20
 +		ath10k_patch_mac $(macaddr_add "$(mtd_get_mac_text product_info 0x40)" 2)
 +		;;
@@ -118,7 +118,7 @@ index 4a1a0ff31118a3..b40f7a1ba6cc0b 100644
  	;;
  "ath10k/pre-cal-ahb-a800000.wifi.bin")
  	case "$board" in
-+	alibaba,ap4220)
++	aliyun,ap4220)
 +		caldata_extract "ART" 0x5000 0x2f20
 +		ath10k_patch_mac $(macaddr_add "$(mtd_get_mac_text product_info 0x40)" 3)
 +		;;
@@ -135,7 +135,7 @@ index 53a95611487b50..a4e488ca09a028 100644
  		;;
 -	alfa-network,ap120c-ac)
 +	alfa-network,ap120c-ac|\
-+	alibaba,ap4220)
++	aliyun,ap4220)
  		part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
  		if [ "$part" = "rootfs1" ]; then
  			fw_setenv active 2 || exit 1
@@ -147,17 +147,17 @@ index 393bb991f11e6a..59e9caec21793c 100644
  endef
  TARGET_DEVICES += alfa-network_ap120c-ac
  
-+define Device/alibaba_ap4220
++define Device/aliyun_ap4220
 +	$(call Device/FitImage)
 +	$(call Device/UbiFit)
-+	DEVICE_VENDOR := Alibaba
++	DEVICE_VENDOR := Aliyun
 +	DEVICE_MODEL := AP4220
 +	SOC := qcom-ipq4018
 +	BLOCKSIZE := 128k
 +	PAGESIZE := 2048
-+	DEVICE_PACKAGES += ipq-wifi-alibaba_ap4220
++	DEVICE_PACKAGES := ipq-wifi-aliyun_ap4220
 +endef
-+TARGET_DEVICES += alibaba_ap4220
++TARGET_DEVICES += aliyun_ap4220
 +
  define Device/aruba_glenmorangie
  	$(call Device/FitImageLzma)

+ 47 - 34
devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7986a-netcore-n60-pro.dts

@@ -13,61 +13,68 @@
 
 	aliases {
 		serial0 = &uart0;
-		label-mac-device = &gmac0;
 		led-boot = &led_power;
 		led-failsafe = &led_power;
 		led-running = &led_power;
 		led-upgrade = &led_power;
+		label-mac-device = &gmac0;
 	};
 
 	chosen {
-		bootargs-append = " root=/dev/fit0 rootwait";
+		bootargs = "root=/dev/fit0 rootwait";
 		rootdisk = <&ubi_rootdisk>;
 		stdout-path = "serial0:115200n8";
 	};
 
-	memory {
+	memory@40000000 {
 		reg = <0 0x40000000 0 0x20000000>;
 	};
 
-	keys {
+	gpio-keys {
 		compatible = "gpio-keys";
 
-		reset {
+		button-reset {
 			label = "reset";
 			linux,code = <KEY_RESTART>;
 			gpios = <&pio 9 GPIO_ACTIVE_LOW>;
 		};
 
-		mesh {
+		button-mesh {
 			label = "mesh";
 			linux,code = <KEY_WPS_BUTTON>;
 			gpios = <&pio 10 GPIO_ACTIVE_LOW>;
 		};
 	};
 
-	leds {
+	gpio-leds {
 		compatible = "gpio-leds";
 
-		led_power: power {
+		led-0 {
+			color = <LED_COLOR_ID_BLUE>;
+			function = LED_FUNCTION_WLAN;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1tpt";
+		};
+
+		led_power: led-1 {
 			color = <LED_COLOR_ID_BLUE>;
 			function = LED_FUNCTION_POWER;
 			gpios = <&pio 29 GPIO_ACTIVE_LOW>;
 		};
 
-		usb {
+		led-2 {
 			color = <LED_COLOR_ID_BLUE>;
 			function = LED_FUNCTION_USB;
 			gpios = <&pio 30 GPIO_ACTIVE_LOW>;
 		};
 
-		mesh {
+		led-3 {
 			color = <LED_COLOR_ID_BLUE>;
 			function = LED_FUNCTION_WPS;
 			gpios = <&pio 31 GPIO_ACTIVE_LOW>;
 		};
 
-		wan {
+		led-4 {
 			color = <LED_COLOR_ID_BLUE>;
 			function = LED_FUNCTION_WAN;
 			gpios = <&pio 32 GPIO_ACTIVE_LOW>;
@@ -105,7 +112,7 @@
 		reg = <0>;
 		phy-mode = "2500base-x";
 
-		nvmem-cells = <&macaddr_lan>;
+		nvmem-cells = <&macaddr_factory_1fef20>;
 		nvmem-cell-names = "mac-address";
 
 		fixed-link {
@@ -121,7 +128,7 @@
 		phy-handle = <&phy6>;
 		phy-mode = "2500base-x";
 
-		nvmem-cells = <&macaddr_wan>;
+		nvmem-cells = <&macaddr_factory_1fef26>;
 		nvmem-cell-names = "mac-address";
 	};
 
@@ -146,12 +153,12 @@
 
 			led@3 {
 				reg = <3>;
-				color = <LED_COLOR_ID_BLUE>;
+				color = <LED_COLOR_ID_GREEN>;
 				function = LED_FUNCTION_LAN;
 			};
 		};
 	};
-	
+
 	phy6: phy@6 {
 		compatible = "ethernet-phy-ieee802.3-c45";
 		reg = <6>;
@@ -162,7 +169,7 @@
 
 			led@3 {
 				reg = <3>;
-				color = <LED_COLOR_ID_BLUE>;
+				color = <LED_COLOR_ID_GREEN>;
 				function = LED_FUNCTION_WAN;
 			};
 		};
@@ -238,45 +245,51 @@
 		mediatek,nmbm;
 		mediatek,bmt-max-ratio = <1>;
 		mediatek,bmt-max-reserved-blocks = <64>;
-
+		
 		partitions {
 			compatible = "fixed-partitions";
 			#address-cells = <1>;
 			#size-cells = <1>;
 
 			partition@0 {
-				label = "BL2";
-				reg = <0x0000000 0x0100000>;
+				label = "bl2";
+				reg = <0x0 0x100000>;
 				read-only;
 			};
 
 			partition@100000 {
 				label = "u-boot-env";
-				reg = <0x0100000 0x0080000>;
+				reg = <0x100000 0x80000>;
 			};
 
-			factory: partition@180000 {
-				label = "Factory";
-				reg = <0x0180000 0x0200000>;
+			partition@180000 {
+				label = "factory";
+				reg = <0x180000 0x200000>;
+				read-only;
 
 				nvmem-layout {
 					compatible = "fixed-layout";
 					#address-cells = <1>;
 					#size-cells = <1>;
 
-					macaddr_lan: macaddr@1fef20 {
+					eeprom_factory_0: eeprom@0 {
+						reg = <0x0 0x1000>;
+					};
+
+					macaddr_factory_1fef20: macaddr@1fef20 {
 						reg = <0x1fef20 0x6>;
 					};
 
-					macaddr_wan: macaddr@1fef26 {
+					macaddr_factory_1fef26: macaddr@1fef26 {
 						reg = <0x1fef26 0x6>;
 					};
 				};
 			};
 
 			partition@380000 {
-				label = "FIP";
-				reg = <0x0380000 0x0200000>;
+				label = "fip";
+				reg = <0x380000 0x200000>;
+				read-only;
 			};
 
 			partition@580000 {
@@ -330,16 +343,16 @@
 	};
 };
 
-&trng {
-	status = "okay";
-};
-
 &ssusb {
 	vusb33-supply = <&reg_3p3v>;
 	vbus-supply = <&reg_5v>;
 	status = "okay";
 };
 
+&trng {
+	status = "okay";
+};
+
 &uart0 {
 	status = "okay";
 };
@@ -353,9 +366,9 @@
 };
 
 &wifi {
-	status = "okay";
+	nvmem-cells = <&eeprom_factory_0>;
+	nvmem-cell-names = "eeprom";
 	pinctrl-names = "default";
 	pinctrl-0 = <&wf_2g_5g_pins>;
-
-	mediatek,mtd-eeprom = <&factory 0x0>;
+	status = "okay";
 };

+ 7 - 56
devices/mediatek_filogic/patches/22-netcore-n60-pro.patch

@@ -1,65 +1,18 @@
-From e3dc0801b6e46883b738386c334e5ef90de76f38 Mon Sep 17 00:00:00 2001
-From: Yujie Zhu <[email protected]>
-Date: Thu, 13 Mar 2025 19:07:20 +0800
-Subject: [PATCH] mediatek: filogic: add Netcore N60 Pro support Hardware
- specification: SoC: MediaTek MT7986A 4x A53 Flash: ESMT F50L1G41LB 128MB RAM:
- M16U4G16256A DDR4 512MB Ethernet: 2x 2.5G + 3x 1G USB: 1x USB 3.0 WiFi1:
- MT7975N 2.4GHz 4T4R WiFi2: MT7975PN 5GHz 4T4R Button: Reset, WPS Power: DC
- 12V 2A
-
-Flash instructions:
-
-    Connect to the router using ssh or telnet,
-    username: useradmin, password is the web
-    login password of the router.
-    Use scp to upload bl31-uboot.fip and flash:
-    "mtd write xxx-bl31-uboot.fip FIP"
-    "mtd erase ubi"
-    Connect to the router via the Lan port,
-    set a static ip of your PC.
-    (ip 192.168.1.254, gateway 192.168.1.1)
-    Download initramfs image, reboot router,
-    waiting for tftp recovery to complete.
-    After openwrt boots up, perform sysupgrade.
-
-Note:
-
-    Back up all mtd partitions before flashing.
-
-Signed-off-by: Yujie Zhu <[email protected]>
----
- .../uboot-envtools/files/mediatek_filogic     |   1 +
- package/boot/uboot-mediatek/Makefile          |  13 +
- .../patches/461-add-netcore-n60-pro.patch     | 378 ++++++++++++++++++
- .../mediatek/dts/mt7986a-netcore-n60-pro.dts  | 338 ++++++++++++++++
- .../filogic/base-files/etc/board.d/01_leds    |   3 +
- .../filogic/base-files/etc/board.d/02_network |   1 +
- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac   |   3 +-
- .../base-files/lib/upgrade/platform.sh        |   1 +
- target/linux/mediatek/image/filogic.mk        |  25 ++
- 9 files changed, 762 insertions(+), 1 deletion(-)
- create mode 100644 package/boot/uboot-mediatek/patches/461-add-netcore-n60-pro.patch
- create mode 100644 target/linux/mediatek/dts/mt7986a-netcore-n60-pro.dts
-
-diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
-index 4e1d10a4dcc196..02781280186286 100644
 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
 +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
-@@ -70,6 +70,12 @@ mercusys,mr90x-v1-ubi)
+@@ -70,6 +70,11 @@ mercusys,mr90x-v1-ubi)
  netgear,wax220)
  	ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0"
  	;;
 +netcore,n60-pro)
-+	ucidef_set_led_netdev "wanlink" "WANLINK" "mdio-bus:06:blue:wan" "eth1" "link tx rx"
-+	ucidef_set_led_netdev "lan-1" "lan-1" "mdio-bus:05:blue:lan" "lan1" "link tx rx"
-+	ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" "link"
-+	ucidef_set_led_netdev "wifi-5g" "WIFI-5G" "blue:wifi5g" "phy0-ap0" "link tx rx"
++	ucidef_set_led_netdev "lan1" "LAN1" "mdio-bus:05:green:lan" "lan1" "link tx rx"
++	ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:06:green:wan" "eth1" "tx rx"
++	ucidef_set_led_netdev "wanlink" "WANLINK" "blue:wan" "eth1" "link"
 +	;;
  nokia,ea0326gmp)
  	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link"
  	ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link"
-diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
-index e9f63938b2d34d..9fb2cb8269499c 100644
+
 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
 +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
 @@ -42,7 +42,7 @@ mediatek_setup_interfaces()
@@ -71,8 +24,7 @@ index e9f63938b2d34d..9fb2cb8269499c 100644
  	ruijie,rg-x60-pro|\
  	unielec,u7981-01*|\
  	zbtlink,zbt-z8102ax|\
-diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
-index 061cbf975c2498..c83b4089c06f6d 100644
+
 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
 +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
 @@ -105,7 +105,8 @@ case "$board" in
@@ -85,8 +37,7 @@ index 061cbf975c2498..c83b4089c06f6d 100644
  		# Originally, phy1 is phy0 mac with LA bit set. However, this would conflict
  		# addresses on multiple VIFs with the other radio. Use label mac to set LA bit.
  		[ "$PHYNBR" = "1" ] && macaddr_setbit_la $(get_mac_label) > /sys${DEVPATH}/macaddress
-diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
-index a019f50461ceff..3071fc1bdc903d 100644
+
 --- a/target/linux/mediatek/image/filogic.mk
 +++ b/target/linux/mediatek/image/filogic.mk
 @@ -1203,6 +1203,23 @@ define Device/netcore_n60

+ 1 - 1
devices/mediatek_filogic/patches/34-sl-3000.patch

@@ -68,7 +68,7 @@
  	cmcc,xr30-emmc|\
 +	cmcc,xr30-emmc |\
 +	*sl,3000* |\
-+        *sl,3000-emmc* |\
++	*sl,3000-emmc* |\
  	glinet,gl-mt2500|\
  	glinet,gl-mt6000|\
  	glinet,gl-x3000|\

+ 0 - 102
devices/qualcommax_ipq50xx/diy/scripts/mkits-glinet.sh

@@ -1,102 +0,0 @@
-#!/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
-
-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;;
-	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}"

+ 1 - 1
devices/qualcommax_ipq50xx/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-gl-b3000.dts

@@ -8,7 +8,7 @@
 #include <dt-bindings/leds/common.h>
 
 / {
-	model = "GL.iNet B3000, Inc. IPQ5018/AP-MP03.5-C1";
+	model = "GL.iNet GL-B3000";
 	compatible ="glinet,gl-b3000", "qcom,ipq5018";
 
 	aliases {

+ 47 - 0
devices/qualcommax_ipq50xx/diy/target/linux/qualcommax/image/glinet_gl-b3000.scr

@@ -0,0 +1,47 @@
+if test "x$verbose" = "x"; then
+    failedmsg=\'[failed]\'
+else
+    failedmsg='######################################## Failed'
+fi
+
+if test -n $soc_hw_version; then
+    if test "$soc_hw_version" = "20180100" || test "$soc_hw_version" = "20180101" ; then
+        echo 'soc_hw_version : Validation success'
+    else
+        echo 'soc_hw_version : did not match, aborting upgrade'
+        exit 1
+    fi
+else
+    echo 'soc_hw_version : unknown, skipping validation'
+fi
+
+if test "$machid" = "8040004" ; then
+    echo 'machid : Validation success'
+else
+    echo 'machid : unknown, aborting upgrade'
+    exit 1
+fi
+
+if test "x$verbose" = "x"; then
+    echo \\c'Flashing ubi:                                          '
+    setenv stdout nulldev
+else
+    echo '######################################## Flashing ubi: Started'
+fi
+
+failreason='error: failed on image extraction'
+imxtract $imgaddr ubi || setenv stdout serial && echo "$failedmsg" && echo "$failreason" && exit 1
+failreason='error: failed on partition erase'
+nand device 0 && nand erase 0x00800000 0x07800000 || setenv stdout serial && echo "$failedmsg" && echo "$failreason" && exit 1
+failreason='error: failed on partition write'
+nand write $fileaddr 0x00800000 0x3520000 || setenv stdout serial && echo "$failedmsg" && echo "$failreason" && exit 1
+if test "x$verbose" = "x"; then
+    setenv stdout serial
+    echo '[ done ]'
+    setenv stdout nulldev
+    setenv stdout serial
+else
+    echo '######################################## Flashing ubi: Done'
+fi
+
+exit 0

+ 119 - 36
devices/qualcommax_ipq50xx/patches/diy.patch

@@ -1,27 +1,25 @@
 --- a/include/image-commands.mk
 +++ b/include/image-commands.mk
-@@ -494,6 +494,26 @@ define Build/lzma-no-dict
+@@ -494,6 +494,24 @@ define Build/lzma-no-dict
  	@mv [email protected] $@
  endef
  
 +define Build/gl-factory
 +	$(eval GL_NAME := $(subst $(comma),_,$(word 1,$(SUPPORTED_DEVICES))))
-+	$(eval GL_INCLUDE := $(STAGING_DIR)/usr/include/glinet-uboot-scr)
-+	$(eval GL_SCRIPT := $(GL_INCLUDE)/$(GL_NAME).scr)
 +	$(eval GL_IMGK := $(KDIR_TMP)/$(DEVICE_IMG_PREFIX)-squashfs-factory.img)
 +	$(eval GL_ITS := $(KDIR_TMP)/$(GL_NAME).its)
-+	$(if $(wildcard $(GL_INCLUDE)/*),$(CP) $(GL_INCLUDE)/* $(KDIR_TMP)/) \
++	$(if $(wildcard $(BOOT_SCRIPT)),$(CP) $(BOOT_SCRIPT) $(KDIR_TMP)/) \
 +
 +	$(TOPDIR)/scripts/mkits-glinet.sh \
-+		$(if $(wildcard $(GL_SCRIPT)),-s $(GL_SCRIPT)) \
++		$(if $(and $(wildcard $(BOOT_SCRIPT)),\
++		$(findstring --with-uboot-scr,$(word 1,$(1)))),\
++		-s $(BOOT_SCRIPT)) \
 +		-f $(GL_IMGK) \
-+		-o $(GL_ITS)
++		-o $(GL_ITS) \
 +
 +	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f \
 +		$(GL_ITS) \
-+		$(GL_IMGK) \
-+
-+	$(RM) $(GL_ITS) $(GL_SCRIPT)
++		$(GL_IMGK)
 +endef
 +
  define Build/moxa-encode-fw
@@ -45,7 +43,7 @@
 
 --- a/target/linux/qualcommax/image/ipq50xx.mk
 +++ b/target/linux/qualcommax/image/ipq50xx.mk
-@@ -41,6 +41,54 @@ define Device/linksys_mx5500
+@@ -41,6 +41,55 @@ define Device/linksys_mx5500
  endef
  TARGET_DEVICES += linksys_mx5500
  
@@ -74,6 +72,7 @@
 +	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 := \
@@ -146,7 +145,9 @@
 
 --- 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,7 @@
+@@ -1,7 +1,9 @@
++. /lib/upgrade/common.sh
++
  PART_NAME=firmware
  REQUIRE_IMAGE_METADATA=1
  
@@ -155,36 +156,15 @@
  RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
  
  remove_oem_ubi_volume() {
-@@ -69,8 +69,126 @@ platform_check_image() {
+@@ -69,8 +71,105 @@ platform_check_image() {
  	return 0;
  }
  
 +glinet_validate_firmware() {
-+	local type='67'
-+	local ubi_magic='55 42 49 23'
-+	local img_magic='d0 0d fe ed'
-+	local sys_magic='73 79 73 75'
++	local type=$(identify_magic_long $(get_magic_long $1))
++	if [ "$type" = "unknown 73797375" ]; then type="sys"; fi
 +
-+	# ubi type firmware
-+	local is_ubi=$( hexdump -C -n 4 "$1" | grep "$ubi_magic" | wc -c )
-+	if [ ${is_ubi} == ${type} ]; then
-+		echo "ubi"
-+		return
-+	fi
-+	# img type firmware
-+	local is_fit=$( hexdump -C -n 4 "$1" | grep "$img_magic" | wc -c )
-+	if [ ${is_fit} == ${type} ]; then
-+		echo "fit"
-+		return
-+	fi
-+	# sysupgrade-tar type firmware
-+	local is_sys=$( hexdump -C -n 4 "$1" | grep "$sys_magic" | wc -c )
-+	if [ ${is_sys} == ${type} ]; then
-+		echo "sys"
-+		return
-+	fi
-+	# Invalid firmware
-+	echo "error"
++	echo "$type"
 +}
 +
 +glinet_do_fit_upgrade() {
@@ -367,3 +347,106 @@
  $(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
++
++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;;
++	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}"
+