kiddin9 преди 6 месеца
родител
ревизия
3d6cc6d27f

+ 1 - 1
.github/workflows/Openwrt-AutoBuild.yml

@@ -152,7 +152,7 @@ jobs:
         TAG_DATE="$( echo ${TAG_INFO} | jq -r '.data.repository.refs.nodes[] | select(.name | startswith("v24")) | .target.tagger.date' | head -n 1)"
         if [[ $(( ($(date +%s) - $(date -d "$TAG_DATE" +%s)) / 86400 )) -lt 30 ]]; then
         REPO_BRANCH="$( echo ${TAG_INFO} | jq -r '.data.repository.refs.nodes[].name' | grep v24 | head -n 1)"
-        REPO_BRANCH="openwrt-24.10"
+        #REPO_BRANCH="openwrt-24.10"
         else
         REPO_BRANCH="openwrt-24.10"
         fi

+ 1 - 1
devices/common/diy.sh

@@ -62,7 +62,7 @@ git_clone_path master https://github.com/coolsnowwolf/lede mv target/linux/gener
 rm -rf package/system/fstools
 git_clone_path master https://github.com/coolsnowwolf/lede package/system/fstools
 
-rm -rf target/linux/generic/hack-6.6/929-Revert-genetlink* target/linux/generic/hack-6.6/767-net-phy-realtek-add-led*
+rm -rf target/linux/generic/hack-6.6/767-net-phy-realtek-add-led*
 wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-6.6/613-netfilter_optional_tcp_window_check.patch -P target/linux/generic/pending-6.6/
 
 # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \;

+ 51 - 0
devices/common/diy/feeds/luci/modules/luci-base/htdocs/luci-static/resources/tools/github.js

@@ -0,0 +1,51 @@
+'use strict';
+
+return L.Class.extend({
+    desc: function(description, username, project) {
+        var luci_project = 'luci-app-' + project;
+        var title = _('if you have any problem, please click to view the project on GitHub : ') + project;
+        var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + luci_project;
+        var package_label = 'package-' + project.replace(/-/g, '_') + '-default';
+        var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
+
+        return "<table style='border: 0; table-layout: auto;'>" +
+                    "<tr>" +
+                        "<td style='border: 0;'>" + _(description) + "</td>" +
+                        "<td style='border: 0;'>" +
+                            "<table style='border: 0; table-layout: auto;'>" +
+                                "<tr>" +
+                                    "<td style='border: 0;'>" +
+                                        "<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + title + "'>" +
+                                            "<img alt='" + project + "' src='https://img.shields.io/badge/" + package_label +  "' />" +
+                                            "<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
+                                        "</a>" +
+                                        "<a href='https://github.com/" + username + "/" + luci_project + "' target='_blank' title='" + luci_title + "'>" +
+                                            "<img alt='" + luci_project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
+                                            "<img alt='" + luci_project + "' src='https://img.shields.io/github/stars/" + username + "/" + luci_project + "?style=social' />" +
+                                        "</a>" +
+                                    "</td>" +
+                                "</tr>" +
+                            "</table>" +
+                        "</td>" +
+                    "</tr>" +
+                "</table>";
+    },
+
+    luci_desc: function(description, username, project) {
+        var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default';
+        project = 'luci-app-' + project;
+        var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + project;
+        
+        return "<table style='border: 0; table-layout: auto;'>" +
+                    "<tr>" +
+                        "<td style='border: 0;'>" + _(description) + "</td>" +
+                        "<td style='border: 0;'>" +
+                            "<a href='https://github.com/" + username + "/" + project + "' target='_blank' title='" + luci_title + "'>" +
+                                "<img alt='" + project + "' src='https://img.shields.io/badge/" + luci_label + "' />" +
+                                "<img alt='" + project + "' src='https://img.shields.io/github/stars/" + username + "/" + project + "?style=social' />" +
+                            "</a>" +
+                        "</td>" +
+                    "</tr>" +
+                "</table>";
+    }
+});

+ 119 - 0
devices/common/patches/luci-base.patch

@@ -169,3 +169,122 @@
  		logger -t "ucitrack" "Setting up /etc/config/$config reload trigger for non-procd $init"
  		procd_add_config_trigger "config.change" "$config" "$init" "$@"
  	fi
+
+--- a/package/feeds/luci/luci-base/htdocs/luci-static/resources/tools/widgets.js
++++ b/package/feeds/luci/luci-base/htdocs/luci-static/resources/tools/widgets.js
+@@ -4,6 +4,7 @@
+ 'require network';
+ 'require firewall';
+ 'require fs';
++'require uci';
+ 
+ function getUsers() {
+     return fs.lines('/etc/passwd').then(function(lines) {
+@@ -645,6 +646,83 @@ var CBIGroupSelect = form.ListValue.extend({
+ 	},
+ });
+ 
++// how to name a ListValue class which contain domain and mac group
++
++var CBIWifidogxGroupSelect = form.ListValue.extend({
++	__name__: 'CBI.WifidogxGroupSelect',
++
++	// group_type: 1: Domain Group, 2: MAC Group
++	// add a new property to store the group type
++	group_type: '1',
++
++	load: function(section_id) {
++		this.sappList = [];
++		var sections = uci.sections('wifidogx', 'group');
++		
++		for (var i = 0; i < sections.length; i++) {
++			if (sections[i]['g_type'] == this.group_type)
++				this.sappList.push(sections[i]['.name']);
++		}
++		
++		return this.super('load', section_id);
++	},
++
++	setGroupType: function(group_type) {
++		if (group_type == 'mac') {
++			this.group_type = '2';
++		} else if (group_type == 'wildcard') {
++			this.group_type = '3';
++		}
++	},
++
++	filter: function(section_id, value) {
++		return true;
++	},
++
++	renderWidget: function(section_id, option_index, cfgvalue) {
++		var values = L.toArray((cfgvalue != null) ? cfgvalue : this.default),
++		    choices = {},
++		    checked = {};
++
++		for (var i = 0; i < values.length; i++)
++			checked[values[i]] = true;
++
++		values = [];
++
++		if (!this.multiple && (this.rmempty || this.optional))
++			choices[''] = E('em', _('unspecified'));
++
++		for (var i = 0; i < this.sappList.length; i++) {
++			var name = this.sappList[i];
++
++			if (checked[name])
++				values.push(name);
++
++			choices[name] =  E('span', { 'class': 'ifacebadge' }, name);
++		}
++
++		var widget = new ui.Dropdown(this.multiple ? values : values[0], choices, {
++			id: this.cbid(section_id),
++			sort: true,
++			multiple: this.multiple,
++			optional: this.optional || this.rmempty,
++			disabled: (this.readonly != null) ? this.readonly : this.map.readonly,
++			select_placeholder: E('em', _('unspecified')),
++			display_items: this.display_size || this.size || 3,
++			dropdown_items: this.dropdown_size || this.size || 5,
++			validate: L.bind(this.validate, this, section_id),
++			create: !this.nocreate,
++			create_markup: '' +
++				'<li data-value="{{value}}">' +
++					'<span class="ifacebadge" style="background:repeating-linear-gradient(45deg,rgba(204,204,204,0.5),rgba(204,204,204,0.5) 5px,rgba(255,255,255,0.5) 5px,rgba(255,255,255,0.5) 10px)">' +
++						'{{value}}: <em>('+_('create')+')</em>' +
++					'</span>' +
++				'</li>'
++		});
++
++		return widget.render();
++	}
++});
+ 
+ return L.Class.extend({
+ 	ZoneSelect: CBIZoneSelect,
+@@ -653,4 +731,5 @@ return L.Class.extend({
+ 	DeviceSelect: CBIDeviceSelect,
+ 	UserSelect: CBIUserSelect,
+ 	GroupSelect: CBIGroupSelect,
++	WifidogxGroupSelect: CBIWifidogxGroupSelect,
+ });
+
+--- a/package/feeds/luci/luci-base/htdocs/luci-static/resources/validation.js
++++ b/package/feeds/luci/luci-base/htdocs/luci-static/resources/validation.js
+@@ -403,6 +403,14 @@ const ValidatorFactory = baseclass.extend({
+ 			return this.assert(false, _('valid hostname'));
+ 		},
+ 
++		wildcard() {
++			// must start with '.', then remove it and check if it's a valid hostname
++			if (this.value[0] != '.')
++				return this.assert(false, _('valid wildcard hostname'));
++			const hostname = this.value.substr(1);
++			return this.apply('hostname', hostname);
++		},
++
+ 		network() {
+ 			return this.assert(this.apply('uciname') || this.apply('hostname') || this.apply('ip4addr') || this.apply('ip6addr'),
+ 				_('valid UCI identifier, hostname or IP address range'));

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

@@ -206,18 +206,8 @@
 			#size-cells = <1>;
 
 			partition@0 {
-				label = "rootfs1";
-				reg = <0x0 0x3000000>;
-			};
-
-			partition@3000000 {
-				label = "rootfs2";
-				reg = <0x3000000 0x3000000>;
-			};
-
-			partition@6000000 {
-				label = "usrdata";
-				reg = <0x6000000 0x2000000>;
+				label = "rootfs";
+				reg = <0x0 0x08000000>;
 			};
 		};
 	};

+ 2 - 2
devices/qualcommax_ipq50xx/diy.sh

@@ -8,8 +8,8 @@ rm -rf package/boot/uboot-envtools package/firmware/ipq-wifi package/firmware/at
 
 git_clone_path main https://github.com/openwrt/openwrt target/linux/qualcommax target/linux/generic package/boot/uboot-tools package/firmware/ipq-wifi package/firmware/ath11k-firmware package/kernel/mac80211 package/kernel/qca-ssdk package/kernel/qca-nss-dp
 
-wget -N https://github.com/openwrt/openwrt/raw/main/include/kernel-6.6 -P include/
+wget -N https://github.com/openwrt/openwrt/raw/main/target/linux/generic/kernel-6.6 -P include/
 
 git_clone_path master https://github.com/coolsnowwolf/lede mv target/linux/generic/hack-6.6
-rm -rf target/linux/generic/hack-6.6/929-Revert-genetlink* target/linux/generic/hack-6.6/767-net-phy-realtek-add-led*
+rm -rf target/linux/generic/hack-6.6/{767-net-phy-realtek-add-led*,220-arm-gc_sections.patch,790-SFP-GE-T-ignore-TX_FAULT.patch}
 wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-6.6/613-netfilter_optional_tcp_window_check.patch -P target/linux/generic/pending-6.6/

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

@@ -1,437 +0,0 @@
-/dts-v1/;
-
-#include "ipq5018.dtsi"
-#include "ipq5018-ess.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/leds/common.h>
-
-/ {
-	model = "GL.iNet GL-B3000";
-	compatible ="glinet,gl-b3000", "qcom,ipq5018";
-
-	aliases {
-		ethernet1 = &dp2;
-		label-mac-device = &dp2;
-		led-boot = &led_system_blue;
-		led-failsafe = &led_status_white;
-		led-running = &led_status_white;
-		led-upgrade = &led_system_blue;
-		serial0 = &blsp1_uart1;
-	};
-
-	chosen {
-		bootargs-append = " root=/dev/ubiblock0_1 swiotlb=1 coherent_pool=2M";
-		stdout-path = "serial0:115200n8";
-	};
-
-	keys {
-		compatible = "gpio-keys";
-		pinctrl-0 = <&button_pins>;
-		pinctrl-names = "default";
-
-		button_reset {
-			label = "reset";
-			gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
-			linux,input-type = <EV_KEY>;
-			linux,code = <KEY_RESTART>;
-			debounce-interval = <60>;
-		};
-	};
-	leds {
-		compatible = "gpio-leds";
-		pinctrl-0 = <&leds_pins>;
-		pinctrl-names = "default";
-
-		led_system_blue: led_system_blue {
-			color = <LED_COLOR_ID_BLUE>;
-			function = LED_FUNCTION_POWER;
-			gpio = <&tlmm 24 GPIO_ACTIVE_HIGH>;
-			default-state = "on";
-		};
-
-		led_status_white: led_status_white {
-			color = <LED_COLOR_ID_WHITE>;
-			function = LED_FUNCTION_POWER;
-			gpio = <&tlmm 23 GPIO_ACTIVE_HIGH>;
-			default-state = "off";
-		};
-	};
-	reserved-memory {
-		q6_mem_regions: q6_mem_regions@4b000000 {
-			no-map;
-			reg = <0x0 0x4b000000 0x0 0x3000000>;
-		};
-	};
-};
-
-&switch {
-	status = "okay";
-
-	switch_mac_mode = <MAC_MODE_SGMII_CHANNEL0>;
-
-	qcom,port_phyinfo {
-		// MAC0 -> GE Phy -> QCA8337 Phy2
-		port@0 {
-			port_id = <1>;
-			mdiobus = <&mdio0>;
-			phy_address = <7>;
-		};
-
-		// MAC1 ---SGMII---> QCA8337 SerDes
-		port@1 {
-			port_id = <2>;
-			forced-speed = <1000>;
-			forced-duplex = <1>;
-		};
-	};
-};
-
-// MAC1 ---SGMII---> QCA8337 SerDes
-&dp2 {
-	status = "okay";
-
-	nvmem-cells = <&macaddr_dp2>;
-	nvmem-cell-names = "mac-address";
-
-	fixed-link {
-		speed = <1000>;
-		full-duplex;
-	};
-};
-
-&mdio0 {
-	status = "okay";
-};
-
-&mdio1 {
-	status = "okay";
-	pinctrl-0 = <&mdio1_pins>;
-	pinctrl-names = "default";
-	reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>;
-	// QCA8337 Phy0 -> WAN
-	qca8337_0: ethernet-phy@0 {
-		reg = <0>;
-	};
-
-	// QCA8337 Phy1 -> LAN1
-	qca8337_1: ethernet-phy@1 {
-		reg = <1>;
-	};
-
-	// QCA8337 Phy3 -> LAN2
-	qca8337_2: ethernet-phy@2 {
-		reg = <2>;
-	};
-
-	// QCA8337 switch
-	switch0: ethernet-switch@17 {
-		compatible = "qca,qca8337";
-		reg = <17>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		ports {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			switch0cpu: port@0 {
-				reg = <0>;
-				label = "cpu";
-				phy-mode = "sgmii";
-				ethernet = <&dp2>;
-				qca,sgmii-enable-pll;
-				fixed-link {
-					speed = <1000>;
-					full-duplex;
-				};
-			};
-			// QCA8337 Phy0 -> WAN
-			port@1 {
-				reg = <1>;
-				label = "wan";
-				phy-handle = <&qca8337_0>;
-				phy_address = <0>;
-			};
-			// QCA8337 Phy1 -> LAN1
-			port@2 {
-				reg = <2>;
-				label = "lan1";
-				phy-handle = <&qca8337_1>;
-				phy_address = <1>;
-			};
-			// QCA8337 Phy3 -> LAN2
-			port@3 {
-				reg = <3>;
-				label = "lan2";
-				phy-handle = <&qca8337_2>;
-				phy_address = <2>;
-			};
-		};
-	};
-};
-
-&sleep_clk {
-	clock-frequency = <32000>;
-};
-
-&xo_board_clk {
-	clock-frequency = <24000000>;
-};
-
-&blsp1_uart1 {
-	status = "okay";
-
-	pinctrl-0 = <&serial_0_pins>;
-	pinctrl-names = "default";
-};
-
-&crypto {
-	status = "okay";
-};
-
-&cryptobam {
-	status = "okay";
-};
-
-&prng {
-	status = "okay";
-};
-
-&qfprom {
-	status = "okay";
-};
-
-&qpic_bam {
-	status = "okay";
-};
-
-&qpic_nand {
-	pinctrl-0 = <&qpic_pins>;
-	pinctrl-names = "default";
-	status = "okay";
-
-	nand@0 {
-    		compatible = "spi-nand";
-		reg = <0>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-
-		nand-ecc-engine = <&qpic_nand>;
-
-    		nand-ecc-strength = <8>;
-    		nand-ecc-step-size = <512>;
-		nand-bus-width = <8>;
-
-		partitions {
-			compatible = "qcom,smem-part";
-
-			partition-0-art {
-				compatible = "fixed-partitions";
-				label = "0:ART";
-				read-only;
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				nvmem-layout {
-					compatible = "fixed-layout";
-					#address-cells = <1>;
-					#size-cells = <1>;
-
-					macaddr_dp2: macaddr@0 {
-						reg = <0x0 0x6>;
-					};
-				};
-			};
-		};
-	};
-};
-
-&tlmm {
-	mdio1_pins: mdio-state {
-		mdc-pins {
-			pins = "gpio36";
-			function = "mdc";
-			drive-strength = <8>;
-			bias-pull-up;
-		};
-
-		mdio-pins {
-			pins = "gpio37";
-			function = "mdio";
-			drive-strength = <8>;
-			bias-pull-up;
-		};
-	};
-
-	leds_pins: leds_pins {
-		led_system_blue {
-			pins = "gpio24";
-			function = "gpio";
-			drive-strength = <8>;
-			bias-pull-down;
-		};
-
-		led_status_white {
-			pins = "gpio23";
-			function = "gpio";
-			drive-strength = <8>;
-			bias-pull-down;
-		};
-	};
-
-	button_pins: button_pins {
-		button_reset {
-			pins = "gpio27";
-			function = "gpio";
-			drive-strength = <8>;
-			bias-pull-up;
-		};
-	};
-
-	qpic_pins: qpic-state {
-		clock-pins {
-			pins = "gpio9";
-			function = "qspi_clk";
-			drive-strength = <8>;
-			bias-disable;
-		};
-
-		cs-pins {
-			pins = "gpio8";
-			function = "qspi_cs";
-			drive-strength = <8>;
-			bias-disable;
-		};
-
-		data-pins {
-			pins = "gpio4", "gpio5", "gpio6", "gpio7";
-			function = "qspi_data";
-			drive-strength = <8>;
-			bias-disable;
-		};
-	};
-
-	serial_0_pins: uart0-state {
-		pins =
-			"gpio20", // RX
-			"gpio21"; // TX
-		function = "blsp0_uart0";
-		drive-strength = <8>;
-		bias-disable;
-	};
-};
-
-&tsens {
-	status = "okay ";
-};
-
-&q6v5_wcss {
-	status = "okay";
-
-	memory-region = <&q6_mem_regions>;
-	firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt",
-			"ath11k/IPQ5018/hw1.0/m3_fw.mdt",
-			"ath11k/QCN6122/hw1.0/m3_fw.mdt";
-
-	/* B3000 currently doesn't support passing bootargs */
-	/*boot-args = <					*/
-			/*       type:	0x1  PCIE0	*/
-			/*     length:	4		*/
-			/*      PD id:	3		*/
-			/* reset GPIO:	15		*/
-			/*   reserved:	0 0>;		*/
-
-	// IPQ5018
-	q6_wcss_pd1: pd-1 {
-		firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt";
-
-		resets =
-			<&gcc GCC_WCSSAON_RESET>,
-			<&gcc GCC_WCSS_BCR>,
-			<&gcc GCC_CE_BCR>;
-		reset-names =
-			"wcss_aon_reset",
-			"wcss_reset",
-			"ce_reset";
-
-		clocks =
-			<&gcc GCC_WCSS_AHB_S_CLK>,
-			<&gcc GCC_WCSS_ACMT_CLK>,
-			<&gcc GCC_WCSS_AXI_M_CLK>;
-		clock-names =
-			"gcc_wcss_ahb_s_clk",
-			"gcc_wcss_acmt_clk",
-			"gcc_wcss_axi_m_clk";
-
-		// qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
-		interrupts-extended =
-			<&wcss_smp2p_in 8 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 9 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 12 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 11 IRQ_TYPE_NONE>;
-		interrupt-names =
-			"fatal",
-			"ready",
-			"spawn-ack",
-			"stop-ack";
-
-		qcom,smem-states =
-			<&wcss_smp2p_out 8>,
-			<&wcss_smp2p_out 9>,
-			<&wcss_smp2p_out 10>;
-		qcom,smem-state-names =
-			"shutdown",
-			"stop",
-			"spawn";
-	};
-
-	// QCN6102 5G
-	q6_wcss_pd3: pd-3 {
-		firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt";
-
-		interrupts-extended =
-			<&wcss_smp2p_in 24 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 25 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 28 IRQ_TYPE_NONE>,
-			<&wcss_smp2p_in 27 IRQ_TYPE_NONE>;
-		interrupt-names =
-			"fatal",
-			"ready",
-			"spawn-ack",
-			"stop-ack";
-
-		qcom,smem-states =
-			<&wcss_smp2p_out 24>,
-			<&wcss_smp2p_out 25>,
-			<&wcss_smp2p_out 26>;
-		qcom,smem-state-names =
-			"shutdown",
-			"stop",
-			"spawn";
-	};
-};
-
-&wifi0 {
-	// IPQ5018
-	qcom,rproc = <&q6_wcss_pd1>;
-	qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
-	qcom,ath11k-calibration-variant = "GL-iNet-GL-B3000";
-	qcom,ath11k-fw-memory-mode = <2>;
-	qcom,bdf-addr = <0x4c400000>;
-
-	status = "okay";
-};
-
-&wifi1 {
-	// QCN6102 5G
-	qcom,rproc = <&q6_wcss_pd3>;
-	qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
-	qcom,ath11k-calibration-variant = "GL-iNet-GL-B3000";
-	qcom,ath11k-fw-memory-mode = <2>;
-	qcom,bdf-addr = <0x4d100000>;
-	qcom,m3-dump-addr = <0x4df00000>;
-
-	status = "okay";
-};

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

@@ -1,47 +0,0 @@
-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 - 322
devices/qualcommax_ipq50xx/patches/diy.patch

@@ -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 {

+ 0 - 3
devices/ramips_mt7621/diy.sh

@@ -7,10 +7,7 @@ SHELL_FOLDER=$(dirname $(readlink -f "$0"))
 
 sed -i "s/DEVICE_MODEL := HC5962$/DEVICE_MODEL := HC5962 \/ B70/" target/linux/ramips/image/mt7621.mk
 
-sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true
 
 sed -i '/# start dockerd/,/# end dockerd/d' .config
 
-sed -i "s/KERNEL_SIZE := 3145728/KERNEL_SIZE := 3407564/" target/linux/ramips/image/mt7621.mk
-
 sed -i "s/--max-leb-cnt=96/--max-leb-cnt=128/g" target/linux/ramips/image/mt7621.mk

+ 179 - 0
devices/ramips_mt7621/diy/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts

@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+	compatible = "jdcloud,re-sp-01b", "mediatek,mt7621-soc";
+	model = "JDCloud RE-SP-01B";
+
+	aliases {
+		led-boot = &led_status_red;
+		led-failsafe = &led_status_red;
+		led-running = &led_status_green;
+		led-upgrade = &led_status_blue;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_status_red: led-red {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_RED>;
+			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+		};
+
+		led_status_green: led-green {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
+			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+		};
+
+		led_status_blue: led-blue {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_BLUE>;
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition@30000 {
+				label = "config";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			partition@40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					eeprom_factory_0: eeprom@0 {
+						reg = <0x0 0x400>;
+					};
+
+					eeprom_factory_8000: eeprom@8000 {
+						reg = <0x8000 0x4da8>;
+					};
+				};
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0x1ab0000>;
+			};
+
+			partition@1b00000 {
+				label = "mini";
+				reg = <0x1b00000 0x400000>;
+				read-only;
+			};
+
+			partition@1f00000 {
+				label = "oem";
+				reg = <0x1f00000 0x100000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&gmac1 {
+	status = "okay";
+	label = "wan";
+	phy-handle = <&ethphy0>;
+};
+
+&ethphy0 {
+	/delete-property/ interrupts;
+};
+
+&switch0 {
+	ports {
+		port@1 {
+			status = "okay";
+			label = "lan1";
+		};
+
+		port@2 {
+			status = "okay";
+			label = "lan2";
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
+
+&pcie0 {
+	wifi@0,0 {
+		compatible = "mediatek,mt76";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&eeprom_factory_0>;
+		nvmem-cell-names = "eeprom";
+	};
+};
+
+&pcie1 {
+	wifi@0,0 {
+		compatible = "mediatek,mt76";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&eeprom_factory_8000>;
+		nvmem-cell-names = "eeprom";
+		ieee80211-freq-limit = <5000000 6000000>;
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "uart2", "uart3", "wdt";
+		function = "gpio";
+	};
+};

+ 29 - 156
devices/ramips_mt7621/patches/02-cr660x.patch

@@ -16,11 +16,11 @@
 +
 +define Device/jdcloud_re-sp-01b
 +  $(Device/dsa-migration)
-+  $(Device/uimage-lzma-loader)
-+  IMAGE_SIZE := 32448k
++  IMAGE_SIZE := 27328k
 +  DEVICE_VENDOR := JDCloud
 +  DEVICE_MODEL := RE-SP-01B
-+  DEVICE_PACKAGES := kmod-fs-ext4 kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-sdhci-mt7620 kmod-usb3
++  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \
++	kmod-sdhci-mt7620 kmod-usb3
 + endef
 + TARGET_DEVICES += jdcloud_re-sp-01b
 +
@@ -157,6 +157,18 @@
  	mikrotik,routerboard-m33g|\
  	mts,wg430223|\
  	oraybox,x3a|\
+@@ -279,6 +279,11 @@ ramips_setup_macs()
+ 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+ 		wan_mac=$(macaddr_add "$lan_mac" 1)
+ 		;;
++	jdcloud,re-sp-01b)
++		lan_mac=$(mtd_get_mac_ascii config mac)
++		wan_mac=$lan_mac
++		label_mac=$lan_mac
++		;;
+ 	linksys,e5600|\
+ 	linksys,ea6350-v4|\
+ 	linksys,ea7300-v1|\
 
 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -187,156 +199,17 @@
  	;;
  esac
 
---- /dev/null
-+++ b/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts
-@@ -0,0 +1,150 @@
-+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-+
-+#include "mt7621.dtsi"
-+
-+#include <dt-bindings/gpio/gpio.h>
-+#include <dt-bindings/input/input.h>
-+
-+/ {
-+	compatible = "jdcloud,re-sp-01b", "mediatek,mt7621-soc";
-+	model = "JDCloud RE-SP-01B";
-+
-+	aliases {
-+		led-boot = &led_red;
-+		led-failsafe = &led_red;
-+		led-running = &led_green;
-+		led-upgrade = &led_blue;
-+		label-mac-device = &gmac0;
-+	};
-+
-+	chosen {
-+		bootargs = "console=ttyS0,115200";
-+	};
-+
-+	keys {
-+		compatible = "gpio-keys";
-+
-+		reset {
-+			label = "reset";
-+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
-+			linux,code = <KEY_RESTART>;
-+		};
-+	};
-+
-+	leds {
-+		compatible = "gpio-leds";
-+
-+		led_red: red {
-+			label = "red:sys";
-+			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
-+			panic-indicator;
-+		};
-+
-+		led_green: green {
-+			label = "green:sys";
-+			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
-+		};
-+
-+		led_blue: blue {
-+			label = "blue:sys";
-+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
-+		};
-+	};
-+};
-+
-+&sdhci {
-+	status = "okay";
-+};
-+
-+&spi0 {
-+	status = "okay";
-+
-+	flash@0 {
-+		compatible = "jedec,spi-nor";
-+		reg = <0>;
-+		spi-max-frequency = <50000000>;
-+
-+		partitions {
-+			compatible = "fixed-partitions";
-+			#address-cells = <1>;
-+			#size-cells = <1>;
-+
-+			partition@0 {
-+				label = "u-boot";
-+				reg = <0x0 0x30000>;
-+				read-only;
-+			};
-+
-+			config: partition@30000 {
-+				label = "config";
-+				reg = <0x30000 0x10000>;
-+				read-only;
-+			};
-+
-+			factory: partition@40000 {
-+				label = "factory";
-+				reg = <0x40000 0x10000>;
-+				read-only;
-+			};
-+
-+			partition@50000 {
-+				compatible = "denx,uimage";
-+				label = "firmware";
-+				reg = <0x50000 0x1fb0000>;
-+			};
-+		};
-+	};
-+};
-+
-+&gmac0 {
-+	mtd-mac-address-ascii = <&config 0x4429>;
-+};
-+
-+&switch0 {
-+	ports {
-+		port@0 {
-+			status = "okay";
-+			label = "wan";
-+		};
-+
-+		port@1 {
-+			status = "okay";
-+			label = "lan1";
-+		};
-+
-+		port@2 {
-+			status = "okay";
-+			label = "lan2";
-+		};
-+	};
-+};
-+
-+&pcie {
-+	status = "okay";
-+};
-+
-+&pcie0 {
-+	wifi@0,0 {
-+		reg = <0x0000 0 0 0 0>;
-+		mtd-mac-address-ascii = <&config 0x4429>;
-+		mediatek,mtd-eeprom = <&factory 0x0>;
-+	};
-+};
-+
-+&pcie1 {
-+	wifi@0,0 {
-+		reg = <0x0000 0 0 0 0>;
-+		mtd-mac-address-ascii = <&config 0x4429>;
-+		mtd-mac-address-increment = <0x80>;
-+		mtd-mac-address-increment-byte = <3>;
-+		mediatek,mtd-eeprom = <&factory 0x8000>;
-+		ieee80211-freq-limit = <5000000 6000000>;
-+	};
-+};
-+
-+&state_default {
-+	gpio {
-+		groups = "uart2", "uart3", "wdt";
-+		function = "gpio";
-+	};
-+};
+--- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
++++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+@@ -126,6 +126,11 @@ case "$board" in
+ 		[ "$PHYNBR" = "1" ] && \
+ 			macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress
+ 		;;
++	jdcloud,re-sp-01b)
++		hw_mac_addr=$(mtd_get_mac_ascii config mac)
++		[ "$PHYNBR" = "0" ] && echo $hw_mac_addr > /sys${DEVPATH}/macaddress
++		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 0x800000 > /sys${DEVPATH}/macaddress
++		;;
+ 	keenetic,kn-3510)
+ 		[ "$PHYNBR" = "1" ] && \
+ 			macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress

+ 1 - 1
devices/x86_64/diy.sh

@@ -10,7 +10,7 @@ wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/
 
 sed -i 's/kmod-r8169/kmod-r8168/' target/linux/x86/image/64.mk
 
-sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-usb-hid kmod-mmc kmod-sdhci usbutils pciutils lm-sensors-detect kmod-atlantic kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8101 kmod-r8125 kmod-r8126 kmod-8139cp kmod-8139too kmod-i40e kmod-drm-amdgpu kmod-mlx4-core kmod-mlx5-core fdisk lsblk kmod-phy-broadcom kmod-ixgbevf/' target/linux/x86/Makefile
+sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-fs-f2fs kmod-mmc kmod-sdhci kmod-usb-hid amd64-microcode intel-microcode usbutils pciutils lm-sensors-detect kmod-atlantic kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8101 kmod-r8125 kmod-r8126 kmod-8139cp kmod-8139too kmod-i40e kmod-drm-amdgpu kmod-mlx4-core kmod-mlx5-core fdisk lsblk kmod-phy-broadcom kmod-ixgbevf/' target/linux/x86/Makefile
 
 mv -f tmp/r81* feeds/kiddin9/
 

+ 1 - 1
devices/x86_generic/diy.sh

@@ -6,7 +6,7 @@ SHELL_FOLDER=$(dirname $(readlink -f "$0"))
 
 git_clone_path master https://github.com/coolsnowwolf/lede target/linux/x86/files target/linux/x86/patches-6.6
 
-sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-usb-hid kmod-mmc kmod-sdhci usbutils pciutils lm-sensors-detect kmod-alx kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8125 kmod-r8126 kmod-r8101 kmod-8139cp kmod-8139too kmod-i40e kmod-i40evf kmod-mlx4-core kmod-mlx5-core fdisk lsblk/' target/linux/x86/Makefile
+sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-fs-f2fs kmod-mmc kmod-sdhci kmod-usb-hid amd64-microcode intel-microcode usbutils pciutils lm-sensors-detect kmod-alx kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8125 kmod-r8126 kmod-r8101 kmod-8139cp kmod-8139too kmod-i40e kmod-i40evf kmod-mlx4-core kmod-mlx5-core fdisk lsblk/' target/linux/x86/Makefile
 
 sed -i 's/kmod-r8169/kmod-r8168/' target/linux/x86/image/generic.mk