From todorcolov at abv.bg  Tue Sep  1 00:37:04 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:37:04 +0300
Subject: [PATCH v3 0/4] ipq806x: add support for Linksys E8350 - Cover letter
Message-ID: <20200901043709.1804-1-todorcolov@abv.bg>

bundle of 4 patches to add support for Linksys E8350 dual band wifi router type AC2350

FCC ID: Q87-E8350
	- device specifications are already in place under the openwrt wiki URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
	- successful test firmware has been confirmed by me and several users under developer forum: https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
	via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
		- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: +2 / +3
		- WLAN ath10k 2Ghz: via /etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
		- WLAN quantenna 5Ghz: set during quantenna firmware load - it has separate SPI flash not accessible via Openwrt OS

	The device label lists only one mac address

Installation:
	via stock WEB interface

Notes:
	Quantenna 5Ghz Wifi requires separate packages for loading its firmware and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys FW header genarator 	- needed for factory FW
    updata over stock WEB interface

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++
 target/linux/ipq806x/image/Makefile           |  29 ++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 tools/firmware-utils/Makefile                 |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
 tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
 .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
 tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
 tools/firmware-utils/src/linksys/crc.h        |  69 +++
 tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
 16 files changed, 2351 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:37:05 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:37:05 +0300
Subject: [PATCH v3 1/4] ipq806x: add support for Linksys E8350
In-Reply-To: <20200901043709.1804-1-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
Message-ID: <20200901043709.1804-2-todorcolov@abv.bg>

---
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
 target/linux/ipq806x/image/Makefile           |  29 +++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
 	ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" "usb2-port1"
 	ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" "usb3-port1"
 	;;
+linksys,e8350-v1)
+        ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+        ;;
 nec,wg2600hp)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..3dfad72232 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -55,6 +55,7 @@ qcom,ipq8064-db149)
 	ucidef_add_switch "switch0" \
 		"1:lan" "2:lan" "3:lan" "4:lan" "6u at eth1" "5:wan" "0u at eth0"
 	;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
 	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
 	ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..4f4fb12ef0 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
 		nand_do_upgrade "$1"
 		;;
 	compex,wpq864|\
+	linksys,e8350-v1|\
 	netgear,d7800 |\
 	netgear,r7500 |\
 	netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 0000000000..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+	model = "Linksys E8350 V1 WiFi Router";
+	compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+	memory at 0 {
+		reg = <0x42000000 0x1e000000>;
+		device_type = "memory";
+	};
+
+	aliases {
+		serial0 = &gsbi4_serial;
+
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&button_pins>;
+		pinctrl-names = "default";
+
+		reset {
+			label = "reset";
+			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		wifi {
+			label = "wifi";
+			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+		};
+	};
+
+	nand-controller at 1ac00000 {
+		compatible = "qcom,ipq806x-nand";
+		reg = <0x1ac00000 0x800>;
+		clocks = <&gcc EBI2_CLK>,
+			<&gcc EBI2_AON_CLK>;
+		clock-names = "core", "aon";
+		dmas = <&adm_dma 3>;
+		dma-names = "rxtx";
+		qcom,cmd-crci = <15>;
+		qcom,data-crci = <3>;
+
+		nand at 0 {
+			reg = <0>;
+
+			nand-ecc-strength = <4>;
+			nand-bus-width = <8>;
+
+			partitions {
+				compatible = "fixed-partitions";
+
+				partition at 0 {
+					label = "ubi";
+					reg = <0 0x4000000>;
+				};
+	
+				partition at 4000000 {
+					label = "extra";
+					reg = <0x4000000 0x4000000>;
+				};
+			};
+		};
+	};
+
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&led_pins>;
+		pinctrl-names = "default";
+
+		led_power: power {
+			label = "e8350-v1:green:power";
+			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+		};
+
+		wps {
+			label = "e8350-v1:green:wps";
+			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
+                };
+
+		wifi {
+			label = "e8350-v1:green:wifi";
+			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&qcom_pinmux {
+	button_pins: button_pins {
+		mux {
+			pins = "gpio68","gpio65", "gpio67";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	led_pins: led_pins {
+		mux {
+			pins = "gpio26","gpio53", "gpio54";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+};
+
+&gsbi4 {
+	qcom,mode = <GSBI_PROT_I2C_UART>;
+	status = "okay";
+	serial at 16340000 {
+		status = "okay";
+	};
+	/*
+	* The i2c device on gsbi4 should not be enabled.
+	* On ipq806x designs gsbi4 i2c is meant for exclusive
+	* RPM usage. Turning this on in kernel manifests as
+	* i2c failure for the RPM.
+	*/
+};
+&gsbi5 {
+	qcom,mode = <GSBI_PROT_SPI>;
+	status = "okay";
+
+	spi5: spi at 1a280000 {
+		status = "okay";
+
+		pinctrl-0 = <&spi_pins>;
+		pinctrl-names = "default";
+
+		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
+
+		m25p80 at 0 {
+			compatible = "jedec,spi-nor";
+			spi-max-frequency = <51200000>;
+			reg = <0>;
+
+			partitions {
+				compatible = "qcom,smem";
+			};
+		};
+	};
+};
+
+&sata_phy {
+	status = "okay";
+};
+
+&sata {
+	status = "okay";
+};
+
+&usb3_0 {
+	clocks = <&gcc USB30_1_MASTER_CLK>;
+	status = "okay";
+};
+
+&usb3_1 {
+	clocks = <&gcc USB30_0_MASTER_CLK>;
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
+
+&pcie1 {
+	status = "okay";
+};
+
+&pcie2 {
+	status = "okay";
+};
+
+&mdio0 {
+	status = "okay";
+
+	pinctrl-0 = <&mdio0_pins>;
+	pinctrl-names = "default";
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+		qca,ar8327-initvals = <
+			0x00004 0x7600000   /* PAD0_MODE */
+			0x00008 0x1000000   /* PAD5_MODE */
+			0x0000c 0x80        /* PAD6_MODE */
+			0x00010 0x2613a0    /* PWS_REG */
+			0x000e4 0x6a545     /* MAC_POWER_SEL */
+			0x000e0 0xc74164de  /* SGMII_CTRL */
+			0x0007c 0x4e        /* PORT0_STATUS */
+			0x00094 0x4e        /* PORT6_STATUS */
+			>;
+	};
+};
+
+&gmac1 {
+	status = "okay";
+	phy-mode = "rgmii";
+	qcom,id = <1>;
+
+	pinctrl-0 = <&rgmii2_pins>;
+	pinctrl-names = "default";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&gmac2 {
+	status = "okay";
+	phy-mode = "sgmii";
+	qcom,id = <2>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&tcsr {
+	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
+	compatible = "qcom,tcsr";
+};
+
+&adm_dma {
+	status = "okay";
+};
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index 5cc66daa21..af428db9fd 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -13,6 +13,17 @@ define Build/buffalo-rootfs-cksum
 	) >> $@
 endef
 
+# tune addpattern for Linksys E8350-V1 fw pattern generation
+define Build/linksys-bin
+        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
+        mv $@.new $@
+endef
+# Use Linksys fw header generator to upgrade openwrt factory image over the native Linksys WEB interface
+define Build/linksys-addfwhdr
+        -$(STAGING_DIR_HOST)/bin/linksys/addfwhdr -i $@ -o $@.new \
+       	;mv "$@.new" "$@"
+endef
+
 define Device/Default
 	PROFILES := Default
 	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
@@ -109,6 +120,24 @@ define Device/compex_wpq864
 endef
 TARGET_DEVICES += compex_wpq864
 
+define Device/linksys_e8350-v1
+        $(call Device/LegacyImage)
+        DEVICE_VENDOR := Linksys
+        DEVICE_MODEL := E8350
+        DEVICE_VARIANT := v1
+        SOC := qcom-ipq8064
+        FW_VERSION := v1.0.03.003
+        FW_DEVICE_ID := 8350
+        PAGESIZE := 2048
+        BLOCKSIZE := 128k
+        KERNEL_IN_UBI := 1
+        IMAGES = factory.bin sysupgrade.ubi
+        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 | append-metadata
+        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-addfwhdr | linksys-bin
+        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct
+endef
+TARGET_DEVICES += linksys_e8350-v1
+
 define Device/linksys_ea7500-v1
 	$(call Device/LegacyImage)
 	DEVICE_VENDOR := Linksys
diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
index 8cdd198c29..f88252d8a6 100644
--- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -843,6 +843,19 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -843,6 +843,20 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-ipq4019-ap.dk07.1-c1.dtb \
  	qcom-ipq4019-ap.dk07.1-c2.dtb \
  	qcom-ipq8064-ap148.dtb \
@@ -18,6 +18,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq8064-d7800.dtb \
 +	qcom-ipq8064-db149.dtb \
 +	qcom-ipq8064-ap161.dtb \
++	qcom-ipq8064-e8350-v1.dtb \
 +	qcom-ipq8064-ea7500-v1.dtb \
 +	qcom-ipq8064-ea8500.dtb \
 +	qcom-ipq8064-r7500.dtb \
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:37:06 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:37:06 +0300
Subject: [PATCH v3 2/4] package: fix nand.sh fwtool trailer removal for UBIFS
In-Reply-To: <20200901043709.1804-1-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
Message-ID: <20200901043709.1804-3-todorcolov@abv.bg>

---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
 	local mtddev="/dev/mtd${mtdnum}"
 	ubidetach -p "${mtddev}" || true
 	sync
+	fwtool -q -t -i /dev/null "$1"
 	ubiformat "${mtddev}" -y -f "${ubi_file}"
 	ubiattach -p "${mtddev}"
 	nand_do_upgrade_success
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:37:07 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:37:07 +0300
Subject: [PATCH v3 3/4] package: fix wifi off/on functional button
In-Reply-To: <20200901043709.1804-1-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
Message-ID: <20200901043709.1804-4-todorcolov@abv.bg>

---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:37:08 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:37:08 +0300
Subject: [PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator - needed
 for factory FW updata over stock WEB interface
In-Reply-To: <20200901043709.1804-1-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
Message-ID: <20200901043709.1804-5-todorcolov@abv.bg>

---
 tools/firmware-utils/Makefile                 |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
 tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
 .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
 tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
 tools/firmware-utils/src/linksys/crc.h        |  69 +++
 tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..1dcbd0db77 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -24,6 +24,8 @@ endef
 
 define Host/Compile
 	mkdir -p $(HOST_BUILD_DIR)/bin
+	mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+	$(call cc,linksys/addfwhdr linksys/crc )
 	$(call cc,add_header)
 	$(call cc,addpattern)
 	$(call cc,asustrx)
@@ -98,7 +100,7 @@ define Host/Compile
 endef
 
 define Host/Install
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+	$(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 0000000000..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <getopt.h>
+#include <time.h>
+#include <sys/time.h>
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF	1024
+#define CRC32_INIT_VALUE 0xffffffff	/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+	va_list args;
+	va_start(args, str);
+	vfprintf(stderr, str, args);
+	fputc('\n', stderr);
+	exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+	unsigned char buf[1];
+	int i;
+
+	fprintf(stderr,"Fill null\n");
+
+	buf[0] = 0xff;
+	for (i=0 ; i< size; i++ )
+		if (write(fd_w, buf, 1) != 1)
+			return 0;
+
+	return 1;
+}
+
+long
+file_open(const char *name)
+{
+	struct stat sb;
+	if ((fd = open(name, O_RDONLY, 0)) < 0){
+		die("Unable to open `%s' : %m", name);
+	}
+
+	if (fstat (fd, &sb))
+		die("Unable to stat `%s' : %m", name);
+
+	return sb.st_size;
+}
+
+void usage(void)
+{
+	die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+	uint input_size,c;
+	char *input_file=NULL, *output_file=NULL;
+        int opt;
+        int option_index=0;
+	int garbage = 0;
+	char *buf = NULL;
+        extern char *optarg;
+        extern int optind, opterr, optopt;
+	
+	struct cbt_fw_header *fwhdr;
+	uint32 crc;	
+
+        static struct option long_options[] =
+	{
+		{"input", 1, 0, 'i'},
+		{"output", 1, 0, 'o'},
+		{"garbage", 0, 0, 'g'},
+		{0, 0, 0, 0}
+	};
+
+	printf("\n---------- add fw header --------\n");
+
+        fwhdr  = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+
+	while(1){
+		opt = getopt_long(argc, argv, "i:o:g",long_options, &option_index);
+		if(opt == -1)
+			break;
+		switch(opt){
+			case 'h' : 
+				usage(); break;
+			case 'i' :
+				input_file = optarg;
+				printf("input file is [%s]\n",input_file); break;
+			case 'o' :
+				output_file = optarg;
+				printf("output file is [%s]\n",output_file); break;
+			case 'g' :
+				garbage = 1; break;
+			default :
+				usage();
+		}
+	}
+
+	if(!input_file || !output_file)
+	{
+		printf("You must specify the input and output file!\n");
+		usage();
+	}
+
+	
+	unlink(output_file);
+	if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREAD | S_IWRITE)) < 0){
+		die("Unable to open `%s' : %m", output_file);
+	}
+	
+	fwhdr = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+	
+	memcpy((char *)&fwhdr->magic, FWHDR_MAGIC_STR, sizeof(fwhdr->magic));
+	
+	input_size = file_open(input_file);
+	if(!(buf = malloc(input_size)))
+	{
+		perror("malloc");
+		goto fail;
+	}
+	c = read(fd, buf, input_size);
+	fwhdr->len = input_size + sizeof(struct cbt_fw_header);
+
+	fwhdr->res = fwhdr->res | 0x1;
+	
+	//junzhao add fw build date in cbt_fw_header for calculate MD5
+	#if 0
+	{
+	       static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+	       int year, day, mon=1;
+               char temp[10]={0};
+	       unsigned char *p_date = (unsigned char *)&fwhdr->res;
+               int j;
+
+               sscanf(__DATE__, "%s %d %d", temp, &day, &year);
+       
+               for(j=0;j<12;j++) {
+                       if(!strcmp(temp, months[j])) {
+                               mon = j+1;
+                               break;
+                       }
+               }
+               p_date[0]= year-2000;
+               p_date[1]= mon;
+               p_date[2]= day;
+
+	       printf("%s: Build date(20%d-%d-%d)\n", __FUNCTION__, p_date[0], p_date[1], p_date[2]);
+
+	}
+	#endif
+	//end
+	
+	crc = crc32((uint8 *)&fwhdr->res, 4, CRC32_INIT_VALUE);
+	crc = crc32((uint8 *)&buf[0], input_size, crc);
+	
+	fwhdr->crc32 = crc;
+
+	/* write code pattern header */
+	write(fd_w, fwhdr, sizeof(struct cbt_fw_header));
+
+	if(write(fd_w, buf, c)!=c)
+		die("Write call failed!\n");
+	
+#if 0
+	if(garbage == 1){			// add garbage, let image is a multiple of 1024, and the web upgrade will ok
+		printf("Add %d bytes garbage\n",1024-32);	
+		if(!fill_null0(1024-32))
+			die("error!\n");
+	}
+#endif
+fail:
+	if(buf)
+		free(buf);
+	close (fd);
+	close (fd_w);
+	
+	return 0;
+}
diff --git a/tools/firmware-utils/src/linksys/bcmdefs.h b/tools/firmware-utils/src/linksys/bcmdefs.h
new file mode 100644
index 0000000000..edd7397892
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/bcmdefs.h
@@ -0,0 +1,318 @@
+/*
+ * Misc system wide definitions
+ *
+ * Copyright (C) 2009, Broadcom Corporation
+ * All Rights Reserved.
+ * 
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+ *
+ * $Id: bcmdefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
+ */
+
+#ifndef	_bcmdefs_h_
+#define	_bcmdefs_h_
+
+/*
+ * One doesn't need to include this file explicitly, gets included automatically if
+ * typedefs.h is included.
+ */
+
+/* Use BCM_REFERENCE to suppress warnings about intentionally-unused function
+ * arguments or local variables.
+ */
+#define BCM_REFERENCE(data)	((void)data)
+
+/* Reclaiming text and data :
+ * The following macros specify special linker sections that can be reclaimed
+ * after a system is considered 'up'.
+ * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN,
+ * as in most cases, the attach function calls the detach function to clean up on error).
+ */
+#ifdef DONGLEBUILD
+
+extern bool bcmreclaimed;
+
+#define BCMATTACHDATA(_data)	__attribute__ ((__section__ (".dataini2." #_data))) _data
+#define BCMATTACHFN(_fn)	__attribute__ ((__section__ (".textini2." #_fn))) _fn
+
+#define BCMPREATTACHDATA(_data)	__attribute__ ((__section__ (".dataini2." #_data))) _data
+#define BCMPREATTACHFN(_fn)	__attribute__ ((__section__ (".textini2." #_fn))) _fn
+
+#if defined(BCMRECLAIM)
+#define BCMINITDATA(_data)	__attribute__ ((__section__ (".dataini1." #_data))) _data
+#define BCMINITFN(_fn)		__attribute__ ((__section__ (".textini1." #_fn))) _fn
+#define CONST
+#else
+#define BCMINITDATA(_data)	_data
+#define BCMINITFN(_fn)		_fn
+#define CONST	const
+#endif
+
+/* Non-manufacture or internal attach function/dat */
+#if !defined(WLTEST)
+#define	BCMNMIATTACHFN(_fn)	BCMATTACHFN(_fn)
+#define	BCMNMIATTACHDATA(_data)	BCMATTACHDATA(_data)
+#else
+#define	BCMNMIATTACHFN(_fn)	_fn
+#define	BCMNMIATTACHDATA(_data)	_data
+#endif	
+
+#define BCMUNINITFN(_fn)	_fn
+
+#define BCMFASTPATH
+
+#else /* DONGLEBUILD */
+
+#define bcmreclaimed 		0
+#define BCMATTACHDATA(_data)	_data
+#define BCMATTACHFN(_fn)	_fn
+#define BCMPREATTACHDATA(_data)	_data
+#define BCMPREATTACHFN(_fn)	_fn
+#define BCMINITDATA(_data)	_data
+#define BCMINITFN(_fn)		_fn
+#define BCMUNINITFN(_fn)	_fn
+#define	BCMNMIATTACHFN(_fn)	_fn
+#define	BCMNMIATTACHDATA(_data)	_data
+#define CONST	const
+#ifdef mips
+#define BCMFASTPATH		__attribute__ ((__section__(".text.fastpath")))
+#else
+#define BCMFASTPATH
+#endif
+
+#endif /* DONGLEBUILD */
+
+#if defined(BCMROMOFFLOAD) || defined(BCMROMBUILD)
+typedef struct {
+	uint16 esiz;
+	uint16 cnt;
+	void *addr;
+} bcmromdat_patch_t;
+#endif
+
+/* Put some library data/code into ROM to reduce RAM requirements */
+#if defined(BCMROMOFFLOAD)
+#define BCMROMDATA(_data)	__attribute__ ((weak, __section__ (".datarom."#_data))) _data
+#define BCMROMDAT_NAME(_data)	_data
+#define BCMROMFN(_fn)		__attribute__ ((weak, long_call, __section__ (".textrom."#_fn))) _fn
+#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
+#define BCMROMDAT_SIZEOF(data)	sizeof(data)
+#define BCMROMDAT_APATCH(data) \
+	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
+	{ sizeof(data[0]), sizeof(data)/sizeof(data[0]), ((void*)data) };
+#define BCMROMDAT_SPATCH(data) \
+	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
+	{ sizeof(data), 1, ((void*)&data) };
+#define BCMROMFN_NAME(_fn)	_fn
+#define STATIC
+#elif defined(BCMROMBUILD)
+#include <bcmjmptbl.h>
+#define STATIC
+#else /* !BCMROMBUILD */
+#define BCMROMDATA(_data)	_data
+#define BCMROMDAT_NAME(_data)	_data
+#define BCMROMFN(_fn)		_fn
+#define BCMROMFN_NAME(_fn)	_fn
+#define STATIC	static
+#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
+#define BCMROMDAT_SIZEOF(data)	sizeof(data)
+#define BCMROMDAT_APATCH(data)
+#define BCMROMDAT_SPATCH(data)
+#endif /* !BCMROMBUILD */
+
+/* Bus types */
+#define	SI_BUS			0	/* SOC Interconnect */
+#define	PCI_BUS			1	/* PCI target */
+#define	PCMCIA_BUS		2	/* PCMCIA target */
+#define SDIO_BUS		3	/* SDIO target */
+#define JTAG_BUS		4	/* JTAG */
+#define USB_BUS			5	/* USB (does not support R/W REG) */
+#define SPI_BUS			6	/* gSPI target */
+#define RPC_BUS			7	/* RPC target */
+
+/* Allows size optimization for single-bus image */
+#ifdef BCMBUSTYPE
+#define BUSTYPE(bus) 	(BCMBUSTYPE)
+#else
+#define BUSTYPE(bus) 	(bus)
+#endif
+
+/* Allows size optimization for single-backplane image */
+#ifdef BCMCHIPTYPE
+#define CHIPTYPE(bus) 	(BCMCHIPTYPE)
+#else
+#define CHIPTYPE(bus) 	(bus)
+#endif
+
+
+/* Allows size optimization for SPROM support */
+#if defined(BCMSPROMBUS)
+#define SPROMBUS	(BCMSPROMBUS)
+#elif defined(SI_PCMCIA_SROM)
+#define SPROMBUS	(PCMCIA_BUS)
+#else
+#define SPROMBUS	(PCI_BUS)
+#endif
+
+/* Allows size optimization for single-chip image */
+#ifdef BCMCHIPID
+#define CHIPID(chip)	(BCMCHIPID)
+#else
+#define CHIPID(chip)	(chip)
+#endif
+
+#ifdef BCMCHIPREV
+#define CHIPREV(rev)	(BCMCHIPREV)
+#else
+#define CHIPREV(rev)	(rev)
+#endif
+
+/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
+#define DMADDR_MASK_32 0x0		/* Address mask for 32-bits */
+#define DMADDR_MASK_30 0xc0000000	/* Address mask for 30-bits */
+#define DMADDR_MASK_0  0xffffffff	/* Address mask for 0-bits (hi-part) */
+
+#define	DMADDRWIDTH_30  30 /* 30-bit addressing capability */
+#define	DMADDRWIDTH_32  32 /* 32-bit addressing capability */
+#define	DMADDRWIDTH_63  63 /* 64-bit addressing capability */
+#define	DMADDRWIDTH_64  64 /* 64-bit addressing capability */
+
+#ifdef BCMDMA64OSL
+typedef struct {
+	uint32 loaddr;
+	uint32 hiaddr;
+} dma64addr_t;
+
+typedef dma64addr_t dmaaddr_t;
+#define PHYSADDRHI(_pa) ((_pa).hiaddr)
+#define PHYSADDRHISET(_pa, _val) \
+	do { \
+		(_pa).hiaddr = (_val);		\
+	} while (0)
+#define PHYSADDRLO(_pa) ((_pa).loaddr)
+#define PHYSADDRLOSET(_pa, _val) \
+	do { \
+		(_pa).loaddr = (_val);		\
+	} while (0)
+
+#else
+typedef unsigned long dmaaddr_t;
+#define PHYSADDRHI(_pa) (0)
+#define PHYSADDRHISET(_pa, _val)
+#define PHYSADDRLO(_pa) ((_pa))
+#define PHYSADDRLOSET(_pa, _val) \
+	do { \
+		(_pa) = (_val);			\
+	} while (0)
+#endif /* BCMDMA64OSL */
+
+/* One physical DMA segment */
+typedef struct  {
+	dmaaddr_t addr;
+	uint32	  length;
+} hnddma_seg_t;
+
+#if defined(MACOSX)
+/* In MacOS, the OS API may return large number of segments. Setting this number lower
+ * will result in failure of dma map
+ */
+#define MAX_DMA_SEGS 8
+#else
+#define MAX_DMA_SEGS 4
+#endif
+
+
+typedef struct {
+	void *oshdmah; /* Opaque handle for OSL to store its information */
+	uint origsize; /* Size of the virtual packet */
+	uint nsegs;
+	hnddma_seg_t segs[MAX_DMA_SEGS];
+} hnddma_seg_map_t;
+
+
+/* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
+ * By doing, we avoid the need  to allocate an extra buffer for the header when bridging to WL.
+ * There is a compile time check in wlc.c which ensure that this value is at least as big
+ * as TXOFF. This value is used in dma_rxfill (hnddma.c).
+ */
+
+#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
+/* add 40 bytes to allow for extra RPC header and info  */
+#define BCMEXTRAHDROOM 220
+#else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+#ifdef CTFMAP
+#define BCMEXTRAHDROOM 176
+#else /* CTFMAP */
+#define BCMEXTRAHDROOM 172
+#endif /* CTFMAP */
+#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+
+/* Headroom required for dongle-to-host communication.  Packets allocated
+ * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
+ * leave this much room in front for low-level message headers which may
+ * be needed to get across the dongle bus to the host.  (These messages
+ * don't go over the network, so room for the full WL header above would
+ * be a waste.).
+ */
+#ifdef BCMUSBDEV
+#define BCMDONGLEHDRSZ 0
+#define BCMDONGLEPADSZ 0
+#else
+#define BCMDONGLEHDRSZ 12
+#define BCMDONGLEPADSZ 16
+#endif
+
+#define BCMDONGLEOVERHEAD	(BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
+
+#ifdef BCMDBG
+
+#ifndef BCMDBG_ERR
+#define BCMDBG_ERR
+#endif /* BCMDBG_ERR */
+
+#ifndef BCMDBG_ASSERT
+#define BCMDBG_ASSERT
+#endif /* BCMDBG_ASSERT */
+
+#endif /* BCMDBG */
+
+#if defined(BCMDBG_ASSERT) || defined(BCMASSERT_LOG)
+#define BCMASSERT_SUPPORT
+#endif /* BCMDBG_ASSERT || BCMASSERT_LOG */
+
+/* Macros for doing definition and get/set of bitfields
+ * Usage example, e.g. a three-bit field (bits 4-6):
+ *    #define <NAME>_M	BITFIELD_MASK(3)
+ *    #define <NAME>_S	4
+ * ...
+ *    regval = R_REG(osh, &regs->regfoo);
+ *    field = GFIELD(regval, <NAME>);
+ *    regval = SFIELD(regval, <NAME>, 1);
+ *    W_REG(osh, &regs->regfoo, regval);
+ */
+#define BITFIELD_MASK(width) \
+		(((unsigned)1 << (width)) - 1)
+#define GFIELD(val, field) \
+		(((val) >> field ## _S) & field ## _M)
+#define SFIELD(val, field, bits) \
+		(((val) & (~(field ## _M << field ## _S))) | \
+		 ((unsigned)(bits) << field ## _S))
+
+/* define BCMSMALL to remove misc features for memory-constrained environments */
+#ifdef BCMSMALL
+#undef	BCMSPACE
+#define bcmspace	FALSE	/* if (bcmspace) code is discarded */
+#else
+#define	BCMSPACE
+#define bcmspace	TRUE	/* if (bcmspace) code is retained */
+#endif
+
+/* Max. nvram variable table size */
+#define	MAXSZ_NVRAM_VARS	4096
+
+#define LOCATOR_EXTERN static
+
+#endif /* _bcmdefs_h_ */
diff --git a/tools/firmware-utils/src/linksys/code_pattern.h b/tools/firmware-utils/src/linksys/code_pattern.h
new file mode 100644
index 0000000000..0bbaa1102d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/code_pattern.h
@@ -0,0 +1,396 @@
+#ifndef _CODE_PATTERN_H_
+#define _CODE_PATTERN_H_
+
+#define CODE_ID		"U2ND"
+#define BOOT_PATTERN	"EST"
+#define UP_PMON		1
+#define UP_MAC		2
+#define UP_CODE		3
+#define UP_PIGGY	4
+#define UP_EOU_KEY	5
+#define UP_SN		6
+#define UP_LANG		7
+#define UP_T_CERT	8
+#define CMP_T_CERT	9	//for factory test.
+#define UP_CODE2       10
+#define UP_FULL_WL     11
+#define UP_WSC_PIN     12
+#define UP_COUNTRY     13
+#define UP_QUAN_BOOT   14
+#define UP_QUAN_IMAGE   15
+
+#define LINKSYS		7
+#define PCI_OEM		9	// <remove the line>
+#define ELSA		10	// <remove the line>
+#define ALLNET		11	// <remove the line>
+#define REENET		12	// 2003/06/21	<remove the line>
+#define CISCO		90
+#define	OTHER_OEM	99	// <remove the line>
+
+#define ENGLISH 	1
+#define JAPANESE	2
+#define GERMAN		3
+#define FRENCH		4
+#define KOREAN		5
+
+#define	USA		1
+#define	JAPAN		2
+#define	EUROPE		3
+#define WW		4
+#define GERMANY		5
+#define	KOREA		6
+#define	FRANCE		7
+
+#define	WRT54G		1
+#define	WRT54GS		2
+#define	WRT54V5		3
+#define	DPN		4
+#define	RTA41		5
+#define	WRT54G3G	6
+#define	T_MOBILE 	7
+#define WRT300N		8
+#define WRT54GL         9
+#define WRT54GSV4       10
+#define WRT350N		11
+#define WRT610N		12
+#define WRT61XN		13
+#define E200		14
+#define E300		15
+//John
+#define WRT54GV5        16
+
+#define E3200		17
+#define E4200		18
+#define E2500		19
+#define AC2350		20
+
+
+#define CES_M_SERIAL	1
+#define CES_E_SERIAL	2
+
+/***************************************
+ * define OEM                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+#define OEM LINKSYS //LINKSYS
+//#define OEM PCI_OEM //PCI_OEM
+//#define OEM ELSA //ELSA
+//#define OEM ALLNET //ALLNET
+//#define OEM REENET //REENET
+//#define OEM OTHER_OEM //OTHER_OEM
+
+/***************************************
+ * define MODEL NAME                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+
+//#define LINKSYS_MODEL E3200 //E3200
+//#define LINKSYS_MODEL E300 //E300
+//#define LINKSYS_MODEL E200 //E200
+//#define LINKSYS_MODEL E4200 //E4200
+//#define LINKSYS_MODEL E2500 //E2500
+#define LINKSYS_MODEL AC2350 //AC2350
+
+/***************************************
+ * define MODEL SERIAL                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+//#define LINKSYS_MODEL_SERIAL CES_M_SERIAL //CES_M_SERIAL
+#define LINKSYS_MODEL_SERIAL CES_E_SERIAL //CES_E_SERIAL
+
+/***************************************
+ * define country                      *
+ * LOCALE=COUNTRY =                    *
+ ***************************************/
+#define COUNTRY		LOCALE
+#define LOCALE USA
+//#define LOCALE JAPAN
+//#define LOCALE EUROPE
+//#define LOCALE WW
+//#define LOCALE GERMANY	
+//#define LOCALE FRANCE
+//#define LOCALE KOREA
+//#define LOCALE UK
+
+/***************************************
+ * define model name and code pattern  *
+ * MODEL_NAME =                        *
+ * CODE_PATTERN =                      *
+ ***************************************/
+#if OEM == LINKSYS
+	#define	CT_VENDOR		"LINKSYS"
+	#define UI_STYLE	CISCO
+
+	#if LINKSYS_MODEL == WRT54GS
+		#define CODE_PATTERN   "W54S"
+		#if LOCALE == GERMANY
+			#define MODEL_NAME	"WRT54GS-DE"
+			#define MODEL_VERSION	""
+		#elif LOCALE == FRANCE
+			#define MODEL_NAME	"WRT54GS-FR"
+			#define MODEL_VERSION	""
+		#elif LOCALE == JAPAN
+			#define MODEL_NAME	"WRT54GS-JP"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME	"WRT54GS"
+			#define MODEL_VERSION	"V3.0"
+		#endif
+	#elif LINKSYS_MODEL == WRT54GSV4
+		#define CODE_PATTERN   "W54s"
+		#define MODEL_NAME     "WRT54GSV4"
+		#define MODEL_VERSION  ""
+	#elif LINKSYS_MODEL == DPN  //DPN
+		#define CODE_PATTERN   "WDPN"
+		#define MODEL_NAME     "DPN"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == WRT54GV5
+		#define CODE_PATTERN   "W54V"
+		#define MODEL_NAME     "WRTA54G"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == RTA41
+		#define CODE_PATTERN   "W54N"
+		#define MODEL_NAME     "RTA41"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == WRT54G3G
+		#define CODE_PATTERN   "W54F"
+		#if LOCALE == EUROPE
+			#define MODEL_NAME     "WRT54G3G-EU"
+			#define MODEL_VERSION	""
+		#elif LOCALE == UK
+			#define MODEL_NAME     "WRT54G3G-UK"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME     "WRT54G3G"
+			#define MODEL_VERSION	"V1"
+		#endif
+	#elif LINKSYS_MODEL == T_MOBILE
+		#define CODE_PATTERN   "W54T"
+		#define MODEL_NAME     "WRT54G-TM"
+		#define MODEL_VERSION	"V3.0"
+	#elif LINKSYS_MODEL == WRT300N
+		#define CODE_PATTERN   "EWCB"
+		#define MODEL_NAME     "WRT300N"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == WRT350N
+		#define CODE_PATTERN   "EWCG"
+		#define MODEL_NAME     "WRT350N"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == WRT54G
+		#define CODE_PATTERN   "W54G"
+		#if LOCALE == GERMANY
+			#define MODEL_NAME	"WRT54G-DE"
+			#define MODEL_VERSION	""
+		#elif LOCALE == FRANCE
+			#define MODEL_NAME	"WRT54G-FR"
+			#define MODEL_VERSION	""
+		#elif LOCALE == JAPAN
+			#define MODEL_NAME	"WRT54G-JP"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME	"WRT54G"
+			#define MODEL_VERSION	"V4.0"
+		#endif
+	#elif LINKSYS_MODEL == WRT54GL
+		#define CODE_PATTERN   "W54G"
+		#define MODEL_NAME	"WRT54GL"
+		#define MODEL_VERSION	"V1"
+	#elif LINKSYS_MODEL == WRT610N
+		#define CODE_PATTERN   "610N"
+		#define MODEL_NAME	"WRT610N"
+		#define MODEL_VERSION	"V2"              //V1 or V2
+	#elif LINKSYS_MODEL == E200
+		#define CODE_PATTERN   "32XN"
+		#define MODEL_NUMBER	"E2000"
+		#define MODEL_NAME	"Linksys E2000"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == E300
+		#define CODE_PATTERN   "61XN"
+		#define MODEL_NUMBER	"E3000"	    //model number added by Jemmy 2009.11.17
+		#define MODEL_NAME	"Linksys E3000"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+	#elif LINKSYS_MODEL == E3200
+		#define CODE_PATTERN   "3200"
+		#define MODEL_NUMBER	"E3200"	    //model number added by zhaoguang 2010.10.25
+		#define MODEL_NAME	"Linksys E3200"
+		#define MODEL_VERSION	"V1" 
+	#elif LINKSYS_MODEL == E4200
+		#define CODE_PATTERN   "4200"
+		#define MODEL_NUMBER	"E4200"	    //model number added by Jemmy 2009.11.17
+		#define MODEL_NAME	"Linksys E4200"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+	#elif (LINKSYS_MODEL == E2500)
+		#define CODE_PATTERN   "25V3"
+		#define MODEL_NUMBER	"E2500"	    //model number
+		#define MODEL_NAME	"Linksys E2500"
+		#define MODEL_VERSION	"V3"              //V1 or V2	
+	#elif (LINKSYS_MODEL == AC2350)
+		#define CODE_PATTERN   "8350"
+		#define MODEL_NUMBER	"E8350"	    //model number
+		#define MODEL_NAME	"Linksys E8350"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+
+	#else
+		#error "You must select a LINKSYS_MODEL!!"
+	#endif
+
+	#if LINKSYS_MODEL == WRT54G || LINKSYS_MODEL == WRT54GL
+		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v1.41.8"
+		#define BCM4712_CHIP_SUPPORT_VERSION_FROM "v1.50.0"
+		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM "v1.3"
+		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM "v2.0"
+	#else
+		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v0.00.0"
+		#define BCM4712_CHIP_SUPPORT_VERSION_FROM "v0.00.0"
+		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM "v0.0"
+		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM "v0.0"
+	#endif
+	#if	LINKSYS_MODEL == WRT350N
+		#define WRT350N_SUPPORT_VERSION_FROM "v0.85.3"		
+	#endif
+
+#elif OEM == PCI_OEM
+	#define CODE_PATTERN    "W54P"
+	#if LOCALE == JAPAN
+		#define MODEL_NAME	"Planex BLW-04G Wireless Router"
+	#else
+		#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#endif
+	#define	CT_VENDOR		"PCI"
+#elif OEM == ELSA
+	#define CODE_PATTERN    "W54E"
+	#define MODEL_NAME	"ELSA WLAN DSL-Router 4P G"
+	#define	CT_VENDOR	"ELSA"
+#elif OEM == ALLNET
+	#define CODE_PATTERN    "W54A"
+	#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#define	CT_VENDOR	"ALLNET"
+#elif OEM == REENET
+	#define CODE_PATTERN    "W54R"
+	#define MODEL_NAME	"RW-IPG500"
+	#define	CT_VENDOR	"REENET"
+#elif OEM == OTHER_OEM
+	#define CODE_PATTERN    "W54O"
+	#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#define	CT_VENDOR	"OTHER_OEM"
+#else
+	#error "Your must select a OEM name!!"
+#endif
+
+/***************************************
+ * define language                     *
+ * LANGUAGE =                          *
+ * LANG_SEL=EN                         *
+ * HTTP_CHARSET =		       *
+ ***************************************/
+#if LOCALE == JAPAN
+	#define	LANGUAGE	JAPANESE
+	#define	HTTP_CHARSET	"shift-jis"
+#elif LOCALE == GERMANY
+	#define LANGUAGE	GERMAN
+	#define	HTTP_CHARSET	"iso-8859-1"
+#elif LOCALE == FRANCE
+	#define LANGUAGE	FRENCH
+	#define	HTTP_CHARSET	"iso-8859-1"
+#elif LOCALE == KOREA
+	#define LANGUAGE 	KOREAN
+	#define	HTTP_CHARSET	"euc-kr"
+#else
+	#define LANGUAGE 	ENGLISH
+	#define	HTTP_CHARSET	"iso-8859-1"
+#endif
+
+/***************************************
+ * define wireless max channel         *
+ * WL_MAX_CHANNEL =                    *
+ ***************************************/
+#if LOCALE == JAPAN || LOCALE == EUROPE || LOCALE == GERMANY || LOCALE == FRANCE
+	#define	WL_MAX_CHANNEL	"13"
+#elif OEM == KOREA			// <remove the line>
+	#define	WL_MAX_CHANNEL	"13"	// <remove the line>
+#else
+	#define WL_MAX_CHANNEL	"11"
+#endif
+
+/***************************************
+ * define web file path                *
+ * WEB_PAGE =                          *
+ ***************************************/
+#if OEM == LINKSYS
+#if UI_STYLE ==  CISCO
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"cisco_wrt54g_jp"
+	#elif LOCALE == GERMANY
+		#define	WEB_PAGE	"cisco_wrt54g_de"
+	#elif LOCALE == FRANCE
+		#define	WEB_PAGE	"cisco_wrt54g_fr"
+	#else
+		#if LINKSYS_MODEL == E200
+			#define WEB_PAGE        "ces_m"
+		#elif LINKSYS_MODEL == E300
+			#define WEB_PAGE        "ces_m"
+		#elif LINKSYS_MODEL == E3200
+			#define WEB_PAGE        "e3200_m"
+		#elif LINKSYS_MODEL == E4200
+			#define WEB_PAGE        "e4200_m"
+		#elif (LINKSYS_MODEL == E2500)
+			#define WEB_PAGE        "e2500_m"	
+		#elif (LINKSYS_MODEL == AC2350)
+			#define WEB_PAGE        "ac2350_m"
+		#else
+			#define WEB_PAGE	"cisco_wrt54g_m"
+		#endif
+	#endif
+#else
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"linksys_wrt54g_jp"
+	#else
+		#define WEB_PAGE	"linksys_wrt54g_en"
+	#endif
+#endif
+#elif OEM == PCI_OEM
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"pci_wrt54g_jp"
+	#else
+		#define WEB_PAGE	"pci_wrt54g_en"
+	#endif
+#elif OEM == ELSA
+	#define WEB_PAGE	"elsa_wrt54g_en"
+#elif OEM == ALLNET
+	#define WEB_PAGE	"nonbrand"
+#elif OEM == REENET
+	#define WEB_PAGE	"reenet_wrt54g_kr"
+#elif	OEM == OTHER_OEM
+	#define WEB_PAGE	"nonbrand"
+#endif
+
+/***************************************
+ * check LOCALE
+ ***************************************/
+#if OEM == LINKSYS
+ #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE && LOCALE != GERMANY && LOCALE != FRANCE
+	#error	"The LOCALE for LINKSYS is error, must be USA, EUROPE, JAPAN, GERMANY or FRANCE"
+ #endif
+#elif OEM == PCI_OEM
+ #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE
+	#error	"The LOCALE for PCI is error, must be USA or JAPAN"
+ #endif
+#elif OEM == ELSA
+ #if LOCALE != EUROPE
+	#error	"The LOCALE for ELSA is error, must be EUROPE"
+ #endif
+#elif OEM == ALLNET
+ #if LOCALE != EUROPE
+	#error	"The LOCALE for ALLNET is error, must be EUROPE"
+ #endif
+#elif OEM == REENET
+ #if LOCALE != KOREA
+	#error	"The LOCALE for REENET is error, must be KOREA"
+ #endif
+#elif OEM == OTHER_OEM
+ #if LOCALE != USA && LOCALE != EUROPE
+	#error	"The LOCALE for NONBRAND is error, must be USA or EUROPE"
+ #endif
+#endif
+
+#endif
diff --git a/tools/firmware-utils/src/linksys/crc.c b/tools/firmware-utils/src/linksys/crc.c
new file mode 100644
index 0000000000..7d3e641df9
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/crc.c
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * $Id: crc.c,v 1.1.1.1 2010/11/24 06:37:40 gavin.ke Exp $
+ * Copyright 2007, Broadcom Corporation      
+ * All Rights Reserved.      
+ *       
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY      
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM      
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS      
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.      
+ * crc.c: utility function to compute various CRCs
+ ******************************************************************************/
+
+#include "typedefs.h"
+#include "crc.h"
+
+/*******************************************************************************
+ * hcs
+ *
+ * Computes and inserts a header check sum based on crc8 polynomial
+ * below.  Unlike a typical crc, the header check sum is inserted 13
+ * bytes from the end of the byte stream (rather than appended to the
+ * end of the byte stream) such that at the receiver a normal checksum
+ * computation over all of the bytes results in a known good value.
+ * Given a constant 12 bytes after the header checksum to the end of
+ * the header, a lookup table can be used to provide the actual value
+ * inserted.
+ ******************************************************************************/
+
+static uint8 hcs_table[8] = { 0x16, 0x2c, 0x58, 0xb0, 0x37, 0x6e, 0xdc, 0xef};
+
+void
+hcs(
+    uint8 *pheader, /* pointer to array of data to process */
+    uint nbytes   /* number of input data bytes to process */
+)
+{
+    uint8 hcs0, hcs1;
+    int i;
+
+    /* run once with zeros in hcs position, 13th byte from the end */
+    pheader[nbytes - 12 - 1] = 0;
+    hcs0 = crc8(pheader, nbytes, CRC8_INIT_VALUE);
+ 
+    /* now compute real hcs to insert in place of zeros */
+    hcs1 = 0;
+    for (i = 0; i < 8; i++) {
+        hcs1 ^= ((hcs0 & (1 << i)) != 0 ? hcs_table[i] : 0);
+    }
+    pheader[nbytes - 12 - 1] = hcs1 ^ 0xff;
+    return;
+}
+
+/*******************************************************************************
+ * crc8
+ *
+ * Computes a crc8 over the input data using the polynomial:
+ *
+ *       x^8 + x^7 +x^6 + x^4 + x^2 + 1
+ *
+ * The caller provides the initial value (either CRC8_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC8_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint8 crc8_table[256] = {
+    0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
+    0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
+    0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
+    0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
+    0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
+    0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
+    0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
+    0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
+    0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
+    0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
+    0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
+    0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
+    0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
+    0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
+    0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
+    0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
+    0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
+    0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
+    0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
+    0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
+    0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
+    0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
+    0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
+    0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
+    0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
+    0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
+    0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
+    0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
+    0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
+    0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
+    0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
+    0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
+};
+
+#define CRC_INNER_LOOP(n, c, x) \
+    (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
+
+uint8
+crc8(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint8 crc      /* either CRC8_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(8, crc, *pdata++);
+    return crc;
+}
+
+/*******************************************************************************
+ * crc16
+ *
+ * Computes a crc16 over the input data using the polynomial:
+ *
+ *       x^16 + x^12 +x^5 + 1
+ *
+ * The caller provides the initial value (either CRC16_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC16_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint16 crc16_table[256] = {
+    0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
+    0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
+    0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
+    0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
+    0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
+    0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
+    0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
+    0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
+    0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
+    0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
+    0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
+    0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
+    0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
+    0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
+    0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
+    0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
+    0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
+    0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
+    0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
+    0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
+    0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
+    0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
+    0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
+    0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
+    0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
+    0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
+    0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
+    0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
+    0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
+    0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
+    0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
+    0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
+};
+
+uint16
+crc16(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint16 crc     /* either CRC16_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(16, crc, *pdata++);
+    return crc;
+}
+
+/*******************************************************************************
+ * crc32
+ *
+ * Computes a crc32 over the input data using the polynomial:
+ *
+ *       x^32+x^26+x^23+x^22+x^16+x^12+x^11+X^10+x^8+x^7+x^5+x^4+x^2+x+1
+ *
+ * The caller provides the initial value (either CRC32_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC32_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint32 crc32_table[256] = {
+    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
+    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
+    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
+    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
+    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
+    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
+    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
+    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
+    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
+    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
+    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
+    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
+    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
+    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
+    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
+    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
+    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
+    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
+    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
+    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
+    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
+    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
+    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
+    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
+    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
+    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
+    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
+    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
+    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
+    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
+    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
+    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
+    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
+    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
+    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
+    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
+    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
+    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
+    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
+    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
+    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
+    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
+    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
+    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
+    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
+    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
+    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
+    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
+    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
+    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
+    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
+    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
+    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
+    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
+    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
+    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
+    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
+    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
+    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
+    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
+    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
+    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
+    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
+    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
+};
+
+uint32
+crc32(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint32 crc     /* either CRC32_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(32, crc, *pdata++);
+    return crc;
+}
diff --git a/tools/firmware-utils/src/linksys/crc.h b/tools/firmware-utils/src/linksys/crc.h
new file mode 100644
index 0000000000..c7e783c159
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/crc.h
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * $Id: crc.h,v 1.2 2010/12/22 05:14:42 gavin.ke Exp $
+ * Copyright (C) 2009, Broadcom Corporation      
+ * All Rights Reserved.      
+ *       
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY      
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM      
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS      
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.      
+ * crc.h - a function to compute crc for iLine10 headers
+ ******************************************************************************/
+
+#ifndef _RTS_CRC_H_
+#define _RTS_CRC_H_ 1
+
+#include "typedefs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define CRC8_INIT_VALUE  0xff       /* Initial CRC8 checksum value */
+#define CRC8_GOOD_VALUE  0x9f       /* Good final CRC8 checksum value */
+#define HCS_GOOD_VALUE   0x39       /* Good final header checksum value */
+
+#define CRC16_INIT_VALUE 0xffff     /* Initial CRC16 checksum value */
+#define CRC16_GOOD_VALUE 0xf0b8     /* Good final CRC16 checksum value */
+
+#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
+#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
+
+void   hcs(uint8 *, uint);
+uint8  crc8(uint8 *, uint, uint8);
+uint16 crc16(uint8 *, uint, uint16);
+uint32 crc32(uint8 *, uint, uint32);
+
+/* macros for common usage */
+
+#define APPEND_CRC8(pbytes, nbytes)                           \
+do {                                                          \
+    uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
+    (pbytes)[(nbytes)] = tmp;                                 \
+    (nbytes) += 1;                                            \
+} while (0)
+
+#define APPEND_CRC16(pbytes, nbytes)                               \
+do {                                                               \
+    uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
+    (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff;                    \
+    (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff;                    \
+    (nbytes) += 2;                                                 \
+} while (0)
+
+#define APPEND_CRC32(pbytes, nbytes)                                   \
+do {                                                                   \
+    uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
+    (pbytes)[(nbytes) + 0] = (tmp >>  0) & 0xff;                       \
+    (pbytes)[(nbytes) + 1] = (tmp >>  8) & 0xff;                       \
+    (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff;                       \
+    (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff;                       \
+    (nbytes) += 4;                                                     \
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTS_CRC_H_ */
diff --git a/tools/firmware-utils/src/linksys/cyutils.h b/tools/firmware-utils/src/linksys/cyutils.h
new file mode 100644
index 0000000000..fd77ab52f3
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/cyutils.h
@@ -0,0 +1,348 @@
+#include "code_pattern.h"
+
+#if LINKSYS_MODEL == WRT54GSV4
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.05.6"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.05.8"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54GS	// WRT54GSV1-3
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.70.8"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.71.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54GL
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.30.2"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.30.4"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54G	// WRT54GV1-4
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.20.9"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.21.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == T_MOBILE
+    #define CYBERTAN_VERSION	"v5.00.0"
+    #define SERIAL_NUMBER	"002"
+    #define MINOR_VERSION	""
+#elif LINKSYS_MODEL == WRT54G3G
+    #define CYBERTAN_VERSION	"v1.90.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+#elif LINKSYS_MODEL == WRT300N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v0.92.1"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.92.1"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT350N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.03.9"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	"-beta3"
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.03.9"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	"-beta3"
+  #endif
+#elif LINKSYS_MODEL == WRT610N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v2.00.00"
+    #define SERIAL_NUMBER	"02 betasvn0526"
+    #define MINOR_VERSION	""
+//add by michael at 200804014
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+//end by michael
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+//add by michael at 20080414
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+//end by michael
+#elif LINKSYS_MODEL == E200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v0.0.01"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E300
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v3.0.00"
+    #define SERIAL_NUMBER	"006"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E3200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"1"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E4200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"9"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E2500
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v3.0.00"
+    #define SERIAL_NUMBER	"6"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == AC2350
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.03"
+    #define SERIAL_NUMBER	"003"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+    #define CYBERTAN_UBOOT_VERSION	"v1.0"
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+    #define CYBERTAN_UBOOT_VERSION	"v1.0"
+  #endif
+
+#endif
+
+#if LINKSYS_MODEL == T_MOBILE
+    #define CFES_BOOT_VERSION	"v5.3"
+#elif LINKSYS_MODEL == E2500
+    //#define CFES_BOOT_VERSION	"v4.13"
+    //#define CFES_BOOT_VERSION	"v5.00"
+    #define CFES_BOOT_VERSION	"v6.07"
+#else
+    #define CFES_BOOT_VERSION	"v5.2"
+#endif
+
+#define LANG_VERSION		"v1.00.00"    //for lang.bin version control(setupwizard)
+#define PMON_BOOT_VERSION	"v1.8"
+#define QCA_WL_VERSION		"v10.2.138.3" /*add for QCA wireless version by Jemmy 2014.5.21*/
+
+
+#if LINKSYS_MODEL == T_MOBILE
+#define BOOT_IPADDR "192.168.0.1"
+#define BOOT_NETMASK "255.255.255.0"
+#else
+#define BOOT_IPADDR "192.168.1.1"
+#define BOOT_NETMASK "255.255.255.0"
+#endif
+
+#define SUPPORT_4712_CHIP	0x0001
+#define SUPPORT_INTEL_FLASH	0x0002
+#define SUPPORT_5325E_SWITCH	0x0004
+#define SUPPORT_4704_CHIP	0x0008
+#define SUPPORT_5352E_CHIP	0x0010
+
+struct code_header {
+	char magic[4];	// Code Pattern
+	char res1[4];	// for extra magic
+	char fwdate[3];	// Firmware build date
+	char fwvern[3];	// Firmware version
+	char id[4];	// U2ND
+	char hw_ver;    // 0) for 4702, 1) for 4712, 2) for 4712L, 3) for 4704, 4) for 5352E
+	unsigned char  sn;	// Serial Number
+	unsigned short flags;
+	unsigned char  stable[2];	// The image is stable (for dual image)
+	unsigned char  try1[2];		// Try to boot image first time (for dual image)
+	unsigned char  try2[2];		// Try to boot image second time (for dual image)
+	unsigned char  try3[2];		// Try to boot image third time (for dual_image)
+	unsigned char  res3[2];
+} ;
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+	unsigned int magic;		/* "CHDR" */
+	unsigned int len;		/* Length of file including header */
+	unsigned int crc32;		/* 32-bit CRC */
+	unsigned int res;	
+};
+
+//#ifdef MULTILANG_SUPPORT
+struct lang_header {
+        char magic[4];
+        char res1[4];   // for extra magic
+        char fwdate[3];
+        char fwvern[3];
+        char id[4];     // U2ND
+        char hw_ver;    // 0: for 4702, 1: for 4712
+	char res2;
+        unsigned long len;
+        unsigned char res3[8];
+} ;
+//#endif
+
+struct boot_header {
+	char magic[3];
+	char res[29];
+};
+
+/***************************************
+ * define upnp misc                    *
+ ***************************************/
+#if OEM == LINKSYS
+  #if LANGUAGE == ENGLISH
+    #define URL			"http://www.linksys.com/"
+  #else
+    #define URL			"http://www.linksys.co.jp/"
+  #endif
+  #define DEV_FRIENDLY_NAME	"Linksys"MODEL_NAME
+  #define DEV_MFR		"Linksys"
+  //#define DEV_MFR_URL		URL
+  #define DEV_MFR_URL		"http://www.linksys.com"
+  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
+  #define DEV_MODEL		MODEL_NAME
+  #define DEV_MODEL_NO		CYBERTAN_VERSION
+  //#define DEV_MODEL_URL		URL
+  #define DEV_MODEL_URL		"http://www.linksys.com/international"
+#elif OEM == PCI
+  #if LANGUAGE == ENGLISH
+    #define URL			"http://www.planex.com/"
+  #else
+    #define URL			"http://www.planex.co.jp/"
+  #endif
+  #define DEV_FRIENDLY_NAME	"BLW-04G Wireless Broadband Router"
+  #define DEV_MFR		"Planex Communciations Inc."
+  #define DEV_MFR_URL		URL
+  #define DEV_MODEL_DESCRIPTION	"Internet Gateway Device with UPnP support"
+  #define DEV_MODEL		"BLW-04G"
+  #define DEV_MODEL_NO 		CYBERTAN_VERSION
+  #define DEV_MODEL_URL		URL
+#else
+  #define URL			""
+  #define DEV_FRIENDLY_NAME	MODEL_NAME
+  #define DEV_MFR		""
+  #define DEV_MFR_URL		URL
+  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
+  #define DEV_MODEL		MODEL_NAME
+  #define DEV_MODEL_NO		CYBERTAN_VERSION
+  #define DEV_MODEL_URL		URL
+#endif
+
+/***************************************
+ * define Parental Control link        *
+ ***************************************/
+#if LOCALE == EUROPE
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/eu/language.jsp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/eu/info_eu.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/en"
+#elif LOCALE == GERMANY
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/de/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/de/info_de.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/de/admin.asp"
+#elif LOCALE == FRANCE
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/fr/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/fr/info_fr.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/fr/admin.asp"
+#else
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/us/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/info.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/us/admin.asp"
+#endif
+
+/***************************************
+ * define PPTP info		       * 
+ ***************************************/
+#if OEM == LINKSYS
+#define	PPTP_VENDOR	"Linksys"
+#else
+#define	PPTP_VENDOR	CT_VENDOR
+#endif
+#define PPTP_HOSTNAME	""
+
+/***************************************
+ * define L2TP info		       *
+ ***************************************/
+#if OEM == LINKSYS
+#define	L2TP_VENDOR	"Linksys"
+#else
+#define	L2TP_VENDOR	CT_VENDOR
+#endif
+#define L2TP_HOSTNAME	MODEL_NAME //2005-03-04 by kanki
diff --git a/tools/firmware-utils/src/linksys/typedefs.h b/tools/firmware-utils/src/linksys/typedefs.h
new file mode 100644
index 0000000000..78989745f9
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/typedefs.h
@@ -0,0 +1,447 @@
+/*
+ * Copyright (C) 2009, Broadcom Corporation
+ * All Rights Reserved.
+ * 
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+ * $Id: typedefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
+ */
+
+#ifndef _TYPEDEFS_H_
+#define _TYPEDEFS_H_
+
+#ifdef SITE_TYPEDEFS
+
+/*
+ * Define SITE_TYPEDEFS in the compile to include a site-specific
+ * typedef file "site_typedefs.h".
+ *
+ * If SITE_TYPEDEFS is not defined, then the code section below makes
+ * inferences about the compile environment based on defined symbols and
+ * possibly compiler pragmas.
+ *
+ * Following these two sections is the Default Typedefs section.
+ * This section is only processed if USE_TYPEDEF_DEFAULTS is
+ * defined. This section has a default set of typedefs and a few
+ * preprocessor symbols (TRUE, FALSE, NULL, ...).
+ */
+
+#include "site_typedefs.h"
+
+#else
+
+/*
+ * Infer the compile environment based on preprocessor symbols and pragmas.
+ * Override type definitions as needed, and include configuration-dependent
+ * header files to define types.
+ */
+
+#ifdef __cplusplus
+
+#define TYPEDEF_BOOL
+#ifndef FALSE
+#define FALSE	false
+#endif
+#ifndef TRUE
+#define TRUE	true
+#endif
+
+#else	/* ! __cplusplus */
+
+#if defined(_WIN32)
+
+#define TYPEDEF_BOOL
+typedef	unsigned char	bool;			/* consistent w/BOOL */
+
+#endif /* _WIN32 */
+
+#endif	/* ! __cplusplus */
+
+#if defined(_WIN64) && !defined(EFI)
+/* use the Windows ULONG_PTR type when compiling for 64 bit */
+#include <basetsd.h>
+#define TYPEDEF_UINTPTR
+typedef ULONG_PTR uintptr;
+#elif defined(__x86_64__)
+#define TYPEDEF_UINTPTR
+typedef unsigned long long int uintptr;
+#endif
+
+#if defined(_HNDRTE_) && !defined(_HNDRTE_SIM_)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(_MINOSL_)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(EFI) && !defined(_WIN64)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(TARGETOS_nucleus)
+/* for 'size_t' type */
+#include <stddef.h>
+
+/* float_t types conflict with the same typedefs from the standard ANSI-C
+** math.h header file. Don't re-typedef them here.
+*/
+#define TYPEDEF_FLOAT_T
+#endif   /* TARGETOS_nucleus */
+
+#if defined(_NEED_SIZE_T_)
+typedef long unsigned int size_t;
+#endif
+
+#ifdef __DJGPP__
+typedef long unsigned int size_t;
+#endif /* __DJGPP__ */
+
+#ifdef _MSC_VER	    /* Microsoft C */
+#define TYPEDEF_INT64
+#define TYPEDEF_UINT64
+typedef signed __int64	int64;
+typedef unsigned __int64 uint64;
+#endif
+
+#if defined(MACOSX)
+#ifdef KERNEL
+#include <libkern/version.h>
+#if VERSION_MAJOR > 10
+#define WLP2P
+#define IO80211P2P
+#define APSTA
+#define WLMCHAN
+#define WL_MULTIQUEUE
+#define WL_BSSCFG_TX_SUPR
+#define WIFI_ACT_FRAME
+#define FAST_ACTFRM_TX
+#endif
+#endif /* KERNEL */
+#define TYPEDEF_BOOL
+#endif
+
+#if defined(__NetBSD__)
+#define TYPEDEF_ULONG
+#endif
+
+#if defined(__sparc__)
+#define TYPEDEF_ULONG
+#endif
+
+
+#ifdef	linux
+/*
+ * If this is either a Linux hybrid build or the per-port code of a hybrid build
+ * then use the Linux header files to get some of the typedefs.  Otherwise, define
+ * them entirely in this file.  We can't always define the types because we get
+ * a duplicate typedef error; there is no way to "undefine" a typedef.
+ * We know when it's per-port code because each file defines LINUX_PORT at the top.
+ */
+#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
+#define TYPEDEF_UINT
+#ifndef TARGETENV_android
+#define TYPEDEF_USHORT
+#define TYPEDEF_ULONG
+#endif /* TARGETENV_android */
+#ifdef __KERNEL__
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
+#define TYPEDEF_BOOL
+#endif	/* >= 2.6.19 */
+#endif	/* __KERNEL__ */
+#endif  /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
+#endif	/* linux */
+
+#if defined(__ECOS)
+#define TYPEDEF_UCHAR
+#define TYPEDEF_UINT
+#define TYPEDEF_USHORT
+#define TYPEDEF_ULONG
+#define TYPEDEF_BOOL
+#endif
+
+#if !defined(linux) && !defined(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) && \
+	!defined(__DJGPP__) && !defined(__ECOS) && !defined(__BOB__) && \
+	!defined(TARGETOS_nucleus)
+#define TYPEDEF_UINT
+#define TYPEDEF_USHORT
+#endif
+
+
+/* Do not support the (u)int64 types with strict ansi for GNU C */
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define TYPEDEF_INT64
+#define TYPEDEF_UINT64
+#endif
+
+/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
+ * for signed or unsigned
+ */
+#if defined(__ICL)
+
+#define TYPEDEF_INT64
+
+#if defined(__STDC__)
+#define TYPEDEF_UINT64
+#endif
+
+#endif /* __ICL */
+
+#if !defined(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) && !defined(__DJGPP__) && \
+	!defined(__BOB__) && !defined(TARGETOS_nucleus)
+
+/* pick up ushort & uint from standard types.h */
+#if defined(linux) && defined(__KERNEL__)
+
+/* See note above */
+#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
+#ifdef USER_MODE
+#include <sys/types.h>
+#else
+#include <linux/types.h>	/* sys/types.h and linux/types.h are oil and water */
+#endif /* USER_MODE */
+#endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
+
+#else
+
+#if defined(__ECOS)
+#include <pkgconf/infra.h>
+#include <cyg/infra/cyg_type.h>
+#include <stdarg.h>
+#endif
+
+#include <sys/types.h>
+
+#endif /* linux && __KERNEL__ */
+
+#endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_  && !_MINOSL_ && !__DJGPP__ */
+
+#if defined(MACOSX)
+
+#ifdef __BIG_ENDIAN__
+#define IL_BIGENDIAN
+#else
+#ifdef IL_BIGENDIAN
+#error "IL_BIGENDIAN was defined for a little-endian compile"
+#endif
+#endif /* __BIG_ENDIAN__ */
+
+#if !defined(__cplusplus)
+
+#if defined(__i386__)
+typedef unsigned char bool;
+#else
+typedef unsigned int bool;
+#endif
+#define TYPE_BOOL 1
+enum {
+    false	= 0,
+    true	= 1
+};
+
+#if defined(KERNEL)
+#include <IOKit/IOTypes.h>
+#endif /* KERNEL */
+
+#endif /* __cplusplus */
+
+#endif /* MACOSX */
+
+
+/* use the default typedefs in the next section of this file */
+#define USE_TYPEDEF_DEFAULTS
+
+#endif /* SITE_TYPEDEFS */
+
+
+/*
+ * Default Typedefs
+ */
+
+#ifdef USE_TYPEDEF_DEFAULTS
+#undef USE_TYPEDEF_DEFAULTS
+
+#ifndef TYPEDEF_BOOL
+typedef	/* @abstract@ */ unsigned char	bool;
+#endif
+
+/* define uchar, ushort, uint, ulong */
+
+#ifndef TYPEDEF_UCHAR
+typedef unsigned char	uchar;
+#endif
+
+#ifndef TYPEDEF_USHORT
+typedef unsigned short	ushort;
+#endif
+
+#ifndef TYPEDEF_UINT
+typedef unsigned int	uint;
+#endif
+
+#ifndef TYPEDEF_ULONG
+typedef unsigned long	ulong;
+#endif
+
+/* define [u]int8/16/32/64, uintptr */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char	uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short	uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned int	uint32;
+#endif
+
+#ifndef TYPEDEF_UINT64
+typedef unsigned long long uint64;
+#endif
+
+#ifndef TYPEDEF_UINTPTR
+typedef unsigned int	uintptr;
+#endif
+
+#ifndef TYPEDEF_INT8
+typedef signed char	int8;
+#endif
+
+#ifndef TYPEDEF_INT16
+typedef signed short	int16;
+#endif
+
+#ifndef _SLHC_H
+#ifndef TYPEDEF_INT32
+typedef signed int	int32;
+#endif
+#endif
+
+#ifndef TYPEDEF_INT64
+typedef signed long long int64;
+#endif
+
+/* define float32/64, float_t */
+
+#ifndef TYPEDEF_FLOAT32
+typedef float		float32;
+#endif
+
+#ifndef TYPEDEF_FLOAT64
+typedef double		float64;
+#endif
+
+/*
+ * abstracted floating point type allows for compile time selection of
+ * single or double precision arithmetic.  Compiling with -DFLOAT32
+ * selects single precision; the default is double precision.
+ */
+
+#ifndef TYPEDEF_FLOAT_T
+
+#if defined(FLOAT32)
+typedef float32 float_t;
+#else /* default to double precision floating point */
+typedef float64 float_t;
+#endif
+
+#endif /* TYPEDEF_FLOAT_T */
+
+/* define macro values */
+
+#ifndef FALSE
+#define FALSE	0
+#endif
+
+#ifndef TRUE
+#define TRUE	1  /* TRUE */
+#endif
+
+#ifndef NULL
+#define	NULL	0
+#endif
+
+#ifndef OFF
+#define	OFF	0
+#endif
+
+#ifndef ON
+#define	ON	1  /* ON = 1 */
+#endif
+
+#define	AUTO	(-1) /* Auto = -1 */
+
+/* define PTRSZ, INLINE */
+
+#ifndef PTRSZ
+#define	PTRSZ	sizeof(char*)
+#endif
+
+
+/* Detect compiler type. */
+#ifdef _MSC_VER
+	#define BWL_COMPILER_MICROSOFT
+#elif defined(__GNUC__)
+	#define BWL_COMPILER_GNU
+#elif defined(__CC_ARM) && __CC_ARM
+	#define BWL_COMPILER_ARMCC
+#else
+	#error "Unknown compiler!"
+#endif /* _MSC_VER */
+
+
+#ifndef INLINE
+	#if defined(BWL_COMPILER_MICROSOFT)
+		#define INLINE __inline
+	#elif defined(BWL_COMPILER_GNU)
+		#define INLINE __inline__
+	#elif defined(BWL_COMPILER_ARMCC)
+		#define INLINE	__inline
+	#else
+		#define INLINE
+	#endif /* _MSC_VER */
+#endif /* INLINE */
+
+#undef TYPEDEF_BOOL
+#undef TYPEDEF_UCHAR
+#undef TYPEDEF_USHORT
+#undef TYPEDEF_UINT
+#undef TYPEDEF_ULONG
+#undef TYPEDEF_UINT8
+#undef TYPEDEF_UINT16
+#undef TYPEDEF_UINT32
+#undef TYPEDEF_UINT64
+#undef TYPEDEF_UINTPTR
+#undef TYPEDEF_INT8
+#undef TYPEDEF_INT16
+#undef TYPEDEF_INT32
+#undef TYPEDEF_INT64
+#undef TYPEDEF_FLOAT32
+#undef TYPEDEF_FLOAT64
+#undef TYPEDEF_FLOAT_T
+
+#endif /* USE_TYPEDEF_DEFAULTS */
+
+/* Suppress unused parameter warning */
+#define UNUSED_PARAMETER(x) (void)(x)
+
+/*
+ * Including the bcmdefs.h here, to make sure everyone including typedefs.h
+ * gets this automatically
+*/
+#include "bcmdefs.h"
+/*
+ * If android target is building then include this file
+ */
+#ifndef LINUX_HYBRID
+#ifdef TARGETENV_android
+#include <bcm_android_types.h>
+#endif /* TARGETENV_android */
+#endif /* LINUX_HYBRID */
+
+#endif /* _TYPEDEFS_H_ */
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:45:30 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:45:30 +0300
Subject: [PATCH v3 0/4] ipq806x: add support for Linksys E8350 - Cover letter
Message-ID: <20200901044534.329-1-todorcolov@abv.bg>

bundle of 4 patches to add support for Linksys E8350 dual band wifi router type AC2350

FCC ID: Q87-E8350
	- device specifications are already in place under the openwrt wiki URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
	- successful test firmware has been confirmed by me and several users under developer forum: https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
	via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
		- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: +2 / +3
		- WLAN ath10k 2Ghz: via /etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
		- WLAN quantenna 5Ghz: set during quantenna firmware load - it has separate SPI flash not accessible via Openwrt OS

	The device label lists only one mac address

Installation:
	via stock WEB interface

Notes:
	Quantenna 5Ghz Wifi requires separate packages for loading its firmware and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys FW header genarator 	- needed for factory FW
    updata over stock WEB interface

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++
 target/linux/ipq806x/image/Makefile           |  29 ++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 tools/firmware-utils/Makefile                 |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
 tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
 .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
 tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
 tools/firmware-utils/src/linksys/crc.h        |  69 +++
 tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
 16 files changed, 2351 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:45:31 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:45:31 +0300
Subject: [PATCH v3 1/4] ipq806x: add support for Linksys E8350
In-Reply-To: <20200901044534.329-1-todorcolov@abv.bg>
References: <20200901044534.329-1-todorcolov@abv.bg>
Message-ID: <20200901044534.329-2-todorcolov@abv.bg>

---
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
 target/linux/ipq806x/image/Makefile           |  29 +++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
 	ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" "usb2-port1"
 	ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" "usb3-port1"
 	;;
+linksys,e8350-v1)
+        ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+        ;;
 nec,wg2600hp)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..3dfad72232 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -55,6 +55,7 @@ qcom,ipq8064-db149)
 	ucidef_add_switch "switch0" \
 		"1:lan" "2:lan" "3:lan" "4:lan" "6u at eth1" "5:wan" "0u at eth0"
 	;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
 	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
 	ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..4f4fb12ef0 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
 		nand_do_upgrade "$1"
 		;;
 	compex,wpq864|\
+	linksys,e8350-v1|\
 	netgear,d7800 |\
 	netgear,r7500 |\
 	netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 0000000000..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+	model = "Linksys E8350 V1 WiFi Router";
+	compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+	memory at 0 {
+		reg = <0x42000000 0x1e000000>;
+		device_type = "memory";
+	};
+
+	aliases {
+		serial0 = &gsbi4_serial;
+
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&button_pins>;
+		pinctrl-names = "default";
+
+		reset {
+			label = "reset";
+			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		wifi {
+			label = "wifi";
+			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+		};
+	};
+
+	nand-controller at 1ac00000 {
+		compatible = "qcom,ipq806x-nand";
+		reg = <0x1ac00000 0x800>;
+		clocks = <&gcc EBI2_CLK>,
+			<&gcc EBI2_AON_CLK>;
+		clock-names = "core", "aon";
+		dmas = <&adm_dma 3>;
+		dma-names = "rxtx";
+		qcom,cmd-crci = <15>;
+		qcom,data-crci = <3>;
+
+		nand at 0 {
+			reg = <0>;
+
+			nand-ecc-strength = <4>;
+			nand-bus-width = <8>;
+
+			partitions {
+				compatible = "fixed-partitions";
+
+				partition at 0 {
+					label = "ubi";
+					reg = <0 0x4000000>;
+				};
+	
+				partition at 4000000 {
+					label = "extra";
+					reg = <0x4000000 0x4000000>;
+				};
+			};
+		};
+	};
+
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&led_pins>;
+		pinctrl-names = "default";
+
+		led_power: power {
+			label = "e8350-v1:green:power";
+			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+		};
+
+		wps {
+			label = "e8350-v1:green:wps";
+			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
+                };
+
+		wifi {
+			label = "e8350-v1:green:wifi";
+			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&qcom_pinmux {
+	button_pins: button_pins {
+		mux {
+			pins = "gpio68","gpio65", "gpio67";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	led_pins: led_pins {
+		mux {
+			pins = "gpio26","gpio53", "gpio54";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+};
+
+&gsbi4 {
+	qcom,mode = <GSBI_PROT_I2C_UART>;
+	status = "okay";
+	serial at 16340000 {
+		status = "okay";
+	};
+	/*
+	* The i2c device on gsbi4 should not be enabled.
+	* On ipq806x designs gsbi4 i2c is meant for exclusive
+	* RPM usage. Turning this on in kernel manifests as
+	* i2c failure for the RPM.
+	*/
+};
+&gsbi5 {
+	qcom,mode = <GSBI_PROT_SPI>;
+	status = "okay";
+
+	spi5: spi at 1a280000 {
+		status = "okay";
+
+		pinctrl-0 = <&spi_pins>;
+		pinctrl-names = "default";
+
+		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
+
+		m25p80 at 0 {
+			compatible = "jedec,spi-nor";
+			spi-max-frequency = <51200000>;
+			reg = <0>;
+
+			partitions {
+				compatible = "qcom,smem";
+			};
+		};
+	};
+};
+
+&sata_phy {
+	status = "okay";
+};
+
+&sata {
+	status = "okay";
+};
+
+&usb3_0 {
+	clocks = <&gcc USB30_1_MASTER_CLK>;
+	status = "okay";
+};
+
+&usb3_1 {
+	clocks = <&gcc USB30_0_MASTER_CLK>;
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
+
+&pcie1 {
+	status = "okay";
+};
+
+&pcie2 {
+	status = "okay";
+};
+
+&mdio0 {
+	status = "okay";
+
+	pinctrl-0 = <&mdio0_pins>;
+	pinctrl-names = "default";
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+		qca,ar8327-initvals = <
+			0x00004 0x7600000   /* PAD0_MODE */
+			0x00008 0x1000000   /* PAD5_MODE */
+			0x0000c 0x80        /* PAD6_MODE */
+			0x00010 0x2613a0    /* PWS_REG */
+			0x000e4 0x6a545     /* MAC_POWER_SEL */
+			0x000e0 0xc74164de  /* SGMII_CTRL */
+			0x0007c 0x4e        /* PORT0_STATUS */
+			0x00094 0x4e        /* PORT6_STATUS */
+			>;
+	};
+};
+
+&gmac1 {
+	status = "okay";
+	phy-mode = "rgmii";
+	qcom,id = <1>;
+
+	pinctrl-0 = <&rgmii2_pins>;
+	pinctrl-names = "default";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&gmac2 {
+	status = "okay";
+	phy-mode = "sgmii";
+	qcom,id = <2>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&tcsr {
+	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
+	compatible = "qcom,tcsr";
+};
+
+&adm_dma {
+	status = "okay";
+};
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index 5cc66daa21..af428db9fd 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -13,6 +13,17 @@ define Build/buffalo-rootfs-cksum
 	) >> $@
 endef
 
+# tune addpattern for Linksys E8350-V1 fw pattern generation
+define Build/linksys-bin
+        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
+        mv $@.new $@
+endef
+# Use Linksys fw header generator to upgrade openwrt factory image over the native Linksys WEB interface
+define Build/linksys-addfwhdr
+        -$(STAGING_DIR_HOST)/bin/linksys/addfwhdr -i $@ -o $@.new \
+       	;mv "$@.new" "$@"
+endef
+
 define Device/Default
 	PROFILES := Default
 	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
@@ -109,6 +120,24 @@ define Device/compex_wpq864
 endef
 TARGET_DEVICES += compex_wpq864
 
+define Device/linksys_e8350-v1
+        $(call Device/LegacyImage)
+        DEVICE_VENDOR := Linksys
+        DEVICE_MODEL := E8350
+        DEVICE_VARIANT := v1
+        SOC := qcom-ipq8064
+        FW_VERSION := v1.0.03.003
+        FW_DEVICE_ID := 8350
+        PAGESIZE := 2048
+        BLOCKSIZE := 128k
+        KERNEL_IN_UBI := 1
+        IMAGES = factory.bin sysupgrade.ubi
+        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 | append-metadata
+        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-addfwhdr | linksys-bin
+        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct
+endef
+TARGET_DEVICES += linksys_e8350-v1
+
 define Device/linksys_ea7500-v1
 	$(call Device/LegacyImage)
 	DEVICE_VENDOR := Linksys
diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
index 8cdd198c29..f88252d8a6 100644
--- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -843,6 +843,19 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -843,6 +843,20 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-ipq4019-ap.dk07.1-c1.dtb \
  	qcom-ipq4019-ap.dk07.1-c2.dtb \
  	qcom-ipq8064-ap148.dtb \
@@ -18,6 +18,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq8064-d7800.dtb \
 +	qcom-ipq8064-db149.dtb \
 +	qcom-ipq8064-ap161.dtb \
++	qcom-ipq8064-e8350-v1.dtb \
 +	qcom-ipq8064-ea7500-v1.dtb \
 +	qcom-ipq8064-ea8500.dtb \
 +	qcom-ipq8064-r7500.dtb \
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:45:32 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:45:32 +0300
Subject: [PATCH v3 2/4] package: fix nand.sh fwtool trailer removal for UBIFS
In-Reply-To: <20200901044534.329-1-todorcolov@abv.bg>
References: <20200901044534.329-1-todorcolov@abv.bg>
Message-ID: <20200901044534.329-3-todorcolov@abv.bg>

---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
 	local mtddev="/dev/mtd${mtdnum}"
 	ubidetach -p "${mtddev}" || true
 	sync
+	fwtool -q -t -i /dev/null "$1"
 	ubiformat "${mtddev}" -y -f "${ubi_file}"
 	ubiattach -p "${mtddev}"
 	nand_do_upgrade_success
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:45:33 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:45:33 +0300
Subject: [PATCH v3 3/4] package: fix wifi off/on functional button
In-Reply-To: <20200901044534.329-1-todorcolov@abv.bg>
References: <20200901044534.329-1-todorcolov@abv.bg>
Message-ID: <20200901044534.329-4-todorcolov@abv.bg>

---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0



From todorcolov at abv.bg  Tue Sep  1 00:45:34 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Tue,  1 Sep 2020 07:45:34 +0300
Subject: [PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator
In-Reply-To: <20200901044534.329-1-todorcolov@abv.bg>
References: <20200901044534.329-1-todorcolov@abv.bg>
Message-ID: <20200901044534.329-5-todorcolov@abv.bg>

---
 tools/firmware-utils/Makefile                 |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
 tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
 .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
 tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
 tools/firmware-utils/src/linksys/crc.h        |  69 +++
 tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..1dcbd0db77 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -24,6 +24,8 @@ endef
 
 define Host/Compile
 	mkdir -p $(HOST_BUILD_DIR)/bin
+	mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+	$(call cc,linksys/addfwhdr linksys/crc )
 	$(call cc,add_header)
 	$(call cc,addpattern)
 	$(call cc,asustrx)
@@ -98,7 +100,7 @@ define Host/Compile
 endef
 
 define Host/Install
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+	$(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 0000000000..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <getopt.h>
+#include <time.h>
+#include <sys/time.h>
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF	1024
+#define CRC32_INIT_VALUE 0xffffffff	/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+	va_list args;
+	va_start(args, str);
+	vfprintf(stderr, str, args);
+	fputc('\n', stderr);
+	exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+	unsigned char buf[1];
+	int i;
+
+	fprintf(stderr,"Fill null\n");
+
+	buf[0] = 0xff;
+	for (i=0 ; i< size; i++ )
+		if (write(fd_w, buf, 1) != 1)
+			return 0;
+
+	return 1;
+}
+
+long
+file_open(const char *name)
+{
+	struct stat sb;
+	if ((fd = open(name, O_RDONLY, 0)) < 0){
+		die("Unable to open `%s' : %m", name);
+	}
+
+	if (fstat (fd, &sb))
+		die("Unable to stat `%s' : %m", name);
+
+	return sb.st_size;
+}
+
+void usage(void)
+{
+	die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+	uint input_size,c;
+	char *input_file=NULL, *output_file=NULL;
+        int opt;
+        int option_index=0;
+	int garbage = 0;
+	char *buf = NULL;
+        extern char *optarg;
+        extern int optind, opterr, optopt;
+	
+	struct cbt_fw_header *fwhdr;
+	uint32 crc;	
+
+        static struct option long_options[] =
+	{
+		{"input", 1, 0, 'i'},
+		{"output", 1, 0, 'o'},
+		{"garbage", 0, 0, 'g'},
+		{0, 0, 0, 0}
+	};
+
+	printf("\n---------- add fw header --------\n");
+
+        fwhdr  = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+
+	while(1){
+		opt = getopt_long(argc, argv, "i:o:g",long_options, &option_index);
+		if(opt == -1)
+			break;
+		switch(opt){
+			case 'h' : 
+				usage(); break;
+			case 'i' :
+				input_file = optarg;
+				printf("input file is [%s]\n",input_file); break;
+			case 'o' :
+				output_file = optarg;
+				printf("output file is [%s]\n",output_file); break;
+			case 'g' :
+				garbage = 1; break;
+			default :
+				usage();
+		}
+	}
+
+	if(!input_file || !output_file)
+	{
+		printf("You must specify the input and output file!\n");
+		usage();
+	}
+
+	
+	unlink(output_file);
+	if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREAD | S_IWRITE)) < 0){
+		die("Unable to open `%s' : %m", output_file);
+	}
+	
+	fwhdr = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+	
+	memcpy((char *)&fwhdr->magic, FWHDR_MAGIC_STR, sizeof(fwhdr->magic));
+	
+	input_size = file_open(input_file);
+	if(!(buf = malloc(input_size)))
+	{
+		perror("malloc");
+		goto fail;
+	}
+	c = read(fd, buf, input_size);
+	fwhdr->len = input_size + sizeof(struct cbt_fw_header);
+
+	fwhdr->res = fwhdr->res | 0x1;
+	
+	//junzhao add fw build date in cbt_fw_header for calculate MD5
+	#if 0
+	{
+	       static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+	       int year, day, mon=1;
+               char temp[10]={0};
+	       unsigned char *p_date = (unsigned char *)&fwhdr->res;
+               int j;
+
+               sscanf(__DATE__, "%s %d %d", temp, &day, &year);
+       
+               for(j=0;j<12;j++) {
+                       if(!strcmp(temp, months[j])) {
+                               mon = j+1;
+                               break;
+                       }
+               }
+               p_date[0]= year-2000;
+               p_date[1]= mon;
+               p_date[2]= day;
+
+	       printf("%s: Build date(20%d-%d-%d)\n", __FUNCTION__, p_date[0], p_date[1], p_date[2]);
+
+	}
+	#endif
+	//end
+	
+	crc = crc32((uint8 *)&fwhdr->res, 4, CRC32_INIT_VALUE);
+	crc = crc32((uint8 *)&buf[0], input_size, crc);
+	
+	fwhdr->crc32 = crc;
+
+	/* write code pattern header */
+	write(fd_w, fwhdr, sizeof(struct cbt_fw_header));
+
+	if(write(fd_w, buf, c)!=c)
+		die("Write call failed!\n");
+	
+#if 0
+	if(garbage == 1){			// add garbage, let image is a multiple of 1024, and the web upgrade will ok
+		printf("Add %d bytes garbage\n",1024-32);	
+		if(!fill_null0(1024-32))
+			die("error!\n");
+	}
+#endif
+fail:
+	if(buf)
+		free(buf);
+	close (fd);
+	close (fd_w);
+	
+	return 0;
+}
diff --git a/tools/firmware-utils/src/linksys/bcmdefs.h b/tools/firmware-utils/src/linksys/bcmdefs.h
new file mode 100644
index 0000000000..edd7397892
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/bcmdefs.h
@@ -0,0 +1,318 @@
+/*
+ * Misc system wide definitions
+ *
+ * Copyright (C) 2009, Broadcom Corporation
+ * All Rights Reserved.
+ * 
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+ *
+ * $Id: bcmdefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
+ */
+
+#ifndef	_bcmdefs_h_
+#define	_bcmdefs_h_
+
+/*
+ * One doesn't need to include this file explicitly, gets included automatically if
+ * typedefs.h is included.
+ */
+
+/* Use BCM_REFERENCE to suppress warnings about intentionally-unused function
+ * arguments or local variables.
+ */
+#define BCM_REFERENCE(data)	((void)data)
+
+/* Reclaiming text and data :
+ * The following macros specify special linker sections that can be reclaimed
+ * after a system is considered 'up'.
+ * BCMATTACHFN is also used for detach functions (it's not worth having a BCMDETACHFN,
+ * as in most cases, the attach function calls the detach function to clean up on error).
+ */
+#ifdef DONGLEBUILD
+
+extern bool bcmreclaimed;
+
+#define BCMATTACHDATA(_data)	__attribute__ ((__section__ (".dataini2." #_data))) _data
+#define BCMATTACHFN(_fn)	__attribute__ ((__section__ (".textini2." #_fn))) _fn
+
+#define BCMPREATTACHDATA(_data)	__attribute__ ((__section__ (".dataini2." #_data))) _data
+#define BCMPREATTACHFN(_fn)	__attribute__ ((__section__ (".textini2." #_fn))) _fn
+
+#if defined(BCMRECLAIM)
+#define BCMINITDATA(_data)	__attribute__ ((__section__ (".dataini1." #_data))) _data
+#define BCMINITFN(_fn)		__attribute__ ((__section__ (".textini1." #_fn))) _fn
+#define CONST
+#else
+#define BCMINITDATA(_data)	_data
+#define BCMINITFN(_fn)		_fn
+#define CONST	const
+#endif
+
+/* Non-manufacture or internal attach function/dat */
+#if !defined(WLTEST)
+#define	BCMNMIATTACHFN(_fn)	BCMATTACHFN(_fn)
+#define	BCMNMIATTACHDATA(_data)	BCMATTACHDATA(_data)
+#else
+#define	BCMNMIATTACHFN(_fn)	_fn
+#define	BCMNMIATTACHDATA(_data)	_data
+#endif	
+
+#define BCMUNINITFN(_fn)	_fn
+
+#define BCMFASTPATH
+
+#else /* DONGLEBUILD */
+
+#define bcmreclaimed 		0
+#define BCMATTACHDATA(_data)	_data
+#define BCMATTACHFN(_fn)	_fn
+#define BCMPREATTACHDATA(_data)	_data
+#define BCMPREATTACHFN(_fn)	_fn
+#define BCMINITDATA(_data)	_data
+#define BCMINITFN(_fn)		_fn
+#define BCMUNINITFN(_fn)	_fn
+#define	BCMNMIATTACHFN(_fn)	_fn
+#define	BCMNMIATTACHDATA(_data)	_data
+#define CONST	const
+#ifdef mips
+#define BCMFASTPATH		__attribute__ ((__section__(".text.fastpath")))
+#else
+#define BCMFASTPATH
+#endif
+
+#endif /* DONGLEBUILD */
+
+#if defined(BCMROMOFFLOAD) || defined(BCMROMBUILD)
+typedef struct {
+	uint16 esiz;
+	uint16 cnt;
+	void *addr;
+} bcmromdat_patch_t;
+#endif
+
+/* Put some library data/code into ROM to reduce RAM requirements */
+#if defined(BCMROMOFFLOAD)
+#define BCMROMDATA(_data)	__attribute__ ((weak, __section__ (".datarom."#_data))) _data
+#define BCMROMDAT_NAME(_data)	_data
+#define BCMROMFN(_fn)		__attribute__ ((weak, long_call, __section__ (".textrom."#_fn))) _fn
+#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
+#define BCMROMDAT_SIZEOF(data)	sizeof(data)
+#define BCMROMDAT_APATCH(data) \
+	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
+	{ sizeof(data[0]), sizeof(data)/sizeof(data[0]), ((void*)data) };
+#define BCMROMDAT_SPATCH(data) \
+	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
+	{ sizeof(data), 1, ((void*)&data) };
+#define BCMROMFN_NAME(_fn)	_fn
+#define STATIC
+#elif defined(BCMROMBUILD)
+#include <bcmjmptbl.h>
+#define STATIC
+#else /* !BCMROMBUILD */
+#define BCMROMDATA(_data)	_data
+#define BCMROMDAT_NAME(_data)	_data
+#define BCMROMFN(_fn)		_fn
+#define BCMROMFN_NAME(_fn)	_fn
+#define STATIC	static
+#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
+#define BCMROMDAT_SIZEOF(data)	sizeof(data)
+#define BCMROMDAT_APATCH(data)
+#define BCMROMDAT_SPATCH(data)
+#endif /* !BCMROMBUILD */
+
+/* Bus types */
+#define	SI_BUS			0	/* SOC Interconnect */
+#define	PCI_BUS			1	/* PCI target */
+#define	PCMCIA_BUS		2	/* PCMCIA target */
+#define SDIO_BUS		3	/* SDIO target */
+#define JTAG_BUS		4	/* JTAG */
+#define USB_BUS			5	/* USB (does not support R/W REG) */
+#define SPI_BUS			6	/* gSPI target */
+#define RPC_BUS			7	/* RPC target */
+
+/* Allows size optimization for single-bus image */
+#ifdef BCMBUSTYPE
+#define BUSTYPE(bus) 	(BCMBUSTYPE)
+#else
+#define BUSTYPE(bus) 	(bus)
+#endif
+
+/* Allows size optimization for single-backplane image */
+#ifdef BCMCHIPTYPE
+#define CHIPTYPE(bus) 	(BCMCHIPTYPE)
+#else
+#define CHIPTYPE(bus) 	(bus)
+#endif
+
+
+/* Allows size optimization for SPROM support */
+#if defined(BCMSPROMBUS)
+#define SPROMBUS	(BCMSPROMBUS)
+#elif defined(SI_PCMCIA_SROM)
+#define SPROMBUS	(PCMCIA_BUS)
+#else
+#define SPROMBUS	(PCI_BUS)
+#endif
+
+/* Allows size optimization for single-chip image */
+#ifdef BCMCHIPID
+#define CHIPID(chip)	(BCMCHIPID)
+#else
+#define CHIPID(chip)	(chip)
+#endif
+
+#ifdef BCMCHIPREV
+#define CHIPREV(rev)	(BCMCHIPREV)
+#else
+#define CHIPREV(rev)	(rev)
+#endif
+
+/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
+#define DMADDR_MASK_32 0x0		/* Address mask for 32-bits */
+#define DMADDR_MASK_30 0xc0000000	/* Address mask for 30-bits */
+#define DMADDR_MASK_0  0xffffffff	/* Address mask for 0-bits (hi-part) */
+
+#define	DMADDRWIDTH_30  30 /* 30-bit addressing capability */
+#define	DMADDRWIDTH_32  32 /* 32-bit addressing capability */
+#define	DMADDRWIDTH_63  63 /* 64-bit addressing capability */
+#define	DMADDRWIDTH_64  64 /* 64-bit addressing capability */
+
+#ifdef BCMDMA64OSL
+typedef struct {
+	uint32 loaddr;
+	uint32 hiaddr;
+} dma64addr_t;
+
+typedef dma64addr_t dmaaddr_t;
+#define PHYSADDRHI(_pa) ((_pa).hiaddr)
+#define PHYSADDRHISET(_pa, _val) \
+	do { \
+		(_pa).hiaddr = (_val);		\
+	} while (0)
+#define PHYSADDRLO(_pa) ((_pa).loaddr)
+#define PHYSADDRLOSET(_pa, _val) \
+	do { \
+		(_pa).loaddr = (_val);		\
+	} while (0)
+
+#else
+typedef unsigned long dmaaddr_t;
+#define PHYSADDRHI(_pa) (0)
+#define PHYSADDRHISET(_pa, _val)
+#define PHYSADDRLO(_pa) ((_pa))
+#define PHYSADDRLOSET(_pa, _val) \
+	do { \
+		(_pa) = (_val);			\
+	} while (0)
+#endif /* BCMDMA64OSL */
+
+/* One physical DMA segment */
+typedef struct  {
+	dmaaddr_t addr;
+	uint32	  length;
+} hnddma_seg_t;
+
+#if defined(MACOSX)
+/* In MacOS, the OS API may return large number of segments. Setting this number lower
+ * will result in failure of dma map
+ */
+#define MAX_DMA_SEGS 8
+#else
+#define MAX_DMA_SEGS 4
+#endif
+
+
+typedef struct {
+	void *oshdmah; /* Opaque handle for OSL to store its information */
+	uint origsize; /* Size of the virtual packet */
+	uint nsegs;
+	hnddma_seg_t segs[MAX_DMA_SEGS];
+} hnddma_seg_map_t;
+
+
+/* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
+ * By doing, we avoid the need  to allocate an extra buffer for the header when bridging to WL.
+ * There is a compile time check in wlc.c which ensure that this value is at least as big
+ * as TXOFF. This value is used in dma_rxfill (hnddma.c).
+ */
+
+#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
+/* add 40 bytes to allow for extra RPC header and info  */
+#define BCMEXTRAHDROOM 220
+#else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+#ifdef CTFMAP
+#define BCMEXTRAHDROOM 176
+#else /* CTFMAP */
+#define BCMEXTRAHDROOM 172
+#endif /* CTFMAP */
+#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
+
+/* Headroom required for dongle-to-host communication.  Packets allocated
+ * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
+ * leave this much room in front for low-level message headers which may
+ * be needed to get across the dongle bus to the host.  (These messages
+ * don't go over the network, so room for the full WL header above would
+ * be a waste.).
+ */
+#ifdef BCMUSBDEV
+#define BCMDONGLEHDRSZ 0
+#define BCMDONGLEPADSZ 0
+#else
+#define BCMDONGLEHDRSZ 12
+#define BCMDONGLEPADSZ 16
+#endif
+
+#define BCMDONGLEOVERHEAD	(BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
+
+#ifdef BCMDBG
+
+#ifndef BCMDBG_ERR
+#define BCMDBG_ERR
+#endif /* BCMDBG_ERR */
+
+#ifndef BCMDBG_ASSERT
+#define BCMDBG_ASSERT
+#endif /* BCMDBG_ASSERT */
+
+#endif /* BCMDBG */
+
+#if defined(BCMDBG_ASSERT) || defined(BCMASSERT_LOG)
+#define BCMASSERT_SUPPORT
+#endif /* BCMDBG_ASSERT || BCMASSERT_LOG */
+
+/* Macros for doing definition and get/set of bitfields
+ * Usage example, e.g. a three-bit field (bits 4-6):
+ *    #define <NAME>_M	BITFIELD_MASK(3)
+ *    #define <NAME>_S	4
+ * ...
+ *    regval = R_REG(osh, &regs->regfoo);
+ *    field = GFIELD(regval, <NAME>);
+ *    regval = SFIELD(regval, <NAME>, 1);
+ *    W_REG(osh, &regs->regfoo, regval);
+ */
+#define BITFIELD_MASK(width) \
+		(((unsigned)1 << (width)) - 1)
+#define GFIELD(val, field) \
+		(((val) >> field ## _S) & field ## _M)
+#define SFIELD(val, field, bits) \
+		(((val) & (~(field ## _M << field ## _S))) | \
+		 ((unsigned)(bits) << field ## _S))
+
+/* define BCMSMALL to remove misc features for memory-constrained environments */
+#ifdef BCMSMALL
+#undef	BCMSPACE
+#define bcmspace	FALSE	/* if (bcmspace) code is discarded */
+#else
+#define	BCMSPACE
+#define bcmspace	TRUE	/* if (bcmspace) code is retained */
+#endif
+
+/* Max. nvram variable table size */
+#define	MAXSZ_NVRAM_VARS	4096
+
+#define LOCATOR_EXTERN static
+
+#endif /* _bcmdefs_h_ */
diff --git a/tools/firmware-utils/src/linksys/code_pattern.h b/tools/firmware-utils/src/linksys/code_pattern.h
new file mode 100644
index 0000000000..0bbaa1102d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/code_pattern.h
@@ -0,0 +1,396 @@
+#ifndef _CODE_PATTERN_H_
+#define _CODE_PATTERN_H_
+
+#define CODE_ID		"U2ND"
+#define BOOT_PATTERN	"EST"
+#define UP_PMON		1
+#define UP_MAC		2
+#define UP_CODE		3
+#define UP_PIGGY	4
+#define UP_EOU_KEY	5
+#define UP_SN		6
+#define UP_LANG		7
+#define UP_T_CERT	8
+#define CMP_T_CERT	9	//for factory test.
+#define UP_CODE2       10
+#define UP_FULL_WL     11
+#define UP_WSC_PIN     12
+#define UP_COUNTRY     13
+#define UP_QUAN_BOOT   14
+#define UP_QUAN_IMAGE   15
+
+#define LINKSYS		7
+#define PCI_OEM		9	// <remove the line>
+#define ELSA		10	// <remove the line>
+#define ALLNET		11	// <remove the line>
+#define REENET		12	// 2003/06/21	<remove the line>
+#define CISCO		90
+#define	OTHER_OEM	99	// <remove the line>
+
+#define ENGLISH 	1
+#define JAPANESE	2
+#define GERMAN		3
+#define FRENCH		4
+#define KOREAN		5
+
+#define	USA		1
+#define	JAPAN		2
+#define	EUROPE		3
+#define WW		4
+#define GERMANY		5
+#define	KOREA		6
+#define	FRANCE		7
+
+#define	WRT54G		1
+#define	WRT54GS		2
+#define	WRT54V5		3
+#define	DPN		4
+#define	RTA41		5
+#define	WRT54G3G	6
+#define	T_MOBILE 	7
+#define WRT300N		8
+#define WRT54GL         9
+#define WRT54GSV4       10
+#define WRT350N		11
+#define WRT610N		12
+#define WRT61XN		13
+#define E200		14
+#define E300		15
+//John
+#define WRT54GV5        16
+
+#define E3200		17
+#define E4200		18
+#define E2500		19
+#define AC2350		20
+
+
+#define CES_M_SERIAL	1
+#define CES_E_SERIAL	2
+
+/***************************************
+ * define OEM                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+#define OEM LINKSYS //LINKSYS
+//#define OEM PCI_OEM //PCI_OEM
+//#define OEM ELSA //ELSA
+//#define OEM ALLNET //ALLNET
+//#define OEM REENET //REENET
+//#define OEM OTHER_OEM //OTHER_OEM
+
+/***************************************
+ * define MODEL NAME                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+
+//#define LINKSYS_MODEL E3200 //E3200
+//#define LINKSYS_MODEL E300 //E300
+//#define LINKSYS_MODEL E200 //E200
+//#define LINKSYS_MODEL E4200 //E4200
+//#define LINKSYS_MODEL E2500 //E2500
+#define LINKSYS_MODEL AC2350 //AC2350
+
+/***************************************
+ * define MODEL SERIAL                          *
+ * Don't edit, auto edit by select.sh  *
+ ***************************************/
+//#define LINKSYS_MODEL_SERIAL CES_M_SERIAL //CES_M_SERIAL
+#define LINKSYS_MODEL_SERIAL CES_E_SERIAL //CES_E_SERIAL
+
+/***************************************
+ * define country                      *
+ * LOCALE=COUNTRY =                    *
+ ***************************************/
+#define COUNTRY		LOCALE
+#define LOCALE USA
+//#define LOCALE JAPAN
+//#define LOCALE EUROPE
+//#define LOCALE WW
+//#define LOCALE GERMANY	
+//#define LOCALE FRANCE
+//#define LOCALE KOREA
+//#define LOCALE UK
+
+/***************************************
+ * define model name and code pattern  *
+ * MODEL_NAME =                        *
+ * CODE_PATTERN =                      *
+ ***************************************/
+#if OEM == LINKSYS
+	#define	CT_VENDOR		"LINKSYS"
+	#define UI_STYLE	CISCO
+
+	#if LINKSYS_MODEL == WRT54GS
+		#define CODE_PATTERN   "W54S"
+		#if LOCALE == GERMANY
+			#define MODEL_NAME	"WRT54GS-DE"
+			#define MODEL_VERSION	""
+		#elif LOCALE == FRANCE
+			#define MODEL_NAME	"WRT54GS-FR"
+			#define MODEL_VERSION	""
+		#elif LOCALE == JAPAN
+			#define MODEL_NAME	"WRT54GS-JP"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME	"WRT54GS"
+			#define MODEL_VERSION	"V3.0"
+		#endif
+	#elif LINKSYS_MODEL == WRT54GSV4
+		#define CODE_PATTERN   "W54s"
+		#define MODEL_NAME     "WRT54GSV4"
+		#define MODEL_VERSION  ""
+	#elif LINKSYS_MODEL == DPN  //DPN
+		#define CODE_PATTERN   "WDPN"
+		#define MODEL_NAME     "DPN"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == WRT54GV5
+		#define CODE_PATTERN   "W54V"
+		#define MODEL_NAME     "WRTA54G"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == RTA41
+		#define CODE_PATTERN   "W54N"
+		#define MODEL_NAME     "RTA41"
+		#define MODEL_VERSION	""
+	#elif LINKSYS_MODEL == WRT54G3G
+		#define CODE_PATTERN   "W54F"
+		#if LOCALE == EUROPE
+			#define MODEL_NAME     "WRT54G3G-EU"
+			#define MODEL_VERSION	""
+		#elif LOCALE == UK
+			#define MODEL_NAME     "WRT54G3G-UK"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME     "WRT54G3G"
+			#define MODEL_VERSION	"V1"
+		#endif
+	#elif LINKSYS_MODEL == T_MOBILE
+		#define CODE_PATTERN   "W54T"
+		#define MODEL_NAME     "WRT54G-TM"
+		#define MODEL_VERSION	"V3.0"
+	#elif LINKSYS_MODEL == WRT300N
+		#define CODE_PATTERN   "EWCB"
+		#define MODEL_NAME     "WRT300N"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == WRT350N
+		#define CODE_PATTERN   "EWCG"
+		#define MODEL_NAME     "WRT350N"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == WRT54G
+		#define CODE_PATTERN   "W54G"
+		#if LOCALE == GERMANY
+			#define MODEL_NAME	"WRT54G-DE"
+			#define MODEL_VERSION	""
+		#elif LOCALE == FRANCE
+			#define MODEL_NAME	"WRT54G-FR"
+			#define MODEL_VERSION	""
+		#elif LOCALE == JAPAN
+			#define MODEL_NAME	"WRT54G-JP"
+			#define MODEL_VERSION	""
+		#else
+			#define MODEL_NAME	"WRT54G"
+			#define MODEL_VERSION	"V4.0"
+		#endif
+	#elif LINKSYS_MODEL == WRT54GL
+		#define CODE_PATTERN   "W54G"
+		#define MODEL_NAME	"WRT54GL"
+		#define MODEL_VERSION	"V1"
+	#elif LINKSYS_MODEL == WRT610N
+		#define CODE_PATTERN   "610N"
+		#define MODEL_NAME	"WRT610N"
+		#define MODEL_VERSION	"V2"              //V1 or V2
+	#elif LINKSYS_MODEL == E200
+		#define CODE_PATTERN   "32XN"
+		#define MODEL_NUMBER	"E2000"
+		#define MODEL_NAME	"Linksys E2000"
+		#define MODEL_VERSION	"V1.0"
+	#elif LINKSYS_MODEL == E300
+		#define CODE_PATTERN   "61XN"
+		#define MODEL_NUMBER	"E3000"	    //model number added by Jemmy 2009.11.17
+		#define MODEL_NAME	"Linksys E3000"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+	#elif LINKSYS_MODEL == E3200
+		#define CODE_PATTERN   "3200"
+		#define MODEL_NUMBER	"E3200"	    //model number added by zhaoguang 2010.10.25
+		#define MODEL_NAME	"Linksys E3200"
+		#define MODEL_VERSION	"V1" 
+	#elif LINKSYS_MODEL == E4200
+		#define CODE_PATTERN   "4200"
+		#define MODEL_NUMBER	"E4200"	    //model number added by Jemmy 2009.11.17
+		#define MODEL_NAME	"Linksys E4200"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+	#elif (LINKSYS_MODEL == E2500)
+		#define CODE_PATTERN   "25V3"
+		#define MODEL_NUMBER	"E2500"	    //model number
+		#define MODEL_NAME	"Linksys E2500"
+		#define MODEL_VERSION	"V3"              //V1 or V2	
+	#elif (LINKSYS_MODEL == AC2350)
+		#define CODE_PATTERN   "8350"
+		#define MODEL_NUMBER	"E8350"	    //model number
+		#define MODEL_NAME	"Linksys E8350"
+		#define MODEL_VERSION	"V1"              //V1 or V2
+
+	#else
+		#error "You must select a LINKSYS_MODEL!!"
+	#endif
+
+	#if LINKSYS_MODEL == WRT54G || LINKSYS_MODEL == WRT54GL
+		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v1.41.8"
+		#define BCM4712_CHIP_SUPPORT_VERSION_FROM "v1.50.0"
+		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM "v1.3"
+		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM "v2.0"
+	#else
+		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v0.00.0"
+		#define BCM4712_CHIP_SUPPORT_VERSION_FROM "v0.00.0"
+		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM "v0.0"
+		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM "v0.0"
+	#endif
+	#if	LINKSYS_MODEL == WRT350N
+		#define WRT350N_SUPPORT_VERSION_FROM "v0.85.3"		
+	#endif
+
+#elif OEM == PCI_OEM
+	#define CODE_PATTERN    "W54P"
+	#if LOCALE == JAPAN
+		#define MODEL_NAME	"Planex BLW-04G Wireless Router"
+	#else
+		#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#endif
+	#define	CT_VENDOR		"PCI"
+#elif OEM == ELSA
+	#define CODE_PATTERN    "W54E"
+	#define MODEL_NAME	"ELSA WLAN DSL-Router 4P G"
+	#define	CT_VENDOR	"ELSA"
+#elif OEM == ALLNET
+	#define CODE_PATTERN    "W54A"
+	#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#define	CT_VENDOR	"ALLNET"
+#elif OEM == REENET
+	#define CODE_PATTERN    "W54R"
+	#define MODEL_NAME	"RW-IPG500"
+	#define	CT_VENDOR	"REENET"
+#elif OEM == OTHER_OEM
+	#define CODE_PATTERN    "W54O"
+	#define MODEL_NAME	"Advanced Wireless 11g Router"
+	#define	CT_VENDOR	"OTHER_OEM"
+#else
+	#error "Your must select a OEM name!!"
+#endif
+
+/***************************************
+ * define language                     *
+ * LANGUAGE =                          *
+ * LANG_SEL=EN                         *
+ * HTTP_CHARSET =		       *
+ ***************************************/
+#if LOCALE == JAPAN
+	#define	LANGUAGE	JAPANESE
+	#define	HTTP_CHARSET	"shift-jis"
+#elif LOCALE == GERMANY
+	#define LANGUAGE	GERMAN
+	#define	HTTP_CHARSET	"iso-8859-1"
+#elif LOCALE == FRANCE
+	#define LANGUAGE	FRENCH
+	#define	HTTP_CHARSET	"iso-8859-1"
+#elif LOCALE == KOREA
+	#define LANGUAGE 	KOREAN
+	#define	HTTP_CHARSET	"euc-kr"
+#else
+	#define LANGUAGE 	ENGLISH
+	#define	HTTP_CHARSET	"iso-8859-1"
+#endif
+
+/***************************************
+ * define wireless max channel         *
+ * WL_MAX_CHANNEL =                    *
+ ***************************************/
+#if LOCALE == JAPAN || LOCALE == EUROPE || LOCALE == GERMANY || LOCALE == FRANCE
+	#define	WL_MAX_CHANNEL	"13"
+#elif OEM == KOREA			// <remove the line>
+	#define	WL_MAX_CHANNEL	"13"	// <remove the line>
+#else
+	#define WL_MAX_CHANNEL	"11"
+#endif
+
+/***************************************
+ * define web file path                *
+ * WEB_PAGE =                          *
+ ***************************************/
+#if OEM == LINKSYS
+#if UI_STYLE ==  CISCO
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"cisco_wrt54g_jp"
+	#elif LOCALE == GERMANY
+		#define	WEB_PAGE	"cisco_wrt54g_de"
+	#elif LOCALE == FRANCE
+		#define	WEB_PAGE	"cisco_wrt54g_fr"
+	#else
+		#if LINKSYS_MODEL == E200
+			#define WEB_PAGE        "ces_m"
+		#elif LINKSYS_MODEL == E300
+			#define WEB_PAGE        "ces_m"
+		#elif LINKSYS_MODEL == E3200
+			#define WEB_PAGE        "e3200_m"
+		#elif LINKSYS_MODEL == E4200
+			#define WEB_PAGE        "e4200_m"
+		#elif (LINKSYS_MODEL == E2500)
+			#define WEB_PAGE        "e2500_m"	
+		#elif (LINKSYS_MODEL == AC2350)
+			#define WEB_PAGE        "ac2350_m"
+		#else
+			#define WEB_PAGE	"cisco_wrt54g_m"
+		#endif
+	#endif
+#else
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"linksys_wrt54g_jp"
+	#else
+		#define WEB_PAGE	"linksys_wrt54g_en"
+	#endif
+#endif
+#elif OEM == PCI_OEM
+	#if LOCALE == JAPAN
+		#define	WEB_PAGE	"pci_wrt54g_jp"
+	#else
+		#define WEB_PAGE	"pci_wrt54g_en"
+	#endif
+#elif OEM == ELSA
+	#define WEB_PAGE	"elsa_wrt54g_en"
+#elif OEM == ALLNET
+	#define WEB_PAGE	"nonbrand"
+#elif OEM == REENET
+	#define WEB_PAGE	"reenet_wrt54g_kr"
+#elif	OEM == OTHER_OEM
+	#define WEB_PAGE	"nonbrand"
+#endif
+
+/***************************************
+ * check LOCALE
+ ***************************************/
+#if OEM == LINKSYS
+ #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE && LOCALE != GERMANY && LOCALE != FRANCE
+	#error	"The LOCALE for LINKSYS is error, must be USA, EUROPE, JAPAN, GERMANY or FRANCE"
+ #endif
+#elif OEM == PCI_OEM
+ #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE
+	#error	"The LOCALE for PCI is error, must be USA or JAPAN"
+ #endif
+#elif OEM == ELSA
+ #if LOCALE != EUROPE
+	#error	"The LOCALE for ELSA is error, must be EUROPE"
+ #endif
+#elif OEM == ALLNET
+ #if LOCALE != EUROPE
+	#error	"The LOCALE for ALLNET is error, must be EUROPE"
+ #endif
+#elif OEM == REENET
+ #if LOCALE != KOREA
+	#error	"The LOCALE for REENET is error, must be KOREA"
+ #endif
+#elif OEM == OTHER_OEM
+ #if LOCALE != USA && LOCALE != EUROPE
+	#error	"The LOCALE for NONBRAND is error, must be USA or EUROPE"
+ #endif
+#endif
+
+#endif
diff --git a/tools/firmware-utils/src/linksys/crc.c b/tools/firmware-utils/src/linksys/crc.c
new file mode 100644
index 0000000000..7d3e641df9
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/crc.c
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * $Id: crc.c,v 1.1.1.1 2010/11/24 06:37:40 gavin.ke Exp $
+ * Copyright 2007, Broadcom Corporation      
+ * All Rights Reserved.      
+ *       
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY      
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM      
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS      
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.      
+ * crc.c: utility function to compute various CRCs
+ ******************************************************************************/
+
+#include "typedefs.h"
+#include "crc.h"
+
+/*******************************************************************************
+ * hcs
+ *
+ * Computes and inserts a header check sum based on crc8 polynomial
+ * below.  Unlike a typical crc, the header check sum is inserted 13
+ * bytes from the end of the byte stream (rather than appended to the
+ * end of the byte stream) such that at the receiver a normal checksum
+ * computation over all of the bytes results in a known good value.
+ * Given a constant 12 bytes after the header checksum to the end of
+ * the header, a lookup table can be used to provide the actual value
+ * inserted.
+ ******************************************************************************/
+
+static uint8 hcs_table[8] = { 0x16, 0x2c, 0x58, 0xb0, 0x37, 0x6e, 0xdc, 0xef};
+
+void
+hcs(
+    uint8 *pheader, /* pointer to array of data to process */
+    uint nbytes   /* number of input data bytes to process */
+)
+{
+    uint8 hcs0, hcs1;
+    int i;
+
+    /* run once with zeros in hcs position, 13th byte from the end */
+    pheader[nbytes - 12 - 1] = 0;
+    hcs0 = crc8(pheader, nbytes, CRC8_INIT_VALUE);
+ 
+    /* now compute real hcs to insert in place of zeros */
+    hcs1 = 0;
+    for (i = 0; i < 8; i++) {
+        hcs1 ^= ((hcs0 & (1 << i)) != 0 ? hcs_table[i] : 0);
+    }
+    pheader[nbytes - 12 - 1] = hcs1 ^ 0xff;
+    return;
+}
+
+/*******************************************************************************
+ * crc8
+ *
+ * Computes a crc8 over the input data using the polynomial:
+ *
+ *       x^8 + x^7 +x^6 + x^4 + x^2 + 1
+ *
+ * The caller provides the initial value (either CRC8_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC8_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint8 crc8_table[256] = {
+    0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
+    0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
+    0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
+    0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
+    0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
+    0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
+    0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
+    0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
+    0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
+    0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
+    0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
+    0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
+    0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
+    0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
+    0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
+    0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
+    0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
+    0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
+    0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
+    0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
+    0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
+    0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
+    0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
+    0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
+    0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
+    0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
+    0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
+    0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
+    0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
+    0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
+    0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
+    0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
+};
+
+#define CRC_INNER_LOOP(n, c, x) \
+    (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
+
+uint8
+crc8(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint8 crc      /* either CRC8_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(8, crc, *pdata++);
+    return crc;
+}
+
+/*******************************************************************************
+ * crc16
+ *
+ * Computes a crc16 over the input data using the polynomial:
+ *
+ *       x^16 + x^12 +x^5 + 1
+ *
+ * The caller provides the initial value (either CRC16_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC16_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint16 crc16_table[256] = {
+    0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
+    0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
+    0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
+    0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
+    0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
+    0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
+    0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
+    0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
+    0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
+    0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
+    0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
+    0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
+    0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
+    0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
+    0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
+    0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
+    0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
+    0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
+    0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
+    0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
+    0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
+    0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
+    0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
+    0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
+    0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
+    0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
+    0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
+    0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
+    0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
+    0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
+    0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
+    0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
+};
+
+uint16
+crc16(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint16 crc     /* either CRC16_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(16, crc, *pdata++);
+    return crc;
+}
+
+/*******************************************************************************
+ * crc32
+ *
+ * Computes a crc32 over the input data using the polynomial:
+ *
+ *       x^32+x^26+x^23+x^22+x^16+x^12+x^11+X^10+x^8+x^7+x^5+x^4+x^2+x+1
+ *
+ * The caller provides the initial value (either CRC32_INIT_VALUE
+ * or the previous returned value) to allow for processing of 
+ * discontiguous blocks of data.  When generating the CRC the
+ * caller is responsible for complementing the final return value
+ * and inserting it into the byte stream.  When checking, a final
+ * return value of CRC32_GOOD_VALUE indicates a valid CRC.
+ *
+ * Reference: Dallas Semiconductor Application Note 27
+ *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
+ *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
+ *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
+ *
+ ******************************************************************************/
+
+static uint32 crc32_table[256] = {
+    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
+    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
+    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
+    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
+    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
+    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
+    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
+    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
+    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
+    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
+    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
+    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
+    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
+    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
+    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
+    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
+    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
+    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
+    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
+    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
+    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
+    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
+    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
+    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
+    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
+    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
+    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
+    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
+    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
+    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
+    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
+    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
+    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
+    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
+    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
+    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
+    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
+    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
+    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
+    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
+    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
+    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
+    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
+    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
+    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
+    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
+    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
+    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
+    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
+    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
+    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
+    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
+    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
+    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
+    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
+    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
+    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
+    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
+    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
+    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
+    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
+    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
+    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
+    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
+};
+
+uint32
+crc32(
+    uint8 *pdata,  /* pointer to array of data to process */
+    uint nbytes, /* number of input data bytes to process */
+    uint32 crc     /* either CRC32_INIT_VALUE or previous return value */
+)
+{
+    while (nbytes-- > 0)
+        CRC_INNER_LOOP(32, crc, *pdata++);
+    return crc;
+}
diff --git a/tools/firmware-utils/src/linksys/crc.h b/tools/firmware-utils/src/linksys/crc.h
new file mode 100644
index 0000000000..c7e783c159
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/crc.h
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * $Id: crc.h,v 1.2 2010/12/22 05:14:42 gavin.ke Exp $
+ * Copyright (C) 2009, Broadcom Corporation      
+ * All Rights Reserved.      
+ *       
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY      
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM      
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS      
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.      
+ * crc.h - a function to compute crc for iLine10 headers
+ ******************************************************************************/
+
+#ifndef _RTS_CRC_H_
+#define _RTS_CRC_H_ 1
+
+#include "typedefs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define CRC8_INIT_VALUE  0xff       /* Initial CRC8 checksum value */
+#define CRC8_GOOD_VALUE  0x9f       /* Good final CRC8 checksum value */
+#define HCS_GOOD_VALUE   0x39       /* Good final header checksum value */
+
+#define CRC16_INIT_VALUE 0xffff     /* Initial CRC16 checksum value */
+#define CRC16_GOOD_VALUE 0xf0b8     /* Good final CRC16 checksum value */
+
+#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
+#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
+
+void   hcs(uint8 *, uint);
+uint8  crc8(uint8 *, uint, uint8);
+uint16 crc16(uint8 *, uint, uint16);
+uint32 crc32(uint8 *, uint, uint32);
+
+/* macros for common usage */
+
+#define APPEND_CRC8(pbytes, nbytes)                           \
+do {                                                          \
+    uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
+    (pbytes)[(nbytes)] = tmp;                                 \
+    (nbytes) += 1;                                            \
+} while (0)
+
+#define APPEND_CRC16(pbytes, nbytes)                               \
+do {                                                               \
+    uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
+    (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff;                    \
+    (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff;                    \
+    (nbytes) += 2;                                                 \
+} while (0)
+
+#define APPEND_CRC32(pbytes, nbytes)                                   \
+do {                                                                   \
+    uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
+    (pbytes)[(nbytes) + 0] = (tmp >>  0) & 0xff;                       \
+    (pbytes)[(nbytes) + 1] = (tmp >>  8) & 0xff;                       \
+    (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff;                       \
+    (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff;                       \
+    (nbytes) += 4;                                                     \
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTS_CRC_H_ */
diff --git a/tools/firmware-utils/src/linksys/cyutils.h b/tools/firmware-utils/src/linksys/cyutils.h
new file mode 100644
index 0000000000..fd77ab52f3
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/cyutils.h
@@ -0,0 +1,348 @@
+#include "code_pattern.h"
+
+#if LINKSYS_MODEL == WRT54GSV4
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.05.6"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.05.8"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54GS	// WRT54GSV1-3
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.70.8"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.71.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54GL
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.30.2"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.30.4"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT54G	// WRT54GV1-4
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v4.20.9"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v4.21.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == T_MOBILE
+    #define CYBERTAN_VERSION	"v5.00.0"
+    #define SERIAL_NUMBER	"002"
+    #define MINOR_VERSION	""
+#elif LINKSYS_MODEL == WRT54G3G
+    #define CYBERTAN_VERSION	"v1.90.0"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+#elif LINKSYS_MODEL == WRT300N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v0.92.1"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.92.1"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	""
+  #endif
+#elif LINKSYS_MODEL == WRT350N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.03.9"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	"-beta3"
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.03.9"
+    #define SERIAL_NUMBER	"000"
+    #define MINOR_VERSION	"-beta3"
+  #endif
+#elif LINKSYS_MODEL == WRT610N
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v2.00.00"
+    #define SERIAL_NUMBER	"02 betasvn0526"
+    #define MINOR_VERSION	""
+//add by michael at 200804014
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+//end by michael
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+//add by michael at 20080414
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+//end by michael
+#elif LINKSYS_MODEL == E200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v0.0.01"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"001"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E300
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v3.0.00"
+    #define SERIAL_NUMBER	"006"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E3200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"1"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E4200
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"9"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v0.00.01"
+    #define SERIAL_NUMBER	"09"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == E2500
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v3.0.00"
+    #define SERIAL_NUMBER	"6"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+  #endif
+#elif LINKSYS_MODEL == AC2350
+  #if LOCALE == USA
+    #define CYBERTAN_VERSION	"v1.0.03"
+    #define SERIAL_NUMBER	"003"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+    #define CYBERTAN_UBOOT_VERSION	"v1.0"
+  #else	// ETSI
+    #define CYBERTAN_VERSION	"v1.0.00"
+    #define SERIAL_NUMBER	"01"
+    #define MINOR_VERSION	""
+    #define BUILD_KEYWORD   " B"
+    #define BUILD_NUMBER    SERIAL_NUMBER
+    #define BETA_VERSION    " "
+    #define CYBERTAN_UBOOT_VERSION	"v1.0"
+  #endif
+
+#endif
+
+#if LINKSYS_MODEL == T_MOBILE
+    #define CFES_BOOT_VERSION	"v5.3"
+#elif LINKSYS_MODEL == E2500
+    //#define CFES_BOOT_VERSION	"v4.13"
+    //#define CFES_BOOT_VERSION	"v5.00"
+    #define CFES_BOOT_VERSION	"v6.07"
+#else
+    #define CFES_BOOT_VERSION	"v5.2"
+#endif
+
+#define LANG_VERSION		"v1.00.00"    //for lang.bin version control(setupwizard)
+#define PMON_BOOT_VERSION	"v1.8"
+#define QCA_WL_VERSION		"v10.2.138.3" /*add for QCA wireless version by Jemmy 2014.5.21*/
+
+
+#if LINKSYS_MODEL == T_MOBILE
+#define BOOT_IPADDR "192.168.0.1"
+#define BOOT_NETMASK "255.255.255.0"
+#else
+#define BOOT_IPADDR "192.168.1.1"
+#define BOOT_NETMASK "255.255.255.0"
+#endif
+
+#define SUPPORT_4712_CHIP	0x0001
+#define SUPPORT_INTEL_FLASH	0x0002
+#define SUPPORT_5325E_SWITCH	0x0004
+#define SUPPORT_4704_CHIP	0x0008
+#define SUPPORT_5352E_CHIP	0x0010
+
+struct code_header {
+	char magic[4];	// Code Pattern
+	char res1[4];	// for extra magic
+	char fwdate[3];	// Firmware build date
+	char fwvern[3];	// Firmware version
+	char id[4];	// U2ND
+	char hw_ver;    // 0) for 4702, 1) for 4712, 2) for 4712L, 3) for 4704, 4) for 5352E
+	unsigned char  sn;	// Serial Number
+	unsigned short flags;
+	unsigned char  stable[2];	// The image is stable (for dual image)
+	unsigned char  try1[2];		// Try to boot image first time (for dual image)
+	unsigned char  try2[2];		// Try to boot image second time (for dual image)
+	unsigned char  try3[2];		// Try to boot image third time (for dual_image)
+	unsigned char  res3[2];
+} ;
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+	unsigned int magic;		/* "CHDR" */
+	unsigned int len;		/* Length of file including header */
+	unsigned int crc32;		/* 32-bit CRC */
+	unsigned int res;	
+};
+
+//#ifdef MULTILANG_SUPPORT
+struct lang_header {
+        char magic[4];
+        char res1[4];   // for extra magic
+        char fwdate[3];
+        char fwvern[3];
+        char id[4];     // U2ND
+        char hw_ver;    // 0: for 4702, 1: for 4712
+	char res2;
+        unsigned long len;
+        unsigned char res3[8];
+} ;
+//#endif
+
+struct boot_header {
+	char magic[3];
+	char res[29];
+};
+
+/***************************************
+ * define upnp misc                    *
+ ***************************************/
+#if OEM == LINKSYS
+  #if LANGUAGE == ENGLISH
+    #define URL			"http://www.linksys.com/"
+  #else
+    #define URL			"http://www.linksys.co.jp/"
+  #endif
+  #define DEV_FRIENDLY_NAME	"Linksys"MODEL_NAME
+  #define DEV_MFR		"Linksys"
+  //#define DEV_MFR_URL		URL
+  #define DEV_MFR_URL		"http://www.linksys.com"
+  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
+  #define DEV_MODEL		MODEL_NAME
+  #define DEV_MODEL_NO		CYBERTAN_VERSION
+  //#define DEV_MODEL_URL		URL
+  #define DEV_MODEL_URL		"http://www.linksys.com/international"
+#elif OEM == PCI
+  #if LANGUAGE == ENGLISH
+    #define URL			"http://www.planex.com/"
+  #else
+    #define URL			"http://www.planex.co.jp/"
+  #endif
+  #define DEV_FRIENDLY_NAME	"BLW-04G Wireless Broadband Router"
+  #define DEV_MFR		"Planex Communciations Inc."
+  #define DEV_MFR_URL		URL
+  #define DEV_MODEL_DESCRIPTION	"Internet Gateway Device with UPnP support"
+  #define DEV_MODEL		"BLW-04G"
+  #define DEV_MODEL_NO 		CYBERTAN_VERSION
+  #define DEV_MODEL_URL		URL
+#else
+  #define URL			""
+  #define DEV_FRIENDLY_NAME	MODEL_NAME
+  #define DEV_MFR		""
+  #define DEV_MFR_URL		URL
+  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
+  #define DEV_MODEL		MODEL_NAME
+  #define DEV_MODEL_NO		CYBERTAN_VERSION
+  #define DEV_MODEL_URL		URL
+#endif
+
+/***************************************
+ * define Parental Control link        *
+ ***************************************/
+#if LOCALE == EUROPE
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/eu/language.jsp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/eu/info_eu.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/en"
+#elif LOCALE == GERMANY
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/de/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/de/info_de.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/de/admin.asp"
+#elif LOCALE == FRANCE
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/fr/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/fr/info_fr.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/fr/admin.asp"
+#else
+  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/us/trial.asp"
+  #define	MORE_INFO_URL	"http://www.linksys.com/pcsvc/info.asp"
+  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/us/admin.asp"
+#endif
+
+/***************************************
+ * define PPTP info		       * 
+ ***************************************/
+#if OEM == LINKSYS
+#define	PPTP_VENDOR	"Linksys"
+#else
+#define	PPTP_VENDOR	CT_VENDOR
+#endif
+#define PPTP_HOSTNAME	""
+
+/***************************************
+ * define L2TP info		       *
+ ***************************************/
+#if OEM == LINKSYS
+#define	L2TP_VENDOR	"Linksys"
+#else
+#define	L2TP_VENDOR	CT_VENDOR
+#endif
+#define L2TP_HOSTNAME	MODEL_NAME //2005-03-04 by kanki
diff --git a/tools/firmware-utils/src/linksys/typedefs.h b/tools/firmware-utils/src/linksys/typedefs.h
new file mode 100644
index 0000000000..78989745f9
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/typedefs.h
@@ -0,0 +1,447 @@
+/*
+ * Copyright (C) 2009, Broadcom Corporation
+ * All Rights Reserved.
+ * 
+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+ * $Id: typedefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
+ */
+
+#ifndef _TYPEDEFS_H_
+#define _TYPEDEFS_H_
+
+#ifdef SITE_TYPEDEFS
+
+/*
+ * Define SITE_TYPEDEFS in the compile to include a site-specific
+ * typedef file "site_typedefs.h".
+ *
+ * If SITE_TYPEDEFS is not defined, then the code section below makes
+ * inferences about the compile environment based on defined symbols and
+ * possibly compiler pragmas.
+ *
+ * Following these two sections is the Default Typedefs section.
+ * This section is only processed if USE_TYPEDEF_DEFAULTS is
+ * defined. This section has a default set of typedefs and a few
+ * preprocessor symbols (TRUE, FALSE, NULL, ...).
+ */
+
+#include "site_typedefs.h"
+
+#else
+
+/*
+ * Infer the compile environment based on preprocessor symbols and pragmas.
+ * Override type definitions as needed, and include configuration-dependent
+ * header files to define types.
+ */
+
+#ifdef __cplusplus
+
+#define TYPEDEF_BOOL
+#ifndef FALSE
+#define FALSE	false
+#endif
+#ifndef TRUE
+#define TRUE	true
+#endif
+
+#else	/* ! __cplusplus */
+
+#if defined(_WIN32)
+
+#define TYPEDEF_BOOL
+typedef	unsigned char	bool;			/* consistent w/BOOL */
+
+#endif /* _WIN32 */
+
+#endif	/* ! __cplusplus */
+
+#if defined(_WIN64) && !defined(EFI)
+/* use the Windows ULONG_PTR type when compiling for 64 bit */
+#include <basetsd.h>
+#define TYPEDEF_UINTPTR
+typedef ULONG_PTR uintptr;
+#elif defined(__x86_64__)
+#define TYPEDEF_UINTPTR
+typedef unsigned long long int uintptr;
+#endif
+
+#if defined(_HNDRTE_) && !defined(_HNDRTE_SIM_)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(_MINOSL_)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(EFI) && !defined(_WIN64)
+#define _NEED_SIZE_T_
+#endif
+
+#if defined(TARGETOS_nucleus)
+/* for 'size_t' type */
+#include <stddef.h>
+
+/* float_t types conflict with the same typedefs from the standard ANSI-C
+** math.h header file. Don't re-typedef them here.
+*/
+#define TYPEDEF_FLOAT_T
+#endif   /* TARGETOS_nucleus */
+
+#if defined(_NEED_SIZE_T_)
+typedef long unsigned int size_t;
+#endif
+
+#ifdef __DJGPP__
+typedef long unsigned int size_t;
+#endif /* __DJGPP__ */
+
+#ifdef _MSC_VER	    /* Microsoft C */
+#define TYPEDEF_INT64
+#define TYPEDEF_UINT64
+typedef signed __int64	int64;
+typedef unsigned __int64 uint64;
+#endif
+
+#if defined(MACOSX)
+#ifdef KERNEL
+#include <libkern/version.h>
+#if VERSION_MAJOR > 10
+#define WLP2P
+#define IO80211P2P
+#define APSTA
+#define WLMCHAN
+#define WL_MULTIQUEUE
+#define WL_BSSCFG_TX_SUPR
+#define WIFI_ACT_FRAME
+#define FAST_ACTFRM_TX
+#endif
+#endif /* KERNEL */
+#define TYPEDEF_BOOL
+#endif
+
+#if defined(__NetBSD__)
+#define TYPEDEF_ULONG
+#endif
+
+#if defined(__sparc__)
+#define TYPEDEF_ULONG
+#endif
+
+
+#ifdef	linux
+/*
+ * If this is either a Linux hybrid build or the per-port code of a hybrid build
+ * then use the Linux header files to get some of the typedefs.  Otherwise, define
+ * them entirely in this file.  We can't always define the types because we get
+ * a duplicate typedef error; there is no way to "undefine" a typedef.
+ * We know when it's per-port code because each file defines LINUX_PORT at the top.
+ */
+#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
+#define TYPEDEF_UINT
+#ifndef TARGETENV_android
+#define TYPEDEF_USHORT
+#define TYPEDEF_ULONG
+#endif /* TARGETENV_android */
+#ifdef __KERNEL__
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
+#define TYPEDEF_BOOL
+#endif	/* >= 2.6.19 */
+#endif	/* __KERNEL__ */
+#endif  /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
+#endif	/* linux */
+
+#if defined(__ECOS)
+#define TYPEDEF_UCHAR
+#define TYPEDEF_UINT
+#define TYPEDEF_USHORT
+#define TYPEDEF_ULONG
+#define TYPEDEF_BOOL
+#endif
+
+#if !defined(linux) && !defined(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) && \
+	!defined(__DJGPP__) && !defined(__ECOS) && !defined(__BOB__) && \
+	!defined(TARGETOS_nucleus)
+#define TYPEDEF_UINT
+#define TYPEDEF_USHORT
+#endif
+
+
+/* Do not support the (u)int64 types with strict ansi for GNU C */
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define TYPEDEF_INT64
+#define TYPEDEF_UINT64
+#endif
+
+/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
+ * for signed or unsigned
+ */
+#if defined(__ICL)
+
+#define TYPEDEF_INT64
+
+#if defined(__STDC__)
+#define TYPEDEF_UINT64
+#endif
+
+#endif /* __ICL */
+
+#if !defined(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) && !defined(__DJGPP__) && \
+	!defined(__BOB__) && !defined(TARGETOS_nucleus)
+
+/* pick up ushort & uint from standard types.h */
+#if defined(linux) && defined(__KERNEL__)
+
+/* See note above */
+#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
+#ifdef USER_MODE
+#include <sys/types.h>
+#else
+#include <linux/types.h>	/* sys/types.h and linux/types.h are oil and water */
+#endif /* USER_MODE */
+#endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
+
+#else
+
+#if defined(__ECOS)
+#include <pkgconf/infra.h>
+#include <cyg/infra/cyg_type.h>
+#include <stdarg.h>
+#endif
+
+#include <sys/types.h>
+
+#endif /* linux && __KERNEL__ */
+
+#endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_  && !_MINOSL_ && !__DJGPP__ */
+
+#if defined(MACOSX)
+
+#ifdef __BIG_ENDIAN__
+#define IL_BIGENDIAN
+#else
+#ifdef IL_BIGENDIAN
+#error "IL_BIGENDIAN was defined for a little-endian compile"
+#endif
+#endif /* __BIG_ENDIAN__ */
+
+#if !defined(__cplusplus)
+
+#if defined(__i386__)
+typedef unsigned char bool;
+#else
+typedef unsigned int bool;
+#endif
+#define TYPE_BOOL 1
+enum {
+    false	= 0,
+    true	= 1
+};
+
+#if defined(KERNEL)
+#include <IOKit/IOTypes.h>
+#endif /* KERNEL */
+
+#endif /* __cplusplus */
+
+#endif /* MACOSX */
+
+
+/* use the default typedefs in the next section of this file */
+#define USE_TYPEDEF_DEFAULTS
+
+#endif /* SITE_TYPEDEFS */
+
+
+/*
+ * Default Typedefs
+ */
+
+#ifdef USE_TYPEDEF_DEFAULTS
+#undef USE_TYPEDEF_DEFAULTS
+
+#ifndef TYPEDEF_BOOL
+typedef	/* @abstract@ */ unsigned char	bool;
+#endif
+
+/* define uchar, ushort, uint, ulong */
+
+#ifndef TYPEDEF_UCHAR
+typedef unsigned char	uchar;
+#endif
+
+#ifndef TYPEDEF_USHORT
+typedef unsigned short	ushort;
+#endif
+
+#ifndef TYPEDEF_UINT
+typedef unsigned int	uint;
+#endif
+
+#ifndef TYPEDEF_ULONG
+typedef unsigned long	ulong;
+#endif
+
+/* define [u]int8/16/32/64, uintptr */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char	uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short	uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned int	uint32;
+#endif
+
+#ifndef TYPEDEF_UINT64
+typedef unsigned long long uint64;
+#endif
+
+#ifndef TYPEDEF_UINTPTR
+typedef unsigned int	uintptr;
+#endif
+
+#ifndef TYPEDEF_INT8
+typedef signed char	int8;
+#endif
+
+#ifndef TYPEDEF_INT16
+typedef signed short	int16;
+#endif
+
+#ifndef _SLHC_H
+#ifndef TYPEDEF_INT32
+typedef signed int	int32;
+#endif
+#endif
+
+#ifndef TYPEDEF_INT64
+typedef signed long long int64;
+#endif
+
+/* define float32/64, float_t */
+
+#ifndef TYPEDEF_FLOAT32
+typedef float		float32;
+#endif
+
+#ifndef TYPEDEF_FLOAT64
+typedef double		float64;
+#endif
+
+/*
+ * abstracted floating point type allows for compile time selection of
+ * single or double precision arithmetic.  Compiling with -DFLOAT32
+ * selects single precision; the default is double precision.
+ */
+
+#ifndef TYPEDEF_FLOAT_T
+
+#if defined(FLOAT32)
+typedef float32 float_t;
+#else /* default to double precision floating point */
+typedef float64 float_t;
+#endif
+
+#endif /* TYPEDEF_FLOAT_T */
+
+/* define macro values */
+
+#ifndef FALSE
+#define FALSE	0
+#endif
+
+#ifndef TRUE
+#define TRUE	1  /* TRUE */
+#endif
+
+#ifndef NULL
+#define	NULL	0
+#endif
+
+#ifndef OFF
+#define	OFF	0
+#endif
+
+#ifndef ON
+#define	ON	1  /* ON = 1 */
+#endif
+
+#define	AUTO	(-1) /* Auto = -1 */
+
+/* define PTRSZ, INLINE */
+
+#ifndef PTRSZ
+#define	PTRSZ	sizeof(char*)
+#endif
+
+
+/* Detect compiler type. */
+#ifdef _MSC_VER
+	#define BWL_COMPILER_MICROSOFT
+#elif defined(__GNUC__)
+	#define BWL_COMPILER_GNU
+#elif defined(__CC_ARM) && __CC_ARM
+	#define BWL_COMPILER_ARMCC
+#else
+	#error "Unknown compiler!"
+#endif /* _MSC_VER */
+
+
+#ifndef INLINE
+	#if defined(BWL_COMPILER_MICROSOFT)
+		#define INLINE __inline
+	#elif defined(BWL_COMPILER_GNU)
+		#define INLINE __inline__
+	#elif defined(BWL_COMPILER_ARMCC)
+		#define INLINE	__inline
+	#else
+		#define INLINE
+	#endif /* _MSC_VER */
+#endif /* INLINE */
+
+#undef TYPEDEF_BOOL
+#undef TYPEDEF_UCHAR
+#undef TYPEDEF_USHORT
+#undef TYPEDEF_UINT
+#undef TYPEDEF_ULONG
+#undef TYPEDEF_UINT8
+#undef TYPEDEF_UINT16
+#undef TYPEDEF_UINT32
+#undef TYPEDEF_UINT64
+#undef TYPEDEF_UINTPTR
+#undef TYPEDEF_INT8
+#undef TYPEDEF_INT16
+#undef TYPEDEF_INT32
+#undef TYPEDEF_INT64
+#undef TYPEDEF_FLOAT32
+#undef TYPEDEF_FLOAT64
+#undef TYPEDEF_FLOAT_T
+
+#endif /* USE_TYPEDEF_DEFAULTS */
+
+/* Suppress unused parameter warning */
+#define UNUSED_PARAMETER(x) (void)(x)
+
+/*
+ * Including the bcmdefs.h here, to make sure everyone including typedefs.h
+ * gets this automatically
+*/
+#include "bcmdefs.h"
+/*
+ * If android target is building then include this file
+ */
+#ifndef LINUX_HYBRID
+#ifdef TARGETENV_android
+#include <bcm_android_types.h>
+#endif /* TARGETENV_android */
+#endif /* LINUX_HYBRID */
+
+#endif /* _TYPEDEFS_H_ */
-- 
2.28.0



From yszhou4tech at gmail.com  Tue Sep  1 01:02:05 2020
From: yszhou4tech at gmail.com (Yousong Zhou)
Date: Tue, 1 Sep 2020 13:02:05 +0800
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
References: <20200829183321.17675-1-hauke@hauke-m.de>
 <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
Message-ID: <CAECwjAiQXvTjvOhdyc7RP26Q2T39su=qxve4Z1=kAjQYUBwtMw@mail.gmail.com>

On Tue, 1 Sep 2020 at 06:45, Yousong Zhou <yszhou4tech at gmail.com> wrote:
>
> It's worth mentioning that recent versions of macos since 10.15 have a
> restriction on certificate validity period, self-signed or not.  It's
> a strong restriction that the browser ui will have no buttons or knobs
> to bypass the certificate validation, rendering such sites
> inaccessible.  I remembered it's also a system wide enforcement that
> chrome on macos also respects this.
>
> [1] Requirements for trusted certificates in iOS 13 and macOS 10.15,
> https://support.apple.com/en-us/HT210176
>
> > TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
>
> [2] About upcoming limits on trusted certificates,
> https://support.apple.com/en-us/HT211025
>
> > TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
>
> Regards,
>                yousong

The other thing that just occurred to me is, chrome will not cache
content fetched from links with invalid certificates.  It's a WontFix
decision [1] . I would guess a 400MHz MIPS CPU might have a hard time
with this.

 [1] Issue 110649: Browser not caching files if HTTPS is used even if
it's allowed by webserver via response headers,
https://bugs.chromium.org/p/chromium/issues/detail?id=110649#c8

Regards,
                yousong


From rayknight at me.com  Tue Sep  1 02:15:10 2020
From: rayknight at me.com (Raylynn Knight)
Date: Tue, 1 Sep 2020 02:15:10 -0400
Subject: [PATCH 0/6] rb532: update to kernel 5.4
In-Reply-To: <02e401d67fee$76146380$623d2a80$@adrianschmutzler.de>
References: <20200822110752.32600-1-freifunk@adrianschmutzler.de>
 <D6EAEDD8-B722-4F54-90D4-539A010F784D@me.com>
 <02e401d67fee$76146380$623d2a80$@adrianschmutzler.de>
Message-ID: <D0EF87FC-1444-4DC3-BFCA-48624539861D@me.com>

On Aug 31, 2020, at 7:28 PM, Adrian Schmutzler <mail at adrianschmutzler.de> wrote:
> 
> Hi again,
> 
>> -----Original Message-----
>> From: Raylynn Knight [mailto:rayknight at me.com]
>> Sent: Montag, 24. August 2020 10:00
>> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>> Cc: OpenWrt Development List <openwrt-devel at lists.openwrt.org>;
>> roman at advem.lv
>> Subject: Re: [PATCH 0/6] rb532: update to kernel 5.4
>> 
>> Result from using sysupgrade:
>> 
>> ------------------------------
>> sysupgrade successful
>> umount: can't unmount /dev: Resource busy
>> umount: can't unmount /tmp: Resource busy [  298.546770] rc32434_wdt:
>> Stopped watchdog timer [  298.551917] reboot: Restarting system
>> 
>> 
>> RouterBOOT booter 2.18
>> 
>> RouterBoard 532A
>> 
>> CPU frequency: 399 MHz
>>  Memory size:  64 MB
>> 
>> Press any key within 4 seconds to enter setup....
>> loading kernel from nand... OK
>> setting up elf image... OK
>> jumping to kernel code
>> ------------------------------
>> 
>> System just hangs at this point.  I let it set for more than 5 minutes.
>> 
>> Result when attempting to boot openwrt-rb532-combined-squashfs.bin
>> from CompactFlash card:
>> 
>> ------------------------------
>> RouterBoard 532A
>> 
>> CPU frequency: 399 MHz
>>  Memory size:  64 MB
>> 
>> Press any key within 4 seconds to enter setup....
>> Booting CF
>> Loading kernel... done
>> setting up elf image... kernel out of range kernel loading failed
>> 
>> 
>> RouterBOOT booter 2.18
>> 
>> RouterBoard 532A
>> 
>> CPU frequency: 399 MHz
>>  Memory size:  64 MB
>> 
>> Press any key within 4 seconds to enter setup.
>> ------------------------------
>> 
>> For what it's worth the current snapshot build from Mon Aug 24 04:19:14
>> 2020 behaves the same way.
>> 
>> I was able to restore some functionality by booting the openwrt-19.07.3-
>> rb532-combined-squashfs.bin from CompactFlash and using sysupgrade.
>> Even this image has issues as I can login with Luci, but the Status page hangs
>> with "Loading view?.?.  Functionality from command line appears OK.  No
>> issues appear with release 18.06.8
> 
> Thanks for testing all of this.
> Unfortunately, it doesn't look like there is a cheap solution for this problem.
> 
> Assuming this problem exists in master before the 5.4 bumps as you report, and taking into account the age of the device/target, the fact that it's a single-device target, and the (very low) activity besides my bump, I decided to not invest further time and drop this together with the other 4.14 targets. Sorry.
> 
> Best
> 
> Adrian

Understandable.  I?m a little overworked right now, or I would do some more research on my part to see if I could discover exactly where the breakage occurred.   Right now 18.06.8 appears to function on both the RB532 and the RB532A.  However I?m not using them for anything useful, they are just a couple of the many devices I have collected.

Ray


>> 
>> 
>> Ray
>> 
>> 
>>> On Aug 22, 2020, at 7:07 AM, Adrian Schmutzler
>> <freifunk at adrianschmutzler.de> wrote:
>>> 
>>> ** I do not own this device, please test! **
>>> 
>>> This updates rb532 from kernel 4.14 to 5.4. Based on the code this was
>>> actually quite easy, let's see whether it works on the devices.
>>> 
>>> Adrian Schmutzler (6):
>>> rb532: copy files from 4.14 to 5.4
>>> rb532: refresh patches for kernel 5.4
>>> rb532: refresh config for kernel 5.4
>>> rb532: use 5.4 as default kernel
>>> rb532: use vendor_model scheme
>>> rb532: determine sysupgrade-* directory for upgrade automatically
>>> 
>>> target/linux/rb532/Makefile                   |   2 +-
>>> .../rb532/base-files/lib/preinit/01_sysinfo   |   2 +-
>>> .../rb532/base-files/lib/upgrade/platform.sh  |  11 +-
>>> target/linux/rb532/config-5.4                 | 218 ++++++++++++++++++
>>> target/linux/rb532/image/Makefile             |   7 +-
>>> .../rb532/patches-5.4/001-cmdline_hack.patch  |  20 ++
>>> .../004-rb532-fix-partition-info.patch        |  17 ++
>>> 7 files changed, 269 insertions(+), 8 deletions(-) create mode 100644
>>> target/linux/rb532/config-5.4 create mode 100644
>>> target/linux/rb532/patches-5.4/001-cmdline_hack.patch
>>> create mode 100644
>>> target/linux/rb532/patches-5.4/004-rb532-fix-partition-info.patch
>>> 
>>> --
>>> 2.20.1
>>> 
>>> 
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From bjorn at mork.no  Tue Sep  1 04:59:31 2020
From: bjorn at mork.no (=?utf-8?Q?Bj=C3=B8rn_Mork?=)
Date: Tue, 01 Sep 2020 10:59:31 +0200
Subject: [RFC] self-signed certificates for LuCI
In-Reply-To: <a8aa0800-95e6-ed81-6b90-3b68a7f0a6ab@nic.br> (Henrique de Moraes
 Holschuh's message of "Mon, 31 Aug 2020 15:17:26 -0300")
References: <271e4185-bdac-ac75-5d56-c29f939c1b7d@aparcar.org>
 <720.1598826745@localhost>
 <2f0cb5b4-9c61-21f2-053a-87b2833fa870@aparcar.org>
 <18215.1598894797@localhost>
 <a8aa0800-95e6-ed81-6b90-3b68a7f0a6ab@nic.br>
Message-ID: <875z8xvpn0.fsf@miraculix.mork.no>

Henrique de Moraes Holschuh <henrique at nic.br> writes:

> It would be *nice* if we could easily deploy extremely restricted
> self-signed CAs that can only sign a numeric pattern hostname under
> <device>.iot.<your>.<domain>.  That extremely restricted CA would get
> "approved" by something from <your>.<domain> that the browser would
> use to stop pestering the user of <device>: be that a certificate
> chaining from <your>.<domain>, or DNSSEC, or whatever.
>
> Well, one can hope and dream...

Yes...  Unfortunately, there still seems to be too much money involved
here to make browsers work in the best interest of their users.

Most services would have been better off with a pinned self-signed
certificate than the current CA scheme. DANE provides the means for any
DNS based service with DNSSEC, but is still not implemented by any major
browser.

TOFU based pinning has also been proposed several times.  This would
have solved the embedded device service use case, as well as many other
cases where the TLS session really is unrelated to DNS.

If the browser vendors wanted to they could have easily implemented a
"TOFU acceptable flag", allowing a service to publish such a policy. The
flag could have been part of either the TLS session or the HTTP
session. The necessary tools to force "TOFU unacceptable" for DNS based
services, using either CAA to pin a specific CA or DANE to pin a CA or
key.

I'll stop dreaming now...  None of this will happen as long as there is
money in the certificate industry.


Bj?rn


From por at oranjevos.nl  Tue Sep  1 06:35:41 2020
From: por at oranjevos.nl (Paul Oranje)
Date: Tue, 1 Sep 2020 12:35:41 +0200
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <20200831232149.GE97563@makrotopia.org>
References: <20200829183321.17675-1-hauke@hauke-m.de>
 <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
 <20200831232149.GE97563@makrotopia.org>
Message-ID: <BC05049D-55AF-4DD9-AC81-980B0E970686@oranjevos.nl>



> Op 1 sep. 2020, om 01:21 heeft Daniel Golle <daniel at makrotopia.org> het volgende geschreven:
> 
> On Tue, Sep 01, 2020 at 06:45:02AM +0800, Yousong Zhou wrote:
>> It's worth mentioning that recent versions of macos since 10.15 have a
>> restriction on certificate validity period, self-signed or not.  It's
>> a strong restriction that the browser ui will have no buttons or knobs
>> to bypass the certificate validation, rendering such sites
>> inaccessible.  I remembered it's also a system wide enforcement that
>> chrome on macos also respects this.
>> 
>> [1] Requirements for trusted certificates in iOS 13 and macOS 10.15,
>> https://support.apple.com/en-us/HT210176
>> 
>>> TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
>> 
>> [2] About upcoming limits on trusted certificates,
>> https://support.apple.com/en-us/HT211025
>> 
>>> TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
> 
> There it also says:
> 'This change will not affect certificates issued from user-added or
> administrator-added Root CAs.'
> 
> So why not force users of devices owned by $$$megacorp to install the
> self-signed as an additional CA?
> 
> This could even be done via an installation tool, downloading the
> certificate from the router using a built-in copy of wolfssl or
> whatever, ignoring the certificates validity.
> 
> Executing the installation program on $$$megacorp-os will of course
> trigger a cascade of extremely scary looking warnings and may require
> changing system settings to even allow running it at all. Another
> cascade of warnings will have to be dealt with when adding the
> self-signed as user-added Root CA.
> I'm pretty sure things like this are needed quite often in Intranet
> environments and shouldn't be hard to implement or document the stepts
> in the Wiki.
> After all, I wouldn't worry about any of this too much as long as there
> is /some/ way to make it work. And users of $$$megacorp-os are
> completely used to these kind of procedures as they are required all
> the time to get things working (unless you bought them through
> $$$megacorp-store which prohibits the use of FOSS licences, despite the
> fact that $$$megacorp-os is of course built on the shoulders of the
> FOSS movement and itself in great parts published under FOSS licences).
> 
> Just my 2 cents...
> 
> 
> 
>> 
>> Regards,
>>               yousong
>> 
Why not apply kind of same policy as with the initial password?
So at first boot just HTTP and a message prompting the user to switch to https with instructions for importing/setting the certificate.

Bye,
Paul



From hauke at hauke-m.de  Tue Sep  1 08:54:36 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:54:36 +0200
Subject: [PATCH] wolfssl: Activate link time optimization (LTO)
Message-ID: <20200901125436.22017-1-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
libwolfssl24_4.5.0-stable-1_mips_24kc.ipk	391.545

new:
libwolfssl24_4.5.0-stable-2_mips_24kc.ipk	387.439

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/libs/wolfssl/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile
index 1fcca9fc5fd2..dc8ca2b26270 100644
--- a/package/libs/wolfssl/Makefile
+++ b/package/libs/wolfssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wolfssl
 PKG_VERSION:=4.5.0-stable
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
@@ -56,7 +56,8 @@ define Package/libwolfssl/config
 	source "$(SOURCE)/Config.in"
 endef
 
-TARGET_CFLAGS += $(FPIC) -DFP_MAX_BITS=8192 -fomit-frame-pointer
+TARGET_CFLAGS += $(FPIC) -DFP_MAX_BITS=8192 -fomit-frame-pointer -flto
+TARGET_LDFLAGS += -flto
 
 # --enable-stunnel needed for OpenSSL API compatibility bits
 CONFIGURE_ARGS += \
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:55:14 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:55:14 +0200
Subject: [PATCH] iw: Update to version 5.8
Message-ID: <20200901125514.22223-1-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
iw_5.4-1_mips_24kc.ipk		35.767
iw-full_5.4-1_mips_24kc.ipk	68.423

new:
iw_5.8-1_mips_24kc.ipk		36.883
iw-full_5.8-1_mips_24kc.ipk	71.992

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/utils/iw/Makefile             |   4 +-
 .../utils/iw/patches/001-nl80211_h_sync.patch | 687 +-----------------
 .../utils/iw/patches/200-reduce_size.patch    |  85 ++-
 3 files changed, 53 insertions(+), 723 deletions(-)

diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
index 7abf93e01e8e..90e678291170 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iw
-PKG_VERSION:=5.4
+PKG_VERSION:=5.8
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/iw
-PKG_HASH:=a2469f677088d7b1070a7fbb28f3c747041697e8f6ec70783339cb1bc27a395f
+PKG_HASH:=b59c4bacb0b6675cc09f2f30ebdceb91174cb65443d0a062fba2c09fad772db4
 
 PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
 PKG_LICENSE:=GPL-2.0
diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
index d935a1dc3ebf..4b462d3f205a 100644
--- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
+++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
@@ -1,696 +1,21 @@
 --- a/nl80211.h
 +++ b/nl80211.h
-@@ -11,7 +11,7 @@
-  * Copyright 2008 Jouni Malinen <jouni.malinen at atheros.com>
-  * Copyright 2008 Colin McCabe <colin at cozybit.com>
-  * Copyright 2015-2017	Intel Deutschland GmbH
-- * Copyright (C) 2018-2019 Intel Corporation
-+ * Copyright (C) 2018-2020 Intel Corporation
+@@ -2515,6 +2515,9 @@ enum nl80211_commands {
+  * @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from
+  *	association request when used with NL80211_CMD_NEW_STATION).
   *
-  * Permission to use, copy, modify, and/or distribute this software for any
-  * purpose with or without fee is hereby granted, provided that the above
-@@ -249,6 +249,45 @@
-  */
- 
- /**
-+ * DOC: VLAN offload support for setting group keys and binding STAs to VLANs
-+ *
-+ * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they
-+ * support offloading VLAN functionality in a manner where the driver exposes a
-+ * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs
-+ * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet
-+ * case. Frames received from stations that are not assigned to any VLAN are
-+ * delivered on the main netdev and frames to such stations can be sent through
-+ * that main netdev.
-+ *
-+ * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and
-+ * %NL80211_CMD_SET_STATION will optionally specify vlan_id using
-+ * %NL80211_ATTR_VLAN_ID.
-+ */
-+
-+/**
-+ * DOC: TID configuration
-+ *
-+ * TID config support can be checked in the %NL80211_ATTR_TID_CONFIG
-+ * attribute given in wiphy capabilities.
-+ *
-+ * The necessary configuration parameters are mentioned in
-+ * &enum nl80211_tid_config_attr and it will be passed to the
-+ * %NL80211_CMD_SET_TID_CONFIG command in %NL80211_ATTR_TID_CONFIG.
-+ *
-+ * If the configuration needs to be applied for specific peer then the MAC
-+ * address of the peer needs to be passed in %NL80211_ATTR_MAC, otherwise the
-+ * configuration will be applied for all the connected peers in the vif except
-+ * any peers that have peer specific configuration for the TID by default; if
-+ * the %NL80211_TID_CONFIG_ATTR_OVERRIDE flag is set, peer specific values
-+ * will be overwritten.
-+ *
-+ * All this configuration is valid only for STA's current connection
-+ * i.e. the configuration will be reset to default when the STA connects back
-+ * after disconnection/roaming, and this configuration will be cleared when
-+ * the interface goes down.
-+ */
-+
-+/**
-  * enum nl80211_commands - supported nl80211 commands
-  *
-  * @NL80211_CMD_UNSPEC: unspecified command to catch errors
-@@ -257,13 +296,14 @@
-  *	to get a list of all present wiphys.
-  * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
-  *	%NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
-- *	%NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the
-- *	attributes determining the channel width; this is used for setting
-- *	monitor mode channel),  %NL80211_ATTR_WIPHY_RETRY_SHORT,
-- *	%NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
-- *	and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
-- *	However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
-- *	instead, the support here is for backward compatibility only.
-+ *	%NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
-+ *	%NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the
-+ *	channel width; this is used for setting monitor mode channel),
-+ *	%NL80211_ATTR_WIPHY_RETRY_SHORT, %NL80211_ATTR_WIPHY_RETRY_LONG,
-+ *	%NL80211_ATTR_WIPHY_FRAG_THRESHOLD, and/or
-+ *	%NL80211_ATTR_WIPHY_RTS_THRESHOLD.  However, for setting the channel,
-+ *	see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward
-+ *	compatibility only.
-  * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
-  *	or rename notification. Has attributes %NL80211_ATTR_WIPHY and
-  *	%NL80211_ATTR_WIPHY_NAME.
-@@ -312,7 +352,8 @@
-  *	%NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
-  *	%NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
-  *	The channel to use can be set on the interface or be given using the
-- *	%NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
-+ *	%NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the
-+ *	attributes determining channel width.
-  * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
-  * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
-  * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
-@@ -497,11 +538,12 @@
-  *	interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
-  *	BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
-  *	the SSID (mainly for association, but is included in authentication
-- *	request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used
-- *	to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE
-- *	is used to specify the authentication type. %NL80211_ATTR_IE is used to
-- *	define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs)
-- *	to be added to the frame.
-+ *	request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ +
-+ *	%NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequence of the
-+ *	channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the
-+ *	authentication type. %NL80211_ATTR_IE is used to define IEs
-+ *	(VendorSpecificInfo, but also including RSN IE and FT IEs) to be added
-+ *	to the frame.
-  *	When used as an event, this reports reception of an Authentication
-  *	frame in station and IBSS modes when the local MLME processed the
-  *	frame, i.e., it was for the local STA and was received in correct
-@@ -556,8 +598,9 @@
-  *	requests to connect to a specified network but without separating
-  *	auth and assoc steps. For this, you need to specify the SSID in a
-  *	%NL80211_ATTR_SSID attribute, and can optionally specify the association
-- *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
-- *	%NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
-+ *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE,
-+ *	%NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ,
-+ *	%NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT,
-  *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
-  *	%NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
-  *	%NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
-@@ -571,6 +614,14 @@
-  *	set of BSSID,frequency parameters is used (i.e., either the enforcing
-  *	%NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
-  *	%NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
-+ *	Driver shall not modify the IEs specified through %NL80211_ATTR_IE if
-+ *	%NL80211_ATTR_MAC is included. However, if %NL80211_ATTR_MAC_HINT is
-+ *	included, these IEs through %NL80211_ATTR_IE are specified by the user
-+ *	space based on the best possible BSS selected. Thus, if the driver ends
-+ *	up selecting a different BSS, it can modify these IEs accordingly (e.g.
-+ *	userspace asks the driver to perform PMKSA caching with BSS1 and the
-+ *	driver ends up selecting BSS2 with different PMKSA cache entry; RSNIE
-+ *	has to get updated with the apt PMKID).
-  *	%NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
-  *	the ESS in case the device is already associated and an association with
-  *	a different BSS is desired.
-@@ -640,6 +691,10 @@
-  *	four bytes for vendor frames including the OUI. The registration
-  *	cannot be dropped, but is removed automatically when the netlink
-  *	socket is closed. Multiple registrations can be made.
-+ *	The %NL80211_ATTR_RECEIVE_MULTICAST flag attribute can be given if
-+ *	%NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS is available, in which
-+ *	case the registration can also be modified to include/exclude the
-+ *	flag, rather than requiring unregistration to change it.
-  * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for
-  *	backward compatibility
-  * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This
-@@ -739,7 +794,7 @@
-  *	various triggers. These triggers can be configured through this
-  *	command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
-  *	more background information, see
-- *	http://wireless.kernel.org/en/users/Documentation/WoWLAN.
-+ *	https://wireless.wiki.kernel.org/en/users/Documentation/WoWLAN.
-  *	The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
-  *	from the driver reporting the wakeup reason. In this case, the
-  *	@NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
-@@ -1101,6 +1156,20 @@
-  *	peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
-  *	content. The frame is ethernet data.
-  *
-+ * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
-+ *	is passed using %NL80211_ATTR_TID_CONFIG attribute.
-+ *
-+ * @NL80211_CMD_UNPROT_BEACON: Unprotected or incorrectly protected Beacon
-+ *	frame. This event is used to indicate that a received Beacon frame was
-+ *	dropped because it did not include a valid MME MIC while beacon
-+ *	protection was enabled (BIGTK configured in station mode).
-+ *
-+ * @NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS: Report TX status of a control
-+ *	port frame transmitted with %NL80211_CMD_CONTROL_PORT_FRAME.
-+ *	%NL80211_ATTR_COOKIE identifies the TX command and %NL80211_ATTR_FRAME
-+ *	includes the contents of the frame. %NL80211_ATTR_ACK flag is included
-+ *	if the recipient acknowledged the frame.
-+ *
-  * @NL80211_CMD_MAX: highest used command number
-  * @__NL80211_CMD_AFTER_LAST: internal use
-  */
-@@ -1325,6 +1394,12 @@ enum nl80211_commands {
- 
- 	NL80211_CMD_PROBE_MESH_LINK,
- 
-+	NL80211_CMD_SET_TID_CONFIG,
-+
-+	NL80211_CMD_UNPROT_BEACON,
-+
-+	NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
-+
- 	/* add new commands above here */
- 
- 	/* used to define NL80211_CMD_MAX below */
-@@ -1370,7 +1445,8 @@ enum nl80211_commands {
-  *	of &enum nl80211_chan_width, describing the channel width. See the
-  *	documentation of the enum for more information.
-  * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the
-- *	channel, used for anything but 20 MHz bandwidth
-+ *	channel, used for anything but 20 MHz bandwidth. In S1G this is the
-+ *	operating channel center frequency.
-  * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the
-  *	channel, used only for 80+80 MHz bandwidth
-  * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
-@@ -1580,7 +1656,8 @@ enum nl80211_commands {
-  *	flag is included, then control port frames are sent over NL80211 instead
-  *	using %CMD_CONTROL_PORT_FRAME.  If control port routing over NL80211 is
-  *	to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
-- *	flag.
-+ *	flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth
-+ *	frames are not forwared over the control port.
-  *
-  * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
-  *	We recommend using nested, driver-specific attributes within this.
-@@ -2373,6 +2450,64 @@ enum nl80211_commands {
-  *	the allowed channel bandwidth configurations. (u8 attribute)
-  *	Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
-  *
-+ * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
-+ *	(u16).
-+ *
-+ * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings.
-+ *
-+ * @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry
-+ *	using attributes from &enum nl80211_iftype_akm_attributes. This
-+ *	attribute is sent in a response to %NL80211_CMD_GET_WIPHY indicating
-+ *	supported AKM suites capability per interface. AKMs advertised in
-+ *	%NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not
-+ *	advertised for a specific interface type.
-+ *
-+ * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
-+ *	nested attribute with &enum nl80211_tid_config_attr sub-attributes;
-+ *	on output (in wiphy attributes) it contains only the feature sub-
-+ *	attributes.
-+ *
-+ * @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control
-+ *	port in order to forward/receive them as ordinary data frames.
-+ *
-+ * @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32,
-+ *	dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value).
-+ *	An optional parameter configured through %NL80211_CMD_SET_PMKSA.
-+ *	Drivers that trigger roaming need to know the lifetime of the
-+ *	configured PMKSA for triggering the full vs. PMKSA caching based
-+ *	authentication. This timeout helps authentication methods like SAE,
-+ *	where PMK gets updated only by going through a full (new SAE)
-+ *	authentication instead of getting updated during an association for EAP
-+ *	authentication. No new full authentication within the PMK expiry shall
-+ *	result in a disassociation at the end of the lifetime.
-+ *
-+ * @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in
-+ *	terms of percentage of %NL80211_ATTR_PMK_LIFETIME
-+ *	(u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional
-+ *	parameter configured through %NL80211_CMD_SET_PMKSA. Requests the
-+ *	driver to trigger a full authentication roam (without PMKSA caching)
-+ *	after the reauthentication threshold time, but before the PMK lifetime
-+ *	has expired.
-+ *
-+ *	Authentication methods like SAE need to be able to generate a new PMKSA
-+ *	entry without having to force a disconnection after the PMK timeout. If
-+ *	no roaming occurs between the reauth threshold and PMK expiration,
-+ *	disassociation is still forced.
-+ * @NL80211_ATTR_RECEIVE_MULTICAST: multicast flag for the
-+ *	%NL80211_CMD_REGISTER_FRAME command, see the description there.
-+ * @NL80211_ATTR_WIPHY_FREQ_OFFSET: offset of the associated
-+ *	%NL80211_ATTR_WIPHY_FREQ in positive KHz. Only valid when supplied with
-+ *	an %NL80211_ATTR_WIPHY_FREQ_OFFSET.
-+ * @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the
-+ *	first channel segment specified in %NL80211_ATTR_CENTER_FREQ1.
-+ * @NL80211_ATTR_SCAN_FREQ_KHZ: nested attribute with KHz frequencies
-+ *
-+ * @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from
-+ *	association request when used with NL80211_CMD_NEW_STATION).
-+ *
 + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
 + *	transmit power to stay within regulatory limits. u32, dBi.
 + *
   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
   * @NL80211_ATTR_MAX: highest attribute number currently defined
   * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -2835,6 +2970,28 @@ enum nl80211_attrs {
- 	NL80211_ATTR_WIPHY_EDMG_CHANNELS,
- 	NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
+@@ -2997,6 +3000,8 @@ enum nl80211_attrs {
+ 
+ 	NL80211_ATTR_HE_6GHZ_CAPABILITY,
  
-+	NL80211_ATTR_VLAN_ID,
-+
-+	NL80211_ATTR_HE_BSS_COLOR,
-+
-+	NL80211_ATTR_IFTYPE_AKM_SUITES,
-+
-+	NL80211_ATTR_TID_CONFIG,
-+
-+	NL80211_ATTR_CONTROL_PORT_NO_PREAUTH,
-+
-+	NL80211_ATTR_PMK_LIFETIME,
-+	NL80211_ATTR_PMK_REAUTH_THRESHOLD,
-+
-+	NL80211_ATTR_RECEIVE_MULTICAST,
-+	NL80211_ATTR_WIPHY_FREQ_OFFSET,
-+	NL80211_ATTR_CENTER_FREQ1_OFFSET,
-+	NL80211_ATTR_SCAN_FREQ_KHZ,
-+
-+	NL80211_ATTR_HE_6GHZ_CAPABILITY,
-+
 +	NL80211_ATTR_WIPHY_ANTENNA_GAIN,
 +
  	/* add attributes here, update the policy in nl80211.c */
  
  	__NL80211_ATTR_AFTER_LAST,
-@@ -3413,6 +3570,8 @@ enum nl80211_mpath_info {
-  *     defined in HE capabilities IE
-  * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently
-  *     defined
-+ * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16),
-+ *	given for all 6 GHz band channels
-  * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
-  */
- enum nl80211_band_iftype_attr {
-@@ -3423,6 +3582,7 @@ enum nl80211_band_iftype_attr {
- 	NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
- 	NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
- 	NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
-+	NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
- 
- 	/* keep last */
- 	__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
-@@ -3554,6 +3714,9 @@ enum nl80211_wmm_rule {
-  * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
-  *	This is a nested attribute that contains the wmm limitation per AC.
-  *	(see &enum nl80211_wmm_rule)
-+ * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel
-+ *	in current regulatory domain.
-+ * @NL80211_FREQUENCY_ATTR_OFFSET: frequency offset in KHz
-  * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
-  *	currently defined
-  * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
-@@ -3583,6 +3746,8 @@ enum nl80211_frequency_attr {
- 	NL80211_FREQUENCY_ATTR_NO_20MHZ,
- 	NL80211_FREQUENCY_ATTR_NO_10MHZ,
- 	NL80211_FREQUENCY_ATTR_WMM,
-+	NL80211_FREQUENCY_ATTR_NO_HE,
-+	NL80211_FREQUENCY_ATTR_OFFSET,
- 
- 	/* keep last */
- 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
-@@ -3780,6 +3945,7 @@ enum nl80211_sched_scan_match_attr {
-  * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
-  * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
-  * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
-+ * @NL80211_RRF_NO_HE: HE operation not allowed
-  */
- enum nl80211_reg_rule_flags {
- 	NL80211_RRF_NO_OFDM		= 1<<0,
-@@ -3797,6 +3963,7 @@ enum nl80211_reg_rule_flags {
- 	NL80211_RRF_NO_HT40PLUS		= 1<<14,
- 	NL80211_RRF_NO_80MHZ		= 1<<15,
- 	NL80211_RRF_NO_160MHZ		= 1<<16,
-+	NL80211_RRF_NO_HE		= 1<<17,
- };
- 
- #define NL80211_RRF_PASSIVE_SCAN	NL80211_RRF_NO_IR
-@@ -4351,6 +4518,7 @@ enum nl80211_bss_scan_width {
-  * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update.
-  *	Contains a nested array of signal strength attributes (u8, dBm),
-  *	using the nesting index as the antenna number.
-+ * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz
-  * @__NL80211_BSS_AFTER_LAST: internal
-  * @NL80211_BSS_MAX: highest BSS attribute
-  */
-@@ -4375,6 +4543,7 @@ enum nl80211_bss {
- 	NL80211_BSS_PARENT_TSF,
- 	NL80211_BSS_PARENT_BSSID,
- 	NL80211_BSS_CHAIN_SIGNAL,
-+	NL80211_BSS_FREQUENCY_OFFSET,
- 
- 	/* keep last */
- 	__NL80211_BSS_AFTER_LAST,
-@@ -4503,6 +4672,7 @@ enum nl80211_key_default_types {
-  *	See &enum nl80211_key_default_types.
-  * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
-  *	Defaults to @NL80211_KEY_RX_TX.
-+ * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key
-  *
-  * @__NL80211_KEY_AFTER_LAST: internal
-  * @NL80211_KEY_MAX: highest key attribute
-@@ -4518,6 +4688,7 @@ enum nl80211_key_attributes {
- 	NL80211_KEY_TYPE,
- 	NL80211_KEY_DEFAULT_TYPES,
- 	NL80211_KEY_MODE,
-+	NL80211_KEY_DEFAULT_BEACON,
- 
- 	/* keep last */
- 	__NL80211_KEY_AFTER_LAST,
-@@ -4674,6 +4845,92 @@ enum nl80211_tx_power_setting {
- };
- 
- /**
-+ * enum nl80211_tid_config - TID config state
-+ * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID
-+ * @NL80211_TID_CONFIG_DISABLE: Disable config for the TID
-+ */
-+enum nl80211_tid_config {
-+	NL80211_TID_CONFIG_ENABLE,
-+	NL80211_TID_CONFIG_DISABLE,
-+};
-+
-+/* enum nl80211_tx_rate_setting - TX rate configuration type
-+ * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate
-+ * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter
-+ * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter
-+ */
-+enum nl80211_tx_rate_setting {
-+	NL80211_TX_RATE_AUTOMATIC,
-+	NL80211_TX_RATE_LIMITED,
-+	NL80211_TX_RATE_FIXED,
-+};
-+
-+/* enum nl80211_tid_config_attr - TID specific configuration.
-+ * @NL80211_TID_CONFIG_ATTR_PAD: pad attribute for 64-bit values
-+ * @NL80211_TID_CONFIG_ATTR_VIF_SUPP: a bitmap (u64) of attributes supported
-+ *	for per-vif configuration; doesn't list the ones that are generic
-+ *	(%NL80211_TID_CONFIG_ATTR_TIDS, %NL80211_TID_CONFIG_ATTR_OVERRIDE).
-+ * @NL80211_TID_CONFIG_ATTR_PEER_SUPP: same as the previous per-vif one, but
-+ *	per peer instead.
-+ * @NL80211_TID_CONFIG_ATTR_OVERRIDE: flag attribue, if set indicates
-+ *	that the new configuration overrides all previous peer
-+ *	configurations, otherwise previous peer specific configurations
-+ *	should be left untouched.
-+ * @NL80211_TID_CONFIG_ATTR_TIDS: a bitmask value of TIDs (bit 0 to 7)
-+ *	Its type is u16.
-+ * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID.
-+ *	specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config.
-+ *	Its type is u8.
-+ * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame
-+ *	transmission, user-space sets this configuration in
-+ *	&NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and
-+ *	the max value is advertised by the driver in this attribute on
-+ *	output in wiphy capabilities.
-+ * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame
-+ *	transmission, user-space sets this configuration in
-+ *	&NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
-+ *	the max value is advertised by the driver in this attribute on
-+ *	output in wiphy capabilities.
-+ * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable MPDU aggregation
-+ *	for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS.
-+ *	Its type is u8, using the values from &nl80211_tid_config.
-+ * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TIDs
-+ *	specified in %NL80211_TID_CONFIG_ATTR_TIDS. It is u8 type, using
-+ *	the values from &nl80211_tid_config.
-+ * @NL80211_TID_CONFIG_ATTR_AMSDU_CTRL: Enable/Disable MSDU aggregation
-+ *	for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS.
-+ *	Its type is u8, using the values from &nl80211_tid_config.
-+ * @NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE: This attribute will be useful
-+ *	to notfiy the driver that what type of txrate should be used
-+ *	for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS. using
-+ *	the values form &nl80211_tx_rate_setting.
-+ * @NL80211_TID_CONFIG_ATTR_TX_RATE: Data frame TX rate mask should be applied
-+ *	with the parameters passed through %NL80211_ATTR_TX_RATES.
-+ *	configuration is applied to the data frame for the tid to that connected
-+ *	station.
-+ */
-+enum nl80211_tid_config_attr {
-+	__NL80211_TID_CONFIG_ATTR_INVALID,
-+	NL80211_TID_CONFIG_ATTR_PAD,
-+	NL80211_TID_CONFIG_ATTR_VIF_SUPP,
-+	NL80211_TID_CONFIG_ATTR_PEER_SUPP,
-+	NL80211_TID_CONFIG_ATTR_OVERRIDE,
-+	NL80211_TID_CONFIG_ATTR_TIDS,
-+	NL80211_TID_CONFIG_ATTR_NOACK,
-+	NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
-+	NL80211_TID_CONFIG_ATTR_RETRY_LONG,
-+	NL80211_TID_CONFIG_ATTR_AMPDU_CTRL,
-+	NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL,
-+	NL80211_TID_CONFIG_ATTR_AMSDU_CTRL,
-+	NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE,
-+	NL80211_TID_CONFIG_ATTR_TX_RATE,
-+
-+	/* keep last */
-+	__NL80211_TID_CONFIG_ATTR_AFTER_LAST,
-+	NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1
-+};
-+
-+/**
-  * enum nl80211_packet_pattern_attr - packet pattern attribute
-  * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
-  * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has
-@@ -5144,6 +5401,8 @@ enum plink_actions {
- 
- #define NL80211_KCK_LEN			16
- #define NL80211_KEK_LEN			16
-+#define NL80211_KCK_EXT_LEN		24
-+#define NL80211_KEK_EXT_LEN		32
- #define NL80211_REPLAY_CTR_LEN		8
- 
- /**
-@@ -5152,6 +5411,7 @@ enum plink_actions {
-  * @NL80211_REKEY_DATA_KEK: key encryption key (binary)
-  * @NL80211_REKEY_DATA_KCK: key confirmation key (binary)
-  * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary)
-+ * @NL80211_REKEY_DATA_AKM: AKM data (OUI, suite type)
-  * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal)
-  * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal)
-  */
-@@ -5160,6 +5420,7 @@ enum nl80211_rekey_data {
- 	NL80211_REKEY_DATA_KEK,
- 	NL80211_REKEY_DATA_KCK,
- 	NL80211_REKEY_DATA_REPLAY_CTR,
-+	NL80211_REKEY_DATA_AKM,
- 
- 	/* keep last */
- 	NUM_NL80211_REKEY_DATA,
-@@ -5484,6 +5745,39 @@ enum nl80211_feature_flags {
-  * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in
-  *	station mode (SAE password is passed as part of the connect command).
-  *
-+ * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev
-+ *	with VLAN tagged frames and separate VLAN-specific netdevs added using
-+ *	vconfig similarly to the Ethernet case.
-+ *
-+ * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL)
-+ *	feature, which prevents bufferbloat by using the expected transmission
-+ *	time to limit the amount of data buffered in the hardware.
-+ *
-+ * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection
-+ *	and can receive key configuration for BIGTK using key indexes 6 and 7.
-+ * @NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT: The driver supports Beacon
-+ *	protection as a client only and cannot transmit protected beacons.
-+ *
-+ * @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the
-+ *	forwarding of preauth frames over the control port. They are then
-+ *	handled as ordinary data frames.
-+ *
-+ * @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames
-+ *
-+ * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations
-+ *      in IBSS mode, essentially by dropping their state.
-+ *
-+ * @NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS: management frame registrations
-+ *	are possible for multicast frames and those will be reported properly.
-+ *
-+ * @NL80211_EXT_FEATURE_SCAN_FREQ_KHZ: This driver supports receiving and
-+ *	reporting scan request with %NL80211_ATTR_SCAN_FREQ_KHZ. In order to
-+ *	report %NL80211_ATTR_SCAN_FREQ_KHZ, %NL80211_SCAN_FLAG_FREQ_KHZ must be
-+ *	included in the scan request.
-+ *
-+ * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS: The driver
-+ *	can report tx status for control port over nl80211 tx operations.
-+ *
-  * @NUM_NL80211_EXT_FEATURES: number of extended features.
-  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
-  */
-@@ -5529,6 +5823,16 @@ enum nl80211_ext_feature_index {
- 	NL80211_EXT_FEATURE_EXT_KEY_ID,
- 	NL80211_EXT_FEATURE_STA_TX_PWR,
- 	NL80211_EXT_FEATURE_SAE_OFFLOAD,
-+	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
-+	NL80211_EXT_FEATURE_AQL,
-+	NL80211_EXT_FEATURE_BEACON_PROTECTION,
-+	NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH,
-+	NL80211_EXT_FEATURE_PROTECTED_TWT,
-+	NL80211_EXT_FEATURE_DEL_IBSS_STA,
-+	NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
-+	NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
-+	NL80211_EXT_FEATURE_SCAN_FREQ_KHZ,
-+	NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS,
- 
- 	/* add new features before the definition below */
- 	NUM_NL80211_EXT_FEATURES,
-@@ -5640,6 +5944,9 @@ enum nl80211_timeout_reason {
-  * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
-  *	only have supported rates and no additional capabilities (unless
-  *	added by userspace explicitly.)
-+ * @NL80211_SCAN_FLAG_FREQ_KHZ: report scan results with
-+ *	%NL80211_ATTR_SCAN_FREQ_KHZ. This also means
-+ *	%NL80211_ATTR_SCAN_FREQUENCIES will not be included.
-  */
- enum nl80211_scan_flags {
- 	NL80211_SCAN_FLAG_LOW_PRIORITY				= 1<<0,
-@@ -5655,6 +5962,7 @@ enum nl80211_scan_flags {
- 	NL80211_SCAN_FLAG_HIGH_ACCURACY				= 1<<10,
- 	NL80211_SCAN_FLAG_RANDOM_SN				= 1<<11,
- 	NL80211_SCAN_FLAG_MIN_PREQ_CONTENT			= 1<<12,
-+	NL80211_SCAN_FLAG_FREQ_KHZ				= 1<<13,
- };
- 
- /**
-@@ -6151,12 +6459,14 @@ enum nl80211_ftm_responder_stats {
-  * @NL80211_PREAMBLE_HT: HT preamble
-  * @NL80211_PREAMBLE_VHT: VHT preamble
-  * @NL80211_PREAMBLE_DMG: DMG preamble
-+ * @NL80211_PREAMBLE_HE: HE preamble
-  */
- enum nl80211_preamble {
- 	NL80211_PREAMBLE_LEGACY,
- 	NL80211_PREAMBLE_HT,
- 	NL80211_PREAMBLE_VHT,
- 	NL80211_PREAMBLE_DMG,
-+	NL80211_PREAMBLE_HE,
- };
- 
- /**
-@@ -6349,6 +6659,10 @@ enum nl80211_peer_measurement_attrs {
-  *	is valid)
-  * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating
-  *	the maximum FTMs per burst (if not present anything is valid)
-+ * @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if
-+ *	trigger based ranging measurement is supported
-+ * @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating
-+ *	if non trigger based ranging measurement is supported
-  *
-  * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
-  * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
-@@ -6364,6 +6678,8 @@ enum nl80211_peer_measurement_ftm_capa {
- 	NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
- 	NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
- 	NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
-+	NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED,
-+	NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED,
- 
- 	/* keep last */
- 	NUM_NL80211_PMSR_FTM_CAPA_ATTR,
-@@ -6393,6 +6709,20 @@ enum nl80211_peer_measurement_ftm_capa {
-  * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag)
-  * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data
-  *	(flag)
-+ * @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging
-+ *	measurement (flag).
-+ *	This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are
-+ *	mutually exclusive.
-+ *      if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
-+ *	%NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
-+ *	ranging will be used.
-+ * @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based
-+ *	ranging measurement (flag)
-+ *	This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are
-+ *	mutually exclusive.
-+ *      if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
-+ *	%NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
-+ *	ranging will be used.
-  *
-  * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
-  * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
-@@ -6409,6 +6739,8 @@ enum nl80211_peer_measurement_ftm_req {
- 	NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
- 	NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
- 	NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
-+	NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED,
-+	NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,
- 
- 	/* keep last */
- 	NUM_NL80211_PMSR_FTM_REQ_ATTR,
-@@ -6548,5 +6880,51 @@ enum nl80211_obss_pd_attributes {
- 	NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
- };
- 
-+/**
-+ * enum nl80211_bss_color_attributes - BSS Color attributes
-+ * @__NL80211_HE_BSS_COLOR_ATTR_INVALID: Invalid
-+ *
-+ * @NL80211_HE_BSS_COLOR_ATTR_COLOR: the current BSS Color.
-+ * @NL80211_HE_BSS_COLOR_ATTR_DISABLED: is BSS coloring disabled.
-+ * @NL80211_HE_BSS_COLOR_ATTR_PARTIAL: the AID equation to be used..
-+ *
-+ * @__NL80211_HE_BSS_COLOR_ATTR_LAST: Internal
-+ * @NL80211_HE_BSS_COLOR_ATTR_MAX: highest BSS Color attribute.
-+ */
-+enum nl80211_bss_color_attributes {
-+	__NL80211_HE_BSS_COLOR_ATTR_INVALID,
-+
-+	NL80211_HE_BSS_COLOR_ATTR_COLOR,
-+	NL80211_HE_BSS_COLOR_ATTR_DISABLED,
-+	NL80211_HE_BSS_COLOR_ATTR_PARTIAL,
-+
-+	/* keep last */
-+	__NL80211_HE_BSS_COLOR_ATTR_LAST,
-+	NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1,
-+};
-+
-+/**
-+ * enum nl80211_iftype_akm_attributes - interface type AKM attributes
-+ * @__NL80211_IFTYPE_AKM_ATTR_INVALID: Invalid
-+ *
-+ * @NL80211_IFTYPE_AKM_ATTR_IFTYPES: nested attribute containing a flag
-+ *	attribute for each interface type that supports AKM suites specified in
-+ *	%NL80211_IFTYPE_AKM_ATTR_SUITES
-+ * @NL80211_IFTYPE_AKM_ATTR_SUITES: an array of u32. Used to indicate supported
-+ *	AKM suites for the specified interface types.
-+ *
-+ * @__NL80211_IFTYPE_AKM_ATTR_LAST: Internal
-+ * @NL80211_IFTYPE_AKM_ATTR_MAX: highest interface type AKM attribute.
-+ */
-+enum nl80211_iftype_akm_attributes {
-+	__NL80211_IFTYPE_AKM_ATTR_INVALID,
-+
-+	NL80211_IFTYPE_AKM_ATTR_IFTYPES,
-+	NL80211_IFTYPE_AKM_ATTR_SUITES,
-+
-+	/* keep last */
-+	__NL80211_IFTYPE_AKM_ATTR_LAST,
-+	NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
-+};
- 
- #endif /* __LINUX_NL80211_H */
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch
index 58613d59a0b0..24eb96537b0f 100644
--- a/package/network/utils/iw/patches/200-reduce_size.patch
+++ b/package/network/utils/iw/patches/200-reduce_size.patch
@@ -1,6 +1,6 @@
 --- a/event.c
 +++ b/event.c
-@@ -699,6 +699,7 @@ static int print_event(struct nl_msg *ms
+@@ -944,6 +944,7 @@ static int print_event(struct nl_msg *ms
  	}
  
  	switch (gnlh->cmd) {
@@ -8,15 +8,15 @@
  	case NL80211_CMD_NEW_WIPHY:
  		printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
  		break;
-@@ -734,6 +735,7 @@ static int print_event(struct nl_msg *ms
+@@ -979,6 +980,7 @@ static int print_event(struct nl_msg *ms
  	case NL80211_CMD_SCHED_SCAN_RESULTS:
  		printf("got scheduled scan results\n");
  		break;
 +#endif
+ 	case NL80211_CMD_WIPHY_REG_CHANGE:
  	case NL80211_CMD_REG_CHANGE:
- 		printf("regulatory domain change: ");
- 
-@@ -812,6 +814,7 @@ static int print_event(struct nl_msg *ms
+ 		if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
+@@ -1061,6 +1063,7 @@ static int print_event(struct nl_msg *ms
  		mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  		printf("del station %s\n", macbuf);
  		break;
@@ -24,10 +24,10 @@
  	case NL80211_CMD_JOIN_IBSS:
  		mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  		printf("IBSS %s joined\n", macbuf);
-@@ -989,9 +992,9 @@ static int print_event(struct nl_msg *ms
- 		parse_nan_match(tb);
+@@ -1254,9 +1257,9 @@ static int print_event(struct nl_msg *ms
+ 	case NL80211_CMD_CH_SWITCH_NOTIFY:
+ 		parse_ch_switch_notify(tb, gnlh->cmd);
  		break;
- 	}
 +#endif
  	default:
 -		printf("unknown event %d (%s)\n",
@@ -38,7 +38,7 @@
  
 --- a/info.c
 +++ b/info.c
-@@ -164,6 +164,7 @@ static int print_phy_handler(struct nl_m
+@@ -167,6 +167,7 @@ static int print_phy_handler(struct nl_m
  			    tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
  				print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
  					       nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
@@ -46,7 +46,7 @@
  			if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) {
  				struct nlattr *nl_iftype;
  				int rem_band;
-@@ -171,6 +172,7 @@ static int print_phy_handler(struct nl_m
+@@ -174,6 +175,7 @@ static int print_phy_handler(struct nl_m
  				nla_for_each_nested(nl_iftype, tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band)
  					print_he_info(nl_iftype);
  			}
@@ -54,7 +54,7 @@
  			if (tb_band[NL80211_BAND_ATTR_FREQS]) {
  				if (!band_had_freq) {
  					printf("\t\tFrequencies:\n");
-@@ -213,6 +215,7 @@ next:
+@@ -216,6 +218,7 @@ next:
  				}
  			}
  
@@ -62,7 +62,7 @@
  			if (tb_band[NL80211_BAND_ATTR_RATES]) {
  			printf("\t\tBitrates (non-HT):\n");
  			nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
-@@ -229,6 +232,7 @@ next:
+@@ -232,6 +235,7 @@ next:
  				printf("\n");
  			}
  			}
@@ -70,7 +70,7 @@
  		}
  	}
  
-@@ -294,6 +298,7 @@ next:
+@@ -297,6 +301,7 @@ next:
  		printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
  	}
  
@@ -78,7 +78,7 @@
  	if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
  		int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
  		int i;
-@@ -305,6 +310,7 @@ next:
+@@ -308,6 +313,7 @@ next:
  					cipher_name(ciphers[i]));
  		}
  	}
@@ -86,7 +86,7 @@
  
  	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
  	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
-@@ -324,11 +330,13 @@ next:
+@@ -327,11 +333,13 @@ next:
  			printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
  	}
  
@@ -100,7 +100,7 @@
  
  	if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
  		struct nlattr *nl_combi;
-@@ -425,6 +433,7 @@ broken_combination:
+@@ -428,6 +436,7 @@ broken_combination:
  			printf("\tinterface combinations are not supported\n");
  	}
  
@@ -108,7 +108,7 @@
  	if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
  		printf("\tSupported commands:\n");
  		nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
-@@ -522,6 +531,7 @@ broken_combination:
+@@ -525,6 +534,7 @@ broken_combination:
  				printf("\t\t * wake up on TCP connection\n");
  		}
  	}
@@ -116,7 +116,7 @@
  
  	if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
  		printf("\tDevice supports roaming.\n");
-@@ -560,6 +570,7 @@ broken_combination:
+@@ -563,6 +573,7 @@ broken_combination:
  		}
  	}
  
@@ -124,7 +124,7 @@
  	if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
  		unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  
-@@ -624,6 +635,7 @@ broken_combination:
+@@ -627,6 +638,7 @@ broken_combination:
  		if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
  			printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
  	}
@@ -132,7 +132,7 @@
  
  	if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
  		printf("\tDevice supports T-DLS.\n");
-@@ -732,6 +744,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
+@@ -762,6 +774,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
  	 "List all wireless devices and their capabilities.");
  TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
  
@@ -140,7 +140,7 @@
  static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
  			   int argc, char **argv, enum id_input id)
  {
-@@ -743,6 +756,7 @@ static int handle_commands(struct nl8021
+@@ -773,6 +786,7 @@ static int handle_commands(struct nl8021
  }
  TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
  	 "list all known commands and their decimal & hex value");
@@ -150,7 +150,7 @@
  {
 --- a/scan.c
 +++ b/scan.c
-@@ -1195,6 +1195,9 @@ static void print_ht_op(const uint8_t ty
+@@ -1297,6 +1297,9 @@ static void print_ht_op(const uint8_t ty
  	printf("\t\t * secondary channel offset: %s\n",
  		ht_secondary_offset[data[1] & 0x3]);
  	printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
@@ -160,7 +160,7 @@
  	printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
  	printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
  	printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
-@@ -1522,6 +1525,14 @@ static void print_ie(const struct ie_pri
+@@ -1707,6 +1710,14 @@ static void print_ie(const struct ie_pri
  
  static const struct ie_print ieprinters[] = {
  	[0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
@@ -175,12 +175,15 @@
  	[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  	[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
  	[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
-@@ -1531,21 +1542,15 @@ static const struct ie_print ieprinters[
+@@ -1716,26 +1727,20 @@ static const struct ie_print ieprinters[
  	[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
  	[35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
  	[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
 -	[45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  	[47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
+ 	[51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), },
+ 	[59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
+ 	[66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
  	[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
 -	[61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
 -	[62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
@@ -188,17 +191,19 @@
 -	[192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
 -	[48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  	[50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
+ 	[70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
  	[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
 -	[114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  	[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
  	[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
  	[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
- 	[111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
+ 	[111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), },
+ 	[195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), },
 +#endif
  };
  
  static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
-@@ -2024,6 +2029,7 @@ void print_ies(unsigned char *ie, int ie
+@@ -2279,6 +2284,7 @@ void print_ies(unsigned char *ie, int ie
  		    ieprinters[ie[0]].flags & BIT(ptype)) {
  			print_ie(&ieprinters[ie[0]],
  				 ie[0], ie[1], ie + 2, &ie_buffer);
@@ -206,7 +211,7 @@
  		} else if (ie[0] == 221 /* vendor */) {
  			print_vendor(ie[1], ie + 2, unknown, ptype);
  		} else if (unknown) {
-@@ -2033,6 +2039,7 @@ void print_ies(unsigned char *ie, int ie
+@@ -2288,6 +2294,7 @@ void print_ies(unsigned char *ie, int ie
  			for (i=0; i<ie[1]; i++)
  				printf(" %.2x", ie[2+i]);
  			printf("\n");
@@ -214,7 +219,7 @@
  		}
  		ielen -= ie[1] + 2;
  		ie += ie[1] + 2;
-@@ -2073,6 +2080,7 @@ static void print_capa_non_dmg(__u16 cap
+@@ -2328,6 +2335,7 @@ static void print_capa_non_dmg(__u16 cap
  		printf(" ESS");
  	if (capa & WLAN_CAPABILITY_IBSS)
  		printf(" IBSS");
@@ -222,7 +227,7 @@
  	if (capa & WLAN_CAPABILITY_CF_POLLABLE)
  		printf(" CfPollable");
  	if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
-@@ -2101,6 +2109,7 @@ static void print_capa_non_dmg(__u16 cap
+@@ -2356,6 +2364,7 @@ static void print_capa_non_dmg(__u16 cap
  		printf(" DelayedBACK");
  	if (capa & WLAN_CAPABILITY_IMM_BACK)
  		printf(" ImmediateBACK");
@@ -230,7 +235,7 @@
  }
  
  static int print_bss_handler(struct nl_msg *msg, void *arg)
-@@ -2185,8 +2194,10 @@ static int print_bss_handler(struct nl_m
+@@ -2440,8 +2449,10 @@ static int print_bss_handler(struct nl_m
  	if (bss[NL80211_BSS_FREQUENCY]) {
  		int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
  		printf("\tfreq: %d\n", freq);
@@ -241,7 +246,7 @@
  	}
  	if (bss[NL80211_BSS_BEACON_INTERVAL])
  		printf("\tbeacon interval: %d TUs\n",
-@@ -2380,6 +2391,7 @@ static int handle_stop_sched_scan(struct
+@@ -2635,6 +2646,7 @@ static int handle_stop_sched_scan(struct
  	return 0;
  }
  
@@ -249,7 +254,7 @@
  COMMAND(scan, sched_start,
  	SCHED_SCAN_OPTIONS,
  	NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
-@@ -2390,3 +2402,4 @@ COMMAND(scan, sched_start,
+@@ -2645,3 +2657,4 @@ COMMAND(scan, sched_start,
  COMMAND(scan, sched_stop, "",
  	NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
  	"Stop an ongoing scheduled scan.");
@@ -272,7 +277,7 @@
  
  int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
  {
-@@ -298,6 +300,9 @@ int parse_keys(struct nl_msg *msg, char
+@@ -311,6 +313,9 @@ int parse_keys(struct nl_msg *msg, char
  	char keybuf[13];
  	int pos = 0;
  
@@ -284,7 +289,7 @@
  
 --- a/Makefile
 +++ b/Makefile
-@@ -22,6 +22,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
+@@ -23,6 +23,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
  VERSION_OBJS := $(filter-out version.o, $(_OBJS))
  OBJS := $(VERSION_OBJS) version.o
  
@@ -299,7 +304,7 @@
  ifeq ($(NO_PKG_CONFIG),)
 --- a/station.c
 +++ b/station.c
-@@ -759,10 +759,12 @@ static int handle_station_set_plink(stru
+@@ -777,10 +777,12 @@ static int handle_station_set_plink(stru
   nla_put_failure:
  	return -ENOBUFS;
  }
@@ -312,7 +317,7 @@
  
  static int handle_station_set_vlan(struct nl80211_state *state,
  				   struct nl_msg *msg,
-@@ -857,11 +859,13 @@ static int handle_station_set_mesh_power
+@@ -875,11 +877,13 @@ static int handle_station_set_mesh_power
  nla_put_failure:
  	return -ENOBUFS;
  }
@@ -348,10 +353,10 @@
  SECTION(switch);
  COMMAND(switch, freq,
  	"<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
-@@ -727,3 +730,4 @@ COMMAND(switch, freq,
- 	"Switch the operating channel by sending a channel switch announcement (CSA).");
- COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
- 	NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
+@@ -956,3 +959,4 @@ COMMAND(set, tidconf, "[peer <MAC addres
+ 	"  $ iw dev wlan0 tids 0x3 override ampdu on noack on rtscts on\n"
+ 	"  $ iw dev wlan0 peer xx:xx:xx:xx:xx:xx tids 0x1 ampdu off tids 0x3 amsdu off rtscts on\n"
+ 	);
 +#endif
 --- a/phy.c
 +++ b/phy.c
-- 
2.20.1




From hauke at hauke-m.de  Tue Sep  1 08:57:02 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:02 +0200
Subject: [PATCH 1/6] jansson: Update to version 2.13.1
Message-ID: <20200901125707.22358-1-hauke@hauke-m.de>

This also sets the ABI_VERSION as this is a versioned shared library.

The ipk sizes for mips_24Kc change like this:
old:
jansson_2.12-1_mips_24kc.ipk	18.692

new:
jansson4_2.13.1-1_mips_24kc.ipk	19.171

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/libs/jansson/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/libs/jansson/Makefile b/package/libs/jansson/Makefile
index 30278ca02eb9..247be3401bd8 100644
--- a/package/libs/jansson/Makefile
+++ b/package/libs/jansson/Makefile
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=jansson
-PKG_VERSION:=2.12
+PKG_VERSION:=2.13.1
 PKG_RELEASE:=1
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.digip.org/jansson/releases/
-PKG_HASH:=645d72cc5dbebd4df608d33988e55aa42a7661039e19a379fcbe5c79d1aee1d2
+PKG_HASH:=ee90a0f879d2b7b7159124ff22b937a2a9a8c36d3bb65d1da7dd3f04370a10bd
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
@@ -32,6 +32,7 @@ define Package/jansson
   CATEGORY:=Libraries
   TITLE:=Jansson library
   URL:=http://www.digip.org/jansson/
+  ABI_VERSION:=4
 endef
 
 define Package/jansson/description
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:57:04 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:04 +0200
Subject: [PATCH 3/6] nftables: Update to version 0.9.6
In-Reply-To: <20200901125707.22358-1-hauke@hauke-m.de>
References: <20200901125707.22358-1-hauke@hauke-m.de>
Message-ID: <20200901125707.22358-3-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
nftables-json_0.9.3-1_mips_24kc.ipk	220.262
nftables-nojson_0.9.3-1_mips_24kc.ipk	192.937

new:
nftables-json_0.9.6-1_mips_24kc.ipk	231.968
nftables-nojson_0.9.6-1_mips_24kc.ipk	204.731

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/utils/nftables/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile
index 67906f8b7d75..8f6e60571551 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
-PKG_VERSION:=0.9.3
+PKG_VERSION:=0.9.6
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
-PKG_HASH:=956b915ce2a7aeaff123e49006be7a0690a0964e96c062703181a36e2e5edb78
+PKG_HASH:=68d6fdfe8ab02303e6b1f13968a4022da5b0120110eaee3233d806857937b66e
 PKG_MAINTAINER:=
 PKG_LICENSE:=GPL-2.0
 
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:57:05 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:05 +0200
Subject: [PATCH 4/6] jansson: Activate link time optimization (LTO)
In-Reply-To: <20200901125707.22358-1-hauke@hauke-m.de>
References: <20200901125707.22358-1-hauke@hauke-m.de>
Message-ID: <20200901125707.22358-4-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
jansson4_2.13.1-1_mips_24kc.ipk	19.171

new:
jansson4_2.13.1-2_mips_24kc.ipk	18.936

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/libs/jansson/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/libs/jansson/Makefile b/package/libs/jansson/Makefile
index 247be3401bd8..5799a362dd5f 100644
--- a/package/libs/jansson/Makefile
+++ b/package/libs/jansson/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=jansson
 PKG_VERSION:=2.13.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE
 
@@ -39,6 +39,9 @@ define Package/jansson/description
   Jansson is a C library for encoding, decoding and manipulating JSON data
 endef
 
+TARGET_CFLAGS += -flto
+TARGET_LDFLAGS += -flto
+
 define Package/jansson/install
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so* $(1)/usr/lib/
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:57:03 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:03 +0200
Subject: [PATCH 2/6] libnftnl: Update to version 1.1.7
In-Reply-To: <20200901125707.22358-1-hauke@hauke-m.de>
References: <20200901125707.22358-1-hauke@hauke-m.de>
Message-ID: <20200901125707.22358-2-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
libnftnl12_1.1.5-1_mips_24kc.ipk	46.252

new:
libnftnl12_1.1.7-1_mips_24kc.ipk	47.459

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/libs/libnftnl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile
index 74771fe678cf..3d8d68ad5f15 100644
--- a/package/libs/libnftnl/Makefile
+++ b/package/libs/libnftnl/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnftnl
-PKG_VERSION:=1.1.5
+PKG_VERSION:=1.1.7
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
-PKG_HASH:=66de4d05227c0a1a731c369b193010d18a05b1185c2735211e0ecf658eeb14f3
+PKG_HASH:=20dbc13f11004aea2c9e479cfb90359cb11fe3446c3140811c18e4ec1648ed8f
 PKG_MAINTAINER:=Steven Barth <steven at midlink.org>
 PKG_LICENSE:=GPL-2.0+
 
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:57:06 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:06 +0200
Subject: [PATCH 5/6] libnftnl: Activate link time optimization (LTO)
In-Reply-To: <20200901125707.22358-1-hauke@hauke-m.de>
References: <20200901125707.22358-1-hauke@hauke-m.de>
Message-ID: <20200901125707.22358-5-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
libnftnl12_1.1.7-1_mips_24kc.ipk	47.459

new:
libnftnl12_1.1.7-2_mips_24kc.ipk	45.742

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/libs/libnftnl/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile
index 3d8d68ad5f15..c56fb068ce94 100644
--- a/package/libs/libnftnl/Makefile
+++ b/package/libs/libnftnl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnftnl
 PKG_VERSION:=1.1.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
@@ -39,7 +39,8 @@ define Package/libnftnl/description
  programming interface (API) to the in-kernel nf_tables subsystem.
 endef
 
-TARGET_CFLAGS += $(FPIC)
+TARGET_CFLAGS += $(FPIC) -flto
+TARGET_LDFLAGS += -flto
 
 CONFIGURE_ARGS += \
 	--enable-static \
-- 
2.20.1



From hauke at hauke-m.de  Tue Sep  1 08:57:07 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue,  1 Sep 2020 14:57:07 +0200
Subject: [PATCH 6/6] nftables: Activate link time optimization (LTO)
In-Reply-To: <20200901125707.22358-1-hauke@hauke-m.de>
References: <20200901125707.22358-1-hauke@hauke-m.de>
Message-ID: <20200901125707.22358-6-hauke@hauke-m.de>

The ipk sizes for mips_24Kc change like this:
old:
nftables-json_0.9.6-1_mips_24kc.ipk	231.968
nftables-nojson_0.9.6-1_mips_24kc.ipk	204.731

new:
nftables-json_0.9.6-2_mips_24kc.ipk	221.894
nftables-nojson_0.9.6-2_mips_24kc.ipk	193.932

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/utils/nftables/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile
index 8f6e60571551..7830596e847c 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
 PKG_VERSION:=0.9.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
@@ -58,6 +58,9 @@ ifeq ($(BUILD_VARIANT),json)
   CONFIGURE_ARGS += --with-json
 endif
 
+TARGET_CFLAGS += -flto
+TARGET_LDFLAGS += -flto
+
 define Package/nftables/install/Default
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
-- 
2.20.1



From karlp at tweak.net.au  Tue Sep  1 09:04:22 2020
From: karlp at tweak.net.au (Karl Palsson)
Date: Tue, 01 Sep 2020 13:04:22 -0000
Subject: [RFC] self-signed certificates for LuCI
In-Reply-To: <271e4185-bdac-ac75-5d56-c29f939c1b7d@aparcar.org>
References: <271e4185-bdac-ac75-5d56-c29f939c1b7d@aparcar.org>
Message-ID: <wRpRXGi6wdcxSoRTA2zNYEktYgkA7cCG4CBS8uGo2425@mailpile>


Paul Spooren <mail at aparcar.org> wrote:
> Hi team,
> 
> I recently rewrote px5g[1] to use WolfSSL instead of MbedTLS,
> as the former will be included in OpenWrt 20.x per default.

Cool, more options for ssl libraries is always good.

> 
> If px5g is added to the next release, certificates are
> generated on first boot and most users are unlikely to manually
> recreate RSA ones, not?

I urge this [luci using self-signed certs by default] to be
reconsidered. Or at the very least, considered at all, not just
happening by default because the ssl library was included for
WPA3.

With this change, the very first thing users see is a browser
warning telling the user very very very bad things about what
they would have to do to continue, and we are simply going to
train users to "just click through the warnings" I see that as a
serious step backwards for security and society as a whole.

Please consider the threat model. "Classic" out of the box
OpenWrt on a consumer LAN router is only offering LuCI to the LAN
already. If you have a hostile LAN, self signed certificates
aren't helping you. If you have a more complex threat model, you
_already_ need something more than these self signed certs can
offer. Even when they're accepted, the browser offers zero
warning if the certs changed, merely the same "this is self
signed" warning again.

Note that even with the self-signed certs, you still receive
warnings in the browser. This is sacrificing usability and user
experience for security theatre and the checkbox marketting of
"TLS out of the box"

Should we have more documentation on how you _could_ setup secure
HTTP access? Sure! But this isn't it.

Sincerely,
Karl Palsson

* Yes, I completely agree, the browser vendors are the root of the problem, but that's harder to solve, and can't be solved here.  TOFU for private lans would be a good start.
* Just because other vendors have gone for that checkbox and are using self-signed certs is in no way support for doing it, merely agreeing that the situation is bad.
* https://openwrt.org/docs/guide-user/luci/getting_rid_of_luci_https_certificate_warnings is a decent start.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP-digital-signature.html
Type: application/pgp-signature
Size: 1175 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200901/0f45fa07/attachment.sig>

From karlp at tweak.net.au  Tue Sep  1 09:57:55 2020
From: karlp at tweak.net.au (Karl Palsson)
Date: Tue, 01 Sep 2020 13:57:55 -0000
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
References: <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
Message-ID: <JsapahaoxwoKuiDyHkV53sSQsJRRKDSMQxtaRzjA2425@mailpile>


Yousong Zhou <yszhou4tech at gmail.com> wrote:
> It's worth mentioning that recent versions of macos since 10.15
> have a restriction on certificate validity period, self-signed
> or not. It's a strong restriction that the browser ui will have
> no buttons or knobs to bypass the certificate validation,
> rendering such sites inaccessible. I remembered it's also a
> system wide enforcement that chrome on macos also respects
> this.
> 
> [1] Requirements for trusted certificates in iOS 13 and macOS
> 10.15, https://support.apple.com/en-us/HT210176
> 
> > TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
> 
> [2] About upcoming limits on trusted certificates,
> https://support.apple.com/en-us/HT211025
> 
> > TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
> 

Are they blocking or planning to block non-http sites? This would
be further arguments that self-signed certs by default for luci
are actively bad.

Latest reference I can find for chromium is that HTTP will be
marked as insecure, but not with the click through horror show of
self signed certs.

https://www.chromium.org/Home/chromium-security/marking-http-as-non-secure

Sincerely,
Karl Palsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP-digital-signature.html
Type: application/pgp-signature
Size: 1175 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200901/6ab33eb3/attachment-0001.sig>

From richb.hanover at gmail.com  Tue Sep  1 10:43:33 2020
From: richb.hanover at gmail.com (Rich Brown)
Date: Tue, 1 Sep 2020 10:43:33 -0400
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <JsapahaoxwoKuiDyHkV53sSQsJRRKDSMQxtaRzjA2425@mailpile>
References: <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
 <JsapahaoxwoKuiDyHkV53sSQsJRRKDSMQxtaRzjA2425@mailpile>
Message-ID: <092E4780-249E-44B2-9CEB-F7E8171D20AE@gmail.com>

Forgive me for chiming in now, for I have not been following the discussion closely.

Is this change (specifically, using these certs for "ordinary operation" of OpenWrt) being considered for the 20.0x release? Would it delay the RC1 release in any way?

If so, I believe we should move it off that critical path, since there's a lot of uncertainty here. (We already have plenty in 20.0x - I worry that adding more tasks/features will push us to 20.1x, or worse.)  If it's not included in 20.0x, we can definitely continue the experiments in snapshot to see whether its benefits are worth the difficulties. Thanks for listening.

Rich

> On Sep 1, 2020, at 9:57 AM, Karl Palsson <karlp at tweak.net.au> wrote:
> 
> 
> Yousong Zhou <yszhou4tech at gmail.com> wrote:
>> It's worth mentioning that recent versions of macos since 10.15
>> have a restriction on certificate validity period, self-signed
>> or not. It's a strong restriction that the browser ui will have
>> no buttons or knobs to bypass the certificate validation,
>> rendering such sites inaccessible. I remembered it's also a
>> system wide enforcement that chrome on macos also respects
>> this.
>> 
>> [1] Requirements for trusted certificates in iOS 13 and macOS
>> 10.15, https://support.apple.com/en-us/HT210176
>> 
>>> TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
>> 
>> [2] About upcoming limits on trusted certificates,
>> https://support.apple.com/en-us/HT211025
>> 
>>> TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
>> 
> 
> Are they blocking or planning to block non-http sites? This would
> be further arguments that self-signed certs by default for luci
> are actively bad.
> 
> Latest reference I can find for chromium is that HTTP will be
> marked as insecure, but not with the click through horror show of
> self signed certs.
> 
> https://www.chromium.org/Home/chromium-security/marking-http-as-non-secure
> 
> Sincerely,
> Karl Palsson_______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From richb.hanover at gmail.com  Tue Sep  1 10:58:08 2020
From: richb.hanover at gmail.com (Rich Brown)
Date: Tue, 1 Sep 2020 10:58:08 -0400
Subject: [RFC] self-signed certificates for LuCI
In-Reply-To: <35E41F3F-B5E9-4ACA-AC53-9CEDB64D8BA4@gmail.com>
References: <271e4185-bdac-ac75-5d56-c29f939c1b7d@aparcar.org>
 <wRpRXGi6wdcxSoRTA2zNYEktYgkA7cCG4CBS8uGo2425@mailpile>
 <35E41F3F-B5E9-4ACA-AC53-9CEDB64D8BA4@gmail.com>
Message-ID: <ADE4158C-9C52-4748-A9B2-92ABB98A6581@gmail.com>

Besides the "project management" concerns expressed in my earlier note, I also share Karl Palsson's worries...

> On Sep 1, 2020, at 9:04 AM, Karl Palsson <karlp at tweak.net.au> wrote:
> 
> With this change, the very first thing users see is a browser
> warning telling the user very very very bad things about what
> they would have to do to continue, and we are simply going to
> train users to "just click through the warnings" I see that as a
> serious step backwards for security and society as a whole.

I see the last sentence as the most important one. Training people to, "Just click through..." without an ounce of preparation (making them check a box/install a cert/etc.) is BAD. 

Sorry for the apolyptic language. But we can hold this off 'til after we release 20.0x to be sure we have all our ducks in a row. Thanks for listening.

Rich




From hannu.nyman at iki.fi  Tue Sep  1 11:13:53 2020
From: hannu.nyman at iki.fi (Hannu Nyman)
Date: Tue, 1 Sep 2020 18:13:53 +0300
Subject: Heads up: Fakeroot package catastrophe has removed most of master
 snapshot package downloads
Message-ID: <eaf64133-043b-ca70-0142-4fcb6bcf8a54@iki.fi>

Heads up, the usage of the new fakeroot package has failed in a major way in 
buildbot, and the phase2 packages buildbot has failed to build any package 
for 1-2 days.

That has caused ALL master snapshot downloadable packages to be removed from 
the download server for most package archs. The download dirs currently 
contain just the empty indices.

That will likely cause a flood of bug reports, forum discussions etc., as no 
casual user can download add-on packages for master until buildbot has 
rebuilt the packages and uploaded them to the server, package arch by arch. 
That will likely take several days until the last arch is done.? I noticed 
this after there were forum complaints away missing LuCI downloads with opkg.


As of now, I am not sure if the problem has been fixed. The most recent 
phase2 builds still show empty download directories. But that is possibly due 
to package builds made with faulty SDKs from the phase1 images buildbot.? 
(And nbd just committed a MacOS fix a few minutes ago, so there are 
apparently effects also for private build envs...)


The havoc has been most likely caused by commit "build: ipkg-build use 
fakeroot with PKG_FILE_MODES"

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=353ce2e521f57318c502c862457dc859d8d181a6;hp=2bd55d0a2b22e5923a433edd9f90be8ea2997bde


Fix attempts were made by

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=5587f19c362a805636da91d9d550928b4a2998fc

and

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=729a75c3b2db0aa25745e8db425711cc761fa1f6

but those have effect in the phase2 packages build only after the build 
happens with the fixed/updated SDK from phase1, which fix is still waiting to 
be built for many targets.


Hopefully things have been fixed, but the rebuild of the packages will really 
take several days, maybe up to a week.



From daniel at makrotopia.org  Tue Sep  1 12:20:38 2020
From: daniel at makrotopia.org (Daniel Golle)
Date: Tue, 1 Sep 2020 17:20:38 +0100
Subject: Heads up: Fakeroot package catastrophe has removed most of
 master snapshot package downloads
In-Reply-To: <eaf64133-043b-ca70-0142-4fcb6bcf8a54@iki.fi>
References: <eaf64133-043b-ca70-0142-4fcb6bcf8a54@iki.fi>
Message-ID: <20200901162038.GH97563@makrotopia.org>

On Tue, Sep 01, 2020 at 06:13:53PM +0300, Hannu Nyman wrote:
> Heads up, the usage of the new fakeroot package has failed in a major way in
> buildbot, and the phase2 packages buildbot has failed to build any package
> for 1-2 days.

Yes, it has been a busy night once I had realized what was going on...

> 
> That has caused ALL master snapshot downloadable packages to be removed from
> the download server for most package archs. The download dirs currently
> contain just the empty indices.
> 
> That will likely cause a flood of bug reports, forum discussions etc., as no
> casual user can download add-on packages for master until buildbot has
> rebuilt the packages and uploaded them to the server, package arch by arch.
> That will likely take several days until the last arch is done.? I noticed
> this after there were forum complaints away missing LuCI downloads with
> opkg.
> 
> 
> As of now, I am not sure if the problem has been fixed. The most recent
> phase2 builds still show empty download directories. But that is possibly
> due to package builds made with faulty SDKs from the phase1 images
> buildbot.? (And nbd just committed a MacOS fix a few minutes ago, so there
> are apparently effects also for private build envs...)
> 
> 
> The havoc has been most likely caused by commit "build: ipkg-build use
> fakeroot with PKG_FILE_MODES"
> 
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=353ce2e521f57318c502c862457dc859d8d181a6;hp=2bd55d0a2b22e5923a433edd9f90be8ea2997bde
> 
> 
> Fix attempts were made by
> 
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=5587f19c362a805636da91d9d550928b4a2998fc
> 
> and
> 
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=729a75c3b2db0aa25745e8db425711cc761fa1f6
> 
> but those have effect in the phase2 packages build only after the build
> happens with the fixed/updated SDK from phase1, which fix is still waiting
> to be built for many targets.

Exactly. First builds with fixed SDK now seem to be ok:
https://buildbot.openwrt.org/master/packages/builders/arm_cortex-a7/builds/250
https://downloads.openwrt.org/snapshots/packages/arm_cortex-a7/base/

> 
> 
> Hopefully things have been fixed, but the rebuild of the packages will
> really take several days, maybe up to a week.

Looks like most phase1 builds have already run through with the fixes
included. Still waiting are archs38/generic, armvirt/64, lantiq/xway,
ramips/mt76x8, sunxi/cortexa7, x86/64 and zynq/generic. I expect them
to run through during the next hours (currently 5 parallel builds, each
run takes roughly 1.5h).

Most importantly, ath79/generic was one of the first to be built again
and mips24kc packages should return with the next phase2 run.
For all phase2 builds to run through it will take a day...


From hauke at hauke-m.de  Tue Sep  1 13:31:56 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Tue, 1 Sep 2020 19:31:56 +0200
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
References: <20200829183321.17675-1-hauke@hauke-m.de>
 <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
Message-ID: <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>

On 9/1/20 12:45 AM, Yousong Zhou wrote:
> It's worth mentioning that recent versions of macos since 10.15 have a
> restriction on certificate validity period, self-signed or not.  It's
> a strong restriction that the browser ui will have no buttons or knobs
> to bypass the certificate validation, rendering such sites
> inaccessible.  I remembered it's also a system wide enforcement that
> chrome on macos also respects this.
> 
> [1] Requirements for trusted certificates in iOS 13 and macOS 10.15,
> https://support.apple.com/en-us/HT210176
> 
>> TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
> 
> [2] About upcoming limits on trusted certificates,
> https://support.apple.com/en-us/HT211025
> 
>> TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
> 
> Regards,
>                yousong

Could someone please test how MacOS and iOS behave with a self signed
certificate, valid for 10 years which was issued no later than today please.

The changes which are applied today on 1. September are only affecting
certificates signed by preinstalled CAs. This information from Apple
does not tell how the system will behave with self signed certificates.
The older changes will reject certificates valid for longer than 825
days (27 months).

Apple also says this:
> TLS server certificates must present the DNS name of the server in the
> Subject Alternative Name extension of the certificate. DNS names in
> the CommonName of a certificate are no longer trusted.
Currently we do not set a "Subject Alternative Name", but we also do not
really know the host name. We could set this to openwrt.lan, the default
hostname.

We will still over normal http, using https is only an addition.

Hauke

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200901/9c4058d2/attachment.sig>

From mail at aparcar.org  Tue Sep  1 15:13:28 2020
From: mail at aparcar.org (Paul Spooren)
Date: Tue,  1 Sep 2020 09:13:28 -1000
Subject: [PATCH v3] dropbear: Enable Ed25519 for normal devices
Message-ID: <20200901191327.2361459-1-mail@aparcar.org>

The Ed25519 key pairs are much shorter than RSA pairs and are supported
by default in OpenSSH. Looking at websites explaining how to create new
SSH keys, many suggest using Ed25519 rather than RSA, however consider
the former as not yet widely established. OpenWrt likely has a positive
influence on that development.

As enabling Ed25519 is a compile time option, it is currently not
possible to install the feature via `opkg` nor select that option in an
ImageBuilder.

Due to the size impact of **12kB** the option should only be enabled for
devices with `!SMALL_FLASH`.

This approach seems cleaner than splitting `dropbear` into two packages
like `dropbear` and `dropbear-ed25519`.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
v3:
  * Add PKG_FLAGS:=nonshared to avoid trouble with legacy `tiny` targets

 package/network/services/dropbear/Config.in | 2 +-
 package/network/services/dropbear/Makefile  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/network/services/dropbear/Config.in b/package/network/services/dropbear/Config.in
index 108b80376b..6aa5a7e4e1 100644
--- a/package/network/services/dropbear/Config.in
+++ b/package/network/services/dropbear/Config.in
@@ -51,7 +51,7 @@ config DROPBEAR_ECC_FULL
 
 config DROPBEAR_ED25519
 	bool "Ed25519 support"
-	default n
+	default y if !SMALL_FLASH
 	help
 		This enables the following public key algorithm:
 		  ssh-ed25519
diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
index 1cda98bf7e..6c97d3e77b 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2016 OpenWrt.org
+# Copyright (C) 2006-2020 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
 PKG_VERSION:=2020.80
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -25,6 +25,7 @@ PKG_BUILD_PARALLEL:=1
 PKG_ASLR_PIE_REGULAR:=1
 PKG_USE_MIPS16:=0
 PKG_FIXUP:=autoreconf
+PKG_FLAGS:=nonshared
 
 PKG_CONFIG_DEPENDS:= \
 	CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
-- 
2.25.1



From mkroken at gmail.com  Tue Sep  1 16:28:25 2020
From: mkroken at gmail.com (Magnus Kroken)
Date: Tue,  1 Sep 2020 22:28:25 +0200
Subject: [PATCH] mbedtls: update to 2.16.8
Message-ID: <20200901202825.31239-1-mkroken@gmail.com>

This release of Mbed TLS provides bug fixes and minor enhancements. This
release includes fixes for security issues and the most notable of them
are described in more detail in the security advisories.

* Local side channel attack on RSA and static Diffie-Hellman
* Local side channel attack on classical CBC decryption in (D)TLS
* When checking X.509 CRLs, a certificate was only considered as revoked
if its revocationDate was in the past according to the local clock if
available.

Full release announcement:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.8

Signed-off-by: Magnus Kroken <mkroken at gmail.com>
---
 package/libs/mbedtls/Makefile                 |  4 +-
 package/libs/mbedtls/patches/200-config.patch | 46 +++++++++----------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile
index 0fa95ee6b5..27f50f8dde 100644
--- a/package/libs/mbedtls/Makefile
+++ b/package/libs/mbedtls/Makefile
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mbedtls
-PKG_VERSION:=2.16.7
+PKG_VERSION:=2.16.8
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)?
-PKG_HASH:=c95b11557ee97d2bdfd48cd57cf9b648a6cddd2ca879e3c35c4e7525f2871992
+PKG_HASH:=fe9e3b15c3375943bdfebbbb20dd6b4f1147b3b5d926248bd835d73247407430
 
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0-or-later
diff --git a/package/libs/mbedtls/patches/200-config.patch b/package/libs/mbedtls/patches/200-config.patch
index 70d178feb8..4cdeed921d 100644
--- a/package/libs/mbedtls/patches/200-config.patch
+++ b/package/libs/mbedtls/patches/200-config.patch
@@ -1,6 +1,6 @@
 --- a/include/mbedtls/config.h
 +++ b/include/mbedtls/config.h
-@@ -658,14 +658,14 @@
+@@ -692,14 +692,14 @@
   *
   * Enable Output Feedback mode (OFB) for symmetric ciphers.
   */
@@ -17,7 +17,7 @@
  
  /**
   * \def MBEDTLS_CIPHER_NULL_CIPHER
-@@ -782,19 +782,19 @@
+@@ -816,19 +816,19 @@
   *
   * Comment macros to disable the curve and functions for it
   */
@@ -46,7 +46,7 @@
  
  /**
   * \def MBEDTLS_ECP_NIST_OPTIM
-@@ -918,7 +918,7 @@
+@@ -952,7 +952,7 @@
   *             See dhm.h for more details.
   *
   */
@@ -55,7 +55,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
-@@ -938,7 +938,7 @@
+@@ -972,7 +972,7 @@
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
   */
@@ -64,7 +64,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
-@@ -963,7 +963,7 @@
+@@ -997,7 +997,7 @@
   *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
   */
@@ -73,7 +73,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
-@@ -1097,7 +1097,7 @@
+@@ -1131,7 +1131,7 @@
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -82,7 +82,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
-@@ -1121,7 +1121,7 @@
+@@ -1155,7 +1155,7 @@
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -91,7 +91,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
-@@ -1225,7 +1225,7 @@
+@@ -1259,7 +1259,7 @@
   * This option is only useful if both MBEDTLS_SHA256_C and
   * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
   */
@@ -100,7 +100,7 @@
  
  /**
   * \def MBEDTLS_ENTROPY_NV_SEED
-@@ -1320,14 +1320,14 @@
+@@ -1354,14 +1354,14 @@
   * Uncomment this macro to disable the use of CRT in RSA.
   *
   */
@@ -117,7 +117,7 @@
  
  /**
   * \def MBEDTLS_SHA256_SMALLER
-@@ -1481,7 +1481,7 @@
+@@ -1515,7 +1515,7 @@
   *          configuration of this extension).
   *
   */
@@ -126,7 +126,7 @@
  
  /**
   * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
-@@ -1656,7 +1656,7 @@
+@@ -1690,7 +1690,7 @@
   *
   * Comment this macro to disable support for SSL session tickets
   */
@@ -135,7 +135,7 @@
  
  /**
   * \def MBEDTLS_SSL_EXPORT_KEYS
-@@ -1686,7 +1686,7 @@
+@@ -1720,7 +1720,7 @@
   *
   * Comment this macro to disable support for truncated HMAC in SSL
   */
@@ -144,7 +144,7 @@
  
  /**
   * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
-@@ -1745,7 +1745,7 @@
+@@ -1779,7 +1779,7 @@
   *
   * Comment this to disable run-time checking and save ROM space
   */
@@ -153,7 +153,7 @@
  
  /**
   * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
-@@ -2075,7 +2075,7 @@
+@@ -2109,7 +2109,7 @@
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
   */
@@ -162,7 +162,7 @@
  
  /**
   * \def MBEDTLS_ARIA_C
-@@ -2141,7 +2141,7 @@
+@@ -2175,7 +2175,7 @@
   * This module enables the AES-CCM ciphersuites, if other requisites are
   * enabled as well.
   */
@@ -171,7 +171,7 @@
  
  /**
   * \def MBEDTLS_CERTS_C
-@@ -2153,7 +2153,7 @@
+@@ -2187,7 +2187,7 @@
   *
   * This module is used for testing (ssl_client/server).
   */
@@ -180,7 +180,7 @@
  
  /**
   * \def MBEDTLS_CHACHA20_C
-@@ -2261,7 +2261,7 @@
+@@ -2295,7 +2295,7 @@
   * \warning   DES is considered a weak cipher and its use constitutes a
   *            security risk. We recommend considering stronger ciphers instead.
   */
@@ -189,7 +189,7 @@
  
  /**
   * \def MBEDTLS_DHM_C
-@@ -2424,7 +2424,7 @@
+@@ -2458,7 +2458,7 @@
   * This module adds support for the Hashed Message Authentication Code
   * (HMAC)-based key derivation function (HKDF).
   */
@@ -198,7 +198,7 @@
  
  /**
   * \def MBEDTLS_HMAC_DRBG_C
-@@ -2734,7 +2734,7 @@
+@@ -2768,7 +2768,7 @@
   *
   * This module enables abstraction of common (libc) functions.
   */
@@ -207,7 +207,7 @@
  
  /**
   * \def MBEDTLS_POLY1305_C
-@@ -2755,7 +2755,7 @@
+@@ -2789,7 +2789,7 @@
   * Caller:  library/md.c
   *
   */
@@ -216,7 +216,7 @@
  
  /**
   * \def MBEDTLS_RSA_C
-@@ -2862,7 +2862,7 @@
+@@ -2896,7 +2896,7 @@
   *
   * Requires: MBEDTLS_CIPHER_C
   */
@@ -225,7 +225,7 @@
  
  /**
   * \def MBEDTLS_SSL_CLI_C
-@@ -2962,7 +2962,7 @@
+@@ -2996,7 +2996,7 @@
   *
   * This module provides run-time version information.
   */
@@ -234,7 +234,7 @@
  
  /**
   * \def MBEDTLS_X509_USE_C
-@@ -3072,7 +3072,7 @@
+@@ -3106,7 +3106,7 @@
   * Module:  library/xtea.c
   * Caller:
   */
-- 
2.20.1



From rosenp at gmail.com  Tue Sep  1 17:45:54 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue,  1 Sep 2020 14:45:54 -0700
Subject: [PATCH] iftop: fix compilation with GCC 10
Message-ID: <20200901214554.85687-1-rosenp@gmail.com>

GCC 10 defaults to fno-common, which demands unique defenitions.

Patch taken from buildroot.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/network/utils/iftop/Makefile          |  2 +-
 .../utils/iftop/patches/010-gcc10.patch       | 57 +++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 package/network/utils/iftop/patches/010-gcc10.patch

diff --git a/package/network/utils/iftop/Makefile b/package/network/utils/iftop/Makefile
index 98fe15c8f5..aa467c2876 100644
--- a/package/network/utils/iftop/Makefile
+++ b/package/network/utils/iftop/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iftop
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git
diff --git a/package/network/utils/iftop/patches/010-gcc10.patch b/package/network/utils/iftop/patches/010-gcc10.patch
new file mode 100644
index 0000000000..7c212d03a8
--- /dev/null
+++ b/package/network/utils/iftop/patches/010-gcc10.patch
@@ -0,0 +1,57 @@
+From 18a9f7732944bfe45023f9dd7528295e7d43e678 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Date: Wed, 12 Aug 2020 22:31:33 +0200
+Subject: [PATCH] ui_common.h: fix build with gcc 10
+
+Define global variables as extern in header to fix the build with gcc 10
+which default to -fno-common: https://gcc.gnu.org/gcc-10/porting_to.html
+
+Fixes:
+ - http://autobuild.buildroot.org/results/55a8581f11e776439782c228441ef1c8c1243386
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+[Upstream status: sent to iftop-users at lists.beasts.org]
+---
+ ui_common.c |  6 ++++++
+ ui_common.h | 10 +++++-----
+ 2 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/ui_common.c b/ui_common.c
+index dcf6646..b1027ec 100644
+--- a/ui_common.c
++++ b/ui_common.c
+@@ -17,6 +17,12 @@
+ 
+ #include "ui_common.h"
+ 
++sorted_list_type screen_list;
++host_pair_line totals;
++int peaksent, peakrecv, peaktotal;
++hash_type* screen_hash;
++hash_type* service_hash;
++
+ /* 2, 10 and 40 seconds */
+ int history_divs[HISTORY_DIVISIONS] = {1, 5, 20};
+ 
+diff --git a/ui_common.h b/ui_common.h
+index 63ae5bb..add72fe 100644
+--- a/ui_common.h
++++ b/ui_common.h
+@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
+ 
+ extern options_t options;
+ 
+-sorted_list_type screen_list;
+-host_pair_line totals;
+-int peaksent, peakrecv, peaktotal;
++extern sorted_list_type screen_list;
++extern host_pair_line totals;
++extern int peaksent, peakrecv, peaktotal;
+ extern history_type history_totals;
+-hash_type* screen_hash;
+-hash_type* service_hash;
++extern hash_type* screen_hash;
++extern hash_type* service_hash;
+ 
+ void analyse_data(void);
+ void screen_list_init(void);
-- 
2.26.2



From rosenp at gmail.com  Tue Sep  1 17:50:08 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue,  1 Sep 2020 14:50:08 -0700
Subject: [PATCH] kexec-tools: update to 2.0.20
Message-ID: <20200901215008.90451-1-rosenp@gmail.com>

kdump was removed in 7acd257ae67b4ca94f8c23cb8bda0ee0709b9216

gdb can be used as an alternative.

Backported patch to fix compilation with GCC10.

Backported several openembedded patches, some of which are upstream
backports.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/boot/kexec-tools/Makefile             | 40 +-------
 .../kexec-tools/patches/010-powerpc.patch     | 35 +++++++
 .../kexec-tools/patches/020-arm-lpae.patch    | 49 +++++++++
 .../boot/kexec-tools/patches/100-gcc10.patch  | 99 +++++++++++++++++++
 ...rela-relocation-R_X86_64_PLT32-error.patch | 14 ---
 .../kexec-tools/patches/110-arm-syscall.patch | 34 +++++++
 .../boot/kexec-tools/patches/120-i386.patch   | 65 ++++++++++++
 7 files changed, 285 insertions(+), 51 deletions(-)
 create mode 100644 package/boot/kexec-tools/patches/010-powerpc.patch
 create mode 100644 package/boot/kexec-tools/patches/020-arm-lpae.patch
 create mode 100644 package/boot/kexec-tools/patches/100-gcc10.patch
 delete mode 100644 package/boot/kexec-tools/patches/100-kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32-error.patch
 create mode 100644 package/boot/kexec-tools/patches/110-arm-syscall.patch
 create mode 100644 package/boot/kexec-tools/patches/120-i386.patch

diff --git a/package/boot/kexec-tools/Makefile b/package/boot/kexec-tools/Makefile
index 269345aa9d..db6dac333e 100644
--- a/package/boot/kexec-tools/Makefile
+++ b/package/boot/kexec-tools/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=kexec-tools
-PKG_VERSION:=2.0.16
-PKG_RELEASE:=2
+PKG_VERSION:=2.0.20
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/kexec
-PKG_HASH:=5b103351ad752c9badd1d65b00eb6de4bce579f944f4df4e3ef3a755ba567010
+PKG_HASH:=dad8077f0315445d1f6335579fc4ade222facf82a67124974c7be5303ba4f8c8
 
 PKG_FIXUP:=autoreconf
 
@@ -51,17 +51,6 @@ define Package/kexec/description
  The kexec utility allows to load and boot another kernel.
 endef
 
-define Package/kdump
-  $(call Package/kexec-tools/Default)
-  TITLE:=Kernel crash analysis
-  DEPENDS:=+kexec @(i386||x86_64||arm) @KERNEL_CRASH_DUMP
-endef
-
-define Package/kdump/description
- The kdump package allows to automatically boot into a
- special kernel for analyzing kernel crashes using kdump.
-endef
-
 define Package/kexec/config
 	source "$(SOURCE)/Config.in"
 endef
@@ -108,28 +97,5 @@ define Package/kexec/install
 	$(LN) ../usr/sbin/kexec $(1)/sbin/kexec
 endef
 
-define Package/kdump/install
-	$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kdump $(PKG_INSTALL_DIR)/usr/sbin/vmcore-dmesg $(1)/usr/sbin
-	$(INSTALL_BIN) ./files/kdump.init $(1)/etc/init.d/kdump
-	$(INSTALL_BIN) ./files/kdump.defaults $(1)/etc/uci-defaults/kdump
-	$(INSTALL_CONF) ./files/kdump.config $(1)/etc/config/kdump
-endef
-
-define Package/kdump/prerm
-#!/bin/sh
-
-case $$(uname -m) in
-	i?86|x86_64)
-		if grep -q " crashkernel=" /boot/grub/grub.cfg; then
-			mount /boot -o remount,rw
-			sed -i 's/ crashkernel=[^ ]*//' /boot/grub/grub.cfg
-			mount /boot -o remount,ro
-		fi
-		;;
-esac
-endef
-
 $(eval $(call BuildPackage,kexec-tools))
 $(eval $(call BuildPackage,kexec))
-$(eval $(call BuildPackage,kdump))
diff --git a/package/boot/kexec-tools/patches/010-powerpc.patch b/package/boot/kexec-tools/patches/010-powerpc.patch
new file mode 100644
index 0000000000..029650f35c
--- /dev/null
+++ b/package/boot/kexec-tools/patches/010-powerpc.patch
@@ -0,0 +1,35 @@
+From 211cae4b6a02a4d9d37bfcd76f3702696e095fc3 Mon Sep 17 00:00:00 2001
+From: Quanyang Wang <quanyang.wang at windriver.com>
+Date: Tue, 16 Jun 2015 12:59:57 +0800
+Subject: [PATCH] powerpc: change the memory size limit
+
+When run "kexec" in powerpc board, the kexec has a limit that
+the kernel text and bss size must be less than 24M. But now
+some kernel size exceed the limit. So we need to change the limit,
+else will get the error log as below:
+
+my_load:669: do
+Could not find a free area of memory of 0x12400 bytes...
+Could not find a free area of memory of 0x13000 bytes...
+locate_hole failed
+
+Upstream-Status: Pending
+
+Signed-off-by: Quanyang Wang <quanyang.wang at windriver.com>
+---
+ kexec/arch/ppc/kexec-ppc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h
+index 04e728e..6bae9ec 100644
+--- a/kexec/arch/ppc/kexec-ppc.h
++++ b/kexec/arch/ppc/kexec-ppc.h
+@@ -44,7 +44,7 @@ void dol_ppc_usage(void);
+  * During inital setup the kernel does not map the whole memory but a part of
+  * it. On Book-E that is 64MiB, 601 24MiB or 256MiB (if possible).
+  */
+-#define KERNEL_ACCESS_TOP (24 * 1024 * 1024)
++#define KERNEL_ACCESS_TOP (36 * 1024 * 1024)
+ 
+ /* boot block version 17 as defined by the linux kernel */
+ struct bootblock {
diff --git a/package/boot/kexec-tools/patches/020-arm-lpae.patch b/package/boot/kexec-tools/patches/020-arm-lpae.patch
new file mode 100644
index 0000000000..832fe67716
--- /dev/null
+++ b/package/boot/kexec-tools/patches/020-arm-lpae.patch
@@ -0,0 +1,49 @@
+From 55e583d20651e829afbbc8dba0f8ec3017cda2d5 Mon Sep 17 00:00:00 2001
+From: Haiqing Bai <Haiqing.Bai at windriver.com>
+Date: Mon, 9 Jan 2017 15:26:29 +0800
+Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue
+
+When "CONFIG_ARM_LPAE" is enabled,3 level page table
+is used by MMU, the "SECTION_SIZE" is defined with
+(1 << 21), but 'add_buffer_phys_virt()' hardcode this
+to (1 << 20).
+
+Upstream-Status: Pending
+
+Suggested-By:fredrik.markstrom at gmail.com
+Signed-off-by: Haiqing Bai <Haiqing.Bai at windriver.com>
+---
+ kexec/arch/arm/crashdump-arm.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
+index daa4788..3f72b38 100644
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 	void *buf;
+ 	int err;
+ 	int last_ranges;
++	unsigned short align_bit_shift = 20;
+ 
+ 	/*
+ 	 * First fetch all the memory (RAM) ranges that we are going to pass to
+@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 
+ 		/* for support LPAE enabled kernel*/
+ 		elf_info.class = ELFCLASS64;
++		align_bit_shift = 21;
+ 
+ 		err = crash_create_elf64_headers(info, &elf_info,
+ 					 usablemem_rgns.ranges,
+@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 	 * 1MB) so that available memory passed in kernel command line will be
+ 	 * aligned to 1MB. This is because kernel create_mapping() wants memory
+ 	 * regions to be aligned to SECTION_SIZE.
++	 * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
+ 	 */
+-	elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
++	elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
+ 					  crash_kernel_mem.start,
+ 					  crash_kernel_mem.end, -1, 0);
+ 
diff --git a/package/boot/kexec-tools/patches/100-gcc10.patch b/package/boot/kexec-tools/patches/100-gcc10.patch
new file mode 100644
index 0000000000..2af315c0fc
--- /dev/null
+++ b/package/boot/kexec-tools/patches/100-gcc10.patch
@@ -0,0 +1,99 @@
+From cc087b11462af9f971a2c090d07e8d780a867b50 Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong at redhat.com>
+Date: Wed, 29 Jan 2020 13:38:19 +0800
+Subject: kexec-tools: Remove duplicated variable declarations
+
+When building kexec-tools for Fedora 32, following error is observed:
+
+/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
+kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
+
+And apparently, these variables are wrongly declared multiple times. So
+remove duplicated declaration.
+
+Signed-off-by: Kairui Song <kasong at redhat.com>
+Signed-off-by: Simon Horman <horms at verge.net.au>
+---
+ kexec/arch/arm64/kexec-arm64.h      | 6 +++---
+ kexec/arch/ppc64/kexec-elf-ppc64.c  | 2 --
+ kexec/arch/x86_64/kexec-bzImage64.c | 1 -
+ kexec/fs2dt.h                       | 2 +-
+ 4 files changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
+index 628de79..ed447ac 100644
+--- a/kexec/arch/arm64/kexec-arm64.h
++++ b/kexec/arch/arm64/kexec-arm64.h
+@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
+ void zImage_arm64_usage(void);
+ 
+ 
+-off_t initrd_base;
+-off_t initrd_size;
++extern off_t initrd_base;
++extern off_t initrd_size;
+ 
+ /**
+  * struct arm64_mem - Memory layout info.
+@@ -65,7 +65,7 @@ struct arm64_mem {
+ };
+ 
+ #define arm64_mem_ngv UINT64_MAX
+-struct arm64_mem arm64_mem;
++extern struct arm64_mem arm64_mem;
+ 
+ uint64_t get_phys_offset(void);
+ uint64_t get_vp_offset(void);
+diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
+index 3510b70..695b8b0 100644
+--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
++++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
+@@ -44,8 +44,6 @@
+ uint64_t initrd_base, initrd_size;
+ unsigned char reuse_initrd = 0;
+ const char *ramdisk;
+-/* Used for enabling printing message from purgatory code */
+-int my_debug = 0;
+ 
+ int elf_ppc64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
+index 8edb3e4..ba8dc48 100644
+--- a/kexec/arch/x86_64/kexec-bzImage64.c
++++ b/kexec/arch/x86_64/kexec-bzImage64.c
+@@ -42,7 +42,6 @@
+ #include <arch/options.h>
+ 
+ static const int probe_debug = 0;
+-int bzImage_support_efi_boot;
+ 
+ int bzImage64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
+index 7633273..fe24931 100644
+--- a/kexec/fs2dt.h
++++ b/kexec/fs2dt.h
+@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
+ 
+ /* Used for enabling printing message from purgatory code
+  * Only has implemented for PPC64 */
+-int my_debug;
++extern int my_debug;
+ extern int dt_no_old_root;
+ 
+ void reserve(unsigned long long where, unsigned long long length);
+-- 
+cgit 1.2.3-1.el7
+
diff --git a/package/boot/kexec-tools/patches/100-kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32-error.patch b/package/boot/kexec-tools/patches/100-kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32-error.patch
deleted file mode 100644
index dfad21992b..0000000000
--- a/package/boot/kexec-tools/patches/100-kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32-error.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-index 7fdde73..af33689 100644
---- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-@@ -78,7 +78,8 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
- 		if ((int64_t)value != *(int32_t *)location)
- 			goto overflow;
- 		break;
--	case R_X86_64_PC32: 
-+	case R_X86_64_PC32:
-+	case R_X86_64_PLT32:
- 		*(uint32_t *)location = value - address;
- 		break;
- 	default:
diff --git a/package/boot/kexec-tools/patches/110-arm-syscall.patch b/package/boot/kexec-tools/patches/110-arm-syscall.patch
new file mode 100644
index 0000000000..9e91fd99f4
--- /dev/null
+++ b/package/boot/kexec-tools/patches/110-arm-syscall.patch
@@ -0,0 +1,34 @@
+From b54816eff272324320c490d62dc36b27d2838732 Mon Sep 17 00:00:00 2001
+From: Quanyang Wang <quanyang.wang at windriver.com>
+Date: Mon, 16 Sep 2019 10:49:05 +0800
+Subject: kexec/arm: undefine __NR_kexec_file_load for arm
+
+In the kernel upstream commit 4ab65ba7a5cb
+("ARM: add kexec_file_load system call number"),
+__NR_kexec_file_load for arm has been defined to be 401.
+This results that even if kexec_file_load isn't implemented
+for arm but the function is_kexec_file_load_implemented()
+will still return true. So undef __NR_kexec_file_load for
+arm architecture.
+
+Signed-off-by: Quanyang Wang <quanyang.wang at windriver.com>
+Signed-off-by: Simon Horman <horms at verge.net.au>
+---
+ kexec/kexec-syscall.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
+index dac1c1f..92d51d3 100644
+--- a/kexec/kexec-syscall.h
++++ b/kexec/kexec-syscall.h
+@@ -56,6 +56,10 @@
+ #endif
+ #endif /*ifndef __NR_kexec_load*/
+ 
++#ifdef __arm__
++#undef __NR_kexec_file_load
++#endif
++
+ #ifndef __NR_kexec_file_load
+ 
+ #ifdef __x86_64__
diff --git a/package/boot/kexec-tools/patches/120-i386.patch b/package/boot/kexec-tools/patches/120-i386.patch
new file mode 100644
index 0000000000..8251e9a58b
--- /dev/null
+++ b/package/boot/kexec-tools/patches/120-i386.patch
@@ -0,0 +1,65 @@
+From 2c9f26ed20a791a7df0182ba82e93abb52f5a615 Mon Sep 17 00:00:00 2001
+From: Chris Packham <chris.packham at alliedtelesis.co.nz>
+Date: Mon, 18 Nov 2019 12:52:15 +1300
+Subject: kexec: build multiboot2 for i386
+
+This addresses the following compilation issues when building for i386.
+
+ kexec/arch/i386/kexec-x86.c:39:22: error: 'multiboot2_x86_probe' undeclared here (not in a function); did you mean 'multiboot_x86_probe'?
+   { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
+                       ^~~~~~~~~~~~~~~~~~~~
+                       multiboot_x86_probe
+ kexec/arch/i386/kexec-x86.c:39:44: error: 'multiboot2_x86_load' undeclared here (not in a function); did you mean 'multiboot_x86_load'?
+   { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
+                                             ^~~~~~~~~~~~~~~~~~~
+                                             multiboot_x86_load
+ kexec/arch/i386/kexec-x86.c:40:4: error: 'multiboot2_x86_usage' undeclared here (not in a function); did you mean 'multiboot_x86_usage'?
+     multiboot2_x86_usage },
+     ^~~~~~~~~~~~~~~~~~~~
+     multiboot_x86_usage
+ make: *** [Makefile:114: kexec/arch/i386/kexec-x86.o] Error 1
+ make: *** Waiting for unfinished jobs....
+
+Signed-off-by: Chris Packham <chris.packham at alliedtelesis.co.nz>
+Signed-off-by: Simon Horman <horms at verge.net.au>
+---
+ kexec/arch/i386/Makefile    | 2 +-
+ kexec/arch/i386/kexec-x86.h | 5 +++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/i386/Makefile b/kexec/arch/i386/Makefile
+index 105cefd..f486103 100644
+--- a/kexec/arch/i386/Makefile
++++ b/kexec/arch/i386/Makefile
+@@ -7,6 +7,7 @@ i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-rel-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-bzImage.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-multiboot-x86.c
++i386_KEXEC_SRCS += kexec/arch/i386/kexec-mb2-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-beoboot-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-nbi.c
+ i386_KEXEC_SRCS += kexec/arch/i386/x86-linux-setup.c
+@@ -14,7 +15,6 @@ i386_KEXEC_SRCS += kexec/arch/i386/crashdump-x86.c
+ 
+ dist += kexec/arch/i386/Makefile $(i386_KEXEC_SRCS)			\
+ 	kexec/arch/i386/crashdump-x86.h					\
+-	kexec/arch/i386/kexec-mb2-x86.c					\
+ 	kexec/arch/i386/kexec-x86.h					\
+ 	kexec/arch/i386/x86-linux-setup.h				\
+ 	kexec/arch/i386/include/arch/options.h
+diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
+index 1b58c3b..0f941df 100644
+--- a/kexec/arch/i386/kexec-x86.h
++++ b/kexec/arch/i386/kexec-x86.h
+@@ -60,6 +60,11 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
+ 	struct kexec_info *info);
+ void multiboot_x86_usage(void);
+ 
++int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len,
++			struct kexec_info *info);
++void multiboot2_x86_usage(void);
++int multiboot2_x86_probe(const char *buf, off_t buf_len);
++
+ int elf_x86_probe(const char *buf, off_t len);
+ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
+ 	struct kexec_info *info);
-- 
2.26.2



From rosenp at gmail.com  Tue Sep  1 17:50:15 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue,  1 Sep 2020 14:50:15 -0700
Subject: [PATCH] ppp: fix compilation with musl 1.2.0
Message-ID: <20200901215015.91441-1-rosenp@gmail.com>

As sys/cdefs.h is no longer available, a __P definition is needed.

Fixes compilation with rp-pppoe-server.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/network/services/ppp/Makefile              |  2 +-
 package/network/services/ppp/patches/610-__P.patch | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 package/network/services/ppp/patches/610-__P.patch

diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile
index de73fdbe00..f28510421b 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ppp
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
diff --git a/package/network/services/ppp/patches/610-__P.patch b/package/network/services/ppp/patches/610-__P.patch
new file mode 100644
index 0000000000..61056b75a7
--- /dev/null
+++ b/package/network/services/ppp/patches/610-__P.patch
@@ -0,0 +1,14 @@
+--- a/pppd/pppd.h
++++ b/pppd/pppd.h
+@@ -61,9 +61,11 @@
+ 
+ #if defined(__STDC__)
+ #include <stdarg.h>
++#define __P(x)	x
+ #define __V(x)	x
+ #else
+ #include <varargs.h>
++#define __P(x)	()
+ #define __V(x)	(va_alist) va_dcl
+ #define const
+ #define volatile
-- 
2.26.2



From rosenp at gmail.com  Tue Sep  1 17:50:26 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue,  1 Sep 2020 14:50:26 -0700
Subject: [PATCH] trace-cmd: update to 2.9
Message-ID: <20200901215026.92841-1-rosenp@gmail.com>

Fixes compilation with GCC 10.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/devel/trace-cmd/Makefile              | 25 +++++++++++--------
 .../patches/110-mac80211_tracepoint.patch     | 10 ++++----
 .../devel/trace-cmd/patches/120-limits.patch  | 24 ------------------
 .../devel/trace-cmd/patches/120-pthread.patch | 11 ++++++++
 .../trace-cmd/patches/130-byteswap.patch      | 11 ++++++++
 5 files changed, 41 insertions(+), 40 deletions(-)
 delete mode 100644 package/devel/trace-cmd/patches/120-limits.patch
 create mode 100644 package/devel/trace-cmd/patches/120-pthread.patch
 create mode 100644 package/devel/trace-cmd/patches/130-byteswap.patch

diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile
index 25831d8b1b..31ffdb1edf 100644
--- a/package/devel/trace-cmd/Makefile
+++ b/package/devel/trace-cmd/Makefile
@@ -1,16 +1,18 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=trace-cmd
-PKG_VERSION:=v2.6.1
-PKG_RELEASE:=2
+PKG_VERSION:=v2.9
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/
-PKG_HASH:=4eb79001778a77c0ada10265e7f4b5515a3e21a46f0a15c2e8cc614efdf3f5df
+PKG_HASH:=53d1d1d6d67ae972086868293e98c61f133bbdc064b8d9d6aebcdcc7d1a5cc6d
+
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
 PKG_INSTALL:=1
 PKG_USE_MIPS16:=0
-PKG_LICENSE:=GPL-2.0
-
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -30,30 +32,31 @@ define Package/trace-cmd-extra
 endef
 
 MAKE_FLAGS += \
+	NO_AUDIT=1 \
 	NO_PYTHON=1 \
 	prefix=/usr
 
-PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins
+PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/traceevent/plugins
 PLUGINS_MAIN := function hrtimer mac80211 sched_switch
 
-TARGET_CFLAGS += --std=gnu99 -D_GNU_SOURCE
+TARGET_CFLAGS += --std=gnu99 -D_GNU_SOURCE $(if $(CONFIG_USE_MUSL),-Dpthread_attr_setaffinity_np=pthread_setaffinity_np)
 
 define Package/trace-cmd/install
-	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/trace-cmd/plugins
+	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/traceevent/plugins
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trace-cmd $(1)/usr/bin/
 	$(CP) \
 		$(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_MAIN)) \
-		$(1)/usr/lib/trace-cmd/plugins
+		$(1)/usr/lib/traceevent/plugins
 endef
 
 define Package/trace-cmd-extra/install
-	$(INSTALL_DIR) $(1)/usr/lib/trace-cmd/plugins
+	$(INSTALL_DIR) $(1)/usr/lib/traceevent/plugins
 	$(CP) \
 		$$(patsubst %,$(PLUGINS_DIR)/plugin_%.so, \
 			$$(filter-out $(PLUGINS_MAIN), \
 				$$(patsubst $(PLUGINS_DIR)/plugin_%.so,%, \
 					$$(wildcard $(PLUGINS_DIR)/plugin_*.so)))) \
-		$(1)/usr/lib/trace-cmd/plugins
+		$(1)/usr/lib/traceevent/plugins
 endef
 
 $(eval $(call BuildPackage,trace-cmd))
diff --git a/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch b/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch
index e2a68972a3..7ad380c96b 100644
--- a/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch
+++ b/package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch
@@ -1,16 +1,16 @@
---- a/plugin_mac80211.c
-+++ b/plugin_mac80211.c
-@@ -179,12 +179,15 @@ static int drv_config(struct trace_seq *
+--- a/lib/traceevent/plugins/plugin_mac80211.c
++++ b/lib/traceevent/plugins/plugin_mac80211.c
+@@ -165,12 +165,15 @@ static int drv_config(struct trace_seq *s, struct tep_record *record,
  		{ 2, "IDLE" },
  		{ 3, "QOS"},
  	);
--	pevent_print_num_field(s, " chan:%d/", event, "center_freq", record, 1);
+-	tep_print_num_field(s, " chan:%d/", event, "center_freq", record, 1);
 -	print_enum(s, event, "channel_type", data,
 -		{ 0, "noht" },
 -		{ 1, "ht20" },
 -		{ 2, "ht40-" },
 -		{ 3, "ht40+" });
-+	pevent_print_num_field(s, " chan:%d@", event, "control_freq", record, 1);
++	tep_print_num_field(s, " chan:%d@", event, "control_freq", record, 1);
 +	print_enum(s, event, "chan_width", data,
 +		{ 0, "20_noht" },
 +		{ 1, "20" },
diff --git a/package/devel/trace-cmd/patches/120-limits.patch b/package/devel/trace-cmd/patches/120-limits.patch
deleted file mode 100644
index b9d91cc03e..0000000000
--- a/package/devel/trace-cmd/patches/120-limits.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 293ff6d5bc9d3b8bfbc3c57d20d3d2d00986c168 Mon Sep 17 00:00:00 2001
-From: Alexander Couzens <lynxis at fe80.eu>
-Date: Sun, 26 Nov 2017 05:22:51 +0100
-Subject: [PATCH] trace-cmd listen: Include limits.h to define PATH_MAX
-
-PATH_MAX is defined by limits.h. On some system it's also
-defined by dirent.h but not on musl.
-
-Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
-Signed-off-by: Steven Rostedt (VMware) <rostedt at goodmis.org>
----
- trace-listen.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/trace-listen.c
-+++ b/trace-listen.c
-@@ -23,6 +23,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <getopt.h>
-+#include <limits.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/wait.h>
diff --git a/package/devel/trace-cmd/patches/120-pthread.patch b/package/devel/trace-cmd/patches/120-pthread.patch
new file mode 100644
index 0000000000..e3c61c643f
--- /dev/null
+++ b/package/devel/trace-cmd/patches/120-pthread.patch
@@ -0,0 +1,11 @@
+--- a/include/trace-cmd/trace-cmd.h
++++ b/include/trace-cmd/trace-cmd.h
+@@ -6,6 +6,8 @@
+ #ifndef _TRACE_CMD_H
+ #define _TRACE_CMD_H
+ 
++#include <pthread.h>
++
+ #include "traceevent/event-parse.h"
+ 
+ #define TRACECMD_MAGIC { 23, 8, 68 }
diff --git a/package/devel/trace-cmd/patches/130-byteswap.patch b/package/devel/trace-cmd/patches/130-byteswap.patch
new file mode 100644
index 0000000000..892a11e17e
--- /dev/null
+++ b/package/devel/trace-cmd/patches/130-byteswap.patch
@@ -0,0 +1,11 @@
+--- a/lib/trace-cmd/include/trace-cmd-local.h
++++ b/lib/trace-cmd/include/trace-cmd-local.h
+@@ -6,6 +6,8 @@
+ #ifndef _TRACE_CMD_LOCAL_H
+ #define _TRACE_CMD_LOCAL_H
+ 
++#include <byteswap.h>
++
+ /* Can be overridden */
+ void warning(const char *fmt, ...);
+ 
-- 
2.26.2



From rosenp at gmail.com  Tue Sep  1 18:37:03 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue,  1 Sep 2020 15:37:03 -0700
Subject: [PATCH] util-linux: fix build when libmagic is present
Message-ID: <20200901223703.785743-1-rosenp@gmail.com>

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/utils/util-linux/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
index 0fc9819c58..05ceaa413e 100644
--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=util-linux
 PKG_VERSION:=2.36
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
@@ -526,6 +526,7 @@ CONFIGURE_ARGS += \
 	--without-python		\
 	--without-udev			\
 	--without-readline		\
+	--without-libmagic		\
 	--with-ncursesw
 
 TARGET_CFLAGS += $(FPIC) -std=gnu99
-- 
2.26.2



From stijn at linux-ipv6.be  Tue Sep  1 19:14:33 2020
From: stijn at linux-ipv6.be (Stijn Tintel)
Date: Wed,  2 Sep 2020 02:14:33 +0300
Subject: [PATCH] ath10k-ct: update to version 2018-08-25
Message-ID: <20200901231433.414585-1-stijn@linux-ipv6.be>

And since we are using mac80211 5.8, let's also switch the ath10k-ct
driver to the new 5.8 version.

Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 package/kernel/ath10k-ct/Makefile                      | 10 +++++-----
 .../164-ath10k-commit-rates-from-mac80211.patch        |  6 +++---
 ...GPIO-controlling-support-for-various-chipsets.patch |  6 +++---
 .../202-ath10k-use-tpt-trigger-by-default.patch        |  2 +-
 .../205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch  |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
index 76077ec156..ad80c75eaf 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -8,14 +8,14 @@ PKG_LICENSE_FILES:=
 
 PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2020-06-30
-PKG_SOURCE_VERSION:=edfbf9161ab75e4831981284ab2d5b1b9fb6ef72
-PKG_MIRROR_HASH:=98b7f88baea7314144fa8f8d141ad0dbbf2816f9606b0a89afb396761b558d14
+PKG_SOURCE_DATE:=2020-08-25
+PKG_SOURCE_VERSION:=13319ff0b5dc3c86e8313f49fca583b829878736
+PKG_MIRROR_HASH:=4a082f9c5ee26fea1eb2f86382b9db4aecec268c918f43e9a0729a0433e262da
 
-# Build the 5.4 ath10k-ct driver version.  Other option is "-4.19".
+# Build ath10k-ct driver version 5.8. Other options are "-4.19", "-5.4", "-5.7".
 # Probably this should match as closely as
 # possible to whatever mac80211 backports version is being used.
-CT_KVER="-5.4"
+CT_KVER="-5.8"
 
 PKG_MAINTAINER:=Ben Greear <greearb at candelatech.com>
 PKG_BUILD_PARALLEL:=1
diff --git a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
index 4e88c8a19f..b913bbdc82 100644
--- a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
+++ b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
@@ -11,7 +11,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
 
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -6793,6 +6793,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6796,6 +6796,7 @@ static void ath10k_bss_info_changed(stru
  			   "mac vdev %d mcast_rate %x\n",
  			   arvif->vdev_id, rate);
  
@@ -19,7 +19,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->mcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6801,6 +6802,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6804,6 +6805,7 @@ static void ath10k_bss_info_changed(stru
  				    "failed to set mcast rate on vdev %i: %d\n",
  				    arvif->vdev_id,  ret);
  
@@ -27,7 +27,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->bcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6827,6 +6829,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6830,6 +6832,7 @@ static void ath10k_bss_info_changed(stru
  			return;
  		}
  
diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
index 15343abd5f..5291732f25 100644
--- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
+++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
@@ -396,7 +396,7 @@ v13:
  /* Rates */
 --- a/ath10k-5.4/wmi-ops.h
 +++ b/ath10k-5.4/wmi-ops.h
-@@ -218,7 +218,10 @@ struct wmi_ops {
+@@ -219,7 +219,10 @@ struct wmi_ops {
  	struct sk_buff *(*gen_bb_timing)
  			(struct ath10k *ar,
  			 const struct wmi_bb_timing_cfg_arg *arg);
@@ -407,7 +407,7 @@ v13:
  };
  
  int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
-@@ -1105,6 +1108,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
+@@ -1115,6 +1118,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
  }
  
@@ -445,7 +445,7 @@ v13:
  {
 --- a/ath10k-5.4/wmi-tlv.c
 +++ b/ath10k-5.4/wmi-tlv.c
-@@ -4367,6 +4367,8 @@ static const struct wmi_ops wmi_tlv_ops
+@@ -4382,6 +4382,8 @@ static const struct wmi_ops wmi_tlv_ops
  	.gen_echo = ath10k_wmi_tlv_op_gen_echo,
  	.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
  	.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
index dd35e2937c..838158c7e0 100644
--- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
+++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
@@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin <dev at kresin.me>
  	if (ret)
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -10383,7 +10383,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10386,7 +10386,7 @@ int ath10k_mac_register(struct ath10k *a
  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
  
  #ifdef CPTCFG_MAC80211_LEDS
diff --git a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
index 33d69e7975..09dd13e9a4 100644
--- a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
+++ b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
@@ -1,6 +1,6 @@
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -10182,6 +10182,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10185,6 +10185,7 @@ int ath10k_mac_register(struct ath10k *a
  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
  	wiphy_ext_feature_set(ar->hw->wiphy,
  			      NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-- 
2.26.2



From mail at aparcar.org  Tue Sep  1 20:32:45 2020
From: mail at aparcar.org (Paul Spooren)
Date: Tue,  1 Sep 2020 14:32:45 -1000
Subject: [PATCH] config: add KERNEL_LSM symbol
Message-ID: <20200902003245.3315830-1-mail@aparcar.org>

The LSM (Linux security mechanism) list is the successor of the now
legacy *major LSM*. Instead of defining a single security mechanism the
LSM symbol is a comma separated list of mechanisms to load.

Until recently OpenWrt would only support DAC (Unix discretionary access
controls) which don't require an additional entry in the LSM list. With
the newly introduced SELinux support the LSM needs to be extended else
only a manual modified Kernel cmdline (`security=selinux`) would
activate SELinux.

As the default OpenWrt Kernel config sets DAC as default security
mechanism, SELinux is stripped from the LSM list, even if
`KERNEL_DEFAULT_SECURITY_SELINUX` is activated. To allow SELinux without
a modified cmdline this commit sets a specific LSM list if
`KERNEL_SECURITY_SELINUX` is enabled.

The upstream Kconfig adds even more mechanisms
(smack,selinux,tomoyo,apparmor), but until they're ported to OpenWrt,
these can be ignored.

To compile SELinux Kernel support but disable it from loading, the
already present options `KERNEL_SECURITY_SELINUX_DISABLE` or
`KERNEL_SECURITY_SELINUX_BOOTPARAM` (with custom cmdline `selinux=0`)
can be used. Further it's possible to edit `/etc/selinux/config`.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 config/Config-kernel.in | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 4eaaa4afae..1f677fd1f5 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -1133,18 +1133,10 @@ config KERNEL_SECURITY_SELINUX_DEVELOP
 	bool "NSA SELinux Development Support"
 	depends on KERNEL_SECURITY_SELINUX
 
-choice
-	prompt "First legacy 'major LSM' to be initialized"
+config KERNEL_LSM
+	string
+	default "lockdown,yama,loadpin,safesetid,integrity,selinux"
 	depends on KERNEL_SECURITY_SELINUX
-	default KERNEL_DEFAULT_SECURITY_SELINUX
-
-	config KERNEL_DEFAULT_SECURITY_SELINUX
-		bool "SELinux"
-
-	config KERNEL_DEFAULT_SECURITY_DAC
-		bool "Unix Discretionary Access Controls"
-
-endchoice
 
 config KERNEL_EXT4_FS_SECURITY
 	bool "Ext4 Security Labels"
-- 
2.25.1



From gch981213 at gmail.com  Wed Sep  2 02:22:28 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Wed,  2 Sep 2020 14:22:28 +0800
Subject: [PATCH 0/3] ramips: fix OKLI lzma-loader
Message-ID: <20200902062231.2238353-1-gch981213@gmail.com>

OKLI mode of our lzma-loader in ramips still contains
left-over bits from ar71xx and isn't used before.
This patchset fixes it so that it can be used in
future devices.
(e.g. https://github.com/openwrt/openwrt/pull/2645)

Chuanhong Guo (3):
  ramips: lzma-loader: make FLASH_START configurable
  ramips: image: add recipe for OKLI loader
  ramips: image: example usage of OKLI loader

 target/linux/ramips/image/Makefile            | 28 ++++++++++++++++++-
 .../linux/ramips/image/lzma-loader/Makefile   |  2 ++
 .../ramips/image/lzma-loader/src/Makefile     |  5 ++++
 .../ramips/image/lzma-loader/src/loader.c     |  5 +---
 target/linux/ramips/image/mt7620.mk           |  1 +
 target/linux/ramips/image/mt7621.mk           |  2 +-
 6 files changed, 37 insertions(+), 6 deletions(-)

-- 
2.26.2



From gch981213 at gmail.com  Wed Sep  2 02:22:29 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Wed,  2 Sep 2020 14:22:29 +0800
Subject: [PATCH 1/3] ramips: lzma-loader: make FLASH_START configurable
In-Reply-To: <20200902062231.2238353-1-gch981213@gmail.com>
References: <20200902062231.2238353-1-gch981213@gmail.com>
Message-ID: <20200902062231.2238353-2-gch981213@gmail.com>

FLASH_START is supposed to point at the memory area where NOR flash are
mapped. We currently have an incorrect FLASH_START copied from ar71xx
back then and the loader doesn't work under OKLI mode.
On ramips, mt7621 has it's flash mapped to 0x1fc00000 and other SoCs
uses 0x1c000000. This commit makes FLASH_START a configurable value to
handle both cases.

Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
---
 target/linux/ramips/image/lzma-loader/Makefile     | 2 ++
 target/linux/ramips/image/lzma-loader/src/Makefile | 5 +++++
 target/linux/ramips/image/lzma-loader/src/loader.c | 5 +----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/image/lzma-loader/Makefile b/target/linux/ramips/image/lzma-loader/Makefile
index f22151c9d7..4cf700d8c6 100644
--- a/target/linux/ramips/image/lzma-loader/Makefile
+++ b/target/linux/ramips/image/lzma-loader/Makefile
@@ -13,6 +13,7 @@ LOADER		:= loader.bin
 LOADER_NAME	:= $(basename $(notdir $(LOADER)))
 LOADER_DATA 	:=
 TARGET_DIR	:=
+FLASH_START	:=
 FLASH_OFFS	:=
 FLASH_MAX	:=
 BOARD		:=
@@ -40,6 +41,7 @@ loader-compile: $(PKG_BUILD_DIR)/.prepared
 	$(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
 		LZMA_TEXT_START=$(LZMA_TEXT_START) \
 		LOADER_DATA=$(LOADER_DATA) \
+		FLASH_START=$(FLASH_START) \
 		FLASH_OFFS=$(FLASH_OFFS) \
 		FLASH_MAX=$(FLASH_MAX) \
 		BOARD="$(BOARD)" \
diff --git a/target/linux/ramips/image/lzma-loader/src/Makefile b/target/linux/ramips/image/lzma-loader/src/Makefile
index d20cd77346..97fd6dad47 100644
--- a/target/linux/ramips/image/lzma-loader/src/Makefile
+++ b/target/linux/ramips/image/lzma-loader/src/Makefile
@@ -19,6 +19,7 @@ LOADADDR	:=
 LZMA_TEXT_START	:= 0x80a00000
 LOADER_DATA	:=
 BOARD		:=
+FLASH_START	:=
 FLASH_OFFS	:=
 FLASH_MAX	:=
 PLATFORM	:=
@@ -64,6 +65,10 @@ ifneq ($(strip $(KERNEL_CMDLINE)),)
 CFLAGS		+= -DCONFIG_KERNEL_CMDLINE='"$(KERNEL_CMDLINE)"'
 endif
 
+ifneq ($(strip $(FLASH_START)),)
+CFLAGS		+= -DCONFIG_FLASH_START=$(FLASH_START)
+endif
+
 ifneq ($(strip $(FLASH_OFFS)),)
 CFLAGS		+= -DCONFIG_FLASH_OFFS=$(FLASH_OFFS)
 endif
diff --git a/target/linux/ramips/image/lzma-loader/src/loader.c b/target/linux/ramips/image/lzma-loader/src/loader.c
index c73b60b351..a3513eccf1 100644
--- a/target/linux/ramips/image/lzma-loader/src/loader.c
+++ b/target/linux/ramips/image/lzma-loader/src/loader.c
@@ -28,9 +28,6 @@
 #include "printf.h"
 #include "LzmaDecode.h"
 
-#define AR71XX_FLASH_START	0x1f000000
-#define AR71XX_FLASH_END	0x1fe00000
-
 #define KSEG0			0x80000000
 #define KSEG1			0xa0000000
 
@@ -178,7 +175,7 @@ static void lzma_init_data(void)
 	unsigned long kernel_ofs;
 	unsigned long kernel_size;
 
-	flash_base = (unsigned char *) KSEG1ADDR(AR71XX_FLASH_START);
+	flash_base = (unsigned char *) KSEG1ADDR(CONFIG_FLASH_START);
 
 	printf("Looking for OpenWrt image... ");
 
-- 
2.26.2



From gch981213 at gmail.com  Wed Sep  2 02:22:30 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Wed,  2 Sep 2020 14:22:30 +0800
Subject: [PATCH 2/3] ramips: image: add recipe for OKLI loader
In-Reply-To: <20200902062231.2238353-1-gch981213@gmail.com>
References: <20200902062231.2238353-1-gch981213@gmail.com>
Message-ID: <20200902062231.2238353-3-gch981213@gmail.com>

Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
---
 target/linux/ramips/image/Makefile | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index f5166f8ae1..10e9edd3bb 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
-DEVICE_VARS += LOADER_TYPE
+DEVICE_VARS += LOADER_TYPE LOADER_FLASH_OFFS
 DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
 DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
@@ -21,8 +21,12 @@ loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
 ldrplatform-y := ralink
 ldrplatform-$(CONFIG_TARGET_ramips_mt7621) := mt7621
 
+ldrflashstart-y := 0x1c000000
+ldrflashstart-$(CONFIG_TARGET_ramips_mt7621) := 0x1fc00000
+
 KERNEL_LOADADDR := $(loadaddr-y)
 LOADER_PLATFORM := $(ldrplatform-y)
+LOADER_FLASH_START := $(ldrflashstart-y)
 
 KERNEL_DTB = kernel-bin | append-dtb | lzma
 
@@ -74,6 +78,18 @@ define Build/loader-kernel
 	$(call Build/loader-common,LOADER_DATA="$@")
 endef
 
+define Build/loader-okli-compile
+	$(call Build/loader-common, \
+		FLASH_START=$(LOADER_FLASH_START) \
+		FLASH_OFFS=$(LOADER_FLASH_OFFS) \
+		FLASH_MAX=0 \
+	)
+endef
+
+define Build/append-loader-okli
+	cat "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" >> "$@"
+endef
+
 # combine kernel and rootfs into one image
 # mkdlinkfw <type> <optional extra arguments to mkdlinkfw binary>
 define Build/mkdlinkfw
-- 
2.26.2



From gch981213 at gmail.com  Wed Sep  2 02:22:31 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Wed,  2 Sep 2020 14:22:31 +0800
Subject: [PATCH 3/3] ramips: image: example usage of OKLI loader
In-Reply-To: <20200902062231.2238353-1-gch981213@gmail.com>
References: <20200902062231.2238353-1-gch981213@gmail.com>
Message-ID: <20200902062231.2238353-4-gch981213@gmail.com>

This is an example of using OKLI loader and will not be part of final
commits.
First uImage header covers loader + kernel so that the original firmware
mtdsplit can be used.
---
 target/linux/ramips/image/Makefile  | 10 ++++++++++
 target/linux/ramips/image/mt7620.mk |  1 +
 target/linux/ramips/image/mt7621.mk |  2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 10e9edd3bb..b985882897 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -224,6 +224,16 @@ define Device/uimage-lzma-loader
   KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
 endef
 
+define Device/uimage-okli-loader
+  LOADER_TYPE := bin
+  LOADER_FLASH_OFFS := 0x51000
+  COMPILE := loader-$(1).bin
+  COMPILE/loader-$(1).bin := loader-okli-compile
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
+  IMAGE/sysupgrade.bin := append-loader-okli $(1) | pad-to 16k | lzma | pad-to 4032 | append-kernel | uImage lzma | append-rootfs | pad-rootfs | append-metadata | check-size
+endef
+
 include $(SUBTARGET).mk
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 0cfaa95cf0..fa8c303903 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -599,6 +599,7 @@ endef
 TARGET_DEVICES += lb-link_bl-w1200
 
 define Device/lenovo_newifi-y1
+  $(Device/uimage-okli-loader)
   SOC := mt7620a
   IMAGE_SIZE := 16064k
   DEVICE_VENDOR := Lenovo
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index d2d41be269..a15d7e25af 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -614,7 +614,7 @@ TARGET_DEVICES += jcg_jhr-ac876m
 
 define Device/lenovo_newifi-d1
   $(Device/dsa-migration)
-  $(Device/uimage-lzma-loader)
+  $(Device/uimage-okli-loader)
   IMAGE_SIZE := 32448k
   DEVICE_VENDOR := Newifi
   DEVICE_MODEL := D1
-- 
2.26.2



From sander at svanheule.net  Wed Sep  2 05:36:19 2020
From: sander at svanheule.net (Sander Vanheule)
Date: Wed, 02 Sep 2020 11:36:19 +0200
Subject: [PATCH] ath10k-ct: update to version 2018-08-25
In-Reply-To: <20200901231433.414585-1-stijn@linux-ipv6.be>
References: <20200901231433.414585-1-stijn@linux-ipv6.be>
Message-ID: <0916f2da92434628c8ed645774cd456ace65b139.camel@svanheule.net>

On Wed, 2020-09-02 at 02:14 +0300, Stijn Tintel wrote:
> And since we are using mac80211 5.8, let's also switch the ath10k-ct
> driver to the new 5.8 version.
> 
> Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>

Built and run-tested on ath79 (TP-Link EAP245 v3: qca9563+qca9982)

Tested-by: Sander Vanheule <sander at svanheule.net>



From yszhou4tech at gmail.com  Wed Sep  2 06:05:46 2020
From: yszhou4tech at gmail.com (Yousong Zhou)
Date: Wed, 2 Sep 2020 18:05:46 +0800
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>
References: <20200829183321.17675-1-hauke@hauke-m.de>
 <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
 <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>
Message-ID: <CAECwjAgnNH2qYUofuZ9XE1+JAhvAH+26m6hsK+Eoj_C60Mcfsw@mail.gmail.com>

On Wed, 2 Sep 2020 at 01:32, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> On 9/1/20 12:45 AM, Yousong Zhou wrote:
> > It's worth mentioning that recent versions of macos since 10.15 have a
> > restriction on certificate validity period, self-signed or not.  It's
> > a strong restriction that the browser ui will have no buttons or knobs
> > to bypass the certificate validation, rendering such sites
> > inaccessible.  I remembered it's also a system wide enforcement that
> > chrome on macos also respects this.
> >
> > [1] Requirements for trusted certificates in iOS 13 and macOS 10.15,
> > https://support.apple.com/en-us/HT210176
> >
> >> TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
> >
> > [2] About upcoming limits on trusted certificates,
> > https://support.apple.com/en-us/HT211025
> >
> >> TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
> >
> > Regards,
> >                yousong
>
> Could someone please test how MacOS and iOS behave with a self signed
> certificate, valid for 10 years which was issued no later than today please.

Tried with chrome on macos 10.15 (catalina), no way to proceed on the
certificate warning page.

With macos 10.13 (high sierra), chrome will allow you to ignore the
check and continue on, but safari will warn after clicking "visit this
website" that "You will have to modify your system settings to allow
this." and prompt for a password to change "Certificate Trust
Settings".

Regards,
                yousong


From karlp at tweak.net.au  Wed Sep  2 06:06:40 2020
From: karlp at tweak.net.au (Karl Palsson)
Date: Wed, 02 Sep 2020 10:06:40 -0000
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>
References: <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>
Message-ID: <PayrWczwqpMic5DuNaVqF2cYuIqsRkueQSANLQkh2425@mailpile>


Hauke Mehrtens <hauke at hauke-m.de> wrote:

> 
> We will still over normal http, using https is only an
> addition.

So you will change <<option redirect_https '1'>> back to 0 by
default then? So it's actually optional? It's currently hardset
to 1 here:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/uhttpd/files/uhttpd.config;h=39089ca25b34bfdcc065682360030e3d3d6433ac;hb=HEAD#l13

This then forces the self signed problematic behaviour anyway.

Sincerely,
Karl Palsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP-digital-signature.html
Type: application/pgp-signature
Size: 1175 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/4059b466/attachment-0001.sig>

From freifunk at adrianschmutzler.de  Wed Sep  2 07:21:43 2020
From: freifunk at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed,  2 Sep 2020 13:21:43 +0200
Subject: [PATCH] ath79: drop Build/loader-kernel-cmdline
Message-ID: <20200902112143.22270-1-freifunk@adrianschmutzler.de>

This is the same as  loader-kernel since the KERNEL_CMDLINE
parameter has been removed in [1] and not used at all anyway.

Remove it.

[1] f77db1a59036 ("ath79: cleanup image build code")

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ath79/image/Makefile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile
index a555cfc6d5..4b4a67fd4d 100644
--- a/target/linux/ath79/image/Makefile
+++ b/target/linux/ath79/image/Makefile
@@ -19,11 +19,6 @@ define Build/loader-kernel
 	$(call Build/loader-common,LOADER_DATA="$@")
 endef
 
-define Build/loader-kernel-cmdline
-	$(call Build/loader-common,LOADER_DATA="$@")
-endef
-
-
 define Build/loader-okli-compile
 	$(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
 endef
-- 
2.20.1



From hauke at hauke-m.de  Wed Sep  2 07:32:07 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Wed, 2 Sep 2020 13:32:07 +0200
Subject: [PATCH] ath10k-ct: update to version 2018-08-25
In-Reply-To: <20200901231433.414585-1-stijn@linux-ipv6.be>
References: <20200901231433.414585-1-stijn@linux-ipv6.be>
Message-ID: <9f87fa83-d7c5-19c6-b090-d72e173001e6@hauke-m.de>

On 9/2/20 1:14 AM, Stijn Tintel wrote:
> And since we are using mac80211 5.8, let's also switch the ath10k-ct
> driver to the new 5.8 version.
> 
> Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
> ---
>  package/kernel/ath10k-ct/Makefile                      | 10 +++++-----
>  .../164-ath10k-commit-rates-from-mac80211.patch        |  6 +++---
>  ...GPIO-controlling-support-for-various-chipsets.patch |  6 +++---
>  .../202-ath10k-use-tpt-trigger-by-default.patch        |  2 +-
>  .../205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch  |  2 +-
>  5 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
> index 76077ec156..ad80c75eaf 100644
> --- a/package/kernel/ath10k-ct/Makefile
> +++ b/package/kernel/ath10k-ct/Makefile
> @@ -8,14 +8,14 @@ PKG_LICENSE_FILES:=
>  
>  PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
>  PKG_SOURCE_PROTO:=git
> -PKG_SOURCE_DATE:=2020-06-30
> -PKG_SOURCE_VERSION:=edfbf9161ab75e4831981284ab2d5b1b9fb6ef72
> -PKG_MIRROR_HASH:=98b7f88baea7314144fa8f8d141ad0dbbf2816f9606b0a89afb396761b558d14
> +PKG_SOURCE_DATE:=2020-08-25
> +PKG_SOURCE_VERSION:=13319ff0b5dc3c86e8313f49fca583b829878736
> +PKG_MIRROR_HASH:=4a082f9c5ee26fea1eb2f86382b9db4aecec268c918f43e9a0729a0433e262da
>  
> -# Build the 5.4 ath10k-ct driver version.  Other option is "-4.19".
> +# Build ath10k-ct driver version 5.8. Other options are "-4.19", "-5.4", "-5.7".
>  # Probably this should match as closely as
>  # possible to whatever mac80211 backports version is being used.
> -CT_KVER="-5.4"
> +CT_KVER="-5.8"

You have to update the patches to also apply to the 5.8 version,
currently they are only applied to the 5.4 version.

I would split this into two patches, one updating ath10k-ct to
2020-08-25 and then a 2. patch which switches to 5.8 and adds the
patches for 5.8 too.

Hauke

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/76f39463/attachment.sig>

From hauke at hauke-m.de  Wed Sep  2 08:02:15 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Wed, 2 Sep 2020 14:02:15 +0200
Subject: [PATCH] uhttpd: Increase default certificate validate from 2 to
 10 years
In-Reply-To: <CAECwjAgnNH2qYUofuZ9XE1+JAhvAH+26m6hsK+Eoj_C60Mcfsw@mail.gmail.com>
References: <20200829183321.17675-1-hauke@hauke-m.de>
 <CAECwjAjW0aiY7ZKKG72cNH310kM-rZW5=r+3mY6MtKGCrx7+=A@mail.gmail.com>
 <b5ef546e-1abe-442c-6832-d477cc778535@hauke-m.de>
 <CAECwjAgnNH2qYUofuZ9XE1+JAhvAH+26m6hsK+Eoj_C60Mcfsw@mail.gmail.com>
Message-ID: <858fa988-1c45-afa4-daca-0da6bb31dd8e@hauke-m.de>

On 9/2/20 12:05 PM, Yousong Zhou wrote:
> On Wed, 2 Sep 2020 at 01:32, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>>
>> On 9/1/20 12:45 AM, Yousong Zhou wrote:
>>> It's worth mentioning that recent versions of macos since 10.15 have a
>>> restriction on certificate validity period, self-signed or not.  It's
>>> a strong restriction that the browser ui will have no buttons or knobs
>>> to bypass the certificate validation, rendering such sites
>>> inaccessible.  I remembered it's also a system wide enforcement that
>>> chrome on macos also respects this.
>>>
>>> [1] Requirements for trusted certificates in iOS 13 and macOS 10.15,
>>> https://support.apple.com/en-us/HT210176
>>>
>>>> TLS server certificates must have a validity period of 825 days or fewer (as expressed in the NotBefore and NotAfter fields of the certificate).
>>>
>>> [2] About upcoming limits on trusted certificates,
>>> https://support.apple.com/en-us/HT211025
>>>
>>>> TLS server certificates issued on or after September 1, 2020 00:00 GMT/UTC must not have a validity period greater than 398 days.
>>>
>>> Regards,
>>>                yousong
>>
>> Could someone please test how MacOS and iOS behave with a self signed
>> certificate, valid for 10 years which was issued no later than today please.
> 
> Tried with chrome on macos 10.15 (catalina), no way to proceed on the
> certificate warning page.
> 
> With macos 10.13 (high sierra), chrome will allow you to ignore the
> check and continue on, but safari will warn after clicking "visit this
> website" that "You will have to modify your system settings to allow
> this." and prompt for a password to change "Certificate Trust
> Settings".

Hi Yousong,

Thanks for testing this.

based on these restrictions I would NACK this change and stay with the 2
years we currently have. This way the user can "easily" acknowledge the
self signed certificate. Easy means here without modifying system
settings to installing an own certificate authority.

We should probably add a process easily renew a certificate after 2 years.

Hauke

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/3f1fbb73/attachment.sig>

From mail at adrianschmutzler.de  Wed Sep  2 12:12:20 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 2 Sep 2020 18:12:20 +0200
Subject: Remove buildbots for ath25, rb532, samsung
Message-ID: <014e01d68143$d7445560$85cd0020$@adrianschmutzler.de>

Hi,

I just dropped the targets

ath25
rb532
samsung

from master. It would be nice if somebody with access and skills could remove the corresponding buildbot configs.

I'm not sure whether we should keep the download folders at little longer; however, we should definitely remove rb532, as it has been reported to be broken with master anyway.

We also still have the scheduled_for_removal folder there, which IMO could be deleted right away as well.

Best

Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/64ef2f27/attachment.sig>

From mail at adrianschmutzler.de  Wed Sep  2 13:00:27 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 2 Sep 2020 19:00:27 +0200
Subject: [PATCH 0/3] ramips: fix OKLI lzma-loader
In-Reply-To: <20200902062231.2238353-1-gch981213@gmail.com>
References: <20200902062231.2238353-1-gch981213@gmail.com>
Message-ID: <017f01d6814a$8f5edc50$ae1c94f0$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Chuanhong Guo
> Sent: Mittwoch, 2. September 2020 08:22
> To: openwrt-devel at lists.openwrt.org
> Cc: Chuanhong Guo <gch981213 at gmail.com>
> Subject: [PATCH 0/3] ramips: fix OKLI lzma-loader
> 
> OKLI mode of our lzma-loader in ramips still contains left-over bits from
> ar71xx and isn't used before.
> This patchset fixes it so that it can be used in future devices.
> (e.g. https://github.com/openwrt/openwrt/pull/2645)

Thanks for taking care of that. In case you haven't read already, I have tidied up/rebased the Hootoo PR onto these changes here:
https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/hootoo

Those are tested by the author now.

Depending on what you prefer, I'd either wait for you to merge your two commits and then push the final one, or just merge all three myself.

Best

Adrian

> 
> Chuanhong Guo (3):
>   ramips: lzma-loader: make FLASH_START configurable
>   ramips: image: add recipe for OKLI loader
>   ramips: image: example usage of OKLI loader
> 
>  target/linux/ramips/image/Makefile            | 28 ++++++++++++++++++-
>  .../linux/ramips/image/lzma-loader/Makefile   |  2 ++
>  .../ramips/image/lzma-loader/src/Makefile     |  5 ++++
>  .../ramips/image/lzma-loader/src/loader.c     |  5 +---
>  target/linux/ramips/image/mt7620.mk           |  1 +
>  target/linux/ramips/image/mt7621.mk           |  2 +-
>  6 files changed, 37 insertions(+), 6 deletions(-)
> 
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/58c8bdf3/attachment.sig>

From mail at adrianschmutzler.de  Wed Sep  2 13:03:39 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 2 Sep 2020 19:03:39 +0200
Subject: [PATCH 1/3] ramips: lzma-loader: make FLASH_START configurable
In-Reply-To: <20200902062231.2238353-2-gch981213@gmail.com>
References: <20200902062231.2238353-1-gch981213@gmail.com>
 <20200902062231.2238353-2-gch981213@gmail.com>
Message-ID: <018a01d6814b$02edaf70$08c90e50$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Chuanhong Guo
> Sent: Mittwoch, 2. September 2020 08:22
> To: openwrt-devel at lists.openwrt.org
> Cc: Chuanhong Guo <gch981213 at gmail.com>
> Subject: [PATCH 1/3] ramips: lzma-loader: make FLASH_START configurable
> 
> FLASH_START is supposed to point at the memory area where NOR flash are
> mapped. We currently have an incorrect FLASH_START copied from ar71xx
> back then and the loader doesn't work under OKLI mode.
> On ramips, mt7621 has it's flash mapped to 0x1fc00000 and other SoCs uses
> 0x1c000000. This commit makes FLASH_START a configurable value to handle
> both cases.
> 
> Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> ---
>  target/linux/ramips/image/lzma-loader/Makefile     | 2 ++
>  target/linux/ramips/image/lzma-loader/src/Makefile | 5 +++++
> target/linux/ramips/image/lzma-loader/src/loader.c | 5 +----
>  3 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/target/linux/ramips/image/lzma-loader/Makefile
> b/target/linux/ramips/image/lzma-loader/Makefile
> index f22151c9d7..4cf700d8c6 100644
> --- a/target/linux/ramips/image/lzma-loader/Makefile
> +++ b/target/linux/ramips/image/lzma-loader/Makefile
> @@ -13,6 +13,7 @@ LOADER		:= loader.bin
>  LOADER_NAME	:= $(basename $(notdir $(LOADER)))
>  LOADER_DATA 	:=
>  TARGET_DIR	:=
> +FLASH_START	:=
>  FLASH_OFFS	:=
>  FLASH_MAX	:=
>  BOARD		:=
> @@ -40,6 +41,7 @@ loader-compile: $(PKG_BUILD_DIR)/.prepared
>  	$(MAKE) -C $(PKG_BUILD_DIR)
> CROSS_COMPILE="$(TARGET_CROSS)" \
>  		LZMA_TEXT_START=$(LZMA_TEXT_START) \
>  		LOADER_DATA=$(LOADER_DATA) \
> +		FLASH_START=$(FLASH_START) \
>  		FLASH_OFFS=$(FLASH_OFFS) \
>  		FLASH_MAX=$(FLASH_MAX) \
>  		BOARD="$(BOARD)" \
> diff --git a/target/linux/ramips/image/lzma-loader/src/Makefile
> b/target/linux/ramips/image/lzma-loader/src/Makefile
> index d20cd77346..97fd6dad47 100644
> --- a/target/linux/ramips/image/lzma-loader/src/Makefile
> +++ b/target/linux/ramips/image/lzma-loader/src/Makefile
> @@ -19,6 +19,7 @@ LOADADDR	:=
>  LZMA_TEXT_START	:= 0x80a00000
>  LOADER_DATA	:=
>  BOARD		:=
> +FLASH_START	:=
>  FLASH_OFFS	:=
>  FLASH_MAX	:=
>  PLATFORM	:=
> @@ -64,6 +65,10 @@ ifneq ($(strip $(KERNEL_CMDLINE)),)
>  CFLAGS		+= -
> DCONFIG_KERNEL_CMDLINE='"$(KERNEL_CMDLINE)"'
>  endif
> 
> +ifneq ($(strip $(FLASH_START)),)
> +CFLAGS		+= -DCONFIG_FLASH_START=$(FLASH_START)
> +endif
> +
>  ifneq ($(strip $(FLASH_OFFS)),)
>  CFLAGS		+= -DCONFIG_FLASH_OFFS=$(FLASH_OFFS)
>  endif
> diff --git a/target/linux/ramips/image/lzma-loader/src/loader.c
> b/target/linux/ramips/image/lzma-loader/src/loader.c
> index c73b60b351..a3513eccf1 100644
> --- a/target/linux/ramips/image/lzma-loader/src/loader.c
> +++ b/target/linux/ramips/image/lzma-loader/src/loader.c
> @@ -28,9 +28,6 @@
>  #include "printf.h"
>  #include "LzmaDecode.h"
> 
> -#define AR71XX_FLASH_START	0x1f000000
> -#define AR71XX_FLASH_END	0x1fe00000
> -

Am I understanding this right, that if FLASH_START is not defined and set in ramips/image/Makefile, then compilation will fail here as the CONFIG_FLASH_START symbol is not defined?

Best

Adrian

>  #define KSEG0			0x80000000
>  #define KSEG1			0xa0000000
> 
> @@ -178,7 +175,7 @@ static void lzma_init_data(void)
>  	unsigned long kernel_ofs;
>  	unsigned long kernel_size;
> 
> -	flash_base = (unsigned char *) KSEG1ADDR(AR71XX_FLASH_START);
> +	flash_base = (unsigned char *) KSEG1ADDR(CONFIG_FLASH_START);
> 
>  	printf("Looking for OpenWrt image... ");
> 
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/3e6020a7/attachment.sig>

From ynezz at true.cz  Wed Sep  2 15:01:59 2020
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Wed, 2 Sep 2020 21:01:59 +0200
Subject: Remove buildbots for ath25, rb532, samsung
In-Reply-To: <014e01d68143$d7445560$85cd0020$@adrianschmutzler.de>
References: <014e01d68143$d7445560$85cd0020$@adrianschmutzler.de>
Message-ID: <20200902190159.GA71905@meh.true.cz>

Adrian Schmutzler <mail at adrianschmutzler.de> [2020-09-02 18:12:20]:

Hi,

> It would be nice if somebody with access and skills could remove the
> corresponding buildbot configs.

FYI, the configs are dynamic[1], so just restart of buildbot master was
needed. Should be done now.

> I'm not sure whether we should keep the download folders at little longer;
> however, we should definitely remove rb532, as it has been reported to be
> broken with master anyway.

I've now moved the folders into scheduled_for_removal.

> We also still have the scheduled_for_removal folder there, which IMO could
> be deleted right away as well.

Yeah, still waiting for someone with access to archive.openwrt.org to move it
overthere, so it could be deleted from downloads.openwrt.org. Until then I
prefer to keep it in this strange folder (naming is hard), unless there is
strong reason to delete it ASAP.

1. https://git.openwrt.org/?p=buildbot.git;a=blob;f=phase1/master.cfg;h=3ba7a1606e89b095b10555e703ea96e93295deec;hb=refs/heads/master#l203

-- ynezz


From mail at adrianschmutzler.de  Wed Sep  2 15:11:09 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 2 Sep 2020 21:11:09 +0200
Subject: Remove buildbots for ath25, rb532, samsung
In-Reply-To: <20200902190159.GA71905@meh.true.cz>
References: <014e01d68143$d7445560$85cd0020$@adrianschmutzler.de>
 <20200902190159.GA71905@meh.true.cz>
Message-ID: <01dc01d6815c$d2138fc0$763aaf40$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Petr ?tetiar
> Sent: Mittwoch, 2. September 2020 21:02
> To: Adrian Schmutzler <mail at adrianschmutzler.de>
> Cc: openwrt-devel at lists.openwrt.org; 'OpenWrt Project Administration'
> <openwrt-adm at lists.openwrt.org>
> Subject: Re: Remove buildbots for ath25, rb532, samsung
> 
> Adrian Schmutzler <mail at adrianschmutzler.de> [2020-09-02 18:12:20]:
> 
> Hi,
> 
> > It would be nice if somebody with access and skills could remove the
> > corresponding buildbot configs.
> 
> FYI, the configs are dynamic[1], so just restart of buildbot master was
> needed. Should be done now.
> 
> > I'm not sure whether we should keep the download folders at little
> > longer; however, we should definitely remove rb532, as it has been
> > reported to be broken with master anyway.
> 
> I've now moved the folders into scheduled_for_removal.

Thanks.

> 
> > We also still have the scheduled_for_removal folder there, which IMO
> > could be deleted right away as well.
> 
> Yeah, still waiting for someone with access to archive.openwrt.org to move it
> overthere, so it could be deleted from downloads.openwrt.org. Until then I
> prefer to keep it in this strange folder (naming is hard), unless there is strong
> reason to delete it ASAP.

Fine with me; this should be enough to keep out most of the users.

Best

Adrian

> 
> 1.
> https://git.openwrt.org/?p=buildbot.git;a=blob;f=phase1/master.cfg;h=3ba7
> a1606e89b095b10555e703ea96e93295deec;hb=refs/heads/master#l203
> 
> -- ynezz
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200902/dc10481b/attachment-0001.sig>

From mail at aparcar.org  Wed Sep  2 16:27:24 2020
From: mail at aparcar.org (Paul Spooren)
Date: Wed, 2 Sep 2020 10:27:24 -1000
Subject: [PATCH] ath79: drop Build/loader-kernel-cmdline
In-Reply-To: <20200902112143.22270-1-freifunk@adrianschmutzler.de>
References: <20200902112143.22270-1-freifunk@adrianschmutzler.de>
Message-ID: <756fb117-020f-681b-e016-739993d71598@aparcar.org>


On 02.09.20 01:21, Adrian Schmutzler wrote:
> This is the same as  loader-kernel since the KERNEL_CMDLINE
> parameter has been removed in [1] and not used at all anyway.
>
> Remove it.
>
> [1] f77db1a59036 ("ath79: cleanup image build code")
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
Acked-by: Paul Spooren <mail at aparcar.org>
> ---
>   target/linux/ath79/image/Makefile | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile
> index a555cfc6d5..4b4a67fd4d 100644
> --- a/target/linux/ath79/image/Makefile
> +++ b/target/linux/ath79/image/Makefile
> @@ -19,11 +19,6 @@ define Build/loader-kernel
>   	$(call Build/loader-common,LOADER_DATA="$@")
>   endef
>   
> -define Build/loader-kernel-cmdline
> -	$(call Build/loader-common,LOADER_DATA="$@")
> -endef
> -
> -
>   define Build/loader-okli-compile
>   	$(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
>   endef


From rosenp at gmail.com  Wed Sep  2 17:18:24 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Wed,  2 Sep 2020 14:18:24 -0700
Subject: [PATCH] tools/zstd: update to 1.4.5
Message-ID: <20200902211824.143130-1-rosenp@gmail.com>

Fix URL. The GITHUB macro is meant to be used for files inside a git
repository. This gets downloaded purely by accident (19.07 packages
feed has zstd 1.4.5 with the file in sources.openwrt.org).

Remove upstream backport.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 tools/zstd/Makefile                           |  6 +-
 ...re-portable-header-prefix-usage-1987.patch | 61 -------------------
 2 files changed, 3 insertions(+), 64 deletions(-)
 delete mode 100644 tools/zstd/patches/0001-build-issue-More-portable-header-prefix-usage-1987.patch

diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile
index 7459725e8e..ef268c0b86 100644
--- a/tools/zstd/Makefile
+++ b/tools/zstd/Makefile
@@ -1,11 +1,11 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zstd
-PKG_VERSION:=1.4.4
+PKG_VERSION:=1.4.5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=@GITHUB/facebook/zstd/releases/download/v$(PKG_VERSION)
-PKG_HASH:=a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8
+PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION)
+PKG_HASH:=98e91c7c6bf162bf90e4e70fdbc41a8188b9fa8de5ad840c401198014406ce9e
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
diff --git a/tools/zstd/patches/0001-build-issue-More-portable-header-prefix-usage-1987.patch b/tools/zstd/patches/0001-build-issue-More-portable-header-prefix-usage-1987.patch
deleted file mode 100644
index 6d743aa385..0000000000
--- a/tools/zstd/patches/0001-build-issue-More-portable-header-prefix-usage-1987.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 06a57cf57e3c4e887cadcf688e3081154f3f6db4 Mon Sep 17 00:00:00 2001
-Message-Id: <06a57cf57e3c4e887cadcf688e3081154f3f6db4.1589392463.git.mschiffer at universe-factory.net>
-From: Bimba Shrestha <bimbashrestha at fb.com>
-Date: Thu, 6 Feb 2020 14:10:51 -0800
-Subject: [PATCH] [build-issue] More portable header prefix usage (#) (#1987)
-
-* make 4.3 build issue fix
-
-* Changing header name and adding comment
----
- programs/Makefile | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/programs/Makefile b/programs/Makefile
-index b75314a83f43..a9ee3cb5311b 100644
---- a/programs/Makefile
-+++ b/programs/Makefile
-@@ -94,9 +94,12 @@ endif
- 
- VOID = /dev/null
- 
-+# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
-+NUM_SYMBOL := \#
-+
- # thread detection
- NO_THREAD_MSG := ==> no threads, building without multithreading support
--HAVE_PTHREAD := $(shell printf '\#include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)
-+HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)
- HAVE_THREAD := $(shell [ "$(HAVE_PTHREAD)" -eq "1" -o -n "$(filter Windows%,$(OS))" ] && echo 1 || echo 0)
- ifeq ($(HAVE_THREAD), 1)
- THREAD_MSG := ==> building with threading support
-@@ -108,7 +111,7 @@ endif
- 
- # zlib detection
- NO_ZLIB_MSG := ==> no zlib, building zstd without .gz support
--HAVE_ZLIB := $(shell printf '\#include <zlib.h>\nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c)
-+HAVE_ZLIB := $(shell printf '$(NUM_SYMBOL)include <zlib.h>\nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c)
- ifeq ($(HAVE_ZLIB), 1)
- ZLIB_MSG := ==> building zstd with .gz compression support
- ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS
-@@ -119,7 +122,7 @@ endif
- 
- # lzma detection
- NO_LZMA_MSG := ==> no liblzma, building zstd without .xz/.lzma support
--HAVE_LZMA := $(shell printf '\#include <lzma.h>\nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c)
-+HAVE_LZMA := $(shell printf '$(NUM_SYMBOL)include <lzma.h>\nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c)
- ifeq ($(HAVE_LZMA), 1)
- LZMA_MSG := ==> building zstd with .xz/.lzma compression support
- LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS
-@@ -130,7 +133,7 @@ endif
- 
- # lz4 detection
- NO_LZ4_MSG := ==> no liblz4, building zstd without .lz4 support
--HAVE_LZ4 := $(shell printf '\#include <lz4frame.h>\n\#include <lz4.h>\nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c)
-+HAVE_LZ4 := $(shell printf '$(NUM_SYMBOL)include <lz4frame.h>\n\#include <lz4.h>\nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c)
- ifeq ($(HAVE_LZ4), 1)
- LZ4_MSG := ==> building zstd with .lz4 compression support
- LZ4CPP = -DZSTD_LZ4COMPRESS -DZSTD_LZ4DECOMPRESS
--- 
-2.26.2
-
-- 
2.26.2



From stijn at linux-ipv6.be  Wed Sep  2 17:20:51 2020
From: stijn at linux-ipv6.be (Stijn Tintel)
Date: Thu,  3 Sep 2020 00:20:51 +0300
Subject: [PATCH v2 2/2] ath10k-ct: switch to driver version 5.8
In-Reply-To: <20200902212051.3808890-1-stijn@linux-ipv6.be>
References: <20200902212051.3808890-1-stijn@linux-ipv6.be>
Message-ID: <20200902212051.3808890-2-stijn@linux-ipv6.be>

Since we are using mac80211 5.8, let's also switch the ath10k-ct driver
to the new 5.8 version.

Modify patches so they patch the new ath10k-ct driver version.
Adapt 164-ath10k-commit-rates-from-mac80211.patch.
Drop upstreamed 205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch.

Drop the other options for CT_KVER from the comment, as it is incorrect
and there are too many versions to sum up and maintain there.

Runtime-tested on ath79.

Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 package/kernel/ath10k-ct/Makefile             |   6 +-
 ...64-ath10k-commit-rates-from-mac80211.patch |  24 ++--
 ...rolling-support-for-various-chipsets.patch | 124 +++++++++---------
 ...02-ath10k-use-tpt-trigger-by-default.patch |  24 ++--
 ...10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch |  10 --
 ...0-0010-ath10k-limit-htt-rx-ring-size.patch |   6 +-
 ...60-0011-ath10k-limit-pci-buffer-size.patch |  12 +-
 7 files changed, 98 insertions(+), 108 deletions(-)
 delete mode 100644 package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch

diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
index b0ac5625c4..439dab3ddf 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ath10k-ct
-PKG_RELEASE=1
+PKG_RELEASE=2
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=
@@ -12,10 +12,10 @@ PKG_SOURCE_DATE:=2020-08-25
 PKG_SOURCE_VERSION:=13319ff0b5dc3c86e8313f49fca583b829878736
 PKG_MIRROR_HASH:=4a082f9c5ee26fea1eb2f86382b9db4aecec268c918f43e9a0729a0433e262da
 
-# Build the 5.4 ath10k-ct driver version.  Other option is "-4.19".
+# Build the 5.8 ath10k-ct driver version.
 # Probably this should match as closely as
 # possible to whatever mac80211 backports version is being used.
-CT_KVER="-5.4"
+CT_KVER="-5.8"
 
 PKG_MAINTAINER:=Ben Greear <greearb at candelatech.com>
 PKG_BUILD_PARALLEL:=1
diff --git a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
index b913bbdc82..a300ff366a 100644
--- a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
+++ b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
@@ -9,9 +9,17 @@ mcast_rate set for a wifi-iface.
 
 Signed-off-by: Sven Eckelmann <sven at narfation.org>
 
---- a/ath10k-5.4/mac.c
-+++ b/ath10k-5.4/mac.c
-@@ -6796,6 +6796,7 @@ static void ath10k_bss_info_changed(stru
+--- a/ath10k-5.8/mac.c
++++ b/ath10k-5.8/mac.c
+@@ -6652,6 +6652,7 @@ static void ath10k_recalculate_mgmt_rate
+ 		return;
+ 	}
+ 
++	arvif->mgt_rate[def->chan->band] = hw_rate_code;
+ 	vdev_param = ar->wmi.vdev_param->mgmt_rate;
+ 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+ 					hw_rate_code);
+@@ -6878,6 +6879,7 @@ static void ath10k_bss_info_changed(stru
  			   "mac vdev %d mcast_rate %x\n",
  			   arvif->vdev_id, rate);
  
@@ -19,7 +27,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->mcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6804,6 +6805,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6886,6 +6888,7 @@ static void ath10k_bss_info_changed(stru
  				    "failed to set mcast rate on vdev %i: %d\n",
  				    arvif->vdev_id,  ret);
  
@@ -27,11 +35,3 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->bcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6830,6 +6832,7 @@ static void ath10k_bss_info_changed(stru
- 			return;
- 		}
- 
-+		arvif->mgt_rate[def.chan->band] = hw_rate_code;
- 		vdev_param = ar->wmi.vdev_param->mgmt_rate;
- 		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
- 						hw_rate_code);
diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
index 5291732f25..5ac6bdc34c 100644
--- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
+++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
@@ -66,25 +66,25 @@ v13:
 
 * cleanup includes
 
- ath10k-5.4/Kconfig   |  10 +++
- ath10k-5.4/Makefile  |   1 +
- ath10k-5.4/core.c    |  22 +++++++
- ath10k-5.4/core.h    |   9 ++-
- ath10k-5.4/hw.h      |   1 +
- ath10k-5.4/leds.c    | 103 ++++++++++++++++++++++++++++++
- ath10k-5.4/leds.h    |  45 +++++++++++++
- ath10k-5.4/mac.c     |   1 +
- ath10k-5.4/wmi-ops.h |  32 ++++++++++
- ath10k-5.4/wmi-tlv.c |   2 +
- ath10k-5.4/wmi.c     |  54 ++++++++++++++++
- ath10k-5.4/wmi.h     |  35 ++++++++++
+ ath10k-5.8/Kconfig   |  10 +++
+ ath10k-5.8/Makefile  |   1 +
+ ath10k-5.8/core.c    |  22 +++++++
+ ath10k-5.8/core.h    |   9 ++-
+ ath10k-5.8/hw.h      |   1 +
+ ath10k-5.8/leds.c    | 103 ++++++++++++++++++++++++++++++
+ ath10k-5.8/leds.h    |  45 +++++++++++++
+ ath10k-5.8/mac.c     |   1 +
+ ath10k-5.8/wmi-ops.h |  32 ++++++++++
+ ath10k-5.8/wmi-tlv.c |   2 +
+ ath10k-5.8/wmi.c     |  54 ++++++++++++++++
+ ath10k-5.8/wmi.h     |  35 ++++++++++
  12 files changed, 314 insertions(+), 1 deletion(-)
- create mode 100644 ath10k-5.4/leds.c
- create mode 100644 ath10k-5.4/leds.h
+ create mode 100644 ath10k-5.8/leds.c
+ create mode 100644 ath10k-5.8/leds.h
 
---- a/ath10k-5.4/Kconfig
-+++ b/ath10k-5.4/Kconfig
-@@ -66,6 +66,16 @@ config ATH10K_DEBUGFS
+--- a/ath10k-5.8/Kconfig
++++ b/ath10k-5.8/Kconfig
+@@ -65,6 +65,16 @@ config ATH10K_DEBUGFS
  
  	  If unsure, say Y to make it easier to debug problems.
  
@@ -101,19 +101,19 @@ v13:
  config ATH10K_SPECTRAL
  	bool "Atheros ath10k spectral scan support"
  	depends on ATH10K_DEBUGFS
---- a/ath10k-5.4/Makefile
-+++ b/ath10k-5.4/Makefile
-@@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) +=
+--- a/ath10k-5.8/Makefile
++++ b/ath10k-5.8/Makefile
+@@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) +=
  ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
  ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
  ath10k_core-$(CONFIG_THERMAL) += thermal.o
 +ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o
  ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
  ath10k_core-$(CONFIG_PM) += wow.o
- ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
---- a/ath10k-5.4/core.c
-+++ b/ath10k-5.4/core.c
-@@ -25,6 +25,7 @@
+ ath10k_core-$(CONFIG_ATH10K_CE) += ce.o
+--- a/ath10k-5.8/core.c
++++ b/ath10k-5.8/core.c
+@@ -26,6 +26,7 @@
  #include "testmode.h"
  #include "wmi-ops.h"
  #include "coredump.h"
@@ -121,7 +121,7 @@ v13:
  
  /* Disable ath10k-ct DBGLOG output by default */
  unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG;
-@@ -67,6 +68,7 @@ static const struct ath10k_hw_params ath
+@@ -68,6 +69,7 @@ static const struct ath10k_hw_params ath
  		.dev_id = QCA988X_2_0_DEVICE_ID,
  		.bus = ATH10K_BUS_PCI,
  		.name = "qca988x hw2.0",
@@ -129,7 +129,7 @@ v13:
  		.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
  		.uart_pin = 7,
  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
-@@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath
+@@ -138,6 +140,7 @@ static const struct ath10k_hw_params ath
  		.dev_id = QCA9887_1_0_DEVICE_ID,
  		.bus = ATH10K_BUS_PCI,
  		.name = "qca9887 hw1.0",
@@ -137,7 +137,7 @@ v13:
  		.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
  		.uart_pin = 7,
  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
-@@ -344,6 +347,7 @@ static const struct ath10k_hw_params ath
+@@ -347,6 +350,7 @@ static const struct ath10k_hw_params ath
  		.dev_id = QCA99X0_2_0_DEVICE_ID,
  		.bus = ATH10K_BUS_PCI,
  		.name = "qca99x0 hw2.0",
@@ -145,7 +145,7 @@ v13:
  		.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
  		.uart_pin = 7,
  		.otp_exe_param = 0x00000700,
-@@ -385,6 +389,7 @@ static const struct ath10k_hw_params ath
+@@ -388,6 +392,7 @@ static const struct ath10k_hw_params ath
  		.dev_id = QCA9984_1_0_DEVICE_ID,
  		.bus = ATH10K_BUS_PCI,
  		.name = "qca9984/qca9994 hw1.0",
@@ -153,7 +153,7 @@ v13:
  		.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
  		.uart_pin = 7,
  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -433,6 +438,7 @@ static const struct ath10k_hw_params ath
+@@ -436,6 +441,7 @@ static const struct ath10k_hw_params ath
  		.dev_id = QCA9888_2_0_DEVICE_ID,
  		.bus = ATH10K_BUS_PCI,
  		.name = "qca9888 hw2.0",
@@ -161,7 +161,7 @@ v13:
  		.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
  		.uart_pin = 7,
  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -3573,6 +3579,10 @@ int ath10k_core_start(struct ath10k *ar,
+@@ -3669,6 +3675,10 @@ int ath10k_core_start(struct ath10k *ar,
  			ath10k_wmi_check_apply_board_power_ctl_table(ar);
  	}
  
@@ -172,7 +172,7 @@ v13:
  	return 0;
  
  err_hif_stop:
-@@ -3829,9 +3839,18 @@ static void ath10k_core_register_work(st
+@@ -3927,9 +3937,18 @@ static void ath10k_core_register_work(st
  		goto err_spectral_destroy;
  	}
  
@@ -191,7 +191,7 @@ v13:
  err_spectral_destroy:
  	ath10k_spectral_destroy(ar);
  err_debug_destroy:
-@@ -3891,6 +3910,8 @@ void ath10k_core_unregister(struct ath10
+@@ -3989,6 +4008,8 @@ void ath10k_core_unregister(struct ath10
  	if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
  		return;
  
@@ -200,8 +200,8 @@ v13:
  	ath10k_thermal_unregister(ar);
  	/* Stop spectral before unregistering from mac80211 to remove the
  	 * relayfs debugfs file cleanly. Otherwise the parent debugfs tree
---- a/ath10k-5.4/core.h
-+++ b/ath10k-5.4/core.h
+--- a/ath10k-5.8/core.h
++++ b/ath10k-5.8/core.h
 @@ -14,6 +14,7 @@
  #include <linux/pci.h>
  #include <linux/uuid.h>
@@ -210,7 +210,7 @@ v13:
  
  #include "htt.h"
  #include "htc.h"
-@@ -1470,6 +1471,13 @@ struct ath10k {
+@@ -1517,6 +1518,13 @@ struct ath10k {
  	} testmode;
  
  	struct {
@@ -222,11 +222,11 @@ v13:
 +
 +	struct {
  		/* protected by data_lock */
+ 		u32 rx_crc_err_drop;
  		u32 fw_crash_counter;
- 		u32 fw_warm_reset_counter;
---- a/ath10k-5.4/hw.h
-+++ b/ath10k-5.4/hw.h
-@@ -518,6 +518,7 @@ struct ath10k_hw_params {
+--- a/ath10k-5.8/hw.h
++++ b/ath10k-5.8/hw.h
+@@ -521,6 +521,7 @@ struct ath10k_hw_params {
  	const char *name;
  	u32 patch_load_addr;
  	int uart_pin;
@@ -235,7 +235,7 @@ v13:
  
  	/* Type of hw cycle counter wraparound logic, for more info
 --- /dev/null
-+++ b/ath10k-5.4/leds.c
++++ b/ath10k-5.8/leds.c
 @@ -0,0 +1,103 @@
 +/*
 + * Copyright (c) 2005-2011 Atheros Communications Inc.
@@ -341,7 +341,7 @@ v13:
 +}
 +
 --- /dev/null
-+++ b/ath10k-5.4/leds.h
++++ b/ath10k-5.8/leds.h
 @@ -0,0 +1,41 @@
 +/*
 + * Copyright (c) 2018, The Linux Foundation. All rights reserved.
@@ -384,9 +384,9 @@ v13:
 +
 +#endif
 +#endif /* _LEDS_H_ */
---- a/ath10k-5.4/mac.c
-+++ b/ath10k-5.4/mac.c
-@@ -24,6 +24,7 @@
+--- a/ath10k-5.8/mac.c
++++ b/ath10k-5.8/mac.c
+@@ -25,6 +25,7 @@
  #include "wmi-tlv.h"
  #include "wmi-ops.h"
  #include "wow.h"
@@ -394,9 +394,9 @@ v13:
  
  /*********/
  /* Rates */
---- a/ath10k-5.4/wmi-ops.h
-+++ b/ath10k-5.4/wmi-ops.h
-@@ -219,7 +219,10 @@ struct wmi_ops {
+--- a/ath10k-5.8/wmi-ops.h
++++ b/ath10k-5.8/wmi-ops.h
+@@ -226,7 +226,10 @@ struct wmi_ops {
  	struct sk_buff *(*gen_bb_timing)
  			(struct ath10k *ar,
  			 const struct wmi_bb_timing_cfg_arg *arg);
@@ -407,7 +407,7 @@ v13:
  };
  
  int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
-@@ -1115,6 +1118,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
+@@ -1145,6 +1148,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
  }
  
@@ -443,9 +443,9 @@ v13:
  static inline int
  ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level)
  {
---- a/ath10k-5.4/wmi-tlv.c
-+++ b/ath10k-5.4/wmi-tlv.c
-@@ -4382,6 +4382,8 @@ static const struct wmi_ops wmi_tlv_ops
+--- a/ath10k-5.8/wmi-tlv.c
++++ b/ath10k-5.8/wmi-tlv.c
+@@ -4583,6 +4583,8 @@ static const struct wmi_ops wmi_tlv_ops
  	.gen_echo = ath10k_wmi_tlv_op_gen_echo,
  	.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
  	.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
@@ -454,9 +454,9 @@ v13:
  };
  
  static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
---- a/ath10k-5.4/wmi.c
-+++ b/ath10k-5.4/wmi.c
-@@ -8305,6 +8305,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
+--- a/ath10k-5.8/wmi.c
++++ b/ath10k-5.8/wmi.c
+@@ -8404,6 +8404,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
  	return skb;
  }
  
@@ -506,7 +506,7 @@ v13:
  static struct sk_buff *
  ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
  			     enum wmi_sta_ps_mode psmode)
-@@ -10104,6 +10147,9 @@ static const struct wmi_ops wmi_ops = {
+@@ -10203,6 +10246,9 @@ static const struct wmi_ops wmi_ops = {
  	.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
  	.gen_echo = ath10k_wmi_op_gen_echo,
@@ -516,7 +516,7 @@ v13:
  	/* .gen_bcn_tmpl not implemented */
  	/* .gen_prb_tmpl not implemented */
  	/* .gen_p2p_go_bcn_ie not implemented */
-@@ -10174,6 +10220,8 @@ static const struct wmi_ops wmi_10_1_ops
+@@ -10273,6 +10319,8 @@ static const struct wmi_ops wmi_10_1_ops
  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
  	.gen_echo = ath10k_wmi_op_gen_echo,
@@ -525,7 +525,7 @@ v13:
  	/* .gen_bcn_tmpl not implemented */
  	/* .gen_prb_tmpl not implemented */
  	/* .gen_p2p_go_bcn_ie not implemented */
-@@ -10253,6 +10301,8 @@ static const struct wmi_ops wmi_10_2_ops
+@@ -10352,6 +10400,8 @@ static const struct wmi_ops wmi_10_2_ops
  	.gen_delba_send = ath10k_wmi_op_gen_delba_send,
  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
@@ -534,7 +534,7 @@ v13:
  	/* .gen_pdev_enable_adaptive_cca not implemented */
  };
  
-@@ -10324,6 +10374,8 @@ static const struct wmi_ops wmi_10_2_4_o
+@@ -10423,6 +10473,8 @@ static const struct wmi_ops wmi_10_2_4_o
  		ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
  	.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
  	.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
@@ -543,7 +543,7 @@ v13:
  	/* .gen_bcn_tmpl not implemented */
  	/* .gen_prb_tmpl not implemented */
  	/* .gen_p2p_go_bcn_ie not implemented */
-@@ -10405,6 +10457,8 @@ static const struct wmi_ops wmi_10_4_ops
+@@ -10504,6 +10556,8 @@ static const struct wmi_ops wmi_10_4_ops
  	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
  	.gen_echo = ath10k_wmi_op_gen_echo,
  	.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
@@ -552,9 +552,9 @@ v13:
  };
  
  int ath10k_wmi_attach(struct ath10k *ar)
---- a/ath10k-5.4/wmi.h
-+++ b/ath10k-5.4/wmi.h
-@@ -3110,6 +3110,41 @@ enum wmi_10_4_feature_mask {
+--- a/ath10k-5.8/wmi.h
++++ b/ath10k-5.8/wmi.h
+@@ -3121,6 +3121,41 @@ enum wmi_10_4_feature_mask {
  
  };
  
diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
index 838158c7e0..ec03fc0632 100644
--- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
+++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
@@ -9,14 +9,14 @@ traffic.
 
 Signed-off-by: Mathias Kresin <dev at kresin.me>
 ---
- ath10k-5.4/core.h | 4 ++++
- ath10k-5.4/leds.c | 4 +---
- ath10k-5.4/mac.c  | 2 +-
+ ath10k-5.8/core.h | 4 ++++
+ ath10k-5.8/leds.c | 4 +---
+ ath10k-5.8/mac.c  | 2 +-
  3 files changed, 6 insertions(+), 4 deletions(-)
 
---- a/ath10k-5.4/core.h
-+++ b/ath10k-5.4/core.h
-@@ -1574,6 +1574,10 @@ struct ath10k {
+--- a/ath10k-5.8/core.h
++++ b/ath10k-5.8/core.h
+@@ -1625,6 +1625,10 @@ struct ath10k {
  	u8 csi_data[4096];
  	u16 csi_data_len;
  
@@ -25,10 +25,10 @@ Signed-off-by: Mathias Kresin <dev at kresin.me>
 +#endif
 +
  	/* must be last */
- 	u8 drv_priv[0] __aligned(sizeof(void *));
+ 	u8 drv_priv[] __aligned(sizeof(void *));
  };
---- a/ath10k-5.4/leds.c
-+++ b/ath10k-5.4/leds.c
+--- a/ath10k-5.8/leds.c
++++ b/ath10k-5.8/leds.c
 @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k *
  
  	ar->leds.cdev.name = ar->leds.label;
@@ -40,9 +40,9 @@ Signed-off-by: Mathias Kresin <dev at kresin.me>
  
  	ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
  	if (ret)
---- a/ath10k-5.4/mac.c
-+++ b/ath10k-5.4/mac.c
-@@ -10386,7 +10386,7 @@ int ath10k_mac_register(struct ath10k *a
+--- a/ath10k-5.8/mac.c
++++ b/ath10k-5.8/mac.c
+@@ -10679,7 +10679,7 @@ int ath10k_mac_register(struct ath10k *a
  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
  
  #ifdef CPTCFG_MAC80211_LEDS
diff --git a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
deleted file mode 100644
index 09dd13e9a4..0000000000
--- a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/ath10k-5.4/mac.c
-+++ b/ath10k-5.4/mac.c
-@@ -10185,6 +10185,7 @@ int ath10k_mac_register(struct ath10k *a
- 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
- 	wiphy_ext_feature_set(ar->hw->wiphy,
- 			      NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-+	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL);
- 
- 	if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) ||
- 	    test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
index c527430898..5b52a434f9 100644
--- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
+++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch
@@ -1,6 +1,6 @@
---- a/ath10k-5.4/htt.h
-+++ b/ath10k-5.4/htt.h
-@@ -225,7 +225,11 @@ enum htt_rx_ring_flags {
+--- a/ath10k-5.8/htt.h
++++ b/ath10k-5.8/htt.h
+@@ -237,7 +237,11 @@ enum htt_rx_ring_flags {
  };
  
  #define HTT_RX_RING_SIZE_MIN 128
diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch
index f559a78f29..98653d6b72 100644
--- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch
+++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch
@@ -1,6 +1,6 @@
---- a/ath10k-5.4/pci.c
-+++ b/ath10k-5.4/pci.c
-@@ -131,7 +131,11 @@ static struct ce_attr host_ce_config_wla
+--- a/ath10k-5.8/pci.c
++++ b/ath10k-5.8/pci.c
+@@ -131,7 +131,11 @@ static const struct ce_attr pci_host_ce_
  		.flags = CE_ATTR_FLAGS,
  		.src_nentries = 0,
  		.src_sz_max = 2048,
@@ -12,7 +12,7 @@
  		.recv_cb = ath10k_pci_htt_htc_rx_cb,
  	},
  
-@@ -140,7 +144,11 @@ static struct ce_attr host_ce_config_wla
+@@ -140,7 +144,11 @@ static const struct ce_attr pci_host_ce_
  		.flags = CE_ATTR_FLAGS,
  		.src_nentries = 0,
  		.src_sz_max = 2048,
@@ -24,7 +24,7 @@
  		.recv_cb = ath10k_pci_htc_rx_cb,
  	},
  
-@@ -167,7 +175,11 @@ static struct ce_attr host_ce_config_wla
+@@ -167,7 +175,11 @@ static const struct ce_attr pci_host_ce_
  		.flags = CE_ATTR_FLAGS,
  		.src_nentries = 0,
  		.src_sz_max = 512,
@@ -36,7 +36,7 @@
  		.recv_cb = ath10k_pci_htt_rx_cb,
  	},
  
-@@ -192,7 +204,11 @@ static struct ce_attr host_ce_config_wla
+@@ -192,7 +204,11 @@ static const struct ce_attr pci_host_ce_
  		.flags = CE_ATTR_FLAGS,
  		.src_nentries = 0,
  		.src_sz_max = 2048,
-- 
2.26.2



From stijn at linux-ipv6.be  Wed Sep  2 17:20:50 2020
From: stijn at linux-ipv6.be (Stijn Tintel)
Date: Thu,  3 Sep 2020 00:20:50 +0300
Subject: [PATCH v2 1/2] ath10k-ct: update to version 2018-08-25
Message-ID: <20200902212051.3808890-1-stijn@linux-ipv6.be>

Runtime-tested on ath79.

Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 package/kernel/ath10k-ct/Makefile                           | 6 +++---
 .../patches/164-ath10k-commit-rates-from-mac80211.patch     | 6 +++---
 ...-and-GPIO-controlling-support-for-various-chipsets.patch | 6 +++---
 .../patches/202-ath10k-use-tpt-trigger-by-default.patch     | 2 +-
 .../205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch       | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
index 76077ec156..b0ac5625c4 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
 
 PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2020-06-30
-PKG_SOURCE_VERSION:=edfbf9161ab75e4831981284ab2d5b1b9fb6ef72
-PKG_MIRROR_HASH:=98b7f88baea7314144fa8f8d141ad0dbbf2816f9606b0a89afb396761b558d14
+PKG_SOURCE_DATE:=2020-08-25
+PKG_SOURCE_VERSION:=13319ff0b5dc3c86e8313f49fca583b829878736
+PKG_MIRROR_HASH:=4a082f9c5ee26fea1eb2f86382b9db4aecec268c918f43e9a0729a0433e262da
 
 # Build the 5.4 ath10k-ct driver version.  Other option is "-4.19".
 # Probably this should match as closely as
diff --git a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
index 4e88c8a19f..b913bbdc82 100644
--- a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
+++ b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch
@@ -11,7 +11,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
 
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -6793,6 +6793,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6796,6 +6796,7 @@ static void ath10k_bss_info_changed(stru
  			   "mac vdev %d mcast_rate %x\n",
  			   arvif->vdev_id, rate);
  
@@ -19,7 +19,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->mcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6801,6 +6802,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6804,6 +6805,7 @@ static void ath10k_bss_info_changed(stru
  				    "failed to set mcast rate on vdev %i: %d\n",
  				    arvif->vdev_id,  ret);
  
@@ -27,7 +27,7 @@ Signed-off-by: Sven Eckelmann <sven at narfation.org>
  		vdev_param = ar->wmi.vdev_param->bcast_data_rate;
  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
  						vdev_param, rate);
-@@ -6827,6 +6829,7 @@ static void ath10k_bss_info_changed(stru
+@@ -6830,6 +6832,7 @@ static void ath10k_bss_info_changed(stru
  			return;
  		}
  
diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
index 15343abd5f..5291732f25 100644
--- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
+++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
@@ -396,7 +396,7 @@ v13:
  /* Rates */
 --- a/ath10k-5.4/wmi-ops.h
 +++ b/ath10k-5.4/wmi-ops.h
-@@ -218,7 +218,10 @@ struct wmi_ops {
+@@ -219,7 +219,10 @@ struct wmi_ops {
  	struct sk_buff *(*gen_bb_timing)
  			(struct ath10k *ar,
  			 const struct wmi_bb_timing_cfg_arg *arg);
@@ -407,7 +407,7 @@ v13:
  };
  
  int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
-@@ -1105,6 +1108,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
+@@ -1115,6 +1118,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
  }
  
@@ -445,7 +445,7 @@ v13:
  {
 --- a/ath10k-5.4/wmi-tlv.c
 +++ b/ath10k-5.4/wmi-tlv.c
-@@ -4367,6 +4367,8 @@ static const struct wmi_ops wmi_tlv_ops
+@@ -4382,6 +4382,8 @@ static const struct wmi_ops wmi_tlv_ops
  	.gen_echo = ath10k_wmi_tlv_op_gen_echo,
  	.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
  	.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
index dd35e2937c..838158c7e0 100644
--- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
+++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch
@@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin <dev at kresin.me>
  	if (ret)
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -10383,7 +10383,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10386,7 +10386,7 @@ int ath10k_mac_register(struct ath10k *a
  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
  
  #ifdef CPTCFG_MAC80211_LEDS
diff --git a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
index 33d69e7975..09dd13e9a4 100644
--- a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
+++ b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch
@@ -1,6 +1,6 @@
 --- a/ath10k-5.4/mac.c
 +++ b/ath10k-5.4/mac.c
-@@ -10182,6 +10182,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10185,6 +10185,7 @@ int ath10k_mac_register(struct ath10k *a
  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
  	wiphy_ext_feature_set(ar->hw->wiphy,
  			      NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-- 
2.26.2



From rosenp at gmail.com  Wed Sep  2 17:24:15 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Wed,  2 Sep 2020 14:24:15 -0700
Subject: [PATCH] uClibc-ng: update to 1.0.35
Message-ID: <20200902212415.391580-1-rosenp@gmail.com>

Fixes compilation with iproute2-full by adding open__to_handle_at.

Switched to HTTPS for download URL.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 toolchain/uClibc/common.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/toolchain/uClibc/common.mk b/toolchain/uClibc/common.mk
index bb093b1dc7..1bd72b482c 100644
--- a/toolchain/uClibc/common.mk
+++ b/toolchain/uClibc/common.mk
@@ -7,17 +7,17 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/target.mk
 
-PKG_VERSION:=1.0.34
+PKG_VERSION:=1.0.35
 PKG_RELEASE:=1
 
 PKG_NAME:=uClibc-ng
-PKG_SOURCE_URL = http://downloads.uclibc-ng.org/releases/$(PKG_VERSION)/
+PKG_SOURCE_URL = https://downloads.uclibc-ng.org/releases/$(PKG_VERSION)/
 PATCH_DIR:=$(PATH_PREFIX)/patches
 CONFIG_DIR:=$(PATH_PREFIX)/config
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 LIBC_SO_VERSION:=$(PKG_VERSION)
 
-PKG_HASH:=e6776229eee8d3f5a1cd29fb4286630e3cb9e97dded4e8f4a3a9bb4fa8c0d5e3
+PKG_HASH:=4d0ee138f037017695a66b556b70f77a0eab8a238819bcb60af890b7b3382a2b
 
 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
 
-- 
2.26.2



From rosenp at gmail.com  Wed Sep  2 17:25:19 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Wed,  2 Sep 2020 14:25:19 -0700
Subject: [PATCH] policycoreutils: add nls.mk
Message-ID: <20200902212519.395282-1-rosenp@gmail.com>

Fixes compilation under uClibc-ng.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/utils/policycoreutils/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/utils/policycoreutils/Makefile b/package/utils/policycoreutils/Makefile
index 0cebec7ece..34c186e62e 100644
--- a/package/utils/policycoreutils/Makefile
+++ b/package/utils/policycoreutils/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=policycoreutils
 PKG_VERSION:=3.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710
@@ -22,6 +22,7 @@ PKG_LICENSE:=GPL-2.0-or-later
 PKG_LICENSE_FILES:=COPYING
 
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
 
 define Package/policycoreutils
   SECTION:=utils
-- 
2.26.2



From gch981213 at gmail.com  Wed Sep  2 21:22:18 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Thu, 3 Sep 2020 09:22:18 +0800
Subject: [PATCH 1/3] ramips: lzma-loader: make FLASH_START configurable
In-Reply-To: <018a01d6814b$02edaf70$08c90e50$@adrianschmutzler.de>
References: <20200902062231.2238353-1-gch981213@gmail.com>
 <20200902062231.2238353-2-gch981213@gmail.com>
 <018a01d6814b$02edaf70$08c90e50$@adrianschmutzler.de>
Message-ID: <CAJsYDVLkT3oq4gCdocOcUt50qM+E1MfL+42kKqVhXChasnFdPQ@mail.gmail.com>

Hi!

On Thu, Sep 3, 2020 at 1:03 AM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
> > --- a/target/linux/ramips/image/lzma-loader/src/loader.c
> > +++ b/target/linux/ramips/image/lzma-loader/src/loader.c
> > @@ -28,9 +28,6 @@
> >  #include "printf.h"
> >  #include "LzmaDecode.h"
> >
> > -#define AR71XX_FLASH_START   0x1f000000
> > -#define AR71XX_FLASH_END     0x1fe00000
> > -
>
> Am I understanding this right, that if FLASH_START is not defined and set in ramips/image/Makefile, then compilation will fail here as the CONFIG_FLASH_START symbol is not defined?

That's my intention. It'll actually fail...

> >  #define KSEG0                        0x80000000
> >  #define KSEG1                        0xa0000000
> >
> > @@ -178,7 +175,7 @@ static void lzma_init_data(void)
> >       unsigned long kernel_ofs;
> >       unsigned long kernel_size;
> >
> > -     flash_base = (unsigned char *) KSEG1ADDR(AR71XX_FLASH_START);
> > +     flash_base = (unsigned char *) KSEG1ADDR(CONFIG_FLASH_START);

...here. It'll fail if CONFIG_FLASH_START isn't defined and no lzma
blob is provided.

-- 
Regards,
Chuanhong Guo


From gch981213 at gmail.com  Wed Sep  2 21:27:29 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Thu, 3 Sep 2020 09:27:29 +0800
Subject: [PATCH 0/3] ramips: fix OKLI lzma-loader
In-Reply-To: <017f01d6814a$8f5edc50$ae1c94f0$@adrianschmutzler.de>
References: <20200902062231.2238353-1-gch981213@gmail.com>
 <017f01d6814a$8f5edc50$ae1c94f0$@adrianschmutzler.de>
Message-ID: <CAJsYDVLfL94dP0KQgWQOeXLLEGMxgJnA5TcFuasCw12-iqxovg@mail.gmail.com>

Hi!

On Thu, Sep 3, 2020 at 1:00 AM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
> Thanks for taking care of that. In case you haven't read already, I have tidied up/rebased the Hootoo PR onto these changes here:
> https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/hootoo
>
> Those are tested by the author now.
>
> Depending on what you prefer, I'd either wait for you to merge your two commits and then push the final one, or just merge all three myself.

Feel free to merge all 3 patches :)

-- 
Regards,
Chuanhong Guo


From rayknight at me.com  Wed Sep  2 21:30:27 2020
From: rayknight at me.com (Raylynn Knight)
Date: Wed, 2 Sep 2020 21:30:27 -0400
Subject: No subject
In-Reply-To: <8aeb5b4f-64a5-9670-59fa-54da85f3497a@gmail.com>
References: <mailman.1099.1598152001.939.openwrt-devel@lists.openwrt.org>
 <8aeb5b4f-64a5-9670-59fa-54da85f3497a@gmail.com>
Message-ID: <ADC92D3D-34AB-4522-BF37-AE71C19A4EE9@me.com>


> On Aug 25, 2020, at 6:24 AM, Alberto Bursi <bobafetthotmail at gmail.com> wrote:
> 
> 
> On 23/08/20 05:06, Raylynn Knight via openwrt-devel wrote:
>> 1.  Should I add each device individually?  Even if some of the devices are very closely related.
> 
> yes, add one device for each commit because it's easier to review, although you should use common dts files for features that are the same, like I did for zyxel NSA310/NSA325
> 
> 
>> 2.  Like many of the already supported kirkwood devices updating to a more current version of u-boot would make supporting openwrt simpler.   I see that some of the existing devices have patches under package/boot/uboot-kirkwood/patches in the tree.  I can?t seem to locate any documentation indicating the procedures for adding u-boot support in that location.  The Makefile a directory above the patches indicates PKG_VERSION 2020.04.  Does this mean I should create my patches against u-boot version 2020.04?   If adding devices already supported by mainstream u-boot do I just add to that Makefile?   If adding devices currently unsupported by upstream u-boot is it required to submit a patch upstream as well?
> 
> the u-boot is handled like a package, if it is not already available upstream you need to add a patch for each device you want to support, and you must always add an entry in the makefile.
> 
> If some devices are supported by upstream uboot you will probably still want to add a small patch to change default boot envs so it can boot OpenWrt, like you see other patches do in that folder.
> 
> The uboot version is 2020.04
> 
Thanks for your response Alberto.  I?ve been busy the last couple of weeks as I was on call with my employer, but now that my rotation is over I have time to get back to this.  I?ve started with support for my first device which I chose because I though it would be the simplest for my first contribution.  I have the ZyXel NSA320 which is already supported in the Linux kernel and u-boot patches are available from bodi at the https://forum.doozan.com where a lot of kirkwood device support exists.   

At this point I?m struggling with workflow based on how OpenWrt uses patches for u-boot and kernel changes.   Do I take the u-boot 2020.04 tag, apply the existing OpenWrt u-boot patches, make my additions and then create patch files from the result which would be added to the package/boot/uboot-kirkwood/patches/ directory of my branch of the OpenWrt trunk?  If this is the correct workflow for u-boot changes do I then take a similar path using the 5.4 linux kernel for kernel patches?


> Upstreaming the change to uboot is welcome, but it does not seem mandatory, at least none enforced that on me when I added uboot patches for NSA310/325 and PogoPlugV4
> 
>> 3.  Is there an existing supported device that would be a good model for me to follow when adding additional devices?
>> 
> If you want to provide an uboot and place the kernel in the UBI partition, you can look at my commits where I added Zyxel NSA310b, NSA325 and PogoPlug V4.

Since I chose the ZyXel NSA320 as my first device I think it best to follow your example for consistency on the ZyXel NAS devices.  My follow up support will likely be for the 3 different Netgear NAS devices I have.

> If you want to use stock uboot and place the kernel in the place where stock firmware has the kernel, you can look at commit that added support for "cisco on100".
> 
> -Alberto
> 
Ray



From paweldembicki at gmail.com  Thu Sep  3 02:12:37 2020
From: paweldembicki at gmail.com (=?UTF-8?Q?Pawe=C5=82_Dembicki?=)
Date: Thu, 3 Sep 2020 08:12:37 +0200
Subject: No subject
In-Reply-To: <mailman.1064.1599096636.1274.openwrt-devel@lists.openwrt.org>
References: <mailman.1099.1598152001.939.openwrt-devel@lists.openwrt.org>
 <8aeb5b4f-64a5-9670-59fa-54da85f3497a@gmail.com>
 <mailman.1064.1599096636.1274.openwrt-devel@lists.openwrt.org>
Message-ID: <CAJN1Kkw1VOyv_BTs4ewAUbz1wC348tPpPumiU+iQT6Rqx92rZg@mail.gmail.com>

On 03.09.2020 at 03:35 Raylynn Knight via openwrt-devel
<openwrt-devel at lists.openwrt.org> wrote:

>
> Since I chose the ZyXel NSA320 as my first device I think it best to follow your example for consistency on the ZyXel NAS devices.  My follow up support will likely be for the 3 different Netgear NAS devices I have.
>

If you have NETGEAR ReadyNAS Duo v2, please look my and test PR:
https://github.com/openwrt/openwrt/pull/3371

Pawel Dembicki


From russell at personaltelco.net  Thu Sep  3 05:07:42 2020
From: russell at personaltelco.net (Russell Senior)
Date: Thu, 03 Sep 2020 02:07:42 -0700
Subject: MR24 wifi broken by recent commit
Message-ID: <87eenjw7mp.fsf@husum.ptp>


commit 9153955095f01a7ac5f2659a671f0229cbad3507
Author: Christian Lamparter <chunkeey at gmail.com>
Date:   Wed Aug 12 18:26:43 2020 +0200

    apm821xx: MR24: enumerate PCIe in device-tree

    This patch adds the pcie-switch and bridge configuration for
        the Meraki MR24.

    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>

The symptom is client devices can't see the beacons. Wifi ifaces appear,
can scan and hear other networks, but clients can't see the MR24's
SSIDs. Reverting the commit above and it works normally again.


-- 
Russell Senior, President
russell at personaltelco.net


From mail at adrianschmutzler.de  Thu Sep  3 09:36:20 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Thu, 3 Sep 2020 15:36:20 +0200
Subject: [PATCH] scripts: add size_compare.sh
In-Reply-To: <20200731031441.767974-1-mail@aparcar.org>
References: <20200731031441.767974-1-mail@aparcar.org>
Message-ID: <012e01d681f7$35b33310$a1199930$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Paul Spooren
> Sent: Freitag, 31. Juli 2020 05:15
> To: openwrt-devel at lists.openwrt.org
> Cc: freifunk at adrianschmutzler.de; Paul Spooren <mail at aparcar.org>
> Subject: [PATCH] scripts: add size_compare.sh
> 
> As package size changes are a continuous topic on the mailing list this scripts
> helps developers to compare their local package modifications against latest
> upstream.
> 
> The script downloads the latest package indexes based on env variables or
> the `.config` file. The script compares the actual installed size
> (data.tar.gz) or the IPK package size.

Just gave this a quick try, and generally it looks good.

However, I got 82 packages listed for " Compare packages of ath79/generic/mips_24kc", but only 66 were in the final comparison.

Will check the code in detail later. A few comment below.

> 
> An example output is found below:
> 
> ```
> user at dawn:~/src/openwrt/openwrt$ ./scripts/size_compare.sh Compare
> packages of ath79/tiny/mips_24kc:
> dropbear busybox iw ubus
> 
> Checking installed size
> 
> Fetching latest package indexes...
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100 80634  100 80634    0     0  33499      0  0:00:02  0:00:02 --:--:-- 33485
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100 54082  100 54082    0     0  24252      0  0:00:02  0:00:02 --:--:-- 24252
> 
> Comparing package sizes...
> Change 	Local 	Package
> 611B	208715B	busybox
> 39B	5612B	ubus
> -42B	34940B	iw
> -14916B	89265B	dropbear
> ```
> 
> I plan to integrate this script into the CI so we have a summary how sizes
> change over different architectures.
> 
> Signed-off-by: Paul Spooren <mail at aparcar.org>
> ---
>  scripts/size_compare.sh | 117
> ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 117 insertions(+)
>  create mode 100755 scripts/size_compare.sh
> 
> diff --git a/scripts/size_compare.sh b/scripts/size_compare.sh new file mode
> 100755 index 0000000000..b310a085a4
> --- /dev/null
> +++ b/scripts/size_compare.sh
> @@ -0,0 +1,117 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later # # Copyright (C) 2020 Paul
> +Spooren <mail at aparcar.org> # ### ### size_compare - compare size of
> +OpenWrt packages against upstream ### ### The script compares locally
> +compiled package with the package indexes ### available upstream. This
> +way the storage impact of optimizations or ### feature modifiactions is
> +easy to see.
> +###
> +### If no environmental variables are set the scritp reads the current
> +### .config file. The evaluated env variables are the following:
> +###
> +###   TARGET SUBTARGET ARCH PACKAGES BIN_DIR BASE_URL
> CHECK_INSTALLED
> +###
> +### Usage:
> +###   ./scripts/size_compare.sh
> +###
> +### Options:
> +###   -p --package-size 	Check IPK package size and not installed size
> +###   -h --help 		This message
> +
> +CONFIG_TARGET=$(sed -n 's/^CONFIG_TARGET_BOARD="\(.*\)"$/\1/p'
> .config)
> +CONFIG_SUBTARGET=$(sed -n
> 's/^CONFIG_TARGET_SUBTARGET="\(.*\)"$/\1/p'
> +.config) CONFIG_ARCH=$(sed -n
> +'s/^CONFIG_TARGET_ARCH_PACKAGES="\(.*\)"$/\1/p' .config)
> +CONFIG_PACKAGES=$(sed -n 's/^CONFIG_PACKAGE_\(.*\)=y$/\1/p'
> .config |
> +tr '\n' ' ') CONFIG_BIN_DIR=$(sed -n
> +'s/^CONFIG_BINARY_DIR="\(.*\)"$/\1/p' .config)
> +
> +TARGET=${TARGET:-$CONFIG_TARGET}
> +SUBTARGET=${SUBTARGET:-$CONFIG_SUBTARGET}
> +ARCH=${ARCH:-$CONFIG_ARCH}
> +PACKAGES=${PACKAGES:-$CONFIG_PACKAGES}
> +BIN_DIR=${CONFIG_BIN_DIR:-./bin}
> +BASE_URL="${BASE_URL:-https://downloads.openwrt.org/snapshots}"
> +CHECK_INSTALLED="${CHECK_INSTALLED:-y}"
> +
> +TARGET_URL="$BASE_URL/targets/$TARGET/$SUBTARGET/packages/Pack
> ages.gz"
> +PACKAGES_URL="$BASE_URL/packages/$ARCH/base/Packages.gz"
> +
> +help() {
> +    sed -rn 's/^### ?//;T;p' "$0"
> +}
> +
> +package_size () {
> +	FOUND_PACKAGE=
> +	if [ -z "$CHECK_INSTALLED" ]; then
> +		SEARCH_PATTERN="Size"
> +	else
> +		SEARCH_PATTERN="Installed-Size"
> +	fi
> +	while IFS= read -r line; do
> +		if [ "$line" = "Package: $2" ]; then
> +			FOUND_PACKAGE=y
> +		fi
> +		if [ -n "$FOUND_PACKAGE" ]; then
> +			case $line in
> +				"$SEARCH_PATTERN"*)
> +					echo "$line" | cut -d ' ' -f 2
> +					break
> +					;;
> +			esac
> +		fi
> +	done < "$1"
> +}
> +
> +compare_sizes () {
> +	for PACKAGE in $PACKAGES; do
> +		if [ "$PACKAGE" = "libc" ]; then
> +			continue
> +		fi
> +		PACKAGE_FILE=$(find "$BIN_DIR/packages/$ARCH/"
> "$BIN_DIR/targets/$TARGET/$SUBTARGET/" -name "${PACKAGE}_*.ipk")

When I first run this, I was in x86 target where only a kernel refresh has happened before (so, no build).
This then produces a lot of warning due to missing packages folder:

find: ?./bin/targets/x86/generic/?: No such file or directory
find: ?./bin/packages/i386_pentium4/?: No such file or directory

So, one should either suppress the message here for the find command, or alternatively check for the folders' existence beforehand.

> +		if [ -z "$PACKAGE_FILE" ]; then
> +			continue
> +		fi
> +		if [ -z "$CHECK_INSTALLED" ]; then
> +			SIZE_LOCAL=$(stat -c '%s' "$PACKAGE_FILE")
> +		else
> +			SIZE_LOCAL=$(tar tzvf "$PACKAGE_FILE" | grep
> data.tar.gz | awk '{ print $3 }')
> +		fi
> +		SIZE_UPSTREAM=$(package_size "$TMP_INDEX"
> "$PACKAGE")
> +		SIZE_DIFF="$((SIZE_LOCAL-SIZE_UPSTREAM))"
> +		echo "${SIZE_DIFF}B	${SIZE_LOCAL}B	$PACKAGE"

Personally, I think the "B" looks ugly. As we only have bytes, we could consider to drop it.
One could also consider to add a "+" for the first column when change is positive. Both changes here are lowest priority.

> +	done
> +}
> +
> +if [ "$1" = "-h" ]; then
> +    help
> +    exit 0
> +fi
> +
> +if [ "$1" = "-p" ]; then
> +    CHECK_INSTALLED=
> +fi
> +
> +echo "Compare packages of $TARGET/$SUBTARGET/$ARCH":
> +echo "$PACKAGES"
> +echo
> +
> +if [ -z "$CHECK_INSTALLED" ]; then
> +	echo "Checking IPK package size"
> +else
> +	echo "Checking installed size"
> +fi
> +echo
> +
> +echo "Fetching latest package indexes..."
> +TMP_INDEX=$(mktemp /tmp/size_compare_package_index.XXXXXX)
> +curl "$TARGET_URL" | gzip -d > "$TMP_INDEX" || exit 1 curl
> +"$PACKAGES_URL" | gzip -d >> "$TMP_INDEX" || exit 1 echo
> +
> +echo "Comparing package sizes..."
> +echo "Change 	Local 	Package"

Since we have enough space, I'd go for "Change  Local  Remote  Package" here.

Best

Adrian

> +compare_sizes | sort -n -r
> +
> +rm "$TMP_INDEX"
> --
> 2.25.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200903/a18e0775/attachment.sig>

From a.heider at gmail.com  Thu Sep  3 11:49:48 2020
From: a.heider at gmail.com (Andre Heider)
Date: Thu, 3 Sep 2020 17:49:48 +0200
Subject: [PATCH v2 1/2] rules.mk: remove redundant -I/-L
In-Reply-To: <20200826061503.454068-1-a.heider@gmail.com>
References: <20200826061503.454068-1-a.heider@gmail.com>
Message-ID: <2ea77812-78f5-aaf1-ed9a-436301786ea0@gmail.com>

Hi Jo,

On 26/08/2020 08:15, Andre Heider wrote:
> $STAGING_DIR/usr/{include,lib} are already added using the gcc specs file, see
> scripts/patch-specs.sh
> 
> $STAGING_DIR/lib is unused and seems to be a leftover from
> 1f0063b5 "rules.mk: remove "$(STAGING_DIR)/include""
> 
> Signed-off-by: Andre Heider <a.heider at gmail.com>

do these two patches look acceptable now?

Thanks,
Andre

> ---
>   rules.mk | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/rules.mk b/rules.mk
> index 45d96d6be4..a6615647f9 100644
> --- a/rules.mk
> +++ b/rules.mk
> @@ -174,8 +174,8 @@ TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) $(call qstrip,$(
>   TARGET_CXXFLAGS = $(TARGET_CFLAGS)
>   TARGET_ASFLAGS_DEFAULT = $(TARGET_CFLAGS)
>   TARGET_ASFLAGS = $(TARGET_ASFLAGS_DEFAULT)
> -TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include
> -TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
> +TARGET_CPPFLAGS:=
> +TARGET_LDFLAGS:=
>   ifneq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
>   LIBGCC_S_PATH=$(realpath $(wildcard $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC))))
>   LIBGCC_S=$(if $(LIBGCC_S_PATH),-L$(dir $(LIBGCC_S_PATH)) -lgcc_s)
> 



From baptiste at bitsofnetworks.org  Thu Sep  3 13:14:18 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu, 3 Sep 2020 19:14:18 +0200
Subject: [PATCH 19.07 7/8] ath10k-ct-firmware: add htt-mgt variants
In-Reply-To: <20200825212510.509763-7-baptiste@bitsofnetworks.org>
References: <20200825212510.509763-1-baptiste@bitsofnetworks.org>
 <20200825212510.509763-7-baptiste@bitsofnetworks.org>
Message-ID: <20200903171418.GA644160@tuxmachine.localdomain>

Adrian pointed out a possible issue with these backpots: combining patches
5/8 and 7/8 basically mean that a different firmware variant will be
distributed in "ath10k-firmware-*-ct-htt" packages.

Currently in 19.07 the ath10k-firmware-*-ct-htt packages bundle this
firmware variant: firmware-{2,5}-ct-full-htt-mgt-community

With patch 5/8 and 7/8, the same ath10k-firmware-*-ct-htt packages would
instead bundle this firmware variant: firmware-{2,5}-ct-htt-mgt-community

The description of this new firmware variant is copied below:

    The non-full one (hence forth 'diet') compiles out a lot of firmware
    features that ath10k does not use. This saves a lot of resources and
    lets one configure more stations/vdevs/etc using fwcfg.

These HTT firmwares are not used in default openwrt images, but they could
be used downstream: it does not seem wise to distribute a different
firmware variant under the same package name.

I will send a v2 fixing this.

On 25-08-20, Baptiste Jonglez wrote:
> From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
> 
> For wave-2, there is now a new variant: htt-mgt-community (vs the old
> full-htt-mgt-community).
> 
> The non-full one (hence forth 'diet') compiles out a lot of firmware features
> that ath10k does not use. This saves a lot of resources and lets one
> configure more stations/vdevs/etc using fwcfg.
> 
> Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
> (cherry picked from commit a882bfce052e78bd344dcbd36efb32acf1340d7a)
> ---
>  package/firmware/ath10k-ct-firmware/Makefile | 155 ++++++++++++++++++-
>  1 file changed, 154 insertions(+), 1 deletion(-)
> 
> diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
> index 6a35e9c75c..18370b7d85 100644
> --- a/package/firmware/ath10k-ct-firmware/Makefile
> +++ b/package/firmware/ath10k-ct-firmware/Makefile
> @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=ath10k-ct-firmware
>  PKG_VERSION:=2020-04-24
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  include $(INCLUDE_DIR)/package.mk
>  
> @@ -75,6 +75,7 @@ $(eval $(call Download,qca9888-board2))
>  
>  CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
>  CT_FIRMWARE_FILE_FULL_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
> +CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
>  
>  define Download/ct-firmware
>    URL:=https://www.candelatech.com/downloads/$(2)
> @@ -88,6 +89,12 @@ define Download/ct-firmware-full-htt
>    URL_FILE:=$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
>  endef
>  
> +define Download/ct-firmware-htt
> +  URL:=https://www.candelatech.com/downloads/$(2)
> +  FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
> +  URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
> +endef
> +
>  QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
>  define Download/ath10k-firmware-qca988x-ct
>    $(call Download/ct-firmware,QCA988X,)
> @@ -132,6 +139,13 @@ define Download/ath10k-firmware-qca99x0-ct-full-htt
>  endef
>  $(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt))
>  
> +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
> +define Download/ath10k-firmware-qca99x0-ct-htt
> +  $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
> +  HASH:=4d4f74afca487d452f244cd48304cf9710d8941eb97a6346a949ed6b6877d657
> +endef
> +$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
> +
>  
>  QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>  define Download/ath10k-firmware-qca9984-ct
> @@ -147,6 +161,13 @@ define Download/ath10k-firmware-qca9984-ct-full-htt
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt))
>  
> +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
> +define Download/ath10k-firmware-qca9984-ct-htt
> +  $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
> +  HASH:=ee593fb5724d75c372de02ac7894e1630ee9f909fcb2e2bbf17aadef67cb9d43
> +endef
> +$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
> +
>  
>  QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>  define Download/ath10k-firmware-qca4019-ct
> @@ -162,6 +183,13 @@ define Download/ath10k-firmware-qca4019-ct-full-htt
>  endef
>  $(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt))
>  
> +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
> +define Download/ath10k-firmware-qca4019-ct-htt
> +  $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
> +  HASH:=51fe06f66365771647d16039cca8b541de3d642c45271977a4cfd433c2c5d45b
> +endef
> +$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
> +
>  
>  QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>  define Download/ath10k-firmware-qca9888-ct
> @@ -177,6 +205,13 @@ define Download/ath10k-firmware-qca9888-ct-full-htt
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt))
>  
> +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
> +define Download/ath10k-firmware-qca9888-ct-htt
> +  $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
> +  HASH:=6c692141155f5bb74c0117553d5d48ff2aaba73bd4d5e90a5044a5e2ec0faab0
> +endef
> +$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
> +
>  
>  define Package/ath10k-ct-firmware-default
>    SECTION:=firmware
> @@ -232,6 +267,14 @@ $(Package/ath10k-ct-firmware-default)
>    PROVIDES:=ath10k-firmware-qca99x0
>    DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>  endef
> +define Package/ath10k-firmware-qca99x0-ct-htt
> +$(Package/ath10k-firmware-default)
> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  PROVIDES:=ath10k-firmware-qca99x0
> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> +endef
>  
>  define Package/ath10k-firmware-qca9984-ct
>  $(Package/ath10k-ct-firmware-default)
> @@ -248,6 +291,14 @@ $(Package/ath10k-ct-firmware-default)
>    PROVIDES:=ath10k-firmware-qca9984
>    DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>  endef
> +define Package/ath10k-firmware-qca9984-ct-htt
> +$(Package/ath10k-firmware-default)
> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  PROVIDES:=ath10k-firmware-qca9984
> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> +endef
>  
>  define Package/ath10k-firmware-qca4019-ct
>  $(Package/ath10k-ct-firmware-default)
> @@ -264,6 +315,14 @@ $(Package/ath10k-ct-firmware-default)
>    PROVIDES:=ath10k-firmware-qca4019
>    DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>  endef
> +define Package/ath10k-firmware-qca4019-ct-htt
> +$(Package/ath10k-firmware-default)
> +  TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  PROVIDES:=ath10k-firmware-qca4019
> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> +endef
>  
>  define Package/ath10k-firmware-qca9888-ct
>  $(Package/ath10k-ct-firmware-default)
> @@ -280,6 +339,14 @@ $(Package/ath10k-ct-firmware-default)
>    PROVIDES:=ath10k-firmware-qca9888
>    DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>  endef
> +define Package/ath10k-firmware-qca9888-ct-htt
> +$(Package/ath10k-firmware-default)
> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  PROVIDES:=ath10k-firmware-qca9888
> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> +endef
>  
>  
>  define Package/ath10k-firmware-qca9887-ct/description
> @@ -330,6 +397,16 @@ Enables IBSS and other features.  See:
>  http://www.candelatech.com/ath10k-10.4.php
>  This firmware selects and requires the ath10k-ct driver.
>  endef
> +define Package/ath10k-firmware-qca99x0-ct-htt/description
> +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
> +Uses normal HTT TX data path for management frames, which improves
> +stability in busy networks and may be required for .11r authentication.
> +This firmware lacks a lot of features that ath10k does not use, saving
> +a lot of resources.
> +Enables IBSS and other features.  See:
> +http://www.candelatech.com/ath10k-10.4.php
> +This firmware selects and requires the ath10k-ct driver.
> +endef
>  
>  define Package/ath10k-firmware-qca9984-ct/description
>  Alternative ath10k firmware for QCA9984 from Candela Technologies.
> @@ -346,6 +423,16 @@ Enables IBSS and other features.  See:
>  http://www.candelatech.com/ath10k-10.4.php
>  This firmware selects and requires the ath10k-ct driver.
>  endef
> +define Package/ath10k-firmware-qca9984-ct-htt/description
> +Alternative ath10k firmware for QCA9984 from Candela Technologies.
> +Uses normal HTT TX data path for management frames, which improves
> +stability in busy networks and may be required for .11r authentication.
> +This firmware lacks a lot of features that ath10k does not use, saving
> +a lot of resources.
> +Enables IBSS and other features.  See:
> +http://www.candelatech.com/ath10k-10.4.php
> +This firmware selects and requires the ath10k-ct driver.
> +endef
>  
>  define Package/ath10k-firmware-qca4019-ct/description
>  Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
> @@ -360,6 +447,16 @@ Enables IBSS and other features.
>  See:  http://www.candelatech.com/ath10k-10.4.php
>  This firmware selects and requires the ath10k-ct driver.
>  endef
> +define Package/ath10k-firmware-qca4019-ct-htt/description
> +Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
> +Uses normal HTT TX data path for management frames, which improves
> +stability in busy networks and may be required for .11r authentication.
> +This firmware lacks a lot of features that ath10k does not use, saving
> +a lot of resources.
> +Enables IBSS and other features.
> +See:  http://www.candelatech.com/ath10k-10.4.php
> +This firmware selects and requires the ath10k-ct driver.
> +endef
>  
>  define Package/ath10k-firmware-qca9888-ct/description
>  Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
> @@ -376,6 +473,16 @@ Enables IBSS and other features.  See:
>  http://www.candelatech.com/ath10k-10.4.php
>  This firmware selects and requires the ath10k-ct driver.
>  endef
> +define Package/ath10k-firmware-qca9888-ct-htt/description
> +Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
> +Uses normal HTT TX data path for management frames, which improves
> +stability in busy networks and may be required for .11r authentication.
> +This firmware lacks a lot of features that ath10k does not use, saving
> +a lot of resources.
> +Enables IBSS and other features.  See:
> +http://www.candelatech.com/ath10k-10.4.php
> +This firmware selects and requires the ath10k-ct driver.
> +endef
>  
>  
>  define Build/Compile
> @@ -445,6 +552,18 @@ define Package/ath10k-firmware-qca99x0-ct-full-htt/install
>  		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA99X0) \
>  		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
>  endef
> +define Package/ath10k-firmware-qca99x0-ct-htt/install
> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
> +endef
>  
>  define Package/ath10k-firmware-qca9984-ct/install
>  	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
> @@ -464,6 +583,15 @@ define Package/ath10k-firmware-qca9984-ct-full-htt/install
>  		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9984) \
>  		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
>  endef
> +define Package/ath10k-firmware-qca9984-ct-htt/install
> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
> +endef
>  
>  define Package/ath10k-firmware-qca4019-ct/install
>  	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
> @@ -483,6 +611,15 @@ define Package/ath10k-firmware-qca4019-ct-full-htt/install
>  		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA4019) \
>  		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
>  endef
> +define Package/ath10k-firmware-qca4019-ct-htt/install
> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
> +endef
>  
>  define Package/ath10k-firmware-qca9888-ct/install
>  	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
> @@ -508,6 +645,18 @@ define Package/ath10k-firmware-qca9888-ct-full-htt/install
>  		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9888) \
>  		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
>  endef
> +define Package/ath10k-firmware-qca9888-ct-htt/install
> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
> +	ln -s \
> +		../../cal-pci-0000:01:00.0.bin \
> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
> +	$(INSTALL_DATA) \
> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
> +endef
>  
>  
>  $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
> @@ -516,9 +665,13 @@ $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
>  $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-full-htt))
>  $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
>  $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-full-htt))
> +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
>  $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
>  $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-full-htt))
> +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
>  $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
>  $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-full-htt))
> +$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
>  $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
>  $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-full-htt))
> +$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200903/5b29c51a/attachment.sig>

From greearb at candelatech.com  Thu Sep  3 13:31:38 2020
From: greearb at candelatech.com (Ben Greear)
Date: Thu, 3 Sep 2020 10:31:38 -0700
Subject: [PATCH 19.07 7/8] ath10k-ct-firmware: add htt-mgt variants
In-Reply-To: <20200903171418.GA644160@tuxmachine.localdomain>
References: <20200825212510.509763-1-baptiste@bitsofnetworks.org>
 <20200825212510.509763-7-baptiste@bitsofnetworks.org>
 <20200903171418.GA644160@tuxmachine.localdomain>
Message-ID: <8bb1bf66-c4e6-cc57-0ee0-4c94ee567c1c@candelatech.com>

On 9/3/20 10:14 AM, Baptiste Jonglez wrote:
> Adrian pointed out a possible issue with these backpots: combining patches
> 5/8 and 7/8 basically mean that a different firmware variant will be
> distributed in "ath10k-firmware-*-ct-htt" packages.
> 
> Currently in 19.07 the ath10k-firmware-*-ct-htt packages bundle this
> firmware variant: firmware-{2,5}-ct-full-htt-mgt-community
> 
> With patch 5/8 and 7/8, the same ath10k-firmware-*-ct-htt packages would
> instead bundle this firmware variant: firmware-{2,5}-ct-htt-mgt-community
> 
> The description of this new firmware variant is copied below:
> 
>      The non-full one (hence forth 'diet') compiles out a lot of firmware
>      features that ath10k does not use. This saves a lot of resources and
>      lets one configure more stations/vdevs/etc using fwcfg.
> 
> These HTT firmwares are not used in default openwrt images, but they could
> be used downstream: it does not seem wise to distribute a different
> firmware variant under the same package name.

Those compiled out features are not used by any ath10k driver as far as I know.
If the driver doesn't use it, I don't see how anything else could...

Its still worth testing, but I think that diet variant is probably the best choice.

Thanks,
Ben

> 
> I will send a v2 fixing this.
> 
> On 25-08-20, Baptiste Jonglez wrote:
>> From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
>>
>> For wave-2, there is now a new variant: htt-mgt-community (vs the old
>> full-htt-mgt-community).
>>
>> The non-full one (hence forth 'diet') compiles out a lot of firmware features
>> that ath10k does not use. This saves a lot of resources and lets one
>> configure more stations/vdevs/etc using fwcfg.
>>
>> Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
>> (cherry picked from commit a882bfce052e78bd344dcbd36efb32acf1340d7a)
>> ---
>>   package/firmware/ath10k-ct-firmware/Makefile | 155 ++++++++++++++++++-
>>   1 file changed, 154 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
>> index 6a35e9c75c..18370b7d85 100644
>> --- a/package/firmware/ath10k-ct-firmware/Makefile
>> +++ b/package/firmware/ath10k-ct-firmware/Makefile
>> @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
>>   
>>   PKG_NAME:=ath10k-ct-firmware
>>   PKG_VERSION:=2020-04-24
>> -PKG_RELEASE:=1
>> +PKG_RELEASE:=2
>>   
>>   include $(INCLUDE_DIR)/package.mk
>>   
>> @@ -75,6 +75,7 @@ $(eval $(call Download,qca9888-board2))
>>   
>>   CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
>>   CT_FIRMWARE_FILE_FULL_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
>> +CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
>>   
>>   define Download/ct-firmware
>>     URL:=https://www.candelatech.com/downloads/$(2)
>> @@ -88,6 +89,12 @@ define Download/ct-firmware-full-htt
>>     URL_FILE:=$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
>>   endef
>>   
>> +define Download/ct-firmware-htt
>> +  URL:=https://www.candelatech.com/downloads/$(2)
>> +  FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
>> +  URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
>> +endef
>> +
>>   QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
>>   define Download/ath10k-firmware-qca988x-ct
>>     $(call Download/ct-firmware,QCA988X,)
>> @@ -132,6 +139,13 @@ define Download/ath10k-firmware-qca99x0-ct-full-htt
>>   endef
>>   $(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt))
>>   
>> +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
>> +define Download/ath10k-firmware-qca99x0-ct-htt
>> +  $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
>> +  HASH:=4d4f74afca487d452f244cd48304cf9710d8941eb97a6346a949ed6b6877d657
>> +endef
>> +$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
>> +
>>   
>>   QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>>   define Download/ath10k-firmware-qca9984-ct
>> @@ -147,6 +161,13 @@ define Download/ath10k-firmware-qca9984-ct-full-htt
>>   endef
>>   $(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt))
>>   
>> +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
>> +define Download/ath10k-firmware-qca9984-ct-htt
>> +  $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
>> +  HASH:=ee593fb5724d75c372de02ac7894e1630ee9f909fcb2e2bbf17aadef67cb9d43
>> +endef
>> +$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
>> +
>>   
>>   QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>>   define Download/ath10k-firmware-qca4019-ct
>> @@ -162,6 +183,13 @@ define Download/ath10k-firmware-qca4019-ct-full-htt
>>   endef
>>   $(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt))
>>   
>> +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
>> +define Download/ath10k-firmware-qca4019-ct-htt
>> +  $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
>> +  HASH:=51fe06f66365771647d16039cca8b541de3d642c45271977a4cfd433c2c5d45b
>> +endef
>> +$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
>> +
>>   
>>   QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
>>   define Download/ath10k-firmware-qca9888-ct
>> @@ -177,6 +205,13 @@ define Download/ath10k-firmware-qca9888-ct-full-htt
>>   endef
>>   $(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt))
>>   
>> +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.018
>> +define Download/ath10k-firmware-qca9888-ct-htt
>> +  $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
>> +  HASH:=6c692141155f5bb74c0117553d5d48ff2aaba73bd4d5e90a5044a5e2ec0faab0
>> +endef
>> +$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
>> +
>>   
>>   define Package/ath10k-ct-firmware-default
>>     SECTION:=firmware
>> @@ -232,6 +267,14 @@ $(Package/ath10k-ct-firmware-default)
>>     PROVIDES:=ath10k-firmware-qca99x0
>>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>>   endef
>> +define Package/ath10k-firmware-qca99x0-ct-htt
>> +$(Package/ath10k-firmware-default)
>> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
>> +  SECTION:=firmware
>> +  CATEGORY:=Firmware
>> +  PROVIDES:=ath10k-firmware-qca99x0
>> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9984-ct
>>   $(Package/ath10k-ct-firmware-default)
>> @@ -248,6 +291,14 @@ $(Package/ath10k-ct-firmware-default)
>>     PROVIDES:=ath10k-firmware-qca9984
>>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>>   endef
>> +define Package/ath10k-firmware-qca9984-ct-htt
>> +$(Package/ath10k-firmware-default)
>> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
>> +  SECTION:=firmware
>> +  CATEGORY:=Firmware
>> +  PROVIDES:=ath10k-firmware-qca9984
>> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>> +endef
>>   
>>   define Package/ath10k-firmware-qca4019-ct
>>   $(Package/ath10k-ct-firmware-default)
>> @@ -264,6 +315,14 @@ $(Package/ath10k-ct-firmware-default)
>>     PROVIDES:=ath10k-firmware-qca4019
>>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>>   endef
>> +define Package/ath10k-firmware-qca4019-ct-htt
>> +$(Package/ath10k-firmware-default)
>> +  TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
>> +  SECTION:=firmware
>> +  CATEGORY:=Firmware
>> +  PROVIDES:=ath10k-firmware-qca4019
>> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9888-ct
>>   $(Package/ath10k-ct-firmware-default)
>> @@ -280,6 +339,14 @@ $(Package/ath10k-ct-firmware-default)
>>     PROVIDES:=ath10k-firmware-qca9888
>>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>>   endef
>> +define Package/ath10k-firmware-qca9888-ct-htt
>> +$(Package/ath10k-firmware-default)
>> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
>> +  SECTION:=firmware
>> +  CATEGORY:=Firmware
>> +  PROVIDES:=ath10k-firmware-qca9888
>> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
>> +endef
>>   
>>   
>>   define Package/ath10k-firmware-qca9887-ct/description
>> @@ -330,6 +397,16 @@ Enables IBSS and other features.  See:
>>   http://www.candelatech.com/ath10k-10.4.php
>>   This firmware selects and requires the ath10k-ct driver.
>>   endef
>> +define Package/ath10k-firmware-qca99x0-ct-htt/description
>> +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
>> +Uses normal HTT TX data path for management frames, which improves
>> +stability in busy networks and may be required for .11r authentication.
>> +This firmware lacks a lot of features that ath10k does not use, saving
>> +a lot of resources.
>> +Enables IBSS and other features.  See:
>> +http://www.candelatech.com/ath10k-10.4.php
>> +This firmware selects and requires the ath10k-ct driver.
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9984-ct/description
>>   Alternative ath10k firmware for QCA9984 from Candela Technologies.
>> @@ -346,6 +423,16 @@ Enables IBSS and other features.  See:
>>   http://www.candelatech.com/ath10k-10.4.php
>>   This firmware selects and requires the ath10k-ct driver.
>>   endef
>> +define Package/ath10k-firmware-qca9984-ct-htt/description
>> +Alternative ath10k firmware for QCA9984 from Candela Technologies.
>> +Uses normal HTT TX data path for management frames, which improves
>> +stability in busy networks and may be required for .11r authentication.
>> +This firmware lacks a lot of features that ath10k does not use, saving
>> +a lot of resources.
>> +Enables IBSS and other features.  See:
>> +http://www.candelatech.com/ath10k-10.4.php
>> +This firmware selects and requires the ath10k-ct driver.
>> +endef
>>   
>>   define Package/ath10k-firmware-qca4019-ct/description
>>   Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
>> @@ -360,6 +447,16 @@ Enables IBSS and other features.
>>   See:  http://www.candelatech.com/ath10k-10.4.php
>>   This firmware selects and requires the ath10k-ct driver.
>>   endef
>> +define Package/ath10k-firmware-qca4019-ct-htt/description
>> +Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
>> +Uses normal HTT TX data path for management frames, which improves
>> +stability in busy networks and may be required for .11r authentication.
>> +This firmware lacks a lot of features that ath10k does not use, saving
>> +a lot of resources.
>> +Enables IBSS and other features.
>> +See:  http://www.candelatech.com/ath10k-10.4.php
>> +This firmware selects and requires the ath10k-ct driver.
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9888-ct/description
>>   Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
>> @@ -376,6 +473,16 @@ Enables IBSS and other features.  See:
>>   http://www.candelatech.com/ath10k-10.4.php
>>   This firmware selects and requires the ath10k-ct driver.
>>   endef
>> +define Package/ath10k-firmware-qca9888-ct-htt/description
>> +Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
>> +Uses normal HTT TX data path for management frames, which improves
>> +stability in busy networks and may be required for .11r authentication.
>> +This firmware lacks a lot of features that ath10k does not use, saving
>> +a lot of resources.
>> +Enables IBSS and other features.  See:
>> +http://www.candelatech.com/ath10k-10.4.php
>> +This firmware selects and requires the ath10k-ct driver.
>> +endef
>>   
>>   
>>   define Build/Compile
>> @@ -445,6 +552,18 @@ define Package/ath10k-firmware-qca99x0-ct-full-htt/install
>>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA99X0) \
>>   		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
>>   endef
>> +define Package/ath10k-firmware-qca99x0-ct-htt/install
>> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
>> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
>> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
>> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9984-ct/install
>>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
>> @@ -464,6 +583,15 @@ define Package/ath10k-firmware-qca9984-ct-full-htt/install
>>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9984) \
>>   		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
>>   endef
>> +define Package/ath10k-firmware-qca9984-ct-htt/install
>> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
>> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
>> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
>> +endef
>>   
>>   define Package/ath10k-firmware-qca4019-ct/install
>>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
>> @@ -483,6 +611,15 @@ define Package/ath10k-firmware-qca4019-ct-full-htt/install
>>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA4019) \
>>   		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
>>   endef
>> +define Package/ath10k-firmware-qca4019-ct-htt/install
>> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
>> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
>> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
>> +endef
>>   
>>   define Package/ath10k-firmware-qca9888-ct/install
>>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
>> @@ -508,6 +645,18 @@ define Package/ath10k-firmware-qca9888-ct-full-htt/install
>>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9888) \
>>   		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
>>   endef
>> +define Package/ath10k-firmware-qca9888-ct-htt/install
>> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
>> +	ln -s \
>> +		../../cal-pci-0000:01:00.0.bin \
>> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
>> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
>> +	$(INSTALL_DATA) \
>> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
>> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
>> +endef
>>   
>>   
>>   $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
>> @@ -516,9 +665,13 @@ $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-full-htt))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-full-htt))
>> +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-full-htt))
>> +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-full-htt))
>> +$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
>>   $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-full-htt))
>> +$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


From mail at adrianschmutzler.de  Thu Sep  3 13:53:42 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Thu, 3 Sep 2020 19:53:42 +0200
Subject: [PATCH 19.07 7/8] ath10k-ct-firmware: add htt-mgt variants
In-Reply-To: <8bb1bf66-c4e6-cc57-0ee0-4c94ee567c1c@candelatech.com>
References: <20200825212510.509763-1-baptiste@bitsofnetworks.org>
 <20200825212510.509763-7-baptiste@bitsofnetworks.org>
 <20200903171418.GA644160@tuxmachine.localdomain>
 <8bb1bf66-c4e6-cc57-0ee0-4c94ee567c1c@candelatech.com>
Message-ID: <01a401d6821b$2a1bef50$7e53cdf0$@adrianschmutzler.de>

> > These HTT firmwares are not used in default openwrt images, but they
> > could be used downstream: it does not seem wise to distribute a
> > different firmware variant under the same package name.
> 
> Those compiled out features are not used by any ath10k driver as far as I
> know.
> If the driver doesn't use it, I don't see how anything else could...
> 
> Its still worth testing, but I think that diet variant is probably the best choice.

My point mainly was that it's against the idea of a stable branch to suddenly rename firmware variants in a .4 revision.

So, it would be better to use patches 1-4, drop the htt renames (5,7) and then just rebase patches 6 and 8 for the 19.07 branch.

Best

Adrian

> 
> Thanks,
> Ben
> 
> >
> > I will send a v2 fixing this.
> >
> > On 25-08-20, Baptiste Jonglez wrote:
> >> From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
> >>
> >> For wave-2, there is now a new variant: htt-mgt-community (vs the old
> >> full-htt-mgt-community).
> >>
> >> The non-full one (hence forth 'diet') compiles out a lot of firmware
> >> features that ath10k does not use. This saves a lot of resources and
> >> lets one configure more stations/vdevs/etc using fwcfg.
> >>
> >> Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com> (cherry
> >> picked from commit a882bfce052e78bd344dcbd36efb32acf1340d7a)
> >> ---
> >>   package/firmware/ath10k-ct-firmware/Makefile | 155
> ++++++++++++++++++-
> >>   1 file changed, 154 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/package/firmware/ath10k-ct-firmware/Makefile
> >> b/package/firmware/ath10k-ct-firmware/Makefile
> >> index 6a35e9c75c..18370b7d85 100644
> >> --- a/package/firmware/ath10k-ct-firmware/Makefile
> >> +++ b/package/firmware/ath10k-ct-firmware/Makefile
> >> @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
> >>
> >>   PKG_NAME:=ath10k-ct-firmware
> >>   PKG_VERSION:=2020-04-24
> >> -PKG_RELEASE:=1
> >> +PKG_RELEASE:=2
> >>
> >>   include $(INCLUDE_DIR)/package.mk
> >>
> >> @@ -75,6 +75,7 @@ $(eval $(call Download,qca9888-board2))
> >>
> >>   CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
> >>   CT_FIRMWARE_FILE_FULL_HTT = $(1)-
> $($(1)_FIRMWARE_FILE_CT_FULL_HTT)
> >> +CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
> >>
> >>   define Download/ct-firmware
> >>     URL:=https://www.candelatech.com/downloads/$(2)
> >> @@ -88,6 +89,12 @@ define Download/ct-firmware-full-htt
> >>     URL_FILE:=$($(1)_FIRMWARE_FILE_CT_FULL_HTT)
> >>   endef
> >>
> >> +define Download/ct-firmware-htt
> >> +  URL:=https://www.candelatech.com/downloads/$(2)
> >> +  FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
> >> +  URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
> >> +endef
> >> +
> >>   QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-
> 22.bin.lede.018
> >>   define Download/ath10k-firmware-qca988x-ct
> >>     $(call Download/ct-firmware,QCA988X,) @@ -132,6 +139,13 @@ define
> >> Download/ath10k-firmware-qca99x0-ct-full-htt
> >>   endef
> >>   $(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt))
> >>
> >> +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-
> community-12.bin
> >> +-lede.018 define Download/ath10k-firmware-qca99x0-ct-htt
> >> +  $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
> >> +
> >>
> +HASH:=4d4f74afca487d452f244cd48304cf9710d8941eb97a6346a949ed6b687
> 7d6
> >> +57
> >> +endef
> >> +$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
> >> +
> >>
> >>   QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-
> lede.018
> >>   define Download/ath10k-firmware-qca9984-ct
> >> @@ -147,6 +161,13 @@ define Download/ath10k-firmware-qca9984-ct-
> full-htt
> >>   endef
> >>   $(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt))
> >>
> >> +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-
> community-12.bin
> >> +-lede.018 define Download/ath10k-firmware-qca9984-ct-htt
> >> +  $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
> >> +
> >>
> +HASH:=ee593fb5724d75c372de02ac7894e1630ee9f909fcb2e2bbf17aadef67c
> b9d
> >> +43
> >> +endef
> >> +$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
> >> +
> >>
> >>   QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-
> lede.018
> >>   define Download/ath10k-firmware-qca4019-ct
> >> @@ -162,6 +183,13 @@ define Download/ath10k-firmware-qca4019-ct-
> full-htt
> >>   endef
> >>   $(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt))
> >>
> >> +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-
> community-12.bin
> >> +-lede.018 define Download/ath10k-firmware-qca4019-ct-htt
> >> +  $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
> >> +
> >>
> +HASH:=51fe06f66365771647d16039cca8b541de3d642c45271977a4cfd433c2c5
> d4
> >> +5b
> >> +endef
> >> +$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
> >> +
> >>
> >>   QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-
> lede.018
> >>   define Download/ath10k-firmware-qca9888-ct
> >> @@ -177,6 +205,13 @@ define Download/ath10k-firmware-qca9888-ct-
> full-htt
> >>   endef
> >>   $(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt))
> >>
> >> +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-
> community-12.bin
> >> +-lede.018 define Download/ath10k-firmware-qca9888-ct-htt
> >> +  $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
> >> +
> >>
> +HASH:=6c692141155f5bb74c0117553d5d48ff2aaba73bd4d5e90a5044a5e2ec0
> faa
> >> +b0
> >> +endef
> >> +$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
> >> +
> >>
> >>   define Package/ath10k-ct-firmware-default
> >>     SECTION:=firmware
> >> @@ -232,6 +267,14 @@ $(Package/ath10k-ct-firmware-default)
> >>     PROVIDES:=ath10k-firmware-qca99x0
> >>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >>   endef
> >> +define Package/ath10k-firmware-qca99x0-ct-htt
> >> +$(Package/ath10k-firmware-default)
> >> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
> >> +  SECTION:=firmware
> >> +  CATEGORY:=Firmware
> >> +  PROVIDES:=ath10k-firmware-qca99x0
> >> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9984-ct
> >>   $(Package/ath10k-ct-firmware-default)
> >> @@ -248,6 +291,14 @@ $(Package/ath10k-ct-firmware-default)
> >>     PROVIDES:=ath10k-firmware-qca9984
> >>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >>   endef
> >> +define Package/ath10k-firmware-qca9984-ct-htt
> >> +$(Package/ath10k-firmware-default)
> >> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
> >> +  SECTION:=firmware
> >> +  CATEGORY:=Firmware
> >> +  PROVIDES:=ath10k-firmware-qca9984
> >> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca4019-ct
> >>   $(Package/ath10k-ct-firmware-default)
> >> @@ -264,6 +315,14 @@ $(Package/ath10k-ct-firmware-default)
> >>     PROVIDES:=ath10k-firmware-qca4019
> >>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >>   endef
> >> +define Package/ath10k-firmware-qca4019-ct-htt
> >> +$(Package/ath10k-firmware-default)
> >> +  TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
> >> +  SECTION:=firmware
> >> +  CATEGORY:=Firmware
> >> +  PROVIDES:=ath10k-firmware-qca4019
> >> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9888-ct
> >>   $(Package/ath10k-ct-firmware-default)
> >> @@ -280,6 +339,14 @@ $(Package/ath10k-ct-firmware-default)
> >>     PROVIDES:=ath10k-firmware-qca9888
> >>     DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >>   endef
> >> +define Package/ath10k-firmware-qca9888-ct-htt
> >> +$(Package/ath10k-firmware-default)
> >> +  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
> >> +  SECTION:=firmware
> >> +  CATEGORY:=Firmware
> >> +  PROVIDES:=ath10k-firmware-qca9888
> >> +  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
> >> +endef
> >>
> >>
> >>   define Package/ath10k-firmware-qca9887-ct/description
> >> @@ -330,6 +397,16 @@ Enables IBSS and other features.  See:
> >>   http://www.candelatech.com/ath10k-10.4.php
> >>   This firmware selects and requires the ath10k-ct driver.
> >>   endef
> >> +define Package/ath10k-firmware-qca99x0-ct-htt/description
> >> +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
> >> +Uses normal HTT TX data path for management frames, which improves
> >> +stability in busy networks and may be required for .11r authentication.
> >> +This firmware lacks a lot of features that ath10k does not use,
> >> +saving a lot of resources.
> >> +Enables IBSS and other features.  See:
> >> +http://www.candelatech.com/ath10k-10.4.php
> >> +This firmware selects and requires the ath10k-ct driver.
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9984-ct/description
> >>   Alternative ath10k firmware for QCA9984 from Candela Technologies.
> >> @@ -346,6 +423,16 @@ Enables IBSS and other features.  See:
> >>   http://www.candelatech.com/ath10k-10.4.php
> >>   This firmware selects and requires the ath10k-ct driver.
> >>   endef
> >> +define Package/ath10k-firmware-qca9984-ct-htt/description
> >> +Alternative ath10k firmware for QCA9984 from Candela Technologies.
> >> +Uses normal HTT TX data path for management frames, which improves
> >> +stability in busy networks and may be required for .11r authentication.
> >> +This firmware lacks a lot of features that ath10k does not use,
> >> +saving a lot of resources.
> >> +Enables IBSS and other features.  See:
> >> +http://www.candelatech.com/ath10k-10.4.php
> >> +This firmware selects and requires the ath10k-ct driver.
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca4019-ct/description
> >>   Alternative ath10k firmware for IPQ4019 radio from Candela
> Technologies.
> >> @@ -360,6 +447,16 @@ Enables IBSS and other features.
> >>   See:  http://www.candelatech.com/ath10k-10.4.php
> >>   This firmware selects and requires the ath10k-ct driver.
> >>   endef
> >> +define Package/ath10k-firmware-qca4019-ct-htt/description
> >> +Alternative ath10k firmware for IPQ4019 radio from Candela
> Technologies.
> >> +Uses normal HTT TX data path for management frames, which improves
> >> +stability in busy networks and may be required for .11r authentication.
> >> +This firmware lacks a lot of features that ath10k does not use,
> >> +saving a lot of resources.
> >> +Enables IBSS and other features.
> >> +See:  http://www.candelatech.com/ath10k-10.4.php
> >> +This firmware selects and requires the ath10k-ct driver.
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9888-ct/description
> >>   Alternative ath10k firmware for QCA9886 and QCA9888 from Candela
> Technologies.
> >> @@ -376,6 +473,16 @@ Enables IBSS and other features.  See:
> >>   http://www.candelatech.com/ath10k-10.4.php
> >>   This firmware selects and requires the ath10k-ct driver.
> >>   endef
> >> +define Package/ath10k-firmware-qca9888-ct-htt/description
> >> +Alternative ath10k firmware for QCA9886 and QCA9888 from Candela
> Technologies.
> >> +Uses normal HTT TX data path for management frames, which improves
> >> +stability in busy networks and may be required for .11r authentication.
> >> +This firmware lacks a lot of features that ath10k does not use,
> >> +saving a lot of resources.
> >> +Enables IBSS and other features.  See:
> >> +http://www.candelatech.com/ath10k-10.4.php
> >> +This firmware selects and requires the ath10k-ct driver.
> >> +endef
> >>
> >>
> >>   define Build/Compile
> >> @@ -445,6 +552,18 @@ define Package/ath10k-firmware-qca99x0-ct-full-
> htt/install
> >>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA99X0) \
> >>   		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
> >>   endef
> >> +define Package/ath10k-firmware-qca99x0-ct-htt/install
> >> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
> >> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
> >> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
> >> +		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9984-ct/install
> >>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
> >> @@ -464,6 +583,15 @@ define Package/ath10k-firmware-qca9984-ct-full-
> htt/install
> >>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9984) \
> >>   		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
> >>   endef
> >> +define Package/ath10k-firmware-qca9984-ct-htt/install
> >> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
> >> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
> >> +		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca4019-ct/install
> >>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
> >> @@ -483,6 +611,15 @@ define Package/ath10k-firmware-qca4019-ct-full-
> htt/install
> >>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA4019) \
> >>   		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
> >>   endef
> >> +define Package/ath10k-firmware-qca4019-ct-htt/install
> >> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
> >> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
> >> +		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
> >> +endef
> >>
> >>   define Package/ath10k-firmware-qca9888-ct/install
> >>   	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
> >> @@ -508,6 +645,18 @@ define Package/ath10k-firmware-qca9888-ct-full-
> htt/install
> >>   		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9888) \
> >>   		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
> >>   endef
> >> +define Package/ath10k-firmware-qca9888-ct-htt/install
> >> +	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
> >> +	ln -s \
> >> +		../../cal-pci-0000:01:00.0.bin \
> >> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
> >> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
> >> +	$(INSTALL_DATA) \
> >> +		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
> >> +		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
> >> +endef
> >>
> >>
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
> >> @@ -516,9 +665,13 @@ $(eval $(call BuildPackage,ath10k-firmware-
> qca988x-ct))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-full-htt))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-full-htt))
> >> +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-full-htt))
> >> +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-full-htt))
> >> +$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
> >>   $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-full-htt))
> >> +$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
> >>
> >> _______________________________________________
> >> openwrt-devel mailing list
> >> openwrt-devel at lists.openwrt.org
> >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> 
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200903/fa15bd36/attachment.sig>

From nick.lowe at gmail.com  Thu Sep  3 13:58:00 2020
From: nick.lowe at gmail.com (Nick Lowe)
Date: Thu, 3 Sep 2020 18:58:00 +0100
Subject: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <20200830123833.GB608218@tuxmachine.localdomain>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <35b3781b-1c57-600a-6b41-ed6480f38692@hauke-m.de>
 <20200829115805.GD574887@tuxmachine.localdomain>
 <20200830123833.GB608218@tuxmachine.localdomain>
Message-ID: <CADSoG1vj45D7Fpr-UaYTQCGV+RMk02gH7nPaYnnpPjK_nhkiVg@mail.gmail.com>

It seems there is an important ath10k patch included in the 4.4.235,
4.9.235, 4.14.196 and 4.19.143, 5.4.62 LTS kernels that is applicable
for OpenWRT users who are not using an up to date CT driver with Wave
2 QCA 802.11ac generation hardware, it is already merged for CT.

It resolves a PCIe hang seen due to the DMA burst size value meaning
different things between Wave 1 and Wave 2 hardware.

The issue resolved is that a value of 0 for the DMA burst size has a
different meaning and instruction depending on the generation.

Cheers,

Nick

On Sun, Aug 30, 2020 at 1:45 PM Baptiste Jonglez
<baptiste at bitsofnetworks.org> wrote:
>
> On 29-08-20, Baptiste Jonglez wrote:
> > On 28-08-20, Hauke Mehrtens wrote:
> > > Hi,
> > >
> > > I would like to do a 19.07.4 and a 18.06.9 release on Sunday or
> > > beginning of next week.
> >
> > Cool, looks good to me.
> >
> > > Is there something missing in the current branches which should get into
> > > this release?
> >
> > There's the ath10k-ct-firmware bump for 19.07: https://patchwork.ozlabs.org/project/openwrt/list/?q=19.07
> >
> > I plan to look at the LuCI issue mentioned here: https://openwrt.org/docs/guide-developer/releases/goals/19.07.4
>
> I backported a fix for the LuCI issue, the pull request needs to be merged
> before the 19.07.4 release: https://github.com/openwrt/luci/pull/4402
>
> Thanks,
> Baptiste
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From chunkeey at gmail.com  Thu Sep  3 14:46:56 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Thu, 3 Sep 2020 20:46:56 +0200
Subject: MR24 wifi broken by recent commit
In-Reply-To: <CAHP3WfP1s6oWZRgrg5mMY1MdiaFzhAS3_yfTBAXumo8jst6=gg@mail.gmail.com>
References: <CAHP3WfP1s6oWZRgrg5mMY1MdiaFzhAS3_yfTBAXumo8jst6=gg@mail.gmail.com>
Message-ID: <b234aabe-a65d-aa12-a8ef-42cc5f7fc28d@gmail.com>

On 2020-09-03 10:44, Russell Senior wrote:
> commit 9153955095f01a7ac5f2659a671f0229cbad3507
> Author: Christian Lamparter <chunkeey at gmail.com <mailto:chunkeey at gmail.com>>
> Date: ? Wed Aug 12 18:26:43 2020 +0200
> 
>  ? ? apm821xx: MR24: enumerate PCIe in device-tree
> 
>  ? ? This patch adds the pcie-switch and bridge configuration for
>  ? ? the Meraki MR24.
> 
>  ? ? Signed-off-by: Christian Lamparter <chunkeey at gmail.com 
> <mailto:chunkeey at gmail.com>>
> 
> The symptom is client devices can't see the beacons. Wifi ifaces appear, 
> can scan and hear other networks, but clients can't see the MR24's 
> SSIDs. Reverting the commit above and it works normally again.

Thanks for the report. CONFIG_PCI_DEBUG



"ath9k 0000:44:00.0: runtime IRQ mapping not provided by arch"



since DT overwrites the usual PCI(e) enumeration and MSI(x) is

busted there's no choice but to specify legacy INTABCDs.


Can you please try the attached patch?
---
diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts 
b/target/linux/apm821xx/dts/meraki-mr24.dts
index 102df59ef0..b28fd2449f 100644
--- a/target/linux/apm821xx/dts/meraki-mr24.dts
+++ b/target/linux/apm821xx/dts/meraki-mr24.dts
@@ -227,6 +227,7 @@
  					/* Atheros AR9380 2.4GHz */
  					compatible = "pci168c,0030";
  					reg = <0x00430000 0 0 0 0>;
+					interrupts = <3>; /* INTC 4.1.1 */
  				};
  			};

@@ -241,6 +242,7 @@
  					/* Atheros AR9380 5GHz */
  					compatible = "pci168c,0030";
  					reg = <0x00440000 0 0 0 0>;
+					interrupts = <4>; /* INTD 4.1.1 */
  				};
  			};
  		};


From champetier.etienne at gmail.com  Thu Sep  3 15:04:55 2020
From: champetier.etienne at gmail.com (Etienne Champetier)
Date: Thu, 3 Sep 2020 21:04:55 +0200
Subject: [PATCH] tools/zstd: update to 1.4.5
In-Reply-To: <20200902211824.143130-1-rosenp@gmail.com>
References: <20200902211824.143130-1-rosenp@gmail.com>
Message-ID: <CAOdf3goR65Unz66XYAnXi_6d2iEWeifTj1zGSosoAAiHi4bC8Q@mail.gmail.com>

Hello Rosen,

Le mer. 2 sept. 2020 ? 23:20, Rosen Penev <rosenp at gmail.com> a ?crit :
>
> Fix URL. The GITHUB macro is meant to be used for files inside a git
> repository. This gets downloaded purely by accident (19.07 packages
> feed has zstd 1.4.5 with the file in sources.openwrt.org).
>
> Remove upstream backport.
>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  tools/zstd/Makefile                           |  6 +-
>  ...re-portable-header-prefix-usage-1987.patch | 61 -------------------
>  2 files changed, 3 insertions(+), 64 deletions(-)
>  delete mode 100644 tools/zstd/patches/0001-build-issue-More-portable-header-prefix-usage-1987.patch
>
> diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile
> index 7459725e8e..ef268c0b86 100644
> --- a/tools/zstd/Makefile
> +++ b/tools/zstd/Makefile
> @@ -1,11 +1,11 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=zstd
> -PKG_VERSION:=1.4.4
> +PKG_VERSION:=1.4.5


There is a blocker regression in 1.4.5 for some use case:
https://github.com/facebook/zstd/issues/2222
Haven't checked if it impacts anything in OpenWrt

Best
Etienne

> [snip]


From sebastian_ml at gmx.net  Thu Sep  3 15:26:23 2020
From: sebastian_ml at gmx.net (Sebastian Kemper)
Date: Thu, 3 Sep 2020 21:26:23 +0200
Subject: [PATCH] util-linux: fix build when libmagic is present
In-Reply-To: <20200901223703.785743-1-rosenp@gmail.com>
References: <20200901223703.785743-1-rosenp@gmail.com>
Message-ID: <20200903192623.GA3620@darth.lan>

On Tue, Sep 01, 2020 at 03:37:03PM -0700, Rosen Penev wrote:
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---

Acked-by: Sebastian Kemper <sebastian_ml at gmx.net>

Please apply to get util-linux building. We need libuuid for telephony
and others :-)

Regards,
Seb

>  package/utils/util-linux/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
> index 0fc9819c58..05ceaa413e 100644
> --- a/package/utils/util-linux/Makefile
> +++ b/package/utils/util-linux/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=util-linux
>  PKG_VERSION:=2.36
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
> @@ -526,6 +526,7 @@ CONFIGURE_ARGS += \
>  	--without-python		\
>  	--without-udev			\
>  	--without-readline		\
> +	--without-libmagic		\
>  	--with-ncursesw
>
>  TARGET_CFLAGS += $(FPIC) -std=gnu99


From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:45 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:45 +0200
Subject: [PATCH 19.07 v2 0/6] Update ath10k-ct firmware
Message-ID: <20200903205651.653299-1-baptiste@bitsofnetworks.org>

From: Baptiste Jonglez <git at bitsofnetworks.org>

This backports all recent ath10k-ct firmware bumps from master, and also
backports moving these firmwares to a new package.  Opkg package names remain
unchanged.

v2: don't backport the following changes:

2e5e9b459ed5 ("ath10k-ct-firmware: rename ct-htt packages")
a882bfce052e ("ath10k-ct-firmware: add htt-mgt variants")

Applied together, these changes would basically change the firmware
variant that we distribute in the "ath10k-firmware-*-ct-htt" packages
from the "full" version to the "diet / non-full" version.

Even though these ath10k-ct-htt firmwares are not used in default OpenWrt
images, this change would not be acceptable for a backport.  Downstream users
might rely on these variants.

As a result, we don't backport the "diet / non-full" variant at all.


Michael Yartys (2):
  ath10k-firmware: update ath10k-ct firmware
  ath10k-ct-firmware: update firmware images

Stefan Lippers-Hollmann (1):
  ath10k-firmware: update Candela Tech firmware images

?lvaro Fern?ndez Rojas (3):
  ath10k-firmware: update ath10k-ct firmware images
  ath10k-firmware: move CT firmwares to new package
  ath10k-ct-firmware: update firmware images

 package/firmware/ath10k-ct-firmware/Makefile | 524 +++++++++++++++++++
 package/firmware/ath10k-firmware/Makefile    | 446 ----------------
 2 files changed, 524 insertions(+), 446 deletions(-)
 create mode 100644 package/firmware/ath10k-ct-firmware/Makefile

-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:46 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:46 +0200
Subject: [PATCH 19.07 v2 1/6] ath10k-firmware: update Candela Tech firmware
 images
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-2-baptiste@bitsofnetworks.org>

From: Stefan Lippers-Hollmann <s.l-h at gmx.de>

The release notes since last time for wave-1:

 * No changes to wave-1, but I make a version .014 copy anyway to keep
   the makefile in sync.

The release notes since last time for wave-2:

 * December 16, 2019: Wave-2 has a fix to make setting txpower work
                      better. Before setting the power was ignored at
                      least some of the time (it also appeared to work
                      mostly, so I guess it was being correctly set in
                      other ways).

Signed-off-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>
(cherry picked from commit 65982642668e859540b21c2bd3bf907493df830a)
---
 package/firmware/ath10k-firmware/Makefile | 40 +++++++++++------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index b6a7c94e89..9f1e7e676b 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -64,14 +64,14 @@ define Download/ct-firmware-htt
   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
 endef
 
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.013
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.014
 define Download/ath10k-firmware-qca988x-ct
   $(call Download/ct-firmware,QCA988X,)
   HASH:=19db86003509dedb8ace339c183813ca637d65af24d00666411d1590efe33e13
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct))
 
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.013
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.014
 define Download/ath10k-firmware-qca988x-ct-htt
   $(call Download/ct-firmware-htt,QCA988X,)
   HASH:=454e67dab545e720369a07be2fee16de008c76db4ab3119e7760bf9f7504c066
@@ -79,14 +79,14 @@ endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
 
 
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.013
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.014
 define Download/ath10k-firmware-qca9887-ct
   $(call Download/ct-firmware,QCA9887,ath10k-9887)
   HASH:=b3c738328427e124701a5735d65cde0f60e4172ae5bc23b00e5b16df7995dbd4
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct))
 
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.013
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.014
 define Download/ath10k-firmware-qca9887-ct-htt
   $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
   HASH:=4432ccee23133bbaa4a5552e50a1e7e889b257362603e05530e751b67c29b7b5
@@ -94,62 +94,62 @@ endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
 
 
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.013
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
 define Download/ath10k-firmware-qca99x0-ct
   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=6fa74a3fc87cba97dbc4a7213b760f8d997cd9c5f11900d47d387b23764cf20a
+  HASH:=9a908f743604a468b651a5f73c49e6b0ba11a05c677b9726fbf041b849d88b25
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct))
 
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.013
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
 define Download/ath10k-firmware-qca99x0-ct-htt
   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=68e92820c51270eba4f68b24654c4a9408902b2600762b70204f4cb5419bb714
+  HASH:=800dd0816702aaca75f3eb5436c2ea724a6c24833838cd54399b9286b4d4fbe8
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
 
 
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.013
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
 define Download/ath10k-firmware-qca9984-ct
   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=08aeb883bd2d9258e8f1907cca8a0d2eda1c559a66e228dadffd6798f6877c7d
+  HASH:=a8b12dba478e8c9d4a215f82324382c7554a900e83c31775f8511af84e59fef7
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct))
 
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.013
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
 define Download/ath10k-firmware-qca9984-ct-htt
   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=38ed59a2b3c66c10926706a21ae2d3aeaf83e589f19345a8f48d6520522e4fde
+  HASH:=d185651b5d3d1f0082720bc6c2bbe43b2a00cdb6333403fac9336a720b1d93ae
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
 
 
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.013
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
 define Download/ath10k-firmware-qca4019-ct
   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=feca75fe89af9a3e998047f85ff3428676f4d574b770d51773bb419d0dd98e5a
+  HASH:=4c2e48835219f420b18dc58e31d1387dae0da70d8170c3fc5e7bce39c06cf355
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct))
 
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.013
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
 define Download/ath10k-firmware-qca4019-ct-htt
   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=6a4977689343f43edd934823512f031fd1a026e872004343b9952077f9607cb0
+  HASH:=743da4d537d094a7839bd8e1f792e4cb8b517101f66777c84fd84585f0b85e64
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
 
 
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.013
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
 define Download/ath10k-firmware-qca9888-ct
   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=d6a59c17bfbec1abc8498762d9f00b2449cab352feb8bef8b621771168376dbf
+  HASH:=5809c8a6b3bd81cbc829b5e90af3c0a3300488fe194524a90e260448158016b6
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct))
 
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.013
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
 define Download/ath10k-firmware-qca9888-ct-htt
   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=fe242c0d56494975d7a1aeb6969d90cc21cb133fba99040d4da7a25fdb90d92c
+  HASH:=a284943c203ff66ec2e865f20ae2d2aa049b450801d7205b53c9163862228f15
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
 
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:47 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:47 +0200
Subject: [PATCH 19.07 v2 2/6] ath10k-firmware: update ath10k-ct firmware
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-3-baptiste@bitsofnetworks.org>

From: Michael Yartys <michael.yartys at protonmail.com>

This supports better per-chain noise floor reporting, which in turn allows for
better RSSI reporting in the driver.

Wave-2 fixes a long-standing rate-ctrl problem when connected to xbox (and probably other devices).

Wave-2 has fix for crash likely related to rekeying.

Wave-1 has some debugging code added where a user reported a crash.

Tested-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>  [ipq806x+qca9984,ipq4019+qca9986]
Signed-off-by: Michael Yartys <michael.yartys at protonmail.com>
(cherry picked from commit 18622638831707038556b9b8bd5a0b4d4a53ce53)
---
 package/firmware/ath10k-firmware/Makefile | 48 +++++++++++------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index 9f1e7e676b..af883e6f03 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -64,92 +64,92 @@ define Download/ct-firmware-htt
   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
 endef
 
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.014
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015
 define Download/ath10k-firmware-qca988x-ct
   $(call Download/ct-firmware,QCA988X,)
-  HASH:=19db86003509dedb8ace339c183813ca637d65af24d00666411d1590efe33e13
+  HASH:=a3a760d0d72707feffa496b6d2266bd9195f09806553b36420b60c0f12b8b87e
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct))
 
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.014
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015
 define Download/ath10k-firmware-qca988x-ct-htt
   $(call Download/ct-firmware-htt,QCA988X,)
-  HASH:=454e67dab545e720369a07be2fee16de008c76db4ab3119e7760bf9f7504c066
+  HASH:=3114a54103d2b492fa1ef903769721f59953c829020d62502a1ec411ab4146d5
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
 
 
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.014
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015
 define Download/ath10k-firmware-qca9887-ct
   $(call Download/ct-firmware,QCA9887,ath10k-9887)
-  HASH:=b3c738328427e124701a5735d65cde0f60e4172ae5bc23b00e5b16df7995dbd4
+  HASH:=71e8b76dfd7c786d2f57bb7df207dcd13a91d3b492cfbd28916f084d0d1bb5e7
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct))
 
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.014
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015
 define Download/ath10k-firmware-qca9887-ct-htt
   $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
-  HASH:=4432ccee23133bbaa4a5552e50a1e7e889b257362603e05530e751b67c29b7b5
+  HASH:=b085e5d2239727b72bc647a76864431b8ac48438e6a33b1d55edc2222468f6ff
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
 
 
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
 define Download/ath10k-firmware-qca99x0-ct
   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=9a908f743604a468b651a5f73c49e6b0ba11a05c677b9726fbf041b849d88b25
+  HASH:=edebe2f6f169cdd05c81a8a78156fb3426a66f415e7946af2ae4b7310fca5fe3
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct))
 
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
 define Download/ath10k-firmware-qca99x0-ct-htt
   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=800dd0816702aaca75f3eb5436c2ea724a6c24833838cd54399b9286b4d4fbe8
+  HASH:=1ef67fb07da9082886e4dd554dfc19256e10b500faf9e4b2a5774d0238130bae
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
 
 
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
 define Download/ath10k-firmware-qca9984-ct
   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=a8b12dba478e8c9d4a215f82324382c7554a900e83c31775f8511af84e59fef7
+  HASH:=c2f04da3285aad37baef9c37c9905a31927175dd234cd4378fd56c106e5c9379
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct))
 
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
 define Download/ath10k-firmware-qca9984-ct-htt
   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=d185651b5d3d1f0082720bc6c2bbe43b2a00cdb6333403fac9336a720b1d93ae
+  HASH:=0c9ede1036750d68885e6481fa84f3cb72192b8440b47719344f7327a030f05d
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
 
 
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
 define Download/ath10k-firmware-qca4019-ct
   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=4c2e48835219f420b18dc58e31d1387dae0da70d8170c3fc5e7bce39c06cf355
+  HASH:=1acbb7e7a6300091715a3dfe1b248c7833734961de52cc3465c1ed231a4d84f1
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct))
 
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
 define Download/ath10k-firmware-qca4019-ct-htt
   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=743da4d537d094a7839bd8e1f792e4cb8b517101f66777c84fd84585f0b85e64
+  HASH:=1065e4d3e55da84ec9e69268a4c5dba55ea33827c48a7c14bb8f0c167eb11b4c
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
 
 
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.014
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
 define Download/ath10k-firmware-qca9888-ct
   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=5809c8a6b3bd81cbc829b5e90af3c0a3300488fe194524a90e260448158016b6
+  HASH:=559ebd16872a8b43443c51bb4b7d021e5b75e65893d333d9393f3f6012f4ac79
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct))
 
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.014
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
 define Download/ath10k-firmware-qca9888-ct-htt
   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=a284943c203ff66ec2e865f20ae2d2aa049b450801d7205b53c9163862228f15
+  HASH:=4feaf5e7c4c1745f499ba8c3125db41675800ebedaea455c418c117805c5b372
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
 
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:50 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:50 +0200
Subject: [PATCH 19.07 v2 5/6] ath10k-ct-firmware: update firmware images
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-6-baptiste@bitsofnetworks.org>

From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>

No release notes this time.

Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
(cherry picked from commit 06f510df6e2aa0b1e40124bbd758672458d01482)
[adapt variables and package names because we did not backport
 2e5e9b459ed5 ("ath10k-ct-firmware: rename ct-htt packages")]
Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 package/firmware/ath10k-ct-firmware/Makefile | 50 ++++++++++----------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
index 79bdeeec4f..6fe8ea6d3b 100644
--- a/package/firmware/ath10k-ct-firmware/Makefile
+++ b/package/firmware/ath10k-ct-firmware/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ath10k-ct-firmware
-PKG_VERSION:=2020-03-25
+PKG_VERSION:=2020-04-24
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -88,92 +88,92 @@ define Download/ct-firmware-htt
   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
 endef
 
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
 define Download/ath10k-firmware-qca988x-ct
   $(call Download/ct-firmware,QCA988X,)
-  HASH:=2f0bf766e400a4c5726e77b128eb8c141ebaa778526fe2c7c5083f3b17659dbf
+  HASH:=8b4c99253aa309d35f2e060c190091b8db1b84dbda06a6a15c83ac0f9a938126
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct))
 
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
 define Download/ath10k-firmware-qca988x-ct-htt
   $(call Download/ct-firmware-htt,QCA988X,)
-  HASH:=5e4285d5c6eee159a25ca14c6ce26022c32380bd7bafaedfc0c5de1510119007
+  HASH:=a7168916d6aa5e4d7858f8b620c0c980c76d03f390929db6f4077685ce2051e7
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
 
 
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
 define Download/ath10k-firmware-qca9887-ct
   $(call Download/ct-firmware,QCA9887,ath10k-9887)
-  HASH:=4fa30e0e1972ca3b06225a731df0f93a1b73ac67fea5bf54bb55dea3bbc0da6a
+  HASH:=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct))
 
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
 define Download/ath10k-firmware-qca9887-ct-htt
   $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
-  HASH:=dc681b6b1e45956e7c2e418ab05eee5c943d13e775209196d9bd931ff6493935
+  HASH:=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
 
 
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
 define Download/ath10k-firmware-qca99x0-ct
   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=289ea845d4bbae6f36b3af2a13a5eaa07097f52d10f7b7306cfc9e2dd394f889
+  HASH:=cf26eb37524de54af51fe9b2efffc85e0e70ab849e8607ef63ce5a8ecffeaa42
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct))
 
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
 define Download/ath10k-firmware-qca99x0-ct-htt
   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=adedcd3d379a910bc3a5257d75f8970e11319f4cd9c1b34440d35821602a8b9c
+  HASH:=e9737538d7379e13ad4e4c8c519a63659b5e34a35455ed9ac4399ae8097caabc
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
 
 
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
 define Download/ath10k-firmware-qca9984-ct
   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=8175be5b3946bddc042be018ff7713e67b41b59374ef4cdd183185b59274c91a
+  HASH:=a6b3d66efe640a430a837f238e91eddcd423eed6b887d3ae19716d87a71fd0b1
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct))
 
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
 define Download/ath10k-firmware-qca9984-ct-htt
   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=eb8b894cfe0d1aaa87f130bb7fd1815ef07b951c14df8a2ceaeb780df8f640e0
+  HASH:=96060227e372b3b210badccbe6b0bd75d9a35335a7a0f2966964e9e89f66b00f
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
 
 
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
 define Download/ath10k-firmware-qca4019-ct
   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=29e9f662c4cd287213877abfbb90fbabb5e32dd3710d3ade82aa94a0921972ae
+  HASH:=46d8f8f1e780813299dc8780eedcfceda103c6b4d8908589ad1adbef921714c0
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct))
 
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
 define Download/ath10k-firmware-qca4019-ct-htt
   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=559c911f23856b1d3d864ce714d1bef7262bf6638e93e057ecf8d5dba48ca1e6
+  HASH:=d884624fc34f4b5de7a3ec0534627c46cea25fca45657f3a2f6bb85f6c5893d7
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
 
 
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
 define Download/ath10k-firmware-qca9888-ct
   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=b295880a8b08ec2680d85daaf5f20232a0e73d9cc579bf3efd7ffae24ea340d7
+  HASH:=d01f1429aaf0bfac07eee3547e5821d19136840b2f983e75e76979a5ac19b6f0
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct))
 
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
 define Download/ath10k-firmware-qca9888-ct-htt
   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=26fe7c00df10e93373a0f9f105e85d02bb8b1cdd629183ce22a5147138336aec
+  HASH:=68c42f8e0dcf77f18d4813ac93174bf06ff5cf5aa4f69befe7f35f9fae1de1e3
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
 
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:48 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:48 +0200
Subject: [PATCH 19.07 v2 3/6] ath10k-firmware: update ath10k-ct firmware images
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-4-baptiste@bitsofnetworks.org>

From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>

Release notes for 017:

Wave-1:

 *  March 19, 2020:  Fix problem where power-save was not enabled when going off-channel to scan.
                     The problem was a boolean logic inversion in the chmgr code, a regression I introduced
                     a long time ago.

 *  March 19, 2020:  When scanning only on current working channel, do not bother with disable/enable
                     powersave.  This should make an on-channel scan less obtrusive than it was previously.

 *  March 23, 2020:  Fix channel-mgr use-after-free problem that caused crashes in some cases.  The crash
                     was exacerbated by recent power-save changes.

 *  March 23, 2020:  Fix station-mode power-save related crash:  backported the fix from 10.2 QCA firmware.

 *  March 23, 2020:  Attempt to better clean up power-save objects and state, especially in station mode.

Release notes for 016:

Wave-1 changes, some debugging code for a crash someone reported, plus:

*  February 28, 2020:  Fix custom-tx path when sending in 0x0 for rate-code.  Have tries == 0 mean
                        one try but NO-ACK (similar to how wave-2 does it).

wave-2:

 * Fixed some long-ago regressions related to powersave and/or multicast.  Maybe fix some
   additional multicast and/or tx-scheduling bugs.

Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
Acked-by: Petr ?tetiar <ynezz at true.cz>
(cherry picked from commit 84f4a783c6987fd9d67c089a76e2f90b7491f446)
---
 package/firmware/ath10k-firmware/Makefile | 48 +++++++++++------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index af883e6f03..6eb7cf9a99 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -64,92 +64,92 @@ define Download/ct-firmware-htt
   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
 endef
 
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
 define Download/ath10k-firmware-qca988x-ct
   $(call Download/ct-firmware,QCA988X,)
-  HASH:=a3a760d0d72707feffa496b6d2266bd9195f09806553b36420b60c0f12b8b87e
+  HASH:=2f0bf766e400a4c5726e77b128eb8c141ebaa778526fe2c7c5083f3b17659dbf
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct))
 
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
 define Download/ath10k-firmware-qca988x-ct-htt
   $(call Download/ct-firmware-htt,QCA988X,)
-  HASH:=3114a54103d2b492fa1ef903769721f59953c829020d62502a1ec411ab4146d5
+  HASH:=5e4285d5c6eee159a25ca14c6ce26022c32380bd7bafaedfc0c5de1510119007
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
 
 
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
 define Download/ath10k-firmware-qca9887-ct
   $(call Download/ct-firmware,QCA9887,ath10k-9887)
-  HASH:=71e8b76dfd7c786d2f57bb7df207dcd13a91d3b492cfbd28916f084d0d1bb5e7
+  HASH:=4fa30e0e1972ca3b06225a731df0f93a1b73ac67fea5bf54bb55dea3bbc0da6a
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct))
 
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
 define Download/ath10k-firmware-qca9887-ct-htt
   $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
-  HASH:=b085e5d2239727b72bc647a76864431b8ac48438e6a33b1d55edc2222468f6ff
+  HASH:=dc681b6b1e45956e7c2e418ab05eee5c943d13e775209196d9bd931ff6493935
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
 
 
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
 define Download/ath10k-firmware-qca99x0-ct
   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=edebe2f6f169cdd05c81a8a78156fb3426a66f415e7946af2ae4b7310fca5fe3
+  HASH:=289ea845d4bbae6f36b3af2a13a5eaa07097f52d10f7b7306cfc9e2dd394f889
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct))
 
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
 define Download/ath10k-firmware-qca99x0-ct-htt
   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=1ef67fb07da9082886e4dd554dfc19256e10b500faf9e4b2a5774d0238130bae
+  HASH:=adedcd3d379a910bc3a5257d75f8970e11319f4cd9c1b34440d35821602a8b9c
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
 
 
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
 define Download/ath10k-firmware-qca9984-ct
   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=c2f04da3285aad37baef9c37c9905a31927175dd234cd4378fd56c106e5c9379
+  HASH:=8175be5b3946bddc042be018ff7713e67b41b59374ef4cdd183185b59274c91a
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct))
 
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
 define Download/ath10k-firmware-qca9984-ct-htt
   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=0c9ede1036750d68885e6481fa84f3cb72192b8440b47719344f7327a030f05d
+  HASH:=eb8b894cfe0d1aaa87f130bb7fd1815ef07b951c14df8a2ceaeb780df8f640e0
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
 
 
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
 define Download/ath10k-firmware-qca4019-ct
   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=1acbb7e7a6300091715a3dfe1b248c7833734961de52cc3465c1ed231a4d84f1
+  HASH:=29e9f662c4cd287213877abfbb90fbabb5e32dd3710d3ade82aa94a0921972ae
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct))
 
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
 define Download/ath10k-firmware-qca4019-ct-htt
   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=1065e4d3e55da84ec9e69268a4c5dba55ea33827c48a7c14bb8f0c167eb11b4c
+  HASH:=559c911f23856b1d3d864ce714d1bef7262bf6638e93e057ecf8d5dba48ca1e6
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
 
 
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
 define Download/ath10k-firmware-qca9888-ct
   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=559ebd16872a8b43443c51bb4b7d021e5b75e65893d333d9393f3f6012f4ac79
+  HASH:=b295880a8b08ec2680d85daaf5f20232a0e73d9cc579bf3efd7ffae24ea340d7
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct))
 
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
 define Download/ath10k-firmware-qca9888-ct-htt
   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=4feaf5e7c4c1745f499ba8c3125db41675800ebedaea455c418c117805c5b372
+  HASH:=26fe7c00df10e93373a0f9f105e85d02bb8b1cdd629183ce22a5147138336aec
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
 
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:51 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:51 +0200
Subject: [PATCH 19.07 v2 6/6] ath10k-ct-firmware: update firmware images
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-7-baptiste@bitsofnetworks.org>

From: Michael Yartys <michael.yartys at gmail.com>

Not a large change from last time, but should fix at least one rare wave-2
crash.

Tested on Netgear R7800.

Signed-off-by: Michael Yartys <michael.yartys at gmail.com>
Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
(cherry picked from commit 91aab77bf1ce91b0e60e720eb147c94a02c1f2fd)
[adapt variables and package names]
[remove changes to non-full htt-mgt variants because we did not backport
 a882bfce052e ("ath10k-ct-firmware: add htt-mgt variants")]
Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 package/firmware/ath10k-ct-firmware/Makefile | 42 ++++++++++----------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
index 6fe8ea6d3b..12fb031f8f 100644
--- a/package/firmware/ath10k-ct-firmware/Makefile
+++ b/package/firmware/ath10k-ct-firmware/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ath10k-ct-firmware
-PKG_VERSION:=2020-04-24
+PKG_VERSION:=2020-07-02
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -88,14 +88,14 @@ define Download/ct-firmware-htt
   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
 endef
 
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019
 define Download/ath10k-firmware-qca988x-ct
   $(call Download/ct-firmware,QCA988X,)
   HASH:=8b4c99253aa309d35f2e060c190091b8db1b84dbda06a6a15c83ac0f9a938126
 endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct))
 
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019
 define Download/ath10k-firmware-qca988x-ct-htt
   $(call Download/ct-firmware-htt,QCA988X,)
   HASH:=a7168916d6aa5e4d7858f8b620c0c980c76d03f390929db6f4077685ce2051e7
@@ -103,14 +103,14 @@ endef
 $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
 
 
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019
 define Download/ath10k-firmware-qca9887-ct
   $(call Download/ct-firmware,QCA9887,ath10k-9887)
   HASH:=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b
 endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct))
 
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019
 define Download/ath10k-firmware-qca9887-ct-htt
   $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
   HASH:=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098
@@ -118,62 +118,62 @@ endef
 $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
 
 
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
 define Download/ath10k-firmware-qca99x0-ct
   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=cf26eb37524de54af51fe9b2efffc85e0e70ab849e8607ef63ce5a8ecffeaa42
+  HASH:=7dc934f934bc4973c9273a4f22cfead8e26ec6f579647af31b718a860eca0a4b
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct))
 
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
 define Download/ath10k-firmware-qca99x0-ct-htt
   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=e9737538d7379e13ad4e4c8c519a63659b5e34a35455ed9ac4399ae8097caabc
+  HASH:=71a27b245a382fe009938d2826d5c97a90dceb10ddf638325268df91837ea302
 endef
 $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
 
 
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
 define Download/ath10k-firmware-qca9984-ct
   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=a6b3d66efe640a430a837f238e91eddcd423eed6b887d3ae19716d87a71fd0b1
+  HASH:=32d13f432691fe759ded7d027052e925233adb436cd8f729f85ec3d19ccd1dfd
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct))
 
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
 define Download/ath10k-firmware-qca9984-ct-htt
   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=96060227e372b3b210badccbe6b0bd75d9a35335a7a0f2966964e9e89f66b00f
+  HASH:=e8ab69777bd00b5fc6b1b7acccb55b903553a99932a5b0351602b5f690106588
 endef
 $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
 
 
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
 define Download/ath10k-firmware-qca4019-ct
   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=46d8f8f1e780813299dc8780eedcfceda103c6b4d8908589ad1adbef921714c0
+  HASH:=4b89763087c7ed9b56046c4e621b7f045e452436d8d9b430a5d171179e313592
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct))
 
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
 define Download/ath10k-firmware-qca4019-ct-htt
   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=d884624fc34f4b5de7a3ec0534627c46cea25fca45657f3a2f6bb85f6c5893d7
+  HASH:=fba591e5777c53b82542ba16cae69d9bb4684837f2fa4cee1b9b26f648096748
 endef
 $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
 
 
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
 define Download/ath10k-firmware-qca9888-ct
   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=d01f1429aaf0bfac07eee3547e5821d19136840b2f983e75e76979a5ac19b6f0
+  HASH:=048f4300725e6ebbf94a6bf4f3f4e4592c446fcdbe1d801aaac024b15e89e0c9
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct))
 
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
 define Download/ath10k-firmware-qca9888-ct-htt
   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=68c42f8e0dcf77f18d4813ac93174bf06ff5cf5aa4f69befe7f35f9fae1de1e3
+  HASH:=d2a7e9fea6bd854721b3fc03a3a00d379d303b2bce339377ee87a1c14a60312d
 endef
 $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
 
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 16:56:49 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 22:56:49 +0200
Subject: [PATCH 19.07 v2 4/6] ath10k-firmware: move CT firmwares to new package
In-Reply-To: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
Message-ID: <20200903205651.653299-5-baptiste@bitsofnetworks.org>

From: ?lvaro Fern?ndez Rojas <noltari at gmail.com>

Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
(cherry picked from commit 658e68f85c2645e0132edc6b30a9c76cc17292de)
---
 package/firmware/ath10k-ct-firmware/Makefile | 524 +++++++++++++++++++
 package/firmware/ath10k-firmware/Makefile    | 446 ----------------
 2 files changed, 524 insertions(+), 446 deletions(-)
 create mode 100644 package/firmware/ath10k-ct-firmware/Makefile

diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
new file mode 100644
index 0000000000..79bdeeec4f
--- /dev/null
+++ b/package/firmware/ath10k-ct-firmware/Makefile
@@ -0,0 +1,524 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ath10k-ct-firmware
+PKG_VERSION:=2020-03-25
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+ATH10K_FIRMWARE_REV:=d622d160e9f552ead68d9ae81b715422892dc2ef
+ATH10K_FIRMWARE_URL:=@GITHUB/kvalo/ath10k-firmware/$(ATH10K_FIRMWARE_REV)
+
+QCA9887_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9887-board.bin
+define Download/qca9887-board
+  FILE:=$(QCA9887_BOARD_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA9887/hw1.0
+  URL_FILE:=board.bin
+  HASH:=cf4df099f6ee05c181f55ce17297a1d32c61d725eb96246fd315ad5587c42426
+endef
+$(eval $(call Download,qca9887-board))
+
+QCA988X_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca988x-board.bin
+define Download/qca988x-board
+  FILE:=$(QCA988X_BOARD_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA988X/hw2.0
+  URL_FILE:=board.bin
+  HASH:=5b5b380333c2dd3b6ce67f30e2f7008f4020bf594970d3b464fd8d4a80fcd880
+endef
+$(eval $(call Download,qca988x-board))
+
+QCA99X0_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca99x0-board.bin
+define Download/qca99x0-board
+  FILE:=$(QCA99X0_BOARD_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA99X0/hw2.0
+  URL_FILE:=boardData_AR900B_CUS239_5G_v2_001.bin
+  HASH:=3bf7561ee373b369025dcd366d276d038a97d3397ccae41ce841d98a58b30aff
+endef
+$(eval $(call Download,qca99x0-board))
+
+QCA99X0_BOARD2_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
+QCA99X0_BOARD2_FILE:=ath10k-firmware-$(QCA99X0_BOARD2_REV)-qca99x0-board-2.bin
+define Download/qca99x0-board2
+  FILE:=$(QCA99X0_BOARD2_FILE)
+  URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
+  URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD2_REV)
+  HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401
+endef
+$(eval $(call Download,qca99x0-board2))
+
+QCA9984_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9984-board-2.bin
+define Download/qca9984-board2
+  FILE:=$(QCA9984_BOARD2_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA9984/hw1.0
+  URL_FILE:=board-2.bin
+  HASH:=0d6d46cf0467185e3959ce3cb69e2415be6e48ab8a4bee3eb400edbe48cb9c25
+endef
+$(eval $(call Download,qca9984-board2))
+
+QCA4019_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca4019-board-2.bin
+define Download/qca4019-board2
+  FILE:=$(QCA4019_BOARD2_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA4019/hw1.0
+  URL_FILE:=board-2.bin
+  HASH:=94b66aa4ddbed5110a96364d3c7b4ebcb320e3ac4e8697660b277e76077bc338
+endef
+$(eval $(call Download,qca4019-board2))
+
+QCA9888_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9888-board-2.bin
+define Download/qca9888-board2
+  FILE:=$(QCA9888_BOARD2_FILE)
+  URL:=$(ATH10K_FIRMWARE_URL)/QCA9888/hw2.0
+  URL_FILE:=board-2.bin
+  HASH:=5b871bb567f64525ca45adb88063211de472015d09e0f9aa3fa61ab71c8fdfd3
+endef
+$(eval $(call Download,qca9888-board2))
+
+CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
+CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
+
+define Download/ct-firmware
+  URL:=https://www.candelatech.com/downloads/$(2)
+  FILE:=$(call CT_FIRMWARE_FILE,$(1))
+  URL_FILE:=$($(1)_FIRMWARE_FILE_CT)
+endef
+
+define Download/ct-firmware-htt
+  URL:=https://www.candelatech.com/downloads/$(2)
+  FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
+  URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
+endef
+
+QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
+define Download/ath10k-firmware-qca988x-ct
+  $(call Download/ct-firmware,QCA988X,)
+  HASH:=2f0bf766e400a4c5726e77b128eb8c141ebaa778526fe2c7c5083f3b17659dbf
+endef
+$(eval $(call Download,ath10k-firmware-qca988x-ct))
+
+QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
+define Download/ath10k-firmware-qca988x-ct-htt
+  $(call Download/ct-firmware-htt,QCA988X,)
+  HASH:=5e4285d5c6eee159a25ca14c6ce26022c32380bd7bafaedfc0c5de1510119007
+endef
+$(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
+
+
+QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
+define Download/ath10k-firmware-qca9887-ct
+  $(call Download/ct-firmware,QCA9887,ath10k-9887)
+  HASH:=4fa30e0e1972ca3b06225a731df0f93a1b73ac67fea5bf54bb55dea3bbc0da6a
+endef
+$(eval $(call Download,ath10k-firmware-qca9887-ct))
+
+QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
+define Download/ath10k-firmware-qca9887-ct-htt
+  $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
+  HASH:=dc681b6b1e45956e7c2e418ab05eee5c943d13e775209196d9bd931ff6493935
+endef
+$(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
+
+
+QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+define Download/ath10k-firmware-qca99x0-ct
+  $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
+  HASH:=289ea845d4bbae6f36b3af2a13a5eaa07097f52d10f7b7306cfc9e2dd394f889
+endef
+$(eval $(call Download,ath10k-firmware-qca99x0-ct))
+
+QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+define Download/ath10k-firmware-qca99x0-ct-htt
+  $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
+  HASH:=adedcd3d379a910bc3a5257d75f8970e11319f4cd9c1b34440d35821602a8b9c
+endef
+$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
+
+
+QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+define Download/ath10k-firmware-qca9984-ct
+  $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
+  HASH:=8175be5b3946bddc042be018ff7713e67b41b59374ef4cdd183185b59274c91a
+endef
+$(eval $(call Download,ath10k-firmware-qca9984-ct))
+
+QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+define Download/ath10k-firmware-qca9984-ct-htt
+  $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
+  HASH:=eb8b894cfe0d1aaa87f130bb7fd1815ef07b951c14df8a2ceaeb780df8f640e0
+endef
+$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
+
+
+QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+define Download/ath10k-firmware-qca4019-ct
+  $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
+  HASH:=29e9f662c4cd287213877abfbb90fbabb5e32dd3710d3ade82aa94a0921972ae
+endef
+$(eval $(call Download,ath10k-firmware-qca4019-ct))
+
+QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+define Download/ath10k-firmware-qca4019-ct-htt
+  $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
+  HASH:=559c911f23856b1d3d864ce714d1bef7262bf6638e93e057ecf8d5dba48ca1e6
+endef
+$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
+
+
+QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
+define Download/ath10k-firmware-qca9888-ct
+  $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
+  HASH:=b295880a8b08ec2680d85daaf5f20232a0e73d9cc579bf3efd7ffae24ea340d7
+endef
+$(eval $(call Download,ath10k-firmware-qca9888-ct))
+
+QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
+define Download/ath10k-firmware-qca9888-ct-htt
+  $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
+  HASH:=26fe7c00df10e93373a0f9f105e85d02bb8b1cdd629183ce22a5147138336aec
+endef
+$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
+
+
+define Package/ath10k-ct-firmware-default
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  URL:=https://www.candelatech.com/ath10k.php
+  DEPENDS:=
+endef
+
+define Package/ath10k-firmware-qca988x-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.1 firmware for QCA988x devices
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca988x
+endef
+define Package/ath10k-firmware-qca988x-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.1 htt-mgt fw for QCA988x
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca988x
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+define Package/ath10k-firmware-qca9887-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.1 firmware for QCA9887 devices
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9887
+endef
+define Package/ath10k-firmware-qca9887-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.1 htt-mgt fw for QCA9887
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9887
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+define Package/ath10k-firmware-qca99x0-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 firmware for QCA99x0 devices
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca99x0
+endef
+define Package/ath10k-firmware-qca99x0-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca99x0
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+define Package/ath10k-firmware-qca9984-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 firmware for QCA9984 devices
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9984
+endef
+define Package/ath10k-firmware-qca9984-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9984
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+define Package/ath10k-firmware-qca4019-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 firmware for QCA4018/9
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca4019
+endef
+define Package/ath10k-firmware-qca4019-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca4019
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+define Package/ath10k-firmware-qca9888-ct
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 fw for QCA9886/8 devices
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9888
+endef
+define Package/ath10k-firmware-qca9888-ct-htt
+$(Package/ath10k-ct-firmware-default)
+  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PROVIDES:=ath10k-firmware-qca9888
+  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
+endef
+
+
+define Package/ath10k-firmware-qca9887-ct/description
+Alternative ath10k firmware for QCA9887 from Candela Technologies.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.1.php
+This firmware conflicts with the standard 9887 firmware, so select only
+one.
+endef
+define Package/ath10k-firmware-qca9887-ct-htt/description
+Alternative ath10k firmware for QCA9887 from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and fixes .11r authentication.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.1.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+define Package/ath10k-firmware-qca988x-ct/description
+Alternative ath10k firmware for QCA988X from Candela Technologies.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.1.php
+This firmware will NOT be used unless the standard ath10k-firmware-qca988x
+is un-selected since the driver will try to load firmware-5.bin before
+firmware-2.bin
+endef
+define Package/ath10k-firmware-qca988x-ct-htt/description
+Alternative ath10k firmware for QCA988X from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and fixes .11r authentication.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.1.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+define Package/ath10k-firmware-qca99x0-ct/description
+Alternative ath10k firmware for QCA99x0 from Candela Technologies.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware conflicts with the standard 99x0 firmware, so select only
+one.
+endef
+define Package/ath10k-firmware-qca99x0-ct-htt/description
+Alternative ath10k firmware for QCA99x0 from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and may be required for .11r authentication.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+define Package/ath10k-firmware-qca9984-ct/description
+Alternative ath10k firmware for QCA9984 from Candela Technologies.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware conflicts with the standard 9984 firmware, so select only
+one.
+endef
+define Package/ath10k-firmware-qca9984-ct-htt/description
+Alternative ath10k firmware for QCA9984 from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and may be required for .11r authentication.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+define Package/ath10k-firmware-qca4019-ct/description
+Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
+Enables IBSS and other features.  Works with standard or ath10k-ct driver.
+See:  http://www.candelatech.com/ath10k-10.4.php
+endef
+define Package/ath10k-firmware-qca4019-ct-htt/description
+Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and may be required for .11r authentication.
+Enables IBSS and other features.
+See:  http://www.candelatech.com/ath10k-10.4.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+define Package/ath10k-firmware-qca9888-ct/description
+Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware conflicts with the standard 9886 and 9888 firmware, so select only
+one.
+endef
+define Package/ath10k-firmware-qca9888-ct-htt/description
+Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
+Uses normal HTT TX data path for management frames, which improves
+stability in busy networks and may be required for .11r authentication.
+Enables IBSS and other features.  See:
+http://www.candelatech.com/ath10k-10.4.php
+This firmware selects and requires the ath10k-ct driver.
+endef
+
+
+define Build/Compile
+
+endef
+
+
+define Package/ath10k-firmware-qca9887-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9887) \
+		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9887_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
+endef
+define Package/ath10k-firmware-qca9887-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9887) \
+		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/ct-firmware-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9887_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
+endef
+
+define Package/ath10k-firmware-qca988x-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA988X_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA988X) \
+		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
+endef
+define Package/ath10k-firmware-qca988x-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA988X_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA988X) \
+		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/ct-firmware-2.bin
+endef
+
+define Package/ath10k-firmware-qca99x0-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA99X0) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
+endef
+define Package/ath10k-firmware-qca99x0-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
+		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
+endef
+
+define Package/ath10k-firmware-qca9984-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9984) \
+		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
+endef
+define Package/ath10k-firmware-qca9984-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
+		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
+endef
+
+define Package/ath10k-firmware-qca4019-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA4019) \
+		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin
+endef
+define Package/ath10k-firmware-qca4019-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
+		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
+endef
+
+define Package/ath10k-firmware-qca9888-ct/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
+	ln -s \
+		../../cal-pci-0000:01:00.0.bin \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9888) \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin
+endef
+define Package/ath10k-firmware-qca9888-ct-htt/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
+	ln -s \
+		../../cal-pci-0000:01:00.0.bin \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
+	$(INSTALL_DATA) \
+		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
+		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
+endef
+
+
+$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct-htt))
+$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-htt))
+$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
+$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
+$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
+$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
+$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index 6eb7cf9a99..c427f08842 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -37,11 +37,6 @@ $(Package/ath10k-firmware-default)
   TITLE:=ath10k firmware for QCA9888 devices
 endef
 
-define Package/ath10k-firmware-qca9887-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k-CT firmware for QCA9887 devices
-endef
-
 define Package/ath10k-firmware-qca988x
 $(Package/ath10k-firmware-default)
   TITLE:=ath10k firmware for QCA988x devices
@@ -49,111 +44,6 @@ $(Package/ath10k-firmware-default)
   CATEGORY:=Firmware
 endef
 
-CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT)
-CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT)
-
-define Download/ct-firmware
-  URL:=https://www.candelatech.com/downloads/$(2)
-  FILE:=$(call CT_FIRMWARE_FILE,$(1))
-  URL_FILE:=$($(1)_FIRMWARE_FILE_CT)
-endef
-
-define Download/ct-firmware-htt
-  URL:=https://www.candelatech.com/downloads/$(2)
-  FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1))
-  URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
-endef
-
-QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
-define Download/ath10k-firmware-qca988x-ct
-  $(call Download/ct-firmware,QCA988X,)
-  HASH:=2f0bf766e400a4c5726e77b128eb8c141ebaa778526fe2c7c5083f3b17659dbf
-endef
-$(eval $(call Download,ath10k-firmware-qca988x-ct))
-
-QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
-define Download/ath10k-firmware-qca988x-ct-htt
-  $(call Download/ct-firmware-htt,QCA988X,)
-  HASH:=5e4285d5c6eee159a25ca14c6ce26022c32380bd7bafaedfc0c5de1510119007
-endef
-$(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
-
-
-QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.017
-define Download/ath10k-firmware-qca9887-ct
-  $(call Download/ct-firmware,QCA9887,ath10k-9887)
-  HASH:=4fa30e0e1972ca3b06225a731df0f93a1b73ac67fea5bf54bb55dea3bbc0da6a
-endef
-$(eval $(call Download,ath10k-firmware-qca9887-ct))
-
-QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.017
-define Download/ath10k-firmware-qca9887-ct-htt
-  $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
-  HASH:=dc681b6b1e45956e7c2e418ab05eee5c943d13e775209196d9bd931ff6493935
-endef
-$(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
-
-
-QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
-define Download/ath10k-firmware-qca99x0-ct
-  $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
-  HASH:=289ea845d4bbae6f36b3af2a13a5eaa07097f52d10f7b7306cfc9e2dd394f889
-endef
-$(eval $(call Download,ath10k-firmware-qca99x0-ct))
-
-QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
-define Download/ath10k-firmware-qca99x0-ct-htt
-  $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
-  HASH:=adedcd3d379a910bc3a5257d75f8970e11319f4cd9c1b34440d35821602a8b9c
-endef
-$(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
-
-
-QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
-define Download/ath10k-firmware-qca9984-ct
-  $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
-  HASH:=8175be5b3946bddc042be018ff7713e67b41b59374ef4cdd183185b59274c91a
-endef
-$(eval $(call Download,ath10k-firmware-qca9984-ct))
-
-QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
-define Download/ath10k-firmware-qca9984-ct-htt
-  $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
-  HASH:=eb8b894cfe0d1aaa87f130bb7fd1815ef07b951c14df8a2ceaeb780df8f640e0
-endef
-$(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
-
-
-QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
-define Download/ath10k-firmware-qca4019-ct
-  $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
-  HASH:=29e9f662c4cd287213877abfbb90fbabb5e32dd3710d3ade82aa94a0921972ae
-endef
-$(eval $(call Download,ath10k-firmware-qca4019-ct))
-
-QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
-define Download/ath10k-firmware-qca4019-ct-htt
-  $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
-  HASH:=559c911f23856b1d3d864ce714d1bef7262bf6638e93e057ecf8d5dba48ca1e6
-endef
-$(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
-
-
-QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.017
-define Download/ath10k-firmware-qca9888-ct
-  $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
-  HASH:=b295880a8b08ec2680d85daaf5f20232a0e73d9cc579bf3efd7ffae24ea340d7
-endef
-$(eval $(call Download,ath10k-firmware-qca9888-ct))
-
-QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.017
-define Download/ath10k-firmware-qca9888-ct-htt
-  $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
-  HASH:=26fe7c00df10e93373a0f9f105e85d02bb8b1cdd629183ce22a5147138336aec
-endef
-$(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
-
-
 define Package/ath10k-firmware-qca99x0
 $(Package/ath10k-firmware-default)
   TITLE:=ath10k firmware for QCA99x0 devices
@@ -161,206 +51,12 @@ $(Package/ath10k-firmware-default)
   CATEGORY:=Firmware
 endef
 
-define Package/ath10k-firmware-qca988x-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.1 firmware for QCA988x devices
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca988x
-endef
-define Package/ath10k-firmware-qca988x-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.1 htt-mgt fw for QCA988x
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca988x
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-define Package/ath10k-firmware-qca9887-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.1 firmware for QCA9887 devices
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9887
-endef
-define Package/ath10k-firmware-qca9887-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.1 htt-mgt fw for QCA9887
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9887
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-define Package/ath10k-firmware-qca988x-ct/description
-Alternative ath10k firmware for QCA988X from Candela Technologies.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.1.php
-This firmware will NOT be used unless the standard ath10k-firmware-qca988x
-is un-selected since the driver will try to load firmware-5.bin before
-firmware-2.bin
-endef
-define Package/ath10k-firmware-qca988x-ct-htt/description
-Alternative ath10k firmware for QCA988X from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and fixes .11r authentication.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.1.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-define Package/ath10k-firmware-qca9887-ct/description
-Alternative ath10k firmware for QCA9887 from Candela Technologies.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.1.php
-This firmware conflicts with the standard 9887 firmware, so select only
-one.
-endef
-define Package/ath10k-firmware-qca9887-ct-htt/description
-Alternative ath10k firmware for QCA9887 from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and fixes .11r authentication.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.1.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-define Package/ath10k-firmware-qca99x0-ct/description
-Alternative ath10k firmware for QCA99x0 from Candela Technologies.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware conflicts with the standard 99x0 firmware, so select only
-one.
-endef
-define Package/ath10k-firmware-qca99x0-ct-htt/description
-Alternative ath10k firmware for QCA99x0 from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and may be required for .11r authentication.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-define Package/ath10k-firmware-qca9984-ct/description
-Alternative ath10k firmware for QCA9984 from Candela Technologies.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware conflicts with the standard 9984 firmware, so select only
-one.
-endef
-define Package/ath10k-firmware-qca9984-ct-htt/description
-Alternative ath10k firmware for QCA9984 from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and may be required for .11r authentication.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-define Package/ath10k-firmware-qca4019-ct/description
-Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
-Enables IBSS and other features.  Works with standard or ath10k-ct driver.
-See:  http://www.candelatech.com/ath10k-10.4.php
-endef
-define Package/ath10k-firmware-qca4019-ct-htt/description
-Alternative ath10k firmware for IPQ4019 radio from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and may be required for .11r authentication.
-Enables IBSS and other features.
-See:  http://www.candelatech.com/ath10k-10.4.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-define Package/ath10k-firmware-qca9888-ct/description
-Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware conflicts with the standard 9886 and 9888 firmware, so select only
-one.
-endef
-define Package/ath10k-firmware-qca9888-ct-htt/description
-Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies.
-Uses normal HTT TX data path for management frames, which improves
-stability in busy networks and may be required for .11r authentication.
-Enables IBSS and other features.  See:
-http://www.candelatech.com/ath10k-10.4.php
-This firmware selects and requires the ath10k-ct driver.
-endef
-
-
 define Package/ath10k-firmware-qca99x0/description
 Standard ath10k firmware for QCA99x0 from QCA
 This firmware conflicts with the CT 99x0 firmware, so select only
 one.
 endef
 
-define Package/ath10k-firmware-qca99x0-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 firmware for QCA99x0 devices
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca99x0
-endef
-define Package/ath10k-firmware-qca99x0-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca99x0
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-define Package/ath10k-firmware-qca9984-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 firmware for QCA9984 devices
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9984
-endef
-define Package/ath10k-firmware-qca9984-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9984
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-define Package/ath10k-firmware-qca4019-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 firmware for QCA4018/9
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca4019
-endef
-define Package/ath10k-firmware-qca4019-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca4019
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-define Package/ath10k-firmware-qca9888-ct
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 fw for QCA9886/8 devices
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9888
-endef
-define Package/ath10k-firmware-qca9888-ct-htt
-$(Package/ath10k-firmware-default)
-  TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  PROVIDES:=ath10k-firmware-qca9888
-  DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct
-endef
-
-
-
 define Package/ath10k-firmware-qca9984
 $(Package/ath10k-firmware-default)
   TITLE:=ath10k firmware for QCA9984 devices
@@ -477,135 +173,6 @@ define Package/ath10k-firmware-qca9984/install
 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
 endef
 
-
-# CT related firmware
-
-define Package/ath10k-firmware-qca9887-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9887) \
-		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-2.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9887/hw1.0/board.bin \
-		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
-endef
-define Package/ath10k-firmware-qca9887-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9887) \
-		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/ct-firmware-2.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9887/hw1.0/board.bin \
-		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
-endef
-
-define Package/ath10k-firmware-qca988x-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
-		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA988X) \
-		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
-endef
-define Package/ath10k-firmware-qca988x-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
-		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA988X) \
-		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/ct-firmware-2.bin
-endef
-
-define Package/ath10k-firmware-qca99x0-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA99X0) \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
-endef
-define Package/ath10k-firmware-qca99x0-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \
-		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin
-endef
-
-define Package/ath10k-firmware-qca9984-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9984) \
-		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
-endef
-define Package/ath10k-firmware-qca9984-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \
-		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin
-endef
-
-define Package/ath10k-firmware-qca4019-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA4019) \
-		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin
-endef
-define Package/ath10k-firmware-qca4019-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \
-		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin
-endef
-
-define Package/ath10k-firmware-qca9888-ct/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
-	ln -s \
-		../../cal-pci-0000:01:00.0.bin \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9888) \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin
-endef
-define Package/ath10k-firmware-qca9888-ct-htt/install
-	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
-	ln -s \
-		../../cal-pci-0000:01:00.0.bin \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
-	$(INSTALL_DATA) \
-		$(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
-	$(INSTALL_DATA) \
-		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \
-		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin
-endef
-
 $(eval $(call BuildPackage,ath10k-firmware-qca9887))
 #$(eval $(call BuildPackage,ath10k-firmware-qca9888))
 $(eval $(call BuildPackage,ath10k-firmware-qca988x))
@@ -613,16 +180,3 @@ $(eval $(call BuildPackage,ath10k-firmware-qca988x))
 #$(eval $(call BuildPackage,ath10k-firmware-qca6174))
 #$(eval $(call BuildPackage,ath10k-firmware-qca9984))
 #$(eval $(call BuildPackage,ath10k-firmware-qca4019))
-
-$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca9887-ct-htt))
-$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-htt))
-$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt))
-$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt))
-$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt))
-$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct))
-$(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt))
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 17:19:07 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 23:19:07 +0200
Subject: [PATCH 19.07] scripts: getver.sh: Fix version when running on local
 19.07 branch
Message-ID: <20200903211907.654588-1-baptiste@bitsofnetworks.org>

From: Baptiste Jonglez <git at bitsofnetworks.org>

When building from a local branch based off the "openwrt-19.07" branch,
version computation is wrong, for instance:

    r10194+1004-c53f62b111

The number of local commits (1004 in this case) is wrong because it is
computed against master.  As a result, it wrongly counts *all* commits
since the beginning of the openwrt-19.07 branch as local commits.

The fix is to compare to the openwrt-19.07 branch instead, which gives the
expected result such as:

    r11192+6-8b0278a17e

Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 scripts/getver.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/getver.sh b/scripts/getver.sh
index 9175f411db..a0063505c3 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -26,7 +26,7 @@ try_git() {
 	*)
 		BRANCH="$(git rev-parse --abbrev-ref HEAD)"
 		ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
-		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
+		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name openwrt-19.07@{u} 2>/dev/null)"
 		REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
 
 		if [ -n "$ORIGIN" ]; then
-- 
2.27.0



From baptiste at bitsofnetworks.org  Thu Sep  3 17:19:22 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu,  3 Sep 2020 23:19:22 +0200
Subject: [PATCH 18.06] scripts: getver.sh: Fix version when running on local
 18.06 branch
Message-ID: <20200903211922.654650-1-baptiste@bitsofnetworks.org>

From: Baptiste Jonglez <git at bitsofnetworks.org>

When building from a local branch based off the "openwrt-18.06" branch,
version computation is wrong, for instance:

    r6907+1154-7e15e21766

The number of local commits (1154 in this case) is wrong because it is
computed against master.  As a result, it wrongly counts *all* commits
since the beginning of the openwrt-18.06 branch as local commits.

The fix is to compare to the openwrt-18.06 branch instead, which gives the
expected result such as:

    r8060+1-1238a22316

Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 scripts/getver.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/getver.sh b/scripts/getver.sh
index 9175f411db..dbd3292343 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -26,7 +26,7 @@ try_git() {
 	*)
 		BRANCH="$(git rev-parse --abbrev-ref HEAD)"
 		ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
-		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
+		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name openwrt-18.06@{u} 2>/dev/null)"
 		REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
 
 		if [ -n "$ORIGIN" ]; then
-- 
2.27.0



From russell at personaltelco.net  Thu Sep  3 17:22:17 2020
From: russell at personaltelco.net (Russell Senior)
Date: Thu, 03 Sep 2020 14:22:17 -0700
Subject: MR24 wifi broken by recent commit
In-Reply-To: <b234aabe-a65d-aa12-a8ef-42cc5f7fc28d@gmail.com> (Christian
 Lamparter's message of "Thu, 3 Sep 2020 20:46:56 +0200")
References: <CAHP3WfP1s6oWZRgrg5mMY1MdiaFzhAS3_yfTBAXumo8jst6=gg@mail.gmail.com>
 <b234aabe-a65d-aa12-a8ef-42cc5f7fc28d@gmail.com>
Message-ID: <87tuwev9me.fsf@husum.ptp>

>>>>> Christian Lamparter <chunkeey at gmail.com> writes:

> On 2020-09-03 10:44, Russell Senior wrote:
>> commit 9153955095f01a7ac5f2659a671f0229cbad3507 Author: Christian
>> Lamparter <chunkeey at gmail.com <mailto:chunkeey at gmail.com>> Date: ?
>> Wed Aug 12 18:26:43 2020 +0200
>> 
>> ? ? apm821xx: MR24: enumerate PCIe in device-tree
>> 
>> ? ? This patch adds the pcie-switch and bridge configuration for ? ?
>> the Meraki MR24.
>> 
>> ? ? Signed-off-by: Christian Lamparter <chunkeey at gmail.com
>> <mailto:chunkeey at gmail.com>>
>> 
>> The symptom is client devices can't see the beacons. Wifi ifaces
>> appear, can scan and hear other networks, but clients can't see the
>> MR24's SSIDs. Reverting the commit above and it works normally again.

> Thanks for the report. CONFIG_PCI_DEBUG



> "ath9k 0000:44:00.0: runtime IRQ mapping not provided by arch"



> since DT overwrites the usual PCI(e) enumeration and MSI(x) is

> busted there's no choice but to specify legacy INTABCDs.


> Can you please try the attached patch?

Your patch fixes it.

I am a little curious, if it works without your commit, what is the
motivation for the commit?


-- 
Russell Senior, President
russell at personaltelco.net


From mail at david-bauer.net  Thu Sep  3 19:00:11 2020
From: mail at david-bauer.net (David Bauer)
Date: Fri,  4 Sep 2020 01:00:11 +0200
Subject: [PATCH] zones: fix max length of zone names
Message-ID: <20200903230011.38291-1-mail@david-bauer.net>

Previously the max length of a zone name was assuming the max
length for a extension in netfilter is 32 bytes while in reality it is
only 29.

Fix this incorrect assumption to allow firewall3 to validate the zone
name lengths correctly.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 zones.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/zones.h b/zones.h
index d786736..beb0e22 100644
--- a/zones.h
+++ b/zones.h
@@ -22,8 +22,12 @@
 #include "options.h"
 #include "iptables.h"
 
-/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
-#define FW3_ZONE_MAXNAMELEN 14
+/* XT_EXTENSION_MAXNAMELEN (29)
+ *  - sizeof("postrouting_")
+ *  - sizeof("_rule")
+ *  - sizeof("\0")
+ */
+#define FW3_ZONE_MAXNAMELEN 11
 
 extern const struct fw3_option fw3_zone_opts[];
 
-- 
2.28.0



From ryazanov.s.a at gmail.com  Thu Sep  3 20:20:49 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Fri,  4 Sep 2020 03:20:49 +0300
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
Message-ID: <20200904002051.3930-1-ryazanov.s.a@gmail.com>

This series introduces support for 5.4 kernel. I know that this target
was dropped earlier this week. And I think that this was a good
decision. So, this series is not for merging, but for reference if
someone still uses one of these boards and want to create a custom build
with a modern kernel version.

Sergey Ryazanov (2):
  ath25: add kernel 5.4 support
  ath25: eth: fix crash on skb DMA (un-)map

 target/linux/ath25/Makefile                   |  1 +
 .../linux/ath25/{config-4.14 => config-5.4}   | 73 +++++++++++--------
 .../107-ar5312_gpio.patch                     | 20 ++---
 .../108-ar2315_gpio.patch                     | 18 ++---
 .../110-ar2313_ethernet.patch                 | 40 +++++-----
 .../120-spiflash.patch                        |  9 +--
 .../130-watchdog.patch                        |  4 +-
 .../140-redboot_boardconfig.patch             | 14 ++--
 .../141-redboot_partition_scan.patch}         |  8 +-
 .../142-redboot_various_erase_size_fix.patch  | 16 ++--
 .../210-reset_button.patch                    |  0
 .../220-enet_micrel_workaround.patch          | 10 +--
 .../330-board_leds.patch                      |  0
 13 files changed, 112 insertions(+), 101 deletions(-)
 copy target/linux/ath25/{config-4.14 => config-5.4} (76%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/107-ar5312_gpio.patch (92%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/108-ar2315_gpio.patch (95%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/110-ar2313_ethernet.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/120-spiflash.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/130-watchdog.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/140-redboot_boardconfig.patch (81%)
 copy target/linux/{ath79/patches-5.4/408-mtd-redboot_partition_scan.patch => ath25/patches-5.4/141-redboot_partition_scan.patch} (79%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/142-redboot_various_erase_size_fix.patch (81%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/210-reset_button.patch (100%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/220-enet_micrel_workaround.patch (88%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/330-board_leds.patch (100%)

-- 
2.26.2



From ryazanov.s.a at gmail.com  Thu Sep  3 20:20:51 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Fri,  4 Sep 2020 03:20:51 +0300
Subject: [PATCH 2/2] ath25: eth: fix crash on skb DMA (un-)map
In-Reply-To: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904002051.3930-3-ryazanov.s.a@gmail.com>

AR2315 Ethernet driver pass NULL instead of a real device pointer to DMA
(un-)map calls. With kernel version 5.4 such behaviour causes a kernel
panic. Fix this issue by preserving device pointer during the probe
procedure and pass it to each skb data DMA (un-)map call.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 .../linux/ath25/patches-5.4/110-ar2313_ethernet.patch  | 10 ++++++----
 .../ath25/patches-5.4/220-enet_micrel_workaround.patch | 10 +++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
index e4f5fa8d2e..57c18abf69 100644
--- a/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
+++ b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
@@ -33,7 +33,7 @@
 +obj-$(CONFIG_NET_AR231X) += ar231x.o
 --- /dev/null
 +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -0,0 +1,1119 @@
+@@ -0,0 +1,1120 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -225,6 +225,7 @@
 +
 +	sp = netdev_priv(dev);
 +	sp->dev = dev;
++	sp->pdev = pdev;
 +	sp->cfg = pdev->dev.platform_data;
 +
 +	sprintf(buf, "eth%d_membase", pdev->id);
@@ -787,7 +788,7 @@
 +			break;
 +		}
 +		/* done with this descriptor */
-+		dma_unmap_single(NULL, txdesc->addr,
++		dma_unmap_single(&sp->pdev->dev, txdesc->addr,
 +				 txdesc->devcs & DMA_TX1_BSIZE_MASK,
 +				 DMA_TO_DEVICE);
 +		txdesc->status = 0;
@@ -1014,7 +1015,7 @@
 +	/* Setup the transmit descriptor. */
 +	td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
 +				 (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED));
-+	td->addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
++	td->addr = dma_map_single(&sp->pdev->dev, skb->data, skb->len, DMA_TO_DEVICE);
 +	td->status = DMA_TX_OWN;
 +
 +	/* kick transmitter last */
@@ -1155,7 +1156,7 @@
 +
 --- /dev/null
 +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h
-@@ -0,0 +1,281 @@
+@@ -0,0 +1,282 @@
 +/*
 + * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -1379,6 +1380,7 @@
 + */
 +struct ar231x_private {
 +	struct net_device *dev;
++	struct platform_device *pdev;
 +	int version;
 +	u32 mb[2];
 +
diff --git a/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
index 91b9792515..9051e1b466 100644
--- a/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
+++ b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
@@ -41,7 +41,7 @@
  static int ar231x_probe(struct platform_device *pdev)
  {
  	struct net_device *dev;
-@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_
+@@ -274,6 +301,24 @@ static int ar231x_probe(struct platform_
  
  	mdiobus_register(sp->mii_bus);
  
@@ -66,7 +66,7 @@
  	if (ar231x_mdiobus_probe(dev) != 0) {
  		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
  		rx_tasklet_cleanup(dev);
-@@ -326,8 +371,10 @@ static int ar231x_remove(struct platform
+@@ -327,8 +372,10 @@ static int ar231x_remove(struct platform
  	rx_tasklet_cleanup(dev);
  	ar231x_init_cleanup(dev);
  	unregister_netdev(dev);
@@ -79,7 +79,7 @@
  	kfree(dev);
  	return 0;
  }
-@@ -870,7 +917,8 @@ static int ar231x_open(struct net_device
+@@ -871,7 +918,8 @@ static int ar231x_open(struct net_device
  
  	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
  
@@ -89,7 +89,7 @@
  
  	return 0;
  }
-@@ -951,7 +999,8 @@ static int ar231x_close(struct net_devic
+@@ -952,7 +1000,8 @@ static int ar231x_close(struct net_devic
  
  #endif
  
@@ -99,7 +99,7 @@
  
  	return 0;
  }
-@@ -995,6 +1044,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -996,6 +1045,9 @@ static int ar231x_ioctl(struct net_devic
  {
  	struct ar231x_private *sp = netdev_priv(dev);
  
-- 
2.26.2



From ryazanov.s.a at gmail.com  Thu Sep  3 20:20:50 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Fri,  4 Sep 2020 03:20:50 +0300
Subject: [PATCH 1/2] ath25: add kernel 5.4 support
In-Reply-To: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904002051.3930-2-ryazanov.s.a@gmail.com>

Copy and refresh patches and config from 4.14. The only couple of fixes
required to make kernel buildable:
* rework ethernet supported link modes to linkmode bitmask;
* drop erase callback invocation from AR2315 MTD driver.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 target/linux/ath25/Makefile                   |  1 +
 .../linux/ath25/{config-4.14 => config-5.4}   | 73 +++++++++++--------
 .../107-ar5312_gpio.patch                     | 20 ++---
 .../108-ar2315_gpio.patch                     | 18 ++---
 .../110-ar2313_ethernet.patch                 | 30 ++++----
 .../120-spiflash.patch                        |  9 +--
 .../130-watchdog.patch                        |  4 +-
 .../140-redboot_boardconfig.patch             | 14 ++--
 .../141-redboot_partition_scan.patch}         |  8 +-
 .../142-redboot_various_erase_size_fix.patch  | 16 ++--
 .../210-reset_button.patch                    |  0
 .../220-enet_micrel_workaround.patch          |  0
 .../330-board_leds.patch                      |  0
 13 files changed, 101 insertions(+), 92 deletions(-)
 copy target/linux/ath25/{config-4.14 => config-5.4} (76%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/107-ar5312_gpio.patch (92%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/108-ar2315_gpio.patch (95%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/110-ar2313_ethernet.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/120-spiflash.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/130-watchdog.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/140-redboot_boardconfig.patch (81%)
 copy target/linux/{ath79/patches-5.4/408-mtd-redboot_partition_scan.patch => ath25/patches-5.4/141-redboot_partition_scan.patch} (79%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/142-redboot_various_erase_size_fix.patch (81%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/210-reset_button.patch (100%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/220-enet_micrel_workaround.patch (100%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/330-board_leds.patch (100%)

diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile
index f885112460..0ed40bd54b 100644
--- a/target/linux/ath25/Makefile
+++ b/target/linux/ath25/Makefile
@@ -12,6 +12,7 @@ BOARDNAME:=Atheros AR231x/AR5312
 FEATURES:=squashfs low_mem small_flash
 
 KERNEL_PATCHVER:=4.14
+KERNEL_TESTING_PATCHVER:=5.4
 
 define Target/Description
 	Build firmware images for Atheros SoC boards
diff --git a/target/linux/ath25/config-4.14 b/target/linux/ath25/config-5.4
similarity index 76%
copy from target/linux/ath25/config-4.14
copy to target/linux/ath25/config-5.4
index 734f598cd0..f59f48f655 100644
--- a/target/linux/ath25/config-4.14
+++ b/target/linux/ath25/config-5.4
@@ -1,26 +1,26 @@
 CONFIG_ADM6996_PHY=y
 CONFIG_AR2315_WDT=y
 CONFIG_AR8216_PHY=y
-CONFIG_ARCH_BINFMT_ELF_STATE=y
+CONFIG_ARCH_32BIT_OFF_T=y
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y
+CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y
+CONFIG_ARCH_HAS_DMA_WRITE_COMBINE=y
 CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set
-# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set
+CONFIG_ARCH_HAS_PHYS_TO_DMA=y
+CONFIG_ARCH_HAS_PTE_SPECIAL=y
+CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
+CONFIG_ARCH_HAS_UNCACHED_SEGMENT=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
 CONFIG_ARCH_MMAP_RND_BITS_MAX=15
 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_MEMREMAP_PROT=y
 CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
 CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
+CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_ATH25=y
 CONFIG_BLK_MQ_PCI=y
@@ -29,8 +29,10 @@ CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
 CONFIG_CMDLINE_BOOL=y
 # CONFIG_CMDLINE_OVERRIDE is not set
+CONFIG_COMPAT_32BIT_TIME=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_CPU_GENERIC_DUMP_TLB=y
+CONFIG_CPU_HAS_LOAD_STORE_LR=y
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_CPU_MIPS32=y
@@ -38,23 +40,34 @@ CONFIG_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
 CONFIG_CPU_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
+CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
 CONFIG_EARLY_PRINTK=y
+CONFIG_EFI_EARLYCON=y
 CONFIG_ETHERNET_PACKET_MANGLE=y
+CONFIG_FONT_8x16=y
+CONFIG_FONT_AUTOSELECT=y
+CONFIG_FONT_SUPPORT=y
+CONFIG_FORCE_PCI=y
+CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
-CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_GETTIMEOFDAY=y
+CONFIG_GENERIC_IOMAP=y
 CONFIG_GENERIC_IRQ_CHIP=y
 CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
 CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_LIB_ASHLDI3=y
+CONFIG_GENERIC_LIB_ASHRDI3=y
+CONFIG_GENERIC_LIB_CMPDI2=y
+CONFIG_GENERIC_LIB_LSHRDI3=y
+CONFIG_GENERIC_LIB_UCMPDI2=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SCHED_CLOCK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
@@ -62,48 +75,48 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_AR2315=y
 CONFIG_GPIO_AR5312=y
-# CONFIG_GRO_CELLS is not set
 CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_COMPILER_H=y
 CONFIG_HAVE_ARCH_JUMP_LABEL=y
 CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_ASM_MODVERSIONS=y
 CONFIG_HAVE_CBPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
 CONFIG_HAVE_CONTEXT_TRACKING=y
 CONFIG_HAVE_COPY_THREAD_TLS=y
 CONFIG_HAVE_C_RECORDMCOUNT=y
 CONFIG_HAVE_DEBUG_KMEMLEAK=y
 CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
 CONFIG_HAVE_DMA_CONTIGUOUS=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FAST_GUP=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_VDSO=y
 CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
 CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
 CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
 CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
 CONFIG_HAVE_NET_DSA=y
 CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PCI=y
 CONFIG_HAVE_PERF_EVENTS=y
 CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_RSEQ=y
 CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HW_HAS_PCI=y
 CONFIG_HW_RANDOM=y
+CONFIG_HZ=250
+CONFIG_HZ_250=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IP17XX_PHY=y
@@ -112,17 +125,19 @@ CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_MIPS_CPU=y
 CONFIG_IRQ_WORK=y
 CONFIG_LEDS_GPIO=y
+CONFIG_LOCK_DEBUGGING_SUPPORT=y
 CONFIG_MDIO_BUS=y
 CONFIG_MDIO_DEVICE=y
+CONFIG_MEMFD_CREATE=y
+CONFIG_MIGRATION=y
 CONFIG_MIPS=y
 CONFIG_MIPS_ASID_BITS=8
 CONFIG_MIPS_ASID_SHIFT=0
+CONFIG_MIPS_CBPF_JIT=y
 CONFIG_MIPS_CLOCK_VSYSCALL=y
 # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
 CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MTD_AR2315=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -137,7 +152,6 @@ CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NET_AR231X=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
-# CONFIG_NO_IOPORT_MAP is not set
 # CONFIG_OF is not set
 CONFIG_PCI=y
 CONFIG_PCI_AR2315=y
@@ -147,13 +161,9 @@ CONFIG_PCI_DRIVERS_LEGACY=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PHYLIB=y
-# CONFIG_RCU_NEED_SEGCBLIST is not set
-# CONFIG_RCU_STALL_COMMON is not set
-# CONFIG_SCHED_INFO is not set
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250_FSL is not set
 CONFIG_SERIAL_8250_NR_UARTS=1
 CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SERIAL_MCTRL_GPIO=y
 CONFIG_SOC_AR2315=y
 CONFIG_SOC_AR5312=y
 CONFIG_SRCU=y
@@ -165,6 +175,7 @@ CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_TARGET_ISA_REV=1
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TINY_SRCU=y
 CONFIG_USB_SUPPORT=y
diff --git a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch b/target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
similarity index 92%
copy from target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
copy to target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
index e74e20b05a..cd7b27d636 100644
--- a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
+++ b/target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
@@ -52,7 +52,7 @@
  		if (!ath25_board.radio)
 --- a/drivers/gpio/Kconfig
 +++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
+@@ -113,6 +113,13 @@ config GPIO_AMDPT
  	  driver for GPIO functionality on Promontory IOHub
  	  Require ACPI ASL code to enumerate as a platform device.
  
@@ -68,14 +68,14 @@
  	depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO
 --- a/drivers/gpio/Makefile
 +++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
- obj-$(CONFIG_GPIO_ASPEED)	+= gpio-aspeed.o
+@@ -30,6 +30,7 @@ obj-$(CONFIG_GPIO_ALTERA)  		+= gpio-alt
+ obj-$(CONFIG_GPIO_AMD8111)		+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMD_FCH)		+= gpio-amd-fch.o
+ obj-$(CONFIG_GPIO_AMDPT)		+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR5312)		+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)		+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ASPEED)		+= gpio-aspeed.o
+ obj-$(CONFIG_GPIO_ATH79)		+= gpio-ath79.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ar5312.c
 @@ -0,0 +1,121 @@
@@ -202,7 +202,7 @@
 +subsys_initcall(ar5312_gpio_init);
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -175,6 +175,7 @@ config ATH25
+@@ -189,6 +189,7 @@ config ATH25
  	select CEVT_R4K
  	select CSRC_R4K
  	select DMA_NONCOHERENT
diff --git a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch b/target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
similarity index 95%
copy from target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
copy to target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
index 749b308b89..e198cecf15 100644
--- a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
+++ b/target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
@@ -75,7 +75,7 @@
  	 * workaround. Attempt to jump to the mips reset location -
 --- a/drivers/gpio/Kconfig
 +++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
+@@ -113,6 +113,13 @@ config GPIO_AMDPT
  	  driver for GPIO functionality on Promontory IOHub
  	  Require ACPI ASL code to enumerate as a platform device.
  
@@ -91,14 +91,14 @@
  	default y if SOC_AR5312
 --- a/drivers/gpio/Makefile
 +++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR2315)	+= gpio-ar2315.o
- obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+@@ -30,6 +30,7 @@ obj-$(CONFIG_GPIO_ALTERA)  		+= gpio-alt
+ obj-$(CONFIG_GPIO_AMD8111)		+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMD_FCH)		+= gpio-amd-fch.o
+ obj-$(CONFIG_GPIO_AMDPT)		+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR2315)		+= gpio-ar2315.o
+ obj-$(CONFIG_GPIO_AR5312)		+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)		+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ASPEED)		+= gpio-aspeed.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ar2315.c
 @@ -0,0 +1,233 @@
diff --git a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
copy to target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
index a2b1492250..e4f5fa8d2e 100644
--- a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
+++ b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
@@ -1,22 +1,22 @@
 --- a/drivers/net/ethernet/atheros/Makefile
 +++ b/drivers/net/ethernet/atheros/Makefile
-@@ -8,3 +8,4 @@ obj-$(CONFIG_ATL2) += atlx/
+@@ -9,3 +9,4 @@ obj-$(CONFIG_ATL2) += atlx/
  obj-$(CONFIG_ATL1E) += atl1e/
  obj-$(CONFIG_ATL1C) += atl1c/
  obj-$(CONFIG_ALX) += alx/
 +obj-$(CONFIG_NET_AR231X) += ar231x/
 --- a/drivers/net/ethernet/atheros/Kconfig
 +++ b/drivers/net/ethernet/atheros/Kconfig
-@@ -5,7 +5,7 @@
+@@ -6,7 +6,7 @@
  config NET_VENDOR_ATHEROS
  	bool "Atheros devices"
  	default y
--	depends on PCI
-+	depends on (PCI || ATH25)
+-	depends on (PCI || ATH79)
++	depends on (PCI || ATH25 || ATH79)
  	---help---
  	  If you have a network (Ethernet) card belonging to this class, say Y.
  
-@@ -78,4 +78,10 @@ config ALX
+@@ -87,4 +87,10 @@ config ALX
  	  To compile this driver as a module, choose M here.  The module
  	  will be called alx.
  
@@ -1113,6 +1113,7 @@
 +
 +static int ar231x_mdiobus_probe(struct net_device *dev)
 +{
++	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 +	struct ar231x_private *const sp = netdev_priv(dev);
 +	struct phy_device *phydev = NULL;
 +
@@ -1134,16 +1135,15 @@
 +	}
 +
 +	/* mask with MAC supported features */
-+	phydev->supported &= (SUPPORTED_10baseT_Half
-+		| SUPPORTED_10baseT_Full
-+		| SUPPORTED_100baseT_Half
-+		| SUPPORTED_100baseT_Full
-+		| SUPPORTED_Autoneg
-+		/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
-+		| SUPPORTED_MII
-+		| SUPPORTED_TP);
++	linkmode_set_bit_array(phy_10_100_features_array,
++			       ARRAY_SIZE(phy_10_100_features_array),
++			       mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, mask);
 +
-+	phydev->advertising = phydev->supported;
++	linkmode_and(phydev->supported, phydev->supported, mask);
++	linkmode_copy(phydev->advertising, phydev->supported);
 +
 +	sp->phy_dev = phydev;
 +
@@ -1713,7 +1713,7 @@
 +
  void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
  {
- 	struct uart_port s;
+ #ifdef CONFIG_SERIAL_8250_CONSOLE
 --- a/arch/mips/include/asm/mach-ath25/ath25_platform.h
 +++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h
 @@ -71,4 +71,15 @@ struct ar231x_board_config {
diff --git a/target/linux/ath25/patches-4.14/120-spiflash.patch b/target/linux/ath25/patches-5.4/120-spiflash.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/120-spiflash.patch
copy to target/linux/ath25/patches-5.4/120-spiflash.patch
index 0a2161fb7e..52460f89dd 100644
--- a/target/linux/ath25/patches-4.14/120-spiflash.patch
+++ b/target/linux/ath25/patches-5.4/120-spiflash.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/devices/Kconfig
 +++ b/drivers/mtd/devices/Kconfig
-@@ -130,6 +130,10 @@ config MTD_BCM47XXSFLASH
+@@ -114,6 +114,10 @@ config MTD_BCM47XXSFLASH
  	  registered by bcma as platform devices. This enables driver for
  	  serial flash memories.
  
@@ -13,7 +13,7 @@
  	help
 --- a/drivers/mtd/devices/Makefile
 +++ b/drivers/mtd/devices/Makefile
-@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
+@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataf
  obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
  obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
  obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
@@ -23,7 +23,7 @@
  obj-$(CONFIG_MTD_POWERNV_FLASH)	+= powernv_flash.o
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,459 @@
+@@ -0,0 +1,456 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -284,9 +284,6 @@
 +
 +	mutex_unlock(&priv->lock);
 +
-+	instr->state = MTD_ERASE_DONE;
-+	mtd_erase_callback(instr);
-+
 +	return 0;
 +}
 +
diff --git a/target/linux/ath25/patches-4.14/130-watchdog.patch b/target/linux/ath25/patches-5.4/130-watchdog.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/130-watchdog.patch
copy to target/linux/ath25/patches-5.4/130-watchdog.patch
index 01904d69a5..8a5bd83418 100644
--- a/target/linux/ath25/patches-4.14/130-watchdog.patch
+++ b/target/linux/ath25/patches-5.4/130-watchdog.patch
@@ -212,7 +212,7 @@
 +MODULE_ALIAS("platform:" DRIVER_NAME);
 --- a/drivers/watchdog/Kconfig
 +++ b/drivers/watchdog/Kconfig
-@@ -1647,6 +1647,13 @@ config PIC32_DMT
+@@ -1830,6 +1830,13 @@ config PIC32_DMT
  	  To compile this driver as a loadable module, choose M here.
  	  The module will be called pic32-dmt.
  
@@ -228,7 +228,7 @@
  # POWERPC Architecture
 --- a/drivers/watchdog/Makefile
 +++ b/drivers/watchdog/Makefile
-@@ -166,6 +166,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+@@ -161,6 +161,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
  obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
  obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
  obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
diff --git a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
similarity index 81%
copy from target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
copy to target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
index 6aad761cb1..0ffa12eec0 100644
--- a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
+++ b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
@@ -1,6 +1,6 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -30,6 +30,8 @@
+--- a/drivers/mtd/parsers/redboot.c
++++ b/drivers/mtd/parsers/redboot.c
+@@ -16,6 +16,8 @@
  #include <linux/mtd/partitions.h>
  #include <linux/module.h>
  
@@ -9,7 +9,7 @@
  struct fis_image_desc {
      unsigned char name[16];      // Null terminated name
      uint32_t	  flash_base;    // Address within FLASH of image
-@@ -60,6 +62,7 @@ static int parse_redboot_partitions(stru
+@@ -67,6 +69,7 @@ static int parse_redboot_partitions(stru
  				    const struct mtd_partition **pparts,
  				    struct mtd_part_parser_data *data)
  {
@@ -17,7 +17,7 @@
  	int nrparts = 0;
  	struct fis_image_desc *buf;
  	struct mtd_partition *parts;
-@@ -225,14 +228,15 @@ static int parse_redboot_partitions(stru
+@@ -234,14 +237,15 @@ static int parse_redboot_partitions(stru
  		}
  	}
  #endif
@@ -35,7 +35,7 @@
  #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  	if (nulllen > 0) {
  		strcpy(nullname, nullstring);
-@@ -251,6 +255,8 @@ static int parse_redboot_partitions(stru
+@@ -260,6 +264,8 @@ static int parse_redboot_partitions(stru
  	}
  #endif
  	for ( ; i<nrparts; i++) {
@@ -44,7 +44,7 @@
  		parts[i].size = fl->img->size;
  		parts[i].offset = fl->img->flash_base;
  		parts[i].name = names;
-@@ -284,6 +290,13 @@ static int parse_redboot_partitions(stru
+@@ -293,6 +299,13 @@ static int parse_redboot_partitions(stru
  		fl = fl->next;
  		kfree(tmp_fl);
  	}
diff --git a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
similarity index 79%
copy from target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch
copy to target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
index 8f3ee32f57..3302d6d247 100644
--- a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch
+++ b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/parsers/redboot.c
 +++ b/drivers/mtd/parsers/redboot.c
-@@ -85,12 +85,18 @@ static int parse_redboot_partitions(stru
+@@ -88,12 +88,18 @@ static int parse_redboot_partitions(stru
  
  	parse_redboot_of(master);
  
@@ -19,7 +19,7 @@
  				return -EIO;
  			}
  			offset -= master->erasesize;
-@@ -103,10 +109,6 @@ static int parse_redboot_partitions(stru
+@@ -106,10 +112,6 @@ static int parse_redboot_partitions(stru
  				goto nogood;
  		}
  	}
@@ -30,12 +30,12 @@
  
  	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
  	       master->name, offset);
-@@ -179,6 +181,11 @@ static int parse_redboot_partitions(stru
+@@ -182,6 +184,11 @@ static int parse_redboot_partitions(stru
  	}
  	if (i == numslots) {
  		/* Didn't find it */
 +		if (offset + master->erasesize < master->size) {
-+			/* not at the end of the flash yet, maybe next block :) */
++			/* not at the end of the flash yet, maybe next block */
 +			directory++;
 +			goto restart;
 +		}
diff --git a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
similarity index 81%
copy from target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
copy to target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
index ce039df9f1..2ac0eb92bf 100644
--- a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
+++ b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
@@ -1,7 +1,7 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -58,6 +58,22 @@ static inline int redboot_checksum(struc
- 	return 1;
+--- a/drivers/mtd/parsers/redboot.c
++++ b/drivers/mtd/parsers/redboot.c
+@@ -65,6 +65,22 @@ static void parse_redboot_of(struct mtd_
+ 	directory = dirblock;
  }
  
 +static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset)
@@ -23,7 +23,7 @@
  static int parse_redboot_partitions(struct mtd_info *master,
  				    const struct mtd_partition **pparts,
  				    struct mtd_part_parser_data *data)
-@@ -74,6 +90,7 @@ static int parse_redboot_partitions(stru
+@@ -81,6 +97,7 @@ static int parse_redboot_partitions(stru
  	int namelen = 0;
  	int nulllen = 0;
  	int numslots;
@@ -31,7 +31,7 @@
  	unsigned long offset;
  #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  	static char nullstring[] = "unallocated";
-@@ -186,7 +203,10 @@ static int parse_redboot_partitions(stru
+@@ -195,7 +212,10 @@ static int parse_redboot_partitions(stru
  		goto out;
  	}
  
@@ -43,7 +43,7 @@
  		struct fis_list *new_fl, **prev;
  
  		if (buf[i].name[0] == 0xff) {
-@@ -262,12 +282,13 @@ static int parse_redboot_partitions(stru
+@@ -271,12 +291,13 @@ static int parse_redboot_partitions(stru
  	}
  #endif
  	for ( ; i<nrparts; i++) {
@@ -59,7 +59,7 @@
  		strcpy(names, fl->img->name);
  #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
  		if (!memcmp(names, "RedBoot", 8) ||
-@@ -297,7 +318,9 @@ static int parse_redboot_partitions(stru
+@@ -306,7 +327,9 @@ static int parse_redboot_partitions(stru
  		fl = fl->next;
  		kfree(tmp_fl);
  	}
diff --git a/target/linux/ath25/patches-4.14/210-reset_button.patch b/target/linux/ath25/patches-5.4/210-reset_button.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/210-reset_button.patch
copy to target/linux/ath25/patches-5.4/210-reset_button.patch
diff --git a/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
copy to target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
diff --git a/target/linux/ath25/patches-4.14/330-board_leds.patch b/target/linux/ath25/patches-5.4/330-board_leds.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/330-board_leds.patch
copy to target/linux/ath25/patches-5.4/330-board_leds.patch
-- 
2.26.2



From daniel at makrotopia.org  Thu Sep  3 20:50:11 2020
From: daniel at makrotopia.org (Daniel Golle)
Date: Fri, 4 Sep 2020 01:50:11 +0100
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904005011.GB1467@makrotopia.org>

On Fri, Sep 04, 2020 at 03:20:49AM +0300, Sergey Ryazanov wrote:
> This series introduces support for 5.4 kernel. I know that this target
> was dropped earlier this week. And I think that this was a good
> decision. So, this series is not for merging, but for reference if
> someone still uses one of these boards and want to create a custom build
> with a modern kernel version.

I'd say as you have apprently really managed to get it booting it is
worth reverting the removal and including it.
Sure, a bit late, but there is hardware out there which would benefit
from recent OpenWrt (old ubnt gear, fonera, ... some of them 8/32).
But in terms of resources, ath25 is more advanced than good-old
bcm47xx and also played an important role in OpenWrt history.

Maybe I'm just nostalgic...

> 
> Sergey Ryazanov (2):
>   ath25: add kernel 5.4 support
>   ath25: eth: fix crash on skb DMA (un-)map
> 
>  target/linux/ath25/Makefile                   |  1 +
>  .../linux/ath25/{config-4.14 => config-5.4}   | 73 +++++++++++--------
>  .../107-ar5312_gpio.patch                     | 20 ++---
>  .../108-ar2315_gpio.patch                     | 18 ++---
>  .../110-ar2313_ethernet.patch                 | 40 +++++-----
>  .../120-spiflash.patch                        |  9 +--
>  .../130-watchdog.patch                        |  4 +-
>  .../140-redboot_boardconfig.patch             | 14 ++--
>  .../141-redboot_partition_scan.patch}         |  8 +-
>  .../142-redboot_various_erase_size_fix.patch  | 16 ++--
>  .../210-reset_button.patch                    |  0
>  .../220-enet_micrel_workaround.patch          | 10 +--
>  .../330-board_leds.patch                      |  0
>  13 files changed, 112 insertions(+), 101 deletions(-)
>  copy target/linux/ath25/{config-4.14 => config-5.4} (76%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/107-ar5312_gpio.patch (92%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/108-ar2315_gpio.patch (95%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/110-ar2313_ethernet.patch (98%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/120-spiflash.patch (98%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/130-watchdog.patch (98%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/140-redboot_boardconfig.patch (81%)
>  copy target/linux/{ath79/patches-5.4/408-mtd-redboot_partition_scan.patch => ath25/patches-5.4/141-redboot_partition_scan.patch} (79%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/142-redboot_various_erase_size_fix.patch (81%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/210-reset_button.patch (100%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/220-enet_micrel_workaround.patch (88%)
>  copy target/linux/ath25/{patches-4.14 => patches-5.4}/330-board_leds.patch (100%)
> 
> -- 
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From fff at bareminimum.eu  Thu Sep  3 22:59:40 2020
From: fff at bareminimum.eu (Johannes Kimmel)
Date: Fri,  4 Sep 2020 04:59:40 +0200
Subject: [PATCH 1/4] netifd: vxlan: handle srcport range
Message-ID: <20200904025943.9067-1-fff@bareminimum.eu>

This adds adds the ability to set the source port range for vxlan
interfaces.

By default vxlans will use a random port within the ephermal range as
source ports for packets. This is done to aid scaleability within a
datacenter.

But with these defaults it's impossible to punch through NATs or
traverese most stateful firewalls easily. One solution is to fix the
srcport to the same as dstport.

If only srcportmin is specified, then srcportmax is set in a way that
outgoing packets will only use srcportmin.

If a range is to be specified, srcportmin and srcportmax have to be
specified. srcportmax is exclusive.

If only srcportmax is specified, the value is ignored and defaults are
used.

Signed-off-by: Johannes Kimmel <fff at bareminimum.eu>
---
 system-linux.c | 26 ++++++++++++++++++++++++++
 system.c       |  2 ++
 system.h       |  2 ++
 3 files changed, 30 insertions(+)

diff --git a/system-linux.c b/system-linux.c
index c5583e0..5ff8749 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3184,6 +3184,32 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
 	}
 	nla_put_u16(msg, IFLA_VXLAN_PORT, htons(port));
 
+	if ((cur = tb_data[VXLAN_DATA_ATTR_SRCPORTMIN])) {
+		struct ifla_vxlan_port_range srcports = {0,0};
+
+		uint32_t low = blobmsg_get_u32(cur);
+		if (low < 1 || low > 65535 - 1) {
+			ret = -EINVAL;
+			goto failure;
+		}
+
+		srcports.low = htons((uint16_t) low);
+		srcports.high = htons((uint16_t) (low+1));
+
+		if ((cur = tb_data[VXLAN_DATA_ATTR_SRCPORTMAX])) {
+			uint32_t high = blobmsg_get_u32(cur);
+			if (high < 1 || high > 65535) {
+				ret = -EINVAL;
+				goto failure;
+			}
+			if (high > low) {
+				srcports.high = htons((uint16_t) high);
+			}
+		}
+
+		nla_put(msg, IFLA_VXLAN_PORT_RANGE, sizeof(srcports), &srcports);
+	}
+
 	if ((cur = tb_data[VXLAN_DATA_ATTR_RXCSUM])) {
 		bool rxcsum = blobmsg_get_bool(cur);
 		nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, !rxcsum);
diff --git a/system.c b/system.c
index bbdfef7..4133e55 100644
--- a/system.c
+++ b/system.c
@@ -38,6 +38,8 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
 	[VXLAN_DATA_ATTR_MACADDR] = { .name = "macaddr", .type = BLOBMSG_TYPE_STRING },
 	[VXLAN_DATA_ATTR_RXCSUM] = { .name = "rxcsum", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_TXCSUM] = { .name = "txcsum", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_SRCPORTMIN] = { .name = "srcportmin", .type = BLOBMSG_TYPE_INT32 },
+	[VXLAN_DATA_ATTR_SRCPORTMAX] = { .name = "srcportmax", .type = BLOBMSG_TYPE_INT32 },
 };
 
 const struct uci_blob_param_list vxlan_data_attr_list = {
diff --git a/system.h b/system.h
index 015987f..bf9e1d7 100644
--- a/system.h
+++ b/system.h
@@ -44,6 +44,8 @@ enum vxlan_data {
 	VXLAN_DATA_ATTR_MACADDR,
 	VXLAN_DATA_ATTR_RXCSUM,
 	VXLAN_DATA_ATTR_TXCSUM,
+	VXLAN_DATA_ATTR_SRCPORTMIN,
+	VXLAN_DATA_ATTR_SRCPORTMAX,
 	__VXLAN_DATA_ATTR_MAX
 };
 
-- 
2.28.0



From fff at bareminimum.eu  Thu Sep  3 22:59:42 2020
From: fff at bareminimum.eu (Johannes Kimmel)
Date: Fri,  4 Sep 2020 04:59:42 +0200
Subject: [PATCH 3/4] netifd: vxlan: add most missing boolean options
In-Reply-To: <20200904025943.9067-1-fff@bareminimum.eu>
References: <20200904025943.9067-1-fff@bareminimum.eu>
Message-ID: <20200904025943.9067-3-fff@bareminimum.eu>

adds the folloing missing options:
  - learning
  - rsc
  - proxy
  - l2miss
  - l3miss
  - gbp

See ip-link(3) for their meaning.

still missing:
  - external
  - gpe

I'm not sure how to handle them at the moment. It's unclear to me what
IFLA_VXLAN_* value corresponds to the 'external' option and according to
the manpage, gpe depends on it.

Signed-off-by: Johannes Kimmel <fff at bareminimum.eu>
---
 system-linux.c | 12 +++++++++++-
 system.c       |  6 ++++++
 system.h       |  6 ++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/system-linux.c b/system-linux.c
index 88b064c..a68af63 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3080,7 +3080,11 @@ static void system_vxlan_map_bool_attr(struct nl_msg *msg, struct blob_attr **tb
 		if (invert) {
 			val = !val;
 		}
-		nla_put_u8(msg, attrtype, val);
+		if ((attrtype == IFLA_VXLAN_GBP) && val) {
+			nla_put_flag(msg, attrtype);
+		} else {
+			nla_put_u8(msg, attrtype, val);
+		}
 	}
 }
 
@@ -3224,6 +3228,12 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_CSUM, VXLAN_DATA_ATTR_TXCSUM, false);
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, VXLAN_DATA_ATTR_RXCSUM, true);
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, VXLAN_DATA_ATTR_TXCSUM, true);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_LEARNING, VXLAN_DATA_ATTR_LEARNING, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_RSC , VXLAN_DATA_ATTR_RSC, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_PROXY , VXLAN_DATA_ATTR_PROXY, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_L2MISS , VXLAN_DATA_ATTR_L2MISS, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_L3MISS , VXLAN_DATA_ATTR_L3MISS, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_GBP , VXLAN_DATA_ATTR_GBP, false);
 
 	if ((cur = tb[TUNNEL_ATTR_TOS])) {
 		char *str = blobmsg_get_string(cur);
diff --git a/system.c b/system.c
index 4133e55..95721e1 100644
--- a/system.c
+++ b/system.c
@@ -40,6 +40,12 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
 	[VXLAN_DATA_ATTR_TXCSUM] = { .name = "txcsum", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_SRCPORTMIN] = { .name = "srcportmin", .type = BLOBMSG_TYPE_INT32 },
 	[VXLAN_DATA_ATTR_SRCPORTMAX] = { .name = "srcportmax", .type = BLOBMSG_TYPE_INT32 },
+	[VXLAN_DATA_ATTR_LEARNING] = { .name = "learning", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_RSC] = { .name = "rsc", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_PROXY] = { .name = "proxy", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_L2MISS] = { .name = "l2miss", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_L3MISS] = { .name = "l3miss", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_GBP] = { .name = "gbp", .type = BLOBMSG_TYPE_BOOL },
 };
 
 const struct uci_blob_param_list vxlan_data_attr_list = {
diff --git a/system.h b/system.h
index bf9e1d7..290c2e5 100644
--- a/system.h
+++ b/system.h
@@ -46,6 +46,12 @@ enum vxlan_data {
 	VXLAN_DATA_ATTR_TXCSUM,
 	VXLAN_DATA_ATTR_SRCPORTMIN,
 	VXLAN_DATA_ATTR_SRCPORTMAX,
+	VXLAN_DATA_ATTR_LEARNING,
+	VXLAN_DATA_ATTR_RSC,
+	VXLAN_DATA_ATTR_PROXY,
+	VXLAN_DATA_ATTR_L2MISS,
+	VXLAN_DATA_ATTR_L3MISS,
+	VXLAN_DATA_ATTR_GBP,
 	__VXLAN_DATA_ATTR_MAX
 };
 
-- 
2.28.0



From fff at bareminimum.eu  Thu Sep  3 22:59:43 2020
From: fff at bareminimum.eu (Johannes Kimmel)
Date: Fri,  4 Sep 2020 04:59:43 +0200
Subject: [PATCH 4/4] netifd: vxlan: add aging and maxaddress options
In-Reply-To: <20200904025943.9067-1-fff@bareminimum.eu>
References: <20200904025943.9067-1-fff@bareminimum.eu>
Message-ID: <20200904025943.9067-4-fff@bareminimum.eu>

For both options the values can just be passed to the kernel. All
unsigned values are accepted, thus no range checking required.

Signed-off-by: Johannes Kimmel <fff at bareminimum.eu>
---
 system-linux.c | 10 ++++++++++
 system.c       |  2 ++
 system.h       |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/system-linux.c b/system-linux.c
index a68af63..c497509 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3235,6 +3235,16 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_L3MISS , VXLAN_DATA_ATTR_L3MISS, false);
 	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_GBP , VXLAN_DATA_ATTR_GBP, false);
 
+	if ((cur = tb_data[VXLAN_DATA_ATTR_AGEING])) {
+		uint32_t ageing = blobmsg_get_u32(cur);
+		nla_put_u32(msg, IFLA_VXLAN_AGEING, ageing);
+	}
+
+	if ((cur = tb_data[VXLAN_DATA_ATTR_LIMIT])) {
+		uint32_t maxaddress = blobmsg_get_u32(cur);
+		nla_put_u32(msg, IFLA_VXLAN_LIMIT, maxaddress);
+	}
+
 	if ((cur = tb[TUNNEL_ATTR_TOS])) {
 		char *str = blobmsg_get_string(cur);
 		unsigned tos = 1;
diff --git a/system.c b/system.c
index 95721e1..834748e 100644
--- a/system.c
+++ b/system.c
@@ -46,6 +46,8 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
 	[VXLAN_DATA_ATTR_L2MISS] = { .name = "l2miss", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_L3MISS] = { .name = "l3miss", .type = BLOBMSG_TYPE_BOOL },
 	[VXLAN_DATA_ATTR_GBP] = { .name = "gbp", .type = BLOBMSG_TYPE_BOOL },
+	[VXLAN_DATA_ATTR_AGEING] = { .name = "ageing", .type = BLOBMSG_TYPE_INT32 },
+	[VXLAN_DATA_ATTR_LIMIT] = { .name = "maxaddress", .type = BLOBMSG_TYPE_INT32 },
 };
 
 const struct uci_blob_param_list vxlan_data_attr_list = {
diff --git a/system.h b/system.h
index 290c2e5..52161a8 100644
--- a/system.h
+++ b/system.h
@@ -52,6 +52,8 @@ enum vxlan_data {
 	VXLAN_DATA_ATTR_L2MISS,
 	VXLAN_DATA_ATTR_L3MISS,
 	VXLAN_DATA_ATTR_GBP,
+	VXLAN_DATA_ATTR_AGEING,
+	VXLAN_DATA_ATTR_LIMIT,
 	__VXLAN_DATA_ATTR_MAX
 };
 
-- 
2.28.0



From fff at bareminimum.eu  Thu Sep  3 22:59:41 2020
From: fff at bareminimum.eu (Johannes Kimmel)
Date: Fri,  4 Sep 2020 04:59:41 +0200
Subject: [PATCH 2/4] netifd: vxlan: refactor mapping of boolean attrs
In-Reply-To: <20200904025943.9067-1-fff@bareminimum.eu>
References: <20200904025943.9067-1-fff@bareminimum.eu>
Message-ID: <20200904025943.9067-2-fff@bareminimum.eu>

Add a small function to handle boolean options and make use of it to handle:
  - rxcsum
  - txcsum

Signed-off-by: Johannes Kimmel <fff at bareminimum.eu>
---
 system-linux.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/system-linux.c b/system-linux.c
index 5ff8749..88b064c 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -3073,6 +3073,17 @@ failure:
 #endif
 
 #ifdef IFLA_VXLAN_MAX
+static void system_vxlan_map_bool_attr(struct nl_msg *msg, struct blob_attr **tb_data, int attrtype, int vxlandatatype, bool invert) {
+	struct blob_attr *cur;
+	if ((cur = tb_data[vxlandatatype])) {
+		bool val = blobmsg_get_bool(cur);
+		if (invert) {
+			val = !val;
+		}
+		nla_put_u8(msg, attrtype, val);
+	}
+}
+
 static int system_add_vxlan(const char *name, const unsigned int link, struct blob_attr **tb, bool v6)
 {
 	struct blob_attr *tb_data[__VXLAN_DATA_ATTR_MAX];
@@ -3210,16 +3221,9 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
 		nla_put(msg, IFLA_VXLAN_PORT_RANGE, sizeof(srcports), &srcports);
 	}
 
-	if ((cur = tb_data[VXLAN_DATA_ATTR_RXCSUM])) {
-		bool rxcsum = blobmsg_get_bool(cur);
-		nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, !rxcsum);
-	}
-
-	if ((cur = tb_data[VXLAN_DATA_ATTR_TXCSUM])) {
-		bool txcsum = blobmsg_get_bool(cur);
-		nla_put_u8(msg, IFLA_VXLAN_UDP_CSUM, txcsum);
-		nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, !txcsum);
-	}
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_CSUM, VXLAN_DATA_ATTR_TXCSUM, false);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, VXLAN_DATA_ATTR_RXCSUM, true);
+	system_vxlan_map_bool_attr(msg, tb_data, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, VXLAN_DATA_ATTR_TXCSUM, true);
 
 	if ((cur = tb[TUNNEL_ATTR_TOS])) {
 		char *str = blobmsg_get_string(cur);
-- 
2.28.0



From russell at personaltelco.net  Fri Sep  4 00:14:46 2020
From: russell at personaltelco.net (Russell Senior)
Date: Thu, 03 Sep 2020 21:14:46 -0700
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <20200904005011.GB1467@makrotopia.org> (Daniel Golle's message of
 "Fri, 4 Sep 2020 01:50:11 +0100")
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
 <20200904005011.GB1467@makrotopia.org>
Message-ID: <878sdquqix.fsf@husum.ptp>

>>>>> "Daniel" == Daniel Golle <daniel at makrotopia.org> writes:

Daniel> On Fri, Sep 04, 2020 at 03:20:49AM +0300, Sergey Ryazanov wrote:
>> This series introduces support for 5.4 kernel. I know that this
>> target was dropped earlier this week. And I think that this was a
>> good decision. So, this series is not for merging, but for reference
>> if someone still uses one of these boards and want to create a custom
>> build with a modern kernel version.

Daniel> I'd say as you have apprently really managed to get it booting
Daniel> it is worth reverting the removal and including it.  Sure, a bit
Daniel> late, but there is hardware out there which would benefit from
Daniel> recent OpenWrt (old ubnt gear, fonera, ... some of them 8/32).
Daniel> But in terms of resources, ath25 is more advanced than good-old
Daniel> bcm47xx and also played an important role in OpenWrt history.

Daniel> Maybe I'm just nostalgic...

+1


-- 
Russell Senior, President
russell at personaltelco.net


From ynezz at true.cz  Fri Sep  4 02:29:27 2020
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Fri, 4 Sep 2020 08:29:27 +0200
Subject: [PATCH] util-linux: fix build when libmagic is present
In-Reply-To: <20200901223703.785743-1-rosenp@gmail.com>
References: <20200901223703.785743-1-rosenp@gmail.com>
Message-ID: <20200904062927.GB7414@meh.true.cz>

Rosen Penev <rosenp at gmail.com> [2020-09-01 15:37:03]:

>From https://openwrt.org/submitting-patches, section about commit description:

 "it will be committed to the source changelog, so it should explain to a
  competent reader why you made this commit.  Include symptoms of the failure
  you are fixing (log messages, error messages, etc.), it will be useful for
  people searching the commit logs looking for a fix for their issue.  If a
  patch fixes a compile failure, include only the most relevant part of the
  failure log"

Thanks.

> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  package/utils/util-linux/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
> index 0fc9819c58..05ceaa413e 100644
> --- a/package/utils/util-linux/Makefile
> +++ b/package/utils/util-linux/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=util-linux
>  PKG_VERSION:=2.36
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
> @@ -526,6 +526,7 @@ CONFIGURE_ARGS += \
>  	--without-python		\
>  	--without-udev			\
>  	--without-readline		\
> +	--without-libmagic		\
>  	--with-ncursesw
>  
>  TARGET_CFLAGS += $(FPIC) -std=gnu99
> -- 
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

-- 
ynezz


From rosenp at gmail.com  Fri Sep  4 03:03:59 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 4 Sep 2020 00:03:59 -0700
Subject: [PATCH] util-linux: fix build when libmagic is present
In-Reply-To: <20200904062927.GB7414@meh.true.cz>
References: <20200901223703.785743-1-rosenp@gmail.com>
 <20200904062927.GB7414@meh.true.cz>
Message-ID: <CAKxU2N_r=8QUNGqLvL+3bDo6_JrRmh+JiQjzerU7e9iQ1ZY=TQ@mail.gmail.com>

On Thu, Sep 3, 2020 at 11:29 PM Petr ?tetiar <ynezz at true.cz> wrote:
>
> Rosen Penev <rosenp at gmail.com> [2020-09-01 15:37:03]:
>
> From https://openwrt.org/submitting-patches, section about commit description:
>
>  "it will be committed to the source changelog, so it should explain to a
>   competent reader why you made this commit.  Include symptoms of the failure
>   you are fixing (log messages, error messages, etc.), it will be useful for
>   people searching the commit logs looking for a fix for their issue.  If a
>   patch fixes a compile failure, include only the most relevant part of the
>   failure log"
Hahaha I don't think so.
>
> Thanks.
>
> > Signed-off-by: Rosen Penev <rosenp at gmail.com>
> > ---
> >  package/utils/util-linux/Makefile | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
> > index 0fc9819c58..05ceaa413e 100644
> > --- a/package/utils/util-linux/Makefile
> > +++ b/package/utils/util-linux/Makefile
> > @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=util-linux
> >  PKG_VERSION:=2.36
> > -PKG_RELEASE:=1
> > +PKG_RELEASE:=2
> >
> >  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
> >  PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
> > @@ -526,6 +526,7 @@ CONFIGURE_ARGS += \
> >       --without-python                \
> >       --without-udev                  \
> >       --without-readline              \
> > +     --without-libmagic              \
> >       --with-ncursesw
> >
> >  TARGET_CFLAGS += $(FPIC) -std=gnu99
> > --
> > 2.26.2
> >
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >
>
> --
> ynezz


From a.heider at gmail.com  Fri Sep  4 03:30:49 2020
From: a.heider at gmail.com (Andre Heider)
Date: Fri,  4 Sep 2020 09:30:49 +0200
Subject: [PATCH] omap: update uboot to v2020.04
Message-ID: <20200904073049.1255919-1-a.heider@gmail.com>

Fixes the build error:
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

Successfully tested on boneblack.

Signed-off-by: Andre Heider <a.heider at gmail.com>
---
 package/boot/uboot-omap/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index 70c8af1dc4..f66b8d5331 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -8,10 +8,10 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
-PKG_VERSION:=2019.10
+PKG_VERSION:=2020.04
 PKG_RELEASE:=1
 
-PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014
+PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
 
 include $(INCLUDE_DIR)/u-boot.mk
 include $(INCLUDE_DIR)/package.mk
-- 
2.28.0



From mail at adrianschmutzler.de  Fri Sep  4 05:25:04 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Fri, 4 Sep 2020 11:25:04 +0200
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <20200904005011.GB1467@makrotopia.org>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
 <20200904005011.GB1467@makrotopia.org>
Message-ID: <004701d6829d$481db0b0$d8591210$@adrianschmutzler.de>

> -----Original Message-----
> From: Daniel Golle [mailto:daniel at makrotopia.org]
> Sent: Freitag, 4. September 2020 02:50
> To: Sergey Ryazanov <ryazanov.s.a at gmail.com>
> Cc: OpenWrt Development List <openwrt-devel at lists.openwrt.org>; Adrian
> Schmutzler <mail at adrianschmutzler.de>
> Subject: Re: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
> 
> On Fri, Sep 04, 2020 at 03:20:49AM +0300, Sergey Ryazanov wrote:
> > This series introduces support for 5.4 kernel. I know that this target
> > was dropped earlier this week. And I think that this was a good
> > decision. So, this series is not for merging, but for reference if
> > someone still uses one of these boards and want to create a custom
> > build with a modern kernel version.
> 
> I'd say as you have apprently really managed to get it booting it is worth
> reverting the removal and including it.
> Sure, a bit late, but there is hardware out there which would benefit from
> recent OpenWrt (old ubnt gear, fonera, ... some of them 8/32).
> But in terms of resources, ath25 is more advanced than good-old bcm47xx
> and also played an important role in OpenWrt history.

I'm not opposed to adding it back in general, but from a quick look it appears to me that devices are either at least 4/32 or broken?

So, effectively we would add it just for custom builds and packages.

Best

Adrian

> 
> Maybe I'm just nostalgic...
> 
> >
> > Sergey Ryazanov (2):
> >   ath25: add kernel 5.4 support
> >   ath25: eth: fix crash on skb DMA (un-)map
> >
> >  target/linux/ath25/Makefile                   |  1 +
> >  .../linux/ath25/{config-4.14 => config-5.4}   | 73 +++++++++++--------
> >  .../107-ar5312_gpio.patch                     | 20 ++---
> >  .../108-ar2315_gpio.patch                     | 18 ++---
> >  .../110-ar2313_ethernet.patch                 | 40 +++++-----
> >  .../120-spiflash.patch                        |  9 +--
> >  .../130-watchdog.patch                        |  4 +-
> >  .../140-redboot_boardconfig.patch             | 14 ++--
> >  .../141-redboot_partition_scan.patch}         |  8 +-
> >  .../142-redboot_various_erase_size_fix.patch  | 16 ++--
> >  .../210-reset_button.patch                    |  0
> >  .../220-enet_micrel_workaround.patch          | 10 +--
> >  .../330-board_leds.patch                      |  0
> >  13 files changed, 112 insertions(+), 101 deletions(-)  copy
> > target/linux/ath25/{config-4.14 => config-5.4} (76%)  copy
> > target/linux/ath25/{patches-4.14 => patches-5.4}/107-ar5312_gpio.patch
> > (92%)  copy target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/108-ar2315_gpio.patch (95%)  copy
> > target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/110-ar2313_ethernet.patch (98%)  copy
> > target/linux/ath25/{patches-4.14 => patches-5.4}/120-spiflash.patch
> > (98%)  copy target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/130-watchdog.patch (98%)  copy
> > target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/140-redboot_boardconfig.patch (81%)  copy
> > target/linux/{ath79/patches-5.4/408-mtd-redboot_partition_scan.patch
> > => ath25/patches-5.4/141-redboot_partition_scan.patch} (79%)  copy
> > target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/142-redboot_various_erase_size_fix.patch (81%)  copy
> > target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/210-reset_button.patch (100%)  copy
> > target/linux/ath25/{patches-4.14 =>
> > patches-5.4}/220-enet_micrel_workaround.patch (88%)  copy
> > target/linux/ath25/{patches-4.14 => patches-5.4}/330-board_leds.patch
> > (100%)
> >
> > --
> > 2.26.2
> >
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200904/6fe0a245/attachment.sig>

From aymen.zayet at qiio.com  Fri Sep  4 05:48:36 2020
From: aymen.zayet at qiio.com (Aymen Zayet)
Date: Fri, 4 Sep 2020 11:48:36 +0200
Subject: enabling cellular modem on openwrt.
In-Reply-To: <cedc4d76-1b35-5b9b-e1b5-9b6b42f5fdbd@qiio.com>
References: <cedc4d76-1b35-5b9b-e1b5-9b6b42f5fdbd@qiio.com>
Message-ID: <6b78014f-0c50-cfae-2308-cebe3bdf718c@qiio.com>

Hi everyone,

I am currently working on enabling the cellular modem. The modem is 
enabled over GPIOs from the hardware side, and over ppp from the 
protocol side.

And I am trying to find the right place to setup the hardware before 
/lib/netifd/proto/ppp.sh is called.

The network configuration I am using is the following ( 
/etc/config/network ) :

*config interface 'broadband'*

*??? option ifname 'ppp0'*

*??? option proto 'ppp'*

*??? option pppd_options 'defaultroute'*

I did some hacks in ppp.sh script in order to turn on the modem on 
proto_ppp_setup() and turn it off on proto_ppp_teardown() hooks. but 
this seems to me a kind of workaround that brings several issues.

Also if anyone knows an openwrt based platform using cellular modem , I 
am interested to know which one. It will be very helpful.

Thanks a lot for your support.

Aymen.



From mail at adrianschmutzler.de  Fri Sep  4 05:56:57 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Fri, 4 Sep 2020 11:56:57 +0200
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <e3826dce-abad-8d32-27fe-6f5dfeea2d39@uid0.hu>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
 <20200904005011.GB1467@makrotopia.org>
 <004701d6829d$481db0b0$d8591210$@adrianschmutzler.de>
 <e3826dce-abad-8d32-27fe-6f5dfeea2d39@uid0.hu>
Message-ID: <007801d682a1$bc57bb20$35073160$@adrianschmutzler.de>

> Indeed some of the devices are 4/32 or even 4/16 in ath25, but there are a number of 8/32 devices (like Fon2202, Meraki Mini, Ubiquiti PS5, and likely other custom boards). So above the nostalgic feeling, there is some technical reasoning to keep the target around, I'm in favour of that. (Thanks Sergey for finding the cause of the eth crash.)

The non-Ubiquiti are served by the generic image then?

Best

Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200904/d48b41b2/attachment-0001.sig>

From wigyori at uid0.hu  Fri Sep  4 06:26:31 2020
From: wigyori at uid0.hu (Zoltan HERPAI)
Date: Fri, 4 Sep 2020 12:26:31 +0200
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <007801d682a1$bc57bb20$35073160$@adrianschmutzler.de>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
 <20200904005011.GB1467@makrotopia.org>
 <004701d6829d$481db0b0$d8591210$@adrianschmutzler.de>
 <e3826dce-abad-8d32-27fe-6f5dfeea2d39@uid0.hu>
 <007801d682a1$bc57bb20$35073160$@adrianschmutzler.de>
Message-ID: <f96a0b23-b488-8a1a-910e-0ed0b2d72cfa@uid0.hu>

On 09/04/2020 11:56, Adrian Schmutzler wrote:
>> Indeed some of the devices are 4/32 or even 4/16 in ath25, but there are a number of 8/32 devices (like Fon2202, Meraki Mini, Ubiquiti PS5, and likely other custom boards). So above the nostalgic feeling, there is some technical reasoning to keep the target around, I'm in favour of that. (Thanks Sergey for finding the cause of the eth crash.)
> The non-Ubiquiti are served by the generic image then?
>
Correct, most of the devices are supported by the generic image.

Regards,
Zoltan H



From ryazanov.s.a at gmail.com  Fri Sep  4 06:47:15 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Fri, 4 Sep 2020 13:47:15 +0300
Subject: [PATCH 0/2] ath25: add 5.4 kernel support (not for merge)
In-Reply-To: <e3826dce-abad-8d32-27fe-6f5dfeea2d39@uid0.hu>
References: <20200904002051.3930-1-ryazanov.s.a@gmail.com>
 <20200904005011.GB1467@makrotopia.org>
 <004701d6829d$481db0b0$d8591210$@adrianschmutzler.de>
 <e3826dce-abad-8d32-27fe-6f5dfeea2d39@uid0.hu>
Message-ID: <CAHNKnsSnmSS9Uf5_F-yofB+SUch81FHqww6e8d5YL5UxqNYaOw@mail.gmail.com>

On Fri, Sep 4, 2020 at 12:54 PM Zoltan HERPAI <wigyori at uid0.hu> wrote:
>> On 09/04/2020 11:25, Adrian Schmutzler wrote:
>> Zoltan HERPAI <wigyori at uid0.hu> wrote:
>>> Sure, a bit late, but there is hardware out there which would benefit from
>>> recent OpenWrt (old ubnt gear, fonera, ... some of them 8/32).
>>> But in terms of resources, ath25 is more advanced than good-old bcm47xx
>>> and also played an important role in OpenWrt history.
>>
>> I'm not opposed to adding it back in general, but from a quick look it appears to me that devices are either at least 4/32 or broken?
>>
>> So, effectively we would add it just for custom builds and packages.
>>
> Indeed some of the devices are 4/32 or even 4/16 in ath25, but there are a number of 8/32 devices (like Fon2202, Meraki Mini, Ubiquiti PS5, and likely other custom boards). So above the nostalgic feeling, there is some technical reasoning to keep the target around, I'm in favour of that.

Looks like I was wrong in assuming there are no active users of these boards.

I will send another series that reverts target dropping and updates
the kernel to 5.4.

-- 
Sergey


From jaapbuurman at gmail.com  Fri Sep  4 09:57:17 2020
From: jaapbuurman at gmail.com (Jaap Buurman)
Date: Fri, 4 Sep 2020 15:57:17 +0200
Subject: ramips: ethernet: fix to interrupt handling
Message-ID: <CAN-r--ng9R_0SG06Q=6PsHtcgV882nPWbuV7=GP6An4rg9=Hkg@mail.gmail.com>

Dear all,

Is there a reason the "ramips: ethernet: fix to interrupt handling"
patch never was included in the master branch or 19.07 branch?:

https://patchwork.ozlabs.org/project/openwrt/patch/20191029172328.85861-2-rosenp at gmail.com/

There are many interrupt errors on my mt7621 device, and there have
been reports that this patch brings those errors massively down or
even eliminates them all together.

Yours sincerely,

Jaap


From dobrovolskiy.alexey at gmail.com  Fri Sep  4 16:32:39 2020
From: dobrovolskiy.alexey at gmail.com (Alexey Dobrovolskiy)
Date: Fri, 4 Sep 2020 23:32:39 +0300
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <20200903230011.38291-1-mail@david-bauer.net>
References: <20200903230011.38291-1-mail@david-bauer.net>
Message-ID: <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>

Hi,
please, see also
https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/

Best regards,
Alexey

??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>
> Previously the max length of a zone name was assuming the max
> length for a extension in netfilter is 32 bytes while in reality it is
> only 29.
>
> Fix this incorrect assumption to allow firewall3 to validate the zone
> name lengths correctly.
>
> Signed-off-by: David Bauer <mail at david-bauer.net>
> ---
>  zones.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/zones.h b/zones.h
> index d786736..beb0e22 100644
> --- a/zones.h
> +++ b/zones.h
> @@ -22,8 +22,12 @@
>  #include "options.h"
>  #include "iptables.h"
>
> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
> -#define FW3_ZONE_MAXNAMELEN 14
> +/* XT_EXTENSION_MAXNAMELEN (29)
> + *  - sizeof("postrouting_")
> + *  - sizeof("_rule")
> + *  - sizeof("\0")
> + */
> +#define FW3_ZONE_MAXNAMELEN 11
>
>  extern const struct fw3_option fw3_zone_opts[];
>
> --
> 2.28.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From rosenp at gmail.com  Fri Sep  4 16:50:08 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 4 Sep 2020 13:50:08 -0700
Subject: ramips: ethernet: fix to interrupt handling
In-Reply-To: <CAN-r--ng9R_0SG06Q=6PsHtcgV882nPWbuV7=GP6An4rg9=Hkg@mail.gmail.com>
References: <CAN-r--ng9R_0SG06Q=6PsHtcgV882nPWbuV7=GP6An4rg9=Hkg@mail.gmail.com>
Message-ID: <CAKxU2N9wc8iDRTBzzHKQ63nnpCwWyHaek+VWMj74M1_O+1=W2g@mail.gmail.com>

On Fri, Sep 4, 2020 at 7:01 AM Jaap Buurman <jaapbuurman at gmail.com> wrote:
>
> Dear all,
>
> Is there a reason the "ramips: ethernet: fix to interrupt handling"
> patch never was included in the master branch or 19.07 branch?:
>
> https://patchwork.ozlabs.org/project/openwrt/patch/20191029172328.85861-2-rosenp at gmail.com/
I doubt anyone cares. That patch was never merged. The issue was
"avoided" by switching drivers.
>
> There are many interrupt errors on my mt7621 device, and there have
> been reports that this patch brings those errors massively down or
> even eliminates them all together.
https://github.com/openwrt/openwrt/commit/b5d425af237dc03327078d6b9be178a38b5f8723
is very interesting in that regard. Some of those patches can be
backported I think.
>
> Yours sincerely,
>
> Jaap
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From baptiste at bitsofnetworks.org  Fri Sep  4 18:11:55 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Sat, 5 Sep 2020 00:11:55 +0200
Subject: [PATCH 19.07 7/8] ath10k-ct-firmware: add htt-mgt variants
In-Reply-To: <01a401d6821b$2a1bef50$7e53cdf0$@adrianschmutzler.de>
References: <20200825212510.509763-1-baptiste@bitsofnetworks.org>
 <20200825212510.509763-7-baptiste@bitsofnetworks.org>
 <20200903171418.GA644160@tuxmachine.localdomain>
 <8bb1bf66-c4e6-cc57-0ee0-4c94ee567c1c@candelatech.com>
 <01a401d6821b$2a1bef50$7e53cdf0$@adrianschmutzler.de>
Message-ID: <20200904221155.GA658540@tuxmachine.localdomain>

Hi,

On 03-09-20, Adrian Schmutzler wrote:
> > > These HTT firmwares are not used in default openwrt images, but they
> > > could be used downstream: it does not seem wise to distribute a
> > > different firmware variant under the same package name.
> > 
> > Those compiled out features are not used by any ath10k driver as far as I
> > know.
> > If the driver doesn't use it, I don't see how anything else could...
> > 
> > Its still worth testing, but I think that diet variant is probably the best choice.

Yes, introducing that diet variant in master seems like a good idea.  It
will be part of the next 20.XX stable release.  As Adrian also pointed
out, the problem is backporting it to the 19.07 branch: it might break
user expectations.

> My point mainly was that it's against the idea of a stable branch to suddenly rename firmware variants in a .4 revision.
> 
> So, it would be better to use patches 1-4, drop the htt renames (5,7) and then just rebase patches 6 and 8 for the 19.07 branch.

I've sent a v2 with this approach, everything works fine on a QCA9886.  I
will try to test it a bit more on different hardware this week-end.

More testing is welcome.

Thanks,
Baptiste
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200905/3f699ec0/attachment.sig>

From baptiste at bitsofnetworks.org  Fri Sep  4 18:28:29 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Sat, 5 Sep 2020 00:28:29 +0200
Subject: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <CADSoG1vj45D7Fpr-UaYTQCGV+RMk02gH7nPaYnnpPjK_nhkiVg@mail.gmail.com>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <35b3781b-1c57-600a-6b41-ed6480f38692@hauke-m.de>
 <20200829115805.GD574887@tuxmachine.localdomain>
 <20200830123833.GB608218@tuxmachine.localdomain>
 <CADSoG1vj45D7Fpr-UaYTQCGV+RMk02gH7nPaYnnpPjK_nhkiVg@mail.gmail.com>
Message-ID: <20200904222829.GB658540@tuxmachine.localdomain>

On 03-09-20, Nick Lowe wrote:
> It seems there is an important ath10k patch included in the 4.4.235,
> 4.9.235, 4.14.196 and 4.19.143, 5.4.62 LTS kernels that is applicable
> for OpenWRT users who are not using an up to date CT driver with Wave
> 2 QCA 802.11ac generation hardware, it is already merged for CT.

Do you mean that it affects both ath10k and ath10k-ct in the 19.07 branch?

> It resolves a PCIe hang seen due to the DMA burst size value meaning
> different things between Wave 1 and Wave 2 hardware.
> 
> The issue resolved is that a value of 0 for the DMA burst size has a
> different meaning and instruction depending on the generation.

Do you have more details, references?  A commit?

> Cheers,
> 
> Nick
> 
> On Sun, Aug 30, 2020 at 1:45 PM Baptiste Jonglez
> <baptiste at bitsofnetworks.org> wrote:
> >
> > On 29-08-20, Baptiste Jonglez wrote:
> > > On 28-08-20, Hauke Mehrtens wrote:
> > > > Hi,
> > > >
> > > > I would like to do a 19.07.4 and a 18.06.9 release on Sunday or
> > > > beginning of next week.
> > >
> > > Cool, looks good to me.
> > >
> > > > Is there something missing in the current branches which should get into
> > > > this release?
> > >
> > > There's the ath10k-ct-firmware bump for 19.07: https://patchwork.ozlabs.org/project/openwrt/list/?q=19.07
> > >
> > > I plan to look at the LuCI issue mentioned here: https://openwrt.org/docs/guide-developer/releases/goals/19.07.4
> >
> > I backported a fix for the LuCI issue, the pull request needs to be merged
> > before the 19.07.4 release: https://github.com/openwrt/luci/pull/4402
> >
> > Thanks,
> > Baptiste
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200905/93976381/attachment.sig>

From mail at aparcar.org  Fri Sep  4 18:46:36 2020
From: mail at aparcar.org (Paul Spooren)
Date: Fri,  4 Sep 2020 12:46:36 -1000
Subject: [PATCH 2/2] build: only use fakeroot for packages if required
In-Reply-To: <20200904224636.484105-1-mail@aparcar.org>
References: <20200904224636.484105-1-mail@aparcar.org>
Message-ID: <20200904224636.484105-2-mail@aparcar.org>

Fakeroot was recently wrapped around the `ipkg-build` script to allow
arbitrary file modes for packages, like setting a SUID. However this
slows down the building process while most packages don't make use of
that (by defining `PKG_FILE_MODES`).

This commit only uses fakeroot if `PKG_FILE_MODES` is set. If it is not
defined the newly added *all root* option `-r` is used.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 include/package-ipkg.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 0b7a561edc..362fa25307 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -260,7 +260,13 @@ $(_endef)
     endif
 
 	$(INSTALL_DIR) $$(PDIR_$(1))
+ifdef PKG_FILE_MODES
+	echo "Package $(1) is build with fakeroot" >&2
 	$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(PKG_FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
+else
+	echo "Package $(1) is build without fakeroot" >&2
+	$(SCRIPT_DIR)/ipkg-build -r $$(IDIR_$(1)) $$(PDIR_$(1))
+endif
 	@[ -f $$(IPKG_$(1)) ]
 
     $(1)-clean:
-- 
2.25.1



From mail at aparcar.org  Fri Sep  4 18:46:35 2020
From: mail at aparcar.org (Paul Spooren)
Date: Fri,  4 Sep 2020 12:46:35 -1000
Subject: [PATCH 1/2] build: ipkg-build add -r option for all-root
Message-ID: <20200904224636.484105-1-mail@aparcar.org>

The `ipkg-build` script create installable `ipk` packages. The newly
added `-r` option attaches the `--owner=0 --group=0` to the `tar`
command, allowing to run without a `fakeroot` context and still result
in root-owned package contents. This approach is much faster than
wrapping the packaging script with `fakeroot`.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 scripts/ipkg-build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/ipkg-build b/scripts/ipkg-build
index e3a9a882cf..38149c4432 100755
--- a/scripts/ipkg-build
+++ b/scripts/ipkg-build
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -x
+
 # ipkg-build -- construct a .ipk from a directory
 # Carl Worth <cworth at east.isi.edu>
 # based on a script by Steve Redler IV, steve at sr-tech.com 5-21-2001
@@ -72,13 +74,14 @@ pkg_appears_sane() {
 # ipkg-build "main"
 ###
 file_modes=""
-usage="Usage: $0 [-v] [-h] [-m] <pkg_directory> [<destination_directory>]"
-while getopts "hvm:" opt; do
+usage="Usage: $0 [-v] [-h] [-r] [-m] <pkg_directory> [<destination_directory>]"
+while getopts "hvrm:" opt; do
     case $opt in
 	v ) echo $version
 	    exit 0
 	    ;;
 	h ) 	echo $usage  >&2 ;;
+	r )	TAR="$TAR --owner=0 --group=0" ;;
 	m )	file_modes=$OPTARG ;;
 	\? ) 	echo $usage  >&2
 	esac
-- 
2.25.1



From rosenp at gmail.com  Fri Sep  4 18:48:56 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 4 Sep 2020 15:48:56 -0700
Subject: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <35b3781b-1c57-600a-6b41-ed6480f38692@hauke-m.de>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <35b3781b-1c57-600a-6b41-ed6480f38692@hauke-m.de>
Message-ID: <CAKxU2N-Oofh6Yp8K_0Bg6bXWs1LS1at7fqoZ7Fyr80ouGt1fjA@mail.gmail.com>

On Fri, Aug 28, 2020 at 2:38 PM Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> On 7/30/20 8:57 PM, Baptiste Jonglez wrote:
> > Hi,
> >
> > New point releases for 19.07 and 18.06 are starting to be overdue, and I
> > would like to help 19.07.4 and 18.06.9 get released somewhere around
> > mid-August.
> >
> > The main motivation are fixes for a libubox regression and for the musl
> > synchronisation bug, as well as a LuCI regression (see "release goals"
> > below).  But there are many other fixes, mostly device-related, that also
> > motivate these new point releases.  If you have more fixes to backport,
> > please consider doing so soon, especially for 18.06.9 which will likely be
> > the last release for 18.06.
> >
> >
> > The following links can be useful to track changes for 19.07:
> >
> > - release goals for 19.07.4 (mostly high-level): https://openwrt.org/docs/guide-developer/releases/goals/19.07.4
> >
> > - current release notes for 19.07.4: https://openwrt.org/releases/19.07/notes-19.07.4
> >
> > - pending patches on patchwork for 19.07: https://patchwork.ozlabs.org/project/openwrt/list/?q=19.07
> >
> > - pending patches on github for 19.07: https://github.com/openwrt/openwrt/pulls?q=is%3Apr+is%3Aopen+label%3Arelease%2F19.07
> >
> > - open bug reports for 19.07: https://bugs.openwrt.org/index.php?do=tasklist&project=2&status%5B0%5D=open&reported%5B%5D=10&order=severity&sort=desc
> >
> >
> > And for 18.06 (overall, things are obviously more quiet):
> >
> > - current release notes for 18.06.9: https://openwrt.org/releases/18.06/notes-18.06.9
> >
> > - pending patches on patchwork for 18.06: https://patchwork.ozlabs.org/project/openwrt/list/?q=18.06
> >
> > - pending patches on github for 18.06: https://github.com/openwrt/openwrt/pulls?q=is%3Apr+is%3Aopen+label%3Arelease%2F18.06
> >
> > - open bug reports for 18.06: https://bugs.openwrt.org/index.php?do=tasklist&project=2&status%5B0%5D=open&reported%5B%5D=8&order=severity&sort=desc
> >
> >
> > While everything is mostly ready, the actual release will need somebody
> > with the rights to "push the button": https://openwrt.org/docs/guide-developer/releases/making-service-release
> >
> > Regards,
> > Baptiste
>
> Hi,
>
> I would like to do a 19.07.4 and a 18.06.9 release on Sunday or
> beginning of next week.
>
> Is there something missing in the current branches which should get into
> this release?
http://lists.openwrt.org/pipermail/openwrt-devel/2020-September/031285.html

As noted in my response, the issue was avoided with the 5.4 kernel bump.
>
> Hauke
>
> Hauke
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From mail at david-bauer.net  Fri Sep  4 19:11:22 2020
From: mail at david-bauer.net (David Bauer)
Date: Sat, 5 Sep 2020 01:11:22 +0200
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
References: <20200903230011.38291-1-mail@david-bauer.net>
 <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
Message-ID: <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>

Hi Alexey,

On 9/4/20 10:32 PM, Alexey Dobrovolskiy wrote:
> Hi,
> please, see also
> https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/

I was not aware of this patch. Will merge yours in the coming days.

Best wishes
David

> 
> Best regards,
> Alexey
> 
> ??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>>
>> Previously the max length of a zone name was assuming the max
>> length for a extension in netfilter is 32 bytes while in reality it is
>> only 29.
>>
>> Fix this incorrect assumption to allow firewall3 to validate the zone
>> name lengths correctly.
>>
>> Signed-off-by: David Bauer <mail at david-bauer.net>
>> ---
>>  zones.h | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/zones.h b/zones.h
>> index d786736..beb0e22 100644
>> --- a/zones.h
>> +++ b/zones.h
>> @@ -22,8 +22,12 @@
>>  #include "options.h"
>>  #include "iptables.h"
>>
>> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
>> -#define FW3_ZONE_MAXNAMELEN 14
>> +/* XT_EXTENSION_MAXNAMELEN (29)
>> + *  - sizeof("postrouting_")
>> + *  - sizeof("_rule")
>> + *  - sizeof("\0")
>> + */
>> +#define FW3_ZONE_MAXNAMELEN 11
>>
>>  extern const struct fw3_option fw3_zone_opts[];
>>
>> --
>> 2.28.0
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:28 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:28 +0300
Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
Message-ID: <20200904235133.27813-1-ryazanov.s.a@gmail.com>

This series returns back ath25 target and switches it to 5.4 kernel.

Discussion in the mailing list revealed that this target still has
active users and some boards still have enough Flash/RAM. We are able to
upgrade target to a fresh kernel and there are no objection against
a target recovery. So, lets return the ath25 target back for at least
the next release circle.

Compile- and run-tested with the following boards:
* D-Link DIR-300 A1 (AR2317)
* D-Link DWL-2100AP (AR2313)

Partially tested with Fonera FON2201 (AR2315 based). My single board has
misteriously bricked during a routine sysupgrade (power issue?). But
Ethernet and Wi-Fi interfaces were tested and work as expected.

Sergey Ryazanov (5):
  Revert "ath25: drop target"
  ath25: add kernel 5.4 support
  ath25: eth: fix crash on skb DMA (un-)map
  ath25: switch to 5.4 kernel
  ath25: drop 4.14 kernel support

 package/kernel/mac80211/ath.mk                |   10 +-
 target/linux/ath25/Makefile                   |   25 +
 .../ath25/base-files/etc/board.d/01_leds      |   13 +
 .../ath25/base-files/etc/board.d/02_network   |   28 +
 .../lib/preinit/15_preinit_iface_atheros      |   34 +
 .../ath25/base-files/lib/upgrade/platform.sh  |   76 +
 target/linux/ath25/config-5.4                 |  181 ++
 target/linux/ath25/image/Makefile             |  115 ++
 .../ath25/patches-5.4/107-ar5312_gpio.patch   |  212 ++
 .../ath25/patches-5.4/108-ar2315_gpio.patch   |  363 ++++
 .../patches-5.4/110-ar2313_ethernet.patch     | 1736 +++++++++++++++++
 .../ath25/patches-5.4/120-spiflash.patch      |  631 ++++++
 .../ath25/patches-5.4/130-watchdog.patch      |  277 +++
 .../patches-5.4/140-redboot_boardconfig.patch |   60 +
 .../141-redboot_partition_scan.patch          |   44 +
 .../142-redboot_various_erase_size_fix.patch  |   72 +
 .../ath25/patches-5.4/210-reset_button.patch  |   71 +
 .../220-enet_micrel_workaround.patch          |  111 ++
 .../ath25/patches-5.4/330-board_leds.patch    |  116 ++
 target/linux/ath25/profiles/00-default.mk     |   16 +
 20 files changed, 4188 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ath25/Makefile
 create mode 100755 target/linux/ath25/base-files/etc/board.d/01_leds
 create mode 100755 target/linux/ath25/base-files/etc/board.d/02_network
 create mode 100644 target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
 create mode 100644 target/linux/ath25/base-files/lib/upgrade/platform.sh
 create mode 100644 target/linux/ath25/config-5.4
 create mode 100644 target/linux/ath25/image/Makefile
 create mode 100644 target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
 create mode 100644 target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
 create mode 100644 target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
 create mode 100644 target/linux/ath25/patches-5.4/120-spiflash.patch
 create mode 100644 target/linux/ath25/patches-5.4/130-watchdog.patch
 create mode 100644 target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
 create mode 100644 target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
 create mode 100644 target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
 create mode 100644 target/linux/ath25/patches-5.4/210-reset_button.patch
 create mode 100644 target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
 create mode 100644 target/linux/ath25/patches-5.4/330-board_leds.patch
 create mode 100644 target/linux/ath25/profiles/00-default.mk

-- 
2.26.2



From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:31 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:31 +0300
Subject: [PATCH 3/5] ath25: eth: fix crash on skb DMA (un-)map
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904235133.27813-4-ryazanov.s.a@gmail.com>

AR2315 Ethernet driver pass NULL instead of a real device pointer to DMA
(un-)map calls. With kernel version 5.4 such behaviour causes a kernel
panic. Fix this issue by preserving device pointer during the probe
procedure and pass it to each skb data DMA (un-)map call.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 .../linux/ath25/patches-5.4/110-ar2313_ethernet.patch  | 10 ++++++----
 .../ath25/patches-5.4/220-enet_micrel_workaround.patch | 10 +++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
index e4f5fa8d2e..57c18abf69 100644
--- a/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
+++ b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
@@ -33,7 +33,7 @@
 +obj-$(CONFIG_NET_AR231X) += ar231x.o
 --- /dev/null
 +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -0,0 +1,1119 @@
+@@ -0,0 +1,1120 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -225,6 +225,7 @@
 +
 +	sp = netdev_priv(dev);
 +	sp->dev = dev;
++	sp->pdev = pdev;
 +	sp->cfg = pdev->dev.platform_data;
 +
 +	sprintf(buf, "eth%d_membase", pdev->id);
@@ -787,7 +788,7 @@
 +			break;
 +		}
 +		/* done with this descriptor */
-+		dma_unmap_single(NULL, txdesc->addr,
++		dma_unmap_single(&sp->pdev->dev, txdesc->addr,
 +				 txdesc->devcs & DMA_TX1_BSIZE_MASK,
 +				 DMA_TO_DEVICE);
 +		txdesc->status = 0;
@@ -1014,7 +1015,7 @@
 +	/* Setup the transmit descriptor. */
 +	td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
 +				 (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED));
-+	td->addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
++	td->addr = dma_map_single(&sp->pdev->dev, skb->data, skb->len, DMA_TO_DEVICE);
 +	td->status = DMA_TX_OWN;
 +
 +	/* kick transmitter last */
@@ -1155,7 +1156,7 @@
 +
 --- /dev/null
 +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h
-@@ -0,0 +1,281 @@
+@@ -0,0 +1,282 @@
 +/*
 + * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -1379,6 +1380,7 @@
 + */
 +struct ar231x_private {
 +	struct net_device *dev;
++	struct platform_device *pdev;
 +	int version;
 +	u32 mb[2];
 +
diff --git a/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
index 91b9792515..9051e1b466 100644
--- a/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
+++ b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
@@ -41,7 +41,7 @@
  static int ar231x_probe(struct platform_device *pdev)
  {
  	struct net_device *dev;
-@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_
+@@ -274,6 +301,24 @@ static int ar231x_probe(struct platform_
  
  	mdiobus_register(sp->mii_bus);
  
@@ -66,7 +66,7 @@
  	if (ar231x_mdiobus_probe(dev) != 0) {
  		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
  		rx_tasklet_cleanup(dev);
-@@ -326,8 +371,10 @@ static int ar231x_remove(struct platform
+@@ -327,8 +372,10 @@ static int ar231x_remove(struct platform
  	rx_tasklet_cleanup(dev);
  	ar231x_init_cleanup(dev);
  	unregister_netdev(dev);
@@ -79,7 +79,7 @@
  	kfree(dev);
  	return 0;
  }
-@@ -870,7 +917,8 @@ static int ar231x_open(struct net_device
+@@ -871,7 +918,8 @@ static int ar231x_open(struct net_device
  
  	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
  
@@ -89,7 +89,7 @@
  
  	return 0;
  }
-@@ -951,7 +999,8 @@ static int ar231x_close(struct net_devic
+@@ -952,7 +1000,8 @@ static int ar231x_close(struct net_devic
  
  #endif
  
@@ -99,7 +99,7 @@
  
  	return 0;
  }
-@@ -995,6 +1044,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -996,6 +1045,9 @@ static int ar231x_ioctl(struct net_devic
  {
  	struct ar231x_private *sp = netdev_priv(dev);
  
-- 
2.26.2



From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:30 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:30 +0300
Subject: [PATCH 2/5] ath25: add kernel 5.4 support
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904235133.27813-3-ryazanov.s.a@gmail.com>

Copy and refresh patches and config from 4.14. The only couple of fixes
required to make kernel buildable:
* rework ethernet supported link modes to linkmode bitmask;
* drop erase callback invocation from AR2315 MTD driver.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 target/linux/ath25/Makefile                   |  1 +
 .../linux/ath25/{config-4.14 => config-5.4}   | 73 +++++++++++--------
 .../107-ar5312_gpio.patch                     | 20 ++---
 .../108-ar2315_gpio.patch                     | 18 ++---
 .../110-ar2313_ethernet.patch                 | 30 ++++----
 .../120-spiflash.patch                        |  9 +--
 .../130-watchdog.patch                        |  4 +-
 .../140-redboot_boardconfig.patch             | 14 ++--
 .../141-redboot_partition_scan.patch}         |  8 +-
 .../142-redboot_various_erase_size_fix.patch  | 16 ++--
 .../210-reset_button.patch                    |  0
 .../220-enet_micrel_workaround.patch          |  0
 .../330-board_leds.patch                      |  0
 13 files changed, 101 insertions(+), 92 deletions(-)
 copy target/linux/ath25/{config-4.14 => config-5.4} (76%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/107-ar5312_gpio.patch (92%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/108-ar2315_gpio.patch (95%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/110-ar2313_ethernet.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/120-spiflash.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/130-watchdog.patch (98%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/140-redboot_boardconfig.patch (81%)
 copy target/linux/{ath79/patches-5.4/408-mtd-redboot_partition_scan.patch => ath25/patches-5.4/141-redboot_partition_scan.patch} (79%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/142-redboot_various_erase_size_fix.patch (81%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/210-reset_button.patch (100%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/220-enet_micrel_workaround.patch (100%)
 copy target/linux/ath25/{patches-4.14 => patches-5.4}/330-board_leds.patch (100%)

diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile
index f885112460..0ed40bd54b 100644
--- a/target/linux/ath25/Makefile
+++ b/target/linux/ath25/Makefile
@@ -12,6 +12,7 @@ BOARDNAME:=Atheros AR231x/AR5312
 FEATURES:=squashfs low_mem small_flash
 
 KERNEL_PATCHVER:=4.14
+KERNEL_TESTING_PATCHVER:=5.4
 
 define Target/Description
 	Build firmware images for Atheros SoC boards
diff --git a/target/linux/ath25/config-4.14 b/target/linux/ath25/config-5.4
similarity index 76%
copy from target/linux/ath25/config-4.14
copy to target/linux/ath25/config-5.4
index 734f598cd0..f59f48f655 100644
--- a/target/linux/ath25/config-4.14
+++ b/target/linux/ath25/config-5.4
@@ -1,26 +1,26 @@
 CONFIG_ADM6996_PHY=y
 CONFIG_AR2315_WDT=y
 CONFIG_AR8216_PHY=y
-CONFIG_ARCH_BINFMT_ELF_STATE=y
+CONFIG_ARCH_32BIT_OFF_T=y
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y
+CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y
+CONFIG_ARCH_HAS_DMA_WRITE_COMBINE=y
 CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set
-# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set
+CONFIG_ARCH_HAS_PHYS_TO_DMA=y
+CONFIG_ARCH_HAS_PTE_SPECIAL=y
+CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
+CONFIG_ARCH_HAS_UNCACHED_SEGMENT=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
 CONFIG_ARCH_MMAP_RND_BITS_MAX=15
 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_MEMREMAP_PROT=y
 CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
 CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
+CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_ATH25=y
 CONFIG_BLK_MQ_PCI=y
@@ -29,8 +29,10 @@ CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
 CONFIG_CMDLINE_BOOL=y
 # CONFIG_CMDLINE_OVERRIDE is not set
+CONFIG_COMPAT_32BIT_TIME=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_CPU_GENERIC_DUMP_TLB=y
+CONFIG_CPU_HAS_LOAD_STORE_LR=y
 CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_CPU_MIPS32=y
@@ -38,23 +40,34 @@ CONFIG_CPU_MIPS32_R1=y
 CONFIG_CPU_MIPSR1=y
 CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
 CONFIG_CPU_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
+CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
 CONFIG_EARLY_PRINTK=y
+CONFIG_EFI_EARLYCON=y
 CONFIG_ETHERNET_PACKET_MANGLE=y
+CONFIG_FONT_8x16=y
+CONFIG_FONT_AUTOSELECT=y
+CONFIG_FONT_SUPPORT=y
+CONFIG_FORCE_PCI=y
+CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
-CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_GETTIMEOFDAY=y
+CONFIG_GENERIC_IOMAP=y
 CONFIG_GENERIC_IRQ_CHIP=y
 CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
 CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_LIB_ASHLDI3=y
+CONFIG_GENERIC_LIB_ASHRDI3=y
+CONFIG_GENERIC_LIB_CMPDI2=y
+CONFIG_GENERIC_LIB_LSHRDI3=y
+CONFIG_GENERIC_LIB_UCMPDI2=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SCHED_CLOCK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
@@ -62,48 +75,48 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_AR2315=y
 CONFIG_GPIO_AR5312=y
-# CONFIG_GRO_CELLS is not set
 CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_COMPILER_H=y
 CONFIG_HAVE_ARCH_JUMP_LABEL=y
 CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_ASM_MODVERSIONS=y
 CONFIG_HAVE_CBPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
 CONFIG_HAVE_CONTEXT_TRACKING=y
 CONFIG_HAVE_COPY_THREAD_TLS=y
 CONFIG_HAVE_C_RECORDMCOUNT=y
 CONFIG_HAVE_DEBUG_KMEMLEAK=y
 CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
 CONFIG_HAVE_DMA_CONTIGUOUS=y
 CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FAST_GUP=y
 CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
 CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_VDSO=y
 CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
 CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
 CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
 CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
 CONFIG_HAVE_NET_DSA=y
 CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PCI=y
 CONFIG_HAVE_PERF_EVENTS=y
 CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_RSEQ=y
 CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
 CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HW_HAS_PCI=y
 CONFIG_HW_RANDOM=y
+CONFIG_HZ=250
+CONFIG_HZ_250=y
 CONFIG_HZ_PERIODIC=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IP17XX_PHY=y
@@ -112,17 +125,19 @@ CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_MIPS_CPU=y
 CONFIG_IRQ_WORK=y
 CONFIG_LEDS_GPIO=y
+CONFIG_LOCK_DEBUGGING_SUPPORT=y
 CONFIG_MDIO_BUS=y
 CONFIG_MDIO_DEVICE=y
+CONFIG_MEMFD_CREATE=y
+CONFIG_MIGRATION=y
 CONFIG_MIPS=y
 CONFIG_MIPS_ASID_BITS=8
 CONFIG_MIPS_ASID_SHIFT=0
+CONFIG_MIPS_CBPF_JIT=y
 CONFIG_MIPS_CLOCK_VSYSCALL=y
 # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
 CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MTD_AR2315=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -137,7 +152,6 @@ CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NET_AR231X=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
-# CONFIG_NO_IOPORT_MAP is not set
 # CONFIG_OF is not set
 CONFIG_PCI=y
 CONFIG_PCI_AR2315=y
@@ -147,13 +161,9 @@ CONFIG_PCI_DRIVERS_LEGACY=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PHYLIB=y
-# CONFIG_RCU_NEED_SEGCBLIST is not set
-# CONFIG_RCU_STALL_COMMON is not set
-# CONFIG_SCHED_INFO is not set
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250_FSL is not set
 CONFIG_SERIAL_8250_NR_UARTS=1
 CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SERIAL_MCTRL_GPIO=y
 CONFIG_SOC_AR2315=y
 CONFIG_SOC_AR5312=y
 CONFIG_SRCU=y
@@ -165,6 +175,7 @@ CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_TARGET_ISA_REV=1
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TINY_SRCU=y
 CONFIG_USB_SUPPORT=y
diff --git a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch b/target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
similarity index 92%
copy from target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
copy to target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
index e74e20b05a..cd7b27d636 100644
--- a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
+++ b/target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
@@ -52,7 +52,7 @@
  		if (!ath25_board.radio)
 --- a/drivers/gpio/Kconfig
 +++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
+@@ -113,6 +113,13 @@ config GPIO_AMDPT
  	  driver for GPIO functionality on Promontory IOHub
  	  Require ACPI ASL code to enumerate as a platform device.
  
@@ -68,14 +68,14 @@
  	depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO
 --- a/drivers/gpio/Makefile
 +++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
- obj-$(CONFIG_GPIO_ASPEED)	+= gpio-aspeed.o
+@@ -30,6 +30,7 @@ obj-$(CONFIG_GPIO_ALTERA)  		+= gpio-alt
+ obj-$(CONFIG_GPIO_AMD8111)		+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMD_FCH)		+= gpio-amd-fch.o
+ obj-$(CONFIG_GPIO_AMDPT)		+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR5312)		+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)		+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ASPEED)		+= gpio-aspeed.o
+ obj-$(CONFIG_GPIO_ATH79)		+= gpio-ath79.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ar5312.c
 @@ -0,0 +1,121 @@
@@ -202,7 +202,7 @@
 +subsys_initcall(ar5312_gpio_init);
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -175,6 +175,7 @@ config ATH25
+@@ -189,6 +189,7 @@ config ATH25
  	select CEVT_R4K
  	select CSRC_R4K
  	select DMA_NONCOHERENT
diff --git a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch b/target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
similarity index 95%
copy from target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
copy to target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
index 749b308b89..e198cecf15 100644
--- a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
+++ b/target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
@@ -75,7 +75,7 @@
  	 * workaround. Attempt to jump to the mips reset location -
 --- a/drivers/gpio/Kconfig
 +++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
+@@ -113,6 +113,13 @@ config GPIO_AMDPT
  	  driver for GPIO functionality on Promontory IOHub
  	  Require ACPI ASL code to enumerate as a platform device.
  
@@ -91,14 +91,14 @@
  	default y if SOC_AR5312
 --- a/drivers/gpio/Makefile
 +++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR2315)	+= gpio-ar2315.o
- obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+@@ -30,6 +30,7 @@ obj-$(CONFIG_GPIO_ALTERA)  		+= gpio-alt
+ obj-$(CONFIG_GPIO_AMD8111)		+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMD_FCH)		+= gpio-amd-fch.o
+ obj-$(CONFIG_GPIO_AMDPT)		+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR2315)		+= gpio-ar2315.o
+ obj-$(CONFIG_GPIO_AR5312)		+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)		+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ASPEED)		+= gpio-aspeed.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ar2315.c
 @@ -0,0 +1,233 @@
diff --git a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
copy to target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
index a2b1492250..e4f5fa8d2e 100644
--- a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
+++ b/target/linux/ath25/patches-5.4/110-ar2313_ethernet.patch
@@ -1,22 +1,22 @@
 --- a/drivers/net/ethernet/atheros/Makefile
 +++ b/drivers/net/ethernet/atheros/Makefile
-@@ -8,3 +8,4 @@ obj-$(CONFIG_ATL2) += atlx/
+@@ -9,3 +9,4 @@ obj-$(CONFIG_ATL2) += atlx/
  obj-$(CONFIG_ATL1E) += atl1e/
  obj-$(CONFIG_ATL1C) += atl1c/
  obj-$(CONFIG_ALX) += alx/
 +obj-$(CONFIG_NET_AR231X) += ar231x/
 --- a/drivers/net/ethernet/atheros/Kconfig
 +++ b/drivers/net/ethernet/atheros/Kconfig
-@@ -5,7 +5,7 @@
+@@ -6,7 +6,7 @@
  config NET_VENDOR_ATHEROS
  	bool "Atheros devices"
  	default y
--	depends on PCI
-+	depends on (PCI || ATH25)
+-	depends on (PCI || ATH79)
++	depends on (PCI || ATH25 || ATH79)
  	---help---
  	  If you have a network (Ethernet) card belonging to this class, say Y.
  
-@@ -78,4 +78,10 @@ config ALX
+@@ -87,4 +87,10 @@ config ALX
  	  To compile this driver as a module, choose M here.  The module
  	  will be called alx.
  
@@ -1113,6 +1113,7 @@
 +
 +static int ar231x_mdiobus_probe(struct net_device *dev)
 +{
++	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 +	struct ar231x_private *const sp = netdev_priv(dev);
 +	struct phy_device *phydev = NULL;
 +
@@ -1134,16 +1135,15 @@
 +	}
 +
 +	/* mask with MAC supported features */
-+	phydev->supported &= (SUPPORTED_10baseT_Half
-+		| SUPPORTED_10baseT_Full
-+		| SUPPORTED_100baseT_Half
-+		| SUPPORTED_100baseT_Full
-+		| SUPPORTED_Autoneg
-+		/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
-+		| SUPPORTED_MII
-+		| SUPPORTED_TP);
++	linkmode_set_bit_array(phy_10_100_features_array,
++			       ARRAY_SIZE(phy_10_100_features_array),
++			       mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask);
++	linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, mask);
 +
-+	phydev->advertising = phydev->supported;
++	linkmode_and(phydev->supported, phydev->supported, mask);
++	linkmode_copy(phydev->advertising, phydev->supported);
 +
 +	sp->phy_dev = phydev;
 +
@@ -1713,7 +1713,7 @@
 +
  void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
  {
- 	struct uart_port s;
+ #ifdef CONFIG_SERIAL_8250_CONSOLE
 --- a/arch/mips/include/asm/mach-ath25/ath25_platform.h
 +++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h
 @@ -71,4 +71,15 @@ struct ar231x_board_config {
diff --git a/target/linux/ath25/patches-4.14/120-spiflash.patch b/target/linux/ath25/patches-5.4/120-spiflash.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/120-spiflash.patch
copy to target/linux/ath25/patches-5.4/120-spiflash.patch
index 0a2161fb7e..52460f89dd 100644
--- a/target/linux/ath25/patches-4.14/120-spiflash.patch
+++ b/target/linux/ath25/patches-5.4/120-spiflash.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/devices/Kconfig
 +++ b/drivers/mtd/devices/Kconfig
-@@ -130,6 +130,10 @@ config MTD_BCM47XXSFLASH
+@@ -114,6 +114,10 @@ config MTD_BCM47XXSFLASH
  	  registered by bcma as platform devices. This enables driver for
  	  serial flash memories.
  
@@ -13,7 +13,7 @@
  	help
 --- a/drivers/mtd/devices/Makefile
 +++ b/drivers/mtd/devices/Makefile
-@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
+@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataf
  obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
  obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
  obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
@@ -23,7 +23,7 @@
  obj-$(CONFIG_MTD_POWERNV_FLASH)	+= powernv_flash.o
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,459 @@
+@@ -0,0 +1,456 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -284,9 +284,6 @@
 +
 +	mutex_unlock(&priv->lock);
 +
-+	instr->state = MTD_ERASE_DONE;
-+	mtd_erase_callback(instr);
-+
 +	return 0;
 +}
 +
diff --git a/target/linux/ath25/patches-4.14/130-watchdog.patch b/target/linux/ath25/patches-5.4/130-watchdog.patch
similarity index 98%
copy from target/linux/ath25/patches-4.14/130-watchdog.patch
copy to target/linux/ath25/patches-5.4/130-watchdog.patch
index 01904d69a5..8a5bd83418 100644
--- a/target/linux/ath25/patches-4.14/130-watchdog.patch
+++ b/target/linux/ath25/patches-5.4/130-watchdog.patch
@@ -212,7 +212,7 @@
 +MODULE_ALIAS("platform:" DRIVER_NAME);
 --- a/drivers/watchdog/Kconfig
 +++ b/drivers/watchdog/Kconfig
-@@ -1647,6 +1647,13 @@ config PIC32_DMT
+@@ -1830,6 +1830,13 @@ config PIC32_DMT
  	  To compile this driver as a loadable module, choose M here.
  	  The module will be called pic32-dmt.
  
@@ -228,7 +228,7 @@
  # POWERPC Architecture
 --- a/drivers/watchdog/Makefile
 +++ b/drivers/watchdog/Makefile
-@@ -166,6 +166,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+@@ -161,6 +161,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
  obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
  obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
  obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
diff --git a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
similarity index 81%
copy from target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
copy to target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
index 6aad761cb1..0ffa12eec0 100644
--- a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
+++ b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch
@@ -1,6 +1,6 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -30,6 +30,8 @@
+--- a/drivers/mtd/parsers/redboot.c
++++ b/drivers/mtd/parsers/redboot.c
+@@ -16,6 +16,8 @@
  #include <linux/mtd/partitions.h>
  #include <linux/module.h>
  
@@ -9,7 +9,7 @@
  struct fis_image_desc {
      unsigned char name[16];      // Null terminated name
      uint32_t	  flash_base;    // Address within FLASH of image
-@@ -60,6 +62,7 @@ static int parse_redboot_partitions(stru
+@@ -67,6 +69,7 @@ static int parse_redboot_partitions(stru
  				    const struct mtd_partition **pparts,
  				    struct mtd_part_parser_data *data)
  {
@@ -17,7 +17,7 @@
  	int nrparts = 0;
  	struct fis_image_desc *buf;
  	struct mtd_partition *parts;
-@@ -225,14 +228,15 @@ static int parse_redboot_partitions(stru
+@@ -234,14 +237,15 @@ static int parse_redboot_partitions(stru
  		}
  	}
  #endif
@@ -35,7 +35,7 @@
  #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  	if (nulllen > 0) {
  		strcpy(nullname, nullstring);
-@@ -251,6 +255,8 @@ static int parse_redboot_partitions(stru
+@@ -260,6 +264,8 @@ static int parse_redboot_partitions(stru
  	}
  #endif
  	for ( ; i<nrparts; i++) {
@@ -44,7 +44,7 @@
  		parts[i].size = fl->img->size;
  		parts[i].offset = fl->img->flash_base;
  		parts[i].name = names;
-@@ -284,6 +290,13 @@ static int parse_redboot_partitions(stru
+@@ -293,6 +299,13 @@ static int parse_redboot_partitions(stru
  		fl = fl->next;
  		kfree(tmp_fl);
  	}
diff --git a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
similarity index 79%
copy from target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch
copy to target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
index 8f3ee32f57..3302d6d247 100644
--- a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch
+++ b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/parsers/redboot.c
 +++ b/drivers/mtd/parsers/redboot.c
-@@ -85,12 +85,18 @@ static int parse_redboot_partitions(stru
+@@ -88,12 +88,18 @@ static int parse_redboot_partitions(stru
  
  	parse_redboot_of(master);
  
@@ -19,7 +19,7 @@
  				return -EIO;
  			}
  			offset -= master->erasesize;
-@@ -103,10 +109,6 @@ static int parse_redboot_partitions(stru
+@@ -106,10 +112,6 @@ static int parse_redboot_partitions(stru
  				goto nogood;
  		}
  	}
@@ -30,12 +30,12 @@
  
  	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
  	       master->name, offset);
-@@ -179,6 +181,11 @@ static int parse_redboot_partitions(stru
+@@ -182,6 +184,11 @@ static int parse_redboot_partitions(stru
  	}
  	if (i == numslots) {
  		/* Didn't find it */
 +		if (offset + master->erasesize < master->size) {
-+			/* not at the end of the flash yet, maybe next block :) */
++			/* not at the end of the flash yet, maybe next block */
 +			directory++;
 +			goto restart;
 +		}
diff --git a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
similarity index 81%
copy from target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
copy to target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
index ce039df9f1..2ac0eb92bf 100644
--- a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
+++ b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch
@@ -1,7 +1,7 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -58,6 +58,22 @@ static inline int redboot_checksum(struc
- 	return 1;
+--- a/drivers/mtd/parsers/redboot.c
++++ b/drivers/mtd/parsers/redboot.c
+@@ -65,6 +65,22 @@ static void parse_redboot_of(struct mtd_
+ 	directory = dirblock;
  }
  
 +static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset)
@@ -23,7 +23,7 @@
  static int parse_redboot_partitions(struct mtd_info *master,
  				    const struct mtd_partition **pparts,
  				    struct mtd_part_parser_data *data)
-@@ -74,6 +90,7 @@ static int parse_redboot_partitions(stru
+@@ -81,6 +97,7 @@ static int parse_redboot_partitions(stru
  	int namelen = 0;
  	int nulllen = 0;
  	int numslots;
@@ -31,7 +31,7 @@
  	unsigned long offset;
  #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  	static char nullstring[] = "unallocated";
-@@ -186,7 +203,10 @@ static int parse_redboot_partitions(stru
+@@ -195,7 +212,10 @@ static int parse_redboot_partitions(stru
  		goto out;
  	}
  
@@ -43,7 +43,7 @@
  		struct fis_list *new_fl, **prev;
  
  		if (buf[i].name[0] == 0xff) {
-@@ -262,12 +282,13 @@ static int parse_redboot_partitions(stru
+@@ -271,12 +291,13 @@ static int parse_redboot_partitions(stru
  	}
  #endif
  	for ( ; i<nrparts; i++) {
@@ -59,7 +59,7 @@
  		strcpy(names, fl->img->name);
  #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
  		if (!memcmp(names, "RedBoot", 8) ||
-@@ -297,7 +318,9 @@ static int parse_redboot_partitions(stru
+@@ -306,7 +327,9 @@ static int parse_redboot_partitions(stru
  		fl = fl->next;
  		kfree(tmp_fl);
  	}
diff --git a/target/linux/ath25/patches-4.14/210-reset_button.patch b/target/linux/ath25/patches-5.4/210-reset_button.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/210-reset_button.patch
copy to target/linux/ath25/patches-5.4/210-reset_button.patch
diff --git a/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
copy to target/linux/ath25/patches-5.4/220-enet_micrel_workaround.patch
diff --git a/target/linux/ath25/patches-4.14/330-board_leds.patch b/target/linux/ath25/patches-5.4/330-board_leds.patch
similarity index 100%
copy from target/linux/ath25/patches-4.14/330-board_leds.patch
copy to target/linux/ath25/patches-5.4/330-board_leds.patch
-- 
2.26.2



From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:32 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:32 +0300
Subject: [PATCH 4/5] ath25: switch to 5.4 kernel
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904235133.27813-5-ryazanov.s.a@gmail.com>

Switch to actual kernel version.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 target/linux/ath25/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile
index 0ed40bd54b..3edbaf19b6 100644
--- a/target/linux/ath25/Makefile
+++ b/target/linux/ath25/Makefile
@@ -11,7 +11,7 @@ BOARD:=ath25
 BOARDNAME:=Atheros AR231x/AR5312
 FEATURES:=squashfs low_mem small_flash
 
-KERNEL_PATCHVER:=4.14
+KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.4
 
 define Target/Description
-- 
2.26.2



From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:29 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:29 +0300
Subject: [PATCH 1/5] Revert "ath25: drop target"
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904235133.27813-2-ryazanov.s.a@gmail.com>

This reverts commit 7d29a557140381ef1815329f6843b88b4126d490.

Discussion in the mailing list reveals that this target have active
users. Also we are able to uprgade this target to 5.4 kernel, so
resurect the target first by reverting the commit.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 package/kernel/mac80211/ath.mk                |   10 +-
 target/linux/ath25/Makefile                   |   24 +
 .../ath25/base-files/etc/board.d/01_leds      |   13 +
 .../ath25/base-files/etc/board.d/02_network   |   28 +
 .../lib/preinit/15_preinit_iface_atheros      |   34 +
 .../ath25/base-files/lib/upgrade/platform.sh  |   76 +
 target/linux/ath25/config-4.14                |  170 ++
 target/linux/ath25/image/Makefile             |  115 ++
 .../ath25/patches-4.14/107-ar5312_gpio.patch  |  212 ++
 .../ath25/patches-4.14/108-ar2315_gpio.patch  |  363 ++++
 .../patches-4.14/110-ar2313_ethernet.patch    | 1734 +++++++++++++++++
 .../ath25/patches-4.14/120-spiflash.patch     |  634 ++++++
 .../ath25/patches-4.14/130-watchdog.patch     |  277 +++
 .../140-redboot_boardconfig.patch             |   60 +
 .../141-redboot_partition_scan.patch          |   44 +
 .../142-redboot_various_erase_size_fix.patch  |   72 +
 .../ath25/patches-4.14/210-reset_button.patch |   71 +
 .../220-enet_micrel_workaround.patch          |  111 ++
 .../ath25/patches-4.14/330-board_leds.patch   |  116 ++
 target/linux/ath25/profiles/00-default.mk     |   16 +
 20 files changed, 4177 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ath25/Makefile
 create mode 100755 target/linux/ath25/base-files/etc/board.d/01_leds
 create mode 100755 target/linux/ath25/base-files/etc/board.d/02_network
 create mode 100644 target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
 create mode 100644 target/linux/ath25/base-files/lib/upgrade/platform.sh
 create mode 100644 target/linux/ath25/config-4.14
 create mode 100644 target/linux/ath25/image/Makefile
 create mode 100644 target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
 create mode 100644 target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
 create mode 100644 target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
 create mode 100644 target/linux/ath25/patches-4.14/120-spiflash.patch
 create mode 100644 target/linux/ath25/patches-4.14/130-watchdog.patch
 create mode 100644 target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
 create mode 100644 target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
 create mode 100644 target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
 create mode 100644 target/linux/ath25/patches-4.14/210-reset_button.patch
 create mode 100644 target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
 create mode 100644 target/linux/ath25/patches-4.14/330-board_leds.patch
 create mode 100644 target/linux/ath25/profiles/00-default.mk

diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk
index 45037738de..5db4be8daa 100644
--- a/package/kernel/mac80211/ath.mk
+++ b/package/kernel/mac80211/ath.mk
@@ -55,7 +55,11 @@ config-$(call config_package,ath9k-htc) += ATH9K_HTC
 config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
 
 config-$(call config_package,ath5k) += ATH5K
-config-y += ATH5K_PCI
+ifdef CONFIG_TARGET_ath25
+  config-y += ATH5K_AHB
+else
+  config-y += ATH5K_PCI
+endif
 
 config-$(call config_package,ath6kl) += ATH6KL
 config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO
@@ -117,7 +121,7 @@ endef
 define KernelPackage/ath
   $(call KernelPackage/mac80211/Default)
   TITLE:=Atheros common driver part
-  DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79 +kmod-mac80211
+  DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79||TARGET_ath25 +kmod-mac80211
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
   MENU:=1
 endef
@@ -130,7 +134,7 @@ define KernelPackage/ath5k
   $(call KernelPackage/mac80211/Default)
   TITLE:=Atheros 5xxx wireless cards support
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
-  DEPENDS+= @PCI_SUPPORT +kmod-ath + at DRIVER_11W_SUPPORT
+  DEPENDS+= @(PCI_SUPPORT||TARGET_ath25) +kmod-ath + at DRIVER_11W_SUPPORT
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
   AUTOLOAD:=$(call AutoProbe,ath5k)
 endef
diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile
new file mode 100644
index 0000000000..f885112460
--- /dev/null
+++ b/target/linux/ath25/Makefile
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=mips
+BOARD:=ath25
+BOARDNAME:=Atheros AR231x/AR5312
+FEATURES:=squashfs low_mem small_flash
+
+KERNEL_PATCHVER:=4.14
+
+define Target/Description
+	Build firmware images for Atheros SoC boards
+endef
+
+include $(INCLUDE_DIR)/target.mk
+
+DEFAULT_PACKAGES += wpad-basic-wolfssl kmod-ath5k swconfig kmod-gpio-button-hotplug
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/ath25/base-files/etc/board.d/01_leds b/target/linux/ath25/base-files/etc/board.d/01_leds
new file mode 100755
index 0000000000..e6ab4a76b1
--- /dev/null
+++ b/target/linux/ath25/base-files/etc/board.d/01_leds
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Copyright 2012-2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+ucidef_set_led_netdev "wlan" "wlan" "wlan" "wlan0"
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath25/base-files/etc/board.d/02_network b/target/linux/ath25/base-files/etc/board.d/02_network
new file mode 100755
index 0000000000..b2977f7b94
--- /dev/null
+++ b/target/linux/ath25/base-files/etc/board.d/02_network
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+if [ -e "/sys/bus/mdio_bus/drivers/IC+ IP175C/0:00" -o \
+     -e "/sys/bus/mdio_bus/drivers/IC+ IP17xx/0:00" ] && \
+   [ -x /sbin/swconfig ];
+then
+	ucidef_add_switch "eth0" \
+		"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5 at eth0"
+
+elif [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
+       -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ];
+then
+	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+
+elif [ -d /sys/class/net/eth1 ]; then
+	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+
+else
+	ucidef_set_interface_lan "eth0"
+fi
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros b/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
new file mode 100644
index 0000000000..235ba4befc
--- /dev/null
+++ b/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
@@ -0,0 +1,34 @@
+# reset button only supported on ar5315+ at the moment
+preinit_ip() {
+	if [ -z "$pi_ifname" ]; then
+		grep -q 'Atheros AR231[567]' /proc/cpuinfo && {
+			if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
+			     -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
+				vconfig set_name_type DEV_PLUS_VID_NO_PAD
+				ip link set eth0 up
+				vconfig add eth0 1
+				ifname=eth0.1
+			else
+				ifname=eth0
+			fi
+			pi_ifname=$ifname
+		}
+	fi
+	[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
+		ip addr add $pi_ip/$pi_netmask broadcast $pi_broadcast dev $pi_ifname
+		ip link set $pi_ifname up
+	}
+}
+
+
+# reset button only supported on ar5315+ at the moment
+
+preinit_ip_deconfig() {
+	if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
+	     -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
+		vconfig rem eth0.1 2>/dev/null
+		ip link set $pi_ifname down
+	elif [ -n "$pi_ifname" ]; then
+		ip -4 addr flush dev $pi_ifname
+	fi
+}
diff --git a/target/linux/ath25/base-files/lib/upgrade/platform.sh b/target/linux/ath25/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000000..778bbf5a39
--- /dev/null
+++ b/target/linux/ath25/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,76 @@
+CI_BLKSZ=65536
+CI_LDADR=0x80041000
+
+platform_find_partitions() {
+	local first dev size erasesize name
+	while read dev size erasesize name; do
+		name=${name#'"'}; name=${name%'"'}
+		case "$name" in
+			vmlinux.bin.l7|kernel|linux|rootfs)
+				if [ -z "$first" ]; then
+					first="$name"
+				else
+					echo "$erasesize:$first:$name"
+					break
+				fi
+			;;
+		esac
+	done < /proc/mtd
+}
+
+platform_find_kernelpart() {
+	local part
+	for part in "${1%:*}" "${1#*:}"; do
+		case "$part" in
+			vmlinux.bin.l7|kernel|linux)
+				echo "$part"
+				break
+			;;
+		esac
+	done
+}
+
+platform_check_image() {
+	[ "$#" -gt 1 ] && return 1
+
+	case "$(get_magic_word "$1")" in
+		# Combined Image
+		4349)
+			local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null)
+			local md5_chk=$(dd if="$1" bs=$CI_BLKSZ skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}"
+
+			if [ -n "$md5_img" -a -n "$md5_chk" ] && [ "$md5_img" = "$md5_chk" ]; then
+				return 0
+			else
+				echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)"
+				return 1
+			fi
+		;;
+		*)
+			echo "Invalid image. Use combined .img files on this platform"
+			return 1
+		;;
+	esac
+}
+
+platform_do_upgrade() {
+	local partitions=$(platform_find_partitions)
+	local kernelpart=$(platform_find_kernelpart "${partitions#*:}")
+	local erase_size=$((0x${partitions%%:*})); partitions="${partitions#*:}"
+	local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null)
+	local kern_blocks=$(($kern_length / $CI_BLKSZ))
+	local root_blocks=$((0x$(dd if="$1" bs=2 skip=5 count=4 2>/dev/null) / $CI_BLKSZ))
+
+	if [ -n "$partitions" ] && [ -n "$kernelpart" ] && \
+	   [ ${kern_blocks:-0} -gt 0 ] && \
+	   [ ${root_blocks:-0} -gt ${kern_blocks:-0} ] && \
+	   [ ${erase_size:-0} -gt 0 ];
+	then
+		local append=""
+		[ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
+
+		( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \
+		  dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \
+			mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions
+	fi
+}
diff --git a/target/linux/ath25/config-4.14 b/target/linux/ath25/config-4.14
new file mode 100644
index 0000000000..734f598cd0
--- /dev/null
+++ b/target/linux/ath25/config-4.14
@@ -0,0 +1,170 @@
+CONFIG_ADM6996_PHY=y
+CONFIG_AR2315_WDT=y
+CONFIG_AR8216_PHY=y
+CONFIG_ARCH_BINFMT_ELF_STATE=y
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
+CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
+# CONFIG_ARCH_HAS_SG_CHAIN is not set
+# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set
+# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_BITS_MAX=15
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
+# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set
+# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
+CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_ATH25=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_CEVT_R4K=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
+CONFIG_CMDLINE_BOOL=y
+# CONFIG_CMDLINE_OVERRIDE is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CPU_GENERIC_DUMP_TLB=y
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+CONFIG_CPU_MIPS32=y
+CONFIG_CPU_MIPS32_R1=y
+CONFIG_CPU_MIPSR1=y
+CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
+CONFIG_CPU_R4K_CACHE_TLB=y
+CONFIG_CPU_R4K_FPU=y
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_CSRC_R4K=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_ETHERNET_PACKET_MANGLE=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_AR2315=y
+CONFIG_GPIO_AR5312=y
+# CONFIG_GRO_CELLS is not set
+CONFIG_HANDLE_DOMAIN_IRQ=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+# CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_CBPF_JIT=y
+CONFIG_HAVE_CC_STACKPROTECTOR=y
+CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_COPY_THREAD_TLS=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
+CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+CONFIG_HW_HAS_PCI=y
+CONFIG_HW_RANDOM=y
+CONFIG_HZ_PERIODIC=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IP17XX_PHY=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_MIPS_CPU=y
+CONFIG_IRQ_WORK=y
+CONFIG_LEDS_GPIO=y
+CONFIG_MDIO_BUS=y
+CONFIG_MDIO_DEVICE=y
+CONFIG_MIPS=y
+CONFIG_MIPS_ASID_BITS=8
+CONFIG_MIPS_ASID_SHIFT=0
+CONFIG_MIPS_CLOCK_VSYSCALL=y
+# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
+CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
+# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+# CONFIG_MIPS_MACHINE is not set
+CONFIG_MODULES_USE_ELF_REL=y
+CONFIG_MTD_AR2315=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+# CONFIG_MTD_CFI_GEOMETRY is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_MYLOADER_PARTS=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
+CONFIG_MTD_REDBOOT_PARTS=y
+CONFIG_MVSWITCH_PHY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NET_AR231X=y
+CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
+# CONFIG_NO_IOPORT_MAP is not set
+# CONFIG_OF is not set
+CONFIG_PCI=y
+CONFIG_PCI_AR2315=y
+CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_DRIVERS_LEGACY=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_PHYLIB=y
+# CONFIG_RCU_NEED_SEGCBLIST is not set
+# CONFIG_RCU_STALL_COMMON is not set
+# CONFIG_SCHED_INFO is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SERIAL_8250_FSL is not set
+CONFIG_SERIAL_8250_NR_UARTS=1
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SOC_AR2315=y
+CONFIG_SOC_AR5312=y
+CONFIG_SRCU=y
+# CONFIG_SWAP is not set
+CONFIG_SWCONFIG=y
+CONFIG_SYSCTL_EXCEPTION_TRACE=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_TINY_SRCU=y
+CONFIG_USB_SUPPORT=y
diff --git a/target/linux/ath25/image/Makefile b/target/linux/ath25/image/Makefile
new file mode 100644
index 0000000000..8066ba61a8
--- /dev/null
+++ b/target/linux/ath25/image/Makefile
@@ -0,0 +1,115 @@
+#
+# Copyright (C) 2006-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+define Build/mkfwimage
+	$(STAGING_DIR_HOST)/bin/mkfwimage \
+		-B $(1).$(VERSION_DIST).$(REVISION) \
+		-k $(IMAGE_KERNEL) \
+		-r $(IMAGE_ROOTFS) \
+		-o $@.new && \
+	mv $@.new $@
+endef
+
+define Build/combined-image
+	-sh $(TOPDIR)/scripts/combined-image.sh \
+		"$(IMAGE_KERNEL)" \
+		"$(IMAGE_ROOTFS)" \
+		"$@.new" && \
+	mv $@.new $@
+endef
+
+define Build/mkmylofw
+	$(STAGING_DIR_HOST)/bin/mkmylofw -B $(1) \
+		-p0x020000:0x130000:ah:0x80041000:linux:$(IMAGE_KERNEL) \
+		-p0x150000:0x2a0000:::rootfs:$(IMAGE_ROOTFS) \
+		$@.new && \
+	mv $@.new $@
+endef
+
+define Build/gzip-kernel
+	gzip -9n -c $@ > $@.gz
+	dd if=$@.gz of=$@ bs=65536 conv=sync
+endef
+
+define Build/lzma-kernel
+	$(STAGING_DIR_HOST)/bin/lzma e $@ $@.l7
+	dd if=$@.l7 of=$@ bs=65536 conv=sync
+endef
+
+define Build/copy-kernel
+	rm -f $@ $@.elf
+	cp $< $@
+	cp $< $@.elf
+endef
+
+define Build/elf-kernel
+	cp $(IMAGE_KERNEL).elf $@
+endef
+
+
+define Device/Default
+  PROFILES = Default $$(DEVICE_NAME)
+  KERNEL := copy-kernel | lzma-kernel
+  IMAGES := sysupgrade.bin
+  FILESYSTEMS := squashfs
+endef
+
+define Device/generic
+  DEVICE_VENDOR := Atheros
+  DEVICE_MODEL := Generic AR2xxx board
+  IMAGES := kernel.lzma kernel.elf kernel.gz rootfs.bin sysupgrade.bin
+  IMAGE/kernel.gz := elf-kernel | gzip-kernel
+  IMAGE/kernel.elf := elf-kernel
+  IMAGE/kernel.lzma := elf-kernel | lzma-kernel
+  IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | combined-image
+  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(if $$(findstring kernel,$$(2)),,$$(1)-)$$(2)
+endef
+TARGET_DEVICES += generic
+
+define Device/ubnt2-pico2
+  DEVICE_VENDOR := Ubiquiti
+  DEVICE_MODEL := XS2-8
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2-8 -v XS2.ar2316
+endef
+TARGET_DEVICES += ubnt2-pico2
+
+define Device/ubnt2
+  DEVICE_VENDOR := Ubiquiti
+  DEVICE_MODEL := XS2
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2 -v XS2.ar2316
+endef
+TARGET_DEVICES += ubnt2
+
+define Device/ubnt5
+  DEVICE_VENDOR := Ubiquiti
+  DEVICE_MODEL := XS5
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313
+endef
+TARGET_DEVICES += ubnt5
+
+define Device/np25g
+  DEVICE_VENDOR := Compex
+  DEVICE_MODEL := NP25G
+  KERNEL := kernel-bin | gzip-kernel
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw np25g
+  BROKEN := y
+endef
+TARGET_DEVICES += np25g
+
+define Device/wpe53g
+  DEVICE_VENDOR := Compex
+  DEVICE_MODEL := WPE53G
+  KERNEL := kernel-bin | gzip-kernel
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw wpe53g
+  BROKEN := y
+endef
+TARGET_DEVICES += wpe53g
+
+$(eval $(call BuildImage))
diff --git a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch b/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
new file mode 100644
index 0000000000..e74e20b05a
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
@@ -0,0 +1,212 @@
+--- a/arch/mips/ath25/Kconfig
++++ b/arch/mips/ath25/Kconfig
+@@ -2,6 +2,7 @@
+ config SOC_AR5312
+ 	bool "Atheros AR5312/AR2312+ SoC support"
+ 	depends on ATH25
++	select GPIO_AR5312
+ 	default y
+ 
+ config SOC_AR2315
+--- a/arch/mips/ath25/ar5312.c
++++ b/arch/mips/ath25/ar5312.c
+@@ -22,6 +22,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/mtd/physmap.h>
+ #include <linux/reboot.h>
++#include <linux/gpio.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -180,6 +181,22 @@ static struct platform_device ar5312_phy
+ 	.num_resources = 1,
+ };
+ 
++static struct resource ar5312_gpio_res[] = {
++	{
++		.name = "ar5312-gpio",
++		.flags = IORESOURCE_MEM,
++		.start = AR5312_GPIO_BASE,
++		.end = AR5312_GPIO_BASE + AR5312_GPIO_SIZE - 1,
++	},
++};
++
++static struct platform_device ar5312_gpio = {
++	.name = "ar5312-gpio",
++	.id = -1,
++	.resource = ar5312_gpio_res,
++	.num_resources = ARRAY_SIZE(ar5312_gpio_res),
++};
++
+ static void __init ar5312_flash_init(void)
+ {
+ 	void __iomem *flashctl_base;
+@@ -247,6 +264,8 @@ void __init ar5312_init_devices(void)
+ 
+ 	platform_device_register(&ar5312_physmap_flash);
+ 
++	platform_device_register(&ar5312_gpio);
++
+ 	switch (ath25_soc) {
+ 	case ATH25_SOC_AR5312:
+ 		if (!ath25_board.radio)
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -105,6 +105,13 @@ config GPIO_AMDPT
+ 	  driver for GPIO functionality on Promontory IOHub
+ 	  Require ACPI ASL code to enumerate as a platform device.
+ 
++config GPIO_AR5312
++	bool "AR5312 SoC GPIO support"
++	default y if SOC_AR5312
++	depends on SOC_AR5312
++	help
++	  Say yes here to enable GPIO support for Atheros AR5312/AR2312+ SoCs.
++
+ config GPIO_ASPEED
+ 	tristate "Aspeed GPIO support"
+ 	depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
+ obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
+ obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+ obj-$(CONFIG_GPIO_ASPEED)	+= gpio-aspeed.o
+--- /dev/null
++++ b/drivers/gpio/gpio-ar5312.c
+@@ -0,0 +1,121 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
++ * Copyright (C) 2006 FON Technology, SL.
++ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
++ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/gpio.h>
++
++#define DRIVER_NAME	"ar5312-gpio"
++
++#define AR5312_GPIO_DO		0x00		/* output register */
++#define AR5312_GPIO_DI		0x04		/* intput register */
++#define AR5312_GPIO_CR		0x08		/* control register */
++
++#define AR5312_GPIO_CR_M(x)	(1 << (x))	/* mask for i/o */
++#define AR5312_GPIO_CR_O(x)	(0 << (x))	/* mask for output */
++#define AR5312_GPIO_CR_I(x)	(1 << (x))	/* mask for input */
++#define AR5312_GPIO_CR_INT(x)	(1 << ((x)+8))	/* mask for interrupt */
++#define AR5312_GPIO_CR_UART(x)	(1 << ((x)+16))	/* uart multiplex */
++
++#define AR5312_GPIO_NUM		8
++
++static void __iomem *ar5312_mem;
++
++static inline u32 ar5312_gpio_reg_read(unsigned reg)
++{
++	return __raw_readl(ar5312_mem + reg);
++}
++
++static inline void ar5312_gpio_reg_write(unsigned reg, u32 val)
++{
++	__raw_writel(val, ar5312_mem + reg);
++}
++
++static inline void ar5312_gpio_reg_mask(unsigned reg, u32 mask, u32 val)
++{
++	ar5312_gpio_reg_write(reg, (ar5312_gpio_reg_read(reg) & ~mask) | val);
++}
++
++static int ar5312_gpio_get_val(struct gpio_chip *chip, unsigned gpio)
++{
++	return (ar5312_gpio_reg_read(AR5312_GPIO_DI) >> gpio) & 1;
++}
++
++static void ar5312_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val)
++{
++	u32 reg = ar5312_gpio_reg_read(AR5312_GPIO_DO);
++
++	reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio);
++	ar5312_gpio_reg_write(AR5312_GPIO_DO, reg);
++}
++
++static int ar5312_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
++{
++	ar5312_gpio_reg_mask(AR5312_GPIO_CR, 0, 1 << gpio);
++	return 0;
++}
++
++static int ar5312_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val)
++{
++	ar5312_gpio_reg_mask(AR5312_GPIO_CR, 1 << gpio, 0);
++	ar5312_gpio_set_val(chip, gpio, val);
++	return 0;
++}
++
++static struct gpio_chip ar5312_gpio_chip = {
++	.label			= DRIVER_NAME,
++	.direction_input	= ar5312_gpio_dir_in,
++	.direction_output	= ar5312_gpio_dir_out,
++	.set			= ar5312_gpio_set_val,
++	.get			= ar5312_gpio_get_val,
++	.base			= 0,
++	.ngpio			= AR5312_GPIO_NUM,
++};
++
++static int ar5312_gpio_probe(struct platform_device *pdev)
++{
++	struct device *dev = &pdev->dev;
++	struct resource *res;
++	int ret;
++
++	if (ar5312_mem)
++		return -EBUSY;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	ar5312_mem = devm_ioremap_resource(dev, res);
++	if (IS_ERR(ar5312_mem))
++		return PTR_ERR(ar5312_mem);
++
++	ar5312_gpio_chip.parent = dev;
++	ret = gpiochip_add(&ar5312_gpio_chip);
++	if (ret) {
++		dev_err(dev, "failed to add gpiochip\n");
++		return ret;
++	}
++
++	return 0;
++}
++
++static struct platform_driver ar5312_gpio_driver = {
++	.probe = ar5312_gpio_probe,
++	.driver = {
++		.name = DRIVER_NAME,
++		.owner = THIS_MODULE,
++	}
++};
++
++static int __init ar5312_gpio_init(void)
++{
++	return platform_driver_register(&ar5312_gpio_driver);
++}
++subsys_initcall(ar5312_gpio_init);
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -175,6 +175,7 @@ config ATH25
+ 	select CEVT_R4K
+ 	select CSRC_R4K
+ 	select DMA_NONCOHERENT
++	select GPIOLIB
+ 	select IRQ_MIPS_CPU
+ 	select IRQ_DOMAIN
+ 	select SYS_HAS_CPU_MIPS32_R1
diff --git a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch b/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
new file mode 100644
index 0000000000..749b308b89
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
@@ -0,0 +1,363 @@
+--- a/arch/mips/ath25/Kconfig
++++ b/arch/mips/ath25/Kconfig
+@@ -8,6 +8,7 @@ config SOC_AR5312
+ config SOC_AR2315
+ 	bool "Atheros AR2315+ SoC support"
+ 	depends on ATH25
++	select GPIO_AR2315
+ 	default y
+ 
+ config PCI_AR2315
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -21,6 +21,8 @@
+ #include <linux/interrupt.h>
+ #include <linux/platform_device.h>
+ #include <linux/reboot.h>
++#include <linux/delay.h>
++#include <linux/gpio.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -167,11 +169,42 @@ void __init ar2315_arch_init_irq(void)
+ 	ar2315_misc_irq_domain = domain;
+ }
+ 
++static struct resource ar2315_gpio_res[] = {
++	{
++		.name = "ar2315-gpio",
++		.flags = IORESOURCE_MEM,
++		.start = AR2315_RST_BASE + AR2315_GPIO,
++		.end = AR2315_RST_BASE + AR2315_GPIO + 0x10 - 1,
++	},
++	{
++		.name = "ar2315-gpio",
++		.flags = IORESOURCE_IRQ,
++	},
++	{
++		.name = "ar2315-gpio-irq-base",
++		.flags = IORESOURCE_IRQ,
++		.start = AR231X_GPIO_IRQ_BASE,
++		.end = AR231X_GPIO_IRQ_BASE,
++	}
++};
++
++static struct platform_device ar2315_gpio = {
++	.id = -1,
++	.name = "ar2315-gpio",
++	.resource = ar2315_gpio_res,
++	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
++};
++
+ void __init ar2315_init_devices(void)
+ {
+ 	/* Find board configuration */
+ 	ath25_find_config(AR2315_SPI_READ_BASE, AR2315_SPI_READ_SIZE);
+ 
++	ar2315_gpio_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
++						      AR2315_MISC_IRQ_GPIO);
++	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
++	platform_device_register(&ar2315_gpio);
++
+ 	ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0);
+ }
+ 
+@@ -187,8 +220,8 @@ static void ar2315_restart(char *command
+ 	/* Cold reset does not work on the AR2315/6, use the GPIO reset bits
+ 	 * a workaround. Give it some time to attempt a gpio based hardware
+ 	 * reset (atheros reference design workaround) */
+-
+-	/* TODO: implement the GPIO reset workaround */
++	gpio_request_one(AR2315_RESET_GPIO, GPIOF_OUT_INIT_LOW, "Reset");
++	mdelay(100);
+ 
+ 	/* Some boards (e.g. Senao EOC-2610) don't implement the reset logic
+ 	 * workaround. Attempt to jump to the mips reset location -
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -105,6 +105,13 @@ config GPIO_AMDPT
+ 	  driver for GPIO functionality on Promontory IOHub
+ 	  Require ACPI ASL code to enumerate as a platform device.
+ 
++config GPIO_AR2315
++	bool "AR2315 SoC GPIO support"
++	default y if SOC_AR2315
++	depends on SOC_AR2315
++	help
++	  Say yes here to enable GPIO support for Atheros AR2315+ SoCs.
++
+ config GPIO_AR5312
+ 	bool "AR5312 SoC GPIO support"
+ 	default y if SOC_AR5312
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
+ obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
+ obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
+ obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
++obj-$(CONFIG_GPIO_AR2315)	+= gpio-ar2315.o
+ obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
+ obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
+ obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+--- /dev/null
++++ b/drivers/gpio/gpio-ar2315.c
+@@ -0,0 +1,233 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
++ * Copyright (C) 2006 FON Technology, SL.
++ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006 Felix Fietkau <nbd at nbd.name>
++ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/gpio.h>
++#include <linux/irq.h>
++
++#define DRIVER_NAME	"ar2315-gpio"
++
++#define AR2315_GPIO_DI			0x0000
++#define AR2315_GPIO_DO			0x0008
++#define AR2315_GPIO_DIR			0x0010
++#define AR2315_GPIO_INT			0x0018
++
++#define AR2315_GPIO_DIR_M(x)		(1 << (x))	/* mask for i/o */
++#define AR2315_GPIO_DIR_O(x)		(1 << (x))	/* output */
++#define AR2315_GPIO_DIR_I(x)		(0)		/* input */
++
++#define AR2315_GPIO_INT_NUM_M		0x3F		/* mask for GPIO num */
++#define AR2315_GPIO_INT_TRIG(x)		((x) << 6)	/* interrupt trigger */
++#define AR2315_GPIO_INT_TRIG_M		(0x3 << 6)	/* mask for int trig */
++
++#define AR2315_GPIO_INT_TRIG_OFF	0	/* Triggerring off */
++#define AR2315_GPIO_INT_TRIG_LOW	1	/* Low Level Triggered */
++#define AR2315_GPIO_INT_TRIG_HIGH	2	/* High Level Triggered */
++#define AR2315_GPIO_INT_TRIG_EDGE	3	/* Edge Triggered */
++
++#define AR2315_GPIO_NUM		22
++
++static u32 ar2315_gpio_intmask;
++static u32 ar2315_gpio_intval;
++static unsigned ar2315_gpio_irq_base;
++static void __iomem *ar2315_mem;
++
++static inline u32 ar2315_gpio_reg_read(unsigned reg)
++{
++	return __raw_readl(ar2315_mem + reg);
++}
++
++static inline void ar2315_gpio_reg_write(unsigned reg, u32 val)
++{
++	__raw_writel(val, ar2315_mem + reg);
++}
++
++static inline void ar2315_gpio_reg_mask(unsigned reg, u32 mask, u32 val)
++{
++	ar2315_gpio_reg_write(reg, (ar2315_gpio_reg_read(reg) & ~mask) | val);
++}
++
++static void ar2315_gpio_irq_handler(struct irq_desc *desc)
++{
++	u32 pend;
++	int bit = -1;
++
++	/* only do one gpio interrupt at a time */
++	pend = ar2315_gpio_reg_read(AR2315_GPIO_DI);
++	pend ^= ar2315_gpio_intval;
++	pend &= ar2315_gpio_intmask;
++
++	if (pend) {
++		bit = fls(pend) - 1;
++		pend &= ~(1 << bit);
++		ar2315_gpio_intval ^= (1 << bit);
++	}
++
++	/* Enable interrupt with edge detection */
++	if ((ar2315_gpio_reg_read(AR2315_GPIO_DIR) & AR2315_GPIO_DIR_M(bit)) !=
++	    AR2315_GPIO_DIR_I(bit))
++		return;
++
++	if (bit >= 0)
++		generic_handle_irq(ar2315_gpio_irq_base + bit);
++}
++
++static void ar2315_gpio_int_setup(unsigned gpio, int trig)
++{
++	u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_INT);
++
++	reg &= ~(AR2315_GPIO_INT_NUM_M | AR2315_GPIO_INT_TRIG_M);
++	reg |= gpio | AR2315_GPIO_INT_TRIG(trig);
++	ar2315_gpio_reg_write(AR2315_GPIO_INT, reg);
++}
++
++static void ar2315_gpio_irq_unmask(struct irq_data *d)
++{
++	unsigned gpio = d->irq - ar2315_gpio_irq_base;
++	u32 dir = ar2315_gpio_reg_read(AR2315_GPIO_DIR);
++
++	/* Enable interrupt with edge detection */
++	if ((dir & AR2315_GPIO_DIR_M(gpio)) != AR2315_GPIO_DIR_I(gpio))
++		return;
++
++	ar2315_gpio_intmask |= (1 << gpio);
++	ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_EDGE);
++}
++
++static void ar2315_gpio_irq_mask(struct irq_data *d)
++{
++	unsigned gpio = d->irq - ar2315_gpio_irq_base;
++
++	/* Disable interrupt */
++	ar2315_gpio_intmask &= ~(1 << gpio);
++	ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_OFF);
++}
++
++static struct irq_chip ar2315_gpio_irq_chip = {
++	.name		= DRIVER_NAME,
++	.irq_unmask	= ar2315_gpio_irq_unmask,
++	.irq_mask	= ar2315_gpio_irq_mask,
++};
++
++static void ar2315_gpio_irq_init(unsigned irq)
++{
++	unsigned i;
++
++	ar2315_gpio_intval = ar2315_gpio_reg_read(AR2315_GPIO_DI);
++	for (i = 0; i < AR2315_GPIO_NUM; i++) {
++		unsigned _irq = ar2315_gpio_irq_base + i;
++
++		irq_set_chip_and_handler(_irq, &ar2315_gpio_irq_chip,
++					 handle_level_irq);
++	}
++	irq_set_chained_handler(irq, ar2315_gpio_irq_handler);
++}
++
++static int ar2315_gpio_get_val(struct gpio_chip *chip, unsigned gpio)
++{
++	return (ar2315_gpio_reg_read(AR2315_GPIO_DI) >> gpio) & 1;
++}
++
++static void ar2315_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val)
++{
++	u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_DO);
++
++	reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio);
++	ar2315_gpio_reg_write(AR2315_GPIO_DO, reg);
++}
++
++static int ar2315_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
++{
++	ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 1 << gpio, 0);
++	return 0;
++}
++
++static int ar2315_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val)
++{
++	ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 0, 1 << gpio);
++	ar2315_gpio_set_val(chip, gpio, val);
++	return 0;
++}
++
++static int ar2315_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
++{
++	return ar2315_gpio_irq_base + gpio;
++}
++
++static struct gpio_chip ar2315_gpio_chip = {
++	.label			= DRIVER_NAME,
++	.direction_input	= ar2315_gpio_dir_in,
++	.direction_output	= ar2315_gpio_dir_out,
++	.set			= ar2315_gpio_set_val,
++	.get			= ar2315_gpio_get_val,
++	.to_irq			= ar2315_gpio_to_irq,
++	.base			= 0,
++	.ngpio			= AR2315_GPIO_NUM,
++};
++
++static int ar2315_gpio_probe(struct platform_device *pdev)
++{
++	struct device *dev = &pdev->dev;
++	struct resource *res;
++	unsigned irq;
++	int ret;
++
++	if (ar2315_mem)
++		return -EBUSY;
++
++	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
++					   "ar2315-gpio-irq-base");
++	if (!res) {
++		dev_err(dev, "not found GPIO IRQ base\n");
++		return -ENXIO;
++	}
++	ar2315_gpio_irq_base = res->start;
++
++	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, DRIVER_NAME);
++	if (!res) {
++		dev_err(dev, "not found IRQ number\n");
++		return -ENXIO;
++	}
++	irq = res->start;
++
++	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, DRIVER_NAME);
++	ar2315_mem = devm_ioremap_resource(dev, res);
++	if (IS_ERR(ar2315_mem))
++		return PTR_ERR(ar2315_mem);
++
++	ar2315_gpio_chip.parent = dev;
++	ret = gpiochip_add(&ar2315_gpio_chip);
++	if (ret) {
++		dev_err(dev, "failed to add gpiochip\n");
++		return ret;
++	}
++
++	ar2315_gpio_irq_init(irq);
++
++	return 0;
++}
++
++static struct platform_driver ar2315_gpio_driver = {
++	.probe = ar2315_gpio_probe,
++	.driver = {
++		.name = DRIVER_NAME,
++		.owner = THIS_MODULE,
++	}
++};
++
++static int __init ar2315_gpio_init(void)
++{
++	return platform_driver_register(&ar2315_gpio_driver);
++}
++subsys_initcall(ar2315_gpio_init);
+--- a/arch/mips/ath25/devices.h
++++ b/arch/mips/ath25/devices.h
+@@ -4,6 +4,11 @@
+ 
+ #include <linux/cpu.h>
+ 
++#define AR231X_GPIO_IRQ_BASE		0x30
++
++/* GPIO number for AR2315/16 reset issue workaround */
++#define AR2315_RESET_GPIO		5
++
+ #define ATH25_REG_MS(_val, _field)	(((_val) & _field##_M) >> _field##_S)
+ 
+ #define ATH25_IRQ_CPU_CLOCK	(MIPS_CPU_IRQ_BASE + 7)	/* C0_CAUSE: 0x8000 */
+--- a/arch/mips/ath25/ar2315_regs.h
++++ b/arch/mips/ath25/ar2315_regs.h
+@@ -315,6 +315,9 @@
+ #define AR2315_MEM_CFG_BANKADDR_BITS_M	0x00000018
+ #define AR2315_MEM_CFG_BANKADDR_BITS_S	3
+ 
++/* GPIO MMR base address */
++#define AR2315_GPIO			0x0088
++
+ /*
+  * Local Bus Interface Registers
+  */
diff --git a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch b/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
new file mode 100644
index 0000000000..a2b1492250
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
@@ -0,0 +1,1734 @@
+--- a/drivers/net/ethernet/atheros/Makefile
++++ b/drivers/net/ethernet/atheros/Makefile
+@@ -8,3 +8,4 @@ obj-$(CONFIG_ATL2) += atlx/
+ obj-$(CONFIG_ATL1E) += atl1e/
+ obj-$(CONFIG_ATL1C) += atl1c/
+ obj-$(CONFIG_ALX) += alx/
++obj-$(CONFIG_NET_AR231X) += ar231x/
+--- a/drivers/net/ethernet/atheros/Kconfig
++++ b/drivers/net/ethernet/atheros/Kconfig
+@@ -5,7 +5,7 @@
+ config NET_VENDOR_ATHEROS
+ 	bool "Atheros devices"
+ 	default y
+-	depends on PCI
++	depends on (PCI || ATH25)
+ 	---help---
+ 	  If you have a network (Ethernet) card belonging to this class, say Y.
+ 
+@@ -78,4 +78,10 @@ config ALX
+ 	  To compile this driver as a module, choose M here.  The module
+ 	  will be called alx.
+ 
++config NET_AR231X
++	tristate "Atheros AR231X built-in Ethernet support"
++	depends on ATH25
++	help
++	  Support for the AR231x/531x ethernet controller
++
+ endif # NET_VENDOR_ATHEROS
+--- /dev/null
++++ b/drivers/net/ethernet/atheros/ar231x/Makefile
+@@ -0,0 +1 @@
++obj-$(CONFIG_NET_AR231X) += ar231x.o
+--- /dev/null
++++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
+@@ -0,0 +1,1119 @@
++/*
++ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
++ *
++ * Copyright (C) 2004 by Sameer Dekate <sdekate at arubanetworks.com>
++ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
++ *
++ * Thanks to Atheros for providing hardware and documentation
++ * enabling me to write this driver.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * Additional credits:
++ * This code is taken from John Taylor's Sibyte driver and then
++ * modified for the AR2313.
++ */
++
++#include <linux/module.h>
++#include <linux/types.h>
++#include <linux/errno.h>
++#include <linux/ioport.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
++#include <linux/interrupt.h>
++#include <linux/skbuff.h>
++#include <linux/init.h>
++#include <linux/delay.h>
++#include <linux/mm.h>
++#include <linux/mii.h>
++#include <linux/phy.h>
++#include <linux/platform_device.h>
++#include <linux/io.h>
++
++#define AR2313_MTU                     1692
++#define AR2313_PRIOS                   1
++#define AR2313_QUEUES                  (2*AR2313_PRIOS)
++#define AR2313_DESCR_ENTRIES           64
++
++#ifndef min
++#define min(a, b)	(((a) < (b)) ? (a) : (b))
++#endif
++
++#ifndef SMP_CACHE_BYTES
++#define SMP_CACHE_BYTES	L1_CACHE_BYTES
++#endif
++
++#define AR2313_MBOX_SET_BIT  0x8
++
++#include "ar231x.h"
++
++/**
++ * New interrupt handler strategy:
++ *
++ * An old interrupt handler worked using the traditional method of
++ * replacing an skbuff with a new one when a packet arrives. However
++ * the rx rings do not need to contain a static number of buffer
++ * descriptors, thus it makes sense to move the memory allocation out
++ * of the main interrupt handler and do it in a bottom half handler
++ * and only allocate new buffers when the number of buffers in the
++ * ring is below a certain threshold. In order to avoid starving the
++ * NIC under heavy load it is however necessary to force allocation
++ * when hitting a minimum threshold. The strategy for alloction is as
++ * follows:
++ *
++ *     RX_LOW_BUF_THRES    - allocate buffers in the bottom half
++ *     RX_PANIC_LOW_THRES  - we are very low on buffers, allocate
++ *                           the buffers in the interrupt handler
++ *     RX_RING_THRES       - maximum number of buffers in the rx ring
++ *
++ * One advantagous side effect of this allocation approach is that the
++ * entire rx processing can be done without holding any spin lock
++ * since the rx rings and registers are totally independent of the tx
++ * ring and its registers.  This of course includes the kmalloc's of
++ * new skb's. Thus start_xmit can run in parallel with rx processing
++ * and the memory allocation on SMP systems.
++ *
++ * Note that running the skb reallocation in a bottom half opens up
++ * another can of races which needs to be handled properly. In
++ * particular it can happen that the interrupt handler tries to run
++ * the reallocation while the bottom half is either running on another
++ * CPU or was interrupted on the same CPU. To get around this the
++ * driver uses bitops to prevent the reallocation routines from being
++ * reentered.
++ *
++ * TX handling can also be done without holding any spin lock, wheee
++ * this is fun! since tx_csm is only written to by the interrupt
++ * handler.
++ */
++
++/**
++ * Threshold values for RX buffer allocation - the low water marks for
++ * when to start refilling the rings are set to 75% of the ring
++ * sizes. It seems to make sense to refill the rings entirely from the
++ * intrrupt handler once it gets below the panic threshold, that way
++ * we don't risk that the refilling is moved to another CPU when the
++ * one running the interrupt handler just got the slab code hot in its
++ * cache.
++ */
++#define RX_RING_SIZE		AR2313_DESCR_ENTRIES
++#define RX_PANIC_THRES	        (RX_RING_SIZE/4)
++#define RX_LOW_THRES	        ((3*RX_RING_SIZE)/4)
++#define CRC_LEN                 4
++#define RX_OFFSET               2
++
++#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
++#define VLAN_HDR                4
++#else
++#define VLAN_HDR                0
++#endif
++
++#define AR2313_BUFSIZE		(AR2313_MTU + VLAN_HDR + ETH_HLEN + CRC_LEN + \
++				 RX_OFFSET)
++
++#ifdef MODULE
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Sameer Dekate <sdekate at arubanetworks.com>, Imre Kaloz <kaloz at openwrt.org>, Felix Fietkau <nbd at nbd.name>");
++MODULE_DESCRIPTION("AR231x Ethernet driver");
++#endif
++
++#define virt_to_phys(x) ((u32)(x) & 0x1fffffff)
++
++/* prototypes */
++static void ar231x_halt(struct net_device *dev);
++static void rx_tasklet_func(unsigned long data);
++static void rx_tasklet_cleanup(struct net_device *dev);
++static void ar231x_multicast_list(struct net_device *dev);
++static void ar231x_tx_timeout(struct net_device *dev);
++
++static int ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
++static int ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
++				u16 value);
++static int ar231x_mdiobus_reset(struct mii_bus *bus);
++static int ar231x_mdiobus_probe(struct net_device *dev);
++static void ar231x_adjust_link(struct net_device *dev);
++
++#ifndef ERR
++#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
++#endif
++
++#ifdef CONFIG_NET_POLL_CONTROLLER
++static void
++ar231x_netpoll(struct net_device *dev)
++{
++	unsigned long flags;
++
++	local_irq_save(flags);
++	ar231x_interrupt(dev->irq, dev);
++	local_irq_restore(flags);
++}
++#endif
++
++static const struct net_device_ops ar231x_ops = {
++	.ndo_open		= ar231x_open,
++	.ndo_stop		= ar231x_close,
++	.ndo_start_xmit		= ar231x_start_xmit,
++	.ndo_set_rx_mode	= ar231x_multicast_list,
++	.ndo_do_ioctl		= ar231x_ioctl,
++	.ndo_change_mtu		= eth_change_mtu,
++	.ndo_validate_addr	= eth_validate_addr,
++	.ndo_set_mac_address	= eth_mac_addr,
++	.ndo_tx_timeout		= ar231x_tx_timeout,
++#ifdef CONFIG_NET_POLL_CONTROLLER
++	.ndo_poll_controller	= ar231x_netpoll,
++#endif
++};
++
++static int ar231x_probe(struct platform_device *pdev)
++{
++	struct net_device *dev;
++	struct ar231x_private *sp;
++	struct resource *res;
++	unsigned long ar_eth_base;
++	char buf[64];
++
++	dev = alloc_etherdev(sizeof(struct ar231x_private));
++
++	if (dev == NULL) {
++		printk(KERN_ERR
++			   "ar231x: Unable to allocate net_device structure!\n");
++		return -ENOMEM;
++	}
++
++	platform_set_drvdata(pdev, dev);
++
++	SET_NETDEV_DEV(dev, &pdev->dev);
++
++	sp = netdev_priv(dev);
++	sp->dev = dev;
++	sp->cfg = pdev->dev.platform_data;
++
++	sprintf(buf, "eth%d_membase", pdev->id);
++	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf);
++	if (!res)
++		return -ENODEV;
++
++	sp->link = 0;
++	ar_eth_base = res->start;
++
++	sprintf(buf, "eth%d_irq", pdev->id);
++	dev->irq = platform_get_irq_byname(pdev, buf);
++
++	spin_lock_init(&sp->lock);
++
++	dev->features |= NETIF_F_HIGHDMA;
++	dev->netdev_ops = &ar231x_ops;
++
++	tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long)dev);
++	tasklet_disable(&sp->rx_tasklet);
++
++	sp->eth_regs = ioremap_nocache(ar_eth_base, sizeof(*sp->eth_regs));
++	if (!sp->eth_regs) {
++		printk("Can't remap eth registers\n");
++		return -ENXIO;
++	}
++
++	/**
++	 * When there's only one MAC, PHY regs are typically on ENET0,
++	 * even though the MAC might be on ENET1.
++	 * So remap PHY regs separately.
++	 */
++	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii");
++	if (!res) {
++		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
++						   "eth1_mii");
++		if (!res)
++			return -ENODEV;
++	}
++	sp->phy_regs = ioremap_nocache(res->start, resource_size(res));
++	if (!sp->phy_regs) {
++		printk("Can't remap phy registers\n");
++		return -ENXIO;
++	}
++
++	sp->dma_regs = ioremap_nocache(ar_eth_base + 0x1000,
++				       sizeof(*sp->dma_regs));
++	if (!sp->dma_regs) {
++		printk("Can't remap DMA registers\n");
++		return -ENXIO;
++	}
++	dev->base_addr = ar_eth_base + 0x1000;
++
++	strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
++	sp->name[sizeof(sp->name) - 1] = '\0';
++	memcpy(dev->dev_addr, sp->cfg->macaddr, 6);
++
++	if (ar231x_init(dev)) {
++		/* ar231x_init() calls ar231x_init_cleanup() on error */
++		kfree(dev);
++		return -ENODEV;
++	}
++
++	if (register_netdev(dev)) {
++		printk("%s: register_netdev failed\n", __func__);
++		return -1;
++	}
++
++	printk("%s: %s: %pM, irq %d\n", dev->name, sp->name, dev->dev_addr,
++	       dev->irq);
++
++	sp->mii_bus = mdiobus_alloc();
++	if (sp->mii_bus == NULL)
++		return -1;
++
++	sp->mii_bus->priv = dev;
++	sp->mii_bus->read = ar231x_mdiobus_read;
++	sp->mii_bus->write = ar231x_mdiobus_write;
++	sp->mii_bus->reset = ar231x_mdiobus_reset;
++	sp->mii_bus->name = "ar231x_eth_mii";
++	snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
++
++	mdiobus_register(sp->mii_bus);
++
++	if (ar231x_mdiobus_probe(dev) != 0) {
++		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
++		rx_tasklet_cleanup(dev);
++		ar231x_init_cleanup(dev);
++		unregister_netdev(dev);
++		kfree(dev);
++		return -ENODEV;
++	}
++
++	return 0;
++}
++
++static void ar231x_multicast_list(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	unsigned int filter;
++
++	filter = sp->eth_regs->mac_control;
++
++	if (dev->flags & IFF_PROMISC)
++		filter |= MAC_CONTROL_PR;
++	else
++		filter &= ~MAC_CONTROL_PR;
++	if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 0))
++		filter |= MAC_CONTROL_PM;
++	else
++		filter &= ~MAC_CONTROL_PM;
++
++	sp->eth_regs->mac_control = filter;
++}
++
++static void rx_tasklet_cleanup(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	/**
++	 * Tasklet may be scheduled. Need to get it removed from the list
++	 * since we're about to free the struct.
++	 */
++
++	sp->unloading = 1;
++	tasklet_enable(&sp->rx_tasklet);
++	tasklet_kill(&sp->rx_tasklet);
++}
++
++static int ar231x_remove(struct platform_device *pdev)
++{
++	struct net_device *dev = platform_get_drvdata(pdev);
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	rx_tasklet_cleanup(dev);
++	ar231x_init_cleanup(dev);
++	unregister_netdev(dev);
++	mdiobus_unregister(sp->mii_bus);
++	mdiobus_free(sp->mii_bus);
++	kfree(dev);
++	return 0;
++}
++
++/**
++ * Restart the AR2313 ethernet controller.
++ */
++static int ar231x_restart(struct net_device *dev)
++{
++	/* disable interrupts */
++	disable_irq(dev->irq);
++
++	/* stop mac */
++	ar231x_halt(dev);
++
++	/* initialize */
++	ar231x_init(dev);
++
++	/* enable interrupts */
++	enable_irq(dev->irq);
++
++	return 0;
++}
++
++static struct platform_driver ar231x_driver = {
++	.driver.name = "ar231x-eth",
++	.probe = ar231x_probe,
++	.remove = ar231x_remove,
++};
++
++module_platform_driver(ar231x_driver);
++
++static void ar231x_free_descriptors(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	if (sp->rx_ring != NULL) {
++		kfree((void *)KSEG0ADDR(sp->rx_ring));
++		sp->rx_ring = NULL;
++		sp->tx_ring = NULL;
++	}
++}
++
++static int ar231x_allocate_descriptors(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	int size;
++	int j;
++	ar231x_descr_t *space;
++
++	if (sp->rx_ring != NULL) {
++		printk("%s: already done.\n", __func__);
++		return 0;
++	}
++
++	size = sizeof(ar231x_descr_t) * (AR2313_DESCR_ENTRIES * AR2313_QUEUES);
++	space = kmalloc(size, GFP_KERNEL);
++	if (space == NULL)
++		return 1;
++
++	/* invalidate caches */
++	dma_cache_inv((unsigned int)space, size);
++
++	/* now convert pointer to KSEG1 */
++	space = (ar231x_descr_t *)KSEG1ADDR(space);
++
++	memset((void *)space, 0, size);
++
++	sp->rx_ring = space;
++	space += AR2313_DESCR_ENTRIES;
++
++	sp->tx_ring = space;
++	space += AR2313_DESCR_ENTRIES;
++
++	/* Initialize the transmit Descriptors */
++	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
++		ar231x_descr_t *td = &sp->tx_ring[j];
++
++		td->status = 0;
++		td->devcs = DMA_TX1_CHAINED;
++		td->addr = 0;
++		td->descr = virt_to_phys(&sp->tx_ring[DSC_NEXT(j)]);
++	}
++
++	return 0;
++}
++
++/**
++ * Generic cleanup handling data allocated during init. Used when the
++ * module is unloaded or if an error occurs during initialization
++ */
++static void ar231x_init_cleanup(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	struct sk_buff *skb;
++	int j;
++
++	ar231x_free_descriptors(dev);
++
++	if (sp->eth_regs)
++		iounmap((void *)sp->eth_regs);
++	if (sp->dma_regs)
++		iounmap((void *)sp->dma_regs);
++	if (sp->phy_regs)
++		iounmap((void *)sp->phy_regs);
++
++	if (sp->rx_skb) {
++		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
++			skb = sp->rx_skb[j];
++			if (skb) {
++				sp->rx_skb[j] = NULL;
++				dev_kfree_skb(skb);
++			}
++		}
++		kfree(sp->rx_skb);
++		sp->rx_skb = NULL;
++	}
++
++	if (sp->tx_skb) {
++		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
++			skb = sp->tx_skb[j];
++			if (skb) {
++				sp->tx_skb[j] = NULL;
++				dev_kfree_skb(skb);
++			}
++		}
++		kfree(sp->tx_skb);
++		sp->tx_skb = NULL;
++	}
++}
++
++static int ar231x_reset_reg(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	unsigned int ethsal, ethsah;
++	unsigned int flags;
++
++	sp->cfg->reset_set(sp->cfg->reset_mac);
++	mdelay(10);
++	sp->cfg->reset_clear(sp->cfg->reset_mac);
++	mdelay(10);
++	sp->cfg->reset_set(sp->cfg->reset_phy);
++	mdelay(10);
++	sp->cfg->reset_clear(sp->cfg->reset_phy);
++	mdelay(10);
++
++	sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
++	mdelay(10);
++	sp->dma_regs->bus_mode =
++		((32 << DMA_BUS_MODE_PBL_SHIFT) | DMA_BUS_MODE_BLE);
++
++	/* enable interrupts */
++	sp->dma_regs->intr_ena = DMA_STATUS_AIS | DMA_STATUS_NIS |
++				 DMA_STATUS_RI | DMA_STATUS_TI |
++				 DMA_STATUS_FBE;
++	sp->dma_regs->xmt_base = virt_to_phys(sp->tx_ring);
++	sp->dma_regs->rcv_base = virt_to_phys(sp->rx_ring);
++	sp->dma_regs->control =
++		(DMA_CONTROL_SR | DMA_CONTROL_ST | DMA_CONTROL_SF);
++
++	sp->eth_regs->flow_control = (FLOW_CONTROL_FCE);
++	sp->eth_regs->vlan_tag = (0x8100);
++
++	/* Enable Ethernet Interface */
++	flags = (MAC_CONTROL_TE |	/* transmit enable */
++			 MAC_CONTROL_PM |	/* pass mcast */
++			 MAC_CONTROL_F |	/* full duplex */
++			 MAC_CONTROL_HBD);	/* heart beat disabled */
++
++	if (dev->flags & IFF_PROMISC) {	/* set promiscuous mode */
++		flags |= MAC_CONTROL_PR;
++	}
++	sp->eth_regs->mac_control = flags;
++
++	/* Set all Ethernet station address registers to their initial values */
++	ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
++		 (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF);
++
++	ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
++		 (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
++		 (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
++		 (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF);
++
++	sp->eth_regs->mac_addr[0] = ethsah;
++	sp->eth_regs->mac_addr[1] = ethsal;
++
++	mdelay(10);
++
++	return 0;
++}
++
++static int ar231x_init(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	int ecode = 0;
++
++	/* Allocate descriptors */
++	if (ar231x_allocate_descriptors(dev)) {
++		printk("%s: %s: ar231x_allocate_descriptors failed\n",
++		       dev->name, __func__);
++		ecode = -EAGAIN;
++		goto init_error;
++	}
++
++	/* Get the memory for the skb rings */
++	if (sp->rx_skb == NULL) {
++		sp->rx_skb =
++			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
++				GFP_KERNEL);
++		if (!(sp->rx_skb)) {
++			printk("%s: %s: rx_skb kmalloc failed\n",
++			       dev->name, __func__);
++			ecode = -EAGAIN;
++			goto init_error;
++		}
++	}
++	memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
++
++	if (sp->tx_skb == NULL) {
++		sp->tx_skb =
++			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
++				GFP_KERNEL);
++		if (!(sp->tx_skb)) {
++			printk("%s: %s: tx_skb kmalloc failed\n",
++			       dev->name, __func__);
++			ecode = -EAGAIN;
++			goto init_error;
++		}
++	}
++	memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
++
++	/**
++	 * Set tx_csm before we start receiving interrupts, otherwise
++	 * the interrupt handler might think it is supposed to process
++	 * tx ints before we are up and running, which may cause a null
++	 * pointer access in the int handler.
++	 */
++	sp->rx_skbprd = 0;
++	sp->cur_rx = 0;
++	sp->tx_prd = 0;
++	sp->tx_csm = 0;
++
++	/* Zero the stats before starting the interface */
++	memset(&dev->stats, 0, sizeof(dev->stats));
++
++	/**
++	 * We load the ring here as there seem to be no way to tell the
++	 * firmware to wipe the ring without re-initializing it.
++	 */
++	ar231x_load_rx_ring(dev, RX_RING_SIZE);
++
++	/* Init hardware */
++	ar231x_reset_reg(dev);
++
++	/* Get the IRQ */
++	ecode = request_irq(dev->irq, &ar231x_interrupt, 0,
++			    dev->name, dev);
++	if (ecode) {
++		printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n",
++		       dev->name, __func__, dev->irq);
++		goto init_error;
++	}
++
++	tasklet_enable(&sp->rx_tasklet);
++
++	return 0;
++
++init_error:
++	ar231x_init_cleanup(dev);
++	return ecode;
++}
++
++/**
++ * Load the rx ring.
++ *
++ * Loading rings is safe without holding the spin lock since this is
++ * done only before the device is enabled, thus no interrupts are
++ * generated and by the interrupt handler/tasklet handler.
++ */
++static void ar231x_load_rx_ring(struct net_device *dev, int nr_bufs)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	short i, idx;
++
++	idx = sp->rx_skbprd;
++
++	for (i = 0; i < nr_bufs; i++) {
++		struct sk_buff *skb;
++		ar231x_descr_t *rd;
++
++		if (sp->rx_skb[idx])
++			break;
++
++		skb = netdev_alloc_skb_ip_align(dev, AR2313_BUFSIZE);
++		if (!skb) {
++			printk("\n\n\n\n %s: No memory in system\n\n\n\n",
++			       __func__);
++			break;
++		}
++
++		/* Make sure IP header starts on a fresh cache line */
++		skb->dev = dev;
++		sp->rx_skb[idx] = skb;
++
++		rd = (ar231x_descr_t *)&sp->rx_ring[idx];
++
++		/* initialize dma descriptor */
++		rd->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
++					 DMA_RX1_CHAINED);
++		rd->addr = virt_to_phys(skb->data);
++		rd->descr = virt_to_phys(&sp->rx_ring[DSC_NEXT(idx)]);
++		rd->status = DMA_RX_OWN;
++
++		idx = DSC_NEXT(idx);
++	}
++
++	if (i)
++		sp->rx_skbprd = idx;
++}
++
++#define AR2313_MAX_PKTS_PER_CALL        64
++
++static int ar231x_rx_int(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	struct sk_buff *skb, *skb_new;
++	ar231x_descr_t *rxdesc;
++	unsigned int status;
++	u32 idx;
++	int pkts = 0;
++	int rval;
++
++	idx = sp->cur_rx;
++
++	/* process at most the entire ring and then wait for another int */
++	while (1) {
++		rxdesc = &sp->rx_ring[idx];
++		status = rxdesc->status;
++
++		if (status & DMA_RX_OWN) {
++			/* SiByte owns descriptor or descr not yet filled in */
++			rval = 0;
++			break;
++		}
++
++		if (++pkts > AR2313_MAX_PKTS_PER_CALL) {
++			rval = 1;
++			break;
++		}
++
++		if ((status & DMA_RX_ERROR) && !(status & DMA_RX_LONG)) {
++			dev->stats.rx_errors++;
++			dev->stats.rx_dropped++;
++
++			/* add statistics counters */
++			if (status & DMA_RX_ERR_CRC)
++				dev->stats.rx_crc_errors++;
++			if (status & DMA_RX_ERR_COL)
++				dev->stats.rx_over_errors++;
++			if (status & DMA_RX_ERR_LENGTH)
++				dev->stats.rx_length_errors++;
++			if (status & DMA_RX_ERR_RUNT)
++				dev->stats.rx_over_errors++;
++			if (status & DMA_RX_ERR_DESC)
++				dev->stats.rx_over_errors++;
++
++		} else {
++			/* alloc new buffer. */
++			skb_new = netdev_alloc_skb_ip_align(dev,
++							    AR2313_BUFSIZE);
++			if (skb_new != NULL) {
++				skb = sp->rx_skb[idx];
++				/* set skb */
++				skb_put(skb, ((status >> DMA_RX_LEN_SHIFT) &
++					0x3fff) - CRC_LEN);
++
++				dev->stats.rx_bytes += skb->len;
++				skb->protocol = eth_type_trans(skb, dev);
++				/* pass the packet to upper layers */
++				netif_rx(skb);
++
++				skb_new->dev = dev;
++				/* reset descriptor's curr_addr */
++				rxdesc->addr = virt_to_phys(skb_new->data);
++
++				dev->stats.rx_packets++;
++				sp->rx_skb[idx] = skb_new;
++			} else {
++				dev->stats.rx_dropped++;
++			}
++		}
++
++		rxdesc->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
++						 DMA_RX1_CHAINED);
++		rxdesc->status = DMA_RX_OWN;
++
++		idx = DSC_NEXT(idx);
++	}
++
++	sp->cur_rx = idx;
++
++	return rval;
++}
++
++static void ar231x_tx_int(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	u32 idx;
++	struct sk_buff *skb;
++	ar231x_descr_t *txdesc;
++	unsigned int status = 0;
++
++	idx = sp->tx_csm;
++
++	while (idx != sp->tx_prd) {
++		txdesc = &sp->tx_ring[idx];
++		status = txdesc->status;
++
++		if (status & DMA_TX_OWN) {
++			/* ar231x dma still owns descr */
++			break;
++		}
++		/* done with this descriptor */
++		dma_unmap_single(NULL, txdesc->addr,
++				 txdesc->devcs & DMA_TX1_BSIZE_MASK,
++				 DMA_TO_DEVICE);
++		txdesc->status = 0;
++
++		if (status & DMA_TX_ERROR) {
++			dev->stats.tx_errors++;
++			dev->stats.tx_dropped++;
++			if (status & DMA_TX_ERR_UNDER)
++				dev->stats.tx_fifo_errors++;
++			if (status & DMA_TX_ERR_HB)
++				dev->stats.tx_heartbeat_errors++;
++			if (status & (DMA_TX_ERR_LOSS | DMA_TX_ERR_LINK))
++				dev->stats.tx_carrier_errors++;
++			if (status & (DMA_TX_ERR_LATE | DMA_TX_ERR_COL |
++			    DMA_TX_ERR_JABBER | DMA_TX_ERR_DEFER))
++				dev->stats.tx_aborted_errors++;
++		} else {
++			/* transmit OK */
++			dev->stats.tx_packets++;
++		}
++
++		skb = sp->tx_skb[idx];
++		sp->tx_skb[idx] = NULL;
++		idx = DSC_NEXT(idx);
++		dev->stats.tx_bytes += skb->len;
++		dev_kfree_skb_irq(skb);
++	}
++
++	sp->tx_csm = idx;
++}
++
++static void rx_tasklet_func(unsigned long data)
++{
++	struct net_device *dev = (struct net_device *)data;
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	if (sp->unloading)
++		return;
++
++	if (ar231x_rx_int(dev)) {
++		tasklet_hi_schedule(&sp->rx_tasklet);
++	} else {
++		unsigned long flags;
++
++		spin_lock_irqsave(&sp->lock, flags);
++		sp->dma_regs->intr_ena |= DMA_STATUS_RI;
++		spin_unlock_irqrestore(&sp->lock, flags);
++	}
++}
++
++static void rx_schedule(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	sp->dma_regs->intr_ena &= ~DMA_STATUS_RI;
++
++	tasklet_hi_schedule(&sp->rx_tasklet);
++}
++
++static irqreturn_t ar231x_interrupt(int irq, void *dev_id)
++{
++	struct net_device *dev = (struct net_device *)dev_id;
++	struct ar231x_private *sp = netdev_priv(dev);
++	unsigned int status, enabled;
++
++	/* clear interrupt */
++	/* Don't clear RI bit if currently disabled */
++	status = sp->dma_regs->status;
++	enabled = sp->dma_regs->intr_ena;
++	sp->dma_regs->status = status & enabled;
++
++	if (status & DMA_STATUS_NIS) {
++		/* normal status */
++		/**
++		 * Don't schedule rx processing if interrupt
++		 * is already disabled.
++		 */
++		if (status & enabled & DMA_STATUS_RI) {
++			/* receive interrupt */
++			rx_schedule(dev);
++		}
++		if (status & DMA_STATUS_TI) {
++			/* transmit interrupt */
++			ar231x_tx_int(dev);
++		}
++	}
++
++	/* abnormal status */
++	if (status & (DMA_STATUS_FBE | DMA_STATUS_TPS))
++		ar231x_restart(dev);
++
++	return IRQ_HANDLED;
++}
++
++static int ar231x_open(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	unsigned int ethsal, ethsah;
++
++	/* reset the hardware, in case the MAC address changed */
++	ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
++		 (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF);
++
++	ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
++		 (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
++		 (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
++		 (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF);
++
++	sp->eth_regs->mac_addr[0] = ethsah;
++	sp->eth_regs->mac_addr[1] = ethsal;
++
++	mdelay(10);
++
++	dev->mtu = 1500;
++	netif_start_queue(dev);
++
++	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
++
++	phy_start(sp->phy_dev);
++
++	return 0;
++}
++
++static void ar231x_tx_timeout(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	unsigned long flags;
++
++	spin_lock_irqsave(&sp->lock, flags);
++	ar231x_restart(dev);
++	spin_unlock_irqrestore(&sp->lock, flags);
++}
++
++static void ar231x_halt(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	int j;
++
++	tasklet_disable(&sp->rx_tasklet);
++
++	/* kill the MAC */
++	sp->eth_regs->mac_control &= ~(MAC_CONTROL_RE |	/* disable Receives */
++				       MAC_CONTROL_TE);	/* disable Transmits */
++	/* stop dma */
++	sp->dma_regs->control = 0;
++	sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR;
++
++	/* place phy and MAC in reset */
++	sp->cfg->reset_set(sp->cfg->reset_mac);
++	sp->cfg->reset_set(sp->cfg->reset_phy);
++
++	/* free buffers on tx ring */
++	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
++		struct sk_buff *skb;
++		ar231x_descr_t *txdesc;
++
++		txdesc = &sp->tx_ring[j];
++		txdesc->descr = 0;
++
++		skb = sp->tx_skb[j];
++		if (skb) {
++			dev_kfree_skb(skb);
++			sp->tx_skb[j] = NULL;
++		}
++	}
++}
++
++/**
++ * close should do nothing. Here's why. It's called when
++ * 'ifconfig bond0 down' is run. If it calls free_irq then
++ * the irq is gone forever ! When bond0 is made 'up' again,
++ * the ar231x_open () does not call request_irq (). Worse,
++ * the call to ar231x_halt() generates a WDOG reset due to
++ * the write to reset register and the box reboots.
++ * Commenting this out is good since it allows the
++ * system to resume when bond0 is made up again.
++ */
++static int ar231x_close(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++#if 0
++	/* Disable interrupts */
++	disable_irq(dev->irq);
++
++	/**
++	 * Without (or before) releasing irq and stopping hardware, this
++	 * is an absolute non-sense, by the way. It will be reset instantly
++	 * by the first irq.
++	 */
++	netif_stop_queue(dev);
++
++	/* stop the MAC and DMA engines */
++	ar231x_halt(dev);
++
++	/* release the interrupt */
++	free_irq(dev->irq, dev);
++
++#endif
++
++	phy_stop(sp->phy_dev);
++
++	return 0;
++}
++
++static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	ar231x_descr_t *td;
++	u32 idx;
++
++	idx = sp->tx_prd;
++	td = &sp->tx_ring[idx];
++
++	if (td->status & DMA_TX_OWN) {
++		/* free skbuf and lie to the caller that we sent it out */
++		dev->stats.tx_dropped++;
++		dev_kfree_skb(skb);
++
++		/* restart transmitter in case locked */
++		sp->dma_regs->xmt_poll = 0;
++		return 0;
++	}
++
++	/* Setup the transmit descriptor. */
++	td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
++				 (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED));
++	td->addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
++	td->status = DMA_TX_OWN;
++
++	/* kick transmitter last */
++	sp->dma_regs->xmt_poll = 0;
++
++	sp->tx_skb[idx] = skb;
++	idx = DSC_NEXT(idx);
++	sp->tx_prd = idx;
++
++	return 0;
++}
++
++static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++
++	switch (cmd) {
++	case SIOCGMIIPHY:
++	case SIOCGMIIREG:
++	case SIOCSMIIREG:
++		return phy_mii_ioctl(sp->phy_dev, ifr, cmd);
++
++	default:
++		break;
++	}
++
++	return -EOPNOTSUPP;
++}
++
++static void ar231x_adjust_link(struct net_device *dev)
++{
++	struct ar231x_private *sp = netdev_priv(dev);
++	struct phy_device *phydev = sp->phy_dev;
++	u32 mc;
++
++	if (!phydev->link) {
++		if (sp->link) {
++			pr_info("%s: link down\n", dev->name);
++			sp->link = 0;
++		}
++		return;
++	}
++	sp->link = 1;
++
++	pr_info("%s: link up (%uMbps/%s duplex)\n", dev->name,
++		phydev->speed, phydev->duplex ? "full" : "half");
++
++	mc = sp->eth_regs->mac_control;
++	if (phydev->duplex)
++		mc = (mc | MAC_CONTROL_F) & ~MAC_CONTROL_DRO;
++	else
++		mc = (mc | MAC_CONTROL_DRO) & ~MAC_CONTROL_F;
++	sp->eth_regs->mac_control = mc;
++	sp->duplex = phydev->duplex;
++}
++
++#define MII_ADDR(phy, reg) \
++	((reg << MII_ADDR_REG_SHIFT) | (phy << MII_ADDR_PHY_SHIFT))
++
++static int
++ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
++{
++	struct net_device *const dev = bus->priv;
++	struct ar231x_private *sp = netdev_priv(dev);
++	volatile MII *ethernet = sp->phy_regs;
++
++	ethernet->mii_addr = MII_ADDR(phy_addr, regnum);
++	while (ethernet->mii_addr & MII_ADDR_BUSY)
++		;
++	return ethernet->mii_data >> MII_DATA_SHIFT;
++}
++
++static int
++ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value)
++{
++	struct net_device *const dev = bus->priv;
++	struct ar231x_private *sp = netdev_priv(dev);
++	volatile MII *ethernet = sp->phy_regs;
++
++	while (ethernet->mii_addr & MII_ADDR_BUSY)
++		;
++	ethernet->mii_data = value << MII_DATA_SHIFT;
++	ethernet->mii_addr = MII_ADDR(phy_addr, regnum) | MII_ADDR_WRITE;
++
++	return 0;
++}
++
++static int ar231x_mdiobus_reset(struct mii_bus *bus)
++{
++	struct net_device *const dev = bus->priv;
++
++	ar231x_reset_reg(dev);
++
++	return 0;
++}
++
++static int ar231x_mdiobus_probe(struct net_device *dev)
++{
++	struct ar231x_private *const sp = netdev_priv(dev);
++	struct phy_device *phydev = NULL;
++
++	/* find the first (lowest address) PHY on the current MAC's MII bus */
++	phydev = phy_find_first(sp->mii_bus);
++	if (!phydev) {
++		printk(KERN_ERR "ar231x: %s: no PHY found\n", dev->name);
++		return -1;
++	}
++
++	/* now we are supposed to have a proper phydev, to attach to... */
++	BUG_ON(phydev->attached_dev);
++
++	phydev = phy_connect(dev, phydev_name(phydev), &ar231x_adjust_link,
++			     PHY_INTERFACE_MODE_MII);
++	if (IS_ERR(phydev)) {
++		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
++		return PTR_ERR(phydev);
++	}
++
++	/* mask with MAC supported features */
++	phydev->supported &= (SUPPORTED_10baseT_Half
++		| SUPPORTED_10baseT_Full
++		| SUPPORTED_100baseT_Half
++		| SUPPORTED_100baseT_Full
++		| SUPPORTED_Autoneg
++		/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
++		| SUPPORTED_MII
++		| SUPPORTED_TP);
++
++	phydev->advertising = phydev->supported;
++
++	sp->phy_dev = phydev;
++
++	printk(KERN_INFO "%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
++	       dev->name, phydev->drv->name, phydev_name(phydev));
++
++	return 0;
++}
++
+--- /dev/null
++++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h
+@@ -0,0 +1,281 @@
++/*
++ * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
++ *
++ * Copyright (C) 2004 by Sameer Dekate <sdekate at arubanetworks.com>
++ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
++ *
++ * Thanks to Atheros for providing hardware and documentation
++ * enabling me to write this driver.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#ifndef _AR2313_H_
++#define _AR2313_H_
++
++#include <linux/interrupt.h>
++#include <generated/autoconf.h>
++#include <linux/bitops.h>
++#include <ath25_platform.h>
++
++/* probe link timer - 5 secs */
++#define LINK_TIMER    (5*HZ)
++
++#define IS_DMA_TX_INT(X)   (((X) & (DMA_STATUS_TI)) != 0)
++#define IS_DMA_RX_INT(X)   (((X) & (DMA_STATUS_RI)) != 0)
++#define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN))    == 0)
++
++#define AR2313_TX_TIMEOUT (HZ/4)
++
++/* Rings */
++#define DSC_RING_ENTRIES_SIZE	(AR2313_DESCR_ENTRIES * sizeof(struct desc))
++#define DSC_NEXT(idx)	        ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
++
++#define AR2313_MBGET		2
++#define AR2313_MBSET		3
++#define AR2313_PCI_RECONFIG	4
++#define AR2313_PCI_DUMP		5
++#define AR2313_TEST_PANIC	6
++#define AR2313_TEST_NULLPTR	7
++#define AR2313_READ_DATA	8
++#define AR2313_WRITE_DATA	9
++#define AR2313_GET_VERSION	10
++#define AR2313_TEST_HANG	11
++#define AR2313_SYNC		12
++
++#define DMA_RX_ERR_CRC		BIT(1)
++#define DMA_RX_ERR_DRIB		BIT(2)
++#define DMA_RX_ERR_MII		BIT(3)
++#define DMA_RX_EV2		BIT(5)
++#define DMA_RX_ERR_COL		BIT(6)
++#define DMA_RX_LONG		BIT(7)
++#define DMA_RX_LS		BIT(8)	/* last descriptor */
++#define DMA_RX_FS		BIT(9)	/* first descriptor */
++#define DMA_RX_MF		BIT(10)	/* multicast frame */
++#define DMA_RX_ERR_RUNT		BIT(11)	/* runt frame */
++#define DMA_RX_ERR_LENGTH	BIT(12)	/* length error */
++#define DMA_RX_ERR_DESC		BIT(14)	/* descriptor error */
++#define DMA_RX_ERROR		BIT(15)	/* error summary */
++#define DMA_RX_LEN_MASK		0x3fff0000
++#define DMA_RX_LEN_SHIFT	16
++#define DMA_RX_FILT		BIT(30)
++#define DMA_RX_OWN		BIT(31)	/* desc owned by DMA controller */
++
++#define DMA_RX1_BSIZE_MASK	0x000007ff
++#define DMA_RX1_BSIZE_SHIFT	0
++#define DMA_RX1_CHAINED		BIT(24)
++#define DMA_RX1_RER		BIT(25)
++
++#define DMA_TX_ERR_UNDER	BIT(1)	/* underflow error */
++#define DMA_TX_ERR_DEFER	BIT(2)	/* excessive deferral */
++#define DMA_TX_COL_MASK		0x78
++#define DMA_TX_COL_SHIFT	3
++#define DMA_TX_ERR_HB		BIT(7)	/* hearbeat failure */
++#define DMA_TX_ERR_COL		BIT(8)	/* excessive collisions */
++#define DMA_TX_ERR_LATE		BIT(9)	/* late collision */
++#define DMA_TX_ERR_LINK		BIT(10)	/* no carrier */
++#define DMA_TX_ERR_LOSS		BIT(11)	/* loss of carrier */
++#define DMA_TX_ERR_JABBER	BIT(14)	/* transmit jabber timeout */
++#define DMA_TX_ERROR		BIT(15)	/* frame aborted */
++#define DMA_TX_OWN		BIT(31)	/* descr owned by DMA controller */
++
++#define DMA_TX1_BSIZE_MASK	0x000007ff
++#define DMA_TX1_BSIZE_SHIFT	0
++#define DMA_TX1_CHAINED		BIT(24)	/* chained descriptors */
++#define DMA_TX1_TER		BIT(25)	/* transmit end of ring */
++#define DMA_TX1_FS		BIT(29)	/* first segment */
++#define DMA_TX1_LS		BIT(30)	/* last segment */
++#define DMA_TX1_IC		BIT(31)	/* interrupt on completion */
++
++#define RCVPKT_LENGTH(X)	(X  >> 16)	/* Received pkt Length */
++
++#define MAC_CONTROL_RE		BIT(2)	/* receive enable */
++#define MAC_CONTROL_TE		BIT(3)	/* transmit enable */
++#define MAC_CONTROL_DC		BIT(5)	/* Deferral check */
++#define MAC_CONTROL_ASTP	BIT(8)	/* Auto pad strip */
++#define MAC_CONTROL_DRTY	BIT(10)	/* Disable retry */
++#define MAC_CONTROL_DBF		BIT(11)	/* Disable bcast frames */
++#define MAC_CONTROL_LCC		BIT(12)	/* late collision ctrl */
++#define MAC_CONTROL_HP		BIT(13)	/* Hash Perfect filtering */
++#define MAC_CONTROL_HASH	BIT(14)	/* Unicast hash filtering */
++#define MAC_CONTROL_HO		BIT(15)	/* Hash only filtering */
++#define MAC_CONTROL_PB		BIT(16)	/* Pass Bad frames */
++#define MAC_CONTROL_IF		BIT(17)	/* Inverse filtering */
++#define MAC_CONTROL_PR		BIT(18)	/* promis mode (valid frames only) */
++#define MAC_CONTROL_PM		BIT(19)	/* pass multicast */
++#define MAC_CONTROL_F		BIT(20)	/* full-duplex */
++#define MAC_CONTROL_DRO		BIT(23)	/* Disable Receive Own */
++#define MAC_CONTROL_HBD		BIT(28)	/* heart-beat disabled (MUST BE SET) */
++#define MAC_CONTROL_BLE		BIT(30)	/* big endian mode */
++#define MAC_CONTROL_RA		BIT(31)	/* rcv all (valid and invalid frames) */
++
++#define MII_ADDR_BUSY		BIT(0)
++#define MII_ADDR_WRITE		BIT(1)
++#define MII_ADDR_REG_SHIFT	6
++#define MII_ADDR_PHY_SHIFT	11
++#define MII_DATA_SHIFT		0
++
++#define FLOW_CONTROL_FCE	BIT(1)
++
++#define DMA_BUS_MODE_SWR	BIT(0)	/* software reset */
++#define DMA_BUS_MODE_BLE	BIT(7)	/* big endian mode */
++#define DMA_BUS_MODE_PBL_SHIFT	8	/* programmable burst length 32 */
++#define DMA_BUS_MODE_DBO	BIT(20)	/* big-endian descriptors */
++
++#define DMA_STATUS_TI		BIT(0)	/* transmit interrupt */
++#define DMA_STATUS_TPS		BIT(1)	/* transmit process stopped */
++#define DMA_STATUS_TU		BIT(2)	/* transmit buffer unavailable */
++#define DMA_STATUS_TJT		BIT(3)	/* transmit buffer timeout */
++#define DMA_STATUS_UNF		BIT(5)	/* transmit underflow */
++#define DMA_STATUS_RI		BIT(6)	/* receive interrupt */
++#define DMA_STATUS_RU		BIT(7)	/* receive buffer unavailable */
++#define DMA_STATUS_RPS		BIT(8)	/* receive process stopped */
++#define DMA_STATUS_ETI		BIT(10)	/* early transmit interrupt */
++#define DMA_STATUS_FBE		BIT(13)	/* fatal bus interrupt */
++#define DMA_STATUS_ERI		BIT(14)	/* early receive interrupt */
++#define DMA_STATUS_AIS		BIT(15)	/* abnormal interrupt summary */
++#define DMA_STATUS_NIS		BIT(16)	/* normal interrupt summary */
++#define DMA_STATUS_RS_SHIFT	17	/* receive process state */
++#define DMA_STATUS_TS_SHIFT	20	/* transmit process state */
++#define DMA_STATUS_EB_SHIFT	23	/* error bits */
++
++#define DMA_CONTROL_SR		BIT(1)	/* start receive */
++#define DMA_CONTROL_ST		BIT(13)	/* start transmit */
++#define DMA_CONTROL_SF		BIT(21)	/* store and forward */
++
++typedef struct {
++	volatile unsigned int status;	/* OWN, Device control and status. */
++	volatile unsigned int devcs;	/* pkt Control bits + Length */
++	volatile unsigned int addr;	/* Current Address. */
++	volatile unsigned int descr;	/* Next descriptor in chain. */
++} ar231x_descr_t;
++
++/**
++ * New Combo structure for Both Eth0 AND eth1
++ *
++ * Don't directly access MII related regs since phy chip could be actually
++ * connected to another ethernet block.
++ */
++typedef struct {
++	volatile unsigned int mac_control;	/* 0x00 */
++	volatile unsigned int mac_addr[2];	/* 0x04 - 0x08 */
++	volatile unsigned int mcast_table[2];	/* 0x0c - 0x10 */
++	volatile unsigned int __mii_addr;	/* 0x14 */
++	volatile unsigned int __mii_data;	/* 0x18 */
++	volatile unsigned int flow_control;	/* 0x1c */
++	volatile unsigned int vlan_tag;	/* 0x20 */
++	volatile unsigned int pad[7];	/* 0x24 - 0x3c */
++	volatile unsigned int ucast_table[8];	/* 0x40-0x5c */
++} ETHERNET_STRUCT;
++
++typedef struct {
++	volatile unsigned int mii_addr;
++	volatile unsigned int mii_data;
++} MII;
++
++/********************************************************************
++ * Interrupt controller
++ ********************************************************************/
++
++typedef struct {
++	volatile unsigned int wdog_control;	/* 0x08 */
++	volatile unsigned int wdog_timer;	/* 0x0c */
++	volatile unsigned int misc_status;	/* 0x10 */
++	volatile unsigned int misc_mask;	/* 0x14 */
++	volatile unsigned int global_status;	/* 0x18 */
++	volatile unsigned int reserved;	/* 0x1c */
++	volatile unsigned int reset_control;	/* 0x20 */
++} INTERRUPT;
++
++/********************************************************************
++ * DMA controller
++ ********************************************************************/
++typedef struct {
++	volatile unsigned int bus_mode;	/* 0x00 (CSR0) */
++	volatile unsigned int xmt_poll;	/* 0x04 (CSR1) */
++	volatile unsigned int rcv_poll;	/* 0x08 (CSR2) */
++	volatile unsigned int rcv_base;	/* 0x0c (CSR3) */
++	volatile unsigned int xmt_base;	/* 0x10 (CSR4) */
++	volatile unsigned int status;	/* 0x14 (CSR5) */
++	volatile unsigned int control;	/* 0x18 (CSR6) */
++	volatile unsigned int intr_ena;	/* 0x1c (CSR7) */
++	volatile unsigned int rcv_missed;	/* 0x20 (CSR8) */
++	volatile unsigned int reserved[11];	/* 0x24-0x4c (CSR9-19) */
++	volatile unsigned int cur_tx_buf_addr;	/* 0x50 (CSR20) */
++	volatile unsigned int cur_rx_buf_addr;	/* 0x50 (CSR21) */
++} DMA;
++
++/**
++ * Struct private for the Sibyte.
++ *
++ * Elements are grouped so variables used by the tx handling goes
++ * together, and will go into the same cache lines etc. in order to
++ * avoid cache line contention between the rx and tx handling on SMP.
++ *
++ * Frequently accessed variables are put at the beginning of the
++ * struct to help the compiler generate better/shorter code.
++ */
++struct ar231x_private {
++	struct net_device *dev;
++	int version;
++	u32 mb[2];
++
++	volatile MII *phy_regs;
++	volatile ETHERNET_STRUCT *eth_regs;
++	volatile DMA *dma_regs;
++	struct ar231x_eth *cfg;
++
++	spinlock_t lock;			/* Serialise access to device */
++
++	/* RX and TX descriptors, must be adjacent */
++	ar231x_descr_t *rx_ring;
++	ar231x_descr_t *tx_ring;
++
++	struct sk_buff **rx_skb;
++	struct sk_buff **tx_skb;
++
++	/* RX elements */
++	u32 rx_skbprd;
++	u32 cur_rx;
++
++	/* TX elements */
++	u32 tx_prd;
++	u32 tx_csm;
++
++	/* Misc elements */
++	char name[48];
++	struct {
++		u32 address;
++		u32 length;
++		char *mapping;
++	} desc;
++
++	unsigned short link;		/* 0 - link down, 1 - link up */
++	unsigned short duplex;		/* 0 - half, 1 - full */
++
++	struct tasklet_struct rx_tasklet;
++	int unloading;
++
++	struct phy_device *phy_dev;
++	struct mii_bus *mii_bus;
++};
++
++/* Prototypes */
++static int ar231x_init(struct net_device *dev);
++#ifdef TX_TIMEOUT
++static void ar231x_tx_timeout(struct net_device *dev);
++#endif
++static int ar231x_restart(struct net_device *dev);
++static void ar231x_load_rx_ring(struct net_device *dev, int bufs);
++static irqreturn_t ar231x_interrupt(int irq, void *dev_id);
++static int ar231x_open(struct net_device *dev);
++static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev);
++static int ar231x_close(struct net_device *dev);
++static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
++static void ar231x_init_cleanup(struct net_device *dev);
++
++#endif	/* _AR2313_H_ */
+--- a/arch/mips/ath25/ar2315_regs.h
++++ b/arch/mips/ath25/ar2315_regs.h
+@@ -57,6 +57,9 @@
+ #define AR2315_PCI_EXT_BASE	0x80000000	/* PCI external */
+ #define AR2315_PCI_EXT_SIZE	0x40000000
+ 
++/* MII registers offset inside Ethernet MMR region */
++#define AR2315_ENET0_MII_BASE	(AR2315_ENET0_BASE + 0x14)
++
+ /*
+  * Configuration registers
+  */
+--- a/arch/mips/ath25/ar5312_regs.h
++++ b/arch/mips/ath25/ar5312_regs.h
+@@ -64,6 +64,10 @@
+ #define AR5312_AR5312_REV7	0x0057		/* AR5312 WMAC (AP30-040) */
+ #define AR5312_AR2313_REV8	0x0058		/* AR2313 WMAC (AP43-030) */
+ 
++/* MII registers offset inside Ethernet MMR region */
++#define AR5312_ENET0_MII_BASE	(AR5312_ENET0_BASE + 0x14)
++#define AR5312_ENET1_MII_BASE	(AR5312_ENET1_BASE + 0x14)
++
+ /* Reset/Timer Block Address Map */
+ #define AR5312_TIMER		0x0000 /* countdown timer */
+ #define AR5312_RELOAD		0x0004 /* timer reload value */
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -136,6 +136,8 @@ static void ar2315_irq_dispatch(void)
+ 
+ 	if (pending & CAUSEF_IP3)
+ 		do_IRQ(AR2315_IRQ_WLAN0);
++	else if (pending & CAUSEF_IP4)
++		do_IRQ(AR2315_IRQ_ENET0);
+ #ifdef CONFIG_PCI_AR2315
+ 	else if (pending & CAUSEF_IP5)
+ 		do_IRQ(AR2315_IRQ_LCBUS_PCI);
+@@ -169,6 +171,29 @@ void __init ar2315_arch_init_irq(void)
+ 	ar2315_misc_irq_domain = domain;
+ }
+ 
++static void ar2315_device_reset_set(u32 mask)
++{
++	u32 val;
++
++	val = ar2315_rst_reg_read(AR2315_RESET);
++	ar2315_rst_reg_write(AR2315_RESET, val | mask);
++}
++
++static void ar2315_device_reset_clear(u32 mask)
++{
++	u32 val;
++
++	val = ar2315_rst_reg_read(AR2315_RESET);
++	ar2315_rst_reg_write(AR2315_RESET, val & ~mask);
++}
++
++static struct ar231x_eth ar2315_eth_data = {
++	.reset_set = ar2315_device_reset_set,
++	.reset_clear = ar2315_device_reset_clear,
++	.reset_mac = AR2315_RESET_ENET0,
++	.reset_phy = AR2315_RESET_EPHY0,
++};
++
+ static struct resource ar2315_gpio_res[] = {
+ 	{
+ 		.name = "ar2315-gpio",
+@@ -205,6 +230,11 @@ void __init ar2315_init_devices(void)
+ 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
+ 	platform_device_register(&ar2315_gpio);
+ 
++	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
++	ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii",
++			   AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0,
++			   &ar2315_eth_data);
++
+ 	ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0);
+ }
+ 
+--- a/arch/mips/ath25/ar5312.c
++++ b/arch/mips/ath25/ar5312.c
+@@ -132,6 +132,10 @@ static void ar5312_irq_dispatch(void)
+ 
+ 	if (pending & CAUSEF_IP2)
+ 		do_IRQ(AR5312_IRQ_WLAN0);
++	else if (pending & CAUSEF_IP3)
++		do_IRQ(AR5312_IRQ_ENET0);
++	else if (pending & CAUSEF_IP4)
++		do_IRQ(AR5312_IRQ_ENET1);
+ 	else if (pending & CAUSEF_IP5)
+ 		do_IRQ(AR5312_IRQ_WLAN1);
+ 	else if (pending & CAUSEF_IP6)
+@@ -163,6 +167,36 @@ void __init ar5312_arch_init_irq(void)
+ 	ar5312_misc_irq_domain = domain;
+ }
+ 
++static void ar5312_device_reset_set(u32 mask)
++{
++	u32 val;
++
++	val = ar5312_rst_reg_read(AR5312_RESET);
++	ar5312_rst_reg_write(AR5312_RESET, val | mask);
++}
++
++static void ar5312_device_reset_clear(u32 mask)
++{
++	u32 val;
++
++	val = ar5312_rst_reg_read(AR5312_RESET);
++	ar5312_rst_reg_write(AR5312_RESET, val & ~mask);
++}
++
++static struct ar231x_eth ar5312_eth0_data = {
++	.reset_set = ar5312_device_reset_set,
++	.reset_clear = ar5312_device_reset_clear,
++	.reset_mac = AR5312_RESET_ENET0,
++	.reset_phy = AR5312_RESET_EPHY0,
++};
++
++static struct ar231x_eth ar5312_eth1_data = {
++	.reset_set = ar5312_device_reset_set,
++	.reset_clear = ar5312_device_reset_clear,
++	.reset_mac = AR5312_RESET_ENET1,
++	.reset_phy = AR5312_RESET_EPHY1,
++};
++
+ static struct physmap_flash_data ar5312_flash_data = {
+ 	.width = 2,
+ };
+@@ -243,6 +277,7 @@ static void __init ar5312_flash_init(voi
+ void __init ar5312_init_devices(void)
+ {
+ 	struct ath25_boarddata *config;
++	u8 *c;
+ 
+ 	ar5312_flash_init();
+ 
+@@ -266,8 +301,30 @@ void __init ar5312_init_devices(void)
+ 
+ 	platform_device_register(&ar5312_gpio);
+ 
++	/* Fix up MAC addresses if necessary */
++	if (is_broadcast_ether_addr(config->enet0_mac))
++		ether_addr_copy(config->enet0_mac, config->enet1_mac);
++
++	/* If ENET0 and ENET1 have the same mac address,
++	 * increment the one from ENET1 */
++	if (ether_addr_equal(config->enet0_mac, config->enet1_mac)) {
++		c = config->enet1_mac + 5;
++		while ((c >= config->enet1_mac) && !(++(*c)))
++			c--;
++	}
++
+ 	switch (ath25_soc) {
+ 	case ATH25_SOC_AR5312:
++		ar5312_eth0_data.macaddr = config->enet0_mac;
++		ath25_add_ethernet(0, AR5312_ENET0_BASE, "eth0_mii",
++				   AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET0,
++				   &ar5312_eth0_data);
++
++		ar5312_eth1_data.macaddr = config->enet1_mac;
++		ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth1_mii",
++				   AR5312_ENET1_MII_BASE, AR5312_IRQ_ENET1,
++				   &ar5312_eth1_data);
++
+ 		if (!ath25_board.radio)
+ 			return;
+ 
+@@ -276,8 +333,18 @@ void __init ar5312_init_devices(void)
+ 
+ 		ath25_add_wmac(0, AR5312_WLAN0_BASE, AR5312_IRQ_WLAN0);
+ 		break;
++	/*
++	 * AR2312/3 ethernet uses the PHY of ENET0, but the MAC
++	 * of ENET1. Atheros calls it 'twisted' for a reason :)
++	 */
+ 	case ATH25_SOC_AR2312:
+ 	case ATH25_SOC_AR2313:
++		ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
++		ar5312_eth1_data.macaddr = config->enet0_mac;
++		ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth0_mii",
++				   AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET1,
++				   &ar5312_eth1_data);
++
+ 		if (!ath25_board.radio)
+ 			return;
+ 		break;
+--- a/arch/mips/ath25/devices.h
++++ b/arch/mips/ath25/devices.h
+@@ -33,6 +33,8 @@ extern struct ar231x_board_config ath25_
+ extern void (*ath25_irq_dispatch)(void);
+ 
+ int ath25_find_config(phys_addr_t offset, unsigned long size);
++int ath25_add_ethernet(int nr, u32 base, const char *mii_name, u32 mii_base,
++		       int irq, void *pdata);
+ void ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
+ int ath25_add_wmac(int nr, u32 base, int irq);
+ 
+--- a/arch/mips/ath25/devices.c
++++ b/arch/mips/ath25/devices.c
+@@ -13,6 +13,51 @@
+ struct ar231x_board_config ath25_board;
+ enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN;
+ 
++static struct resource ath25_eth0_res[] = {
++	{
++		.name = "eth0_membase",
++		.flags = IORESOURCE_MEM,
++	},
++	{
++		.name = "eth0_mii",
++		.flags = IORESOURCE_MEM,
++	},
++	{
++		.name = "eth0_irq",
++		.flags = IORESOURCE_IRQ,
++	}
++};
++
++static struct resource ath25_eth1_res[] = {
++	{
++		.name = "eth1_membase",
++		.flags = IORESOURCE_MEM,
++	},
++	{
++		.name = "eth1_mii",
++		.flags = IORESOURCE_MEM,
++	},
++	{
++		.name = "eth1_irq",
++		.flags = IORESOURCE_IRQ,
++	}
++};
++
++static struct platform_device ath25_eth[] = {
++	{
++		.id = 0,
++		.name = "ar231x-eth",
++		.resource = ath25_eth0_res,
++		.num_resources = ARRAY_SIZE(ath25_eth0_res)
++	},
++	{
++		.id = 1,
++		.name = "ar231x-eth",
++		.resource = ath25_eth1_res,
++		.num_resources = ARRAY_SIZE(ath25_eth1_res)
++	}
++};
++
+ static struct resource ath25_wmac0_res[] = {
+ 	{
+ 		.name = "wmac0_membase",
+@@ -71,6 +116,25 @@ const char *get_system_type(void)
+ 	return soc_type_strings[ath25_soc];
+ }
+ 
++int __init ath25_add_ethernet(int nr, u32 base, const char *mii_name,
++			      u32 mii_base, int irq, void *pdata)
++{
++	struct resource *res;
++
++	ath25_eth[nr].dev.platform_data = pdata;
++	res = &ath25_eth[nr].resource[0];
++	res->start = base;
++	res->end = base + 0x2000 - 1;
++	res++;
++	res->name = mii_name;
++	res->start = mii_base;
++	res->end = mii_base + 8 - 1;
++	res++;
++	res->start = irq;
++	res->end = irq;
++	return platform_device_register(&ath25_eth[nr]);
++}
++
+ void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
+ {
+ 	struct uart_port s;
+--- a/arch/mips/include/asm/mach-ath25/ath25_platform.h
++++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h
+@@ -71,4 +71,15 @@ struct ar231x_board_config {
+ 	const char *radio;
+ };
+ 
++/*
++ * Platform device information for the Ethernet MAC
++ */
++struct ar231x_eth {
++	void (*reset_set)(u32);
++	void (*reset_clear)(u32);
++	u32 reset_mac;
++	u32 reset_phy;
++	char *macaddr;
++};
++
+ #endif /* __ASM_MACH_ATH25_PLATFORM_H */
diff --git a/target/linux/ath25/patches-4.14/120-spiflash.patch b/target/linux/ath25/patches-4.14/120-spiflash.patch
new file mode 100644
index 0000000000..0a2161fb7e
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/120-spiflash.patch
@@ -0,0 +1,634 @@
+--- a/drivers/mtd/devices/Kconfig
++++ b/drivers/mtd/devices/Kconfig
+@@ -130,6 +130,10 @@ config MTD_BCM47XXSFLASH
+ 	  registered by bcma as platform devices. This enables driver for
+ 	  serial flash memories.
+ 
++config MTD_AR2315
++	tristate "Atheros AR2315+ SPI Flash support"
++	depends on SOC_AR2315
++
+ config MTD_SLRAM
+ 	tristate "Uncached system RAM"
+ 	help
+--- a/drivers/mtd/devices/Makefile
++++ b/drivers/mtd/devices/Makefile
+@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
+ obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
+ obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
+ obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
++obj-$(CONFIG_MTD_AR2315)	+= ar2315.o
+ obj-$(CONFIG_MTD_BCM47XXSFLASH)	+= bcm47xxsflash.o
+ obj-$(CONFIG_MTD_ST_SPI_FSM)    += st_spi_fsm.o
+ obj-$(CONFIG_MTD_POWERNV_FLASH)	+= powernv_flash.o
+--- /dev/null
++++ b/drivers/mtd/devices/ar2315.c
+@@ -0,0 +1,459 @@
++
++/*
++ * MTD driver for the SPI Flash Memory support on Atheros AR2315
++ *
++ * Copyright (c) 2005-2006 Atheros Communications Inc.
++ * Copyright (C) 2006-2007 FON Technology, SL.
++ * Copyright (C) 2006-2007 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
++ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
++ *
++ * This code is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/types.h>
++#include <linux/errno.h>
++#include <linux/slab.h>
++#include <linux/mtd/mtd.h>
++#include <linux/mtd/partitions.h>
++#include <linux/platform_device.h>
++#include <linux/sched.h>
++#include <linux/delay.h>
++#include <linux/io.h>
++#include <linux/mutex.h>
++
++#include "ar2315_spiflash.h"
++
++#define DRIVER_NAME "ar2315-spiflash"
++
++#define busy_wait(_priv, _condition, _wait) do { \
++	while (_condition) { \
++		if (_wait > 1) \
++			msleep(_wait); \
++		else if ((_wait == 1) && need_resched()) \
++			schedule(); \
++		else \
++			udelay(1); \
++	} \
++} while (0)
++
++enum {
++	FLASH_NONE,
++	FLASH_1MB,
++	FLASH_2MB,
++	FLASH_4MB,
++	FLASH_8MB,
++	FLASH_16MB,
++};
++
++/* Flash configuration table */
++struct flashconfig {
++	u32 byte_cnt;
++	u32 sector_cnt;
++	u32 sector_size;
++};
++
++static const struct flashconfig flashconfig_tbl[] = {
++	[FLASH_NONE] = { 0, 0, 0},
++	[FLASH_1MB]  = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT,
++			 STM_1MB_SECTOR_SIZE},
++	[FLASH_2MB]  = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT,
++			 STM_2MB_SECTOR_SIZE},
++	[FLASH_4MB]  = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT,
++			 STM_4MB_SECTOR_SIZE},
++	[FLASH_8MB]  = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT,
++			 STM_8MB_SECTOR_SIZE},
++	[FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT,
++			 STM_16MB_SECTOR_SIZE}
++};
++
++/* Mapping of generic opcodes to STM serial flash opcodes */
++enum {
++	SPI_WRITE_ENABLE,
++	SPI_WRITE_DISABLE,
++	SPI_RD_STATUS,
++	SPI_WR_STATUS,
++	SPI_RD_DATA,
++	SPI_FAST_RD_DATA,
++	SPI_PAGE_PROGRAM,
++	SPI_SECTOR_ERASE,
++	SPI_BULK_ERASE,
++	SPI_DEEP_PWRDOWN,
++	SPI_RD_SIG,
++};
++
++struct opcodes {
++	__u16 code;
++	__s8 tx_cnt;
++	__s8 rx_cnt;
++};
++
++static const struct opcodes stm_opcodes[] = {
++	[SPI_WRITE_ENABLE] = {STM_OP_WR_ENABLE, 1, 0},
++	[SPI_WRITE_DISABLE] = {STM_OP_WR_DISABLE, 1, 0},
++	[SPI_RD_STATUS] = {STM_OP_RD_STATUS, 1, 1},
++	[SPI_WR_STATUS] = {STM_OP_WR_STATUS, 1, 0},
++	[SPI_RD_DATA] = {STM_OP_RD_DATA, 4, 4},
++	[SPI_FAST_RD_DATA] = {STM_OP_FAST_RD_DATA, 5, 0},
++	[SPI_PAGE_PROGRAM] = {STM_OP_PAGE_PGRM, 8, 0},
++	[SPI_SECTOR_ERASE] = {STM_OP_SECTOR_ERASE, 4, 0},
++	[SPI_BULK_ERASE] = {STM_OP_BULK_ERASE, 1, 0},
++	[SPI_DEEP_PWRDOWN] = {STM_OP_DEEP_PWRDOWN, 1, 0},
++	[SPI_RD_SIG] = {STM_OP_RD_SIG, 4, 1},
++};
++
++/* Driver private data structure */
++struct spiflash_priv {
++	struct mtd_info mtd;
++	void __iomem *readaddr; /* memory mapped data for read  */
++	void __iomem *mmraddr;  /* memory mapped register space */
++	struct mutex lock;	/* serialize registers access */
++};
++
++#define to_spiflash(_mtd) container_of(_mtd, struct spiflash_priv, mtd)
++
++enum {
++	FL_READY,
++	FL_READING,
++	FL_ERASING,
++	FL_WRITING
++};
++
++/*****************************************************************************/
++
++static u32
++spiflash_read_reg(struct spiflash_priv *priv, int reg)
++{
++	return ioread32(priv->mmraddr + reg);
++}
++
++static void
++spiflash_write_reg(struct spiflash_priv *priv, int reg, u32 data)
++{
++	iowrite32(data, priv->mmraddr + reg);
++}
++
++static u32
++spiflash_wait_busy(struct spiflash_priv *priv)
++{
++	u32 reg;
++
++	busy_wait(priv, (reg = spiflash_read_reg(priv, SPI_FLASH_CTL)) &
++		SPI_CTL_BUSY, 0);
++	return reg;
++}
++
++static u32
++spiflash_sendcmd(struct spiflash_priv *priv, int opcode, u32 addr)
++{
++	const struct opcodes *op;
++	u32 reg, mask;
++
++	op = &stm_opcodes[opcode];
++	reg = spiflash_wait_busy(priv);
++	spiflash_write_reg(priv, SPI_FLASH_OPCODE,
++			   ((u32)op->code) | (addr << 8));
++
++	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
++	reg |= SPI_CTL_START | op->tx_cnt | (op->rx_cnt << 4);
++
++	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
++	spiflash_wait_busy(priv);
++
++	if (!op->rx_cnt)
++		return 0;
++
++	reg = spiflash_read_reg(priv, SPI_FLASH_DATA);
++
++	switch (op->rx_cnt) {
++	case 1:
++		mask = 0x000000ff;
++		break;
++	case 2:
++		mask = 0x0000ffff;
++		break;
++	case 3:
++		mask = 0x00ffffff;
++		break;
++	default:
++		mask = 0xffffffff;
++		break;
++	}
++	reg &= mask;
++
++	return reg;
++}
++
++/*
++ * Probe SPI flash device
++ * Function returns 0 for failure.
++ * and flashconfig_tbl array index for success.
++ */
++static int
++spiflash_probe_chip(struct platform_device *pdev, struct spiflash_priv *priv)
++{
++	u32 sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0);
++	int flash_size;
++
++	switch (sig) {
++	case STM_8MBIT_SIGNATURE:
++		flash_size = FLASH_1MB;
++		break;
++	case STM_16MBIT_SIGNATURE:
++		flash_size = FLASH_2MB;
++		break;
++	case STM_32MBIT_SIGNATURE:
++		flash_size = FLASH_4MB;
++		break;
++	case STM_64MBIT_SIGNATURE:
++		flash_size = FLASH_8MB;
++		break;
++	case STM_128MBIT_SIGNATURE:
++		flash_size = FLASH_16MB;
++		break;
++	default:
++		dev_warn(&pdev->dev, "read of flash device signature failed!\n");
++		return 0;
++	}
++
++	return flash_size;
++}
++
++static void
++spiflash_wait_complete(struct spiflash_priv *priv, unsigned int timeout)
++{
++	busy_wait(priv, spiflash_sendcmd(priv, SPI_RD_STATUS, 0) &
++		SPI_STATUS_WIP, timeout);
++}
++
++static int
++spiflash_erase(struct mtd_info *mtd, struct erase_info *instr)
++{
++	struct spiflash_priv *priv = to_spiflash(mtd);
++	const struct opcodes *op;
++	u32 temp, reg;
++
++	if (instr->addr + instr->len > mtd->size)
++		return -EINVAL;
++
++	mutex_lock(&priv->lock);
++
++	spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
++	reg = spiflash_wait_busy(priv);
++
++	op = &stm_opcodes[SPI_SECTOR_ERASE];
++	temp = ((u32)instr->addr << 8) | (u32)(op->code);
++	spiflash_write_reg(priv, SPI_FLASH_OPCODE, temp);
++
++	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
++	reg |= op->tx_cnt | SPI_CTL_START;
++	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
++
++	spiflash_wait_complete(priv, 20);
++
++	mutex_unlock(&priv->lock);
++
++	instr->state = MTD_ERASE_DONE;
++	mtd_erase_callback(instr);
++
++	return 0;
++}
++
++static int
++spiflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
++	      u_char *buf)
++{
++	struct spiflash_priv *priv = to_spiflash(mtd);
++
++	if (!len)
++		return 0;
++
++	if (from + len > mtd->size)
++		return -EINVAL;
++
++	*retlen = len;
++
++	mutex_lock(&priv->lock);
++
++	memcpy_fromio(buf, priv->readaddr + from, len);
++
++	mutex_unlock(&priv->lock);
++
++	return 0;
++}
++
++static int
++spiflash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
++	       const u8 *buf)
++{
++	struct spiflash_priv *priv = to_spiflash(mtd);
++	u32 opcode, bytes_left;
++
++	*retlen = 0;
++
++	if (!len)
++		return 0;
++
++	if (to + len > mtd->size)
++		return -EINVAL;
++
++	bytes_left = len;
++
++	do {
++		u32 read_len, reg, page_offset, spi_data = 0;
++
++		read_len = min(bytes_left, sizeof(u32));
++
++		/* 32-bit writes cannot span across a page boundary
++		 * (256 bytes). This types of writes require two page
++		 * program operations to handle it correctly. The STM part
++		 * will write the overflow data to the beginning of the
++		 * current page as opposed to the subsequent page.
++		 */
++		page_offset = (to & (STM_PAGE_SIZE - 1)) + read_len;
++
++		if (page_offset > STM_PAGE_SIZE)
++			read_len -= (page_offset - STM_PAGE_SIZE);
++
++		mutex_lock(&priv->lock);
++
++		spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
++		spi_data = 0;
++		switch (read_len) {
++		case 4:
++			spi_data |= buf[3] << 24;
++			/* fall through */
++		case 3:
++			spi_data |= buf[2] << 16;
++			/* fall through */
++		case 2:
++			spi_data |= buf[1] << 8;
++			/* fall through */
++		case 1:
++			spi_data |= buf[0] & 0xff;
++			break;
++		default:
++			break;
++		}
++
++		spiflash_write_reg(priv, SPI_FLASH_DATA, spi_data);
++		opcode = stm_opcodes[SPI_PAGE_PROGRAM].code |
++			(to & 0x00ffffff) << 8;
++		spiflash_write_reg(priv, SPI_FLASH_OPCODE, opcode);
++
++		reg = spiflash_read_reg(priv, SPI_FLASH_CTL);
++		reg &= ~SPI_CTL_TX_RX_CNT_MASK;
++		reg |= (read_len + 4) | SPI_CTL_START;
++		spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
++
++		spiflash_wait_complete(priv, 1);
++
++		mutex_unlock(&priv->lock);
++
++		bytes_left -= read_len;
++		to += read_len;
++		buf += read_len;
++
++		*retlen += read_len;
++	} while (bytes_left != 0);
++
++	return 0;
++}
++
++#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS
++static const char * const part_probe_types[] = {
++	"cmdlinepart", "RedBoot", "MyLoader", NULL
++};
++#endif
++
++static int
++spiflash_probe(struct platform_device *pdev)
++{
++	struct spiflash_priv *priv;
++	struct mtd_info *mtd;
++	struct resource *res;
++	int index;
++	int result = 0;
++
++	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
++	if (!priv)
++		return -ENOMEM;
++
++	mutex_init(&priv->lock);
++	mtd = &priv->mtd;
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++	priv->mmraddr = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(priv->mmraddr)) {
++		dev_warn(&pdev->dev, "failed to map flash MMR\n");
++		return PTR_ERR(priv->mmraddr);
++	}
++
++	index = spiflash_probe_chip(pdev, priv);
++	if (!index) {
++		dev_warn(&pdev->dev, "found no flash device\n");
++		return -ENODEV;
++	}
++
++	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++	priv->readaddr = devm_ioremap_resource(&pdev->dev, res);
++	if (IS_ERR(priv->readaddr)) {
++		dev_warn(&pdev->dev, "failed to map flash read mem\n");
++		return PTR_ERR(priv->readaddr);
++	}
++
++	platform_set_drvdata(pdev, priv);
++	mtd->name = "spiflash";
++	mtd->type = MTD_NORFLASH;
++	mtd->flags = (MTD_CAP_NORFLASH|MTD_WRITEABLE);
++	mtd->size = flashconfig_tbl[index].byte_cnt;
++	mtd->erasesize = flashconfig_tbl[index].sector_size;
++	mtd->writesize = 1;
++	mtd->numeraseregions = 0;
++	mtd->eraseregions = NULL;
++	mtd->_erase = spiflash_erase;
++	mtd->_read = spiflash_read;
++	mtd->_write = spiflash_write;
++	mtd->owner = THIS_MODULE;
++
++	dev_info(&pdev->dev, "%lld Kbytes flash detected\n", mtd->size >> 10);
++
++#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS
++	/* parse redboot partitions */
++
++	result = mtd_device_parse_register(mtd, part_probe_types,
++					   NULL, NULL, 0);
++#endif
++
++	return result;
++}
++
++static int
++spiflash_remove(struct platform_device *pdev)
++{
++	struct spiflash_priv *priv = platform_get_drvdata(pdev);
++
++	mtd_device_unregister(&priv->mtd);
++
++	return 0;
++}
++
++static struct platform_driver spiflash_driver = {
++	.driver.name = DRIVER_NAME,
++	.probe = spiflash_probe,
++	.remove = spiflash_remove,
++};
++
++module_platform_driver(spiflash_driver);
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("OpenWrt.org");
++MODULE_AUTHOR("Atheros Communications Inc");
++MODULE_DESCRIPTION("MTD driver for SPI Flash on Atheros AR2315+ SOC");
++MODULE_ALIAS("platform:" DRIVER_NAME);
++
+--- /dev/null
++++ b/drivers/mtd/devices/ar2315_spiflash.h
+@@ -0,0 +1,106 @@
++/*
++ * Atheros AR2315 SPI Flash Memory support header file.
++ *
++ * Copyright (c) 2005, Atheros Communications Inc.
++ * Copyright (C) 2006 FON Technology, SL.
++ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
++ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
++ *
++ * This code is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
++#ifndef __AR2315_SPIFLASH_H
++#define __AR2315_SPIFLASH_H
++
++#define STM_PAGE_SIZE           256
++
++#define SFI_WRITE_BUFFER_SIZE   4
++#define SFI_FLASH_ADDR_MASK     0x00ffffff
++
++#define STM_8MBIT_SIGNATURE     0x13
++#define STM_M25P80_BYTE_COUNT   1048576
++#define STM_M25P80_SECTOR_COUNT 16
++#define STM_M25P80_SECTOR_SIZE  0x10000
++
++#define STM_16MBIT_SIGNATURE    0x14
++#define STM_M25P16_BYTE_COUNT   2097152
++#define STM_M25P16_SECTOR_COUNT 32
++#define STM_M25P16_SECTOR_SIZE  0x10000
++
++#define STM_32MBIT_SIGNATURE    0x15
++#define STM_M25P32_BYTE_COUNT   4194304
++#define STM_M25P32_SECTOR_COUNT 64
++#define STM_M25P32_SECTOR_SIZE  0x10000
++
++#define STM_64MBIT_SIGNATURE    0x16
++#define STM_M25P64_BYTE_COUNT   8388608
++#define STM_M25P64_SECTOR_COUNT 128
++#define STM_M25P64_SECTOR_SIZE  0x10000
++
++#define STM_128MBIT_SIGNATURE   0x17
++#define STM_M25P128_BYTE_COUNT   16777216
++#define STM_M25P128_SECTOR_COUNT 256
++#define STM_M25P128_SECTOR_SIZE  0x10000
++
++#define STM_1MB_BYTE_COUNT   STM_M25P80_BYTE_COUNT
++#define STM_1MB_SECTOR_COUNT STM_M25P80_SECTOR_COUNT
++#define STM_1MB_SECTOR_SIZE  STM_M25P80_SECTOR_SIZE
++#define STM_2MB_BYTE_COUNT   STM_M25P16_BYTE_COUNT
++#define STM_2MB_SECTOR_COUNT STM_M25P16_SECTOR_COUNT
++#define STM_2MB_SECTOR_SIZE  STM_M25P16_SECTOR_SIZE
++#define STM_4MB_BYTE_COUNT   STM_M25P32_BYTE_COUNT
++#define STM_4MB_SECTOR_COUNT STM_M25P32_SECTOR_COUNT
++#define STM_4MB_SECTOR_SIZE  STM_M25P32_SECTOR_SIZE
++#define STM_8MB_BYTE_COUNT   STM_M25P64_BYTE_COUNT
++#define STM_8MB_SECTOR_COUNT STM_M25P64_SECTOR_COUNT
++#define STM_8MB_SECTOR_SIZE  STM_M25P64_SECTOR_SIZE
++#define STM_16MB_BYTE_COUNT   STM_M25P128_BYTE_COUNT
++#define STM_16MB_SECTOR_COUNT STM_M25P128_SECTOR_COUNT
++#define STM_16MB_SECTOR_SIZE  STM_M25P128_SECTOR_SIZE
++
++/*
++ * ST Microelectronics Opcodes for Serial Flash
++ */
++
++#define STM_OP_WR_ENABLE       0x06     /* Write Enable */
++#define STM_OP_WR_DISABLE      0x04     /* Write Disable */
++#define STM_OP_RD_STATUS       0x05     /* Read Status */
++#define STM_OP_WR_STATUS       0x01     /* Write Status */
++#define STM_OP_RD_DATA         0x03     /* Read Data */
++#define STM_OP_FAST_RD_DATA    0x0b     /* Fast Read Data */
++#define STM_OP_PAGE_PGRM       0x02     /* Page Program */
++#define STM_OP_SECTOR_ERASE    0xd8     /* Sector Erase */
++#define STM_OP_BULK_ERASE      0xc7     /* Bulk Erase */
++#define STM_OP_DEEP_PWRDOWN    0xb9     /* Deep Power-Down Mode */
++#define STM_OP_RD_SIG          0xab     /* Read Electronic Signature */
++
++#define STM_STATUS_WIP       0x01       /* Write-In-Progress */
++#define STM_STATUS_WEL       0x02       /* Write Enable Latch */
++#define STM_STATUS_BP0       0x04       /* Block Protect 0 */
++#define STM_STATUS_BP1       0x08       /* Block Protect 1 */
++#define STM_STATUS_BP2       0x10       /* Block Protect 2 */
++#define STM_STATUS_SRWD      0x80       /* Status Register Write Disable */
++
++/*
++ * SPI Flash Interface Registers
++ */
++
++#define SPI_FLASH_CTL           0x00
++#define SPI_FLASH_OPCODE        0x04
++#define SPI_FLASH_DATA          0x08
++
++#define SPI_CTL_START           0x00000100
++#define SPI_CTL_BUSY            0x00010000
++#define SPI_CTL_TXCNT_MASK      0x0000000f
++#define SPI_CTL_RXCNT_MASK      0x000000f0
++#define SPI_CTL_TX_RX_CNT_MASK  0x000000ff
++#define SPI_CTL_SIZE_MASK       0x00060000
++
++#define SPI_CTL_CLK_SEL_MASK    0x03000000
++#define SPI_OPCODE_MASK         0x000000ff
++
++#define SPI_STATUS_WIP		STM_STATUS_WIP
++
++#endif
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -220,6 +220,28 @@ static struct platform_device ar2315_gpi
+ 	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
+ };
+ 
++static struct resource ar2315_spiflash_res[] = {
++	{
++		.name = "spiflash_read",
++		.flags = IORESOURCE_MEM,
++		.start = AR2315_SPI_READ_BASE,
++		.end = AR2315_SPI_READ_BASE + AR2315_SPI_READ_SIZE - 1,
++	},
++	{
++		.name = "spiflash_mmr",
++		.flags = IORESOURCE_MEM,
++		.start = AR2315_SPI_MMR_BASE,
++		.end = AR2315_SPI_MMR_BASE + AR2315_SPI_MMR_SIZE - 1,
++	},
++};
++
++static struct platform_device ar2315_spiflash = {
++	.id = 0,
++	.name = "ar2315-spiflash",
++	.resource = ar2315_spiflash_res,
++	.num_resources = ARRAY_SIZE(ar2315_spiflash_res)
++};
++
+ void __init ar2315_init_devices(void)
+ {
+ 	/* Find board configuration */
+@@ -230,6 +252,8 @@ void __init ar2315_init_devices(void)
+ 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
+ 	platform_device_register(&ar2315_gpio);
+ 
++	platform_device_register(&ar2315_spiflash);
++
+ 	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
+ 	ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii",
+ 			   AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0,
diff --git a/target/linux/ath25/patches-4.14/130-watchdog.patch b/target/linux/ath25/patches-4.14/130-watchdog.patch
new file mode 100644
index 0000000000..01904d69a5
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/130-watchdog.patch
@@ -0,0 +1,277 @@
+--- /dev/null
++++ b/drivers/watchdog/ar2315-wtd.c
+@@ -0,0 +1,209 @@
++/*
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ *
++ * Copyright (C) 2008 John Crispin <blogic at openwrt.org>
++ * Based on EP93xx and ifxmips wdt driver
++ */
++
++#include <linux/interrupt.h>
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/types.h>
++#include <linux/miscdevice.h>
++#include <linux/watchdog.h>
++#include <linux/fs.h>
++#include <linux/ioport.h>
++#include <linux/notifier.h>
++#include <linux/reboot.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/io.h>
++#include <linux/uaccess.h>
++
++#define DRIVER_NAME	"ar2315-wdt"
++
++#define CLOCK_RATE 40000000
++#define HEARTBEAT(x) (x < 1 || x > 90 ? 20 : x)
++
++#define WDT_REG_TIMER		0x00
++#define WDT_REG_CTRL		0x04
++
++#define WDT_CTRL_ACT_NONE	0x00000000	/* No action */
++#define WDT_CTRL_ACT_NMI	0x00000001	/* NMI on watchdog */
++#define WDT_CTRL_ACT_RESET	0x00000002	/* reset on watchdog */
++
++static int wdt_timeout = 20;
++static int started;
++static int in_use;
++static void __iomem *wdt_base;
++
++static inline void ar2315_wdt_wr(unsigned reg, u32 val)
++{
++	iowrite32(val, wdt_base + reg);
++}
++
++static void
++ar2315_wdt_enable(void)
++{
++	ar2315_wdt_wr(WDT_REG_TIMER, wdt_timeout * CLOCK_RATE);
++}
++
++static ssize_t
++ar2315_wdt_write(struct file *file, const char __user *data, size_t len,
++		 loff_t *ppos)
++{
++	if (len)
++		ar2315_wdt_enable();
++	return len;
++}
++
++static int
++ar2315_wdt_open(struct inode *inode, struct file *file)
++{
++	if (in_use)
++		return -EBUSY;
++	ar2315_wdt_enable();
++	in_use = 1;
++	started = 1;
++	return nonseekable_open(inode, file);
++}
++
++static int
++ar2315_wdt_release(struct inode *inode, struct file *file)
++{
++	in_use = 0;
++	return 0;
++}
++
++static irqreturn_t
++ar2315_wdt_interrupt(int irq, void *dev)
++{
++	struct platform_device *pdev = (struct platform_device *)dev;
++
++	if (started) {
++		dev_crit(&pdev->dev, "watchdog expired, rebooting system\n");
++		emergency_restart();
++	} else {
++		ar2315_wdt_wr(WDT_REG_CTRL, 0);
++		ar2315_wdt_wr(WDT_REG_TIMER, 0);
++	}
++	return IRQ_HANDLED;
++}
++
++static struct watchdog_info ident = {
++	.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
++	.identity = "ar2315 Watchdog",
++};
++
++static long
++ar2315_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
++{
++	int new_wdt_timeout;
++	int ret = -ENOIOCTLCMD;
++
++	switch (cmd) {
++	case WDIOC_GETSUPPORT:
++		ret = copy_to_user((void __user *)arg, &ident, sizeof(ident)) ?
++		      -EFAULT : 0;
++		break;
++	case WDIOC_KEEPALIVE:
++		ar2315_wdt_enable();
++		ret = 0;
++		break;
++	case WDIOC_SETTIMEOUT:
++		ret = get_user(new_wdt_timeout, (int __user *)arg);
++		if (ret)
++			break;
++		wdt_timeout = HEARTBEAT(new_wdt_timeout);
++		ar2315_wdt_enable();
++		break;
++	case WDIOC_GETTIMEOUT:
++		ret = put_user(wdt_timeout, (int __user *)arg);
++		break;
++	}
++	return ret;
++}
++
++static const struct file_operations ar2315_wdt_fops = {
++	.owner		= THIS_MODULE,
++	.llseek		= no_llseek,
++	.write		= ar2315_wdt_write,
++	.unlocked_ioctl	= ar2315_wdt_ioctl,
++	.open		= ar2315_wdt_open,
++	.release	= ar2315_wdt_release,
++};
++
++static struct miscdevice ar2315_wdt_miscdev = {
++	.minor	= WATCHDOG_MINOR,
++	.name	= "watchdog",
++	.fops	= &ar2315_wdt_fops,
++};
++
++static int
++ar2315_wdt_probe(struct platform_device *dev)
++{
++	struct resource *mem_res, *irq_res;
++	int ret = 0;
++
++	if (wdt_base)
++		return -EBUSY;
++
++	irq_res = platform_get_resource(dev, IORESOURCE_IRQ, 0);
++	if (!irq_res) {
++		dev_err(&dev->dev, "no IRQ resource\n");
++		return -ENOENT;
++	}
++
++	mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
++	wdt_base = devm_ioremap_resource(&dev->dev, mem_res);
++	if (IS_ERR(wdt_base))
++		return PTR_ERR(wdt_base);
++
++	ret = devm_request_irq(&dev->dev, irq_res->start, ar2315_wdt_interrupt,
++			       0, DRIVER_NAME, dev);
++	if (ret) {
++		dev_err(&dev->dev, "failed to register inetrrupt\n");
++		goto out;
++	}
++
++	ret = misc_register(&ar2315_wdt_miscdev);
++	if (ret)
++		dev_err(&dev->dev, "failed to register miscdev\n");
++
++out:
++	return ret;
++}
++
++static int
++ar2315_wdt_remove(struct platform_device *dev)
++{
++	misc_deregister(&ar2315_wdt_miscdev);
++	return 0;
++}
++
++static struct platform_driver ar2315_wdt_driver = {
++	.probe = ar2315_wdt_probe,
++	.remove = ar2315_wdt_remove,
++	.driver = {
++		.name = DRIVER_NAME,
++		.owner = THIS_MODULE,
++	},
++};
++
++module_platform_driver(ar2315_wdt_driver);
++
++MODULE_DESCRIPTION("Atheros AR2315 hardware watchdog driver");
++MODULE_AUTHOR("John Crispin <blogic at openwrt.org>");
++MODULE_LICENSE("GPL");
++MODULE_ALIAS("platform:" DRIVER_NAME);
+--- a/drivers/watchdog/Kconfig
++++ b/drivers/watchdog/Kconfig
+@@ -1647,6 +1647,13 @@ config PIC32_DMT
+ 	  To compile this driver as a loadable module, choose M here.
+ 	  The module will be called pic32-dmt.
+ 
++config AR2315_WDT
++	tristate "Atheros AR2315+ WiSoCs Watchdog Timer"
++	depends on ATH25
++	help
++	  Hardware driver for the built-in watchdog timer on the Atheros
++	  AR2315/AR2316 WiSoCs.
++
+ # PARISC Architecture
+ 
+ # POWERPC Architecture
+--- a/drivers/watchdog/Makefile
++++ b/drivers/watchdog/Makefile
+@@ -166,6 +166,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+ obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
+ obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
+ obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
++obj-$(CONFIG_AR2315_WDT) += ar2315-wtd.o
+ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
+ obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
+ octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -220,6 +220,24 @@ static struct platform_device ar2315_gpi
+ 	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
+ };
+ 
++static struct resource ar2315_wdt_res[] = {
++	{
++		.flags = IORESOURCE_MEM,
++		.start = AR2315_RST_BASE + AR2315_WDT_TIMER,
++		.end = AR2315_RST_BASE + AR2315_WDT_TIMER + 8 - 1,
++	},
++	{
++		.flags = IORESOURCE_IRQ,
++	}
++};
++
++static struct platform_device ar2315_wdt = {
++	.id = 0,
++	.name = "ar2315-wdt",
++	.resource = ar2315_wdt_res,
++	.num_resources = ARRAY_SIZE(ar2315_wdt_res)
++};
++
+ static struct resource ar2315_spiflash_res[] = {
+ 	{
+ 		.name = "spiflash_read",
+@@ -252,6 +270,11 @@ void __init ar2315_init_devices(void)
+ 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
+ 	platform_device_register(&ar2315_gpio);
+ 
++	ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
++						     AR2315_MISC_IRQ_WATCHDOG);
++	ar2315_wdt_res[1].end = ar2315_wdt_res[1].start;
++	platform_device_register(&ar2315_wdt);
++
+ 	platform_device_register(&ar2315_spiflash);
+ 
+ 	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
diff --git a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch b/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
new file mode 100644
index 0000000000..6aad761cb1
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
@@ -0,0 +1,60 @@
+--- a/drivers/mtd/redboot.c
++++ b/drivers/mtd/redboot.c
+@@ -30,6 +30,8 @@
+ #include <linux/mtd/partitions.h>
+ #include <linux/module.h>
+ 
++#define BOARD_CONFIG_PART		"boardconfig"
++
+ struct fis_image_desc {
+     unsigned char name[16];      // Null terminated name
+     uint32_t	  flash_base;    // Address within FLASH of image
+@@ -60,6 +62,7 @@ static int parse_redboot_partitions(stru
+ 				    const struct mtd_partition **pparts,
+ 				    struct mtd_part_parser_data *data)
+ {
++	unsigned long max_offset = 0;
+ 	int nrparts = 0;
+ 	struct fis_image_desc *buf;
+ 	struct mtd_partition *parts;
+@@ -225,14 +228,15 @@ static int parse_redboot_partitions(stru
+ 		}
+ 	}
+ #endif
+-	parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
++	parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen +
++			sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
+ 
+ 	if (!parts) {
+ 		ret = -ENOMEM;
+ 		goto out;
+ 	}
+ 
+-	nullname = (char *)&parts[nrparts];
++	nullname = (char *)&parts[nrparts + 1];
+ #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
+ 	if (nulllen > 0) {
+ 		strcpy(nullname, nullstring);
+@@ -251,6 +255,8 @@ static int parse_redboot_partitions(stru
+ 	}
+ #endif
+ 	for ( ; i<nrparts; i++) {
++		if (max_offset < buf[i].flash_base + buf[i].size)
++			max_offset = buf[i].flash_base + buf[i].size;
+ 		parts[i].size = fl->img->size;
+ 		parts[i].offset = fl->img->flash_base;
+ 		parts[i].name = names;
+@@ -284,6 +290,13 @@ static int parse_redboot_partitions(stru
+ 		fl = fl->next;
+ 		kfree(tmp_fl);
+ 	}
++	if (master->size - max_offset >= master->erasesize) {
++		parts[nrparts].size = master->size - max_offset;
++		parts[nrparts].offset = max_offset;
++		parts[nrparts].name = names;
++		strcpy(names, BOARD_CONFIG_PART);
++		nrparts++;
++	}
+ 	ret = nrparts;
+ 	*pparts = parts;
+  out:
diff --git a/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch b/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
new file mode 100644
index 0000000000..d1d281eaf4
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
@@ -0,0 +1,44 @@
+--- a/drivers/mtd/redboot.c
++++ b/drivers/mtd/redboot.c
+@@ -79,12 +79,18 @@ static int parse_redboot_partitions(stru
+ 	static char nullstring[] = "unallocated";
+ #endif
+ 
++	buf = vmalloc(master->erasesize);
++	if (!buf)
++		return -ENOMEM;
++
++ restart:
+ 	if ( directory < 0 ) {
+ 		offset = master->size + directory * master->erasesize;
+ 		while (mtd_block_isbad(master, offset)) {
+ 			if (!offset) {
+ 			nogood:
+ 				printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
++				vfree(buf);
+ 				return -EIO;
+ 			}
+ 			offset -= master->erasesize;
+@@ -97,10 +103,6 @@ static int parse_redboot_partitions(stru
+ 				goto nogood;
+ 		}
+ 	}
+-	buf = vmalloc(master->erasesize);
+-
+-	if (!buf)
+-		return -ENOMEM;
+ 
+ 	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
+ 	       master->name, offset);
+@@ -173,6 +175,11 @@ static int parse_redboot_partitions(stru
+ 	}
+ 	if (i == numslots) {
+ 		/* Didn't find it */
++		if (offset + master->erasesize < master->size) {
++			/* not at the end of the flash yet, maybe next block */
++			directory++;
++			goto restart;
++		}
+ 		printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
+ 		       master->name);
+ 		ret = 0;
diff --git a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
new file mode 100644
index 0000000000..ce039df9f1
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
@@ -0,0 +1,72 @@
+--- a/drivers/mtd/redboot.c
++++ b/drivers/mtd/redboot.c
+@@ -58,6 +58,22 @@ static inline int redboot_checksum(struc
+ 	return 1;
+ }
+ 
++static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset)
++{
++	struct mtd_erase_region_info *regions = mtd->eraseregions;
++	int i;
++
++	for (i = 0; i < mtd->numeraseregions; i++) {
++		if (regions[i].offset +
++		    regions[i].numblocks * regions[i].erasesize <= offset)
++			continue;
++
++		return regions[i].erasesize;
++	}
++
++	return mtd->erasesize;
++}
++
+ static int parse_redboot_partitions(struct mtd_info *master,
+ 				    const struct mtd_partition **pparts,
+ 				    struct mtd_part_parser_data *data)
+@@ -74,6 +90,7 @@ static int parse_redboot_partitions(stru
+ 	int namelen = 0;
+ 	int nulllen = 0;
+ 	int numslots;
++	int first_slot;
+ 	unsigned long offset;
+ #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
+ 	static char nullstring[] = "unallocated";
+@@ -186,7 +203,10 @@ static int parse_redboot_partitions(stru
+ 		goto out;
+ 	}
+ 
+-	for (i = 0; i < numslots; i++) {
++	first_slot = (buf[i].flash_base & (master->erasesize - 1)) /
++		     sizeof(struct fis_image_desc);
++
++	for (i = first_slot; i < first_slot + numslots; i++) {
+ 		struct fis_list *new_fl, **prev;
+ 
+ 		if (buf[i].name[0] == 0xff) {
+@@ -262,12 +282,13 @@ static int parse_redboot_partitions(stru
+ 	}
+ #endif
+ 	for ( ; i<nrparts; i++) {
+-		if (max_offset < buf[i].flash_base + buf[i].size)
+-			max_offset = buf[i].flash_base + buf[i].size;
+ 		parts[i].size = fl->img->size;
+ 		parts[i].offset = fl->img->flash_base;
+ 		parts[i].name = names;
+ 
++		if (max_offset < parts[i].offset + parts[i].size)
++			max_offset = parts[i].offset + parts[i].size;
++
+ 		strcpy(names, fl->img->name);
+ #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
+ 		if (!memcmp(names, "RedBoot", 8) ||
+@@ -297,7 +318,9 @@ static int parse_redboot_partitions(stru
+ 		fl = fl->next;
+ 		kfree(tmp_fl);
+ 	}
+-	if (master->size - max_offset >= master->erasesize) {
++
++	if (master->size - max_offset >=
++	    mtd_get_offset_erasesize(master, max_offset)) {
+ 		parts[nrparts].size = master->size - max_offset;
+ 		parts[nrparts].offset = max_offset;
+ 		parts[nrparts].name = names;
diff --git a/target/linux/ath25/patches-4.14/210-reset_button.patch b/target/linux/ath25/patches-4.14/210-reset_button.patch
new file mode 100644
index 0000000000..b3f7a14cda
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/210-reset_button.patch
@@ -0,0 +1,71 @@
+--- a/arch/mips/ath25/Makefile
++++ b/arch/mips/ath25/Makefile
+@@ -8,7 +8,7 @@
+ # Copyright (C) 2006-2009 Felix Fietkau <nbd at openwrt.org>
+ #
+ 
+-obj-y += board.o prom.o devices.o
++obj-y += board.o prom.o devices.o reset.o
+ 
+ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+ 
+--- /dev/null
++++ b/arch/mips/ath25/reset.c
+@@ -0,0 +1,57 @@
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/platform_device.h>
++#include <linux/gpio_keys.h>
++#include <linux/input.h>
++#include <ath25_platform.h>
++#include "devices.h"
++
++static int __init
++ar231x_init_reset(void)
++{
++	struct platform_device *pdev;
++	struct gpio_keys_platform_data pdata;
++	struct gpio_keys_button *p;
++	int err;
++
++	if (ath25_board.config->reset_config_gpio == 0xffff)
++		return -ENODEV;
++
++	p = kzalloc(sizeof(*p), GFP_KERNEL);
++	if (!p)
++		goto err;
++
++	p->desc = "reset";
++	p->type = EV_KEY;
++	p->code = KEY_RESTART;
++	p->debounce_interval = 60;
++	p->gpio = ath25_board.config->reset_config_gpio;
++
++	memset(&pdata, 0, sizeof(pdata));
++	pdata.poll_interval = 20;
++	pdata.buttons = p;
++	pdata.nbuttons = 1;
++
++	pdev = platform_device_alloc("gpio-keys-polled", 0);
++	if (!pdev)
++		goto err_free;
++
++	err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
++	if (err)
++		goto err_put_pdev;
++
++	err = platform_device_add(pdev);
++	if (err)
++		goto err_put_pdev;
++
++	return 0;
++
++err_put_pdev:
++	platform_device_put(pdev);
++err_free:
++	kfree(p);
++err:
++	return -ENOMEM;
++}
++
++device_initcall(ar231x_init_reset);
diff --git a/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
new file mode 100644
index 0000000000..91b9792515
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
@@ -0,0 +1,111 @@
+--- a/drivers/net/ethernet/atheros/ar231x/ar231x.c
++++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
+@@ -135,6 +135,7 @@ static int ar231x_mdiobus_write(struct m
+ static int ar231x_mdiobus_reset(struct mii_bus *bus);
+ static int ar231x_mdiobus_probe(struct net_device *dev);
+ static void ar231x_adjust_link(struct net_device *dev);
++static bool no_phy;
+ 
+ #ifndef ERR
+ #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
+@@ -167,6 +168,32 @@ static const struct net_device_ops ar231
+ #endif
+ };
+ 
++static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id)
++{
++	int phy_reg;
++
++	/**
++	 * Grab the bits from PHYIR1, and put them
++	 * in the upper half.
++	 */
++	phy_reg = mdiobus_read(bus, addr, MII_PHYSID1);
++
++	if (phy_reg < 0)
++		return -EIO;
++
++	*phy_id = (phy_reg & 0xffff) << 16;
++
++	/* Grab the bits from PHYIR2, and put them in the lower half */
++	phy_reg = mdiobus_read(bus, addr, MII_PHYSID2);
++
++	if (phy_reg < 0)
++		return -EIO;
++
++	*phy_id |= (phy_reg & 0xffff);
++
++	return 0;
++}
++
+ static int ar231x_probe(struct platform_device *pdev)
+ {
+ 	struct net_device *dev;
+@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_
+ 
+ 	mdiobus_register(sp->mii_bus);
+ 
++	/**
++	 * Workaround for Micrel switch, which is only available on
++	 * one PHY and cannot be configured through MDIO.
++	 */
++	if (!no_phy) {
++		u32 phy_id = 0;
++
++		get_phy_id(sp->mii_bus, 1, &phy_id);
++		if (phy_id == 0x00221450)
++			no_phy = true;
++	}
++	if (no_phy) {
++		sp->link = 1;
++		netif_carrier_on(dev);
++		return 0;
++	}
++	no_phy = true;
++
+ 	if (ar231x_mdiobus_probe(dev) != 0) {
+ 		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
+ 		rx_tasklet_cleanup(dev);
+@@ -326,8 +371,10 @@ static int ar231x_remove(struct platform
+ 	rx_tasklet_cleanup(dev);
+ 	ar231x_init_cleanup(dev);
+ 	unregister_netdev(dev);
+-	mdiobus_unregister(sp->mii_bus);
+-	mdiobus_free(sp->mii_bus);
++	if (sp->mii_bus) {
++		mdiobus_unregister(sp->mii_bus);
++		mdiobus_free(sp->mii_bus);
++	}
+ 	kfree(dev);
+ 	return 0;
+ }
+@@ -870,7 +917,8 @@ static int ar231x_open(struct net_device
+ 
+ 	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
+ 
+-	phy_start(sp->phy_dev);
++	if (sp->phy_dev)
++		phy_start(sp->phy_dev);
+ 
+ 	return 0;
+ }
+@@ -951,7 +999,8 @@ static int ar231x_close(struct net_devic
+ 
+ #endif
+ 
+-	phy_stop(sp->phy_dev);
++	if (sp->phy_dev)
++		phy_stop(sp->phy_dev);
+ 
+ 	return 0;
+ }
+@@ -995,6 +1044,9 @@ static int ar231x_ioctl(struct net_devic
+ {
+ 	struct ar231x_private *sp = netdev_priv(dev);
+ 
++	if (!sp->phy_dev)
++		return -ENODEV;
++
+ 	switch (cmd) {
+ 	case SIOCGMIIPHY:
+ 	case SIOCGMIIREG:
diff --git a/target/linux/ath25/patches-4.14/330-board_leds.patch b/target/linux/ath25/patches-4.14/330-board_leds.patch
new file mode 100644
index 0000000000..e357fc6a64
--- /dev/null
+++ b/target/linux/ath25/patches-4.14/330-board_leds.patch
@@ -0,0 +1,116 @@
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -23,6 +23,7 @@
+ #include <linux/reboot.h>
+ #include <linux/delay.h>
+ #include <linux/gpio.h>
++#include <linux/leds.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -260,6 +261,50 @@ static struct platform_device ar2315_spi
+ 	.num_resources = ARRAY_SIZE(ar2315_spiflash_res)
+ };
+ 
++#ifdef CONFIG_LEDS_GPIO
++static struct gpio_led ar2315_leds[6];
++static struct gpio_led_platform_data ar2315_led_data = {
++	.leds = (void *)ar2315_leds,
++};
++
++static struct platform_device ar2315_gpio_leds = {
++	.name = "leds-gpio",
++	.id = -1,
++	.dev = {
++		.platform_data = (void *)&ar2315_led_data,
++	}
++};
++
++static void __init ar2315_init_gpio_leds(void)
++{
++	static char led_names[6][6];
++	int i, led = 0;
++
++	ar2315_led_data.num_leds = 0;
++	for (i = 1; i < 8; i++) {
++		if ((i == AR2315_RESET_GPIO) ||
++		    (i == ath25_board.config->reset_config_gpio))
++			continue;
++
++		if (i == ath25_board.config->sys_led_gpio)
++			strcpy(led_names[led], "wlan");
++		else
++			sprintf(led_names[led], "gpio%d", i);
++
++		ar2315_leds[led].name = led_names[led];
++		ar2315_leds[led].gpio = i;
++		ar2315_leds[led].active_low = 0;
++		led++;
++	}
++	ar2315_led_data.num_leds = led;
++	platform_device_register(&ar2315_gpio_leds);
++}
++#else
++static inline void ar2315_init_gpio_leds(void)
++{
++}
++#endif
++
+ void __init ar2315_init_devices(void)
+ {
+ 	/* Find board configuration */
+@@ -270,6 +315,8 @@ void __init ar2315_init_devices(void)
+ 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
+ 	platform_device_register(&ar2315_gpio);
+ 
++	ar2315_init_gpio_leds();
++
+ 	ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
+ 						     AR2315_MISC_IRQ_WATCHDOG);
+ 	ar2315_wdt_res[1].end = ar2315_wdt_res[1].start;
+--- a/arch/mips/ath25/ar5312.c
++++ b/arch/mips/ath25/ar5312.c
+@@ -23,6 +23,7 @@
+ #include <linux/mtd/physmap.h>
+ #include <linux/reboot.h>
+ #include <linux/gpio.h>
++#include <linux/leds.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -231,6 +232,23 @@ static struct platform_device ar5312_gpi
+ 	.num_resources = ARRAY_SIZE(ar5312_gpio_res),
+ };
+ 
++#ifdef CONFIG_LEDS_GPIO
++static struct gpio_led ar5312_leds[] = {
++	{ .name = "wlan", .gpio = 0, .active_low = 1, },
++};
++
++static const struct gpio_led_platform_data ar5312_led_data = {
++	.num_leds = ARRAY_SIZE(ar5312_leds),
++	.leds = (void *)ar5312_leds,
++};
++
++static struct platform_device ar5312_gpio_leds = {
++	.name = "leds-gpio",
++	.id = -1,
++	.dev.platform_data = (void *)&ar5312_led_data,
++};
++#endif
++
+ static void __init ar5312_flash_init(void)
+ {
+ 	void __iomem *flashctl_base;
+@@ -301,6 +319,11 @@ void __init ar5312_init_devices(void)
+ 
+ 	platform_device_register(&ar5312_gpio);
+ 
++#ifdef CONFIG_LEDS_GPIO
++	ar5312_leds[0].gpio = config->sys_led_gpio;
++	platform_device_register(&ar5312_gpio_leds);
++#endif
++
+ 	/* Fix up MAC addresses if necessary */
+ 	if (is_broadcast_ether_addr(config->enet0_mac))
+ 		ether_addr_copy(config->enet0_mac, config->enet1_mac);
diff --git a/target/linux/ath25/profiles/00-default.mk b/target/linux/ath25/profiles/00-default.mk
new file mode 100644
index 0000000000..b40eb1b0ce
--- /dev/null
+++ b/target/linux/ath25/profiles/00-default.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/Default
+	NAME:=Default Profile
+	PRIORITY:=1
+endef
+
+define Profile/Default/Description
+	Default package set compatible with most boards.
+endef
+$(eval $(call Profile,Default))
-- 
2.26.2



From ryazanov.s.a at gmail.com  Fri Sep  4 19:51:33 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sat,  5 Sep 2020 02:51:33 +0300
Subject: [PATCH 5/5] ath25: drop 4.14 kernel support
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <20200904235133.27813-6-ryazanov.s.a@gmail.com>

Remove no more used 4.14 kernel support.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 target/linux/ath25/config-4.14                |  170 --
 .../ath25/patches-4.14/107-ar5312_gpio.patch  |  212 --
 .../ath25/patches-4.14/108-ar2315_gpio.patch  |  363 ----
 .../patches-4.14/110-ar2313_ethernet.patch    | 1734 -----------------
 .../ath25/patches-4.14/120-spiflash.patch     |  634 ------
 .../ath25/patches-4.14/130-watchdog.patch     |  277 ---
 .../140-redboot_boardconfig.patch             |   60 -
 .../141-redboot_partition_scan.patch          |   44 -
 .../142-redboot_various_erase_size_fix.patch  |   72 -
 .../ath25/patches-4.14/210-reset_button.patch |   71 -
 .../220-enet_micrel_workaround.patch          |  111 --
 .../ath25/patches-4.14/330-board_leds.patch   |  116 --
 12 files changed, 3864 deletions(-)
 delete mode 100644 target/linux/ath25/config-4.14
 delete mode 100644 target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
 delete mode 100644 target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
 delete mode 100644 target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
 delete mode 100644 target/linux/ath25/patches-4.14/120-spiflash.patch
 delete mode 100644 target/linux/ath25/patches-4.14/130-watchdog.patch
 delete mode 100644 target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
 delete mode 100644 target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
 delete mode 100644 target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
 delete mode 100644 target/linux/ath25/patches-4.14/210-reset_button.patch
 delete mode 100644 target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
 delete mode 100644 target/linux/ath25/patches-4.14/330-board_leds.patch

diff --git a/target/linux/ath25/config-4.14 b/target/linux/ath25/config-4.14
deleted file mode 100644
index 734f598cd0..0000000000
--- a/target/linux/ath25/config-4.14
+++ /dev/null
@@ -1,170 +0,0 @@
-CONFIG_ADM6996_PHY=y
-CONFIG_AR2315_WDT=y
-CONFIG_AR8216_PHY=y
-CONFIG_ARCH_BINFMT_ELF_STATE=y
-CONFIG_ARCH_CLOCKSOURCE_DATA=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set
-# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_MMAP_RND_BITS_MAX=15
-CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set
-# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
-CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ATH25=y
-CONFIG_BLK_MQ_PCI=y
-CONFIG_CEVT_R4K=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-CONFIG_CPU_BIG_ENDIAN=y
-CONFIG_CPU_GENERIC_DUMP_TLB=y
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_CPU_HAS_SYNC=y
-CONFIG_CPU_MIPS32=y
-CONFIG_CPU_MIPS32_R1=y
-CONFIG_CPU_MIPSR1=y
-CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
-CONFIG_CPU_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CSRC_R4K=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_ETHERNET_PACKET_MANGLE=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_CPU_AUTOPROBE=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_TIME_VSYSCALL=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_AR2315=y
-CONFIG_GPIO_AR5312=y
-# CONFIG_GRO_CELLS is not set
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_CBPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_COPY_THREAD_TLS=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IP17XX_PHY=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_MIPS_CPU=y
-CONFIG_IRQ_WORK=y
-CONFIG_LEDS_GPIO=y
-CONFIG_MDIO_BUS=y
-CONFIG_MDIO_DEVICE=y
-CONFIG_MIPS=y
-CONFIG_MIPS_ASID_BITS=8
-CONFIG_MIPS_ASID_SHIFT=0
-CONFIG_MIPS_CLOCK_VSYSCALL=y
-# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
-CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_AR2315=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_MYLOADER_PARTS=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
-CONFIG_MTD_REDBOOT_PARTS=y
-CONFIG_MVSWITCH_PHY=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NET_AR231X=y
-CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
-# CONFIG_NO_IOPORT_MAP is not set
-# CONFIG_OF is not set
-CONFIG_PCI=y
-CONFIG_PCI_AR2315=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_DRIVERS_LEGACY=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYLIB=y
-# CONFIG_RCU_NEED_SEGCBLIST is not set
-# CONFIG_RCU_STALL_COMMON is not set
-# CONFIG_SCHED_INFO is not set
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250_FSL is not set
-CONFIG_SERIAL_8250_NR_UARTS=1
-CONFIG_SERIAL_8250_RUNTIME_UARTS=1
-CONFIG_SOC_AR2315=y
-CONFIG_SOC_AR5312=y
-CONFIG_SRCU=y
-# CONFIG_SWAP is not set
-CONFIG_SWCONFIG=y
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-CONFIG_SYS_HAS_CPU_MIPS32_R1=y
-CONFIG_SYS_HAS_EARLY_PRINTK=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TINY_SRCU=y
-CONFIG_USB_SUPPORT=y
diff --git a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch b/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
deleted file mode 100644
index e74e20b05a..0000000000
--- a/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch
+++ /dev/null
@@ -1,212 +0,0 @@
---- a/arch/mips/ath25/Kconfig
-+++ b/arch/mips/ath25/Kconfig
-@@ -2,6 +2,7 @@
- config SOC_AR5312
- 	bool "Atheros AR5312/AR2312+ SoC support"
- 	depends on ATH25
-+	select GPIO_AR5312
- 	default y
- 
- config SOC_AR2315
---- a/arch/mips/ath25/ar5312.c
-+++ b/arch/mips/ath25/ar5312.c
-@@ -22,6 +22,7 @@
- #include <linux/platform_device.h>
- #include <linux/mtd/physmap.h>
- #include <linux/reboot.h>
-+#include <linux/gpio.h>
- #include <asm/bootinfo.h>
- #include <asm/reboot.h>
- #include <asm/time.h>
-@@ -180,6 +181,22 @@ static struct platform_device ar5312_phy
- 	.num_resources = 1,
- };
- 
-+static struct resource ar5312_gpio_res[] = {
-+	{
-+		.name = "ar5312-gpio",
-+		.flags = IORESOURCE_MEM,
-+		.start = AR5312_GPIO_BASE,
-+		.end = AR5312_GPIO_BASE + AR5312_GPIO_SIZE - 1,
-+	},
-+};
-+
-+static struct platform_device ar5312_gpio = {
-+	.name = "ar5312-gpio",
-+	.id = -1,
-+	.resource = ar5312_gpio_res,
-+	.num_resources = ARRAY_SIZE(ar5312_gpio_res),
-+};
-+
- static void __init ar5312_flash_init(void)
- {
- 	void __iomem *flashctl_base;
-@@ -247,6 +264,8 @@ void __init ar5312_init_devices(void)
- 
- 	platform_device_register(&ar5312_physmap_flash);
- 
-+	platform_device_register(&ar5312_gpio);
-+
- 	switch (ath25_soc) {
- 	case ATH25_SOC_AR5312:
- 		if (!ath25_board.radio)
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
- 	  driver for GPIO functionality on Promontory IOHub
- 	  Require ACPI ASL code to enumerate as a platform device.
- 
-+config GPIO_AR5312
-+	bool "AR5312 SoC GPIO support"
-+	default y if SOC_AR5312
-+	depends on SOC_AR5312
-+	help
-+	  Say yes here to enable GPIO support for Atheros AR5312/AR2312+ SoCs.
-+
- config GPIO_ASPEED
- 	tristate "Aspeed GPIO support"
- 	depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
- obj-$(CONFIG_GPIO_ASPEED)	+= gpio-aspeed.o
---- /dev/null
-+++ b/drivers/gpio/gpio-ar5312.c
-@@ -0,0 +1,121 @@
-+/*
-+ * This file is subject to the terms and conditions of the GNU General Public
-+ * License.  See the file "COPYING" in the main directory of this archive
-+ * for more details.
-+ *
-+ * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
-+ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/gpio.h>
-+
-+#define DRIVER_NAME	"ar5312-gpio"
-+
-+#define AR5312_GPIO_DO		0x00		/* output register */
-+#define AR5312_GPIO_DI		0x04		/* intput register */
-+#define AR5312_GPIO_CR		0x08		/* control register */
-+
-+#define AR5312_GPIO_CR_M(x)	(1 << (x))	/* mask for i/o */
-+#define AR5312_GPIO_CR_O(x)	(0 << (x))	/* mask for output */
-+#define AR5312_GPIO_CR_I(x)	(1 << (x))	/* mask for input */
-+#define AR5312_GPIO_CR_INT(x)	(1 << ((x)+8))	/* mask for interrupt */
-+#define AR5312_GPIO_CR_UART(x)	(1 << ((x)+16))	/* uart multiplex */
-+
-+#define AR5312_GPIO_NUM		8
-+
-+static void __iomem *ar5312_mem;
-+
-+static inline u32 ar5312_gpio_reg_read(unsigned reg)
-+{
-+	return __raw_readl(ar5312_mem + reg);
-+}
-+
-+static inline void ar5312_gpio_reg_write(unsigned reg, u32 val)
-+{
-+	__raw_writel(val, ar5312_mem + reg);
-+}
-+
-+static inline void ar5312_gpio_reg_mask(unsigned reg, u32 mask, u32 val)
-+{
-+	ar5312_gpio_reg_write(reg, (ar5312_gpio_reg_read(reg) & ~mask) | val);
-+}
-+
-+static int ar5312_gpio_get_val(struct gpio_chip *chip, unsigned gpio)
-+{
-+	return (ar5312_gpio_reg_read(AR5312_GPIO_DI) >> gpio) & 1;
-+}
-+
-+static void ar5312_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val)
-+{
-+	u32 reg = ar5312_gpio_reg_read(AR5312_GPIO_DO);
-+
-+	reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio);
-+	ar5312_gpio_reg_write(AR5312_GPIO_DO, reg);
-+}
-+
-+static int ar5312_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
-+{
-+	ar5312_gpio_reg_mask(AR5312_GPIO_CR, 0, 1 << gpio);
-+	return 0;
-+}
-+
-+static int ar5312_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val)
-+{
-+	ar5312_gpio_reg_mask(AR5312_GPIO_CR, 1 << gpio, 0);
-+	ar5312_gpio_set_val(chip, gpio, val);
-+	return 0;
-+}
-+
-+static struct gpio_chip ar5312_gpio_chip = {
-+	.label			= DRIVER_NAME,
-+	.direction_input	= ar5312_gpio_dir_in,
-+	.direction_output	= ar5312_gpio_dir_out,
-+	.set			= ar5312_gpio_set_val,
-+	.get			= ar5312_gpio_get_val,
-+	.base			= 0,
-+	.ngpio			= AR5312_GPIO_NUM,
-+};
-+
-+static int ar5312_gpio_probe(struct platform_device *pdev)
-+{
-+	struct device *dev = &pdev->dev;
-+	struct resource *res;
-+	int ret;
-+
-+	if (ar5312_mem)
-+		return -EBUSY;
-+
-+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+	ar5312_mem = devm_ioremap_resource(dev, res);
-+	if (IS_ERR(ar5312_mem))
-+		return PTR_ERR(ar5312_mem);
-+
-+	ar5312_gpio_chip.parent = dev;
-+	ret = gpiochip_add(&ar5312_gpio_chip);
-+	if (ret) {
-+		dev_err(dev, "failed to add gpiochip\n");
-+		return ret;
-+	}
-+
-+	return 0;
-+}
-+
-+static struct platform_driver ar5312_gpio_driver = {
-+	.probe = ar5312_gpio_probe,
-+	.driver = {
-+		.name = DRIVER_NAME,
-+		.owner = THIS_MODULE,
-+	}
-+};
-+
-+static int __init ar5312_gpio_init(void)
-+{
-+	return platform_driver_register(&ar5312_gpio_driver);
-+}
-+subsys_initcall(ar5312_gpio_init);
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -175,6 +175,7 @@ config ATH25
- 	select CEVT_R4K
- 	select CSRC_R4K
- 	select DMA_NONCOHERENT
-+	select GPIOLIB
- 	select IRQ_MIPS_CPU
- 	select IRQ_DOMAIN
- 	select SYS_HAS_CPU_MIPS32_R1
diff --git a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch b/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
deleted file mode 100644
index 749b308b89..0000000000
--- a/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch
+++ /dev/null
@@ -1,363 +0,0 @@
---- a/arch/mips/ath25/Kconfig
-+++ b/arch/mips/ath25/Kconfig
-@@ -8,6 +8,7 @@ config SOC_AR5312
- config SOC_AR2315
- 	bool "Atheros AR2315+ SoC support"
- 	depends on ATH25
-+	select GPIO_AR2315
- 	default y
- 
- config PCI_AR2315
---- a/arch/mips/ath25/ar2315.c
-+++ b/arch/mips/ath25/ar2315.c
-@@ -21,6 +21,8 @@
- #include <linux/interrupt.h>
- #include <linux/platform_device.h>
- #include <linux/reboot.h>
-+#include <linux/delay.h>
-+#include <linux/gpio.h>
- #include <asm/bootinfo.h>
- #include <asm/reboot.h>
- #include <asm/time.h>
-@@ -167,11 +169,42 @@ void __init ar2315_arch_init_irq(void)
- 	ar2315_misc_irq_domain = domain;
- }
- 
-+static struct resource ar2315_gpio_res[] = {
-+	{
-+		.name = "ar2315-gpio",
-+		.flags = IORESOURCE_MEM,
-+		.start = AR2315_RST_BASE + AR2315_GPIO,
-+		.end = AR2315_RST_BASE + AR2315_GPIO + 0x10 - 1,
-+	},
-+	{
-+		.name = "ar2315-gpio",
-+		.flags = IORESOURCE_IRQ,
-+	},
-+	{
-+		.name = "ar2315-gpio-irq-base",
-+		.flags = IORESOURCE_IRQ,
-+		.start = AR231X_GPIO_IRQ_BASE,
-+		.end = AR231X_GPIO_IRQ_BASE,
-+	}
-+};
-+
-+static struct platform_device ar2315_gpio = {
-+	.id = -1,
-+	.name = "ar2315-gpio",
-+	.resource = ar2315_gpio_res,
-+	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
-+};
-+
- void __init ar2315_init_devices(void)
- {
- 	/* Find board configuration */
- 	ath25_find_config(AR2315_SPI_READ_BASE, AR2315_SPI_READ_SIZE);
- 
-+	ar2315_gpio_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
-+						      AR2315_MISC_IRQ_GPIO);
-+	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
-+	platform_device_register(&ar2315_gpio);
-+
- 	ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0);
- }
- 
-@@ -187,8 +220,8 @@ static void ar2315_restart(char *command
- 	/* Cold reset does not work on the AR2315/6, use the GPIO reset bits
- 	 * a workaround. Give it some time to attempt a gpio based hardware
- 	 * reset (atheros reference design workaround) */
--
--	/* TODO: implement the GPIO reset workaround */
-+	gpio_request_one(AR2315_RESET_GPIO, GPIOF_OUT_INIT_LOW, "Reset");
-+	mdelay(100);
- 
- 	/* Some boards (e.g. Senao EOC-2610) don't implement the reset logic
- 	 * workaround. Attempt to jump to the mips reset location -
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -105,6 +105,13 @@ config GPIO_AMDPT
- 	  driver for GPIO functionality on Promontory IOHub
- 	  Require ACPI ASL code to enumerate as a platform device.
- 
-+config GPIO_AR2315
-+	bool "AR2315 SoC GPIO support"
-+	default y if SOC_AR2315
-+	depends on SOC_AR2315
-+	help
-+	  Say yes here to enable GPIO support for Atheros AR2315+ SoCs.
-+
- config GPIO_AR5312
- 	bool "AR5312 SoC GPIO support"
- 	default y if SOC_AR5312
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-alte
- obj-$(CONFIG_GPIO_ALTERA_A10SR)	+= gpio-altera-a10sr.o
- obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
- obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
-+obj-$(CONFIG_GPIO_AR2315)	+= gpio-ar2315.o
- obj-$(CONFIG_GPIO_AR5312)	+= gpio-ar5312.o
- obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
- obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
---- /dev/null
-+++ b/drivers/gpio/gpio-ar2315.c
-@@ -0,0 +1,233 @@
-+/*
-+ * This file is subject to the terms and conditions of the GNU General Public
-+ * License.  See the file "COPYING" in the main directory of this archive
-+ * for more details.
-+ *
-+ * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006 Felix Fietkau <nbd at nbd.name>
-+ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/gpio.h>
-+#include <linux/irq.h>
-+
-+#define DRIVER_NAME	"ar2315-gpio"
-+
-+#define AR2315_GPIO_DI			0x0000
-+#define AR2315_GPIO_DO			0x0008
-+#define AR2315_GPIO_DIR			0x0010
-+#define AR2315_GPIO_INT			0x0018
-+
-+#define AR2315_GPIO_DIR_M(x)		(1 << (x))	/* mask for i/o */
-+#define AR2315_GPIO_DIR_O(x)		(1 << (x))	/* output */
-+#define AR2315_GPIO_DIR_I(x)		(0)		/* input */
-+
-+#define AR2315_GPIO_INT_NUM_M		0x3F		/* mask for GPIO num */
-+#define AR2315_GPIO_INT_TRIG(x)		((x) << 6)	/* interrupt trigger */
-+#define AR2315_GPIO_INT_TRIG_M		(0x3 << 6)	/* mask for int trig */
-+
-+#define AR2315_GPIO_INT_TRIG_OFF	0	/* Triggerring off */
-+#define AR2315_GPIO_INT_TRIG_LOW	1	/* Low Level Triggered */
-+#define AR2315_GPIO_INT_TRIG_HIGH	2	/* High Level Triggered */
-+#define AR2315_GPIO_INT_TRIG_EDGE	3	/* Edge Triggered */
-+
-+#define AR2315_GPIO_NUM		22
-+
-+static u32 ar2315_gpio_intmask;
-+static u32 ar2315_gpio_intval;
-+static unsigned ar2315_gpio_irq_base;
-+static void __iomem *ar2315_mem;
-+
-+static inline u32 ar2315_gpio_reg_read(unsigned reg)
-+{
-+	return __raw_readl(ar2315_mem + reg);
-+}
-+
-+static inline void ar2315_gpio_reg_write(unsigned reg, u32 val)
-+{
-+	__raw_writel(val, ar2315_mem + reg);
-+}
-+
-+static inline void ar2315_gpio_reg_mask(unsigned reg, u32 mask, u32 val)
-+{
-+	ar2315_gpio_reg_write(reg, (ar2315_gpio_reg_read(reg) & ~mask) | val);
-+}
-+
-+static void ar2315_gpio_irq_handler(struct irq_desc *desc)
-+{
-+	u32 pend;
-+	int bit = -1;
-+
-+	/* only do one gpio interrupt at a time */
-+	pend = ar2315_gpio_reg_read(AR2315_GPIO_DI);
-+	pend ^= ar2315_gpio_intval;
-+	pend &= ar2315_gpio_intmask;
-+
-+	if (pend) {
-+		bit = fls(pend) - 1;
-+		pend &= ~(1 << bit);
-+		ar2315_gpio_intval ^= (1 << bit);
-+	}
-+
-+	/* Enable interrupt with edge detection */
-+	if ((ar2315_gpio_reg_read(AR2315_GPIO_DIR) & AR2315_GPIO_DIR_M(bit)) !=
-+	    AR2315_GPIO_DIR_I(bit))
-+		return;
-+
-+	if (bit >= 0)
-+		generic_handle_irq(ar2315_gpio_irq_base + bit);
-+}
-+
-+static void ar2315_gpio_int_setup(unsigned gpio, int trig)
-+{
-+	u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_INT);
-+
-+	reg &= ~(AR2315_GPIO_INT_NUM_M | AR2315_GPIO_INT_TRIG_M);
-+	reg |= gpio | AR2315_GPIO_INT_TRIG(trig);
-+	ar2315_gpio_reg_write(AR2315_GPIO_INT, reg);
-+}
-+
-+static void ar2315_gpio_irq_unmask(struct irq_data *d)
-+{
-+	unsigned gpio = d->irq - ar2315_gpio_irq_base;
-+	u32 dir = ar2315_gpio_reg_read(AR2315_GPIO_DIR);
-+
-+	/* Enable interrupt with edge detection */
-+	if ((dir & AR2315_GPIO_DIR_M(gpio)) != AR2315_GPIO_DIR_I(gpio))
-+		return;
-+
-+	ar2315_gpio_intmask |= (1 << gpio);
-+	ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_EDGE);
-+}
-+
-+static void ar2315_gpio_irq_mask(struct irq_data *d)
-+{
-+	unsigned gpio = d->irq - ar2315_gpio_irq_base;
-+
-+	/* Disable interrupt */
-+	ar2315_gpio_intmask &= ~(1 << gpio);
-+	ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_OFF);
-+}
-+
-+static struct irq_chip ar2315_gpio_irq_chip = {
-+	.name		= DRIVER_NAME,
-+	.irq_unmask	= ar2315_gpio_irq_unmask,
-+	.irq_mask	= ar2315_gpio_irq_mask,
-+};
-+
-+static void ar2315_gpio_irq_init(unsigned irq)
-+{
-+	unsigned i;
-+
-+	ar2315_gpio_intval = ar2315_gpio_reg_read(AR2315_GPIO_DI);
-+	for (i = 0; i < AR2315_GPIO_NUM; i++) {
-+		unsigned _irq = ar2315_gpio_irq_base + i;
-+
-+		irq_set_chip_and_handler(_irq, &ar2315_gpio_irq_chip,
-+					 handle_level_irq);
-+	}
-+	irq_set_chained_handler(irq, ar2315_gpio_irq_handler);
-+}
-+
-+static int ar2315_gpio_get_val(struct gpio_chip *chip, unsigned gpio)
-+{
-+	return (ar2315_gpio_reg_read(AR2315_GPIO_DI) >> gpio) & 1;
-+}
-+
-+static void ar2315_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val)
-+{
-+	u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_DO);
-+
-+	reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio);
-+	ar2315_gpio_reg_write(AR2315_GPIO_DO, reg);
-+}
-+
-+static int ar2315_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
-+{
-+	ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 1 << gpio, 0);
-+	return 0;
-+}
-+
-+static int ar2315_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val)
-+{
-+	ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 0, 1 << gpio);
-+	ar2315_gpio_set_val(chip, gpio, val);
-+	return 0;
-+}
-+
-+static int ar2315_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
-+{
-+	return ar2315_gpio_irq_base + gpio;
-+}
-+
-+static struct gpio_chip ar2315_gpio_chip = {
-+	.label			= DRIVER_NAME,
-+	.direction_input	= ar2315_gpio_dir_in,
-+	.direction_output	= ar2315_gpio_dir_out,
-+	.set			= ar2315_gpio_set_val,
-+	.get			= ar2315_gpio_get_val,
-+	.to_irq			= ar2315_gpio_to_irq,
-+	.base			= 0,
-+	.ngpio			= AR2315_GPIO_NUM,
-+};
-+
-+static int ar2315_gpio_probe(struct platform_device *pdev)
-+{
-+	struct device *dev = &pdev->dev;
-+	struct resource *res;
-+	unsigned irq;
-+	int ret;
-+
-+	if (ar2315_mem)
-+		return -EBUSY;
-+
-+	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
-+					   "ar2315-gpio-irq-base");
-+	if (!res) {
-+		dev_err(dev, "not found GPIO IRQ base\n");
-+		return -ENXIO;
-+	}
-+	ar2315_gpio_irq_base = res->start;
-+
-+	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, DRIVER_NAME);
-+	if (!res) {
-+		dev_err(dev, "not found IRQ number\n");
-+		return -ENXIO;
-+	}
-+	irq = res->start;
-+
-+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, DRIVER_NAME);
-+	ar2315_mem = devm_ioremap_resource(dev, res);
-+	if (IS_ERR(ar2315_mem))
-+		return PTR_ERR(ar2315_mem);
-+
-+	ar2315_gpio_chip.parent = dev;
-+	ret = gpiochip_add(&ar2315_gpio_chip);
-+	if (ret) {
-+		dev_err(dev, "failed to add gpiochip\n");
-+		return ret;
-+	}
-+
-+	ar2315_gpio_irq_init(irq);
-+
-+	return 0;
-+}
-+
-+static struct platform_driver ar2315_gpio_driver = {
-+	.probe = ar2315_gpio_probe,
-+	.driver = {
-+		.name = DRIVER_NAME,
-+		.owner = THIS_MODULE,
-+	}
-+};
-+
-+static int __init ar2315_gpio_init(void)
-+{
-+	return platform_driver_register(&ar2315_gpio_driver);
-+}
-+subsys_initcall(ar2315_gpio_init);
---- a/arch/mips/ath25/devices.h
-+++ b/arch/mips/ath25/devices.h
-@@ -4,6 +4,11 @@
- 
- #include <linux/cpu.h>
- 
-+#define AR231X_GPIO_IRQ_BASE		0x30
-+
-+/* GPIO number for AR2315/16 reset issue workaround */
-+#define AR2315_RESET_GPIO		5
-+
- #define ATH25_REG_MS(_val, _field)	(((_val) & _field##_M) >> _field##_S)
- 
- #define ATH25_IRQ_CPU_CLOCK	(MIPS_CPU_IRQ_BASE + 7)	/* C0_CAUSE: 0x8000 */
---- a/arch/mips/ath25/ar2315_regs.h
-+++ b/arch/mips/ath25/ar2315_regs.h
-@@ -315,6 +315,9 @@
- #define AR2315_MEM_CFG_BANKADDR_BITS_M	0x00000018
- #define AR2315_MEM_CFG_BANKADDR_BITS_S	3
- 
-+/* GPIO MMR base address */
-+#define AR2315_GPIO			0x0088
-+
- /*
-  * Local Bus Interface Registers
-  */
diff --git a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch b/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
deleted file mode 100644
index a2b1492250..0000000000
--- a/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch
+++ /dev/null
@@ -1,1734 +0,0 @@
---- a/drivers/net/ethernet/atheros/Makefile
-+++ b/drivers/net/ethernet/atheros/Makefile
-@@ -8,3 +8,4 @@ obj-$(CONFIG_ATL2) += atlx/
- obj-$(CONFIG_ATL1E) += atl1e/
- obj-$(CONFIG_ATL1C) += atl1c/
- obj-$(CONFIG_ALX) += alx/
-+obj-$(CONFIG_NET_AR231X) += ar231x/
---- a/drivers/net/ethernet/atheros/Kconfig
-+++ b/drivers/net/ethernet/atheros/Kconfig
-@@ -5,7 +5,7 @@
- config NET_VENDOR_ATHEROS
- 	bool "Atheros devices"
- 	default y
--	depends on PCI
-+	depends on (PCI || ATH25)
- 	---help---
- 	  If you have a network (Ethernet) card belonging to this class, say Y.
- 
-@@ -78,4 +78,10 @@ config ALX
- 	  To compile this driver as a module, choose M here.  The module
- 	  will be called alx.
- 
-+config NET_AR231X
-+	tristate "Atheros AR231X built-in Ethernet support"
-+	depends on ATH25
-+	help
-+	  Support for the AR231x/531x ethernet controller
-+
- endif # NET_VENDOR_ATHEROS
---- /dev/null
-+++ b/drivers/net/ethernet/atheros/ar231x/Makefile
-@@ -0,0 +1 @@
-+obj-$(CONFIG_NET_AR231X) += ar231x.o
---- /dev/null
-+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -0,0 +1,1119 @@
-+/*
-+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
-+ *
-+ * Copyright (C) 2004 by Sameer Dekate <sdekate at arubanetworks.com>
-+ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
-+ *
-+ * Thanks to Atheros for providing hardware and documentation
-+ * enabling me to write this driver.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Additional credits:
-+ * This code is taken from John Taylor's Sibyte driver and then
-+ * modified for the AR2313.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/ioport.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/interrupt.h>
-+#include <linux/skbuff.h>
-+#include <linux/init.h>
-+#include <linux/delay.h>
-+#include <linux/mm.h>
-+#include <linux/mii.h>
-+#include <linux/phy.h>
-+#include <linux/platform_device.h>
-+#include <linux/io.h>
-+
-+#define AR2313_MTU                     1692
-+#define AR2313_PRIOS                   1
-+#define AR2313_QUEUES                  (2*AR2313_PRIOS)
-+#define AR2313_DESCR_ENTRIES           64
-+
-+#ifndef min
-+#define min(a, b)	(((a) < (b)) ? (a) : (b))
-+#endif
-+
-+#ifndef SMP_CACHE_BYTES
-+#define SMP_CACHE_BYTES	L1_CACHE_BYTES
-+#endif
-+
-+#define AR2313_MBOX_SET_BIT  0x8
-+
-+#include "ar231x.h"
-+
-+/**
-+ * New interrupt handler strategy:
-+ *
-+ * An old interrupt handler worked using the traditional method of
-+ * replacing an skbuff with a new one when a packet arrives. However
-+ * the rx rings do not need to contain a static number of buffer
-+ * descriptors, thus it makes sense to move the memory allocation out
-+ * of the main interrupt handler and do it in a bottom half handler
-+ * and only allocate new buffers when the number of buffers in the
-+ * ring is below a certain threshold. In order to avoid starving the
-+ * NIC under heavy load it is however necessary to force allocation
-+ * when hitting a minimum threshold. The strategy for alloction is as
-+ * follows:
-+ *
-+ *     RX_LOW_BUF_THRES    - allocate buffers in the bottom half
-+ *     RX_PANIC_LOW_THRES  - we are very low on buffers, allocate
-+ *                           the buffers in the interrupt handler
-+ *     RX_RING_THRES       - maximum number of buffers in the rx ring
-+ *
-+ * One advantagous side effect of this allocation approach is that the
-+ * entire rx processing can be done without holding any spin lock
-+ * since the rx rings and registers are totally independent of the tx
-+ * ring and its registers.  This of course includes the kmalloc's of
-+ * new skb's. Thus start_xmit can run in parallel with rx processing
-+ * and the memory allocation on SMP systems.
-+ *
-+ * Note that running the skb reallocation in a bottom half opens up
-+ * another can of races which needs to be handled properly. In
-+ * particular it can happen that the interrupt handler tries to run
-+ * the reallocation while the bottom half is either running on another
-+ * CPU or was interrupted on the same CPU. To get around this the
-+ * driver uses bitops to prevent the reallocation routines from being
-+ * reentered.
-+ *
-+ * TX handling can also be done without holding any spin lock, wheee
-+ * this is fun! since tx_csm is only written to by the interrupt
-+ * handler.
-+ */
-+
-+/**
-+ * Threshold values for RX buffer allocation - the low water marks for
-+ * when to start refilling the rings are set to 75% of the ring
-+ * sizes. It seems to make sense to refill the rings entirely from the
-+ * intrrupt handler once it gets below the panic threshold, that way
-+ * we don't risk that the refilling is moved to another CPU when the
-+ * one running the interrupt handler just got the slab code hot in its
-+ * cache.
-+ */
-+#define RX_RING_SIZE		AR2313_DESCR_ENTRIES
-+#define RX_PANIC_THRES	        (RX_RING_SIZE/4)
-+#define RX_LOW_THRES	        ((3*RX_RING_SIZE)/4)
-+#define CRC_LEN                 4
-+#define RX_OFFSET               2
-+
-+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
-+#define VLAN_HDR                4
-+#else
-+#define VLAN_HDR                0
-+#endif
-+
-+#define AR2313_BUFSIZE		(AR2313_MTU + VLAN_HDR + ETH_HLEN + CRC_LEN + \
-+				 RX_OFFSET)
-+
-+#ifdef MODULE
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Sameer Dekate <sdekate at arubanetworks.com>, Imre Kaloz <kaloz at openwrt.org>, Felix Fietkau <nbd at nbd.name>");
-+MODULE_DESCRIPTION("AR231x Ethernet driver");
-+#endif
-+
-+#define virt_to_phys(x) ((u32)(x) & 0x1fffffff)
-+
-+/* prototypes */
-+static void ar231x_halt(struct net_device *dev);
-+static void rx_tasklet_func(unsigned long data);
-+static void rx_tasklet_cleanup(struct net_device *dev);
-+static void ar231x_multicast_list(struct net_device *dev);
-+static void ar231x_tx_timeout(struct net_device *dev);
-+
-+static int ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
-+static int ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
-+				u16 value);
-+static int ar231x_mdiobus_reset(struct mii_bus *bus);
-+static int ar231x_mdiobus_probe(struct net_device *dev);
-+static void ar231x_adjust_link(struct net_device *dev);
-+
-+#ifndef ERR
-+#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
-+#endif
-+
-+#ifdef CONFIG_NET_POLL_CONTROLLER
-+static void
-+ar231x_netpoll(struct net_device *dev)
-+{
-+	unsigned long flags;
-+
-+	local_irq_save(flags);
-+	ar231x_interrupt(dev->irq, dev);
-+	local_irq_restore(flags);
-+}
-+#endif
-+
-+static const struct net_device_ops ar231x_ops = {
-+	.ndo_open		= ar231x_open,
-+	.ndo_stop		= ar231x_close,
-+	.ndo_start_xmit		= ar231x_start_xmit,
-+	.ndo_set_rx_mode	= ar231x_multicast_list,
-+	.ndo_do_ioctl		= ar231x_ioctl,
-+	.ndo_change_mtu		= eth_change_mtu,
-+	.ndo_validate_addr	= eth_validate_addr,
-+	.ndo_set_mac_address	= eth_mac_addr,
-+	.ndo_tx_timeout		= ar231x_tx_timeout,
-+#ifdef CONFIG_NET_POLL_CONTROLLER
-+	.ndo_poll_controller	= ar231x_netpoll,
-+#endif
-+};
-+
-+static int ar231x_probe(struct platform_device *pdev)
-+{
-+	struct net_device *dev;
-+	struct ar231x_private *sp;
-+	struct resource *res;
-+	unsigned long ar_eth_base;
-+	char buf[64];
-+
-+	dev = alloc_etherdev(sizeof(struct ar231x_private));
-+
-+	if (dev == NULL) {
-+		printk(KERN_ERR
-+			   "ar231x: Unable to allocate net_device structure!\n");
-+		return -ENOMEM;
-+	}
-+
-+	platform_set_drvdata(pdev, dev);
-+
-+	SET_NETDEV_DEV(dev, &pdev->dev);
-+
-+	sp = netdev_priv(dev);
-+	sp->dev = dev;
-+	sp->cfg = pdev->dev.platform_data;
-+
-+	sprintf(buf, "eth%d_membase", pdev->id);
-+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf);
-+	if (!res)
-+		return -ENODEV;
-+
-+	sp->link = 0;
-+	ar_eth_base = res->start;
-+
-+	sprintf(buf, "eth%d_irq", pdev->id);
-+	dev->irq = platform_get_irq_byname(pdev, buf);
-+
-+	spin_lock_init(&sp->lock);
-+
-+	dev->features |= NETIF_F_HIGHDMA;
-+	dev->netdev_ops = &ar231x_ops;
-+
-+	tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long)dev);
-+	tasklet_disable(&sp->rx_tasklet);
-+
-+	sp->eth_regs = ioremap_nocache(ar_eth_base, sizeof(*sp->eth_regs));
-+	if (!sp->eth_regs) {
-+		printk("Can't remap eth registers\n");
-+		return -ENXIO;
-+	}
-+
-+	/**
-+	 * When there's only one MAC, PHY regs are typically on ENET0,
-+	 * even though the MAC might be on ENET1.
-+	 * So remap PHY regs separately.
-+	 */
-+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii");
-+	if (!res) {
-+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-+						   "eth1_mii");
-+		if (!res)
-+			return -ENODEV;
-+	}
-+	sp->phy_regs = ioremap_nocache(res->start, resource_size(res));
-+	if (!sp->phy_regs) {
-+		printk("Can't remap phy registers\n");
-+		return -ENXIO;
-+	}
-+
-+	sp->dma_regs = ioremap_nocache(ar_eth_base + 0x1000,
-+				       sizeof(*sp->dma_regs));
-+	if (!sp->dma_regs) {
-+		printk("Can't remap DMA registers\n");
-+		return -ENXIO;
-+	}
-+	dev->base_addr = ar_eth_base + 0x1000;
-+
-+	strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
-+	sp->name[sizeof(sp->name) - 1] = '\0';
-+	memcpy(dev->dev_addr, sp->cfg->macaddr, 6);
-+
-+	if (ar231x_init(dev)) {
-+		/* ar231x_init() calls ar231x_init_cleanup() on error */
-+		kfree(dev);
-+		return -ENODEV;
-+	}
-+
-+	if (register_netdev(dev)) {
-+		printk("%s: register_netdev failed\n", __func__);
-+		return -1;
-+	}
-+
-+	printk("%s: %s: %pM, irq %d\n", dev->name, sp->name, dev->dev_addr,
-+	       dev->irq);
-+
-+	sp->mii_bus = mdiobus_alloc();
-+	if (sp->mii_bus == NULL)
-+		return -1;
-+
-+	sp->mii_bus->priv = dev;
-+	sp->mii_bus->read = ar231x_mdiobus_read;
-+	sp->mii_bus->write = ar231x_mdiobus_write;
-+	sp->mii_bus->reset = ar231x_mdiobus_reset;
-+	sp->mii_bus->name = "ar231x_eth_mii";
-+	snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
-+
-+	mdiobus_register(sp->mii_bus);
-+
-+	if (ar231x_mdiobus_probe(dev) != 0) {
-+		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
-+		rx_tasklet_cleanup(dev);
-+		ar231x_init_cleanup(dev);
-+		unregister_netdev(dev);
-+		kfree(dev);
-+		return -ENODEV;
-+	}
-+
-+	return 0;
-+}
-+
-+static void ar231x_multicast_list(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int filter;
-+
-+	filter = sp->eth_regs->mac_control;
-+
-+	if (dev->flags & IFF_PROMISC)
-+		filter |= MAC_CONTROL_PR;
-+	else
-+		filter &= ~MAC_CONTROL_PR;
-+	if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 0))
-+		filter |= MAC_CONTROL_PM;
-+	else
-+		filter &= ~MAC_CONTROL_PM;
-+
-+	sp->eth_regs->mac_control = filter;
-+}
-+
-+static void rx_tasklet_cleanup(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	/**
-+	 * Tasklet may be scheduled. Need to get it removed from the list
-+	 * since we're about to free the struct.
-+	 */
-+
-+	sp->unloading = 1;
-+	tasklet_enable(&sp->rx_tasklet);
-+	tasklet_kill(&sp->rx_tasklet);
-+}
-+
-+static int ar231x_remove(struct platform_device *pdev)
-+{
-+	struct net_device *dev = platform_get_drvdata(pdev);
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	rx_tasklet_cleanup(dev);
-+	ar231x_init_cleanup(dev);
-+	unregister_netdev(dev);
-+	mdiobus_unregister(sp->mii_bus);
-+	mdiobus_free(sp->mii_bus);
-+	kfree(dev);
-+	return 0;
-+}
-+
-+/**
-+ * Restart the AR2313 ethernet controller.
-+ */
-+static int ar231x_restart(struct net_device *dev)
-+{
-+	/* disable interrupts */
-+	disable_irq(dev->irq);
-+
-+	/* stop mac */
-+	ar231x_halt(dev);
-+
-+	/* initialize */
-+	ar231x_init(dev);
-+
-+	/* enable interrupts */
-+	enable_irq(dev->irq);
-+
-+	return 0;
-+}
-+
-+static struct platform_driver ar231x_driver = {
-+	.driver.name = "ar231x-eth",
-+	.probe = ar231x_probe,
-+	.remove = ar231x_remove,
-+};
-+
-+module_platform_driver(ar231x_driver);
-+
-+static void ar231x_free_descriptors(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	if (sp->rx_ring != NULL) {
-+		kfree((void *)KSEG0ADDR(sp->rx_ring));
-+		sp->rx_ring = NULL;
-+		sp->tx_ring = NULL;
-+	}
-+}
-+
-+static int ar231x_allocate_descriptors(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int size;
-+	int j;
-+	ar231x_descr_t *space;
-+
-+	if (sp->rx_ring != NULL) {
-+		printk("%s: already done.\n", __func__);
-+		return 0;
-+	}
-+
-+	size = sizeof(ar231x_descr_t) * (AR2313_DESCR_ENTRIES * AR2313_QUEUES);
-+	space = kmalloc(size, GFP_KERNEL);
-+	if (space == NULL)
-+		return 1;
-+
-+	/* invalidate caches */
-+	dma_cache_inv((unsigned int)space, size);
-+
-+	/* now convert pointer to KSEG1 */
-+	space = (ar231x_descr_t *)KSEG1ADDR(space);
-+
-+	memset((void *)space, 0, size);
-+
-+	sp->rx_ring = space;
-+	space += AR2313_DESCR_ENTRIES;
-+
-+	sp->tx_ring = space;
-+	space += AR2313_DESCR_ENTRIES;
-+
-+	/* Initialize the transmit Descriptors */
-+	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+		ar231x_descr_t *td = &sp->tx_ring[j];
-+
-+		td->status = 0;
-+		td->devcs = DMA_TX1_CHAINED;
-+		td->addr = 0;
-+		td->descr = virt_to_phys(&sp->tx_ring[DSC_NEXT(j)]);
-+	}
-+
-+	return 0;
-+}
-+
-+/**
-+ * Generic cleanup handling data allocated during init. Used when the
-+ * module is unloaded or if an error occurs during initialization
-+ */
-+static void ar231x_init_cleanup(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	struct sk_buff *skb;
-+	int j;
-+
-+	ar231x_free_descriptors(dev);
-+
-+	if (sp->eth_regs)
-+		iounmap((void *)sp->eth_regs);
-+	if (sp->dma_regs)
-+		iounmap((void *)sp->dma_regs);
-+	if (sp->phy_regs)
-+		iounmap((void *)sp->phy_regs);
-+
-+	if (sp->rx_skb) {
-+		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+			skb = sp->rx_skb[j];
-+			if (skb) {
-+				sp->rx_skb[j] = NULL;
-+				dev_kfree_skb(skb);
-+			}
-+		}
-+		kfree(sp->rx_skb);
-+		sp->rx_skb = NULL;
-+	}
-+
-+	if (sp->tx_skb) {
-+		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+			skb = sp->tx_skb[j];
-+			if (skb) {
-+				sp->tx_skb[j] = NULL;
-+				dev_kfree_skb(skb);
-+			}
-+		}
-+		kfree(sp->tx_skb);
-+		sp->tx_skb = NULL;
-+	}
-+}
-+
-+static int ar231x_reset_reg(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int ethsal, ethsah;
-+	unsigned int flags;
-+
-+	sp->cfg->reset_set(sp->cfg->reset_mac);
-+	mdelay(10);
-+	sp->cfg->reset_clear(sp->cfg->reset_mac);
-+	mdelay(10);
-+	sp->cfg->reset_set(sp->cfg->reset_phy);
-+	mdelay(10);
-+	sp->cfg->reset_clear(sp->cfg->reset_phy);
-+	mdelay(10);
-+
-+	sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
-+	mdelay(10);
-+	sp->dma_regs->bus_mode =
-+		((32 << DMA_BUS_MODE_PBL_SHIFT) | DMA_BUS_MODE_BLE);
-+
-+	/* enable interrupts */
-+	sp->dma_regs->intr_ena = DMA_STATUS_AIS | DMA_STATUS_NIS |
-+				 DMA_STATUS_RI | DMA_STATUS_TI |
-+				 DMA_STATUS_FBE;
-+	sp->dma_regs->xmt_base = virt_to_phys(sp->tx_ring);
-+	sp->dma_regs->rcv_base = virt_to_phys(sp->rx_ring);
-+	sp->dma_regs->control =
-+		(DMA_CONTROL_SR | DMA_CONTROL_ST | DMA_CONTROL_SF);
-+
-+	sp->eth_regs->flow_control = (FLOW_CONTROL_FCE);
-+	sp->eth_regs->vlan_tag = (0x8100);
-+
-+	/* Enable Ethernet Interface */
-+	flags = (MAC_CONTROL_TE |	/* transmit enable */
-+			 MAC_CONTROL_PM |	/* pass mcast */
-+			 MAC_CONTROL_F |	/* full duplex */
-+			 MAC_CONTROL_HBD);	/* heart beat disabled */
-+
-+	if (dev->flags & IFF_PROMISC) {	/* set promiscuous mode */
-+		flags |= MAC_CONTROL_PR;
-+	}
-+	sp->eth_regs->mac_control = flags;
-+
-+	/* Set all Ethernet station address registers to their initial values */
-+	ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
-+		 (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF);
-+
-+	ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
-+		 (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
-+		 (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
-+		 (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF);
-+
-+	sp->eth_regs->mac_addr[0] = ethsah;
-+	sp->eth_regs->mac_addr[1] = ethsal;
-+
-+	mdelay(10);
-+
-+	return 0;
-+}
-+
-+static int ar231x_init(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int ecode = 0;
-+
-+	/* Allocate descriptors */
-+	if (ar231x_allocate_descriptors(dev)) {
-+		printk("%s: %s: ar231x_allocate_descriptors failed\n",
-+		       dev->name, __func__);
-+		ecode = -EAGAIN;
-+		goto init_error;
-+	}
-+
-+	/* Get the memory for the skb rings */
-+	if (sp->rx_skb == NULL) {
-+		sp->rx_skb =
-+			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
-+				GFP_KERNEL);
-+		if (!(sp->rx_skb)) {
-+			printk("%s: %s: rx_skb kmalloc failed\n",
-+			       dev->name, __func__);
-+			ecode = -EAGAIN;
-+			goto init_error;
-+		}
-+	}
-+	memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
-+
-+	if (sp->tx_skb == NULL) {
-+		sp->tx_skb =
-+			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
-+				GFP_KERNEL);
-+		if (!(sp->tx_skb)) {
-+			printk("%s: %s: tx_skb kmalloc failed\n",
-+			       dev->name, __func__);
-+			ecode = -EAGAIN;
-+			goto init_error;
-+		}
-+	}
-+	memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
-+
-+	/**
-+	 * Set tx_csm before we start receiving interrupts, otherwise
-+	 * the interrupt handler might think it is supposed to process
-+	 * tx ints before we are up and running, which may cause a null
-+	 * pointer access in the int handler.
-+	 */
-+	sp->rx_skbprd = 0;
-+	sp->cur_rx = 0;
-+	sp->tx_prd = 0;
-+	sp->tx_csm = 0;
-+
-+	/* Zero the stats before starting the interface */
-+	memset(&dev->stats, 0, sizeof(dev->stats));
-+
-+	/**
-+	 * We load the ring here as there seem to be no way to tell the
-+	 * firmware to wipe the ring without re-initializing it.
-+	 */
-+	ar231x_load_rx_ring(dev, RX_RING_SIZE);
-+
-+	/* Init hardware */
-+	ar231x_reset_reg(dev);
-+
-+	/* Get the IRQ */
-+	ecode = request_irq(dev->irq, &ar231x_interrupt, 0,
-+			    dev->name, dev);
-+	if (ecode) {
-+		printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n",
-+		       dev->name, __func__, dev->irq);
-+		goto init_error;
-+	}
-+
-+	tasklet_enable(&sp->rx_tasklet);
-+
-+	return 0;
-+
-+init_error:
-+	ar231x_init_cleanup(dev);
-+	return ecode;
-+}
-+
-+/**
-+ * Load the rx ring.
-+ *
-+ * Loading rings is safe without holding the spin lock since this is
-+ * done only before the device is enabled, thus no interrupts are
-+ * generated and by the interrupt handler/tasklet handler.
-+ */
-+static void ar231x_load_rx_ring(struct net_device *dev, int nr_bufs)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	short i, idx;
-+
-+	idx = sp->rx_skbprd;
-+
-+	for (i = 0; i < nr_bufs; i++) {
-+		struct sk_buff *skb;
-+		ar231x_descr_t *rd;
-+
-+		if (sp->rx_skb[idx])
-+			break;
-+
-+		skb = netdev_alloc_skb_ip_align(dev, AR2313_BUFSIZE);
-+		if (!skb) {
-+			printk("\n\n\n\n %s: No memory in system\n\n\n\n",
-+			       __func__);
-+			break;
-+		}
-+
-+		/* Make sure IP header starts on a fresh cache line */
-+		skb->dev = dev;
-+		sp->rx_skb[idx] = skb;
-+
-+		rd = (ar231x_descr_t *)&sp->rx_ring[idx];
-+
-+		/* initialize dma descriptor */
-+		rd->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
-+					 DMA_RX1_CHAINED);
-+		rd->addr = virt_to_phys(skb->data);
-+		rd->descr = virt_to_phys(&sp->rx_ring[DSC_NEXT(idx)]);
-+		rd->status = DMA_RX_OWN;
-+
-+		idx = DSC_NEXT(idx);
-+	}
-+
-+	if (i)
-+		sp->rx_skbprd = idx;
-+}
-+
-+#define AR2313_MAX_PKTS_PER_CALL        64
-+
-+static int ar231x_rx_int(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	struct sk_buff *skb, *skb_new;
-+	ar231x_descr_t *rxdesc;
-+	unsigned int status;
-+	u32 idx;
-+	int pkts = 0;
-+	int rval;
-+
-+	idx = sp->cur_rx;
-+
-+	/* process at most the entire ring and then wait for another int */
-+	while (1) {
-+		rxdesc = &sp->rx_ring[idx];
-+		status = rxdesc->status;
-+
-+		if (status & DMA_RX_OWN) {
-+			/* SiByte owns descriptor or descr not yet filled in */
-+			rval = 0;
-+			break;
-+		}
-+
-+		if (++pkts > AR2313_MAX_PKTS_PER_CALL) {
-+			rval = 1;
-+			break;
-+		}
-+
-+		if ((status & DMA_RX_ERROR) && !(status & DMA_RX_LONG)) {
-+			dev->stats.rx_errors++;
-+			dev->stats.rx_dropped++;
-+
-+			/* add statistics counters */
-+			if (status & DMA_RX_ERR_CRC)
-+				dev->stats.rx_crc_errors++;
-+			if (status & DMA_RX_ERR_COL)
-+				dev->stats.rx_over_errors++;
-+			if (status & DMA_RX_ERR_LENGTH)
-+				dev->stats.rx_length_errors++;
-+			if (status & DMA_RX_ERR_RUNT)
-+				dev->stats.rx_over_errors++;
-+			if (status & DMA_RX_ERR_DESC)
-+				dev->stats.rx_over_errors++;
-+
-+		} else {
-+			/* alloc new buffer. */
-+			skb_new = netdev_alloc_skb_ip_align(dev,
-+							    AR2313_BUFSIZE);
-+			if (skb_new != NULL) {
-+				skb = sp->rx_skb[idx];
-+				/* set skb */
-+				skb_put(skb, ((status >> DMA_RX_LEN_SHIFT) &
-+					0x3fff) - CRC_LEN);
-+
-+				dev->stats.rx_bytes += skb->len;
-+				skb->protocol = eth_type_trans(skb, dev);
-+				/* pass the packet to upper layers */
-+				netif_rx(skb);
-+
-+				skb_new->dev = dev;
-+				/* reset descriptor's curr_addr */
-+				rxdesc->addr = virt_to_phys(skb_new->data);
-+
-+				dev->stats.rx_packets++;
-+				sp->rx_skb[idx] = skb_new;
-+			} else {
-+				dev->stats.rx_dropped++;
-+			}
-+		}
-+
-+		rxdesc->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
-+						 DMA_RX1_CHAINED);
-+		rxdesc->status = DMA_RX_OWN;
-+
-+		idx = DSC_NEXT(idx);
-+	}
-+
-+	sp->cur_rx = idx;
-+
-+	return rval;
-+}
-+
-+static void ar231x_tx_int(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	u32 idx;
-+	struct sk_buff *skb;
-+	ar231x_descr_t *txdesc;
-+	unsigned int status = 0;
-+
-+	idx = sp->tx_csm;
-+
-+	while (idx != sp->tx_prd) {
-+		txdesc = &sp->tx_ring[idx];
-+		status = txdesc->status;
-+
-+		if (status & DMA_TX_OWN) {
-+			/* ar231x dma still owns descr */
-+			break;
-+		}
-+		/* done with this descriptor */
-+		dma_unmap_single(NULL, txdesc->addr,
-+				 txdesc->devcs & DMA_TX1_BSIZE_MASK,
-+				 DMA_TO_DEVICE);
-+		txdesc->status = 0;
-+
-+		if (status & DMA_TX_ERROR) {
-+			dev->stats.tx_errors++;
-+			dev->stats.tx_dropped++;
-+			if (status & DMA_TX_ERR_UNDER)
-+				dev->stats.tx_fifo_errors++;
-+			if (status & DMA_TX_ERR_HB)
-+				dev->stats.tx_heartbeat_errors++;
-+			if (status & (DMA_TX_ERR_LOSS | DMA_TX_ERR_LINK))
-+				dev->stats.tx_carrier_errors++;
-+			if (status & (DMA_TX_ERR_LATE | DMA_TX_ERR_COL |
-+			    DMA_TX_ERR_JABBER | DMA_TX_ERR_DEFER))
-+				dev->stats.tx_aborted_errors++;
-+		} else {
-+			/* transmit OK */
-+			dev->stats.tx_packets++;
-+		}
-+
-+		skb = sp->tx_skb[idx];
-+		sp->tx_skb[idx] = NULL;
-+		idx = DSC_NEXT(idx);
-+		dev->stats.tx_bytes += skb->len;
-+		dev_kfree_skb_irq(skb);
-+	}
-+
-+	sp->tx_csm = idx;
-+}
-+
-+static void rx_tasklet_func(unsigned long data)
-+{
-+	struct net_device *dev = (struct net_device *)data;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	if (sp->unloading)
-+		return;
-+
-+	if (ar231x_rx_int(dev)) {
-+		tasklet_hi_schedule(&sp->rx_tasklet);
-+	} else {
-+		unsigned long flags;
-+
-+		spin_lock_irqsave(&sp->lock, flags);
-+		sp->dma_regs->intr_ena |= DMA_STATUS_RI;
-+		spin_unlock_irqrestore(&sp->lock, flags);
-+	}
-+}
-+
-+static void rx_schedule(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	sp->dma_regs->intr_ena &= ~DMA_STATUS_RI;
-+
-+	tasklet_hi_schedule(&sp->rx_tasklet);
-+}
-+
-+static irqreturn_t ar231x_interrupt(int irq, void *dev_id)
-+{
-+	struct net_device *dev = (struct net_device *)dev_id;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int status, enabled;
-+
-+	/* clear interrupt */
-+	/* Don't clear RI bit if currently disabled */
-+	status = sp->dma_regs->status;
-+	enabled = sp->dma_regs->intr_ena;
-+	sp->dma_regs->status = status & enabled;
-+
-+	if (status & DMA_STATUS_NIS) {
-+		/* normal status */
-+		/**
-+		 * Don't schedule rx processing if interrupt
-+		 * is already disabled.
-+		 */
-+		if (status & enabled & DMA_STATUS_RI) {
-+			/* receive interrupt */
-+			rx_schedule(dev);
-+		}
-+		if (status & DMA_STATUS_TI) {
-+			/* transmit interrupt */
-+			ar231x_tx_int(dev);
-+		}
-+	}
-+
-+	/* abnormal status */
-+	if (status & (DMA_STATUS_FBE | DMA_STATUS_TPS))
-+		ar231x_restart(dev);
-+
-+	return IRQ_HANDLED;
-+}
-+
-+static int ar231x_open(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int ethsal, ethsah;
-+
-+	/* reset the hardware, in case the MAC address changed */
-+	ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
-+		 (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF);
-+
-+	ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
-+		 (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
-+		 (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
-+		 (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF);
-+
-+	sp->eth_regs->mac_addr[0] = ethsah;
-+	sp->eth_regs->mac_addr[1] = ethsal;
-+
-+	mdelay(10);
-+
-+	dev->mtu = 1500;
-+	netif_start_queue(dev);
-+
-+	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
-+
-+	phy_start(sp->phy_dev);
-+
-+	return 0;
-+}
-+
-+static void ar231x_tx_timeout(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned long flags;
-+
-+	spin_lock_irqsave(&sp->lock, flags);
-+	ar231x_restart(dev);
-+	spin_unlock_irqrestore(&sp->lock, flags);
-+}
-+
-+static void ar231x_halt(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int j;
-+
-+	tasklet_disable(&sp->rx_tasklet);
-+
-+	/* kill the MAC */
-+	sp->eth_regs->mac_control &= ~(MAC_CONTROL_RE |	/* disable Receives */
-+				       MAC_CONTROL_TE);	/* disable Transmits */
-+	/* stop dma */
-+	sp->dma_regs->control = 0;
-+	sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR;
-+
-+	/* place phy and MAC in reset */
-+	sp->cfg->reset_set(sp->cfg->reset_mac);
-+	sp->cfg->reset_set(sp->cfg->reset_phy);
-+
-+	/* free buffers on tx ring */
-+	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+		struct sk_buff *skb;
-+		ar231x_descr_t *txdesc;
-+
-+		txdesc = &sp->tx_ring[j];
-+		txdesc->descr = 0;
-+
-+		skb = sp->tx_skb[j];
-+		if (skb) {
-+			dev_kfree_skb(skb);
-+			sp->tx_skb[j] = NULL;
-+		}
-+	}
-+}
-+
-+/**
-+ * close should do nothing. Here's why. It's called when
-+ * 'ifconfig bond0 down' is run. If it calls free_irq then
-+ * the irq is gone forever ! When bond0 is made 'up' again,
-+ * the ar231x_open () does not call request_irq (). Worse,
-+ * the call to ar231x_halt() generates a WDOG reset due to
-+ * the write to reset register and the box reboots.
-+ * Commenting this out is good since it allows the
-+ * system to resume when bond0 is made up again.
-+ */
-+static int ar231x_close(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+#if 0
-+	/* Disable interrupts */
-+	disable_irq(dev->irq);
-+
-+	/**
-+	 * Without (or before) releasing irq and stopping hardware, this
-+	 * is an absolute non-sense, by the way. It will be reset instantly
-+	 * by the first irq.
-+	 */
-+	netif_stop_queue(dev);
-+
-+	/* stop the MAC and DMA engines */
-+	ar231x_halt(dev);
-+
-+	/* release the interrupt */
-+	free_irq(dev->irq, dev);
-+
-+#endif
-+
-+	phy_stop(sp->phy_dev);
-+
-+	return 0;
-+}
-+
-+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	ar231x_descr_t *td;
-+	u32 idx;
-+
-+	idx = sp->tx_prd;
-+	td = &sp->tx_ring[idx];
-+
-+	if (td->status & DMA_TX_OWN) {
-+		/* free skbuf and lie to the caller that we sent it out */
-+		dev->stats.tx_dropped++;
-+		dev_kfree_skb(skb);
-+
-+		/* restart transmitter in case locked */
-+		sp->dma_regs->xmt_poll = 0;
-+		return 0;
-+	}
-+
-+	/* Setup the transmit descriptor. */
-+	td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
-+				 (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED));
-+	td->addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
-+	td->status = DMA_TX_OWN;
-+
-+	/* kick transmitter last */
-+	sp->dma_regs->xmt_poll = 0;
-+
-+	sp->tx_skb[idx] = skb;
-+	idx = DSC_NEXT(idx);
-+	sp->tx_prd = idx;
-+
-+	return 0;
-+}
-+
-+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	switch (cmd) {
-+	case SIOCGMIIPHY:
-+	case SIOCGMIIREG:
-+	case SIOCSMIIREG:
-+		return phy_mii_ioctl(sp->phy_dev, ifr, cmd);
-+
-+	default:
-+		break;
-+	}
-+
-+	return -EOPNOTSUPP;
-+}
-+
-+static void ar231x_adjust_link(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	struct phy_device *phydev = sp->phy_dev;
-+	u32 mc;
-+
-+	if (!phydev->link) {
-+		if (sp->link) {
-+			pr_info("%s: link down\n", dev->name);
-+			sp->link = 0;
-+		}
-+		return;
-+	}
-+	sp->link = 1;
-+
-+	pr_info("%s: link up (%uMbps/%s duplex)\n", dev->name,
-+		phydev->speed, phydev->duplex ? "full" : "half");
-+
-+	mc = sp->eth_regs->mac_control;
-+	if (phydev->duplex)
-+		mc = (mc | MAC_CONTROL_F) & ~MAC_CONTROL_DRO;
-+	else
-+		mc = (mc | MAC_CONTROL_DRO) & ~MAC_CONTROL_F;
-+	sp->eth_regs->mac_control = mc;
-+	sp->duplex = phydev->duplex;
-+}
-+
-+#define MII_ADDR(phy, reg) \
-+	((reg << MII_ADDR_REG_SHIFT) | (phy << MII_ADDR_PHY_SHIFT))
-+
-+static int
-+ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
-+{
-+	struct net_device *const dev = bus->priv;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	volatile MII *ethernet = sp->phy_regs;
-+
-+	ethernet->mii_addr = MII_ADDR(phy_addr, regnum);
-+	while (ethernet->mii_addr & MII_ADDR_BUSY)
-+		;
-+	return ethernet->mii_data >> MII_DATA_SHIFT;
-+}
-+
-+static int
-+ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value)
-+{
-+	struct net_device *const dev = bus->priv;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	volatile MII *ethernet = sp->phy_regs;
-+
-+	while (ethernet->mii_addr & MII_ADDR_BUSY)
-+		;
-+	ethernet->mii_data = value << MII_DATA_SHIFT;
-+	ethernet->mii_addr = MII_ADDR(phy_addr, regnum) | MII_ADDR_WRITE;
-+
-+	return 0;
-+}
-+
-+static int ar231x_mdiobus_reset(struct mii_bus *bus)
-+{
-+	struct net_device *const dev = bus->priv;
-+
-+	ar231x_reset_reg(dev);
-+
-+	return 0;
-+}
-+
-+static int ar231x_mdiobus_probe(struct net_device *dev)
-+{
-+	struct ar231x_private *const sp = netdev_priv(dev);
-+	struct phy_device *phydev = NULL;
-+
-+	/* find the first (lowest address) PHY on the current MAC's MII bus */
-+	phydev = phy_find_first(sp->mii_bus);
-+	if (!phydev) {
-+		printk(KERN_ERR "ar231x: %s: no PHY found\n", dev->name);
-+		return -1;
-+	}
-+
-+	/* now we are supposed to have a proper phydev, to attach to... */
-+	BUG_ON(phydev->attached_dev);
-+
-+	phydev = phy_connect(dev, phydev_name(phydev), &ar231x_adjust_link,
-+			     PHY_INTERFACE_MODE_MII);
-+	if (IS_ERR(phydev)) {
-+		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
-+		return PTR_ERR(phydev);
-+	}
-+
-+	/* mask with MAC supported features */
-+	phydev->supported &= (SUPPORTED_10baseT_Half
-+		| SUPPORTED_10baseT_Full
-+		| SUPPORTED_100baseT_Half
-+		| SUPPORTED_100baseT_Full
-+		| SUPPORTED_Autoneg
-+		/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
-+		| SUPPORTED_MII
-+		| SUPPORTED_TP);
-+
-+	phydev->advertising = phydev->supported;
-+
-+	sp->phy_dev = phydev;
-+
-+	printk(KERN_INFO "%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
-+	       dev->name, phydev->drv->name, phydev_name(phydev));
-+
-+	return 0;
-+}
-+
---- /dev/null
-+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h
-@@ -0,0 +1,281 @@
-+/*
-+ * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
-+ *
-+ * Copyright (C) 2004 by Sameer Dekate <sdekate at arubanetworks.com>
-+ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
-+ *
-+ * Thanks to Atheros for providing hardware and documentation
-+ * enabling me to write this driver.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ */
-+
-+#ifndef _AR2313_H_
-+#define _AR2313_H_
-+
-+#include <linux/interrupt.h>
-+#include <generated/autoconf.h>
-+#include <linux/bitops.h>
-+#include <ath25_platform.h>
-+
-+/* probe link timer - 5 secs */
-+#define LINK_TIMER    (5*HZ)
-+
-+#define IS_DMA_TX_INT(X)   (((X) & (DMA_STATUS_TI)) != 0)
-+#define IS_DMA_RX_INT(X)   (((X) & (DMA_STATUS_RI)) != 0)
-+#define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN))    == 0)
-+
-+#define AR2313_TX_TIMEOUT (HZ/4)
-+
-+/* Rings */
-+#define DSC_RING_ENTRIES_SIZE	(AR2313_DESCR_ENTRIES * sizeof(struct desc))
-+#define DSC_NEXT(idx)	        ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
-+
-+#define AR2313_MBGET		2
-+#define AR2313_MBSET		3
-+#define AR2313_PCI_RECONFIG	4
-+#define AR2313_PCI_DUMP		5
-+#define AR2313_TEST_PANIC	6
-+#define AR2313_TEST_NULLPTR	7
-+#define AR2313_READ_DATA	8
-+#define AR2313_WRITE_DATA	9
-+#define AR2313_GET_VERSION	10
-+#define AR2313_TEST_HANG	11
-+#define AR2313_SYNC		12
-+
-+#define DMA_RX_ERR_CRC		BIT(1)
-+#define DMA_RX_ERR_DRIB		BIT(2)
-+#define DMA_RX_ERR_MII		BIT(3)
-+#define DMA_RX_EV2		BIT(5)
-+#define DMA_RX_ERR_COL		BIT(6)
-+#define DMA_RX_LONG		BIT(7)
-+#define DMA_RX_LS		BIT(8)	/* last descriptor */
-+#define DMA_RX_FS		BIT(9)	/* first descriptor */
-+#define DMA_RX_MF		BIT(10)	/* multicast frame */
-+#define DMA_RX_ERR_RUNT		BIT(11)	/* runt frame */
-+#define DMA_RX_ERR_LENGTH	BIT(12)	/* length error */
-+#define DMA_RX_ERR_DESC		BIT(14)	/* descriptor error */
-+#define DMA_RX_ERROR		BIT(15)	/* error summary */
-+#define DMA_RX_LEN_MASK		0x3fff0000
-+#define DMA_RX_LEN_SHIFT	16
-+#define DMA_RX_FILT		BIT(30)
-+#define DMA_RX_OWN		BIT(31)	/* desc owned by DMA controller */
-+
-+#define DMA_RX1_BSIZE_MASK	0x000007ff
-+#define DMA_RX1_BSIZE_SHIFT	0
-+#define DMA_RX1_CHAINED		BIT(24)
-+#define DMA_RX1_RER		BIT(25)
-+
-+#define DMA_TX_ERR_UNDER	BIT(1)	/* underflow error */
-+#define DMA_TX_ERR_DEFER	BIT(2)	/* excessive deferral */
-+#define DMA_TX_COL_MASK		0x78
-+#define DMA_TX_COL_SHIFT	3
-+#define DMA_TX_ERR_HB		BIT(7)	/* hearbeat failure */
-+#define DMA_TX_ERR_COL		BIT(8)	/* excessive collisions */
-+#define DMA_TX_ERR_LATE		BIT(9)	/* late collision */
-+#define DMA_TX_ERR_LINK		BIT(10)	/* no carrier */
-+#define DMA_TX_ERR_LOSS		BIT(11)	/* loss of carrier */
-+#define DMA_TX_ERR_JABBER	BIT(14)	/* transmit jabber timeout */
-+#define DMA_TX_ERROR		BIT(15)	/* frame aborted */
-+#define DMA_TX_OWN		BIT(31)	/* descr owned by DMA controller */
-+
-+#define DMA_TX1_BSIZE_MASK	0x000007ff
-+#define DMA_TX1_BSIZE_SHIFT	0
-+#define DMA_TX1_CHAINED		BIT(24)	/* chained descriptors */
-+#define DMA_TX1_TER		BIT(25)	/* transmit end of ring */
-+#define DMA_TX1_FS		BIT(29)	/* first segment */
-+#define DMA_TX1_LS		BIT(30)	/* last segment */
-+#define DMA_TX1_IC		BIT(31)	/* interrupt on completion */
-+
-+#define RCVPKT_LENGTH(X)	(X  >> 16)	/* Received pkt Length */
-+
-+#define MAC_CONTROL_RE		BIT(2)	/* receive enable */
-+#define MAC_CONTROL_TE		BIT(3)	/* transmit enable */
-+#define MAC_CONTROL_DC		BIT(5)	/* Deferral check */
-+#define MAC_CONTROL_ASTP	BIT(8)	/* Auto pad strip */
-+#define MAC_CONTROL_DRTY	BIT(10)	/* Disable retry */
-+#define MAC_CONTROL_DBF		BIT(11)	/* Disable bcast frames */
-+#define MAC_CONTROL_LCC		BIT(12)	/* late collision ctrl */
-+#define MAC_CONTROL_HP		BIT(13)	/* Hash Perfect filtering */
-+#define MAC_CONTROL_HASH	BIT(14)	/* Unicast hash filtering */
-+#define MAC_CONTROL_HO		BIT(15)	/* Hash only filtering */
-+#define MAC_CONTROL_PB		BIT(16)	/* Pass Bad frames */
-+#define MAC_CONTROL_IF		BIT(17)	/* Inverse filtering */
-+#define MAC_CONTROL_PR		BIT(18)	/* promis mode (valid frames only) */
-+#define MAC_CONTROL_PM		BIT(19)	/* pass multicast */
-+#define MAC_CONTROL_F		BIT(20)	/* full-duplex */
-+#define MAC_CONTROL_DRO		BIT(23)	/* Disable Receive Own */
-+#define MAC_CONTROL_HBD		BIT(28)	/* heart-beat disabled (MUST BE SET) */
-+#define MAC_CONTROL_BLE		BIT(30)	/* big endian mode */
-+#define MAC_CONTROL_RA		BIT(31)	/* rcv all (valid and invalid frames) */
-+
-+#define MII_ADDR_BUSY		BIT(0)
-+#define MII_ADDR_WRITE		BIT(1)
-+#define MII_ADDR_REG_SHIFT	6
-+#define MII_ADDR_PHY_SHIFT	11
-+#define MII_DATA_SHIFT		0
-+
-+#define FLOW_CONTROL_FCE	BIT(1)
-+
-+#define DMA_BUS_MODE_SWR	BIT(0)	/* software reset */
-+#define DMA_BUS_MODE_BLE	BIT(7)	/* big endian mode */
-+#define DMA_BUS_MODE_PBL_SHIFT	8	/* programmable burst length 32 */
-+#define DMA_BUS_MODE_DBO	BIT(20)	/* big-endian descriptors */
-+
-+#define DMA_STATUS_TI		BIT(0)	/* transmit interrupt */
-+#define DMA_STATUS_TPS		BIT(1)	/* transmit process stopped */
-+#define DMA_STATUS_TU		BIT(2)	/* transmit buffer unavailable */
-+#define DMA_STATUS_TJT		BIT(3)	/* transmit buffer timeout */
-+#define DMA_STATUS_UNF		BIT(5)	/* transmit underflow */
-+#define DMA_STATUS_RI		BIT(6)	/* receive interrupt */
-+#define DMA_STATUS_RU		BIT(7)	/* receive buffer unavailable */
-+#define DMA_STATUS_RPS		BIT(8)	/* receive process stopped */
-+#define DMA_STATUS_ETI		BIT(10)	/* early transmit interrupt */
-+#define DMA_STATUS_FBE		BIT(13)	/* fatal bus interrupt */
-+#define DMA_STATUS_ERI		BIT(14)	/* early receive interrupt */
-+#define DMA_STATUS_AIS		BIT(15)	/* abnormal interrupt summary */
-+#define DMA_STATUS_NIS		BIT(16)	/* normal interrupt summary */
-+#define DMA_STATUS_RS_SHIFT	17	/* receive process state */
-+#define DMA_STATUS_TS_SHIFT	20	/* transmit process state */
-+#define DMA_STATUS_EB_SHIFT	23	/* error bits */
-+
-+#define DMA_CONTROL_SR		BIT(1)	/* start receive */
-+#define DMA_CONTROL_ST		BIT(13)	/* start transmit */
-+#define DMA_CONTROL_SF		BIT(21)	/* store and forward */
-+
-+typedef struct {
-+	volatile unsigned int status;	/* OWN, Device control and status. */
-+	volatile unsigned int devcs;	/* pkt Control bits + Length */
-+	volatile unsigned int addr;	/* Current Address. */
-+	volatile unsigned int descr;	/* Next descriptor in chain. */
-+} ar231x_descr_t;
-+
-+/**
-+ * New Combo structure for Both Eth0 AND eth1
-+ *
-+ * Don't directly access MII related regs since phy chip could be actually
-+ * connected to another ethernet block.
-+ */
-+typedef struct {
-+	volatile unsigned int mac_control;	/* 0x00 */
-+	volatile unsigned int mac_addr[2];	/* 0x04 - 0x08 */
-+	volatile unsigned int mcast_table[2];	/* 0x0c - 0x10 */
-+	volatile unsigned int __mii_addr;	/* 0x14 */
-+	volatile unsigned int __mii_data;	/* 0x18 */
-+	volatile unsigned int flow_control;	/* 0x1c */
-+	volatile unsigned int vlan_tag;	/* 0x20 */
-+	volatile unsigned int pad[7];	/* 0x24 - 0x3c */
-+	volatile unsigned int ucast_table[8];	/* 0x40-0x5c */
-+} ETHERNET_STRUCT;
-+
-+typedef struct {
-+	volatile unsigned int mii_addr;
-+	volatile unsigned int mii_data;
-+} MII;
-+
-+/********************************************************************
-+ * Interrupt controller
-+ ********************************************************************/
-+
-+typedef struct {
-+	volatile unsigned int wdog_control;	/* 0x08 */
-+	volatile unsigned int wdog_timer;	/* 0x0c */
-+	volatile unsigned int misc_status;	/* 0x10 */
-+	volatile unsigned int misc_mask;	/* 0x14 */
-+	volatile unsigned int global_status;	/* 0x18 */
-+	volatile unsigned int reserved;	/* 0x1c */
-+	volatile unsigned int reset_control;	/* 0x20 */
-+} INTERRUPT;
-+
-+/********************************************************************
-+ * DMA controller
-+ ********************************************************************/
-+typedef struct {
-+	volatile unsigned int bus_mode;	/* 0x00 (CSR0) */
-+	volatile unsigned int xmt_poll;	/* 0x04 (CSR1) */
-+	volatile unsigned int rcv_poll;	/* 0x08 (CSR2) */
-+	volatile unsigned int rcv_base;	/* 0x0c (CSR3) */
-+	volatile unsigned int xmt_base;	/* 0x10 (CSR4) */
-+	volatile unsigned int status;	/* 0x14 (CSR5) */
-+	volatile unsigned int control;	/* 0x18 (CSR6) */
-+	volatile unsigned int intr_ena;	/* 0x1c (CSR7) */
-+	volatile unsigned int rcv_missed;	/* 0x20 (CSR8) */
-+	volatile unsigned int reserved[11];	/* 0x24-0x4c (CSR9-19) */
-+	volatile unsigned int cur_tx_buf_addr;	/* 0x50 (CSR20) */
-+	volatile unsigned int cur_rx_buf_addr;	/* 0x50 (CSR21) */
-+} DMA;
-+
-+/**
-+ * Struct private for the Sibyte.
-+ *
-+ * Elements are grouped so variables used by the tx handling goes
-+ * together, and will go into the same cache lines etc. in order to
-+ * avoid cache line contention between the rx and tx handling on SMP.
-+ *
-+ * Frequently accessed variables are put at the beginning of the
-+ * struct to help the compiler generate better/shorter code.
-+ */
-+struct ar231x_private {
-+	struct net_device *dev;
-+	int version;
-+	u32 mb[2];
-+
-+	volatile MII *phy_regs;
-+	volatile ETHERNET_STRUCT *eth_regs;
-+	volatile DMA *dma_regs;
-+	struct ar231x_eth *cfg;
-+
-+	spinlock_t lock;			/* Serialise access to device */
-+
-+	/* RX and TX descriptors, must be adjacent */
-+	ar231x_descr_t *rx_ring;
-+	ar231x_descr_t *tx_ring;
-+
-+	struct sk_buff **rx_skb;
-+	struct sk_buff **tx_skb;
-+
-+	/* RX elements */
-+	u32 rx_skbprd;
-+	u32 cur_rx;
-+
-+	/* TX elements */
-+	u32 tx_prd;
-+	u32 tx_csm;
-+
-+	/* Misc elements */
-+	char name[48];
-+	struct {
-+		u32 address;
-+		u32 length;
-+		char *mapping;
-+	} desc;
-+
-+	unsigned short link;		/* 0 - link down, 1 - link up */
-+	unsigned short duplex;		/* 0 - half, 1 - full */
-+
-+	struct tasklet_struct rx_tasklet;
-+	int unloading;
-+
-+	struct phy_device *phy_dev;
-+	struct mii_bus *mii_bus;
-+};
-+
-+/* Prototypes */
-+static int ar231x_init(struct net_device *dev);
-+#ifdef TX_TIMEOUT
-+static void ar231x_tx_timeout(struct net_device *dev);
-+#endif
-+static int ar231x_restart(struct net_device *dev);
-+static void ar231x_load_rx_ring(struct net_device *dev, int bufs);
-+static irqreturn_t ar231x_interrupt(int irq, void *dev_id);
-+static int ar231x_open(struct net_device *dev);
-+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev);
-+static int ar231x_close(struct net_device *dev);
-+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-+static void ar231x_init_cleanup(struct net_device *dev);
-+
-+#endif	/* _AR2313_H_ */
---- a/arch/mips/ath25/ar2315_regs.h
-+++ b/arch/mips/ath25/ar2315_regs.h
-@@ -57,6 +57,9 @@
- #define AR2315_PCI_EXT_BASE	0x80000000	/* PCI external */
- #define AR2315_PCI_EXT_SIZE	0x40000000
- 
-+/* MII registers offset inside Ethernet MMR region */
-+#define AR2315_ENET0_MII_BASE	(AR2315_ENET0_BASE + 0x14)
-+
- /*
-  * Configuration registers
-  */
---- a/arch/mips/ath25/ar5312_regs.h
-+++ b/arch/mips/ath25/ar5312_regs.h
-@@ -64,6 +64,10 @@
- #define AR5312_AR5312_REV7	0x0057		/* AR5312 WMAC (AP30-040) */
- #define AR5312_AR2313_REV8	0x0058		/* AR2313 WMAC (AP43-030) */
- 
-+/* MII registers offset inside Ethernet MMR region */
-+#define AR5312_ENET0_MII_BASE	(AR5312_ENET0_BASE + 0x14)
-+#define AR5312_ENET1_MII_BASE	(AR5312_ENET1_BASE + 0x14)
-+
- /* Reset/Timer Block Address Map */
- #define AR5312_TIMER		0x0000 /* countdown timer */
- #define AR5312_RELOAD		0x0004 /* timer reload value */
---- a/arch/mips/ath25/ar2315.c
-+++ b/arch/mips/ath25/ar2315.c
-@@ -136,6 +136,8 @@ static void ar2315_irq_dispatch(void)
- 
- 	if (pending & CAUSEF_IP3)
- 		do_IRQ(AR2315_IRQ_WLAN0);
-+	else if (pending & CAUSEF_IP4)
-+		do_IRQ(AR2315_IRQ_ENET0);
- #ifdef CONFIG_PCI_AR2315
- 	else if (pending & CAUSEF_IP5)
- 		do_IRQ(AR2315_IRQ_LCBUS_PCI);
-@@ -169,6 +171,29 @@ void __init ar2315_arch_init_irq(void)
- 	ar2315_misc_irq_domain = domain;
- }
- 
-+static void ar2315_device_reset_set(u32 mask)
-+{
-+	u32 val;
-+
-+	val = ar2315_rst_reg_read(AR2315_RESET);
-+	ar2315_rst_reg_write(AR2315_RESET, val | mask);
-+}
-+
-+static void ar2315_device_reset_clear(u32 mask)
-+{
-+	u32 val;
-+
-+	val = ar2315_rst_reg_read(AR2315_RESET);
-+	ar2315_rst_reg_write(AR2315_RESET, val & ~mask);
-+}
-+
-+static struct ar231x_eth ar2315_eth_data = {
-+	.reset_set = ar2315_device_reset_set,
-+	.reset_clear = ar2315_device_reset_clear,
-+	.reset_mac = AR2315_RESET_ENET0,
-+	.reset_phy = AR2315_RESET_EPHY0,
-+};
-+
- static struct resource ar2315_gpio_res[] = {
- 	{
- 		.name = "ar2315-gpio",
-@@ -205,6 +230,11 @@ void __init ar2315_init_devices(void)
- 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
- 	platform_device_register(&ar2315_gpio);
- 
-+	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
-+	ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii",
-+			   AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0,
-+			   &ar2315_eth_data);
-+
- 	ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0);
- }
- 
---- a/arch/mips/ath25/ar5312.c
-+++ b/arch/mips/ath25/ar5312.c
-@@ -132,6 +132,10 @@ static void ar5312_irq_dispatch(void)
- 
- 	if (pending & CAUSEF_IP2)
- 		do_IRQ(AR5312_IRQ_WLAN0);
-+	else if (pending & CAUSEF_IP3)
-+		do_IRQ(AR5312_IRQ_ENET0);
-+	else if (pending & CAUSEF_IP4)
-+		do_IRQ(AR5312_IRQ_ENET1);
- 	else if (pending & CAUSEF_IP5)
- 		do_IRQ(AR5312_IRQ_WLAN1);
- 	else if (pending & CAUSEF_IP6)
-@@ -163,6 +167,36 @@ void __init ar5312_arch_init_irq(void)
- 	ar5312_misc_irq_domain = domain;
- }
- 
-+static void ar5312_device_reset_set(u32 mask)
-+{
-+	u32 val;
-+
-+	val = ar5312_rst_reg_read(AR5312_RESET);
-+	ar5312_rst_reg_write(AR5312_RESET, val | mask);
-+}
-+
-+static void ar5312_device_reset_clear(u32 mask)
-+{
-+	u32 val;
-+
-+	val = ar5312_rst_reg_read(AR5312_RESET);
-+	ar5312_rst_reg_write(AR5312_RESET, val & ~mask);
-+}
-+
-+static struct ar231x_eth ar5312_eth0_data = {
-+	.reset_set = ar5312_device_reset_set,
-+	.reset_clear = ar5312_device_reset_clear,
-+	.reset_mac = AR5312_RESET_ENET0,
-+	.reset_phy = AR5312_RESET_EPHY0,
-+};
-+
-+static struct ar231x_eth ar5312_eth1_data = {
-+	.reset_set = ar5312_device_reset_set,
-+	.reset_clear = ar5312_device_reset_clear,
-+	.reset_mac = AR5312_RESET_ENET1,
-+	.reset_phy = AR5312_RESET_EPHY1,
-+};
-+
- static struct physmap_flash_data ar5312_flash_data = {
- 	.width = 2,
- };
-@@ -243,6 +277,7 @@ static void __init ar5312_flash_init(voi
- void __init ar5312_init_devices(void)
- {
- 	struct ath25_boarddata *config;
-+	u8 *c;
- 
- 	ar5312_flash_init();
- 
-@@ -266,8 +301,30 @@ void __init ar5312_init_devices(void)
- 
- 	platform_device_register(&ar5312_gpio);
- 
-+	/* Fix up MAC addresses if necessary */
-+	if (is_broadcast_ether_addr(config->enet0_mac))
-+		ether_addr_copy(config->enet0_mac, config->enet1_mac);
-+
-+	/* If ENET0 and ENET1 have the same mac address,
-+	 * increment the one from ENET1 */
-+	if (ether_addr_equal(config->enet0_mac, config->enet1_mac)) {
-+		c = config->enet1_mac + 5;
-+		while ((c >= config->enet1_mac) && !(++(*c)))
-+			c--;
-+	}
-+
- 	switch (ath25_soc) {
- 	case ATH25_SOC_AR5312:
-+		ar5312_eth0_data.macaddr = config->enet0_mac;
-+		ath25_add_ethernet(0, AR5312_ENET0_BASE, "eth0_mii",
-+				   AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET0,
-+				   &ar5312_eth0_data);
-+
-+		ar5312_eth1_data.macaddr = config->enet1_mac;
-+		ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth1_mii",
-+				   AR5312_ENET1_MII_BASE, AR5312_IRQ_ENET1,
-+				   &ar5312_eth1_data);
-+
- 		if (!ath25_board.radio)
- 			return;
- 
-@@ -276,8 +333,18 @@ void __init ar5312_init_devices(void)
- 
- 		ath25_add_wmac(0, AR5312_WLAN0_BASE, AR5312_IRQ_WLAN0);
- 		break;
-+	/*
-+	 * AR2312/3 ethernet uses the PHY of ENET0, but the MAC
-+	 * of ENET1. Atheros calls it 'twisted' for a reason :)
-+	 */
- 	case ATH25_SOC_AR2312:
- 	case ATH25_SOC_AR2313:
-+		ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
-+		ar5312_eth1_data.macaddr = config->enet0_mac;
-+		ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth0_mii",
-+				   AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET1,
-+				   &ar5312_eth1_data);
-+
- 		if (!ath25_board.radio)
- 			return;
- 		break;
---- a/arch/mips/ath25/devices.h
-+++ b/arch/mips/ath25/devices.h
-@@ -33,6 +33,8 @@ extern struct ar231x_board_config ath25_
- extern void (*ath25_irq_dispatch)(void);
- 
- int ath25_find_config(phys_addr_t offset, unsigned long size);
-+int ath25_add_ethernet(int nr, u32 base, const char *mii_name, u32 mii_base,
-+		       int irq, void *pdata);
- void ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
- int ath25_add_wmac(int nr, u32 base, int irq);
- 
---- a/arch/mips/ath25/devices.c
-+++ b/arch/mips/ath25/devices.c
-@@ -13,6 +13,51 @@
- struct ar231x_board_config ath25_board;
- enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN;
- 
-+static struct resource ath25_eth0_res[] = {
-+	{
-+		.name = "eth0_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth0_mii",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth0_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct resource ath25_eth1_res[] = {
-+	{
-+		.name = "eth1_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth1_mii",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth1_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct platform_device ath25_eth[] = {
-+	{
-+		.id = 0,
-+		.name = "ar231x-eth",
-+		.resource = ath25_eth0_res,
-+		.num_resources = ARRAY_SIZE(ath25_eth0_res)
-+	},
-+	{
-+		.id = 1,
-+		.name = "ar231x-eth",
-+		.resource = ath25_eth1_res,
-+		.num_resources = ARRAY_SIZE(ath25_eth1_res)
-+	}
-+};
-+
- static struct resource ath25_wmac0_res[] = {
- 	{
- 		.name = "wmac0_membase",
-@@ -71,6 +116,25 @@ const char *get_system_type(void)
- 	return soc_type_strings[ath25_soc];
- }
- 
-+int __init ath25_add_ethernet(int nr, u32 base, const char *mii_name,
-+			      u32 mii_base, int irq, void *pdata)
-+{
-+	struct resource *res;
-+
-+	ath25_eth[nr].dev.platform_data = pdata;
-+	res = &ath25_eth[nr].resource[0];
-+	res->start = base;
-+	res->end = base + 0x2000 - 1;
-+	res++;
-+	res->name = mii_name;
-+	res->start = mii_base;
-+	res->end = mii_base + 8 - 1;
-+	res++;
-+	res->start = irq;
-+	res->end = irq;
-+	return platform_device_register(&ath25_eth[nr]);
-+}
-+
- void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
- {
- 	struct uart_port s;
---- a/arch/mips/include/asm/mach-ath25/ath25_platform.h
-+++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h
-@@ -71,4 +71,15 @@ struct ar231x_board_config {
- 	const char *radio;
- };
- 
-+/*
-+ * Platform device information for the Ethernet MAC
-+ */
-+struct ar231x_eth {
-+	void (*reset_set)(u32);
-+	void (*reset_clear)(u32);
-+	u32 reset_mac;
-+	u32 reset_phy;
-+	char *macaddr;
-+};
-+
- #endif /* __ASM_MACH_ATH25_PLATFORM_H */
diff --git a/target/linux/ath25/patches-4.14/120-spiflash.patch b/target/linux/ath25/patches-4.14/120-spiflash.patch
deleted file mode 100644
index 0a2161fb7e..0000000000
--- a/target/linux/ath25/patches-4.14/120-spiflash.patch
+++ /dev/null
@@ -1,634 +0,0 @@
---- a/drivers/mtd/devices/Kconfig
-+++ b/drivers/mtd/devices/Kconfig
-@@ -130,6 +130,10 @@ config MTD_BCM47XXSFLASH
- 	  registered by bcma as platform devices. This enables driver for
- 	  serial flash memories.
- 
-+config MTD_AR2315
-+	tristate "Atheros AR2315+ SPI Flash support"
-+	depends on SOC_AR2315
-+
- config MTD_SLRAM
- 	tristate "Uncached system RAM"
- 	help
---- a/drivers/mtd/devices/Makefile
-+++ b/drivers/mtd/devices/Makefile
-@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
- obj-$(CONFIG_MTD_MCHP23K256)	+= mchp23k256.o
- obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
- obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
-+obj-$(CONFIG_MTD_AR2315)	+= ar2315.o
- obj-$(CONFIG_MTD_BCM47XXSFLASH)	+= bcm47xxsflash.o
- obj-$(CONFIG_MTD_ST_SPI_FSM)    += st_spi_fsm.o
- obj-$(CONFIG_MTD_POWERNV_FLASH)	+= powernv_flash.o
---- /dev/null
-+++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,459 @@
-+
-+/*
-+ * MTD driver for the SPI Flash Memory support on Atheros AR2315
-+ *
-+ * Copyright (c) 2005-2006 Atheros Communications Inc.
-+ * Copyright (C) 2006-2007 FON Technology, SL.
-+ * Copyright (C) 2006-2007 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
-+ * Copyright (C) 2012 Alexandros C. Couloumbis <alex at ozo.com>
-+ *
-+ * This code is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/mtd/partitions.h>
-+#include <linux/platform_device.h>
-+#include <linux/sched.h>
-+#include <linux/delay.h>
-+#include <linux/io.h>
-+#include <linux/mutex.h>
-+
-+#include "ar2315_spiflash.h"
-+
-+#define DRIVER_NAME "ar2315-spiflash"
-+
-+#define busy_wait(_priv, _condition, _wait) do { \
-+	while (_condition) { \
-+		if (_wait > 1) \
-+			msleep(_wait); \
-+		else if ((_wait == 1) && need_resched()) \
-+			schedule(); \
-+		else \
-+			udelay(1); \
-+	} \
-+} while (0)
-+
-+enum {
-+	FLASH_NONE,
-+	FLASH_1MB,
-+	FLASH_2MB,
-+	FLASH_4MB,
-+	FLASH_8MB,
-+	FLASH_16MB,
-+};
-+
-+/* Flash configuration table */
-+struct flashconfig {
-+	u32 byte_cnt;
-+	u32 sector_cnt;
-+	u32 sector_size;
-+};
-+
-+static const struct flashconfig flashconfig_tbl[] = {
-+	[FLASH_NONE] = { 0, 0, 0},
-+	[FLASH_1MB]  = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT,
-+			 STM_1MB_SECTOR_SIZE},
-+	[FLASH_2MB]  = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT,
-+			 STM_2MB_SECTOR_SIZE},
-+	[FLASH_4MB]  = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT,
-+			 STM_4MB_SECTOR_SIZE},
-+	[FLASH_8MB]  = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT,
-+			 STM_8MB_SECTOR_SIZE},
-+	[FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT,
-+			 STM_16MB_SECTOR_SIZE}
-+};
-+
-+/* Mapping of generic opcodes to STM serial flash opcodes */
-+enum {
-+	SPI_WRITE_ENABLE,
-+	SPI_WRITE_DISABLE,
-+	SPI_RD_STATUS,
-+	SPI_WR_STATUS,
-+	SPI_RD_DATA,
-+	SPI_FAST_RD_DATA,
-+	SPI_PAGE_PROGRAM,
-+	SPI_SECTOR_ERASE,
-+	SPI_BULK_ERASE,
-+	SPI_DEEP_PWRDOWN,
-+	SPI_RD_SIG,
-+};
-+
-+struct opcodes {
-+	__u16 code;
-+	__s8 tx_cnt;
-+	__s8 rx_cnt;
-+};
-+
-+static const struct opcodes stm_opcodes[] = {
-+	[SPI_WRITE_ENABLE] = {STM_OP_WR_ENABLE, 1, 0},
-+	[SPI_WRITE_DISABLE] = {STM_OP_WR_DISABLE, 1, 0},
-+	[SPI_RD_STATUS] = {STM_OP_RD_STATUS, 1, 1},
-+	[SPI_WR_STATUS] = {STM_OP_WR_STATUS, 1, 0},
-+	[SPI_RD_DATA] = {STM_OP_RD_DATA, 4, 4},
-+	[SPI_FAST_RD_DATA] = {STM_OP_FAST_RD_DATA, 5, 0},
-+	[SPI_PAGE_PROGRAM] = {STM_OP_PAGE_PGRM, 8, 0},
-+	[SPI_SECTOR_ERASE] = {STM_OP_SECTOR_ERASE, 4, 0},
-+	[SPI_BULK_ERASE] = {STM_OP_BULK_ERASE, 1, 0},
-+	[SPI_DEEP_PWRDOWN] = {STM_OP_DEEP_PWRDOWN, 1, 0},
-+	[SPI_RD_SIG] = {STM_OP_RD_SIG, 4, 1},
-+};
-+
-+/* Driver private data structure */
-+struct spiflash_priv {
-+	struct mtd_info mtd;
-+	void __iomem *readaddr; /* memory mapped data for read  */
-+	void __iomem *mmraddr;  /* memory mapped register space */
-+	struct mutex lock;	/* serialize registers access */
-+};
-+
-+#define to_spiflash(_mtd) container_of(_mtd, struct spiflash_priv, mtd)
-+
-+enum {
-+	FL_READY,
-+	FL_READING,
-+	FL_ERASING,
-+	FL_WRITING
-+};
-+
-+/*****************************************************************************/
-+
-+static u32
-+spiflash_read_reg(struct spiflash_priv *priv, int reg)
-+{
-+	return ioread32(priv->mmraddr + reg);
-+}
-+
-+static void
-+spiflash_write_reg(struct spiflash_priv *priv, int reg, u32 data)
-+{
-+	iowrite32(data, priv->mmraddr + reg);
-+}
-+
-+static u32
-+spiflash_wait_busy(struct spiflash_priv *priv)
-+{
-+	u32 reg;
-+
-+	busy_wait(priv, (reg = spiflash_read_reg(priv, SPI_FLASH_CTL)) &
-+		SPI_CTL_BUSY, 0);
-+	return reg;
-+}
-+
-+static u32
-+spiflash_sendcmd(struct spiflash_priv *priv, int opcode, u32 addr)
-+{
-+	const struct opcodes *op;
-+	u32 reg, mask;
-+
-+	op = &stm_opcodes[opcode];
-+	reg = spiflash_wait_busy(priv);
-+	spiflash_write_reg(priv, SPI_FLASH_OPCODE,
-+			   ((u32)op->code) | (addr << 8));
-+
-+	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+	reg |= SPI_CTL_START | op->tx_cnt | (op->rx_cnt << 4);
-+
-+	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+	spiflash_wait_busy(priv);
-+
-+	if (!op->rx_cnt)
-+		return 0;
-+
-+	reg = spiflash_read_reg(priv, SPI_FLASH_DATA);
-+
-+	switch (op->rx_cnt) {
-+	case 1:
-+		mask = 0x000000ff;
-+		break;
-+	case 2:
-+		mask = 0x0000ffff;
-+		break;
-+	case 3:
-+		mask = 0x00ffffff;
-+		break;
-+	default:
-+		mask = 0xffffffff;
-+		break;
-+	}
-+	reg &= mask;
-+
-+	return reg;
-+}
-+
-+/*
-+ * Probe SPI flash device
-+ * Function returns 0 for failure.
-+ * and flashconfig_tbl array index for success.
-+ */
-+static int
-+spiflash_probe_chip(struct platform_device *pdev, struct spiflash_priv *priv)
-+{
-+	u32 sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0);
-+	int flash_size;
-+
-+	switch (sig) {
-+	case STM_8MBIT_SIGNATURE:
-+		flash_size = FLASH_1MB;
-+		break;
-+	case STM_16MBIT_SIGNATURE:
-+		flash_size = FLASH_2MB;
-+		break;
-+	case STM_32MBIT_SIGNATURE:
-+		flash_size = FLASH_4MB;
-+		break;
-+	case STM_64MBIT_SIGNATURE:
-+		flash_size = FLASH_8MB;
-+		break;
-+	case STM_128MBIT_SIGNATURE:
-+		flash_size = FLASH_16MB;
-+		break;
-+	default:
-+		dev_warn(&pdev->dev, "read of flash device signature failed!\n");
-+		return 0;
-+	}
-+
-+	return flash_size;
-+}
-+
-+static void
-+spiflash_wait_complete(struct spiflash_priv *priv, unsigned int timeout)
-+{
-+	busy_wait(priv, spiflash_sendcmd(priv, SPI_RD_STATUS, 0) &
-+		SPI_STATUS_WIP, timeout);
-+}
-+
-+static int
-+spiflash_erase(struct mtd_info *mtd, struct erase_info *instr)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+	const struct opcodes *op;
-+	u32 temp, reg;
-+
-+	if (instr->addr + instr->len > mtd->size)
-+		return -EINVAL;
-+
-+	mutex_lock(&priv->lock);
-+
-+	spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
-+	reg = spiflash_wait_busy(priv);
-+
-+	op = &stm_opcodes[SPI_SECTOR_ERASE];
-+	temp = ((u32)instr->addr << 8) | (u32)(op->code);
-+	spiflash_write_reg(priv, SPI_FLASH_OPCODE, temp);
-+
-+	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+	reg |= op->tx_cnt | SPI_CTL_START;
-+	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+
-+	spiflash_wait_complete(priv, 20);
-+
-+	mutex_unlock(&priv->lock);
-+
-+	instr->state = MTD_ERASE_DONE;
-+	mtd_erase_callback(instr);
-+
-+	return 0;
-+}
-+
-+static int
-+spiflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
-+	      u_char *buf)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+
-+	if (!len)
-+		return 0;
-+
-+	if (from + len > mtd->size)
-+		return -EINVAL;
-+
-+	*retlen = len;
-+
-+	mutex_lock(&priv->lock);
-+
-+	memcpy_fromio(buf, priv->readaddr + from, len);
-+
-+	mutex_unlock(&priv->lock);
-+
-+	return 0;
-+}
-+
-+static int
-+spiflash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
-+	       const u8 *buf)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+	u32 opcode, bytes_left;
-+
-+	*retlen = 0;
-+
-+	if (!len)
-+		return 0;
-+
-+	if (to + len > mtd->size)
-+		return -EINVAL;
-+
-+	bytes_left = len;
-+
-+	do {
-+		u32 read_len, reg, page_offset, spi_data = 0;
-+
-+		read_len = min(bytes_left, sizeof(u32));
-+
-+		/* 32-bit writes cannot span across a page boundary
-+		 * (256 bytes). This types of writes require two page
-+		 * program operations to handle it correctly. The STM part
-+		 * will write the overflow data to the beginning of the
-+		 * current page as opposed to the subsequent page.
-+		 */
-+		page_offset = (to & (STM_PAGE_SIZE - 1)) + read_len;
-+
-+		if (page_offset > STM_PAGE_SIZE)
-+			read_len -= (page_offset - STM_PAGE_SIZE);
-+
-+		mutex_lock(&priv->lock);
-+
-+		spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
-+		spi_data = 0;
-+		switch (read_len) {
-+		case 4:
-+			spi_data |= buf[3] << 24;
-+			/* fall through */
-+		case 3:
-+			spi_data |= buf[2] << 16;
-+			/* fall through */
-+		case 2:
-+			spi_data |= buf[1] << 8;
-+			/* fall through */
-+		case 1:
-+			spi_data |= buf[0] & 0xff;
-+			break;
-+		default:
-+			break;
-+		}
-+
-+		spiflash_write_reg(priv, SPI_FLASH_DATA, spi_data);
-+		opcode = stm_opcodes[SPI_PAGE_PROGRAM].code |
-+			(to & 0x00ffffff) << 8;
-+		spiflash_write_reg(priv, SPI_FLASH_OPCODE, opcode);
-+
-+		reg = spiflash_read_reg(priv, SPI_FLASH_CTL);
-+		reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+		reg |= (read_len + 4) | SPI_CTL_START;
-+		spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+
-+		spiflash_wait_complete(priv, 1);
-+
-+		mutex_unlock(&priv->lock);
-+
-+		bytes_left -= read_len;
-+		to += read_len;
-+		buf += read_len;
-+
-+		*retlen += read_len;
-+	} while (bytes_left != 0);
-+
-+	return 0;
-+}
-+
-+#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS
-+static const char * const part_probe_types[] = {
-+	"cmdlinepart", "RedBoot", "MyLoader", NULL
-+};
-+#endif
-+
-+static int
-+spiflash_probe(struct platform_device *pdev)
-+{
-+	struct spiflash_priv *priv;
-+	struct mtd_info *mtd;
-+	struct resource *res;
-+	int index;
-+	int result = 0;
-+
-+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-+	if (!priv)
-+		return -ENOMEM;
-+
-+	mutex_init(&priv->lock);
-+	mtd = &priv->mtd;
-+
-+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-+	priv->mmraddr = devm_ioremap_resource(&pdev->dev, res);
-+	if (IS_ERR(priv->mmraddr)) {
-+		dev_warn(&pdev->dev, "failed to map flash MMR\n");
-+		return PTR_ERR(priv->mmraddr);
-+	}
-+
-+	index = spiflash_probe_chip(pdev, priv);
-+	if (!index) {
-+		dev_warn(&pdev->dev, "found no flash device\n");
-+		return -ENODEV;
-+	}
-+
-+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+	priv->readaddr = devm_ioremap_resource(&pdev->dev, res);
-+	if (IS_ERR(priv->readaddr)) {
-+		dev_warn(&pdev->dev, "failed to map flash read mem\n");
-+		return PTR_ERR(priv->readaddr);
-+	}
-+
-+	platform_set_drvdata(pdev, priv);
-+	mtd->name = "spiflash";
-+	mtd->type = MTD_NORFLASH;
-+	mtd->flags = (MTD_CAP_NORFLASH|MTD_WRITEABLE);
-+	mtd->size = flashconfig_tbl[index].byte_cnt;
-+	mtd->erasesize = flashconfig_tbl[index].sector_size;
-+	mtd->writesize = 1;
-+	mtd->numeraseregions = 0;
-+	mtd->eraseregions = NULL;
-+	mtd->_erase = spiflash_erase;
-+	mtd->_read = spiflash_read;
-+	mtd->_write = spiflash_write;
-+	mtd->owner = THIS_MODULE;
-+
-+	dev_info(&pdev->dev, "%lld Kbytes flash detected\n", mtd->size >> 10);
-+
-+#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS
-+	/* parse redboot partitions */
-+
-+	result = mtd_device_parse_register(mtd, part_probe_types,
-+					   NULL, NULL, 0);
-+#endif
-+
-+	return result;
-+}
-+
-+static int
-+spiflash_remove(struct platform_device *pdev)
-+{
-+	struct spiflash_priv *priv = platform_get_drvdata(pdev);
-+
-+	mtd_device_unregister(&priv->mtd);
-+
-+	return 0;
-+}
-+
-+static struct platform_driver spiflash_driver = {
-+	.driver.name = DRIVER_NAME,
-+	.probe = spiflash_probe,
-+	.remove = spiflash_remove,
-+};
-+
-+module_platform_driver(spiflash_driver);
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("OpenWrt.org");
-+MODULE_AUTHOR("Atheros Communications Inc");
-+MODULE_DESCRIPTION("MTD driver for SPI Flash on Atheros AR2315+ SOC");
-+MODULE_ALIAS("platform:" DRIVER_NAME);
-+
---- /dev/null
-+++ b/drivers/mtd/devices/ar2315_spiflash.h
-@@ -0,0 +1,106 @@
-+/*
-+ * Atheros AR2315 SPI Flash Memory support header file.
-+ *
-+ * Copyright (c) 2005, Atheros Communications Inc.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <kaloz at openwrt.org>
-+ * Copyright (C) 2006-2009 Felix Fietkau <nbd at nbd.name>
-+ *
-+ * This code is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+#ifndef __AR2315_SPIFLASH_H
-+#define __AR2315_SPIFLASH_H
-+
-+#define STM_PAGE_SIZE           256
-+
-+#define SFI_WRITE_BUFFER_SIZE   4
-+#define SFI_FLASH_ADDR_MASK     0x00ffffff
-+
-+#define STM_8MBIT_SIGNATURE     0x13
-+#define STM_M25P80_BYTE_COUNT   1048576
-+#define STM_M25P80_SECTOR_COUNT 16
-+#define STM_M25P80_SECTOR_SIZE  0x10000
-+
-+#define STM_16MBIT_SIGNATURE    0x14
-+#define STM_M25P16_BYTE_COUNT   2097152
-+#define STM_M25P16_SECTOR_COUNT 32
-+#define STM_M25P16_SECTOR_SIZE  0x10000
-+
-+#define STM_32MBIT_SIGNATURE    0x15
-+#define STM_M25P32_BYTE_COUNT   4194304
-+#define STM_M25P32_SECTOR_COUNT 64
-+#define STM_M25P32_SECTOR_SIZE  0x10000
-+
-+#define STM_64MBIT_SIGNATURE    0x16
-+#define STM_M25P64_BYTE_COUNT   8388608
-+#define STM_M25P64_SECTOR_COUNT 128
-+#define STM_M25P64_SECTOR_SIZE  0x10000
-+
-+#define STM_128MBIT_SIGNATURE   0x17
-+#define STM_M25P128_BYTE_COUNT   16777216
-+#define STM_M25P128_SECTOR_COUNT 256
-+#define STM_M25P128_SECTOR_SIZE  0x10000
-+
-+#define STM_1MB_BYTE_COUNT   STM_M25P80_BYTE_COUNT
-+#define STM_1MB_SECTOR_COUNT STM_M25P80_SECTOR_COUNT
-+#define STM_1MB_SECTOR_SIZE  STM_M25P80_SECTOR_SIZE
-+#define STM_2MB_BYTE_COUNT   STM_M25P16_BYTE_COUNT
-+#define STM_2MB_SECTOR_COUNT STM_M25P16_SECTOR_COUNT
-+#define STM_2MB_SECTOR_SIZE  STM_M25P16_SECTOR_SIZE
-+#define STM_4MB_BYTE_COUNT   STM_M25P32_BYTE_COUNT
-+#define STM_4MB_SECTOR_COUNT STM_M25P32_SECTOR_COUNT
-+#define STM_4MB_SECTOR_SIZE  STM_M25P32_SECTOR_SIZE
-+#define STM_8MB_BYTE_COUNT   STM_M25P64_BYTE_COUNT
-+#define STM_8MB_SECTOR_COUNT STM_M25P64_SECTOR_COUNT
-+#define STM_8MB_SECTOR_SIZE  STM_M25P64_SECTOR_SIZE
-+#define STM_16MB_BYTE_COUNT   STM_M25P128_BYTE_COUNT
-+#define STM_16MB_SECTOR_COUNT STM_M25P128_SECTOR_COUNT
-+#define STM_16MB_SECTOR_SIZE  STM_M25P128_SECTOR_SIZE
-+
-+/*
-+ * ST Microelectronics Opcodes for Serial Flash
-+ */
-+
-+#define STM_OP_WR_ENABLE       0x06     /* Write Enable */
-+#define STM_OP_WR_DISABLE      0x04     /* Write Disable */
-+#define STM_OP_RD_STATUS       0x05     /* Read Status */
-+#define STM_OP_WR_STATUS       0x01     /* Write Status */
-+#define STM_OP_RD_DATA         0x03     /* Read Data */
-+#define STM_OP_FAST_RD_DATA    0x0b     /* Fast Read Data */
-+#define STM_OP_PAGE_PGRM       0x02     /* Page Program */
-+#define STM_OP_SECTOR_ERASE    0xd8     /* Sector Erase */
-+#define STM_OP_BULK_ERASE      0xc7     /* Bulk Erase */
-+#define STM_OP_DEEP_PWRDOWN    0xb9     /* Deep Power-Down Mode */
-+#define STM_OP_RD_SIG          0xab     /* Read Electronic Signature */
-+
-+#define STM_STATUS_WIP       0x01       /* Write-In-Progress */
-+#define STM_STATUS_WEL       0x02       /* Write Enable Latch */
-+#define STM_STATUS_BP0       0x04       /* Block Protect 0 */
-+#define STM_STATUS_BP1       0x08       /* Block Protect 1 */
-+#define STM_STATUS_BP2       0x10       /* Block Protect 2 */
-+#define STM_STATUS_SRWD      0x80       /* Status Register Write Disable */
-+
-+/*
-+ * SPI Flash Interface Registers
-+ */
-+
-+#define SPI_FLASH_CTL           0x00
-+#define SPI_FLASH_OPCODE        0x04
-+#define SPI_FLASH_DATA          0x08
-+
-+#define SPI_CTL_START           0x00000100
-+#define SPI_CTL_BUSY            0x00010000
-+#define SPI_CTL_TXCNT_MASK      0x0000000f
-+#define SPI_CTL_RXCNT_MASK      0x000000f0
-+#define SPI_CTL_TX_RX_CNT_MASK  0x000000ff
-+#define SPI_CTL_SIZE_MASK       0x00060000
-+
-+#define SPI_CTL_CLK_SEL_MASK    0x03000000
-+#define SPI_OPCODE_MASK         0x000000ff
-+
-+#define SPI_STATUS_WIP		STM_STATUS_WIP
-+
-+#endif
---- a/arch/mips/ath25/ar2315.c
-+++ b/arch/mips/ath25/ar2315.c
-@@ -220,6 +220,28 @@ static struct platform_device ar2315_gpi
- 	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
- };
- 
-+static struct resource ar2315_spiflash_res[] = {
-+	{
-+		.name = "spiflash_read",
-+		.flags = IORESOURCE_MEM,
-+		.start = AR2315_SPI_READ_BASE,
-+		.end = AR2315_SPI_READ_BASE + AR2315_SPI_READ_SIZE - 1,
-+	},
-+	{
-+		.name = "spiflash_mmr",
-+		.flags = IORESOURCE_MEM,
-+		.start = AR2315_SPI_MMR_BASE,
-+		.end = AR2315_SPI_MMR_BASE + AR2315_SPI_MMR_SIZE - 1,
-+	},
-+};
-+
-+static struct platform_device ar2315_spiflash = {
-+	.id = 0,
-+	.name = "ar2315-spiflash",
-+	.resource = ar2315_spiflash_res,
-+	.num_resources = ARRAY_SIZE(ar2315_spiflash_res)
-+};
-+
- void __init ar2315_init_devices(void)
- {
- 	/* Find board configuration */
-@@ -230,6 +252,8 @@ void __init ar2315_init_devices(void)
- 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
- 	platform_device_register(&ar2315_gpio);
- 
-+	platform_device_register(&ar2315_spiflash);
-+
- 	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
- 	ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii",
- 			   AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0,
diff --git a/target/linux/ath25/patches-4.14/130-watchdog.patch b/target/linux/ath25/patches-4.14/130-watchdog.patch
deleted file mode 100644
index 01904d69a5..0000000000
--- a/target/linux/ath25/patches-4.14/130-watchdog.patch
+++ /dev/null
@@ -1,277 +0,0 @@
---- /dev/null
-+++ b/drivers/watchdog/ar2315-wtd.c
-@@ -0,0 +1,209 @@
-+/*
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * Copyright (C) 2008 John Crispin <blogic at openwrt.org>
-+ * Based on EP93xx and ifxmips wdt driver
-+ */
-+
-+#include <linux/interrupt.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/types.h>
-+#include <linux/miscdevice.h>
-+#include <linux/watchdog.h>
-+#include <linux/fs.h>
-+#include <linux/ioport.h>
-+#include <linux/notifier.h>
-+#include <linux/reboot.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/io.h>
-+#include <linux/uaccess.h>
-+
-+#define DRIVER_NAME	"ar2315-wdt"
-+
-+#define CLOCK_RATE 40000000
-+#define HEARTBEAT(x) (x < 1 || x > 90 ? 20 : x)
-+
-+#define WDT_REG_TIMER		0x00
-+#define WDT_REG_CTRL		0x04
-+
-+#define WDT_CTRL_ACT_NONE	0x00000000	/* No action */
-+#define WDT_CTRL_ACT_NMI	0x00000001	/* NMI on watchdog */
-+#define WDT_CTRL_ACT_RESET	0x00000002	/* reset on watchdog */
-+
-+static int wdt_timeout = 20;
-+static int started;
-+static int in_use;
-+static void __iomem *wdt_base;
-+
-+static inline void ar2315_wdt_wr(unsigned reg, u32 val)
-+{
-+	iowrite32(val, wdt_base + reg);
-+}
-+
-+static void
-+ar2315_wdt_enable(void)
-+{
-+	ar2315_wdt_wr(WDT_REG_TIMER, wdt_timeout * CLOCK_RATE);
-+}
-+
-+static ssize_t
-+ar2315_wdt_write(struct file *file, const char __user *data, size_t len,
-+		 loff_t *ppos)
-+{
-+	if (len)
-+		ar2315_wdt_enable();
-+	return len;
-+}
-+
-+static int
-+ar2315_wdt_open(struct inode *inode, struct file *file)
-+{
-+	if (in_use)
-+		return -EBUSY;
-+	ar2315_wdt_enable();
-+	in_use = 1;
-+	started = 1;
-+	return nonseekable_open(inode, file);
-+}
-+
-+static int
-+ar2315_wdt_release(struct inode *inode, struct file *file)
-+{
-+	in_use = 0;
-+	return 0;
-+}
-+
-+static irqreturn_t
-+ar2315_wdt_interrupt(int irq, void *dev)
-+{
-+	struct platform_device *pdev = (struct platform_device *)dev;
-+
-+	if (started) {
-+		dev_crit(&pdev->dev, "watchdog expired, rebooting system\n");
-+		emergency_restart();
-+	} else {
-+		ar2315_wdt_wr(WDT_REG_CTRL, 0);
-+		ar2315_wdt_wr(WDT_REG_TIMER, 0);
-+	}
-+	return IRQ_HANDLED;
-+}
-+
-+static struct watchdog_info ident = {
-+	.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
-+	.identity = "ar2315 Watchdog",
-+};
-+
-+static long
-+ar2315_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-+{
-+	int new_wdt_timeout;
-+	int ret = -ENOIOCTLCMD;
-+
-+	switch (cmd) {
-+	case WDIOC_GETSUPPORT:
-+		ret = copy_to_user((void __user *)arg, &ident, sizeof(ident)) ?
-+		      -EFAULT : 0;
-+		break;
-+	case WDIOC_KEEPALIVE:
-+		ar2315_wdt_enable();
-+		ret = 0;
-+		break;
-+	case WDIOC_SETTIMEOUT:
-+		ret = get_user(new_wdt_timeout, (int __user *)arg);
-+		if (ret)
-+			break;
-+		wdt_timeout = HEARTBEAT(new_wdt_timeout);
-+		ar2315_wdt_enable();
-+		break;
-+	case WDIOC_GETTIMEOUT:
-+		ret = put_user(wdt_timeout, (int __user *)arg);
-+		break;
-+	}
-+	return ret;
-+}
-+
-+static const struct file_operations ar2315_wdt_fops = {
-+	.owner		= THIS_MODULE,
-+	.llseek		= no_llseek,
-+	.write		= ar2315_wdt_write,
-+	.unlocked_ioctl	= ar2315_wdt_ioctl,
-+	.open		= ar2315_wdt_open,
-+	.release	= ar2315_wdt_release,
-+};
-+
-+static struct miscdevice ar2315_wdt_miscdev = {
-+	.minor	= WATCHDOG_MINOR,
-+	.name	= "watchdog",
-+	.fops	= &ar2315_wdt_fops,
-+};
-+
-+static int
-+ar2315_wdt_probe(struct platform_device *dev)
-+{
-+	struct resource *mem_res, *irq_res;
-+	int ret = 0;
-+
-+	if (wdt_base)
-+		return -EBUSY;
-+
-+	irq_res = platform_get_resource(dev, IORESOURCE_IRQ, 0);
-+	if (!irq_res) {
-+		dev_err(&dev->dev, "no IRQ resource\n");
-+		return -ENOENT;
-+	}
-+
-+	mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-+	wdt_base = devm_ioremap_resource(&dev->dev, mem_res);
-+	if (IS_ERR(wdt_base))
-+		return PTR_ERR(wdt_base);
-+
-+	ret = devm_request_irq(&dev->dev, irq_res->start, ar2315_wdt_interrupt,
-+			       0, DRIVER_NAME, dev);
-+	if (ret) {
-+		dev_err(&dev->dev, "failed to register inetrrupt\n");
-+		goto out;
-+	}
-+
-+	ret = misc_register(&ar2315_wdt_miscdev);
-+	if (ret)
-+		dev_err(&dev->dev, "failed to register miscdev\n");
-+
-+out:
-+	return ret;
-+}
-+
-+static int
-+ar2315_wdt_remove(struct platform_device *dev)
-+{
-+	misc_deregister(&ar2315_wdt_miscdev);
-+	return 0;
-+}
-+
-+static struct platform_driver ar2315_wdt_driver = {
-+	.probe = ar2315_wdt_probe,
-+	.remove = ar2315_wdt_remove,
-+	.driver = {
-+		.name = DRIVER_NAME,
-+		.owner = THIS_MODULE,
-+	},
-+};
-+
-+module_platform_driver(ar2315_wdt_driver);
-+
-+MODULE_DESCRIPTION("Atheros AR2315 hardware watchdog driver");
-+MODULE_AUTHOR("John Crispin <blogic at openwrt.org>");
-+MODULE_LICENSE("GPL");
-+MODULE_ALIAS("platform:" DRIVER_NAME);
---- a/drivers/watchdog/Kconfig
-+++ b/drivers/watchdog/Kconfig
-@@ -1647,6 +1647,13 @@ config PIC32_DMT
- 	  To compile this driver as a loadable module, choose M here.
- 	  The module will be called pic32-dmt.
- 
-+config AR2315_WDT
-+	tristate "Atheros AR2315+ WiSoCs Watchdog Timer"
-+	depends on ATH25
-+	help
-+	  Hardware driver for the built-in watchdog timer on the Atheros
-+	  AR2315/AR2316 WiSoCs.
-+
- # PARISC Architecture
- 
- # POWERPC Architecture
---- a/drivers/watchdog/Makefile
-+++ b/drivers/watchdog/Makefile
-@@ -166,6 +166,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
- obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
- obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
- obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
-+obj-$(CONFIG_AR2315_WDT) += ar2315-wtd.o
- obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
- obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
- octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
---- a/arch/mips/ath25/ar2315.c
-+++ b/arch/mips/ath25/ar2315.c
-@@ -220,6 +220,24 @@ static struct platform_device ar2315_gpi
- 	.num_resources = ARRAY_SIZE(ar2315_gpio_res)
- };
- 
-+static struct resource ar2315_wdt_res[] = {
-+	{
-+		.flags = IORESOURCE_MEM,
-+		.start = AR2315_RST_BASE + AR2315_WDT_TIMER,
-+		.end = AR2315_RST_BASE + AR2315_WDT_TIMER + 8 - 1,
-+	},
-+	{
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct platform_device ar2315_wdt = {
-+	.id = 0,
-+	.name = "ar2315-wdt",
-+	.resource = ar2315_wdt_res,
-+	.num_resources = ARRAY_SIZE(ar2315_wdt_res)
-+};
-+
- static struct resource ar2315_spiflash_res[] = {
- 	{
- 		.name = "spiflash_read",
-@@ -252,6 +270,11 @@ void __init ar2315_init_devices(void)
- 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
- 	platform_device_register(&ar2315_gpio);
- 
-+	ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
-+						     AR2315_MISC_IRQ_WATCHDOG);
-+	ar2315_wdt_res[1].end = ar2315_wdt_res[1].start;
-+	platform_device_register(&ar2315_wdt);
-+
- 	platform_device_register(&ar2315_spiflash);
- 
- 	ar2315_eth_data.macaddr = ath25_board.config->enet0_mac;
diff --git a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch b/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
deleted file mode 100644
index 6aad761cb1..0000000000
--- a/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch
+++ /dev/null
@@ -1,60 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -30,6 +30,8 @@
- #include <linux/mtd/partitions.h>
- #include <linux/module.h>
- 
-+#define BOARD_CONFIG_PART		"boardconfig"
-+
- struct fis_image_desc {
-     unsigned char name[16];      // Null terminated name
-     uint32_t	  flash_base;    // Address within FLASH of image
-@@ -60,6 +62,7 @@ static int parse_redboot_partitions(stru
- 				    const struct mtd_partition **pparts,
- 				    struct mtd_part_parser_data *data)
- {
-+	unsigned long max_offset = 0;
- 	int nrparts = 0;
- 	struct fis_image_desc *buf;
- 	struct mtd_partition *parts;
-@@ -225,14 +228,15 @@ static int parse_redboot_partitions(stru
- 		}
- 	}
- #endif
--	parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
-+	parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen +
-+			sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
- 
- 	if (!parts) {
- 		ret = -ENOMEM;
- 		goto out;
- 	}
- 
--	nullname = (char *)&parts[nrparts];
-+	nullname = (char *)&parts[nrparts + 1];
- #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
- 	if (nulllen > 0) {
- 		strcpy(nullname, nullstring);
-@@ -251,6 +255,8 @@ static int parse_redboot_partitions(stru
- 	}
- #endif
- 	for ( ; i<nrparts; i++) {
-+		if (max_offset < buf[i].flash_base + buf[i].size)
-+			max_offset = buf[i].flash_base + buf[i].size;
- 		parts[i].size = fl->img->size;
- 		parts[i].offset = fl->img->flash_base;
- 		parts[i].name = names;
-@@ -284,6 +290,13 @@ static int parse_redboot_partitions(stru
- 		fl = fl->next;
- 		kfree(tmp_fl);
- 	}
-+	if (master->size - max_offset >= master->erasesize) {
-+		parts[nrparts].size = master->size - max_offset;
-+		parts[nrparts].offset = max_offset;
-+		parts[nrparts].name = names;
-+		strcpy(names, BOARD_CONFIG_PART);
-+		nrparts++;
-+	}
- 	ret = nrparts;
- 	*pparts = parts;
-  out:
diff --git a/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch b/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
deleted file mode 100644
index d1d281eaf4..0000000000
--- a/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch
+++ /dev/null
@@ -1,44 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -79,12 +79,18 @@ static int parse_redboot_partitions(stru
- 	static char nullstring[] = "unallocated";
- #endif
- 
-+	buf = vmalloc(master->erasesize);
-+	if (!buf)
-+		return -ENOMEM;
-+
-+ restart:
- 	if ( directory < 0 ) {
- 		offset = master->size + directory * master->erasesize;
- 		while (mtd_block_isbad(master, offset)) {
- 			if (!offset) {
- 			nogood:
- 				printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
-+				vfree(buf);
- 				return -EIO;
- 			}
- 			offset -= master->erasesize;
-@@ -97,10 +103,6 @@ static int parse_redboot_partitions(stru
- 				goto nogood;
- 		}
- 	}
--	buf = vmalloc(master->erasesize);
--
--	if (!buf)
--		return -ENOMEM;
- 
- 	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
- 	       master->name, offset);
-@@ -173,6 +175,11 @@ static int parse_redboot_partitions(stru
- 	}
- 	if (i == numslots) {
- 		/* Didn't find it */
-+		if (offset + master->erasesize < master->size) {
-+			/* not at the end of the flash yet, maybe next block */
-+			directory++;
-+			goto restart;
-+		}
- 		printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
- 		       master->name);
- 		ret = 0;
diff --git a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
deleted file mode 100644
index ce039df9f1..0000000000
--- a/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch
+++ /dev/null
@@ -1,72 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -58,6 +58,22 @@ static inline int redboot_checksum(struc
- 	return 1;
- }
- 
-+static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset)
-+{
-+	struct mtd_erase_region_info *regions = mtd->eraseregions;
-+	int i;
-+
-+	for (i = 0; i < mtd->numeraseregions; i++) {
-+		if (regions[i].offset +
-+		    regions[i].numblocks * regions[i].erasesize <= offset)
-+			continue;
-+
-+		return regions[i].erasesize;
-+	}
-+
-+	return mtd->erasesize;
-+}
-+
- static int parse_redboot_partitions(struct mtd_info *master,
- 				    const struct mtd_partition **pparts,
- 				    struct mtd_part_parser_data *data)
-@@ -74,6 +90,7 @@ static int parse_redboot_partitions(stru
- 	int namelen = 0;
- 	int nulllen = 0;
- 	int numslots;
-+	int first_slot;
- 	unsigned long offset;
- #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
- 	static char nullstring[] = "unallocated";
-@@ -186,7 +203,10 @@ static int parse_redboot_partitions(stru
- 		goto out;
- 	}
- 
--	for (i = 0; i < numslots; i++) {
-+	first_slot = (buf[i].flash_base & (master->erasesize - 1)) /
-+		     sizeof(struct fis_image_desc);
-+
-+	for (i = first_slot; i < first_slot + numslots; i++) {
- 		struct fis_list *new_fl, **prev;
- 
- 		if (buf[i].name[0] == 0xff) {
-@@ -262,12 +282,13 @@ static int parse_redboot_partitions(stru
- 	}
- #endif
- 	for ( ; i<nrparts; i++) {
--		if (max_offset < buf[i].flash_base + buf[i].size)
--			max_offset = buf[i].flash_base + buf[i].size;
- 		parts[i].size = fl->img->size;
- 		parts[i].offset = fl->img->flash_base;
- 		parts[i].name = names;
- 
-+		if (max_offset < parts[i].offset + parts[i].size)
-+			max_offset = parts[i].offset + parts[i].size;
-+
- 		strcpy(names, fl->img->name);
- #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
- 		if (!memcmp(names, "RedBoot", 8) ||
-@@ -297,7 +318,9 @@ static int parse_redboot_partitions(stru
- 		fl = fl->next;
- 		kfree(tmp_fl);
- 	}
--	if (master->size - max_offset >= master->erasesize) {
-+
-+	if (master->size - max_offset >=
-+	    mtd_get_offset_erasesize(master, max_offset)) {
- 		parts[nrparts].size = master->size - max_offset;
- 		parts[nrparts].offset = max_offset;
- 		parts[nrparts].name = names;
diff --git a/target/linux/ath25/patches-4.14/210-reset_button.patch b/target/linux/ath25/patches-4.14/210-reset_button.patch
deleted file mode 100644
index b3f7a14cda..0000000000
--- a/target/linux/ath25/patches-4.14/210-reset_button.patch
+++ /dev/null
@@ -1,71 +0,0 @@
---- a/arch/mips/ath25/Makefile
-+++ b/arch/mips/ath25/Makefile
-@@ -8,7 +8,7 @@
- # Copyright (C) 2006-2009 Felix Fietkau <nbd at openwrt.org>
- #
- 
--obj-y += board.o prom.o devices.o
-+obj-y += board.o prom.o devices.o reset.o
- 
- obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
- 
---- /dev/null
-+++ b/arch/mips/ath25/reset.c
-@@ -0,0 +1,57 @@
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/platform_device.h>
-+#include <linux/gpio_keys.h>
-+#include <linux/input.h>
-+#include <ath25_platform.h>
-+#include "devices.h"
-+
-+static int __init
-+ar231x_init_reset(void)
-+{
-+	struct platform_device *pdev;
-+	struct gpio_keys_platform_data pdata;
-+	struct gpio_keys_button *p;
-+	int err;
-+
-+	if (ath25_board.config->reset_config_gpio == 0xffff)
-+		return -ENODEV;
-+
-+	p = kzalloc(sizeof(*p), GFP_KERNEL);
-+	if (!p)
-+		goto err;
-+
-+	p->desc = "reset";
-+	p->type = EV_KEY;
-+	p->code = KEY_RESTART;
-+	p->debounce_interval = 60;
-+	p->gpio = ath25_board.config->reset_config_gpio;
-+
-+	memset(&pdata, 0, sizeof(pdata));
-+	pdata.poll_interval = 20;
-+	pdata.buttons = p;
-+	pdata.nbuttons = 1;
-+
-+	pdev = platform_device_alloc("gpio-keys-polled", 0);
-+	if (!pdev)
-+		goto err_free;
-+
-+	err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
-+	if (err)
-+		goto err_put_pdev;
-+
-+	err = platform_device_add(pdev);
-+	if (err)
-+		goto err_put_pdev;
-+
-+	return 0;
-+
-+err_put_pdev:
-+	platform_device_put(pdev);
-+err_free:
-+	kfree(p);
-+err:
-+	return -ENOMEM;
-+}
-+
-+device_initcall(ar231x_init_reset);
diff --git a/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
deleted file mode 100644
index 91b9792515..0000000000
--- a/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch
+++ /dev/null
@@ -1,111 +0,0 @@
---- a/drivers/net/ethernet/atheros/ar231x/ar231x.c
-+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -135,6 +135,7 @@ static int ar231x_mdiobus_write(struct m
- static int ar231x_mdiobus_reset(struct mii_bus *bus);
- static int ar231x_mdiobus_probe(struct net_device *dev);
- static void ar231x_adjust_link(struct net_device *dev);
-+static bool no_phy;
- 
- #ifndef ERR
- #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
-@@ -167,6 +168,32 @@ static const struct net_device_ops ar231
- #endif
- };
- 
-+static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id)
-+{
-+	int phy_reg;
-+
-+	/**
-+	 * Grab the bits from PHYIR1, and put them
-+	 * in the upper half.
-+	 */
-+	phy_reg = mdiobus_read(bus, addr, MII_PHYSID1);
-+
-+	if (phy_reg < 0)
-+		return -EIO;
-+
-+	*phy_id = (phy_reg & 0xffff) << 16;
-+
-+	/* Grab the bits from PHYIR2, and put them in the lower half */
-+	phy_reg = mdiobus_read(bus, addr, MII_PHYSID2);
-+
-+	if (phy_reg < 0)
-+		return -EIO;
-+
-+	*phy_id |= (phy_reg & 0xffff);
-+
-+	return 0;
-+}
-+
- static int ar231x_probe(struct platform_device *pdev)
- {
- 	struct net_device *dev;
-@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_
- 
- 	mdiobus_register(sp->mii_bus);
- 
-+	/**
-+	 * Workaround for Micrel switch, which is only available on
-+	 * one PHY and cannot be configured through MDIO.
-+	 */
-+	if (!no_phy) {
-+		u32 phy_id = 0;
-+
-+		get_phy_id(sp->mii_bus, 1, &phy_id);
-+		if (phy_id == 0x00221450)
-+			no_phy = true;
-+	}
-+	if (no_phy) {
-+		sp->link = 1;
-+		netif_carrier_on(dev);
-+		return 0;
-+	}
-+	no_phy = true;
-+
- 	if (ar231x_mdiobus_probe(dev) != 0) {
- 		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
- 		rx_tasklet_cleanup(dev);
-@@ -326,8 +371,10 @@ static int ar231x_remove(struct platform
- 	rx_tasklet_cleanup(dev);
- 	ar231x_init_cleanup(dev);
- 	unregister_netdev(dev);
--	mdiobus_unregister(sp->mii_bus);
--	mdiobus_free(sp->mii_bus);
-+	if (sp->mii_bus) {
-+		mdiobus_unregister(sp->mii_bus);
-+		mdiobus_free(sp->mii_bus);
-+	}
- 	kfree(dev);
- 	return 0;
- }
-@@ -870,7 +917,8 @@ static int ar231x_open(struct net_device
- 
- 	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
- 
--	phy_start(sp->phy_dev);
-+	if (sp->phy_dev)
-+		phy_start(sp->phy_dev);
- 
- 	return 0;
- }
-@@ -951,7 +999,8 @@ static int ar231x_close(struct net_devic
- 
- #endif
- 
--	phy_stop(sp->phy_dev);
-+	if (sp->phy_dev)
-+		phy_stop(sp->phy_dev);
- 
- 	return 0;
- }
-@@ -995,6 +1044,9 @@ static int ar231x_ioctl(struct net_devic
- {
- 	struct ar231x_private *sp = netdev_priv(dev);
- 
-+	if (!sp->phy_dev)
-+		return -ENODEV;
-+
- 	switch (cmd) {
- 	case SIOCGMIIPHY:
- 	case SIOCGMIIREG:
diff --git a/target/linux/ath25/patches-4.14/330-board_leds.patch b/target/linux/ath25/patches-4.14/330-board_leds.patch
deleted file mode 100644
index e357fc6a64..0000000000
--- a/target/linux/ath25/patches-4.14/330-board_leds.patch
+++ /dev/null
@@ -1,116 +0,0 @@
---- a/arch/mips/ath25/ar2315.c
-+++ b/arch/mips/ath25/ar2315.c
-@@ -23,6 +23,7 @@
- #include <linux/reboot.h>
- #include <linux/delay.h>
- #include <linux/gpio.h>
-+#include <linux/leds.h>
- #include <asm/bootinfo.h>
- #include <asm/reboot.h>
- #include <asm/time.h>
-@@ -260,6 +261,50 @@ static struct platform_device ar2315_spi
- 	.num_resources = ARRAY_SIZE(ar2315_spiflash_res)
- };
- 
-+#ifdef CONFIG_LEDS_GPIO
-+static struct gpio_led ar2315_leds[6];
-+static struct gpio_led_platform_data ar2315_led_data = {
-+	.leds = (void *)ar2315_leds,
-+};
-+
-+static struct platform_device ar2315_gpio_leds = {
-+	.name = "leds-gpio",
-+	.id = -1,
-+	.dev = {
-+		.platform_data = (void *)&ar2315_led_data,
-+	}
-+};
-+
-+static void __init ar2315_init_gpio_leds(void)
-+{
-+	static char led_names[6][6];
-+	int i, led = 0;
-+
-+	ar2315_led_data.num_leds = 0;
-+	for (i = 1; i < 8; i++) {
-+		if ((i == AR2315_RESET_GPIO) ||
-+		    (i == ath25_board.config->reset_config_gpio))
-+			continue;
-+
-+		if (i == ath25_board.config->sys_led_gpio)
-+			strcpy(led_names[led], "wlan");
-+		else
-+			sprintf(led_names[led], "gpio%d", i);
-+
-+		ar2315_leds[led].name = led_names[led];
-+		ar2315_leds[led].gpio = i;
-+		ar2315_leds[led].active_low = 0;
-+		led++;
-+	}
-+	ar2315_led_data.num_leds = led;
-+	platform_device_register(&ar2315_gpio_leds);
-+}
-+#else
-+static inline void ar2315_init_gpio_leds(void)
-+{
-+}
-+#endif
-+
- void __init ar2315_init_devices(void)
- {
- 	/* Find board configuration */
-@@ -270,6 +315,8 @@ void __init ar2315_init_devices(void)
- 	ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
- 	platform_device_register(&ar2315_gpio);
- 
-+	ar2315_init_gpio_leds();
-+
- 	ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
- 						     AR2315_MISC_IRQ_WATCHDOG);
- 	ar2315_wdt_res[1].end = ar2315_wdt_res[1].start;
---- a/arch/mips/ath25/ar5312.c
-+++ b/arch/mips/ath25/ar5312.c
-@@ -23,6 +23,7 @@
- #include <linux/mtd/physmap.h>
- #include <linux/reboot.h>
- #include <linux/gpio.h>
-+#include <linux/leds.h>
- #include <asm/bootinfo.h>
- #include <asm/reboot.h>
- #include <asm/time.h>
-@@ -231,6 +232,23 @@ static struct platform_device ar5312_gpi
- 	.num_resources = ARRAY_SIZE(ar5312_gpio_res),
- };
- 
-+#ifdef CONFIG_LEDS_GPIO
-+static struct gpio_led ar5312_leds[] = {
-+	{ .name = "wlan", .gpio = 0, .active_low = 1, },
-+};
-+
-+static const struct gpio_led_platform_data ar5312_led_data = {
-+	.num_leds = ARRAY_SIZE(ar5312_leds),
-+	.leds = (void *)ar5312_leds,
-+};
-+
-+static struct platform_device ar5312_gpio_leds = {
-+	.name = "leds-gpio",
-+	.id = -1,
-+	.dev.platform_data = (void *)&ar5312_led_data,
-+};
-+#endif
-+
- static void __init ar5312_flash_init(void)
- {
- 	void __iomem *flashctl_base;
-@@ -301,6 +319,11 @@ void __init ar5312_init_devices(void)
- 
- 	platform_device_register(&ar5312_gpio);
- 
-+#ifdef CONFIG_LEDS_GPIO
-+	ar5312_leds[0].gpio = config->sys_led_gpio;
-+	platform_device_register(&ar5312_gpio_leds);
-+#endif
-+
- 	/* Fix up MAC addresses if necessary */
- 	if (is_broadcast_ether_addr(config->enet0_mac))
- 		ether_addr_copy(config->enet0_mac, config->enet1_mac);
-- 
2.26.2



From mail at adrianschmutzler.de  Sat Sep  5 03:36:22 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sat, 5 Sep 2020 09:36:22 +0200
Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
In-Reply-To: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
Message-ID: <004201d68357$54184b40$fc48e1c0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Sergey Ryazanov
> Sent: Samstag, 5. September 2020 01:51
> To: OpenWrt Development List <openwrt-devel at lists.openwrt.org>
> Cc: Adrian Schmutzler <mail at adrianschmutzler.de>; Zoltan HERPAI
> <wigyori at uid0.hu>
> Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
> 
> This series returns back ath25 target and switches it to 5.4 kernel.

I will take care, but probably alter the patches so we directly start with
kernel 5.4, and not add back 4.14 just to remove it again.

Which devices are 4 MB flash and need to be disabled?

Best

Adrian

> 
> Discussion in the mailing list revealed that this target still has active
users and
> some boards still have enough Flash/RAM. We are able to upgrade target to
> a fresh kernel and there are no objection against a target recovery. So,
lets
> return the ath25 target back for at least the next release circle.
> 
> Compile- and run-tested with the following boards:
> * D-Link DIR-300 A1 (AR2317)
> * D-Link DWL-2100AP (AR2313)
> 
> Partially tested with Fonera FON2201 (AR2315 based). My single board has
> misteriously bricked during a routine sysupgrade (power issue?). But
> Ethernet and Wi-Fi interfaces were tested and work as expected.
> 
> Sergey Ryazanov (5):
>   Revert "ath25: drop target"
>   ath25: add kernel 5.4 support
>   ath25: eth: fix crash on skb DMA (un-)map
>   ath25: switch to 5.4 kernel
>   ath25: drop 4.14 kernel support
> 
>  package/kernel/mac80211/ath.mk                |   10 +-
>  target/linux/ath25/Makefile                   |   25 +
>  .../ath25/base-files/etc/board.d/01_leds      |   13 +
>  .../ath25/base-files/etc/board.d/02_network   |   28 +
>  .../lib/preinit/15_preinit_iface_atheros      |   34 +
>  .../ath25/base-files/lib/upgrade/platform.sh  |   76 +
>  target/linux/ath25/config-5.4                 |  181 ++
>  target/linux/ath25/image/Makefile             |  115 ++
>  .../ath25/patches-5.4/107-ar5312_gpio.patch   |  212 ++
>  .../ath25/patches-5.4/108-ar2315_gpio.patch   |  363 ++++
>  .../patches-5.4/110-ar2313_ethernet.patch     | 1736 +++++++++++++++++
>  .../ath25/patches-5.4/120-spiflash.patch      |  631 ++++++
>  .../ath25/patches-5.4/130-watchdog.patch      |  277 +++
>  .../patches-5.4/140-redboot_boardconfig.patch |   60 +
>  .../141-redboot_partition_scan.patch          |   44 +
>  .../142-redboot_various_erase_size_fix.patch  |   72 +
>  .../ath25/patches-5.4/210-reset_button.patch  |   71 +
>  .../220-enet_micrel_workaround.patch          |  111 ++
>  .../ath25/patches-5.4/330-board_leds.patch    |  116 ++
>  target/linux/ath25/profiles/00-default.mk     |   16 +
>  20 files changed, 4188 insertions(+), 3 deletions(-)  create mode 100644
> target/linux/ath25/Makefile  create mode 100755 target/linux/ath25/base-
> files/etc/board.d/01_leds
>  create mode 100755 target/linux/ath25/base-files/etc/board.d/02_network
>  create mode 100644 target/linux/ath25/base-
> files/lib/preinit/15_preinit_iface_atheros
>  create mode 100644 target/linux/ath25/base-files/lib/upgrade/platform.sh
>  create mode 100644 target/linux/ath25/config-5.4  create mode 100644
> target/linux/ath25/image/Makefile  create mode 100644
> target/linux/ath25/patches-5.4/107-ar5312_gpio.patch
>  create mode 100644 target/linux/ath25/patches-5.4/108-ar2315_gpio.patch
>  create mode 100644 target/linux/ath25/patches-5.4/110-
> ar2313_ethernet.patch
>  create mode 100644 target/linux/ath25/patches-5.4/120-spiflash.patch
>  create mode 100644 target/linux/ath25/patches-5.4/130-watchdog.patch
>  create mode 100644 target/linux/ath25/patches-5.4/140-
> redboot_boardconfig.patch
>  create mode 100644 target/linux/ath25/patches-5.4/141-
> redboot_partition_scan.patch
>  create mode 100644 target/linux/ath25/patches-5.4/142-
> redboot_various_erase_size_fix.patch
>  create mode 100644 target/linux/ath25/patches-5.4/210-reset_button.patch
>  create mode 100644 target/linux/ath25/patches-5.4/220-
> enet_micrel_workaround.patch
>  create mode 100644 target/linux/ath25/patches-5.4/330-board_leds.patch
>  create mode 100644 target/linux/ath25/profiles/00-default.mk
> 
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From karlp at tweak.net.au  Sat Sep  5 07:58:16 2020
From: karlp at tweak.net.au (Karl Palsson)
Date: Sat, 05 Sep 2020 11:58:16 -0000
Subject: [PATCH 1/2] build: ipkg-build add -r option for all-root
In-Reply-To: <20200904224636.484105-1-mail@aparcar.org>
References: <20200904224636.484105-1-mail@aparcar.org>
Message-ID: <BPUXGHNpUFR8N3FR2KoRQb9Xr3J2SUYiYVZL5wvu2427@mailpile>


Paul Spooren <mail at aparcar.org> wrote:
> 
> diff --git a/scripts/ipkg-build b/scripts/ipkg-build
> index e3a9a882cf..38149c4432 100755
> --- a/scripts/ipkg-build
> +++ b/scripts/ipkg-build
> @@ -1,5 +1,7 @@
>  #!/bin/sh
>  
> +set -x
> +

Do you mean to have this in the patch?

Sincerely,
Karl Palsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP-digital-signature.html
Type: application/pgp-signature
Size: 1175 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200905/896ec6de/attachment.sig>

From mail at david-bauer.net  Sat Sep  5 09:41:47 2020
From: mail at david-bauer.net (David Bauer)
Date: Sat,  5 Sep 2020 15:41:47 +0200
Subject: [PATCH] hostapd: add support for per-BSS airtime configuration
Message-ID: <20200905134147.30997-1-mail@david-bauer.net>

Add support for per-BSS airtime weight configuration. This allows to set
a airtime weight per BSS as well as a ratio limit based on the weight.

Support for this feature is only enabled in the full flavors of hostapd.

Consult the hostapd.conf documentation (Airtime policy configuration)
for more information on the inner workings of the exposed settings.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 package/network/services/hostapd/Makefile            |  2 +-
 .../services/hostapd/files/hostapd-full.config       |  2 +-
 package/network/services/hostapd/files/hostapd.sh    | 12 ++++++++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 5e56a43e9a..8f94dce782 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
index 0ecce423e7..ab9d13aae7 100644
--- a/package/network/services/hostapd/files/hostapd-full.config
+++ b/package/network/services/hostapd/files/hostapd-full.config
@@ -384,7 +384,7 @@ CONFIG_TAXONOMY=y
 #CONFIG_OWE=y
 
 # Airtime policy support
-#CONFIG_AIRTIME_POLICY=y
+CONFIG_AIRTIME_POLICY=y
 
 # Override default value for the wpa_disable_eapol_key_retries configuration
 # parameter. See that parameter in hostapd.conf for more details.
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index fe5b407bc1..dd505f6841 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -110,7 +110,7 @@ hostapd_prepare_device_config() {
 	local base_cfg=
 
 	json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
-		acs_chan_bias local_pwr_constraint spectrum_mgmt_required
+		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode
 
 	hostapd_set_log_options base_cfg
 
@@ -118,6 +118,7 @@ hostapd_prepare_device_config() {
 	set_default spectrum_mgmt_required 0
 	set_default doth 1
 	set_default legacy_rates 1
+	set_default airtime_mode 0
 
 	[ "$hwmode" = "b" ] && legacy_rates=1
 
@@ -164,6 +165,7 @@ hostapd_prepare_device_config() {
 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
 	append base_cfg "beacon_int=$beacon_int" "$N"
 	append base_cfg "dtim_period=$dtim_period" "$N"
+	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
 
 	json_get_values opts hostapd_options
 	for val in $opts; do
@@ -315,7 +317,8 @@ hostapd_set_bss_options() {
 		iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
 		acct_server acct_secret acct_port acct_interval \
 		bss_load_update_period chan_util_avg_period sae_require_mfp \
-		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key
+		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
+		airtime_bss_weight airtime_bss_limit
 
 	set_default isolate 0
 	set_default maxassoc 0
@@ -333,6 +336,8 @@ hostapd_set_bss_options() {
 	set_default chan_util_avg_period 600
 	set_default utf8_ssid 1
 	set_default multi_ap 0
+	set_default airtime_bss_weight 0
+	set_default airtime_bss_limit 0
 
 	append bss_conf "ctrl_interface=/var/run/hostapd"
 	if [ "$isolate" -gt 0 ]; then
@@ -345,6 +350,9 @@ hostapd_set_bss_options() {
 		append bss_conf "ap_max_inactivity=$max_inactivity" "$N"
 	fi
 
+	[ "$airtime_bss_weight" -gt 0 ] && append bss_conf "airtime_bss_weight=$airtime_bss_weight" "$N"
+	[ "$airtime_bss_limit" -gt 0 ] && append bss_conf "airtime_bss_limit=$airtime_bss_limit" "$N"
+
 	append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
 	append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"
 	append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N"
-- 
2.28.0



From jaapbuurman at gmail.com  Sat Sep  5 09:56:51 2020
From: jaapbuurman at gmail.com (Jaap Buurman)
Date: Sat, 5 Sep 2020 15:56:51 +0200
Subject: ramips: ethernet: fix to interrupt handling
In-Reply-To: <CAKxU2N9wc8iDRTBzzHKQ63nnpCwWyHaek+VWMj74M1_O+1=W2g@mail.gmail.com>
References: <CAN-r--ng9R_0SG06Q=6PsHtcgV882nPWbuV7=GP6An4rg9=Hkg@mail.gmail.com>
 <CAKxU2N9wc8iDRTBzzHKQ63nnpCwWyHaek+VWMj74M1_O+1=W2g@mail.gmail.com>
Message-ID: <CAN-r--=hLeY342aoC_CF9hF-fcBL8FbBfsmdVaBNQc9zKnMpCw@mail.gmail.com>

Dear Rosen,

On Fri, Sep 4, 2020 at 10:50 PM Rosen Penev <rosenp at gmail.com> wrote:
>
> On Fri, Sep 4, 2020 at 7:01 AM Jaap Buurman <jaapbuurman at gmail.com> wrote:
> >
> > Dear all,
> >
> > Is there a reason the "ramips: ethernet: fix to interrupt handling"
> > patch never was included in the master branch or 19.07 branch?:
> >
> > https://patchwork.ozlabs.org/project/openwrt/patch/20191029172328.85861-2-rosenp at gmail.com/
> I doubt anyone cares. That patch was never merged. The issue was
> "avoided" by switching drivers.

That's very unfortunate to hear, since the 19.07 branch (which doesn't
use the dsa drivers) is still the latest stable branch and used a lot,
especially since the patch is already available and only needs to be
merged.

> >
> > There are many interrupt errors on my mt7621 device, and there have
> > been reports that this patch brings those errors massively down or
> > even eliminates them all together.
> https://github.com/openwrt/openwrt/commit/b5d425af237dc03327078d6b9be178a38b5f8723
> is very interesting in that regard. Some of those patches can be
> backported I think.

I have seen these as well. I haven't had time yet to test these, but I
am hoping these fix the transmit queue has timed out that has plagued
mt7621 for a very long time now. Fingers crossed!

> >
> > Yours sincerely,
> >
> > Jaap
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Kind regards,

Jaap


From mschiffer at universe-factory.net  Sat Sep  5 10:08:38 2020
From: mschiffer at universe-factory.net (Matthias Schiffer)
Date: Sat, 5 Sep 2020 16:08:38 +0200
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>
References: <20200903230011.38291-1-mail@david-bauer.net>
 <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
 <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>
Message-ID: <9a5e1123-5e1a-9cf1-3c4f-2a23c645e1a2@universe-factory.net>

On 9/5/20 1:11 AM, David Bauer wrote:
> Hi Alexey,
> 
> On 9/4/20 10:32 PM, Alexey Dobrovolskiy wrote:
>> Hi,
>> please, see also
>> https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/
> 
> I was not aware of this patch. Will merge yours in the coming days.
> 
> Best wishes
> David


Maybe we could replace "postrouting" and similiar strings with abbreviated
versions?

Kind regards,
Matthias



> 
>>
>> Best regards,
>> Alexey
>>
>> ??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>>>
>>> Previously the max length of a zone name was assuming the max
>>> length for a extension in netfilter is 32 bytes while in reality it is
>>> only 29.
>>>
>>> Fix this incorrect assumption to allow firewall3 to validate the zone
>>> name lengths correctly.
>>>
>>> Signed-off-by: David Bauer <mail at david-bauer.net>
>>> ---
>>>  zones.h | 8 ++++++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/zones.h b/zones.h
>>> index d786736..beb0e22 100644
>>> --- a/zones.h
>>> +++ b/zones.h
>>> @@ -22,8 +22,12 @@
>>>  #include "options.h"
>>>  #include "iptables.h"
>>>
>>> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
>>> -#define FW3_ZONE_MAXNAMELEN 14
>>> +/* XT_EXTENSION_MAXNAMELEN (29)
>>> + *  - sizeof("postrouting_")
>>> + *  - sizeof("_rule")
>>> + *  - sizeof("\0")
>>> + */
>>> +#define FW3_ZONE_MAXNAMELEN 11
>>>
>>>  extern const struct fw3_option fw3_zone_opts[];
>>>
>>> --
>>> 2.28.0
>>>
>>>
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200905/446b6c71/attachment-0001.sig>

From mail at david-bauer.net  Sat Sep  5 10:32:13 2020
From: mail at david-bauer.net (David Bauer)
Date: Sat, 5 Sep 2020 16:32:13 +0200
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <9a5e1123-5e1a-9cf1-3c4f-2a23c645e1a2@universe-factory.net>
References: <20200903230011.38291-1-mail@david-bauer.net>
 <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
 <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>
 <9a5e1123-5e1a-9cf1-3c4f-2a23c645e1a2@universe-factory.net>
Message-ID: <006b713c-ca56-9179-6dfb-6de34d6efc9c@david-bauer.net>

Hi Matthias,

On 9/5/20 4:08 PM, Matthias Schiffer wrote:
> On 9/5/20 1:11 AM, David Bauer wrote:
>> Hi Alexey,
>>
>> On 9/4/20 10:32 PM, Alexey Dobrovolskiy wrote:
>>> Hi,
>>> please, see also
>>> https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/
>>
>> I was not aware of this patch. Will merge yours in the coming days.
>>
>> Best wishes
>> David
> 
> 
> Maybe we could replace "postrouting" and similiar strings with abbreviated
> versions?

>From my perspective this should be possible. However, postrouting might not be
the primary limiting factor then, as there are also chains such as
"zone_<zonename>_dest_REJECT" automatically created. Sure enough, these can
also be renamed.

Best wishes
David

> 
> Kind regards,
> Matthias
> 
> 
> 
>>
>>>
>>> Best regards,
>>> Alexey
>>>
>>> ??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>>>>
>>>> Previously the max length of a zone name was assuming the max
>>>> length for a extension in netfilter is 32 bytes while in reality it is
>>>> only 29.
>>>>
>>>> Fix this incorrect assumption to allow firewall3 to validate the zone
>>>> name lengths correctly.
>>>>
>>>> Signed-off-by: David Bauer <mail at david-bauer.net>
>>>> ---
>>>>  zones.h | 8 ++++++--
>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/zones.h b/zones.h
>>>> index d786736..beb0e22 100644
>>>> --- a/zones.h
>>>> +++ b/zones.h
>>>> @@ -22,8 +22,12 @@
>>>>  #include "options.h"
>>>>  #include "iptables.h"
>>>>
>>>> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
>>>> -#define FW3_ZONE_MAXNAMELEN 14
>>>> +/* XT_EXTENSION_MAXNAMELEN (29)
>>>> + *  - sizeof("postrouting_")
>>>> + *  - sizeof("_rule")
>>>> + *  - sizeof("\0")
>>>> + */
>>>> +#define FW3_ZONE_MAXNAMELEN 11
>>>>
>>>>  extern const struct fw3_option fw3_zone_opts[];
>>>>
>>>> --
>>>> 2.28.0
>>>>
>>>>
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel at lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
> 
> 


From mschiffer at universe-factory.net  Sat Sep  5 10:45:45 2020
From: mschiffer at universe-factory.net (Matthias Schiffer)
Date: Sat, 5 Sep 2020 16:45:45 +0200
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <006b713c-ca56-9179-6dfb-6de34d6efc9c@david-bauer.net>
References: <20200903230011.38291-1-mail@david-bauer.net>
 <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
 <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>
 <9a5e1123-5e1a-9cf1-3c4f-2a23c645e1a2@universe-factory.net>
 <006b713c-ca56-9179-6dfb-6de34d6efc9c@david-bauer.net>
Message-ID: <a71ddb32-3f3f-b905-11b2-993562fbde1d@universe-factory.net>

On 9/5/20 4:32 PM, David Bauer wrote:
> Hi Matthias,
> 
> On 9/5/20 4:08 PM, Matthias Schiffer wrote:
>> On 9/5/20 1:11 AM, David Bauer wrote:
>>> Hi Alexey,
>>>
>>> On 9/4/20 10:32 PM, Alexey Dobrovolskiy wrote:
>>>> Hi,
>>>> please, see also
>>>> https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/
>>>
>>> I was not aware of this patch. Will merge yours in the coming days.
>>>
>>> Best wishes
>>> David
>>
>>
>> Maybe we could replace "postrouting" and similiar strings with abbreviated
>> versions?
> 
> From my perspective this should be possible. However, postrouting might not be
> the primary limiting factor then, as there are also chains such as
> "zone_<zonename>_dest_REJECT" automatically created. Sure enough, these can
> also be renamed.
> 
> Best wishes
> David
> 

I wonder which solution will break more configurations... keeping the
current names, breaking zones with longer names, or renaming them, breaking
custom rulesets that rely on the current naming.



>>
>> Kind regards,
>> Matthias
>>
>>
>>
>>>
>>>>
>>>> Best regards,
>>>> Alexey
>>>>
>>>> ??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>>>>>
>>>>> Previously the max length of a zone name was assuming the max
>>>>> length for a extension in netfilter is 32 bytes while in reality it is
>>>>> only 29.
>>>>>
>>>>> Fix this incorrect assumption to allow firewall3 to validate the zone
>>>>> name lengths correctly.
>>>>>
>>>>> Signed-off-by: David Bauer <mail at david-bauer.net>
>>>>> ---
>>>>>  zones.h | 8 ++++++--
>>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/zones.h b/zones.h
>>>>> index d786736..beb0e22 100644
>>>>> --- a/zones.h
>>>>> +++ b/zones.h
>>>>> @@ -22,8 +22,12 @@
>>>>>  #include "options.h"
>>>>>  #include "iptables.h"
>>>>>
>>>>> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
>>>>> -#define FW3_ZONE_MAXNAMELEN 14
>>>>> +/* XT_EXTENSION_MAXNAMELEN (29)
>>>>> + *  - sizeof("postrouting_")
>>>>> + *  - sizeof("_rule")
>>>>> + *  - sizeof("\0")
>>>>> + */
>>>>> +#define FW3_ZONE_MAXNAMELEN 11
>>>>>
>>>>>  extern const struct fw3_option fw3_zone_opts[];
>>>>>
>>>>> --
>>>>> 2.28.0
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> openwrt-devel mailing list
>>>>> openwrt-devel at lists.openwrt.org
>>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>
>>
>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200905/5c7dd781/attachment.sig>

From paul at oranjevos.nl  Sat Sep  5 14:14:42 2020
From: paul at oranjevos.nl (Paul Oranje)
Date: Sat, 5 Sep 2020 20:14:42 +0200
Subject: [PATCH] util-linux: fix build when libmagic is present
In-Reply-To: <CAKxU2N_r=8QUNGqLvL+3bDo6_JrRmh+JiQjzerU7e9iQ1ZY=TQ@mail.gmail.com>
References: <20200901223703.785743-1-rosenp@gmail.com>
 <20200904062927.GB7414@meh.true.cz>
 <CAKxU2N_r=8QUNGqLvL+3bDo6_JrRmh+JiQjzerU7e9iQ1ZY=TQ@mail.gmail.com>
Message-ID: <476E4491-0EEB-49F8-A109-0C395D2109C8@oranjevos.nl>

Op 4 sep. 2020, om 09:03 heeft Rosen Penev <rosenp at gmail.com> het volgende geschreven:
> 
> On Thu, Sep 3, 2020 at 11:29 PM Petr ?tetiar <ynezz at true.cz> wrote:
>> 
>> Rosen Penev <rosenp at gmail.com> [2020-09-01 15:37:03]:
>> 
>> From https://openwrt.org/submitting-patches, section about commit description:
>> 
>> "it will be committed to the source changelog, so it should explain to a
>>  competent reader why you made this commit.  Include symptoms of the failure
>>  you are fixing (log messages, error messages, etc.), it will be useful for
>>  people searching the commit logs looking for a fix for their issue.  If a
>>  patch fixes a compile failure, include only the most relevant part of the
>>  failure log"
> Hahaha I don't think so.
This is truly provocative.
As you produce astounding amounts of patches - so many it becomes almost inconceivable that one person only can produce that many - some polite criticism must be taken seriously. This does not feel right.

Regards from a bystander,
Paul

>> 
>> Thanks.
>> 
>>> Signed-off-by: Rosen Penev <rosenp at gmail.com>
>>> ---
>>> package/utils/util-linux/Makefile | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile
>>> index 0fc9819c58..05ceaa413e 100644
>>> --- a/package/utils/util-linux/Makefile
>>> +++ b/package/utils/util-linux/Makefile
>>> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>>> 
>>> PKG_NAME:=util-linux
>>> PKG_VERSION:=2.36
>>> -PKG_RELEASE:=1
>>> +PKG_RELEASE:=2
>>> 
>>> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>>> PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
>>> @@ -526,6 +526,7 @@ CONFIGURE_ARGS += \
>>>      --without-python                \
>>>      --without-udev                  \
>>>      --without-readline              \
>>> +     --without-libmagic              \
>>>      --with-ncursesw
>>> 
>>> TARGET_CFLAGS += $(FPIC) -std=gnu99
>>> --
>>> 2.26.2
>>> 
>>> 
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>> 
>> 
>> --
>> ynezz
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From mail at david-bauer.net  Sat Sep  5 15:52:43 2020
From: mail at david-bauer.net (David Bauer)
Date: Sat, 5 Sep 2020 21:52:43 +0200
Subject: [PATCH] zones: fix max length of zone names
In-Reply-To: <a71ddb32-3f3f-b905-11b2-993562fbde1d@universe-factory.net>
References: <20200903230011.38291-1-mail@david-bauer.net>
 <CANCYDrw=N=RDjXDyhtwMt5utW7sa1+fdRWS2KxYpNrboMr+m9w@mail.gmail.com>
 <037ee7d1-800b-214f-8238-4814b34437e4@david-bauer.net>
 <9a5e1123-5e1a-9cf1-3c4f-2a23c645e1a2@universe-factory.net>
 <006b713c-ca56-9179-6dfb-6de34d6efc9c@david-bauer.net>
 <a71ddb32-3f3f-b905-11b2-993562fbde1d@universe-factory.net>
Message-ID: <23eff67c-4738-1e3f-226e-1b79460230b4@david-bauer.net>

Hello Matthias,

On 9/5/20 4:45 PM, Matthias Schiffer wrote:
> On 9/5/20 4:32 PM, David Bauer wrote:
>> Hi Matthias,
>>
>> On 9/5/20 4:08 PM, Matthias Schiffer wrote:
>>> On 9/5/20 1:11 AM, David Bauer wrote:
>>>> Hi Alexey,
>>>>
>>>> On 9/4/20 10:32 PM, Alexey Dobrovolskiy wrote:
>>>>> Hi,
>>>>> please, see also
>>>>> https://patchwork.ozlabs.org/project/openwrt/patch/20200830211009.3359-1-dobrovolskiy.alexey at gmail.com/
>>>>
>>>> I was not aware of this patch. Will merge yours in the coming days.
>>>>
>>>> Best wishes
>>>> David
>>>
>>>
>>> Maybe we could replace "postrouting" and similiar strings with abbreviated
>>> versions?
>>
>> From my perspective this should be possible. However, postrouting might not be
>> the primary limiting factor then, as there are also chains such as
>> "zone_<zonename>_dest_REJECT" automatically created. Sure enough, these can
>> also be renamed.
>>
>> Best wishes
>> David
>>
> 
> I wonder which solution will break more configurations... keeping the
> current names, breaking zones with longer names, or renaming them, breaking
> custom rulesets that rely on the current naming.

The patch in this thread effectively only fixes the validation. Commiting the iptables rules
with long names failed already previously with the safer string operations patch from jow.

So this patch does not break these longer names as they are currently already broken, just
provides the user with a clearer error message.

Best wishes
David

> 
> 
> 
>>>
>>> Kind regards,
>>> Matthias
>>>
>>>
>>>
>>>>
>>>>>
>>>>> Best regards,
>>>>> Alexey
>>>>>
>>>>> ??, 4 ????. 2020 ?. ? 02:02, David Bauer <mail at david-bauer.net>:
>>>>>>
>>>>>> Previously the max length of a zone name was assuming the max
>>>>>> length for a extension in netfilter is 32 bytes while in reality it is
>>>>>> only 29.
>>>>>>
>>>>>> Fix this incorrect assumption to allow firewall3 to validate the zone
>>>>>> name lengths correctly.
>>>>>>
>>>>>> Signed-off-by: David Bauer <mail at david-bauer.net>
>>>>>> ---
>>>>>>  zones.h | 8 ++++++--
>>>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/zones.h b/zones.h
>>>>>> index d786736..beb0e22 100644
>>>>>> --- a/zones.h
>>>>>> +++ b/zones.h
>>>>>> @@ -22,8 +22,12 @@
>>>>>>  #include "options.h"
>>>>>>  #include "iptables.h"
>>>>>>
>>>>>> -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
>>>>>> -#define FW3_ZONE_MAXNAMELEN 14
>>>>>> +/* XT_EXTENSION_MAXNAMELEN (29)
>>>>>> + *  - sizeof("postrouting_")
>>>>>> + *  - sizeof("_rule")
>>>>>> + *  - sizeof("\0")
>>>>>> + */
>>>>>> +#define FW3_ZONE_MAXNAMELEN 11
>>>>>>
>>>>>>  extern const struct fw3_option fw3_zone_opts[];
>>>>>>
>>>>>> --
>>>>>> 2.28.0
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> openwrt-devel mailing list
>>>>>> openwrt-devel at lists.openwrt.org
>>>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>>
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel at lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>>
>>>
>>>
> 
> 


From chunkeey at gmail.com  Sat Sep  5 18:25:01 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun, 6 Sep 2020 00:25:01 +0200
Subject: MR24 wifi broken by recent commit
In-Reply-To: <87tuwev9me.fsf@husum.ptp>
References: <CAHP3WfP1s6oWZRgrg5mMY1MdiaFzhAS3_yfTBAXumo8jst6=gg@mail.gmail.com>
 <b234aabe-a65d-aa12-a8ef-42cc5f7fc28d@gmail.com> <87tuwev9me.fsf@husum.ptp>
Message-ID: <0ba6956e-55e7-30c5-642c-08ec71524b64@gmail.com>

Almost lost this in the spam-folder :( .

On 2020-09-03 23:22, Russell Senior wrote:
>>>>>> Christian Lamparter <chunkeey at gmail.com> writes:
> 
>> On 2020-09-03 10:44, Russell Senior wrote:
>>> commit 9153955095f01a7ac5f2659a671f0229cbad3507 Author: Christian
>>> Lamparter <chunkeey at gmail.com <mailto:chunkeey at gmail.com>> Date:
>>> Wed Aug 12 18:26:43 2020 +0200
>>>
>>>  ? ? apm821xx: MR24: enumerate PCIe in device-tree
>>>
>>>  ? ? This patch adds the pcie-switch and bridge configuration for
>>> the Meraki MR24.
>>>
>>>  ? ? Signed-off-by: Christian Lamparter <chunkeey at gmail.com
>>> <mailto:chunkeey at gmail.com>>
>>>
>>> The symptom is client devices can't see the beacons. Wifi ifaces
>>> appear, can scan and hear other networks, but clients can't see the
>>> MR24's SSIDs. Reverting the commit above and it works normally again.
> 
>> Thanks for the report. CONFIG_PCI_DEBUG
> 
> 
> 
>> "ath9k 0000:44:00.0: runtime IRQ mapping not provided by arch"
> 
> 
> 
>> since DT overwrites the usual PCI(e) enumeration and MSI(x) is
> 
>> busted there's no choice but to specify legacy INTABCDs.
> 
> 
>> Can you please try the attached patch?
> 
> Your patch fixes it.
> 
> I am a little curious, if it works without your commit, what is the
> motivation for the commit?
> 

APM82181 needs to move forward. I'm trying to upstream these devices.
Since nobody is commenting on linux-ppcdev, I have to spin the wheels
and preemptively spif-things up from version to version.

In the end, I'm hoping to avoid smart questions about:
"hey, why does this dual-band accesspoint device of yours not define a
single wifi-device in the DT? Like is this even working or what?"

You could tell the linux-ppcdev about your experience with the MR24
by replying to the latest v3 series:
<https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-September/217642.html>

Cheers,
Christian


From ryazanov.s.a at gmail.com  Sat Sep  5 18:39:30 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sun, 6 Sep 2020 01:39:30 +0300
Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
In-Reply-To: <004201d68357$54184b40$fc48e1c0$@adrianschmutzler.de>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
 <004201d68357$54184b40$fc48e1c0$@adrianschmutzler.de>
Message-ID: <CAHNKnsQ5mTLgj6YRGBeM07MGd81Fg7oY5DfgQ5zwdAENroPNOw@mail.gmail.com>

On Sat, Sep 5, 2020 at 10:36 AM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
> > This series returns back ath25 target and switches it to 5.4 kernel.
>
> I will take care, but probably alter the patches so we directly start with
> kernel 5.4, and not add back 4.14 just to remove it again.

Sure. But specify the commit which drops ath25 target with 4.14 kernel
in a commit message, please. So, history readers will be aware of
reasons of history interruption and where history is continued.

-- 
Sergey


From chunkeey at gmail.com  Sat Sep  5 18:50:27 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:27 +0200
Subject: [PATCH v2 2/7] build: define PWM_SUPPORT arch feature flag
In-Reply-To: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
Message-ID: <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>

As the PWM has its own sub-system in the Linux kernel,
I think it should be handled in the same way as GPIO, RTC, PCI...

This patch introduces a specific feature flag "pwm" and the
"leds-pwm" kernel module as the first customer.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/kernel/linux/modules/leds.mk | 16 ++++++++++++++++
 scripts/target-metadata.pl           |  1 +
 target/Config.in                     |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk
index c030b54b39..fe90c6b559 100644
--- a/package/kernel/linux/modules/leds.mk
+++ b/package/kernel/linux/modules/leds.mk
@@ -159,3 +159,19 @@ define KernelPackage/leds-pca963x/description
 endef
 
 $(eval $(call KernelPackage,leds-pca963x))
+
+
+define KernelPackage/leds-pwm
+  SUBMENU:=$(LEDS_MENU)
+  TITLE:=PWM driven LED Support
+  KCONFIG:=CONFIG_LEDS_PWM
+  DEPENDS:= @PWM_SUPPORT
+  FILES:=$(LINUX_DIR)/drivers/leds/leds-pwm.ko
+  AUTOLOAD:=$(call AutoLoad,60,leds-pwm,1)
+endef
+
+define KernelPackage/leds-pwm/description
+ This option enables support for pwm driven LEDs
+endef
+
+$(eval $(call KernelPackage,leds-pwm))
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index c58f096573..bf6413d315 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -20,6 +20,7 @@ sub target_config_features(@) {
 		/^usb$/ and $ret .= "\tselect USB_SUPPORT\n";
 		/^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n";
 		/^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
+		/^pwm$/ and $ret .= "\select PWM_SUPPORT\n";
 		/^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n";
 		/^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n";
 		/^jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
diff --git a/target/Config.in b/target/Config.in
index 9fead5994f..43de4710df 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -29,6 +29,9 @@ config PCIE_SUPPORT
 config PCMCIA_SUPPORT
 	bool
 
+config PWM_SUPPORT
+	bool
+
 config USB_SUPPORT
 	select AUDIO_SUPPORT
 	bool
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:26 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:26 +0200
Subject: [PATCH v2 1/7] scripts: mkits.sh make it possible to specify fdt@#
Message-ID: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>

Some bootloaders are really keen on just one special
fdt in a multi-image fit image. This is a problem, because
currently this is fixed to "fdt at 1".

This patch introduces a new device variable:
DEVICE_FDT_NUM that allows to specify the right
fdt number.

If the value is absent "1" will be chosen.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 include/image-commands.mk |  1 +
 include/image.mk          |  6 ++++--
 scripts/mkits.sh          | 12 ++++++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 9516801c8d..740d627fc7 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -158,6 +158,7 @@ define Build/fit
 		-D $(DEVICE_NAME) -o $@.its -k $@ \
 		$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
 		-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+		$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
 		-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config at 1") \
 		-A $(LINUX_KARCH) -v $(LINUX_VERSION)
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
diff --git a/include/image.mk b/include/image.mk
index 703aeb6816..a1308f47ad 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -432,6 +432,7 @@ define Device/Init
   DEVICE_DTS :=
   DEVICE_DTS_CONFIG :=
   DEVICE_DTS_DIR :=
+  DEVICE_FDT_NUM :=
   SOC :=
 
   BOARD_NAME :=
@@ -453,8 +454,9 @@ DEFAULT_DEVICE_VARS := \
   DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
-  DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \
-  IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \
+  DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \
+  UIMAGE_NAME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
+  UBOOT_PATH IMAGE_SIZE \
   DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
   DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
   DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 468ef670e6..bb629d6fca 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -16,7 +16,7 @@
 
 usage() {
 	printf "Usage: %s -A arch -C comp -a addr -e entry" "$(basename "$0")"
-	printf " -v version -k kernel [-D name -d dtb] -o its_file"
+	printf " -v version -k kernel [-D name -n address -d dtb] -o its_file"
 
 	printf "\n\t-A ==> set architecture to 'arch'"
 	printf "\n\t-C ==> set compression type 'comp'"
@@ -26,12 +26,15 @@ usage() {
 	printf "\n\t-v ==> set kernel version to 'version'"
 	printf "\n\t-k ==> include kernel image 'kernel'"
 	printf "\n\t-D ==> human friendly Device Tree Blob 'name'"
+	printf "\n\t-n ==> fdt unit-address 'address'"
 	printf "\n\t-d ==> include Device Tree Blob 'dtb'"
 	printf "\n\t-o ==> create output file 'its_file'\n"
 	exit 1
 }
 
-while getopts ":A:a:c:C:D:d:e:k:o:v:" OPTION
+FDTNUM=1
+
+while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION
 do
 	case $OPTION in
 		A ) ARCH=$OPTARG;;
@@ -42,6 +45,7 @@ do
 		d ) DTB=$OPTARG;;
 		e ) ENTRY_ADDR=$OPTARG;;
 		k ) KERNEL=$OPTARG;;
+		n ) FDTNUM=$OPTARG;;
 		o ) OUTPUT=$OPTARG;;
 		v ) VERSION=$OPTARG;;
 		* ) echo "Invalid option passed to '$0' (options:$*)"
@@ -61,7 +65,7 @@ ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]')
 # Conditionally create fdt information
 if [ -n "${DTB}" ]; then
 	FDT_NODE="
-		fdt at 1 {
+		fdt@$FDTNUM {
 			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
 			data = /incbin/(\"${DTB}\");
 			type = \"flat_dt\";
@@ -75,7 +79,7 @@ if [ -n "${DTB}" ]; then
 			};
 		};
 "
-	FDT_PROP="fdt = \"fdt at 1\";"
+	FDT_PROP="fdt = \"fdt@$FDTNUM\";"
 fi
 
 # Create a default, fully populated DTS file
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:29 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:29 +0200
Subject: [PATCH v2 4/7] bcm53xx: backport uart2 and pcie2 device-nodes
In-Reply-To: <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
 <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
 <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>
Message-ID: <e3475844cf2cb9f0aee99ae9f178de1c187f7acb.1599346205.git.chunkeey@gmail.com>

These have made their way into -next.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 ...dts-BCM5301X-Specify-uart2-in-the-DT.patch | 37 +++++++++++++++++++
 ...dts-BCM5301X-Specify-pcie2-in-the-DT.patch | 33 +++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch

diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
new file mode 100644
index 0000000000..1fec981146
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
@@ -0,0 +1,37 @@
+From 95c1f0076303922ca401851b6605dc17eb0eb732 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Wed, 6 Jun 2018 21:57:15 +0200
+Subject: [PATCH 1/4] ARM: dts: BCM5301X: Specify uart2 in the DT
+
+The BCM53016 in the Meraki MR32 utilizes the third "uart2"
+to connect to a on-board Bluetooth-LE 4.0 BCM20732 chip.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi
+index 45cd8c7411dd..eb1290fed235 100644
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -392,6 +392,15 @@ usb3_dmp: syscon at 18105000 {
+ 		reg = <0x18105000 0x1000>;
+ 	};
+ 
++	uart2: serial at 18008000 {
++		compatible = "ns16550a";
++		reg = <0x18008000 0x20>;
++		clocks = <&iprocslow>;
++		interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
++		reg-shift = <2>;
++		status = "disabled";
++	};
++
+ 	i2c0: i2c at 18009000 {
+ 		compatible = "brcm,iproc-i2c";
+ 		reg = <0x18009000 0x50>;
+-- 
+2.28.0
+
diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
new file mode 100644
index 0000000000..d4ec31c0ae
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
@@ -0,0 +1,33 @@
+From 5abb709b027a6234c135843764bad383be264162 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sun, 10 Jun 2018 17:17:53 +0200
+Subject: [PATCH 2/4] ARM: dts: BCM5301X: Specify pcie2 in the DT
+
+The SoC supports three pcie ports. Currently, only
+pcie0 and pcie1 are enabled. This patch adds the
+pcie2 port as well.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+---
+ arch/arm/boot/dts/bcm5301x.dtsi | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi
+index eb1290fed235..9d9e8fe3f6ae 100644
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -252,6 +252,10 @@ pcie1: pcie at 13000 {
+ 			reg = <0x00013000 0x1000>;
+ 		};
+ 
++		pcie2: pcie at 14000 {
++			reg = <0x00014000 0x1000>;
++		};
++
+ 		usb2: usb2 at 21000 {
+ 			reg = <0x00021000 0x1000>;
+ 
+-- 
+2.28.0
+
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:28 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:28 +0200
Subject: [PATCH v2 3/7] bcm53xx: enable PWM for bcm53xx
In-Reply-To: <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
 <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
Message-ID: <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>

The Meraki MR32 (BCM53016A1) uses the pwm to drive the
tricolor LED. The driver has been available in upstream
for a long time. Only the Device-Tree definition was
missing, but it has been queued recently.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/bcm53xx/Makefile                 |  2 +-
 target/linux/bcm53xx/config-5.4               |  3 ++
 ...M-dts-BCM5301X-Specify-PWM-in-the-DT.patch | 45 +++++++++++++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch

diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
index 35f8513801..f980f8a8fb 100644
--- a/target/linux/bcm53xx/Makefile
+++ b/target/linux/bcm53xx/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=bcm53xx
 BOARDNAME:=Broadcom BCM47xx/53xx (ARM)
-FEATURES:=squashfs nand usb pci pcie gpio
+FEATURES:=squashfs nand usb pci pcie gpio pwm
 CPU_TYPE:=cortex-a9
 SUBTARGETS:=generic
 
diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4
index eacfcb620e..8c7cdf45d5 100644
--- a/target/linux/bcm53xx/config-5.4
+++ b/target/linux/bcm53xx/config-5.4
@@ -308,6 +308,9 @@ CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_IPROC_GPIO is not set
 CONFIG_PINCTRL_NS=y
 # CONFIG_PINCTRL_NS2_MUX is not set
+CONFIG_PWM=y
+CONFIG_PWM_BCM_IPROC=y
+CONFIG_PWM_SYSFS=y
 CONFIG_RATIONAL=y
 CONFIG_RCU_NEED_SEGCBLIST=y
 CONFIG_RCU_STALL_COMMON=y
diff --git a/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
new file mode 100644
index 0000000000..d7b871bde4
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
@@ -0,0 +1,45 @@
+From 9bd34833986d4af180c6d75a326edb933a17de31 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Wed, 6 Jun 2018 21:01:59 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify PWM in the DT
+
+The BCM53016 in the Meraki MR32 uses the on-chip PWM
+controller to drive a tri-color RGB LED. Since I plan
+to use the PWM, I made a label for the pwm's pinmux
+node. This way, it can be easily referenced.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Acked-by: Scott Branden <scott.branden at broadcom.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -350,6 +350,14 @@
+ 		};
+ 	};
+ 
++	pwm: pwm at 18002000 {
++		compatible = "brcm,iproc-pwm";
++		reg = <0x18002000 0x28>;
++		clocks = <&osc>;
++		#pwm-cells = <3>;
++		status = "disabled";
++	};
++
+ 	mdio: mdio at 18003000 {
+ 		compatible = "brcm,iproc-mdio";
+ 		reg = <0x18003000 0x8>;
+@@ -417,12 +425,12 @@
+ 					function = "spi";
+ 				};
+ 
+-				i2c {
++				pinmux_i2c: i2c {
+ 					groups = "i2c_grp";
+ 					function = "i2c";
+ 				};
+ 
+-				pwm {
++				pinmux_pwm: pwm {
+ 					groups = "pwm0_grp", "pwm1_grp",
+ 						 "pwm2_grp", "pwm3_grp";
+ 					function = "pwm";
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:30 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:30 +0200
Subject: [PATCH v2 5/7] kernel: add default for new config symbols
In-Reply-To: <e3475844cf2cb9f0aee99ae9f178de1c187f7acb.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
 <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
 <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>
 <e3475844cf2cb9f0aee99ae9f178de1c187f7acb.1599346205.git.chunkeey@gmail.com>
Message-ID: <1e220a910a1a9b63fd643116b760094aadd75167.1599346205.git.chunkeey@gmail.com>

Provide disabled defaults for I2C_SLAVE_EEPROM and IPMB_DEVICE_INTERFACE.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/generic/config-5.4 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index d543819aad..2f5ab98d26 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -2134,6 +2134,7 @@ CONFIG_HW_RANDOM_TPM=y
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
 # CONFIG_I2C_SLAVE is not set
+# CONFIG_I2C_SLAVE_EEPROM is not set
 # CONFIG_I2C_SMBUS is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TAOS_EVM is not set
@@ -2394,6 +2395,7 @@ CONFIG_IO_STRICT_DEVMEM=y
 # CONFIG_IP6_NF_TARGET_SYNPROXY is not set
 # CONFIG_IPACK_BUS is not set
 # CONFIG_IPC_NS is not set
+# CONFIG_IPMB_DEVICE_INTERFACE is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_IPV6 is not set
 # CONFIG_IPV6_FOU is not set
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:31 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:31 +0200
Subject: [PATCH v2 6/7] kernel: package bcm53xx i2c module
In-Reply-To: <1e220a910a1a9b63fd643116b760094aadd75167.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
 <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
 <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>
 <e3475844cf2cb9f0aee99ae9f178de1c187f7acb.1599346205.git.chunkeey@gmail.com>
 <1e220a910a1a9b63fd643116b760094aadd75167.1599346205.git.chunkeey@gmail.com>
Message-ID: <33189a16492ead50ec5938124ea0c8556a5ab930.1599346205.git.chunkeey@gmail.com>

The BCM5301x SoCs do have i2c. Since this is only
being used by the Meraki MR32, this will be packaged
as a module.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/kernel/linux/modules/i2c.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk
index ca6463c81b..1c8b1b844e 100644
--- a/package/kernel/linux/modules/i2c.mk
+++ b/package/kernel/linux/modules/i2c.mk
@@ -259,3 +259,17 @@ endef
 $(eval $(call KernelPackage,i2c-tiny-usb))
 
 
+I2C_BCM_IPROC_MODULES:= \
+  CONFIG_I2C_BCM_IPROC:drivers/i2c/busses/i2c-bcm-iproc
+
+define KernelPackage/i2c-bcm-iproc
+  $(call i2c_defaults,$(I2C_BCM_IPROC_MODULES),59)
+  TITLE:=Broadcom iProc I2C controller
+  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core
+endef
+
+define KernelPackage/i2c-bcm-iproc/description
+ Kernel module for the Broadcom iProc I2C controller.
+endef
+
+$(eval $(call KernelPackage,i2c-bcm-iproc))
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep  5 18:50:32 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun,  6 Sep 2020 00:50:32 +0200
Subject: [PATCH v2 7/7] bcm53xx: add Cisco Meraki MR32
In-Reply-To: <33189a16492ead50ec5938124ea0c8556a5ab930.1599346205.git.chunkeey@gmail.com>
References: <e9e07587efbea0c9bb3006b852688cef7b2f7d7f.1599346205.git.chunkeey@gmail.com>
 <d1c81fa336e061ce140c4c1178243977599dcb3c.1599346205.git.chunkeey@gmail.com>
 <ad38f258ecdb8e29d92f623f597e5d7c0f5b7a94.1599346205.git.chunkeey@gmail.com>
 <e3475844cf2cb9f0aee99ae9f178de1c187f7acb.1599346205.git.chunkeey@gmail.com>
 <1e220a910a1a9b63fd643116b760094aadd75167.1599346205.git.chunkeey@gmail.com>
 <33189a16492ead50ec5938124ea0c8556a5ab930.1599346205.git.chunkeey@gmail.com>
Message-ID: <c647ad56b4adb449cd448a2bc56d58058fd06e6f.1599346205.git.chunkeey@gmail.com>

This patch adds support for Cisco Meraki MR32.
The unit was donated by Chris Blake. Thank you!

WARNING:
Only the 1x1:1 abgn Air Marshal WIPS wifi is currently supported by b43:
 b43-phy2: Found PHY: Analog 9, Type 4 (N), Revision 16
 b43-phy2: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1
 b43-phy2: Loading firmware version 784.2 (2012-08-15 21:35:19)
 and only as 802.11ABG!

while WIFI1 and WIFI2 (both BCM4352) are not:
 b43-phy0: Broadcom 4352 WLAN found (core revision 42)
 b43-phy0 ERROR: FOUND UNSUPPORTED PHY (Analog 12, Type 11 (AC), Revision 1)

Hardware Highlights:

SoC:	Broadcom BCM53016A1 (1 GHz, 2 cores)
RAM:	128 MiB
NAND:	128 MiB Spansion S34ML01G2 (~114 MiB useable)
ETH:	1GBit Ethernet Port - PoE
WIFI1:	Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
WIFI2:	Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
WIFI3:	Broadcom BCM43428 abgn (1x1:1 - id: 43428)

BLE:	Broadcom BCM20732 (ttyS1)
LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
	1 x White LED (GPIO)
	1 x Orange LED Fault Indicator (GPIO)
	2 x LAN Activity / Speed LEDs (On the RJ45 Port)
BUTTON: one Reset button
MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC + Serial#!)
	ina219 hardware monitor (i2c)
	Kensington Lock

SERIAL:
	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
	The Serial setting is 115200-8-N-1. The board has a populated
	right angle 1x4 0.1" pinheader.
	The pinout is: VCC, RX, TX, GND. (Use a multimeter)

Flashing needs a serial adaptor (due to the lack of a working dropbear on
the original firmware).

This flashing procedure for the MR32 was tested with firmware:
"r23-149867:150252-aacharya".

0. Create a seperate Ethernet LAN which does not have access to the internet.
   Ideally use 192.168.1.2 for your PC. Make sure to reserve 192.168.1.1 it
   will be used later on by the OpenWrt firmware. The original Meraki firmware
   will likely try to setup the network via DHCP Discovery, so make sure your
   PC is running a DHCP-Server (i.e.: dnsmasq)
   '# dnsmasq -i eth# -F 192.168.1.5,192.168.1.50
   Furthermore, the PC needs a supported ssh/http/ftp server in order to
   retrieve the initramfs + dtb file

1. Disassemble the MR32 device by removing all screws (4 screws are located
   under the 4 rubber feets!) and prying open the plastic covers without
   breaking the plastic retention clips. Once inside, remove all the screws
   on the outer metal shielding to get to the PCB. It's not necessary to
   remove the antennas!

2. Connect the serial cable to the serial header.

3. Partially reassemble the outer metal shielding to ensure that the SoC
   has a proper heat sink.

4. Connect the Ethernet patch cable to the device and the power cable.

5. Wait for the device to boot and enter the root shell.
   (rooting is not discussed in detail here please refer to
   Chris Blake - "pwning the meraki mr18" blog post:
   <https://servernetworktech.com/2016/02/pwning-the-meraki-mr18/>
   (The same method works with the MR32's r23-149867:150252-aacharya)

   Wait for the MR32 to enter the "<Meraki>" prompt and enter:
   <Meraki> odm serial_num read
   (Verify that it matches what's on the S/N Sticker on the back!)
   <Meraki> odm serial_num write Q2XX-XXXX-XXXV
   <Meraki> odm serial_num read
   (Verify that the S/N has changed - and the LED start to flash)

   now to flash the firmware:
   <Meraki> odm firmware part.safe "http://192.168.1.2/mr32-initramfs.bin"

Once OpenWrt booted use sysupgrade to permanently install
OpenWrt. To do this: Download the latest sysupgrade.bin file
for the MR32 to the device and use sysupgrade *sysupgrade.bin
to install it.

WARNING: DO NOT DELETE the "storage" ubi volume!

To flash later MR32 Firmwares like r25-201804051805-G885d6d78-dhow-rel
requires in-circut-i2c tools to access the I2C EEPROM AT24C64 next to
the SoC. The idea is pretty much the same as from Step 5 from above:
Change the serial number to Q2XXXXXXXXXV (should be around 0x7c), then
attach a serial cable, ethernet (but make sure the device can't reach
the internet!) hit "s" (the small s!) during boot to enter the root-shell
and add the following commands to the /storage/config there:

serial_allow_odm true
serial_access_enabled true
serial_access_check false
valid_config true

and then hit exit to let it finish booting.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>

---

rfc -> v2
	- fixed Adrian's comments
	- unbroke sysupgrade on other bcm53xx
---
 .../bcm53xx/base-files/etc/board.d/02_network |   7 +-
 target/linux/bcm53xx/base-files/etc/diag.sh   |   3 +
 .../lib/preinit/07_set_preinit_iface_bcm53xx  |  14 +
 .../base-files/lib/upgrade/platform.sh        |  43 ++-
 target/linux/bcm53xx/image/Makefile           |  27 ++
 ...-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch | 281 ++++++++++++++++++
 .../331-Meraki-MR32-Status-LEDs.patch         |  28 ++
 7 files changed, 400 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
 create mode 100644 target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch

diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network
index 5752b7760d..231566cfa0 100755
--- a/target/linux/bcm53xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network
@@ -89,10 +89,15 @@ bcm53xx_setup_macs()
 	netgear,r8500)
 		# As vendor doesn't use eth0 its MAC may be missing. Use one from eth2.
 		et2macaddr="$(nvram get et2macaddr)"
-		[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+		;;
+	meraki,mr32)
+		# The MAC is stored on an AT24C64 eeprom and not on the nvram
+		et2macaddr=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
 		;;
 	esac
 
+	[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+
 	wan_macaddr="$(nvram get wan_hwaddr)"
 	case "$board" in
 	asus,rt-ac87u)
diff --git a/target/linux/bcm53xx/base-files/etc/diag.sh b/target/linux/bcm53xx/base-files/etc/diag.sh
index 1a9332327a..bf5b779aa8 100644
--- a/target/linux/bcm53xx/base-files/etc/diag.sh
+++ b/target/linux/bcm53xx/base-files/etc/diag.sh
@@ -18,6 +18,9 @@ get_status_led() {
 		status_led=$(basename $status_led_file)
 		return
 	fi;
+
+	# And finally, let's also try the device-Tree aliases node
+	status_led="$(get_dt_led status)"
 }
 
 set_state() {
diff --git a/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
new file mode 100644
index 0000000000..9e7c4b821e
--- /dev/null
+++ b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
@@ -0,0 +1,14 @@
+set_preinit_iface() {
+	. /lib/functions.sh
+
+	case $(board_name) in
+	meraki,mr32)
+		# switch needs to be out of the vlan mode.
+		swconfig dev switch0 set reset 1
+		swconfig dev switch0 set enable_vlan 0
+		swconfig dev switch0 set apply 1
+		;;
+	esac
+}
+
+boot_hook_add preinit_main set_preinit_iface
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 40b2ef67be..cbb8290275 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -96,7 +96,7 @@ platform_identify() {
 	echo "unknown"
 }
 
-platform_check_image() {
+platform_other_check_image() {
 	[ "$#" -gt 1 ] && return 1
 
 	local file_type=$(platform_identify "$1")
@@ -227,6 +227,25 @@ platform_check_image() {
 	return $error
 }
 
+platform_check_image() {
+	case "$(board_name)" in
+	meraki,mr32)
+		# Ideally, REQUIRE_IMAGE_METADATA=1 would suffice
+		# but this would require converting all other
+		# devices too.
+		nand_do_platform_check meraki-mr32 "$1"
+		return $?
+		;;
+	*)
+		platform_other_check_image "$1"
+		return $?
+		;;
+	esac
+
+	return 1
+}
+
+
 # $(1): image for upgrade (with possible extra header)
 # $(2): offset of trx in image
 platform_do_upgrade_nand_trx() {
@@ -393,7 +412,7 @@ platform_img_from_seama() {
 	echo -n $dir/image-entity.bin
 }
 
-platform_do_upgrade() {
+platform_other_do_upgrade() {
 	local file_type=$(platform_identify "$1")
 	local trx="$1"
 	local cmd=
@@ -424,3 +443,23 @@ platform_do_upgrade() {
 
 	default_do_upgrade "$trx" "$cmd"
 }
+
+platform_do_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		nand_do_upgrade "$1"
+		;;
+	*)
+		platform_other_do_upgrade "$1"
+		;;
+	esac
+}
+
+platform_nand_pre_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		;;
+	esac
+}
diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 768477160a..613f2d533d 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -320,6 +320,33 @@ define Device/luxul_xwr-3150
 endef
 TARGET_DEVICES += luxul_xwr-3150
 
+define Device/meraki_mr32
+  DEVICE_VENODR := Meraki
+  DEVICE_MODEL := MR32
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-bluetooth
+  DEVICE_DTS := bcm53016-meraki-mr32
+# Meraki FW r23 tries to resize the part.safe partition before it will
+# flash the image. This is a bit of a problem, since resizing will fail
+# if the partition is smaller than the old one.
+  KERNEL_LOADADDR := 0x00008000
+  KERNEL_INITRAMFS_SUFFIX := .bin
+  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb | \
+	pad-to 10362880
+  KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+
+# Currently the only device that uses the new image check
+  SUPPORTED_DEVICES := meraki,mr32
+
+# The loader is specifically looking for fdt at 2:
+# [    3.190000] find_itb_subimage: error finding fdt at 2: FDT_ERR_NOTFOUND
+# The image won't boot, if it isn't found. :(
+  DEVICE_FDT_NUM := 2
+endef
+TARGET_DEVICES += meraki_mr32
+
 define Device/netgear
   DEVICE_VENDOR := NETGEAR
   IMAGES := chk
diff --git a/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
new file mode 100644
index 0000000000..a59415d251
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
@@ -0,0 +1,281 @@
+From ca655714de06ebd51d0d060a4b12be9e9ac29194 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Thu, 7 Jun 2018 19:29:12 +0200
+Subject: [PATCH 4/4] ARM: BCM5301X: Add DT for Meraki MR32
+
+add support for the Cisco Meraki MR32.
+This is a dual-band enterprise class 802.11ac access point.
+The unit was donated by Chris Blake. Thank you!
+
+SoC:    Broadcom BCM53016A1 (1 GHz, 2 cores)
+RAM:    128 MiB
+NAND:   128 MiB Spansion S34ML01G2 (~114 MiB useable)
+ETH:    1GBit Ethernet Port - PoE
+WIFI1:  Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
+WIFI2:  Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
+WIFI3:  Broadcom BCM43428 abgn (1x1:1 - id: 43428)
+
+BLE:    Broadcom BCM20732 (ttyS1)
+LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
+        1 x White LED (GPIO)
+        1 x Orange LED Fault Indicator (GPIO)
+        2 x LAN Activity / Speed LEDs (On the RJ45 Port)
+BUTTON: one Reset button
+MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC)
+        ina219 hardware monitor (i2c)
+        Kensington Lock
+
+SERIAL:
+	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
+        The Serial setting is 115200-8-N-1. The board has a populated
+        right angle 1x4 0.1" pinheader.
+        The pinout is: VCC, RX, TX, GND.
+
+Odd stuff:
+	- uart0 clock frequency is 62.5 MHz.
+	- The LEDs are labeled as SYS-LED1 through SYS-LED3
+	  because of the silkscreen on the PCB.
+	- the original u-boot has been compiled with most functions
+	  and commands disabled. The u-boot env isn't setup properly
+	  either and as a result, the bcm47xxpart probing is not
+	  working. Hence, the nand partitions are specified through a
+	  "fixed-partition" binding.
+	- The "WICED SMART(TM)" Bluetooth LE 4.0 BCM20732 chip is
+	  connected to uart2 of the SoC. The BCM20732 does not
+	  provide a HCI. So the linux' bluetooth stack is useless.
+	  The mock-up node with the compatible binding and
+	  enable-gpios property is provided solely as documentation.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -119,6 +119,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
+ 	bcm47094-luxul-xwr-3150-v1.dtb \
+ 	bcm47094-netgear-r8500.dtb \
+ 	bcm47094-phicomm-k3.dtb \
++	bcm53016-meraki-mr32.dtb \
+ 	bcm94708.dtb \
+ 	bcm94709.dtb \
+ 	bcm953012er.dtb \
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -0,0 +1,219 @@
++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
++/*
++ * Broadcom BCM470X / BCM5301X ARM platform code.
++ * DTS for Meraki MR32 / Codename: Espresso
++ *
++ * Copyright (C) 2018-2020 Christian Lamparter <chunkeey at gmail.com>
++ */
++
++/dts-v1/;
++
++#include "bcm4708.dtsi"
++#include "bcm5301x-nand-cs0-bch8.dtsi"
++#include <dt-bindings/leds/common.h>
++
++/ {
++	compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708";
++	model = "Meraki MR32";
++
++	chosen {
++		bootargs = " console=ttyS0,115200n8 earlycon";
++	};
++
++	memory {
++		reg = <0x00000000 0x08000000>;
++		device_type = "memory";
++	};
++
++	aliases {
++		serial1 = &uart2;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		sysled3 {
++			function = LED_FUNCTION_FAULT;
++			color = <LED_COLOR_ID_AMBER>;
++			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
++			panic-indicator;
++		};
++		sysled2 {
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_WHITE>;
++			gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>;
++		};
++	};
++
++	keys {
++		compatible = "gpio-keys";
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		restart {
++			label = "Reset";
++			linux,code = <KEY_RESTART>;
++			gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	pwm-leds {
++		compatible = "pwm-leds";
++
++		red {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_RED>;
++			pwms = <&pwm 0 50000 0>;
++			max-brightness = <255>;
++		};
++
++		green {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_POWER;
++			color = <LED_COLOR_ID_GREEN>;
++			pwms = <&pwm 1 50000 0>;
++			max-brightness = <255>;
++		};
++
++		blue {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_BLUE>;
++			pwms = <&pwm 2 50000 0>;
++			max-brightness = <255>;
++		};
++	};
++
++	i2c {
++		/*
++		 * The platform provided I2C does not budge.
++		 * This is a replacement until I can figure
++		 * out what are the missing bits...
++		 */
++
++		compatible = "i2c-gpio";
++		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
++		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
++		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		current_sense: ina219 at 45 {
++			compatible = "ti,ina219";
++			reg = <0x45>;
++			shunt-resistor = <60000>; /* = 60 mOhms */
++		};
++
++		eeprom: eeprom at 50 {
++			compatible = "atmel,24c64";
++			reg = <0x50>;
++			pagesize = <32>;
++			read-only;
++		};
++	};
++};
++
++&i2c0 {
++	/* status = "okay"; - can be enabled once it works. */
++
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_i2c>;
++
++	clock-frequency = <100000>;
++
++	/* current_sense: */ ina219 at 45 {
++		compatible = "ti,ina219";
++		reg = <0x45>;
++		shunt-resistor = <60000>; /* = 60 mOhms */
++	};
++
++	/* eeprom: */ eeprom at 50 {
++		compatible = "atmel,24c64";
++		reg = <0x50>;
++		pagesize = <32>;
++		read-only;
++	};
++};
++
++&uart0 {
++	clock-frequency = <62500000>;
++	/delete-property/ clocks;
++};
++
++&uart1 {
++	status = "disabled";
++};
++
++&uart2 {
++	status = "okay";
++	/*
++	 * bluetooth-le {
++	 *	compatible = "brcm,bcm20732";
++	 *	enable-gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>;
++	 *};
++	 */
++};
++
++&gmac1 {
++	status = "disabled";
++};
++&gmac2 {
++	status = "disabled";
++};
++&gmac3 {
++	status = "disabled";
++};
++
++&pwm {
++	status = "okay";
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_pwm>;
++};
++
++&nandcs {
++	nand-ecc-algo = "hw";
++
++	partitions {
++		/*
++		 * The partition autodetection does not work for this device.
++		 * It will only detect the "nvram" partition with an incorrect size.
++		 *	[    1.721667] 1 bcm47xxpart partitions found on MTD device brcmnand.0
++		 *	[    1.727962] Creating 1 MTD partitions on "brcmnand.0":
++		 *	[    1.733117] 0x000000400000-0x000008000000 : "nvram"
++		 */
++
++		compatible = "fixed-partitions";
++		#address-cells = <0x1>;
++		#size-cells = <0x1>;
++
++		partition0 at 0 {
++			label = "u-boot";
++			reg = <0x0 0x100000>;
++			read-only;
++		};
++
++		partition1 at 100000 {
++			label = "bootkernel1";
++			reg = <0x100000 0x300000>;
++			read-only;
++		};
++
++		partition2 at 400000 {
++			label = "nvram";
++			reg = <0x400000 0x100000>;
++			read-only;
++		};
++
++		partition3 at 500000 {
++			label = "bootkernel2";
++			reg = <0x500000 0x300000>;
++			read-only;
++		};
++
++		partition4 at 800000 {
++			label = "ubi";
++			reg = <0x800000 0x7780000>;
++		};
++	};
++};
diff --git a/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
new file mode 100644
index 0000000000..fb78ee93c4
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
@@ -0,0 +1,28 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Thu, 7 Jun 2018 19:29:12 +0200
+Subject: bcm53xx: add LED status label alias for Meraki MR32
+
+add an led-status alias label. This is used by OpenWrt's LED
+DTS lookup function to identifiy the indicator LED
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -27,6 +27,7 @@
+ 
+ 	aliases {
+ 		serial1 = &uart2;
++		led-status = &led_status;
+ 	};
+ 
+ 	leds {
+@@ -68,7 +69,7 @@
+ 			max-brightness = <255>;
+ 		};
+ 
+-		green {
++		led_status: green {
+ 			/* SYS-LED 1 - Tricolor */
+ 			function = LED_FUNCTION_POWER;
+ 			color = <LED_COLOR_ID_GREEN>;
-- 
2.28.0



From mail at aparcar.org  Sun Sep  6 06:02:38 2020
From: mail at aparcar.org (Paul Spooren)
Date: Sun, 06 Sep 2020 00:02:38 -1000
Subject: [PATCH 1/2] build: ipkg-build add -r option for all-root
In-Reply-To: <BPUXGHNpUFR8N3FR2KoRQb9Xr3J2SUYiYVZL5wvu2427@mailpile>
Message-ID: <C5G77TFL22DN.2OC8Q2UKO1BCE@dawn>

On Sat Sep 5, 2020 at 1:58 AM HST, Karl Palsson wrote:
>
> Paul Spooren <mail at aparcar.org> wrote:
> > 
> > diff --git a/scripts/ipkg-build b/scripts/ipkg-build
> > index e3a9a882cf..38149c4432 100755
> > --- a/scripts/ipkg-build
> > +++ b/scripts/ipkg-build
> > @@ -1,5 +1,7 @@
> >  #!/bin/sh
> >  
> > +set -x
> > +
>
> Do you mean to have this in the patch?

No thanks for spotting. I initially created this because I thought
fakeroot would be the cause slowing down the buildbots, however Felix
found that it was something related to `get_source_date_epoch.sh` calls.

I therefore set these two patches to "not applicable".
>
> Sincerely,
> Karl Palsson



From hauke at hauke-m.de  Sun Sep  6 11:09:46 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Sun, 6 Sep 2020 17:09:46 +0200
Subject: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <20200904222829.GB658540@tuxmachine.localdomain>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <35b3781b-1c57-600a-6b41-ed6480f38692@hauke-m.de>
 <20200829115805.GD574887@tuxmachine.localdomain>
 <20200830123833.GB608218@tuxmachine.localdomain>
 <CADSoG1vj45D7Fpr-UaYTQCGV+RMk02gH7nPaYnnpPjK_nhkiVg@mail.gmail.com>
 <20200904222829.GB658540@tuxmachine.localdomain>
Message-ID: <db5d0321-5956-db4d-d76a-da1ac67fef74@hauke-m.de>

On 9/5/20 12:28 AM, Baptiste Jonglez wrote:
> On 03-09-20, Nick Lowe wrote:
>> It seems there is an important ath10k patch included in the 4.4.235,
>> 4.9.235, 4.14.196 and 4.19.143, 5.4.62 LTS kernels that is applicable
>> for OpenWRT users who are not using an up to date CT driver with Wave
>> 2 QCA 802.11ac generation hardware, it is already merged for CT.
> 
> Do you mean that it affects both ath10k and ath10k-ct in the 19.07 branch?
> 
>> It resolves a PCIe hang seen due to the DMA burst size value meaning
>> different things between Wave 1 and Wave 2 hardware.
>>
>> The issue resolved is that a value of 0 for the DMA burst size has a
>> different meaning and instruction depending on the generation.
> 
> Do you have more details, references?  A commit?

He is probably talking about this commit:
https://git.kernel.org/linus/a1769bb68a850508a492e3674ab1e5e479b11254
from kernel 5.6.

This was backported to version v4.19.143 and v4.14.196 some days ago.

The problem affects ath10k-ct in all versions (18.06, 19.07 and master)
and ath10k in 19.07 and 18.06.

Hauke

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200906/e376c55d/attachment.sig>

From mail at adrianschmutzler.de  Sun Sep  6 11:32:39 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sun, 6 Sep 2020 17:32:39 +0200
Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
In-Reply-To: <CAHNKnsQ5mTLgj6YRGBeM07MGd81Fg7oY5DfgQ5zwdAENroPNOw@mail.gmail.com>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
 <004201d68357$54184b40$fc48e1c0$@adrianschmutzler.de>
 <CAHNKnsQ5mTLgj6YRGBeM07MGd81Fg7oY5DfgQ5zwdAENroPNOw@mail.gmail.com>
Message-ID: <01bb01d68462$f46bb850$dd4328f0$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Sergey Ryazanov
> Sent: Sonntag, 6. September 2020 00:40
> To: Adrian Schmutzler <mail at adrianschmutzler.de>
> Cc: OpenWrt Development List <openwrt-devel at lists.openwrt.org>; Zoltan
> HERPAI <wigyori at uid0.hu>
> Subject: Re: [PATCH 0/5] ath25: return back with 5.4 kernel support
> 
> On Sat, Sep 5, 2020 at 10:36 AM Adrian Schmutzler
> <mail at adrianschmutzler.de> wrote:
> > > This series returns back ath25 target and switches it to 5.4 kernel.
> >
> > I will take care, but probably alter the patches so we directly start
> > with kernel 5.4, and not add back 4.14 just to remove it again.
> 
> Sure. But specify the commit which drops ath25 target with 4.14 kernel in a
> commit message, please. So, history readers will be aware of reasons of
> history interruption and where history is continued.

I have pushed my to-be-merged collection of patches here:
https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/ath25merge

However, before I can merge this, we still need somebody to clean up base-files/lib/preinit/15_preinit_iface_atheros

This still contains calls to vconfig which is not added by default for years.

Somebody just send it separately and then I will put it on top.

Best

Adrian

> 
> --
> Sergey
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200906/3fc93d6e/attachment.sig>

From baptiste at bitsofnetworks.org  Sun Sep  6 11:47:49 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Sun, 6 Sep 2020 17:47:49 +0200
Subject: [PATCH 19.07 v2 6/6] ath10k-ct-firmware: update firmware images
In-Reply-To: <20200903205651.653299-7-baptiste@bitsofnetworks.org>
References: <20200903205651.653299-1-baptiste@bitsofnetworks.org>
 <20200903205651.653299-7-baptiste@bitsofnetworks.org>
Message-ID: <20200906154749.GB687746@tuxmachine.localdomain>

Tested-by: Baptiste Jonglez <git at bitsofnetworks.org> [QCA9886, QCA9887]

On 03-09-20, Baptiste Jonglez wrote:
> From: Michael Yartys <michael.yartys at gmail.com>
> 
> Not a large change from last time, but should fix at least one rare wave-2
> crash.
> 
> Tested on Netgear R7800.
> 
> Signed-off-by: Michael Yartys <michael.yartys at gmail.com>
> Signed-off-by: ?lvaro Fern?ndez Rojas <noltari at gmail.com>
> (cherry picked from commit 91aab77bf1ce91b0e60e720eb147c94a02c1f2fd)
> [adapt variables and package names]
> [remove changes to non-full htt-mgt variants because we did not backport
>  a882bfce052e ("ath10k-ct-firmware: add htt-mgt variants")]
> Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
> ---
>  package/firmware/ath10k-ct-firmware/Makefile | 42 ++++++++++----------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile
> index 6fe8ea6d3b..12fb031f8f 100644
> --- a/package/firmware/ath10k-ct-firmware/Makefile
> +++ b/package/firmware/ath10k-ct-firmware/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=ath10k-ct-firmware
> -PKG_VERSION:=2020-04-24
> +PKG_VERSION:=2020-07-02
>  PKG_RELEASE:=1
>  
>  include $(INCLUDE_DIR)/package.mk
> @@ -88,14 +88,14 @@ define Download/ct-firmware-htt
>    URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT)
>  endef
>  
> -QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
> +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019
>  define Download/ath10k-firmware-qca988x-ct
>    $(call Download/ct-firmware,QCA988X,)
>    HASH:=8b4c99253aa309d35f2e060c190091b8db1b84dbda06a6a15c83ac0f9a938126
>  endef
>  $(eval $(call Download,ath10k-firmware-qca988x-ct))
>  
> -QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
> +QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019
>  define Download/ath10k-firmware-qca988x-ct-htt
>    $(call Download/ct-firmware-htt,QCA988X,)
>    HASH:=a7168916d6aa5e4d7858f8b620c0c980c76d03f390929db6f4077685ce2051e7
> @@ -103,14 +103,14 @@ endef
>  $(eval $(call Download,ath10k-firmware-qca988x-ct-htt))
>  
>  
> -QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.018
> +QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019
>  define Download/ath10k-firmware-qca9887-ct
>    $(call Download/ct-firmware,QCA9887,ath10k-9887)
>    HASH:=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9887-ct))
>  
> -QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.018
> +QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019
>  define Download/ath10k-firmware-qca9887-ct-htt
>    $(call Download/ct-firmware-htt,QCA9887,ath10k-9887)
>    HASH:=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098
> @@ -118,62 +118,62 @@ endef
>  $(eval $(call Download,ath10k-firmware-qca9887-ct-htt))
>  
>  
> -QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
> +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca99x0-ct
>    $(call Download/ct-firmware,QCA99X0,ath10k-10-4b)
> -  HASH:=cf26eb37524de54af51fe9b2efffc85e0e70ab849e8607ef63ce5a8ecffeaa42
> +  HASH:=7dc934f934bc4973c9273a4f22cfead8e26ec6f579647af31b718a860eca0a4b
>  endef
>  $(eval $(call Download,ath10k-firmware-qca99x0-ct))
>  
> -QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
> +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca99x0-ct-htt
>    $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b)
> -  HASH:=e9737538d7379e13ad4e4c8c519a63659b5e34a35455ed9ac4399ae8097caabc
> +  HASH:=71a27b245a382fe009938d2826d5c97a90dceb10ddf638325268df91837ea302
>  endef
>  $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt))
>  
>  
> -QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
> +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca9984-ct
>    $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b)
> -  HASH:=a6b3d66efe640a430a837f238e91eddcd423eed6b887d3ae19716d87a71fd0b1
> +  HASH:=32d13f432691fe759ded7d027052e925233adb436cd8f729f85ec3d19ccd1dfd
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9984-ct))
>  
> -QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
> +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca9984-ct-htt
>    $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b)
> -  HASH:=96060227e372b3b210badccbe6b0bd75d9a35335a7a0f2966964e9e89f66b00f
> +  HASH:=e8ab69777bd00b5fc6b1b7acccb55b903553a99932a5b0351602b5f690106588
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9984-ct-htt))
>  
>  
> -QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
> +QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca4019-ct
>    $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b)
> -  HASH:=46d8f8f1e780813299dc8780eedcfceda103c6b4d8908589ad1adbef921714c0
> +  HASH:=4b89763087c7ed9b56046c4e621b7f045e452436d8d9b430a5d171179e313592
>  endef
>  $(eval $(call Download,ath10k-firmware-qca4019-ct))
>  
> -QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
> +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca4019-ct-htt
>    $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b)
> -  HASH:=d884624fc34f4b5de7a3ec0534627c46cea25fca45657f3a2f6bb85f6c5893d7
> +  HASH:=fba591e5777c53b82542ba16cae69d9bb4684837f2fa4cee1b9b26f648096748
>  endef
>  $(eval $(call Download,ath10k-firmware-qca4019-ct-htt))
>  
>  
> -QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.018
> +QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca9888-ct
>    $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b)
> -  HASH:=d01f1429aaf0bfac07eee3547e5821d19136840b2f983e75e76979a5ac19b6f0
> +  HASH:=048f4300725e6ebbf94a6bf4f3f4e4592c446fcdbe1d801aaac024b15e89e0c9
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9888-ct))
>  
> -QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.018
> +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019
>  define Download/ath10k-firmware-qca9888-ct-htt
>    $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b)
> -  HASH:=68c42f8e0dcf77f18d4813ac93174bf06ff5cf5aa4f69befe7f35f9fae1de1e3
> +  HASH:=d2a7e9fea6bd854721b3fc03a3a00d379d303b2bce339377ee87a1c14a60312d
>  endef
>  $(eval $(call Download,ath10k-firmware-qca9888-ct-htt))
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200906/c176d611/attachment.sig>

From noreply at github.com  Sun Sep  6 12:44:29 2020
From: noreply at github.com (Stephen Walker)
Date: Sun, 06 Sep 2020 09:44:29 -0700
Subject: [sdwalker/sdwalker.github.io] 135637: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/89f913-135637@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 13563798ade996b0182447f54301162c412d0026
      https://github.com/sdwalker/sdwalker.github.io/commit/13563798ade996b0182447f54301162c412d0026
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2020-09-06 (Sun, 06 Sep 2020)

  Changed paths:
    M uscan/index-18.06.html
    M uscan/index-19.07.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From ryazanov.s.a at gmail.com  Sun Sep  6 12:45:02 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sun,  6 Sep 2020 19:45:02 +0300
Subject: [PATCH] ath25: fix preinit Ethernet port configuration
Message-ID: <20200906164502.1034-1-ryazanov.s.a@gmail.com>

vconfig is no more installed by default to a firmware image. So, replace
vconfig calls for VLAN subinterface configuration by coresponding
ip-link commands.

Also drop few useless comments from the preinit hook script, while we
are at it.

I have no chance to test this fix since I have no board with a subject
switch IC, but this is still better then call an utility that is
unavailable in the firmware for years.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
---
 .../base-files/lib/preinit/15_preinit_iface_atheros      | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros b/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
index 235ba4befc..87bc4abba5 100644
--- a/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
+++ b/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
@@ -1,12 +1,10 @@
-# reset button only supported on ar5315+ at the moment
 preinit_ip() {
 	if [ -z "$pi_ifname" ]; then
 		grep -q 'Atheros AR231[567]' /proc/cpuinfo && {
 			if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
 			     -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
-				vconfig set_name_type DEV_PLUS_VID_NO_PAD
 				ip link set eth0 up
-				vconfig add eth0 1
+				ip link add dev eth0.1 link eth0 type vlan id 1
 				ifname=eth0.1
 			else
 				ifname=eth0
@@ -20,13 +18,10 @@ preinit_ip() {
 	}
 }
 
-
-# reset button only supported on ar5315+ at the moment
-
 preinit_ip_deconfig() {
 	if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
 	     -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
-		vconfig rem eth0.1 2>/dev/null
+		ip link del eth0.1 2>/dev/null
 		ip link set $pi_ifname down
 	elif [ -n "$pi_ifname" ]; then
 		ip -4 addr flush dev $pi_ifname
-- 
2.26.2



From ryazanov.s.a at gmail.com  Sun Sep  6 12:55:21 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Sun, 6 Sep 2020 19:55:21 +0300
Subject: [PATCH 0/5] ath25: return back with 5.4 kernel support
In-Reply-To: <01bb01d68462$f46bb850$dd4328f0$@adrianschmutzler.de>
References: <20200904235133.27813-1-ryazanov.s.a@gmail.com>
 <004201d68357$54184b40$fc48e1c0$@adrianschmutzler.de>
 <CAHNKnsQ5mTLgj6YRGBeM07MGd81Fg7oY5DfgQ5zwdAENroPNOw@mail.gmail.com>
 <01bb01d68462$f46bb850$dd4328f0$@adrianschmutzler.de>
Message-ID: <CAHNKnsQevvJcfeHQ2g1f1B7AuAFAWw4MN4XsYC7+ODRVNErVOg@mail.gmail.com>

On Sun, Sep 6, 2020 at 6:32 PM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
> I have pushed my to-be-merged collection of patches here:
> https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/ath25merge

Thank you for this careful work! Commit that recovers 4.14 patches,
but within the 5.4 directory is a very nice solution for
revert-drop-and-anyway-drop case.

> However, before I can merge this, we still need somebody to clean up base-files/lib/preinit/15_preinit_iface_atheros
>
> This still contains calls to vconfig which is not added by default for years.
>
> Somebody just send it separately and then I will put it on top.

Just sent a patch that fixes this.

-- 
Sergey


From kvalo at codeaurora.org  Mon Sep  7 11:46:18 2020
From: kvalo at codeaurora.org (Kalle Valo)
Date: Mon, 7 Sep 2020 15:46:18 +0000
Subject: CVE-2020-3702: Firmware updates for ath9k and ath10k chips
In-Reply-To: <20200829114833.GC574887@tuxmachine.localdomain> (Baptiste
 Jonglez's message of "Sat, 29 Aug 2020 13:48:33 +0200")
References: <20200810090126.mtu3uocpcjg5se5e@pali>
 <20200812083600.6zxdf5pfktdzggd6@pali> <87lfik1av8.fsf@toke.dk>
 <20200812092334.GA17878@w1.fi>
 <20200829114833.GC574887@tuxmachine.localdomain>
Message-ID: <01010174693f1de3-af9854a3-bf4a-49d4-8aac-ae8f24b5a29d-000000@us-west-2.amazonses.com>

Baptiste Jonglez <baptiste at bitsofnetworks.org> writes:

> Hi,
>
> Cross-posting to openwrt-devel because we are backporting the necessary fixes.
>
> On 12-08-20, Jouni Malinen wrote:
>> On Wed, Aug 12, 2020 at 11:17:47AM +0200, Toke H?iland-J?rgensen wrote:
>> > Pali Roh?r <pali at kernel.org> writes:
>> > > Could somebody react and provide some details when fixes would be
>> > > available for ath9k and ath10k Linux drivers? And what is current state
>> > > of this issue for Linux?
>> > >
>> > > I'm looking at ath9k and ath10k git trees [1] [2] [3] and I do not see
>> > > there any change which could be related to CVE-2020-3702.
>> > 
>> > How about these, from March:
>> > 
>> > a0761a301746 ("mac80211: drop data frames without key on encrypted links")
>> > ce2e1ca70307 ("mac80211: Check port authorization in the
>> > ieee80211_tx_dequeue() case")
>> > b16798f5b907 ("mac80211: mark station unauthorized before key removal")
>> 
>> Those cover most of the identified issues for drivers using mac80211
>> (e.g., ath9k and ath10k; though, I don't remember whether I actually
>> ever managed to reproduce this with ath10k in practice). I have couple
>> of additional ath9k-specific patches that cover additional lower layer
>> paths for this. I hope to get those out after confirming they work with
>> the current kernel tree snapshot.
>
> I could find linux-stable backports for ce2e1ca70307 and b16798f5b907, but
> not for a0761a301746.  Is it intended?  From the commit message, it looks
> like it does fix an important issue.
>
> Also, for the sake of completeness, this subsequent commit is also related
> to CVE-2020-3702 (and already backported):
>
> 5981fe5b0529 ("mac80211: fix misplaced while instead of if")

I think you should ask the stable to also take commit a0761a301746, most
likely they just missed it by accident.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


From dwmw2 at infradead.org  Tue Sep  8 04:26:33 2020
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue,  8 Sep 2020 09:26:33 +0100
Subject: [PATCH 2/3] mediatek: fix missing pause on switch port for Banana Pi
 R2
In-Reply-To: <20200908082634.1898371-1-dwmw2@infradead.org>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
Message-ID: <20200908082634.1898371-2-dwmw2@infradead.org>

This causes rx drops when running iperf.

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 ...623-add-missing-pause-for-switchport.patch | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch

diff --git a/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch b/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch
new file mode 100644
index 0000000000..35277f0ddd
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/0700-arm-dts-mt7623-add-missing-pause-for-switchport.patch
@@ -0,0 +1,27 @@
+From: Frank Wunderlich <frank-w at public-files.de>
+Date: Mon,  7 Sep 2020 09:05:17 +0200
+
+port6 of mt7530 switch (= cpu port 0) on bananapi-r2 misses pause option
+which causes rx drops on running iperf.
+
+Cc: stable at vger.kernel.org
+Fixes: f4ff257cd160 ("arm: dts: mt7623: add support for Bananapi R2 (BPI-R2) board")
+Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
+---
+ arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+index 2b760f90f38c..5375c6699843 100644
+--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
++++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+@@ -192,6 +192,7 @@ port at 6 {
+ 					fixed-link {
+ 						speed = <1000>;
+ 						full-duplex;
++						pause;
+ 					};
+ 				};
+ 			};
+-- 
+2.25.1
-- 
2.26.2



From dwmw2 at infradead.org  Tue Sep  8 04:26:32 2020
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue,  8 Sep 2020 09:26:32 +0100
Subject: [PATCH 1/3] mediatek: mt7623n-preloader: add preloader for Banana Pi
 R64
Message-ID: <20200908082634.1898371-1-dwmw2@infradead.org>

We want to be able to make full system images for this system too, just
as we now can for the MT7623 platforms.

The package directory (mt7623n) is now a bit misnamed as it's overly
specific, but the precise set of platforms which we support this way
is evolving and we'll fix it up when the dust settles and we know what
nomenclature makes most sense.

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 package/boot/mt7623n-preloader/Makefile | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/package/boot/mt7623n-preloader/Makefile b/package/boot/mt7623n-preloader/Makefile
index 801c6d19b3..0faaf46d3f 100644
--- a/package/boot/mt7623n-preloader/Makefile
+++ b/package/boot/mt7623n-preloader/Makefile
@@ -30,6 +30,14 @@ define Download/BPI-R2-preloader-2k.img.gz
 endef
 $(eval $(call Download,BPI-R2-preloader-2k.img.gz))
 
+define Download/BPI-R64-preloader-2k.img.gz
+  FILE:=$(BPI_PRELOADER_PREFIX)-BPI-R64-preloader-2k.img.gz
+  URL:=$(BPI_PRELOADER_URL)
+  URL_FILE:=BPI-R64-preloader-2k.img.gz
+  HASH:=1a4b55da1717190aa4e790ce93850605e9b15aae4c3248bcf8734aac020ab0e4
+endef
+$(eval $(call Download,BPI-R64-preloader-2k.img.gz))
+
 
 define Package/mt7623n-preloader
   SECTION:=boot
@@ -43,10 +51,23 @@ define Package/mt7623n-preloader/description
   Preloader image for mt7623n based boards like Banana Pi R2.
 endef
 
+define Package/mt7622-preloader
+  SECTION:=boot
+  CATEGORY:=Boot Loaders
+  DEPENDS:=@TARGET_mediatek_mt7622
+  TITLE:=mt7622-preloader
+  DEFAULT:=y if TARGET_mediatek
+endef
+
+define Package/mt7622-preloader/description
+  Preloader image for mt7622 based boards like Banana Pi R64.
+endef
+
 define Build/Prepare
 	rm -rf $(PKG_BUILD_DIR)
 	mkdir -p $(PKG_BUILD_DIR)
 	cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz $(PKG_BUILD_DIR)/mt7623n_bpir2-preloader.bin.gz
+	cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R64-preloader-2k.img.gz $(PKG_BUILD_DIR)/mt7622_bpir64-preloader.bin.gz
 endef
 
 define Build/Compile
@@ -59,3 +80,4 @@ define Build/InstallDev
 endef
 
 $(eval $(call BuildPackage,mt7623n-preloader))
+$(eval $(call BuildPackage,mt7622-preloader))
-- 
2.26.2



From dwmw2 at infradead.org  Tue Sep  8 04:26:34 2020
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue,  8 Sep 2020 09:26:34 +0100
Subject: [PATCH 3/3] mediatek: mt7623: use bash for generating bootable images
In-Reply-To: <20200908082634.1898371-1-dwmw2@infradead.org>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
Message-ID: <20200908082634.1898371-3-dwmw2@infradead.org>

It turns out that 'echo -e' isn't portable; it doesn't work in the dash
builtin echo and Ubuntu users are complaining.

I can't even get octal (specified by POSIX) to work consistently because
those  variants of 'echo' which *do* support -e don't seem to interpret
octalwithout it.

I could switch to /bin/echo but using -e with that isn't actually
portable *either* even though it works today.

For now just stick with bash, and use its builtin. We may end up using
something else entirely; perhaps perl.

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 target/linux/mediatek/image/gen_mtk_mmc_img.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/mediatek/image/gen_mtk_mmc_img.sh b/target/linux/mediatek/image/gen_mtk_mmc_img.sh
index ea8a9c63a1..2dacb9019d 100755
--- a/target/linux/mediatek/image/gen_mtk_mmc_img.sh
+++ b/target/linux/mediatek/image/gen_mtk_mmc_img.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright ? 2019 Alexey Loukianov <lx2 at lexa2.ru>
 # Copyright ? 2020 David Woodhouse <dwmw2 at infradead.org>
-- 
2.26.2



From nbd at nbd.name  Tue Sep  8 04:31:50 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Tue, 8 Sep 2020 10:31:50 +0200
Subject: [PATCH 3/3] mediatek: mt7623: use bash for generating bootable
 images
In-Reply-To: <20200908082634.1898371-3-dwmw2@infradead.org>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
 <20200908082634.1898371-3-dwmw2@infradead.org>
Message-ID: <de040c04-2e83-ba2b-b64d-d2b167e29896@nbd.name>

On 2020-09-08 10:26, David Woodhouse wrote:
> It turns out that 'echo -e' isn't portable; it doesn't work in the dash
> builtin echo and Ubuntu users are complaining.
> 
> I can't even get octal (specified by POSIX) to work consistently because
> those  variants of 'echo' which *do* support -e don't seem to interpret
> octalwithout it.
> 
> I could switch to /bin/echo but using -e with that isn't actually
> portable *either* even though it works today.
> 
> For now just stick with bash, and use its builtin. We may end up using
> something else entirely; perhaps perl.
> 
> Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
Have you considered using printf instead of echo?

- Felix


From dwmw2 at infradead.org  Tue Sep  8 04:39:19 2020
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue, 08 Sep 2020 09:39:19 +0100
Subject: [PATCH 3/3] mediatek: mt7623: use bash for generating bootable
 images
In-Reply-To: <de040c04-2e83-ba2b-b64d-d2b167e29896@nbd.name>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
 <20200908082634.1898371-3-dwmw2@infradead.org>
 <de040c04-2e83-ba2b-b64d-d2b167e29896@nbd.name>
Message-ID: <5a4f800eb04a99286737a506c55531a439e33422.camel@infradead.org>

On Tue, 2020-09-08 at 10:31 +0200, Felix Fietkau wrote:
> On 2020-09-08 10:26, David Woodhouse wrote:
> > It turns out that 'echo -e' isn't portable; it doesn't work in the dash
> > builtin echo and Ubuntu users are complaining.
> > 
> > I can't even get octal (specified by POSIX) to work consistently because
> > those  variants of 'echo' which *do* support -e don't seem to interpret
> > octalwithout it.
> > 
> > I could switch to /bin/echo but using -e with that isn't actually
> > portable *either* even though it works today.
> > 
> > For now just stick with bash, and use its builtin. We may end up using
> > something else entirely; perhaps perl.
> > 
> > Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
> 
> Have you considered using printf instead of echo?

I played with that for a while a few weeks ago and didn't manage to get
it working in all environments either. Sometimes I need '\\x' and
sometimes just '\x'.

At the time I gave up as it was mostly a theoretical problem and our
own builds worked, and I had more important things to fix.

But now users are hitting this in practice? so I need to at least come
up with a stopgap solution, and this was it.

Better solutions welcome ? and we do have a handful of other places in
the tree that need fixing too, when we work out what the best approach
is.

? http://forum.banana-pi.org/t/banana-pi-r2-openwrt-19-07-image/11323/80
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5174 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200908/9a46d3d7/attachment.bin>

From nbd at nbd.name  Tue Sep  8 04:42:12 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Tue, 8 Sep 2020 10:42:12 +0200
Subject: [PATCH 3/3] mediatek: mt7623: use bash for generating bootable
 images
In-Reply-To: <5a4f800eb04a99286737a506c55531a439e33422.camel@infradead.org>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
 <20200908082634.1898371-3-dwmw2@infradead.org>
 <de040c04-2e83-ba2b-b64d-d2b167e29896@nbd.name>
 <5a4f800eb04a99286737a506c55531a439e33422.camel@infradead.org>
Message-ID: <f70869ba-8b4f-8d0f-0e51-68488fa6f65b@nbd.name>

On 2020-09-08 10:39, David Woodhouse wrote:
> On Tue, 2020-09-08 at 10:31 +0200, Felix Fietkau wrote:
>> On 2020-09-08 10:26, David Woodhouse wrote:
>> > It turns out that 'echo -e' isn't portable; it doesn't work in the dash
>> > builtin echo and Ubuntu users are complaining.
>> > 
>> > I can't even get octal (specified by POSIX) to work consistently because
>> > those  variants of 'echo' which *do* support -e don't seem to interpret
>> > octalwithout it.
>> > 
>> > I could switch to /bin/echo but using -e with that isn't actually
>> > portable *either* even though it works today.
>> > 
>> > For now just stick with bash, and use its builtin. We may end up using
>> > something else entirely; perhaps perl.
>> > 
>> > Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
>> 
>> Have you considered using printf instead of echo?
> 
> I played with that for a while a few weeks ago and didn't manage to get
> it working in all environments either. Sometimes I need '\\x' and
> sometimes just '\x'.
> 
> At the time I gave up as it was mostly a theoretical problem and our
> own builds worked, and I had more important things to fix.
> 
> But now users are hitting this in practice? so I need to at least come
> up with a stopgap solution, and this was it.
> 
> Better solutions welcome ? and we do have a handful of other places in
> the tree that need fixing too, when we work out what the best approach
> is.
Sure, using bash is fine. We already require it for many other things.

- Felix


From dwmw2 at infradead.org  Tue Sep  8 06:11:38 2020
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue, 08 Sep 2020 11:11:38 +0100
Subject: [PATCH 3/3] mediatek: mt7623: use bash for generating bootable
 images
In-Reply-To: <f70869ba-8b4f-8d0f-0e51-68488fa6f65b@nbd.name>
References: <20200908082634.1898371-1-dwmw2@infradead.org>
 <20200908082634.1898371-3-dwmw2@infradead.org>
 <de040c04-2e83-ba2b-b64d-d2b167e29896@nbd.name>
 <5a4f800eb04a99286737a506c55531a439e33422.camel@infradead.org>
 <f70869ba-8b4f-8d0f-0e51-68488fa6f65b@nbd.name>
Message-ID: <410516d23aa857044f3aec4371694e7bc6b288ab.camel@infradead.org>

On Tue, 2020-09-08 at 10:42 +0200, Felix Fietkau wrote:
> Sure, using bash is fine. We already require it for many other
> things.

I did make an effort to remove bashisms as part of the review before
adding this script, but yeah, we can live with bash for now.

For the time being I do still need someone to commit it for me...
please.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5174 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200908/02cb658d/attachment.bin>

From Jason at zx2c4.com  Tue Sep  8 12:28:30 2020
From: Jason at zx2c4.com (Jason A. Donenfeld)
Date: Tue,  8 Sep 2020 18:28:30 +0200
Subject: [PATCH] wireguard: bump to 1.0.20200908
Message-ID: <20200908162830.192432-1-Jason@zx2c4.com>

* compat: backport kfree_sensitive and switch to it
* netlink: consistently use NLA_POLICY_EXACT_LEN()
* netlink: consistently use NLA_POLICY_MIN_LEN()
* compat: backport NLA policy macros

Backports from upstream changes.

* peerlookup: take lock before checking hash in replace operation

A fix for a race condition caught by syzkaller.

Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
---
 package/network/services/wireguard/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile
index 8c408d0..7df219f 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wireguard
 
-PKG_VERSION:=1.0.20200729
+PKG_VERSION:=1.0.20200908
 PKG_RELEASE:=1
 
 PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
-PKG_HASH:=690c7d9e115e2ff27386811cb495c9784678f717c8d6fc4cc7469dce373f252e
+PKG_HASH:=ad33b2d2267a37e0f65c97e65e7d4d926d5aef7d530c251b63fbf919048eead9
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
-- 
2.28.0



From Jason at zx2c4.com  Tue Sep  8 12:30:01 2020
From: Jason at zx2c4.com (Jason A. Donenfeld)
Date: Tue,  8 Sep 2020 18:30:01 +0200
Subject: [PATCH] wireguard-tools: bump to 1.0.20200827
Message-ID: <20200908163001.192718-1-Jason@zx2c4.com>

* ipc: split into separate files per-platform

This is in preparation for FreeBSD support, which I had hoped to have this
release, but we're still waiting on some tooling fixes, so hopefully next
wg(8) will support that. Either way, the code base is now a lot more amenable
to adding more kernel platform support.

* man: wg-quick: use syncconf instead of addconf for strip example

Simple documentation fix.

* pubkey: isblank is a subset of isspace
* ctype: use non-locale-specific ctype.h

In addition to ensuring that isalpha() and such isn't locale-specific, we also
make these constant time, even though we're never distinguishing between bits
of a secret using them. From that perspective, though, this is markedly better
than the locale-specific table lookups in glibc, even though base64 characters
span two cache lines and valid private keys must hit both. This may be useful
for other projects too: https://git.zx2c4.com/wireguard-tools/tree/src/ctype.h
---
 package/network/utils/wireguard-tools/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile
index fb7c0b6..a5264a5 100644
--- a/package/network/utils/wireguard-tools/Makefile
+++ b/package/network/utils/wireguard-tools/Makefile
@@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wireguard-tools
 
-PKG_VERSION:=1.0.20200513
+PKG_VERSION:=1.0.20200827
 PKG_RELEASE:=2
 
 PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/
-PKG_HASH:=e73409a9fb8c90506db241d1e1a4e7372a60dbfa400e37f4ab2fd70a92ba495f
+PKG_HASH:=51bc85e33a5b3cf353786ae64b0f1216d7a871447f058b6137f793eb0f53b7fd
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
-- 
2.28.0



From bjorn at mork.no  Tue Sep  8 15:38:55 2020
From: bjorn at mork.no (=?utf-8?Q?Bj=C3=B8rn_Mork?=)
Date: Tue, 08 Sep 2020 21:38:55 +0200
Subject: stale key-build.ucert files
Message-ID: <87r1rcf48g.fsf@miraculix.mork.no>

A few weeks ago I started getting

 chain_verify: certificate expired
 Image check failed.

from sysupgrade.  And just forced it since I "knew" the image was
fine,..

But then again today I got the same message and started looking into
it.  Google had little to offer, so this was obviously just me.  Looking
at my local build dir, I noticed that all the the key-build* files were
more than a year old.  Including the key-build.ucert.  And sure enough,
dumping it showed:


ucert -D -c key-build.ucert 
=== CHAIN ELEMENT 01 ===
signature:
---
untrusted comment: signed by key 99db1e0996685023
RWSZ2x4JlmhQI/wQ9kXSjLGUtynHUksgRpvz9ES/dCGwjlXWMtqNvTvrAx+foN1grKbNNf4iPhYUW0Ym1xeSQ+b7bF4Be6qsRQ0=
---
payload:
---
"ucert": {
        "certtype": 1,
        "validfrom": 1564991013,
        "expiresat": 1596527013,
        "pubkey": "untrusted comment: Local build key\nRWSZ2x4JlmhQI527QU7Q03p7YVx11VN8LFkVGJz/SQEHdyped/+0yjUs\n"
}
---


So this expired on the Aug 4th.  But why was it still there and used in
my recent builds? Well, it is generated by the configure step of
base-files, but only if the file doesn't already exist:

>From package/base-files/Makefile:
..
  define Build/Configure
        [ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \
                $(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key"

        [ -s $(BUILD_KEY).ucert ] || \
                $(STAGING_DIR_HOST)/bin/ucert -I -c $(BUILD_KEY).ucert -p $(BUILD_KEY).pub -s $(BUILD_KEY)

  endef


AFAICS, there isn't anything ever cleaning or recreating this file if it
exists.  I guess the rule should not just check for existense, but also
the expiry date of an existing certificate.

I would have prepared a patch here if I only knew what the policy was
supposed to be.  Simply checking for an expired certficate obviously
isn't enough.  The image should be installable tomorrow as well.  But
what about next year?  Why not?

Exacly how are these dates supposed to be used?  Does it really make
sense that a valid image signed by a key in /etc/opkg/keys expires on
disk and starts failing validation?   I am really not sure about that.



Bj?rn


From baptiste at bitsofnetworks.org  Tue Sep  8 16:11:26 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Tue, 8 Sep 2020 22:11:26 +0200
Subject: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <20200730185757.GA935@tuxmachine.localdomain>
References: <20200730185757.GA935@tuxmachine.localdomain>
Message-ID: <20200908201126.GC834100@tuxmachine.localdomain>

Hi,

Images for 19.07.4 have been built.  Thomas, could you update the ToH
accordingly?  When the download page is also updated, I will announce it,
probably tomorrow.

18.06.9 will follow soon.

Thanks,
Baptiste

On 30-07-20, Baptiste Jonglez wrote:
> Hi,
> 
> New point releases for 19.07 and 18.06 are starting to be overdue, and I
> would like to help 19.07.4 and 18.06.9 get released somewhere around
> mid-August.
> 
> The main motivation are fixes for a libubox regression and for the musl
> synchronisation bug, as well as a LuCI regression (see "release goals"
> below).  But there are many other fixes, mostly device-related, that also
> motivate these new point releases.  If you have more fixes to backport,
> please consider doing so soon, especially for 18.06.9 which will likely be
> the last release for 18.06.
> 
> 
> The following links can be useful to track changes for 19.07:
> 
> - release goals for 19.07.4 (mostly high-level): https://openwrt.org/docs/guide-developer/releases/goals/19.07.4
> 
> - current release notes for 19.07.4: https://openwrt.org/releases/19.07/notes-19.07.4
> 
> - pending patches on patchwork for 19.07: https://patchwork.ozlabs.org/project/openwrt/list/?q=19.07
> 
> - pending patches on github for 19.07: https://github.com/openwrt/openwrt/pulls?q=is%3Apr+is%3Aopen+label%3Arelease%2F19.07
> 
> - open bug reports for 19.07: https://bugs.openwrt.org/index.php?do=tasklist&project=2&status%5B0%5D=open&reported%5B%5D=10&order=severity&sort=desc
> 
> 
> And for 18.06 (overall, things are obviously more quiet):
> 
> - current release notes for 18.06.9: https://openwrt.org/releases/18.06/notes-18.06.9
> 
> - pending patches on patchwork for 18.06: https://patchwork.ozlabs.org/project/openwrt/list/?q=18.06
> 
> - pending patches on github for 18.06: https://github.com/openwrt/openwrt/pulls?q=is%3Apr+is%3Aopen+label%3Arelease%2F18.06
> 
> - open bug reports for 18.06: https://bugs.openwrt.org/index.php?do=tasklist&project=2&status%5B0%5D=open&reported%5B%5D=8&order=severity&sort=desc
> 
> 
> While everything is mostly ready, the actual release will need somebody
> with the rights to "push the button": https://openwrt.org/docs/guide-developer/releases/making-service-release
> 
> Regards,
> Baptiste


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200908/d6df5d39/attachment.sig>

From greearb at candelatech.com  Tue Sep  8 18:57:43 2020
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 8 Sep 2020 15:57:43 -0700
Subject: Updated ath10k-ct firmware
Message-ID: <36238a31-9f41-6695-fc8b-689d4940f430@candelatech.com>


Here are md5sums and details for latest firmware images.

The 'qcache' variant enables the qcache logic like upstream
firmware uses.  It appears to have fixed on user's problems, but
I am not sure it is an over-all improvement.  It may allow more
stations to associate in AP mode, if you tune fwcfg properly, but
I have not tested that and don't know how well it performs.

qcache in general swaps firmware memory objects in and out out
of host memory, so it will at the least use more host memory.

Since last time:

wave-1:  single extra line of debugging code, no significant change.

wave-2:

* Enable qcache builds
* Tune memory in 4019 chipset firmware to allow more TIDs (at cost of fewer stations)
   This should balance better and have less chance of crashing system under high
   stations loads.


988x
a4c3d1e2fb80f6b8b9738c7189795ab9505e6c09efc12ba5f08ee7f49e934239  firmware-2-ct-full-community-22.bin.lede.020
93108bd0870652860cdb57749f5a12205ecb15bb1f129d916ad73b6f06406c82  firmware-2-ct-full-htt-mgt-community-22.bin.lede.020
/home/greearb/candela_html/downloads
9887
459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b  firmware-2-ct-full-community-22.bin.lede.020
fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098  firmware-2-ct-full-htt-mgt-community-22.bin.lede.020
/home/greearb/candela_html/downloads
9980
59f4b1b9377d14cf73e2ccc024b51ed906939432bfb45a518b4e7696aedca136  firmware-5-ct-full-community-12.bin-lede.020
c1a660f3d388e4500283c1ea99cda08d3d43e20178c676b6bbbcdc53f7864372  firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
be5a5f8059d9af65bb86f13df11408707b7611661d231bc2a8a98681c8947dd5  firmware-5-ct-htt-mgt-community-12.bin-lede.020
47ead9df5c3629a20b6464d0831179508713a57ca618c68ef598a5c728cf5a03  firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
/home/greearb/candela_html/downloads
9984
b30cc6859395d176006a2ccf170dcd786e2a466f360648f546808c6f3827bc1d  firmware-5-ct-full-community-12.bin-lede.020
ce59caa48a390138c9d059f796200ebd1c01e3e054b031c1abe55751a1410c55  firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
42d070e9be6a0d85958516380d009de188a6766d31713af54b3c500d2f365d10  firmware-5-ct-htt-mgt-community-12.bin-lede.020
97cd148e89a39d4bb21749307b134a08202faaf832e61d5073b73d832d2fa654  firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
/home/greearb/candela_html/downloads
4019
4326484653b3cb6d992b871cdabcb0a64bfd15d0ee5c0da4f19c1c87716efe3a  firmware-5-ct-full-community-12.bin-lede.020
062b265102b0b293638073886f2273961277a97e298e131d5efbdd46ebaaa154  firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
01c7825a816a4c97e518a26b3913608782b970dcac568857fdc3529450e75ff7  firmware-5-ct-htt-mgt-community-12.bin-lede.020
cd4949e1199400a98e9010ea9fc13922a2ae774e9d28b36fa4af315aef11a9cf  firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
/home/greearb/candela_html/downloads
9888
e3c381843688e2d2a11c0ad1e1e26be499fd66f646deaa75e0f1b0cf3c4893b7  firmware-5-ct-full-community-12.bin-lede.020
ad0e206d01f936d09e45b40088422415e54a7665fc7cdcd111659ee415045168  firmware-5-ct-full-htt-mgt-community-12.bin-lede.020
b8f587092fe69c23c6555bfa1c817304920c2bab8408b32b3ff1ef3f56250bc8  firmware-5-ct-htt-mgt-community-12.bin-lede.020
b569c96eebcfd83d154453743f5c4f4492f033bcc8b0b6ee221b5ca419fe051f  firmware-5-ct-htt-mgt-community-qcache-12.bin-lede.020
/home/greearb/candela_html/downloads


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


From mail at aparcar.org  Tue Sep  8 19:11:22 2020
From: mail at aparcar.org (Paul Spooren)
Date: Tue,  8 Sep 2020 13:11:22 -1000
Subject: [PATCH] build: fix missing file handling for file_modes
Message-ID: <20200908231122.35729-1-mail@aparcar.org>

The `ipkg-build` script uses `file_modes` (-m) to set file modes
during package creation. If a single OpenWrt package results in
multiple `ipk` packages, the `PKG_FILE_MODES` are applied to every
single one of them. This can cause in errors files can be missing
between e.g. a *full* and a *mini* variant.

This commit checks if the file/folder exists, if not a warning is
printed but no longer a positive exit code produced.

Also clean up indention of surrounding lines.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 scripts/ipkg-build | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/scripts/ipkg-build b/scripts/ipkg-build
index e3a9a882cf..62b72ada88 100755
--- a/scripts/ipkg-build
+++ b/scripts/ipkg-build
@@ -134,19 +134,24 @@ cd $pkg_dir
 for file_mode in $file_modes; do
 	case $file_mode in
 	/*:*:*:*)
-	    ;;
+		;;
 	*)
-	    echo "ERROR: file modes must use absolute path and contain user:group:mode"
-	    echo "$file_mode"
-	    exit 1
-	    ;;
+		echo "ERROR: file modes must use absolute path and contain user:group:mode"
+		echo "$file_mode"
+		exit 1
+		;;
 	esac
-	path=$(echo "$file_mode" | cut -d ':' -f 1)
-	user_group=$(echo "$file_mode" | cut -d ':' -f 2-3)
-	mode=$(echo "$file_mode" | cut -d ':' -f 4)
 
-	chown "$user_group" "$pkg_dir/$path"
-	chmod  "$mode" "$pkg_dir/$path"
+	path=$(echo "$file_mode" | cut -d ':' -f 1)
+	if [ -e "$pkg_dir/$path" ]; then
+		user_group=$(echo "$file_mode" | cut -d ':' -f 2-3)
+		mode=$(echo "$file_mode" | cut -d ':' -f 4)
+
+		chown "$user_group" "$pkg_dir/$path"
+		chmod "$mode" "$pkg_dir/$path"
+	else
+		echo "WARNING: skip mod change for non existing $path"
+	fi
 done
 $TAR -X $tmp_dir/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/data.tar.gz
 
-- 
2.25.1



From mail at david-bauer.net  Tue Sep  8 23:42:48 2020
From: mail at david-bauer.net (David Bauer)
Date: Wed,  9 Sep 2020 05:42:48 +0200
Subject: [PATCH] ipq40xx: essedma: enable VLAN tag offload for single-port
Message-ID: <20200909034248.77949-1-mail@david-bauer.net>

Enable the VLAN tag offloading mechanism for RGMII single-port devices.
This allows those devices to use 802.1Q VLANs on the ethernet port.

Previously, RX frames were double tagged, as the RX TAG removal flag was
not enabled and an additional 802.1Q header was inserted elsewhere in
the code.

On the TX side, tagging was completely not present for single-port
devices. Enable tagging if an 802.1Q frame should be transmitted and
disable the default tagging mechanism for single-port devices.

Tested on Aruba AP-303

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 .../drivers/net/ethernet/qualcomm/essedma/edma.c     | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma.c b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma.c
index 5561cc23ea..5f2630ae50 100644
--- a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma.c
+++ b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma.c
@@ -164,10 +164,8 @@ static void edma_configure_rx(struct edma_common_info *edma_cinfo)
 	/* Set Rx FIFO threshold to start to DMA data to host */
 	rxq_ctrl_data = EDMA_FIFO_THRESH_128_BYTE;
 
-	if (!edma_cinfo->is_single_phy) {
 	/* Set RX remove vlan bit */
 	rxq_ctrl_data |= EDMA_RXQ_CTRL_RMV_VLAN;
-	}
 
 	edma_write_reg(EDMA_REG_RXQ_CTRL, rxq_ctrl_data);
 }
@@ -1411,12 +1409,10 @@ netdev_tx_t edma_xmit(struct sk_buff *skb,
 	}
 
 	/* Check and mark VLAN tag offload */
-	if (!adapter->edma_cinfo->is_single_phy) {
-		if (unlikely(skb_vlan_tag_present(skb)))
-			flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_FLAG;
-		else if (adapter->default_vlan_tag)
-			flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_DEFAULT_FLAG;
-	}
+	if (unlikely(skb_vlan_tag_present(skb)))
+		flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_FLAG;
+	else if (!adapter->edma_cinfo->is_single_phy && adapter->default_vlan_tag)
+		flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_DEFAULT_FLAG;
 
 	/* Check and mark checksum offload */
 	if (likely(skb->ip_summed == CHECKSUM_PARTIAL))
-- 
2.28.0



From dedeckeh at gmail.com  Wed Sep  9 01:56:48 2020
From: dedeckeh at gmail.com (Hans Dedecker)
Date: Wed, 9 Sep 2020 07:56:48 +0200
Subject: [PATCH] wireguard-tools: bump to 1.0.20200827
In-Reply-To: <20200908163001.192718-1-Jason@zx2c4.com>
References: <20200908163001.192718-1-Jason@zx2c4.com>
Message-ID: <CAJLcKsGtfFZTffd3Xr7bSGC_jbDDayHz9nv-bjK0uOWOpT+YEA@mail.gmail.com>

Hi,

On Tue, Sep 8, 2020 at 6:30 PM Jason A. Donenfeld <Jason at zx2c4.com> wrote:
>
> * ipc: split into separate files per-platform
>
> This is in preparation for FreeBSD support, which I had hoped to have this
> release, but we're still waiting on some tooling fixes, so hopefully next
> wg(8) will support that. Either way, the code base is now a lot more amenable
> to adding more kernel platform support.
>
> * man: wg-quick: use syncconf instead of addconf for strip example
>
> Simple documentation fix.
>
> * pubkey: isblank is a subset of isspace
> * ctype: use non-locale-specific ctype.h
>
> In addition to ensuring that isalpha() and such isn't locale-specific, we also
> make these constant time, even though we're never distinguishing between bits
> of a secret using them. From that perspective, though, this is markedly better
> than the locale-specific table lookups in glibc, even though base64 characters
> span two cache lines and valid private keys must hit both. This may be useful
> for other projects too: https://git.zx2c4.com/wireguard-tools/tree/src/ctype.h

The patch is missing a SoB

Hans
> ---
>  package/network/utils/wireguard-tools/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile
> index fb7c0b6..a5264a5 100644
> --- a/package/network/utils/wireguard-tools/Makefile
> +++ b/package/network/utils/wireguard-tools/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard-tools
>
> -PKG_VERSION:=1.0.20200513
> +PKG_VERSION:=1.0.20200827
>  PKG_RELEASE:=2
>
>  PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/
> -PKG_HASH:=e73409a9fb8c90506db241d1e1a4e7372a60dbfa400e37f4ab2fd70a92ba495f
> +PKG_HASH:=51bc85e33a5b3cf353786ae64b0f1216d7a871447f058b6137f793eb0f53b7fd
>
>  PKG_LICENSE:=GPL-2.0
>  PKG_LICENSE_FILES:=COPYING
> --
> 2.28.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From Jason at zx2c4.com  Wed Sep  9 03:56:21 2020
From: Jason at zx2c4.com (Jason A. Donenfeld)
Date: Wed, 9 Sep 2020 09:56:21 +0200
Subject: [PATCH] wireguard-tools: bump to 1.0.20200827
In-Reply-To: <20200908163001.192718-1-Jason@zx2c4.com>
References: <20200908163001.192718-1-Jason@zx2c4.com>
Message-ID: <CAHmME9oaJ_WVDfVZigYPRSW1STC5BboAk=RdefVq+T2Q0vLbVA@mail.gmail.com>

On Tue, Sep 8, 2020 at 6:30 PM Jason A. Donenfeld <Jason at zx2c4.com> wrote:
>
> * ipc: split into separate files per-platform
>
> This is in preparation for FreeBSD support, which I had hoped to have this
> release, but we're still waiting on some tooling fixes, so hopefully next
> wg(8) will support that. Either way, the code base is now a lot more amenable
> to adding more kernel platform support.
>
> * man: wg-quick: use syncconf instead of addconf for strip example
>
> Simple documentation fix.
>
> * pubkey: isblank is a subset of isspace
> * ctype: use non-locale-specific ctype.h
>
> In addition to ensuring that isalpha() and such isn't locale-specific, we also
> make these constant time, even though we're never distinguishing between bits
> of a secret using them. From that perspective, though, this is markedly better
> than the locale-specific table lookups in glibc, even though base64 characters
> span two cache lines and valid private keys must hit both. This may be useful
> for other projects too: https://git.zx2c4.com/wireguard-tools/tree/src/ctype.h
> ---
>  package/network/utils/wireguard-tools/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/utils/wireguard-tools/Makefile b/package/network/utils/wireguard-tools/Makefile
> index fb7c0b6..a5264a5 100644
> --- a/package/network/utils/wireguard-tools/Makefile
> +++ b/package/network/utils/wireguard-tools/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard-tools
>
> -PKG_VERSION:=1.0.20200513
> +PKG_VERSION:=1.0.20200827
>  PKG_RELEASE:=2
>
>  PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/
> -PKG_HASH:=e73409a9fb8c90506db241d1e1a4e7372a60dbfa400e37f4ab2fd70a92ba495f
> +PKG_HASH:=51bc85e33a5b3cf353786ae64b0f1216d7a871447f058b6137f793eb0f53b7fd
>
>  PKG_LICENSE:=GPL-2.0
>  PKG_LICENSE_FILES:=COPYING
> --
> 2.28.0

Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>


From sebastian_ml at gmx.net  Wed Sep  9 06:29:50 2020
From: sebastian_ml at gmx.net (Sebastian Kemper)
Date: Wed, 9 Sep 2020 12:29:50 +0200
Subject: [PATCH] build: allow file modes per binary package
Message-ID: <20200909102950.GA12953@darth.lan>

Currently the global variable PKG_FILE_MODES is used for all ipkg
creations. This works for Makefiles which output a single package, or
variants of a single package.

But if a Makefile outputs multiple packages that each contain different
files, setting PKG_FILE_MODES causes build failure when any of the files
in the variable do not exist in the folder that is currently being
packaged.

Example:

/openwrt/staging_dir/host/bin/fakeroot -l /openwrt/staging_dir/host/lib/libfakeroot.so -f /openwrt/staging_dir/host/bin/faked /openwrt/scripts/ipkg-build -m "/usr/lib/mariadb/plugin/auth_pam_tool_dir:root:376:0750" /openwrt/build_dir/target-mips_24kc_musl/mariadb-10.4.13/ipkg-mips_24kc/mariadb-server-plugin-disks /openwrt/bin/packages/mips_24kc/packages
+chown: cannot access '/openwrt/build_dir/target-mips_24kc_musl/mariadb-10.4.13/ipkg-mips_24kc/mariadb-server-plugin-disks//usr/lib/mariadb/plugin/auth_pam_tool_dir': No such file or directory

This commit changes the file mode handling a bit. The file mode can now
be set either globally via PKG_FILE_MODES (no behavior change) or on a
per-package basis via FILE_MODES. This way specific file modes can be
used for any particular package.

This behavior is already used for other OpenWrt variables, hence it is
familiar:

PKG_MAINTAINER vs MAINTAINER
PKG_SOURCE_SUBDIR vs SUBDIR
PKG_LICENSE vs LICENSE
...

Signed-off-by: Sebastian Kemper <sebastian_ml at gmx.net>
---
 include/package-defaults.mk | 1 +
 include/package-ipkg.mk     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 2fed72b1a4..2a04bc17e9 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -59,6 +59,7 @@ define Package/Default
   ALTERNATIVES:=
   LICENSE:=$(PKG_LICENSE)
   LICENSE_FILES:=$(PKG_LICENSE_FILES)
+  FILE_MODES:=$(PKG_FILE_MODES)
 endef

 Build/Patch:=$(Build/Patch/Default)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 62cda5b936..0bca8ae84d 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -260,7 +260,7 @@ $(_endef)
     endif

 	$(INSTALL_DIR) $$(PDIR_$(1))
-	$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(PKG_FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
+	$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
 	@[ -f $$(IPKG_$(1)) ]

     $(1)-clean:
--
2.26.2



From mail at adrianschmutzler.de  Wed Sep  9 11:08:26 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 9 Sep 2020 17:08:26 +0200
Subject: [PATCH] ath25: fix preinit Ethernet port configuration
In-Reply-To: <20200906164502.1034-1-ryazanov.s.a@gmail.com>
References: <20200906164502.1034-1-ryazanov.s.a@gmail.com>
Message-ID: <012301d686bb$1206a500$3613ef00$@adrianschmutzler.de>

Hi,

> -				vconfig set_name_type
> DEV_PLUS_VID_NO_PAD
>  				ip link set eth0 up
> -				vconfig add eth0 1
> +				ip link add dev eth0.1 link eth0 type vlan id 1

Are you sure this is correct? I only find the following syntax:

ip link add link eth0 name eth0.1 type vlan id 1

Best

Adrian 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200909/3cb47dc5/attachment.sig>

From tmo26 at gmx.de  Wed Sep  9 11:10:14 2020
From: tmo26 at gmx.de (Thomas Endt)
Date: Wed, 9 Sep 2020 17:10:14 +0200
Subject: AW: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <20200908201126.GC834100@tuxmachine.localdomain>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <20200908201126.GC834100@tuxmachine.localdomain>
Message-ID: <000501d686bb$5239bbd0$f6ad3370$@gmx.de>

> Von: Baptiste Jonglez <baptiste at bitsofnetworks.org>
> Gesendet: Dienstag, 8. September 2020 22:11
> Images for 19.07.4 have been built.  Thomas, could you update the ToH
> accordingly?  When the download page is also updated, I will announce it,
> probably tomorrow.
>
> 18.06.9 will follow soon.

I will update the dataentries this evening.

Thomas



From tmo26 at gmx.de  Wed Sep  9 14:54:29 2020
From: tmo26 at gmx.de (Thomas Endt)
Date: Wed, 9 Sep 2020 20:54:29 +0200
Subject: AW: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <000501d686bb$5239bbd0$f6ad3370$@gmx.de>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <20200908201126.GC834100@tuxmachine.localdomain>
 <000501d686bb$5239bbd0$f6ad3370$@gmx.de>
Message-ID: <000001d686da$a7f71a30$f7e54e90$@gmx.de>

> Von: openwrt-devel <openwrt-devel-bounces at lists.openwrt.org> Im
> Auftrag von Thomas Endt
> Gesendet: Mittwoch, 9. September 2020 17:10
> I will update the dataentries this evening.

Dataentry update to 19.07.4 is running right now.
Time for the long awaited announcement message! ?

Thomas




From ryazanov.s.a at gmail.com  Wed Sep  9 15:20:32 2020
From: ryazanov.s.a at gmail.com (Sergey Ryazanov)
Date: Wed, 9 Sep 2020 22:20:32 +0300
Subject: [PATCH] ath25: fix preinit Ethernet port configuration
In-Reply-To: <012301d686bb$1206a500$3613ef00$@adrianschmutzler.de>
References: <20200906164502.1034-1-ryazanov.s.a@gmail.com>
 <012301d686bb$1206a500$3613ef00$@adrianschmutzler.de>
Message-ID: <CAHNKnsRg14y7MA2gkxwsduVq376NtuCNnesLp91pxBNE8jEy7A@mail.gmail.com>

On Wed, Sep 9, 2020 at 6:08 PM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
> > -                             vconfig add eth0 1
> > +                             ip link add dev eth0.1 link eth0 type vlan id 1
>
> Are you sure this is correct?

Yes, I tested this command with an OpenWrt ip package :)

> I only find the following syntax:
>
> ip link add link eth0 name eth0.1 type vlan id 1
>

According to ip-link(8) a user should use 'name' argument for a new
interface, but in fact the iplink.c have the following code in the
interface creation handler:
>         /* Allow "ip link add dev" and "ip link add name" */
>        if (!name)
>                name = dev;

-- 
Sergey


From avalentin at marcant.net  Wed Sep  9 15:31:57 2020
From: avalentin at marcant.net (=?UTF-8?q?Andr=C3=A9=20Valentin?=)
Date: Wed,  9 Sep 2020 21:31:57 +0200
Subject: [PATCH] hostapd: enable background scanning in wpa_supplicant_full
Message-ID: <20200909193157.32447-1-avalentin@marcant.net>

Activation of autoscanning enables a a wifi client to select the best
accesspoint based on rssi.

This feature is useful in case you have multiple access points in your range
and you do not want to stick the client on the first one it connected to.
Especially when used with 802.11r this allows seamless transition to the
optimal accesspoints.

Setting the config value bgscan to -65 will tell wpa_supplicant to try to
connect to an access points with better rssi.

Example config:
config wifi-iface 'default_radio1'
	option device 'radio1'
	option mode 'sta'
	option ssid 'openwrt'
	option encryption 'psk2'
	option key 'mykey'
	option network 'wlan'
	option bgscan '-65'

The ipk sizes for mipsel_24kc change like this:
old:
wpad-openssl_2020-06-08-5a8b3662-4_mipsel_24kc.ipk 550133

new:
wpad-openssl_2020-06-08-5a8b3662-5_mipsel_24kc.ipk 551961

Signed-off-by: Andr? Valentin <avalentin at marcant.net>
---
 package/network/services/hostapd/files/hostapd.sh          		| 7 +++++++
 package/network/services/hostapd/files/wpa_supplicant-full.config      | 6 +++---
 package/network/services/hostapd/Makefile				| 1 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 88113cd7ce..85299234c2 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -272,6 +272,8 @@ hostapd_common_add_bss_config() {
 	config_add_array operator_icon
 	config_add_array hs20_conn_capab
 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+
+	config_add_string roam_rssi_threshold
 }
 
 hostapd_set_vlan_file() {
@@ -1178,6 +1180,11 @@ wpa_supplicant_add_network() {
 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
 
+	[ -n "$roam_rssi_threshold" ] && {
+		json_get_vars roam_rssi_threshold
+		append network_data "bgscan=\"simple:120:${roam_rssi_threshold}:600\"" "$N$T"
+	}
+
 	[ -n "$basic_rate" ] && {
 		local br rate_list=
 		for br in $basic_rate; do
diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
index 982f4d5534..d39ee74a8d 100644
--- a/package/network/services/hostapd/files/wpa_supplicant-full.config
+++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
@@ -527,9 +527,9 @@ CONFIG_WNM=y
 #
 # Enabling directly a module will enable autoscan support.
 # For exponential module:
-#CONFIG_AUTOSCAN_EXPONENTIAL=y
+CONFIG_AUTOSCAN_EXPONENTIAL=y
 # For periodic module:
-#CONFIG_AUTOSCAN_PERIODIC=y
+CONFIG_AUTOSCAN_PERIODIC=y
 
 # Password (and passphrase, etc.) backend for external storage
 # These optional mechanisms can be used to add support for storing passwords
@@ -600,7 +600,7 @@ CONFIG_IBSS_RSN=y
 # operations for roaming within an ESS (same SSID). See the bgscan parameter in
 # the wpa_supplicant.conf file for more details.
 # Periodic background scans based on signal strength
-#CONFIG_BGSCAN_SIMPLE=y
+CONFIG_BGSCAN_SIMPLE=y
 # Learn channels used by the network and try to avoid bgscans on other
 # channels (experimental)
 #CONFIG_BGSCAN_LEARN=y
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 8f94dce782..8c264854d7 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
-- 
2.20.1


From avalentin at marcant.net  Wed Sep  9 16:00:32 2020
From: avalentin at marcant.net (=?UTF-8?q?Andr=C3=A9=20Valentin?=)
Date: Wed,  9 Sep 2020 22:00:32 +0200
Subject: [PATCH v2] hostapd: enable background scanning in wpa_supplicant_full
Message-ID: <20200909200032.3662-1-avalentin@marcant.net>

Activation of autoscanning enables a a wifi client to select the best
accesspoint based on rssi.

This feature is useful in case you have multiple access points in your range
and you do not want to stick the client on the first one it connected to.
Especially when used with 802.11r this allows seamless transition to the
optimal accesspoints.

Setting the config value bgscan to -65 will tell wpa_supplicant to try to
connect to an access points with better rssi.

Example config:
config wifi-iface 'default_radio1'
	option device 'radio1'
	option mode 'sta'
	option ssid 'openwrt'
	option encryption 'psk2'
	option key 'mykey'
	option network 'wlan'
	option roam_rssi_threshold '-65'

The ipk sizes for mipsel_24kc change like this:
old:
wpad-openssl_2020-06-08-5a8b3662-4_mipsel_24kc.ipk 550133

new:
wpad-openssl_2020-06-08-5a8b3662-5_mipsel_24kc.ipk 551961

Signed-off-by: Andr? Valentin <avalentin at marcant.net>
---
 package/network/services/hostapd/files/hostapd.sh          		| 7 +++++++
 package/network/services/hostapd/files/wpa_supplicant-full.config      | 6 +++---
 package/network/services/hostapd/Makefile				| 1 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 88113cd7ce..85299234c2 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -272,6 +272,8 @@ hostapd_common_add_bss_config() {
 	config_add_array operator_icon
 	config_add_array hs20_conn_capab
 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+
+	config_add_string roam_rssi_threshold
 }
 
 hostapd_set_vlan_file() {
@@ -1178,6 +1180,11 @@ wpa_supplicant_add_network() {
 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
 
+	[ -n "$roam_rssi_threshold" ] && {
+		json_get_vars roam_rssi_threshold
+		append network_data "bgscan=\"simple:120:${roam_rssi_threshold}:600\"" "$N$T"
+	}
+
 	[ -n "$basic_rate" ] && {
 		local br rate_list=
 		for br in $basic_rate; do
diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
index 982f4d5534..d39ee74a8d 100644
--- a/package/network/services/hostapd/files/wpa_supplicant-full.config
+++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
@@ -527,9 +527,9 @@ CONFIG_WNM=y
 #
 # Enabling directly a module will enable autoscan support.
 # For exponential module:
-#CONFIG_AUTOSCAN_EXPONENTIAL=y
+CONFIG_AUTOSCAN_EXPONENTIAL=y
 # For periodic module:
-#CONFIG_AUTOSCAN_PERIODIC=y
+CONFIG_AUTOSCAN_PERIODIC=y
 
 # Password (and passphrase, etc.) backend for external storage
 # These optional mechanisms can be used to add support for storing passwords
@@ -600,7 +600,7 @@ CONFIG_IBSS_RSN=y
 # operations for roaming within an ESS (same SSID). See the bgscan parameter in
 # the wpa_supplicant.conf file for more details.
 # Periodic background scans based on signal strength
-#CONFIG_BGSCAN_SIMPLE=y
+CONFIG_BGSCAN_SIMPLE=y
 # Learn channels used by the network and try to avoid bgscans on other
 # channels (experimental)
 #CONFIG_BGSCAN_LEARN=y
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 8f94dce782..8c264854d7 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git


From linus.walleij at linaro.org  Wed Sep  9 17:10:11 2020
From: linus.walleij at linaro.org (Linus Walleij)
Date: Wed,  9 Sep 2020 23:10:11 +0200
Subject: [PATCH v4] gemini: Bring up DSA switches
Message-ID: <20200909211011.63229-1-linus.walleij@linaro.org>

First group the interfaces on the DSA switch into the
right LAN/WAN groups. Tested successfully on the
D-Link DIR-685 with the RTL8366RB DSA switch.

The RTL8366RB is DSA custom tagged and now handled
by the kernel tag parser. (Backported.)

The Vitesse switches are not capable of supporting
DSA per-port tagging. We suspect they must be handled
using some custom VLAN set-up.

Cc: Pawel Dembicki <paweldembicki at gmail.com>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
ChangeLog v3->v4:
- Rebased patch.
- This now works as expected on the D-Link DIR-685
  with the upstream DSA patches.
- For the Vitesse routers
  I don't know what to do, but it should be "something
  like this" eventually. I think it looks better with
  this script than without it actually.
ChangeLog v2->v3:
- Actually remove the eth1 from the lan list as well on
  the Gemini SL93512r.
ChangeLog v1->v2:
- Remove the eth1 from the LAN bridge in both the
  Vitesse switch devices, instead bring up each ethernet
  master interface independently with "none" protocol.
---
 .../gemini/base-files/etc/board.d/02_network  | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 target/linux/gemini/base-files/etc/board.d/02_network

diff --git a/target/linux/gemini/base-files/etc/board.d/02_network b/target/linux/gemini/base-files/etc/board.d/02_network
new file mode 100755
index 000000000000..e2fce015fb44
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/board.d/02_network
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+storlink,gemini324)
+	# These are all connected to eth1 thru VSC7385
+	ucidef_set_interface "eth" ifname "eth1" protocol "none"
+	ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
+	;;
+itian,sq201)
+	# These are all connected to eth1 thru VSC7395
+	ucidef_set_interface "eth" ifname "eth1" protocol "none"
+	ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
+	;;
+dlink,dir-685)
+	# These are all connected to eth0 thru RTL8366RB
+	ucidef_set_interface "eth" ifname "eth0" protocol "none"
+	ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan"
+	;;
+esac
+
+board_config_flush
+
+exit 0
-- 
2.26.2



From mail at adrianschmutzler.de  Wed Sep  9 18:12:09 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Thu, 10 Sep 2020 00:12:09 +0200
Subject: [PATCH v4] gemini: Bring up DSA switches
In-Reply-To: <20200909211011.63229-1-linus.walleij@linaro.org>
References: <20200909211011.63229-1-linus.walleij@linaro.org>
Message-ID: <00b201d686f6$4452c440$ccf84cc0$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Linus Walleij
> Sent: Mittwoch, 9. September 2020 23:10
> To: Roman Yeryomin <roman at advem.lv>; Sebastian Luft
> <sebastian.luft at gmail.com>; Hans Ulli Kroll <ulli.kroll at googlemail.com>;
> Hauke Mehrtens <hauke at hauke-m.de>; Christian Lamparter
> <chunkeey at gmail.com>
> Cc: Pawel Dembicki <paweldembicki at gmail.com>; Linus Walleij
> <linus.walleij at linaro.org>; Florian Fainelli <f.fainelli at gmail.com>; openwrt-
> devel at lists.openwrt.org
> Subject: [PATCH v4] gemini: Bring up DSA switches
> 
> First group the interfaces on the DSA switch into the right LAN/WAN groups.
> Tested successfully on the D-Link DIR-685 with the RTL8366RB DSA switch.
> 
> The RTL8366RB is DSA custom tagged and now handled by the kernel tag
> parser. (Backported.)
> 
> The Vitesse switches are not capable of supporting DSA per-port tagging. We
> suspect they must be handled using some custom VLAN set-up.
> 
> Cc: Pawel Dembicki <paweldembicki at gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> ChangeLog v3->v4:
> - Rebased patch.
> - This now works as expected on the D-Link DIR-685
>   with the upstream DSA patches.
> - For the Vitesse routers
>   I don't know what to do, but it should be "something
>   like this" eventually. I think it looks better with
>   this script than without it actually.
> ChangeLog v2->v3:
> - Actually remove the eth1 from the lan list as well on
>   the Gemini SL93512r.
> ChangeLog v1->v2:
> - Remove the eth1 from the LAN bridge in both the
>   Vitesse switch devices, instead bring up each ethernet
>   master interface independently with "none" protocol.
> ---
>  .../gemini/base-files/etc/board.d/02_network  | 27
> +++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100755 target/linux/gemini/base-
> files/etc/board.d/02_network
> 
> diff --git a/target/linux/gemini/base-files/etc/board.d/02_network
> b/target/linux/gemini/base-files/etc/board.d/02_network
> new file mode 100755
> index 000000000000..e2fce015fb44
> --- /dev/null
> +++ b/target/linux/gemini/base-files/etc/board.d/02_network
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +. /lib/functions/uci-defaults.sh
> +
> +board_config_update
> +
> +case "$(board_name)" in
> +storlink,gemini324)

Devices should be sorted alphabetically here.

Best

Adrian

> +	# These are all connected to eth1 thru VSC7385
> +	ucidef_set_interface "eth" ifname "eth1" protocol "none"
> +	ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
> +	;;
> +itian,sq201)
> +	# These are all connected to eth1 thru VSC7395
> +	ucidef_set_interface "eth" ifname "eth1" protocol "none"
> +	ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0"
> +	;;
> +dlink,dir-685)
> +	# These are all connected to eth0 thru RTL8366RB
> +	ucidef_set_interface "eth" ifname "eth0" protocol "none"
> +	ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan"
> +	;;
> +esac
> +
> +board_config_flush
> +
> +exit 0
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/ed13edbf/attachment-0001.sig>

From rosenp at gmail.com  Wed Sep  9 19:05:26 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Wed, 9 Sep 2020 16:05:26 -0700
Subject: [PATCHv3] mdadm: revised mdadm config & init logic
In-Reply-To: <20200123025658.1416676-1-rosenp@gmail.com>
References: <20200123025658.1416676-1-rosenp@gmail.com>
Message-ID: <CAKxU2N_nvMdsW0r-8LQEtr4E1spkWc7am+K3_K6BPdRNdA9n0A@mail.gmail.com>

Ping. Is there any chance of this being merged?

On Wed, Jan 22, 2020 at 6:57 PM Rosen Penev <rosenp at gmail.com> wrote:
>
> From: Joseph Tingiris <joseph.tingiris at gmail.com>
>
> This is a significant revision of /etc/init.d/mdadm.  It adds new
> features, support for new configuration options, safer error
> handling, (configurable) verbose output, and contains multiple bug
> fixes.
>
> Most notably, mdadm was being started with the --config flag and
> that prevented it from using its built in Auto Assembly features.
> Users were required to put a correct uuid in /etc/config/mdadm.
>
> The new default startup mode is now to automatically assemble all
> RAID arrays attached to the machine using device scans, rather than
> configuation options.
>
> A new UCI section, config mdadm global, was added with new options that
> are supported by the accompanying /etc/init.d/mdadm. Documentation for all
> new (and previous) options was added as well.  See the
> /etc/config/mdadmin or mdadm.init file itself for more details.
>
> Additionally, a new stateful 'auto' feature was added that functions
> similarly to the stateless Auto Assembly feature.  The benefits of
> stateful auto assembly are to support features that mdadm 4.0 will only
> read from a configuration file, such as setting the MAILFROM value.  The
> new mdadm_conf_auto() function will also aid users in troubleshooting.
> When verbose is turned on it provides tips and better visibility for what's
> actually happening.
>
> Backward compatibility was retained.  Stateful UCI only configurations are
> supported.  All previously existing configurations will work in this mode.
> However, these users will now have to explicitly turn it on.
>
> A new reload_service() function was added to prevent reloads from
> stopping mdadm.  Reloads will now be ignored, though the stage is set for
> reloads to trigger scans for new devices.  Explicit restarts still work as
> expected.
>
> The start_service() function was enhanced to query new UCI mdadm.global
> options: alert_program, config, email, email_from, monitor_frequency,
> and verbose.  Each option is documented in /etc/mdadm/config (config.init) and
> some additional code comments were added.
>
> Finally, error handling and verbose output was enhanced.  Users will
> know what's going on (if verbose is turned on).
>
> Strict reliance on a shell global ($CONF) was removed and replaced with a
> single global ($TMP_FILE) that's for development convenience.  When/if a config
> file is not specified in the UCI config, it will fall back to using $TMP_FILE as the
> configuration file.
>
> Incremented PKG_RELEASE from 1 to 2
>
> Signed-off-by: Joseph Tingiris <joseph.tingiris at gmail.com>
> (rebased and ran through shellcheck)
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  v3: Simplified several sections
>  v2: Rebased after sysmacro patches
>  package/utils/mdadm/Makefile           |   2 +-
>  package/utils/mdadm/files/mdadm.config | 162 +++++++-
>  package/utils/mdadm/files/mdadm.init   | 552 ++++++++++++++++++++++---
>  3 files changed, 643 insertions(+), 73 deletions(-)
>
> diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
> index f20a58b704..d5ea91eeed 100644
> --- a/package/utils/mdadm/Makefile
> +++ b/package/utils/mdadm/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=mdadm
>  PKG_VERSION:=4.1
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
> diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
> index 50afbc2ab6..0c78c964a8 100644
> --- a/package/utils/mdadm/files/mdadm.config
> +++ b/package/utils/mdadm/files/mdadm.config
> @@ -1,18 +1,154 @@
> -config mdadm
> +#
> +# The mdadm 'global' section is for options that apply to all sections.
> +#
> +
> +config mdadm global
> +
> +       #
> +       # option 'alert_program' values may be a path to a valid, executable binary.
> +       #
> +       # The default 'alert_program' is not set.
> +       #
> +       # When mdadm detects an event it will execute this program with 3 arguments, see https://linux.die.net/man/8/mdadm
> +       # $1 = will be the event
> +       # $2 = will be the meta device
> +       # $3 = may be a related component (if one exists)
> +       #
> +       # * alert_program runs independently from sendmail.
> +       # * If both options alert_program and email are set, and both work, then an email and a
> +       #   custom alert will be generated.
> +       # * no alert program is included in mdadm 4.0-4.
> +       #
> +       # Lots of possibilities exist, i.e. scripts for netdata, slack, etc.
> +       #
> +       #option alert_program /usr/sbin/mdadm_alerts
> +
> +
> +       #
> +       # option 'config' values may be one of the following.
> +       #
> +       # The default 'config' is none (stateless auto assembly).
> +       #
> +       # auto          - stateful, dynamically generated mdadm.conf via block info,
> +       #                 stored in /var/etc/mdadm.conf
> +       # containers    - stateless, mdadm --assemble --scan --config=containers; see https://linux.die.net/man/8/mdadm
> +       # none          - stateless, mdadm --assemble --scan --config=none; aka 'Auto Assembly',
> +       #                 see https://linux.die.net/man/8/mdadm
> +       # partition     - stateless, mdadm --assemble --scan --config=partition; see https://linux.die.net/man/8/mdadm
> +       # uci           - stateful, dynamically generated mdadm.conf via uci array values (below),
> +       #                 stored in /var/etc/mdadm.conf
> +       # file          - stateful, manually generated mdadm.conf file(s),
> +       #                 'file' must be preceded by a / and may be a readable filename
> +       #                 or directory with multiple .conf files
> +       #
> +       # Try uncommenting this and using 'auto' if there are issues.  It provides more comprehensive
> +       # diagnostics via verbose messages & the ability to set an email from address.
> +       #
> +       #option config auto
> +
> +
> +       #
> +       # option 'email' values may be a valid (to) email address, or empty.
> +       #
> +       # The default 'email' to send to is root (monitor email will be sent to the local root user).
> +       #
> +       # * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> +       # * Comment, or unset, the email value causes mail to be disabled.  With no email value, mdadm wont even try.
> +       # * A single word name must be a valid user on the system, or it will bounce back to root.
> +       #   Unless user 'mdadm' exists (it doesn't by default), this will bounce:
> +       #   option email mdadm
> +       # * A full email address does not need quoting and will deliver if tcp port 25 (SMTP) is allowed outbound, i.e.
> +       #   option email joseph.tingiris at gmail.com
> +       # * mdadm only supports one email address (MAILADDR) for all arrays. see mdadm.conf(5)
> +       #
> +       # mail will be to 'root@$HOSTNAME', i.e. root at OpenWrt
> +       #
>         option email root
> -       # list devices /dev/hd*
> -       # list devices /dev/sd*
> -       # list devices partitions
>
> -config array
> -       option uuid 52c5c44a:d2162820:f75d3464:799750f8
> -       option device /dev/md0
> -       # option name raid:0
> -       # option super_minor 0
> -       # list devices /dev/sda1
> -       # list devices /dev/sdb1
> -       # option spares 0
> -       # option spare_group spares
> +
> +       #
> +       # option 'email_from' values may be a valid (from) email address, or empty.
> +       #
> +       # The default 'email_from' is 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> +       #
> +       # * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> +       # * Comment, or unset, the email_from value causes mdadm to send mail from
> +       #   root@$HOSTNAME, e.g. root at OpenWrt
> +       # * A complete from envelope can be specified within quotes, i.e.
> +       #   option email_from 'mdadm monitoring <this_is_not_spam at example.com>'
> +       # * mdadm only supports setting a from address (MAILFROM) with a stateful config,
> +       #   e.g. 'auto' or 'uci'. see mdadm.conf(5)
> +       #
> +       # mail will be from 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> +       #
> +       option email_from 'OpenWrt RAID Monitoring <mdadm>'
> +
> +
> +       #
> +       # option 'monitor_frequency' values may be a valid integer, or empty.
> +       #
> +       # The default monitor frequency (delayed poll) is 120 seconds.
> +       #
> +       # * This is the polling interval, frequency, or delay.  It's the value for mdadm --delay.  see https://linux.die.net/man/8/mdadm
> +       #
> +       option monitor_frequency 300
> +
> +       #
> +       # option 'verbose' values may be '1', 'on', or 'true', everything else is false.
> +       #
> +       # The default verbosity is false (quiet).
> +       #
> +       # * Standard errors will be sent to console and syslog regardless of this setting.
> +       # * When verbose is false mdadm will run in --quiet mode and generate very little log
> +       #   or standard output.
> +       #
> +       # Turn this on if you're having problems, or want more detail.  With SSH_TTY set output will
> +       # be to that TTY, otherwise it will go to syslog via logger.
> +       #
> +       #option verbose on
> +
> +
> +#
> +# The mdadm 'array' section(s) are for stateful, manual configurations. Experts only.  Use with caution.
> +#
> +#
> +# The use of multiple 'array' sections is supported by /etc/init.d/mdadm.
> +# They must all be named 'array'.
> +#
> +# As of this writing unnamed 'mdadm' sections are still allowed, but deprecated. Do not use.
> +#
> +
> +#config array
> +       #
> +       # example 'array' options may be a valid mix of:
> +       #
> +       # bitmap
> +       # container
> +       # device
> +       # devices
> +       # member
> +       # name
> +       # spare_group
> +       # spares
> +       # super_minor
> +       # uuid
> +       #
>         # option bitmap /bitmap.md
>         # option container 00000000:00000000:00000000:00000000
> +       # option device /dev/md0
> +       # -and/or a devices list-
> +       # list devices /dev/hd* # mdadm allows glob, see glob(7)
> +       # list devices /dev/sd*
> +       # list devices /dev/sda1
> +       # list devices /dev/sdb1
> +       # list devices containers
> +       # list devices partitions
>         # option member 1
> +       # option name raid:0
> +       # option spare_group spares
> +       # option spares 0
> +       # option super_minor 0
> +       # use uuid from block info (preferred), or mdadm --misc --detail /dev/md0
> +       # option uuid 2084de11-70c4-4521-8f95-6113e75f1fe9
> +       #
> +       # These options directly translate to mdadm -- options, see https://linux.die.net/man/8/mdadm
> diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
> index 64a50b35de..eb323ecad0 100644
> --- a/package/utils/mdadm/files/mdadm.init
> +++ b/package/utils/mdadm/files/mdadm.init
> @@ -1,93 +1,527 @@
>  #!/bin/sh /etc/rc.common
>
> -START=13
> -STOP=98
> +START=12
> +STOP=99
>
>  USE_PROCD=1
>  PROG=/sbin/mdadm
>  NAME=mdadm
>
> -CONF="/var/etc/mdadm.conf"
> +LOGGER=0 # off
> +VERBOSE=1 # off
> +
> +TMP_FILE="/var/etc/mdadm.conf" # /var/etc is on /tmp; used for temporary state, to enable stateful only mdadm features
> +
> +[ -x "$PROG" ] || exit 1
>
>  append_list_item() {
> -       append "$2" "$1" "$3"
> +    append "$2" "$1" "$3"
>  }
>
>  append_option() {
> -       local var="$1"
> -       local cfg="$2"
> -       local opt="$3"
> -       local name="$4"
> -       local sep="$5"
> -       local str
> -
> -       if [ -n "$sep" ]; then
> -               config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> -       else
> -               config_get str "$cfg" "$opt"
> -       fi
> -
> -       [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
> +    local var="$1"
> +    local cfg="$2"
> +    local opt="$3"
> +    local name="$4"
> +    local sep="$5"
> +    local str
> +
> +    if [ -n "$sep" ]; then
> +        config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> +    else
> +        config_get str "$cfg" "$opt"
> +    fi
> +
> +    [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
>  }
>
> -mdadm_common() {
> -       local cfg="$1"
> -       local email devices
> +verbose() {
> +    local msg="$1"
> +    local level="$2"
>
> -       if [ -x /usr/sbin/sendmail ]; then
> -               config_get email "$cfg" email
> -               [ -n "$email" ] && printf "MAILADDR %s\n" "$email" >> $CONF
> -       fi
> +    [ -z "$level" ] && level="INFO"
>
> -       config_list_foreach "$cfg" devices append_list_item devices " "
> -       [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $CONF
> +    [ "$VERBOSE" = "1" ] && {
> +        if [ ${#SSH_TTY} -gt 0 ]; then
> +            printf "$NAME: init %7s - %b\n" "$level" "$msg"
> +        else
> +            # no SSH_TTY goes to logger
> +            printf "$NAME: init %7s - %b\n" "$level" "$msg" | logger -t mdadm
> +        fi
> +    }
>  }
>
> -mdadm_array() {
> -       local cfg="$1"
> -       local uuid device devices name array
> +mdadm_conf_auto() {
> +    local mdadm_conf="$1"
> +
> +    [ -w "$mdadm_conf" ] || {
> +        if [ -z "$mdadm_conf" ]; then
> +            verbose "mdadm_conf value is empty" ERROR
> +        else
> +            verbose "'$mdadm_conf' file not found writable" ERROR
> +        fi
> +        return 1
> +    }
> +
> +    local block_md block_uuid mdadm_md mdadm_md_rc mdadm_uuid
> +
> +    # Check block info for active linux_raid_members, if necessary then compare with mdadm, & dynamically update $mdadm_conf
> +
> +    block_md=0 # counter
> +    for block_uuid in $(block info 2> /dev/null | sed -nEe 's#^.* UUID="([^"]*)".*TYPE="linux_raid_member"#\1#p'); do
> +        mdadm_md=""
> +        mdadm_md_rc=0
> +
> +        while [ -z "$mdadm_md" ]; do
> +            if [ -b "/dev/md$block_md" ]; then
> +                # handle mdadm restart, service reload, multiple starts without stops, physical unplug, etc.
> +
> +                verbose "/dev/md$block_md block device already exists" NOTICE
>
> -       config_get uuid "$cfg" uuid
> -       config_get name "$cfg" name
> -       config_get device "$cfg" device
> +                # active arrays will promptly respond; first check
> +                mdadm_uuid=$($PROG --detail --test --brief "/dev/md$block_md" 2> /dev/null | sed -nEe '1s#^.*UUID=((.){35})#\1#p')
>
> -       if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> -               echo "Skipping array without device, uuid or name" >&2
> -               return
> -       fi
> +                [ -z "$mdadm_uuid" ] && {
> +                    # When an array is unplugged and then plugged in again (without rebooting) then it becomes an INACTIVE-ARRAY
> +                    # however the device file persists, e.g. /dev/md0, and should be reused, rather than a new device assigned.
> +                    if $PROG --detail --test --scan "/dev/md$block_md" 2> /dev/null | grep -E "^(INACTIVE-ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t)metadata)" > /dev/null 2>&1; then
> +                        verbose "attempting to revive INACTIVE-ARRAY on /dev/md$block_md" NOTICE
> +                        if $PROG --examine --scan 2> /dev/null | grep -qE "^(ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t))"; then
> +                            # this is relatively safe with the above regex validation
> +                            mdadm_md="/dev/md$block_md"
> +                        fi
> +                    else
> +                        # This is an unsafe condition to handle with a shell, mdadm sees an inactive device with a different /dev.
> +                        # Err to the side of caution;--assemble --scan shoud know what to do ... it will abandon the block device.
> +                        # If these are happening, suggest stateless & sacrifice some minor functionality, e.g. MAILFROM
> +                        # May be an mdadm or kernel bug with this hardware setup.
> +                        verbose "bug? unsafe to revive INACTIVE-ARRAY on /dev/md$block_md" WARNING
> +                        block_md=$((block_md+1))
> +                        continue
> +                    fi
> +                }
>
> -       [ -n "$uuid" ] && append array "uuid=$uuid"
> -       [ -n "$name" ] && append array "name=$name"
> +                if [ "${block_uuid//-/}" = "${mdadm_uuid//:/}" ]; then
> +                    # block info & mdadm concur all's well; the meta device is active; reuse
> +                    mdadm_md="/dev/md$block_md"
> +                    verbose "auto conf found active RAID member block_uuid=$block_uuid and will reused device '$mdadm_md'" OK
> +                else
> +                    if [ ! -e "/dev/md$block_md" ]; then
> +                        # this block device was never assembled previously; new
> +                        mdadm_md="/dev/md$block_md"
> +                        verbose "auto conf found new RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> +                    else
> +                        block_md=$((block_md+1))
> +                        continue
> +                    fi
> +                fi
>
> -       append_option array "$cfg" super_minor
> -       append_option array "$cfg" spares
> -       append_option array "$cfg" spare_group
> -       append_option array "$cfg" bitmap
> -       append_option array "$cfg" container
> -       append_option array "$cfg" member
> -       append_option array "$cfg" devices devices ","
> +            else
> +                if [ ! -e "/dev/md$block_md" ]; then
> +                    # best scenario; no device or file (yet), safest
> +                    mdadm_md="/dev/md$block_md"
> +                    verbose "auto conf found missing RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> +                else
> +                    # a file exists, but it's not a block device? It's possible (touch), albeit a corner case; discretely say
> +                    # we know & pass over it.
> +                    verbose "/dev/md$block_md file found, not a block device" WARNING
> +                    block_md=$((block_md+1))
> +                    continue
> +                fi
> +            fi
>
> -       printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
> +            $PROG --detail --test --brief $mdadm_md > /dev/null 2>&1 # rc 1=ok, 1=degrade, 2=dead, 4=missing
> +            mdadm_md_rc=$?
> +
> +            # todo: annouce degraded arrays in the logs? mdadmin monitor will do it but not on demand, only per frequency.
> +            #       nice to have for hot plugs ...
> +
> +            verbose "block_md=$block_md, block_uuid=$block_uuid, mdadm_md=$mdadm_md, mdadm_uuid=$mdadm_uuid, rc=$mdadm_md_rc" INFO
> +
> +            if [ $mdadm_md_rc -lt 4 ]; then
> +                $PROG --detail --test --brief $mdadm_md 2> /dev/null >> $mdadm_conf
> +            else
> +                # there's a device with no header.  maybe it's to replace a failed device ...
> +                echo "ARRAY $mdadm_md uuid=$block_uuid" >> $mdadm_conf
> +            fi
> +
> +        done
> +
> +    done
> +
> +    if [ -n "$mdadm_md" ]; then
> +        return 0
> +    else
> +        return 1
> +    fi
> +}
> +
> +mdadm_conf_uci() {
> +    local cfg="$1"
> +    local mdadm_conf="$2"
> +
> +    [ -z "$cfg" ] && {
> +        verbose "cfg is empty" WARNING
> +        return 1
> +    }
> +
> +    local cfg_name
> +    cfg_name=$(uci_get mdadm.$cfg 2> /dev/null)
> +
> +    [ -z "$cfg_name" ] && verbose "($cfg) mdadm config name is empty" NOTICE
> +
> +    [ -z "$mdadm_conf" ] && {
> +        verbose "($cfg) skipping mdadm.$cfg_name array; config file is empty" WARNING
> +        return 1
> +    }
> +
> +    if ! touch "$mdadm_conf" 2> /dev/null; then
> +        verbose "($cfg) skipping mdadm.$cfg_name array; can't touch '$mdadm_conf'" ERROR
> +        return 1
> +    fi
> +
> +    local array device devices name uuid
> +
> +    config_get name "$cfg" name
> +    config_get device "$cfg" device
> +    config_get uuid "$cfg" uuid
> +
> +    config_list_foreach "$cfg" devices append_list_item devices " "
> +    [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $mdadm_conf
> +
> +    if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> +        verbose "($cfg) skipping mdadm.$cfg_name array; no device, uuid, or name" WARNING
> +        return 1
> +    fi
> +
> +    [ -n "$uuid" ] && append array "uuid=$uuid"
> +    [ -n "$name" ] && append array "name=$name"
> +
> +    append_option array "$cfg" super_minor
> +    append_option array "$cfg" spares
> +    append_option array "$cfg" spare_group
> +    append_option array "$cfg" bitmap
> +    append_option array "$cfg" container
> +    append_option array "$cfg" member
> +    append_option array "$cfg" devices devices ","
> +
> +    printf "ARRAY %s %s\n" "$device" "$array" >> $mdadm_conf
> +}
> +
> +reload_service() {
> +    while read -r line; do echo $line; done
> +    # running start_service() on reload should be OK in all modes, except manual configs.
> +    # for auto & none, start_service() already rescans for hotplugged devices, add new arrays, etc.
> +    # could check for the configured mode & call appropriately?  doing nothing is safer; todo: test & resolve
> +    verbose "reload_service called, ignoring" NOTICE
> +    return 0
>  }
>
>  start_service() {
> -       local email
> +    local config config_detail config_file config_level config_mode config_rc config_state config_verbose mdadm_conf
> +
> +    # mdadm.global specific locals
> +    local alert_program email email_from mail_program mdadm_args monitor_frequency
> +
> +    config_verbose=$(uci_get mdadm.global.verbose 2> /dev/null | awk '{print tolower($1)}')
> +    if [ "$config_verbose" = "1" ] || [ "$config_verbose" = "on" ] || [ "$config_verbose" = "true" ]; then
> +        VERBOSE=1 # turn verbose on globally
> +        config_verbose=1
> +        mdadm_args="--verbose"
> +    else
> +        unset -v config_verbose
> +        mdadm_args="--quiet"
> +    fi
> +
> +    verbose "start_service $*" INFO
> +
> +    config_rc=0
> +    config_detail="start"
> +    config_level="INFO"
> +    config_mode="service"
> +
> +    config=$(uci_get mdadm.global.config 2> /dev/null)
> +    if [ -z "$config" ]; then
> +        # per PR1713 discussion; this works very well for the majority of use cases; let mdadm do the heavy lifting.
> +        # none is (Auto Assemble; or no --config); see mdadm(8), default
> +        config='none'
> +        config_detail="mdadm.global.config value is empty"
> +        config_state='stateless'
> +        config_mode="default"
> +        config_level='OK'
> +    else
> +        # experts only
>
> -       mkdir -p "${CONF%/*}"
> -       printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
> +        config_mode="manual"
>
> -       config_load mdadm
> -       config_foreach mdadm_common mdadm
> -       config_foreach mdadm_array array
> +        # check file values first, to preserve case of file name values
> +        if [ "${config:0:1}" = "/" ]; then
> +            config_state='stateful' # all types of file configs are stateful
>
> -       $PROG --assemble --scan --config="$CONF"
> +            if [ -d "$config" ] && [ -r "$config" ]; then
> +                local config_file_count=0
> +                for config_file in ${config}/*.conf; do
> +                    if [ -r "$config_file" ]; then
> +                        config_file_count=$((config_file_count+1))
> +                    fi
> +                done
> +                if [ $config_file_count -eq 0 ]; then
> +                    config_level="WARNING"
> +                else
> +                    config_level="OK"
> +                fi
> +                config_detail="directory found with $config_file_count readable .conf files"
> +            else
> +                if [ -w "$config" ]; then
> +                    if [ -s "$config" ]; then
> +                        # regardless, this will rely on mdadm for final validation; for informational purposes ...
> +                        grep -E '^((DEVICE){1}(\ |\t)(.*)(/dev/|containers|partitions))' "$config" > /dev/null 2>&1 # pattern per mdadm(8)
> +                        if [ $? -eq 0 ]; then
> +                            config_detail="file found, readable with a ^DEVICE"
> +                            config_level="OK"
> +                        else
> +                            config_detail="file found, readable without a ^DEVICE"
> +                            config_level="WARNING"
> +                        fi
> +                    else
> +                        config_detail="file found, writable and empty"
> +                        config_level="OK"
> +                    fi
> +                else
> +                    config_detail="file not found, unwritable"
> +                    config_level="FATAL"
> +                    config_rc=1
> +                fi
> +            fi
> +        else
> +            config_mode="dynamic"
>
> -       procd_open_instance
> -       procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
> -       procd_close_instance
> +            # allow static values in mixed case; convert to lower
> +            config="$(awk -v config="$config" 'BEGIN{print tolower(config)}')"
> +            if [ "$config" = "containers" ] || [ "$config" = "none" ] || [ "$config" = "partition" ]; then
> +                # pass through to mdadm --config=
> +                config_detail="dynamic; uci static key value"
> +                config_level="OK"
> +                config_state='stateless'
> +            else
> +                if [ "$config" = "auto" ] || [ "$config" = "uci" ]; then
> +                    config_detail="dynamic; $config config"
> +                    config_level="OK"
> +                    config_state='stateful'
> +                    mdadm_conf="$TMP_FILE"
> +                else
> +                    config_detail="invalid; unsupported uci config key value"
> +                    config_level="FATAL"
> +                    config_state='stateful'
> +                    config_rc=1
> +                fi
> +            fi
> +        fi
> +    fi
> +
> +    # final safety & functional checks
> +
> +    # check for fatality
> +    [ -z "$config" ] && {
> +        config="${config}?"
> +        config_detail="$config_detail (sorry, something went wrong; check the config settings)"
> +        config_level="FATAL"
> +        config_mode="${config_mode}?"
> +        config_state="${config_state}?"
> +        config_rc=1
> +    }
> +
> +    # Prefer mdadm.global.email; only one is allowed and can be an --email argument per mdadm.conf(5)
> +    email=$(uci_get mdadm.global.email 2> /dev/null)
> +
> +    # mdadm (or postfix?) bug; workaround.  mdadm 4.0 for 18.06.1 has a compiled in default of '/usr/lib/sendmail -t'.
> +    # There's no configurable way to change it and mdadm must be recompiled differently for Openwrt, or posfix should
> +    # add the link. In 18.06.1, postfix 3.3.0-1 installs sendmail in /usr/sbin; mdadm complains & no mail is delivered.
> +    # Other distro's postfix pkg typically installs this link ... or one in /etc/alternatives.
> +    # Since mdadm needs it, I'm adding it here to be sure mdadm can send email if there's a /usr/sbin/sendmail.
> +
> +    # There's really no point in making mdadm's compiled in sendmail configurable via uci.
> +    mail_program="/usr/lib/sendmail"
> +    [ -x /usr/sbin/sendmail ] && [ ! -e "$mail_program" ] && {
> +        # a sym link will suffice
> +        if ! ln -s /usr/sbin/sendmail "$mail_program"; then
> +            verbose "ln -s /usr/bin/sendmail /usr/lib/sendmail failed" WARNING
> +        fi
> +    }
> +
> +    [ -x "$mail_program" ] || {
> +        verbose "disabling email; mail program '/usr/lib/sendmail' not found executable (install postfix)" WARNING
> +        email=""
> +    }
> +
> +    if [ "$config_state" = "stateful" ] && [ -n "$mdadm_conf" ]; then
> +        if mkdir -p "${mdadm_conf%/*}" > /dev/null 2>&1; then
> +            printf "# Autogenerated from /etc/init.d/mdadm, do not edit!\n" > $mdadm_conf
> +
> +            # Use mdadm.global.email_from only if there's a valid mta; only one is allowed per mdadm.conf(5)
> +            # todo: see what other mtas Openwrt has in their opkg repos & maybe support others
> +            [ -x "$mail_program" ] && email_from=$(uci_get mdadm.global.email_from 2> /dev/null)
> +
> +            if [ "$config" = "auto" ]; then
> +                # stateful mdadm.conf auto configuration
> +                if ! mdadm_conf_auto "$mdadm_conf"; then
> +                    #there's quite a bit of logic & error handling in mdadm_conf_auto; if it doesn't return 0 then it's a fatality
> +                    config_detail="$config_detail (couldn't find any meta devices; check connections, or try stateless autoconfig)"
> +                    config_level="FATAL"
> +                    config_rc=1
> +                fi
> +            else
> +                # stateful mdadm.conf uci configuration
> +
> +                # load uci config from /etc/config/mdadm
> +                config_load mdadm
> +
> +                # This is how mdadm uci mdadm config sections should be named, like fstab does with 'mount'.
> +                # The included uci /etc/config/mdadm provides more documentation & direction.
> +                config_foreach mdadm_conf_uci array "$mdadm_conf"
> +
> +                # The unlabled mdadm. at mdadm[0] section should be (is now) deprecated.
> +                # It's more difficult to document how to use, redundant, and over complicated this init configuration.
> +
> +                # Confused; originally config_foreach?
> +                # It's possible to specify multiple mdadm sections with array options in all sections.
> +                # Thus multiple option emails which could result in multiple MAILADDR being appended to mdadm.conf.
> +                # That confuses mdadm.
> +
> +                # The following code is here to prevent regressions.
> +
> +                config_foreach mdadm_conf_uci mdadm "$mdadm_conf"
> +
> +                # For backward compatibility; this will allow an mdadm. at mdadm[0] section's option email.
> +                # (only if mdadm.global.email is not set; again, prefer mdadm.global.email)
> +                #
> +                # bug fixed. The first legacy mdadm section option email will be used.
> +                # a better fix would be to *only* support array sections.
> +                #
> +                [ -z "$email" ] && [ -x "$mail_program" ] && email=$(uci_get mdadm. at mdadm[0].email 2> /dev/null)
> +                # email_from is a new feature; was not previously handled; no need to and please don't backport
> +
> +            fi
> +
> +            # This is nice feature to have to get mdadm mails through spam filters, etc.
> +            # Too bad mdadm (4.0) doesn't have an argument for it.
> +            # Maybe mdadm 4.1 will ... todo: revisit when making mdadm 4.1 & it's in Openwrt mainline.
> +            # This tests successfully with the postfix workaround above & mdadm 4.0.
> +            [ -x "$mail_program" ] && {
> +                printf "MAILFROM %s\n" "$email_from" >> $mdadm_conf # only supported via stateful configs; see mdadm.conf(5)
> +            }
> +
> +            [ -n "$config_verbose" ] && [ -r "$mdadm_conf" ] && {
> +                verbose "mdadm_conf = $mdadm_conf (config_verbose=$config_verbose)" INFO
> +                verbose "---cut $mdadm_conf cut---" INFO
> +                while read -r line; do
> +                    verbose "$line" INFO
> +                done < "$mdadm_conf"
> +                unset -v line
> +                verbose "---cut $mdadm_conf cut---" INFO
> +            }
> +
> +        else
> +            config_detail="$config_detail (mkdir failed; check permissions)"
> +            config_level="FATAL"
> +            config_rc=1
> +        fi
> +    fi
> +
> +    [ $config_rc -ne 0 ] && {
> +        # FATAL
> +        verbose "$config_state,$config_mode config='$config', $config_detail" "$config_level" INFO
> +        [ -n "$mdadm_conf" ] && [ -w "$mdadm_conf" ] && rm -f "$mdadm_conf"
> +        exit $config_rc
> +    }
> +
> +    # Good to go, no more fatal exits, finish getting global & setting local values ... they're all optional.
> +
> +    mdadm_args="$mdadm_args --scan"
> +
> +    if [ -n "$mdadm_conf" ]; then
> +        # mdadm.global.config </file>
> +        mdadm_args="$mdadm_args --config=$mdadm_conf"
> +    else
> +        # mdadm.global.config all (containers, partitions, etc), except none
> +        [ -n "$config" ] && [ "$config" != 'none' ] && mdadm_args="$mdadm_args --config=$config"
> +    fi
> +
> +    local assemble_count assemble_rc
> +
> +    assemble_count=$($PROG --detail --brief --scan 2> /dev/null | wc -l)
> +    verbose "$assemble_count arrays are currently assembled" INFO
> +
> +    # setup assembly mode
> +
> +    verbose "(assemble) '$PROG --assemble $mdadm_args'" INFO
> +    $PROG --assemble $mdadm_args > /dev/null 2>&1
> +    assemble_rc=$?
> +
> +    if [ $assemble_rc -eq 0 ]; then
> +        verbose "all arrays assembled successfully" OK
> +        [ -n "$config_verbose" ] && {
> +            true > /var/log/mdadm.detail
> +            local assemble_dev assemble_devs
> +            assemble_devs=$($PROG --detail --brief --scan | awk '{print $2}')
> +            for assemble_dev in $assemble_devs; do
> +             {
> +                printf "\n"
> +                $PROG --verbose --detail $assemble_dev
> +                printf "\n"
> +             } >> /var/log/mdadm.detail
> +            done
> +            unset -v assemble_dev
> +            while read -r line; do
> +                verbose "$line" INFO
> +            done < "/var/log/mdadm.detail"
> +            unset -v line
> +        }
> +    else
> +        if [ $assemble_count -eq 0 ]; then
> +            verbose "no arrays assembled successfully" ERROR
> +        else
> +            verbose "no new arrays need assembly" NOTICE
> +        fi
> +    fi
> +
> +    # setup monitor mode
> +
> +    alert_program=$(uci_get mdadm.global.alert_program 2> /dev/null)
> +    [ -n "$alert_program" ] && {
> +        if [ -x "$alert_program" ]; then
> +            mdadm_args="$mdadm_args --alert=$alert_program"
> +        else
> +            verbose "disabling alerts; alert_progam '$alert_program' not found executable" WARNING
> +        fi
> +    }
> +
> +    [ -n "$email" ] && mdadm_args="$mdadm_args --mail=$email"
> +
> +    monitor_frequency=$(uci_get mdadm.global.monitor_frequency 2> /dev/null | sed -e 's/[^0-9]*//g')
> +    [ -n "$monitor_frequency" ] && {
> +        mdadm_args="$mdadm_args --delay=$monitor_frequency"
> +        verbose "setting monitor frequency to '$monitor_frequency' seconds"
> +    }
> +
> +    verbose "(monitor) '$PROG --monitor --syslog $mdadm_args'" INFO
> +
> +    # /etc/rc.common doesn't like valid sh constructs like while read line; do echo $line; done <<< "$(echo hello; echo world)" # 8|
> +    # Taking the time machine back to sh is rough enough as it is ... I need to better understand its purpose. I spent too much time
> +    # in /lib/functions.  It's all circa 2006-2013.  Yikes.  Where's the man pages?  Or even code comments?  It would've been way
> +    # easier just to do *everything* the good ol' sysvinit fashioned way, or use systemd.  Just a gripe, I really do like OpenWrt.
> +    procd_open_instance
> +    procd_set_param command "$PROG" --monitor --syslog $mdadm_args
> +    procd_close_instance
> +
> +    verbose "$config_state,$config_mode config=$config, $config_detail complete" "$config_level"
>  }
>
>  stop_service() {
> -       $PROG --stop --scan
> +    $PROG --stop --scan
> +    if echo "here VERBOSE=$VERBOSE"; then
> +        verbose "'$PROG --stop --scan' stop_service succeeded" OK
> +    else
> +        verbose "'$PROG --stop --scan' stop_service failed" ERROR
> +    fi
>  }
> -
> --
> 2.24.1
>


From rosenp at gmail.com  Wed Sep  9 23:22:44 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Wed,  9 Sep 2020 20:22:44 -0700
Subject: [PATCH] libcxxabi: fix compilation under the SDK
Message-ID: <20200910032244.21726-1-rosenp@gmail.com>

Under the SDK, the path for base packages is different.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/libs/libcxxabi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/libs/libcxxabi/Makefile b/package/libs/libcxxabi/Makefile
index 90547561b2..e663fafc8e 100644
--- a/package/libs/libcxxabi/Makefile
+++ b/package/libs/libcxxabi/Makefile
@@ -58,7 +58,7 @@ TARGET_CXXFLAGS += -flto
 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
 
 define Build/Prepare
-	$(MAKE) -C $(TOPDIR)/package/libs/libcxx prepare
+	$(MAKE) -C $(TOPDIR)/$(if $(CONFIG_IN_SDK),feeds/base/)package/libs/libcxx prepare
 	$(call Build/Prepare/Default)
 endef
 
-- 
2.17.1



From baptiste at bitsofnetworks.org  Thu Sep 10 02:41:06 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Thu, 10 Sep 2020 08:41:06 +0200
Subject: OpenWrt 19.07.4 service release
Message-ID: <20200910064106.GA852931@tuxmachine.localdomain>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

The OpenWrt community is proud to announce the newest service release in
the 19.07 stable series: OpenWrt 19.07.4. It focuses on stability and
device support.

Selected highlights of this service release are:

 * fix regression in libubox causing some services to fail to start

 * fix regression in the LuCI web interface: the menu was not showing
   newly installed opkg packages

 * fix a bug in musl that could crash applications in rare
   circumstances. Fastd, a VPN daemon, seems to be particularly affected
   by this bug

 * fix support for several devices that failed to boot

 * many other fixes and improvements to device support

 * update core components (linux kernel, mac80211, ath10k-ct-firmware)

Full release notes and upgrade instructions are available at
https://openwrt.org/releases/19.07/notes-19.07.4

In particular, make sure to read the regressions and known issues before upgrading:
https://openwrt.org/releases/19.07/notes-19.07.4#regressions

For a very detailed list of all changes since 19.07.3, refer to
https://openwrt.org/releases/19.07/changelog-19.07.4

We now have a forum topic where you can report your upgrading experience:
https://forum.openwrt.org/t/openwrt-19-07-4-service-release/73829

- ---

To stay informed of new OpenWrt releases and security advisories, there
are new channels available:

 * a low-volume mailing list for important announcements: https://lists.openwrt.org/mailman/listinfo/openwrt-announce

 * a dedicated "announcements" section in the forum: https://forum.openwrt.org/c/announcements/14

 * other announcement channels (such as RSS feeds) might be added in the
   future, they will be listed at https://openwrt.org/contact

- ---

For latest information about the 19.07 series, refer to the wiki at:
https://openwrt.org/releases/19.07/

To download a OpenWrt 19.07.4 firmware image for your device, head to the
Table of Hardware:
https://openwrt.org/toh/start

Or navigate directly in the list of firmware images:
https://downloads.openwrt.org/releases/19.07.4/targets/

As always, a big thank you goes to all our active package maintainers,
testers, documenters, and supporters.

Have fun!

The OpenWrt Community
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEjVflzZuxNlVFbt5QvgHsIqBOLkYFAl9Zyn0ACgkQvgHsIqBO
LkZQ/g/+LwZqKZuw/9S64ZpLT5ZDJcYnqv9DkoEVlg85YteGmZOMs+M/4BTUuxRc
4wl+nJFmMbXrV8HRG97tHa3ZCVhjCS/yka/EATdn2ixLqe2VSffJYdq9wRmWk3bN
SlDT0ihmWEk5ZM1OW8KKMAn4l3Z0rR1vmUI6il6ft69AfBpxJClgD6pW2+aMn3pt
YsTu+RY1VquvKEasLR8kZ5TRvxflbxWKHe/SITIWpEukdiNXQp3DBkMcdKrc76jX
rJY78N/kXzlZRBywSNWhNjAl3hZrYMRzy4PqF84lwSXIRVZG8QcUdAqWK496oqvj
FSm8LuqsdLBjJ5EeX1BnroYtKAEWkNqx/kfe8IOd+BwWUE3KsaoPlkaXmXk4qCaZ
wNS1dD6oHHIE2BFYDQ/s+hlVhK13Z7IuyeMM73W1bOeuRygXMJ/W61WOfeSYFTZT
PDZl4imgk/iEO4qSGj/6XXcYFMbI7+3/9rkdmxz1JHQT3EIDqgePgt6KhlHSvNbn
vY8iihd1qsVC8qArdQmpWN1NQV/fiW4B9tg6nPfaeM8ymE4Hpo9EaKv+3PxmMwhX
iZj8MJw1eLpoAOiLfCIPyj6yBk3sCqC0OJNLlFtZv4fLhAafv6TRyoPH34VUwYJ/
o1AJUpx0U9EMbh/wOuhJd5NzPqGle41KrgHLltbSZBHa6A+X/vU=
=V3bj
-----END PGP SIGNATURE-----


From jo at mein.io  Thu Sep 10 04:22:26 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 10:22:26 +0200
Subject: [PATCH] libcxxabi: fix compilation under the SDK
In-Reply-To: <20200910032244.21726-1-rosenp@gmail.com>
References: <20200910032244.21726-1-rosenp@gmail.com>
Message-ID: <0e530d7d-7ddd-a2ab-0a90-56f9dc552fe1@wwsnet.net>

Hi,

> +	$(MAKE) -C $(TOPDIR)/$(if $(CONFIG_IN_SDK),feeds/base/)package/libs/libcxx prepare

this looks like an ugly hack, also the feed is not guaranteed to reside in
feeds/base/ - the user can theoretically change the name of the base feed.

Why does this package need to trigger an prepare in a foreign package anyway?
Isn't it enough to PKG_BUILD_DEPEND on base-files?

~ Jo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/91d3a25a/attachment.sig>

From jo at mein.io  Thu Sep 10 04:36:12 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 10:36:12 +0200
Subject: [OpenWrt-Devel] [PATCHv3] mdadm: revised mdadm config & init logic
In-Reply-To: <20200123025658.1416676-1-rosenp@gmail.com>
References: <20200123025658.1416676-1-rosenp@gmail.com>
Message-ID: <5fba4d4e-22fa-a8bb-91f0-c68f4d7fa915@wwsnet.net>

Hi,

comments inline.

On 1/23/20 3:56 AM, Rosen Penev wrote:
> From: Joseph Tingiris <joseph.tingiris at gmail.com>
> 
> This is a significant revision of /etc/init.d/mdadm.  It adds new
> features, support for new configuration options, safer error
> handling, (configurable) verbose output, and contains multiple bug
> fixes.
> 
> Most notably, mdadm was being started with the --config flag and
> that prevented it from using its built in Auto Assembly features.
> Users were required to put a correct uuid in /etc/config/mdadm.
> 
> The new default startup mode is now to automatically assemble all
> RAID arrays attached to the machine using device scans, rather than
> configuation options.
> 
> A new UCI section, config mdadm global, was added with new options that
> are supported by the accompanying /etc/init.d/mdadm. Documentation for all
> new (and previous) options was added as well.  See the
> /etc/config/mdadmin or mdadm.init file itself for more details.
> 
> Additionally, a new stateful 'auto' feature was added that functions
> similarly to the stateless Auto Assembly feature.  The benefits of
> stateful auto assembly are to support features that mdadm 4.0 will only
> read from a configuration file, such as setting the MAILFROM value.  The
> new mdadm_conf_auto() function will also aid users in troubleshooting.
> When verbose is turned on it provides tips and better visibility for what's
> actually happening.
> 
> Backward compatibility was retained.  Stateful UCI only configurations are
> supported.  All previously existing configurations will work in this mode.
> However, these users will now have to explicitly turn it on.
> 
> A new reload_service() function was added to prevent reloads from
> stopping mdadm.  Reloads will now be ignored, though the stage is set for
> reloads to trigger scans for new devices.  Explicit restarts still work as
> expected.
> 
> The start_service() function was enhanced to query new UCI mdadm.global
> options: alert_program, config, email, email_from, monitor_frequency,
> and verbose.  Each option is documented in /etc/mdadm/config (config.init) and
> some additional code comments were added.
> 
> Finally, error handling and verbose output was enhanced.  Users will
> know what's going on (if verbose is turned on).
> 
> Strict reliance on a shell global ($CONF) was removed and replaced with a
> single global ($TMP_FILE) that's for development convenience.  When/if a config
> file is not specified in the UCI config, it will fall back to using $TMP_FILE as the
> configuration file.
> 
> Incremented PKG_RELEASE from 1 to 2
> 
> Signed-off-by: Joseph Tingiris <joseph.tingiris at gmail.com>
> (rebased and ran through shellcheck)
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  v3: Simplified several sections
>  v2: Rebased after sysmacro patches
>  package/utils/mdadm/Makefile           |   2 +-
>  package/utils/mdadm/files/mdadm.config | 162 +++++++-
>  package/utils/mdadm/files/mdadm.init   | 552 ++++++++++++++++++++++---
>  3 files changed, 643 insertions(+), 73 deletions(-)
> 
> diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
> index f20a58b704..d5ea91eeed 100644
> --- a/package/utils/mdadm/Makefile
> +++ b/package/utils/mdadm/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=mdadm
>  PKG_VERSION:=4.1
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
> diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
> index 50afbc2ab6..0c78c964a8 100644
> --- a/package/utils/mdadm/files/mdadm.config
> +++ b/package/utils/mdadm/files/mdadm.config
> @@ -1,18 +1,154 @@
> -config mdadm
> +#
> +# The mdadm 'global' section is for options that apply to all sections.
> +#
> +
> +config mdadm global
> +
> +	#
> +	# option 'alert_program' values may be a path to a valid, executable binary.
> +	#
> +	# The default 'alert_program' is not set.
> +	#
> +	# When mdadm detects an event it will execute this program with 3 arguments, see https://linux.die.net/man/8/mdadm
> +	# $1 = will be the event
> +	# $2 = will be the meta device
> +	# $3 = may be a related component (if one exists)
> +	#
> +	# * alert_program runs independently from sendmail.
> +	# * If both options alert_program and email are set, and both work, then an email and a
> +	#   custom alert will be generated.
> +	# * no alert program is included in mdadm 4.0-4.
> +	#
> +	# Lots of possibilities exist, i.e. scripts for netdata, slack, etc.
> +	#
> +	#option alert_program /usr/sbin/mdadm_alerts
> +
> +
> +	#
> +	# option 'config' values may be one of the following.
> +	#
> +	# The default 'config' is none (stateless auto assembly).
> +	#
> +	# auto		- stateful, dynamically generated mdadm.conf via block info,
> +	#		  stored in /var/etc/mdadm.conf
> +	# containers	- stateless, mdadm --assemble --scan --config=containers; see https://linux.die.net/man/8/mdadm
> +	# none		- stateless, mdadm --assemble --scan --config=none; aka 'Auto Assembly',
> +	#		  see https://linux.die.net/man/8/mdadm
> +	# partition	- stateless, mdadm --assemble --scan --config=partition; see https://linux.die.net/man/8/mdadm
> +	# uci		- stateful, dynamically generated mdadm.conf via uci array values (below),
> +	#		  stored in /var/etc/mdadm.conf
> +	# file		- stateful, manually generated mdadm.conf file(s),
> +	#		  'file' must be preceded by a / and may be a readable filename
> +	#		  or directory with multiple .conf files
> +	#
> +	# Try uncommenting this and using 'auto' if there are issues.  It provides more comprehensive
> +	# diagnostics via verbose messages & the ability to set an email from address.
> +	#
> +	#option config auto
> +
> +
> +	#
> +	# option 'email' values may be a valid (to) email address, or empty.
> +	#
> +	# The default 'email' to send to is root (monitor email will be sent to the local root user).
> +	#
> +	# * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> +	# * Comment, or unset, the email value causes mail to be disabled.  With no email value, mdadm wont even try.
> +	# * A single word name must be a valid user on the system, or it will bounce back to root.
> +	#   Unless user 'mdadm' exists (it doesn't by default), this will bounce:
> +	#   option email mdadm
> +	# * A full email address does not need quoting and will deliver if tcp port 25 (SMTP) is allowed outbound, i.e.
> +	#   option email joseph.tingiris at gmail.com
> +	# * mdadm only supports one email address (MAILADDR) for all arrays. see mdadm.conf(5)
> +	#
> +	# mail will be to 'root@$HOSTNAME', i.e. root at OpenWrt
> +	#
>  	option email root
> -	# list devices /dev/hd*
> -	# list devices /dev/sd*
> -	# list devices partitions
>  
> -config array
> -	option uuid 52c5c44a:d2162820:f75d3464:799750f8
> -	option device /dev/md0
> -	# option name raid:0
> -	# option super_minor 0
> -	# list devices /dev/sda1
> -	# list devices /dev/sdb1
> -	# option spares 0
> -	# option spare_group spares
> +
> +	#
> +	# option 'email_from' values may be a valid (from) email address, or empty.
> +	#
> +	# The default 'email_from' is 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> +	#
> +	# * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> +	# * Comment, or unset, the email_from value causes mdadm to send mail from
> +	#   root@$HOSTNAME, e.g. root at OpenWrt
> +	# * A complete from envelope can be specified within quotes, i.e.
> +	#   option email_from 'mdadm monitoring <this_is_not_spam at example.com>'
> +	# * mdadm only supports setting a from address (MAILFROM) with a stateful config,
> +	#   e.g. 'auto' or 'uci'. see mdadm.conf(5)
> +	#
> +	# mail will be from 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> +	#
> +	option email_from 'OpenWrt RAID Monitoring <mdadm>'
> +
> +
> +	#
> +	# option 'monitor_frequency' values may be a valid integer, or empty.
> +	#
> +	# The default monitor frequency (delayed poll) is 120 seconds.
> +	#
> +	# * This is the polling interval, frequency, or delay.  It's the value for mdadm --delay.  see https://linux.die.net/man/8/mdadm
> +	#
> +	option monitor_frequency 300
> +
> +	#
> +	# option 'verbose' values may be '1', 'on', or 'true', everything else is false.
> +	#
> +	# The default verbosity is false (quiet).
> +	#
> +	# * Standard errors will be sent to console and syslog regardless of this setting.
> +	# * When verbose is false mdadm will run in --quiet mode and generate very little log
> +	#   or standard output.
> +	#
> +	# Turn this on if you're having problems, or want more detail.  With SSH_TTY set output will
> +	# be to that TTY, otherwise it will go to syslog via logger.
> +	#
> +	#option verbose on
> +
> +
> +#
> +# The mdadm 'array' section(s) are for stateful, manual configurations. Experts only.  Use with caution.
> +#
> +#
> +# The use of multiple 'array' sections is supported by /etc/init.d/mdadm.
> +# They must all be named 'array'.
> +#
> +# As of this writing unnamed 'mdadm' sections are still allowed, but deprecated. Do not use.
> +#
> +
> +#config array
> +	#
> +	# example 'array' options may be a valid mix of:
> +	#
> +	# bitmap
> +	# container
> +	# device
> +	# devices
> +	# member
> +	# name
> +	# spare_group
> +	# spares
> +	# super_minor
> +	# uuid
> +	#
>  	# option bitmap /bitmap.md
>  	# option container 00000000:00000000:00000000:00000000
> +	# option device /dev/md0
> +	# -and/or a devices list-
> +	# list devices /dev/hd* # mdadm allows glob, see glob(7)
> +	# list devices /dev/sd*
> +	# list devices /dev/sda1
> +	# list devices /dev/sdb1
> +	# list devices containers
> +	# list devices partitions
>  	# option member 1
> +	# option name raid:0
> +	# option spare_group spares
> +	# option spares 0
> +	# option super_minor 0
> +	# use uuid from block info (preferred), or mdadm --misc --detail /dev/md0
> +	# option uuid 2084de11-70c4-4521-8f95-6113e75f1fe9
> +	#
> +	# These options directly translate to mdadm -- options, see https://linux.die.net/man/8/mdadm
> diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
> index 64a50b35de..eb323ecad0 100644
> --- a/package/utils/mdadm/files/mdadm.init
> +++ b/package/utils/mdadm/files/mdadm.init
> @@ -1,93 +1,527 @@
>  #!/bin/sh /etc/rc.common
>  
> -START=13
> -STOP=98
> +START=12
> +STOP=99
>  
>  USE_PROCD=1
>  PROG=/sbin/mdadm
>  NAME=mdadm
>  
> -CONF="/var/etc/mdadm.conf"
> +LOGGER=0 # off
> +VERBOSE=1 # off
> +
> +TMP_FILE="/var/etc/mdadm.conf" # /var/etc is on /tmp; used for temporary state, to enable stateful only mdadm features
> +
> +[ -x "$PROG" ] || exit 1
>  
>  append_list_item() {
> -	append "$2" "$1" "$3"
> +    append "$2" "$1" "$3"
>  }
>  
>  append_option() {
> -	local var="$1"
> -	local cfg="$2"
> -	local opt="$3"
> -	local name="$4"
> -	local sep="$5"
> -	local str
> -
> -	if [ -n "$sep" ]; then
> -		config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> -	else
> -		config_get str "$cfg" "$opt"
> -	fi
> -
> -	[ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
> +    local var="$1"
> +    local cfg="$2"
> +    local opt="$3"
> +    local name="$4"
> +    local sep="$5"
> +    local str
> +
> +    if [ -n "$sep" ]; then
> +        config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> +    else
> +        config_get str "$cfg" "$opt"
> +    fi
> +
> +    [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
>  }
>  
> -mdadm_common() {
> -	local cfg="$1"
> -	local email devices
> +verbose() {
> +    local msg="$1"
> +    local level="$2"
>  
> -	if [ -x /usr/sbin/sendmail ]; then
> -		config_get email "$cfg" email
> -		[ -n "$email" ] && printf "MAILADDR %s\n" "$email" >> $CONF
> -	fi
> +    [ -z "$level" ] && level="INFO"
>  
> -	config_list_foreach "$cfg" devices append_list_item devices " "
> -	[ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $CONF
> +    [ "$VERBOSE" = "1" ] && {
> +        if [ ${#SSH_TTY} -gt 0 ]; then
> +            printf "$NAME: init %7s - %b\n" "$level" "$msg"
> +        else
> +            # no SSH_TTY goes to logger
> +            printf "$NAME: init %7s - %b\n" "$level" "$msg" | logger -t mdadm
> +        fi
> +    }
>  }
>  
> -mdadm_array() {
> -	local cfg="$1"
> -	local uuid device devices name array
> +mdadm_conf_auto() {
> +    local mdadm_conf="$1"
> +
> +    [ -w "$mdadm_conf" ] || {
> +        if [ -z "$mdadm_conf" ]; then
> +            verbose "mdadm_conf value is empty" ERROR
> +        else
> +            verbose "'$mdadm_conf' file not found writable" ERROR
> +        fi
> +        return 1
> +    }
> +
> +    local block_md block_uuid mdadm_md mdadm_md_rc mdadm_uuid
> +
> +    # Check block info for active linux_raid_members, if necessary then compare with mdadm, & dynamically update $mdadm_conf
> +
> +    block_md=0 # counter
> +    for block_uuid in $(block info 2> /dev/null | sed -nEe 's#^.* UUID="([^"]*)".*TYPE="linux_raid_member"#\1#p'); do
> +        mdadm_md=""
> +        mdadm_md_rc=0
> +
> +        while [ -z "$mdadm_md" ]; do
> +            if [ -b "/dev/md$block_md" ]; then
> +                # handle mdadm restart, service reload, multiple starts without stops, physical unplug, etc.
> +
> +                verbose "/dev/md$block_md block device already exists" NOTICE
>  
> -	config_get uuid "$cfg" uuid
> -	config_get name "$cfg" name
> -	config_get device "$cfg" device
> +                # active arrays will promptly respond; first check
> +                mdadm_uuid=$($PROG --detail --test --brief "/dev/md$block_md" 2> /dev/null | sed -nEe '1s#^.*UUID=((.){35})#\1#p')
>  
> -	if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> -		echo "Skipping array without device, uuid or name" >&2
> -		return
> -	fi
> +                [ -z "$mdadm_uuid" ] && {
> +                    # When an array is unplugged and then plugged in again (without rebooting) then it becomes an INACTIVE-ARRAY
> +                    # however the device file persists, e.g. /dev/md0, and should be reused, rather than a new device assigned.
> +                    if $PROG --detail --test --scan "/dev/md$block_md" 2> /dev/null | grep -E "^(INACTIVE-ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t)metadata)" > /dev/null 2>&1; then
> +                        verbose "attempting to revive INACTIVE-ARRAY on /dev/md$block_md" NOTICE
> +                        if $PROG --examine --scan 2> /dev/null | grep -qE "^(ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t))"; then
> +                            # this is relatively safe with the above regex validation
> +                            mdadm_md="/dev/md$block_md"
> +                        fi
> +                    else
> +                        # This is an unsafe condition to handle with a shell, mdadm sees an inactive device with a different /dev.
> +                        # Err to the side of caution;--assemble --scan shoud know what to do ... it will abandon the block device.
> +                        # If these are happening, suggest stateless & sacrifice some minor functionality, e.g. MAILFROM
> +                        # May be an mdadm or kernel bug with this hardware setup.
> +                        verbose "bug? unsafe to revive INACTIVE-ARRAY on /dev/md$block_md" WARNING
> +                        block_md=$((block_md+1))
> +                        continue
> +                    fi
> +                }
>  
> -	[ -n "$uuid" ] && append array "uuid=$uuid"
> -	[ -n "$name" ] && append array "name=$name"
> +                if [ "${block_uuid//-/}" = "${mdadm_uuid//:/}" ]; then
> +                    # block info & mdadm concur all's well; the meta device is active; reuse
> +                    mdadm_md="/dev/md$block_md"
> +                    verbose "auto conf found active RAID member block_uuid=$block_uuid and will reused device '$mdadm_md'" OK
> +                else
> +                    if [ ! -e "/dev/md$block_md" ]; then
> +                        # this block device was never assembled previously; new
> +                        mdadm_md="/dev/md$block_md"
> +                        verbose "auto conf found new RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> +                    else
> +                        block_md=$((block_md+1))
> +                        continue
> +                    fi
> +                fi
>  
> -	append_option array "$cfg" super_minor
> -	append_option array "$cfg" spares
> -	append_option array "$cfg" spare_group
> -	append_option array "$cfg" bitmap
> -	append_option array "$cfg" container
> -	append_option array "$cfg" member
> -	append_option array "$cfg" devices devices ","
> +            else
> +                if [ ! -e "/dev/md$block_md" ]; then
> +                    # best scenario; no device or file (yet), safest
> +                    mdadm_md="/dev/md$block_md"
> +                    verbose "auto conf found missing RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> +                else
> +                    # a file exists, but it's not a block device? It's possible (touch), albeit a corner case; discretely say
> +                    # we know & pass over it.
> +                    verbose "/dev/md$block_md file found, not a block device" WARNING
> +                    block_md=$((block_md+1))
> +                    continue
> +                fi
> +            fi
>  
> -	printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
> +            $PROG --detail --test --brief $mdadm_md > /dev/null 2>&1 # rc 1=ok, 1=degrade, 2=dead, 4=missing
> +            mdadm_md_rc=$?
> +
> +            # todo: annouce degraded arrays in the logs? mdadmin monitor will do it but not on demand, only per frequency.
> +            #       nice to have for hot plugs ...
> +
> +            verbose "block_md=$block_md, block_uuid=$block_uuid, mdadm_md=$mdadm_md, mdadm_uuid=$mdadm_uuid, rc=$mdadm_md_rc" INFO
> +
> +            if [ $mdadm_md_rc -lt 4 ]; then
> +                $PROG --detail --test --brief $mdadm_md 2> /dev/null >> $mdadm_conf
> +            else
> +                # there's a device with no header.  maybe it's to replace a failed device ...
> +                echo "ARRAY $mdadm_md uuid=$block_uuid" >> $mdadm_conf
> +            fi
> +
> +        done
> +
> +    done
> +
> +    if [ -n "$mdadm_md" ]; then
> +        return 0
> +    else
> +        return 1
> +    fi
> +}
> +
> +mdadm_conf_uci() {
> +    local cfg="$1"
> +    local mdadm_conf="$2"
> +
> +    [ -z "$cfg" ] && {
> +        verbose "cfg is empty" WARNING
> +        return 1
> +    }
> +
> +    local cfg_name
> +    cfg_name=$(uci_get mdadm.$cfg 2> /dev/null)
> +
> +    [ -z "$cfg_name" ] && verbose "($cfg) mdadm config name is empty" NOTICE
> +
> +    [ -z "$mdadm_conf" ] && {
> +        verbose "($cfg) skipping mdadm.$cfg_name array; config file is empty" WARNING
> +        return 1
> +    }
> +
> +    if ! touch "$mdadm_conf" 2> /dev/null; then
> +        verbose "($cfg) skipping mdadm.$cfg_name array; can't touch '$mdadm_conf'" ERROR
> +        return 1
> +    fi
> +
> +    local array device devices name uuid
> +
> +    config_get name "$cfg" name
> +    config_get device "$cfg" device
> +    config_get uuid "$cfg" uuid
> +
> +    config_list_foreach "$cfg" devices append_list_item devices " "
> +    [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $mdadm_conf
> +
> +    if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> +        verbose "($cfg) skipping mdadm.$cfg_name array; no device, uuid, or name" WARNING
> +        return 1
> +    fi
> +
> +    [ -n "$uuid" ] && append array "uuid=$uuid"
> +    [ -n "$name" ] && append array "name=$name"
> +
> +    append_option array "$cfg" super_minor
> +    append_option array "$cfg" spares
> +    append_option array "$cfg" spare_group
> +    append_option array "$cfg" bitmap
> +    append_option array "$cfg" container
> +    append_option array "$cfg" member
> +    append_option array "$cfg" devices devices ","
> +
> +    printf "ARRAY %s %s\n" "$device" "$array" >> $mdadm_conf
> +}
> +
> +reload_service() {
> +    while read -r line; do echo $line; done
> +    # running start_service() on reload should be OK in all modes, except manual configs.
> +    # for auto & none, start_service() already rescans for hotplugged devices, add new arrays, etc.
> +    # could check for the configured mode & call appropriately?  doing nothing is safer; todo: test & resolve
> +    verbose "reload_service called, ignoring" NOTICE
> +    return 0
>  }
>  
>  start_service() {
> -	local email
> +    local config config_detail config_file config_level config_mode config_rc config_state config_verbose mdadm_conf
> +
> +    # mdadm.global specific locals
> +    local alert_program email email_from mail_program mdadm_args monitor_frequency
> +
> +    config_verbose=$(uci_get mdadm.global.verbose 2> /dev/null | awk '{print tolower($1)}')

Suggest replace awk with `tr 'A-Z' 'a-z'`. Invoking awk for the sake of
lowercasing option values (which is done in no other init script) seems overkill.

> +    if [ "$config_verbose" = "1" ] || [ "$config_verbose" = "on" ] || [ "$config_verbose" = "true" ]; then
> +        VERBOSE=1 # turn verbose on globally
> +        config_verbose=1
> +        mdadm_args="--verbose"
> +    else
> +        unset -v config_verbose
> +        mdadm_args="--quiet"
> +    fi
> +
> +    verbose "start_service $*" INFO
> +
> +    config_rc=0
> +    config_detail="start"
> +    config_level="INFO"
> +    config_mode="service"
> +
> +    config=$(uci_get mdadm.global.config 2> /dev/null)
> +    if [ -z "$config" ]; then
> +        # per PR1713 discussion; this works very well for the majority of use cases; let mdadm do the heavy lifting.
> +        # none is (Auto Assemble; or no --config); see mdadm(8), default
> +        config='none'
> +        config_detail="mdadm.global.config value is empty"
> +        config_state='stateless'
> +        config_mode="default"
> +        config_level='OK'
> +    else
> +        # experts only
>  
> -	mkdir -p "${CONF%/*}"
> -	printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
> +        config_mode="manual"
>  
> -	config_load mdadm
> -	config_foreach mdadm_common mdadm
> -	config_foreach mdadm_array array
> +        # check file values first, to preserve case of file name values
> +        if [ "${config:0:1}" = "/" ]; then
> +            config_state='stateful' # all types of file configs are stateful
>  
> -	$PROG --assemble --scan --config="$CONF"
> +            if [ -d "$config" ] && [ -r "$config" ]; then
> +                local config_file_count=0
> +                for config_file in ${config}/*.conf; do
> +                    if [ -r "$config_file" ]; then
> +                        config_file_count=$((config_file_count+1))
> +                    fi
> +                done
> +                if [ $config_file_count -eq 0 ]; then
> +                    config_level="WARNING"
> +                else
> +                    config_level="OK"
> +                fi
> +                config_detail="directory found with $config_file_count readable .conf files"
> +            else
> +                if [ -w "$config" ]; then
> +                    if [ -s "$config" ]; then
> +                        # regardless, this will rely on mdadm for final validation; for informational purposes ...
> +                        grep -E '^((DEVICE){1}(\ |\t)(.*)(/dev/|containers|partitions))' "$config" > /dev/null 2>&1 # pattern per mdadm(8)
> +                        if [ $? -eq 0 ]; then
> +                            config_detail="file found, readable with a ^DEVICE"
> +                            config_level="OK"
> +                        else
> +                            config_detail="file found, readable without a ^DEVICE"
> +                            config_level="WARNING"
> +                        fi
> +                    else
> +                        config_detail="file found, writable and empty"
> +                        config_level="OK"
> +                    fi
> +                else
> +                    config_detail="file not found, unwritable"
> +                    config_level="FATAL"
> +                    config_rc=1
> +                fi
> +            fi
> +        else
> +            config_mode="dynamic"
>  
> -	procd_open_instance
> -	procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
> -	procd_close_instance
> +            # allow static values in mixed case; convert to lower
> +            config="$(awk -v config="$config" 'BEGIN{print tolower(config)}')"

`tr 'A-Z' 'a-z'`

> +            if [ "$config" = "containers" ] || [ "$config" = "none" ] || [ "$config" = "partition" ]; then
> +                # pass through to mdadm --config=
> +                config_detail="dynamic; uci static key value"
> +                config_level="OK"
> +                config_state='stateless'
> +            else
> +                if [ "$config" = "auto" ] || [ "$config" = "uci" ]; then
> +                    config_detail="dynamic; $config config"
> +                    config_level="OK"
> +                    config_state='stateful'
> +                    mdadm_conf="$TMP_FILE"
> +                else
> +                    config_detail="invalid; unsupported uci config key value"
> +                    config_level="FATAL"
> +                    config_state='stateful'
> +                    config_rc=1
> +                fi
> +            fi
> +        fi
> +    fi
> +
> +    # final safety & functional checks
> +
> +    # check for fatality
> +    [ -z "$config" ] && {
> +        config="${config}?"
> +        config_detail="$config_detail (sorry, something went wrong; check the config settings)"
> +        config_level="FATAL"
> +        config_mode="${config_mode}?"
> +        config_state="${config_state}?"
> +        config_rc=1
> +    }
> +
> +    # Prefer mdadm.global.email; only one is allowed and can be an --email argument per mdadm.conf(5)
> +    email=$(uci_get mdadm.global.email 2> /dev/null)
> +
> +    # mdadm (or postfix?) bug; workaround.  mdadm 4.0 for 18.06.1 has a compiled in default of '/usr/lib/sendmail -t'.
> +    # There's no configurable way to change it and mdadm must be recompiled differently for Openwrt, or posfix should
> +    # add the link. In 18.06.1, postfix 3.3.0-1 installs sendmail in /usr/sbin; mdadm complains & no mail is delivered.
> +    # Other distro's postfix pkg typically installs this link ... or one in /etc/alternatives.
> +    # Since mdadm needs it, I'm adding it here to be sure mdadm can send email if there's a /usr/sbin/sendmail.
> +
> +    # There's really no point in making mdadm's compiled in sendmail configurable via uci.
> +    mail_program="/usr/lib/sendmail"
> +    [ -x /usr/sbin/sendmail ] && [ ! -e "$mail_program" ] && {
> +        # a sym link will suffice
> +        if ! ln -s /usr/sbin/sendmail "$mail_program"; then
> +            verbose "ln -s /usr/bin/sendmail /usr/lib/sendmail failed" WARNING
> +        fi
> +    }

Remove this workaround, packages should be fixed instead.

> +
> +    [ -x "$mail_program" ] || {
> +        verbose "disabling email; mail program '/usr/lib/sendmail' not found executable (install postfix)" WARNING
> +        email=""
> +    }
> +
> +    if [ "$config_state" = "stateful" ] && [ -n "$mdadm_conf" ]; then
> +        if mkdir -p "${mdadm_conf%/*}" > /dev/null 2>&1; then
> +            printf "# Autogenerated from /etc/init.d/mdadm, do not edit!\n" > $mdadm_conf
> +
> +            # Use mdadm.global.email_from only if there's a valid mta; only one is allowed per mdadm.conf(5)
> +            # todo: see what other mtas Openwrt has in their opkg repos & maybe support others
> +            [ -x "$mail_program" ] && email_from=$(uci_get mdadm.global.email_from 2> /dev/null)
> +
> +            if [ "$config" = "auto" ]; then
> +                # stateful mdadm.conf auto configuration
> +                if ! mdadm_conf_auto "$mdadm_conf"; then
> +                    #there's quite a bit of logic & error handling in mdadm_conf_auto; if it doesn't return 0 then it's a fatality
> +                    config_detail="$config_detail (couldn't find any meta devices; check connections, or try stateless autoconfig)"
> +                    config_level="FATAL"
> +                    config_rc=1
> +                fi
> +            else
> +                # stateful mdadm.conf uci configuration
> +
> +                # load uci config from /etc/config/mdadm
> +                config_load mdadm
> +
> +                # This is how mdadm uci mdadm config sections should be named, like fstab does with 'mount'.
> +                # The included uci /etc/config/mdadm provides more documentation & direction.
> +                config_foreach mdadm_conf_uci array "$mdadm_conf"
> +
> +                # The unlabled mdadm. at mdadm[0] section should be (is now) deprecated.
> +                # It's more difficult to document how to use, redundant, and over complicated this init configuration.
> +
> +                # Confused; originally config_foreach?
> +                # It's possible to specify multiple mdadm sections with array options in all sections.
> +                # Thus multiple option emails which could result in multiple MAILADDR being appended to mdadm.conf.
> +                # That confuses mdadm.
> +
> +                # The following code is here to prevent regressions.
> +
> +                config_foreach mdadm_conf_uci mdadm "$mdadm_conf"
> +
> +                # For backward compatibility; this will allow an mdadm. at mdadm[0] section's option email.
> +                # (only if mdadm.global.email is not set; again, prefer mdadm.global.email)
> +                #
> +                # bug fixed. The first legacy mdadm section option email will be used.
> +                # a better fix would be to *only* support array sections.
> +                #
> +                [ -z "$email" ] && [ -x "$mail_program" ] && email=$(uci_get mdadm. at mdadm[0].email 2> /dev/null)
> +                # email_from is a new feature; was not previously handled; no need to and please don't backport
> +
> +            fi
> +
> +            # This is nice feature to have to get mdadm mails through spam filters, etc.
> +            # Too bad mdadm (4.0) doesn't have an argument for it.
> +            # Maybe mdadm 4.1 will ... todo: revisit when making mdadm 4.1 & it's in Openwrt mainline.
> +            # This tests successfully with the postfix workaround above & mdadm 4.0.
> +            [ -x "$mail_program" ] && {
> +                printf "MAILFROM %s\n" "$email_from" >> $mdadm_conf # only supported via stateful configs; see mdadm.conf(5)
> +            }
> +
> +            [ -n "$config_verbose" ] && [ -r "$mdadm_conf" ] && {
> +                verbose "mdadm_conf = $mdadm_conf (config_verbose=$config_verbose)" INFO
> +                verbose "---cut $mdadm_conf cut---" INFO
> +                while read -r line; do
> +                    verbose "$line" INFO
> +                done < "$mdadm_conf"
> +                unset -v line
> +                verbose "---cut $mdadm_conf cut---" INFO
> +            }
> +
> +        else
> +            config_detail="$config_detail (mkdir failed; check permissions)"
> +            config_level="FATAL"
> +            config_rc=1
> +        fi
> +    fi
> +
> +    [ $config_rc -ne 0 ] && {
> +        # FATAL
> +        verbose "$config_state,$config_mode config='$config', $config_detail" "$config_level" INFO
> +        [ -n "$mdadm_conf" ] && [ -w "$mdadm_conf" ] && rm -f "$mdadm_conf"
> +        exit $config_rc
> +    }
> +
> +    # Good to go, no more fatal exits, finish getting global & setting local values ... they're all optional.
> +
> +    mdadm_args="$mdadm_args --scan"
> +
> +    if [ -n "$mdadm_conf" ]; then
> +        # mdadm.global.config </file>
> +        mdadm_args="$mdadm_args --config=$mdadm_conf"
> +    else
> +        # mdadm.global.config all (containers, partitions, etc), except none
> +        [ -n "$config" ] && [ "$config" != 'none' ] && mdadm_args="$mdadm_args --config=$config"
> +    fi
> +
> +    local assemble_count assemble_rc
> +
> +    assemble_count=$($PROG --detail --brief --scan 2> /dev/null | wc -l)
> +    verbose "$assemble_count arrays are currently assembled" INFO
> +
> +    # setup assembly mode
> +
> +    verbose "(assemble) '$PROG --assemble $mdadm_args'" INFO
> +    $PROG --assemble $mdadm_args > /dev/null 2>&1
> +    assemble_rc=$?
> +
> +    if [ $assemble_rc -eq 0 ]; then
> +        verbose "all arrays assembled successfully" OK
> +        [ -n "$config_verbose" ] && {
> +            true > /var/log/mdadm.detail
> +            local assemble_dev assemble_devs
> +            assemble_devs=$($PROG --detail --brief --scan | awk '{print $2}')
> +            for assemble_dev in $assemble_devs; do
> +             {
> +                printf "\n"
> +                $PROG --verbose --detail $assemble_dev
> +                printf "\n"
> +             } >> /var/log/mdadm.detail
> +            done
> +            unset -v assemble_dev
> +            while read -r line; do
> +                verbose "$line" INFO
> +            done < "/var/log/mdadm.detail"
> +            unset -v line
> +        }
> +    else
> +        if [ $assemble_count -eq 0 ]; then
> +            verbose "no arrays assembled successfully" ERROR
> +        else
> +            verbose "no new arrays need assembly" NOTICE
> +        fi
> +    fi
> +
> +    # setup monitor mode
> +
> +    alert_program=$(uci_get mdadm.global.alert_program 2> /dev/null)
> +    [ -n "$alert_program" ] && {
> +        if [ -x "$alert_program" ]; then
> +            mdadm_args="$mdadm_args --alert=$alert_program"
> +        else
> +            verbose "disabling alerts; alert_progam '$alert_program' not found executable" WARNING
> +        fi
> +    }
> +
> +    [ -n "$email" ] && mdadm_args="$mdadm_args --mail=$email"
> +
> +    monitor_frequency=$(uci_get mdadm.global.monitor_frequency 2> /dev/null | sed -e 's/[^0-9]*//g')
> +    [ -n "$monitor_frequency" ] && {
> +        mdadm_args="$mdadm_args --delay=$monitor_frequency"
> +        verbose "setting monitor frequency to '$monitor_frequency' seconds"
> +    }
> +
> +    verbose "(monitor) '$PROG --monitor --syslog $mdadm_args'" INFO
> +
> +    # /etc/rc.common doesn't like valid sh constructs like while read line; do echo $line; done <<< "$(echo hello; echo world)" # 8|
> +    # Taking the time machine back to sh is rough enough as it is ... I need to better understand its purpose. I spent too much time
> +    # in /lib/functions.  It's all circa 2006-2013.  Yikes.  Where's the man pages?  Or even code comments?  It would've been way
> +    # easier just to do *everything* the good ol' sysvinit fashioned way, or use systemd.  Just a gripe, I really do like OpenWrt.

Remove this comment.

> +    procd_open_instance
> +    procd_set_param command "$PROG" --monitor --syslog $mdadm_args
> +    procd_close_instance
> +
> +    verbose "$config_state,$config_mode config=$config, $config_detail complete" "$config_level"
>  }
>  
>  stop_service() {
> -	$PROG --stop --scan
> +    $PROG --stop --scan
> +    if echo "here VERBOSE=$VERBOSE"; then

This looks like debug code. To me it seems the condition will always be true.

> +        verbose "'$PROG --stop --scan' stop_service succeeded" OK
> +    else
> +        verbose "'$PROG --stop --scan' stop_service failed" ERROR
> +    fi
>  }
> -
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/311fc845/attachment-0001.sig>

From rosenp at gmail.com  Thu Sep 10 04:41:37 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Thu, 10 Sep 2020 01:41:37 -0700
Subject: [PATCH] libcxxabi: fix compilation under the SDK
In-Reply-To: <0e530d7d-7ddd-a2ab-0a90-56f9dc552fe1@wwsnet.net>
References: <20200910032244.21726-1-rosenp@gmail.com>
 <0e530d7d-7ddd-a2ab-0a90-56f9dc552fe1@wwsnet.net>
Message-ID: <CAKxU2N866po6GQXp1_r2PEZdRJ9oJ5o4ugj6iwSGRv=PaJLW-g@mail.gmail.com>

On Thu, Sep 10, 2020 at 1:25 AM Jo-Philipp Wich <jo at mein.io> wrote:
>
> Hi,
>
> > +     $(MAKE) -C $(TOPDIR)/$(if $(CONFIG_IN_SDK),feeds/base/)package/libs/libcxx prepare
>
> this looks like an ugly hack,
Yes it is.
> also the feed is not guaranteed to reside in
> feeds/base/ - the user can theoretically change the name of the base feed.
>
> Why does this package need to trigger an prepare in a foreign package anyway?
> Isn't it enough to PKG_BUILD_DEPEND on base-files?
It's a circular dependency. Rather, libcxxabi depends on headers
provided by libcxx. But libcxx itself depends on libcxxabi.
>
> ~ Jo
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From zajec5 at gmail.com  Thu Sep 10 04:53:49 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Thu, 10 Sep 2020 10:53:49 +0200
Subject: [PATCH V4 rpc] rc: new ubus object for handling /etc/init.d/ scripts
Message-ID: <20200910085349.5129-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

This commit adds "rc" ubus object with methods "list" and "exec" for
listing and calling init.d script appropriately. It's useful for all
kind of UIs (e.g. LuCI) and custom apps.

Example:
root at OpenWrt:~# ubus call rc list
{
	"blockd": {
		"enabled": true,
		"running": true
	},
	"dnsmasq": {
		"enabled": true,
		"running": true
	}
}
root at OpenWrt:~# ubus call rc init '{ "name": "blockd", "action": "disable" }'
root at OpenWrt:~# ubus call rc init '{ "name": "dnsmasq", "action": "stop" }'
root at OpenWrt:~# ubus call rc list
{
	"blockd": {
		"enabled": false,
		"running": true
	},
	"dnsmasq": {
		"enabled": true,
		"running": false
	}
}

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
V2: Use ubus_defer_request() and uloop_process_add() when callinig
    init.d scripts. It's required as rpcd is single thread so waitpid()
    could stop it from processing requests initiaited by init.d scripts.
    Add timer to kill hanging init.d calls.
V3: Add uloop_end()
    close(fd) only for fd > 2
V4: Add "start" and "stop"
    Use /etc/rc.d/S* to check for script being enabled. On bcm53xx it
    speeds up "list" call from 1.24s to 0.72s (24 scripts).
---
 CMakeLists.txt    |   2 +-
 include/rpcd/rc.h |   7 +
 main.c            |   6 +-
 rc.c              | 359 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 371 insertions(+), 3 deletions(-)
 create mode 100644 include/rpcd/rc.h
 create mode 100644 rc.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3bfc286..26e011e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@ INCLUDE_DIRECTORIES(${ubus_include_dir})
 FIND_PATH(ubox_include_dir libubox/blobmsg_json.h)
 INCLUDE_DIRECTORIES(${ubox_include_dir})
 
-ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c plugin.c)
+ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c rc.c plugin.c)
 TARGET_LINK_LIBRARIES(rpcd ${ubox} ${ubus} ${uci} ${blobmsg_json} ${json} ${crypt} dl)
 
 SET(PLUGINS "")
diff --git a/include/rpcd/rc.h b/include/rpcd/rc.h
new file mode 100644
index 0000000..ca00f56
--- /dev/null
+++ b/include/rpcd/rc.h
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: ISC OR MIT
+#ifndef __RPCD_RC_H
+#define __RPCD_RC_H
+
+int rpc_rc_api_init(struct ubus_context *ctx);
+
+#endif
diff --git a/main.c b/main.c
index 9a177cf..d77a814 100644
--- a/main.c
+++ b/main.c
@@ -25,10 +25,11 @@
 #include <signal.h>
 #include <sys/stat.h>
 
+#include <rpcd/exec.h>
+#include <rpcd/plugin.h>
+#include <rpcd/rc.h>
 #include <rpcd/session.h>
 #include <rpcd/uci.h>
-#include <rpcd/plugin.h>
-#include <rpcd/exec.h>
 
 static struct ubus_context *ctx;
 static bool respawn = false;
@@ -113,6 +114,7 @@ int main(int argc, char **argv)
 
 	rpc_session_api_init(ctx);
 	rpc_uci_api_init(ctx);
+	rpc_rc_api_init(ctx);
 	rpc_plugin_api_init(ctx);
 
 	hangup = getenv("RPC_HANGUP");
diff --git a/rc.c b/rc.c
new file mode 100644
index 0000000..35be544
--- /dev/null
+++ b/rc.c
@@ -0,0 +1,359 @@
+// SPDX-License-Identifier: ISC OR MIT
+/*
+ * rpcd - UBUS RPC server
+ *
+ * Copyright (C) 2020 Rafa? Mi?ecki <rafal at milecki.pl>
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <linux/limits.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include <libubox/blobmsg.h>
+#include <libubox/ulog.h>
+#include <libubox/uloop.h>
+#include <libubus.h>
+
+#include <rpcd/rc.h>
+
+#define RC_LIST_EXEC_TIMEOUT_MS			3000
+
+enum {
+	RC_INIT_NAME,
+	RC_INIT_ACTION,
+	__RC_INIT_MAX
+};
+
+static const struct blobmsg_policy rc_init_policy[] = {
+	[RC_INIT_NAME] = { "name", BLOBMSG_TYPE_STRING },
+	[RC_INIT_ACTION] = { "action", BLOBMSG_TYPE_STRING },
+};
+
+struct rc_list_context {
+	struct uloop_process process;
+	struct uloop_timeout timeout;
+	struct ubus_context *ctx;
+	struct ubus_request_data req;
+	struct blob_buf *buf;
+	DIR *dir;
+
+	/* Info about currently processed init.d entry */
+	struct {
+		char path[PATH_MAX];
+		const char *d_name;
+		unsigned int start;
+		unsigned int stop;
+		bool enabled;
+		bool running;
+	} entry;
+};
+
+static void rc_list_readdir(struct rc_list_context *c);
+
+/**
+ * rc_check_script - check if script is safe to execute as root
+ *
+ * Check if it's owned by root and if only root can modify it.
+ */
+static int rc_check_script(const char *path)
+{
+	struct stat s;
+
+	if (stat(path, &s))
+		return UBUS_STATUS_NOT_FOUND;
+
+	if (s.st_uid != 0 || s.st_gid != 0 || !(s.st_mode & S_IXUSR) || (s.st_mode & S_IWOTH))
+		return UBUS_STATUS_PERMISSION_DENIED;
+
+	return UBUS_STATUS_OK;
+}
+
+static void rc_list_add_table(struct rc_list_context *c)
+{
+	void *e;
+
+	e = blobmsg_open_table(c->buf, c->entry.d_name);
+
+	if (c->entry.start)
+		blobmsg_add_u16(c->buf, "start", c->entry.start);
+	if (c->entry.stop)
+		blobmsg_add_u16(c->buf, "stop", c->entry.stop);
+	blobmsg_add_u8(c->buf, "enabled", c->entry.enabled);
+	blobmsg_add_u8(c->buf, "running", c->entry.running);
+
+	blobmsg_close_table(c->buf, e);
+}
+
+static void rpc_list_exec_timeout_cb(struct uloop_timeout *t)
+{
+	struct rc_list_context *c = container_of(t, struct rc_list_context, timeout);
+
+	ULOG_WARN("Timeout waiting for %s\n", c->entry.path);
+
+	uloop_process_delete(&c->process);
+	kill(c->process.pid, SIGKILL);
+
+	rc_list_readdir(c);
+}
+
+/**
+ * rc_exec - execute a file and call callback on complete
+ */
+static int rc_list_exec(struct rc_list_context *c, const char *action, uloop_process_handler cb)
+{
+	pid_t pid;
+	int err;
+	int fd;
+
+	pid = fork();
+	switch (pid) {
+	case -1:
+		return -errno;
+	case 0:
+		/* Set stdin, stdout & stderr to /dev/null */
+		fd = open("/dev/null", O_RDWR);
+		if (fd >= 0) {
+			dup2(fd, 0);
+			dup2(fd, 1);
+			dup2(fd, 2);
+			if (fd > 2)
+				close(fd);
+		}
+
+		uloop_end();
+
+		execl(c->entry.path, c->entry.path, action, NULL);
+		exit(errno);
+	default:
+		c->process.pid = pid;
+		c->process.cb = cb;
+
+		err = uloop_process_add(&c->process);
+		if (err)
+			return err;
+
+		c->timeout.cb = rpc_list_exec_timeout_cb;
+		err = uloop_timeout_set(&c->timeout, RC_LIST_EXEC_TIMEOUT_MS);
+		if (err) {
+			uloop_process_delete(&c->process);
+			return err;
+		}
+
+		return 0;
+	}
+}
+
+static void rc_list_exec_running_cb(struct uloop_process *p, int stat)
+{
+	struct rc_list_context *c = container_of(p, struct rc_list_context, process);
+
+	uloop_timeout_cancel(&c->timeout);
+
+	c->entry.running = !stat;
+	rc_list_add_table(c);
+
+	rc_list_readdir(c);
+}
+
+static void rc_list_readdir(struct rc_list_context *c)
+{
+	struct dirent *e;
+	FILE *fp;
+
+	e = readdir(c->dir);
+	if (!e) {
+		closedir(c->dir);
+		ubus_send_reply(c->ctx, &c->req, c->buf->head);
+		ubus_complete_deferred_request(c->ctx, &c->req, UBUS_STATUS_OK);
+		return;
+	}
+
+	if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, ".."))
+		goto next;
+
+	memset(&c->entry, 0, sizeof(c->entry));
+
+	snprintf(c->entry.path, sizeof(c->entry.path), "/etc/init.d/%s", e->d_name);
+	if (rc_check_script(c->entry.path))
+		goto next;
+
+	c->entry.d_name = e->d_name;
+
+	fp = fopen(c->entry.path, "r");
+	if (fp) {
+		struct stat s;
+		char path[PATH_MAX];
+		char line[128];
+
+		while (!c->entry.start && !c->entry.stop && fgets(line, sizeof(line), fp)) {
+			char *ch;
+
+			if ((ch = strstr(line, "START="))) {
+				c->entry.start = strtoul(ch + 6, NULL, 0);
+			} else if ((ch = strstr(line, "STOP="))) {
+				c->entry.stop = strtoul(ch + 5, NULL, 0);
+			}
+		}
+		fclose(fp);
+
+		snprintf(path, sizeof(path), "/etc/rc.d/S%02d%s", c->entry.start, c->entry.d_name);
+		if (!stat(path, &s) && (s.st_mode & S_IXUSR))
+			c->entry.enabled = true;
+	}
+
+	if (rc_list_exec(c, "running", rc_list_exec_running_cb))
+		goto next;
+
+	return;
+next:
+	rc_list_readdir(c);
+}
+
+/**
+ * rc_list - allocate listing context and start reading directory
+ */
+static int rc_list(struct ubus_context *ctx, struct ubus_object *obj,
+		   struct ubus_request_data *req, const char *method,
+		   struct blob_attr *msg)
+{
+	static struct blob_buf buf;
+	struct rc_list_context *c;
+
+	blob_buf_init(&buf, 0);
+
+	c = calloc(1, sizeof(*c));
+	if (!c)
+		return UBUS_STATUS_UNKNOWN_ERROR;
+
+	c->ctx = ctx;
+	c->buf = &buf;
+	c->dir = opendir("/etc/init.d");
+	if (!c->dir) {
+		free(c);
+		return UBUS_STATUS_UNKNOWN_ERROR;
+	}
+
+	ubus_defer_request(ctx, req, &c->req);
+
+	rc_list_readdir(c);
+
+	return 0; /* Deferred */
+}
+
+struct rc_init_context {
+	struct uloop_process process;
+	struct ubus_context *ctx;
+	struct ubus_request_data req;
+};
+
+static void rc_init_cb(struct uloop_process *p, int stat)
+{
+	struct rc_init_context *c = container_of(p, struct rc_init_context, process);
+
+	ubus_complete_deferred_request(c->ctx, &c->req, UBUS_STATUS_OK);
+
+	free(c);
+}
+
+static int rc_init(struct ubus_context *ctx, struct ubus_object *obj,
+		   struct ubus_request_data *req, const char *method,
+		   struct blob_attr *msg)
+{
+	struct blob_attr *tb[__RC_INIT_MAX];
+	struct rc_init_context *c;
+	char path[PATH_MAX];
+	const char *action;
+	const char *name;
+	const char *chr;
+	pid_t pid;
+	int err;
+	int fd;
+
+	blobmsg_parse(rc_init_policy, __RC_INIT_MAX, tb, blobmsg_data(msg), blobmsg_data_len(msg));
+
+	if (!tb[RC_INIT_NAME] || !tb[RC_INIT_ACTION])
+		return UBUS_STATUS_INVALID_ARGUMENT;
+
+	name = blobmsg_get_string(tb[RC_INIT_NAME]);
+
+	/* Validate script name */
+	for (chr = name; (chr = strchr(chr, '.')); chr++) {
+		if (*(chr + 1) == '.')
+			return UBUS_STATUS_INVALID_ARGUMENT;
+	}
+	if (strchr(name, '/'))
+		return UBUS_STATUS_INVALID_ARGUMENT;
+
+	snprintf(path, sizeof(path), "/etc/init.d/%s", name);
+
+	/* Validate script privileges */
+	err = rc_check_script(path);
+	if (err)
+		return err;
+
+	action = blobmsg_get_string(tb[RC_INIT_ACTION]);
+	if (strcmp(action, "disable") &&
+	    strcmp(action, "enable") &&
+	    strcmp(action, "stop") &&
+	    strcmp(action, "start") &&
+	    strcmp(action, "restart") &&
+	    strcmp(action, "reload"))
+		return UBUS_STATUS_INVALID_ARGUMENT;
+
+	c = calloc(1, sizeof(*c));
+	if (!c)
+		return UBUS_STATUS_UNKNOWN_ERROR;
+
+	pid = fork();
+	switch (pid) {
+	case -1:
+		free(c);
+		return UBUS_STATUS_UNKNOWN_ERROR;
+	case 0:
+		/* Set stdin, stdout & stderr to /dev/null */
+		fd = open("/dev/null", O_RDWR);
+		if (fd >= 0) {
+			dup2(fd, 0);
+			dup2(fd, 1);
+			dup2(fd, 2);
+			if (fd > 2)
+				close(fd);
+		}
+
+		uloop_end();
+
+		execl(path, path, action, NULL);
+		exit(errno);
+	default:
+		c->ctx = ctx;
+		c->process.pid = pid;
+		c->process.cb = rc_init_cb;
+		uloop_process_add(&c->process);
+
+		ubus_defer_request(ctx, req, &c->req);
+
+		return 0; /* Deferred */
+	}
+}
+
+int rpc_rc_api_init(struct ubus_context *ctx)
+{
+	static const struct ubus_method rc_methods[] = {
+		UBUS_METHOD_NOARG("list", rc_list),
+		UBUS_METHOD("init", rc_init, rc_init_policy),
+	};
+
+	static struct ubus_object_type rc_type =
+		UBUS_OBJECT_TYPE("rc", rc_methods);
+
+	static struct ubus_object obj = {
+		.name = "rc",
+		.type = &rc_type,
+		.methods = rc_methods,
+		.n_methods = ARRAY_SIZE(rc_methods),
+	};
+
+	return ubus_add_object(ctx, &obj);
+}
-- 
2.27.0



From rosenp at gmail.com  Thu Sep 10 04:55:46 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Thu, 10 Sep 2020 01:55:46 -0700
Subject: [OpenWrt-Devel] [PATCHv3] mdadm: revised mdadm config & init logic
In-Reply-To: <5fba4d4e-22fa-a8bb-91f0-c68f4d7fa915@wwsnet.net>
References: <20200123025658.1416676-1-rosenp@gmail.com>
 <5fba4d4e-22fa-a8bb-91f0-c68f4d7fa915@wwsnet.net>
Message-ID: <CAKxU2N-V4gd3m-8R3OM5JyXPecjpQt47E6YtSOcUf0xEaFmJFg@mail.gmail.com>

On Thu, Sep 10, 2020 at 1:40 AM Jo-Philipp Wich <jo at mein.io> wrote:
>
> Hi,
>
> comments inline.
>
> On 1/23/20 3:56 AM, Rosen Penev wrote:
> > From: Joseph Tingiris <joseph.tingiris at gmail.com>
> >
> > This is a significant revision of /etc/init.d/mdadm.  It adds new
> > features, support for new configuration options, safer error
> > handling, (configurable) verbose output, and contains multiple bug
> > fixes.
> >
> > Most notably, mdadm was being started with the --config flag and
> > that prevented it from using its built in Auto Assembly features.
> > Users were required to put a correct uuid in /etc/config/mdadm.
> >
> > The new default startup mode is now to automatically assemble all
> > RAID arrays attached to the machine using device scans, rather than
> > configuation options.
> >
> > A new UCI section, config mdadm global, was added with new options that
> > are supported by the accompanying /etc/init.d/mdadm. Documentation for all
> > new (and previous) options was added as well.  See the
> > /etc/config/mdadmin or mdadm.init file itself for more details.
> >
> > Additionally, a new stateful 'auto' feature was added that functions
> > similarly to the stateless Auto Assembly feature.  The benefits of
> > stateful auto assembly are to support features that mdadm 4.0 will only
> > read from a configuration file, such as setting the MAILFROM value.  The
> > new mdadm_conf_auto() function will also aid users in troubleshooting.
> > When verbose is turned on it provides tips and better visibility for what's
> > actually happening.
> >
> > Backward compatibility was retained.  Stateful UCI only configurations are
> > supported.  All previously existing configurations will work in this mode.
> > However, these users will now have to explicitly turn it on.
> >
> > A new reload_service() function was added to prevent reloads from
> > stopping mdadm.  Reloads will now be ignored, though the stage is set for
> > reloads to trigger scans for new devices.  Explicit restarts still work as
> > expected.
> >
> > The start_service() function was enhanced to query new UCI mdadm.global
> > options: alert_program, config, email, email_from, monitor_frequency,
> > and verbose.  Each option is documented in /etc/mdadm/config (config.init) and
> > some additional code comments were added.
> >
> > Finally, error handling and verbose output was enhanced.  Users will
> > know what's going on (if verbose is turned on).
> >
> > Strict reliance on a shell global ($CONF) was removed and replaced with a
> > single global ($TMP_FILE) that's for development convenience.  When/if a config
> > file is not specified in the UCI config, it will fall back to using $TMP_FILE as the
> > configuration file.
> >
> > Incremented PKG_RELEASE from 1 to 2
> >
> > Signed-off-by: Joseph Tingiris <joseph.tingiris at gmail.com>
> > (rebased and ran through shellcheck)
> > Signed-off-by: Rosen Penev <rosenp at gmail.com>
> > ---
> >  v3: Simplified several sections
> >  v2: Rebased after sysmacro patches
> >  package/utils/mdadm/Makefile           |   2 +-
> >  package/utils/mdadm/files/mdadm.config | 162 +++++++-
> >  package/utils/mdadm/files/mdadm.init   | 552 ++++++++++++++++++++++---
> >  3 files changed, 643 insertions(+), 73 deletions(-)
> >
> > diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
> > index f20a58b704..d5ea91eeed 100644
> > --- a/package/utils/mdadm/Makefile
> > +++ b/package/utils/mdadm/Makefile
> > @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=mdadm
> >  PKG_VERSION:=4.1
> > -PKG_RELEASE:=2
> > +PKG_RELEASE:=3
> >
> >  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
> >  PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
> > diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
> > index 50afbc2ab6..0c78c964a8 100644
> > --- a/package/utils/mdadm/files/mdadm.config
> > +++ b/package/utils/mdadm/files/mdadm.config
> > @@ -1,18 +1,154 @@
> > -config mdadm
> > +#
> > +# The mdadm 'global' section is for options that apply to all sections.
> > +#
> > +
> > +config mdadm global
> > +
> > +     #
> > +     # option 'alert_program' values may be a path to a valid, executable binary.
> > +     #
> > +     # The default 'alert_program' is not set.
> > +     #
> > +     # When mdadm detects an event it will execute this program with 3 arguments, see https://linux.die.net/man/8/mdadm
> > +     # $1 = will be the event
> > +     # $2 = will be the meta device
> > +     # $3 = may be a related component (if one exists)
> > +     #
> > +     # * alert_program runs independently from sendmail.
> > +     # * If both options alert_program and email are set, and both work, then an email and a
> > +     #   custom alert will be generated.
> > +     # * no alert program is included in mdadm 4.0-4.
> > +     #
> > +     # Lots of possibilities exist, i.e. scripts for netdata, slack, etc.
> > +     #
> > +     #option alert_program /usr/sbin/mdadm_alerts
> > +
> > +
> > +     #
> > +     # option 'config' values may be one of the following.
> > +     #
> > +     # The default 'config' is none (stateless auto assembly).
> > +     #
> > +     # auto          - stateful, dynamically generated mdadm.conf via block info,
> > +     #                 stored in /var/etc/mdadm.conf
> > +     # containers    - stateless, mdadm --assemble --scan --config=containers; see https://linux.die.net/man/8/mdadm
> > +     # none          - stateless, mdadm --assemble --scan --config=none; aka 'Auto Assembly',
> > +     #                 see https://linux.die.net/man/8/mdadm
> > +     # partition     - stateless, mdadm --assemble --scan --config=partition; see https://linux.die.net/man/8/mdadm
> > +     # uci           - stateful, dynamically generated mdadm.conf via uci array values (below),
> > +     #                 stored in /var/etc/mdadm.conf
> > +     # file          - stateful, manually generated mdadm.conf file(s),
> > +     #                 'file' must be preceded by a / and may be a readable filename
> > +     #                 or directory with multiple .conf files
> > +     #
> > +     # Try uncommenting this and using 'auto' if there are issues.  It provides more comprehensive
> > +     # diagnostics via verbose messages & the ability to set an email from address.
> > +     #
> > +     #option config auto
> > +
> > +
> > +     #
> > +     # option 'email' values may be a valid (to) email address, or empty.
> > +     #
> > +     # The default 'email' to send to is root (monitor email will be sent to the local root user).
> > +     #
> > +     # * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> > +     # * Comment, or unset, the email value causes mail to be disabled.  With no email value, mdadm wont even try.
> > +     # * A single word name must be a valid user on the system, or it will bounce back to root.
> > +     #   Unless user 'mdadm' exists (it doesn't by default), this will bounce:
> > +     #   option email mdadm
> > +     # * A full email address does not need quoting and will deliver if tcp port 25 (SMTP) is allowed outbound, i.e.
> > +     #   option email joseph.tingiris at gmail.com
> > +     # * mdadm only supports one email address (MAILADDR) for all arrays. see mdadm.conf(5)
> > +     #
> > +     # mail will be to 'root@$HOSTNAME', i.e. root at OpenWrt
> > +     #
> >       option email root
> > -     # list devices /dev/hd*
> > -     # list devices /dev/sd*
> > -     # list devices partitions
> >
> > -config array
> > -     option uuid 52c5c44a:d2162820:f75d3464:799750f8
> > -     option device /dev/md0
> > -     # option name raid:0
> > -     # option super_minor 0
> > -     # list devices /dev/sda1
> > -     # list devices /dev/sdb1
> > -     # option spares 0
> > -     # option spare_group spares
> > +
> > +     #
> > +     # option 'email_from' values may be a valid (from) email address, or empty.
> > +     #
> > +     # The default 'email_from' is 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> > +     #
> > +     # * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
> > +     # * Comment, or unset, the email_from value causes mdadm to send mail from
> > +     #   root@$HOSTNAME, e.g. root at OpenWrt
> > +     # * A complete from envelope can be specified within quotes, i.e.
> > +     #   option email_from 'mdadm monitoring <this_is_not_spam at example.com>'
> > +     # * mdadm only supports setting a from address (MAILFROM) with a stateful config,
> > +     #   e.g. 'auto' or 'uci'. see mdadm.conf(5)
> > +     #
> > +     # mail will be from 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
> > +     #
> > +     option email_from 'OpenWrt RAID Monitoring <mdadm>'
> > +
> > +
> > +     #
> > +     # option 'monitor_frequency' values may be a valid integer, or empty.
> > +     #
> > +     # The default monitor frequency (delayed poll) is 120 seconds.
> > +     #
> > +     # * This is the polling interval, frequency, or delay.  It's the value for mdadm --delay.  see https://linux.die.net/man/8/mdadm
> > +     #
> > +     option monitor_frequency 300
> > +
> > +     #
> > +     # option 'verbose' values may be '1', 'on', or 'true', everything else is false.
> > +     #
> > +     # The default verbosity is false (quiet).
> > +     #
> > +     # * Standard errors will be sent to console and syslog regardless of this setting.
> > +     # * When verbose is false mdadm will run in --quiet mode and generate very little log
> > +     #   or standard output.
> > +     #
> > +     # Turn this on if you're having problems, or want more detail.  With SSH_TTY set output will
> > +     # be to that TTY, otherwise it will go to syslog via logger.
> > +     #
> > +     #option verbose on
> > +
> > +
> > +#
> > +# The mdadm 'array' section(s) are for stateful, manual configurations. Experts only.  Use with caution.
> > +#
> > +#
> > +# The use of multiple 'array' sections is supported by /etc/init.d/mdadm.
> > +# They must all be named 'array'.
> > +#
> > +# As of this writing unnamed 'mdadm' sections are still allowed, but deprecated. Do not use.
> > +#
> > +
> > +#config array
> > +     #
> > +     # example 'array' options may be a valid mix of:
> > +     #
> > +     # bitmap
> > +     # container
> > +     # device
> > +     # devices
> > +     # member
> > +     # name
> > +     # spare_group
> > +     # spares
> > +     # super_minor
> > +     # uuid
> > +     #
> >       # option bitmap /bitmap.md
> >       # option container 00000000:00000000:00000000:00000000
> > +     # option device /dev/md0
> > +     # -and/or a devices list-
> > +     # list devices /dev/hd* # mdadm allows glob, see glob(7)
> > +     # list devices /dev/sd*
> > +     # list devices /dev/sda1
> > +     # list devices /dev/sdb1
> > +     # list devices containers
> > +     # list devices partitions
> >       # option member 1
> > +     # option name raid:0
> > +     # option spare_group spares
> > +     # option spares 0
> > +     # option super_minor 0
> > +     # use uuid from block info (preferred), or mdadm --misc --detail /dev/md0
> > +     # option uuid 2084de11-70c4-4521-8f95-6113e75f1fe9
> > +     #
> > +     # These options directly translate to mdadm -- options, see https://linux.die.net/man/8/mdadm
> > diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
> > index 64a50b35de..eb323ecad0 100644
> > --- a/package/utils/mdadm/files/mdadm.init
> > +++ b/package/utils/mdadm/files/mdadm.init
> > @@ -1,93 +1,527 @@
> >  #!/bin/sh /etc/rc.common
> >
> > -START=13
> > -STOP=98
> > +START=12
> > +STOP=99
> >
> >  USE_PROCD=1
> >  PROG=/sbin/mdadm
> >  NAME=mdadm
> >
> > -CONF="/var/etc/mdadm.conf"
> > +LOGGER=0 # off
> > +VERBOSE=1 # off
> > +
> > +TMP_FILE="/var/etc/mdadm.conf" # /var/etc is on /tmp; used for temporary state, to enable stateful only mdadm features
> > +
> > +[ -x "$PROG" ] || exit 1
> >
> >  append_list_item() {
> > -     append "$2" "$1" "$3"
> > +    append "$2" "$1" "$3"
> >  }
> >
> >  append_option() {
> > -     local var="$1"
> > -     local cfg="$2"
> > -     local opt="$3"
> > -     local name="$4"
> > -     local sep="$5"
> > -     local str
> > -
> > -     if [ -n "$sep" ]; then
> > -             config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> > -     else
> > -             config_get str "$cfg" "$opt"
> > -     fi
> > -
> > -     [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
> > +    local var="$1"
> > +    local cfg="$2"
> > +    local opt="$3"
> > +    local name="$4"
> > +    local sep="$5"
> > +    local str
> > +
> > +    if [ -n "$sep" ]; then
> > +        config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
> > +    else
> > +        config_get str "$cfg" "$opt"
> > +    fi
> > +
> > +    [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
> >  }
> >
> > -mdadm_common() {
> > -     local cfg="$1"
> > -     local email devices
> > +verbose() {
> > +    local msg="$1"
> > +    local level="$2"
> >
> > -     if [ -x /usr/sbin/sendmail ]; then
> > -             config_get email "$cfg" email
> > -             [ -n "$email" ] && printf "MAILADDR %s\n" "$email" >> $CONF
> > -     fi
> > +    [ -z "$level" ] && level="INFO"
> >
> > -     config_list_foreach "$cfg" devices append_list_item devices " "
> > -     [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $CONF
> > +    [ "$VERBOSE" = "1" ] && {
> > +        if [ ${#SSH_TTY} -gt 0 ]; then
> > +            printf "$NAME: init %7s - %b\n" "$level" "$msg"
> > +        else
> > +            # no SSH_TTY goes to logger
> > +            printf "$NAME: init %7s - %b\n" "$level" "$msg" | logger -t mdadm
> > +        fi
> > +    }
> >  }
> >
> > -mdadm_array() {
> > -     local cfg="$1"
> > -     local uuid device devices name array
> > +mdadm_conf_auto() {
> > +    local mdadm_conf="$1"
> > +
> > +    [ -w "$mdadm_conf" ] || {
> > +        if [ -z "$mdadm_conf" ]; then
> > +            verbose "mdadm_conf value is empty" ERROR
> > +        else
> > +            verbose "'$mdadm_conf' file not found writable" ERROR
> > +        fi
> > +        return 1
> > +    }
> > +
> > +    local block_md block_uuid mdadm_md mdadm_md_rc mdadm_uuid
> > +
> > +    # Check block info for active linux_raid_members, if necessary then compare with mdadm, & dynamically update $mdadm_conf
> > +
> > +    block_md=0 # counter
> > +    for block_uuid in $(block info 2> /dev/null | sed -nEe 's#^.* UUID="([^"]*)".*TYPE="linux_raid_member"#\1#p'); do
> > +        mdadm_md=""
> > +        mdadm_md_rc=0
> > +
> > +        while [ -z "$mdadm_md" ]; do
> > +            if [ -b "/dev/md$block_md" ]; then
> > +                # handle mdadm restart, service reload, multiple starts without stops, physical unplug, etc.
> > +
> > +                verbose "/dev/md$block_md block device already exists" NOTICE
> >
> > -     config_get uuid "$cfg" uuid
> > -     config_get name "$cfg" name
> > -     config_get device "$cfg" device
> > +                # active arrays will promptly respond; first check
> > +                mdadm_uuid=$($PROG --detail --test --brief "/dev/md$block_md" 2> /dev/null | sed -nEe '1s#^.*UUID=((.){35})#\1#p')
> >
> > -     if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> > -             echo "Skipping array without device, uuid or name" >&2
> > -             return
> > -     fi
> > +                [ -z "$mdadm_uuid" ] && {
> > +                    # When an array is unplugged and then plugged in again (without rebooting) then it becomes an INACTIVE-ARRAY
> > +                    # however the device file persists, e.g. /dev/md0, and should be reused, rather than a new device assigned.
> > +                    if $PROG --detail --test --scan "/dev/md$block_md" 2> /dev/null | grep -E "^(INACTIVE-ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t)metadata)" > /dev/null 2>&1; then
> > +                        verbose "attempting to revive INACTIVE-ARRAY on /dev/md$block_md" NOTICE
> > +                        if $PROG --examine --scan 2> /dev/null | grep -qE "^(ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t))"; then
> > +                            # this is relatively safe with the above regex validation
> > +                            mdadm_md="/dev/md$block_md"
> > +                        fi
> > +                    else
> > +                        # This is an unsafe condition to handle with a shell, mdadm sees an inactive device with a different /dev.
> > +                        # Err to the side of caution;--assemble --scan shoud know what to do ... it will abandon the block device.
> > +                        # If these are happening, suggest stateless & sacrifice some minor functionality, e.g. MAILFROM
> > +                        # May be an mdadm or kernel bug with this hardware setup.
> > +                        verbose "bug? unsafe to revive INACTIVE-ARRAY on /dev/md$block_md" WARNING
> > +                        block_md=$((block_md+1))
> > +                        continue
> > +                    fi
> > +                }
> >
> > -     [ -n "$uuid" ] && append array "uuid=$uuid"
> > -     [ -n "$name" ] && append array "name=$name"
> > +                if [ "${block_uuid//-/}" = "${mdadm_uuid//:/}" ]; then
> > +                    # block info & mdadm concur all's well; the meta device is active; reuse
> > +                    mdadm_md="/dev/md$block_md"
> > +                    verbose "auto conf found active RAID member block_uuid=$block_uuid and will reused device '$mdadm_md'" OK
> > +                else
> > +                    if [ ! -e "/dev/md$block_md" ]; then
> > +                        # this block device was never assembled previously; new
> > +                        mdadm_md="/dev/md$block_md"
> > +                        verbose "auto conf found new RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> > +                    else
> > +                        block_md=$((block_md+1))
> > +                        continue
> > +                    fi
> > +                fi
> >
> > -     append_option array "$cfg" super_minor
> > -     append_option array "$cfg" spares
> > -     append_option array "$cfg" spare_group
> > -     append_option array "$cfg" bitmap
> > -     append_option array "$cfg" container
> > -     append_option array "$cfg" member
> > -     append_option array "$cfg" devices devices ","
> > +            else
> > +                if [ ! -e "/dev/md$block_md" ]; then
> > +                    # best scenario; no device or file (yet), safest
> > +                    mdadm_md="/dev/md$block_md"
> > +                    verbose "auto conf found missing RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
> > +                else
> > +                    # a file exists, but it's not a block device? It's possible (touch), albeit a corner case; discretely say
> > +                    # we know & pass over it.
> > +                    verbose "/dev/md$block_md file found, not a block device" WARNING
> > +                    block_md=$((block_md+1))
> > +                    continue
> > +                fi
> > +            fi
> >
> > -     printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
> > +            $PROG --detail --test --brief $mdadm_md > /dev/null 2>&1 # rc 1=ok, 1=degrade, 2=dead, 4=missing
> > +            mdadm_md_rc=$?
> > +
> > +            # todo: annouce degraded arrays in the logs? mdadmin monitor will do it but not on demand, only per frequency.
> > +            #       nice to have for hot plugs ...
> > +
> > +            verbose "block_md=$block_md, block_uuid=$block_uuid, mdadm_md=$mdadm_md, mdadm_uuid=$mdadm_uuid, rc=$mdadm_md_rc" INFO
> > +
> > +            if [ $mdadm_md_rc -lt 4 ]; then
> > +                $PROG --detail --test --brief $mdadm_md 2> /dev/null >> $mdadm_conf
> > +            else
> > +                # there's a device with no header.  maybe it's to replace a failed device ...
> > +                echo "ARRAY $mdadm_md uuid=$block_uuid" >> $mdadm_conf
> > +            fi
> > +
> > +        done
> > +
> > +    done
> > +
> > +    if [ -n "$mdadm_md" ]; then
> > +        return 0
> > +    else
> > +        return 1
> > +    fi
> > +}
> > +
> > +mdadm_conf_uci() {
> > +    local cfg="$1"
> > +    local mdadm_conf="$2"
> > +
> > +    [ -z "$cfg" ] && {
> > +        verbose "cfg is empty" WARNING
> > +        return 1
> > +    }
> > +
> > +    local cfg_name
> > +    cfg_name=$(uci_get mdadm.$cfg 2> /dev/null)
> > +
> > +    [ -z "$cfg_name" ] && verbose "($cfg) mdadm config name is empty" NOTICE
> > +
> > +    [ -z "$mdadm_conf" ] && {
> > +        verbose "($cfg) skipping mdadm.$cfg_name array; config file is empty" WARNING
> > +        return 1
> > +    }
> > +
> > +    if ! touch "$mdadm_conf" 2> /dev/null; then
> > +        verbose "($cfg) skipping mdadm.$cfg_name array; can't touch '$mdadm_conf'" ERROR
> > +        return 1
> > +    fi
> > +
> > +    local array device devices name uuid
> > +
> > +    config_get name "$cfg" name
> > +    config_get device "$cfg" device
> > +    config_get uuid "$cfg" uuid
> > +
> > +    config_list_foreach "$cfg" devices append_list_item devices " "
> > +    [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $mdadm_conf
> > +
> > +    if [ -z "$device" ] || [ -z "$uuid$name" ]; then
> > +        verbose "($cfg) skipping mdadm.$cfg_name array; no device, uuid, or name" WARNING
> > +        return 1
> > +    fi
> > +
> > +    [ -n "$uuid" ] && append array "uuid=$uuid"
> > +    [ -n "$name" ] && append array "name=$name"
> > +
> > +    append_option array "$cfg" super_minor
> > +    append_option array "$cfg" spares
> > +    append_option array "$cfg" spare_group
> > +    append_option array "$cfg" bitmap
> > +    append_option array "$cfg" container
> > +    append_option array "$cfg" member
> > +    append_option array "$cfg" devices devices ","
> > +
> > +    printf "ARRAY %s %s\n" "$device" "$array" >> $mdadm_conf
> > +}
> > +
> > +reload_service() {
> > +    while read -r line; do echo $line; done
> > +    # running start_service() on reload should be OK in all modes, except manual configs.
> > +    # for auto & none, start_service() already rescans for hotplugged devices, add new arrays, etc.
> > +    # could check for the configured mode & call appropriately?  doing nothing is safer; todo: test & resolve
> > +    verbose "reload_service called, ignoring" NOTICE
> > +    return 0
> >  }
> >
> >  start_service() {
> > -     local email
> > +    local config config_detail config_file config_level config_mode config_rc config_state config_verbose mdadm_conf
> > +
> > +    # mdadm.global specific locals
> > +    local alert_program email email_from mail_program mdadm_args monitor_frequency
> > +
> > +    config_verbose=$(uci_get mdadm.global.verbose 2> /dev/null | awk '{print tolower($1)}')
>
> Suggest replace awk with `tr 'A-Z' 'a-z'`. Invoking awk for the sake of
> lowercasing option values (which is done in no other init script) seems overkill.
Funny you mention that. There was discussion on this mailing list
about that. tr A-Z a-z will cause a shellcheck warning. awk does not.

Specifially, the discussion was about tr :lower: and :upper: not working.
>
> > +    if [ "$config_verbose" = "1" ] || [ "$config_verbose" = "on" ] || [ "$config_verbose" = "true" ]; then
> > +        VERBOSE=1 # turn verbose on globally
> > +        config_verbose=1
> > +        mdadm_args="--verbose"
> > +    else
> > +        unset -v config_verbose
> > +        mdadm_args="--quiet"
> > +    fi
> > +
> > +    verbose "start_service $*" INFO
> > +
> > +    config_rc=0
> > +    config_detail="start"
> > +    config_level="INFO"
> > +    config_mode="service"
> > +
> > +    config=$(uci_get mdadm.global.config 2> /dev/null)
> > +    if [ -z "$config" ]; then
> > +        # per PR1713 discussion; this works very well for the majority of use cases; let mdadm do the heavy lifting.
> > +        # none is (Auto Assemble; or no --config); see mdadm(8), default
> > +        config='none'
> > +        config_detail="mdadm.global.config value is empty"
> > +        config_state='stateless'
> > +        config_mode="default"
> > +        config_level='OK'
> > +    else
> > +        # experts only
> >
> > -     mkdir -p "${CONF%/*}"
> > -     printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
> > +        config_mode="manual"
> >
> > -     config_load mdadm
> > -     config_foreach mdadm_common mdadm
> > -     config_foreach mdadm_array array
> > +        # check file values first, to preserve case of file name values
> > +        if [ "${config:0:1}" = "/" ]; then
> > +            config_state='stateful' # all types of file configs are stateful
> >
> > -     $PROG --assemble --scan --config="$CONF"
> > +            if [ -d "$config" ] && [ -r "$config" ]; then
> > +                local config_file_count=0
> > +                for config_file in ${config}/*.conf; do
> > +                    if [ -r "$config_file" ]; then
> > +                        config_file_count=$((config_file_count+1))
> > +                    fi
> > +                done
> > +                if [ $config_file_count -eq 0 ]; then
> > +                    config_level="WARNING"
> > +                else
> > +                    config_level="OK"
> > +                fi
> > +                config_detail="directory found with $config_file_count readable .conf files"
> > +            else
> > +                if [ -w "$config" ]; then
> > +                    if [ -s "$config" ]; then
> > +                        # regardless, this will rely on mdadm for final validation; for informational purposes ...
> > +                        grep -E '^((DEVICE){1}(\ |\t)(.*)(/dev/|containers|partitions))' "$config" > /dev/null 2>&1 # pattern per mdadm(8)
> > +                        if [ $? -eq 0 ]; then
> > +                            config_detail="file found, readable with a ^DEVICE"
> > +                            config_level="OK"
> > +                        else
> > +                            config_detail="file found, readable without a ^DEVICE"
> > +                            config_level="WARNING"
> > +                        fi
> > +                    else
> > +                        config_detail="file found, writable and empty"
> > +                        config_level="OK"
> > +                    fi
> > +                else
> > +                    config_detail="file not found, unwritable"
> > +                    config_level="FATAL"
> > +                    config_rc=1
> > +                fi
> > +            fi
> > +        else
> > +            config_mode="dynamic"
> >
> > -     procd_open_instance
> > -     procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
> > -     procd_close_instance
> > +            # allow static values in mixed case; convert to lower
> > +            config="$(awk -v config="$config" 'BEGIN{print tolower(config)}')"
>
> `tr 'A-Z' 'a-z'`
>
> > +            if [ "$config" = "containers" ] || [ "$config" = "none" ] || [ "$config" = "partition" ]; then
> > +                # pass through to mdadm --config=
> > +                config_detail="dynamic; uci static key value"
> > +                config_level="OK"
> > +                config_state='stateless'
> > +            else
> > +                if [ "$config" = "auto" ] || [ "$config" = "uci" ]; then
> > +                    config_detail="dynamic; $config config"
> > +                    config_level="OK"
> > +                    config_state='stateful'
> > +                    mdadm_conf="$TMP_FILE"
> > +                else
> > +                    config_detail="invalid; unsupported uci config key value"
> > +                    config_level="FATAL"
> > +                    config_state='stateful'
> > +                    config_rc=1
> > +                fi
> > +            fi
> > +        fi
> > +    fi
> > +
> > +    # final safety & functional checks
> > +
> > +    # check for fatality
> > +    [ -z "$config" ] && {
> > +        config="${config}?"
> > +        config_detail="$config_detail (sorry, something went wrong; check the config settings)"
> > +        config_level="FATAL"
> > +        config_mode="${config_mode}?"
> > +        config_state="${config_state}?"
> > +        config_rc=1
> > +    }
> > +
> > +    # Prefer mdadm.global.email; only one is allowed and can be an --email argument per mdadm.conf(5)
> > +    email=$(uci_get mdadm.global.email 2> /dev/null)
> > +
> > +    # mdadm (or postfix?) bug; workaround.  mdadm 4.0 for 18.06.1 has a compiled in default of '/usr/lib/sendmail -t'.
> > +    # There's no configurable way to change it and mdadm must be recompiled differently for Openwrt, or posfix should
> > +    # add the link. In 18.06.1, postfix 3.3.0-1 installs sendmail in /usr/sbin; mdadm complains & no mail is delivered.
> > +    # Other distro's postfix pkg typically installs this link ... or one in /etc/alternatives.
> > +    # Since mdadm needs it, I'm adding it here to be sure mdadm can send email if there's a /usr/sbin/sendmail.
> > +
> > +    # There's really no point in making mdadm's compiled in sendmail configurable via uci.
> > +    mail_program="/usr/lib/sendmail"
> > +    [ -x /usr/sbin/sendmail ] && [ ! -e "$mail_program" ] && {
> > +        # a sym link will suffice
> > +        if ! ln -s /usr/sbin/sendmail "$mail_program"; then
> > +            verbose "ln -s /usr/bin/sendmail /usr/lib/sendmail failed" WARNING
> > +        fi
> > +    }
>
> Remove this workaround, packages should be fixed instead.
OK
>
> > +
> > +    [ -x "$mail_program" ] || {
> > +        verbose "disabling email; mail program '/usr/lib/sendmail' not found executable (install postfix)" WARNING
> > +        email=""
> > +    }
> > +
> > +    if [ "$config_state" = "stateful" ] && [ -n "$mdadm_conf" ]; then
> > +        if mkdir -p "${mdadm_conf%/*}" > /dev/null 2>&1; then
> > +            printf "# Autogenerated from /etc/init.d/mdadm, do not edit!\n" > $mdadm_conf
> > +
> > +            # Use mdadm.global.email_from only if there's a valid mta; only one is allowed per mdadm.conf(5)
> > +            # todo: see what other mtas Openwrt has in their opkg repos & maybe support others
> > +            [ -x "$mail_program" ] && email_from=$(uci_get mdadm.global.email_from 2> /dev/null)
> > +
> > +            if [ "$config" = "auto" ]; then
> > +                # stateful mdadm.conf auto configuration
> > +                if ! mdadm_conf_auto "$mdadm_conf"; then
> > +                    #there's quite a bit of logic & error handling in mdadm_conf_auto; if it doesn't return 0 then it's a fatality
> > +                    config_detail="$config_detail (couldn't find any meta devices; check connections, or try stateless autoconfig)"
> > +                    config_level="FATAL"
> > +                    config_rc=1
> > +                fi
> > +            else
> > +                # stateful mdadm.conf uci configuration
> > +
> > +                # load uci config from /etc/config/mdadm
> > +                config_load mdadm
> > +
> > +                # This is how mdadm uci mdadm config sections should be named, like fstab does with 'mount'.
> > +                # The included uci /etc/config/mdadm provides more documentation & direction.
> > +                config_foreach mdadm_conf_uci array "$mdadm_conf"
> > +
> > +                # The unlabled mdadm. at mdadm[0] section should be (is now) deprecated.
> > +                # It's more difficult to document how to use, redundant, and over complicated this init configuration.
> > +
> > +                # Confused; originally config_foreach?
> > +                # It's possible to specify multiple mdadm sections with array options in all sections.
> > +                # Thus multiple option emails which could result in multiple MAILADDR being appended to mdadm.conf.
> > +                # That confuses mdadm.
> > +
> > +                # The following code is here to prevent regressions.
> > +
> > +                config_foreach mdadm_conf_uci mdadm "$mdadm_conf"
> > +
> > +                # For backward compatibility; this will allow an mdadm. at mdadm[0] section's option email.
> > +                # (only if mdadm.global.email is not set; again, prefer mdadm.global.email)
> > +                #
> > +                # bug fixed. The first legacy mdadm section option email will be used.
> > +                # a better fix would be to *only* support array sections.
> > +                #
> > +                [ -z "$email" ] && [ -x "$mail_program" ] && email=$(uci_get mdadm. at mdadm[0].email 2> /dev/null)
> > +                # email_from is a new feature; was not previously handled; no need to and please don't backport
> > +
> > +            fi
> > +
> > +            # This is nice feature to have to get mdadm mails through spam filters, etc.
> > +            # Too bad mdadm (4.0) doesn't have an argument for it.
> > +            # Maybe mdadm 4.1 will ... todo: revisit when making mdadm 4.1 & it's in Openwrt mainline.
> > +            # This tests successfully with the postfix workaround above & mdadm 4.0.
> > +            [ -x "$mail_program" ] && {
> > +                printf "MAILFROM %s\n" "$email_from" >> $mdadm_conf # only supported via stateful configs; see mdadm.conf(5)
> > +            }
> > +
> > +            [ -n "$config_verbose" ] && [ -r "$mdadm_conf" ] && {
> > +                verbose "mdadm_conf = $mdadm_conf (config_verbose=$config_verbose)" INFO
> > +                verbose "---cut $mdadm_conf cut---" INFO
> > +                while read -r line; do
> > +                    verbose "$line" INFO
> > +                done < "$mdadm_conf"
> > +                unset -v line
> > +                verbose "---cut $mdadm_conf cut---" INFO
> > +            }
> > +
> > +        else
> > +            config_detail="$config_detail (mkdir failed; check permissions)"
> > +            config_level="FATAL"
> > +            config_rc=1
> > +        fi
> > +    fi
> > +
> > +    [ $config_rc -ne 0 ] && {
> > +        # FATAL
> > +        verbose "$config_state,$config_mode config='$config', $config_detail" "$config_level" INFO
> > +        [ -n "$mdadm_conf" ] && [ -w "$mdadm_conf" ] && rm -f "$mdadm_conf"
> > +        exit $config_rc
> > +    }
> > +
> > +    # Good to go, no more fatal exits, finish getting global & setting local values ... they're all optional.
> > +
> > +    mdadm_args="$mdadm_args --scan"
> > +
> > +    if [ -n "$mdadm_conf" ]; then
> > +        # mdadm.global.config </file>
> > +        mdadm_args="$mdadm_args --config=$mdadm_conf"
> > +    else
> > +        # mdadm.global.config all (containers, partitions, etc), except none
> > +        [ -n "$config" ] && [ "$config" != 'none' ] && mdadm_args="$mdadm_args --config=$config"
> > +    fi
> > +
> > +    local assemble_count assemble_rc
> > +
> > +    assemble_count=$($PROG --detail --brief --scan 2> /dev/null | wc -l)
> > +    verbose "$assemble_count arrays are currently assembled" INFO
> > +
> > +    # setup assembly mode
> > +
> > +    verbose "(assemble) '$PROG --assemble $mdadm_args'" INFO
> > +    $PROG --assemble $mdadm_args > /dev/null 2>&1
> > +    assemble_rc=$?
> > +
> > +    if [ $assemble_rc -eq 0 ]; then
> > +        verbose "all arrays assembled successfully" OK
> > +        [ -n "$config_verbose" ] && {
> > +            true > /var/log/mdadm.detail
> > +            local assemble_dev assemble_devs
> > +            assemble_devs=$($PROG --detail --brief --scan | awk '{print $2}')
> > +            for assemble_dev in $assemble_devs; do
> > +             {
> > +                printf "\n"
> > +                $PROG --verbose --detail $assemble_dev
> > +                printf "\n"
> > +             } >> /var/log/mdadm.detail
> > +            done
> > +            unset -v assemble_dev
> > +            while read -r line; do
> > +                verbose "$line" INFO
> > +            done < "/var/log/mdadm.detail"
> > +            unset -v line
> > +        }
> > +    else
> > +        if [ $assemble_count -eq 0 ]; then
> > +            verbose "no arrays assembled successfully" ERROR
> > +        else
> > +            verbose "no new arrays need assembly" NOTICE
> > +        fi
> > +    fi
> > +
> > +    # setup monitor mode
> > +
> > +    alert_program=$(uci_get mdadm.global.alert_program 2> /dev/null)
> > +    [ -n "$alert_program" ] && {
> > +        if [ -x "$alert_program" ]; then
> > +            mdadm_args="$mdadm_args --alert=$alert_program"
> > +        else
> > +            verbose "disabling alerts; alert_progam '$alert_program' not found executable" WARNING
> > +        fi
> > +    }
> > +
> > +    [ -n "$email" ] && mdadm_args="$mdadm_args --mail=$email"
> > +
> > +    monitor_frequency=$(uci_get mdadm.global.monitor_frequency 2> /dev/null | sed -e 's/[^0-9]*//g')
> > +    [ -n "$monitor_frequency" ] && {
> > +        mdadm_args="$mdadm_args --delay=$monitor_frequency"
> > +        verbose "setting monitor frequency to '$monitor_frequency' seconds"
> > +    }
> > +
> > +    verbose "(monitor) '$PROG --monitor --syslog $mdadm_args'" INFO
> > +
> > +    # /etc/rc.common doesn't like valid sh constructs like while read line; do echo $line; done <<< "$(echo hello; echo world)" # 8|
> > +    # Taking the time machine back to sh is rough enough as it is ... I need to better understand its purpose. I spent too much time
> > +    # in /lib/functions.  It's all circa 2006-2013.  Yikes.  Where's the man pages?  Or even code comments?  It would've been way
> > +    # easier just to do *everything* the good ol' sysvinit fashioned way, or use systemd.  Just a gripe, I really do like OpenWrt.
>
> Remove this comment.
ACK
>
> > +    procd_open_instance
> > +    procd_set_param command "$PROG" --monitor --syslog $mdadm_args
> > +    procd_close_instance
> > +
> > +    verbose "$config_state,$config_mode config=$config, $config_detail complete" "$config_level"
> >  }
> >
> >  stop_service() {
> > -     $PROG --stop --scan
> > +    $PROG --stop --scan
> > +    if echo "here VERBOSE=$VERBOSE"; then
>
> This looks like debug code. To me it seems the condition will always be true.
ACK
>
> > +        verbose "'$PROG --stop --scan' stop_service succeeded" OK
> > +    else
> > +        verbose "'$PROG --stop --scan' stop_service failed" ERROR
> > +    fi
> >  }
> > -
> >
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From karlp at tweak.net.au  Thu Sep 10 05:52:12 2020
From: karlp at tweak.net.au (Karl Palsson)
Date: Thu, 10 Sep 2020 09:52:12 -0000
Subject: [PATCH] ath25: fix preinit Ethernet port configuration
In-Reply-To: <CAHNKnsRg14y7MA2gkxwsduVq376NtuCNnesLp91pxBNE8jEy7A@mail.gmail.com>
References: <CAHNKnsRg14y7MA2gkxwsduVq376NtuCNnesLp91pxBNE8jEy7A@mail.gmail.com>
Message-ID: <BAwJxMwz4FDhyHaXAHZCUeSRqhQhVICQEtBKxDRb2429@mailpile>


Sergey Ryazanov <ryazanov.s.a at gmail.com> wrote:
> On Wed, Sep 9, 2020 at 6:08 PM Adrian Schmutzler
> <mail at adrianschmutzler.de> wrote:
> > > -                             vconfig add eth0 1
> > > +                             ip link add dev eth0.1 link eth0 type vlan id 1
> >
> > Are you sure this is correct?
> 
> Yes, I tested this command with an OpenWrt ip package :)
> 
> > I only find the following syntax:
> >
> > ip link add link eth0 name eth0.1 type vlan id 1
> >
> 
> According to ip-link(8) a user should use 'name' argument for a
> new interface, but in fact the iplink.c have the following code
> in the interface creation handler:
> >         /* Allow "ip link add dev" and "ip link add name" */
> >        if (!name)
> >                name = dev;
> 

Relying on undocumented behaviour seems like a risky move, when
we could just do it the documented way up front?

Sincerely,
Karl Palsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP-digital-signature.html
Type: application/pgp-signature
Size: 1175 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/adfcda05/attachment.sig>

From zajec5 at gmail.com  Thu Sep 10 07:25:14 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Thu, 10 Sep 2020 13:25:14 +0200
Subject: [PATCH V4 rpc] rc: new ubus object for handling /etc/init.d/
 scripts
In-Reply-To: <20200910085349.5129-1-zajec5@gmail.com>
References: <20200910085349.5129-1-zajec5@gmail.com>
Message-ID: <5b8694e3-8ae3-99af-c060-e315b894c7c1@gmail.com>

On 10.09.2020 10:53, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> This commit adds "rc" ubus object with methods "list" and "exec" for
> listing and calling init.d script appropriately. It's useful for all
> kind of UIs (e.g. LuCI) and custom apps.

Pushed with strstr -> strncmp to avoid parsing commented out lines like
# START=90


From jo at mein.io  Thu Sep 10 08:57:31 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 14:57:31 +0200
Subject: [PATCH 2/2] rules.mk: simplify FAKEROOT command line
In-Reply-To: <20200910125731.3415057-1-jo@mein.io>
References: <20200910125731.3415057-1-jo@mein.io>
Message-ID: <20200910125731.3415057-2-jo@mein.io>

Since fakeroot is patched to discover related ressources relative to the
STAGING_DIR_HOST environment variable, there is no need to pass the path
to faked or the preload library manually anymore.

Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 rules.mk | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/rules.mk b/rules.mk
index 8b2424f2ba..3214395e1f 100644
--- a/rules.mk
+++ b/rules.mk
@@ -264,12 +264,7 @@ endif
 
 BUILD_KEY=$(TOPDIR)/key-build
 
-ifeq ($(HOST_OS),Darwin)
-  FAKEROOT_SO:=$(STAGING_DIR_HOST)/lib/libfakeroot.dylib
-else
-  FAKEROOT_SO:=$(STAGING_DIR_HOST)/lib/libfakeroot.so
-endif
-FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot -l $(FAKEROOT_SO) -f $(STAGING_DIR_HOST)/bin/faked
+FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot
 
 TARGET_CC:=$(TARGET_CROSS)gcc
 TARGET_CXX:=$(TARGET_CROSS)g++
-- 
2.28.0



From jo at mein.io  Thu Sep 10 08:57:30 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 14:57:30 +0200
Subject: [PATCH 1/2] fakeroot: make fakeroot script relocatable
Message-ID: <20200910125731.3415057-1-jo@mein.io>

Patch the fakeroot script template to discover faked and libfakeroot.so
relative to the STAGING_DIR_HOST environment variable, similar to how it
is done for automake, libtool, quilt and autoconf already.

This avoids the need for passing the paths to faked and libfakeroot.so
manually every time we invoke fakeroot and subsequently allows us to
drop OS X specific logic.

Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 tools/fakeroot/patches/000-relocatable.patch | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 tools/fakeroot/patches/000-relocatable.patch

diff --git a/tools/fakeroot/patches/000-relocatable.patch b/tools/fakeroot/patches/000-relocatable.patch
new file mode 100644
index 0000000000..9f6915bfe8
--- /dev/null
+++ b/tools/fakeroot/patches/000-relocatable.patch
@@ -0,0 +1,25 @@
+--- a/scripts/fakeroot.in
++++ b/scripts/fakeroot.in
+@@ -30,12 +30,19 @@ fatal ()
+ }
+ 
+ # strip /bin/fakeroot to find install prefix
+-FAKEROOT_PREFIX=@prefix@
+-FAKEROOT_BINDIR=@bindir@
++if [ -n "$STAGING_DIR_HOST" ]; then
++    FAKEROOT_PREFIX="${STAGING_DIR_HOST}"
++    FAKEROOT_BINDIR="${STAGING_DIR_HOST}/bin"
++    FAKEROOT_LIBDIR="${STAGING_DIR_HOST}/lib"
++else
++    FAKEROOT_PREFIX=@prefix@
++    FAKEROOT_BINDIR=@bindir@
++    FAKEROOT_LIBDIR=@libdir@
++fi
+ 
+ USEABSLIBPATH=@LDPRELOADABS@
+ LIB=lib at fakeroot_transformed@@DLSUFFIX@
+-PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot
++PATHS=${FAKEROOT_LIBDIR}:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot
+ FAKED=${FAKEROOT_BINDIR}/@faked_transformed@
+ 
+ FAKED_MODE="unknown-is-root"
-- 
2.28.0



From jo at mein.io  Thu Sep 10 09:00:10 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 15:00:10 +0200
Subject: [PATCH 2/2] rules.mk: simplify FAKEROOT command line
In-Reply-To: <20200910125731.3415057-2-jo@mein.io>
References: <20200910125731.3415057-1-jo@mein.io>
 <20200910125731.3415057-2-jo@mein.io>
Message-ID: <72cd3f40-f9c0-796b-4f14-31014a662616@wwsnet.net>

Hi,

please disregard, I made a logical mistake and forgot that the OS X check is
about the *.dylib vs. *.so extension, not the library location.

~ Jo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/dd5b41f9/attachment.sig>

From jo at mein.io  Thu Sep 10 09:04:27 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 10 Sep 2020 15:04:27 +0200
Subject: [PATCH 2/2] rules.mk: simplify FAKEROOT command line
In-Reply-To: <72cd3f40-f9c0-796b-4f14-31014a662616@wwsnet.net>
References: <20200910125731.3415057-1-jo@mein.io>
 <20200910125731.3415057-2-jo@mein.io>
 <72cd3f40-f9c0-796b-4f14-31014a662616@wwsnet.net>
Message-ID: <6c302839-93f0-1ab3-98ca-4c8bbab88ddd@wwsnet.net>

Hi again,
> please disregard, I made a logical mistake and forgot that the OS X check is
> about the *.dylib vs. *.so extension, not the library location.

actually it seems fine after all since the proper extension is embedded in the
fakeroot script according to whats applicable to the host system:

  LIB=lib at fakeroot_transformed@@DLSUFFIX@

Would still appreciate some runtime testing on OS X.

~ Jo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200910/82f23392/attachment-0001.sig>

From freifunk at adrianschmutzler.de  Thu Sep 10 11:37:12 2020
From: freifunk at adrianschmutzler.de (Adrian Schmutzler)
Date: Thu, 10 Sep 2020 17:37:12 +0200
Subject: [PATCH] base-files: drop default setup for vconfig
Message-ID: <20200910153712.1880-1-freifunk@adrianschmutzler.de>

vconfig has been disabled by default since 2015 [1] and there are
no remaining uses in entire OpenWrt trunk. However, we still set up
a specific name_type for it during boot.

While this setup is properly implemented to be only triggered when
vconfig is present, it still seems anachronistic and unnecessary
to set up a standard for a tool that is not used anymore.

Therefore, this removes the set_name_type initialization and leaves
it for those people actually using the tool to configure it as needed.

[1] 899a23227e55 ("busybox: improve applets & deprecate ifconfig, route")

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 package/base-files/Makefile              | 2 +-
 package/base-files/files/etc/init.d/boot | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 2419849a44..73455174db 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=228
+PKG_RELEASE:=229
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index 958a67599e..b36323a97e 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -20,7 +20,6 @@ uci_apply_defaults() {
 boot() {
 	[ -f /proc/mounts ] || /sbin/mount_root
 	[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
-	[ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
 
 	mkdir -p /var/run
 	mkdir -p /var/log
-- 
2.20.1



From mail at aparcar.org  Thu Sep 10 16:02:39 2020
From: mail at aparcar.org (Paul Spooren)
Date: Thu, 10 Sep 2020 10:02:39 -1000
Subject: [PATCH] build: create rootfs.tar.xz if BUILDBOT
Message-ID: <20200910200239.456129-1-mail@aparcar.org>

The rootfs.tar.gz is used to create Docker containers containing the
OpenWrt root filesystem. These containers are currently only available
for x84/64 and armvirt/{32,64}. For CI package runtime testing more
rootfs containers would allow additional tests.

After CI building a changed package for multiple packages, QEMU is used
inside another CI step run run OpenWrt rootfs containers in multiple
architectures, install the create package and execute a runtime test.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
This change would allow additional runtime tests for this PoC:
https://github.com/openwrt/packages/pull/13315

 config/Config-images.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/Config-images.in b/config/Config-images.in
index 7d56d70908..f2eb237d0d 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -70,7 +70,7 @@ menu "Target Images"
 
 	config TARGET_ROOTFS_TARGZ
 		bool "tar.gz"
-		default y if USES_TARGZ
+		default y if USES_TARGZ || BUILDBOT
 		help
 		  Build a compressed tar archive of the root filesystem.
 
-- 
2.25.1



From isprotejesvalkata at gmail.com  Fri Sep 11 05:59:22 2020
From: isprotejesvalkata at gmail.com (Perry)
Date: Fri, 11 Sep 2020 11:59:22 +0200
Subject: AW: Upcoming 19.07.4 and 18.07.9 stable releases
In-Reply-To: <000001d686da$a7f71a30$f7e54e90$@gmx.de>
References: <20200730185757.GA935@tuxmachine.localdomain>
 <20200908201126.GC834100@tuxmachine.localdomain>
 <000501d686bb$5239bbd0$f6ad3370$@gmx.de>
 <000001d686da$a7f71a30$f7e54e90$@gmx.de>
Message-ID: <a212f7ea-a16e-5ebf-555b-2cd9999f2419@gmail.com>

Hello all,

I noticed today that the "Using the SDK" wiki page has quite outdated
links.  Updating to 19.07.4 and 18.06.8 would be good while at the same
time removing the EOL 17.x link.

https://openwrt.org/docs/guide-developer/using_the_sdk#downloads

Greets,
Perry

On 9/9/20 8:54 PM, Thomas Endt wrote:
>> Von: openwrt-devel <openwrt-devel-bounces at lists.openwrt.org> Im
>> Auftrag von Thomas Endt
>> Gesendet: Mittwoch, 9. September 2020 17:10
>> I will update the dataentries this evening.
> 
> Dataentry update to 19.07.4 is running right now.
> Time for the long awaited announcement message! ?
> 
> Thomas
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 


From zajec5 at gmail.com  Fri Sep 11 07:03:05 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 11 Sep 2020 13:03:05 +0200
Subject: [PATCH rpcd] rc: support init.d scripts with START=0
Message-ID: <20200911110305.14161-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Use negative value (instead of 0) to indicate missing START.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 rc.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/rc.c b/rc.c
index b4787d5..45fdc1a 100644
--- a/rc.c
+++ b/rc.c
@@ -43,8 +43,8 @@ struct rc_list_context {
 	struct {
 		char path[PATH_MAX];
 		const char *d_name;
-		unsigned int start;
-		unsigned int stop;
+		int start;
+		int stop;
 		bool enabled;
 		bool running;
 	} entry;
@@ -76,9 +76,9 @@ static void rc_list_add_table(struct rc_list_context *c)
 
 	e = blobmsg_open_table(c->buf, c->entry.d_name);
 
-	if (c->entry.start)
+	if (c->entry.start >= 0)
 		blobmsg_add_u16(c->buf, "start", c->entry.start);
-	if (c->entry.stop)
+	if (c->entry.stop >= 0)
 		blobmsg_add_u16(c->buf, "stop", c->entry.stop);
 	blobmsg_add_u8(c->buf, "enabled", c->entry.enabled);
 	blobmsg_add_u8(c->buf, "running", c->entry.running);
@@ -174,6 +174,8 @@ static void rc_list_readdir(struct rc_list_context *c)
 		goto next;
 
 	memset(&c->entry, 0, sizeof(c->entry));
+	c->entry.start = -1;
+	c->entry.stop = -1;
 
 	snprintf(c->entry.path, sizeof(c->entry.path), "/etc/init.d/%s", e->d_name);
 	if (rc_check_script(c->entry.path))
@@ -189,7 +191,7 @@ static void rc_list_readdir(struct rc_list_context *c)
 		bool beginning;
 
 		beginning = true;
-		while (!c->entry.start && !c->entry.stop && fgets(line, sizeof(line), fp)) {
+		while (c->entry.start < 0 && c->entry.stop < 0 && fgets(line, sizeof(line), fp)) {
 			if (beginning) {
 				if (!strncmp(line, "START=", 6)) {
 					c->entry.start = strtoul(line + 6, NULL, 0);
@@ -202,9 +204,11 @@ static void rc_list_readdir(struct rc_list_context *c)
 		}
 		fclose(fp);
 
-		snprintf(path, sizeof(path), "/etc/rc.d/S%02d%s", c->entry.start, c->entry.d_name);
-		if (!stat(path, &s) && (s.st_mode & S_IXUSR))
-			c->entry.enabled = true;
+		if (c->entry.start >= 0) {
+			snprintf(path, sizeof(path), "/etc/rc.d/S%02d%s", c->entry.start, c->entry.d_name);
+			if (!stat(path, &s) && (s.st_mode & S_IXUSR))
+				c->entry.enabled = true;
+		}
 	}
 
 	if (rc_list_exec(c, "running", rc_list_exec_running_cb))
-- 
2.27.0



From zajec5 at gmail.com  Fri Sep 11 07:26:45 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 11 Sep 2020 13:26:45 +0200
Subject: [PATCH luci] luci-mod-system: use new "rc" ubus object for init.d
 scripts
Message-ID: <20200911112645.20101-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

It's meant to be wide/generic method for handling /etc/init.d/ scripts.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../resources/view/system/startup.js          | 24 +++++++++----------
 .../usr/share/rpcd/acl.d/luci-mod-system.json |  8 +++----
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
index ae92ce88b..1b5559502 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js
@@ -7,15 +7,15 @@
 var isReadonlyView = !L.hasViewPermission() || null;
 
 return view.extend({
-	callInitList: rpc.declare({
-		object: 'luci',
-		method: 'getInitList',
+	callRcList: rpc.declare({
+		object: 'rc',
+		method: 'list',
 		expect: { '': {} }
 	}),
 
-	callInitAction: rpc.declare({
-		object: 'luci',
-		method: 'setInitAction',
+	callRcInit: rpc.declare({
+		object: 'rc',
+		method: 'init',
 		params: [ 'name', 'action' ],
 		expect: { result: false }
 	}),
@@ -23,12 +23,12 @@ return view.extend({
 	load: function() {
 		return Promise.all([
 			L.resolveDefault(fs.read('/etc/rc.local'), ''),
-			this.callInitList()
+			this.callRcList()
 		]);
 	},
 
 	handleAction: function(name, action, ev) {
-		return this.callInitAction(name, action).then(function(success) {
+		return this.callRcInit(name, action).then(function(success) {
 			if (success != true)
 				throw _('Command failed');
 
@@ -80,19 +80,19 @@ return view.extend({
 		]);
 
 		for (var init in initList)
-			if (initList[init].index < 100)
+			if (initList[init].start < 100)
 				list.push(Object.assign({ name: init }, initList[init]));
 
 		list.sort(function(a, b) {
-			if (a.index != b.index)
-				return a.index - b.index
+			if (a.start != b.start)
+				return a.start - b.start
 
 			return a.name > b.name;
 		});
 
 		for (var i = 0; i < list.length; i++) {
 			rows.push([
-				'%02d'.format(list[i].index),
+				'%02d'.format(list[i].start),
 				list[i].name,
 				E('div', [
 					this.renderEnableDisable(list[i]),
diff --git a/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json b/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
index 38ff98dee..d5beb130c 100644
--- a/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
+++ b/modules/luci-mod-system/root/usr/share/rpcd/acl.d/luci-mod-system.json
@@ -45,8 +45,8 @@
 				"/etc/rc.local": [ "read" ]
 			},
 			"ubus": {
-				"file": [ "read" ],
-				"luci": [ "getInitList" ]
+				"rc": [ "list" ],
+				"file": [ "read" ]
 			}
 		},
 		"write": {
@@ -54,8 +54,8 @@
 				"/etc/rc.local": [ "write" ]
 			},
 			"ubus": {
-				"file": [ "write" ],
-				"luci": [ "setInitAction" ]
+				"rc": [ "init" ],
+				"file": [ "write" ]
 			}
 		}
 	},
-- 
2.27.0



From a.voloshyn at d.mobilunity.com  Fri Sep 11 08:28:59 2020
From: a.voloshyn at d.mobilunity.com (Andrii Voloshyn)
Date: Fri, 11 Sep 2020 15:28:59 +0300
Subject: SQUASHFS error: xz decompression failed, data probably corrupt
Message-ID: <1747d23e82b.bbf72573101722.1037323677492243148@d.mobilunity.com>

Hi there,

 Occasionally I see the following error messages when booting:

SQUASHFS error: xz decompression failed, data probably corrupt
SQUASHFS error: squashfs_read_data failed to read block 0x2dba2
SQUASHFS error: Unable to read fragment cache entry [2dba2]
SQUASHFS error: Unable to read page, block 2dba2, size 14400
SQUASHFS error: Unable to read fragment cache entry [2dba2]
SQUASHFS error: Unable to read page, block 2dba2, size 14400
.....
json_object_from_file: error reading file /etc/hotplug.json: I/O error
json_object_from_file: error reading file /etc/hotplug.json: I/O error
json_object_from_file: error reading file /etc/hotplug.json: I/O error
json_object_from_file: error reading file /etc/hotplug.json: I/O error
open: No such file or directory
open: No such file or directory
open: No such file or directory
open: No such file or directory
open: No such file or directory
....

Only HW reset helps, and after the reset the messages are gone, and the board boots as expected. 
On the board is NOR flash, so I guess it is not related to bad blocks.
Has anyone seen this issue before? Any clue how to fix it?


 OpenWRT 19.07.03,  mt7621 chip

Cheers,
Andy


From rosenp at gmail.com  Fri Sep 11 21:25:07 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 11 Sep 2020 18:25:07 -0700
Subject: [PATCHv4] mdadm: revised mdadm config & init logic
Message-ID: <20200912012507.103278-1-rosenp@gmail.com>

From: Joseph Tingiris <joseph.tingiris at gmail.com>

This is a significant revision of /etc/init.d/mdadm.  It adds new
features, support for new configuration options, safer error
handling, (configurable) verbose output, and contains multiple bug
fixes.

Most notably, mdadm was being started with the --config flag and
that prevented it from using its built in Auto Assembly features.
Users were required to put a correct uuid in /etc/config/mdadm.

The new default startup mode is now to automatically assemble all
RAID arrays attached to the machine using device scans, rather than
configuation options.

A new UCI section, config mdadm global, was added with new options that
are supported by the accompanying /etc/init.d/mdadm. Documentation for all
new (and previous) options was added as well.  See the
/etc/config/mdadmin or mdadm.init file itself for more details.

Additionally, a new stateful 'auto' feature was added that functions
similarly to the stateless Auto Assembly feature.  The benefits of
stateful auto assembly are to support features that mdadm 4.0 will only
read from a configuration file, such as setting the MAILFROM value.  The
new mdadm_conf_auto() function will also aid users in troubleshooting.
When verbose is turned on it provides tips and better visibility for what's
actually happening.

Backward compatibility was retained.  Stateful UCI only configurations are
supported.  All previously existing configurations will work in this mode.
However, these users will now have to explicitly turn it on.

A new reload_service() function was added to prevent reloads from
stopping mdadm.  Reloads will now be ignored, though the stage is set for
reloads to trigger scans for new devices.  Explicit restarts still work as
expected.

The start_service() function was enhanced to query new UCI mdadm.global
options: alert_program, config, email, email_from, monitor_frequency,
and verbose.  Each option is documented in /etc/mdadm/config (config.init) and
some additional code comments were added.

Finally, error handling and verbose output was enhanced.  Users will
know what's going on (if verbose is turned on).

Strict reliance on a shell global ($CONF) was removed and replaced with a
single global ($TMP_FILE) that's for development convenience.  When/if a config
file is not specified in the UCI config, it will fall back to using $TMP_FILE as the
configuration file.

Incremented PKG_RELEASE from 1 to 2

Signed-off-by: Joseph Tingiris <joseph.tingiris at gmail.com>
(rebased and ran through shellcheck)
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 v4: remove a bunch of stuff based on review
 v3: Simplified several sections
 v2: Rebased after sysmacro patches
 package/utils/mdadm/Makefile           |   2 +-
 package/utils/mdadm/files/mdadm.config | 162 +++++++-
 package/utils/mdadm/files/mdadm.init   | 530 ++++++++++++++++++++++---
 3 files changed, 621 insertions(+), 73 deletions(-)

diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile
index f20a58b704..d5ea91eeed 100644
--- a/package/utils/mdadm/Makefile
+++ b/package/utils/mdadm/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mdadm
 PKG_VERSION:=4.1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm
diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
index 50afbc2ab6..0c78c964a8 100644
--- a/package/utils/mdadm/files/mdadm.config
+++ b/package/utils/mdadm/files/mdadm.config
@@ -1,18 +1,154 @@
-config mdadm
+#
+# The mdadm 'global' section is for options that apply to all sections.
+#
+
+config mdadm global
+
+	#
+	# option 'alert_program' values may be a path to a valid, executable binary.
+	#
+	# The default 'alert_program' is not set.
+	#
+	# When mdadm detects an event it will execute this program with 3 arguments, see https://linux.die.net/man/8/mdadm
+	# $1 = will be the event
+	# $2 = will be the meta device
+	# $3 = may be a related component (if one exists)
+	#
+	# * alert_program runs independently from sendmail.
+	# * If both options alert_program and email are set, and both work, then an email and a
+	#   custom alert will be generated.
+	# * no alert program is included in mdadm 4.0-4.
+	#
+	# Lots of possibilities exist, i.e. scripts for netdata, slack, etc.
+	#
+	#option alert_program /usr/sbin/mdadm_alerts
+
+
+	#
+	# option 'config' values may be one of the following.
+	#
+	# The default 'config' is none (stateless auto assembly).
+	#
+	# auto		- stateful, dynamically generated mdadm.conf via block info,
+	#		  stored in /var/etc/mdadm.conf
+	# containers	- stateless, mdadm --assemble --scan --config=containers; see https://linux.die.net/man/8/mdadm
+	# none		- stateless, mdadm --assemble --scan --config=none; aka 'Auto Assembly',
+	#		  see https://linux.die.net/man/8/mdadm
+	# partition	- stateless, mdadm --assemble --scan --config=partition; see https://linux.die.net/man/8/mdadm
+	# uci		- stateful, dynamically generated mdadm.conf via uci array values (below),
+	#		  stored in /var/etc/mdadm.conf
+	# file		- stateful, manually generated mdadm.conf file(s),
+	#		  'file' must be preceded by a / and may be a readable filename
+	#		  or directory with multiple .conf files
+	#
+	# Try uncommenting this and using 'auto' if there are issues.  It provides more comprehensive
+	# diagnostics via verbose messages & the ability to set an email from address.
+	#
+	#option config auto
+
+
+	#
+	# option 'email' values may be a valid (to) email address, or empty.
+	#
+	# The default 'email' to send to is root (monitor email will be sent to the local root user).
+	#
+	# * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
+	# * Comment, or unset, the email value causes mail to be disabled.  With no email value, mdadm wont even try.
+	# * A single word name must be a valid user on the system, or it will bounce back to root.
+	#   Unless user 'mdadm' exists (it doesn't by default), this will bounce:
+	#   option email mdadm
+	# * A full email address does not need quoting and will deliver if tcp port 25 (SMTP) is allowed outbound, i.e.
+	#   option email joseph.tingiris at gmail.com
+	# * mdadm only supports one email address (MAILADDR) for all arrays. see mdadm.conf(5)
+	#
+	# mail will be to 'root@$HOSTNAME', i.e. root at OpenWrt
+	#
 	option email root
-	# list devices /dev/hd*
-	# list devices /dev/sd*
-	# list devices partitions
 
-config array
-	option uuid 52c5c44a:d2162820:f75d3464:799750f8
-	option device /dev/md0
-	# option name raid:0
-	# option super_minor 0
-	# list devices /dev/sda1
-	# list devices /dev/sdb1
-	# option spares 0
-	# option spare_group spares
+
+	#
+	# option 'email_from' values may be a valid (from) email address, or empty.
+	#
+	# The default 'email_from' is 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
+	#
+	# * Sending mail will only work if /usr/lib/sendmail or /usr/sbin/sendmail is available. Install postfix.
+	# * Comment, or unset, the email_from value causes mdadm to send mail from
+	#   root@$HOSTNAME, e.g. root at OpenWrt
+	# * A complete from envelope can be specified within quotes, i.e.
+	#   option email_from 'mdadm monitoring <this_is_not_spam at example.com>'
+	# * mdadm only supports setting a from address (MAILFROM) with a stateful config,
+	#   e.g. 'auto' or 'uci'. see mdadm.conf(5)
+	#
+	# mail will be from 'OpenWrt RAID Monitoring <mdadm@$HOSTNAME>', i.e. mdadm at OpenWrt
+	#
+	option email_from 'OpenWrt RAID Monitoring <mdadm>'
+
+
+	#
+	# option 'monitor_frequency' values may be a valid integer, or empty.
+	#
+	# The default monitor frequency (delayed poll) is 120 seconds.
+	#
+	# * This is the polling interval, frequency, or delay.  It's the value for mdadm --delay.  see https://linux.die.net/man/8/mdadm
+	#
+	option monitor_frequency 300
+
+	#
+	# option 'verbose' values may be '1', 'on', or 'true', everything else is false.
+	#
+	# The default verbosity is false (quiet).
+	#
+	# * Standard errors will be sent to console and syslog regardless of this setting.
+	# * When verbose is false mdadm will run in --quiet mode and generate very little log
+	#   or standard output.
+	#
+	# Turn this on if you're having problems, or want more detail.  With SSH_TTY set output will
+	# be to that TTY, otherwise it will go to syslog via logger.
+	#
+	#option verbose on
+
+
+#
+# The mdadm 'array' section(s) are for stateful, manual configurations. Experts only.  Use with caution.
+#
+#
+# The use of multiple 'array' sections is supported by /etc/init.d/mdadm.
+# They must all be named 'array'.
+#
+# As of this writing unnamed 'mdadm' sections are still allowed, but deprecated. Do not use.
+#
+
+#config array
+	#
+	# example 'array' options may be a valid mix of:
+	#
+	# bitmap
+	# container
+	# device
+	# devices
+	# member
+	# name
+	# spare_group
+	# spares
+	# super_minor
+	# uuid
+	#
 	# option bitmap /bitmap.md
 	# option container 00000000:00000000:00000000:00000000
+	# option device /dev/md0
+	# -and/or a devices list-
+	# list devices /dev/hd* # mdadm allows glob, see glob(7)
+	# list devices /dev/sd*
+	# list devices /dev/sda1
+	# list devices /dev/sdb1
+	# list devices containers
+	# list devices partitions
 	# option member 1
+	# option name raid:0
+	# option spare_group spares
+	# option spares 0
+	# option super_minor 0
+	# use uuid from block info (preferred), or mdadm --misc --detail /dev/md0
+	# option uuid 2084de11-70c4-4521-8f95-6113e75f1fe9
+	#
+	# These options directly translate to mdadm -- options, see https://linux.die.net/man/8/mdadm
diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
index 64a50b35de..6469603671 100644
--- a/package/utils/mdadm/files/mdadm.init
+++ b/package/utils/mdadm/files/mdadm.init
@@ -1,93 +1,505 @@
 #!/bin/sh /etc/rc.common
 
-START=13
-STOP=98
+START=12
+STOP=99
 
 USE_PROCD=1
 PROG=/sbin/mdadm
 NAME=mdadm
 
-CONF="/var/etc/mdadm.conf"
+LOGGER=0 # off
+VERBOSE=0 # off
+
+TMP_FILE="/var/etc/mdadm.conf" # /var/etc is on /tmp; used for temporary state, to enable stateful only mdadm features
+
+[ -x "$PROG" ] || exit 1
 
 append_list_item() {
-	append "$2" "$1" "$3"
+    append "$2" "$1" "$3"
 }
 
 append_option() {
-	local var="$1"
-	local cfg="$2"
-	local opt="$3"
-	local name="$4"
-	local sep="$5"
-	local str
-
-	if [ -n "$sep" ]; then
-		config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
-	else
-		config_get str "$cfg" "$opt"
-	fi
-
-	[ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
+    local var="$1"
+    local cfg="$2"
+    local opt="$3"
+    local name="$4"
+    local sep="$5"
+    local str
+
+    if [ -n "$sep" ]; then
+        config_list_foreach "$cfg" "$opt" append_list_item str "$sep"
+    else
+        config_get str "$cfg" "$opt"
+    fi
+
+    [ -n "$str" ] && append "$var" $(printf "%s=%s" "${name:-${opt//_/-}}" "$str")
 }
 
-mdadm_common() {
-	local cfg="$1"
-	local email devices
+verbose() {
+    local msg="$1"
+    local level="$2"
+
+    [ -z "$level" ] && level="INFO"
+
+    [ "$VERBOSE" = "1" ] && {
+        if [ ${#SSH_TTY} -gt 0 ]; then
+            printf "$NAME: init %7s - %b\n" "$level" "$msg"
+        else
+            # no SSH_TTY goes to logger
+            printf "$NAME: init %7s - %b\n" "$level" "$msg" | logger -t mdadm
+        fi
+    }
+}
+
+mdadm_conf_auto() {
+    local mdadm_conf="$1"
+
+    [ -w "$mdadm_conf" ] || {
+        if [ -z "$mdadm_conf" ]; then
+            verbose "mdadm_conf value is empty" ERROR
+        else
+            verbose "'$mdadm_conf' file not found writable" ERROR
+        fi
+        return 1
+    }
+
+    local block_md block_uuid mdadm_md mdadm_md_rc mdadm_uuid
+
+    # Check block info for active linux_raid_members, if necessary then compare with mdadm, & dynamically update $mdadm_conf
+
+    block_md=0 # counter
+    for block_uuid in $(block info 2> /dev/null | sed -nEe 's#^.* UUID="([^"]*)".*TYPE="linux_raid_member"#\1#p'); do
+        mdadm_md=""
+        mdadm_md_rc=0
+
+        while [ -z "$mdadm_md" ]; do
+            if [ -b "/dev/md$block_md" ]; then
+                # handle mdadm restart, service reload, multiple starts without stops, physical unplug, etc.
+
+                verbose "/dev/md$block_md block device already exists" NOTICE
+
+                # active arrays will promptly respond; first check
+                mdadm_uuid=$($PROG --detail --test --brief "/dev/md$block_md" 2> /dev/null | sed -nEe '1s#^.*UUID=((.){35})#\1#p')
+
+                [ -z "$mdadm_uuid" ] && {
+                    # When an array is unplugged and then plugged in again (without rebooting) then it becomes an INACTIVE-ARRAY
+                    # however the device file persists, e.g. /dev/md0, and should be reused, rather than a new device assigned.
+                    if $PROG --detail --test --scan "/dev/md$block_md" 2> /dev/null | grep -E "^(INACTIVE-ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t)metadata)" > /dev/null 2>&1; then
+                        verbose "attempting to revive INACTIVE-ARRAY on /dev/md$block_md" NOTICE
+                        if $PROG --examine --scan 2> /dev/null | grep -qE "^(ARRAY(\ |\t)(.*)/dev/md(|/)$block_md(\ |\t))"; then
+                            # this is relatively safe with the above regex validation
+                            mdadm_md="/dev/md$block_md"
+                        fi
+                    else
+                        # This is an unsafe condition to handle with a shell, mdadm sees an inactive device with a different /dev.
+                        # Err to the side of caution;--assemble --scan shoud know what to do ... it will abandon the block device.
+                        # If these are happening, suggest stateless & sacrifice some minor functionality, e.g. MAILFROM
+                        # May be an mdadm or kernel bug with this hardware setup.
+                        verbose "bug? unsafe to revive INACTIVE-ARRAY on /dev/md$block_md" WARNING
+                        block_md=$((block_md+1))
+                        continue
+                    fi
+                }
+
+                if [ "${block_uuid//-/}" = "${mdadm_uuid//:/}" ]; then
+                    # block info & mdadm concur all's well; the meta device is active; reuse
+                    mdadm_md="/dev/md$block_md"
+                    verbose "auto conf found active RAID member block_uuid=$block_uuid and will reused device '$mdadm_md'" OK
+                else
+                    if [ ! -e "/dev/md$block_md" ]; then
+                        # this block device was never assembled previously; new
+                        mdadm_md="/dev/md$block_md"
+                        verbose "auto conf found new RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
+                    else
+                        block_md=$((block_md+1))
+                        continue
+                    fi
+                fi
+
+            else
+                if [ ! -e "/dev/md$block_md" ]; then
+                    # best scenario; no device or file (yet), safest
+                    mdadm_md="/dev/md$block_md"
+                    verbose "auto conf found missing RAID member block_uuid=$block_uuid and will assign device '$mdadm_md'" OK
+                else
+                    # a file exists, but it's not a block device? It's possible (touch), albeit a corner case; discretely say
+                    # we know & pass over it.
+                    verbose "/dev/md$block_md file found, not a block device" WARNING
+                    block_md=$((block_md+1))
+                    continue
+                fi
+            fi
 
-	if [ -x /usr/sbin/sendmail ]; then
-		config_get email "$cfg" email
-		[ -n "$email" ] && printf "MAILADDR %s\n" "$email" >> $CONF
-	fi
+            $PROG --detail --test --brief $mdadm_md > /dev/null 2>&1 # rc 1=ok, 1=degrade, 2=dead, 4=missing
+            mdadm_md_rc=$?
 
-	config_list_foreach "$cfg" devices append_list_item devices " "
-	[ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $CONF
+            # todo: annouce degraded arrays in the logs? mdadmin monitor will do it but not on demand, only per frequency.
+            #       nice to have for hot plugs ...
+
+            verbose "block_md=$block_md, block_uuid=$block_uuid, mdadm_md=$mdadm_md, mdadm_uuid=$mdadm_uuid, rc=$mdadm_md_rc" INFO
+
+            if [ $mdadm_md_rc -lt 4 ]; then
+                $PROG --detail --test --brief $mdadm_md 2> /dev/null >> $mdadm_conf
+            else
+                # there's a device with no header.  maybe it's to replace a failed device ...
+                echo "ARRAY $mdadm_md uuid=$block_uuid" >> $mdadm_conf
+            fi
+
+        done
+
+    done
+
+    if [ -n "$mdadm_md" ]; then
+        return 0
+    else
+        return 1
+    fi
 }
 
-mdadm_array() {
-	local cfg="$1"
-	local uuid device devices name array
+mdadm_conf_uci() {
+    local cfg="$1"
+    local mdadm_conf="$2"
+
+    [ -z "$cfg" ] && {
+        verbose "cfg is empty" WARNING
+        return 1
+    }
+
+    local cfg_name
+    cfg_name=$(uci_get mdadm.$cfg 2> /dev/null)
+
+    [ -z "$cfg_name" ] && verbose "($cfg) mdadm config name is empty" NOTICE
+
+    [ -z "$mdadm_conf" ] && {
+        verbose "($cfg) skipping mdadm.$cfg_name array; config file is empty" WARNING
+        return 1
+    }
 
-	config_get uuid "$cfg" uuid
-	config_get name "$cfg" name
-	config_get device "$cfg" device
+    if ! touch "$mdadm_conf" 2> /dev/null; then
+        verbose "($cfg) skipping mdadm.$cfg_name array; can't touch '$mdadm_conf'" ERROR
+        return 1
+    fi
 
-	if [ -z "$device" ] || [ -z "$uuid$name" ]; then
-		echo "Skipping array without device, uuid or name" >&2
-		return
-	fi
+    local array device devices name uuid
 
-	[ -n "$uuid" ] && append array "uuid=$uuid"
-	[ -n "$name" ] && append array "name=$name"
+    config_get name "$cfg" name
+    config_get device "$cfg" device
+    config_get uuid "$cfg" uuid
 
-	append_option array "$cfg" super_minor
-	append_option array "$cfg" spares
-	append_option array "$cfg" spare_group
-	append_option array "$cfg" bitmap
-	append_option array "$cfg" container
-	append_option array "$cfg" member
-	append_option array "$cfg" devices devices ","
+    config_list_foreach "$cfg" devices append_list_item devices " "
+    [ -n "$devices" ] && printf "DEVICE %s\n" "$devices" >> $mdadm_conf
 
-	printf "ARRAY %s %s\n" "$device" "$array" >> $CONF
+    if [ -z "$device" ] || [ -z "$uuid$name" ]; then
+        verbose "($cfg) skipping mdadm.$cfg_name array; no device, uuid, or name" WARNING
+        return 1
+    fi
+
+    [ -n "$uuid" ] && append array "uuid=$uuid"
+    [ -n "$name" ] && append array "name=$name"
+
+    append_option array "$cfg" super_minor
+    append_option array "$cfg" spares
+    append_option array "$cfg" spare_group
+    append_option array "$cfg" bitmap
+    append_option array "$cfg" container
+    append_option array "$cfg" member
+    append_option array "$cfg" devices devices ","
+
+    printf "ARRAY %s %s\n" "$device" "$array" >> $mdadm_conf
+}
+
+reload_service() {
+    while read -r line; do echo $line; done
+    # running start_service() on reload should be OK in all modes, except manual configs.
+    # for auto & none, start_service() already rescans for hotplugged devices, add new arrays, etc.
+    # could check for the configured mode & call appropriately?  doing nothing is safer; todo: test & resolve
+    verbose "reload_service called, ignoring" NOTICE
+    return 0
 }
 
 start_service() {
-	local email
+    local config config_detail config_file config_level config_mode config_rc config_state config_verbose mdadm_conf
+
+    # mdadm.global specific locals
+    local alert_program email email_from mail_program mdadm_args monitor_frequency
+
+    config_verbose=$(uci_get mdadm.global.verbose 2> /dev/null | awk '{print tolower($1)}')
+    if [ "$config_verbose" = "1" ] || [ "$config_verbose" = "on" ] || [ "$config_verbose" = "true" ]; then
+        VERBOSE=1 # turn verbose on globally
+        config_verbose=1
+        mdadm_args="--verbose"
+    else
+        unset -v config_verbose
+        mdadm_args="--quiet"
+    fi
+
+    verbose "start_service $*" INFO
+
+    config_rc=0
+    config_detail="start"
+    config_level="INFO"
+    config_mode="service"
 
-	mkdir -p "${CONF%/*}"
-	printf "# Autogenerated from /etc/config/mdadm, do not edit!\n" > $CONF
+    config=$(uci_get mdadm.global.config 2> /dev/null)
+    if [ -z "$config" ]; then
+        # per PR1713 discussion; this works very well for the majority of use cases; let mdadm do the heavy lifting.
+        # none is (Auto Assemble; or no --config); see mdadm(8), default
+        config='none'
+        config_detail="mdadm.global.config value is empty"
+        config_state='stateless'
+        config_mode="default"
+        config_level='OK'
+    else
+        # experts only
 
-	config_load mdadm
-	config_foreach mdadm_common mdadm
-	config_foreach mdadm_array array
+        config_mode="manual"
 
-	$PROG --assemble --scan --config="$CONF"
+        # check file values first, to preserve case of file name values
+        if [ "${config:0:1}" = "/" ]; then
+            config_state='stateful' # all types of file configs are stateful
 
-	procd_open_instance
-	procd_set_param command "$PROG" --monitor --syslog --scan --config="$CONF"
-	procd_close_instance
+            if [ -d "$config" ] && [ -r "$config" ]; then
+                local config_file_count=0
+                for config_file in ${config}/*.conf; do
+                    if [ -r "$config_file" ]; then
+                        config_file_count=$((config_file_count+1))
+                    fi
+                done
+                if [ $config_file_count -eq 0 ]; then
+                    config_level="WARNING"
+                else
+                    config_level="OK"
+                fi
+                config_detail="directory found with $config_file_count readable .conf files"
+            else
+                if [ -w "$config" ]; then
+                    if [ -s "$config" ]; then
+                        # regardless, this will rely on mdadm for final validation; for informational purposes ...
+                        grep -E '^((DEVICE){1}(\ |\t)(.*)(/dev/|containers|partitions))' "$config" > /dev/null 2>&1 # pattern per mdadm(8)
+                        if [ $? -eq 0 ]; then
+                            config_detail="file found, readable with a ^DEVICE"
+                            config_level="OK"
+                        else
+                            config_detail="file found, readable without a ^DEVICE"
+                            config_level="WARNING"
+                        fi
+                    else
+                        config_detail="file found, writable and empty"
+                        config_level="OK"
+                    fi
+                else
+                    config_detail="file not found, unwritable"
+                    config_level="FATAL"
+                    config_rc=1
+                fi
+            fi
+        else
+            config_mode="dynamic"
+
+            # allow static values in mixed case; convert to lower
+            config="$(awk -v config="$config" 'BEGIN{print tolower(config)}')"
+            if [ "$config" = "containers" ] || [ "$config" = "none" ] || [ "$config" = "partition" ]; then
+                # pass through to mdadm --config=
+                config_detail="dynamic; uci static key value"
+                config_level="OK"
+                config_state='stateless'
+            else
+                if [ "$config" = "auto" ] || [ "$config" = "uci" ]; then
+                    config_detail="dynamic; $config config"
+                    config_level="OK"
+                    config_state='stateful'
+                    mdadm_conf="$TMP_FILE"
+                else
+                    config_detail="invalid; unsupported uci config key value"
+                    config_level="FATAL"
+                    config_state='stateful'
+                    config_rc=1
+                fi
+            fi
+        fi
+    fi
+
+    # final safety & functional checks
+
+    # check for fatality
+    [ -z "$config" ] && {
+        config="${config}?"
+        config_detail="$config_detail (sorry, something went wrong; check the config settings)"
+        config_level="FATAL"
+        config_mode="${config_mode}?"
+        config_state="${config_state}?"
+        config_rc=1
+    }
+
+    # Prefer mdadm.global.email; only one is allowed and can be an --email argument per mdadm.conf(5)
+    email=$(uci_get mdadm.global.email 2> /dev/null)
+
+    # There's really no point in making mdadm's compiled in sendmail configurable via uci.
+    mail_program="/usr/lib/sendmail"
+    [ -x "$mail_program" ] || {
+        verbose "disabling email; mail program '/usr/lib/sendmail' not found executable (install postfix)" WARNING
+        email=""
+    }
+
+    if [ "$config_state" = "stateful" ] && [ -n "$mdadm_conf" ]; then
+        if mkdir -p "${mdadm_conf%/*}" > /dev/null 2>&1; then
+            printf "# Autogenerated from /etc/init.d/mdadm, do not edit!\n" > $mdadm_conf
+
+            # Use mdadm.global.email_from only if there's a valid mta; only one is allowed per mdadm.conf(5)
+            # todo: see what other mtas Openwrt has in their opkg repos & maybe support others
+            [ -x "$mail_program" ] && email_from=$(uci_get mdadm.global.email_from 2> /dev/null)
+
+            if [ "$config" = "auto" ]; then
+                # stateful mdadm.conf auto configuration
+                if ! mdadm_conf_auto "$mdadm_conf"; then
+                    #there's quite a bit of logic & error handling in mdadm_conf_auto; if it doesn't return 0 then it's a fatality
+                    config_detail="$config_detail (couldn't find any meta devices; check connections, or try stateless autoconfig)"
+                    config_level="FATAL"
+                    config_rc=1
+                fi
+            else
+                # stateful mdadm.conf uci configuration
+
+                # load uci config from /etc/config/mdadm
+                config_load mdadm
+
+                # This is how mdadm uci mdadm config sections should be named, like fstab does with 'mount'.
+                # The included uci /etc/config/mdadm provides more documentation & direction.
+                config_foreach mdadm_conf_uci array "$mdadm_conf"
+
+                # The unlabled mdadm. at mdadm[0] section should be (is now) deprecated.
+                # It's more difficult to document how to use, redundant, and over complicated this init configuration.
+
+                # Confused; originally config_foreach?
+                # It's possible to specify multiple mdadm sections with array options in all sections.
+                # Thus multiple option emails which could result in multiple MAILADDR being appended to mdadm.conf.
+                # That confuses mdadm.
+
+                # The following code is here to prevent regressions.
+
+                config_foreach mdadm_conf_uci mdadm "$mdadm_conf"
+
+                # For backward compatibility; this will allow an mdadm. at mdadm[0] section's option email.
+                # (only if mdadm.global.email is not set; again, prefer mdadm.global.email)
+                #
+                # bug fixed. The first legacy mdadm section option email will be used.
+                # a better fix would be to *only* support array sections.
+                #
+                [ -z "$email" ] && [ -x "$mail_program" ] && email=$(uci_get mdadm. at mdadm[0].email 2> /dev/null)
+                # email_from is a new feature; was not previously handled; no need to and please don't backport
+
+            fi
+
+            # This is nice feature to have to get mdadm mails through spam filters, etc.
+            # Too bad mdadm (4.0) doesn't have an argument for it.
+            # Maybe mdadm 4.1 will ... todo: revisit when making mdadm 4.1 & it's in Openwrt mainline.
+            # This tests successfully with the postfix workaround above & mdadm 4.0.
+            [ -x "$mail_program" ] && {
+                printf "MAILFROM %s\n" "$email_from" >> $mdadm_conf # only supported via stateful configs; see mdadm.conf(5)
+            }
+
+            [ -n "$config_verbose" ] && [ -r "$mdadm_conf" ] && {
+                verbose "mdadm_conf = $mdadm_conf (config_verbose=$config_verbose)" INFO
+                verbose "---cut $mdadm_conf cut---" INFO
+                while read -r line; do
+                    verbose "$line" INFO
+                done < "$mdadm_conf"
+                unset -v line
+                verbose "---cut $mdadm_conf cut---" INFO
+            }
+
+        else
+            config_detail="$config_detail (mkdir failed; check permissions)"
+            config_level="FATAL"
+            config_rc=1
+        fi
+    fi
+
+    [ $config_rc -ne 0 ] && {
+        # FATAL
+        verbose "$config_state,$config_mode config='$config', $config_detail" "$config_level" INFO
+        [ -n "$mdadm_conf" ] && [ -w "$mdadm_conf" ] && rm -f "$mdadm_conf"
+        exit $config_rc
+    }
+
+    # Good to go, no more fatal exits, finish getting global & setting local values ... they're all optional.
+
+    mdadm_args="$mdadm_args --scan"
+
+    if [ -n "$mdadm_conf" ]; then
+        # mdadm.global.config </file>
+        mdadm_args="$mdadm_args --config=$mdadm_conf"
+    else
+        # mdadm.global.config all (containers, partitions, etc), except none
+        [ -n "$config" ] && [ "$config" != 'none' ] && mdadm_args="$mdadm_args --config=$config"
+    fi
+
+    local assemble_count assemble_rc
+
+    assemble_count=$($PROG --detail --brief --scan 2> /dev/null | wc -l)
+    verbose "$assemble_count arrays are currently assembled" INFO
+
+    # setup assembly mode
+
+    verbose "(assemble) '$PROG --assemble $mdadm_args'" INFO
+    $PROG --assemble $mdadm_args > /dev/null 2>&1
+    assemble_rc=$?
+
+    if [ $assemble_rc -eq 0 ]; then
+        verbose "all arrays assembled successfully" OK
+        [ -n "$config_verbose" ] && {
+            true > /var/log/mdadm.detail
+            local assemble_dev assemble_devs
+            assemble_devs=$($PROG --detail --brief --scan | awk '{print $2}')
+            for assemble_dev in $assemble_devs; do
+             {
+                printf "\n"
+                $PROG --verbose --detail $assemble_dev
+                printf "\n"
+             } >> /var/log/mdadm.detail
+            done
+            unset -v assemble_dev
+            while read -r line; do
+                verbose "$line" INFO
+            done < "/var/log/mdadm.detail"
+            unset -v line
+        }
+    else
+        if [ $assemble_count -eq 0 ]; then
+            verbose "no arrays assembled successfully" ERROR
+        else
+            verbose "no new arrays need assembly" NOTICE
+        fi
+    fi
+
+    # setup monitor mode
+
+    alert_program=$(uci_get mdadm.global.alert_program 2> /dev/null)
+    [ -n "$alert_program" ] && {
+        if [ -x "$alert_program" ]; then
+            mdadm_args="$mdadm_args --alert=$alert_program"
+        else
+            verbose "disabling alerts; alert_progam '$alert_program' not found executable" WARNING
+        fi
+    }
+
+    [ -n "$email" ] && mdadm_args="$mdadm_args --mail=$email"
+
+    monitor_frequency=$(uci_get mdadm.global.monitor_frequency 2> /dev/null | sed -e 's/[^0-9]*//g')
+    [ -n "$monitor_frequency" ] && {
+        mdadm_args="$mdadm_args --delay=$monitor_frequency"
+        verbose "setting monitor frequency to '$monitor_frequency' seconds"
+    }
+
+    verbose "(monitor) '$PROG --monitor --syslog $mdadm_args'" INFO
+
+    procd_open_instance
+    procd_set_param command "$PROG" --monitor --syslog $mdadm_args
+    procd_close_instance
+
+    verbose "$config_state,$config_mode config=$config, $config_detail complete" "$config_level"
 }
 
 stop_service() {
-	$PROG --stop --scan
+    $PROG --stop --scan
 }
-
-- 
2.26.2



From freifunk at adrianschmutzler.de  Sat Sep 12 15:52:48 2020
From: freifunk at adrianschmutzler.de (Adrian Schmutzler)
Date: Sat, 12 Sep 2020 21:52:48 +0200
Subject: [PATCH] ath79: consistently use "info" label for default-mac partition
Message-ID: <20200912195248.47681-1-freifunk@adrianschmutzler.de>

The tp-link safeloader devices typically contain a partition
"default-mac" which stores the MAC addresses. It is followed by other
partitions containing device info, like

  {"default-mac", 0x610000, 0x00020},
  {"pin", 0x610100, 0x00020},
  {"product-info", 0x611100, 0x01000},

In DTS, we typically assign a 0x10000 sized partition for these,
which is mostly labelled "mac" or "info". In rarer cases, the
partitions have been enclosed in a larger "tplink" or "config"
partition.

However, when comparing different devices, the implementation appears
relatively arbitrary at the moment.
Thus, this PR aims at harmonizing these partitions by always using
the name "info" for the DTS partition containing "default-mac".
"info" is preferred over "mac" as we never just have "default-mac"
alone, but always some other device-info partitions as well.

While at it, this also establishes a similar partitioning for the
few devices where the "info" partitions are part of a bigger
unspecific "config" partition or similar.

Besides the harmonization itself, this also allows to merge a few
cases in 11-ath10k-caldata.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ath79/dts/ar9344_tplink_cpe.dtsi |  2 +-
 .../dts/qca9531_tplink_tl-wr902ac-v1.dts      | 14 +++++++++----
 .../dts/qca9533_tplink_tl-wa850re-v2.dts      | 20 +++++++++++++++----
 .../ath79/dts/qca9558_tplink_re350k-v1.dts    | 20 +++++++++++++++----
 .../dts/qca9561_tplink_archer-c58-v1.dts      |  4 ++--
 .../dts/qca9561_tplink_archer-c59-v1.dts      |  4 ++--
 .../dts/qca9561_tplink_archer-c59-v2.dts      |  4 ++--
 .../ath79/dts/qca9561_tplink_archer-c5x.dtsi  |  6 +++---
 .../dts/qca9561_tplink_archer-c60-v1.dts      |  4 ++--
 .../dts/qca9561_tplink_archer-c60-v2.dts      |  4 ++--
 .../dts/qca9561_tplink_archer-c60-v3.dts      |  4 ++--
 .../ath79/dts/qca9561_tplink_archer-c6x.dtsi  |  6 +++---
 .../dts/qca9563_tplink_archer-c6-v2-us.dts    |  4 ++--
 .../ath79/dts/qca9563_tplink_archer-c6-v2.dts |  4 ++--
 .../dts/qca9563_tplink_archer-x6-v2.dtsi      |  4 ++--
 .../dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts  |  4 ++--
 .../dts/qca9563_tplink_tl-wpa8630p-v2-int.dts |  4 ++--
 .../dts/qca9563_tplink_tl-wpa8630p-v2.dtsi    |  4 ++--
 .../etc/hotplug.d/firmware/11-ath10k-caldata  | 18 +++++------------
 19 files changed, 78 insertions(+), 56 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
index e8a3bdc399..044f6c5c19 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
@@ -100,7 +100,7 @@
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&info 0x08>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &eth0 {
diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
index 0e338fe012..6d9cdf8b3f 100644
--- a/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
+++ b/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
@@ -126,9 +126,15 @@
 				reg = <0x020000 0x730000>;
 			};
 
-			tplink: partition at 750000 {
+			info: partition at 750000 {
+				label = "info";
+				reg = <0x750000 0x010000>;
+				read-only;
+			};
+
+			partition at 760000 {
 				label = "tplink";
-				reg = <0x750000 0x0a0000>;
+				reg = <0x760000 0x090000>;
 				read-only;
 			};
 
@@ -146,7 +152,7 @@
 
 	phy-handle = <&swphy4>;
 
-	mtd-mac-address = <&tplink 0x8>;
+	mtd-mac-address = <&info 0x8>;
 	mtd-mac-address-increment = <1>;
 };
 
@@ -158,7 +164,7 @@
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&tplink 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &pcie0 {
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
index e103b66cbd..6f7f3cca79 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
@@ -125,9 +125,21 @@
 				compatible = "tplink,firmware";
 			};
 
-			config: partition at 3b0000 {
+			partition at 3b0000 {
+				label = "partition-table";
+				reg = <0x3b0000 0x010000>;
+				read-only;
+			};
+
+			info: partition at 3c0000 {
+				label = "info";
+				reg = <0x3c0000 0x010000>;
+				read-only;
+			};
+
+			partition at 3d0000 {
 				label = "config";
-				reg = <0x3b0000 0x040000>;
+				reg = <0x3d0000 0x020000>;
 				read-only;
 			};
 
@@ -145,7 +157,7 @@
 
 	phy-handle = <&swphy4>;
 
-	mtd-mac-address = <&config 0x10008>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &eth1 {
@@ -156,5 +168,5 @@
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&config 0x10008>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
index 887b6eea5f..7c27c97934 100644
--- a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
@@ -100,7 +100,7 @@
 	phy-handle = <&phy4>;
 	pll-data = <0x9e000000 0x80000101 0x80001313>;
 
-	mtd-mac-address = <&config 0x10008>;
+	mtd-mac-address = <&info 0x8>;
 
 	gmac-config {
 		device = <&gmac>;
@@ -144,9 +144,21 @@
 				reg = <0x020000 0xd70000>;
 			};
 
-			config: partition at d90000 {
+			partition at d90000 {
+				label = "partition-table";
+				reg = <0xd90000 0x010000>;
+				read-only;
+			};
+
+			info: partition at da0000 {
+				label = "info";
+				reg = <0xda0000 0x020000>;
+				read-only;
+			};
+
+			partition at dc0000 {
 				label = "config";
-				reg = <0xd90000 0x260000>;
+				reg = <0xdc0000 0x230000>;
 				read-only;
 			};
 
@@ -167,5 +179,5 @@
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&config 0x10008>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts
index db2e38bbcb..dfd299b0a0 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c58-v1.dts
@@ -28,8 +28,8 @@
 				read-only;
 			};
 
-			mac: partition at 10000 {
-				label = "mac";
+			info: partition at 10000 {
+				label = "info";
 				reg = <0x010000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
index 773b071a34..cb0dca59ee 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
@@ -52,8 +52,8 @@
 				read-only;
 			};
 
-			mac: partition at 10000 {
-				label = "mac";
+			info: partition at 10000 {
+				label = "info";
 				reg = <0x010000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
index e70afbffd9..c2dad233fa 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
@@ -58,8 +58,8 @@
 				read-only;
 			};
 
-			mac: partition at 30000 {
-				label = "mac";
+			info: partition at 30000 {
+				label = "info";
 				reg = <0x030000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
index aa33d13c85..06df553d49 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
@@ -130,7 +130,7 @@
 
 	phy-handle = <&swphy0>;
 
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 	mtd-mac-address-increment = <1>;
 
 	gmac-config {
@@ -144,12 +144,12 @@
 &eth1 {
 	status = "okay";
 
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &wmac {
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
index a83b5881d4..349c0623d6 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
@@ -40,8 +40,8 @@
 				read-only;
 			};
 
-			mac: partition at 10000 {
-				label = "mac";
+			info: partition at 10000 {
+				label = "info";
 				reg = <0x010000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
index c19e4e973d..ebd5254a2c 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
@@ -40,8 +40,8 @@
 				read-only;
 			};
 
-			mac: partition at 1fb00 {
-				label = "mac";
+			info: partition at 1fb00 {
+				label = "info";
 				reg = <0x01fb00 0x000500>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
index 444d54b000..3187bcda63 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
@@ -35,8 +35,8 @@
 				read-only;
 			};
 
-			mac: partition at 1fb00 {
-				label = "mac";
+			info: partition at 1fb00 {
+				label = "info";
 				reg = <0x01fb00 0x000500>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi b/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
index 993c6acc56..b001938d92 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
@@ -76,19 +76,19 @@
 
 	phy-handle = <&swphy4>;
 
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 	mtd-mac-address-increment = <1>;
 };
 
 &eth1 {
 	status = "okay";
 
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &wmac {
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
index 3a6f00bf4e..63185ca7e5 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
@@ -96,8 +96,8 @@
 				read-only;
 			};
 
-			mac: partition at 20000 {
-				label = "mac";
+			info: partition at 20000 {
+				label = "info";
 				reg = <0x020000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
index e7ceec9b37..7defe6a2a2 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
@@ -96,8 +96,8 @@
 				read-only;
 			};
 
-			mac: partition at 20000 {
-				label = "mac";
+			info: partition at 20000 {
+				label = "info";
 				reg = <0x020000 0x010000>;
 				read-only;
 			};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi b/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi
index 275f71316c..15be4c2967 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-x6-v2.dtsi
@@ -42,12 +42,12 @@
 	phy-mode = "sgmii";
 	phy-handle = <&phy0>;
 
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &wmac {
 	status = "okay";
 
 	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts
index afcb471670..c205b78545 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts
@@ -9,8 +9,8 @@
 };
 
 &partitions {
-	mac: partition at 630000 {
-		label = "mac";
+	info: partition at 630000 {
+		label = "info";
 		reg = <0x630000 0x010000>;
 		read-only;
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts
index 8655283f58..9990a253ca 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts
@@ -15,8 +15,8 @@
 		read-only;
 	};
 
-	mac: partition at 7e0000 {
-		label = "mac";
+	info: partition at 7e0000 {
+		label = "info";
 		reg = <0x7e0000 0x010000>;
 		read-only;
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi
index 2d3128e037..be691a843b 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi
@@ -35,9 +35,9 @@
 };
 
 &eth0 {
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
 
 &wmac {
-	mtd-mac-address = <&mac 0x8>;
+	mtd-mac-address = <&info 0x8>;
 };
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 39b2d0ba49..89a64fbf35 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -98,7 +98,8 @@ case "$FIRMWARE" in
 	tplink,archer-c2-v3|\
 	tplink,archer-c7-v4|\
 	tplink,archer-c7-v5|\
-	tplink,archer-c25-v1)
+	tplink,archer-c25-v1|\
+	tplink,tl-wr902ac-v1)
 		caldata_extract "art" 0x5000 0x844
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
 		;;
@@ -118,7 +119,7 @@ case "$FIRMWARE" in
 		;;
 	tplink,re350k-v1)
 		caldata_extract "art" 0x5000 0x844
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2)
+		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +2)
 		;;
 	tplink,re355-v1|\
 	tplink,re450-v1)
@@ -134,10 +135,6 @@ case "$FIRMWARE" in
 		caldata_extract "art" 0x5000 0x844
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x0fc00) +1)
 		;;
-	tplink,tl-wr902ac-v1)
-		caldata_extract "art" 0x5000 0x844
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary tplink 0x8) -1)
-		;;
 	esac
 	;;
 "ath10k/cal-pci-0000:01:00.0.bin")
@@ -195,18 +192,13 @@ case "$FIRMWARE" in
 	tplink,archer-c6-v2|\
 	tplink,archer-c6-v2-us)
 		caldata_extract "art" 0x5000 0x2f20
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1)
+		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
 		ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
 			/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
 		;;
+	tplink,eap225-wall-v2|\
 	tplink,tl-wpa8630p-v2-eu|\
 	tplink,tl-wpa8630p-v2-int)
-		caldata_extract "art" 0x5000 0x2f20
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) +1)
-		ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
-			/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
-		;;
-	tplink,eap225-wall-v2)
 		caldata_extract "art" 0x5000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1)
 		ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
-- 
2.20.1



From chunkeey at gmail.com  Sat Sep 12 17:15:28 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:28 +0200
Subject: [PATCH v3 2/8] build: define PWM_SUPPORT arch feature flag
In-Reply-To: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
Message-ID: <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>

As the PWM has its own sub-system in the Linux kernel,
I think it should be handled in the same way as GPIO, RTC, PCI...

This patch introduces a specific feature flag "pwm" and the
"leds-pwm" kernel module as the first customer.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/kernel/linux/modules/leds.mk | 16 ++++++++++++++++
 scripts/target-metadata.pl           |  1 +
 target/Config.in                     |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk
index c030b54b39..fe90c6b559 100644
--- a/package/kernel/linux/modules/leds.mk
+++ b/package/kernel/linux/modules/leds.mk
@@ -159,3 +159,19 @@ define KernelPackage/leds-pca963x/description
 endef
 
 $(eval $(call KernelPackage,leds-pca963x))
+
+
+define KernelPackage/leds-pwm
+  SUBMENU:=$(LEDS_MENU)
+  TITLE:=PWM driven LED Support
+  KCONFIG:=CONFIG_LEDS_PWM
+  DEPENDS:= @PWM_SUPPORT
+  FILES:=$(LINUX_DIR)/drivers/leds/leds-pwm.ko
+  AUTOLOAD:=$(call AutoLoad,60,leds-pwm,1)
+endef
+
+define KernelPackage/leds-pwm/description
+ This option enables support for pwm driven LEDs
+endef
+
+$(eval $(call KernelPackage,leds-pwm))
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index c58f096573..bf6413d315 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -20,6 +20,7 @@ sub target_config_features(@) {
 		/^usb$/ and $ret .= "\tselect USB_SUPPORT\n";
 		/^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n";
 		/^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
+		/^pwm$/ and $ret .= "\select PWM_SUPPORT\n";
 		/^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n";
 		/^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n";
 		/^jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
diff --git a/target/Config.in b/target/Config.in
index 9fead5994f..43de4710df 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -29,6 +29,9 @@ config PCIE_SUPPORT
 config PCMCIA_SUPPORT
 	bool
 
+config PWM_SUPPORT
+	bool
+
 config USB_SUPPORT
 	select AUDIO_SUPPORT
 	bool
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:27 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:27 +0200
Subject: [PATCH v3 1/8] scripts: mkits.sh make it possible to specify fdt@#
Message-ID: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>

Some bootloaders are really keen on just one special
fdt in a multi-image fit image. This is a problem, because
currently this is fixed to "fdt at 1".

This patch introduces a new device variable:
DEVICE_FDT_NUM that allows to specify the right
fdt number.

If the value is absent "1" will be chosen.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 include/image-commands.mk |  1 +
 include/image.mk          |  6 ++++--
 scripts/mkits.sh          | 12 ++++++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 9516801c8d..740d627fc7 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -158,6 +158,7 @@ define Build/fit
 		-D $(DEVICE_NAME) -o $@.its -k $@ \
 		$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
 		-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+		$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
 		-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config at 1") \
 		-A $(LINUX_KARCH) -v $(LINUX_VERSION)
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
diff --git a/include/image.mk b/include/image.mk
index 703aeb6816..a1308f47ad 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -432,6 +432,7 @@ define Device/Init
   DEVICE_DTS :=
   DEVICE_DTS_CONFIG :=
   DEVICE_DTS_DIR :=
+  DEVICE_FDT_NUM :=
   SOC :=
 
   BOARD_NAME :=
@@ -453,8 +454,9 @@ DEFAULT_DEVICE_VARS := \
   DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
-  DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \
-  IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \
+  DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \
+  UIMAGE_NAME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
+  UBOOT_PATH IMAGE_SIZE \
   DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
   DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
   DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 468ef670e6..bb629d6fca 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -16,7 +16,7 @@
 
 usage() {
 	printf "Usage: %s -A arch -C comp -a addr -e entry" "$(basename "$0")"
-	printf " -v version -k kernel [-D name -d dtb] -o its_file"
+	printf " -v version -k kernel [-D name -n address -d dtb] -o its_file"
 
 	printf "\n\t-A ==> set architecture to 'arch'"
 	printf "\n\t-C ==> set compression type 'comp'"
@@ -26,12 +26,15 @@ usage() {
 	printf "\n\t-v ==> set kernel version to 'version'"
 	printf "\n\t-k ==> include kernel image 'kernel'"
 	printf "\n\t-D ==> human friendly Device Tree Blob 'name'"
+	printf "\n\t-n ==> fdt unit-address 'address'"
 	printf "\n\t-d ==> include Device Tree Blob 'dtb'"
 	printf "\n\t-o ==> create output file 'its_file'\n"
 	exit 1
 }
 
-while getopts ":A:a:c:C:D:d:e:k:o:v:" OPTION
+FDTNUM=1
+
+while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION
 do
 	case $OPTION in
 		A ) ARCH=$OPTARG;;
@@ -42,6 +45,7 @@ do
 		d ) DTB=$OPTARG;;
 		e ) ENTRY_ADDR=$OPTARG;;
 		k ) KERNEL=$OPTARG;;
+		n ) FDTNUM=$OPTARG;;
 		o ) OUTPUT=$OPTARG;;
 		v ) VERSION=$OPTARG;;
 		* ) echo "Invalid option passed to '$0' (options:$*)"
@@ -61,7 +65,7 @@ ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]')
 # Conditionally create fdt information
 if [ -n "${DTB}" ]; then
 	FDT_NODE="
-		fdt at 1 {
+		fdt@$FDTNUM {
 			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
 			data = /incbin/(\"${DTB}\");
 			type = \"flat_dt\";
@@ -75,7 +79,7 @@ if [ -n "${DTB}" ]; then
 			};
 		};
 "
-	FDT_PROP="fdt = \"fdt at 1\";"
+	FDT_PROP="fdt = \"fdt@$FDTNUM\";"
 fi
 
 # Create a default, fully populated DTS file
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:29 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:29 +0200
Subject: [PATCH v3 3/8] bcm53xx: enable PWM for bcm53xx
In-Reply-To: <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
Message-ID: <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>

The Meraki MR32 (BCM53016A1) uses the pwm to drive the
tricolor LED. The driver has been available in upstream
for a long time. Only the Device-Tree definition was
missing, but it has been queued recently.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
v2 -> v3
	- backport patches from devicetree/next
---
 target/linux/bcm53xx/Makefile                 |  2 +-
 target/linux/bcm53xx/config-5.4               |  3 ++
 ...M-dts-BCM5301X-Specify-PWM-in-the-DT.patch | 48 +++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch

diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
index 35f8513801..f980f8a8fb 100644
--- a/target/linux/bcm53xx/Makefile
+++ b/target/linux/bcm53xx/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=bcm53xx
 BOARDNAME:=Broadcom BCM47xx/53xx (ARM)
-FEATURES:=squashfs nand usb pci pcie gpio
+FEATURES:=squashfs nand usb pci pcie gpio pwm
 CPU_TYPE:=cortex-a9
 SUBTARGETS:=generic
 
diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4
index eacfcb620e..8c7cdf45d5 100644
--- a/target/linux/bcm53xx/config-5.4
+++ b/target/linux/bcm53xx/config-5.4
@@ -308,6 +308,9 @@ CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_IPROC_GPIO is not set
 CONFIG_PINCTRL_NS=y
 # CONFIG_PINCTRL_NS2_MUX is not set
+CONFIG_PWM=y
+CONFIG_PWM_BCM_IPROC=y
+CONFIG_PWM_SYSFS=y
 CONFIG_RATIONAL=y
 CONFIG_RCU_NEED_SEGCBLIST=y
 CONFIG_RCU_STALL_COMMON=y
diff --git a/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
new file mode 100644
index 0000000000..335378656c
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
@@ -0,0 +1,48 @@
+From 0ea4b29d149586667d96767f1fc8e57ee942c1b0 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:19 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify PWM in the DT
+
+The BCM53016 in the Meraki MR32 uses the on-chip PWM
+controller to drive a tri-color RGB LED. Since I plan
+to use the PWM, I made a label for the pwm's pinmux
+node. This way, it can be easily referenced.... And
+Also included a label for the i2c since I'm going to
+need it in the future too.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Acked-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -350,6 +350,14 @@
+ 		};
+ 	};
+ 
++	pwm: pwm at 18002000 {
++		compatible = "brcm,iproc-pwm";
++		reg = <0x18002000 0x28>;
++		clocks = <&osc>;
++		#pwm-cells = <3>;
++		status = "disabled";
++	};
++
+ 	mdio: mdio at 18003000 {
+ 		compatible = "brcm,iproc-mdio";
+ 		reg = <0x18003000 0x8>;
+@@ -417,12 +425,12 @@
+ 					function = "spi";
+ 				};
+ 
+-				i2c {
++				pinmux_i2c: i2c {
+ 					groups = "i2c_grp";
+ 					function = "i2c";
+ 				};
+ 
+-				pwm {
++				pinmux_pwm: pwm {
+ 					groups = "pwm0_grp", "pwm1_grp",
+ 						 "pwm2_grp", "pwm3_grp";
+ 					function = "pwm";
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:30 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:30 +0200
Subject: [PATCH v3 4/8] bcm53xx: backport uart2 and pcie2 device-nodes
In-Reply-To: <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
Message-ID: <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>

These have made their way into -next. This patch
also includes the portion of the bcm53xx kernel
patch refreshes as the hunks in
302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
moved slightly due to the added nodes.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
v2 -> v3
        - backport patches from devicetree/next
	- make target/linux/refresh
---
 ...dts-BCM5301X-Specify-uart2-in-the-DT.patch | 30 +++++++++++++++++++
 ...dts-BCM5301X-Specify-pcie2-in-the-DT.patch | 26 ++++++++++++++++
 ...01X-Update-Northstar-pinctrl-binding.patch |  2 +-
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch

diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
new file mode 100644
index 0000000000..8cee6745ee
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
@@ -0,0 +1,30 @@
+From 5e396bb05b89e23e98e6d75749b77502e68210a4 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:20 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify uart2 in the DT
+
+The BCM53016 in the Meraki MR32 utilizes the third "uart2"
+to connect to a on-board Bluetooth-LE 4.0 BCM20732 chip.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -392,6 +392,15 @@
+ 		reg = <0x18105000 0x1000>;
+ 	};
+ 
++	uart2: serial at 18008000 {
++		compatible = "ns16550a";
++		reg = <0x18008000 0x20>;
++		clocks = <&iprocslow>;
++		interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
++		reg-shift = <2>;
++		status = "disabled";
++	};
++
+ 	i2c0: i2c at 18009000 {
+ 		compatible = "brcm,iproc-i2c";
+ 		reg = <0x18009000 0x50>;
diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
new file mode 100644
index 0000000000..d3e2fbcc9e
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
@@ -0,0 +1,26 @@
+From c4cd6fcae46fd14aed8665b7cf66d0954765a873 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:21 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify pcie2 in the DT
+
+The SoC supports three pcie ports. Currently, only
+pcie0 and pcie1 are enabled. This patch adds the
+pcie2 port as well.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -252,6 +252,10 @@
+ 			reg = <0x00013000 0x1000>;
+ 		};
+ 
++		pcie2: pcie at 14000 {
++			reg = <0x00014000 0x1000>;
++		};
++
+ 		usb2: usb2 at 21000 {
+ 			reg = <0x00021000 0x1000>;
+ 
diff --git a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
index 77bc68c8ce..1d71647d60 100644
--- a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
+++ b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
@@ -9,7 +9,7 @@ Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
 
 --- a/arch/arm/boot/dts/bcm5301x.dtsi
 +++ b/arch/arm/boot/dts/bcm5301x.dtsi
-@@ -401,16 +401,12 @@
+@@ -422,16 +422,12 @@
  		#size-cells = <1>;
  
  		cru at 100 {
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:31 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:31 +0200
Subject: [PATCH v3 5/8] kernel: add default for new config symbols
In-Reply-To: <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
Message-ID: <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>

Provide disabled defaults for I2C_SLAVE_EEPROM and IPMB_DEVICE_INTERFACE.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/generic/config-5.4 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index 6f63b8c5dd..1c28addff4 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -2134,6 +2134,7 @@ CONFIG_HW_RANDOM_TPM=y
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
 # CONFIG_I2C_SLAVE is not set
+# CONFIG_I2C_SLAVE_EEPROM is not set
 # CONFIG_I2C_SMBUS is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TAOS_EVM is not set
@@ -2394,6 +2395,7 @@ CONFIG_IO_STRICT_DEVMEM=y
 # CONFIG_IP6_NF_TARGET_SYNPROXY is not set
 # CONFIG_IPACK_BUS is not set
 # CONFIG_IPC_NS is not set
+# CONFIG_IPMB_DEVICE_INTERFACE is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_IPV6 is not set
 # CONFIG_IPV6_FOU is not set
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:32 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:32 +0200
Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
In-Reply-To: <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
Message-ID: <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>

The BCM5301x SoCs do have i2c. Since this is only
being used by the Meraki MR32, this will be packaged
as a module.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/kernel/linux/modules/i2c.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk
index ca6463c81b..1c8b1b844e 100644
--- a/package/kernel/linux/modules/i2c.mk
+++ b/package/kernel/linux/modules/i2c.mk
@@ -259,3 +259,17 @@ endef
 $(eval $(call KernelPackage,i2c-tiny-usb))
 
 
+I2C_BCM_IPROC_MODULES:= \
+  CONFIG_I2C_BCM_IPROC:drivers/i2c/busses/i2c-bcm-iproc
+
+define KernelPackage/i2c-bcm-iproc
+  $(call i2c_defaults,$(I2C_BCM_IPROC_MODULES),59)
+  TITLE:=Broadcom iProc I2C controller
+  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core
+endef
+
+define KernelPackage/i2c-bcm-iproc/description
+ Kernel module for the Broadcom iProc I2C controller.
+endef
+
+$(eval $(call KernelPackage,i2c-bcm-iproc))
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:34 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:34 +0200
Subject: [PATCH v3 8/8] -NOT YET- bcm53xx: MR32: replace i2c-gpio with SoC's
 i2c
In-Reply-To: <2ac30e3b4c6a3d5b1688263953d965912cb003c4.1599943537.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599943537.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599943537.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599943537.git.chunkeey@gmail.com>
 <7667f06331e9a6a0d80f4f7418265b0b5e15f7f0.1599943537.git.chunkeey@gmail.com>
 <328a57945d66faa5ab569ba5d3fa86466c205b92.1599943537.git.chunkeey@gmail.com>
 <6b5147940224e3508b4fd3c5f8e1d818cd552c99.1599943537.git.chunkeey@gmail.com>
 <2ac30e3b4c6a3d5b1688263953d965912cb003c4.1599943537.git.chunkeey@gmail.com>
Message-ID: <a65605749b6186875aead624bdb693daedda03ff.1599943537.git.chunkeey@gmail.com>

During review of the MR32, Florian Fainelli pointed out that the
SoC has a real I2C-controller. Furthermore, the connected pins
(SDA and SCL) would line up perfectly for use. This patch swaps
out the the bitbanged i2c-gpio with the real deal.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/bcm53xx/image/Makefile           |  2 +-
 .../332-Meraki-MR32-use-hw-i2c.patch          | 73 +++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 613f2d533d..74d92a0579 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -323,7 +323,7 @@ TARGET_DEVICES += luxul_xwr-3150
 define Device/meraki_mr32
   DEVICE_VENODR := Meraki
   DEVICE_MODEL := MR32
-  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
 	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-bluetooth
   DEVICE_DTS := bcm53016-meraki-mr32
 # Meraki FW r23 tries to resize the part.safe partition before it will
diff --git a/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
new file mode 100644
index 0000000000..5ddfd67994
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
@@ -0,0 +1,73 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 12 Sep 2020 22:11:12 +0200
+Subject: bcm53xx: Meraki MR32 use hw i2c
+
+replace the i2c-gpio provided i2c functionality with the
+hardware in the SoC. This can be activated once the
+internal i2c works as well as the bit-banged i2c-gpio.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -85,34 +85,6 @@
+ 			max-brightness = <255>;
+ 		};
+ 	};
+-
+-	i2c {
+-		/*
+-		 * The platform provided I2C does not budge.
+-		 * This is a replacement until I can figure
+-		 * out what are the missing bits...
+-		 */
+-
+-		compatible = "i2c-gpio";
+-		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-
+-		current_sense: ina219 at 45 {
+-			compatible = "ti,ina219";
+-			reg = <0x45>;
+-			shunt-resistor = <60000>; /* = 60 mOhms */
+-		};
+-
+-		eeprom: eeprom at 50 {
+-			compatible = "atmel,24c64";
+-			reg = <0x50>;
+-			pagesize = <32>;
+-			read-only;
+-		};
+-	};
+ };
+ 
+ &uart0 {
+@@ -195,3 +168,25 @@
+ 		};
+ 	};
+ };
++
++&i2c0 {
++	status = "okay";
++
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_i2c>;
++
++	clock-frequency = <100000>;
++
++	current_sense: ina219 at 45 {
++		compatible = "ti,ina219";
++		reg = <0x45>;
++		shunt-resistor = <60000>; /* = 60 mOhms */
++	};
++
++	eeprom: eeprom at 50 {
++		compatible = "atmel,24c64";
++		reg = <0x50>;
++		pagesize = <32>;
++		read-only;
++	};
++};
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:35 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:35 +0200
Subject: [PATCH v3 8/8] [RFT][WIP] bcm53xx: MR32: replace i2c-gpio with SoC's
 i2c
In-Reply-To: <64ed9aa6d1d8db2567778f8f8eabea454455c593.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
 <64ed9aa6d1d8db2567778f8f8eabea454455c593.1599945264.git.chunkeey@gmail.com>
Message-ID: <f6ff0158ce8305f4b6bfcbb004ff05f67588f14e.1599945264.git.chunkeey@gmail.com>

During review of the MR32, Florian Fainelli pointed out that the
SoC has a real I2C-controller. Furthermore, the connected pins
(SDA and SCL) would line up perfectly for use. This patch swaps
out the the bitbanged i2c-gpio with the real deal. It can be
applied once it works.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/bcm53xx/image/Makefile           |  2 +-
 .../332-Meraki-MR32-use-hw-i2c.patch          | 73 +++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 613f2d533d..74d92a0579 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -323,7 +323,7 @@ TARGET_DEVICES += luxul_xwr-3150
 define Device/meraki_mr32
   DEVICE_VENODR := Meraki
   DEVICE_MODEL := MR32
-  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
 	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-bluetooth
   DEVICE_DTS := bcm53016-meraki-mr32
 # Meraki FW r23 tries to resize the part.safe partition before it will
diff --git a/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
new file mode 100644
index 0000000000..f61b9fdcdc
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
@@ -0,0 +1,73 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 12 Sep 2020 22:11:12 +0200
+Subject: bcm53xx: Meraki MR32 use hw i2c
+
+replace the i2c-gpio provided i2c functionality with the
+hardware in the SoC. This can be activated once the
+internal i2c works as well as the bit-banged i2c-gpio.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -85,34 +85,6 @@
+ 			max-brightness = <255>;
+ 		};
+ 	};
+-
+-	i2c {
+-		/*
+-		 * The platform provided I2C does not budge.
+-		 * This is a replacement until I can figure
+-		 * out what are the missing bits...
+-		 */
+-
+-		compatible = "i2c-gpio";
+-		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-
+-		current_sense: ina219 at 45 {
+-			compatible = "ti,ina219";
+-			reg = <0x45>;
+-			shunt-resistor = <60000>; /* = 60 mOhms */
+-		};
+-
+-		eeprom: eeprom at 50 {
+-			compatible = "atmel,24c64";
+-			reg = <0x50>;
+-			pagesize = <32>;
+-			read-only;
+-		};
+-	};
+ };
+ 
+ &uart0 {
+@@ -196,3 +168,25 @@
+ 		};
+ 	};
+ };
++
++&i2c0 {
++	status = "okay";
++
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_i2c>;
++
++	clock-frequency = <100000>;
++
++	current_sense: ina219 at 45 {
++		compatible = "ti,ina219";
++		reg = <0x45>;
++		shunt-resistor = <60000>; /* = 60 mOhms */
++	};
++
++	eeprom: eeprom at 50 {
++		compatible = "atmel,24c64";
++		reg = <0x50>;
++		pagesize = <32>;
++		read-only;
++	};
++};
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 17:15:33 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 12 Sep 2020 23:15:33 +0200
Subject: [PATCH v3 7/8] bcm53xx: add Cisco Meraki MR32
In-Reply-To: <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
Message-ID: <64ed9aa6d1d8db2567778f8f8eabea454455c593.1599945264.git.chunkeey@gmail.com>

This patch adds support for Cisco Meraki MR32.
The unit was donated by Chris Blake. Thank you!

WARNING:
Only the 1x1:1 abgn Air Marshal WIPS wifi is currently supported by b43:
 b43-phy2: Found PHY: Analog 9, Type 4 (N), Revision 16
 b43-phy2: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1
 b43-phy2: Loading firmware version 784.2 (2012-08-15 21:35:19)
 and only as 802.11ABG!

while WIFI1 and WIFI2 (both BCM4352) are not:
 b43-phy0: Broadcom 4352 WLAN found (core revision 42)
 b43-phy0 ERROR: FOUND UNSUPPORTED PHY (Analog 12, Type 11 (AC), Revision 1)

Hardware Highlights:

SoC:	Broadcom BCM53016A1 (1 GHz, 2 cores)
RAM:	128 MiB
NAND:	128 MiB Spansion S34ML01G2 (~114 MiB useable)
ETH:	1GBit Ethernet Port - PoE
WIFI1:	Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
WIFI2:	Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
WIFI3:	Broadcom BCM43428 abgn (1x1:1 - id: 43428)

BLE:	Broadcom BCM20732 (ttyS1)
LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
	1 x White LED (GPIO)
	1 x Orange LED Fault Indicator (GPIO)
	2 x LAN Activity / Speed LEDs (On the RJ45 Port)
BUTTON: one Reset button
MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC + Serial#!)
	ina219 hardware monitor (i2c)
	Kensington Lock

SERIAL:
	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
	The Serial setting is 115200-8-N-1. The board has a populated
	right angle 1x4 0.1" pinheader.
	The pinout is: VCC, RX, TX, GND. (Use a multimeter)

Flashing needs a serial adaptor (due to the lack of a working dropbear on
the original firmware).

This flashing procedure for the MR32 was tested with firmware:
"r23-149867:150252-aacharya".

0. Create a seperate Ethernet LAN which does not have access to the internet.
   Ideally use 192.168.1.2 for your PC. Make sure to reserve 192.168.1.1 it
   will be used later on by the OpenWrt firmware. The original Meraki firmware
   will likely try to setup the network via DHCP Discovery, so make sure your
   PC is running a DHCP-Server (i.e.: dnsmasq)
   '# dnsmasq -i eth# -F 192.168.1.5,192.168.1.50
   Furthermore, the PC needs a supported ssh/http/ftp server in order to
   retrieve the initramfs + dtb file

1. Disassemble the MR32 device by removing all screws (4 screws are located
   under the 4 rubber feets!) and prying open the plastic covers without
   breaking the plastic retention clips. Once inside, remove all the screws
   on the outer metal shielding to get to the PCB. It's not necessary to
   remove the antennas!

2. Connect the serial cable to the serial header.

3. Partially reassemble the outer metal shielding to ensure that the SoC
   has a proper heat sink.

4. Connect the Ethernet patch cable to the device and the power cable.

5. Wait for the device to boot and enter the root shell.
   (rooting is not discussed in detail here please refer to
   Chris Blake - "pwning the meraki mr18" blog post:
   <https://servernetworktech.com/2016/02/pwning-the-meraki-mr18/>
   (The same method works with the MR32's r23-149867:150252-aacharya)

   Wait for the MR32 to enter the "<Meraki>" prompt and enter:
   <Meraki> odm serial_num read
   (Verify that it matches what's on the S/N Sticker on the back!)
   <Meraki> odm serial_num write Q2XX-XXXX-XXXV
   <Meraki> odm serial_num read
   (Verify that the S/N has changed - and the LED start to flash)

   now to flash the firmware:
   <Meraki> odm firmware part.safe "http://192.168.1.2/mr32-initramfs.bin"

Once OpenWrt booted use sysupgrade to permanently install
OpenWrt. To do this: Download the latest sysupgrade.bin file
for the MR32 to the device and use sysupgrade *sysupgrade.bin
to install it.

WARNING: DO NOT DELETE the "storage" ubi volume!

To flash later MR32 Firmwares like r25-201804051805-G885d6d78-dhow-rel
requires in-circut-i2c tools to access the I2C EEPROM AT24C64 next to
the SoC. The idea is pretty much the same as from Step 5 from above:
Change the serial number to Q2XXXXXXXXXV (should be around 0x7c), then
attach a serial cable, ethernet (but make sure the device can't reach
the internet!) hit "s" (the small s!) during boot to enter the root-shell
and add the following commands to the /storage/config there:

serial_allow_odm true
serial_access_enabled true
serial_access_check false
valid_config true

and then hit exit to let it finish booting.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>

---

rfc -> v2
	- fixed Adrian's comments
	- unbroke sysupgrade on other bcm53xx

v2 -> v3
	- use florians patch
	- make a separate patch for the i2c-gpio -> i2c-hw
---
 .../bcm53xx/base-files/etc/board.d/02_network |   7 +-
 target/linux/bcm53xx/base-files/etc/diag.sh   |   3 +
 .../lib/preinit/07_set_preinit_iface_bcm53xx  |  14 +
 .../base-files/lib/upgrade/platform.sh        |  43 ++-
 target/linux/bcm53xx/image/Makefile           |  27 ++
 ...-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch | 261 ++++++++++++++++++
 .../331-Meraki-MR32-Status-LEDs.patch         |  28 ++
 7 files changed, 380 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
 create mode 100644 target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch

diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network
index 5752b7760d..231566cfa0 100755
--- a/target/linux/bcm53xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network
@@ -89,10 +89,15 @@ bcm53xx_setup_macs()
 	netgear,r8500)
 		# As vendor doesn't use eth0 its MAC may be missing. Use one from eth2.
 		et2macaddr="$(nvram get et2macaddr)"
-		[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+		;;
+	meraki,mr32)
+		# The MAC is stored on an AT24C64 eeprom and not on the nvram
+		et2macaddr=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
 		;;
 	esac
 
+	[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+
 	wan_macaddr="$(nvram get wan_hwaddr)"
 	case "$board" in
 	asus,rt-ac87u)
diff --git a/target/linux/bcm53xx/base-files/etc/diag.sh b/target/linux/bcm53xx/base-files/etc/diag.sh
index 1a9332327a..bf5b779aa8 100644
--- a/target/linux/bcm53xx/base-files/etc/diag.sh
+++ b/target/linux/bcm53xx/base-files/etc/diag.sh
@@ -18,6 +18,9 @@ get_status_led() {
 		status_led=$(basename $status_led_file)
 		return
 	fi;
+
+	# And finally, let's also try the device-Tree aliases node
+	status_led="$(get_dt_led status)"
 }
 
 set_state() {
diff --git a/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
new file mode 100644
index 0000000000..9e7c4b821e
--- /dev/null
+++ b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
@@ -0,0 +1,14 @@
+set_preinit_iface() {
+	. /lib/functions.sh
+
+	case $(board_name) in
+	meraki,mr32)
+		# switch needs to be out of the vlan mode.
+		swconfig dev switch0 set reset 1
+		swconfig dev switch0 set enable_vlan 0
+		swconfig dev switch0 set apply 1
+		;;
+	esac
+}
+
+boot_hook_add preinit_main set_preinit_iface
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 40b2ef67be..cbb8290275 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -96,7 +96,7 @@ platform_identify() {
 	echo "unknown"
 }
 
-platform_check_image() {
+platform_other_check_image() {
 	[ "$#" -gt 1 ] && return 1
 
 	local file_type=$(platform_identify "$1")
@@ -227,6 +227,25 @@ platform_check_image() {
 	return $error
 }
 
+platform_check_image() {
+	case "$(board_name)" in
+	meraki,mr32)
+		# Ideally, REQUIRE_IMAGE_METADATA=1 would suffice
+		# but this would require converting all other
+		# devices too.
+		nand_do_platform_check meraki-mr32 "$1"
+		return $?
+		;;
+	*)
+		platform_other_check_image "$1"
+		return $?
+		;;
+	esac
+
+	return 1
+}
+
+
 # $(1): image for upgrade (with possible extra header)
 # $(2): offset of trx in image
 platform_do_upgrade_nand_trx() {
@@ -393,7 +412,7 @@ platform_img_from_seama() {
 	echo -n $dir/image-entity.bin
 }
 
-platform_do_upgrade() {
+platform_other_do_upgrade() {
 	local file_type=$(platform_identify "$1")
 	local trx="$1"
 	local cmd=
@@ -424,3 +443,23 @@ platform_do_upgrade() {
 
 	default_do_upgrade "$trx" "$cmd"
 }
+
+platform_do_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		nand_do_upgrade "$1"
+		;;
+	*)
+		platform_other_do_upgrade "$1"
+		;;
+	esac
+}
+
+platform_nand_pre_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		;;
+	esac
+}
diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 768477160a..613f2d533d 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -320,6 +320,33 @@ define Device/luxul_xwr-3150
 endef
 TARGET_DEVICES += luxul_xwr-3150
 
+define Device/meraki_mr32
+  DEVICE_VENODR := Meraki
+  DEVICE_MODEL := MR32
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-bluetooth
+  DEVICE_DTS := bcm53016-meraki-mr32
+# Meraki FW r23 tries to resize the part.safe partition before it will
+# flash the image. This is a bit of a problem, since resizing will fail
+# if the partition is smaller than the old one.
+  KERNEL_LOADADDR := 0x00008000
+  KERNEL_INITRAMFS_SUFFIX := .bin
+  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb | \
+	pad-to 10362880
+  KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+
+# Currently the only device that uses the new image check
+  SUPPORTED_DEVICES := meraki,mr32
+
+# The loader is specifically looking for fdt at 2:
+# [    3.190000] find_itb_subimage: error finding fdt at 2: FDT_ERR_NOTFOUND
+# The image won't boot, if it isn't found. :(
+  DEVICE_FDT_NUM := 2
+endef
+TARGET_DEVICES += meraki_mr32
+
 define Device/netgear
   DEVICE_VENDOR := NETGEAR
   IMAGES := chk
diff --git a/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
new file mode 100644
index 0000000000..29329eb3f0
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
@@ -0,0 +1,261 @@
+From ec88a9c344d9fd8c3b11bff1f99a0b6248ae256d Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:23 +0200
+Subject: [PATCH] ARM: BCM5301X: Add DT for Meraki MR32
+
+add support for the Cisco Meraki MR32.
+This is a dual-band enterprise class 802.11ac access point.
+The unit was donated by Chris Blake. Thank you!
+
+SoC:    Broadcom BCM53016A1 (1 GHz, 2 cores)
+RAM:    128 MiB
+NAND:   128 MiB Spansion S34ML01G2 (~114 MiB useable)
+ETH:    1GBit Ethernet Port - PoE
+WIFI1:  Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
+WIFI2:  Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
+WIFI3:  Broadcom BCM43428 abgn (1x1:1 - id: 43428)
+
+BLE:    Broadcom BCM20732 (ttyS1)
+LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
+        1 x White LED (GPIO)
+        1 x Orange LED Fault Indicator (GPIO)
+        2 x LAN Activity / Speed LEDs (On the RJ45 Port)
+BUTTON: one Reset button
+MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC)
+        ina219 hardware monitor (i2c)
+        Kensington Lock
+
+SERIAL:
+	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
+        The Serial setting is 115200-8-N-1. The board has a populated
+        right angle 1x4 0.1" pinheader.
+        The pinout is: VCC, RX, TX, GND.
+
+Odd stuff:
+	- uart0 clock frequency is 62.5 MHz.
+	- The LEDs are labeled as SYS-LED1 through SYS-LED3
+	  because of the silkscreen on the PCB.
+	- the original u-boot has been compiled with most functions
+	  and commands disabled. The u-boot env isn't setup properly
+	  either and as a result, the bcm47xxpart probing is not
+	  working. Hence, the nand partitions are specified through a
+	  "fixed-partition" binding.
+	- The "WICED SMART(TM)" Bluetooth LE 4.0 BCM20732 chip is
+	  connected to uart2 of the SoC. The BCM20732 does not
+	  provide a HCI. So the linux' bluetooth stack is useless.
+	  The mock-up node with the compatible binding and
+	  enable-gpios property is provided solely as documentation.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -119,6 +119,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
+ 	bcm47094-luxul-xwr-3150-v1.dtb \
+ 	bcm47094-netgear-r8500.dtb \
+ 	bcm47094-phicomm-k3.dtb \
++	bcm53016-meraki-mr32.dtb \
+ 	bcm94708.dtb \
+ 	bcm94709.dtb \
+ 	bcm953012er.dtb \
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -0,0 +1,197 @@
++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
++/*
++ * Broadcom BCM470X / BCM5301X ARM platform code.
++ * DTS for Meraki MR32 / Codename: Espresso
++ *
++ * Copyright (C) 2018-2020 Christian Lamparter <chunkeey at gmail.com>
++ */
++
++/dts-v1/;
++
++#include "bcm4708.dtsi"
++#include "bcm5301x-nand-cs0-bch8.dtsi"
++#include <dt-bindings/leds/common.h>
++
++/ {
++	compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708";
++	model = "Meraki MR32";
++
++	chosen {
++		bootargs = " console=ttyS0,115200n8 earlycon";
++	};
++
++	memory {
++		reg = <0x00000000 0x08000000>;
++		device_type = "memory";
++	};
++
++	aliases {
++		serial1 = &uart2;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		sysled3 {
++			function = LED_FUNCTION_FAULT;
++			color = <LED_COLOR_ID_AMBER>;
++			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
++			panic-indicator;
++		};
++		sysled2 {
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_WHITE>;
++			gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>;
++		};
++	};
++
++	keys {
++		compatible = "gpio-keys";
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		restart {
++			label = "Reset";
++			linux,code = <KEY_RESTART>;
++			gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	pwm-leds {
++		compatible = "pwm-leds";
++
++		red {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_RED>;
++			pwms = <&pwm 0 50000 0>;
++			max-brightness = <255>;
++		};
++
++		green {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_POWER;
++			color = <LED_COLOR_ID_GREEN>;
++			pwms = <&pwm 1 50000 0>;
++			max-brightness = <255>;
++		};
++
++		blue {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_BLUE>;
++			pwms = <&pwm 2 50000 0>;
++			max-brightness = <255>;
++		};
++	};
++
++	i2c {
++		/*
++		 * The platform provided I2C does not budge.
++		 * This is a replacement until I can figure
++		 * out what are the missing bits...
++		 */
++
++		compatible = "i2c-gpio";
++		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
++		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
++		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		current_sense: ina219 at 45 {
++			compatible = "ti,ina219";
++			reg = <0x45>;
++			shunt-resistor = <60000>; /* = 60 mOhms */
++		};
++
++		eeprom: eeprom at 50 {
++			compatible = "atmel,24c64";
++			reg = <0x50>;
++			pagesize = <32>;
++			read-only;
++		};
++	};
++};
++
++&uart0 {
++	clock-frequency = <62500000>;
++	/delete-property/ clocks;
++};
++
++&uart1 {
++	status = "disabled";
++};
++
++&uart2 {
++	status = "okay";
++	/*
++	 * bluetooth-le {
++	 *	compatible = "brcm,bcm20732";
++	 *	enable-gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>;
++	 *};
++	 */
++};
++
++&gmac1 {
++	status = "disabled";
++};
++&gmac2 {
++	status = "disabled";
++};
++&gmac3 {
++	status = "disabled";
++};
++
++&pwm {
++	status = "okay";
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_pwm>;
++};
++
++&nandcs {
++	nand-ecc-algo = "hw";
++
++	partitions {
++		/*
++		 * The partition autodetection does not work for this device.
++		 * It will only detect the "nvram" partition with an incorrect size.
++		 *	[    1.721667] 1 bcm47xxpart partitions found on MTD device brcmnand.0
++		 *	[    1.727962] Creating 1 MTD partitions on "brcmnand.0":
++		 *	[    1.733117] 0x000000400000-0x000008000000 : "nvram"
++		 */
++
++		compatible = "fixed-partitions";
++		#address-cells = <0x1>;
++		#size-cells = <0x1>;
++
++		partition0 at 0 {
++			label = "u-boot";
++			reg = <0x0 0x100000>;
++			read-only;
++		};
++
++		partition1 at 100000 {
++			label = "bootkernel1";
++			reg = <0x100000 0x300000>;
++			read-only;
++		};
++
++		partition2 at 400000 {
++			label = "nvram";
++			reg = <0x400000 0x100000>;
++			read-only;
++		};
++
++		partition3 at 500000 {
++			label = "bootkernel2";
++			reg = <0x500000 0x300000>;
++			read-only;
++		};
++
++		partition4 at 800000 {
++			label = "ubi";
++			reg = <0x800000 0x7780000>;
++		};
++	};
++};
diff --git a/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
new file mode 100644
index 0000000000..fb78ee93c4
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
@@ -0,0 +1,28 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Thu, 7 Jun 2018 19:29:12 +0200
+Subject: bcm53xx: add LED status label alias for Meraki MR32
+
+add an led-status alias label. This is used by OpenWrt's LED
+DTS lookup function to identifiy the indicator LED
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -27,6 +27,7 @@
+ 
+ 	aliases {
+ 		serial1 = &uart2;
++		led-status = &led_status;
+ 	};
+ 
+ 	leds {
+@@ -68,7 +69,7 @@
+ 			max-brightness = <255>;
+ 		};
+ 
+-		green {
++		led_status: green {
+ 			/* SYS-LED 1 - Tricolor */
+ 			function = LED_FUNCTION_POWER;
+ 			color = <LED_COLOR_ID_GREEN>;
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 12 18:04:32 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sun, 13 Sep 2020 00:04:32 +0200
Subject: [PATCH v2 1/2] ipq40xx: add support for Luma Home WRTQ-329ACN
In-Reply-To: <20200830112811.6175-1-tomek_n@o2.pl>
References: <20200830112811.6175-1-tomek_n@o2.pl>
Message-ID: <4c344f4a-45e6-6042-fa90-40301a683683@gmail.com>

On 2020-08-30 13:28, Tomasz Maciej Nowak wrote:
> Luma Home WRTQ-329ACN, also known as Luma WiFi System, is a dual-band
> wireless access point.
> 
> Specification
> SoC: Qualcomm Atheros IPQ4018
> RAM: 256 MB DDR3
> Flash: 2 MB SPI NOR
>         128 MB SPI NAND
> WIFI: 2.4 GHz 2T2R integrated
>        5 GHz 2T2R integrated
> Ethernet: 2x 10/100/1000 Mbps QCA8075
> USB: 1x 2.0
> Bluetooth: 1x 4.0 CSR8510 A10, connected to USB bus
> LEDS: 16x multicolor LEDs ring, controlled by MSP430G2403 MCU
> Buttons: 1x GPIO controlled
> EEPROM: 16 Kbit, compatible with AT24C16
> UART: row of 4 holes marked on PCB as J19, starting count from the side
>        of J19 marking on PCB
>        1. GND, 2. RX, 3. TX, 4. 3.3V
>        baud: 115200, parity: none, flow control: none
> 
> The device supports OTA or USB flash drive updates, unfotunately they
> are signed. Until the signing key is known, the UART access is mandatory
> for installation. The difficult part is disassembling the casing, there
> are a lot of latches holding it together.
> 
> Teardown
> Prepare three thin, but sturdy, prying tools. Place the device with back
> of it facing upwards. Start with the wall having a small notch. Insert
> first tool, until You'll feel resistance and keep it there. Repeat the
> procedure for neighbouring walls. With applying a pressure, one edge of
> the back cover should pop up. Now carefully slide one of the tools to
> free the rest of the latches.
> There's no need to solder pins to the UART holes, You can use hook clips,
> but wiring them outside the casing, will ease debuging and recovery if
> problems occur.
> 
> Installation
> 1. Prepare TFTP server with OpenWrt initramfs image.
> 2. Connect to UART port (don't connect the voltage pin).
> 3. Connect to LAN port.
> 4. Power on the device, carefully observe the console output and when
>     asked quickly enter the failsafe mode.
> 5. Invoke 'mount_root'.
> 6. After the overlayfs is mounted run:
>       fw_setenv bootdelay 3
>     This will allow to access U-Boot shell.
> 7. Reboot the device and when prompted to stop autoboot, hit any key.
> 8. Adjust "ipaddr" and "serverip" addresses in U-Boot environment, use
>     'setenv' to do that, then run following commands:
>       tftpboot 0x84000000 <openwrt_initramfs_image_name>
>       bootm 0x84000000
>     and wait till OpenWrt boots.
> 9. In OpenWrt command line run following commands:
>       fw_setenv openwrt "setenv mtdids nand1=spi_nand; setenv mtdparts mtdparts=spi_nand:-(ubi); ubi part ubi; ubi read 0x84000000 kernel1; bootm 0x84000000"
>       fw_setenv bootcmd "run openwrt"
So, because you install from the initramfs and introduced a custom run
command with a custom "kernel1" ubi volume... It might be possible to
cut the extra parts in the sysupgrade and bootargs and unify it with
the generic nand_do_upgrade() crowed.

I've incorperated what maybe could be done in this patch on my
staging tree: [0]

(Note the changes in step 9 (kernel1->kernel), step 10 (ubirmvol ubi_rootfs1 & kernel1) and the "step 2 in
back to OEM".

The idea is that we use OpenWrt's existing automount for ubi
and "rootfs" volumes.

(In theory this could make the "back to OEM" even easier.
Because if it works the way I think it does, we could drop
the ubirmvol of ubi_rootfs1 and kernel1 in step 10 of my version.
Next, it should be possible to drop the ubimkvol of
kernel1 and ubi_rootfs1 step 2 in the "Reverting to OEM" section.
This is because the original rootfs1 and kernel1 still exist and
are left untouched - no idea if this works out or not.)

Note: I've squashed both of your patches into one.

Note2: You don't mention it in your commit. But I'm seeing that you are
using GPIO OPEN_DRAIN for the bitbanged i2c. So, don't you also need
Brain's pinctrl patch that wires up OPEN_DRAIN for this? [1]

Currently, I've added it to the staging tree too (see the parent patch [2]).
If you haven't heard of this patch before, please also give it a quick
spin and see if it changes anything or not. Thanks.

Cheers,
Christian

[0] <https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=f0aead0152574ed8ea24fec1ef6ee54ff3627c3e>
[1] <https://patchwork.ozlabs.org/project/openwrt/patch/20200718205148.1743807-5-computersforpeace at gmail.com/>
[2] <https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=68d0dc5802a8b670a06c02b9797ab7ca237da502>


From baptiste at bitsofnetworks.org  Sun Sep 13 08:42:56 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Sun, 13 Sep 2020 14:42:56 +0200
Subject: [PATCH opkg] libopkg: fix md5sum calculation
Message-ID: <20200913124256.893496-1-baptiste@bitsofnetworks.org>

From: Alexander Ryzhov <github at ryzhov-al.ru>

This regression prevents MD5 checksums from being checked. Packages are
still installed, but this raises several issues:

- if only MD5 checksums are provided in the package list, it is trivial
  for an attacker to modify the content of a package, since checksum
  verification is bypassed. If both MD5 and SHA256 checksums are
  provided, then SHA256 is correctly verified and the attack is not
  possible.

- future efforts to harden checksum verification would prevent package
  installation.

Note that OpenWrt has switched to SHA256 for all its packages several
years ago. As a result, this bug does not affect OpenWrt packages from the
official package feeds.

However, custom package repositories that only use MD5 are affected.

Initially submitted at https://github.com/openwrt/openwrt/pull/3087

Fixes: 33f7b80aa325 ("libopkg: drop custom md5 implementation,
unconditionally enable sha256 support")

Signed-off-by: Alexander Ryzhov <github at ryzhov-al.ru>
[Add commit description]
Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 libopkg/file_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libopkg/file_util.c b/libopkg/file_util.c
index 3a1761e..8e698cc 100644
--- a/libopkg/file_util.c
+++ b/libopkg/file_util.c
@@ -153,7 +153,7 @@ char *file_md5sum_alloc(const char *file_name)
 
 	len = md5sum(file_name, md5sum_bin);
 
-	if (len) {
+	if (len < 0) {
 		opkg_msg(ERROR, "Could't compute md5sum for %s.\n", file_name);
 		return NULL;
 	}
-- 
2.27.0



From baptiste at bitsofnetworks.org  Sun Sep 13 08:48:22 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Sun, 13 Sep 2020 14:48:22 +0200
Subject: [PATCH opkg 0/5] Purge packages from cache when they have
 incorrect checksum
In-Reply-To: <20200824230032.492951-1-baptiste@bitsofnetworks.org>
References: <20200824230032.492951-1-baptiste@bitsofnetworks.org>
Message-ID: <20200913124822.GA888704@tuxmachine.localdomain>

Hi,

Any feedback on this patch series?

It fixes this annoying bug in the imagebuilder: https://bugs.openwrt.org/index.php?do=details&task_id=2690

Since the changes are somewhat significant, I would like some exposure in
master for a few weeks/months before it can be backported to 18.06 and
19.07.

Thanks,
Baptiste

On 25-08-20, Baptiste Jonglez wrote:
> From: Baptiste Jonglez <git at bitsofnetworks.org>
> 
> The motivation of this patch series is to fix FS#2690.  Because packages
> are continuously rebuilt, the ImageBuilder ends up with old packages in
> its cache, and fails because checksums don't match with the new package
> index from the download server.
> 
> The approach to solve this problem is the following.  Before using a package
> from the cache, verify its size and checksum against the package index, and
> delete the package from the cache if they don't match.  The install process
> will then proceed to download the "fixed" package as usual.
> 
> The main patch is "download: purge cached packages that have incorrect
> checksum".  The other ones are either cleanup or refactoring to prepare
> for the main change.
> 
> Baptiste Jonglez (5):
>   download: remove compatibility with old cache naming scheme
>   libopkg: factor out checksum and size verification
>   download: factor out the logic for building cache filenames
>   download: purge cached packages that have incorrect checksum
>   opkg_verify_integrity: better logging and error conditions
> 
>  libopkg/opkg_download.c | 123 ++++++++++++++++++++++++++++++++--------
>  libopkg/opkg_download.h |   1 +
>  libopkg/opkg_install.c  |  76 +++----------------------
>  3 files changed, 108 insertions(+), 92 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200913/10a83b1c/attachment.sig>

From freifunk at adrianschmutzler.de  Sun Sep 13 09:32:16 2020
From: freifunk at adrianschmutzler.de (Adrian Schmutzler)
Date: Sun, 13 Sep 2020 15:32:16 +0200
Subject: [PATCH] ath79: use common device definition for Buffalo devices
Message-ID: <20200913133216.46088-1-freifunk@adrianschmutzler.de>

The Buffalo devices in ath79 share their image generation code,
so let's create a shared Device definition for them.

Since most of them use BUFFALO_HWVER := 3, this is moved as
default to the shared definition as well.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ath79/image/common-buffalo.mk | 15 +++++++++
 target/linux/ath79/image/generic.mk        | 39 ++++++----------------
 target/linux/ath79/image/tiny.mk           |  9 ++---
 3 files changed, 27 insertions(+), 36 deletions(-)

diff --git a/target/linux/ath79/image/common-buffalo.mk b/target/linux/ath79/image/common-buffalo.mk
index d62b7eea94..31936b8234 100644
--- a/target/linux/ath79/image/common-buffalo.mk
+++ b/target/linux/ath79/image/common-buffalo.mk
@@ -1,3 +1,5 @@
+DEVICE_VARS += BUFFALO_PRODUCT BUFFALO_HWVER
+
 define Build/buffalo-tag
 	$(eval product=$(word 1,$(1)))
 	$(eval hwver=$(word 2,$(1)))
@@ -17,3 +19,16 @@ define Build/buffalo-tftp-header
 	) > $@.new
 	mv $@.new $@
 endef
+
+
+define Device/buffalo_common
+  DEVICE_VENDOR := Buffalo
+  BUFFALO_PRODUCT :=
+  BUFFALO_HWVER := 3
+  IMAGES += factory.bin tftp.bin
+  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
+	pad-rootfs | check-size
+  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc $$$$(BUFFALO_PRODUCT) 1.99 | \
+	buffalo-tag $$$$(BUFFALO_PRODUCT) $$$$(BUFFALO_HWVER)
+  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
+endef
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 7a00bae287..4b6cdaa826 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -315,17 +315,12 @@ endef
 TARGET_DEVICES += avm_fritzdvbc
 
 define Device/buffalo_bhr-4grv
+  $(Device/buffalo_common)
   SOC := ar7242
-  DEVICE_VENDOR := Buffalo
   DEVICE_MODEL := BHR-4GRV
+  BUFFALO_PRODUCT := BHR-4GRV
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   IMAGE_SIZE := 32256k
-  IMAGES += factory.bin tftp.bin
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs | check-size
-  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc BHR-4GRV 1.99 | \
-	buffalo-tag BHR-4GRV 3
-  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
   SUPPORTED_DEVICES += wzr-hp-g450h
 endef
 TARGET_DEVICES += buffalo_bhr-4grv
@@ -339,51 +334,37 @@ endef
 TARGET_DEVICES += buffalo_bhr-4grv2
 
 define Device/buffalo_wzr-hp-ag300h
+  $(Device/buffalo_common)
   SOC := ar7161
-  DEVICE_VENDOR := Buffalo
   DEVICE_MODEL := WZR-HP-AG300H
-  IMAGE_SIZE := 32320k
-  IMAGES += factory.bin tftp.bin
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs | check-size
-  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-AG300H 1.99 | \
-	buffalo-tag WZR-HP-AG300H 3
-  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
+  BUFFALO_PRODUCT := WZR-HP-AG300H
   DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
 	kmod-leds-reset kmod-owl-loader
+  IMAGE_SIZE := 32320k
   SUPPORTED_DEVICES += wzr-hp-ag300h
 endef
 TARGET_DEVICES += buffalo_wzr-hp-ag300h
 
 define Device/buffalo_wzr-hp-g302h-a1a0
+  $(Device/buffalo_common)
   SOC := ar7242
-  DEVICE_VENDOR := Buffalo
   DEVICE_MODEL := WZR-HP-G302H
   DEVICE_VARIANT := A1A0
+  BUFFALO_PRODUCT := WZR-HP-G302H
+  BUFFALO_HWVER := 4
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   IMAGE_SIZE := 32128k
-  IMAGES += factory.bin tftp.bin
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs | check-size
-  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G302H 1.99 | \
-	buffalo-tag WZR-HP-G302H 4
-  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
   SUPPORTED_DEVICES += wzr-hp-g300nh2
 endef
 TARGET_DEVICES += buffalo_wzr-hp-g302h-a1a0
 
 define Device/buffalo_wzr-hp-g450h
+  $(Device/buffalo_common)
   SOC := ar7242
-  DEVICE_VENDOR := Buffalo
   DEVICE_MODEL := WZR-HP-G450H/WZR-450HP
+  BUFFALO_PRODUCT := WZR-HP-G450H
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   IMAGE_SIZE := 32256k
-  IMAGES += factory.bin tftp.bin
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs | check-size
-  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G450H 1.99 | \
-	buffalo-tag WZR-HP-G450H 3
-  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
   SUPPORTED_DEVICES += wzr-hp-g450h
 endef
 TARGET_DEVICES += buffalo_wzr-hp-g450h
diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk
index 9f4f89bd9a..83c34d718b 100644
--- a/target/linux/ath79/image/tiny.mk
+++ b/target/linux/ath79/image/tiny.mk
@@ -1,16 +1,11 @@
 include ./common-buffalo.mk
 
 define Device/buffalo_whr-g301n
+  $(Device/buffalo_common)
   SOC := ar7240
-  DEVICE_VENDOR := Buffalo
   DEVICE_MODEL := WHR-G301N
+  BUFFALO_PRODUCT := WHR-G301N
   IMAGE_SIZE := 3712k
-  IMAGES += factory.bin tftp.bin
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs | check-size
-  IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WHR-G301N 1.99 | \
-	buffalo-tag WHR-G301N 3
-  IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
   SUPPORTED_DEVICES += whr-g301n
   DEFAULT := n
 endef
-- 
2.20.1



From noreply at github.com  Sun Sep 13 12:56:28 2020
From: noreply at github.com (Stephen Walker)
Date: Sun, 13 Sep 2020 09:56:28 -0700
Subject: [sdwalker/sdwalker.github.io] dbbb5a: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/135637-dbbb5a@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: dbbb5ad886a73db6b5a7d30c61d272eccc0e96c8
      https://github.com/sdwalker/sdwalker.github.io/commit/dbbb5ad886a73db6b5a7d30c61d272eccc0e96c8
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2020-09-13 (Sun, 13 Sep 2020)

  Changed paths:
    M uscan/index-18.06.html
    M uscan/index-19.07.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From rosenp at gmail.com  Sun Sep 13 16:56:40 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sun, 13 Sep 2020 13:56:40 -0700
Subject: [PATCH] bpftools: fix compilation under powerpc
Message-ID: <20200913205640.319275-1-rosenp@gmail.com>

asm/errno.h must be included before errno.h under powerpc.

Fixes:

In file included from tools/arch/powerpc/include/uapi/asm/errno.h:5,
                 from tools/include/linux/err.h:8,
                 from libbpf.c:29:
tools/include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined
 [-Werror]
 #define EDEADLOCK EDEADLK

In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
                 from libbpf.c:26:
toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this
is the location of the previous definition
 #define EDEADLOCK       58

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/network/utils/bpftools/Makefile       |  2 +-
 .../utils/bpftools/patches/010-powerpc.patch  | 50 +++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 package/network/utils/bpftools/patches/010-powerpc.patch

diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile
index 156dc8a4fa..8e40654ca6 100644
--- a/package/network/utils/bpftools/Makefile
+++ b/package/network/utils/bpftools/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bpftools
 PKG_VERSION:=5.8.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
diff --git a/package/network/utils/bpftools/patches/010-powerpc.patch b/package/network/utils/bpftools/patches/010-powerpc.patch
new file mode 100644
index 0000000000..c2a11f9a2e
--- /dev/null
+++ b/package/network/utils/bpftools/patches/010-powerpc.patch
@@ -0,0 +1,50 @@
+--- a/tools/lib/bpf/btf.c
++++ b/tools/lib/bpf/btf.c
+@@ -7,6 +7,7 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <asm/errno.h>
+ #include <errno.h>
+ #include <sys/utsname.h>
+ #include <sys/param.h>
+--- a/tools/lib/bpf/btf_dump.c
++++ b/tools/lib/bpf/btf_dump.c
+@@ -10,6 +10,7 @@
+ #include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <asm/errno.h>
+ #include <errno.h>
+ #include <linux/err.h>
+ #include <linux/btf.h>
+--- a/tools/lib/bpf/hashmap.c
++++ b/tools/lib/bpf/hashmap.c
+@@ -8,6 +8,7 @@
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <asm/errno.h>
+ #include <errno.h>
+ #include <linux/err.h>
+ #include "hashmap.h"
+--- a/tools/lib/bpf/libbpf.c
++++ b/tools/lib/bpf/libbpf.c
+@@ -23,6 +23,7 @@
+ #include <unistd.h>
+ #include <endian.h>
+ #include <fcntl.h>
++#include <asm/errno.h>
+ #include <errno.h>
+ #include <ctype.h>
+ #include <asm/unistd.h>
+--- a/tools/lib/bpf/ringbuf.c
++++ b/tools/lib/bpf/ringbuf.c
+@@ -9,6 +9,7 @@
+ #endif
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <asm/errno.h>
+ #include <errno.h>
+ #include <unistd.h>
+ #include <linux/err.h>
-- 
2.26.2



From rosenp at gmail.com  Sun Sep 13 23:30:20 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sun, 13 Sep 2020 20:30:20 -0700
Subject: [PATCH] bpftools: fix compilation under powerpc
In-Reply-To: <20200913205640.319275-1-rosenp@gmail.com>
References: <20200913205640.319275-1-rosenp@gmail.com>
Message-ID: <CAKxU2N_PD9vy-UKWkZ0js0HWT8n++uVbB_Q-2kV_xNhX6YLwRg@mail.gmail.com>

On Sun, Sep 13, 2020 at 1:56 PM Rosen Penev <rosenp at gmail.com> wrote:
>
> asm/errno.h must be included before errno.h under powerpc.
https://downloads.openwrt.org/snapshots/faillogs/powerpc_464fp/base/bpftools/full/compile.txt
>
> Fixes:
>
> In file included from tools/arch/powerpc/include/uapi/asm/errno.h:5,
>                  from tools/include/linux/err.h:8,
>                  from libbpf.c:29:
> tools/include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined
>  [-Werror]
>  #define EDEADLOCK EDEADLK
>
> In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
>                  from libbpf.c:26:
> toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this
> is the location of the previous definition
>  #define EDEADLOCK       58
>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  package/network/utils/bpftools/Makefile       |  2 +-
>  .../utils/bpftools/patches/010-powerpc.patch  | 50 +++++++++++++++++++
>  2 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 package/network/utils/bpftools/patches/010-powerpc.patch
>
> diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile
> index 156dc8a4fa..8e40654ca6 100644
> --- a/package/network/utils/bpftools/Makefile
> +++ b/package/network/utils/bpftools/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=bpftools
>  PKG_VERSION:=5.8.3
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
> diff --git a/package/network/utils/bpftools/patches/010-powerpc.patch b/package/network/utils/bpftools/patches/010-powerpc.patch
> new file mode 100644
> index 0000000000..c2a11f9a2e
> --- /dev/null
> +++ b/package/network/utils/bpftools/patches/010-powerpc.patch
> @@ -0,0 +1,50 @@
> +--- a/tools/lib/bpf/btf.c
> ++++ b/tools/lib/bpf/btf.c
> +@@ -7,6 +7,7 @@
> + #include <string.h>
> + #include <fcntl.h>
> + #include <unistd.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <sys/utsname.h>
> + #include <sys/param.h>
> +--- a/tools/lib/bpf/btf_dump.c
> ++++ b/tools/lib/bpf/btf_dump.c
> +@@ -10,6 +10,7 @@
> + #include <stddef.h>
> + #include <stdlib.h>
> + #include <string.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <linux/err.h>
> + #include <linux/btf.h>
> +--- a/tools/lib/bpf/hashmap.c
> ++++ b/tools/lib/bpf/hashmap.c
> +@@ -8,6 +8,7 @@
> + #include <stdint.h>
> + #include <stdlib.h>
> + #include <stdio.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <linux/err.h>
> + #include "hashmap.h"
> +--- a/tools/lib/bpf/libbpf.c
> ++++ b/tools/lib/bpf/libbpf.c
> +@@ -23,6 +23,7 @@
> + #include <unistd.h>
> + #include <endian.h>
> + #include <fcntl.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <ctype.h>
> + #include <asm/unistd.h>
> +--- a/tools/lib/bpf/ringbuf.c
> ++++ b/tools/lib/bpf/ringbuf.c
> +@@ -9,6 +9,7 @@
> + #endif
> + #include <stdlib.h>
> + #include <stdio.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <unistd.h>
> + #include <linux/err.h>
> --
> 2.26.2
>


From mail at aparcar.org  Mon Sep 14 01:36:12 2020
From: mail at aparcar.org (Paul Spooren)
Date: Sun, 13 Sep 2020 19:36:12 -1000
Subject: [PATCH] imagebuilder: add package signature verification
In-Reply-To: <20200826082455.82021-1-mail@aparcar.org>
Message-ID: <C5MUK6L85O18.3M6SXT3BHDMBN@dawn>

Hi,

On Tue Aug 25, 2020 at 10:24 PM HST, Paul Spooren wrote:
> The ImageBuilder downloads pre-built packages and adds them to images.
> This process uses `opkg` which has the capability to verify package list
> signatures, as enabled per default on running OpenWrt devices.
>
> Until now this was disabled for ImageBuilders because neither the OPKG
> keys nor the `opkg-add` script was present during first packagelist
> update.
>
> To harden the ImageBuilder against *drive-by-download-attacks* both keys
> and verification script are added to the ImageBuilder allowing OPKG to
> verify downloaded package indices.
>
> This commit adds `opkg-add` to the IB scripts folder, as it is just a
> shell script. The keys folder is added to IBs TOPDIR to have an obvious
> place for users to store their own keys. The `option check_signature` is
> appended to the repositories.conf file. All of the above only happens if
> the Buildbot runs with the SIGNED_PACKAGES option.
>
> Signed-off-by: Paul Spooren <mail at aparcar.org>
> ---
> This patch requires the following two patches:
>
> * opkg: allow to configure the path to the signature verification script
> https://patchwork.ozlabs.org/project/openwrt/patch/20200824150740.450363-1-baptiste at bitsofnetworks.org/

Merged

>
> * build: opkg-key variable key folder
> https://patchwork.ozlabs.org/project/openwrt/patch/20200826005527.2696524-1-mail at aparcar.org/

Merged

Please somebody review this, the dependencies are all merged. This is a
"blocker" for 20.x (based on the goals site and my opinion).

Best,
Paul

>
> In combination this should resolve the following 20.x goal:
> * Improve security of ImageBuilder - Check signatures
>
> I'm shaken by the fact that ImageBuilders downloaded packages via HTTP
> and without OPKG signature checks by default - fun
>
> target/imagebuilder/Makefile | 6 ++++++
> target/imagebuilder/files/Makefile | 2 ++
> 2 files changed, 8 insertions(+)
>
> diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
> index ad19ab2b53..2a4e9263db 100644
> --- a/target/imagebuilder/Makefile
> +++ b/target/imagebuilder/Makefile
> @@ -43,6 +43,12 @@ endif
> echo '' >> $(PKG_BUILD_DIR)/repositories.conf
> echo '## This is the local package repository, do not remove!' >>
> $(PKG_BUILD_DIR)/repositories.conf
> echo 'src imagebuilder file:packages' >>
> $(PKG_BUILD_DIR)/repositories.conf
> +ifneq ($(CONFIG_SIGNED_PACKAGES),)
> + echo 'option check_signature' >> $(PKG_BUILD_DIR)/repositories.conf
> + $(INSTALL_DIR) $(PKG_BUILD_DIR)/keys
> + $(CP) -L $(STAGING_DIR_ROOT)/etc/opkg/keys/ $(PKG_BUILD_DIR)/
> + $(CP) -L $(STAGING_DIR_ROOT)/usr/sbin/opkg-key
> $(PKG_BUILD_DIR)/scripts/
> +endif
>  
> $(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf
>  
> diff --git a/target/imagebuilder/files/Makefile
> b/target/imagebuilder/files/Makefile
> index 326dd2ba2f..98769d93de 100644
> --- a/target/imagebuilder/files/Makefile
> +++ b/target/imagebuilder/files/Makefile
> @@ -64,8 +64,10 @@ help: FORCE
> # override variables from rules.mk
> PACKAGE_DIR:=$(TOPDIR)/packages
> LISTS_DIR:=$(subst $(space),/,$(patsubst %,..,$(subst
> /,$(space),$(TARGET_DIR))))$(DL_DIR)
> +export OPKG_KEYS:=$(TOPDIR)/keys
> OPKG:=$(call opkg,$(TARGET_DIR)) \
> -f $(TOPDIR)/repositories.conf \
> + --verify-program $(SCRIPT_DIR)/opkg-key \
> --cache $(DL_DIR) \
> --lists-dir $(LISTS_DIR)
>  
> --
> 2.25.1



From a.heider at gmail.com  Mon Sep 14 04:45:15 2020
From: a.heider at gmail.com (Andre Heider)
Date: Mon, 14 Sep 2020 10:45:15 +0200
Subject: [PATCH v2 1/2] rules.mk: remove redundant -I/-L
In-Reply-To: <20200826061503.454068-1-a.heider@gmail.com>
References: <20200826061503.454068-1-a.heider@gmail.com>
Message-ID: <4eed6617-3bd7-3eb2-aac7-6cb48044af07@gmail.com>

On 26/08/2020 08:15, Andre Heider wrote:
> $STAGING_DIR/usr/{include,lib} are already added using the gcc specs file, see
> scripts/patch-specs.sh
> 
> $STAGING_DIR/lib is unused and seems to be a leftover from
> 1f0063b5 "rules.mk: remove "$(STAGING_DIR)/include""
> 
> Signed-off-by: Andre Heider <a.heider at gmail.com>

Anyone else? The tiny patches fix just a small annoyance, but an 
annoyance nevertheless ;)

Thanks,
Andre


From a.heider at gmail.com  Mon Sep 14 04:49:46 2020
From: a.heider at gmail.com (Andre Heider)
Date: Mon, 14 Sep 2020 10:49:46 +0200
Subject: [PATCH] omap: update uboot to v2020.04
In-Reply-To: <20200904073049.1255919-1-a.heider@gmail.com>
References: <20200904073049.1255919-1-a.heider@gmail.com>
Message-ID: <32ae6e20-a22d-1e78-1452-ee38dae59954@gmail.com>

Hi Adrian,

On 04/09/2020 09:30, Andre Heider wrote:
> Fixes the build error:
> /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
> collect2: error: ld returned 1 exit status
> 
> Successfully tested on boneblack.
> 
> Signed-off-by: Andre Heider <a.heider at gmail.com>

you took care of my last omap patches, would you take a look at this one 
too please?

See your comment here:
https://github.com/openwrt/openwrt/pull/2852#issuecomment-620281604

Thanks,
Andre

> ---
>   package/boot/uboot-omap/Makefile | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
> index 70c8af1dc4..f66b8d5331 100644
> --- a/package/boot/uboot-omap/Makefile
> +++ b/package/boot/uboot-omap/Makefile
> @@ -8,10 +8,10 @@
>   include $(TOPDIR)/rules.mk
>   include $(INCLUDE_DIR)/kernel.mk
>   
> -PKG_VERSION:=2019.10
> +PKG_VERSION:=2020.04
>   PKG_RELEASE:=1
>   
> -PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014
> +PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
>   
>   include $(INCLUDE_DIR)/u-boot.mk
>   include $(INCLUDE_DIR)/package.mk
> 



From mail at adrianschmutzler.de  Mon Sep 14 05:06:21 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Mon, 14 Sep 2020 11:06:21 +0200
Subject: [PATCH] omap: update uboot to v2020.04
In-Reply-To: <32ae6e20-a22d-1e78-1452-ee38dae59954@gmail.com>
References: <20200904073049.1255919-1-a.heider@gmail.com>
 <32ae6e20-a22d-1e78-1452-ee38dae59954@gmail.com>
Message-ID: <003901d68a76$515928e0$f40b7aa0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Andre Heider
> Sent: Montag, 14. September 2020 10:50
> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> Cc: OpenWrt Development List <openwrt-devel at lists.openwrt.org>
> Subject: Re: [PATCH] omap: update uboot to v2020.04
> 
> Hi Adrian,
> 
> On 04/09/2020 09:30, Andre Heider wrote:
> > Fixes the build error:
> > /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple
> > definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first
> > defined here
> > collect2: error: ld returned 1 exit status
> >
> > Successfully tested on boneblack.
> >
> > Signed-off-by: Andre Heider <a.heider at gmail.com>
> 
> you took care of my last omap patches, would you take a look at this one too
> please?

Sorry, u-boot is not my area.

Best

Adrian

> 
> See your comment here:
> https://github.com/openwrt/openwrt/pull/2852#issuecomment-620281604
> 
> Thanks,
> Andre
> 
> > ---
> >   package/boot/uboot-omap/Makefile | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/package/boot/uboot-omap/Makefile
> > b/package/boot/uboot-omap/Makefile
> > index 70c8af1dc4..f66b8d5331 100644
> > --- a/package/boot/uboot-omap/Makefile
> > +++ b/package/boot/uboot-omap/Makefile
> > @@ -8,10 +8,10 @@
> >   include $(TOPDIR)/rules.mk
> >   include $(INCLUDE_DIR)/kernel.mk
> >
> > -PKG_VERSION:=2019.10
> > +PKG_VERSION:=2020.04
> >   PKG_RELEASE:=1
> >
> > -
> PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829c
> a796
> > 67014
> >
> +PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff
> 4ad5
> > +65372
> >
> >   include $(INCLUDE_DIR)/u-boot.mk
> >   include $(INCLUDE_DIR)/package.mk
> >
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200914/5fb1b1e9/attachment.sig>

From dengqf6 at mail2.sysu.edu.cn  Mon Sep 14 03:05:03 2020
From: dengqf6 at mail2.sysu.edu.cn (DENG Qingfang)
Date: Mon, 14 Sep 2020 15:05:03 +0800
Subject: [PATCH] mt76: move mt7615/7663 firmware to firmware section
Message-ID: <20200914070503.57889-1-dengqf6@mail2.sysu.edu.cn>

Move the separate mt76 firmware packages to firmware section

Signed-off-by: DENG Qingfang <dengqf6 at mail2.sysu.edu.cn>
---
 package/kernel/mt76/Makefile           | 78 ++++++++++++++------------
 target/linux/mediatek/image/mt7622.mk  |  4 +-
 target/linux/mediatek/mt7622/target.mk |  2 +-
 target/linux/ramips/image/mt7621.mk    | 70 +++++++++++------------
 4 files changed, 80 insertions(+), 74 deletions(-)

diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index 84a59b7e08..3b201ef9f1 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -150,12 +150,6 @@ define KernelPackage/mt7615-common
   FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615-common.ko
 endef
 
-define KernelPackage/mt7615-firmware
-  $(KernelPackage/mt76-default)
-  TITLE:=MediaTek MT7615e firmware
-  DEFAULT:=PACKAGE_kmod-mt7615e
-endef
-
 define KernelPackage/mt7615e
   $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT7615e wireless driver
@@ -164,16 +158,6 @@ define KernelPackage/mt7615e
   AUTOLOAD:=$(call AutoProbe,mt7615e)
 endef
 
-define KernelPackage/mt7663-firmware-ap
-  $(KernelPackage/mt76-default)
-  TITLE:=MediaTek MT7663e firmware (optimized for AP)
-endef
-
-define KernelPackage/mt7663-firmware-sta
-  $(KernelPackage/mt76-default)
-  TITLE:=MediaTek MT7663e firmware (client mode offload)
-endef
-
 define KernelPackage/mt7663-usb-sdio
   $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT7663 USB/SDIO shared code
@@ -216,6 +200,28 @@ define Package/mt76-test
   DEPENDS:=kmod-mt76-core +libnl-tiny
 endef
 
+define Package/mt76-firmware-default
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  PKGARCH:=all
+endef
+
+define Package/mt7615-firmware
+  $(Package/mt76-firmware-default)
+  TITLE:=MediaTek MT7615e firmware
+  DEFAULT:=PACKAGE_kmod-mt7615e
+endef
+
+define Package/mt7663-firmware-ap
+  $(Package/mt76-firmware-default)
+  TITLE:=MediaTek MT7663e firmware (optimized for AP)
+endef
+
+define Package/mt7663-firmware-sta
+  $(Package/mt76-firmware-default)
+  TITLE:=MediaTek MT7663e firmware (client mode offload)
+endef
+
 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
 
 NOSTDINC_FLAGS = \
@@ -346,7 +352,21 @@ define KernelPackage/mt7603/install
 		$(1)/lib/firmware
 endef
 
-define KernelPackage/mt7615-firmware/install
+define KernelPackage/mt7915e/install
+	$(INSTALL_DIR) $(1)/lib/firmware/mediatek
+	cp \
+		$(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \
+		$(PKG_BUILD_DIR)/firmware/mt7915_wm.bin \
+		$(PKG_BUILD_DIR)/firmware/mt7915_rom_patch.bin \
+		$(1)/lib/firmware/mediatek
+endef
+
+define Package/mt76-test/install
+	mkdir -p $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin
+endef
+
+define Package/mt7615-firmware/install
 	$(INSTALL_DIR) $(1)/lib/firmware/mediatek
 	cp \
 		$(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \
@@ -358,7 +378,7 @@ define KernelPackage/mt7615-firmware/install
 		$(1)/lib/firmware/mediatek
 endef
 
-define KernelPackage/mt7663-firmware-ap/install
+define Package/mt7663-firmware-ap/install
 	$(INSTALL_DIR) $(1)/lib/firmware/mediatek
 	cp \
 		$(PKG_BUILD_DIR)/firmware/mt7663_n9_rebb.bin \
@@ -366,7 +386,7 @@ define KernelPackage/mt7663-firmware-ap/install
 		$(1)/lib/firmware/mediatek
 endef
 
-define KernelPackage/mt7663-firmware-sta/install
+define Package/mt7663-firmware-sta/install
 	$(INSTALL_DIR) $(1)/lib/firmware/mediatek
 	cp \
 		$(PKG_BUILD_DIR)/firmware/mt7663_n9_v3.bin \
@@ -374,20 +394,6 @@ define KernelPackage/mt7663-firmware-sta/install
 		$(1)/lib/firmware/mediatek
 endef
 
-define KernelPackage/mt7915e/install
-	$(INSTALL_DIR) $(1)/lib/firmware/mediatek
-	cp \
-		$(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \
-		$(PKG_BUILD_DIR)/firmware/mt7915_wm.bin \
-		$(PKG_BUILD_DIR)/firmware/mt7915_rom_patch.bin \
-		$(1)/lib/firmware/mediatek
-endef
-
-define Package/mt76-test/install
-	mkdir -p $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin
-endef
-
 $(eval $(call KernelPackage,mt76-core))
 $(eval $(call KernelPackage,mt76-usb))
 $(eval $(call KernelPackage,mt76x02-usb))
@@ -400,13 +406,13 @@ $(eval $(call KernelPackage,mt76x2u))
 $(eval $(call KernelPackage,mt76x2))
 $(eval $(call KernelPackage,mt7603))
 $(eval $(call KernelPackage,mt7615-common))
-$(eval $(call KernelPackage,mt7615-firmware))
 $(eval $(call KernelPackage,mt7615e))
-$(eval $(call KernelPackage,mt7663-firmware-ap))
-$(eval $(call KernelPackage,mt7663-firmware-sta))
 $(eval $(call KernelPackage,mt7663-usb-sdio))
 $(eval $(call KernelPackage,mt7663u))
 $(eval $(call KernelPackage,mt7663s))
 $(eval $(call KernelPackage,mt7915e))
 $(eval $(call KernelPackage,mt76))
 $(eval $(call BuildPackage,mt76-test))
+$(eval $(call BuildPackage,mt7615-firmware))
+$(eval $(call BuildPackage,mt7663-firmware-ap))
+$(eval $(call BuildPackage,mt7663-firmware-sta))
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index dee340accf..7f4a0b4ee4 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -27,8 +27,8 @@ define Device/elecom_wrc-2533gent
   DEVICE_MODEL := WRC-2533GENT
   DEVICE_DTS := mt7622-elecom-wrc-2533gent
   DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
-  DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-mt7615e \
-	kmod-mt7615-firmware mt7622bt-firmware swconfig
+  DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 mt7622bt-firmware \
+	swconfig
 endef
 TARGET_DEVICES += elecom_wrc-2533gent
 
diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk
index cb5a6b48cd..26c32083c5 100644
--- a/target/linux/mediatek/mt7622/target.mk
+++ b/target/linux/mediatek/mt7622/target.mk
@@ -2,7 +2,7 @@ ARCH:=aarch64
 SUBTARGET:=mt7622
 BOARDNAME:=MT7622
 CPU_TYPE:=cortex-a53
-DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl
+DEFAULT_PACKAGES += kmod-mt7615e mt7615-firmware wpad-basic-wolfssl
 KERNELNAME:=Image dtbs
 
 define Target/Description
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 4633aff080..ef8c8de536 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -115,7 +115,7 @@ define Device/adslr_g7
   IMAGE_SIZE := 16064k
   DEVICE_VENDOR := ADSLR
   DEVICE_MODEL := G7
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += adslr_g7
 
@@ -181,7 +181,7 @@ define Device/asus_rt-ac65p
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
 	check-size
-  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools
+  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e mt7615-firmware uboot-envtools
 endef
 TARGET_DEVICES += asus_rt-ac65p
 
@@ -198,7 +198,7 @@ define Device/asus_rt-ac85p
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
 	check-size
-  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools
+  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e mt7615-firmware uboot-envtools
 endef
 TARGET_DEVICES += asus_rt-ac85p
 
@@ -223,7 +223,7 @@ define Device/buffalo_wsr-2533dhpl
   DEVICE_ALT0_VENDOR := Buffalo
   DEVICE_ALT0_MODEL := WSR-2533DHP
   IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += buffalo_wsr-2533dhpl
 
@@ -241,7 +241,7 @@ define Device/dlink_dir-8xx-a1
   $(Device/dsa-migration)
   IMAGE_SIZE := 16000k
   DEVICE_VENDOR := D-Link
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
   KERNEL_INITRAMFS := $$(KERNEL) | uimage-padhdr 96
   IMAGES += factory.bin
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\
@@ -258,7 +258,7 @@ define Device/dlink_dir-xx60-a1
   IMAGE_SIZE := 40960k
   UBINIZE_OPTS := -E 5
   DEVICE_VENDOR := D-Link
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3 \
 	kmod-usb-ledtrig-usbport
   KERNEL := $$(KERNEL) | uimage-padhdr 96
   IMAGES += factory.bin
@@ -353,7 +353,7 @@ define Device/edimax_ra21s
   IMAGES += factory.bin
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
 	elx-header 02020040 8844A2D168B45A2D
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += edimax_ra21s
 
@@ -372,7 +372,7 @@ define Device/edimax_re23s
   IMAGE/factory.bin := append-kernel | append-rootfs | \
 	edimax-header -s CSYS -m RN76 -f 0x70000 -S 0x01100000 | pad-rootfs | \
 	check-size
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += edimax_re23s
 
@@ -385,7 +385,7 @@ define Device/edimax_rg21s
   IMAGES += factory.bin
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
 	elx-header 02020038 8844A2D168B45A2D
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += edimax_rg21s
 
@@ -397,7 +397,7 @@ define Device/elecom_wrc-1167ghbk2-s
   IMAGES += factory.bin
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
 	elecom-wrc-factory WRC-1167GHBK2-S 0.00
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += elecom_wrc-1167ghbk2-s
 
@@ -408,7 +408,7 @@ define Device/elecom_wrc-gs
   IMAGES += factory.bin
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
 	elecom-wrc-gs-factory $$$$(ELECOM_HWNAME) 0.00
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 
 define Device/elecom_wrc-1750gs
@@ -545,7 +545,7 @@ define Device/iodata_wn-ax1167gr2
   DEVICE_MODEL := WN-AX1167GR2
   KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \
 	custom-initramfs-uimage 3.10(XBC.1)b10 | iodata-mstc-header
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += iodata_wn-ax1167gr2
 
@@ -555,7 +555,7 @@ define Device/iodata_wn-ax2033gr
   DEVICE_MODEL := WN-AX2033GR
   KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \
 	custom-initramfs-uimage 3.10(VST.1)C10 | iodata-mstc-header
-  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += iodata_wn-ax2033gr
 
@@ -565,7 +565,7 @@ define Device/iodata_wn-dx1167r
   DEVICE_MODEL := WN-DX1167R
   KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \
 	custom-initramfs-uimage 3.10(XIK.1)b10 | iodata-mstc-header
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += iodata_wn-dx1167r
 
@@ -588,7 +588,7 @@ define Device/iodata_wnpr2600g
   IMAGES += factory.bin
   IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
 	elx-header 0104003a 8844A2D168B45A2D
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += iodata_wnpr2600g
 
@@ -598,7 +598,7 @@ define Device/iptime_a6ns-m
   UIMAGE_NAME := a6nm
   DEVICE_VENDOR := ipTIME
   DEVICE_MODEL := A6ns-M
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3 \
 	kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += iptime_a6ns-m
@@ -609,7 +609,7 @@ define Device/iptime_a8004t
   UIMAGE_NAME := a8004t
   DEVICE_VENDOR := ipTIME
   DEVICE_MODEL := A8004T
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3
 endef
 TARGET_DEVICES += iptime_a8004t
 
@@ -621,7 +621,7 @@ define Device/jcg_jhr-ac876m
   JCG_MAXSIZE := 16064k
   DEVICE_VENDOR := JCG
   DEVICE_MODEL := JHR-AC876M
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3 \
 	kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += jcg_jhr-ac876m
@@ -655,7 +655,7 @@ define Device/linksys_ea7xxx
   KERNEL_SIZE := 4096k
   IMAGE_SIZE := 36864k
   DEVICE_VENDOR := Linksys
-  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \
+  DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e mt7615-firmware \
 	uboot-envtools
   UBINIZE_OPTS := -E 5
   IMAGES := sysupgrade.bin factory.bin
@@ -828,7 +828,7 @@ define Device/netgear_r6260
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0052
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_r6260
 
@@ -840,7 +840,7 @@ define Device/netgear_r6350
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0052
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_r6350
 
@@ -859,7 +859,7 @@ define Device/netgear_r6700-v2
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x1032
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_r6700-v2
 
@@ -871,7 +871,7 @@ define Device/netgear_r6800
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0062
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_r6800
 
@@ -883,7 +883,7 @@ define Device/netgear_r6850
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0052
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_r6850
 
@@ -907,7 +907,7 @@ define Device/netgear_wac124
   SERCOMM_HWVER := A003
   SERCOMM_SWVER := 0x0402
   IMAGE_SIZE := 40960k
-  DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += netgear_wac124
 
@@ -957,7 +957,7 @@ define Device/phicomm_k2p
   DEVICE_ALT0_VENDOR := Phicomm
   DEVICE_ALT0_MODEL := KE 2P
   SUPPORTED_DEVICES += k2p
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += phicomm_k2p
 
@@ -1019,7 +1019,7 @@ define Device/totolink_a7000r
   UIMAGE_NAME := C8340R1C-9999
   DEVICE_VENDOR := TOTOLINK
   DEVICE_MODEL := A7000R
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += totolink_a7000r
 
@@ -1040,7 +1040,7 @@ define Device/tplink_re500-v1
   $(Device/tplink-safeloader)
   DEVICE_MODEL := RE500
   DEVICE_VARIANT := v1
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
   TPLINK_BOARD_ID := RE500-V1
   IMAGE_SIZE := 14208k
 endef
@@ -1051,7 +1051,7 @@ define Device/tplink_re650-v1
   $(Device/tplink-safeloader)
   DEVICE_MODEL := RE650
   DEVICE_VARIANT := v1
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware
   TPLINK_BOARD_ID := RE650-V1
   IMAGE_SIZE := 14208k
 endef
@@ -1061,7 +1061,7 @@ define Device/tplink_tl-wdr8620-v3
   DEVICE_VENDOR := TP-Link
   DEVICE_MODEL := TL-WDR8620
   DEVICE_VARIANT := v3
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3
   IMAGE_SIZE := 16128k
 endef
 TARGET_DEVICES += tplink_tl-wdr8620-v3
@@ -1098,7 +1098,7 @@ define Device/ubnt_unifi-nanohd
   $(Device/dsa-migration)
   DEVICE_VENDOR := Ubiquiti
   DEVICE_MODEL := UniFi nanoHD
-  DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e mt7615-firmware
   IMAGE_SIZE := 15552k
 endef
 TARGET_DEVICES += ubnt_unifi-nanohd
@@ -1129,7 +1129,7 @@ define Device/wavlink_wl-wn531a6
   $(Device/dsa-migration)
   DEVICE_VENDOR := Wavlink
   DEVICE_MODEL := WL-WN531A6
-  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-usb3
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e mt7615-firmware kmod-usb3
   IMAGE_SIZE := 15040k
 endef
 TARGET_DEVICES += wavlink_wl-wn531a6
@@ -1168,7 +1168,7 @@ define Device/winstars_ws-wn583a6
   DEVICE_ALT0_VENDOR := Gemeita
   DEVICE_ALT0_MODEL := AC2100
   KERNEL_INITRAMFS_SUFFIX := -WN583A6$$(KERNEL_SUFFIX)
-  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e mt7615-firmware
 endef
 TARGET_DEVICES += winstars_ws-wn583a6
 
@@ -1185,7 +1185,7 @@ define Device/xiaomi-ac2100
   IMAGE/rootfs0.bin := append-ubi | check-size
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   DEVICE_VENDOR := Xiaomi
-  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e mt7615-firmware \
 	uboot-envtools
 endef
 
@@ -1246,7 +1246,7 @@ define Device/xiaomi_mir3p
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
 	check-size
-  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \
+  DEVICE_PACKAGES := kmod-mt7615e mt7615-firmware kmod-usb3 \
 	kmod-usb-ledtrig-usbport uboot-envtools
 endef
 TARGET_DEVICES += xiaomi_mir3p
-- 
2.28.0





From mail at david-bauer.net  Mon Sep 14 08:19:44 2020
From: mail at david-bauer.net (David Bauer)
Date: Mon, 14 Sep 2020 14:19:44 +0200
Subject: [PATCH] ath79: add support for Ubiquiti UniFi AP Pro
Message-ID: <20200914121944.114046-1-mail@david-bauer.net>

This adds support for the Ubiquiti UniFi AP Pro to the ath79 target. The
device was previously supported on the now removed ar71xx target.

SoC   Atheros AR9344
WiFi  Atheros AR9344 & Atheros AR9280
ETH   Atheros AR8327
RAM   128M DDR2
FLASH 16M SPI-NOR

Installation
------------

Follow the Ubiquiti TFTP recovery procedure for this device.

1. Hold down the reset button while connecting power for 10 seconds.
2. Transfer the factory image via TFTP to the AP (192.168.1.20)
3. Wait 2 minutes for the AP to write the firmware to flash. The device
   will automatically reboot to OpenWrt.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 .../ath79/dts/ar9344_ubnt_unifi-ap-pro.dts    | 153 ++++++++++++++++++
 .../generic/base-files/etc/board.d/02_network |   4 +
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |   1 +
 target/linux/ath79/image/generic-ubnt.mk      |  25 +++
 4 files changed, 183 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts

diff --git a/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts b/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts
new file mode 100644
index 0000000000..8b6e1bfd6d
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9344.dtsi"
+
+/ {
+	model = "Ubiquiti UniFi AP Pro";
+	compatible = "ubnt,unifi-ap-pro";
+
+	aliases {
+		led-boot = &led_white;
+		led-failsafe = &led_white;
+		led-running = &led_blue;
+		led-upgrade = &led_blue;
+		label-mac-device = &eth0;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_white: led-white {
+			label = "ubnt:white:dome";
+			gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_blue: led-blue {
+			label = "ubnt:blue:dome";
+			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&ref {
+	clock-frequency = <40000000>;
+};
+
+&uart {
+	status = "okay";
+};
+
+&spi {
+	status = "okay";
+
+	num-cs = <1>;
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			uboot: partition at 0 {
+				label = "u-boot";
+				reg = <0x0 0x40000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				label = "u-boot-env";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+
+			partition at 50000 {
+				label = "kernel";
+				reg = <0x50000 0x300000>;
+				/* Can be resized w/o issues.
+				 * U-Boot canload kernel from the
+				 * entirety of the "firmware" partition space.
+				 */
+			};
+
+			partition at 350000 {
+				label = "rootfs";
+				reg = <0x350000 0xc60000>;
+			};
+
+			firmware-partition at 50000 {
+				label = "firmware";
+				reg = <0x50000 0xf60000>;
+			};
+
+			partition at fb0000 {
+				label = "cfg";
+				reg = <0xfb0000 0x40000>;
+				read-only;
+			};
+
+			art: partition at f0000 {
+				label = "art";
+				reg = <0xff0000 0x10000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "pci168c,0033";
+		reg = <0 0 0 0 0>;
+		qca,no-eeprom;
+	};
+};
+
+&wmac {
+	status = "okay";
+	mtd-cal-data = <&art 0x1000>;
+};
+
+&mdio0 {
+	status = "okay";
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+
+		qca,ar8327-initvals = <
+			0x4 0x7600000 /* PORT0 PAD MODE CTRL */
+			0x10 0x80000080 /* POWER_ON_STRAP */
+			0x7c 0x7e /* PORT0_STATUS */
+			>;
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	pll-data = <0x6000000 0x101 0x1616>;
+
+	mtd-mac-address = <&art 0x0>;
+
+	phy-mode = "rgmii";
+	phy-handle = <&phy0>;
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index f437f7432f..4105b639f0 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -370,6 +370,10 @@ ath79_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "2:lan:1" "3:lan:2"
 		;;
+	ubnt,unifi-ap-pro)
+		ucidef_add_switch "switch0" \
+			"0 at eth0" "1:lan" "2:lan"
+		;;
 	zbtlink,zbt-wd323|\
 	xiaomi,mi-router-4q)
 		ucidef_set_interface_wan "eth1"
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 5ecae96cd1..4da7bfac6c 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -98,6 +98,7 @@ case "$FIRMWARE" in
 	tplink,tl-wdr4300-v1-il|\
 	tplink,tl-wdr4310-v1|\
 	tplink,tl-wdr4900-v2|\
+	ubnt,unifi-ap-pro|\
 	winchannel,wb2000)
 		caldata_extract "art" 0x5000 0x440
 		;;
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index b945183776..3593f637a6 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -13,6 +13,14 @@ define Build/mkubntimage
 		-k $(IMAGE_KERNEL) -r $@ -o $@
 endef
 
+define Build/mkubntimage2
+	-$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
+		-v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
+		-p jffs2:0x50000:0xf60000:0:0:$@ \
+		-o $@.new
+	@mv $@.new $@
+endef
+
 # all UBNT XM/WA devices expect the kernel image to have 1024k while flash, when
 # booting the image, the size doesn't matter.
 define Build/mkubntimage-split
@@ -369,3 +377,20 @@ define Device/ubnt_unifiac-pro
   SUPPORTED_DEVICES += unifiac-pro
 endef
 TARGET_DEVICES += ubnt_unifiac-pro
+
+define Device/ubnt_unifi-ap-pro
+  SOC := ar9344
+  DEVICE_VENDOR := Ubiquiti
+  DEVICE_MODEL := UniFi AP Pro
+  UBNT_TYPE := BZ
+  UBNT_CHIP := ar934x
+  KERNEL_SIZE := 3072k
+  IMAGE_SIZE := 15744k
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0
+  IMAGES := sysupgrade.bin factory.bin
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\
+	pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+  IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
+  SUPPORTED_DEVICES += uap-pro
+endef
+TARGET_DEVICES += ubnt_unifi-ap-pro
-- 
2.28.0



From zajec5 at gmail.com  Mon Sep 14 10:04:13 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 14 Sep 2020 16:04:13 +0200
Subject: [PATCH uhttpd] ubus: fix blob_buf initialization
Message-ID: <20200914140413.14084-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Initializing buffer in the uh_ubus_handle_request() didn't handle
batched requests correctly. It resulted in reusing buffer and generating
malformed replies.

Call blob_buf_init() before every usage of the global buf variable.

While at it make two functions take blob_buf pointer as argument:
1. uh_ubus_send_response()
2. uh_ubus_init_json_rpc_response()

This helps following global "buf" variable usage and will help avoiding
similar bugs in the future.

Fixes: 628341fae412 ("ubus: use local "blob_buf" in uh_ubus_handle_request_object()")
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ubus.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/ubus.c b/ubus.c
index c22e07a..a458f4c 100644
--- a/ubus.c
+++ b/ubus.c
@@ -169,7 +169,7 @@ static void uh_ubus_send_header(struct client *cl)
 	ustream_printf(cl->us, "\r\n");
 }
 
-static void uh_ubus_send_response(struct client *cl)
+static void uh_ubus_send_response(struct client *cl, struct blob_buf *buf)
 {
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
 	const char *sep = "";
@@ -178,7 +178,7 @@ static void uh_ubus_send_response(struct client *cl)
 	if (du->array && du->array_idx > 1)
 		sep = ",";
 
-	str = blobmsg_format_json(buf.head, true);
+	str = blobmsg_format_json(buf->head, true);
 	ops->chunk_printf(cl, "%s%s", sep, str);
 	free(str);
 
@@ -189,32 +189,34 @@ static void uh_ubus_send_response(struct client *cl)
 		return ops->request_done(cl);
 }
 
-static void uh_ubus_init_json_rpc_response(struct client *cl)
+static void uh_ubus_init_json_rpc_response(struct client *cl, struct blob_buf *buf)
 {
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
 	struct json_object *obj = du->jsobj_cur, *obj2 = NULL;
 
-	blobmsg_add_string(&buf, "jsonrpc", "2.0");
+	blobmsg_add_string(buf, "jsonrpc", "2.0");
 
 	if (obj)
 		json_object_object_get_ex(obj, "id", &obj2);
 
 	if (obj2)
-		blobmsg_add_json_element(&buf, "id", obj2);
+		blobmsg_add_json_element(buf, "id", obj2);
 	else
-		blobmsg_add_field(&buf, BLOBMSG_TYPE_UNSPEC, "id", NULL, 0);
+		blobmsg_add_field(buf, BLOBMSG_TYPE_UNSPEC, "id", NULL, 0);
 }
 
 static void uh_ubus_json_rpc_error(struct client *cl, enum rpc_error type)
 {
 	void *c;
 
-	uh_ubus_init_json_rpc_response(cl);
+	blob_buf_init(&buf, 0);
+
+	uh_ubus_init_json_rpc_response(cl, &buf);
 	c = blobmsg_open_table(&buf, "error");
 	blobmsg_add_u32(&buf, "code", json_errors[type].code);
 	blobmsg_add_string(&buf, "message", json_errors[type].msg);
 	blobmsg_close_table(&buf, c);
-	uh_ubus_send_response(cl);
+	uh_ubus_send_response(cl, &buf);
 }
 
 static void
@@ -234,14 +236,16 @@ uh_ubus_request_cb(struct ubus_request *req, int ret)
 	void *r;
 	int rem;
 
+	blob_buf_init(&buf, 0);
+
 	uloop_timeout_cancel(&du->timeout);
-	uh_ubus_init_json_rpc_response(cl);
+	uh_ubus_init_json_rpc_response(cl, &buf);
 	r = blobmsg_open_array(&buf, "result");
 	blobmsg_add_u32(&buf, "", ret);
 	blob_for_each_attr(cur, du->buf.head, rem)
 		blobmsg_add_blob(&buf, cur);
 	blobmsg_close_array(&buf, r);
-	uh_ubus_send_response(cl);
+	uh_ubus_send_response(cl, &buf);
 }
 
 static void
@@ -401,9 +405,10 @@ static void uh_ubus_send_list(struct client *cl, struct blob_attr *params)
 
 	uh_client_unref(cl);
 
-	uh_ubus_init_json_rpc_response(cl);
+	blob_buf_init(&buf, 0);
+	uh_ubus_init_json_rpc_response(cl, &buf);
 	blobmsg_add_blob(&buf, blob_data(data.buf->head));
-	uh_ubus_send_response(cl);
+	uh_ubus_send_response(cl, &buf);
 }
 
 static bool parse_json_rpc(struct rpc_data *d, struct blob_attr *data)
@@ -627,8 +632,6 @@ static void uh_ubus_handle_request(struct client *cl, char *url, struct path_inf
 {
 	struct dispatch *d = &cl->dispatch;
 
-	blob_buf_init(&buf, 0);
-
 	switch (cl->request.method)
 	{
 	case UH_HTTP_MSG_POST:
-- 
2.27.0



From zajec5 at gmail.com  Mon Sep 14 11:15:23 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 14 Sep 2020 17:15:23 +0200
Subject: [PATCH V3 uhttpd] ubus: add new RESTful API
Message-ID: <20200914151523.4757-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Initial uhttpd ubus API was fully based on JSON-RPC. That restricted it
from supporting ubus notifications that don't fit its model.

Notifications require protocol that allows server to send data without
being polled. There are two candidates for that:
1. Server-sent events
2. WebSocket

The later one is overcomplex for this simple task so ideally uhttps ubus
should support text-based server-sent events. It's not possible with
JSON-RPC without violating it. Specification requires server to reply
with Response object. Replying with text/event-stream is not allowed.

All above led to designing new API that:
1. Uses GET and POST requests
2. Makes use of RESTful URLs
3. Uses JSON-RPC in cleaner form and only for calling ubus methods

This new API allows:
1. Listing all ubus objects and their methods using GET <prefix>/list
2. Listing object methods using GET <prefix>/list/<path>
3. Listening to object notifications with GET <prefix>/subscribe/<path>
4. Calling ubus methods using POST <prefix>/call/<path>

JSON-RPC custom protocol was also simplified to:
1. Use "method" member for ubus object method name
   It was possible thanks to using RESTful URLs. Previously "method"
   had to be "list" or "call".
2. Reply with Error object on ubus method call error
   This simplified "result" member format as it doesn't need to contain
   ubus result code anymore.

This patch doesn't break or change the old API. The biggest downside of
the new API is no support for batch requests. It's cost of using RESTful
URLs. It should not matter much as uhttpd supports keep alive.

Example usages:

1. Getting all objects and their methods:
$ curl http://192.168.1.1/ubus/list
{
	"dhcp": {
		"ipv4leases": {

		},
		"ipv6leases": {

		}
	},
	"log": {
		"read": {
			"lines": "number",
			"stream": "boolean",
			"oneshot": "boolean"
		},
		"write": {
			"event": "string"
		}
	}
}

2. Getting object methods:
$ curl http://192.168.1.1/ubus/list/log
{
	"read": {
		"lines": "number",
		"stream": "boolean",
		"oneshot": "boolean"
	},
	"write": {
		"event": "string"
	}
}

3. Subscribing to notifications:
$ curl http://192.168.1.1/ubus/subscribe/foo
event: status
data: {"count":5}

4. Calling ubus object method:
$ curl -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "login",
    "params": {"username": "root", "password": "password" }
}' http://192.168.1.1/ubus/call/session
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"ubus_rpc_session": "01234567890123456789012345678901",
		(...)
	}
}

$ curl -H 'Authorization: Bearer 01234567890123456789012345678901' -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "write",
    "params": {"event": "Hello world" }
}' http://192.168.1.1/ubus/call/log
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": null
}

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
V2: Use "Authorization" with Bearer for rpcd session id / token
    Treat missing session id as UH_UBUS_DEFAULT_SID
    Fix "result" format (was: "result":{{"foo":"bar"}})
V3: Treat /ubus/ requests as legacy ones for backward compatibility.
    Previously there were causing 404 (only /ubus was accepted).
    Support requests with search path (e.g. ?foo=bar) by ignoring it.
    This may be used by some clients to avoid caching responses.
    Rebase on the [PATCH uhttpd] ubus: fix blob_buf initialization
---
 main.c   |   8 +-
 ubus.c   | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 uhttpd.h |   5 +
 3 files changed, 339 insertions(+), 22 deletions(-)

diff --git a/main.c b/main.c
index 26e74ec..73e3d42 100644
--- a/main.c
+++ b/main.c
@@ -159,6 +159,7 @@ static int usage(const char *name)
 		"	-U file         Override ubus socket path\n"
 		"	-a              Do not authenticate JSON-RPC requests against UBUS session api\n"
 		"	-X		Enable CORS HTTP headers on JSON-RPC api\n"
+		"	-e		Events subscription reconnection time (retry value)\n"
 #endif
 		"	-x string       URL prefix for CGI handler, default is '/cgi-bin'\n"
 		"	-y alias[=path]	URL alias handle\n"
@@ -262,7 +263,7 @@ int main(int argc, char **argv)
 	init_defaults_pre();
 	signal(SIGPIPE, SIG_IGN);
 
-	while ((ch = getopt(argc, argv, "A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:P:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
+	while ((ch = getopt(argc, argv, "A:aC:c:Dd:E:e:fh:H:I:i:K:k:L:l:m:N:n:P:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
 		switch(ch) {
 #ifdef HAVE_TLS
 		case 'C':
@@ -490,11 +491,16 @@ int main(int argc, char **argv)
 		case 'X':
 			conf.ubus_cors = 1;
 			break;
+
+		case 'e':
+			conf.events_retry = atoi(optarg);
+			break;
 #else
 		case 'a':
 		case 'u':
 		case 'U':
 		case 'X':
+		case 'e':
 			fprintf(stderr, "uhttpd: UBUS support not compiled, "
 			                "ignoring -%c\n", ch);
 			break;
diff --git a/ubus.c b/ubus.c
index a458f4c..d7d7678 100644
--- a/ubus.c
+++ b/ubus.c
@@ -73,6 +73,7 @@ struct rpc_data {
 
 struct list_data {
 	bool verbose;
+	bool add_object;
 	struct blob_buf *buf;
 };
 
@@ -154,14 +155,14 @@ static void uh_ubus_add_cors_headers(struct client *cl)
 	ustream_printf(cl->us, "Access-Control-Allow-Credentials: true\r\n");
 }
 
-static void uh_ubus_send_header(struct client *cl)
+static void uh_ubus_send_header(struct client *cl, int code, const char *summary, const char *content_type)
 {
-	ops->http_header(cl, 200, "OK");
+	ops->http_header(cl, code, summary);
 
 	if (conf.ubus_cors)
 		uh_ubus_add_cors_headers(cl);
 
-	ustream_printf(cl->us, "Content-Type: application/json\r\n");
+	ustream_printf(cl->us, "Content-Type: %s\r\n", content_type);
 
 	if (cl->request.method == UH_HTTP_MSG_OPTIONS)
 		ustream_printf(cl->us, "Content-Length: 0\r\n");
@@ -219,12 +220,169 @@ static void uh_ubus_json_rpc_error(struct client *cl, enum rpc_error type)
 	uh_ubus_send_response(cl, &buf);
 }
 
+static void uh_ubus_error(struct client *cl, int code, const char *message)
+{
+	blob_buf_init(&buf, 0);
+
+	blobmsg_add_u32(&buf, "code", code);
+	blobmsg_add_string(&buf, "message", message);
+	uh_ubus_send_response(cl, &buf);
+}
+
+static void uh_ubus_posix_error(struct client *cl, int err)
+{
+	uh_ubus_error(cl, -err, strerror(err));
+}
+
+static void uh_ubus_ubus_error(struct client *cl, int err)
+{
+	uh_ubus_error(cl, err, ubus_strerror(err));
+}
+
+/* GET requests handling */
+
+static void uh_ubus_list_cb(struct ubus_context *ctx, struct ubus_object_data *obj, void *priv);
+
+static void uh_ubus_handle_get_list(struct client *cl, const char *path)
+{
+	static struct blob_buf tmp;
+	struct list_data data = { .verbose = true, .add_object = !path, .buf = &tmp};
+	struct blob_attr *cur;
+	int rem;
+	int err;
+
+	blob_buf_init(&tmp, 0);
+
+	err = ubus_lookup(ctx, path, uh_ubus_list_cb, &data);
+	if (err) {
+		uh_ubus_send_header(cl, 500, "Ubus Protocol Error", "application/json");
+		uh_ubus_ubus_error(cl, err);
+		return;
+	}
+
+	blob_buf_init(&buf, 0);
+	blob_for_each_attr(cur, tmp.head, rem)
+		blobmsg_add_blob(&buf, cur);
+
+	uh_ubus_send_header(cl, 200, "OK", "application/json");
+	uh_ubus_send_response(cl, &buf);
+}
+
+static int uh_ubus_subscription_notification_cb(struct ubus_context *ctx,
+						struct ubus_object *obj,
+						struct ubus_request_data *req,
+						const char *method,
+						struct blob_attr *msg)
+{
+	struct ubus_subscriber *s;
+	struct dispatch_ubus *du;
+	struct client *cl;
+	char *json;
+
+	s = container_of(obj, struct ubus_subscriber, obj);
+	du = container_of(s, struct dispatch_ubus, sub);
+	cl = container_of(du, struct client, dispatch.ubus);
+
+	json = blobmsg_format_json(msg, true);
+	if (json) {
+		ops->chunk_printf(cl, "event: %s\ndata: %s\n\n", method, json);
+		free(json);
+	}
+
+	return 0;
+}
+
+static void uh_ubus_subscription_notification_remove_cb(struct ubus_context *ctx, struct ubus_subscriber *s, uint32_t id)
+{
+	struct dispatch_ubus *du;
+	struct client *cl;
+
+	du = container_of(s, struct dispatch_ubus, sub);
+	cl = container_of(du, struct client, dispatch.ubus);
+
+	ops->request_done(cl);
+}
+
+static void uh_ubus_handle_get_subscribe(struct client *cl, const char *sid, const char *path)
+{
+	struct dispatch_ubus *du = &cl->dispatch.ubus;
+	uint32_t id;
+	int err;
+
+	/* TODO: add ACL support */
+	if (!conf.ubus_noauth) {
+		uh_ubus_send_header(cl, 200, "OK", "application/json");
+		uh_ubus_posix_error(cl, EACCES);
+		return;
+	}
+
+	du->sub.cb = uh_ubus_subscription_notification_cb;
+	du->sub.remove_cb = uh_ubus_subscription_notification_remove_cb;
+
+	uh_client_ref(cl);
+
+	err = ubus_register_subscriber(ctx, &du->sub);
+	if (err)
+		goto err_unref;
+
+	err = ubus_lookup_id(ctx, path, &id);
+	if (err)
+		goto err_unregister;
+
+	err = ubus_subscribe(ctx, &du->sub, id);
+	if (err)
+		goto err_unregister;
+
+	uh_ubus_send_header(cl, 200, "OK", "text/event-stream");
+
+	if (conf.events_retry)
+		ops->chunk_printf(cl, "retry: %d\n", conf.events_retry);
+
+	return;
+
+err_unregister:
+	ubus_unregister_subscriber(ctx, &du->sub);
+err_unref:
+	uh_client_unref(cl);
+	if (err) {
+		uh_ubus_send_header(cl, 200, "OK", "application/json");
+		uh_ubus_ubus_error(cl, err);
+	}
+}
+
+static void uh_ubus_handle_get(struct client *cl)
+{
+	struct dispatch_ubus *du = &cl->dispatch.ubus;
+	const char *url = du->url_path;
+
+	url += strlen(conf.ubus_prefix);
+
+	if (!strcmp(url, "/list") || !strncmp(url, "/list/", strlen("/list/"))) {
+		url += strlen("/list");
+
+		uh_ubus_handle_get_list(cl, *url ? url + 1 : NULL);
+	} else if (!strncmp(url, "/subscribe/", strlen("/subscribe/"))) {
+		url += strlen("/subscribe");
+
+		uh_ubus_handle_get_subscribe(cl, NULL, url + 1);
+	} else {
+		ops->http_header(cl, 404, "Not Found");
+		ustream_printf(cl->us, "\r\n");
+		ops->request_done(cl);
+	}
+}
+
+/* POST requests handling */
+
 static void
 uh_ubus_request_data_cb(struct ubus_request *req, int type, struct blob_attr *msg)
 {
 	struct dispatch_ubus *du = container_of(req, struct dispatch_ubus, req);
+	struct blob_attr *cur;
+	int len;
 
-	blobmsg_add_field(&du->buf, BLOBMSG_TYPE_TABLE, "", blob_data(msg), blob_len(msg));
+	blob_for_each_attr(cur, msg, len)
+		blobmsg_add_blob(&du->buf, cur);
 }
 
 static void
@@ -239,13 +397,46 @@ uh_ubus_request_cb(struct ubus_request *req, int ret)
 	blob_buf_init(&buf, 0);
 
 	uloop_timeout_cancel(&du->timeout);
-	uh_ubus_init_json_rpc_response(cl, &buf);
-	r = blobmsg_open_array(&buf, "result");
-	blobmsg_add_u32(&buf, "", ret);
-	blob_for_each_attr(cur, du->buf.head, rem)
-		blobmsg_add_blob(&buf, cur);
-	blobmsg_close_array(&buf, r);
-	uh_ubus_send_response(cl, &buf);
+
+	/* Legacy format always uses "result" array - even for errors and empty
+	 * results. */
+	if (du->legacy) {
+		void *c;
+
+		uh_ubus_init_json_rpc_response(cl, &buf);
+		r = blobmsg_open_array(&buf, "result");
+		blobmsg_add_u32(&buf, "", ret);
+		c = blobmsg_open_table(&buf, NULL);
+		blob_for_each_attr(cur, du->buf.head, rem)
+			blobmsg_add_blob(&buf, cur);
+		blobmsg_close_table(&buf, c);
+		blobmsg_close_array(&buf, r);
+		uh_ubus_send_response(cl, &buf);
+		return;
+	}
+
+	if (ret) {
+		void *c;
+
+		uh_ubus_init_json_rpc_response(cl, &buf);
+		c = blobmsg_open_table(&buf, "error");
+		blobmsg_add_u32(&buf, "code", ret);
+		blobmsg_add_string(&buf, "message", ubus_strerror(ret));
+		blobmsg_close_table(&buf, c);
+		uh_ubus_send_response(cl, &buf);
+	} else {
+		uh_ubus_init_json_rpc_response(cl, &buf);
+		if (blob_len(du->buf.head)) {
+			r = blobmsg_open_table(&buf, "result");
+			blob_for_each_attr(cur, du->buf.head, rem)
+				blobmsg_add_blob(&buf, cur);
+			blobmsg_close_table(&buf, r);
+		} else {
+			blobmsg_add_field(&buf, BLOBMSG_TYPE_UNSPEC, "result", NULL, 0);
+		}
+		uh_ubus_send_response(cl, &buf);
+	}
+
 }
 
 static void
@@ -282,11 +473,14 @@ static void uh_ubus_request_free(struct client *cl)
 
 	if (du->req_pending)
 		ubus_abort_request(ctx, &du->req);
+
+	free(du->url_path);
+	du->url_path = NULL;
 }
 
 static void uh_ubus_single_error(struct client *cl, enum rpc_error type)
 {
-	uh_ubus_send_header(cl);
+	uh_ubus_send_header(cl, 200, "OK", "application/json");
 	uh_ubus_json_rpc_error(cl, type);
 	ops->request_done(cl);
 }
@@ -339,7 +533,8 @@ static void uh_ubus_list_cb(struct ubus_context *ctx, struct ubus_object_data *o
 	if (!obj->signature)
 		return;
 
-	o = blobmsg_open_table(data->buf, obj->path);
+	if (data->add_object)
+		o = blobmsg_open_table(data->buf, obj->path);
 	blob_for_each_attr(sig, obj->signature, rem) {
 		t = blobmsg_open_table(data->buf, blobmsg_name(sig));
 		rem2 = blobmsg_data_len(sig);
@@ -370,13 +565,14 @@ static void uh_ubus_list_cb(struct ubus_context *ctx, struct ubus_object_data *o
 		}
 		blobmsg_close_table(data->buf, t);
 	}
-	blobmsg_close_table(data->buf, o);
+	if (data->add_object)
+		blobmsg_close_table(data->buf, o);
 }
 
 static void uh_ubus_send_list(struct client *cl, struct blob_attr *params)
 {
 	struct blob_attr *cur, *dup;
-	struct list_data data = { .buf = &cl->dispatch.ubus.buf, .verbose = false };
+	struct list_data data = { .buf = &cl->dispatch.ubus.buf, .verbose = false, .add_object = true };
 	void *r;
 	int rem;
 
@@ -476,7 +672,7 @@ static void uh_ubus_init_batch(struct client *cl)
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
 
 	du->array = true;
-	uh_ubus_send_header(cl);
+	uh_ubus_send_header(cl, 200, "OK", "application/json");
 	ops->chunk_printf(cl, "[");
 }
 
@@ -599,7 +795,7 @@ static void uh_ubus_data_done(struct client *cl)
 
 	switch (obj ? json_object_get_type(obj) : json_type_null) {
 	case json_type_object:
-		uh_ubus_send_header(cl);
+		uh_ubus_send_header(cl, 200, "OK", "application/json");
 		return uh_ubus_handle_request_object(cl, obj);
 	case json_type_array:
 		uh_ubus_init_batch(cl);
@@ -609,6 +805,97 @@ static void uh_ubus_data_done(struct client *cl)
 	}
 }
 
+static void uh_ubus_call(struct client *cl, const char *path, const char *sid)
+{
+	struct dispatch_ubus *du = &cl->dispatch.ubus;
+	struct json_object *obj = du->jsobj;
+	struct rpc_data data = {};
+	enum rpc_error err = ERROR_PARSE;
+	static struct blob_buf req;
+
+	uh_client_ref(cl);
+
+	if (!obj || json_object_get_type(obj) != json_type_object)
+		goto error;
+
+	uh_ubus_send_header(cl, 200, "OK", "application/json");
+
+	du->jsobj_cur = obj;
+	blob_buf_init(&req, 0);
+	if (!blobmsg_add_object(&req, obj))
+		goto error;
+
+	if (!parse_json_rpc(&data, req.head))
+		goto error;
+
+	du->func = data.method;
+	if (ubus_lookup_id(ctx, path, &du->obj)) {
+		err = ERROR_OBJECT;
+		goto error;
+	}
+
+	if (!conf.ubus_noauth && !uh_ubus_allowed(sid, path, data.method)) {
+		err = ERROR_ACCESS;
+		goto error;
+	}
+
+	uh_ubus_send_request(cl, sid, data.params);
+	goto out;
+
+error:
+	uh_ubus_json_rpc_error(cl, err);
+out:
+	if (data.params)
+		free(data.params);
+
+	uh_client_unref(cl);
+}
+
+enum ubus_hdr {
+	HDR_AUTHORIZATION,
+	__HDR_UBUS_MAX
+};
+
+static void uh_ubus_handle_post(struct client *cl)
+{
+	static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
+		[HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
+	};
+	struct dispatch_ubus *du = &cl->dispatch.ubus;
+	struct blob_attr *tb[__HDR_UBUS_MAX];
+	const char *url = du->url_path;
+	const char *auth;
+
+	if (!strcmp(url, conf.ubus_prefix) ||
+	    (url[strlen(url) - 1] == '/' && !strncmp(url, conf.ubus_prefix, strlen(url) - 1))) {
+		du->legacy = true;
+		uh_ubus_data_done(cl);
+		return;
+	}
+
+	blobmsg_parse(hdr_policy, __HDR_UBUS_MAX, tb, blob_data(cl->hdr.head), blob_len(cl->hdr.head));
+
+	auth = UH_UBUS_DEFAULT_SID;
+	if (tb[HDR_AUTHORIZATION]) {
+		const char *tmp = blobmsg_get_string(tb[HDR_AUTHORIZATION]);
+
+		if (!strncasecmp(tmp, "Bearer ", 7))
+			auth = tmp + 7;
+	}
+
+	url += strlen(conf.ubus_prefix);
+
+	if (!strncmp(url, "/call/", strlen("/call/"))) {
+		url += strlen("/call/");
+
+		uh_ubus_call(cl, url, auth);
+	} else {
+		ops->http_header(cl, 404, "Not Found");
+		ustream_printf(cl->us, "\r\n");
+		ops->request_done(cl);
+	}
+}
+
 static int uh_ubus_data_send(struct client *cl, const char *data, int len)
 {
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
@@ -631,25 +918,44 @@ error:
 static void uh_ubus_handle_request(struct client *cl, char *url, struct path_info *pi)
 {
 	struct dispatch *d = &cl->dispatch;
+	struct dispatch_ubus *du = &d->ubus;
+	char *chr;
+
+	du->url_path = strdup(url);
+	if (!du->url_path) {
+		ops->client_error(cl, 500, "Internal Server Error", "Failed to allocate resources");
+		return;
+	}
+	chr = strchr(du->url_path, '?');
+	if (chr)
+		chr[0] = '\0';
+
+	du->legacy = false;
 
 	switch (cl->request.method)
 	{
+	case UH_HTTP_MSG_GET:
+		uh_ubus_handle_get(cl);
+		break;
 	case UH_HTTP_MSG_POST:
 		d->data_send = uh_ubus_data_send;
-		d->data_done = uh_ubus_data_done;
+		d->data_done = uh_ubus_handle_post;
 		d->close_fds = uh_ubus_close_fds;
 		d->free = uh_ubus_request_free;
-		d->ubus.jstok = json_tokener_new();
-		break;
+		du->jstok = json_tokener_new();
+		return;
 
 	case UH_HTTP_MSG_OPTIONS:
-		uh_ubus_send_header(cl);
+		uh_ubus_send_header(cl, 200, "OK", "application/json");
 		ops->request_done(cl);
 		break;
 
 	default:
 		ops->client_error(cl, 400, "Bad Request", "Invalid Request");
 	}
+
+	free(du->url_path);
+	du->url_path = NULL;
 }
 
 static bool
diff --git a/uhttpd.h b/uhttpd.h
index f77718e..e61e176 100644
--- a/uhttpd.h
+++ b/uhttpd.h
@@ -82,6 +82,7 @@ struct config {
 	int ubus_noauth;
 	int ubus_cors;
 	int cgi_prefix_len;
+	int events_retry;
 	struct list_head cgi_alias;
 	struct list_head lua_prefix;
 };
@@ -209,6 +210,7 @@ struct dispatch_ubus {
 	struct json_tokener *jstok;
 	struct json_object *jsobj;
 	struct json_object *jsobj_cur;
+	char *url_path;
 	int post_len;
 
 	uint32_t obj;
@@ -218,6 +220,9 @@ struct dispatch_ubus {
 	bool req_pending;
 	bool array;
 	int array_idx;
+	bool legacy; /* Got legacy request => use legacy reply */
+
+	struct ubus_subscriber sub;
 };
 #endif
 
-- 
2.27.0



From mail at adrianschmutzler.de  Mon Sep 14 11:27:29 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Mon, 14 Sep 2020 17:27:29 +0200
Subject: [PATCH] ath79: add support for Ubiquiti UniFi AP Pro
In-Reply-To: <20200914121944.114046-1-mail@david-bauer.net>
References: <20200914121944.114046-1-mail@david-bauer.net>
Message-ID: <003c01d68aab$8f5fcfb0$ae1f6f10$@adrianschmutzler.de>

Hi,

> +			firmware-partition at 50000 {

Is there a special reason for calling this "firmware-partition"?

> +				label = "firmware";
> +				reg = <0x50000 0xf60000>;
> +			};
> +
> +			partition at fb0000 {
> +				label = "cfg";
> +				reg = <0xfb0000 0x40000>;
> +				read-only;
> +			};
> +
> +			art: partition at f0000 {

Typo: @ff0000

> +				label = "art";
> +				reg = <0xff0000 0x10000>;
> +				read-only;
> +			};
> +		};
> +	};
> +};
> +
> +&pcie {
> +	status = "okay";
> +
> +	wifi at 0,0 {
> +		compatible = "pci168c,0033";
> +		reg = <0 0 0 0 0>;
> +		qca,no-eeprom;
> +	};
> +};
> +
> +&wmac {
> +	status = "okay";
> +	mtd-cal-data = <&art 0x1000>;

I'd like an empty line after status here.

[...]

> +  IMAGES := sysupgrade.bin factory.bin
> +  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) |
> append-rootfs |\
> +	pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)

check-size can be used without argument now. (But watch out during backporting ...).

Best

Adrian 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200914/e744f70a/attachment.sig>

From zajec5 at gmail.com  Mon Sep 14 12:31:07 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 14 Sep 2020 18:31:07 +0200
Subject: [PATCH luci] luci-base: use actual JSON-RPC for verifying ubus RPC URL
Message-ID: <20200914163107.27739-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Sending GET request to the main RPC base URL and expecting HTTP response
code 400 had two flaws:
1. It was not verifying actual JSON-RPC interface availability
2. It did not allow implementing support for new requests

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../luci-base/htdocs/luci-static/resources/luci.js  | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 83c2807d7..e285f999e 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -2553,10 +2553,19 @@
 				rpcBaseURL = Session.getLocalData('rpcBaseURL');
 
 			if (rpcBaseURL == null) {
+				var msg = {
+					jsonrpc: '2.0',
+					id:      'init',
+					method:  'list',
+					params:  undefined
+				};
+				var options = {
+					nobatch: true
+				};
 				var rpcFallbackURL = this.url('admin/ubus');
 
-				rpcBaseURL = Request.get(env.ubuspath).then(function(res) {
-					return (rpcBaseURL = (res.status == 400) ? env.ubuspath : rpcFallbackURL);
+				rpcBaseURL = Request.post(env.ubuspath, msg, options).then(function(res) {
+					return (rpcBaseURL = res.status == 200 ? env.ubuspath : rpcFallbackURL);
 				}, function() {
 					return (rpcBaseURL = rpcFallbackURL);
 				}).then(function(url) {
-- 
2.27.0



From rosenp at gmail.com  Mon Sep 14 17:34:29 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Mon, 14 Sep 2020 14:34:29 -0700
Subject: [PATCH] fs-cifs: remove old CONFIG option
Message-ID: <20200914213429.21319-1-rosenp@gmail.com>

0fdfef9aa7ee68ddd508aef7c98630cfc054f8d6 upstream removed this option.
Kernels 4.19 and above do not have it. Currently only kernels 4.19 and
5.4 are in the tree.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/kernel/linux/modules/fs.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk
index cfce929c0c..8ef06b7264 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -91,8 +91,7 @@ define KernelPackage/fs-cifs
 	CONFIG_CIFS \
 	CONFIG_CIFS_XATTR=y \
 	CONFIG_CIFS_DFS_UPCALL=n \
-	CONFIG_CIFS_UPCALL=n \
-	CONFIG_CIFS_SMB311=n
+	CONFIG_CIFS_UPCALL=n
   FILES:=$(LINUX_DIR)/fs/cifs/cifs.ko
   AUTOLOAD:=$(call AutoLoad,30,cifs)
   $(call AddDepends/nls)
-- 
2.26.2



From baptiste at bitsofnetworks.org  Mon Sep 14 18:27:50 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Tue, 15 Sep 2020 00:27:50 +0200
Subject: [PATCH] imagebuilder: add package signature verification
In-Reply-To: <20200826082455.82021-1-mail@aparcar.org>
References: <20200826082455.82021-1-mail@aparcar.org>
Message-ID: <20200914222750.GA911938@tuxmachine.localdomain>

Hi,

Thanks for the patch, it looks good but comments below:

On 25-08-20, Paul Spooren wrote:
> The ImageBuilder downloads pre-built packages and adds them to images.
> This process uses `opkg` which has the capability to verify package list
> signatures, as enabled per default on running OpenWrt devices.
>
> Until now this was disabled for ImageBuilders because neither the OPKG
> keys nor the `opkg-add` script was present during first packagelist
> update.
> 
> To harden the ImageBuilder against *drive-by-download-attacks* both keys
> and verification script are added to the ImageBuilder allowing OPKG to
> verify downloaded package indices.
> 
> This commit adds `opkg-add` to the IB scripts folder, as it is just a
> shell script. The keys folder is added to IBs TOPDIR to have an obvious
> place for users to store their own keys. The `option check_signature` is
> appended to the repositories.conf file.

With this patch, the imagebuilder gives an error while trying to fetch a
signature for the local package index:

    Downloading https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/Packages.gz
    Updated list of available packages in /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/openwrt_base
    Downloading https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/Packages.sig
    Signature check passed.
    Downloading file:packages/Packages
    Updated list of available packages in /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/imagebuilder
    Downloading file:packages/Packages.sig
    Signature file download failed.
    Remove wrong Signature file.
    Collected errors:
     * copy_file: packages/Packages.sig: No such file or directory.
     * file_copy: Failed to copy file packages/Packages.sig to /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/imagebuilder.sig.

However, it works fine in the end: I think packages coming from a local
repository are special-cased when it comes to verifying signature.

It's not possible to sign this package file, because it is generated
locally by the imagebuilder and we don't have access to any usign private
key.  Signing a locally-generated file doesn't make much sense anyway.
So, it probably needs to be fixed in opkg.

> All of the above only happens if the Buildbot runs with the
> SIGNED_PACKAGES option.

As far as I can tell, you don't actually rely on the package index
signatures that are generated on the host?  You are using the usign keys
from the openwrt-keyring package as well as the locally-generated build
key, both of which are enabled by SIGNED_PACKAGES.  This is far from
trivial and should be added to the commit message or as a comment.

I'm asking because my first idea was to depend on SIGNATURE_CHECK.  It
seems more logical but it's actually not relevant: SIGNATURE_CHECK enables
signature checking in the target device opkg configuration, so it's
completely unrelated to what should happen in the imagebuilder.

Baptiste
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/9a3d7a49/attachment.sig>

From rosenp at gmail.com  Mon Sep 14 21:33:35 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Mon, 14 Sep 2020 18:33:35 -0700
Subject: [PATCH 1/2] fs/cifs: update module dependencies
Message-ID: <20200915013336.678405-1-rosenp@gmail.com>

0fdfef9aa7ee68ddd508aef7c98630cfc054f8d6 upstream removed CIFS_SMB311.
Kernels 4.19 and above do not have it. Currently only kernels 4.19 and
5.4 are in the tree.

The Kconfig file in the kernel has more selection that what is in here.
Add the rest and reorder based on upstream ordering.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/kernel/linux/modules/fs.mk | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk
index cfce929c0c..abaf2d07fb 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -91,19 +91,22 @@ define KernelPackage/fs-cifs
 	CONFIG_CIFS \
 	CONFIG_CIFS_XATTR=y \
 	CONFIG_CIFS_DFS_UPCALL=n \
-	CONFIG_CIFS_UPCALL=n \
-	CONFIG_CIFS_SMB311=n
+	CONFIG_CIFS_UPCALL=n
   FILES:=$(LINUX_DIR)/fs/cifs/cifs.ko
   AUTOLOAD:=$(call AutoLoad,30,cifs)
   $(call AddDepends/nls)
   DEPENDS+= \
-    +kmod-crypto-arc4 \
-    +kmod-crypto-hmac \
-    +kmod-crypto-md5 \
     +kmod-crypto-md4 \
-    +kmod-crypto-des \
+    +kmod-crypto-md5 \
+    +kmod-crypto-sha256 \
+    +kmod-crypto-sha512 \
+    +kmod-crypto-cmac \
+    +kmod-crypto-hmac \
+    +kmod-crypto-arc4 \
+    +kmod-crypto-aead \
+    +kmod-crypto-ccm \
     +kmod-crypto-ecb \
-    +kmod-crypto-sha256
+    +kmod-crypto-des
 endef
 
 define KernelPackage/fs-cifs/description
-- 
2.26.2



From rosenp at gmail.com  Mon Sep 14 21:33:36 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Mon, 14 Sep 2020 18:33:36 -0700
Subject: [PATCH 2/2] target/linux: disable legacy and debug cifs options
In-Reply-To: <20200915013336.678405-1-rosenp@gmail.com>
References: <20200915013336.678405-1-rosenp@gmail.com>
Message-ID: <20200915013336.678405-2-rosenp@gmail.com>

CIFS_ALLOW_INSECURE_LEGACY is only relevant for mounting shares that
are provided by old CIFS servers. It is not relevant to the Samba or
ksmbd package that provide a server.

CIFS_STATS is a debugging option. It is not really useful for end users

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 target/linux/generic/config-4.19 | 4 ++--
 target/linux/generic/config-5.4  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19
index d4a942f9aa..e9c6306307 100644
--- a/target/linux/generic/config-4.19
+++ b/target/linux/generic/config-4.19
@@ -776,14 +776,14 @@ CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
 # CONFIG_CICADA_PHY is not set
 # CONFIG_CIFS is not set
 # CONFIG_CIFS_ACL is not set
-CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y
+# CONFIG_CIFS_ALLOW_INSECURE_LEGACY is not set
 # CONFIG_CIFS_DEBUG is not set
 # CONFIG_CIFS_DEBUG2 is not set
 # CONFIG_CIFS_FSCACHE is not set
 # CONFIG_CIFS_NFSD_EXPORT is not set
 CONFIG_CIFS_POSIX=y
 # CONFIG_CIFS_SMB2 is not set
-CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS is not set
 # CONFIG_CIFS_STATS2 is not set
 # CONFIG_CIFS_WEAK_PW_HASH is not set
 # CONFIG_CIFS_XATTR is not set
diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index 6f63b8c5dd..b8d214349c 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -826,14 +826,14 @@ CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
 # CONFIG_CICADA_PHY is not set
 # CONFIG_CIFS is not set
 # CONFIG_CIFS_ACL is not set
-CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y
+# CONFIG_CIFS_ALLOW_INSECURE_LEGACY is not set
 # CONFIG_CIFS_DEBUG is not set
 # CONFIG_CIFS_DEBUG2 is not set
 # CONFIG_CIFS_FSCACHE is not set
 # CONFIG_CIFS_NFSD_EXPORT is not set
 CONFIG_CIFS_POSIX=y
 # CONFIG_CIFS_SMB2 is not set
-CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS is not set
 # CONFIG_CIFS_STATS2 is not set
 # CONFIG_CIFS_WEAK_PW_HASH is not set
 # CONFIG_CIFS_XATTR is not set
-- 
2.26.2



From mail at aparcar.org  Mon Sep 14 22:28:23 2020
From: mail at aparcar.org (Paul Spooren)
Date: Mon, 14 Sep 2020 16:28:23 -1000
Subject: [PATCH] imagebuilder: add package signature verification
In-Reply-To: <20200914222750.GA911938@tuxmachine.localdomain>
Message-ID: <C5NL6X7WXBDD.1BE2TZ8HDPKYJ@dawn>

Hi,

On Mon Sep 14, 2020 at 12:27 PM HST, Baptiste Jonglez wrote:
> Hi,
>
> Thanks for the patch, it looks good but comments below:
>
> On 25-08-20, Paul Spooren wrote:
> > The ImageBuilder downloads pre-built packages and adds them to images.
> > This process uses `opkg` which has the capability to verify package list
> > signatures, as enabled per default on running OpenWrt devices.
> >
> > Until now this was disabled for ImageBuilders because neither the OPKG
> > keys nor the `opkg-add` script was present during first packagelist
> > update.
> > 
> > To harden the ImageBuilder against *drive-by-download-attacks* both keys
> > and verification script are added to the ImageBuilder allowing OPKG to
> > verify downloaded package indices.
> > 
> > This commit adds `opkg-add` to the IB scripts folder, as it is just a
> > shell script. The keys folder is added to IBs TOPDIR to have an obvious
> > place for users to store their own keys. The `option check_signature` is
> > appended to the repositories.conf file.
>
> With this patch, the imagebuilder gives an error while trying to fetch a
> signature for the local package index:
>
> Downloading
> https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/Packages.gz
> Updated list of available packages in
> /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/openwrt_base
> Downloading
> https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/Packages.sig
> Signature check passed.
> Downloading file:packages/Packages
> Updated list of available packages in
> /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/imagebuilder
> Downloading file:packages/Packages.sig
> Signature file download failed.
> Remove wrong Signature file.
> Collected errors:
> * copy_file: packages/Packages.sig: No such file or directory.
> * file_copy: Failed to copy file packages/Packages.sig to
> /tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/root-ath79/../../../../../tmp/openwrt-imagebuilder-ath79-generic.Linux-x86_64/dl/imagebuilder.sig.
>
> However, it works fine in the end: I think packages coming from a local
> repository are special-cased when it comes to verifying signature.

What do you think about the following patch disabling signature checks
for the local cache?

```diff
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index a329558..a6b5773 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -143,7 +143,7 @@ static int opkg_update_cmd(int argc, char **argv)
                }
                free(url);
 #if defined(HAVE_USIGN)
-               if (pkglist_dl_error == 0 && conf->check_signature) {
+               if (pkglist_dl_error == 0 && conf->check_signature && !strncmp("file:packages", src->value, 13)) {
                        /* download detached signitures to verify the package lists */
                        /* get the url for the sig file */
                        if (src->extra_data)    /* debian style? */
```

>
> It's not possible to sign this package file, because it is generated
> locally by the imagebuilder and we don't have access to any usign
> private
> key. Signing a locally-generated file doesn't make much sense anyway.
> So, it probably needs to be fixed in opkg.
>
> > All of the above only happens if the Buildbot runs with the
> > SIGNED_PACKAGES option.
>
> As far as I can tell, you don't actually rely on the package index
> signatures that are generated on the host? You are using the usign keys
> from the openwrt-keyring package as well as the locally-generated build
> key, both of which are enabled by SIGNED_PACKAGES. This is far from
> trivial and should be added to the commit message or as a comment.

True, it's not trivial and should be included in the commit message.
Sidenote, these keys are included in every image as well.

>
> I'm asking because my first idea was to depend on SIGNATURE_CHECK. It
> seems more logical but it's actually not relevant: SIGNATURE_CHECK
> enables
> signature checking in the target device opkg configuration, so it's
> completely unrelated to what should happen in the imagebuilder.
>

Paul



From daniel at gsat.us  Tue Sep 15 02:23:28 2020
From: daniel at gsat.us (Daniel Santos)
Date: Tue, 15 Sep 2020 01:23:28 -0500
Subject: Any interest in Golang patchset for better ARCH flags?
Message-ID: <f7202f90-bc47-7631-ff41-ed26aefbe853@gsat.us>

Hello Jeffery,

Thank you for the wonderful work on maintaining the Go packages!

I got a little irritated at CGo's restriction of arch flags (in the
immutable GOGCCFLAGS variable) and put together a patch set for v19.07
to override them with an environment variable and then (optionally) feed
the machine flags in the Golang build.? In the OpenWRT repo, I did this
by splitting out how DEFAULT_CFLAGS are put together in order to
populate a DEFAULT_MACHINE_FLAGS, but it could probably be done with
just a $(filter -m%,$(DEFAULT_CFLAGS)) instead.

If you or others have any interest in this, I can clean them up for the
master branch.? I'm probably going to submit the Golang patch upstream,
since I don't see any good reason for such a restriction.? I see you've
made a lot of changes on the HEAD.

Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Goloang-Add-customizable-ARCH-flags-via-CGO_MACHINE_.patch
Type: text/x-patch
Size: 3484 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/b2d42d6e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-MACHINE_FLAGS-for-use-by-Golang.patch
Type: text/x-patch
Size: 4558 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/b2d42d6e/attachment-0001.bin>

From zajec5 at gmail.com  Tue Sep 15 02:45:12 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Tue, 15 Sep 2020 08:45:12 +0200
Subject: [PATCH V3 uhttpd] ubus: add new RESTful API
In-Reply-To: <20200914151523.4757-1-zajec5@gmail.com>
References: <20200914151523.4757-1-zajec5@gmail.com>
Message-ID: <1685cbed-4417-1c1d-a1dd-ad28a9ca0c59@gmail.com>

On 14.09.2020 17:15, Rafa? Mi?ecki wrote:
> +static void uh_ubus_handle_post(struct client *cl)
> +{
> +	static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
> +		[HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
> +	};
> +	struct dispatch_ubus *du = &cl->dispatch.ubus;
> +	struct blob_attr *tb[__HDR_UBUS_MAX];
> +	const char *url = du->url_path;
> +	const char *auth;
> +
> +	if (!strcmp(url, conf.ubus_prefix) ||
> +	    (url[strlen(url) - 1] == '/' && !strncmp(url, conf.ubus_prefix, strlen(url) - 1))) {

I think above may result in false positives for
ubus_prefix: /ubus/
url: /ub/

That should be:
if (ops->path_match(conf.ubus_prefix, url) && strlen(url) - strlen(conf.ubus_prefix) <= 1) {


From baptiste at bitsofnetworks.org  Tue Sep 15 02:49:51 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Tue, 15 Sep 2020 08:49:51 +0200
Subject: HTTPS performance issue with opkg (Was: [PATCH 3/3] build: switch
 VERSION_REPO to HTTPS)
In-Reply-To: <20200827214708.915775-3-mail@aparcar.org>
References: <20200827214708.915775-1-mail@aparcar.org>
 <20200827214708.915775-3-mail@aparcar.org>
Message-ID: <20200915064951.GA916710@tuxmachine.localdomain>

On 27-08-20, Paul Spooren wrote:
> The variable VERSION_REPO is used by opkg to download package(list)s.
> Now that the default installation support encrypted HTTP opkg should
> make use of it.

I wonder what is the performance impact of this?  Opkg forks a new wget
process to download each package, so the HTTPS connection is never reused.

Running a simple "time make image
PROFILE=mikrotik_routerboard-921gs-5hpacd-15s" with the ath79/mikrotik
imagebuilder results in a 50% increase of running time:

- with HTTPS: 32 seconds
- with HTTP: 22 seconds

(timing for the second run is shown, and dl/ is cleaned up before each run)

The overhead might be even more significant on a device, and the download
server probably sees more load from the large number of key exchange.
Anybody got any figures?

With HTTPS, opkg would really need connection reuse.  I don't think the
current situation is acceptable for a stable release, if only to avoid
high load on the download server.

Baptiste

> Suggested-by: Petr ?tetiar <ynezz at true.cz>
> Suggested-by: Baptiste Jonglez <baptiste at bitsofnetworks.org>
> Signed-off-by: Paul Spooren <mail at aparcar.org>
> ---
>  include/version.mk                 | 2 +-
>  package/base-files/image-config.in | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/version.mk b/include/version.mk
> index 7d3c1ad640..b7f42e13bb 100644
> --- a/include/version.mk
> +++ b/include/version.mk
> @@ -32,7 +32,7 @@ VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
>  VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
>  
>  VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
> -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
> +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
>  
>  VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
>  VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
> diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
> index 4bace77db0..bfa3055cc8 100644
> --- a/package/base-files/image-config.in
> +++ b/package/base-files/image-config.in
> @@ -183,7 +183,7 @@ if VERSIONOPT
>  	config VERSION_REPO
>  		string
>  		prompt "Release repository"
> -		default "http://downloads.openwrt.org/snapshots"
> +		default "https://downloads.openwrt.org/snapshots"
>  		help
>  			This is the repository address embedded in the image, it defaults
>  			to the trunk snapshot repo; the url may contain the following placeholders:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/3aee2907/attachment.sig>

From zajec5 at gmail.com  Tue Sep 15 03:15:51 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Tue, 15 Sep 2020 09:15:51 +0200
Subject: [PATCH PROOF luci] luci-base: switch to the new ubus API
Message-ID: <20200915071551.7716-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

This is proof of concept for the new uhttpd ubus API. It switches LuCI
(in a bit hacky way) to the new API.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../htdocs/luci-static/resources/luci.js      |  5 +++
 .../htdocs/luci-static/resources/rpc.js       | 31 +++++--------------
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index e285f999e..9d2c52d77 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -739,11 +739,13 @@
 				if (!opt.cache)
 					opt.url += ((/\?/).test(opt.url) ? '&' : '?') + (new Date()).getTime();
 
+/*
 				if (isQueueableRequest(opt)) {
 					requestQueue.push([opt, rejectFn, resolveFn]);
 					requestAnimationFrame(flushRequestQueue);
 					return;
 				}
+*/
 
 				if ('username' in opt && 'password' in opt)
 					opt.xhr.open(opt.method, opt.url, true, opt.username, opt.password);
@@ -758,6 +760,9 @@
 				if ('timeout' in opt)
 					opt.xhr.timeout = +opt.timeout;
 
+				if ('authorization' in opt)
+					opt.xhr.setRequestHeader('Authorization', 'Bearer %s'.format(opt.authorization));
+
 				if ('credentials' in opt)
 					opt.xhr.withCredentials = !!opt.credentials;
 
diff --git a/modules/luci-base/htdocs/luci-static/resources/rpc.js b/modules/luci-base/htdocs/luci-static/resources/rpc.js
index 7bfc91336..5d9569d87 100644
--- a/modules/luci-base/htdocs/luci-static/resources/rpc.js
+++ b/modules/luci-base/htdocs/luci-static/resources/rpc.js
@@ -18,8 +18,8 @@ var rpcRequestID = 1,
  */
 return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
 	/* privates */
-	call: function(req, cb, nobatch) {
-		var q = '';
+	call: function(object, req, cb) {
+		var q = 'call/%s'.format(object);
 
 		if (Array.isArray(req)) {
 			if (req.length == 0)
@@ -33,13 +33,10 @@ return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
 						req[i].params[2]
 					);
 		}
-		else if (req.params) {
-			q += '/%s.%s'.format(req.params[1], req.params[2]);
-		}
 
 		return request.post(rpcBaseURL + q, req, {
 			timeout: (L.env.rpctimeout || 20) * 1000,
-			nobatch: nobatch,
+			authorization: rpcSessionID,
 			credentials: true
 		}).then(cb, cb);
 	},
@@ -89,16 +86,7 @@ return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
 			return req.reject(e);
 		}
 
-		if (!req.object && !req.method) {
-			ret = msg.result;
-		}
-		else if (Array.isArray(msg.result)) {
-			if (req.raise && msg.result[0] !== 0)
-				L.raise('RPCError', 'RPC call to %s/%s failed with ubus code %d: %s',
-					req.object, req.method, msg.result[0], this.getStatusText(msg.result[0]));
-
-			ret = (msg.result.length > 1) ? msg.result[1] : msg.result[0];
-		}
+		ret = msg.result;
 
 		if (req.expect) {
 			for (var key in req.expect) {
@@ -332,17 +320,12 @@ return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
 				var msg = {
 					jsonrpc: '2.0',
 					id:      rpcRequestID++,
-					method:  'call',
-					params:  [
-						rpcSessionID,
-						options.object,
-						options.method,
-						params
-					]
+					method:  options.method,
+					params:  params
 				};
 
 				/* call rpc */
-				rpc.call(msg, rpc.parseCallReply.bind(rpc, req), options.nobatch);
+				rpc.call(options.object, msg, rpc.parseCallReply.bind(rpc, req));
 			});
 		}, this, this, options);
 	},
-- 
2.27.0



From daniel at makrotopia.org  Tue Sep 15 04:23:50 2020
From: daniel at makrotopia.org (Daniel Golle)
Date: Tue, 15 Sep 2020 09:23:50 +0100
Subject: HTTPS performance issue with opkg (Was: [PATCH 3/3] build:
 switch VERSION_REPO to HTTPS)
In-Reply-To: <20200915064951.GA916710@tuxmachine.localdomain>
References: <20200827214708.915775-1-mail@aparcar.org>
 <20200827214708.915775-3-mail@aparcar.org>
 <20200915064951.GA916710@tuxmachine.localdomain>
Message-ID: <20200915082350.GA1322@makrotopia.org>

On Tue, Sep 15, 2020 at 08:49:51AM +0200, Baptiste Jonglez wrote:
> On 27-08-20, Paul Spooren wrote:
> > The variable VERSION_REPO is used by opkg to download package(list)s.
> > Now that the default installation support encrypted HTTP opkg should
> > make use of it.
> 
> I wonder what is the performance impact of this?  Opkg forks a new wget
> process to download each package, so the HTTPS connection is never reused.
> 
> Running a simple "time make image
> PROFILE=mikrotik_routerboard-921gs-5hpacd-15s" with the ath79/mikrotik
> imagebuilder results in a 50% increase of running time:
> 
> - with HTTPS: 32 seconds
> - with HTTP: 22 seconds
> 
> (timing for the second run is shown, and dl/ is cleaned up before each run)
> 
> The overhead might be even more significant on a device, and the download
> server probably sees more load from the large number of key exchange.
> Anybody got any figures?
> 
> With HTTPS, opkg would really need connection reuse.  I don't think the
> current situation is acceptable for a stable release, if only to avoid
> high load on the download server.

I suggest to revert that change as HTTPS doesn't do us a favour here.
It prevents Web-Caches (squid and such), hurts performance and
integrity should (at least now) anyway be ensured by SHA256 of the
package contained in the ed25519 signed package list.
In my opinion HTTPS even gives users a false sense of security, as it
is up to a few hundred certification authorities to not compromise
rather than just to a few keys shipped with OpenWrt.
Plus the the complexity of the handshake, large choice of ciphers
(rather than pinning SHA256 + ed25519), ...
Even major distributions like Debian and ArchLinux make HTTPS optional
and opt-in for their package download servers.
Imho the disadvantages clearly outweight the benifits here.


> 
> Baptiste
> 
> > Suggested-by: Petr ?tetiar <ynezz at true.cz>
> > Suggested-by: Baptiste Jonglez <baptiste at bitsofnetworks.org>
> > Signed-off-by: Paul Spooren <mail at aparcar.org>
> > ---
> >  include/version.mk                 | 2 +-
> >  package/base-files/image-config.in | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/version.mk b/include/version.mk
> > index 7d3c1ad640..b7f42e13bb 100644
> > --- a/include/version.mk
> > +++ b/include/version.mk
> > @@ -32,7 +32,7 @@ VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
> >  VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
> >  
> >  VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
> > -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
> > +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
> >  
> >  VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
> >  VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
> > diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
> > index 4bace77db0..bfa3055cc8 100644
> > --- a/package/base-files/image-config.in
> > +++ b/package/base-files/image-config.in
> > @@ -183,7 +183,7 @@ if VERSIONOPT
> >  	config VERSION_REPO
> >  		string
> >  		prompt "Release repository"
> > -		default "http://downloads.openwrt.org/snapshots"
> > +		default "https://downloads.openwrt.org/snapshots"
> >  		help
> >  			This is the repository address embedded in the image, it defaults
> >  			to the trunk snapshot repo; the url may contain the following placeholders:



> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From zajec5 at gmail.com  Tue Sep 15 04:37:09 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Tue, 15 Sep 2020 10:37:09 +0200
Subject: [PATCH luci] luci-base: use actual JSON-RPC for verifying ubus
 RPC URL
In-Reply-To: <20200914163107.27739-1-zajec5@gmail.com>
References: <20200914163107.27739-1-zajec5@gmail.com>
Message-ID: <7fb620b7-d818-14a8-cb28-c4f9a4fcfe1b@gmail.com>

On 14.09.2020 18:31, Rafa? Mi?ecki wrote:
> @@ -2553,10 +2553,19 @@
>   				rpcBaseURL = Session.getLocalData('rpcBaseURL');
>   
>   			if (rpcBaseURL == null) {
> +				var msg = {
> +					jsonrpc: '2.0',
> +					id:      'init',
> +					method:  'list',
> +					params:  undefined
> +				};
> +				var options = {
> +					nobatch: true
> +				};
>   				var rpcFallbackURL = this.url('admin/ubus');
>   
> -				rpcBaseURL = Request.get(env.ubuspath).then(function(res) {
> -					return (rpcBaseURL = (res.status == 400) ? env.ubuspath : rpcFallbackURL);
> +				rpcBaseURL = Request.post(env.ubuspath, msg, options).then(function(res) {
> +					return (rpcBaseURL = res.status == 200 ? env.ubuspath : rpcFallbackURL);

Pushing with "options" variable object inlined.


From mail at aparcar.org  Tue Sep 15 05:18:04 2020
From: mail at aparcar.org (Paul Spooren)
Date: Mon, 14 Sep 2020 23:18:04 -1000
Subject: HTTPS performance issue with opkg (Was: [PATCH 3/3] build:
 switch VERSION_REPO to HTTPS)
In-Reply-To: <20200915082350.GA1322@makrotopia.org>
Message-ID: <C5NTWLYVI5EQ.21U7CS2R3I7UC@dawn>

On Mon Sep 14, 2020 at 10:23 PM HST, Daniel Golle wrote:
> On Tue, Sep 15, 2020 at 08:49:51AM +0200, Baptiste Jonglez wrote:
> > On 27-08-20, Paul Spooren wrote:
> > > The variable VERSION_REPO is used by opkg to download package(list)s.
> > > Now that the default installation support encrypted HTTP opkg should
> > > make use of it.
> > 
> > I wonder what is the performance impact of this?  Opkg forks a new wget
> > process to download each package, so the HTTPS connection is never reused.
> > 
> > Running a simple "time make image
> > PROFILE=mikrotik_routerboard-921gs-5hpacd-15s" with the ath79/mikrotik
> > imagebuilder results in a 50% increase of running time:
> > 
> > - with HTTPS: 32 seconds
> > - with HTTP: 22 seconds
> > 
> > (timing for the second run is shown, and dl/ is cleaned up before each run)
> > 
> > The overhead might be even more significant on a device, and the download
> > server probably sees more load from the large number of key exchange.
> > Anybody got any figures?
> > 
> > With HTTPS, opkg would really need connection reuse.  I don't think the
> > current situation is acceptable for a stable release, if only to avoid
> > high load on the download server.
>
> I suggest to revert that change as HTTPS doesn't do us a favour here.
> It prevents Web-Caches (squid and such), hurts performance and
> integrity should (at least now) anyway be ensured by SHA256 of the
> package contained in the ed25519 signed package list.
> In my opinion HTTPS even gives users a false sense of security, as it
> is up to a few hundred certification authorities to not compromise
> rather than just to a few keys shipped with OpenWrt.
> Plus the the complexity of the handshake, large choice of ciphers
> (rather than pinning SHA256 + ed25519), ...
> Even major distributions like Debian and ArchLinux make HTTPS optional
> and opt-in for their package download servers.
> Imho the disadvantages clearly outweight the benifits here.

I see some advantage in not sharing what packages (incl. versions) are
installed in images or running machines, however that maybe doesn't
outweighs the issues stated above.

Removing HTTPS right now means insecure package installations in
ImageBuilder created images, I suggest to avoid that.

Enabling signature checks right now in ImageBuilder doesn't work because
the local folder packages/ contains kmods, kernel and libc which are
required for image creation. This folder is dynamically put together on
ImageBuilder creation and the index is created during ImageBuilder
runtime locally, meaning no signatures are available.

My initial idea (mocked in a very poor patch) was to disable signature
checking for the special case "file:packages". Given a second thought a
per feed option could be used for those special cases, like
"src/trusted" instead of "src". Adding signature check exceptions is
however bad, therefore I'd like to suggest a third solution:

Instead of shipping the ImageBuilder with the packages/ folder
(containing kmods etc.) another (signed) feed should be added to the
ImageBuilders repositories.conf, similar to what's already added to
snapshot images:

src/gz openwrt_kmods http://downloads.openwrt.org/snapshots/targets/armvirt/64/kmods/5.4.65-1-397bac86dd45c4d97d5f09fd9def9671/

This folder contains all available kmods. The special packages `kernel`
and `libc` should be added there, which requires a little buildbot
patch.

Instead of installing the local available kernel_*.ipk[1] the kernel and
libc revision could be hardcoded, something which is already done for
e.g. the revision[2] in ImageBuilder and SDK.

In combination this allows smaller ImageBuilders only using remote
packages which are all signed.

When choosing to have a standalone ImageBuilder with all packages
available locally (CONFIG_IB_STANDALONE) then all feeds except the
packages/ folder are disabled, meaning the `option check_signature` can
be disabled independently of `CONFIG_SIGNED_PACKAGES`.

If this seems a feasible approach I'd submit the patches for Buildbot
and ImageBuilder.

[1]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/imagebuilder/files/Makefile;h=27d3cfa8dfd5e5b7de0465db2ebff277e2040a14;hb=HEAD#l156
[2]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/imagebuilder/Makefile;h=ad19ab2b53ffd08d91ffb86817e54fdb31279660;hb=HEAD#l79


>
>
> > 
> > Baptiste
> > 
> > > Suggested-by: Petr ?tetiar <ynezz at true.cz>
> > > Suggested-by: Baptiste Jonglez <baptiste at bitsofnetworks.org>
> > > Signed-off-by: Paul Spooren <mail at aparcar.org>
> > > ---
> > >  include/version.mk                 | 2 +-
> > >  package/base-files/image-config.in | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/version.mk b/include/version.mk
> > > index 7d3c1ad640..b7f42e13bb 100644
> > > --- a/include/version.mk
> > > +++ b/include/version.mk
> > > @@ -32,7 +32,7 @@ VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
> > >  VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
> > >  
> > >  VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
> > > -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
> > > +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
> > >  
> > >  VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
> > >  VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
> > > diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
> > > index 4bace77db0..bfa3055cc8 100644
> > > --- a/package/base-files/image-config.in
> > > +++ b/package/base-files/image-config.in
> > > @@ -183,7 +183,7 @@ if VERSIONOPT
> > >  	config VERSION_REPO
> > >  		string
> > >  		prompt "Release repository"
> > > -		default "http://downloads.openwrt.org/snapshots"
> > > +		default "https://downloads.openwrt.org/snapshots"
> > >  		help
> > >  			This is the repository address embedded in the image, it defaults
> > >  			to the trunk snapshot repo; the url may contain the following placeholders:
>
>
>
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From mail at adrianschmutzler.de  Tue Sep 15 07:28:23 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Tue, 15 Sep 2020 13:28:23 +0200
Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
In-Reply-To: <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
Message-ID: <010d01d68b53$530792c0$f916b840$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Christian Lamparter
> Sent: Samstag, 12. September 2020 23:16
> To: openwrt-devel at lists.openwrt.org
> Cc: rafal at milecki.pl; hauke at hauke-m.de; f.fainelli at gmail.com;
> chrisrblake93 at gmail.com; Adrian Schmutzler <mail at adrianschmutzler.de>
> Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
> 
> The BCM5301x SoCs do have i2c. Since this is only being used by the Meraki
> MR32, this will be packaged as a module.
> 
> Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
> ---
>  package/kernel/linux/modules/i2c.mk | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/package/kernel/linux/modules/i2c.mk
> b/package/kernel/linux/modules/i2c.mk
> index ca6463c81b..1c8b1b844e 100644
> --- a/package/kernel/linux/modules/i2c.mk
> +++ b/package/kernel/linux/modules/i2c.mk
> @@ -259,3 +259,17 @@ endef
>  $(eval $(call KernelPackage,i2c-tiny-usb))
> 
> 
> +I2C_BCM_IPROC_MODULES:= \
> +  CONFIG_I2C_BCM_IPROC:drivers/i2c/busses/i2c-bcm-iproc
> +
> +define KernelPackage/i2c-bcm-iproc
> +  $(call i2c_defaults,$(I2C_BCM_IPROC_MODULES),59)
> +  TITLE:=Broadcom iProc I2C controller
> +  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core endef

More a question than a remark:

I always wonder whether stuff like this (depending on a single target) belongs into package/kernel/linux/modules/... or into target/linux/bcm53xx/modules.mk

Is there a general rule or is this mostly depending on circumstances/taste?

Best

Adrian

> +
> +define KernelPackage/i2c-bcm-iproc/description
> + Kernel module for the Broadcom iProc I2C controller.
> +endef
> +
> +$(eval $(call KernelPackage,i2c-bcm-iproc))
> --
> 2.28.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/9f7b5f16/attachment.sig>

From mail at adrianschmutzler.de  Tue Sep 15 07:35:04 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Tue, 15 Sep 2020 13:35:04 +0200
Subject: [PATCH v3 7/8] bcm53xx: add Cisco Meraki MR32
In-Reply-To: <64ed9aa6d1d8db2567778f8f8eabea454455c593.1599945264.git.chunkeey@gmail.com>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
 <64ed9aa6d1d8db2567778f8f8eabea454455c593.1599945264.git.chunkeey@gmail.com>
Message-ID: <011801d68b54$417504b0$c45f0e10$@adrianschmutzler.de>

Hi,

> --- a/target/linux/bcm53xx/image/Makefile
> +++ b/target/linux/bcm53xx/image/Makefile
> @@ -320,6 +320,33 @@ define Device/luxul_xwr-3150  endef
> TARGET_DEVICES += luxul_xwr-3150
> 
> +define Device/meraki_mr32
> +  DEVICE_VENODR := Meraki
> +  DEVICE_MODEL := MR32
> +  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-
> eeprom-at24 \
> +	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-

kmod-hwmon-core gets selected by kmod-hwmon-ina2xx now (since [1]), so technically it could be removed here.
But this isn't really important, just FYI if you touch the stuff again anyway...

[1] https://github.com/openwrt/openwrt/commit/4159054fbbf8a7176eaf3dd4467c5b0db70769d0

Best

Adrian 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200915/4024575b/attachment-0001.sig>

From daniel at makrotopia.org  Tue Sep 15 07:47:31 2020
From: daniel at makrotopia.org (Daniel Golle)
Date: Tue, 15 Sep 2020 12:47:31 +0100
Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
In-Reply-To: <010d01d68b53$530792c0$f916b840$@adrianschmutzler.de>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
 <010d01d68b53$530792c0$f916b840$@adrianschmutzler.de>
Message-ID: <20200915114731.GA2239@makrotopia.org>

On Tue, Sep 15, 2020 at 01:28:23PM +0200, Adrian Schmutzler wrote:
> Hi,
> 
> > -----Original Message-----
> > From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> > On Behalf Of Christian Lamparter
> > Sent: Samstag, 12. September 2020 23:16
> > To: openwrt-devel at lists.openwrt.org
> > Cc: rafal at milecki.pl; hauke at hauke-m.de; f.fainelli at gmail.com;
> > chrisrblake93 at gmail.com; Adrian Schmutzler <mail at adrianschmutzler.de>
> > Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
> > 
> > The BCM5301x SoCs do have i2c. Since this is only being used by the Meraki
> > MR32, this will be packaged as a module.
> > 
> > Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
> > ---
> >  package/kernel/linux/modules/i2c.mk | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/package/kernel/linux/modules/i2c.mk
> > b/package/kernel/linux/modules/i2c.mk
> > index ca6463c81b..1c8b1b844e 100644
> > --- a/package/kernel/linux/modules/i2c.mk
> > +++ b/package/kernel/linux/modules/i2c.mk
> > @@ -259,3 +259,17 @@ endef
> >  $(eval $(call KernelPackage,i2c-tiny-usb))
> > 
> > 
> > +I2C_BCM_IPROC_MODULES:= \
> > +  CONFIG_I2C_BCM_IPROC:drivers/i2c/busses/i2c-bcm-iproc
> > +
> > +define KernelPackage/i2c-bcm-iproc
> > +  $(call i2c_defaults,$(I2C_BCM_IPROC_MODULES),59)
> > +  TITLE:=Broadcom iProc I2C controller
> > +  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core endef
> 
> More a question than a remark:
> 
> I always wonder whether stuff like this (depending on a single target) belongs into package/kernel/linux/modules/... or into target/linux/bcm53xx/modules.mk
> 
> Is there a general rule or is this mostly depending on circumstances/taste?

I'd say in a case like that (DEPENDS:=@TARGET_bcm53xx) it should go to
target/linux/bcm53xx/modules.mk. However, another idea of that can be
to list in-tree modules in package/kernel/linux/modules/... and target-
specific out-of-tree modules in target/linux/*/modules.mk.
I don't think we got a clear policy regarding that.

> 
> Best
> 
> Adrian
> 
> > +
> > +define KernelPackage/i2c-bcm-iproc/description
> > + Kernel module for the Broadcom iProc I2C controller.
> > +endef
> > +
> > +$(eval $(call KernelPackage,i2c-bcm-iproc))
> > --
> > 2.28.0
> > 
> > 
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel



> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From jeffery.to at gmail.com  Tue Sep 15 07:58:36 2020
From: jeffery.to at gmail.com (Jeffery To)
Date: Tue, 15 Sep 2020 19:58:36 +0800
Subject: No subject
In-Reply-To: <mailman.5006.1600151018.1274.openwrt-devel@lists.openwrt.org>
References: <mailman.5006.1600151018.1274.openwrt-devel@lists.openwrt.org>
Message-ID: <CAJXyS=gzDv3GLBd96qf79rUixhsMxHK_Q-EaHbAF7rcrypwH7w@mail.gmail.com>

Hi Daniel,

(Resending due to HTML email being rejected...)

On Tue, Sep 15, 2020 at 2:26 PM Daniel Santos via openwrt-devel
<openwrt-devel at lists.openwrt.org> wrote:
> Thank you for the wonderful work on maintaining the Go packages!

You're welcome :-)

> I got a little irritated at CGo's restriction of arch flags (in the
> immutable GOGCCFLAGS variable) and put together a patch set for v19.07
> to override them with an environment variable and then (optionally) feed
> the machine flags in the Golang build.  In the OpenWRT repo, I did this
> by splitting out how DEFAULT_CFLAGS are put together in order to
> populate a DEFAULT_MACHINE_FLAGS, but it could probably be done with
> just a $(filter -m%,$(DEFAULT_CFLAGS)) instead.
>
> If you or others have any interest in this, I can clean them up for the
> master branch.  I'm probably going to submit the Golang patch upstream,
> since I don't see any good reason for such a restriction.  I see you've
> made a lot of changes on the HEAD.

I can't speak for the main OpenWrt repo changes, but I would prefer to
have the Go compiler patch accepted upstream first. They may have
certain assumptions/dependencies on the arch flags that I'm not aware
of.

Jeff


From tomek_n at o2.pl  Tue Sep 15 10:50:26 2020
From: tomek_n at o2.pl (Tomasz Maciej Nowak)
Date: Tue, 15 Sep 2020 16:50:26 +0200
Subject: [PATCH v2 1/2] ipq40xx: add support for Luma Home WRTQ-329ACN
In-Reply-To: <4c344f4a-45e6-6042-fa90-40301a683683@gmail.com>
References: <20200830112811.6175-1-tomek_n@o2.pl>
 <4c344f4a-45e6-6042-fa90-40301a683683@gmail.com>
Message-ID: <b4e06e91-0c62-00a5-7e76-e799ee430098@o2.pl>

Hi Christian, thanks for looking at this.

W dniu 13.09.2020 o?00:04, Christian Lamparter pisze:
> On 2020-08-30 13:28, Tomasz Maciej Nowak wrote:
>> Luma Home WRTQ-329ACN, also known as Luma WiFi System, is a dual-band
>> wireless access point.
>>
>> Specification
>> SoC: Qualcomm Atheros IPQ4018
>> RAM: 256 MB DDR3
>> Flash: 2 MB SPI NOR
>> ??????? 128 MB SPI NAND
>> WIFI: 2.4 GHz 2T2R integrated
>> ?????? 5 GHz 2T2R integrated
>> Ethernet: 2x 10/100/1000 Mbps QCA8075
>> USB: 1x 2.0
>> Bluetooth: 1x 4.0 CSR8510 A10, connected to USB bus
>> LEDS: 16x multicolor LEDs ring, controlled by MSP430G2403 MCU
>> Buttons: 1x GPIO controlled
>> EEPROM: 16 Kbit, compatible with AT24C16
>> UART: row of 4 holes marked on PCB as J19, starting count from the side
>> ?????? of J19 marking on PCB
>> ?????? 1. GND, 2. RX, 3. TX, 4. 3.3V
>> ?????? baud: 115200, parity: none, flow control: none
>>
>> The device supports OTA or USB flash drive updates, unfotunately they
>> are signed. Until the signing key is known, the UART access is mandatory
>> for installation. The difficult part is disassembling the casing, there
>> are a lot of latches holding it together.
>>
>> Teardown
>> Prepare three thin, but sturdy, prying tools. Place the device with back
>> of it facing upwards. Start with the wall having a small notch. Insert
>> first tool, until You'll feel resistance and keep it there. Repeat the
>> procedure for neighbouring walls. With applying a pressure, one edge of
>> the back cover should pop up. Now carefully slide one of the tools to
>> free the rest of the latches.
>> There's no need to solder pins to the UART holes, You can use hook clips,
>> but wiring them outside the casing, will ease debuging and recovery if
>> problems occur.
>>
>> Installation
>> 1. Prepare TFTP server with OpenWrt initramfs image.
>> 2. Connect to UART port (don't connect the voltage pin).
>> 3. Connect to LAN port.
>> 4. Power on the device, carefully observe the console output and when
>> ??? asked quickly enter the failsafe mode.
>> 5. Invoke 'mount_root'.
>> 6. After the overlayfs is mounted run:
>> ????? fw_setenv bootdelay 3
>> ??? This will allow to access U-Boot shell.
>> 7. Reboot the device and when prompted to stop autoboot, hit any key.
>> 8. Adjust "ipaddr" and "serverip" addresses in U-Boot environment, use
>> ??? 'setenv' to do that, then run following commands:
>> ????? tftpboot 0x84000000 <openwrt_initramfs_image_name>
>> ????? bootm 0x84000000
>> ??? and wait till OpenWrt boots.
>> 9. In OpenWrt command line run following commands:
>> ????? fw_setenv openwrt "setenv mtdids nand1=spi_nand; setenv mtdparts mtdparts=spi_nand:-(ubi); ubi part ubi; ubi read 0x84000000 kernel1; bootm 0x84000000"
>> ????? fw_setenv bootcmd "run openwrt"
> So, because you install from the initramfs and introduced a custom run
> command with a custom "kernel1" ubi volume... It might be possible to
> cut the extra parts in the sysupgrade and bootargs and unify it with
> the generic nand_do_upgrade() crowed.
> 
> I've incorperated what maybe could be done in this patch on my
> staging tree: [0]
> 
> (Note the changes in step 9 (kernel1->kernel), step 10 (ubirmvol ubi_rootfs1 & kernel1) and the "step 2 in
> back to OEM".
> 
> The idea is that we use OpenWrt's existing automount for ubi
> and "rootfs" volumes.
> 
> (In theory this could make the "back to OEM" even easier.
> Because if it works the way I think it does, we could drop
> the ubirmvol of ubi_rootfs1 and kernel1 in step 10 of my version.
> Next, it should be possible to drop the ubimkvol of
> kernel1 and ubi_rootfs1 step 2 in the "Reverting to OEM" section.
> This is because the original rootfs1 and kernel1 still exist and
> are left untouched - no idea if this works out or not.)

Personally I would like to use whole NAND for OpenWrt, that would simplify everything a lot.
Unfortunately some users might be dissatisfied with how things are done in OpenWrt and wish
to revert to stock firmware. I'll explain in points what are the current issues with this
device. My knowledge is based on what I could dig out from firmware (QSDK) without access to
source modifications.

1. The devices have different flash layouts, some come with
mtd8: 08000000 00020000 "rootfs"
mtd9: 0041e000 0001f000 "kernel"
mtd10: 026c0000 0001f000 "ubi_rootfs"
mtd11: 01ff8000 0001f000 "rootfs_data"
mtd12: 0041e000 0001f000 "kernel1"
mtd13: 026c0000 0001f000 "ubi_rootfs1"

and some

mtd8: 08000000 00020000 "rootfs"
mtd9: 003a2000 0001f000 "kernel"
mtd10: 02283000 0001f000 "ubi_rootfs"
mtd11: 0062d000 0001f000 "dummy"
mtd12: 01ff8000 0001f000 "rootfs_data"
mtd13: 0041e000 0001f000 "kernel1"
mtd14: 026c0000 0001f000 "ubi_rootfs1"

this reflects the bootargs in dts.

2. As illustrated above, the device comes with two sets of kernel+ubi_rootfs and shared
overlay "rootfs_data". The U-Boot with 'bootipq' command boots the first kernel+ubi_rootfs
pair. There is some kind of fallback mechanism to issue boot from the second pair, but I was
unable to trigger it (didn't try hammer approach by deleting first kernel+ubi_rootfs set).

3. On each reboot the 'bootipq' command rewrites some of U-Boot environments variables to
default state. I don't know every one of them and that makes this not a stable environment,
which could overwrite our changes. Also this increases flash wear (it's NOR, I know, but still).
That's why I decided to introduce custom 'bootcmd'.

4. The stock firmware likes to fiddle with U-Boot environment from userspace. I could miss
some case of it and users who reverted to stock firmware (which would need custom 'bootcmd'
if we went with Your changes) could end up with OpenWrt booted after reboot (in best case)
or in U-Boot shell. Explaining what to do, would include non-trivial tasks for average user.
This is why I decided to write OpenWrt firmware to kernel1+ubi_rootfs1 set.

5. What we have stored in flash is all we've got in terms of OEM firmware. There is no
downloadable image (I know of) we could use to flash the device with, in case no backup is
made and all partitions are wiped.
Given that, I decided to go for reverting to OEM setup, as close as possible, so self-heal
implemented in stock firmware won't be confused.

> 
> Note: I've squashed both of your patches into one.

ACK

> 
> Note2: You don't mention it in your commit. But I'm seeing that you are
> using GPIO OPEN_DRAIN for the bitbanged i2c. So, don't you also need
> Brain's pinctrl patch that wires up OPEN_DRAIN for this? [1]

I went with suggestion in [3], but even setting to GPIO_ACTIVE_HIGH is enough. I tested
this with and without Brian's patch. Should I send v3 without GPIO_OPEN_DRAIN?

> 
> Currently, I've added it to the staging tree too (see the parent patch [2]).
> If you haven't heard of this patch before, please also give it a quick
> spin and see if it changes anything or not. Thanks.
> 
> Cheers,
> Christian
> 
> [0] <https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=f0aead0152574ed8ea24fec1ef6ee54ff3627c3e>
> [1] <https://patchwork.ozlabs.org/project/openwrt/patch/20200718205148.1743807-5-computersforpeace at gmail.com/>
> [2] <https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=68d0dc5802a8b670a06c02b9797ab7ca237da502>

[3] <https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-gpio.txt>

-- 
TMN


From zajec5 at gmail.com  Tue Sep 15 14:05:11 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Tue, 15 Sep 2020 20:05:11 +0200
Subject: [PATCH] ubus: add ACL support for "subscribe" request
Message-ID: <20200915180511.22491-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

With this change ubus will allow users with access to the object pseudo
method ":subscribe" to subscribe for notifications.

1. Move uh_ubus_allowed() up in the code
2. Export "Authorization" parsing code to the uh_ubus_get_auth()
3. Check for ":subscribe" method access

Right now this depends on "Authorization" HTTP header which browsers
don't allow setting for the EventSource. An alternative method of
submitting session token remains to be implemented.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ubus.c | 119 +++++++++++++++++++++++++++++++--------------------------
 1 file changed, 64 insertions(+), 55 deletions(-)

diff --git a/ubus.c b/ubus.c
index ccddbbd..1cf5c5f 100644
--- a/ubus.c
+++ b/ubus.c
@@ -112,6 +112,30 @@ enum cors_hdr {
 	__HDR_MAX
 };
 
+enum ubus_hdr {
+	HDR_AUTHORIZATION,
+	__HDR_UBUS_MAX
+};
+
+static const char *uh_ubus_get_auth(const struct blob_attr *attr)
+{
+	static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
+		[HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
+	};
+	struct blob_attr *tb[__HDR_UBUS_MAX];
+
+	blobmsg_parse(hdr_policy, __HDR_UBUS_MAX, tb, blob_data(attr), blob_len(attr));
+
+	if (tb[HDR_AUTHORIZATION]) {
+		const char *tmp = blobmsg_get_string(tb[HDR_AUTHORIZATION]);
+
+		if (!strncasecmp(tmp, "Bearer ", 7))
+			return tmp + 7;
+	}
+
+	return UH_UBUS_DEFAULT_SID;
+}
+
 static void __uh_ubus_next_batched_request(struct uloop_timeout *timeout);
 
 static void uh_ubus_next_batched_request(struct client *cl)
@@ -239,6 +263,39 @@ static void uh_ubus_ubus_error(struct client *cl, int err)
 	uh_ubus_error(cl, err, ubus_strerror(err));
 }
 
+static void uh_ubus_allowed_cb(struct ubus_request *req, int type, struct blob_attr *msg)
+{
+	struct blob_attr *tb[__SES_MAX];
+	bool *allow = (bool *)req->priv;
+
+	if (!msg)
+		return;
+
+	blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg));
+
+	if (tb[SES_ACCESS])
+		*allow = blobmsg_get_bool(tb[SES_ACCESS]);
+}
+
+static bool uh_ubus_allowed(const char *sid, const char *obj, const char *fun)
+{
+	uint32_t id;
+	bool allow = false;
+	static struct blob_buf req;
+
+	if (ubus_lookup_id(ctx, "session", &id))
+		return false;
+
+	blob_buf_init(&req, 0);
+	blobmsg_add_string(&req, "ubus_rpc_session", sid);
+	blobmsg_add_string(&req, "object", obj);
+	blobmsg_add_string(&req, "function", fun);
+
+	ubus_invoke(ctx, id, "access", req.head, uh_ubus_allowed_cb, &allow, conf.script_timeout * 500);
+
+	return allow;
+}
+
 /* GET requests handling */
 
 static void uh_ubus_list_cb(struct ubus_context *ctx, struct ubus_object_data *obj, void *priv);
@@ -303,14 +360,16 @@ static void uh_ubus_subscription_notification_remove_cb(struct ubus_context *ctx
 	ops->request_done(cl);
 }
 
-static void uh_ubus_handle_get_subscribe(struct client *cl, const char *sid, const char *path)
+static void uh_ubus_handle_get_subscribe(struct client *cl, const char *path)
 {
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
+	const char *sid;
 	uint32_t id;
 	int err;
 
-	/* TODO: add ACL support */
-	if (!conf.ubus_noauth) {
+	sid = uh_ubus_get_auth(cl->hdr.head);
+
+	if (!conf.ubus_noauth && !uh_ubus_allowed(sid, path, ":subscribe")) {
 		uh_ubus_send_header(cl, 200, "OK", "application/json");
 		uh_ubus_posix_error(cl, EACCES);
 		return;
@@ -364,7 +423,7 @@ static void uh_ubus_handle_get(struct client *cl)
 	} else if (!strncmp(url, "/subscribe/", strlen("/subscribe/"))) {
 		url += strlen("/subscribe");
 
-		uh_ubus_handle_get_subscribe(cl, NULL, url + 1);
+		uh_ubus_handle_get_subscribe(cl, url + 1);
 	} else {
 		ops->http_header(cl, 404, "Not Found");
 		ustream_printf(cl->us, "\r\n");
@@ -682,39 +741,6 @@ static void uh_ubus_complete_batch(struct client *cl)
 	ops->request_done(cl);
 }
 
-static void uh_ubus_allowed_cb(struct ubus_request *req, int type, struct blob_attr *msg)
-{
-	struct blob_attr *tb[__SES_MAX];
-	bool *allow = (bool *)req->priv;
-
-	if (!msg)
-		return;
-
-	blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg));
-
-	if (tb[SES_ACCESS])
-		*allow = blobmsg_get_bool(tb[SES_ACCESS]);
-}
-
-static bool uh_ubus_allowed(const char *sid, const char *obj, const char *fun)
-{
-	uint32_t id;
-	bool allow = false;
-	static struct blob_buf req;
-
-	if (ubus_lookup_id(ctx, "session", &id))
-		return false;
-
-	blob_buf_init(&req, 0);
-	blobmsg_add_string(&req, "ubus_rpc_session", sid);
-	blobmsg_add_string(&req, "object", obj);
-	blobmsg_add_string(&req, "function", fun);
-
-	ubus_invoke(ctx, id, "access", req.head, uh_ubus_allowed_cb, &allow, conf.script_timeout * 500);
-
-	return allow;
-}
-
 static void uh_ubus_handle_request_object(struct client *cl, struct json_object *obj)
 {
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
@@ -851,18 +877,9 @@ out:
 	uh_client_unref(cl);
 }
 
-enum ubus_hdr {
-	HDR_AUTHORIZATION,
-	__HDR_UBUS_MAX
-};
-
 static void uh_ubus_handle_post(struct client *cl)
 {
-	static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
-		[HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
-	};
 	struct dispatch_ubus *du = &cl->dispatch.ubus;
-	struct blob_attr *tb[__HDR_UBUS_MAX];
 	const char *url = du->url_path;
 	const char *auth;
 
@@ -873,15 +890,7 @@ static void uh_ubus_handle_post(struct client *cl)
 		return;
 	}
 
-	blobmsg_parse(hdr_policy, __HDR_UBUS_MAX, tb, blob_data(cl->hdr.head), blob_len(cl->hdr.head));
-
-	auth = UH_UBUS_DEFAULT_SID;
-	if (tb[HDR_AUTHORIZATION]) {
-		const char *tmp = blobmsg_get_string(tb[HDR_AUTHORIZATION]);
-
-		if (!strncasecmp(tmp, "Bearer ", 7))
-			auth = tmp + 7;
-	}
+	auth = uh_ubus_get_auth(cl->hdr.head);
 
 	url += strlen(conf.ubus_prefix);
 
-- 
2.27.0



From jacekowski at jacekowski.org  Tue Sep 15 15:56:55 2020
From: jacekowski at jacekowski.org (jacekowski at jacekowski.org)
Date: Tue, 15 Sep 2020 21:56:55 +0200
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
Message-ID: <20200915195655.13866-1-jacekowski@jacekowski.org>

From: Jacek Milewicz <jacekowski at jacekowski.org>

Fixes FS#3285 for NBG6817 only.

Signed-off-by: Jacek Milewicz <jacekowski at jacekowski.org>
---
 .../files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts       | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
index 7cd1c7b567..5745040d2b 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
@@ -289,6 +289,7 @@
 			qcom,emulation = <0>;
 			qcom,irq = <255>;
 			mdiobus = <&mdio0>;
+			tx-fifo-depth = <4096>;
 
 			pinctrl-0 = <&rgmii2_pins>;
 			pinctrl-names = "default";
@@ -310,6 +311,7 @@
 			qcom,emulation = <0>;
 			qcom,irq = <258>;
 			mdiobus = <&mdio0>;
+			tx-fifo-depth = <4096>;
 
 			fixed-link {
 				speed = <1000>;
-- 
2.17.1



From henrique at nic.br  Tue Sep 15 17:19:33 2020
From: henrique at nic.br (Henrique de Moraes Holschuh)
Date: Tue, 15 Sep 2020 18:19:33 -0300
Subject: [PATCH 1/3] build: add libustream and certs to default pkgs
In-Reply-To: <20200827214708.915775-1-mail@aparcar.org>
References: <20200827214708.915775-1-mail@aparcar.org>
Message-ID: <9f88309c-7462-e160-d8fd-d0869dbc8a00@nic.br>

On 27/08/2020 18:47, Paul Spooren wrote:
> To allow HTTPS usage on a router it requires both certificates
> (ca-bundle) and a fitting libustream library (libustream-wolfssl)
> 
> By adding both, uclient-fetch and wget can connect to encrypted HTTP.
> 
> This allows opkg to update package lists in a more secure fashion.

It is also a FLASH pig IMHO: not as bad as, say, openssl, but ca-bundle 
is still Not Small[tm] :-(

ca-bundle could benefit from some Kconfig-enforced mega diet:


[ ] Let's Encrypt and its alternative roots
[ ] Openwrt.org's packages
[ ] custom path -> (some path where we can add custom certificates,
     with a default of certs/)
[ ] All other certificates we'd usually package in ca-bundle

Default would be something that gets us all the current certificates in 
ca-bundle, and maybe just the custom path or LE for the SMALL_FLASH version.

-- 
Henrique de Moraes Holschuh
www.nic.br


From mail at aparcar.org  Tue Sep 15 21:10:41 2020
From: mail at aparcar.org (Paul Spooren)
Date: Tue, 15 Sep 2020 15:10:41 -1000
Subject: [PATCH] conf: add src/{,gz}/trusted option
Message-ID: <20200916011041.1746959-1-mail@aparcar.org>

This options allows to individually disable signature checks for
individual feeds. This option should only be used for local feeds or
remote feeds downloaded via HTTPS.

Within OpenWrt this option allows ImageBuilders to verify remote feeds
while also taking local feeds into account which are unsigned.

The two new config options are:

	src/trusted
	src/gz/trusted

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
ImageBuilders offer a folder called "packages/" which includes at least
the packages kernel_*.ipk and libc*.ipk, additionally packages provided
by the user.

It is not possible to enable signature checks within the
ImageBuilder and allow an unsigned local package  feed at the same time.

This patch is an option to set the special local packages feed to
"trusted".

As an alternative, the ImageBuilder could generate usign keys which sign
the local package feed, however those keys would then also be considered
for remote feeds which seems less secure.

 libopkg/opkg_cmd.c     |  2 +-
 libopkg/opkg_conf.c    | 28 ++++++++++++++++++++++++----
 libopkg/pkg_hash.c     |  2 +-
 libopkg/pkg_src.c      |  3 ++-
 libopkg/pkg_src.h      |  3 ++-
 libopkg/pkg_src_list.c |  4 ++--
 libopkg/pkg_src_list.h |  2 +-
 7 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index a329558..05c0c85 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -143,7 +143,7 @@ static int opkg_update_cmd(int argc, char **argv)
 		}
 		free(url);
 #if defined(HAVE_USIGN)
-		if (pkglist_dl_error == 0 && conf->check_signature) {
+		if (pkglist_dl_error == 0 && conf->check_signature && ! src->trusted) {
 			/* download detached signitures to verify the package lists */
 			/* get the url for the sig file */
 			if (src->extra_data)	/* debian style? */
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 38703ee..6097588 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -295,7 +295,7 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) dist_src_list, name)) {
 					pkg_src_list_append(dist_src_list, name,
-							    value, extra, 0);
+							    value, extra, 0, 0);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate dist declaration (%s %s). "
@@ -305,7 +305,7 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) dist_src_list, name)) {
 					pkg_src_list_append(dist_src_list, name,
-							    value, extra, 1);
+							    value, extra, 1, 0);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate dist declaration (%s %s). "
@@ -315,7 +315,7 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) pkg_src_list, name)) {
 					pkg_src_list_append(pkg_src_list, name,
-							    value, extra, 0);
+							    value, extra, 0, 0);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate src declaration (%s %s). "
@@ -325,7 +325,27 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) pkg_src_list, name)) {
 					pkg_src_list_append(pkg_src_list, name,
-							    value, extra, 1);
+							    value, extra, 1, 0);
+				} else {
+					opkg_msg(ERROR,
+						 "Duplicate src declaration (%s %s). "
+						 "Skipping.\n", name, value);
+				}
+			} else if (strcmp(type, "src/trusted") == 0) {
+				if (!nv_pair_list_find
+				    ((nv_pair_list_t *) pkg_src_list, name)) {
+					pkg_src_list_append(pkg_src_list, name,
+							    value, extra, 0, 1);
+				} else {
+					opkg_msg(ERROR,
+						 "Duplicate src declaration (%s %s). "
+						 "Skipping.\n", name, value);
+				}
+			} else if (strcmp(type, "src/gz/trusted") == 0) {
+				if (!nv_pair_list_find
+				    ((nv_pair_list_t *) pkg_src_list, name)) {
+					pkg_src_list_append(pkg_src_list, name,
+							    value, extra, 1, 1);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate src declaration (%s %s). "
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 52c64ff..21dc914 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -84,7 +84,7 @@ int dist_hash_add_from_file(const char *lists_dir, pkg_src_t * dist)
 				return -1;
 			}
 			pkg_src_list_append(&conf->pkg_src_list, subname,
-					    dist->value, "__dummy__", 0);
+					    dist->value, "__dummy__", 0, 0);
 		}
 
 		free(list_file);
diff --git a/libopkg/pkg_src.c b/libopkg/pkg_src.c
index fae3ce3..dd26469 100644
--- a/libopkg/pkg_src.c
+++ b/libopkg/pkg_src.c
@@ -19,11 +19,12 @@
 #include "libbb/libbb.h"
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-		 const char *extra_data, int gzip)
+		 const char *extra_data, int gzip, int trusted)
 {
 	src->gzip = gzip;
 	src->name = xstrdup(name);
 	src->value = xstrdup(base_url);
+	src->trusted = trusted;
 	if (extra_data)
 		src->extra_data = xstrdup(extra_data);
 	else
diff --git a/libopkg/pkg_src.h b/libopkg/pkg_src.h
index 1320f1f..0ff2d92 100644
--- a/libopkg/pkg_src.h
+++ b/libopkg/pkg_src.h
@@ -25,10 +25,11 @@ typedef struct {
 	char *value;
 	char *extra_data;
 	int gzip;
+	int trusted;
 } pkg_src_t;
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-		 const char *extra_data, int gzip);
+		 const char *extra_data, int gzip, int trusted);
 void pkg_src_deinit(pkg_src_t * src);
 
 #endif
diff --git a/libopkg/pkg_src_list.c b/libopkg/pkg_src_list.c
index cc24438..4ea254c 100644
--- a/libopkg/pkg_src_list.c
+++ b/libopkg/pkg_src_list.c
@@ -42,11 +42,11 @@ void pkg_src_list_deinit(pkg_src_list_t * list)
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list,
 			       const char *name, const char *base_url,
-			       const char *extra_data, int gzip)
+			       const char *extra_data, int gzip, int trusted)
 {
 	/* freed in pkg_src_list_deinit */
 	pkg_src_t *pkg_src = xcalloc(1, sizeof(pkg_src_t));
-	pkg_src_init(pkg_src, name, base_url, extra_data, gzip);
+	pkg_src_init(pkg_src, name, base_url, extra_data, gzip, trusted);
 
 	void_list_append((void_list_t *) list, pkg_src);
 
diff --git a/libopkg/pkg_src_list.h b/libopkg/pkg_src_list.h
index 71a10f6..4e175e8 100644
--- a/libopkg/pkg_src_list.h
+++ b/libopkg/pkg_src_list.h
@@ -38,6 +38,6 @@ void pkg_src_list_deinit(pkg_src_list_t * list);
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list, const char *name,
 			       const char *root_dir, const char *extra_data,
-			       int gzip);
+			       int gzip, int trusted);
 
 #endif
-- 
2.25.1



From mail at aparcar.org  Tue Sep 15 21:24:58 2020
From: mail at aparcar.org (Paul Spooren)
Date: Tue, 15 Sep 2020 15:24:58 -1000
Subject: [PATCH v2] imagebuilder: add package signature verification
In-Reply-To: <20200826082455.82021-1-mail@aparcar.org>
References: <20200826082455.82021-1-mail@aparcar.org>
Message-ID: <20200916012457.1748220-1-mail@aparcar.org>

The ImageBuilder downloads pre-built packages and adds them to images.
This process uses `opkg` which has the capability to verify package list
signatures via `usign`, as enabled per default on running OpenWrt
devices.

Until now this was disabled for ImageBuilders because neither the `opkg`
keys nor the `opkg-add` script was present during first packagelist
update.

To harden the ImageBuilder against *drive-by-download-attacks* both keys
and verification script are added to the ImageBuilder allowing `opkg` to
verify downloaded package indices.

This commit adds `opkg-add` to the ImageBuilder scripts folder. The keys
folder is added to ImageBuilder $TOPDIR to have an obvious place for users to
store their own keys. The `option check_signature` is appended to the
repositories.conf file. All of the above only happens if the Buildbot
runs with the SIGNATURE_CHECK option.

The keys stored in the ImageBuilder keys/ folder are the same as stored
within images in `/etc/opkg/keys`.

To allow a local package feed in which the user can add additional
packages, the local *imagebuilder* feed is set to `src/trusted` which
skips signature verification only on this particular feed.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 target/imagebuilder/Makefile       | 10 +++++++++-
 target/imagebuilder/files/Makefile |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index ad19ab2b53..0cdc1f4d93 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -42,7 +42,7 @@ endif
 
 	echo ''                                                        >> $(PKG_BUILD_DIR)/repositories.conf
 	echo '## This is the local package repository, do not remove!' >> $(PKG_BUILD_DIR)/repositories.conf
-	echo 'src imagebuilder file:packages'                          >> $(PKG_BUILD_DIR)/repositories.conf
+	echo 'src/trusted imagebuilder file:packages'                  >> $(PKG_BUILD_DIR)/repositories.conf
 
 	$(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf
 
@@ -57,6 +57,14 @@ else
 	find $(wildcard $(PACKAGE_SUBDIRS)) -type f -name '*.ipk' -exec $(CP) {} $(PKG_BUILD_DIR)/packages/ \;
 endif
 
+ifneq ($(CONFIG_SIGNATURE_CHECK),)
+	echo ''                                                        >> $(PKG_BUILD_DIR)/repositories.conf
+	echo 'option check_signature'                                  >> $(PKG_BUILD_DIR)/repositories.conf
+	$(INSTALL_DIR) $(PKG_BUILD_DIR)/keys
+	$(CP) -L $(STAGING_DIR_ROOT)/etc/opkg/keys/ $(PKG_BUILD_DIR)/
+	$(CP) -L $(STAGING_DIR_ROOT)/usr/sbin/opkg-key $(PKG_BUILD_DIR)/scripts/
+endif
+
 	$(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/
 	if [ -d $(TOPDIR)/staging_dir/host/lib/grub ]; then \
 		$(CP) $(TOPDIR)/staging_dir/host/lib/grub/ $(PKG_BUILD_DIR)/staging_dir/host/lib; \
diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index 27d3cfa8df..56b70f16b5 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -64,8 +64,10 @@ help: FORCE
 # override variables from rules.mk
 PACKAGE_DIR:=$(TOPDIR)/packages
 LISTS_DIR:=$(subst $(space),/,$(patsubst %,..,$(subst /,$(space),$(TARGET_DIR))))$(DL_DIR)
+export OPKG_KEYS:=$(TOPDIR)/keys
 OPKG:=$(call opkg,$(TARGET_DIR)) \
 	-f $(TOPDIR)/repositories.conf \
+	--verify-program $(SCRIPT_DIR)/opkg-key \
 	--cache $(DL_DIR) \
 	--lists-dir $(LISTS_DIR)
 
-- 
2.25.1



From zajec5 at gmail.com  Wed Sep 16 01:03:50 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Wed, 16 Sep 2020 07:03:50 +0200
Subject: [PATCH] ath79: add support for Ubiquiti UniFi AP Pro
In-Reply-To: <20200914121944.114046-1-mail@david-bauer.net>
References: <20200914121944.114046-1-mail@david-bauer.net>
Message-ID: <CACna6rww9m8kV_+95aSTLxpCGqcc92r+g3riPr80isuCuhk-PQ@mail.gmail.com>

On Mon, 14 Sep 2020 at 14:22, David Bauer <mail at david-bauer.net> wrote:
> +                       firmware-partition at 50000 {
> +                               label = "firmware";
> +                               reg = <0x50000 0xf60000>;
> +                       };

Please specify "compatible" so the kernel doesn't have to guess its format.

https://openwrt.org/docs/guide-developer/defining-firmware-partitions#defining_software_partitions_in_all_dts_targets

-- 
Rafa?


From devel-sven at geroedel.de  Wed Sep 16 03:17:13 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Wed, 16 Sep 2020 09:17:13 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
Message-ID: <5836172.LP2CDrWvR4@strike>

Hi,

not sure if this has been discussed before.
I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM), TPLink 
WR842 v2)  for our Freifunk-project and realized that the low RAM situation 
requires quite different handling than the full boards (8+/64+).

I wonder if there is a reason to not move the boards, which are affected by 
the 4/32MB warning also, to the ath79-tiny target?

Sven




From mail at david-bauer.net  Wed Sep 16 03:52:36 2020
From: mail at david-bauer.net (David Bauer)
Date: Wed, 16 Sep 2020 09:52:36 +0200
Subject: [PATCH] ath79: add support for Ubiquiti UniFi AP Pro
In-Reply-To: <CACna6rww9m8kV_+95aSTLxpCGqcc92r+g3riPr80isuCuhk-PQ@mail.gmail.com>
References: <20200914121944.114046-1-mail@david-bauer.net>
 <CACna6rww9m8kV_+95aSTLxpCGqcc92r+g3riPr80isuCuhk-PQ@mail.gmail.com>
Message-ID: <fc74b2d5-7a0f-9899-cd7c-86e7761f51d1@david-bauer.net>

Hi Rafal,

On 9/16/20 7:03 AM, Rafa? Mi?ecki wrote:
> On Mon, 14 Sep 2020 at 14:22, David Bauer <mail at david-bauer.net> wrote:
>> +                       firmware-partition at 50000 {
>> +                               label = "firmware";
>> +                               reg = <0x50000 0xf60000>;
>> +                       };
> 
> Please specify "compatible" so the kernel doesn't have to guess its format.

There's not MTD splitter for JFFS2 kernel partitions as far as I'm concerned.
kernel and rootfs partitions are also defined in the DTS, so no splitter is needed.

The sole purpose of th firmware partition is to allow the default sysupgrade method.

Best wishes
David

> 
> https://openwrt.org/docs/guide-developer/defining-firmware-partitions#defining_software_partitions_in_all_dts_targets
> 


From mail at adrianschmutzler.de  Wed Sep 16 05:40:13 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 16 Sep 2020 11:40:13 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <5836172.LP2CDrWvR4@strike>
References: <5836172.LP2CDrWvR4@strike>
Message-ID: <004b01d68c0d$610a3250$231e96f0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Sven Roederer
> Sent: Mittwoch, 16. September 2020 09:17
> To: openwrt-devel at lists.openwrt.org
> Subject: ath79: move 8/32 boards to tiny subtarget
> 
> Hi,
> 
> not sure if this has been discussed before.
> I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM),
> TPLink
> WR842 v2)  for our Freifunk-project and realized that the low RAM situation
> requires quite different handling than the full boards (8+/64+).
> 
> I wonder if there is a reason to not move the boards, which are affected by
> the 4/32MB warning also, to the ath79-tiny target?

I wonder whether the tiny subtarget will actually make much difference for RAM issues?

Best

Adrian

> 
> Sven
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200916/58fe2216/attachment.sig>

From mail at david-bauer.net  Wed Sep 16 10:15:42 2020
From: mail at david-bauer.net (David Bauer)
Date: Wed, 16 Sep 2020 16:15:42 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <004b01d68c0d$610a3250$231e96f0$@adrianschmutzler.de>
References: <5836172.LP2CDrWvR4@strike>
 <004b01d68c0d$610a3250$231e96f0$@adrianschmutzler.de>
Message-ID: <c84906cf-4c1a-500b-786a-10ca05c4bbec@david-bauer.net>

Hi,

On 9/16/20 11:40 AM, Adrian Schmutzler wrote:
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of Sven Roederer
>> Sent: Mittwoch, 16. September 2020 09:17
>> To: openwrt-devel at lists.openwrt.org
>> Subject: ath79: move 8/32 boards to tiny subtarget
>>
>> Hi,
>>
>> not sure if this has been discussed before.
>> I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM),
>> TPLink
>> WR842 v2)  for our Freifunk-project and realized that the low RAM situation
>> requires quite different handling than the full boards (8+/64+).
>>
>> I wonder if there is a reason to not move the boards, which are affected by
>> the 4/32MB warning also, to the ath79-tiny target?
> 
> I wonder whether the tiny subtarget will actually make much difference for RAM issues?

In it's current state, it will most likely increase low-memory issues as the squashfs
blocksize is 1024kB compared to the regular 256kB. Not that ath79-tiny has no target-flag
for small memory set.

Best wishes
David

> 
> Best
> 
> Adrian
> 
>>
>> Sven
>>
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From avalentin at marcant.net  Wed Sep 16 14:41:03 2020
From: avalentin at marcant.net (Andre Valentin)
Date: Wed, 16 Sep 2020 20:41:03 +0200
Subject: [PATCH v2] hostapd: enable background scanning in
 wpa_supplicant_full
In-Reply-To: <20200909200032.3662-1-avalentin@marcant.net>
References: <20200909200032.3662-1-avalentin@marcant.net>
Message-ID: <68ca7d3a-8aa6-09a8-440c-d786372857e0@marcant.net>

Hello!

Could someone please take care of this little snippet?

Kind regards,

Andr?
Am 09.09.20 um 22:00 schrieb Andr? Valentin:
> Activation of autoscanning enables a a wifi client to select the best
> accesspoint based on rssi.
> 
> This feature is useful in case you have multiple access points in your range
> and you do not want to stick the client on the first one it connected to.
> Especially when used with 802.11r this allows seamless transition to the
> optimal accesspoints.
> 
> Setting the config value bgscan to -65 will tell wpa_supplicant to try to
> connect to an access points with better rssi.
> 
> Example config:
> config wifi-iface 'default_radio1'
> 	option device 'radio1'
> 	option mode 'sta'
> 	option ssid 'openwrt'
> 	option encryption 'psk2'
> 	option key 'mykey'
> 	option network 'wlan'
> 	option roam_rssi_threshold '-65'
> 
> The ipk sizes for mipsel_24kc change like this:
> old:
> wpad-openssl_2020-06-08-5a8b3662-4_mipsel_24kc.ipk 550133
> 
> new:
> wpad-openssl_2020-06-08-5a8b3662-5_mipsel_24kc.ipk 551961
> 
> Signed-off-by: Andr? Valentin <avalentin at marcant.net>
> ---
>  package/network/services/hostapd/files/hostapd.sh          		| 7 +++++++
>  package/network/services/hostapd/files/wpa_supplicant-full.config      | 6 +++---
>  package/network/services/hostapd/Makefile				| 1 +-
>  3 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
> index 88113cd7ce..85299234c2 100644
> --- a/package/network/services/hostapd/files/hostapd.sh
> +++ b/package/network/services/hostapd/files/hostapd.sh
> @@ -272,6 +272,8 @@ hostapd_common_add_bss_config() {
>  	config_add_array operator_icon
>  	config_add_array hs20_conn_capab
>  	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
> +
> +	config_add_string roam_rssi_threshold
>  }
>  
>  hostapd_set_vlan_file() {
> @@ -1178,6 +1180,11 @@ wpa_supplicant_add_network() {
>  	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
>  	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
>  
> +	[ -n "$roam_rssi_threshold" ] && {
> +		json_get_vars roam_rssi_threshold
> +		append network_data "bgscan=\"simple:120:${roam_rssi_threshold}:600\"" "$N$T"
> +	}
> +
>  	[ -n "$basic_rate" ] && {
>  		local br rate_list=
>  		for br in $basic_rate; do
> diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
> index 982f4d5534..d39ee74a8d 100644
> --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
> +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
> @@ -527,9 +527,9 @@ CONFIG_WNM=y
>  #
>  # Enabling directly a module will enable autoscan support.
>  # For exponential module:
> -#CONFIG_AUTOSCAN_EXPONENTIAL=y
> +CONFIG_AUTOSCAN_EXPONENTIAL=y
>  # For periodic module:
> -#CONFIG_AUTOSCAN_PERIODIC=y
> +CONFIG_AUTOSCAN_PERIODIC=y
>  
>  # Password (and passphrase, etc.) backend for external storage
>  # These optional mechanisms can be used to add support for storing passwords
> @@ -600,7 +600,7 @@ CONFIG_IBSS_RSN=y
>  # operations for roaming within an ESS (same SSID). See the bgscan parameter in
>  # the wpa_supplicant.conf file for more details.
>  # Periodic background scans based on signal strength
> -#CONFIG_BGSCAN_SIMPLE=y
> +CONFIG_BGSCAN_SIMPLE=y
>  # Learn channels used by the network and try to avoid bgscans on other
>  # channels (experimental)
>  #CONFIG_BGSCAN_LEARN=y
> diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
> index 8f94dce782..8c264854d7 100644
> --- a/package/network/services/hostapd/Makefile
> +++ b/package/network/services/hostapd/Makefile
> @@ -7,7 +7,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=hostapd
> -PKG_RELEASE:=5
> +PKG_RELEASE:=6
>  
>  PKG_SOURCE_URL:=http://w1.fi/hostap.git
>  PKG_SOURCE_PROTO:=git
> 


-- 
Mit freundlichen Gr??en
Andr? Valentin

Systemadministration - Projektkoordination


--
MarcanT AG, Herforder Stra?e 163a, D - 33609 Bielefeld
Fon: +49 (521) 95945-0 | Fax: +49 (521) 95945-18
URL: http://www.marcant.net <http://www.marcant.net/> | http://www.global-m2m.com <http://www.global-m2m.com/>

Internet * Netzwerk * Mobile Daten

Vorstand:
Thorsten Hojas (Vorsitzender)
Marc-Henrik Delker
Dr. Anja-Christina Padberg
Handelsregister: AG Bielefeld, HRB 42260 USt-ID Nr.: DE 190203238



___________________________________________________________
Ausserhalb unserer Gesch?ftszeiten (Montag bis Freitag von 8:30 Uhr bis
17:30 Uhr, ausgenommen gesetzliche Feiertage in NRW) stehen wir Ihnen
gem?? Ihrer jeweiligen Service-Level-Agreements unter der Ihnen
mitgeteilten Telefonnummer f?r St?rungen und Notf?lle zur Verf?gung.
Sie k?nnen nat?rlich auch gerne jederzeit unter support at marcant.net ein
Ticket er?ffnen, welches am n?chsten Arbeitstag bearbeitet wird.

?



From greearb at candelatech.com  Wed Sep 16 18:09:21 2020
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 16 Sep 2020 15:09:21 -0700
Subject: New ath10k-ct driver available
Message-ID: <70bd81db-b3dd-1411-8c0a-9f7289ffe71e@candelatech.com>

Hello,

On June 30, I pulled in an upstream commit that changed dma_burst.  This broke at least some
systems (see:  https://github.com/greearb/ath10k-ct/issues/153)

I am not sure how to detect which value to use in the driver, it seems platform
dependent from what little I know of the problem.

So, I'm adding a fwcfg option to override the dma_burst option.  Here is the new
ath10k-ct commit ID.  If someone can pull this in a do a bit of testing I'd
appreciate it.  Bug 153 has some details on how to configure the override
if you want to try that.

commit 76280f692492fb9ddd506bddffab76efd2a57312 (HEAD -> master, origin/master)
Author: Ben Greear <greearb at candelatech.com>
Date:   Wed Sep 16 14:31:42 2020 -0700

     ath10k-ct:  Allow override of dma_burst setting using fwcfg.

     Previously tested and shown to work on 5.4 kernel, now applied to 4.16
     through 5.8 kernels.

     Signed-off-by: Ben Greear <greearb at candelatech.com>


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


From greearb at candelatech.com  Wed Sep 16 18:11:53 2020
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 16 Sep 2020 15:11:53 -0700
Subject: New ath10k-ct driver available
Message-ID: <a8a306a1-05a1-07e5-6ebc-6e0c5c6d32fd@candelatech.com>

Hello,

On June 30, I pulled in an upstream commit that changed dma_burst.  This broke at least some
systems (see:  https://github.com/greearb/ath10k-ct/issues/153)

I am not sure how to detect which value to use in the driver, it seems platform
dependent from what little I know of the problem.

So, I'm adding a fwcfg option to override the dma_burst option.  Here is the new
ath10k-ct commit ID.  If someone can pull this in a do a bit of testing I'd
appreciate it.  Bug 153 has some details on how to configure the override
if you want to try that.

commit 76280f692492fb9ddd506bddffab76efd2a57312 (HEAD -> master, origin/master)
Author: Ben Greear <greearb at candelatech.com>
Date:   Wed Sep 16 14:31:42 2020 -0700

     ath10k-ct:  Allow override of dma_burst setting using fwcfg.

     Previously tested and shown to work on 5.4 kernel, now applied to 4.16
     through 5.8 kernels.

     Signed-off-by: Ben Greear <greearb at candelatech.com>


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


From jo at mein.io  Thu Sep 17 04:29:03 2020
From: jo at mein.io (Jo-Philipp Wich)
Date: Thu, 17 Sep 2020 10:29:03 +0200
Subject: Merged: zram-swap: default to lzo instead of lzo-rle compression
In-Reply-To: <20200730124917.199164-1-rsalvaterra@gmail.com>
References: <20200730124917.199164-1-rsalvaterra@gmail.com>
Message-ID: <20200917082903.3843871-1-jo@mein.io>

Merged into my staging tree at
http://git.openwrt.org/?p=openwrt/staging/jow.git.

Thank you!



From e9hack at gmail.com  Thu Sep 17 05:38:42 2020
From: e9hack at gmail.com (e9hack)
Date: Thu, 17 Sep 2020 11:38:42 +0200
Subject: zram-swap: default to lzo instead of lzo-rle compression
Message-ID: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>

Hi,

I think commit 419f149e482641ddc520f80a7ab2038f7e2ebc8a is not the proper fix for the described issue.

The kernel module lzo-rle is still missing. To solve this, it must be installed on the root-fs:

diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk
index 1289cc1f25..fade8a5cfd 100644
--- a/package/kernel/linux/modules/lib.mk
+++ b/package/kernel/linux/modules/lib.mk
@@ -109,9 +109,10 @@ define KernelPackage/lib-lzo
   HIDDEN:=1
   FILES:= \
        $(LINUX_DIR)/crypto/lzo.ko \
+       $(LINUX_DIR)/crypto/lzo-rle.ko at ge5.1 \
        $(LINUX_DIR)/lib/lzo/lzo_compress.ko \
        $(LINUX_DIR)/lib/lzo/lzo_decompress.ko
-  AUTOLOAD:=$(call AutoProbe,lzo lzo_compress lzo_decompress)
+  AUTOLOAD:=$(call AutoProbe,lzo lzo-rle lzo_compress lzo_decompress)
 endef

 define KernelPackage/lib-lzo/description


Since kernel 4.19 isn't longer used, @ge5.1 isn't necessary.

Regards,
Hartmut 


From rsalvaterra at gmail.com  Thu Sep 17 06:11:19 2020
From: rsalvaterra at gmail.com (Rui Salvaterra)
Date: Thu, 17 Sep 2020 11:11:19 +0100
Subject: zram-swap: default to lzo instead of lzo-rle compression
In-Reply-To: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
References: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
Message-ID: <CALjTZvYQVmZhHf_CRNr3Mc008c=CKPwAhOEiLPC989tSF-F9Pg@mail.gmail.com>

On Thu, 17 Sep 2020 at 10:38, e9hack <e9hack at gmail.com> wrote:
>
> Hi,
>
> I think commit 419f149e482641ddc520f80a7ab2038f7e2ebc8a is not the proper fix for the described issue.
>
> The kernel module lzo-rle is still missing. To solve this, it must be installed on the root-fs:
>
> diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk
> index 1289cc1f25..fade8a5cfd 100644
> --- a/package/kernel/linux/modules/lib.mk
> +++ b/package/kernel/linux/modules/lib.mk
> @@ -109,9 +109,10 @@ define KernelPackage/lib-lzo
>    HIDDEN:=1
>    FILES:= \
>         $(LINUX_DIR)/crypto/lzo.ko \
> +       $(LINUX_DIR)/crypto/lzo-rle.ko at ge5.1 \
>         $(LINUX_DIR)/lib/lzo/lzo_compress.ko \
>         $(LINUX_DIR)/lib/lzo/lzo_decompress.ko
> -  AUTOLOAD:=$(call AutoProbe,lzo lzo_compress lzo_decompress)
> +  AUTOLOAD:=$(call AutoProbe,lzo lzo-rle lzo_compress lzo_decompress)
>  endef
>
>  define KernelPackage/lib-lzo/description
>
>
> Since kernel 4.19 isn't longer used, @ge5.1 isn't necessary.
>
> Regards,
> Hartmut

Good catch. You're absolutely right, the lzo-rle is a separate module.
Now, what I don't understand is why the crypto layer advertises
lzo-rle support without the module being present. Sounds like an
upstream bug to me?

Thanks,
Rui


From mail at adrianschmutzler.de  Thu Sep 17 06:14:01 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Thu, 17 Sep 2020 12:14:01 +0200
Subject: zram-swap: default to lzo instead of lzo-rle compression
In-Reply-To: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
References: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
Message-ID: <002c01d68cdb$43aee470$cb0cad50$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of e9hack
> Sent: Donnerstag, 17. September 2020 11:39
> To: jo at mein.io; rsalvaterra at gmail.com
> Cc: openwrt-devel at lists.openwrt.org
> Subject: zram-swap: default to lzo instead of lzo-rle compression
> 
> Hi,
> 
> I think commit 419f149e482641ddc520f80a7ab2038f7e2ebc8a is not the
> proper fix for the described issue.
> 
> The kernel module lzo-rle is still missing. To solve this, it must be installed on
> the root-fs:
> 
> diff --git a/package/kernel/linux/modules/lib.mk
> b/package/kernel/linux/modules/lib.mk
> index 1289cc1f25..fade8a5cfd 100644
> --- a/package/kernel/linux/modules/lib.mk
> +++ b/package/kernel/linux/modules/lib.mk
> @@ -109,9 +109,10 @@ define KernelPackage/lib-lzo
>    HIDDEN:=1
>    FILES:= \
>         $(LINUX_DIR)/crypto/lzo.ko \
> +       $(LINUX_DIR)/crypto/lzo-rle.ko at ge5.1 \
>         $(LINUX_DIR)/lib/lzo/lzo_compress.ko \
>         $(LINUX_DIR)/lib/lzo/lzo_decompress.ko
> -  AUTOLOAD:=$(call AutoProbe,lzo lzo_compress lzo_decompress)
> +  AUTOLOAD:=$(call AutoProbe,lzo lzo-rle lzo_compress lzo_decompress)
>  endef
> 
>  define KernelPackage/lib-lzo/description
> 
> 
> Since kernel 4.19 isn't longer used, @ge5.1 isn't necessary.

Kernel 4.19 support is still present in master (for regression testing), so we should properly implement the switches until it is removed entirely.

Best

Adrian

> 
> Regards,
> Hartmut
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200917/0bc828e9/attachment-0001.sig>

From devel-sven at geroedel.de  Thu Sep 17 19:27:07 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Fri, 18 Sep 2020 01:27:07 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <c84906cf-4c1a-500b-786a-10ca05c4bbec@david-bauer.net>
References: <5836172.LP2CDrWvR4@strike>
 <004b01d68c0d$610a3250$231e96f0$@adrianschmutzler.de>
 <c84906cf-4c1a-500b-786a-10ca05c4bbec@david-bauer.net>
Message-ID: <10757956.9tHsuBLZXe@strike>

Adrian, David,

Am Mittwoch, 16. September 2020, 16:15:42 CEST schrieb David Bauer:
> Hi,
> 
> On 9/16/20 11:40 AM, Adrian Schmutzler wrote:
> >> -----Original Message-----
> >> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> >> On Behalf Of Sven Roederer
> >> Sent: Mittwoch, 16. September 2020 09:17
> >> To: openwrt-devel at lists.openwrt.org
> >> Subject: ath79: move 8/32 boards to tiny subtarget
> >> 
> >> Hi,
> >> 
> >> not sure if this has been discussed before.
> >> I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM),
> >> TPLink
> >> WR842 v2)  for our Freifunk-project and realized that the low RAM
> >> situation
> >> requires quite different handling than the full boards (8+/64+).
> >> 
> >> I wonder if there is a reason to not move the boards, which are affected
> >> by
> >> the 4/32MB warning also, to the ath79-tiny target?
> > 
> > I wonder whether the tiny subtarget will actually make much difference for
> > RAM issues?

My idea based on the fact, to have an easy way to disable certain kernel-
features to reduce teh kernel-size (in flash and RAM). Candidates I see here 
are: USB-Support, additional filesystems, block-devices, ...
Even some devices provide USB-connectors it might be better to have less OOM-
crashes and reboots than installing a usb-flashdrive. In our Freifunk-Firmware 
I've seen much less runtime-problems with a stripped down kernel.
With having the 8/32 in tiny it would just be a config-file for the low-RAM 
boards. Having them in generic subtarget would require to build 2 kernels for 
the same subtarget.

> In it's current state, it will most likely increase low-memory issues as the
> squashfs blocksize is 1024kB compared to the regular 256kB. Not that
> ath79-tiny has no target-flag for small memory set.
> 

Did you miss an "e" ? "Note that ath79-tiny has ..." gives more sense to me. 
Reading it this way, you expect the larger blocksize was choosen as tradeoff 
between using the flash most efficient vs. RAM for the 4/32 boards?
I've seen there is a low_mem flag for some 16MB boards defined. It seems that 
for some config-options SMALL_FLASH and LOW-MEM are conflicting.

Sven





From devel-sven at geroedel.de  Thu Sep 17 19:38:29 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Fri, 18 Sep 2020 01:38:29 +0200
Subject: zram-swap: default to lzo instead of lzo-rle compression
In-Reply-To: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
References: <541cbfbd-76f2-59b3-a867-47b6f0fc7da9@gmail.com>
Message-ID: <2409322.pTfltUWnDt@strike>

Am Donnerstag, 17. September 2020, 11:38:42 CEST schrieb e9hack:
>The kernel module lzo-rle is still missing. To solve this, it must be
> installed on the root-fs:
> 
> diff --git a/package/kernel/linux/modules/lib.mk
> b/package/kernel/linux/modules/lib.mk index 1289cc1f25..fade8a5cfd 100644
> --- a/package/kernel/linux/modules/lib.mk
> +++ b/package/kernel/linux/modules/lib.mk
> @@ -109,9 +109,10 @@ define KernelPackage/lib-lzo
>    HIDDEN:=1
>    FILES:= \
>         $(LINUX_DIR)/crypto/lzo.ko \
> +       $(LINUX_DIR)/crypto/lzo-rle.ko at ge5.1 \
>         $(LINUX_DIR)/lib/lzo/lzo_compress.ko \
>         $(LINUX_DIR)/lib/lzo/lzo_decompress.ko
> -  AUTOLOAD:=$(call AutoProbe,lzo lzo_compress lzo_decompress)
> +  AUTOLOAD:=$(call AutoProbe,lzo lzo-rle lzo_compress lzo_decompress)
>  endef
> 

Hartmut,

I had a short test wit zram-swap these days and also saw this. 
I fixed this by changing the default compression-algo to lzo via etc/config/
system. My intention was not to use an additional kernel-module which will 
consume additional RAM which I just won by using zram ... (Indeed I did not 
check the numbers and only assumed)


Sven





From mail at david-bauer.net  Fri Sep 18 03:44:10 2020
From: mail at david-bauer.net (David Bauer)
Date: Fri, 18 Sep 2020 09:44:10 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <10757956.9tHsuBLZXe@strike>
References: <5836172.LP2CDrWvR4@strike>
 <004b01d68c0d$610a3250$231e96f0$@adrianschmutzler.de>
 <c84906cf-4c1a-500b-786a-10ca05c4bbec@david-bauer.net>
 <10757956.9tHsuBLZXe@strike>
Message-ID: <a922fff6-7efd-8131-ae3c-8f9bfadbb2fb@david-bauer.net>

Hello Sven,

On 9/18/20 1:27 AM, Sven Roederer wrote:
> Adrian, David,
> 
> Am Mittwoch, 16. September 2020, 16:15:42 CEST schrieb David Bauer:
>> Hi,
>>
>> On 9/16/20 11:40 AM, Adrian Schmutzler wrote:
>>>> -----Original Message-----
>>>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>>>> On Behalf Of Sven Roederer
>>>> Sent: Mittwoch, 16. September 2020 09:17
>>>> To: openwrt-devel at lists.openwrt.org
>>>> Subject: ath79: move 8/32 boards to tiny subtarget
>>>>
>>>> Hi,
>>>>
>>>> not sure if this has been discussed before.
>>>> I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM),
>>>> TPLink
>>>> WR842 v2)  for our Freifunk-project and realized that the low RAM
>>>> situation
>>>> requires quite different handling than the full boards (8+/64+).
>>>>
>>>> I wonder if there is a reason to not move the boards, which are affected
>>>> by
>>>> the 4/32MB warning also, to the ath79-tiny target?
>>>
>>> I wonder whether the tiny subtarget will actually make much difference for
>>> RAM issues?
> 
> My idea based on the fact, to have an easy way to disable certain kernel-
> features to reduce teh kernel-size (in flash and RAM). Candidates I see here 
> are: USB-Support, additional filesystems, block-devices, ...
> Even some devices provide USB-connectors it might be better to have less OOM-
> crashes and reboots than installing a usb-flashdrive. In our Freifunk-Firmware 
> I've seen much less runtime-problems with a stripped down kernel.
> With having the 8/32 in tiny it would just be a config-file for the low-RAM 
> boards. Having them in generic subtarget would require to build 2 kernels for 
> the same subtarget.
> 
>> In it's current state, it will most likely increase low-memory issues as the
>> squashfs blocksize is 1024kB compared to the regular 256kB. Not that
>> ath79-tiny has no target-flag for small memory set.
>>
> 
> Did you miss an "e" ? "Note that ath79-tiny has ..." gives more sense to me. 
> Reading it this way, you expect the larger blocksize was choosen as tradeoff 
> between using the flash most efficient vs. RAM for the 4/32 boards?
> I've seen there is a low_mem flag for some 16MB boards defined. It seems that 
> for some config-options SMALL_FLASH and LOW-MEM are conflicting.

Yes, there was an e missing.

We've experienced severe system instabilities with larger blocksizes (the default
one for ar71xx-tiny to be precise) downstream. [0] [1]

However, In my opinion the blocksize upstream works well for people looking for a
home router, as memory consumption is typically lower and some additional space
is desirable there.

I could also imagine the low-mem target feature and It's configuration implications
have to be assessed as a whole, given it did not experience much use for a longer
period of time.

[0] https://github.com/freifunk-gluon/gluon/issues/2032
[1] https://github.com/freifunk-gluon/gluon/commit/7e8af99cf504ca1dc389f282a0c94f4a911571be

Best wishes
David

> 
> Sven
> 
> 
> 


From mail at david-bauer.net  Fri Sep 18 07:57:19 2020
From: mail at david-bauer.net (David Bauer)
Date: Fri, 18 Sep 2020 13:57:19 +0200
Subject: [PATCH] hostapd: send ubus event on BSS update
Message-ID: <20200918115719.78233-1-mail@david-bauer.net>

hostapd will emit a ubus event with the eventname hostapd.<ifname>.<event>
when adding, removing or reloading a BSS.

This way, services which install state (for example the RMM neighbor
list) can on-demand reinstall this information for the BSS without
polling this state.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 .../services/hostapd/src/src/ap/ubus.c        | 24 ++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index d27ece7366..bfce641a75 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -111,6 +111,21 @@ void hostapd_ubus_free_iface(struct hostapd_iface *iface)
 		return;
 }
 
+static void hostapd_send_ubus_event(char *bssname, char *event)
+{
+	char *name;
+
+	if (!ctx)
+		return;
+
+	if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0)
+		return;
+
+	blob_buf_init(&b, 0);
+	ubus_send_event(ctx, name, b.head);
+	free(name);
+}
+
 static void
 hostapd_bss_del_ban(void *eloop_data, void *user_ctx)
 {
@@ -155,7 +170,10 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
 		   struct blob_attr *msg)
 {
 	struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
-	return hostapd_reload_config(hapd->iface, 1);
+	int ret = hostapd_reload_config(hapd->iface, 1);
+
+	hostapd_send_ubus_event(hapd->conf->iface, "reload");
+	return ret;
 }
 
 static int
@@ -1181,6 +1199,8 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd)
 	obj->n_methods = bss_object_type.n_methods;
 	ret = ubus_add_object(ctx, obj);
 	hostapd_ubus_ref_inc();
+
+	hostapd_send_ubus_event(hapd->conf->iface, "add");
 }
 
 void hostapd_ubus_free_bss(struct hostapd_data *hapd)
@@ -1191,6 +1211,8 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
 	if (!ctx)
 		return;
 
+	hostapd_send_ubus_event(hapd->conf->iface, "remove");
+
 	if (obj->id) {
 		ubus_remove_object(ctx, obj);
 		hostapd_ubus_ref_dec();
-- 
2.28.0



From chunkeey at gmail.com  Fri Sep 18 14:47:31 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Fri, 18 Sep 2020 20:47:31 +0200
Subject: [PATCH v2 1/2] ipq40xx: add support for Luma Home WRTQ-329ACN
In-Reply-To: <b4e06e91-0c62-00a5-7e76-e799ee430098@o2.pl>
References: <20200830112811.6175-1-tomek_n@o2.pl>
 <4c344f4a-45e6-6042-fa90-40301a683683@gmail.com>
 <b4e06e91-0c62-00a5-7e76-e799ee430098@o2.pl>
Message-ID: <a4a7d498-b606-a8df-1752-700070bc1f52@gmail.com>

On 2020-09-15 16:50, Tomasz Maciej Nowak wrote:
> Hi Christian, thanks for looking at this.
> 
> W dniu 13.09.2020 o?00:04, Christian Lamparter pisze:
>> On 2020-08-30 13:28, Tomasz Maciej Nowak wrote:
>>> Luma Home WRTQ-329ACN, also known as Luma WiFi System, is a dual-band
>>> wireless access point.
>>>
>>> Specification
>>> SoC: Qualcomm Atheros IPQ4018
>>> RAM: 256 MB DDR3
>>> Flash: 2 MB SPI NOR
>>>  ??????? 128 MB SPI NAND
[...]

>> So, because you install from the initramfs and introduced a custom run
>> command with a custom "kernel1" ubi volume... It might be possible to
>> cut the extra parts in the sysupgrade and bootargs and unify it with
>> the generic nand_do_upgrade() crowd.
>>
>> I've incorperated what maybe could be done in this patch on my
>> staging tree: [0]
>>
>> (Note the changes in step 9 (kernel1->kernel), step 10 (ubirmvol ubi_rootfs1 & kernel1) and the "step 2 in
>> back to OEM".
>>
>> The idea is that we use OpenWrt's existing automount for ubi
>> and "rootfs" volumes.
>>
>> (In theory this could make the "back to OEM" even easier.
>> Because if it works the way I think it does, we could drop
>> the ubirmvol of ubi_rootfs1 and kernel1 in step 10 of my version.
>> Next, it should be possible to drop the ubimkvol of
>> kernel1 and ubi_rootfs1 step 2 in the "Reverting to OEM" section.
>> This is because the original rootfs1 and kernel1 still exist and
>> are left untouched - no idea if this works out or not.)
> 
> Personally I would like to use whole NAND for OpenWrt, that would simplify everything a lot.
> Unfortunately some users might be dissatisfied with how things are done in OpenWrt and wish
> to revert to stock firmware. I'll explain in points what are the current issues with this
> device. My knowledge is based on what I could dig out from firmware (QSDK) without access to
> source modifications.

I don't think there's a need to do that. On old (and new) devices that only have
8MiB/16MiB of flash space, it's impossible to keep the vendor firmware around.
There's no obligation to do that. From the looks of it, though. I think it's more
of a hassle to fully remove the vendor than to keep it around and praise this as
a feature. So either way, both are fine :-) . If somebody wants to use the full
NAND, she/he could just delete the remaining "kernel1, ubi_rootfs[1]" volumes
and resize the rootfs_data. (This can be done in place).

> 1. The devices have different flash layouts, some come with
> mtd8: 08000000 00020000 "rootfs"
> mtd9: 0041e000 0001f000 "kernel"
> mtd10: 026c0000 0001f000 "ubi_rootfs"
> mtd11: 01ff8000 0001f000 "rootfs_data"
> mtd12: 0041e000 0001f000 "kernel1"
> mtd13: 026c0000 0001f000 "ubi_rootfs1"
> 
> and some
> 
> mtd8: 08000000 00020000 "rootfs"
> mtd9: 003a2000 0001f000 "kernel"
> mtd10: 02283000 0001f000 "ubi_rootfs"
> mtd11: 0062d000 0001f000 "dummy"
> mtd12: 01ff8000 0001f000 "rootfs_data"
> mtd13: 0041e000 0001f000 "kernel1"
> mtd14: 026c0000 0001f000 "ubi_rootfs1"
> 
> this reflects the bootargs in dts.

Ok, that 128 MiB "rootfs" looks to be the "ubi" partition. My best "this could be"
guess is that the "dummy" and the different sizes of the kernel vs kernel1 partition
stems from a update. The dummy would be a temporary filesystem for the stuff that
was worth keeping... But I don't know.

I just like to see the use of the established "kernel" and "rootfs" volumes whenever
possible.

I did the necessary changes in this version:
<https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=b30fedc765871e7738257eae305674b0069bbd96>

This will repurpose the "kernel" partition (by overwriting it)
and ditch "ubi_rootfs". The big mtd partition "rootfs" is renamed to
"ubi" (this is because OpenWrt will auto-attach the volume - handled
by 490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch)

and the squashfs root is placed in "rootfs". (OpenWrt does
automatically create a ubiblock for volumes called rootfs -
done by 491-ubi-auto-create-ubiblock-device-for-rootfs.patch @Daniel)

What's your opinion? Do you want it in a different way? Or are you
fine with the changes? (I would need to know if this works or not
though)

> 
> 2. As illustrated above, the device comes with two sets of kernel+ubi_rootfs and shared
> overlay "rootfs_data". The U-Boot with 'bootipq' command boots the first kernel+ubi_rootfs
> pair. There is some kind of fallback mechanism to issue boot from the second pair, but I was
> unable to trigger it (didn't try hammer approach by deleting first kernel+ubi_rootfs set).
> 
> 3. On each reboot the 'bootipq' command rewrites some of U-Boot environments variables to
> default state. I don't know every one of them and that makes this not a stable environment,
> which could overwrite our changes. Also this increases flash wear (it's NOR, I know, but still).
> That's why I decided to introduce custom 'bootcmd'.
Custom "bootcmd" is fine.

> 
> 4. The stock firmware likes to fiddle with U-Boot environment from userspace. I could miss
> some case of it and users who reverted to stock firmware (which would need custom 'bootcmd'
> if we went with Your changes) could end up with OpenWrt booted after reboot (in best case)
> or in U-Boot shell. Explaining what to do, would include non-trivial tasks for average user.
> This is why I decided to write OpenWrt firmware to kernel1+ubi_rootfs1 set.
Hm? Did I make a mistake somewhere? I thought that I kept the custom bootcmd. I only changed
the "kernel1" to "kernel" and let the kernel use auto-attach the "ubi"-volume and boot from
the "rootfs" volume. (Note: sysupgrade in the initramfs also installs into "kernel"
and "rootfs". These are the defaults for CI_KERNPART and CI_ROOTPART). Did you try this with
your existing setup? (You would need to start with a newly created initramfs image to test
this)

> 
> 5. What we have stored in flash is all we've got in terms of OEM firmware. There is no
> downloadable image (I know of) we could use to flash the device with, in case no backup is
> made and all partitions are wiped.
> Given that, I decided to go for reverting to OEM setup, as close as possible, so self-heal
> implemented in stock firmware won't be confused.
I updated the "back to stock" instruction. These are from the POV of a newly bought device.
I assume that the content of ubi_rootfs1 matches ubi_rootfs, likewise "kernel1" would match
"kernel". Is this not true?

>>
>> Note2: You don't mention it in your commit. But I'm seeing that you are
>> using GPIO OPEN_DRAIN for the bitbanged i2c. So, don't you also need
>> Brain's pinctrl patch that wires up OPEN_DRAIN for this? [1]
> 
> I went with suggestion in [3], but even setting to GPIO_ACTIVE_HIGH is enough. I tested
> this with and without Brian's patch. Should I send v3 without GPIO_OPEN_DRAIN?
> 
Brain's patch is upstream I think.
The Open Drain is coming from the I2C spec itself. From what I remember it's
important for multi-master and if slaves employ Clock stretching. I would keep it,
but please test it now before it causes problems later.

Cheers,
Christian



From mail at adrianschmutzler.de  Sat Sep 19 07:09:13 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sat, 19 Sep 2020 13:09:13 +0200
Subject: [PATCH] kernel: fix mtd partition erase<parent_erasesize writing
 to wrong address
In-Reply-To: <20200805211354.3922-1-git@johnthomson.fastmail.com.au>
References: <20200805211354.3922-1-git@johnthomson.fastmail.com.au>
Message-ID: <002c01d68e75$4f7a9600$ee6fc200$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of John Thomson
> Sent: Mittwoch, 5. August 2020 23:14
> To: openwrt-devel at lists.openwrt.org
> Cc: John Thomson <git at johnthomson.fastmail.com.au>
> Subject: [PATCH] kernel: fix mtd partition erase<parent_erasesize writing to
> wrong address
> 
> This bug applied where mtd partition end address, or erase start address,
> was not cleanly divisible by parent mtd erasesize.
> 
> This error would cause the bits following the end of the partition to the next
> erasesize block boundary to be erased, and this partition-overflow data to be
> written to the partition erase address (missing additional partition offset
> address) of the mtd (top) parent device.

We had a longer discussion about that on IRC yesterday, where we also discussed (stylistically) different solutions.

As it appears, kernel did a major overhaul of mtdpart.c in a more recent major kernel version:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef

So, any cosmetic improvement would probably be in vain anyway. Therefore, I decided to merge the patch in its current (tested) state.

However, this essentially means we will meet the same problem again with the next kernel bump, and it won't become easier.
In the discussion, jow had the idea to circumvent these problems and handle the non-aligned partitions in user-space. Maybe one can exploit the mtd-rw tool (available as kmod-mtd-rw in packages repo) for unlocking the relevant areas and then do everything else in user-space.

If that seems suitable, we could use the merged patch for the 20.xx release, and then migrate master to a better solution when we have one.

I put the discussion below in case somebody feels inspired to play around with that (first half is the general discussion, second half mentions the user-space solution).

Best

Adrian

---

[...]
12:31 jow: adrianschmutzler: I took a look at the difference and in hindsight it seems to make a lot of sense
12:33 jow: adrianschmutzler: plain diff: (Link: https://pastebin.com/AqE89TXB)https://pastebin.com/AqE89TXB - code context: (Link: https://pastebin.com/Hn2ny4Lt)https://pastebin.com/Hn2ny4Lt
12:34 jow: adrianschmutzler: so the "instr->addr -= part->offset;" address manipulation is moved after the _write() which makes sense since we're supposed to both erase and (partially) re-write the same block
12:34 jow: (my second paste shows the old, not the patched code)
12:35 jow: the way the code is right now, it would erase the entire block partly occupied by a partition, then overwrite the first block of the mtd device
12:35 jow: this is my interpretation at least, I am not an mtd subsystem expert
12:38 adrianschmutzler: okay, thanks. will have a look at the older kernel now, as in the PR it is called "a merge bug  in 4.19 & 5.4" ...
12:39 jow: yeah, my first thought was the same, probably a merge/patch rebase quirk
12:41 jow: tbh, I'd refactor the code while at it, directly substract instr->addr after part->parent->_erase(part->parent, instr); like it is done in the current broken code and explicitly pass instr->addr + part->offset and instr->addr + instr->len + part->offset respectively to part->parent->_write() to mirror what is done for mtd_read() a few further lines up
12:41 adrianschmutzler: unfortunately upstream also doesn't seem to be interested in commenting on the patches
12:43 jow: mtd_read() and part->parent->_write() take explicit offsets as arguments (part->offset + instr->addr + ...) while part->parent->_erase() uses the ->addr member from instr, hence the address manipulation
12:43 jow: and I'd revert the address to its original value as soon as possible and continue passing calculated offsets later
12:44 adrianschmutzler: jow: So, it's actually bad design after all?
12:45 jow: this would be my fix on top of the current broken code: (Link: https://pastebin.com/diff/EjUdXshw)https://pastebin.com/diff/EjUdXshw
12:45 adrianschmutzler: the need to increase/decrease instr->addr ...
12:47 adrianschmutzler: jow: okay. IIRC, they stirred around mtd in one of the recent kernel anyway, and also did some fairly similarly looking changes with offsets there as well
12:47 jow: I do not know enough about the struct erase_info and part->parent->_erase() semantics to understand why _erase() apparently uses instr->addr relative to the partition offset while part->parent->_write() expects an absolute offset relative to the mtd block
12:48 jow: that seems inconsitent to me, maybe the _erase() operates on a wrong offset as well
12:53 jow: adrianschmutzler: I took at the upstream code as well: (Link: https://lxr.missinglinkelectronics.com/linux/drivers/mtd/mtdpart.c#L197)https://lxr.missinglinkelectronics.com/linux/drivers/mtd/mtdpart.c#L197 and I think I got a better idea now. So the various part_*() functions expect an erase_info struct with partition-relative addresses, they then interally manipulate those addresses to be mtd-relative, invoke the lowlevel whole mtd ops, then revert the address back to their
12:53 jow: original partition-relative value
12:54 jow: so the originally proposed patch which simply moves the reversal (instr->addr -= part->offset;) directly before the `return ret;` is fine and matches the style of the kernel part_*() functions
12:58 jow: adrianschmutzler: just for completeness, and even better fix would be (Link: https://pastebin.com/diff/mFSb8Uqp)https://pastebin.com/diff/mFSb8Uqp
13:02 adrianschmutzler: jow: why is the additional mtd_to_part(mtd) superior?
13:03 jow: it should be optimized away by the compiler, the code is superior because the intention is clearer
13:03 jow: likewise the mtd_read() at the beginning could be changed to part_read()  and the `part->offset + ` removed in each invocation
13:04 jow: this way the only "address fiddling" that remains is in the original function body of part_erase()
13:04 jow: (we can't obviously call part_erase() from within part_erase() since that'd recurse forever)
13:05 jow: but this is all just a matter of style and taste, not sure what the subsystem maintainers would prefer
13:06 jow: I guess however that this partial erase will likely will never go upstream
13:06 adrianschmutzler: okay, I see your point now
13:06 adrianschmutzler: probably that's why they remained silent on the other issues
13:07 jow: I actually wonder why this can't be done in userspace
13:08 jow: or in wahtever code using the mtd api
13:08 jow: after all it is just a matter of reading an entire block, holding it in memory, erasing the entire block and then simply partially write back the parts we did not want to erase
13:09 jow: the only obstacle would be the write protection for non-eb aligned parts I guess
13:10 adrianschmutzler: no idea; but I will throw that idea towards the affected people, maybe they want to go into that direction
13:11 jow: in the meanwhile I'd say we should apply the proposed fix
13:11 jow: it makes sense
13:11 jow: and its not the submitters fault that the orginal code is not beautiful to begin with
13:11 adrianschmutzler: sysupgrade won't be a problem for a user-space solution, as other stuff there happens in user-space as well?
13:12 jow: if I remember correctly, that partial erase thing was introduced years ago to support sysupgrade on Redboot systems
13:13 adrianschmutzler: that's one of currently broken systems and the patch fixes them apparently
13:13 jow: there we wanted to write accross the FIS table dictated kernel/rootfs boundary using the mtd util and nbd implemented a kernel patch and corresponding functionality in mtd to do exactly that
13:13 jow: and I believe one of (the?) problem was that the kernel mtd subsystem write-protects all non-aligned partitions by default
13:14 adrianschmutzler: but that sounds more like the subsequent patch:
13:14 adrianschmutzler: 412-mtd-partial_eraseblock_unlock.patch
13:15 adrianschmutzler: which states it's for ixp4xx only, which probably isn't true anymore ...
13:16 jow: adrianschmutzler: I think both is needed
13:19 jow: adrianschmutzler: I think the partial erase was needed to rewrite the FIS partition while keeping the Redboot config (often both share one eraseblock)
13:20 adrianschmutzler: okay, then since this is tested and waiting some time already, and since part_write is removed with newer kernel anyway, I merge the existing patch.
13:20 jow: adrianschmutzler: and the partial erase unlock patch covers cases where the partition you manipulate is locked because its not spanning an entire eb
13:21 jow: at least this is my understanding
13:22 adrianschmutzler: jow: okay. but then the 412 patch is probably relevant to all devices with redboot partitions and the ixp4xx references should be removed from the description ...
13:22 jow: or rather, it allows unlocking non-aligned parts by simply tweaking the flash area begin and end offsets to start at the previous eb boundary and end on the next
13:22 jow: so you're not only unlocking the target area but a little bit of stuff before and after too
13:23 jow: otherwise the mtd subsystem would reject the unlock
13:24 adrianschmutzler: so, it's effectively a hack
13:24 jow: yes
13:24 adrianschmutzler: btw just found that Rafa? wanted to remove these scripts already in March: (Link: https://patchwork.ozlabs.org/project/openwrt/patch/20200309114302.14383-1-zajec5 at gmail.com/)https://patchwork.ozlabs.org/project/openwrt/patch/20200309114302.14383-1-zajec5 at gmail.com/
13:25 adrianschmutzler: scripts->patches
13:26 jow: I think that if we somehow have a mechanism to forcibly unlock all flash areas (which could be done by a much leaner and more isolated patch I suppose) we could handle all the other edge cases in userspace
13:26 jow: by disregarding any partitioning and simply treating the entire mtd as continuous block device with offsets
13:27 jow: like you would e.g. dd an x86 image to the blockdev
13:28 jow: ah, just remebered this: (Link: https://github.com/jclehner/mtd-rw)https://github.com/jclehner/mtd-rw
13:28 jow: something like this could be a solution for sysupgrade
13:28 jow: not sure if its still compatible to 5.4 but if yes the we wouldn't even need a patch at all
13:29 adrianschmutzler: mtd-rw is in packages repo and works fine AFAIK
13:29 jow: a slightly less dangerous solution would be a kernel module or some other facility which would allow us to create mtd partitions on demand, not sure if something like this is possible
13:30 jow: one could thne simply "spwan" a new mtd partition for the flash area relevant for sysupgrade, then "mtd write" in there
13:30 adrianschmutzler: I just hesitate to include and enable a tool like that by default
13:30 jow: while "masking" other sensible parts like bootloader etc. to avoid bricks if something goes wrong
13:33 jow: hm well, yeah I understand your concerns
13:33 jow: but on x86 for example you can also happily dd over your entire disk
13:33 jow: granted, it is way easier to recover, but still...
13:34 adrianschmutzler: I will push that forward to the Mikrotik people anyway, as they seem to be the most affected at the moment. Maybe they have time to play around with idea going into that direction
13:34 adrianschmutzler: "Mikrotik people" -> contributors working with Mikrotik devices, not the vendor of course
13:37 jow: I could imagine that adding mtd-rw by defualt and adding some kind of sysctl to trigger it would be good enough
13:37 adrianschmutzler: together with Tomasz on the Redboot front there should be enough people interested
13:37 adrianschmutzler: hmm, I really have to think about that
13:37 jow: that sysctl could then be toggled by "mtd unlock" which never actually worked for me when I needed it
13:38 jow: or some other equivalent commend to not break existing "mtd unlock" users
13:38 jow: *command
13:38 adrianschmutzler: I fear this may end up in a lot of scripts then, where people will use it to take shortcuts ...
13:39 adrianschmutzler: but if it solves the problem, we should consider it
13:40 adrianschmutzler: because maintaining these patches won't become easier
13:41 jow: I agree
14:12 rmilecki: adrianschmutzler: jow: omg, that parial erase size crap again?
14:13 jow: rmilecki: we've been discussing its original intnetion and possible, non-invasive alternatives
14:14 jow: rmilecki: current working idea is to ship some kind of mtd unlock mechanism and handling the overlapping write/erase things in userspace
14:15 jow: rmilecki: (Link: https://github.com/jclehner/mtd-rw)https://github.com/jclehner/mtd-rw plus some clever scripting should already achive that
14:15 adrianschmutzler: rmilecki: the problem is that this partial erase stuff is needed for the redboot devices and all of the mikrotik ones as well (which currently all have "broken" sysupgrade)
14:16 rmilecki: the problem is it exists in a current form
14:16 rmilecki: afair it enables those partial wries for all ops, without checking if access is aligned or not
14:18 rmilecki: adrianschmutzler: i see jow posted few improvement ideas, do you want to implement them? if so, as part of submitted patch? or on top of that (later)?
14:21 adrianschmutzler: rmilecki: most of jow's improvement were about style. however, in (Link: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef)https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef kernel changes partition handling anyway
14:21 rmilecki: oh, that one is a hure change
14:21 adrianschmutzler: so, I don't think it's worth to care too much about style when we have to do a different implementation for next stable kernel anyway.
14:21 rmilecki: it's in some recent kernel though, right?
14:21 adrianschmutzler: and the existing patch is tested and known to be working on the affected devices
14:22 rmilecki: adrianschmutzler: ok, i agree, let's just make it work
14:22 adrianschmutzler: haven't checked explicitly, but somewhere after 5.4 of course
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200919/48641814/attachment-0001.sig>

From hacks at slashdirt.org  Sat Sep 19 07:46:53 2020
From: hacks at slashdirt.org (Thibaut)
Date: Sat, 19 Sep 2020 13:46:53 +0200
Subject: [PATCH] kernel: fix mtd partition erase<parent_erasesize writing
 to wrong address
In-Reply-To: <002c01d68e75$4f7a9600$ee6fc200$@adrianschmutzler.de>
References: <20200805211354.3922-1-git@johnthomson.fastmail.com.au>
 <002c01d68e75$4f7a9600$ee6fc200$@adrianschmutzler.de>
Message-ID: <3CBBC70D-A04A-4843-963E-91B6D5C8C719@slashdirt.org>

Hi,

Thanks for the summary.

I?m however under the impression that two distinct things are being confused here: partial erase and 4K_LIMIT.

Specifically, prior to the recent (4.17) changes in the mtd subsystem, Mikrotik devices made use of two separate hacks:

1) the ability to set different EB sizes (e.g. 64K or 4K) for different mtd partitions (which AIUI https://lists.infradead.org/pipermail/linux-mtd/2020-August/081636.html is trying to bring back to life)
2) the ability to perform partial erases when e.g. a small (4KB) partition with 4K EB was overlapping the boundary of an adjacent 64K EB

As far as MikroTik devices are concerned, the only reason we need 1) & 2) above is to be able to edit the bootloader configuration which is stored in ?soft_config?, a 4K partition (registered with 4K EB) that is typically adjacent to a larger, read-only, bootloader (using 64K EB).

However, the other issue that has arisen and the reason for the sysupgrade borkage is somewhat different: until said recent changes, Mikrotik (and others AIUI) devices used the CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT hack so that the small r/w partition (such as soft_config) properly used 4K EB, while the larger partitions (e.g. rootfs) kept using 64K EB (for performance reasons). That hack is also broken.

On Mikrotik devices, the sysupgrade failures are due to the fact that when 4K_SECTORS is turned on, 4K_SECTORS_LIMIT is ignored and so _all_ partitions end up using 4K EB. However rootfs is properly 64K-aligned and thus can (and should) use 64K EB. That's also what the build system expects, which results in jffs2 failure to recover sysupgrade saved data.

That second problem is AIUI addressed by John?s attempt to fix upstream so that mtd-spi-nor-attempt-4K-erase.patch works.

HTH,
Thibaut

> On 19 Sep 2020, at 13:09, Adrian Schmutzler <mail at adrianschmutzler.de> wrote:
> 
> Hi,
> 
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of John Thomson
>> Sent: Mittwoch, 5. August 2020 23:14
>> To: openwrt-devel at lists.openwrt.org
>> Cc: John Thomson <git at johnthomson.fastmail.com.au>
>> Subject: [PATCH] kernel: fix mtd partition erase<parent_erasesize writing to
>> wrong address
>> 
>> This bug applied where mtd partition end address, or erase start address,
>> was not cleanly divisible by parent mtd erasesize.
>> 
>> This error would cause the bits following the end of the partition to the next
>> erasesize block boundary to be erased, and this partition-overflow data to be
>> written to the partition erase address (missing additional partition offset
>> address) of the mtd (top) parent device.
> 
> We had a longer discussion about that on IRC yesterday, where we also discussed (stylistically) different solutions.
> 
> As it appears, kernel did a major overhaul of mtdpart.c in a more recent major kernel version:
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef
> 
> So, any cosmetic improvement would probably be in vain anyway. Therefore, I decided to merge the patch in its current (tested) state.
> 
> However, this essentially means we will meet the same problem again with the next kernel bump, and it won't become easier.
> In the discussion, jow had the idea to circumvent these problems and handle the non-aligned partitions in user-space. Maybe one can exploit the mtd-rw tool (available as kmod-mtd-rw in packages repo) for unlocking the relevant areas and then do everything else in user-space.
> 
> If that seems suitable, we could use the merged patch for the 20.xx release, and then migrate master to a better solution when we have one.
> 
> I put the discussion below in case somebody feels inspired to play around with that (first half is the general discussion, second half mentions the user-space solution).
> 
> Best
> 
> Adrian
> 
> ---
> 
> [...]
> 12:31 jow: adrianschmutzler: I took a look at the difference and in hindsight it seems to make a lot of sense
> 12:33 jow: adrianschmutzler: plain diff: (Link: https://pastebin.com/AqE89TXB)https://pastebin.com/AqE89TXB - code context: (Link: https://pastebin.com/Hn2ny4Lt)https://pastebin.com/Hn2ny4Lt
> 12:34 jow: adrianschmutzler: so the "instr->addr -= part->offset;" address manipulation is moved after the _write() which makes sense since we're supposed to both erase and (partially) re-write the same block
> 12:34 jow: (my second paste shows the old, not the patched code)
> 12:35 jow: the way the code is right now, it would erase the entire block partly occupied by a partition, then overwrite the first block of the mtd device
> 12:35 jow: this is my interpretation at least, I am not an mtd subsystem expert
> 12:38 adrianschmutzler: okay, thanks. will have a look at the older kernel now, as in the PR it is called "a merge bug  in 4.19 & 5.4" ...
> 12:39 jow: yeah, my first thought was the same, probably a merge/patch rebase quirk
> 12:41 jow: tbh, I'd refactor the code while at it, directly substract instr->addr after part->parent->_erase(part->parent, instr); like it is done in the current broken code and explicitly pass instr->addr + part->offset and instr->addr + instr->len + part->offset respectively to part->parent->_write() to mirror what is done for mtd_read() a few further lines up
> 12:41 adrianschmutzler: unfortunately upstream also doesn't seem to be interested in commenting on the patches
> 12:43 jow: mtd_read() and part->parent->_write() take explicit offsets as arguments (part->offset + instr->addr + ...) while part->parent->_erase() uses the ->addr member from instr, hence the address manipulation
> 12:43 jow: and I'd revert the address to its original value as soon as possible and continue passing calculated offsets later
> 12:44 adrianschmutzler: jow: So, it's actually bad design after all?
> 12:45 jow: this would be my fix on top of the current broken code: (Link: https://pastebin.com/diff/EjUdXshw)https://pastebin.com/diff/EjUdXshw
> 12:45 adrianschmutzler: the need to increase/decrease instr->addr ...
> 12:47 adrianschmutzler: jow: okay. IIRC, they stirred around mtd in one of the recent kernel anyway, and also did some fairly similarly looking changes with offsets there as well
> 12:47 jow: I do not know enough about the struct erase_info and part->parent->_erase() semantics to understand why _erase() apparently uses instr->addr relative to the partition offset while part->parent->_write() expects an absolute offset relative to the mtd block
> 12:48 jow: that seems inconsitent to me, maybe the _erase() operates on a wrong offset as well
> 12:53 jow: adrianschmutzler: I took at the upstream code as well: (Link: https://lxr.missinglinkelectronics.com/linux/drivers/mtd/mtdpart.c#L197)https://lxr.missinglinkelectronics.com/linux/drivers/mtd/mtdpart.c#L197 and I think I got a better idea now. So the various part_*() functions expect an erase_info struct with partition-relative addresses, they then interally manipulate those addresses to be mtd-relative, invoke the lowlevel whole mtd ops, then revert the address back to their
> 12:53 jow: original partition-relative value
> 12:54 jow: so the originally proposed patch which simply moves the reversal (instr->addr -= part->offset;) directly before the `return ret;` is fine and matches the style of the kernel part_*() functions
> 12:58 jow: adrianschmutzler: just for completeness, and even better fix would be (Link: https://pastebin.com/diff/mFSb8Uqp)https://pastebin.com/diff/mFSb8Uqp
> 13:02 adrianschmutzler: jow: why is the additional mtd_to_part(mtd) superior?
> 13:03 jow: it should be optimized away by the compiler, the code is superior because the intention is clearer
> 13:03 jow: likewise the mtd_read() at the beginning could be changed to part_read()  and the `part->offset + ` removed in each invocation
> 13:04 jow: this way the only "address fiddling" that remains is in the original function body of part_erase()
> 13:04 jow: (we can't obviously call part_erase() from within part_erase() since that'd recurse forever)
> 13:05 jow: but this is all just a matter of style and taste, not sure what the subsystem maintainers would prefer
> 13:06 jow: I guess however that this partial erase will likely will never go upstream
> 13:06 adrianschmutzler: okay, I see your point now
> 13:06 adrianschmutzler: probably that's why they remained silent on the other issues
> 13:07 jow: I actually wonder why this can't be done in userspace
> 13:08 jow: or in wahtever code using the mtd api
> 13:08 jow: after all it is just a matter of reading an entire block, holding it in memory, erasing the entire block and then simply partially write back the parts we did not want to erase
> 13:09 jow: the only obstacle would be the write protection for non-eb aligned parts I guess
> 13:10 adrianschmutzler: no idea; but I will throw that idea towards the affected people, maybe they want to go into that direction
> 13:11 jow: in the meanwhile I'd say we should apply the proposed fix
> 13:11 jow: it makes sense
> 13:11 jow: and its not the submitters fault that the orginal code is not beautiful to begin with
> 13:11 adrianschmutzler: sysupgrade won't be a problem for a user-space solution, as other stuff there happens in user-space as well?
> 13:12 jow: if I remember correctly, that partial erase thing was introduced years ago to support sysupgrade on Redboot systems
> 13:13 adrianschmutzler: that's one of currently broken systems and the patch fixes them apparently
> 13:13 jow: there we wanted to write accross the FIS table dictated kernel/rootfs boundary using the mtd util and nbd implemented a kernel patch and corresponding functionality in mtd to do exactly that
> 13:13 jow: and I believe one of (the?) problem was that the kernel mtd subsystem write-protects all non-aligned partitions by default
> 13:14 adrianschmutzler: but that sounds more like the subsequent patch:
> 13:14 adrianschmutzler: 412-mtd-partial_eraseblock_unlock.patch
> 13:15 adrianschmutzler: which states it's for ixp4xx only, which probably isn't true anymore ...
> 13:16 jow: adrianschmutzler: I think both is needed
> 13:19 jow: adrianschmutzler: I think the partial erase was needed to rewrite the FIS partition while keeping the Redboot config (often both share one eraseblock)
> 13:20 adrianschmutzler: okay, then since this is tested and waiting some time already, and since part_write is removed with newer kernel anyway, I merge the existing patch.
> 13:20 jow: adrianschmutzler: and the partial erase unlock patch covers cases where the partition you manipulate is locked because its not spanning an entire eb
> 13:21 jow: at least this is my understanding
> 13:22 adrianschmutzler: jow: okay. but then the 412 patch is probably relevant to all devices with redboot partitions and the ixp4xx references should be removed from the description ...
> 13:22 jow: or rather, it allows unlocking non-aligned parts by simply tweaking the flash area begin and end offsets to start at the previous eb boundary and end on the next
> 13:22 jow: so you're not only unlocking the target area but a little bit of stuff before and after too
> 13:23 jow: otherwise the mtd subsystem would reject the unlock
> 13:24 adrianschmutzler: so, it's effectively a hack
> 13:24 jow: yes
> 13:24 adrianschmutzler: btw just found that Rafa? wanted to remove these scripts already in March: (Link: https://patchwork.ozlabs.org/project/openwrt/patch/20200309114302.14383-1-zajec5 at gmail.com/)https://patchwork.ozlabs.org/project/openwrt/patch/20200309114302.14383-1-zajec5 at gmail.com/
> 13:25 adrianschmutzler: scripts->patches
> 13:26 jow: I think that if we somehow have a mechanism to forcibly unlock all flash areas (which could be done by a much leaner and more isolated patch I suppose) we could handle all the other edge cases in userspace
> 13:26 jow: by disregarding any partitioning and simply treating the entire mtd as continuous block device with offsets
> 13:27 jow: like you would e.g. dd an x86 image to the blockdev
> 13:28 jow: ah, just remebered this: (Link: https://github.com/jclehner/mtd-rw)https://github.com/jclehner/mtd-rw
> 13:28 jow: something like this could be a solution for sysupgrade
> 13:28 jow: not sure if its still compatible to 5.4 but if yes the we wouldn't even need a patch at all
> 13:29 adrianschmutzler: mtd-rw is in packages repo and works fine AFAIK
> 13:29 jow: a slightly less dangerous solution would be a kernel module or some other facility which would allow us to create mtd partitions on demand, not sure if something like this is possible
> 13:30 jow: one could thne simply "spwan" a new mtd partition for the flash area relevant for sysupgrade, then "mtd write" in there
> 13:30 adrianschmutzler: I just hesitate to include and enable a tool like that by default
> 13:30 jow: while "masking" other sensible parts like bootloader etc. to avoid bricks if something goes wrong
> 13:33 jow: hm well, yeah I understand your concerns
> 13:33 jow: but on x86 for example you can also happily dd over your entire disk
> 13:33 jow: granted, it is way easier to recover, but still...
> 13:34 adrianschmutzler: I will push that forward to the Mikrotik people anyway, as they seem to be the most affected at the moment. Maybe they have time to play around with idea going into that direction
> 13:34 adrianschmutzler: "Mikrotik people" -> contributors working with Mikrotik devices, not the vendor of course
> 13:37 jow: I could imagine that adding mtd-rw by defualt and adding some kind of sysctl to trigger it would be good enough
> 13:37 adrianschmutzler: together with Tomasz on the Redboot front there should be enough people interested
> 13:37 adrianschmutzler: hmm, I really have to think about that
> 13:37 jow: that sysctl could then be toggled by "mtd unlock" which never actually worked for me when I needed it
> 13:38 jow: or some other equivalent commend to not break existing "mtd unlock" users
> 13:38 jow: *command
> 13:38 adrianschmutzler: I fear this may end up in a lot of scripts then, where people will use it to take shortcuts ...
> 13:39 adrianschmutzler: but if it solves the problem, we should consider it
> 13:40 adrianschmutzler: because maintaining these patches won't become easier
> 13:41 jow: I agree
> 14:12 rmilecki: adrianschmutzler: jow: omg, that parial erase size crap again?
> 14:13 jow: rmilecki: we've been discussing its original intnetion and possible, non-invasive alternatives
> 14:14 jow: rmilecki: current working idea is to ship some kind of mtd unlock mechanism and handling the overlapping write/erase things in userspace
> 14:15 jow: rmilecki: (Link: https://github.com/jclehner/mtd-rw)https://github.com/jclehner/mtd-rw plus some clever scripting should already achive that
> 14:15 adrianschmutzler: rmilecki: the problem is that this partial erase stuff is needed for the redboot devices and all of the mikrotik ones as well (which currently all have "broken" sysupgrade)
> 14:16 rmilecki: the problem is it exists in a current form
> 14:16 rmilecki: afair it enables those partial wries for all ops, without checking if access is aligned or not
> 14:18 rmilecki: adrianschmutzler: i see jow posted few improvement ideas, do you want to implement them? if so, as part of submitted patch? or on top of that (later)?
> 14:21 adrianschmutzler: rmilecki: most of jow's improvement were about style. however, in (Link: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef)https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=46b5889cc2c54bac7d7e727a44d28a298df23cef kernel changes partition handling anyway
> 14:21 rmilecki: oh, that one is a hure change
> 14:21 adrianschmutzler: so, I don't think it's worth to care too much about style when we have to do a different implementation for next stable kernel anyway.
> 14:21 rmilecki: it's in some recent kernel though, right?
> 14:21 adrianschmutzler: and the existing patch is tested and known to be working on the affected devices
> 14:22 rmilecki: adrianschmutzler: ok, i agree, let's just make it work
> 14:22 adrianschmutzler: haven't checked explicitly, but somewhere after 5.4 of course



From chunkeey at gmail.com  Sat Sep 19 09:41:30 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 15:41:30 +0200
Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
In-Reply-To: <20200915114731.GA2239@makrotopia.org>
References: <819d2e74bd950ba6970fa6bd03f6c10dd48dcbab.1599945264.git.chunkeey@gmail.com>
 <74a8026cdfc2105396f5a35e0d45d6d4f57aebe0.1599945264.git.chunkeey@gmail.com>
 <b0e83581b6229b904c11ad479733bd8adf8b90a1.1599945264.git.chunkeey@gmail.com>
 <fb40216cb2a5ad8e79af47b6c511a8fc3ef11df1.1599945264.git.chunkeey@gmail.com>
 <05408ae755225bdcddace6a1316ee4176e437554.1599945264.git.chunkeey@gmail.com>
 <3f787818e4f2f2144473347f8d7a1acf0c6f3ff9.1599945264.git.chunkeey@gmail.com>
 <010d01d68b53$530792c0$f916b840$@adrianschmutzler.de>
 <20200915114731.GA2239@makrotopia.org>
Message-ID: <b7e879cf-4437-9dcf-7ad8-89a7a4150c67@gmail.com>

On 2020-09-15 13:47, Daniel Golle wrote:
> On Tue, Sep 15, 2020 at 01:28:23PM +0200, Adrian Schmutzler wrote:
>> Hi,
>>
>>> -----Original Message-----
>>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>>> On Behalf Of Christian Lamparter
>>> Sent: Samstag, 12. September 2020 23:16
>>> To: openwrt-devel at lists.openwrt.org
>>> Cc: rafal at milecki.pl; hauke at hauke-m.de; f.fainelli at gmail.com;
>>> chrisrblake93 at gmail.com; Adrian Schmutzler <mail at adrianschmutzler.de>
>>> Subject: [PATCH v3 6/8] kernel: package bcm53xx i2c module
>>>
>>> The BCM5301x SoCs do have i2c. Since this is only being used by the Meraki
>>> MR32, this will be packaged as a module.
>>>
>>> Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
>>> ---
>>>   package/kernel/linux/modules/i2c.mk | 14 ++++++++++++++
>>>   1 file changed, 14 insertions(+)
>>>
>>> diff --git a/package/kernel/linux/modules/i2c.mk
>>> b/package/kernel/linux/modules/i2c.mk
>>> index ca6463c81b..1c8b1b844e 100644
>>> --- a/package/kernel/linux/modules/i2c.mk
>>> +++ b/package/kernel/linux/modules/i2c.mk
>>> @@ -259,3 +259,17 @@ endef
>>>   $(eval $(call KernelPackage,i2c-tiny-usb))
>>>
>>>
>>> +I2C_BCM_IPROC_MODULES:= \
>>> +  CONFIG_I2C_BCM_IPROC:drivers/i2c/busses/i2c-bcm-iproc
>>> +
>>> +define KernelPackage/i2c-bcm-iproc
>>> +  $(call i2c_defaults,$(I2C_BCM_IPROC_MODULES),59)
>>> +  TITLE:=Broadcom iProc I2C controller
>>> +  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core endef
>>
>> More a question than a remark:
>>
>> I always wonder whether stuff like this (depending on a single target) belongs into package/kernel/linux/modules/... or into target/linux/bcm53xx/modules.mk
>>
>> Is there a general rule or is this mostly depending on circumstances/taste?
> 
> I'd say in a case like that (DEPENDS:=@TARGET_bcm53xx) it should go to
> target/linux/bcm53xx/modules.mk. However, another idea of that can be
> to list in-tree modules in package/kernel/linux/modules/... and target-
> specific out-of-tree modules in target/linux/*/modules.mk.
> I don't think we got a clear policy regarding that.

The bcm-iproc-i2c is also used by the arm64 stingray and northstar2
chips of broadcom's 802.11ax platform. That said, there isn't any
target for it so I might as well put the it into
target/linux/bcm53xx/modules.mk.

Cheers
Christian


From por at oranjevos.nl  Sat Sep 19 10:06:20 2020
From: por at oranjevos.nl (Paul Oranje)
Date: Sat, 19 Sep 2020 16:06:20 +0200
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
In-Reply-To: <20200915195655.13866-1-jacekowski@jacekowski.org>
References: <20200915195655.13866-1-jacekowski@jacekowski.org>
Message-ID: <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>

See below, regards,
Paul


> Op 15 sep. 2020, om 21:56 heeft jacekowski at jacekowski.org het volgende geschreven:
The subject does not to comply with the rules for that, it should at least start with the target, better would be:
	ipq806x: fix tx-queue-size on NBG6817

> 
> From: Jacek Milewicz <jacekowski at jacekowski.org>
> 
> Fixes FS#3285 for NBG6817 only.
Why is that ?

> 
> Signed-off-by: Jacek Milewicz <jacekowski at jacekowski.org>
> ---
> .../files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts       | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
> index 7cd1c7b567..5745040d2b 100644
> --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
> +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
> @@ -289,6 +289,7 @@
> 			qcom,emulation = <0>;
> 			qcom,irq = <255>;
> 			mdiobus = <&mdio0>;
> +			tx-fifo-depth = <4096>;
> 
> 			pinctrl-0 = <&rgmii2_pins>;
> 			pinctrl-names = "default";
> @@ -310,6 +311,7 @@
> 			qcom,emulation = <0>;
> 			qcom,irq = <258>;
> 			mdiobus = <&mdio0>;
> +			tx-fifo-depth = <4096>;
> 
> 			fixed-link {
> 				speed = <1000>;
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From chunkeey at gmail.com  Sat Sep 19 10:40:01 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:40:01 +0200
Subject: [PATCH v4 5/8] kernel: add default for new config symbols
In-Reply-To: <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
 <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
 <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>
Message-ID: <f33e2b1d0e9e362c54dcb15bb7a138f89b310013.1600525798.git.chunkeey@gmail.com>

Provide disabled defaults for I2C_SLAVE_EEPROM and IPMB_DEVICE_INTERFACE.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/generic/config-5.4 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index 6f63b8c5dd..1c28addff4 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -2134,6 +2134,7 @@ CONFIG_HW_RANDOM_TPM=y
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
 # CONFIG_I2C_SLAVE is not set
+# CONFIG_I2C_SLAVE_EEPROM is not set
 # CONFIG_I2C_SMBUS is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TAOS_EVM is not set
@@ -2394,6 +2395,7 @@ CONFIG_IO_STRICT_DEVMEM=y
 # CONFIG_IP6_NF_TARGET_SYNPROXY is not set
 # CONFIG_IPACK_BUS is not set
 # CONFIG_IPC_NS is not set
+# CONFIG_IPMB_DEVICE_INTERFACE is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_IPV6 is not set
 # CONFIG_IPV6_FOU is not set
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:40:02 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:40:02 +0200
Subject: [PATCH v4 6/8] kernel: package bcm53xx i2c module
In-Reply-To: <f33e2b1d0e9e362c54dcb15bb7a138f89b310013.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
 <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
 <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>
 <f33e2b1d0e9e362c54dcb15bb7a138f89b310013.1600525798.git.chunkeey@gmail.com>
Message-ID: <c21cfcf9e90e3a4c838db22426368e3fd9c1871d.1600525798.git.chunkeey@gmail.com>

The BCM5301x SoCs do have i2c. Since this is only
being used by the Meraki MR32, this will be packaged
as a module.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>

---
v3 -> v4
	- moved to target/linux/bcm53xx/modules.mk
---
 target/linux/bcm53xx/modules.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/target/linux/bcm53xx/modules.mk b/target/linux/bcm53xx/modules.mk
index b3bb42578c..ab3bab3f15 100644
--- a/target/linux/bcm53xx/modules.mk
+++ b/target/linux/bcm53xx/modules.mk
@@ -35,3 +35,18 @@ define KernelPackage/phy-bcm-ns-usb3/description
 endef
 
 $(eval $(call KernelPackage,phy-bcm-ns-usb3))
+
+define KernelPackage/i2c-bcm-iproc
+  TITLE:=Broadcom iProc I2C controller
+  KCONFIG:=CONFIG_I2C_BCM_IPROC
+  DEPENDS:=@TARGET_bcm53xx +kmod-i2c-core
+  SUBMENU:=(I2C_MENU)
+  FILES:=$(LINUX_DIR)/drivers/i2c/busses/i2c-bcm-iproc.ko
+  AUTOLOAD:=$(call AutoLoad,59,i2c-bcm-iproc,1)
+endef
+
+define KernelPackage/i2c-bcm-iproc/description
+ Kernel module for the Broadcom iProc I2C controller.
+endef
+
+$(eval $(call KernelPackage,i2c-bcm-iproc))
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:40:04 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:40:04 +0200
Subject: [PATCH v4 8/8] [RFT][WIP] bcm53xx: MR32: replace i2c-gpio with SoC's
 i2c
In-Reply-To: <2a6d5b3755d1ba02cad0d8df46afdc0fcbb05b8e.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
 <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
 <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>
 <f33e2b1d0e9e362c54dcb15bb7a138f89b310013.1600525798.git.chunkeey@gmail.com>
 <c21cfcf9e90e3a4c838db22426368e3fd9c1871d.1600525798.git.chunkeey@gmail.com>
 <2a6d5b3755d1ba02cad0d8df46afdc0fcbb05b8e.1600525798.git.chunkeey@gmail.com>
Message-ID: <54311329a56e7a38b1da6f61115543580f8fef18.1600525798.git.chunkeey@gmail.com>

During review of the MR32, Florian Fainelli pointed out that the
SoC has a real I2C-controller. Furthermore, the connected pins
(SDA and SCL) would line up perfectly for use. This patch swaps
out the the bitbanged i2c-gpio with the real deal. It can be
applied once it works.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 target/linux/bcm53xx/image/Makefile           |  2 +-
 .../332-Meraki-MR32-use-hw-i2c.patch          | 73 +++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 9ceb5f6212..2d90665ee3 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -323,7 +323,7 @@ TARGET_DEVICES += luxul_xwr-3150
 define Device/meraki_mr32
   DEVICE_VENODR := Meraki
   DEVICE_MODEL := MR32
-  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
 	kmod-leds-pwm kmod-hwmon-ina2xx kmod-bluetooth
   DEVICE_DTS := bcm53016-meraki-mr32
 # Meraki FW r23 tries to resize the part.safe partition before it will
diff --git a/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
new file mode 100644
index 0000000000..f61b9fdcdc
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
@@ -0,0 +1,73 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 12 Sep 2020 22:11:12 +0200
+Subject: bcm53xx: Meraki MR32 use hw i2c
+
+replace the i2c-gpio provided i2c functionality with the
+hardware in the SoC. This can be activated once the
+internal i2c works as well as the bit-banged i2c-gpio.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -85,34 +85,6 @@
+ 			max-brightness = <255>;
+ 		};
+ 	};
+-
+-	i2c {
+-		/*
+-		 * The platform provided I2C does not budge.
+-		 * This is a replacement until I can figure
+-		 * out what are the missing bits...
+-		 */
+-
+-		compatible = "i2c-gpio";
+-		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-
+-		current_sense: ina219 at 45 {
+-			compatible = "ti,ina219";
+-			reg = <0x45>;
+-			shunt-resistor = <60000>; /* = 60 mOhms */
+-		};
+-
+-		eeprom: eeprom at 50 {
+-			compatible = "atmel,24c64";
+-			reg = <0x50>;
+-			pagesize = <32>;
+-			read-only;
+-		};
+-	};
+ };
+ 
+ &uart0 {
+@@ -196,3 +168,25 @@
+ 		};
+ 	};
+ };
++
++&i2c0 {
++	status = "okay";
++
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_i2c>;
++
++	clock-frequency = <100000>;
++
++	current_sense: ina219 at 45 {
++		compatible = "ti,ina219";
++		reg = <0x45>;
++		shunt-resistor = <60000>; /* = 60 mOhms */
++	};
++
++	eeprom: eeprom at 50 {
++		compatible = "atmel,24c64";
++		reg = <0x50>;
++		pagesize = <32>;
++		read-only;
++	};
++};
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:39:57 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:39:57 +0200
Subject: [PATCH v4 1/8] scripts: mkits.sh make it possible to specify fdt@#
Message-ID: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>

Some bootloaders are really keen on just one special
fdt in a multi-image fit image. This is a problem, because
currently this is fixed to "fdt at 1".

This patch introduces a new device variable:
DEVICE_FDT_NUM that allows to specify the right
fdt number.

If the value is absent "1" will be chosen.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 include/image-commands.mk |  1 +
 include/image.mk          |  6 ++++--
 scripts/mkits.sh          | 12 ++++++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 9516801c8d..740d627fc7 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -158,6 +158,7 @@ define Build/fit
 		-D $(DEVICE_NAME) -o $@.its -k $@ \
 		$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \
 		-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+		$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
 		-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config at 1") \
 		-A $(LINUX_KARCH) -v $(LINUX_VERSION)
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
diff --git a/include/image.mk b/include/image.mk
index 703aeb6816..a1308f47ad 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -432,6 +432,7 @@ define Device/Init
   DEVICE_DTS :=
   DEVICE_DTS_CONFIG :=
   DEVICE_DTS_DIR :=
+  DEVICE_FDT_NUM :=
   SOC :=
 
   BOARD_NAME :=
@@ -453,8 +454,9 @@ DEFAULT_DEVICE_VARS := \
   DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
   CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
   VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
-  DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \
-  IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \
+  DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \
+  UIMAGE_NAME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
+  UBOOT_PATH IMAGE_SIZE \
   DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
   DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
   DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 468ef670e6..bb629d6fca 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -16,7 +16,7 @@
 
 usage() {
 	printf "Usage: %s -A arch -C comp -a addr -e entry" "$(basename "$0")"
-	printf " -v version -k kernel [-D name -d dtb] -o its_file"
+	printf " -v version -k kernel [-D name -n address -d dtb] -o its_file"
 
 	printf "\n\t-A ==> set architecture to 'arch'"
 	printf "\n\t-C ==> set compression type 'comp'"
@@ -26,12 +26,15 @@ usage() {
 	printf "\n\t-v ==> set kernel version to 'version'"
 	printf "\n\t-k ==> include kernel image 'kernel'"
 	printf "\n\t-D ==> human friendly Device Tree Blob 'name'"
+	printf "\n\t-n ==> fdt unit-address 'address'"
 	printf "\n\t-d ==> include Device Tree Blob 'dtb'"
 	printf "\n\t-o ==> create output file 'its_file'\n"
 	exit 1
 }
 
-while getopts ":A:a:c:C:D:d:e:k:o:v:" OPTION
+FDTNUM=1
+
+while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION
 do
 	case $OPTION in
 		A ) ARCH=$OPTARG;;
@@ -42,6 +45,7 @@ do
 		d ) DTB=$OPTARG;;
 		e ) ENTRY_ADDR=$OPTARG;;
 		k ) KERNEL=$OPTARG;;
+		n ) FDTNUM=$OPTARG;;
 		o ) OUTPUT=$OPTARG;;
 		v ) VERSION=$OPTARG;;
 		* ) echo "Invalid option passed to '$0' (options:$*)"
@@ -61,7 +65,7 @@ ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]')
 # Conditionally create fdt information
 if [ -n "${DTB}" ]; then
 	FDT_NODE="
-		fdt at 1 {
+		fdt@$FDTNUM {
 			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
 			data = /incbin/(\"${DTB}\");
 			type = \"flat_dt\";
@@ -75,7 +79,7 @@ if [ -n "${DTB}" ]; then
 			};
 		};
 "
-	FDT_PROP="fdt = \"fdt at 1\";"
+	FDT_PROP="fdt = \"fdt@$FDTNUM\";"
 fi
 
 # Create a default, fully populated DTS file
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:39:58 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:39:58 +0200
Subject: [PATCH v4 2/8] build: define PWM_SUPPORT arch feature flag
In-Reply-To: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
Message-ID: <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>

As the PWM has its own sub-system in the Linux kernel,
I think it should be handled in the same way as GPIO, RTC, PCI...

This patch introduces a specific feature flag "pwm" and the
"leds-pwm" kernel module as the first customer.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/kernel/linux/modules/leds.mk | 16 ++++++++++++++++
 scripts/target-metadata.pl           |  1 +
 target/Config.in                     |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk
index c030b54b39..fe90c6b559 100644
--- a/package/kernel/linux/modules/leds.mk
+++ b/package/kernel/linux/modules/leds.mk
@@ -159,3 +159,19 @@ define KernelPackage/leds-pca963x/description
 endef
 
 $(eval $(call KernelPackage,leds-pca963x))
+
+
+define KernelPackage/leds-pwm
+  SUBMENU:=$(LEDS_MENU)
+  TITLE:=PWM driven LED Support
+  KCONFIG:=CONFIG_LEDS_PWM
+  DEPENDS:= @PWM_SUPPORT
+  FILES:=$(LINUX_DIR)/drivers/leds/leds-pwm.ko
+  AUTOLOAD:=$(call AutoLoad,60,leds-pwm,1)
+endef
+
+define KernelPackage/leds-pwm/description
+ This option enables support for pwm driven LEDs
+endef
+
+$(eval $(call KernelPackage,leds-pwm))
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index c58f096573..bf6413d315 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -20,6 +20,7 @@ sub target_config_features(@) {
 		/^usb$/ and $ret .= "\tselect USB_SUPPORT\n";
 		/^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n";
 		/^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
+		/^pwm$/ and $ret .= "\select PWM_SUPPORT\n";
 		/^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n";
 		/^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n";
 		/^jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
diff --git a/target/Config.in b/target/Config.in
index 9fead5994f..43de4710df 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -29,6 +29,9 @@ config PCIE_SUPPORT
 config PCMCIA_SUPPORT
 	bool
 
+config PWM_SUPPORT
+	bool
+
 config USB_SUPPORT
 	select AUDIO_SUPPORT
 	bool
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:40:00 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:40:00 +0200
Subject: [PATCH v4 4/8] bcm53xx: backport uart2 and pcie2 device-nodes
In-Reply-To: <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
 <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
Message-ID: <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>

These have made their way into -next. This patch
also includes the portion of the bcm53xx kernel
patch refreshes as the hunks in
302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
moved slightly due to the added nodes.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
v2 -> v3
        - backport patches from devicetree/next
	- make target/linux/refresh
---
 ...dts-BCM5301X-Specify-uart2-in-the-DT.patch | 30 +++++++++++++++++++
 ...dts-BCM5301X-Specify-pcie2-in-the-DT.patch | 26 ++++++++++++++++
 ...01X-Update-Northstar-pinctrl-binding.patch |  2 +-
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch

diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
new file mode 100644
index 0000000000..8cee6745ee
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/034-v5.10-ARM-dts-BCM5301X-Specify-uart2-in-the-DT.patch
@@ -0,0 +1,30 @@
+From 5e396bb05b89e23e98e6d75749b77502e68210a4 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:20 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify uart2 in the DT
+
+The BCM53016 in the Meraki MR32 utilizes the third "uart2"
+to connect to a on-board Bluetooth-LE 4.0 BCM20732 chip.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -392,6 +392,15 @@
+ 		reg = <0x18105000 0x1000>;
+ 	};
+ 
++	uart2: serial at 18008000 {
++		compatible = "ns16550a";
++		reg = <0x18008000 0x20>;
++		clocks = <&iprocslow>;
++		interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
++		reg-shift = <2>;
++		status = "disabled";
++	};
++
+ 	i2c0: i2c at 18009000 {
+ 		compatible = "brcm,iproc-i2c";
+ 		reg = <0x18009000 0x50>;
diff --git a/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
new file mode 100644
index 0000000000..d3e2fbcc9e
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/035-v5.10-ARM-dts-BCM5301X-Specify-pcie2-in-the-DT.patch
@@ -0,0 +1,26 @@
+From c4cd6fcae46fd14aed8665b7cf66d0954765a873 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:21 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify pcie2 in the DT
+
+The SoC supports three pcie ports. Currently, only
+pcie0 and pcie1 are enabled. This patch adds the
+pcie2 port as well.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Reviewed-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -252,6 +252,10 @@
+ 			reg = <0x00013000 0x1000>;
+ 		};
+ 
++		pcie2: pcie at 14000 {
++			reg = <0x00014000 0x1000>;
++		};
++
+ 		usb2: usb2 at 21000 {
+ 			reg = <0x00021000 0x1000>;
+ 
diff --git a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
index 77bc68c8ce..1d71647d60 100644
--- a/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
+++ b/target/linux/bcm53xx/patches-5.4/302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch
@@ -9,7 +9,7 @@ Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
 
 --- a/arch/arm/boot/dts/bcm5301x.dtsi
 +++ b/arch/arm/boot/dts/bcm5301x.dtsi
-@@ -401,16 +401,12 @@
+@@ -422,16 +422,12 @@
  		#size-cells = <1>;
  
  		cru at 100 {
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:39:59 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:39:59 +0200
Subject: [PATCH v4 3/8] bcm53xx: enable PWM for bcm53xx
In-Reply-To: <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
Message-ID: <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>

The Meraki MR32 (BCM53016A1) uses the pwm to drive the
tricolor LED. The driver has been available in upstream
for a long time. Only the Device-Tree definition was
missing, but it has been queued recently.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
v2 -> v3
	- backport patches from devicetree/next
---
 target/linux/bcm53xx/Makefile                 |  2 +-
 target/linux/bcm53xx/config-5.4               |  3 ++
 ...M-dts-BCM5301X-Specify-PWM-in-the-DT.patch | 48 +++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch

diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
index 35f8513801..f980f8a8fb 100644
--- a/target/linux/bcm53xx/Makefile
+++ b/target/linux/bcm53xx/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=bcm53xx
 BOARDNAME:=Broadcom BCM47xx/53xx (ARM)
-FEATURES:=squashfs nand usb pci pcie gpio
+FEATURES:=squashfs nand usb pci pcie gpio pwm
 CPU_TYPE:=cortex-a9
 SUBTARGETS:=generic
 
diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4
index eacfcb620e..8c7cdf45d5 100644
--- a/target/linux/bcm53xx/config-5.4
+++ b/target/linux/bcm53xx/config-5.4
@@ -308,6 +308,9 @@ CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_IPROC_GPIO is not set
 CONFIG_PINCTRL_NS=y
 # CONFIG_PINCTRL_NS2_MUX is not set
+CONFIG_PWM=y
+CONFIG_PWM_BCM_IPROC=y
+CONFIG_PWM_SYSFS=y
 CONFIG_RATIONAL=y
 CONFIG_RCU_NEED_SEGCBLIST=y
 CONFIG_RCU_STALL_COMMON=y
diff --git a/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
new file mode 100644
index 0000000000..335378656c
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/033-v5.10-ARM-dts-BCM5301X-Specify-PWM-in-the-DT.patch
@@ -0,0 +1,48 @@
+From 0ea4b29d149586667d96767f1fc8e57ee942c1b0 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:19 +0200
+Subject: [PATCH] ARM: dts: BCM5301X: Specify PWM in the DT
+
+The BCM53016 in the Meraki MR32 uses the on-chip PWM
+controller to drive a tri-color RGB LED. Since I plan
+to use the PWM, I made a label for the pwm's pinmux
+node. This way, it can be easily referenced.... And
+Also included a label for the i2c since I'm going to
+need it in the future too.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Acked-by: Scott Branden <scott.branden at broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -350,6 +350,14 @@
+ 		};
+ 	};
+ 
++	pwm: pwm at 18002000 {
++		compatible = "brcm,iproc-pwm";
++		reg = <0x18002000 0x28>;
++		clocks = <&osc>;
++		#pwm-cells = <3>;
++		status = "disabled";
++	};
++
+ 	mdio: mdio at 18003000 {
+ 		compatible = "brcm,iproc-mdio";
+ 		reg = <0x18003000 0x8>;
+@@ -417,12 +425,12 @@
+ 					function = "spi";
+ 				};
+ 
+-				i2c {
++				pinmux_i2c: i2c {
+ 					groups = "i2c_grp";
+ 					function = "i2c";
+ 				};
+ 
+-				pwm {
++				pinmux_pwm: pwm {
+ 					groups = "pwm0_grp", "pwm1_grp",
+ 						 "pwm2_grp", "pwm3_grp";
+ 					function = "pwm";
-- 
2.28.0



From chunkeey at gmail.com  Sat Sep 19 10:40:03 2020
From: chunkeey at gmail.com (Christian Lamparter)
Date: Sat, 19 Sep 2020 16:40:03 +0200
Subject: [PATCH v4 7/8] bcm53xx: add Cisco Meraki MR32
In-Reply-To: <c21cfcf9e90e3a4c838db22426368e3fd9c1871d.1600525798.git.chunkeey@gmail.com>
References: <6310f880aa209003fee9ef04add80176e249997a.1600525798.git.chunkeey@gmail.com>
 <8d4ccd9d499c7f080e401ee3828bdfb0e5733edf.1600525798.git.chunkeey@gmail.com>
 <3f47a2946d6fb8cd15356f03384cab25da52aec1.1600525798.git.chunkeey@gmail.com>
 <6738ae97125b563bc7f6655f9cf69f5ff1ac6e98.1600525798.git.chunkeey@gmail.com>
 <f33e2b1d0e9e362c54dcb15bb7a138f89b310013.1600525798.git.chunkeey@gmail.com>
 <c21cfcf9e90e3a4c838db22426368e3fd9c1871d.1600525798.git.chunkeey@gmail.com>
Message-ID: <2a6d5b3755d1ba02cad0d8df46afdc0fcbb05b8e.1600525798.git.chunkeey@gmail.com>

This patch adds support for Cisco Meraki MR32.
The unit was donated by Chris Blake. Thank you!

WARNING:
Only the 1x1:1 abgn Air Marshal WIPS wifi is currently supported by b43:
 b43-phy2: Found PHY: Analog 9, Type 4 (N), Revision 16
 b43-phy2: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1
 b43-phy2: Loading firmware version 784.2 (2012-08-15 21:35:19)
 and only as 802.11ABG!

while WIFI1 and WIFI2 (both BCM4352) are not:
 b43-phy0: Broadcom 4352 WLAN found (core revision 42)
 b43-phy0 ERROR: FOUND UNSUPPORTED PHY (Analog 12, Type 11 (AC), Revision 1)

Hardware Highlights:

SoC:	Broadcom BCM53016A1 (1 GHz, 2 cores)
RAM:	128 MiB
NAND:	128 MiB Spansion S34ML01G2 (~114 MiB useable)
ETH:	1GBit Ethernet Port - PoE
WIFI1:	Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
WIFI2:	Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
WIFI3:	Broadcom BCM43428 abgn (1x1:1 - id: 43428)

BLE:	Broadcom BCM20732 (ttyS1)
LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
	1 x White LED (GPIO)
	1 x Orange LED Fault Indicator (GPIO)
	2 x LAN Activity / Speed LEDs (On the RJ45 Port)
BUTTON: one Reset button
MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC + Serial#!)
	ina219 hardware monitor (i2c)
	Kensington Lock

SERIAL:
	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
	The Serial setting is 115200-8-N-1. The board has a populated
	right angle 1x4 0.1" pinheader.
	The pinout is: VCC, RX, TX, GND. (Use a multimeter)

Flashing needs a serial adaptor (due to the lack of a working dropbear on
the original firmware).

This flashing procedure for the MR32 was tested with firmware:
"r23-149867:150252-aacharya".

0. Create a seperate Ethernet LAN which does not have access to the internet.
   Ideally use 192.168.1.2 for your PC. Make sure to reserve 192.168.1.1 it
   will be used later on by the OpenWrt firmware. The original Meraki firmware
   will likely try to setup the network via DHCP Discovery, so make sure your
   PC is running a DHCP-Server (i.e.: dnsmasq)
   '# dnsmasq -i eth# -F 192.168.1.5,192.168.1.50
   Furthermore, the PC needs a supported ssh/http/ftp server in order to
   retrieve the initramfs + dtb file

1. Disassemble the MR32 device by removing all screws (4 screws are located
   under the 4 rubber feets!) and prying open the plastic covers without
   breaking the plastic retention clips. Once inside, remove all the screws
   on the outer metal shielding to get to the PCB. It's not necessary to
   remove the antennas!

2. Connect the serial cable to the serial header.

3. Partially reassemble the outer metal shielding to ensure that the SoC
   has a proper heat sink.

4. Connect the Ethernet patch cable to the device and the power cable.

5. Wait for the device to boot and enter the root shell.
   (rooting is not discussed in detail here please refer to
   Chris Blake - "pwning the meraki mr18" blog post:
   <https://servernetworktech.com/2016/02/pwning-the-meraki-mr18/>
   (The same method works with the MR32's r23-149867:150252-aacharya)

   Wait for the MR32 to enter the "<Meraki>" prompt and enter:
   <Meraki> odm serial_num read
   (Verify that it matches what's on the S/N Sticker on the back!)
   <Meraki> odm serial_num write Q2XX-XXXX-XXXV
   <Meraki> odm serial_num read
   (Verify that the S/N has changed - and the LED start to flash)

   now to flash the firmware:
   <Meraki> odm firmware part.safe "http://192.168.1.2/mr32-initramfs.bin"

Once OpenWrt booted use sysupgrade to permanently install
OpenWrt. To do this: Download the latest sysupgrade.bin file
for the MR32 to the device and use sysupgrade *sysupgrade.bin
to install it.

WARNING: DO NOT DELETE the "storage" ubi volume!

To flash later MR32 Firmwares like r25-201804051805-G885d6d78-dhow-rel
requires in-circut-i2c tools to access the I2C EEPROM AT24C64 next to
the SoC. The idea is pretty much the same as from Step 5 from above:
Change the serial number to Q2XXXXXXXXXV (should be around 0x7c), then
attach a serial cable, ethernet (but make sure the device can't reach
the internet!) hit "s" (the small s!) during boot to enter the root-shell
and add the following commands to the /storage/config there:

serial_allow_odm true
serial_access_enabled true
serial_access_check false
valid_config true

and then hit exit to let it finish booting.

Signed-off-by: Christian Lamparter <chunkeey at gmail.com>

---

rfc -> v2
	- fixed Adrian's comments
	- unbroke sysupgrade on other bcm53xx

v2 -> v3
	- use florians patch
	- make a separate patch for the i2c-gpio -> i2c-hw

v3 -> v4
	- remove superflous kmod-hwmon-core
---
 .../bcm53xx/base-files/etc/board.d/02_network |   7 +-
 target/linux/bcm53xx/base-files/etc/diag.sh   |   3 +
 .../lib/preinit/07_set_preinit_iface_bcm53xx  |  14 +
 .../base-files/lib/upgrade/platform.sh        |  43 ++-
 target/linux/bcm53xx/image/Makefile           |  27 ++
 ...-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch | 261 ++++++++++++++++++
 .../331-Meraki-MR32-Status-LEDs.patch         |  28 ++
 7 files changed, 380 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
 create mode 100644 target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
 create mode 100644 target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch

diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network
index 5752b7760d..231566cfa0 100755
--- a/target/linux/bcm53xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network
@@ -89,10 +89,15 @@ bcm53xx_setup_macs()
 	netgear,r8500)
 		# As vendor doesn't use eth0 its MAC may be missing. Use one from eth2.
 		et2macaddr="$(nvram get et2macaddr)"
-		[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+		;;
+	meraki,mr32)
+		# The MAC is stored on an AT24C64 eeprom and not on the nvram
+		et2macaddr=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
 		;;
 	esac
 
+	[ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+
 	wan_macaddr="$(nvram get wan_hwaddr)"
 	case "$board" in
 	asus,rt-ac87u)
diff --git a/target/linux/bcm53xx/base-files/etc/diag.sh b/target/linux/bcm53xx/base-files/etc/diag.sh
index 1a9332327a..bf5b779aa8 100644
--- a/target/linux/bcm53xx/base-files/etc/diag.sh
+++ b/target/linux/bcm53xx/base-files/etc/diag.sh
@@ -18,6 +18,9 @@ get_status_led() {
 		status_led=$(basename $status_led_file)
 		return
 	fi;
+
+	# And finally, let's also try the device-Tree aliases node
+	status_led="$(get_dt_led status)"
 }
 
 set_state() {
diff --git a/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
new file mode 100644
index 0000000000..9e7c4b821e
--- /dev/null
+++ b/target/linux/bcm53xx/base-files/lib/preinit/07_set_preinit_iface_bcm53xx
@@ -0,0 +1,14 @@
+set_preinit_iface() {
+	. /lib/functions.sh
+
+	case $(board_name) in
+	meraki,mr32)
+		# switch needs to be out of the vlan mode.
+		swconfig dev switch0 set reset 1
+		swconfig dev switch0 set enable_vlan 0
+		swconfig dev switch0 set apply 1
+		;;
+	esac
+}
+
+boot_hook_add preinit_main set_preinit_iface
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 40b2ef67be..cbb8290275 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -96,7 +96,7 @@ platform_identify() {
 	echo "unknown"
 }
 
-platform_check_image() {
+platform_other_check_image() {
 	[ "$#" -gt 1 ] && return 1
 
 	local file_type=$(platform_identify "$1")
@@ -227,6 +227,25 @@ platform_check_image() {
 	return $error
 }
 
+platform_check_image() {
+	case "$(board_name)" in
+	meraki,mr32)
+		# Ideally, REQUIRE_IMAGE_METADATA=1 would suffice
+		# but this would require converting all other
+		# devices too.
+		nand_do_platform_check meraki-mr32 "$1"
+		return $?
+		;;
+	*)
+		platform_other_check_image "$1"
+		return $?
+		;;
+	esac
+
+	return 1
+}
+
+
 # $(1): image for upgrade (with possible extra header)
 # $(2): offset of trx in image
 platform_do_upgrade_nand_trx() {
@@ -393,7 +412,7 @@ platform_img_from_seama() {
 	echo -n $dir/image-entity.bin
 }
 
-platform_do_upgrade() {
+platform_other_do_upgrade() {
 	local file_type=$(platform_identify "$1")
 	local trx="$1"
 	local cmd=
@@ -424,3 +443,23 @@ platform_do_upgrade() {
 
 	default_do_upgrade "$trx" "$cmd"
 }
+
+platform_do_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		nand_do_upgrade "$1"
+		;;
+	*)
+		platform_other_do_upgrade "$1"
+		;;
+	esac
+}
+
+platform_nand_pre_upgrade() {
+	case "$(board_name)" in
+	meraki,mr32)
+		CI_KERNPART="part.safe"
+		;;
+	esac
+}
diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 768477160a..9ceb5f6212 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -320,6 +320,33 @@ define Device/luxul_xwr-3150
 endef
 TARGET_DEVICES += luxul_xwr-3150
 
+define Device/meraki_mr32
+  DEVICE_VENODR := Meraki
+  DEVICE_MODEL := MR32
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+	kmod-leds-pwm kmod-hwmon-ina2xx kmod-bluetooth
+  DEVICE_DTS := bcm53016-meraki-mr32
+# Meraki FW r23 tries to resize the part.safe partition before it will
+# flash the image. This is a bit of a problem, since resizing will fail
+# if the partition is smaller than the old one.
+  KERNEL_LOADADDR := 0x00008000
+  KERNEL_INITRAMFS_SUFFIX := .bin
+  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb | \
+	pad-to 10362880
+  KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+
+# Currently the only device that uses the new image check
+  SUPPORTED_DEVICES := meraki,mr32
+
+# The loader is specifically looking for fdt at 2:
+# [    3.190000] find_itb_subimage: error finding fdt at 2: FDT_ERR_NOTFOUND
+# The image won't boot, if it isn't found. :(
+  DEVICE_FDT_NUM := 2
+endef
+TARGET_DEVICES += meraki_mr32
+
 define Device/netgear
   DEVICE_VENDOR := NETGEAR
   IMAGES := chk
diff --git a/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
new file mode 100644
index 0000000000..29329eb3f0
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/330-ARM-BCM5301X-Add-DT-for-Meraki-MR32.patch
@@ -0,0 +1,261 @@
+From ec88a9c344d9fd8c3b11bff1f99a0b6248ae256d Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Sat, 22 Aug 2020 18:19:23 +0200
+Subject: [PATCH] ARM: BCM5301X: Add DT for Meraki MR32
+
+add support for the Cisco Meraki MR32.
+This is a dual-band enterprise class 802.11ac access point.
+The unit was donated by Chris Blake. Thank you!
+
+SoC:    Broadcom BCM53016A1 (1 GHz, 2 cores)
+RAM:    128 MiB
+NAND:   128 MiB Spansion S34ML01G2 (~114 MiB useable)
+ETH:    1GBit Ethernet Port - PoE
+WIFI1:  Broadcom BCM43520 an+ac (2x2:2 - id: 0x4352)
+WIFI2:  Broadcom BCM43520 bgn (2x2:2 - id: 0x4352)
+WIFI3:  Broadcom BCM43428 abgn (1x1:1 - id: 43428)
+
+BLE:    Broadcom BCM20732 (ttyS1)
+LEDS:   1 x Programmable RGB Status LED (driven by a PWM)
+        1 x White LED (GPIO)
+        1 x Orange LED Fault Indicator (GPIO)
+        2 x LAN Activity / Speed LEDs (On the RJ45 Port)
+BUTTON: one Reset button
+MISC:   AT24C64 8KiB EEPROM (i2c - stores Ethernet MAC)
+        ina219 hardware monitor (i2c)
+        Kensington Lock
+
+SERIAL:
+	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
+        The Serial setting is 115200-8-N-1. The board has a populated
+        right angle 1x4 0.1" pinheader.
+        The pinout is: VCC, RX, TX, GND.
+
+Odd stuff:
+	- uart0 clock frequency is 62.5 MHz.
+	- The LEDs are labeled as SYS-LED1 through SYS-LED3
+	  because of the silkscreen on the PCB.
+	- the original u-boot has been compiled with most functions
+	  and commands disabled. The u-boot env isn't setup properly
+	  either and as a result, the bcm47xxpart probing is not
+	  working. Hence, the nand partitions are specified through a
+	  "fixed-partition" binding.
+	- The "WICED SMART(TM)" Bluetooth LE 4.0 BCM20732 chip is
+	  connected to uart2 of the SoC. The BCM20732 does not
+	  provide a HCI. So the linux' bluetooth stack is useless.
+	  The mock-up node with the compatible binding and
+	  enable-gpios property is provided solely as documentation.
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
+
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -119,6 +119,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
+ 	bcm47094-luxul-xwr-3150-v1.dtb \
+ 	bcm47094-netgear-r8500.dtb \
+ 	bcm47094-phicomm-k3.dtb \
++	bcm53016-meraki-mr32.dtb \
+ 	bcm94708.dtb \
+ 	bcm94709.dtb \
+ 	bcm953012er.dtb \
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -0,0 +1,197 @@
++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
++/*
++ * Broadcom BCM470X / BCM5301X ARM platform code.
++ * DTS for Meraki MR32 / Codename: Espresso
++ *
++ * Copyright (C) 2018-2020 Christian Lamparter <chunkeey at gmail.com>
++ */
++
++/dts-v1/;
++
++#include "bcm4708.dtsi"
++#include "bcm5301x-nand-cs0-bch8.dtsi"
++#include <dt-bindings/leds/common.h>
++
++/ {
++	compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708";
++	model = "Meraki MR32";
++
++	chosen {
++		bootargs = " console=ttyS0,115200n8 earlycon";
++	};
++
++	memory {
++		reg = <0x00000000 0x08000000>;
++		device_type = "memory";
++	};
++
++	aliases {
++		serial1 = &uart2;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		sysled3 {
++			function = LED_FUNCTION_FAULT;
++			color = <LED_COLOR_ID_AMBER>;
++			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
++			panic-indicator;
++		};
++		sysled2 {
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_WHITE>;
++			gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>;
++		};
++	};
++
++	keys {
++		compatible = "gpio-keys";
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		restart {
++			label = "Reset";
++			linux,code = <KEY_RESTART>;
++			gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	pwm-leds {
++		compatible = "pwm-leds";
++
++		red {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_RED>;
++			pwms = <&pwm 0 50000 0>;
++			max-brightness = <255>;
++		};
++
++		green {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_POWER;
++			color = <LED_COLOR_ID_GREEN>;
++			pwms = <&pwm 1 50000 0>;
++			max-brightness = <255>;
++		};
++
++		blue {
++			/* SYS-LED 1 - Tricolor */
++			function = LED_FUNCTION_INDICATOR;
++			color = <LED_COLOR_ID_BLUE>;
++			pwms = <&pwm 2 50000 0>;
++			max-brightness = <255>;
++		};
++	};
++
++	i2c {
++		/*
++		 * The platform provided I2C does not budge.
++		 * This is a replacement until I can figure
++		 * out what are the missing bits...
++		 */
++
++		compatible = "i2c-gpio";
++		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
++		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
++		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		current_sense: ina219 at 45 {
++			compatible = "ti,ina219";
++			reg = <0x45>;
++			shunt-resistor = <60000>; /* = 60 mOhms */
++		};
++
++		eeprom: eeprom at 50 {
++			compatible = "atmel,24c64";
++			reg = <0x50>;
++			pagesize = <32>;
++			read-only;
++		};
++	};
++};
++
++&uart0 {
++	clock-frequency = <62500000>;
++	/delete-property/ clocks;
++};
++
++&uart1 {
++	status = "disabled";
++};
++
++&uart2 {
++	status = "okay";
++	/*
++	 * bluetooth-le {
++	 *	compatible = "brcm,bcm20732";
++	 *	enable-gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>;
++	 *};
++	 */
++};
++
++&gmac1 {
++	status = "disabled";
++};
++&gmac2 {
++	status = "disabled";
++};
++&gmac3 {
++	status = "disabled";
++};
++
++&pwm {
++	status = "okay";
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_pwm>;
++};
++
++&nandcs {
++	nand-ecc-algo = "hw";
++
++	partitions {
++		/*
++		 * The partition autodetection does not work for this device.
++		 * It will only detect the "nvram" partition with an incorrect size.
++		 *	[    1.721667] 1 bcm47xxpart partitions found on MTD device brcmnand.0
++		 *	[    1.727962] Creating 1 MTD partitions on "brcmnand.0":
++		 *	[    1.733117] 0x000000400000-0x000008000000 : "nvram"
++		 */
++
++		compatible = "fixed-partitions";
++		#address-cells = <0x1>;
++		#size-cells = <0x1>;
++
++		partition0 at 0 {
++			label = "u-boot";
++			reg = <0x0 0x100000>;
++			read-only;
++		};
++
++		partition1 at 100000 {
++			label = "bootkernel1";
++			reg = <0x100000 0x300000>;
++			read-only;
++		};
++
++		partition2 at 400000 {
++			label = "nvram";
++			reg = <0x400000 0x100000>;
++			read-only;
++		};
++
++		partition3 at 500000 {
++			label = "bootkernel2";
++			reg = <0x500000 0x300000>;
++			read-only;
++		};
++
++		partition4 at 800000 {
++			label = "ubi";
++			reg = <0x800000 0x7780000>;
++		};
++	};
++};
diff --git a/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
new file mode 100644
index 0000000000..fb78ee93c4
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch
@@ -0,0 +1,28 @@
+From: Christian Lamparter <chunkeey at gmail.com>
+Date: Thu, 7 Jun 2018 19:29:12 +0200
+Subject: bcm53xx: add LED status label alias for Meraki MR32
+
+add an led-status alias label. This is used by OpenWrt's LED
+DTS lookup function to identifiy the indicator LED
+
+Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -27,6 +27,7 @@
+ 
+ 	aliases {
+ 		serial1 = &uart2;
++		led-status = &led_status;
+ 	};
+ 
+ 	leds {
+@@ -68,7 +69,7 @@
+ 			max-brightness = <255>;
+ 		};
+ 
+-		green {
++		led_status: green {
+ 			/* SYS-LED 1 - Tricolor */
+ 			function = LED_FUNCTION_POWER;
+ 			color = <LED_COLOR_ID_GREEN>;
-- 
2.28.0



From devel-sven at geroedel.de  Sat Sep 19 17:44:54 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Sat, 19 Sep 2020 23:44:54 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <a922fff6-7efd-8131-ae3c-8f9bfadbb2fb@david-bauer.net>
References: <5836172.LP2CDrWvR4@strike> <10757956.9tHsuBLZXe@strike>
 <a922fff6-7efd-8131-ae3c-8f9bfadbb2fb@david-bauer.net>
Message-ID: <16349278.dxtDtKCgZ7@strike>

Hello David,

Am Freitag, 18. September 2020, 09:44:10 CEST schrieb David Bauer:
> Hello Sven,
> 
> On 9/18/20 1:27 AM, Sven Roederer wrote:
> > Adrian, David,
> > 
> > Am Mittwoch, 16. September 2020, 16:15:42 CEST schrieb David Bauer:
> >> Hi,
> >> 
> >> On 9/16/20 11:40 AM, Adrian Schmutzler wrote:
> >>>> -----Original Message-----
> >>>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> >>>> On Behalf Of Sven Roederer
> >>>> Sent: Mittwoch, 16. September 2020 09:17
> >>>> To: openwrt-devel at lists.openwrt.org
> >>>> Subject: ath79: move 8/32 boards to tiny subtarget
> >>>> 
> >>>> Hi,
> >>>> 
> >>>> not sure if this has been discussed before.
> >>>> I recently worked with some 8/32 boards (Ubiquiti Nanostation M (XM),
> >>>> TPLink
> >>>> WR842 v2)  for our Freifunk-project and realized that the low RAM
> >>>> situation
> >>>> requires quite different handling than the full boards (8+/64+).
> >>>> 
> >>>> I wonder if there is a reason to not move the boards, which are
> >>>> affected
> >>>> by
> >>>> the 4/32MB warning also, to the ath79-tiny target?
> >>> 
> >>> I wonder whether the tiny subtarget will actually make much difference
> >>> for
> >>> RAM issues?
> > 
> > My idea based on the fact, to have an easy way to disable certain kernel-
> > features to reduce teh kernel-size (in flash and RAM). Candidates I see
> > here are: USB-Support, additional filesystems, block-devices, ...
> > Even some devices provide USB-connectors it might be better to have less
> > OOM- crashes and reboots than installing a usb-flashdrive. In our
> > Freifunk-Firmware I've seen much less runtime-problems with a stripped
> > down kernel.
> > With having the 8/32 in tiny it would just be a config-file for the
> > low-RAM
> > boards. Having them in generic subtarget would require to build 2 kernels
> > for the same subtarget.
> > 
> >> In it's current state, it will most likely increase low-memory issues as
> >> the squashfs blocksize is 1024kB compared to the regular 256kB. Not that
> >> ath79-tiny has no target-flag for small memory set.
> > 
> > Did you miss an "e" ? "Note that ath79-tiny has ..." gives more sense to
> > me. Reading it this way, you expect the larger blocksize was choosen as
> > tradeoff between using the flash most efficient vs. RAM for the 4/32
> > boards? I've seen there is a low_mem flag for some 16MB boards defined.
> > It seems that for some config-options SMALL_FLASH and LOW-MEM are
> > conflicting.
> 
> Yes, there was an e missing.
> 
> We've experienced severe system instabilities with larger blocksizes (the
> default one for ar71xx-tiny to be precise) downstream. [0] [1]
> 
> However, In my opinion the blocksize upstream works well for people looking
> for a home router, as memory consumption is typically lower and some
> additional space is desirable there.
> 

For that reason Freifunk-Gluon and Freifunk-Berlin use the non-default value. 
Esp. for the routing-daemons these project need more RAM for apps running.

> I could also imagine the low-mem target feature and It's configuration
> implications have to be assessed as a whole, given it did not experience
> much use for a longer period of time.
> 
Indeed "LOW_MEMORY_FOOTPRINT" seems only to affedt 3 general options and one 
option of OpenSSL.

So it might be an option to :
* set LOW_MEM for 8/32 MB devies
* set LOW_MEM and SMALL_FLASH for 4/32 MB devices
* check the CONFIG-options for usefull defaults
So the tiny aubtarget can be defined as "boards with 32MB or less of RAM; some 
boards also with only 4MB of flash". This definition would essentially match 
the "4/32 warning" [1]. 

[1] - https://openwrt.org/supported_devices/432_warning

Sven

> [0] https://github.com/freifunk-gluon/gluon/issues/2032
> [1]
> https://github.com/freifunk-gluon/gluon/commit/7e8af99cf504ca1dc389f282a0c9
> 4f4a911571be
> 






From mail at adrianschmutzler.de  Sat Sep 19 18:21:44 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sun, 20 Sep 2020 00:21:44 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <16349278.dxtDtKCgZ7@strike>
References: <5836172.LP2CDrWvR4@strike> <10757956.9tHsuBLZXe@strike>
 <a922fff6-7efd-8131-ae3c-8f9bfadbb2fb@david-bauer.net>
 <16349278.dxtDtKCgZ7@strike>
Message-ID: <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>

> Indeed "LOW_MEMORY_FOOTPRINT" seems only to affedt 3 general options
> and one option of OpenSSL.
> 
> So it might be an option to :
> * set LOW_MEM for 8/32 MB devies
> * set LOW_MEM and SMALL_FLASH for 4/32 MB devices
> * check the CONFIG-options for usefull defaults So the tiny aubtarget can be
> defined as "boards with 32MB or less of RAM; some boards also with only
> 4MB of flash". This definition would essentially match the "4/32 warning" [1].

Actually, this narrows down to a question that struck me several times already:

Now, that 4 MB flash devices are not "supported" anymore, how should we deal with the "tiny" subtargets:

1. We keep the tiny subtargets configured for low flash, so people still trying to build 4 MB flash devices still can use this. (This will also benefit a few devices with kernel size restrictions; however, this is a much smaller set than in earlier times; most of these devices have dual-stage bootloaders now or died anyway).

2. We convert the tiny targets to low-memory targets; this will improve the situation for a few devices (like you mentioned), but will make it much harder to still build the 4M flash devices without major changes. Apart from ath79, I don't know whether this would make sense for other targets like the old subtargets on ramips. This poses the risk of having some targets low-mem and some small-flash, which I'd like to avoid. Additionally, we will have to change back from low-mem to small-flash again when we start to hit limits with the 8M devices.

3. Though not intended by this conversation, the third option is obviously to just ignore all 4M or 32M devices from now on (as actually announced by the 4/32 warning), and design the tiny targets based on the requirements of the 8M devices that will start to become a "problem" soon (either due to kernel size restrictions or because of small rootfs). Actually, we already went into this direction by using wpad-basic-wolfssl on tiny targets as well.

Best

Adrian

> 
> [1] - https://openwrt.org/supported_devices/432_warning
> 
> Sven
> 
> > [0] https://github.com/freifunk-gluon/gluon/issues/2032
> > [1]
> > https://github.com/freifunk-
> gluon/gluon/commit/7e8af99cf504ca1dc389f28
> > 2a0c9
> > 4f4a911571be
> >
> 
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200920/2f9b7cdf/attachment.sig>

From rosenp at gmail.com  Sun Sep 20 01:31:37 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 19 Sep 2020 22:31:37 -0700
Subject: [PATCH 1/4] base-files/functions.sh: read grep output by line
Message-ID: <20200920053140.35255-1-rosenp@gmail.com>

From: https://github.com/koalaman/shellcheck/wiki/SC2013

For loops by default (subject to $IFS) read word by word.
Additionally, glob expansion will occur.

I believe the intended use case of these loops is to read lines.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/base-files/files/lib/functions.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 7da0c872fa..59bb0fe711 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -182,7 +182,8 @@ default_prerm() {
 	fi
 
 	local shell="$(command -v bash)"
-	for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
+	grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list" | while IFS= read -r i
+	do
 		if [ -n "$root" ]; then
 			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
 		else
@@ -260,7 +261,8 @@ default_postinst() {
 
 		if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
 			[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
-			for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
+			grep -s "^/etc/uci-defaults/" "$filelist" | while IFS= read -r i
+			do
 				( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
 			done
 			uci commit
@@ -270,7 +272,8 @@ default_postinst() {
 	fi
 
 	local shell="$(command -v bash)"
-	for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
+	grep -s "^/etc/init.d/" "$root$filelist" | while IFS= read -r i
+	do
 		if [ -n "$root" ]; then
 			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
 		else
-- 
2.26.2



From rosenp at gmail.com  Sun Sep 20 01:31:38 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 19 Sep 2020 22:31:38 -0700
Subject: [PATCH 2/4] base-files/functions.sh: do not iterate over ls
In-Reply-To: <20200920053140.35255-1-rosenp@gmail.com>
References: <20200920053140.35255-1-rosenp@gmail.com>
Message-ID: <20200920053140.35255-2-rosenp@gmail.com>

>From https://github.com/koalaman/shellcheck/wiki/SC2045 :

When looping over a set of files, it's always better to use globs when
possible. Using command expansion causes word splitting and glob
expansion, which will cause problems for certain filenames (typically
first seen when trying to process a file with spaces in the name).

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/base-files/files/lib/functions.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 59bb0fe711..0f56387244 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -290,8 +290,9 @@ default_postinst() {
 include() {
 	local file
 
-	for file in $(ls $1/*.sh 2>/dev/null); do
-		. $file
+	for file in "$1"/*.sh; do
+		[ -e "$file" ] || break
+		. "$file"
 	done
 }
 
-- 
2.26.2



From rosenp at gmail.com  Sun Sep 20 01:31:39 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 19 Sep 2020 22:31:39 -0700
Subject: [PATCH 3/4] base-files/functions.sh: replace ^ with ! in []
In-Reply-To: <20200920053140.35255-1-rosenp@gmail.com>
References: <20200920053140.35255-1-rosenp@gmail.com>
Message-ID: <20200920053140.35255-3-rosenp@gmail.com>

Strictly speaking, ash does not support it.

>From https://wiki.ubuntu.com/DashAsBinSh#A.5B.5E.5D :

Not to be confused by sed's and other program's regular expression
syntax. Uses of [^] in case (parameter/word expansion in general) need
to be replaced with [!].

Found with shellcheck: https://github.com/koalaman/shellcheck/wiki/SC2169

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/base-files/files/lib/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 0f56387244..a7ff50cb1a 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -108,7 +108,7 @@ config_unset() {
 # config_get <section> <option>
 config_get() {
 	case "$2${3:-$1}" in
-		*[^A-Za-z0-9_]*) : ;;
+		*[!A-Za-z0-9_]*) : ;;
 		*)
 			case "$3" in
 				"") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";;
-- 
2.26.2



From rosenp at gmail.com  Sun Sep 20 01:31:40 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 19 Sep 2020 22:31:40 -0700
Subject: [PATCH 4/4] base-files/functions.sh: quote variables in []
In-Reply-To: <20200920053140.35255-1-rosenp@gmail.com>
References: <20200920053140.35255-1-rosenp@gmail.com>
Message-ID: <20200920053140.35255-4-rosenp@gmail.com>

ash does not support [[]] syntax, which makes this redundant.

Found with https://github.com/koalaman/shellcheck/wiki/Sc2086

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/base-files/files/lib/functions.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index a7ff50cb1a..8ada3c376a 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -92,7 +92,7 @@ list() {
 	local len
 
 	config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
-	[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
+	[ "$len" = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
 	len=$((len + 1))
 	config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
 	config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
@@ -164,7 +164,7 @@ config_list_foreach() {
 
 	config_get len "${section}" "${option}_LENGTH"
 	[ -z "$len" ] && return 0
-	while [ $c -le "$len" ]; do
+	while [ "$c" -le "$len" ]; do
 		config_get val "${section}" "${option}_ITEM$c"
 		eval "$function \"\$val\" \"\$@\""
 		c="$((c + 1))"
-- 
2.26.2



From edgar.soldin at web.de  Sun Sep 20 06:12:24 2020
From: edgar.soldin at web.de (edgar.soldin at web.de)
Date: Sun, 20 Sep 2020 12:12:24 +0200
Subject: [PATCH 2/4] base-files/functions.sh: do not iterate over ls
In-Reply-To: <20200920053140.35255-2-rosenp@gmail.com>
References: <20200920053140.35255-1-rosenp@gmail.com>
 <20200920053140.35255-2-rosenp@gmail.com>
Message-ID: <ab677310-9dbd-3e08-d159-eff1b29aa1d7@web.de>

On 20.09.2020 07:31, Rosen Penev wrote:
> -	for file in $(ls $1/*.sh 2>/dev/null); do
> -		. $file
> +	for file in "$1"/*.sh; do
> +		[ -e "$file" ] || break
> +		. "$file"

the existence check is probably meant to catch "../*.sh" entry found if no files match. as files will likely not vanish during the loop this will probably work.
still it'll break the loop completely without any need. using 'continue' instead of 'break' would not break the loop and be safer here.

..ede


From zajec5 at gmail.com  Sun Sep 20 07:03:42 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Sun, 20 Sep 2020 13:03:42 +0200
Subject: [PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator
In-Reply-To: <20200901044534.329-5-todorcolov@abv.bg>
References: <20200901044534.329-1-todorcolov@abv.bg>
 <20200901044534.329-5-todorcolov@abv.bg>
Message-ID: <CACna6ryLaoGaKLqM16T6XLA2hHVGnTZvxhp1-yvZcOmvUnNs=w@mail.gmail.com>

On Tue, 1 Sep 2020 at 06:48, Todor Colov <todorcolov at abv.bg> wrote:
>
> ---
>  tools/firmware-utils/Makefile                 |   4 +-
>  tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
>  tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
>  .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
>  tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
>  tools/firmware-utils/src/linksys/crc.h        |  69 +++
>  tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
>  tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
>  8 files changed, 2066 insertions(+), 1 deletion(-)
>  create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
>  create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
>  create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
>  create mode 100644 tools/firmware-utils/src/linksys/crc.c
>  create mode 100644 tools/firmware-utils/src/linksys/crc.h
>  create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
>  create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

This adds quite a large amount of Broadcom garbage code that doesn't
fit your usage. It's hard to read, follow, understand and so maintain
too.

-- 
Rafa?


From zajec5 at gmail.com  Sun Sep 20 07:05:02 2020
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Sun, 20 Sep 2020 13:05:02 +0200
Subject: [PATCH v3 0/4] ipq806x: add support for Linksys E8350 - Cover
 letter
In-Reply-To: <20200901043709.1804-1-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
Message-ID: <CACna6rxkWhKOOZVXC2+GWf8nZquv_kZ934_ijp=O0dFDqVT8Ag@mail.gmail.com>

On Tue, 1 Sep 2020 at 06:41, Todor Colov <todorcolov at abv.bg> wrote:
> bundle of 4 patches to add support for Linksys E8350 dual band wifi router type AC2350

Apart from my comment on Broadcom code you also need to sign off all
your changes. See OpenWrt documentation on submitting patches and "git
help commit" and --signoff option.

-- 
Rafa?


From devel-sven at geroedel.de  Sun Sep 20 09:32:52 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Sun, 20 Sep 2020 15:32:52 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
References: <5836172.LP2CDrWvR4@strike> <16349278.dxtDtKCgZ7@strike>
 <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
Message-ID: <9009300.hBHk0JINo9@strike>

Am Sonntag, 20. September 2020, 00:21:44 CEST schrieb Adrian Schmutzler:
> > Indeed "LOW_MEMORY_FOOTPRINT" seems only to affedt 3 general options
> > and one option of OpenSSL.
> > 
> > So it might be an option to :
> > * set LOW_MEM for 8/32 MB devies
> > * set LOW_MEM and SMALL_FLASH for 4/32 MB devices
> > * check the CONFIG-options for usefull defaults So the tiny aubtarget can
> > be defined as "boards with 32MB or less of RAM; some boards also with
> > only 4MB of flash". This definition would essentially match the "4/32
> > warning" [1].
> Actually, this narrows down to a question that struck me several times
> already:
> 
> Now, that 4 MB flash devices are not "supported" anymore, how should we deal
> with the "tiny" subtargets:
> 
> 1. We keep the tiny subtargets configured for low flash, so people still
> trying to build 4 MB flash devices still can use this. (This will also
> benefit a few devices with kernel size restrictions; however, this is a
> much smaller set than in earlier times; most of these devices have
> dual-stage bootloaders now or died anyway).
> 
> 2. We convert the tiny targets to low-memory targets; this will improve the
> situation for a few devices (like you mentioned), but will make it much
> harder to still build the 4M flash devices without major changes. Apart
> from ath79, I don't know whether this would make sense for other targets
> like the old subtargets on ramips. This poses the risk of having some
> targets low-mem and some small-flash, which I'd like to avoid.
> Additionally, we will have to change back from low-mem to small-flash again
> when we start to hit limits with the 8M devices.
> 
> 3. Though not intended by this conversation, the third option is obviously
> to just ignore all 4M or 32M devices from now on (as actually announced by
> the 4/32 warning), and design the tiny targets based on the requirements of
> the 8M devices that will start to become a "problem" soon (either due to
> kernel size restrictions or because of small rootfs). Actually, we already
> went into this direction by using wpad-basic-wolfssl on tiny targets as
> well.
> 

Adrian,

thanks for reminding that 4/32 have be planned to phase out after 19.07.  This 
will or have to be done in the near future.
Reading  your points my quick idea was: "Moving the 4/32 and 8/32 to the tiny-
target for 20.xx and removing this target after 20.xx bramch-off". 
This shows clearly for 20.xx what will happen soon and the user can prepare 
for this finally. The code can possibly also cahnged to take more advantage of 
"low_mem" and "small_flash" flags for the "next 8/64 round".
regarding yout concerns that mixing 4/32 and 8/32 will make some more devices 
not usable I think like: this will break probably some 4/32 on tiny, but will 
make some 8/32 more usable. As the 4/32 warning is around fror some years now, 
nobody should be really surprised that the boards "dying" and that the 4/32 
boards dying before the 8/32.

Best Sven




From mail at adrianschmutzler.de  Sun Sep 20 15:31:35 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sun, 20 Sep 2020 21:31:35 +0200
Subject: [PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator -
 needed for factory FW updata over stock WEB interface
In-Reply-To: <20200901043709.1804-5-todorcolov@abv.bg>
References: <20200901043709.1804-1-todorcolov@abv.bg>
 <20200901043709.1804-5-todorcolov@abv.bg>
Message-ID: <005601d68f84$a79149a0$f6b3dce0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Todor Colov
> Sent: Dienstag, 1. September 2020 06:37
> To: openwrt-devel at lists.openwrt.org
> Cc: Todor Colov <todorcolov at abv.bg>
> Subject: [PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator -
> needed for factory FW updata over stock WEB interface
> 
> ---
>  tools/firmware-utils/Makefile                 |   4 +-
>  tools/firmware-utils/src/linksys/addfwhdr.c   | 195 ++++++++
>  tools/firmware-utils/src/linksys/bcmdefs.h    | 318 +++++++++++++
>  .../firmware-utils/src/linksys/code_pattern.h | 396 ++++++++++++++++
>  tools/firmware-utils/src/linksys/crc.c        | 290 ++++++++++++
>  tools/firmware-utils/src/linksys/crc.h        |  69 +++
>  tools/firmware-utils/src/linksys/cyutils.h    | 348 ++++++++++++++
>  tools/firmware-utils/src/linksys/typedefs.h   | 447 ++++++++++++++++++
>  8 files changed, 2066 insertions(+), 1 deletion(-)
>  create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
>  create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
>  create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
>  create mode 100644 tools/firmware-utils/src/linksys/crc.c
>  create mode 100644 tools/firmware-utils/src/linksys/crc.h
>  create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
>  create mode 100644 tools/firmware-utils/src/linksys/typedefs.h
> 
> diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
> index 39c3503886..1dcbd0db77 100644
> --- a/tools/firmware-utils/Makefile
> +++ b/tools/firmware-utils/Makefile
> @@ -24,6 +24,8 @@ endef
> 
>  define Host/Compile
>  	mkdir -p $(HOST_BUILD_DIR)/bin
> +	mkdir -p $(HOST_BUILD_DIR)/bin/linksys
> +	$(call cc,linksys/addfwhdr linksys/crc )

I'd personally really like if you followed the existing scheme here, so no folders, proper alphabetic sorting, and one file per line.

Best

Adrian

>  	$(call cc,add_header)
>  	$(call cc,addpattern)
>  	$(call cc,asustrx)
> @@ -98,7 +100,7 @@ define Host/Compile
>  endef
> 
>  define Host/Install
> -	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/*
> $(STAGING_DIR_HOST)/bin/
> +	$(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
>  endef
> 
>  $(eval $(call HostBuild))
> diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c b/tools/firmware-
> utils/src/linksys/addfwhdr.c
> new file mode 100644
> index 0000000000..6e2896c62d
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/addfwhdr.c
> @@ -0,0 +1,195 @@
> +#include <stdio.h>
> +#include <string.h>
> +#include <stdlib.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <sys/stat.h>
> +#include <stdarg.h>
> +#include <getopt.h>
> +#include <time.h>
> +#include <sys/time.h>
> +
> +#include "cyutils.h"
> +#include "code_pattern.h"
> +
> +#include "typedefs.h"
> +
> +#define MAX_BUF	1024
> +#define CRC32_INIT_VALUE 0xffffffff	/* Initial CRC32 checksum
> value */
> +
> +extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
> +
> +int fd, fd_w;
> +
> +void die(const char * str, ...)
> +{
> +	va_list args;
> +	va_start(args, str);
> +	vfprintf(stderr, str, args);
> +	fputc('\n', stderr);
> +	exit(1);
> +}
> +
> +int
> +fill_null0(int size)
> +{
> +	unsigned char buf[1];
> +	int i;
> +
> +	fprintf(stderr,"Fill null\n");
> +
> +	buf[0] = 0xff;
> +	for (i=0 ; i< size; i++ )
> +		if (write(fd_w, buf, 1) != 1)
> +			return 0;
> +
> +	return 1;
> +}
> +
> +long
> +file_open(const char *name)
> +{
> +	struct stat sb;
> +	if ((fd = open(name, O_RDONLY, 0)) < 0){
> +		die("Unable to open `%s' : %m", name);
> +	}
> +
> +	if (fstat (fd, &sb))
> +		die("Unable to stat `%s' : %m", name);
> +
> +	return sb.st_size;
> +}
> +
> +void usage(void)
> +{
> +	die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output]
> code.bin\n");
> +}
> +
> +int main(int argc, char ** argv)
> +{
> +	uint input_size,c;
> +	char *input_file=NULL, *output_file=NULL;
> +        int opt;
> +        int option_index=0;
> +	int garbage = 0;
> +	char *buf = NULL;
> +        extern char *optarg;
> +        extern int optind, opterr, optopt;
> +
> +	struct cbt_fw_header *fwhdr;
> +	uint32 crc;
> +
> +        static struct option long_options[] =
> +	{
> +		{"input", 1, 0, 'i'},
> +		{"output", 1, 0, 'o'},
> +		{"garbage", 0, 0, 'g'},
> +		{0, 0, 0, 0}
> +	};
> +
> +	printf("\n---------- add fw header --------\n");
> +
> +        fwhdr  = malloc(sizeof(struct cbt_fw_header));
> +	memset(fwhdr, 0, sizeof(struct cbt_fw_header));
> +
> +	while(1){
> +		opt = getopt_long(argc, argv, "i:o:g",long_options,
> &option_index);
> +		if(opt == -1)
> +			break;
> +		switch(opt){
> +			case 'h' :
> +				usage(); break;
> +			case 'i' :
> +				input_file = optarg;
> +				printf("input file is [%s]\n",input_file); break;
> +			case 'o' :
> +				output_file = optarg;
> +				printf("output file is [%s]\n",output_file);
> break;
> +			case 'g' :
> +				garbage = 1; break;
> +			default :
> +				usage();
> +		}
> +	}
> +
> +	if(!input_file || !output_file)
> +	{
> +		printf("You must specify the input and output file!\n");
> +		usage();
> +	}
> +
> +
> +	unlink(output_file);
> +	if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREAD |
> S_IWRITE)) < 0){
> +		die("Unable to open `%s' : %m", output_file);
> +	}
> +
> +	fwhdr = malloc(sizeof(struct cbt_fw_header));
> +	memset(fwhdr, 0, sizeof(struct cbt_fw_header));
> +
> +	memcpy((char *)&fwhdr->magic, FWHDR_MAGIC_STR,
> sizeof(fwhdr->magic));
> +
> +	input_size = file_open(input_file);
> +	if(!(buf = malloc(input_size)))
> +	{
> +		perror("malloc");
> +		goto fail;
> +	}
> +	c = read(fd, buf, input_size);
> +	fwhdr->len = input_size + sizeof(struct cbt_fw_header);
> +
> +	fwhdr->res = fwhdr->res | 0x1;
> +
> +	//junzhao add fw build date in cbt_fw_header for calculate MD5
> +	#if 0
> +	{
> +	       static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
> "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
> +	       int year, day, mon=1;
> +               char temp[10]={0};
> +	       unsigned char *p_date = (unsigned char *)&fwhdr->res;
> +               int j;
> +
> +               sscanf(__DATE__, "%s %d %d", temp, &day, &year);
> +
> +               for(j=0;j<12;j++) {
> +                       if(!strcmp(temp, months[j])) {
> +                               mon = j+1;
> +                               break;
> +                       }
> +               }
> +               p_date[0]= year-2000;
> +               p_date[1]= mon;
> +               p_date[2]= day;
> +
> +	       printf("%s: Build date(20%d-%d-%d)\n", __FUNCTION__,
> p_date[0], p_date[1], p_date[2]);
> +
> +	}
> +	#endif
> +	//end
> +
> +	crc = crc32((uint8 *)&fwhdr->res, 4, CRC32_INIT_VALUE);
> +	crc = crc32((uint8 *)&buf[0], input_size, crc);
> +
> +	fwhdr->crc32 = crc;
> +
> +	/* write code pattern header */
> +	write(fd_w, fwhdr, sizeof(struct cbt_fw_header));
> +
> +	if(write(fd_w, buf, c)!=c)
> +		die("Write call failed!\n");
> +
> +#if 0
> +	if(garbage == 1){			// add garbage, let image is a
> multiple of 1024, and the web upgrade will ok
> +		printf("Add %d bytes garbage\n",1024-32);
> +		if(!fill_null0(1024-32))
> +			die("error!\n");
> +	}
> +#endif
> +fail:
> +	if(buf)
> +		free(buf);
> +	close (fd);
> +	close (fd_w);
> +
> +	return 0;
> +}
> diff --git a/tools/firmware-utils/src/linksys/bcmdefs.h b/tools/firmware-
> utils/src/linksys/bcmdefs.h
> new file mode 100644
> index 0000000000..edd7397892
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/bcmdefs.h
> @@ -0,0 +1,318 @@
> +/*
> + * Misc system wide definitions
> + *
> + * Copyright (C) 2009, Broadcom Corporation
> + * All Rights Reserved.
> + *
> + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO
> WARRANTIES OF ANY
> + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR
> OTHERWISE. BROADCOM
> + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF
> MERCHANTABILITY, FITNESS
> + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS
> SOFTWARE.
> + *
> + * $Id: bcmdefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
> + */
> +
> +#ifndef	_bcmdefs_h_
> +#define	_bcmdefs_h_
> +
> +/*
> + * One doesn't need to include this file explicitly, gets included automatically
> if
> + * typedefs.h is included.
> + */
> +
> +/* Use BCM_REFERENCE to suppress warnings about intentionally-unused
> function
> + * arguments or local variables.
> + */
> +#define BCM_REFERENCE(data)	((void)data)
> +
> +/* Reclaiming text and data :
> + * The following macros specify special linker sections that can be reclaimed
> + * after a system is considered 'up'.
> + * BCMATTACHFN is also used for detach functions (it's not worth having a
> BCMDETACHFN,
> + * as in most cases, the attach function calls the detach function to clean up
> on error).
> + */
> +#ifdef DONGLEBUILD
> +
> +extern bool bcmreclaimed;
> +
> +#define BCMATTACHDATA(_data)	__attribute__ ((__section__
> (".dataini2." #_data))) _data
> +#define BCMATTACHFN(_fn)	__attribute__ ((__section__ (".textini2."
> #_fn))) _fn
> +
> +#define BCMPREATTACHDATA(_data)	__attribute__ ((__section__
> (".dataini2." #_data))) _data
> +#define BCMPREATTACHFN(_fn)	__attribute__ ((__section__
> (".textini2." #_fn))) _fn
> +
> +#if defined(BCMRECLAIM)
> +#define BCMINITDATA(_data)	__attribute__ ((__section__
> (".dataini1." #_data))) _data
> +#define BCMINITFN(_fn)		__attribute__ ((__section__
> (".textini1." #_fn))) _fn
> +#define CONST
> +#else
> +#define BCMINITDATA(_data)	_data
> +#define BCMINITFN(_fn)		_fn
> +#define CONST	const
> +#endif
> +
> +/* Non-manufacture or internal attach function/dat */
> +#if !defined(WLTEST)
> +#define	BCMNMIATTACHFN(_fn)	BCMATTACHFN(_fn)
> +#define	BCMNMIATTACHDATA(_data)	BCMATTACHDATA(_data)
> +#else
> +#define	BCMNMIATTACHFN(_fn)	_fn
> +#define	BCMNMIATTACHDATA(_data)	_data
> +#endif
> +
> +#define BCMUNINITFN(_fn)	_fn
> +
> +#define BCMFASTPATH
> +
> +#else /* DONGLEBUILD */
> +
> +#define bcmreclaimed 		0
> +#define BCMATTACHDATA(_data)	_data
> +#define BCMATTACHFN(_fn)	_fn
> +#define BCMPREATTACHDATA(_data)	_data
> +#define BCMPREATTACHFN(_fn)	_fn
> +#define BCMINITDATA(_data)	_data
> +#define BCMINITFN(_fn)		_fn
> +#define BCMUNINITFN(_fn)	_fn
> +#define	BCMNMIATTACHFN(_fn)	_fn
> +#define	BCMNMIATTACHDATA(_data)	_data
> +#define CONST	const
> +#ifdef mips
> +#define BCMFASTPATH		__attribute__
> ((__section__(".text.fastpath")))
> +#else
> +#define BCMFASTPATH
> +#endif
> +
> +#endif /* DONGLEBUILD */
> +
> +#if defined(BCMROMOFFLOAD) || defined(BCMROMBUILD)
> +typedef struct {
> +	uint16 esiz;
> +	uint16 cnt;
> +	void *addr;
> +} bcmromdat_patch_t;
> +#endif
> +
> +/* Put some library data/code into ROM to reduce RAM requirements */
> +#if defined(BCMROMOFFLOAD)
> +#define BCMROMDATA(_data)	__attribute__ ((weak, __section__
> (".datarom."#_data))) _data
> +#define BCMROMDAT_NAME(_data)	_data
> +#define BCMROMFN(_fn)		__attribute__ ((weak, long_call,
> __section__ (".textrom."#_fn))) _fn
> +#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
> +#define BCMROMDAT_SIZEOF(data)	sizeof(data)
> +#define BCMROMDAT_APATCH(data) \
> +	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
> +	{ sizeof(data[0]), sizeof(data)/sizeof(data[0]), ((void*)data) };
> +#define BCMROMDAT_SPATCH(data) \
> +	const bcmromdat_patch_t BCMROMDATA(data##__bcmpatch) = \
> +	{ sizeof(data), 1, ((void*)&data) };
> +#define BCMROMFN_NAME(_fn)	_fn
> +#define STATIC
> +#elif defined(BCMROMBUILD)
> +#include <bcmjmptbl.h>
> +#define STATIC
> +#else /* !BCMROMBUILD */
> +#define BCMROMDATA(_data)	_data
> +#define BCMROMDAT_NAME(_data)	_data
> +#define BCMROMFN(_fn)		_fn
> +#define BCMROMFN_NAME(_fn)	_fn
> +#define STATIC	static
> +#define BCMROMDAT_ARYSIZ(data)	ARRAYSIZE(data)
> +#define BCMROMDAT_SIZEOF(data)	sizeof(data)
> +#define BCMROMDAT_APATCH(data)
> +#define BCMROMDAT_SPATCH(data)
> +#endif /* !BCMROMBUILD */
> +
> +/* Bus types */
> +#define	SI_BUS			0	/* SOC Interconnect */
> +#define	PCI_BUS			1	/* PCI target */
> +#define	PCMCIA_BUS		2	/* PCMCIA target */
> +#define SDIO_BUS		3	/* SDIO target */
> +#define JTAG_BUS		4	/* JTAG */
> +#define USB_BUS			5	/* USB (does not support R/W
> REG) */
> +#define SPI_BUS			6	/* gSPI target */
> +#define RPC_BUS			7	/* RPC target */
> +
> +/* Allows size optimization for single-bus image */
> +#ifdef BCMBUSTYPE
> +#define BUSTYPE(bus) 	(BCMBUSTYPE)
> +#else
> +#define BUSTYPE(bus) 	(bus)
> +#endif
> +
> +/* Allows size optimization for single-backplane image */
> +#ifdef BCMCHIPTYPE
> +#define CHIPTYPE(bus) 	(BCMCHIPTYPE)
> +#else
> +#define CHIPTYPE(bus) 	(bus)
> +#endif
> +
> +
> +/* Allows size optimization for SPROM support */
> +#if defined(BCMSPROMBUS)
> +#define SPROMBUS	(BCMSPROMBUS)
> +#elif defined(SI_PCMCIA_SROM)
> +#define SPROMBUS	(PCMCIA_BUS)
> +#else
> +#define SPROMBUS	(PCI_BUS)
> +#endif
> +
> +/* Allows size optimization for single-chip image */
> +#ifdef BCMCHIPID
> +#define CHIPID(chip)	(BCMCHIPID)
> +#else
> +#define CHIPID(chip)	(chip)
> +#endif
> +
> +#ifdef BCMCHIPREV
> +#define CHIPREV(rev)	(BCMCHIPREV)
> +#else
> +#define CHIPREV(rev)	(rev)
> +#endif
> +
> +/* Defines for DMA Address Width - Shared between OSL and HNDDMA */
> +#define DMADDR_MASK_32 0x0		/* Address mask for 32-bits */
> +#define DMADDR_MASK_30 0xc0000000	/* Address mask for 30-bits */
> +#define DMADDR_MASK_0  0xffffffff	/* Address mask for 0-bits (hi-
> part) */
> +
> +#define	DMADDRWIDTH_30  30 /* 30-bit addressing capability */
> +#define	DMADDRWIDTH_32  32 /* 32-bit addressing capability */
> +#define	DMADDRWIDTH_63  63 /* 64-bit addressing capability */
> +#define	DMADDRWIDTH_64  64 /* 64-bit addressing capability */
> +
> +#ifdef BCMDMA64OSL
> +typedef struct {
> +	uint32 loaddr;
> +	uint32 hiaddr;
> +} dma64addr_t;
> +
> +typedef dma64addr_t dmaaddr_t;
> +#define PHYSADDRHI(_pa) ((_pa).hiaddr)
> +#define PHYSADDRHISET(_pa, _val) \
> +	do { \
> +		(_pa).hiaddr = (_val);		\
> +	} while (0)
> +#define PHYSADDRLO(_pa) ((_pa).loaddr)
> +#define PHYSADDRLOSET(_pa, _val) \
> +	do { \
> +		(_pa).loaddr = (_val);		\
> +	} while (0)
> +
> +#else
> +typedef unsigned long dmaaddr_t;
> +#define PHYSADDRHI(_pa) (0)
> +#define PHYSADDRHISET(_pa, _val)
> +#define PHYSADDRLO(_pa) ((_pa))
> +#define PHYSADDRLOSET(_pa, _val) \
> +	do { \
> +		(_pa) = (_val);			\
> +	} while (0)
> +#endif /* BCMDMA64OSL */
> +
> +/* One physical DMA segment */
> +typedef struct  {
> +	dmaaddr_t addr;
> +	uint32	  length;
> +} hnddma_seg_t;
> +
> +#if defined(MACOSX)
> +/* In MacOS, the OS API may return large number of segments. Setting this
> number lower
> + * will result in failure of dma map
> + */
> +#define MAX_DMA_SEGS 8
> +#else
> +#define MAX_DMA_SEGS 4
> +#endif
> +
> +
> +typedef struct {
> +	void *oshdmah; /* Opaque handle for OSL to store its information */
> +	uint origsize; /* Size of the virtual packet */
> +	uint nsegs;
> +	hnddma_seg_t segs[MAX_DMA_SEGS];
> +} hnddma_seg_map_t;
> +
> +
> +/* packet headroom necessary to accommodate the largest header in the
> system, (i.e TXOFF).
> + * By doing, we avoid the need  to allocate an extra buffer for the header
> when bridging to WL.
> + * There is a compile time check in wlc.c which ensure that this value is at
> least as big
> + * as TXOFF. This value is used in dma_rxfill (hnddma.c).
> + */
> +
> +#if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
> +/* add 40 bytes to allow for extra RPC header and info  */
> +#define BCMEXTRAHDROOM 220
> +#else /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
> +#ifdef CTFMAP
> +#define BCMEXTRAHDROOM 176
> +#else /* CTFMAP */
> +#define BCMEXTRAHDROOM 172
> +#endif /* CTFMAP */
> +#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY */
> +
> +/* Headroom required for dongle-to-host communication.  Packets
> allocated
> + * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should
> + * leave this much room in front for low-level message headers which may
> + * be needed to get across the dongle bus to the host.  (These messages
> + * don't go over the network, so room for the full WL header above would
> + * be a waste.).
> + */
> +#ifdef BCMUSBDEV
> +#define BCMDONGLEHDRSZ 0
> +#define BCMDONGLEPADSZ 0
> +#else
> +#define BCMDONGLEHDRSZ 12
> +#define BCMDONGLEPADSZ 16
> +#endif
> +
> +#define BCMDONGLEOVERHEAD	(BCMDONGLEHDRSZ +
> BCMDONGLEPADSZ)
> +
> +#ifdef BCMDBG
> +
> +#ifndef BCMDBG_ERR
> +#define BCMDBG_ERR
> +#endif /* BCMDBG_ERR */
> +
> +#ifndef BCMDBG_ASSERT
> +#define BCMDBG_ASSERT
> +#endif /* BCMDBG_ASSERT */
> +
> +#endif /* BCMDBG */
> +
> +#if defined(BCMDBG_ASSERT) || defined(BCMASSERT_LOG)
> +#define BCMASSERT_SUPPORT
> +#endif /* BCMDBG_ASSERT || BCMASSERT_LOG */
> +
> +/* Macros for doing definition and get/set of bitfields
> + * Usage example, e.g. a three-bit field (bits 4-6):
> + *    #define <NAME>_M	BITFIELD_MASK(3)
> + *    #define <NAME>_S	4
> + * ...
> + *    regval = R_REG(osh, &regs->regfoo);
> + *    field = GFIELD(regval, <NAME>);
> + *    regval = SFIELD(regval, <NAME>, 1);
> + *    W_REG(osh, &regs->regfoo, regval);
> + */
> +#define BITFIELD_MASK(width) \
> +		(((unsigned)1 << (width)) - 1)
> +#define GFIELD(val, field) \
> +		(((val) >> field ## _S) & field ## _M)
> +#define SFIELD(val, field, bits) \
> +		(((val) & (~(field ## _M << field ## _S))) | \
> +		 ((unsigned)(bits) << field ## _S))
> +
> +/* define BCMSMALL to remove misc features for memory-constrained
> environments */
> +#ifdef BCMSMALL
> +#undef	BCMSPACE
> +#define bcmspace	FALSE	/* if (bcmspace) code is discarded */
> +#else
> +#define	BCMSPACE
> +#define bcmspace	TRUE	/* if (bcmspace) code is retained */
> +#endif
> +
> +/* Max. nvram variable table size */
> +#define	MAXSZ_NVRAM_VARS	4096
> +
> +#define LOCATOR_EXTERN static
> +
> +#endif /* _bcmdefs_h_ */
> diff --git a/tools/firmware-utils/src/linksys/code_pattern.h
> b/tools/firmware-utils/src/linksys/code_pattern.h
> new file mode 100644
> index 0000000000..0bbaa1102d
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/code_pattern.h
> @@ -0,0 +1,396 @@
> +#ifndef _CODE_PATTERN_H_
> +#define _CODE_PATTERN_H_
> +
> +#define CODE_ID		"U2ND"
> +#define BOOT_PATTERN	"EST"
> +#define UP_PMON		1
> +#define UP_MAC		2
> +#define UP_CODE		3
> +#define UP_PIGGY	4
> +#define UP_EOU_KEY	5
> +#define UP_SN		6
> +#define UP_LANG		7
> +#define UP_T_CERT	8
> +#define CMP_T_CERT	9	//for factory test.
> +#define UP_CODE2       10
> +#define UP_FULL_WL     11
> +#define UP_WSC_PIN     12
> +#define UP_COUNTRY     13
> +#define UP_QUAN_BOOT   14
> +#define UP_QUAN_IMAGE   15
> +
> +#define LINKSYS		7
> +#define PCI_OEM		9	// <remove the line>
> +#define ELSA		10	// <remove the line>
> +#define ALLNET		11	// <remove the line>
> +#define REENET		12	// 2003/06/21	<remove the line>
> +#define CISCO		90
> +#define	OTHER_OEM	99	// <remove the line>
> +
> +#define ENGLISH 	1
> +#define JAPANESE	2
> +#define GERMAN		3
> +#define FRENCH		4
> +#define KOREAN		5
> +
> +#define	USA		1
> +#define	JAPAN		2
> +#define	EUROPE		3
> +#define WW		4
> +#define GERMANY		5
> +#define	KOREA		6
> +#define	FRANCE		7
> +
> +#define	WRT54G		1
> +#define	WRT54GS		2
> +#define	WRT54V5		3
> +#define	DPN		4
> +#define	RTA41		5
> +#define	WRT54G3G	6
> +#define	T_MOBILE 	7
> +#define WRT300N		8
> +#define WRT54GL         9
> +#define WRT54GSV4       10
> +#define WRT350N		11
> +#define WRT610N		12
> +#define WRT61XN		13
> +#define E200		14
> +#define E300		15
> +//John
> +#define WRT54GV5        16
> +
> +#define E3200		17
> +#define E4200		18
> +#define E2500		19
> +#define AC2350		20
> +
> +
> +#define CES_M_SERIAL	1
> +#define CES_E_SERIAL	2
> +
> +/***************************************
> + * define OEM                          *
> + * Don't edit, auto edit by select.sh  *
> + ***************************************/
> +#define OEM LINKSYS //LINKSYS
> +//#define OEM PCI_OEM //PCI_OEM
> +//#define OEM ELSA //ELSA
> +//#define OEM ALLNET //ALLNET
> +//#define OEM REENET //REENET
> +//#define OEM OTHER_OEM //OTHER_OEM
> +
> +/***************************************
> + * define MODEL NAME                          *
> + * Don't edit, auto edit by select.sh  *
> + ***************************************/
> +
> +//#define LINKSYS_MODEL E3200 //E3200
> +//#define LINKSYS_MODEL E300 //E300
> +//#define LINKSYS_MODEL E200 //E200
> +//#define LINKSYS_MODEL E4200 //E4200
> +//#define LINKSYS_MODEL E2500 //E2500
> +#define LINKSYS_MODEL AC2350 //AC2350
> +
> +/***************************************
> + * define MODEL SERIAL                          *
> + * Don't edit, auto edit by select.sh  *
> + ***************************************/
> +//#define LINKSYS_MODEL_SERIAL CES_M_SERIAL //CES_M_SERIAL
> +#define LINKSYS_MODEL_SERIAL CES_E_SERIAL //CES_E_SERIAL
> +
> +/***************************************
> + * define country                      *
> + * LOCALE=COUNTRY =                    *
> + ***************************************/
> +#define COUNTRY		LOCALE
> +#define LOCALE USA
> +//#define LOCALE JAPAN
> +//#define LOCALE EUROPE
> +//#define LOCALE WW
> +//#define LOCALE GERMANY
> +//#define LOCALE FRANCE
> +//#define LOCALE KOREA
> +//#define LOCALE UK
> +
> +/***************************************
> + * define model name and code pattern  *
> + * MODEL_NAME =                        *
> + * CODE_PATTERN =                      *
> + ***************************************/
> +#if OEM == LINKSYS
> +	#define	CT_VENDOR		"LINKSYS"
> +	#define UI_STYLE	CISCO
> +
> +	#if LINKSYS_MODEL == WRT54GS
> +		#define CODE_PATTERN   "W54S"
> +		#if LOCALE == GERMANY
> +			#define MODEL_NAME	"WRT54GS-DE"
> +			#define MODEL_VERSION	""
> +		#elif LOCALE == FRANCE
> +			#define MODEL_NAME	"WRT54GS-FR"
> +			#define MODEL_VERSION	""
> +		#elif LOCALE == JAPAN
> +			#define MODEL_NAME	"WRT54GS-JP"
> +			#define MODEL_VERSION	""
> +		#else
> +			#define MODEL_NAME	"WRT54GS"
> +			#define MODEL_VERSION	"V3.0"
> +		#endif
> +	#elif LINKSYS_MODEL == WRT54GSV4
> +		#define CODE_PATTERN   "W54s"
> +		#define MODEL_NAME     "WRT54GSV4"
> +		#define MODEL_VERSION  ""
> +	#elif LINKSYS_MODEL == DPN  //DPN
> +		#define CODE_PATTERN   "WDPN"
> +		#define MODEL_NAME     "DPN"
> +		#define MODEL_VERSION	""
> +	#elif LINKSYS_MODEL == WRT54GV5
> +		#define CODE_PATTERN   "W54V"
> +		#define MODEL_NAME     "WRTA54G"
> +		#define MODEL_VERSION	""
> +	#elif LINKSYS_MODEL == RTA41
> +		#define CODE_PATTERN   "W54N"
> +		#define MODEL_NAME     "RTA41"
> +		#define MODEL_VERSION	""
> +	#elif LINKSYS_MODEL == WRT54G3G
> +		#define CODE_PATTERN   "W54F"
> +		#if LOCALE == EUROPE
> +			#define MODEL_NAME     "WRT54G3G-EU"
> +			#define MODEL_VERSION	""
> +		#elif LOCALE == UK
> +			#define MODEL_NAME     "WRT54G3G-UK"
> +			#define MODEL_VERSION	""
> +		#else
> +			#define MODEL_NAME     "WRT54G3G"
> +			#define MODEL_VERSION	"V1"
> +		#endif
> +	#elif LINKSYS_MODEL == T_MOBILE
> +		#define CODE_PATTERN   "W54T"
> +		#define MODEL_NAME     "WRT54G-TM"
> +		#define MODEL_VERSION	"V3.0"
> +	#elif LINKSYS_MODEL == WRT300N
> +		#define CODE_PATTERN   "EWCB"
> +		#define MODEL_NAME     "WRT300N"
> +		#define MODEL_VERSION	"V1.0"
> +	#elif LINKSYS_MODEL == WRT350N
> +		#define CODE_PATTERN   "EWCG"
> +		#define MODEL_NAME     "WRT350N"
> +		#define MODEL_VERSION	"V1.0"
> +	#elif LINKSYS_MODEL == WRT54G
> +		#define CODE_PATTERN   "W54G"
> +		#if LOCALE == GERMANY
> +			#define MODEL_NAME	"WRT54G-DE"
> +			#define MODEL_VERSION	""
> +		#elif LOCALE == FRANCE
> +			#define MODEL_NAME	"WRT54G-FR"
> +			#define MODEL_VERSION	""
> +		#elif LOCALE == JAPAN
> +			#define MODEL_NAME	"WRT54G-JP"
> +			#define MODEL_VERSION	""
> +		#else
> +			#define MODEL_NAME	"WRT54G"
> +			#define MODEL_VERSION	"V4.0"
> +		#endif
> +	#elif LINKSYS_MODEL == WRT54GL
> +		#define CODE_PATTERN   "W54G"
> +		#define MODEL_NAME	"WRT54GL"
> +		#define MODEL_VERSION	"V1"
> +	#elif LINKSYS_MODEL == WRT610N
> +		#define CODE_PATTERN   "610N"
> +		#define MODEL_NAME	"WRT610N"
> +		#define MODEL_VERSION	"V2"              //V1 or V2
> +	#elif LINKSYS_MODEL == E200
> +		#define CODE_PATTERN   "32XN"
> +		#define MODEL_NUMBER	"E2000"
> +		#define MODEL_NAME	"Linksys E2000"
> +		#define MODEL_VERSION	"V1.0"
> +	#elif LINKSYS_MODEL == E300
> +		#define CODE_PATTERN   "61XN"
> +		#define MODEL_NUMBER	"E3000"	    //model
> number added by Jemmy 2009.11.17
> +		#define MODEL_NAME	"Linksys E3000"
> +		#define MODEL_VERSION	"V1"              //V1 or V2
> +	#elif LINKSYS_MODEL == E3200
> +		#define CODE_PATTERN   "3200"
> +		#define MODEL_NUMBER	"E3200"	    //model
> number added by zhaoguang 2010.10.25
> +		#define MODEL_NAME	"Linksys E3200"
> +		#define MODEL_VERSION	"V1"
> +	#elif LINKSYS_MODEL == E4200
> +		#define CODE_PATTERN   "4200"
> +		#define MODEL_NUMBER	"E4200"	    //model
> number added by Jemmy 2009.11.17
> +		#define MODEL_NAME	"Linksys E4200"
> +		#define MODEL_VERSION	"V1"              //V1 or V2
> +	#elif (LINKSYS_MODEL == E2500)
> +		#define CODE_PATTERN   "25V3"
> +		#define MODEL_NUMBER	"E2500"	    //model
> number
> +		#define MODEL_NAME	"Linksys E2500"
> +		#define MODEL_VERSION	"V3"              //V1 or V2
> +	#elif (LINKSYS_MODEL == AC2350)
> +		#define CODE_PATTERN   "8350"
> +		#define MODEL_NUMBER	"E8350"	    //model
> number
> +		#define MODEL_NAME	"Linksys E8350"
> +		#define MODEL_VERSION	"V1"              //V1 or V2
> +
> +	#else
> +		#error "You must select a LINKSYS_MODEL!!"
> +	#endif
> +
> +	#if LINKSYS_MODEL == WRT54G || LINKSYS_MODEL == WRT54GL
> +		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v1.41.8"
> +		#define BCM4712_CHIP_SUPPORT_VERSION_FROM
> "v1.50.0"
> +		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM
> "v1.3"
> +		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM
> "v2.0"
> +	#else
> +		#define INTEL_FLASH_SUPPORT_VERSION_FROM "v0.00.0"
> +		#define BCM4712_CHIP_SUPPORT_VERSION_FROM
> "v0.00.0"
> +		#define INTEL_FLASH_SUPPORT_BOOT_VERSION_FROM
> "v0.0"
> +		#define BCM4712_CHIP_SUPPORT_BOOT_VERSION_FROM
> "v0.0"
> +	#endif
> +	#if	LINKSYS_MODEL == WRT350N
> +		#define WRT350N_SUPPORT_VERSION_FROM "v0.85.3"
> 
> +	#endif
> +
> +#elif OEM == PCI_OEM
> +	#define CODE_PATTERN    "W54P"
> +	#if LOCALE == JAPAN
> +		#define MODEL_NAME	"Planex BLW-04G Wireless
> Router"
> +	#else
> +		#define MODEL_NAME	"Advanced Wireless 11g
> Router"
> +	#endif
> +	#define	CT_VENDOR		"PCI"
> +#elif OEM == ELSA
> +	#define CODE_PATTERN    "W54E"
> +	#define MODEL_NAME	"ELSA WLAN DSL-Router 4P G"
> +	#define	CT_VENDOR	"ELSA"
> +#elif OEM == ALLNET
> +	#define CODE_PATTERN    "W54A"
> +	#define MODEL_NAME	"Advanced Wireless 11g Router"
> +	#define	CT_VENDOR	"ALLNET"
> +#elif OEM == REENET
> +	#define CODE_PATTERN    "W54R"
> +	#define MODEL_NAME	"RW-IPG500"
> +	#define	CT_VENDOR	"REENET"
> +#elif OEM == OTHER_OEM
> +	#define CODE_PATTERN    "W54O"
> +	#define MODEL_NAME	"Advanced Wireless 11g Router"
> +	#define	CT_VENDOR	"OTHER_OEM"
> +#else
> +	#error "Your must select a OEM name!!"
> +#endif
> +
> +/***************************************
> + * define language                     *
> + * LANGUAGE =                          *
> + * LANG_SEL=EN                         *
> + * HTTP_CHARSET =		       *
> + ***************************************/
> +#if LOCALE == JAPAN
> +	#define	LANGUAGE	JAPANESE
> +	#define	HTTP_CHARSET	"shift-jis"
> +#elif LOCALE == GERMANY
> +	#define LANGUAGE	GERMAN
> +	#define	HTTP_CHARSET	"iso-8859-1"
> +#elif LOCALE == FRANCE
> +	#define LANGUAGE	FRENCH
> +	#define	HTTP_CHARSET	"iso-8859-1"
> +#elif LOCALE == KOREA
> +	#define LANGUAGE 	KOREAN
> +	#define	HTTP_CHARSET	"euc-kr"
> +#else
> +	#define LANGUAGE 	ENGLISH
> +	#define	HTTP_CHARSET	"iso-8859-1"
> +#endif
> +
> +/***************************************
> + * define wireless max channel         *
> + * WL_MAX_CHANNEL =                    *
> + ***************************************/
> +#if LOCALE == JAPAN || LOCALE == EUROPE || LOCALE == GERMANY ||
> LOCALE == FRANCE
> +	#define	WL_MAX_CHANNEL	"13"
> +#elif OEM == KOREA			// <remove the line>
> +	#define	WL_MAX_CHANNEL	"13"	// <remove the line>
> +#else
> +	#define WL_MAX_CHANNEL	"11"
> +#endif
> +
> +/***************************************
> + * define web file path                *
> + * WEB_PAGE =                          *
> + ***************************************/
> +#if OEM == LINKSYS
> +#if UI_STYLE ==  CISCO
> +	#if LOCALE == JAPAN
> +		#define	WEB_PAGE	"cisco_wrt54g_jp"
> +	#elif LOCALE == GERMANY
> +		#define	WEB_PAGE	"cisco_wrt54g_de"
> +	#elif LOCALE == FRANCE
> +		#define	WEB_PAGE	"cisco_wrt54g_fr"
> +	#else
> +		#if LINKSYS_MODEL == E200
> +			#define WEB_PAGE        "ces_m"
> +		#elif LINKSYS_MODEL == E300
> +			#define WEB_PAGE        "ces_m"
> +		#elif LINKSYS_MODEL == E3200
> +			#define WEB_PAGE        "e3200_m"
> +		#elif LINKSYS_MODEL == E4200
> +			#define WEB_PAGE        "e4200_m"
> +		#elif (LINKSYS_MODEL == E2500)
> +			#define WEB_PAGE        "e2500_m"
> +		#elif (LINKSYS_MODEL == AC2350)
> +			#define WEB_PAGE        "ac2350_m"
> +		#else
> +			#define WEB_PAGE	"cisco_wrt54g_m"
> +		#endif
> +	#endif
> +#else
> +	#if LOCALE == JAPAN
> +		#define	WEB_PAGE	"linksys_wrt54g_jp"
> +	#else
> +		#define WEB_PAGE	"linksys_wrt54g_en"
> +	#endif
> +#endif
> +#elif OEM == PCI_OEM
> +	#if LOCALE == JAPAN
> +		#define	WEB_PAGE	"pci_wrt54g_jp"
> +	#else
> +		#define WEB_PAGE	"pci_wrt54g_en"
> +	#endif
> +#elif OEM == ELSA
> +	#define WEB_PAGE	"elsa_wrt54g_en"
> +#elif OEM == ALLNET
> +	#define WEB_PAGE	"nonbrand"
> +#elif OEM == REENET
> +	#define WEB_PAGE	"reenet_wrt54g_kr"
> +#elif	OEM == OTHER_OEM
> +	#define WEB_PAGE	"nonbrand"
> +#endif
> +
> +/***************************************
> + * check LOCALE
> + ***************************************/
> +#if OEM == LINKSYS
> + #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE && LOCALE
> != GERMANY && LOCALE != FRANCE
> +	#error	"The LOCALE for LINKSYS is error, must be USA, EUROPE,
> JAPAN, GERMANY or FRANCE"
> + #endif
> +#elif OEM == PCI_OEM
> + #if LOCALE != JAPAN && LOCALE != USA && LOCALE != EUROPE
> +	#error	"The LOCALE for PCI is error, must be USA or JAPAN"
> + #endif
> +#elif OEM == ELSA
> + #if LOCALE != EUROPE
> +	#error	"The LOCALE for ELSA is error, must be EUROPE"
> + #endif
> +#elif OEM == ALLNET
> + #if LOCALE != EUROPE
> +	#error	"The LOCALE for ALLNET is error, must be EUROPE"
> + #endif
> +#elif OEM == REENET
> + #if LOCALE != KOREA
> +	#error	"The LOCALE for REENET is error, must be KOREA"
> + #endif
> +#elif OEM == OTHER_OEM
> + #if LOCALE != USA && LOCALE != EUROPE
> +	#error	"The LOCALE for NONBRAND is error, must be USA or
> EUROPE"
> + #endif
> +#endif
> +
> +#endif
> diff --git a/tools/firmware-utils/src/linksys/crc.c b/tools/firmware-
> utils/src/linksys/crc.c
> new file mode 100644
> index 0000000000..7d3e641df9
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/crc.c
> @@ -0,0 +1,290 @@
> +/*********************************************************
> **********************
> + * $Id: crc.c,v 1.1.1.1 2010/11/24 06:37:40 gavin.ke Exp $
> + * Copyright 2007, Broadcom Corporation
> + * All Rights Reserved.
> + *
> + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO
> WARRANTIES OF ANY
> + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR
> OTHERWISE. BROADCOM
> + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF
> MERCHANTABILITY, FITNESS
> + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS
> SOFTWARE.
> + * crc.c: utility function to compute various CRCs
> +
> **********************************************************
> ********************/
> +
> +#include "typedefs.h"
> +#include "crc.h"
> +
> +/*********************************************************
> **********************
> + * hcs
> + *
> + * Computes and inserts a header check sum based on crc8 polynomial
> + * below.  Unlike a typical crc, the header check sum is inserted 13
> + * bytes from the end of the byte stream (rather than appended to the
> + * end of the byte stream) such that at the receiver a normal checksum
> + * computation over all of the bytes results in a known good value.
> + * Given a constant 12 bytes after the header checksum to the end of
> + * the header, a lookup table can be used to provide the actual value
> + * inserted.
> +
> **********************************************************
> ********************/
> +
> +static uint8 hcs_table[8] = { 0x16, 0x2c, 0x58, 0xb0, 0x37, 0x6e, 0xdc, 0xef};
> +
> +void
> +hcs(
> +    uint8 *pheader, /* pointer to array of data to process */
> +    uint nbytes   /* number of input data bytes to process */
> +)
> +{
> +    uint8 hcs0, hcs1;
> +    int i;
> +
> +    /* run once with zeros in hcs position, 13th byte from the end */
> +    pheader[nbytes - 12 - 1] = 0;
> +    hcs0 = crc8(pheader, nbytes, CRC8_INIT_VALUE);
> +
> +    /* now compute real hcs to insert in place of zeros */
> +    hcs1 = 0;
> +    for (i = 0; i < 8; i++) {
> +        hcs1 ^= ((hcs0 & (1 << i)) != 0 ? hcs_table[i] : 0);
> +    }
> +    pheader[nbytes - 12 - 1] = hcs1 ^ 0xff;
> +    return;
> +}
> +
> +/*********************************************************
> **********************
> + * crc8
> + *
> + * Computes a crc8 over the input data using the polynomial:
> + *
> + *       x^8 + x^7 +x^6 + x^4 + x^2 + 1
> + *
> + * The caller provides the initial value (either CRC8_INIT_VALUE
> + * or the previous returned value) to allow for processing of
> + * discontiguous blocks of data.  When generating the CRC the
> + * caller is responsible for complementing the final return value
> + * and inserting it into the byte stream.  When checking, a final
> + * return value of CRC8_GOOD_VALUE indicates a valid CRC.
> + *
> + * Reference: Dallas Semiconductor Application Note 27
> + *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
> + *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
> + *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
> + *
> +
> **********************************************************
> ********************/
> +
> +static uint8 crc8_table[256] = {
> +    0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
> +    0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
> +    0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
> +    0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
> +    0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
> +    0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
> +    0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
> +    0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
> +    0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
> +    0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
> +    0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
> +    0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
> +    0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
> +    0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
> +    0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
> +    0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
> +    0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
> +    0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
> +    0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
> +    0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
> +    0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
> +    0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
> +    0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
> +    0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
> +    0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
> +    0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
> +    0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
> +    0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
> +    0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
> +    0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
> +    0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
> +    0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
> +};
> +
> +#define CRC_INNER_LOOP(n, c, x) \
> +    (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
> +
> +uint8
> +crc8(
> +    uint8 *pdata,  /* pointer to array of data to process */
> +    uint nbytes, /* number of input data bytes to process */
> +    uint8 crc      /* either CRC8_INIT_VALUE or previous return value */
> +)
> +{
> +    while (nbytes-- > 0)
> +        CRC_INNER_LOOP(8, crc, *pdata++);
> +    return crc;
> +}
> +
> +/*********************************************************
> **********************
> + * crc16
> + *
> + * Computes a crc16 over the input data using the polynomial:
> + *
> + *       x^16 + x^12 +x^5 + 1
> + *
> + * The caller provides the initial value (either CRC16_INIT_VALUE
> + * or the previous returned value) to allow for processing of
> + * discontiguous blocks of data.  When generating the CRC the
> + * caller is responsible for complementing the final return value
> + * and inserting it into the byte stream.  When checking, a final
> + * return value of CRC16_GOOD_VALUE indicates a valid CRC.
> + *
> + * Reference: Dallas Semiconductor Application Note 27
> + *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
> + *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
> + *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
> + *
> +
> **********************************************************
> ********************/
> +
> +static uint16 crc16_table[256] = {
> +    0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
> +    0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
> +    0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
> +    0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
> +    0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
> +    0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
> +    0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
> +    0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
> +    0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
> +    0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
> +    0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
> +    0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
> +    0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
> +    0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
> +    0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
> +    0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
> +    0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
> +    0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
> +    0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
> +    0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
> +    0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
> +    0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
> +    0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
> +    0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
> +    0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
> +    0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
> +    0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
> +    0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
> +    0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
> +    0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
> +    0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
> +    0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
> +};
> +
> +uint16
> +crc16(
> +    uint8 *pdata,  /* pointer to array of data to process */
> +    uint nbytes, /* number of input data bytes to process */
> +    uint16 crc     /* either CRC16_INIT_VALUE or previous return value */
> +)
> +{
> +    while (nbytes-- > 0)
> +        CRC_INNER_LOOP(16, crc, *pdata++);
> +    return crc;
> +}
> +
> +/*********************************************************
> **********************
> + * crc32
> + *
> + * Computes a crc32 over the input data using the polynomial:
> + *
> + *
> x^32+x^26+x^23+x^22+x^16+x^12+x^11+X^10+x^8+x^7+x^5+x^4+x^2+x+1
> + *
> + * The caller provides the initial value (either CRC32_INIT_VALUE
> + * or the previous returned value) to allow for processing of
> + * discontiguous blocks of data.  When generating the CRC the
> + * caller is responsible for complementing the final return value
> + * and inserting it into the byte stream.  When checking, a final
> + * return value of CRC32_GOOD_VALUE indicates a valid CRC.
> + *
> + * Reference: Dallas Semiconductor Application Note 27
> + *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
> + *     ver 3, Aug 1993, ross at guest.adelaide.edu.au, Rocksoft Pty Ltd.,
> + *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
> + *
> +
> **********************************************************
> ********************/
> +
> +static uint32 crc32_table[256] = {
> +    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
> +    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
> +    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
> +    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
> +    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
> +    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
> +    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
> +    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
> +    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
> +    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
> +    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
> +    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
> +    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
> +    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
> +    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
> +    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
> +    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
> +    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
> +    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
> +    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
> +    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
> +    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
> +    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
> +    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
> +    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
> +    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
> +    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
> +    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
> +    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
> +    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
> +    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
> +    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
> +    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
> +    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
> +    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
> +    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
> +    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
> +    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
> +    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
> +    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
> +    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
> +    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
> +    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
> +    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
> +    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
> +    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
> +    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
> +    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
> +    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
> +    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
> +    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
> +    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
> +    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
> +    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
> +    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
> +    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
> +    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
> +    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
> +    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
> +    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
> +    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
> +    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
> +    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
> +    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
> +};
> +
> +uint32
> +crc32(
> +    uint8 *pdata,  /* pointer to array of data to process */
> +    uint nbytes, /* number of input data bytes to process */
> +    uint32 crc     /* either CRC32_INIT_VALUE or previous return value */
> +)
> +{
> +    while (nbytes-- > 0)
> +        CRC_INNER_LOOP(32, crc, *pdata++);
> +    return crc;
> +}
> diff --git a/tools/firmware-utils/src/linksys/crc.h b/tools/firmware-
> utils/src/linksys/crc.h
> new file mode 100644
> index 0000000000..c7e783c159
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/crc.h
> @@ -0,0 +1,69 @@
> +/*********************************************************
> **********************
> + * $Id: crc.h,v 1.2 2010/12/22 05:14:42 gavin.ke Exp $
> + * Copyright (C) 2009, Broadcom Corporation
> + * All Rights Reserved.
> + *
> + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO
> WARRANTIES OF ANY
> + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR
> OTHERWISE. BROADCOM
> + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF
> MERCHANTABILITY, FITNESS
> + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS
> SOFTWARE.
> + * crc.h - a function to compute crc for iLine10 headers
> +
> **********************************************************
> ********************/
> +
> +#ifndef _RTS_CRC_H_
> +#define _RTS_CRC_H_ 1
> +
> +#include "typedefs.h"
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +
> +#define CRC8_INIT_VALUE  0xff       /* Initial CRC8 checksum value */
> +#define CRC8_GOOD_VALUE  0x9f       /* Good final CRC8 checksum value */
> +#define HCS_GOOD_VALUE   0x39       /* Good final header checksum value
> */
> +
> +#define CRC16_INIT_VALUE 0xffff     /* Initial CRC16 checksum value */
> +#define CRC16_GOOD_VALUE 0xf0b8     /* Good final CRC16 checksum
> value */
> +
> +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
> +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum
> value */
> +
> +void   hcs(uint8 *, uint);
> +uint8  crc8(uint8 *, uint, uint8);
> +uint16 crc16(uint8 *, uint, uint16);
> +uint32 crc32(uint8 *, uint, uint32);
> +
> +/* macros for common usage */
> +
> +#define APPEND_CRC8(pbytes, nbytes)                           \
> +do {                                                          \
> +    uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
> +    (pbytes)[(nbytes)] = tmp;                                 \
> +    (nbytes) += 1;                                            \
> +} while (0)
> +
> +#define APPEND_CRC16(pbytes, nbytes)                               \
> +do {                                                               \
> +    uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
> +    (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff;                    \
> +    (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff;                    \
> +    (nbytes) += 2;                                                 \
> +} while (0)
> +
> +#define APPEND_CRC32(pbytes, nbytes)                                   \
> +do {                                                                   \
> +    uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
> +    (pbytes)[(nbytes) + 0] = (tmp >>  0) & 0xff;                       \
> +    (pbytes)[(nbytes) + 1] = (tmp >>  8) & 0xff;                       \
> +    (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff;                       \
> +    (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff;                       \
> +    (nbytes) += 4;                                                     \
> +} while (0)
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTS_CRC_H_ */
> diff --git a/tools/firmware-utils/src/linksys/cyutils.h b/tools/firmware-
> utils/src/linksys/cyutils.h
> new file mode 100644
> index 0000000000..fd77ab52f3
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/cyutils.h
> @@ -0,0 +1,348 @@
> +#include "code_pattern.h"
> +
> +#if LINKSYS_MODEL == WRT54GSV4
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v1.05.6"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v1.05.8"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #endif
> +#elif LINKSYS_MODEL == WRT54GS	// WRT54GSV1-3
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v4.70.8"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v4.71.0"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #endif
> +#elif LINKSYS_MODEL == WRT54GL
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v4.30.2"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v4.30.4"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #endif
> +#elif LINKSYS_MODEL == WRT54G	// WRT54GV1-4
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v4.20.9"
> +    #define SERIAL_NUMBER	"001"
> +    #define MINOR_VERSION	""
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v4.21.0"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #endif
> +#elif LINKSYS_MODEL == T_MOBILE
> +    #define CYBERTAN_VERSION	"v5.00.0"
> +    #define SERIAL_NUMBER	"002"
> +    #define MINOR_VERSION	""
> +#elif LINKSYS_MODEL == WRT54G3G
> +    #define CYBERTAN_VERSION	"v1.90.0"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +#elif LINKSYS_MODEL == WRT300N
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v0.92.1"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.92.1"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	""
> +  #endif
> +#elif LINKSYS_MODEL == WRT350N
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v1.03.9"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	"-beta3"
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v1.03.9"
> +    #define SERIAL_NUMBER	"000"
> +    #define MINOR_VERSION	"-beta3"
> +  #endif
> +#elif LINKSYS_MODEL == WRT610N
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v2.00.00"
> +    #define SERIAL_NUMBER	"02 betasvn0526"
> +    #define MINOR_VERSION	""
> +//add by michael at 200804014
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +//end by michael
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.00.01"
> +    #define SERIAL_NUMBER	"09"
> +    #define MINOR_VERSION	""
> +//add by michael at 20080414
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +//end by michael
> +#elif LINKSYS_MODEL == E200
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v0.0.01"
> +    #define SERIAL_NUMBER	"001"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.00.01"
> +    #define SERIAL_NUMBER	"001"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +#elif LINKSYS_MODEL == E300
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v3.0.00"
> +    #define SERIAL_NUMBER	"006"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.00.01"
> +    #define SERIAL_NUMBER	"09"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +#elif LINKSYS_MODEL == E3200
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v1.0.00"
> +    #define SERIAL_NUMBER	"1"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.00.01"
> +    #define SERIAL_NUMBER	"01"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +#elif LINKSYS_MODEL == E4200
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v1.0.00"
> +    #define SERIAL_NUMBER	"9"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v0.00.01"
> +    #define SERIAL_NUMBER	"09"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +#elif LINKSYS_MODEL == E2500
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v3.0.00"
> +    #define SERIAL_NUMBER	"6"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v1.0.00"
> +    #define SERIAL_NUMBER	"01"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +  #endif
> +#elif LINKSYS_MODEL == AC2350
> +  #if LOCALE == USA
> +    #define CYBERTAN_VERSION	"v1.0.03"
> +    #define SERIAL_NUMBER	"003"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +    #define CYBERTAN_UBOOT_VERSION	"v1.0"
> +  #else	// ETSI
> +    #define CYBERTAN_VERSION	"v1.0.00"
> +    #define SERIAL_NUMBER	"01"
> +    #define MINOR_VERSION	""
> +    #define BUILD_KEYWORD   " B"
> +    #define BUILD_NUMBER    SERIAL_NUMBER
> +    #define BETA_VERSION    " "
> +    #define CYBERTAN_UBOOT_VERSION	"v1.0"
> +  #endif
> +
> +#endif
> +
> +#if LINKSYS_MODEL == T_MOBILE
> +    #define CFES_BOOT_VERSION	"v5.3"
> +#elif LINKSYS_MODEL == E2500
> +    //#define CFES_BOOT_VERSION	"v4.13"
> +    //#define CFES_BOOT_VERSION	"v5.00"
> +    #define CFES_BOOT_VERSION	"v6.07"
> +#else
> +    #define CFES_BOOT_VERSION	"v5.2"
> +#endif
> +
> +#define LANG_VERSION		"v1.00.00"    //for lang.bin version
> control(setupwizard)
> +#define PMON_BOOT_VERSION	"v1.8"
> +#define QCA_WL_VERSION		"v10.2.138.3" /*add for QCA wireless
> version by Jemmy 2014.5.21*/
> +
> +
> +#if LINKSYS_MODEL == T_MOBILE
> +#define BOOT_IPADDR "192.168.0.1"
> +#define BOOT_NETMASK "255.255.255.0"
> +#else
> +#define BOOT_IPADDR "192.168.1.1"
> +#define BOOT_NETMASK "255.255.255.0"
> +#endif
> +
> +#define SUPPORT_4712_CHIP	0x0001
> +#define SUPPORT_INTEL_FLASH	0x0002
> +#define SUPPORT_5325E_SWITCH	0x0004
> +#define SUPPORT_4704_CHIP	0x0008
> +#define SUPPORT_5352E_CHIP	0x0010
> +
> +struct code_header {
> +	char magic[4];	// Code Pattern
> +	char res1[4];	// for extra magic
> +	char fwdate[3];	// Firmware build date
> +	char fwvern[3];	// Firmware version
> +	char id[4];	// U2ND
> +	char hw_ver;    // 0) for 4702, 1) for 4712, 2) for 4712L, 3) for 4704, 4)
> for 5352E
> +	unsigned char  sn;	// Serial Number
> +	unsigned short flags;
> +	unsigned char  stable[2];	// The image is stable (for dual image)
> +	unsigned char  try1[2];		// Try to boot image first time (for dual
> image)
> +	unsigned char  try2[2];		// Try to boot image second time (for
> dual image)
> +	unsigned char  try3[2];		// Try to boot image third time (for
> dual_image)
> +	unsigned char  res3[2];
> +} ;
> +
> +//add for AC2350 F/W header
> +#define FWHDR_MAGIC_STR "CHDR"
> +#define FWHDR_MAGIC 0X52444843
> +struct cbt_fw_header
> +{
> +	unsigned int magic;		/* "CHDR" */
> +	unsigned int len;		/* Length of file including header */
> +	unsigned int crc32;		/* 32-bit CRC */
> +	unsigned int res;
> +};
> +
> +//#ifdef MULTILANG_SUPPORT
> +struct lang_header {
> +        char magic[4];
> +        char res1[4];   // for extra magic
> +        char fwdate[3];
> +        char fwvern[3];
> +        char id[4];     // U2ND
> +        char hw_ver;    // 0: for 4702, 1: for 4712
> +	char res2;
> +        unsigned long len;
> +        unsigned char res3[8];
> +} ;
> +//#endif
> +
> +struct boot_header {
> +	char magic[3];
> +	char res[29];
> +};
> +
> +/***************************************
> + * define upnp misc                    *
> + ***************************************/
> +#if OEM == LINKSYS
> +  #if LANGUAGE == ENGLISH
> +    #define URL			"http://www.linksys.com/"
> +  #else
> +    #define URL			"http://www.linksys.co.jp/"
> +  #endif
> +  #define DEV_FRIENDLY_NAME	"Linksys"MODEL_NAME
> +  #define DEV_MFR		"Linksys"
> +  //#define DEV_MFR_URL		URL
> +  #define DEV_MFR_URL		"http://www.linksys.com"
> +  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
> +  #define DEV_MODEL		MODEL_NAME
> +  #define DEV_MODEL_NO		CYBERTAN_VERSION
> +  //#define DEV_MODEL_URL		URL
> +  #define DEV_MODEL_URL
> 	"http://www.linksys.com/international"
> +#elif OEM == PCI
> +  #if LANGUAGE == ENGLISH
> +    #define URL			"http://www.planex.com/"
> +  #else
> +    #define URL			"http://www.planex.co.jp/"
> +  #endif
> +  #define DEV_FRIENDLY_NAME	"BLW-04G Wireless Broadband
> Router"
> +  #define DEV_MFR		"Planex Communciations Inc."
> +  #define DEV_MFR_URL		URL
> +  #define DEV_MODEL_DESCRIPTION	"Internet Gateway Device with UPnP
> support"
> +  #define DEV_MODEL		"BLW-04G"
> +  #define DEV_MODEL_NO 		CYBERTAN_VERSION
> +  #define DEV_MODEL_URL		URL
> +#else
> +  #define URL			""
> +  #define DEV_FRIENDLY_NAME	MODEL_NAME
> +  #define DEV_MFR		""
> +  #define DEV_MFR_URL		URL
> +  #define DEV_MODEL_DESCRIPTION	"Internet Access Server"
> +  #define DEV_MODEL		MODEL_NAME
> +  #define DEV_MODEL_NO		CYBERTAN_VERSION
> +  #define DEV_MODEL_URL		URL
> +#endif
> +
> +/***************************************
> + * define Parental Control link        *
> + ***************************************/
> +#if LOCALE == EUROPE
> +  #define	SIGN_UP_URL
> 	"http://pcsvc.ourlinksys.com/eu/language.jsp"
> +  #define	MORE_INFO_URL
> 	"http://www.linksys.com/pcsvc/eu/info_eu.asp"
> +  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/en"
> +#elif LOCALE == GERMANY
> +  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/de/trial.asp"
> +  #define	MORE_INFO_URL
> 	"http://www.linksys.com/pcsvc/de/info_de.asp"
> +  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/de/admin.asp"
> +#elif LOCALE == FRANCE
> +  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/fr/trial.asp"
> +  #define	MORE_INFO_URL
> 	"http://www.linksys.com/pcsvc/fr/info_fr.asp"
> +  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/fr/admin.asp"
> +#else
> +  #define	SIGN_UP_URL	"http://pcsvc.ourlinksys.com/us/trial.asp"
> +  #define	MORE_INFO_URL
> 	"http://www.linksys.com/pcsvc/info.asp"
> +  #define	ADMIN_URL	"http://pcsvc.ourlinksys.com/us/admin.asp"
> +#endif
> +
> +/***************************************
> + * define PPTP info		       *
> + ***************************************/
> +#if OEM == LINKSYS
> +#define	PPTP_VENDOR	"Linksys"
> +#else
> +#define	PPTP_VENDOR	CT_VENDOR
> +#endif
> +#define PPTP_HOSTNAME	""
> +
> +/***************************************
> + * define L2TP info		       *
> + ***************************************/
> +#if OEM == LINKSYS
> +#define	L2TP_VENDOR	"Linksys"
> +#else
> +#define	L2TP_VENDOR	CT_VENDOR
> +#endif
> +#define L2TP_HOSTNAME	MODEL_NAME //2005-03-04 by kanki
> diff --git a/tools/firmware-utils/src/linksys/typedefs.h b/tools/firmware-
> utils/src/linksys/typedefs.h
> new file mode 100644
> index 0000000000..78989745f9
> --- /dev/null
> +++ b/tools/firmware-utils/src/linksys/typedefs.h
> @@ -0,0 +1,447 @@
> +/*
> + * Copyright (C) 2009, Broadcom Corporation
> + * All Rights Reserved.
> + *
> + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO
> WARRANTIES OF ANY
> + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR
> OTHERWISE. BROADCOM
> + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF
> MERCHANTABILITY, FITNESS
> + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS
> SOFTWARE.
> + * $Id: typedefs.h,v 1.1.1.1 2010/11/24 06:37:38 gavin.ke Exp $
> + */
> +
> +#ifndef _TYPEDEFS_H_
> +#define _TYPEDEFS_H_
> +
> +#ifdef SITE_TYPEDEFS
> +
> +/*
> + * Define SITE_TYPEDEFS in the compile to include a site-specific
> + * typedef file "site_typedefs.h".
> + *
> + * If SITE_TYPEDEFS is not defined, then the code section below makes
> + * inferences about the compile environment based on defined symbols
> and
> + * possibly compiler pragmas.
> + *
> + * Following these two sections is the Default Typedefs section.
> + * This section is only processed if USE_TYPEDEF_DEFAULTS is
> + * defined. This section has a default set of typedefs and a few
> + * preprocessor symbols (TRUE, FALSE, NULL, ...).
> + */
> +
> +#include "site_typedefs.h"
> +
> +#else
> +
> +/*
> + * Infer the compile environment based on preprocessor symbols and
> pragmas.
> + * Override type definitions as needed, and include configuration-
> dependent
> + * header files to define types.
> + */
> +
> +#ifdef __cplusplus
> +
> +#define TYPEDEF_BOOL
> +#ifndef FALSE
> +#define FALSE	false
> +#endif
> +#ifndef TRUE
> +#define TRUE	true
> +#endif
> +
> +#else	/* ! __cplusplus */
> +
> +#if defined(_WIN32)
> +
> +#define TYPEDEF_BOOL
> +typedef	unsigned char	bool;			/* consistent w/BOOL
> */
> +
> +#endif /* _WIN32 */
> +
> +#endif	/* ! __cplusplus */
> +
> +#if defined(_WIN64) && !defined(EFI)
> +/* use the Windows ULONG_PTR type when compiling for 64 bit */
> +#include <basetsd.h>
> +#define TYPEDEF_UINTPTR
> +typedef ULONG_PTR uintptr;
> +#elif defined(__x86_64__)
> +#define TYPEDEF_UINTPTR
> +typedef unsigned long long int uintptr;
> +#endif
> +
> +#if defined(_HNDRTE_) && !defined(_HNDRTE_SIM_)
> +#define _NEED_SIZE_T_
> +#endif
> +
> +#if defined(_MINOSL_)
> +#define _NEED_SIZE_T_
> +#endif
> +
> +#if defined(EFI) && !defined(_WIN64)
> +#define _NEED_SIZE_T_
> +#endif
> +
> +#if defined(TARGETOS_nucleus)
> +/* for 'size_t' type */
> +#include <stddef.h>
> +
> +/* float_t types conflict with the same typedefs from the standard ANSI-C
> +** math.h header file. Don't re-typedef them here.
> +*/
> +#define TYPEDEF_FLOAT_T
> +#endif   /* TARGETOS_nucleus */
> +
> +#if defined(_NEED_SIZE_T_)
> +typedef long unsigned int size_t;
> +#endif
> +
> +#ifdef __DJGPP__
> +typedef long unsigned int size_t;
> +#endif /* __DJGPP__ */
> +
> +#ifdef _MSC_VER	    /* Microsoft C */
> +#define TYPEDEF_INT64
> +#define TYPEDEF_UINT64
> +typedef signed __int64	int64;
> +typedef unsigned __int64 uint64;
> +#endif
> +
> +#if defined(MACOSX)
> +#ifdef KERNEL
> +#include <libkern/version.h>
> +#if VERSION_MAJOR > 10
> +#define WLP2P
> +#define IO80211P2P
> +#define APSTA
> +#define WLMCHAN
> +#define WL_MULTIQUEUE
> +#define WL_BSSCFG_TX_SUPR
> +#define WIFI_ACT_FRAME
> +#define FAST_ACTFRM_TX
> +#endif
> +#endif /* KERNEL */
> +#define TYPEDEF_BOOL
> +#endif
> +
> +#if defined(__NetBSD__)
> +#define TYPEDEF_ULONG
> +#endif
> +
> +#if defined(__sparc__)
> +#define TYPEDEF_ULONG
> +#endif
> +
> +
> +#ifdef	linux
> +/*
> + * If this is either a Linux hybrid build or the per-port code of a hybrid build
> + * then use the Linux header files to get some of the typedefs.  Otherwise,
> define
> + * them entirely in this file.  We can't always define the types because we
> get
> + * a duplicate typedef error; there is no way to "undefine" a typedef.
> + * We know when it's per-port code because each file defines LINUX_PORT
> at the top.
> + */
> +#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
> +#define TYPEDEF_UINT
> +#ifndef TARGETENV_android
> +#define TYPEDEF_USHORT
> +#define TYPEDEF_ULONG
> +#endif /* TARGETENV_android */
> +#ifdef __KERNEL__
> +#include <linux/version.h>
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
> +#define TYPEDEF_BOOL
> +#endif	/* >= 2.6.19 */
> +#endif	/* __KERNEL__ */
> +#endif  /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
> +#endif	/* linux */
> +
> +#if defined(__ECOS)
> +#define TYPEDEF_UCHAR
> +#define TYPEDEF_UINT
> +#define TYPEDEF_USHORT
> +#define TYPEDEF_ULONG
> +#define TYPEDEF_BOOL
> +#endif
> +
> +#if !defined(linux) && !defined(_WIN32) && !defined(_CFE_) &&
> !defined(_MINOSL_) && \
> +	!defined(__DJGPP__) && !defined(__ECOS) && !defined(__BOB__)
> && \
> +	!defined(TARGETOS_nucleus)
> +#define TYPEDEF_UINT
> +#define TYPEDEF_USHORT
> +#endif
> +
> +
> +/* Do not support the (u)int64 types with strict ansi for GNU C */
> +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
> +#define TYPEDEF_INT64
> +#define TYPEDEF_UINT64
> +#endif
> +
> +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
> + * for signed or unsigned
> + */
> +#if defined(__ICL)
> +
> +#define TYPEDEF_INT64
> +
> +#if defined(__STDC__)
> +#define TYPEDEF_UINT64
> +#endif
> +
> +#endif /* __ICL */
> +
> +#if !defined(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) &&
> !defined(__DJGPP__) && \
> +	!defined(__BOB__) && !defined(TARGETOS_nucleus)
> +
> +/* pick up ushort & uint from standard types.h */
> +#if defined(linux) && defined(__KERNEL__)
> +
> +/* See note above */
> +#if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
> +#ifdef USER_MODE
> +#include <sys/types.h>
> +#else
> +#include <linux/types.h>	/* sys/types.h and linux/types.h are oil and
> water */
> +#endif /* USER_MODE */
> +#endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
> +
> +#else
> +
> +#if defined(__ECOS)
> +#include <pkgconf/infra.h>
> +#include <cyg/infra/cyg_type.h>
> +#include <stdarg.h>
> +#endif
> +
> +#include <sys/types.h>
> +
> +#endif /* linux && __KERNEL__ */
> +
> +#endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_  && !_MINOSL_
> && !__DJGPP__ */
> +
> +#if defined(MACOSX)
> +
> +#ifdef __BIG_ENDIAN__
> +#define IL_BIGENDIAN
> +#else
> +#ifdef IL_BIGENDIAN
> +#error "IL_BIGENDIAN was defined for a little-endian compile"
> +#endif
> +#endif /* __BIG_ENDIAN__ */
> +
> +#if !defined(__cplusplus)
> +
> +#if defined(__i386__)
> +typedef unsigned char bool;
> +#else
> +typedef unsigned int bool;
> +#endif
> +#define TYPE_BOOL 1
> +enum {
> +    false	= 0,
> +    true	= 1
> +};
> +
> +#if defined(KERNEL)
> +#include <IOKit/IOTypes.h>
> +#endif /* KERNEL */
> +
> +#endif /* __cplusplus */
> +
> +#endif /* MACOSX */
> +
> +
> +/* use the default typedefs in the next section of this file */
> +#define USE_TYPEDEF_DEFAULTS
> +
> +#endif /* SITE_TYPEDEFS */
> +
> +
> +/*
> + * Default Typedefs
> + */
> +
> +#ifdef USE_TYPEDEF_DEFAULTS
> +#undef USE_TYPEDEF_DEFAULTS
> +
> +#ifndef TYPEDEF_BOOL
> +typedef	/* @abstract@ */ unsigned char	bool;
> +#endif
> +
> +/* define uchar, ushort, uint, ulong */
> +
> +#ifndef TYPEDEF_UCHAR
> +typedef unsigned char	uchar;
> +#endif
> +
> +#ifndef TYPEDEF_USHORT
> +typedef unsigned short	ushort;
> +#endif
> +
> +#ifndef TYPEDEF_UINT
> +typedef unsigned int	uint;
> +#endif
> +
> +#ifndef TYPEDEF_ULONG
> +typedef unsigned long	ulong;
> +#endif
> +
> +/* define [u]int8/16/32/64, uintptr */
> +
> +#ifndef TYPEDEF_UINT8
> +typedef unsigned char	uint8;
> +#endif
> +
> +#ifndef TYPEDEF_UINT16
> +typedef unsigned short	uint16;
> +#endif
> +
> +#ifndef TYPEDEF_UINT32
> +typedef unsigned int	uint32;
> +#endif
> +
> +#ifndef TYPEDEF_UINT64
> +typedef unsigned long long uint64;
> +#endif
> +
> +#ifndef TYPEDEF_UINTPTR
> +typedef unsigned int	uintptr;
> +#endif
> +
> +#ifndef TYPEDEF_INT8
> +typedef signed char	int8;
> +#endif
> +
> +#ifndef TYPEDEF_INT16
> +typedef signed short	int16;
> +#endif
> +
> +#ifndef _SLHC_H
> +#ifndef TYPEDEF_INT32
> +typedef signed int	int32;
> +#endif
> +#endif
> +
> +#ifndef TYPEDEF_INT64
> +typedef signed long long int64;
> +#endif
> +
> +/* define float32/64, float_t */
> +
> +#ifndef TYPEDEF_FLOAT32
> +typedef float		float32;
> +#endif
> +
> +#ifndef TYPEDEF_FLOAT64
> +typedef double		float64;
> +#endif
> +
> +/*
> + * abstracted floating point type allows for compile time selection of
> + * single or double precision arithmetic.  Compiling with -DFLOAT32
> + * selects single precision; the default is double precision.
> + */
> +
> +#ifndef TYPEDEF_FLOAT_T
> +
> +#if defined(FLOAT32)
> +typedef float32 float_t;
> +#else /* default to double precision floating point */
> +typedef float64 float_t;
> +#endif
> +
> +#endif /* TYPEDEF_FLOAT_T */
> +
> +/* define macro values */
> +
> +#ifndef FALSE
> +#define FALSE	0
> +#endif
> +
> +#ifndef TRUE
> +#define TRUE	1  /* TRUE */
> +#endif
> +
> +#ifndef NULL
> +#define	NULL	0
> +#endif
> +
> +#ifndef OFF
> +#define	OFF	0
> +#endif
> +
> +#ifndef ON
> +#define	ON	1  /* ON = 1 */
> +#endif
> +
> +#define	AUTO	(-1) /* Auto = -1 */
> +
> +/* define PTRSZ, INLINE */
> +
> +#ifndef PTRSZ
> +#define	PTRSZ	sizeof(char*)
> +#endif
> +
> +
> +/* Detect compiler type. */
> +#ifdef _MSC_VER
> +	#define BWL_COMPILER_MICROSOFT
> +#elif defined(__GNUC__)
> +	#define BWL_COMPILER_GNU
> +#elif defined(__CC_ARM) && __CC_ARM
> +	#define BWL_COMPILER_ARMCC
> +#else
> +	#error "Unknown compiler!"
> +#endif /* _MSC_VER */
> +
> +
> +#ifndef INLINE
> +	#if defined(BWL_COMPILER_MICROSOFT)
> +		#define INLINE __inline
> +	#elif defined(BWL_COMPILER_GNU)
> +		#define INLINE __inline__
> +	#elif defined(BWL_COMPILER_ARMCC)
> +		#define INLINE	__inline
> +	#else
> +		#define INLINE
> +	#endif /* _MSC_VER */
> +#endif /* INLINE */
> +
> +#undef TYPEDEF_BOOL
> +#undef TYPEDEF_UCHAR
> +#undef TYPEDEF_USHORT
> +#undef TYPEDEF_UINT
> +#undef TYPEDEF_ULONG
> +#undef TYPEDEF_UINT8
> +#undef TYPEDEF_UINT16
> +#undef TYPEDEF_UINT32
> +#undef TYPEDEF_UINT64
> +#undef TYPEDEF_UINTPTR
> +#undef TYPEDEF_INT8
> +#undef TYPEDEF_INT16
> +#undef TYPEDEF_INT32
> +#undef TYPEDEF_INT64
> +#undef TYPEDEF_FLOAT32
> +#undef TYPEDEF_FLOAT64
> +#undef TYPEDEF_FLOAT_T
> +
> +#endif /* USE_TYPEDEF_DEFAULTS */
> +
> +/* Suppress unused parameter warning */
> +#define UNUSED_PARAMETER(x) (void)(x)
> +
> +/*
> + * Including the bcmdefs.h here, to make sure everyone including
> typedefs.h
> + * gets this automatically
> +*/
> +#include "bcmdefs.h"
> +/*
> + * If android target is building then include this file
> + */
> +#ifndef LINUX_HYBRID
> +#ifdef TARGETENV_android
> +#include <bcm_android_types.h>
> +#endif /* TARGETENV_android */
> +#endif /* LINUX_HYBRID */
> +
> +#endif /* _TYPEDEFS_H_ */
> --
> 2.28.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200920/d9c63cea/attachment-0001.sig>

From foss at volatilesystems.org  Sun Sep 20 16:48:33 2020
From: foss at volatilesystems.org (Stijn Segers)
Date: Sun, 20 Sep 2020 22:48:33 +0200
Subject: [PATCH] odhcpd: number UCI defaults script
Message-ID: <20200920204833.2878-1-foss@volatilesystems.org>

UCI defaults scripts are supposed to be numbered, but odhcpd's lacked numbering, which
turned out to mess up my custom scripts numbered 9[0-9]_*. The idea is to have high number
scripts executed last. Jow confirmed numbering is the default case, not the exception (thanks).

Signed-off-by: Stijn Segers <foss at volatilesystems.org>
---
 .../services/odhcpd/files/15_odhcpd.defaults  | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 package/network/services/odhcpd/files/15_odhcpd.defaults

diff --git a/package/network/services/odhcpd/files/15_odhcpd.defaults b/package/network/services/odhcpd/files/15_odhcpd.defaults
new file mode 100644
index 0000000000..5a1706f785
--- /dev/null
+++ b/package/network/services/odhcpd/files/15_odhcpd.defaults
@@ -0,0 +1,32 @@
+#!/bin/sh
+uci -q get dhcp.odhcpd && exit 0
+touch /etc/config/dhcp
+
+. /usr/share/libubox/jshn.sh
+
+json_load "$(cat /etc/board.json)"
+json_select network
+json_select lan
+json_get_vars protocol
+json_select ..
+json_select ..
+
+case "$protocol" in
+# only enable server mode on statically addressed lan ports
+"static") [ -e /proc/sys/net/ipv6 ] && MODE=server || MODE=disabled ;;
+*) MODE=disabled ;;
+esac
+
+uci batch <<EOF
+set dhcp.odhcpd=odhcpd
+set dhcp.odhcpd.maindhcp=0
+set dhcp.odhcpd.leasefile=/tmp/hosts/odhcpd
+set dhcp.odhcpd.leasetrigger=/usr/sbin/odhcpd-update
+set dhcp.odhcpd.loglevel=4
+set dhcp.lan.dhcpv6=$MODE
+set dhcp.lan.ra=$MODE
+set dhcp.lan.ra_slaac=1
+add_list dhcp.lan.ra_flags=managed-config
+add_list dhcp.lan.ra_flags=other-config
+commit dhcp
+EOF
-- 
2.20.1



From foss at volatilesystems.org  Sun Sep 20 17:03:32 2020
From: foss at volatilesystems.org (Stijn Segers)
Date: Sun, 20 Sep 2020 23:03:32 +0200
Subject: [PATCH v2] odhcpd: number UCI defaults script
In-Reply-To: <20200920204833.2878-1-foss@volatilesystems.org>
References: <20200920204833.2878-1-foss@volatilesystems.org>
Message-ID: <20200920210332.3800-1-foss@volatilesystems.org>

UCI defaults scripts are supposed to be numbered, but odhcpd's lacked numbering, which
turned out to mess up my custom scripts numbered 9[0-9]_*. The idea is to have high number
(custom) scripts executed last. Jow confirmed numbering is the default case, not the
exception (thanks).

Signed-off-by: Stijn Segers <foss at volatilesystems.org>
---
 package/network/services/odhcpd/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile
index d3e131caec..62dd53774d 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -100,7 +100,7 @@ define Package/odhcpd/install
 	$(INSTALL_DIR) $(1)/etc/init.d
 	$(INSTALL_BIN) ./files/odhcpd.init $(1)/etc/init.d/odhcpd
 	$(INSTALL_DIR) $(1)/etc/uci-defaults
-	$(INSTALL_BIN) ./files/odhcpd.defaults $(1)/etc/uci-defaults
+	$(INSTALL_BIN) ./files/odhcpd.defaults $(1)/etc/uci-defaults/15_odhcpd
 endef
 
 Package/odhcpd-ipv6only/install = $(Package/odhcpd/install)
-- 
2.20.1



From fhfrediani at gmail.com  Sun Sep 20 18:24:00 2020
From: fhfrediani at gmail.com (Fernando Frediani)
Date: Sun, 20 Sep 2020 19:24:00 -0300
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
References: <5836172.LP2CDrWvR4@strike> <10757956.9tHsuBLZXe@strike>
 <a922fff6-7efd-8131-ae3c-8f9bfadbb2fb@david-bauer.net>
 <16349278.dxtDtKCgZ7@strike>
 <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
Message-ID: <0e9a2934-7484-f61a-37c0-e0506671bea2@gmail.com>

I have some concern to call tiny the 8/32 boards.
While I understand the 4MB flash devices as phased out the 8/32 are 
still very popular and probably most of the devices still running in 
many and many places and they are not really tiny as of today. Some 
newer low priced are coming with 8/64, but the point is that OpenWrt has 
been the responsible for many devices to keep going for years with 
stability and this no doubt will happen with 8/32 for a while.
Calling tiny means only 8MB flash or both 8MB flash and 32MB ram ? I may 
see a point to call the 8MB devices maybe, but not 32MB ram ones.

Fernando

On 19/09/2020 19:21, Adrian Schmutzler wrote:
>> Indeed "LOW_MEMORY_FOOTPRINT" seems only to affedt 3 general options
>> and one option of OpenSSL.
>>
>> So it might be an option to :
>> * set LOW_MEM for 8/32 MB devies
>> * set LOW_MEM and SMALL_FLASH for 4/32 MB devices
>> * check the CONFIG-options for usefull defaults So the tiny aubtarget can be
>> defined as "boards with 32MB or less of RAM; some boards also with only
>> 4MB of flash". This definition would essentially match the "4/32 warning" [1].
> Actually, this narrows down to a question that struck me several times already:
>
> Now, that 4 MB flash devices are not "supported" anymore, how should we deal with the "tiny" subtargets:
>
> 1. We keep the tiny subtargets configured for low flash, so people still trying to build 4 MB flash devices still can use this. (This will also benefit a few devices with kernel size restrictions; however, this is a much smaller set than in earlier times; most of these devices have dual-stage bootloaders now or died anyway).
>
> 2. We convert the tiny targets to low-memory targets; this will improve the situation for a few devices (like you mentioned), but will make it much harder to still build the 4M flash devices without major changes. Apart from ath79, I don't know whether this would make sense for other targets like the old subtargets on ramips. This poses the risk of having some targets low-mem and some small-flash, which I'd like to avoid. Additionally, we will have to change back from low-mem to small-flash again when we start to hit limits with the 8M devices.
>
> 3. Though not intended by this conversation, the third option is obviously to just ignore all 4M or 32M devices from now on (as actually announced by the 4/32 warning), and design the tiny targets based on the requirements of the 8M devices that will start to become a "problem" soon (either due to kernel size restrictions or because of small rootfs). Actually, we already went into this direction by using wpad-basic-wolfssl on tiny targets as well.
>
> Best
>
> Adrian
>
>> [1] - https://openwrt.org/supported_devices/432_warning
>>
>> Sven
>>
>>> [0] https://github.com/freifunk-gluon/gluon/issues/2032
>>> [1]
>>> https://github.com/freifunk-
>> gluon/gluon/commit/7e8af99cf504ca1dc389f28
>>> 2a0c9
>>> 4f4a911571be
>>>
>>
>>
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From shep971 at centurylink.net  Sun Sep 20 19:16:53 2020
From: shep971 at centurylink.net (Heppler, J. Scott)
Date: Sun, 20 Sep 2020 16:16:53 -0700
Subject: Quick question on Linksys EA7300 V2
Message-ID: <20200920231653.GB14295@centurylink.net>

Based on the commit of Santiago Rodruquez-Papa, for a Linksys EA7300 V1,
I purchased a factory recertified EA7300 - version was not advertised.
On arrival, it was a version 2.

I researched and V2 is almost the same as V1 except it has 7603/7615
radios instead of a pair of 7615s.  The memory/flash is the same size
but from different manufactures.  I posted the details, with wikidevi
links, and the modifications I made to the code in the OpenWrt forum.
It built fine but I'm looking for some reassurance before flashing.  I
understand the case is difficult to pry open and I'd like to avoid the
possibility of soldering/serial console.

Any comments or suggestions appreciated.  If it works, I intend to submit
a patch.  Also have a question on the description.  I could copy/paste
Santiago's description with 4 small edits or link/reference his work with
a shorter description of the differences.  I expect the lengthy install
procedure to be the same and will confirm prior to submission.

https://forum.openwrt.org/t/add-support-for-linksys-ea7300-v2/74563

Thanks
-- 
J. Scott Heppler


From noreply at github.com  Sun Sep 20 19:20:23 2020
From: noreply at github.com (Stephen Walker)
Date: Sun, 20 Sep 2020 16:20:23 -0700
Subject: [sdwalker/sdwalker.github.io] 5286f4: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/dbbb5a-5286f4@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 5286f40f6ba8db650b12e2d8dfa89610a57e6ccd
      https://github.com/sdwalker/sdwalker.github.io/commit/5286f40f6ba8db650b12e2d8dfa89610a57e6ccd
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2020-09-20 (Sun, 20 Sep 2020)

  Changed paths:
    M uscan/index-18.06.html
    M uscan/index-19.07.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From gch981213 at gmail.com  Mon Sep 21 02:57:44 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Mon, 21 Sep 2020 14:57:44 +0800
Subject: [PATCH] ath79: ar8216: make switch register access atomic
Message-ID: <20200921065744.491098-1-gch981213@gmail.com>

reg accesses on integrated ar8229 sometimes fails. As a result, phy read
got incorrect port status and wan link goes down and up mysteriously.
After comparing ar8216 with the old driver, these local_irq_save/restore
calls are the only meaningful differences I could find and it does fix
the issue.
The same changes were added in svn r26856 by Gabor Juhos:
ar71xx: ag71xx: make switch register access atomic

As I can't find the underlying problem either, this hack is broght
back to fix the unstable link issue.
This hack is only suitable for ath79 mdio and may easily break the
driver on other platform. Limit it to ath79-only as a target patch.

Fixes: FS#2216
Fixes: FS#3226
Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
---
 .../930-ar8216-make-reg-access-atomic.patch   | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch

diff --git a/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch
new file mode 100644
index 0000000000..42f3305195
--- /dev/null
+++ b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch
@@ -0,0 +1,61 @@
+From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00 2001
+From: Chuanhong Guo <gch981213 at gmail.com>
+Date: Sun, 20 Sep 2020 01:00:45 +0800
+Subject: [PATCH] ath79: ar8216: make switch register access atomic
+
+due to some unknown reason these register accesses sometimes fail
+on the integrated switch without this patch.
+
+THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER PLATFORMS!
+The mdio bus on ath79 works in polling mode and doesn't rely on
+any interrupt. This patch breaks the driver on any mdio master
+with interrupts used.
+
+---
+--- a/drivers/net/phy/ar8216.c
++++ b/drivers/net/phy/ar8216.c
+@@ -253,12 +253,14 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p
+ u32
+ ar8xxx_read(struct ar8xxx_priv *priv, int reg)
+ {
++	unsigned long flags;
+ 	struct mii_bus *bus = priv->mii_bus;
+ 	u16 r1, r2, page;
+ 	u32 val;
+ 
+ 	split_addr((u32) reg, &r1, &r2, &page);
+ 
++	local_irq_save(flags);
+ 	mutex_lock(&bus->mdio_lock);
+ 
+ 	bus->write(bus, 0x18, 0, page);
+@@ -266,6 +268,7 @@ ar8xxx_read(struct ar8xxx_priv *priv, in
+ 	val = ar8xxx_mii_read32(priv, 0x10 | r2, r1);
+ 
+ 	mutex_unlock(&bus->mdio_lock);
++	local_irq_restore(flags);
+ 
+ 	return val;
+ }
+@@ -273,11 +276,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in
+ void
+ ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val)
+ {
++	unsigned long flags;
+ 	struct mii_bus *bus = priv->mii_bus;
+ 	u16 r1, r2, page;
+ 
+ 	split_addr((u32) reg, &r1, &r2, &page);
+ 
++	local_irq_save(flags);
+ 	mutex_lock(&bus->mdio_lock);
+ 
+ 	bus->write(bus, 0x18, 0, page);
+@@ -285,6 +290,7 @@ ar8xxx_write(struct ar8xxx_priv *priv, i
+ 	ar8xxx_mii_write32(priv, 0x10 | r2, r1, val);
+ 
+ 	mutex_unlock(&bus->mdio_lock);
++	local_irq_restore(flags);
+ }
+ 
+ u32
-- 
2.26.2



From gvalkov at abv.bg  Mon Sep 21 04:45:56 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Mon, 21 Sep 2020 11:45:56 +0300
Subject: mac80211: Fixed a bug: STA disconnects frequently
Message-ID: <A19B14FA-9AD8-4E33-A1C9-2202F2097D11@abv.bg>

Hi Felix!

Please revise your patch:
package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch

net/mac80211/mlme.c
Function  ieee80211_sta_tx_notify should check and reset  sdata->u.mgd.probe_send_count = 0, when  ack is  true, before calling  ieee80211_queue_work.
Otherwise the counter accumulates over time and the STA will eventually disconnect periodically.

Test conditions:
STA (WDS): TL-WR1043ND v4 - fixing the STA firmware resolves the issue
AP (WDS): WRT3200ACM - AP is not affected
PC wired to AP: ping -t sta-ip-address - indicate lost packets

Log:
[ 1516.144323] br-lan: port 3(wifi) entered disabled state
[ 1516.149836] br-lan: topology change detected, propagating
[ 1517.097423] wifi: authenticate with 60:38:e0:xx:xx:xx
[ 1517.116774] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[ 1517.159748] wifi: authenticated
[ 1517.167704] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[ 1517.191637] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[ 1517.199819] wifi: associated
[ 1517.213115] br-lan: port 3(wifi) entered blocking state
[ 1517.218579] br-lan: port 3(wifi) entered listening state
[ 1519.121477] br-lan: port 3(wifi) entered disabled state
[ 1519.126978] br-lan: topology change detected, propagating
[ 1520.075548] wifi: authenticate with 60:38:e0:xx:xx:xx
[ 1520.094883] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[ 1520.128702] wifi: authenticated
[ 1520.133053] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[ 1520.157807] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[ 1520.165962] wifi: associated
[ 1520.176668] br-lan: port 3(wifi) entered blocking state
[ 1520.182136] br-lan: port 3(wifi) entered listening state
[ 1522.217602] br-lan: port 3(wifi) entered learning state

Pull request with fix:
https://github.com/openwrt/openwrt/pull/3443

Please grant me write access to OpenWRT, so I can contribute other important fixes in the future, such as:
https://github.com/openwrt/openwrt/pull/3391


From 174bc62cf9157e06f6625ca68bb562c8c0a9ad32 Mon Sep 17 00:00:00 2001
From: Georgi Valkov <gvalkov at abv.bg>
Date: Sun, 20 Sep 2020 18:55:56 +0300
Subject: [PATCH] mac80211: Fixed a bug: STA disconnects frequently, because
 probe_send_count was not reset when ACK is received. Introduced in
 317-mac80211-optimize-station-connection-monitor.patch

Signed-off-by: Georgi Valkov <gvalkov at abv.bg>
---
 ...-optimize-station-connection-monitor.patch | 31 +++++++++----------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
index ed9efb2b0d..bbf5ed0d35 100644
--- a/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
+++ b/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
@@ -46,34 +46,31 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
  {
  	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-@@ -2521,21 +2504,13 @@ void ieee80211_sta_tx_notify(struct ieee
+@@ -2521,13 +2504,10 @@ void ieee80211_sta_tx_notify(struct ieee
  {
  	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);
  
 -	if (!ieee80211_is_data(hdr->frame_control))
 -	    return;
 -
--	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
--	    sdata->u.mgd.probe_send_count > 0) {
--		if (ack)
+ 	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
+ 	    sdata->u.mgd.probe_send_count > 0) {
+ 		if (ack)
 -			ieee80211_sta_reset_conn_monitor(sdata);
--		else
--			sdata->u.mgd.nullfunc_failed = true;
--		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
-+	if (!ieee80211_is_any_nullfunc(hdr->frame_control) ||
-+	    !sdata->u.mgd.probe_send_count)
- 		return;
--	}
++			sdata->u.mgd.probe_send_count = 0;
+ 		else
+ 			sdata->u.mgd.nullfunc_failed = true;
+ 		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
+@@ -2535,7 +2515,7 @@ void ieee80211_sta_tx_notify(struct ieee
+ 	}
  
--	if (ack)
+ 	if (ack)
 -		ieee80211_sta_reset_conn_monitor(sdata);
-+	if (!ack)
-+		sdata->u.mgd.nullfunc_failed = true;
-+	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
++		sdata->u.mgd.probe_send_count = 0;
  }
  
  static void ieee80211_mlme_send_probe_req(struct ieee80211_sub_if_data *sdata,
-@@ -3600,8 +3575,8 @@ static bool ieee80211_assoc_success(stru
+@@ -3600,8 +3580,8 @@ static bool ieee80211_assoc_success(stru
  	 * Start timer to probe the connection to the AP now.
  	 * Also start the timer that will detect beacon loss.
  	 */
@@ -83,7 +80,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
  
  	ret = true;
   out:
-@@ -4569,10 +4544,26 @@ static void ieee80211_sta_conn_mon_timer
+@@ -4569,10 +4549,26 @@ static void ieee80211_sta_conn_mon_timer
  		from_timer(sdata, t, u.mgd.conn_mon_timer);
  	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
  	struct ieee80211_local *local = sdata->local;
-- 
2.24.3 (Apple Git-128)




From gch981213 at gmail.com  Mon Sep 21 06:43:42 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Mon, 21 Sep 2020 18:43:42 +0800
Subject: mac80211: Fixed a bug: STA disconnects frequently
In-Reply-To: <A19B14FA-9AD8-4E33-A1C9-2202F2097D11@abv.bg>
References: <A19B14FA-9AD8-4E33-A1C9-2202F2097D11@abv.bg>
Message-ID: <CAJsYDV+kne+=yzD5bLLmmWfoheV93ZnWR=aUN2kwV=bVuBpC7Q@mail.gmail.com>

Hi!

On Mon, Sep 21, 2020 at 4:49 PM Georgi Valkov <gvalkov at abv.bg> wrote:
> Please grant me write access to OpenWRT, so I can contribute other important fixes in the future, such as:
> https://github.com/openwrt/openwrt/pull/3391

That's totally not how the development of OpenWrt works. Please
take your time to read OpenWrt contribution guidelines [0]
and fix all the formal issues first.

[0] https://openwrt.org/submitting-patches
-- 
Regards,
Chuanhong Guo


From nbd at nbd.name  Mon Sep 21 09:24:04 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Mon, 21 Sep 2020 15:24:04 +0200
Subject: [PATCH] ath79: ar8216: make switch register access atomic
In-Reply-To: <20200921065744.491098-1-gch981213@gmail.com>
References: <20200921065744.491098-1-gch981213@gmail.com>
Message-ID: <32b0d4ec-b518-7d51-f70f-56d08a80db61@nbd.name>

On 2020-09-21 08:57, Chuanhong Guo wrote:
> reg accesses on integrated ar8229 sometimes fails. As a result, phy read
> got incorrect port status and wan link goes down and up mysteriously.
> After comparing ar8216 with the old driver, these local_irq_save/restore
> calls are the only meaningful differences I could find and it does fix
> the issue.
> The same changes were added in svn r26856 by Gabor Juhos:
> ar71xx: ag71xx: make switch register access atomic
> 
> As I can't find the underlying problem either, this hack is broght
> back to fix the unstable link issue.
> This hack is only suitable for ath79 mdio and may easily break the
> driver on other platform. Limit it to ath79-only as a target patch.
> 
> Fixes: FS#2216
> Fixes: FS#3226
> Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> ---
>  .../930-ar8216-make-reg-access-atomic.patch   | 61 +++++++++++++++++++
>  1 file changed, 61 insertions(+)
>  create mode 100644 target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch
> 
> diff --git a/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch
> new file mode 100644
> index 0000000000..42f3305195
> --- /dev/null
> +++ b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch
> @@ -0,0 +1,61 @@
> +From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00 2001
> +From: Chuanhong Guo <gch981213 at gmail.com>
> +Date: Sun, 20 Sep 2020 01:00:45 +0800
> +Subject: [PATCH] ath79: ar8216: make switch register access atomic
> +
> +due to some unknown reason these register accesses sometimes fail
> +on the integrated switch without this patch.
> +
> +THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER PLATFORMS!
> +The mdio bus on ath79 works in polling mode and doesn't rely on
> +any interrupt. This patch breaks the driver on any mdio master
> +with interrupts used.
> +
> +---
> +--- a/drivers/net/phy/ar8216.c
> ++++ b/drivers/net/phy/ar8216.c
> +@@ -253,12 +253,14 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p
> + u32
> + ar8xxx_read(struct ar8xxx_priv *priv, int reg)
> + {
> ++	unsigned long flags;
> + 	struct mii_bus *bus = priv->mii_bus;
> + 	u16 r1, r2, page;
> + 	u32 val;
> + 
> + 	split_addr((u32) reg, &r1, &r2, &page);
> + 
> ++	local_irq_save(flags);
> + 	mutex_lock(&bus->mdio_lock);
Taking a mutex in an irq-disabled section is basically asking for a
deadlock. What router is this issue reproduced on? What else is running
at the time this happens?

- Felix


From zajec5 at gmail.com  Mon Sep 21 10:16:23 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 21 Sep 2020 16:16:23 +0200
Subject: [PATCH uhttpd] ubus: support GET method with CORS requests
Message-ID: <20200921141623.23608-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Complex GET requests (e.g. those with custom headers) require browsers
to send preflight OPTIONS request with:
Access-Control-Request-Method: GET

It's important to reply to such requests with all relevant
Access-Control-Allow-* headers to allow CORS requests.

Adding GET to the Access-Control-Allow-Methods is cosmetical as
according to the Fetch standard:

> If request?s method is not in methods, request?s method is not a
> CORS-safelisted method, and request?s credentials mode is "include" or
> methods does not contain `*`, then return a network error.

It basically means that Access-Control-Allow-Methods value is ignored
for GET, HEAD and POST methods.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ubus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ubus.c b/ubus.c
index 1cf5c5f..39b38b2 100644
--- a/ubus.c
+++ b/ubus.c
@@ -164,7 +164,7 @@ static void uh_ubus_add_cors_headers(struct client *cl)
 	{
 		char *hdr = (char *) blobmsg_data(tb[HDR_ACCESS_CONTROL_REQUEST_METHOD]);
 
-		if (strcmp(hdr, "POST") && strcmp(hdr, "OPTIONS"))
+		if (strcmp(hdr, "GET") && strcmp(hdr, "POST") && strcmp(hdr, "OPTIONS"))
 			return;
 	}
 
@@ -175,7 +175,7 @@ static void uh_ubus_add_cors_headers(struct client *cl)
 		ustream_printf(cl->us, "Access-Control-Allow-Headers: %s\r\n",
 		               blobmsg_get_string(tb[HDR_ACCESS_CONTROL_REQUEST_HEADERS]));
 
-	ustream_printf(cl->us, "Access-Control-Allow-Methods: POST, OPTIONS\r\n");
+	ustream_printf(cl->us, "Access-Control-Allow-Methods: GET, POST, OPTIONS\r\n");
 	ustream_printf(cl->us, "Access-Control-Allow-Credentials: true\r\n");
 }
 
-- 
2.27.0



From gch981213 at gmail.com  Mon Sep 21 12:26:23 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Tue, 22 Sep 2020 00:26:23 +0800
Subject: [PATCH] ath79: ar8216: make switch register access atomic
In-Reply-To: <32b0d4ec-b518-7d51-f70f-56d08a80db61@nbd.name>
References: <20200921065744.491098-1-gch981213@gmail.com>
 <32b0d4ec-b518-7d51-f70f-56d08a80db61@nbd.name>
Message-ID: <CAJsYDVKKZg68vCxysHBTbv1oG03553P9gX_tv720H4Rvtc1J+w@mail.gmail.com>

Hi!

On Mon, Sep 21, 2020 at 9:24 PM Felix Fietkau <nbd at nbd.name> wrote:
> > +
> > +     split_addr((u32) reg, &r1, &r2, &page);
> > +
> > ++    local_irq_save(flags);
> > +     mutex_lock(&bus->mdio_lock);
> Taking a mutex in an irq-disabled section is basically asking for a
> deadlock. What router is this issue reproduced on?

Any ar934x/qca953x router using built-in switch, based on
Flyspray bug reports. I can reproduce it on ar9341/tp-link-wr841n-v8
As there's an ancient commit about the same issue I guess
it appears on ar724x/ar933x as well.
here's the commit message:
commit 5d77f370d695c9a70f25ffb8367db64efadaaedd
Author: Gabor Juhos <juhosg at openwrt.org>
Date:   Sun May 8 16:32:53 2011 +0000

    ar71xx: ag71xx: make switch register access atomic

    Reading of the PHY registers occasionally returns with bogus values
    under heavy load. This misleads the PHY driver and thus causes false
    link/speed change notifications which leads to performance loss.
[and some dmesg after this]

> What else is running at the time this happens?

I'm using a minimal wr841n-v8 image. (make menuconfig,
select the device, save and build the firmware)
no extra background tasks are running.
swconfig led trigger is used so the kernel is constantly
polling port status from switch in the background.

-- 
Regards,
Chuanhong Guo


From a.heider at gmail.com  Mon Sep 21 12:31:42 2020
From: a.heider at gmail.com (Andre Heider)
Date: Mon, 21 Sep 2020 18:31:42 +0200
Subject: [PATCH] omap: update uboot to v2020.04
In-Reply-To: <20200904073049.1255919-1-a.heider@gmail.com>
References: <20200904073049.1255919-1-a.heider@gmail.com>
Message-ID: <925fb705-473f-075b-7b4b-ff0d48556464@gmail.com>

Hi Alexander,

On 04/09/2020 09:30, Andre Heider wrote:
> Fixes the build error:
> /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
> collect2: error: ld returned 1 exit status
> 
> Successfully tested on boneblack.
> 
> Signed-off-by: Andre Heider <a.heider at gmail.com>

do you mind to take a quick look? In the end this is just a tiny package 
bump! :)

Thanks,
Andre

> ---
>   package/boot/uboot-omap/Makefile | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
> index 70c8af1dc4..f66b8d5331 100644
> --- a/package/boot/uboot-omap/Makefile
> +++ b/package/boot/uboot-omap/Makefile
> @@ -8,10 +8,10 @@
>   include $(TOPDIR)/rules.mk
>   include $(INCLUDE_DIR)/kernel.mk
>   
> -PKG_VERSION:=2019.10
> +PKG_VERSION:=2020.04
>   PKG_RELEASE:=1
>   
> -PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014
> +PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
>   
>   include $(INCLUDE_DIR)/u-boot.mk
>   include $(INCLUDE_DIR)/package.mk
> 



From nbd at nbd.name  Mon Sep 21 12:37:38 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Mon, 21 Sep 2020 18:37:38 +0200
Subject: [PATCH] ath79: ar8216: make switch register access atomic
In-Reply-To: <CAJsYDVKKZg68vCxysHBTbv1oG03553P9gX_tv720H4Rvtc1J+w@mail.gmail.com>
References: <20200921065744.491098-1-gch981213@gmail.com>
 <32b0d4ec-b518-7d51-f70f-56d08a80db61@nbd.name>
 <CAJsYDVKKZg68vCxysHBTbv1oG03553P9gX_tv720H4Rvtc1J+w@mail.gmail.com>
Message-ID: <2707d025-2d01-bf72-158c-8679d1c4695f@nbd.name>


On 2020-09-21 18:26, Chuanhong Guo wrote:
> Hi!
> 
> On Mon, Sep 21, 2020 at 9:24 PM Felix Fietkau <nbd at nbd.name> wrote:
>> > +
>> > +     split_addr((u32) reg, &r1, &r2, &page);
>> > +
>> > ++    local_irq_save(flags);
>> > +     mutex_lock(&bus->mdio_lock);
>> Taking a mutex in an irq-disabled section is basically asking for a
>> deadlock. What router is this issue reproduced on?
> 
> Any ar934x/qca953x router using built-in switch, based on
> Flyspray bug reports. I can reproduce it on ar9341/tp-link-wr841n-v8
> As there's an ancient commit about the same issue I guess
> it appears on ar724x/ar933x as well.
> here's the commit message:
> commit 5d77f370d695c9a70f25ffb8367db64efadaaedd
> Author: Gabor Juhos <juhosg at openwrt.org>
> Date:   Sun May 8 16:32:53 2011 +0000
> 
>     ar71xx: ag71xx: make switch register access atomic
> 
>     Reading of the PHY registers occasionally returns with bogus values
>     under heavy load. This misleads the PHY driver and thus causes false
>     link/speed change notifications which leads to performance loss.
> [and some dmesg after this]
> 
>> What else is running at the time this happens?
> 
> I'm using a minimal wr841n-v8 image. (make menuconfig,
> select the device, save and build the firmware)
> no extra background tasks are running.
> swconfig led trigger is used so the kernel is constantly
> polling port status from switch in the background.
I have another idea what you could try. Many SoCs enable both MDIO
busses, and maybe they have some shared resources/state in the hw.

You could try making a global spinlock in ag71xx_mdio.c and do
spin_lock_bh(&mdio_lock) in ag71xx_mdio_mii_read and ag71xx_mdio_mii_write

- Felix


From lynxis at fe80.eu  Mon Sep 21 12:53:13 2020
From: lynxis at fe80.eu (Alexander 'lynxis' Couzens)
Date: Mon, 21 Sep 2020 18:53:13 +0200
Subject: [PATCH] omap: update uboot to v2020.04
In-Reply-To: <925fb705-473f-075b-7b4b-ff0d48556464@gmail.com>
References: <20200904073049.1255919-1-a.heider@gmail.com>
 <925fb705-473f-075b-7b4b-ff0d48556464@gmail.com>
Message-ID: <20200921185314.20536222@lazus.yip>

> do you mind to take a quick look? In the end this is just a tiny
> package bump! :)

let me have a tiny look on other devices ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200921/586e0f0e/attachment.sig>

From shep971 at centurylink.net  Mon Sep 21 13:54:09 2020
From: shep971 at centurylink.net (Heppler, J. Scott)
Date: Mon, 21 Sep 2020 10:54:09 -0700
Subject: mt7603 radio not enabled in Linksys EA7300 V2 build
Message-ID: <20200921175409.GA99662@centurylink.net>

My build, based on the EA7300v1 build has 2 glitches, the mt7603 radio
is not enable and the switch does not show in LuCi.  The switch does
seem to function.

I essentially edited all the EA7300v1 commits and duplicated/edited the
EA7300v1 dts to a EA7300v2.  In the image/mt7621.mk entry, I appended 
DEVICE_PACKAGES += kmod-mt7603.  If specific files are needed to review,
beyond, my overview, I'm glad to provide them.


Hopefully, fixing this will not open up a can of worms in the *ea7xxx
dtsi.

-- 
J. Scott Heppler


From devel-sven at geroedel.de  Mon Sep 21 14:42:50 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Mon, 21 Sep 2020 20:42:50 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <0e9a2934-7484-f61a-37c0-e0506671bea2@gmail.com>
References: <5836172.LP2CDrWvR4@strike>
 <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
 <0e9a2934-7484-f61a-37c0-e0506671bea2@gmail.com>
Message-ID: <2094853.XaBt8SgSzu@strike>

Fernando,

I'm only talking on the boards having 32MB RAM. This includes 4MB / 8MB flash 
boards. 
I'm not having the 8/64 boards in mind. They are fine and should work for some 
furture releases

Sven

Am Montag, 21. September 2020, 00:24:00 CEST schrieb Fernando Frediani:
> I have some concern to call tiny the 8/32 boards.
> While I understand the 4MB flash devices as phased out the 8/32 are
> still very popular and probably most of the devices still running in
> many and many places and they are not really tiny as of today. Some
> newer low priced are coming with 8/64, but the point is that OpenWrt has
> been the responsible for many devices to keep going for years with
> stability and this no doubt will happen with 8/32 for a while.
> Calling tiny means only 8MB flash or both 8MB flash and 32MB ram ? I may
> see a point to call the 8MB devices maybe, but not 32MB ram ones.
> 
> Fernando
> 




From mail at adrianschmutzler.de  Mon Sep 21 15:00:01 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Mon, 21 Sep 2020 21:00:01 +0200
Subject: mt7603 radio not enabled in Linksys EA7300 V2 build
In-Reply-To: <20200921175409.GA99662@centurylink.net>
References: <20200921175409.GA99662@centurylink.net>
Message-ID: <005301d69049$6937b840$3ba728c0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Heppler, J. Scott
> Sent: Montag, 21. September 2020 19:54
> To: openwrt-devel at openwrt.org
> Subject: mt7603 radio not enabled in Linksys EA7300 V2 build
> 
> My build, based on the EA7300v1 build has 2 glitches, the mt7603 radio is not
> enable and the switch does not show in LuCi.  The switch does seem to
> function.

EA7300v1 is mt7621 and thus uses DSA for the switch config; probably LuCI doesn't support that yet and your setup is fine.

Best

Adrian 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200921/aa372719/attachment.sig>

From jacekowski at jacekowski.org  Mon Sep 21 18:57:58 2020
From: jacekowski at jacekowski.org (Jacek Milewicz)
Date: Mon, 21 Sep 2020 23:57:58 +0100
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
In-Reply-To: <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>
References: <20200915195655.13866-1-jacekowski@jacekowski.org>
 <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>
Message-ID: <7ed2e21b-0594-7246-71f0-f4fb885e4c3a@jacekowski.org>


On 19/09/2020 15:06, Paul Oranje wrote:
> See below, regards,
> Paul
>
>
>> Op 15 sep. 2020, om 21:56 heeft jacekowski at jacekowski.org het volgende geschreven:
> The subject does not to comply with the rules for that, it should at least start with the target, better would be:
> 	ipq806x: fix tx-queue-size on NBG6817

I was not aware of that.

>> From: Jacek Milewicz <jacekowski at jacekowski.org>
>>
>> Fixes FS#3285 for NBG6817 only.
> Why is that ?

Because on IPQ806x SoC it is impossible to detect correct value, 
therefore it has to be set for each device in device tree (which is what 
this patch is doing).

On most IPQ806x devices correct value has to be determined manually by 
trying few most common values and seeing what works (4k seems to be most 
common).

>
>> Signed-off-by: Jacek Milewicz <jacekowski at jacekowski.org>
>> ---
>> .../files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts       | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
>> index 7cd1c7b567..5745040d2b 100644
>> --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
>> +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
>> @@ -289,6 +289,7 @@
>> 			qcom,emulation = <0>;
>> 			qcom,irq = <255>;
>> 			mdiobus = <&mdio0>;
>> +			tx-fifo-depth = <4096>;
>>
>> 			pinctrl-0 = <&rgmii2_pins>;
>> 			pinctrl-names = "default";
>> @@ -310,6 +311,7 @@
>> 			qcom,emulation = <0>;
>> 			qcom,irq = <258>;
>> 			mdiobus = <&mdio0>;
>> +			tx-fifo-depth = <4096>;
>>
>> 			fixed-link {
>> 				speed = <1000>;
>> -- 
>> 2.17.1
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From ansuelsmth at gmail.com  Mon Sep 21 19:06:05 2020
From: ansuelsmth at gmail.com (Ansuel Smith)
Date: Tue, 22 Sep 2020 01:06:05 +0200
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
In-Reply-To: <7ed2e21b-0594-7246-71f0-f4fb885e4c3a@jacekowski.org>
References: <20200915195655.13866-1-jacekowski@jacekowski.org>
 <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>
 <7ed2e21b-0594-7246-71f0-f4fb885e4c3a@jacekowski.org>
Message-ID: <CA+_ehUz9veE9bx9jLZK4JYNG8s801fFbKh7shpd4oxjxkZRuvA@mail.gmail.com>

>
>
> On 19/09/2020 15:06, Paul Oranje wrote:
> > See below, regards,
> > Paul
> >
> >
> >> Op 15 sep. 2020, om 21:56 heeft jacekowski at jacekowski.org het volgende geschreven:
> > The subject does not to comply with the rules for that, it should at least start with the target, better would be:
> >       ipq806x: fix tx-queue-size on NBG6817
>
> I was not aware of that.
>
> >> From: Jacek Milewicz <jacekowski at jacekowski.org>
> >>
> >> Fixes FS#3285 for NBG6817 only.
> > Why is that ?
>
> Because on IPQ806x SoC it is impossible to detect correct value,
> therefore it has to be set for each device in device tree (which is what
> this patch is doing).
>
> On most IPQ806x devices correct value has to be determined manually by
> trying few most common values and seeing what works (4k seems to be most
> common).
>

Can I ask you how you found out and how to check if a bad value is set?
Is this set by default on the OEM firmware? Any test or something?


From jacekowski at jacekowski.org  Mon Sep 21 20:02:25 2020
From: jacekowski at jacekowski.org (Jacek Milewicz)
Date: Tue, 22 Sep 2020 01:02:25 +0100
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
In-Reply-To: <CA+_ehUz9veE9bx9jLZK4JYNG8s801fFbKh7shpd4oxjxkZRuvA@mail.gmail.com>
References: <20200915195655.13866-1-jacekowski@jacekowski.org>
 <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>
 <7ed2e21b-0594-7246-71f0-f4fb885e4c3a@jacekowski.org>
 <CA+_ehUz9veE9bx9jLZK4JYNG8s801fFbKh7shpd4oxjxkZRuvA@mail.gmail.com>
Message-ID: <f2025378-0c1e-d796-bf90-062aac016e5f@jacekowski.org>



On 22/09/2020 00:06, Ansuel Smith wrote:
>>
>>
>> On 19/09/2020 15:06, Paul Oranje wrote:
>>> See below, regards,
>>> Paul
>>>
>>>
>>>> Op 15 sep. 2020, om 21:56 heeft jacekowski at jacekowski.org het volgende geschreven:
>>> The subject does not to comply with the rules for that, it should at least start with the target, better would be:
>>>        ipq806x: fix tx-queue-size on NBG6817
>>
>> I was not aware of that.
>>
>>>> From: Jacek Milewicz <jacekowski at jacekowski.org>
>>>>
>>>> Fixes FS#3285 for NBG6817 only.
>>> Why is that ?
>>
>> Because on IPQ806x SoC it is impossible to detect correct value,
>> therefore it has to be set for each device in device tree (which is what
>> this patch is doing).
>>
>> On most IPQ806x devices correct value has to be determined manually by
>> trying few most common values and seeing what works (4k seems to be most
>> common).
>>
> 
> Can I ask you how you found out and how to check if a bad value is set?
> Is this set by default on the OEM firmware? Any test or something?
> 

OEM firmware runs older kernel that does not check for tx-fifo-depth at 
all (https://patchwork.kernel.org/patch/11283121/ - this patch, dated 
December 2019 added the check). There is only few values that the driver 
will accept (256,512,1k,2k,4,8k,16k), so the easiest way to check is set 
it to highest (16k) and then try increasingly higher MTU to check at 
what point does it start dropping packets or crashing (and it seems like 
4k is fairly common value on this SoC).


From mail at aparcar.org  Mon Sep 21 22:30:31 2020
From: mail at aparcar.org (Paul Spooren)
Date: Mon, 21 Sep 2020 16:30:31 -1000
Subject: Policy for adding new files to OpenWrt
Message-ID: <C5TJMDO1FMUC.3EV8QOZCBQBOE@dawn>

Hi team,

Based on PR#3427 on GitHub[0] I'd suggest we add a policy that every
added file needs a SPDX header. This likely simplifies merging patches
into mainline Kernel and probably makes some lawyers happy.

There are fancy tools to do so, like the `reuse` project[1].

Best,
Paul

[0]: https://github.com/openwrt/openwrt/pull/3427
[1]: https://github.com/fsfe/reuse-tool


From gvalkov at abv.bg  Tue Sep 22 03:28:57 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Tue, 22 Sep 2020 10:28:57 +0300
Subject: [PATCH] mac80211: fix regression in sta connection monitor
In-Reply-To: <20200921154545.91971-1-nbd@nbd.name>
References: <20200921154545.91971-1-nbd@nbd.name>
Message-ID: <7A099B27-5278-4D2A-91A1-6B795CB0E221@abv.bg>

Hi Felix!

In the original code before the regression, as well as in the fix I proposed, probe_send_count was always reset if ack is true, while in your fix it will not be reset when non-null frames are received. The connection failed again after 10 hours and the STA remained offline for two minutes instead of two seconds. I should also note that I spent multiple days testing the fix I proposed and I had no disconnects. Please revise your fix again!


// my fix
void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
			     struct ieee80211_hdr *hdr, bool ack, u16 tx_time)
{
	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);

	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
	    sdata->u.mgd.probe_send_count > 0) {
		if (ack)
			sdata->u.mgd.probe_send_count = 0;
		else
			sdata->u.mgd.nullfunc_failed = true;
		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
		return;
	}

	if (ack)
		sdata->u.mgd.probe_send_count = 0;
}


// commit 1c6d45644a54e50b6445bbc63eff1ae34b2f1e2e
void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
			     struct ieee80211_hdr *hdr, bool ack, u16 tx_time)
{
	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);

	if (!ieee80211_is_any_nullfunc(hdr->frame_control) ||
	    !sdata->u.mgd.probe_send_count)
		return;

	if (ack)
		sdata->u.mgd.probe_send_count = 0;
	else
		sdata->u.mgd.nullfunc_failed = true;
	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
}


[STA: excerpt from the kernel log]
[   37.473147] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   37.587678] jffs2_build_filesystem(): unlocking the mtd device...
[   37.587722] done.
[   37.596129] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   37.964664] br-lan: port 1(eth0.1) entered forwarding state
[   37.978167] br-lan: topology change detected, propagating
[   37.984273] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   38.744745] ath: EEPROM regdomain: 0x8348
[   38.744752] ath: EEPROM indicates we should expect a country code
[   38.744759] ath: doing EEPROM country->regdmn map search
[   38.744764] ath: country maps to regdmn code: 0x3a
[   38.744769] ath: Country alpha2 being used: US
[   38.744772] ath: Regpair used: 0x3a
[   38.744778] ath: regdomain 0x8348 dynamically updated by user
[   39.468663] br-lan: port 2(tap_su) entered learning state
[   41.377031] br-lan: port 3(wifi) entered blocking state
[   41.382487] br-lan: port 3(wifi) entered disabled state
[   41.388183] device wifi entered promiscuous mode
[   41.484626] br-lan: port 2(tap_su) entered forwarding state
[   41.490410] br-lan: topology change detected, propagating
[   41.954884] wifi: authenticate with 60:38:e0:xx:xx:xx
[   41.974243] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[   41.986584] wifi: authenticated
[   42.044684] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[   42.070584] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[   42.078755] wifi: associated
[   42.093218] IPv6: ADDRCONF(NETDEV_CHANGE): wifi: link becomes ready
[   42.099926] br-lan: port 3(wifi) entered blocking state
[   42.105375] br-lan: port 3(wifi) entered listening state
[   44.140622] br-lan: port 3(wifi) entered learning state
[   46.156627] br-lan: port 3(wifi) entered forwarding state
[   46.162225] br-lan: topology change detected, sending tcn bpdu
[   66.065901] done.
[   66.067921] jffs2: notice: (1973) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   66.371947] overlayfs: upper fs does not support tmpfile.
[   96.686235] sh (2348): drop_caches: 3
[36276.157356] wifi: deauthenticated from 60:38:e0:xx:xx:xx (Reason: 16=GROUP_KEY_HANDSHAKE_TIMEOUT)
[36276.166733] br-lan: port 3(wifi) entered disabled state
[36276.172265] br-lan: topology change detected, propagating
[36277.143206] wifi: authenticate with 60:38:e0:xx:xx:xx
[36277.162537] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[36277.207635] wifi: authenticated
[36277.212374] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[36277.236924] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[36277.245086] wifi: associated
[36277.272020] br-lan: port 3(wifi) entered blocking state
[36277.277472] br-lan: port 3(wifi) entered listening state
[36279.304356] br-lan: port 3(wifi) entered learning state
[36281.320494] br-lan: port 3(wifi) entered forwarding state
[36281.326089] br-lan: topology change detected, sending tcn bpdu
[36301.769911] br-lan: port 3(wifi) neighbor 7fff.60:38:e0:xx:xx:xy lost
[36301.776587] br-lan: topology change detected, propagating
[36577.165274] wifi: disassociated from 60:38:e0:xx:xx:xx (Reason: 4=DISASSOC_DUE_TO_INACTIVITY)
[36577.174238] br-lan: port 3(wifi) entered disabled state
[36577.228788] wifi: authenticate with 60:38:e0:xx:xx:xx
[36577.248147] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[36577.255054] wifi: authenticated
[36577.259806] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[36577.285353] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[36577.293521] wifi: associated
[36577.303805] br-lan: port 3(wifi) entered blocking state
[36577.309234] br-lan: port 3(wifi) entered listening state
[36579.323849] br-lan: port 3(wifi) entered learning state
[36581.339975] br-lan: port 3(wifi) entered forwarding state
[36581.345571] br-lan: topology change detected, sending tcn bpdu


[STA: excerpt from the system log]
Tue Sep 22 09:24:16 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Group rekeying completed with 60:38:e0:xx:xx:xx [GTK=CCMP]
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.157356] wifi: deauthenticated from 60:38:e0:xx:xx:xx (Reason: 16=GROUP_KEY_HANDSHAKE_TIMEOUT)
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.166733] br-lan: port 3(wifi) entered disabled state
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.172265] br-lan: topology change detected, propagating
Tue Sep 22 09:24:20 2020 daemon.notice netifd: Network device 'wifi' link is down
Tue Sep 22 09:24:20 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-DISCONNECTED bssid=60:38:e0:xx:xx:xx reason=16
Tue Sep 22 09:24:21 2020 daemon.notice wpa_supplicant[1436]: wifi: SME: Trying to authenticate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.143206] wifi: authenticate with 60:38:e0:xx:xx:xx
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.162537] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:24:21 2020 daemon.notice wpa_supplicant[1436]: wifi: Trying to associate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.207635] wifi: authenticated
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.212374] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.236924] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.245086] wifi: associated
Tue Sep 22 09:24:22 2020 daemon.notice netifd: Network device 'wifi' link is up
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Associated with 60:38:e0:xx:xx:xx
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Key negotiation completed with 60:38:e0:xx:xx:xx [PTK=CCMP GTK=CCMP]
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-CONNECTED - Connection to 60:38:e0:xx:xx:xx completed [id=0 id_str=]
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.272020] br-lan: port 3(wifi) entered blocking state
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.277472] br-lan: port 3(wifi) entered listening state
Tue Sep 22 09:24:24 2020 kern.info kernel: [36279.304356] br-lan: port 3(wifi) entered learning state
Tue Sep 22 09:24:26 2020 kern.info kernel: [36281.320494] br-lan: port 3(wifi) entered forwarding state
Tue Sep 22 09:24:26 2020 kern.info kernel: [36281.326089] br-lan: topology change detected, sending tcn bpdu
Tue Sep 22 09:24:46 2020 kern.info kernel: [36301.769911] br-lan: port 3(wifi) neighbor 7fff.60:38:e0:xx:xx:xy lost
Tue Sep 22 09:24:46 2020 kern.info kernel: [36301.776587] br-lan: topology change detected, propagating
Tue Sep 22 09:29:21 2020 kern.info kernel: [36577.165274] wifi: disassociated from 60:38:e0:xx:xx:xx (Reason: 4=DISASSOC_DUE_TO_INACTIVITY)
Tue Sep 22 09:29:21 2020 kern.info kernel: [36577.174238] br-lan: port 3(wifi) entered disabled state
Tue Sep 22 09:29:21 2020 daemon.notice netifd: Network device 'wifi' link is down
Tue Sep 22 09:29:21 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-DISCONNECTED bssid=60:38:e0:xx:xx:xx reason=4
Tue Sep 22 09:29:21 2020 daemon.notice wpa_supplicant[1436]: wifi: SME: Trying to authenticate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.228788] wifi: authenticate with 60:38:e0:xx:xx:xx
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.248147] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.255054] wifi: authenticated
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Trying to associate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.259806] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.285353] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.293521] wifi: associated
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Associated with 60:38:e0:xx:xx:xx
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Tue Sep 22 09:29:22 2020 daemon.notice netifd: Network device 'wifi' link is up
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Key negotiation completed with 60:38:e0:xx:xx:xx [PTK=CCMP GTK=CCMP]
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-CONNECTED - Connection to 60:38:e0:xx:xx:xx completed [id=0 id_str=]
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.303805] br-lan: port 3(wifi) entered blocking state
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.309234] br-lan: port 3(wifi) entered listening state
Tue Sep 22 09:29:24 2020 kern.info kernel: [36579.323849] br-lan: port 3(wifi) entered learning state
Tue Sep 22 09:29:26 2020 kern.info kernel: [36581.339975] br-lan: port 3(wifi) entered forwarding state
Tue Sep 22 09:29:26 2020 kern.info kernel: [36581.345571] br-lan: topology change detected, sending tcn bpdu


[AP: excerpt from the kernel log]
[86442.373359] ieee80211 phy1: staid 1 deleted
[86448.496264] ieee80211 phy1: staid 1 deleted


[PC: ping -t 192.168.zzz.1]
Reply from 192.168.zzz.1: bytes=32 time=6ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=6ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.

Ping statistics for 192.168.zzz.1:
    Packets: Sent = 29750, Received = 29745, Lost = 5 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 242ms, Average = 2ms
Control-Break
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.1: bytes=32 time=2996ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=44ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=505ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=301ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=507ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=5ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=3ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=3ms TTL=64

Ping statistics for 192.168.zzz.1:
    Packets: Sent = 29820, Received = 29815, Lost = 5 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 2996ms, Average = 3ms


> On 2020-09-21, at 6:45 PM, Felix Fietkau <nbd at nbd.name> wrote:
> 
> When the nulldata frame was acked, the probe send count needs to be reset,
> otherwise it will keep increasing until the connection is considered dead,
> even though it fine.
> 
> Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
> Reported-by: Georgi Valkov <gvalkov at abv.bg>
> Signed-off-by: Felix Fietkau <nbd at nbd.name>
> ---
> net/mac80211/mlme.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 50a9b9025725..7c04d8e30482 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -2508,7 +2508,9 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
> 	    !sdata->u.mgd.probe_send_count)
> 		return;
> 
> -	if (!ack)
> +	if (ack)
> +		sdata->u.mgd.probe_send_count = 0;
> +	else
> 		sdata->u.mgd.nullfunc_failed = true;
> 	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
> }
> -- 
> 2.28.0
> 
> 



From nbd at nbd.name  Tue Sep 22 04:56:13 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Tue, 22 Sep 2020 10:56:13 +0200
Subject: [PATCH] mac80211: fix regression in sta connection monitor
In-Reply-To: <7A099B27-5278-4D2A-91A1-6B795CB0E221@abv.bg>
References: <20200921154545.91971-1-nbd@nbd.name>
 <7A099B27-5278-4D2A-91A1-6B795CB0E221@abv.bg>
Message-ID: <099b1679-87c4-1ac5-978b-a1110db93f54@nbd.name>

On 2020-09-22 09:28, Georgi Valkov wrote:
> Hi Felix!
> 
> In the original code before the regression, as well as in the fix I
> proposed, probe_send_count was always reset if ack is true, while in
> your fix it will not be reset when non-null frames are received. The
> connection failed again after 10 hours and the STA remained offline for
> two minutes instead of two seconds. I should also note that I spent
> multiple days testing the fix I proposed and I had no disconnects.
> Please revise your fix again!
Thanks for the info. Handling non-null frames in that function is
incomplete, because it does not cover the 802.3 tx status path.
I'll make v2 patch that checks the timestamp of the last ACK in
ieee80211_sta_work instead.

- Felix


From sami at olmari.fi  Tue Sep 22 06:59:58 2020
From: sami at olmari.fi (Sami Olmari)
Date: Tue, 22 Sep 2020 13:59:58 +0300
Subject: Dnssec is never enabled on recent master
Message-ID: <CAENOc+za16-cVMi2PjN1Vh4q681yVjpwQQraqUghMj65TaX0Vw@mail.gmail.com>

This commit https://github.com/openwrt/openwrt/commit/064dc1e81bc85f6ef8becc38854292853a59d2c2
breaks all dnssec, it will never get enabled despite /etc/config/dhcp
enabling it. Reverting this commit made dnssec to work again. So this
needs either reverting, or some more elaborate fix.

Additionally I got this message when troubleshooting this at irc:
"While at it, ask please to fix trust-anchor match too (it's not an
option, the option just contains that word at the end)"

Thank you!

-- 
 Sami Olmari
 Oy Olmari Ab
 Vaasa Hacklab ry


From richb.hanover at gmail.com  Tue Sep 22 07:04:40 2020
From: richb.hanover at gmail.com (Rich Brown)
Date: Tue, 22 Sep 2020 07:04:40 -0400
Subject: [PATCH] Fix tx-queue-size on NBG6817 (allows MTU changes).
In-Reply-To: <f2025378-0c1e-d796-bf90-062aac016e5f@jacekowski.org>
References: <20200915195655.13866-1-jacekowski@jacekowski.org>
 <326CDF01-E74E-4AF0-885F-54B70162C458@oranjevos.nl>
 <7ed2e21b-0594-7246-71f0-f4fb885e4c3a@jacekowski.org>
 <CA+_ehUz9veE9bx9jLZK4JYNG8s801fFbKh7shpd4oxjxkZRuvA@mail.gmail.com>
 <f2025378-0c1e-d796-bf90-062aac016e5f@jacekowski.org>
Message-ID: <7876AF6C-EB0F-430A-8846-00B014CEB2B3@gmail.com>



> On Sep 21, 2020, at 8:02 PM, Jacek Milewicz <jacekowski at jacekowski.org> wrote:
> 
> 
> 
> On 22/09/2020 00:06, Ansuel Smith wrote:
>>> 
>>> 
>>> On 19/09/2020 15:06, Paul Oranje wrote:
>>>> See below, regards,
>>>> Paul
>>>> 
>>>> 
>>>>> Op 15 sep. 2020, om 21:56 heeft jacekowski at jacekowski.org het volgende geschreven:
>>>> The subject does not to comply with the rules for that, it should at least start with the target, better would be:
>>>>       ipq806x: fix tx-queue-size on NBG6817
>>> 
>>> I was not aware of that.
>>> 
>>>>> From: Jacek Milewicz <jacekowski at jacekowski.org>
>>>>> 
>>>>> Fixes FS#3285 for NBG6817 only.
>>>> Why is that ?
>>> 
>>> Because on IPQ806x SoC it is impossible to detect correct value,
>>> therefore it has to be set for each device in device tree (which is what
>>> this patch is doing).
>>> 
>>> On most IPQ806x devices correct value has to be determined manually by
>>> trying few most common values and seeing what works (4k seems to be most
>>> common).
>>> 
>> Can I ask you how you found out and how to check if a bad value is set?
>> Is this set by default on the OEM firmware? Any test or something?
> 
> OEM firmware runs older kernel that does not check for tx-fifo-depth at all (https://patchwork.kernel.org/patch/11283121/ - this patch, dated December 2019 added the check). There is only few values that the driver will accept (256,512,1k,2k,4,8k,16k), so the easiest way to check is set it to highest (16k) and then try increasingly higher MTU to check at what point does it start dropping packets or crashing (and it seems like 4k is fairly common value on this SoC).

This all sounds like valuable, hard-won information that deserves to be documented in the code.

> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From tomek_n at o2.pl  Tue Sep 22 12:56:16 2020
From: tomek_n at o2.pl (Tomasz Maciej Nowak)
Date: Tue, 22 Sep 2020 18:56:16 +0200
Subject: [PATCH v2 1/2] ipq40xx: add support for Luma Home WRTQ-329ACN
In-Reply-To: <a4a7d498-b606-a8df-1752-700070bc1f52@gmail.com>
References: <20200830112811.6175-1-tomek_n@o2.pl>
 <4c344f4a-45e6-6042-fa90-40301a683683@gmail.com>
 <b4e06e91-0c62-00a5-7e76-e799ee430098@o2.pl>
 <a4a7d498-b606-a8df-1752-700070bc1f52@gmail.com>
Message-ID: <ccf4685f-be70-f917-8b9a-9e1ab63920a0@o2.pl>

W dniu 18.09.2020 o?20:47, Christian Lamparter pisze:
> On 2020-09-15 16:50, Tomasz Maciej Nowak wrote:
>> Hi Christian, thanks for looking at this.
>>
>> W dniu 13.09.2020 o?00:04, Christian Lamparter pisze:
>>> On 2020-08-30 13:28, Tomasz Maciej Nowak wrote:
>>>> Luma Home WRTQ-329ACN, also known as Luma WiFi System, is a dual-band
>>>> wireless access point.
>>>>
>>>> Specification
>>>> SoC: Qualcomm Atheros IPQ4018
>>>> RAM: 256 MB DDR3
>>>> Flash: 2 MB SPI NOR
>>>> ???????? 128 MB SPI NAND
> [...]
> 
>>> So, because you install from the initramfs and introduced a custom run
>>> command with a custom "kernel1" ubi volume... It might be possible to
>>> cut the extra parts in the sysupgrade and bootargs and unify it with
>>> the generic nand_do_upgrade() crowd.
>>>
>>> I've incorperated what maybe could be done in this patch on my
>>> staging tree: [0]
>>>
>>> (Note the changes in step 9 (kernel1->kernel), step 10 (ubirmvol ubi_rootfs1 & kernel1) and the "step 2 in
>>> back to OEM".
>>>
>>> The idea is that we use OpenWrt's existing automount for ubi
>>> and "rootfs" volumes.
>>>
>>> (In theory this could make the "back to OEM" even easier.
>>> Because if it works the way I think it does, we could drop
>>> the ubirmvol of ubi_rootfs1 and kernel1 in step 10 of my version.
>>> Next, it should be possible to drop the ubimkvol of
>>> kernel1 and ubi_rootfs1 step 2 in the "Reverting to OEM" section.
>>> This is because the original rootfs1 and kernel1 still exist and
>>> are left untouched - no idea if this works out or not.)
>>
>> Personally I would like to use whole NAND for OpenWrt, that would simplify everything a lot.
>> Unfortunately some users might be dissatisfied with how things are done in OpenWrt and wish
>> to revert to stock firmware. I'll explain in points what are the current issues with this
>> device. My knowledge is based on what I could dig out from firmware (QSDK) without access to
>> source modifications.
> 
> I don't think there's a need to do that. On old (and new) devices that only have
> 8MiB/16MiB of flash space, it's impossible to keep the vendor firmware around.
> There's no obligation to do that. From the looks of it, though. I think it's more
> of a hassle to fully remove the vendor than to keep it around and praise this as
> a feature. So either way, both are fine :-) . If somebody wants to use the full
> NAND, she/he could just delete the remaining "kernel1, ubi_rootfs[1]" volumes
> and resize the rootfs_data. (This can be done in place).

Yeah, this is one of the features making UBI so good. Anyway there's enough space
so let's keep the OEM firmware.

> 
>> 1. The devices have different flash layouts, some come with
>> mtd8: 08000000 00020000 "rootfs"
>> mtd9: 0041e000 0001f000 "kernel"
>> mtd10: 026c0000 0001f000 "ubi_rootfs"
>> mtd11: 01ff8000 0001f000 "rootfs_data"
>> mtd12: 0041e000 0001f000 "kernel1"
>> mtd13: 026c0000 0001f000 "ubi_rootfs1"
>>
>> and some
>>
>> mtd8: 08000000 00020000 "rootfs"
>> mtd9: 003a2000 0001f000 "kernel"
>> mtd10: 02283000 0001f000 "ubi_rootfs"
>> mtd11: 0062d000 0001f000 "dummy"
>> mtd12: 01ff8000 0001f000 "rootfs_data"
>> mtd13: 0041e000 0001f000 "kernel1"
>> mtd14: 026c0000 0001f000 "ubi_rootfs1"
>>
>> this reflects the bootargs in dts.
> 
> Ok, that 128 MiB "rootfs" looks to be the "ubi" partition.

Yes, I renamed it to accommodate OpenWrt features (that was before I shifted to use
kernel1+ubi_rootfs1).

> My best "this could be"
> guess is that the "dummy" and the different sizes of the kernel vs kernel1 partition
> stems from a update. The dummy would be a temporary filesystem for the stuff that
> was worth keeping... But I don't know.

That was my guess too, except the dummy partition is almost empty, with small amount of garbage.
Seems to be a failed update, since on first (active) set of kernel+ubi_rootfs I had 1.1-16r
firmware version and on the second one 1.1-18. Reading from scripts the second set is always
updated first.

> 
> I just like to see the use of the established "kernel" and "rootfs" volumes whenever
> possible.

ACK

> 
> I did the necessary changes in this version:
> <https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=b30fedc765871e7738257eae305674b0069bbd96>
> 
> This will repurpose the "kernel" partition (by overwriting it)
> and ditch "ubi_rootfs". The big mtd partition "rootfs" is renamed to
> "ubi" (this is because OpenWrt will auto-attach the volume - handled
> by 490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch)
> 
> and the squashfs root is placed in "rootfs". (OpenWrt does
> automatically create a ubiblock for volumes called rootfs -
> done by 491-ubi-auto-create-ubiblock-device-for-rootfs.patch @Daniel)
> 
> What's your opinion? Do you want it in a different way? Or are you
> fine with the changes? (I would need to know if this works or not
> though)

I'm (very much) fine with proposed solution. I like the volumes renaming which I didn't
consider previously. The instructions worked, except when restoring ubi_rootfs1 there was not
enough PEBs. I'm thinking about also removing the "dummy" volume in installation instruction,
since it's not used by OEM firmware for anything (that solved missing PEBs). Also I would
change the order of restoring volumes from:
 ubimkvol /dev/ubi0 -S 264 -N rootfs_data
 ubimkvol /dev/ubi0 -S 34 -N kernel1
 ubimkvol /dev/ubi0 -S 320 -N ubi_rootfs1
to
 ubimkvol /dev/ubi0 -S 34 -N kernel1
 ubimkvol /dev/ubi0 -S 320 -N ubi_rootfs1
 ubimkvol /dev/ubi0 -S 264 -N rootfs_data
since the starting point is beginning of flash, no the middle.

> 
>>
>> 2. As illustrated above, the device comes with two sets of kernel+ubi_rootfs and shared
>> overlay "rootfs_data". The U-Boot with 'bootipq' command boots the first kernel+ubi_rootfs
>> pair. There is some kind of fallback mechanism to issue boot from the second pair, but I was
>> unable to trigger it (didn't try hammer approach by deleting first kernel+ubi_rootfs set).
>>
>> 3. On each reboot the 'bootipq' command rewrites some of U-Boot environments variables to
>> default state. I don't know every one of them and that makes this not a stable environment,
>> which could overwrite our changes. Also this increases flash wear (it's NOR, I know, but still).
>> That's why I decided to introduce custom 'bootcmd'.
> Custom "bootcmd" is fine.
> 
>>
>> 4. The stock firmware likes to fiddle with U-Boot environment from userspace. I could miss
>> some case of it and users who reverted to stock firmware (which would need custom 'bootcmd'
>> if we went with Your changes) could end up with OpenWrt booted after reboot (in best case)
>> or in U-Boot shell. Explaining what to do, would include non-trivial tasks for average user.
>> This is why I decided to write OpenWrt firmware to kernel1+ubi_rootfs1 set.
> Hm? Did I make a mistake somewhere? I thought that I kept the custom bootcmd. I only changed
> the "kernel1" to "kernel" and let the kernel use auto-attach the "ubi"-volume and boot from
> the "rootfs" volume. (Note: sysupgrade in the initramfs also installs into "kernel"
> and "rootfs". These are the defaults for CI_KERNPART and CI_ROOTPART). Did you try this with
> your existing setup? (You would need to start with a newly created initramfs image to test
> this)

I skimmed too fast on the changes on Your first proposal and got confused, overall the changes
were in good direction. There was a mistake in
'target/linux/ipq40xx/base-files/lib/upgrade/platform.sh' (it,s still retained in Your second
proposal) and I didn't see the difference (brainfart). Also small mistake in the installation
description in point 10. needed changes:
 ubirmvol /dev/ubi0 -N ubi_rootfs1
 ubirmvol /dev/ubi0 -N kernel1
to
 ubirmvol /dev/ubi0 -N ubi_rootfs
 ubirmvol /dev/ubi0 -N kernel
or only
 ubirmvol /dev/ubi0 -N ubi_rootfs
which You already did.

> 
>>
>> 5. What we have stored in flash is all we've got in terms of OEM firmware. There is no
>> downloadable image (I know of) we could use to flash the device with, in case no backup is
>> made and all partitions are wiped.
>> Given that, I decided to go for reverting to OEM setup, as close as possible, so self-heal
>> implemented in stock firmware won't be confused.
> I updated the "back to stock" instruction. These are from the POV of a newly bought device.
> I assume that the content of ubi_rootfs1 matches ubi_rootfs, likewise "kernel1" would match
> "kernel". Is this not true?

As written above, not always. The culprit is probably failed update but I can't say that for
sure, since I bought the devices on aftermarket.

> 
>>>
>>> Note2: You don't mention it in your commit. But I'm seeing that you are
>>> using GPIO OPEN_DRAIN for the bitbanged i2c. So, don't you also need
>>> Brain's pinctrl patch that wires up OPEN_DRAIN for this? [1]
>>
>> I went with suggestion in [3], but even setting to GPIO_ACTIVE_HIGH is enough. I tested
>> this with and without Brian's patch. Should I send v3 without GPIO_OPEN_DRAIN?
>>
> Brain's patch is upstream I think.
> The Open Drain is coming from the I2C spec itself. From what I remember it's
> important for multi-master and if slaves employ Clock stretching. I would keep it,
> but please test it now before it causes problems later.

Works with Brian's patch applied.

> 
> Cheers,
> Christian
> 

Regards
-- 
TMN


From shep971 at centurylink.net  Tue Sep 22 18:27:44 2020
From: shep971 at centurylink.net (Heppler, J. Scott)
Date: Tue, 22 Sep 2020 15:27:44 -0700
Subject: [PATCH]ramips: add support for Linksys EA7300 v2
Message-ID: <20200922222744.GA64982@centurylink.net>


ramips:  add  support  for  Linksys  EA7300  v2

This submission relied heavily on the work of
Santiago Rodriguez-Papa <contact at rodsan.dev>

Specifications:

*  SoC:            MediaTek  MT7621A                            (880  MHz  2c/4t)
*  RAM:            Nanya  NT5CC128M16IP-DIT              (256M  DDR3-1600)
*  Flash:        Macronix  MX30LF1G18AC-TI            (128M  NAND)
*  Eth:            MediaTek  MT7621A                            (10/100/1000  Mbps  x5)
*  Radio:        MT7603E/MT7615N                                       (2.4  GHz  &  5  GHz)
                         4  antennae:  1  internal  and  3  non-deatachable
*  USB:            3.0  (x1)
*  LEDs:
         White      (x1  logo)
         Green      (x6  eth  +  wps)
         Orange    (x5,  hardware-bound)
*  Buttons:
         Reset      (x1)
         WPS          (x1)

Installation:

Flash  factory  image  through  GUI.

This  might  fail  due  to  the  A/B  nature  of  this  device.  When  flashing,  OEM
firmware  writes  over  the  non-booted  partition.  If  booted  from  'A',
flashing  over  'B'  won't  work.  To  get  around  this,  you  should  flash  the
OEM  image  over  itself.  This  will  then  boot  the  router  from  'B'  and
allow  you  to  flash  OpenWRT  without  problems.

Reverting  to  factory  firmware:

Hard-reset  the  router  three  times  to  force  it  to  boot  from  'B.'  This  is
where  the  stock  firmware  resides.  To  remove  any  traces  of  OpenWRT  from
your  router  simply  flash  the  OEM  image  at  this  point.
---
  package/boot/uboot-envtools/files/ramips      |  1 +
  .../ramips/dts/mt7621_linksys_ea7300-v2.dts   | 55 +++++++++++++++++++
  target/linux/ramips/image/mt7621.mk           |  9 +++
  .../mt7621/base-files/etc/board.d/01_leds     |  1 +
  .../mt7621/base-files/etc/board.d/02_network  |  1 +
  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  1 +
  .../mt7621/base-files/etc/init.d/bootcount    |  1 +
  .../mt7621/base-files/lib/upgrade/platform.sh |  1 +
  8 files changed, 70 insertions(+)
  create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 6ff04b26e8..14c12bbf09 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -40,6 +40,7 @@ ravpower,rp-wd03)
  		ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
  	;;
  linksys,ea7300-v1|\
+linksys,ea7300-v2|\
  linksys,ea7500-v2|\
  xiaomi,mi-router-ac2100|\
  xiaomi,mir3p|\
diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
new file mode 100644
index 0000000000..f7330d1c86
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_linksys_ea7xxx.dtsi"
+
+/ {
+	compatible = "linksys,ea7300-v2", "mediatek,mt7621-soc";
+	model = "Linksys EA7300 v2";
+
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wan_green {
+			label = "ea7300-v2:green:wan";
+			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+		};
+
+		lan1_green {
+			label = "ea7300-v2:green:lan1";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		lan2_green {
+			label = "ea7300-v2:green:lan2";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+
+		lan3_green {
+			label = "ea7300-v2:green:lan3";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		lan4_green {
+			label = "ea7300-v2:green:lan4";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+
+		led_power: power {
+			label = "ea7300-v2:white:power";
+			gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
+		};
+
+		wps {
+			label = "ea7300-v2:green:wps";
+			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 78629563ee..274d9f7158 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -655,6 +655,15 @@ define Device/linksys_ea7300-v1
  endef
  TARGET_DEVICES += linksys_ea7300-v1
  
+define Device/linksys_ea7300-v2
+  $(Device/linksys_ea7xxx)
+  DEVICE_MODEL := EA7300
+  DEVICE_VARIANT := v2
+  LINKSYS_HWNAME := EA7300v2
+  DEVICE_PACKAGES += kmod-mt7603
+endef
+TARGET_DEVICES += linksys_ea7300-v2
+
  define Device/linksys_ea7500-v2
    $(Device/linksys_ea7xxx)
    DEVICE_MODEL := EA7500
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index c5cd446809..8c3be541b0 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -42,6 +42,7 @@ gnubee,gb-pc2)
  	ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2"
  	;;
  linksys,ea7300-v1|\
+linksys,ea7300-v2|\
  linksys,ea7500-v2)
  	ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1" "lan1" "link"
  	ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2" "lan2" "link"
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 1c1d0e4ab7..26063470e8 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -105,6 +105,7 @@ ramips_setup_macs()
  		label_mac=$wan_mac
  		;;
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  		wan_mac=$lan_mac
diff --git 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
index 3f7fdc1a79..b7a41f038c 100644
--- 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
@@ -11,6 +11,7 @@ board=$(board_name)
  
  case "$board" in
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
index b17161a50a..7ef0053e67 100755
--- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
+++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
@@ -9,6 +9,7 @@ boot() {
  			echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s -
  		;;
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		mtd resetbc s_env || true
  		;;
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index b1feea7ae6..442e78df3c 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -49,6 +49,7 @@ platform_do_upgrade() {
  	dlink,dir-2660-a1|\
  	hiwifi,hc5962|\
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2|\
  	netgear,r6220|\
  	netgear,r6260|\
-- 
2.20.1



-- 
J. Scott Heppler


From shep971 at centurylink.net  Tue Sep 22 19:12:36 2020
From: shep971 at centurylink.net (Heppler, J. Scott)
Date: Tue, 22 Sep 2020 16:12:36 -0700
Subject: [PATCH v2]ramips: add support for Linksys EA7300 v2
Message-ID: <20200922231236.GA11198@centurylink.net>

ramips:  add  support  for  Linksys  EA7300  v2

This submission relied heavily on the work of
Santiago Rodriguez-Papa <contact at rodsan.dev>

Specifications:

*  SoC:            	MediaTek  MT7621A		(880  MHz  2c/4t)
*  RAM:            	Winbond W632GG6MB-12		(256M  DDR3-1600)
*  Flash:          	Winbond W29N01HVSINA		(128M  NAND)
*  Eth:            	MediaTek  MT7621A           	(10/100/1000  Mbps  x5)
*  Radio:        	MT7603E/MT7615N (2.4  GHz  &  5  GHz)
                         4  antennae:  1  internal  and  3  non-deatachable
*  USB:            	3.0  (x1)
*  LEDs:
         White      	(x1  logo)
         Green      	(x6  eth  +  wps)
         Orange    	(x5,  hardware-bound)
*  Buttons:
         Reset      	(x1)
         WPS          	(x1)

Installation:

Flash  factory  image  through  GUI.

This  might  fail  due  to  the  A/B  nature  of  this  device.  When  flashing,  OEM
firmware  writes  over  the  non-booted  partition.  If  booted  from  'A',
flashing  over  'B'  won't  work.  To  get  around  this,  you  should  flash  the
OEM  image  over  itself.  This  will  then  boot  the  router  from  'B'  and
allow  you  to  flash  OpenWRT  without  problems.

Reverting  to  factory  firmware:

Hard-reset  the  router  three  times  to  force  it  to  boot  from  'B.'  This  is
where  the  stock  firmware  resides.  To  remove  any  traces  of  OpenWRT  from
your  router  simply  flash  the  OEM  image  at  this  point.
---
  package/boot/uboot-envtools/files/ramips      |  1 +
  .../ramips/dts/mt7621_linksys_ea7300-v2.dts   | 55 +++++++++++++++++++
  target/linux/ramips/image/mt7621.mk           |  9 +++
  .../mt7621/base-files/etc/board.d/01_leds     |  1 +
  .../mt7621/base-files/etc/board.d/02_network  |  1 +
  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  1 +
  .../mt7621/base-files/etc/init.d/bootcount    |  1 +
  .../mt7621/base-files/lib/upgrade/platform.sh |  1 +
  8 files changed, 70 insertions(+)
  create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 6ff04b26e8..14c12bbf09 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -40,6 +40,7 @@ ravpower,rp-wd03)
  		ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
  	;;
  linksys,ea7300-v1|\
+linksys,ea7300-v2|\
  linksys,ea7500-v2|\
  xiaomi,mi-router-ac2100|\
  xiaomi,mir3p|\
diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
new file mode 100644
index 0000000000..f7330d1c86
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_linksys_ea7xxx.dtsi"
+
+/ {
+	compatible = "linksys,ea7300-v2", "mediatek,mt7621-soc";
+	model = "Linksys EA7300 v2";
+
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wan_green {
+			label = "ea7300-v2:green:wan";
+			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+		};
+
+		lan1_green {
+			label = "ea7300-v2:green:lan1";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		lan2_green {
+			label = "ea7300-v2:green:lan2";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+
+		lan3_green {
+			label = "ea7300-v2:green:lan3";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		lan4_green {
+			label = "ea7300-v2:green:lan4";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+
+		led_power: power {
+			label = "ea7300-v2:white:power";
+			gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
+		};
+
+		wps {
+			label = "ea7300-v2:green:wps";
+			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 78629563ee..274d9f7158 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -655,6 +655,15 @@ define Device/linksys_ea7300-v1
  endef
  TARGET_DEVICES += linksys_ea7300-v1
  
+define Device/linksys_ea7300-v2
+  $(Device/linksys_ea7xxx)
+  DEVICE_MODEL := EA7300
+  DEVICE_VARIANT := v2
+  LINKSYS_HWNAME := EA7300v2
+  DEVICE_PACKAGES += kmod-mt7603
+endef
+TARGET_DEVICES += linksys_ea7300-v2
+
  define Device/linksys_ea7500-v2
    $(Device/linksys_ea7xxx)
    DEVICE_MODEL := EA7500
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index c5cd446809..8c3be541b0 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -42,6 +42,7 @@ gnubee,gb-pc2)
  	ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2"
  	;;
  linksys,ea7300-v1|\
+linksys,ea7300-v2|\
  linksys,ea7500-v2)
  	ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1" "lan1" "link"
  	ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2" "lan2" "link"
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 1c1d0e4ab7..26063470e8 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -105,6 +105,7 @@ ramips_setup_macs()
  		label_mac=$wan_mac
  		;;
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  		wan_mac=$lan_mac
diff --git 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
index 3f7fdc1a79..b7a41f038c 100644
--- 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
@@ -11,6 +11,7 @@ board=$(board_name)
  
  case "$board" in
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
index b17161a50a..7ef0053e67 100755
--- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
+++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
@@ -9,6 +9,7 @@ boot() {
  			echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s -
  		;;
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2)
  		mtd resetbc s_env || true
  		;;
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index b1feea7ae6..442e78df3c 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -49,6 +49,7 @@ platform_do_upgrade() {
  	dlink,dir-2660-a1|\
  	hiwifi,hc5962|\
  	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
  	linksys,ea7500-v2|\
  	netgear,r6220|\
  	netgear,r6260|\
-- 
2.20.1


-- 
J. Scott Heppler


From baptiste at bitsofnetworks.org  Tue Sep 22 19:45:06 2020
From: baptiste at bitsofnetworks.org (Baptiste Jonglez)
Date: Wed, 23 Sep 2020 01:45:06 +0200
Subject: Regressions in 19.07.4
Message-ID: <20200922234506.GC1034012@tuxmachine.localdomain>

Hi,

FYI, there have been several regressions reported in 19.07.4:

  https://openwrt.org/releases/19.07/notes-19.07.4#regressions

The third one (instability/reboot on ramips) might be a kernel issue,
devices from different ramips subtargets are affected.

Other than that, feedback has been positive: https://forum.openwrt.org/t/openwrt-19-07-4-service-release/73829

Baptiste
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200923/924a6878/attachment.sig>

From rosenp at gmail.com  Tue Sep 22 21:28:37 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Tue, 22 Sep 2020 18:28:37 -0700
Subject: Regressions in 19.07.4
In-Reply-To: <20200922234506.GC1034012@tuxmachine.localdomain>
References: <20200922234506.GC1034012@tuxmachine.localdomain>
Message-ID: <CAKxU2N9-rN7tQ3D8JvWTQrh7QKgNqwrMRhJYH-Fv9mS-2aYi5g@mail.gmail.com>

On Tue, Sep 22, 2020 at 4:48 PM Baptiste Jonglez
<baptiste at bitsofnetworks.org> wrote:
>
> Hi,
>
> FYI, there have been several regressions reported in 19.07.4:
>
>   https://openwrt.org/releases/19.07/notes-19.07.4#regressions
I think what that patch fixes was done on master with the upstream
driver. I backported some of the changes here:

https://github.com/neheb/openwrt/tree/ramips

That last patch sounds like it accomplishes the same thing. I don't
have any ramips hardware so I cannot do any testing.
>
> The third one (instability/reboot on ramips) might be a kernel issue,
> devices from different ramips subtargets are affected.
>
> Other than that, feedback has been positive: https://forum.openwrt.org/t/openwrt-19-07-4-service-release/73829
>
> Baptiste
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From shep971 at centurylink.net  Tue Sep 22 22:30:45 2020
From: shep971 at centurylink.net (Heppler, J. Scott)
Date: Tue, 22 Sep 2020 19:30:45 -0700
Subject: [PATCH v3] ramips: add support for Linksys EA7300 v2
Message-ID: <20200923023045.GA18468@centurylink.net>

ramips:  add  support  for  Linksys  EA7300  v2

This submission relied heavily on the work of
Santiago Rodriguez-Papa <contact at rodsan.dev>

Specifications:

*  SoC:            	MediaTek  MT7621A		(880  MHz  2c/4t)
*  RAM:            	Winbond W632GG6MB-12		(256M  DDR3-1600)
*  Flash:          	Winbond W29N01HVSINA		(128M  NAND)
*  Eth:            	MediaTek  MT7621A           	(10/100/1000  Mbps  x5)
*  Radio:        	MT7603E/MT7615N 		(2.4  GHz  &  5  GHz)
                          4  antennae:  1  internal  and  3  non-deatachable
*  USB:            	3.0  (x1)
*  LEDs:
          White      	(x1  logo)
          Green      	(x6  eth  +  wps)
          Orange    	(x5,  hardware-bound)
*  Buttons:
          Reset      	(x1)
          WPS          	(x1)

Installation:

Flash  factory  image  through  GUI.

This  might  fail  due  to  the  A/B  nature  of  this  device.  When  flashing,  OEM
firmware  writes  over  the  non-booted  partition.  If  booted  from  'A',
flashing  over  'B'  won't  work.  To  get  around  this,  you  should  flash  the
OEM  image  over  itself.  This  will  then  boot  the  router  from  'B'  and
allow  you  to  flash  OpenWRT  without  problems.

Reverting  to  factory  firmware:

Hard-reset  the  router  three  times  to  force  it  to  boot  from  'B.'  This  is
where  the  stock  firmware  resides.  To  remove  any  traces  of  OpenWRT  from
your  router  simply  flash  the  OEM  image  at  this  point.

Signed-off-by: J. Scott Heppler <shep971 at centurylink.net>
---
   package/boot/uboot-envtools/files/ramips      |  1 +
   .../ramips/dts/mt7621_linksys_ea7300-v2.dts   | 55 +++++++++++++++++++
   target/linux/ramips/image/mt7621.mk           |  9 +++
   .../mt7621/base-files/etc/board.d/01_leds     |  1 +
   .../mt7621/base-files/etc/board.d/02_network  |  1 +
   .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  1 +
   .../mt7621/base-files/etc/init.d/bootcount    |  1 +
   .../mt7621/base-files/lib/upgrade/platform.sh |  1 +
   8 files changed, 70 insertions(+)
   create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 6ff04b26e8..14c12bbf09 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -40,6 +40,7 @@ ravpower,rp-wd03)
   		ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
   	;;
   linksys,ea7300-v1|\
+linksys,ea7300-v2|\
   linksys,ea7500-v2|\
   xiaomi,mi-router-ac2100|\
   xiaomi,mir3p|\
diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
new file mode 100644
index 0000000000..f7330d1c86
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_linksys_ea7xxx.dtsi"
+
+/ {
+	compatible = "linksys,ea7300-v2", "mediatek,mt7621-soc";
+	model = "Linksys EA7300 v2";
+
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wan_green {
+			label = "ea7300-v2:green:wan";
+			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+		};
+
+		lan1_green {
+			label = "ea7300-v2:green:lan1";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		lan2_green {
+			label = "ea7300-v2:green:lan2";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+
+		lan3_green {
+			label = "ea7300-v2:green:lan3";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		lan4_green {
+			label = "ea7300-v2:green:lan4";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+
+		led_power: power {
+			label = "ea7300-v2:white:power";
+			gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
+		};
+
+		wps {
+			label = "ea7300-v2:green:wps";
+			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 78629563ee..274d9f7158 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -655,6 +655,15 @@ define Device/linksys_ea7300-v1
   endef
   TARGET_DEVICES += linksys_ea7300-v1
   
+define Device/linksys_ea7300-v2
+  $(Device/linksys_ea7xxx)
+  DEVICE_MODEL := EA7300
+  DEVICE_VARIANT := v2
+  LINKSYS_HWNAME := EA7300v2
+  DEVICE_PACKAGES += kmod-mt7603
+endef
+TARGET_DEVICES += linksys_ea7300-v2
+
   define Device/linksys_ea7500-v2
     $(Device/linksys_ea7xxx)
     DEVICE_MODEL := EA7500
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index c5cd446809..8c3be541b0 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -42,6 +42,7 @@ gnubee,gb-pc2)
   	ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2"
   	;;
   linksys,ea7300-v1|\
+linksys,ea7300-v2|\
   linksys,ea7500-v2)
   	ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1" "lan1" "link"
   	ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2" "lan2" "link"
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 1c1d0e4ab7..26063470e8 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -105,6 +105,7 @@ ramips_setup_macs()
   		label_mac=$wan_mac
   		;;
   	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
   	linksys,ea7500-v2)
   		lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
   		wan_mac=$lan_mac
diff --git 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
index 3f7fdc1a79..b7a41f038c 100644
--- 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
@@ -11,6 +11,7 @@ board=$(board_name)
   
   case "$board" in
   	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
   	linksys,ea7500-v2)
   		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
   		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
index b17161a50a..7ef0053e67 100755
--- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
+++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
@@ -9,6 +9,7 @@ boot() {
   			echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s -
   		;;
   	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
   	linksys,ea7500-v2)
   		mtd resetbc s_env || true
   		;;
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index b1feea7ae6..442e78df3c 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -49,6 +49,7 @@ platform_do_upgrade() {
   	dlink,dir-2660-a1|\
   	hiwifi,hc5962|\
   	linksys,ea7300-v1|\
+	linksys,ea7300-v2|\
   	linksys,ea7500-v2|\
   	netgear,r6220|\
   	netgear,r6260|\
-- 
2.20.1


-- 
J. Scott Heppler


From zajec5 at gmail.com  Wed Sep 23 03:28:13 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Wed, 23 Sep 2020 09:28:13 +0200
Subject: [PATCH uhttpd RFC] ubus: support setting custom CORS origin URL
Message-ID: <20200923072813.31877-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

By default uhttpd replies with Access-Control-Allow-Origin containing
URL from the request Origin header. It allows sending CORS requests from
any website allowing attacks.

Add support for -o option that allows specifying a single URL to be put
in the Access-Control-Allow-Origin.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
I use this patch with addition of a single init.d script line:
append_arg "$cfg" ubus_origin "-o"

Does anyone find it useful?
---
 main.c   | 7 ++++++-
 ubus.c   | 2 +-
 uhttpd.h | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 73e3d42..c5f2fe4 100644
--- a/main.c
+++ b/main.c
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
 	init_defaults_pre();
 	signal(SIGPIPE, SIG_IGN);
 
-	while ((ch = getopt(argc, argv, "A:aC:c:Dd:E:e:fh:H:I:i:K:k:L:l:m:N:n:P:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
+	while ((ch = getopt(argc, argv, "A:aC:c:Dd:E:e:fh:H:I:i:K:k:L:l:m:N:n:o:P:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
 		switch(ch) {
 #ifdef HAVE_TLS
 		case 'C':
@@ -492,6 +492,10 @@ int main(int argc, char **argv)
 			conf.ubus_cors = 1;
 			break;
 
+		case 'o':
+			conf.ubus_origin = optarg;
+			break;
+
 		case 'e':
 			conf.events_retry = atoi(optarg);
 			break;
@@ -500,6 +504,7 @@ int main(int argc, char **argv)
 		case 'u':
 		case 'U':
 		case 'X':
+		case 'o':
 		case 'e':
 			fprintf(stderr, "uhttpd: UBUS support not compiled, "
 			                "ignoring -%c\n", ch);
diff --git a/ubus.c b/ubus.c
index 39b38b2..27c1c95 100644
--- a/ubus.c
+++ b/ubus.c
@@ -169,7 +169,7 @@ static void uh_ubus_add_cors_headers(struct client *cl)
 	}
 
 	ustream_printf(cl->us, "Access-Control-Allow-Origin: %s\r\n",
-	               blobmsg_get_string(tb[HDR_ORIGIN]));
+	               conf.ubus_origin ? conf.ubus_origin : blobmsg_get_string(tb[HDR_ORIGIN]));
 
 	if (tb[HDR_ACCESS_CONTROL_REQUEST_HEADERS])
 		ustream_printf(cl->us, "Access-Control-Allow-Headers: %s\r\n",
diff --git a/uhttpd.h b/uhttpd.h
index e61e176..f924c77 100644
--- a/uhttpd.h
+++ b/uhttpd.h
@@ -81,6 +81,7 @@ struct config {
 	int script_timeout;
 	int ubus_noauth;
 	int ubus_cors;
+	const char *ubus_origin;
 	int cgi_prefix_len;
 	int events_retry;
 	struct list_head cgi_alias;
-- 
2.27.0



From mail at adrianschmutzler.de  Wed Sep 23 05:53:25 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 23 Sep 2020 11:53:25 +0200
Subject: [PATCH] ath79: ar8216: make switch register access atomic
In-Reply-To: <20200921065744.491098-1-gch981213@gmail.com>
References: <20200921065744.491098-1-gch981213@gmail.com>
Message-ID: <002901d6918f$61bdae20$25390a60$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Chuanhong Guo
> Sent: Montag, 21. September 2020 08:58
> To: openwrt-devel at openwrt.org
> Cc: Chuanhong Guo <gch981213 at gmail.com>
> Subject: [PATCH] ath79: ar8216: make switch register access atomic
> 
> reg accesses on integrated ar8229 sometimes fails. As a result, phy read got
> incorrect port status and wan link goes down and up mysteriously.
> After comparing ar8216 with the old driver, these local_irq_save/restore calls
> are the only meaningful differences I could find and it does fix the issue.
> The same changes were added in svn r26856 by Gabor Juhos:
> ar71xx: ag71xx: make switch register access atomic
> 
> As I can't find the underlying problem either, this hack is broght back to fix
> the unstable link issue.
> This hack is only suitable for ath79 mdio and may easily break the driver on
> other platform. Limit it to ath79-only as a target patch.

This patch fixes the problem for me on TL-WR841N v12 (qca9533), tested on top of 19.07.4.

Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
Acked-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

Best

Adrian

> 
> Fixes: FS#2216
> Fixes: FS#3226
> Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> ---
>  .../930-ar8216-make-reg-access-atomic.patch   | 61 +++++++++++++++++++
>  1 file changed, 61 insertions(+)
>  create mode 100644 target/linux/ath79/patches-5.4/930-ar8216-make-reg-
> access-atomic.patch
> 
> diff --git a/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-
> atomic.patch b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-
> atomic.patch
> new file mode 100644
> index 0000000000..42f3305195
> --- /dev/null
> +++ b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.p
> +++ atch
> @@ -0,0 +1,61 @@
> +From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00
> 2001
> +From: Chuanhong Guo <gch981213 at gmail.com>
> +Date: Sun, 20 Sep 2020 01:00:45 +0800
> +Subject: [PATCH] ath79: ar8216: make switch register access atomic
> +
> +due to some unknown reason these register accesses sometimes fail on
> +the integrated switch without this patch.
> +
> +THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER
> PLATFORMS!
> +The mdio bus on ath79 works in polling mode and doesn't rely on any
> +interrupt. This patch breaks the driver on any mdio master with
> +interrupts used.
> +
> +---
> +--- a/drivers/net/phy/ar8216.c
> ++++ b/drivers/net/phy/ar8216.c
> +@@ -253,12 +253,14 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p
> + u32
> + ar8xxx_read(struct ar8xxx_priv *priv, int reg)  {
> ++	unsigned long flags;
> + 	struct mii_bus *bus = priv->mii_bus;
> + 	u16 r1, r2, page;
> + 	u32 val;
> +
> + 	split_addr((u32) reg, &r1, &r2, &page);
> +
> ++	local_irq_save(flags);
> + 	mutex_lock(&bus->mdio_lock);
> +
> + 	bus->write(bus, 0x18, 0, page);
> +@@ -266,6 +268,7 @@ ar8xxx_read(struct ar8xxx_priv *priv, in
> + 	val = ar8xxx_mii_read32(priv, 0x10 | r2, r1);
> +
> + 	mutex_unlock(&bus->mdio_lock);
> ++	local_irq_restore(flags);
> +
> + 	return val;
> + }
> +@@ -273,11 +276,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in  void
> +ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val)  {
> ++	unsigned long flags;
> + 	struct mii_bus *bus = priv->mii_bus;
> + 	u16 r1, r2, page;
> +
> + 	split_addr((u32) reg, &r1, &r2, &page);
> +
> ++	local_irq_save(flags);
> + 	mutex_lock(&bus->mdio_lock);
> +
> + 	bus->write(bus, 0x18, 0, page);
> +@@ -285,6 +290,7 @@ ar8xxx_write(struct ar8xxx_priv *priv, i
> + 	ar8xxx_mii_write32(priv, 0x10 | r2, r1, val);
> +
> + 	mutex_unlock(&bus->mdio_lock);
> ++	local_irq_restore(flags);
> + }
> +
> + u32
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200923/6adda5d1/attachment-0001.sig>

From mail at adrianschmutzler.de  Wed Sep 23 05:48:06 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 23 Sep 2020 11:48:06 +0200
Subject: [PATCH v3] ramips: add support for Linksys EA7300 v2
In-Reply-To: <20200923023045.GA18468@centurylink.net>
References: <20200923023045.GA18468@centurylink.net>
Message-ID: <002401d6918e$a3a2b020$eae81060$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Heppler, J. Scott
> Sent: Mittwoch, 23. September 2020 04:31
> To: openwrt-devel at openwrt.org
> Subject: [PATCH v3] ramips: add support for Linksys EA7300 v2
> 
> ramips:  add  support  for  Linksys  EA7300  v2

Thanks, I will merge this later today, but please note the following hints for the next time you submit patches :-)

General:
- If you resend with incremented version, please add some comments about what has changed between the submission. This should be done by adding a line with "---" after the Signed-off-by in the commit message, and then adding something like

---

Changes in v2:
- Fixed indent

Due to the "---" line, everything after that will automatically be cut off when a committer takes that patch from patchwork. But we don't have to look for the changes between versions ourselves.

- Your patch had strangely broken indent, so it didn't apply at all. For some reason, the non-changed lines in the patch were not starting with one space, but with three:

   reference line
   reference line
   reference line
+added line
   reference line
   reference line
   reference line

However, it should be only one space, as you have only one plus or minus as well:

 reference line
 reference line
 reference line
+added line
 reference line
 reference line
 reference line

I don't know how that got introduced, but I had to fix it manually in the patch. If you used git-sendemail, there must be something wrong with the configuration somewhere.

Other comments below.

> 
> This submission relied heavily on the work of Santiago Rodriguez-Papa
> <contact at rodsan.dev>
> 
> Specifications:
> 
> *  SoC:            	MediaTek  MT7621A		(880  MHz  2c/4t)
> *  RAM:            	Winbond W632GG6MB-12		(256M  DDR3-1600)
> *  Flash:          	Winbond W29N01HVSINA		(128M  NAND)
> *  Eth:            	MediaTek  MT7621A           	(10/100/1000  Mbps  x5)
> *  Radio:        	MT7603E/MT7615N 		(2.4  GHz  &  5  GHz)
>                           4  antennae:  1  internal  and  3  non-deatachable
> *  USB:            	3.0  (x1)

This has mixed space and tab indent. For blocks like these typically pure spaces are used.

> *  LEDs:
>           White      	(x1  logo)
>           Green      	(x6  eth  +  wps)
>           Orange    	(x5,  hardware-bound)
> *  Buttons:
>           Reset      	(x1)
>           WPS          	(x1)
> 
> Installation:
> 
> Flash  factory  image  through  GUI.
> 
> This  might  fail  due  to  the  A/B  nature  of  this  device.  When  flashing,
> OEM firmware  writes  over  the  non-booted  partition.  If  booted  from  'A',
> flashing  over  'B'  won't  work.  To  get  around  this,  you  should  flash  the
> OEM  image  over  itself.  This  will  then  boot  the  router  from  'B'  and allow
> you  to  flash  OpenWRT  without  problems.
> 
> Reverting  to  factory  firmware:
> 
> Hard-reset  the  router  three  times  to  force  it  to  boot  from  'B.'  This  is
> where  the  stock  firmware  resides.  To  remove  any  traces  of  OpenWRT
> from your  router  simply  flash  the  OEM  image  at  this  point.
> 
> Signed-off-by: J. Scott Heppler <shep971 at centurylink.net>

Please use a real e-mail address here instead of the at placeholder.

As stated above, you don't need to resend this patch, it's just meant as hint for future submissions.

Best

Adrian

> ---
>    package/boot/uboot-envtools/files/ramips      |  1 +
>    .../ramips/dts/mt7621_linksys_ea7300-v2.dts   | 55
> +++++++++++++++++++
>    target/linux/ramips/image/mt7621.mk           |  9 +++
>    .../mt7621/base-files/etc/board.d/01_leds     |  1 +
>    .../mt7621/base-files/etc/board.d/02_network  |  1 +
>    .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  1 +
>    .../mt7621/base-files/etc/init.d/bootcount    |  1 +
>    .../mt7621/base-files/lib/upgrade/platform.sh |  1 +
>    8 files changed, 70 insertions(+)
>    create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea7300-
> v2.dts
> 
> diff --git a/package/boot/uboot-envtools/files/ramips
> b/package/boot/uboot-envtools/files/ramips
> index 6ff04b26e8..14c12bbf09 100644
> --- a/package/boot/uboot-envtools/files/ramips
> +++ b/package/boot/uboot-envtools/files/ramips
> @@ -40,6 +40,7 @@ ravpower,rp-wd03)
>    		ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000"
> "0x1000"
>    	;;
>    linksys,ea7300-v1|\
> +linksys,ea7300-v2|\
>    linksys,ea7500-v2|\
>    xiaomi,mi-router-ac2100|\
>    xiaomi,mir3p|\
> diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
> b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
> new file mode 100644
> index 0000000000..f7330d1c86
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts
> @@ -0,0 +1,55 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;
> +
> +#include "mt7621_linksys_ea7xxx.dtsi"
> +
> +/ {
> +	compatible = "linksys,ea7300-v2", "mediatek,mt7621-soc";
> +	model = "Linksys EA7300 v2";
> +
> +	aliases {
> +		led-boot = &led_power;
> +		led-failsafe = &led_power;
> +		led-running = &led_power;
> +		led-upgrade = &led_power;
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		wan_green {
> +			label = "ea7300-v2:green:wan";
> +			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan1_green {
> +			label = "ea7300-v2:green:lan1";
> +			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan2_green {
> +			label = "ea7300-v2:green:lan2";
> +			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan3_green {
> +			label = "ea7300-v2:green:lan3";
> +			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan4_green {
> +			label = "ea7300-v2:green:lan4";
> +			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		led_power: power {
> +			label = "ea7300-v2:white:power";
> +			gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		wps {
> +			label = "ea7300-v2:green:wps";
> +			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> diff --git a/target/linux/ramips/image/mt7621.mk
> b/target/linux/ramips/image/mt7621.mk
> index 78629563ee..274d9f7158 100644
> --- a/target/linux/ramips/image/mt7621.mk
> +++ b/target/linux/ramips/image/mt7621.mk
> @@ -655,6 +655,15 @@ define Device/linksys_ea7300-v1
>    endef
>    TARGET_DEVICES += linksys_ea7300-v1
> 
> +define Device/linksys_ea7300-v2
> +  $(Device/linksys_ea7xxx)
> +  DEVICE_MODEL := EA7300
> +  DEVICE_VARIANT := v2
> +  LINKSYS_HWNAME := EA7300v2
> +  DEVICE_PACKAGES += kmod-mt7603
> +endef
> +TARGET_DEVICES += linksys_ea7300-v2
> +
>    define Device/linksys_ea7500-v2
>      $(Device/linksys_ea7xxx)
>      DEVICE_MODEL := EA7500
> diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
> b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
> index c5cd446809..8c3be541b0 100755
> --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
> @@ -42,6 +42,7 @@ gnubee,gb-pc2)
>    	ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2"
> "lan2"
>    	;;
>    linksys,ea7300-v1|\
> +linksys,ea7300-v2|\
>    linksys,ea7500-v2)
>    	ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1"
> "lan1" "link"
>    	ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2"
> "lan2" "link"
> diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> index 1c1d0e4ab7..26063470e8 100755
> --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> @@ -105,6 +105,7 @@ ramips_setup_macs()
>    		label_mac=$wan_mac
>    		;;
>    	linksys,ea7300-v1|\
> +	linksys,ea7300-v2|\
>    	linksys,ea7500-v2)
>    		lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
>    		wan_mac=$lan_mac
> diff --git 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
> index 3f7fdc1a79..b7a41f038c 100644
> --- 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_f
> +++ ix_wifi_mac
> @@ -11,6 +11,7 @@ board=$(board_name)
> 
>    case "$board" in
>    	linksys,ea7300-v1|\
> +	linksys,ea7300-v2|\
>    	linksys,ea7500-v2)
>    		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
>    		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 >
> /sys${DEVPATH}/macaddress diff --git a/target/linux/ramips/mt7621/base-
> files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-
> files/etc/init.d/bootcount
> index b17161a50a..7ef0053e67 100755
> --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
> +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
> @@ -9,6 +9,7 @@ boot() {
>    			echo -e "bootcount\nbootchanged\n" |
> /usr/sbin/fw_setenv -s -
>    		;;
>    	linksys,ea7300-v1|\
> +	linksys,ea7300-v2|\
>    	linksys,ea7500-v2)
>    		mtd resetbc s_env || true
>    		;;
> diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
> b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
> index b1feea7ae6..442e78df3c 100755
> --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
> @@ -49,6 +49,7 @@ platform_do_upgrade() {
>    	dlink,dir-2660-a1|\
>    	hiwifi,hc5962|\
>    	linksys,ea7300-v1|\
> +	linksys,ea7300-v2|\
>    	linksys,ea7500-v2|\
>    	netgear,r6220|\
>    	netgear,r6260|\
> --
> 2.20.1
> 
> 
> --
> J. Scott Heppler
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200923/5bdd06b7/attachment.sig>

From zajec5 at gmail.com  Wed Sep 23 06:43:27 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Wed, 23 Sep 2020 12:43:27 +0200
Subject: [PATCH uhttpd] client: really close connection on timeout
Message-ID: <20200923104327.14812-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

After specified time of network inactivity uhttpd is meant to close
connection. It doesn't seem to work thought. After timeout client
doesn't receive any more data but connection it still opened.

This change fixes that.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
V1: Set cl->request.connection_close and then call uh_request_done().
    With this change:
    1. uh_request_done() will take care of calling uh_connection_close()
    2. uh_request_done() won't set state back to the CLIENT_STATE_INIT
---
 client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client.c b/client.c
index 2a2393f..b5736e4 100644
--- a/client.c
+++ b/client.c
@@ -95,7 +95,8 @@ static void client_timeout(struct uloop_timeout *timeout)
 	struct client *cl = container_of(timeout, struct client, timeout);
 
 	cl->state = CLIENT_STATE_CLOSE;
-	uh_connection_close(cl);
+	cl->request.connection_close = true;
+	uh_request_done(cl);
 }
 
 static void uh_set_client_timeout(struct client *cl, int timeout)
-- 
2.27.0



From zajec5 at gmail.com  Wed Sep 23 07:57:30 2020
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Wed, 23 Sep 2020 13:57:30 +0200
Subject: [PATCH luci] luci-base: don't append object.method to the RPC url
Message-ID: <20200923115730.23743-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

It was a cosmetic feature that doesn't work anymore with the latest
uhttpd ubus API. Adding RESTful API resulted in treating URL part
following the /ubus/ as the new API request.
---
 modules/luci-base/htdocs/luci-static/resources/rpc.js | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/modules/luci-base/htdocs/luci-static/resources/rpc.js b/modules/luci-base/htdocs/luci-static/resources/rpc.js
index 7bfc91336..f37f7bb6a 100644
--- a/modules/luci-base/htdocs/luci-static/resources/rpc.js
+++ b/modules/luci-base/htdocs/luci-static/resources/rpc.js
@@ -33,9 +33,6 @@ return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
 						req[i].params[2]
 					);
 		}
-		else if (req.params) {
-			q += '/%s.%s'.format(req.params[1], req.params[2]);
-		}
 
 		return request.post(rpcBaseURL + q, req, {
 			timeout: (L.env.rpctimeout || 20) * 1000,
-- 
2.27.0



From gch981213 at gmail.com  Wed Sep 23 11:50:09 2020
From: gch981213 at gmail.com (Chuanhong Guo)
Date: Wed, 23 Sep 2020 23:50:09 +0800
Subject: [PATCH] ath79: ar8216: make switch register access atomic
In-Reply-To: <2707d025-2d01-bf72-158c-8679d1c4695f@nbd.name>
References: <20200921065744.491098-1-gch981213@gmail.com>
 <32b0d4ec-b518-7d51-f70f-56d08a80db61@nbd.name>
 <CAJsYDVKKZg68vCxysHBTbv1oG03553P9gX_tv720H4Rvtc1J+w@mail.gmail.com>
 <2707d025-2d01-bf72-158c-8679d1c4695f@nbd.name>
Message-ID: <CAJsYDVJuiJNFaR0DqNGiXyDotkoQ=o_RmyZiwnEW8dh4+TkYWg@mail.gmail.com>

Hi!

On Tue, Sep 22, 2020 at 12:37 AM Felix Fietkau <nbd at nbd.name> wrote:
> You could try making a global spinlock in ag71xx_mdio.c and do
> spin_lock_bh(&mdio_lock) in ag71xx_mdio_mii_read and ag71xx_mdio_mii_write

I've just tried that and it doesn't work.
Should I move local_irq_save below mutex_lock and send a v2 or
do you have other suggestions?
-- 
Regards,
Chuanhong Guo


From avalentin at marcant.net  Wed Sep 23 17:33:19 2020
From: avalentin at marcant.net (Andre Valentin)
Date: Wed, 23 Sep 2020 23:33:19 +0200
Subject: [PATCH V3 uhttpd] ubus: add new RESTful API
In-Reply-To: <20200914151523.4757-1-zajec5@gmail.com>
References: <20200914151523.4757-1-zajec5@gmail.com>
Message-ID: <5b35b700-4816-13e0-e69a-b2f3507c23e1@marcant.net>

Hi Rafa?!

I'm experimenting again a bit with the new API. I subscribed to the hostapd events and saw that
after some time the connection is still up, but now new events come in.
How can I control timeout and make sure, that the subscription connections stays as long as
possible online?

Kind regards,

Andr?

Am 14.09.20 um 17:15 schrieb Rafa? Mi?ecki:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> Initial uhttpd ubus API was fully based on JSON-RPC. That restricted it
> from supporting ubus notifications that don't fit its model.
> 
> Notifications require protocol that allows server to send data without
> being polled. There are two candidates for that:
> 1. Server-sent events
> 2. WebSocket
> 
> The later one is overcomplex for this simple task so ideally uhttps ubus
> should support text-based server-sent events. It's not possible with
> JSON-RPC without violating it. Specification requires server to reply
> with Response object. Replying with text/event-stream is not allowed.
> 
> All above led to designing new API that:
> 1. Uses GET and POST requests
> 2. Makes use of RESTful URLs
> 3. Uses JSON-RPC in cleaner form and only for calling ubus methods
> 
> This new API allows:
> 1. Listing all ubus objects and their methods using GET <prefix>/list
> 2. Listing object methods using GET <prefix>/list/<path>
> 3. Listening to object notifications with GET <prefix>/subscribe/<path>
> 4. Calling ubus methods using POST <prefix>/call/<path>
> 
> JSON-RPC custom protocol was also simplified to:
> 1. Use "method" member for ubus object method name
>    It was possible thanks to using RESTful URLs. Previously "method"
>    had to be "list" or "call".
> 2. Reply with Error object on ubus method call error
>    This simplified "result" member format as it doesn't need to contain
>    ubus result code anymore.
> 
> This patch doesn't break or change the old API. The biggest downside of
> the new API is no support for batch requests. It's cost of using RESTful
> URLs. It should not matter much as uhttpd supports keep alive.
> 
> Example usages:
> 
> 1. Getting all objects and their methods:
> $ curl http://192.168.1.1/ubus/list
> {
> 	"dhcp": {
> 		"ipv4leases": {
> 
> 		},
> 		"ipv6leases": {
> 
> 		}
> 	},
> 	"log": {
> 		"read": {
> 			"lines": "number",
> 			"stream": "boolean",
> 			"oneshot": "boolean"
> 		},
> 		"write": {
> 			"event": "string"
> 		}
> 	}
> }
> 
> 2. Getting object methods:
> $ curl http://192.168.1.1/ubus/list/log
> {
> 	"read": {
> 		"lines": "number",
> 		"stream": "boolean",
> 		"oneshot": "boolean"
> 	},
> 	"write": {
> 		"event": "string"
> 	}
> }
> 
> 3. Subscribing to notifications:
> $ curl http://192.168.1.1/ubus/subscribe/foo
> event: status
> data: {"count":5}
> 
> 4. Calling ubus object method:
> $ curl -d '{
>     "jsonrpc": "2.0",
>     "id": 1,
>     "method": "login",
>     "params": {"username": "root", "password": "password" }
> }' http://192.168.1.1/ubus/call/session
> {
> 	"jsonrpc": "2.0",
> 	"id": 1,
> 	"result": {
> 		"ubus_rpc_session": "01234567890123456789012345678901",
> 		(...)
> 	}
> }
> 
> $ curl -H 'Authorization: Bearer 01234567890123456789012345678901' -d '{
>     "jsonrpc": "2.0",
>     "id": 1,
>     "method": "write",
>     "params": {"event": "Hello world" }
> }' http://192.168.1.1/ubus/call/log
> {
> 	"jsonrpc": "2.0",
> 	"id": 1,
> 	"result": null
> }
> 
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
> ---
> V2: Use "Authorization" with Bearer for rpcd session id / token
>     Treat missing session id as UH_UBUS_DEFAULT_SID
>     Fix "result" format (was: "result":{{"foo":"bar"}})
> V3: Treat /ubus/ requests as legacy ones for backward compatibility.
>     Previously there were causing 404 (only /ubus was accepted).
>     Support requests with search path (e.g. ?foo=bar) by ignoring it.
>     This may be used by some clients to avoid caching responses.
>     Rebase on the [PATCH uhttpd] ubus: fix blob_buf initialization

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4052 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200923/126a3dd0/attachment.p7s>

From rafal at milecki.pl  Wed Sep 23 17:37:35 2020
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Wed, 23 Sep 2020 23:37:35 +0200
Subject: [PATCH V3 uhttpd] ubus: add new RESTful API
In-Reply-To: <5b35b700-4816-13e0-e69a-b2f3507c23e1@marcant.net>
References: <20200914151523.4757-1-zajec5@gmail.com>
 <5b35b700-4816-13e0-e69a-b2f3507c23e1@marcant.net>
Message-ID: <af5ccea4dedf173e78a9d1a581f4514f@milecki.pl>

On 2020-09-23 23:33, Andre Valentin wrote:
> I'm experimenting again a bit with the new API. I subscribed to the
> hostapd events and saw that
> after some time the connection is still up, but now new events come in.
> How can I control timeout and make sure, that the subscription
> connections stays as long as
> possible online?

Did you mean "no new events"? Please try:
[PATCH uhttpd] client: really close connection on timeout
https://patchwork.ozlabs.org/project/openwrt/patch/20200923104327.14812-1-zajec5 at gmail.com/


From git at johnthomson.fastmail.com.au  Wed Sep 23 18:01:21 2020
From: git at johnthomson.fastmail.com.au (John Thomson)
Date: Thu, 24 Sep 2020 08:01:21 +1000
Subject: [PATCH RFC] kernel: mtd spi-nor: allow use of mixed erasesizes (E.g.
 64K & 4K)
Message-ID: <20200923220121.8929-1-git@johnthomson.fastmail.com.au>

Allow SPI NOR code to be configured to use the multiple erase-regions
code path for a uniform erase-region device. This code path allows an
erase request to select and run a list of erase operations (including 4K
erases where supported by the device, and needed by the request). The
multi erase-regions code path does additional checks before the erase
starts, therefore may take slightly longer before the erase runs on device.

Kernel config options:
Introduces:
CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
Used with:
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=n

Previous users of partial or 4K erase in Openwrt:
- Mikrotik routerboot bootloader configuration
  target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c
  Will work with this patch, with the 4K_SECTORS test removed.
- RedBoot "FIS directory" partition scheme layout update
  package/system/mtd/src/fis.c
  Will need to be changed to use the size of the FIS directory partition,
  rather than the partition erasesize.
  The partial erase patchset set erasesize to partition size where
  partition boundary was not major erasesize aligned. This patch sets
  partition erasesize to minor erasesize only where the boundary is
  minor erasesize aligned.

An erasesize_minor variable is added to the MTD struct mtd_info, so that
the mtd level does not need access to the SPI NOR level to calculate the
smallest (minor) universal erasesize. This is set in spi-nor.c device
initialisation.

mtdpart.c is modified to not prevent writing to partitions with a
boundary on a minor eraseblock. As mtd partitions are currently a stack
of structs, the erasesize_minor need to be copied (from parent) to each
partition. MTD partitions use a list in kernel 5.7, but the erasesize
boundary code remains the same.

There appears to be a bug in spi-nor.c for univeral erase-region devices,
in a code path that only this patch uses: A pointer to an address within
a struct is not updated following a memcpy of the struct.

Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>

---

Replaces Openwrt generic patches:
These cuts are not included in this patch to reduce RFC length.
- partial erase 411 & 412
- 4K limit 470 (non-functional on 5.4)

Any suggestions welcome!

Further discussion here: https://github.com/openwrt/openwrt/pull/3271

WIP: Do not run this without a full NOR backup,
and a means to restore it.
E.g. SOIC8 clip? + single board computer with extra SPI.

Run tested with Mikrotik soft_config writes on ath79 & ramips.
Not tested on Redboot FIS layout update (fis code needs changes).

An earlier patch which modified the default universal erase-region code
path in spi-nor.c was sent RFC to linux-mtd, but received no comments.

The update pointer to memcpy'd address patch has been recently sent RFC
to linux-mtd and maintainers. My intention is that once this gets addressed,
I send through the erasesize_minor and mtdpart changes.

- I am not sure that testing if (wr_alignment_minor) is enough to check
  that the device has an erasesize_minor set?
- I am not sure that the picked erasesize_minor would be universal for
  multi erase-regions devices.

It is my opinion that code requesting an mtd_erase should manage the
whole eraseblock. The partial erase patchset currently manages this in
kernel, and a recently fixed merge bug in it was able to cause data loss
and bootloader corruption on some Mikrotik and Redboot devices. In
kernel 5.7, the mtd partition code is changed and would require a
rewrite of the partial erase, as part_erase is no longer used.

There may be devices that currently use partial erase which do not support 4K
erase. They would lose functionaly with this patch.

If there are any other user of 4K or partial erase, please let me know.

Cheers!
---
 ...9-0-mtd-spi-nor-allow-variable-erase.patch | 172 ++++++++++++++++++
 1 file changed, 172 insertions(+)
 create mode 100644 target/linux/generic/pending-5.4/499-0-mtd-spi-nor-allow-variable-erase.patch

diff --git a/target/linux/generic/pending-5.4/499-0-mtd-spi-nor-allow-variable-erase.patch b/target/linux/generic/pending-5.4/499-0-mtd-spi-nor-allow-variable-erase.patch
new file mode 100644
index 0000000000..a7d727f2b0
--- /dev/null
+++ b/target/linux/generic/pending-5.4/499-0-mtd-spi-nor-allow-variable-erase.patch
@@ -0,0 +1,172 @@
+--- a/drivers/mtd/mtdpart.c
++++ b/drivers/mtd/mtdpart.c
+@@ -331,8 +331,9 @@ static struct mtd_part *allocate_partiti
+ {
+ 	int wr_alignment = (parent->flags & MTD_NO_ERASE) ? parent->writesize :
+ 							    parent->erasesize;
++	int wr_alignment_minor = parent->erasesize_minor;
+ 	struct mtd_part *slave;
+-	u32 remainder;
++	u32 remainder, remainder_minor;
+ 	char *name;
+ 	u64 tmp;
+ 
+@@ -433,6 +434,9 @@ static struct mtd_part *allocate_partiti
+ 	if (parent->_put_device)
+ 		slave->mtd._put_device = part_put_device;
+ 
++	if (parent->erasesize_minor)
++		slave->mtd.erasesize_minor = parent->erasesize_minor;
++
+ 	slave->mtd._erase = part_erase;
+ 	slave->parent = parent;
+ 	slave->offset = part->offset;
+@@ -523,21 +527,41 @@ static struct mtd_part *allocate_partiti
+ 
+ 	tmp = part_absolute_offset(parent) + slave->offset;
+ 	remainder = do_div(tmp, wr_alignment);
+-	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {
+-		/* Doesn't start on a boundary of major erase size */
+-		/* FIXME: Let it be writable if it is on a boundary of
+-		 * _minor_ erase size though */
+-		slave->mtd.flags &= ~MTD_WRITEABLE;
+-		printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n",
+-			part->name);
++	if (remainder && wr_alignment_minor) {
++		tmp = part_absolute_offset(parent) + slave->offset;
++		remainder_minor = do_div(tmp, wr_alignment_minor);
++	}
++	if (slave->mtd.flags & MTD_WRITEABLE){
++		if (!remainder){
++			/* Does start on a boundary of major erase size */
++		} else if (wr_alignment_minor && !remainder_minor){
++			/* Does start on a boundary of minor erase size */
++			slave->mtd.erasesize = parent->erasesize_minor;
++		} else {
++			slave->mtd.flags &= ~MTD_WRITEABLE;
++			printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n",
++				part->name);
++		}
+ 	}
+ 
+ 	tmp = part_absolute_offset(parent) + slave->offset + slave->mtd.size;
+ 	remainder = do_div(tmp, wr_alignment);
+-	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {
+-		slave->mtd.flags &= ~MTD_WRITEABLE;
+-		printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n",
+-			part->name);
++	if (remainder && wr_alignment_minor) {
++		tmp = part_absolute_offset(parent) +
++		      slave->offset + slave->mtd.size;
++		remainder_minor = do_div(tmp, wr_alignment_minor);
++	}
++	if (slave->mtd.flags & MTD_WRITEABLE){
++		if (!remainder){
++			/* Does end on a boundary of major erase size */
++		} else if (wr_alignment_minor && !remainder_minor){
++			/* Does end on a boundary of minor erase size */
++			slave->mtd.erasesize = parent->erasesize_minor;
++		} else {
++			slave->mtd.flags &= ~MTD_WRITEABLE;
++			printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n",
++				part->name);
++		}
+ 	}
+ 
+ 	mtd_set_ooblayout(&slave->mtd, &part_ooblayout_ops);
+--- a/drivers/mtd/spi-nor/Kconfig
++++ b/drivers/mtd/spi-nor/Kconfig
+@@ -24,6 +24,14 @@ config MTD_SPI_NOR_USE_4K_SECTORS
+ 	  Please note that some tools/drivers/filesystems may not work with
+ 	  4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).
+ 
++config MTD_SPI_NOR_USE_VARIABLE_ERASE
++	bool "Disable uniform_erase"
++	default n
++	help
++	  Return false with spi_nor_has_uniform_erase,
++	  so that the multiple eraseregions code path is used.
++	  This allows an erase to use 4K erase where supported and needed.
++
+ config SPI_ASPEED_SMC
+ 	tristate "Aspeed flash controllers in SPI mode"
+ 	depends on ARCH_ASPEED || COMPILE_TEST
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -4346,6 +4346,7 @@ static int spi_nor_select_erase(struct s
+ {
+ 	struct spi_nor_erase_map *map = &nor->params.erase_map;
+ 	const struct spi_nor_erase_type *erase = NULL;
++	const struct spi_nor_erase_type *erase_minor = NULL;
+ 	struct mtd_info *mtd = &nor->mtd;
+ 	u32 wanted_size = nor->info->sector_size;
+ 	int i;
+@@ -4378,15 +4379,20 @@ static int spi_nor_select_erase(struct s
+ 	 */
+ 	for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) {
+ 		if (map->erase_type[i].size) {
+-			erase = &map->erase_type[i];
+-			break;
++			if (!erase)
++				erase = &map->erase_type[i];
++			erase_minor = &map->erase_type[i];
+ 		}
+ 	}
+ 
+ 	if (!erase)
+ 		return -EINVAL;
+ 
++	if (!erase_minor)
++		erase_minor = erase;
++
+ 	mtd->erasesize = erase->size;
++	mtd->erasesize_minor = erase_minor->size;
+ 	return 0;
+ }
+ 
+@@ -4522,12 +4528,20 @@ static void spi_nor_sfdp_init_params(str
+ 	struct spi_nor_flash_parameter sfdp_params;
+ 
+ 	memcpy(&sfdp_params, &nor->params, sizeof(sfdp_params));
++	if (nor->params.erase_map.regions ==
++	    &nor->params.erase_map.uniform_region)
++		sfdp_params.erase_map.regions = (
++			&sfdp_params.erase_map.uniform_region);
+ 
+ 	if (spi_nor_parse_sfdp(nor, &sfdp_params)) {
+ 		nor->addr_width = 0;
+ 		nor->flags &= ~SNOR_F_4B_OPCODES;
+ 	} else {
+ 		memcpy(&nor->params, &sfdp_params, sizeof(nor->params));
++		if (sfdp_params.erase_map.regions ==
++		    &sfdp_params.erase_map.uniform_region)
++			nor->params.erase_map.regions = (
++				&nor->params.erase_map.uniform_region);
+ 	}
+ }
+ 
+--- a/include/linux/mtd/mtd.h
++++ b/include/linux/mtd/mtd.h
+@@ -205,6 +205,8 @@ struct mtd_info {
+ 	 * information below if they desire
+ 	 */
+ 	uint32_t erasesize;
++	/* "Minor" erase size supported by the whole device */
++	uint32_t erasesize_minor;
+ 	/* Minimal writable flash unit size. In case of NOR flash it is 1 (even
+ 	 * though individual bits can be cleared), in case of NAND flash it is
+ 	 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
+--- a/include/linux/mtd/spi-nor.h
++++ b/include/linux/mtd/spi-nor.h
+@@ -631,7 +631,11 @@ spi_nor_region_mark_overlay(struct spi_n
+ 
+ static bool __maybe_unused spi_nor_has_uniform_erase(const struct spi_nor *nor)
+ {
++#ifdef CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE
++	return false;
++#else
+ 	return !!nor->params.erase_map.uniform_erase_type;
++#endif
+ }
+ 
+ static inline void spi_nor_set_flash_node(struct spi_nor *nor,
-- 
2.28.0



From facboy at gmail.com  Wed Sep 23 18:08:36 2020
From: facboy at gmail.com (Christopher Ng)
Date: Wed, 23 Sep 2020 23:08:36 +0100
Subject: [PATCH] fw3: rules: fix parsing of multiple weekdays
Message-ID: <20200923220836.18537-1-facboy@gmail.com>

fw3 was not parsing the 'weekdays' option of rules correctly, it would
only put the first day listed into the iptables --weekdays option.

Signed-off-by: Christopher Ng <facboy at gmail.com>
---
 iptables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iptables.c b/iptables.c
index e7e8b59..9e8fa74 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1208,7 +1208,7 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct fw3_time *time)
 					rem--;
 				}
 
-				p += snprintf(p, rem, "%u", i);
+				len = snprintf(p, rem, "%u", i);
 
 				if (len < 0 || len >= rem)
 					break;
-- 
2.17.1



From hauke at hauke-m.de  Wed Sep 23 18:30:48 2020
From: hauke at hauke-m.de (Hauke Mehrtens)
Date: Thu, 24 Sep 2020 00:30:48 +0200
Subject: WBMv13 goes virutal - please vote on your preferred date!
In-Reply-To: <CAPS4iOL5vgN9w3WXe6cq78UoF038vga3C18hXJpoDpxPm052AQ@mail.gmail.com>
References: <CAPS4iOL5vgN9w3WXe6cq78UoF038vga3C18hXJpoDpxPm052AQ@mail.gmail.com>
Message-ID: <01bc378c-195f-d57b-e65c-c8082012b852@hauke-m.de>

Hi OpenWrt community,

In the beginning of the year we planned to have OpenWrt talks at the
Wireless Battle Mesh, but this will not happen as an in person event
this year because of Corona.

The Wireless Battle Mesh goes virtual this year!

OpenWrt would also like to participate in this virtual WBM13 event. I
hope we will get about 3 interesting talks about OpenWrt or just have
some interesting discussions on a voice chat server.

If you would like to participate please vote for your preferred dates of
the event:
https://framadate.org/oqWwMrU4EKJdy1Sl

Hauke

On 9/15/20 11:59 PM, Filipe Borges Teixeira wrote:
> Dear mesh enthusiasts,
> 
> WBM is going virtual!
> 
> After some months of reconsideration, we have concluded that it would be
> kinda difficult to do the WBMv13 in person this year :..(
> But our mission can't be shutdown by a mere 7.5 kilobytes of RNA - there
> will be a dedicated mesh developer/community event in 2020!
> 
> The rough idea, for now, is to put together a schedule of around 10
> interesting presentations, via BigBlueButton (streamcopied to
> Peertube/YouTube) and a set of topic-based rooms on a voice chat server
> (mumble). For now, things are still flexible - we can change this model
> according to the expected number of participants.?
> We could also use this event to try running distributed experiments.
> 
> Next Steps:
> ? ?
> 1) Please help us find out how many participants we can expect for a
> small online event that spans over 2 half-days during a weekend in
> November/December. by marking your preferred date here [1];
> 2) Please help us spread the word by forwarding this call to your local
> communities!
> 
> All the best,
> ? The WBMv13 "Virtual Global Edition" orga team
> 
> [1] https://framadate.org/oqWwMrU4EKJdy1Sl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200924/f896d385/attachment.sig>

From avalentin at marcant.net  Thu Sep 24 14:22:06 2020
From: avalentin at marcant.net (Andre Valentin)
Date: Thu, 24 Sep 2020 20:22:06 +0200
Subject: [PATCH V3 uhttpd] ubus: add new RESTful API
In-Reply-To: <af5ccea4dedf173e78a9d1a581f4514f@milecki.pl>
References: <20200914151523.4757-1-zajec5@gmail.com>
 <5b35b700-4816-13e0-e69a-b2f3507c23e1@marcant.net>
 <af5ccea4dedf173e78a9d1a581f4514f@milecki.pl>
Message-ID: <5cd93749-78a2-7d15-7d03-5499ef709d0b@marcant.net>

Hi Rafa?!

Am 23.09.20 um 23:37 schrieb Rafa? Mi?ecki:
> On 2020-09-23 23:33, Andre Valentin wrote:
>> I'm experimenting again a bit with the new API. I subscribed to the
>> hostapd events and saw that
>> after some time the connection is still up, but now new events come in.
>> How can I control timeout and make sure, that the subscription
>> connections stays as long as
>> possible online?
> 
> Did you mean "no new events"? Please try:
> [PATCH uhttpd] client: really close connection on timeout
> https://patchwork.ozlabs.org/project/openwrt/patch/20200923104327.14812-1-zajec5 at gmail.com/

Thanks for the hint. Will try it and come back. BTW, how long can such a subscription persist?
Is it controlled with the "-e" switch?

Kind regards,

Andr?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4052 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200924/9496eabd/attachment.p7s>

From mail at aparcar.org  Thu Sep 24 16:54:32 2020
From: mail at aparcar.org (Paul Spooren)
Date: Thu, 24 Sep 2020 10:54:32 -1000
Subject: [PATCH 1/2] libopkg: remove support for "dist" config
Message-ID: <20200924205433.1531208-1-mail@aparcar.org>

The "dist" config option is legacy to imitate Debians repository
structure. However this is never used within the OpenWrt ecosystem and
can therefore be removed.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 libopkg/opkg_conf.c | 32 +++-----------------------------
 libopkg/opkg_conf.h |  1 -
 libopkg/pkg_hash.c  | 25 -------------------------
 libopkg/pkg_hash.h  |  1 -
 4 files changed, 3 insertions(+), 56 deletions(-)

diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 38703ee..ee151f5 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -184,8 +184,7 @@ static int opkg_conf_set_option(const char *name, const char *value)
 
 static int
 opkg_conf_parse_file(const char *filename,
-		     pkg_src_list_t * pkg_src_list,
-		     pkg_src_list_t * dist_src_list)
+		     pkg_src_list_t * pkg_src_list)
 {
 	int line_num = 0;
 	int err = 0;
@@ -291,26 +290,6 @@ opkg_conf_parse_file(const char *filename,
 			   tmp_src_nv_pair_list for sake of symmetry.) */
 			if (strcmp(type, "option") == 0) {
 				opkg_conf_set_option(name, value);
-			} else if (strcmp(type, "dist") == 0) {
-				if (!nv_pair_list_find
-				    ((nv_pair_list_t *) dist_src_list, name)) {
-					pkg_src_list_append(dist_src_list, name,
-							    value, extra, 0);
-				} else {
-					opkg_msg(ERROR,
-						 "Duplicate dist declaration (%s %s). "
-						 "Skipping.\n", name, value);
-				}
-			} else if (strcmp(type, "dist/gz") == 0) {
-				if (!nv_pair_list_find
-				    ((nv_pair_list_t *) dist_src_list, name)) {
-					pkg_src_list_append(dist_src_list, name,
-							    value, extra, 1);
-				} else {
-					opkg_msg(ERROR,
-						 "Duplicate dist declaration (%s %s). "
-						 "Skipping.\n", name, value);
-				}
 			} else if (strcmp(type, "src") == 0) {
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) pkg_src_list, name)) {
@@ -458,7 +437,6 @@ static int glob_errfunc(const char *epath, int eerrno)
 int opkg_conf_init(void)
 {
 	pkg_src_list_init(&conf->pkg_src_list);
-	pkg_src_list_init(&conf->dist_src_list);
 	pkg_dest_list_init(&conf->pkg_dest_list);
 	pkg_dest_list_init(&conf->tmp_dest_list);
 	nv_pair_list_init(&conf->arch_list);
@@ -486,8 +464,7 @@ int opkg_conf_load(void)
 			goto err0;
 		}
 		if (opkg_conf_parse_file(conf->conf_file,
-					 &conf->pkg_src_list,
-					 &conf->dist_src_list))
+					 &conf->pkg_src_list))
 			goto err1;
 	}
 
@@ -518,8 +495,7 @@ int opkg_conf_load(void)
 			    !strcmp(conf->conf_file, globbuf.gl_pathv[i]))
 				continue;
 		if (opkg_conf_parse_file(globbuf.gl_pathv[i],
-					 &conf->pkg_src_list,
-					 &conf->dist_src_list) < 0) {
+					 &conf->pkg_src_list) < 0) {
 			globfree(&globbuf);
 			goto err1;
 		}
@@ -629,7 +605,6 @@ err2:
 	}
 err1:
 	pkg_src_list_deinit(&conf->pkg_src_list);
-	pkg_src_list_deinit(&conf->dist_src_list);
 	pkg_dest_list_deinit(&conf->pkg_dest_list);
 	nv_pair_list_deinit(&conf->arch_list);
 
@@ -670,7 +645,6 @@ void opkg_conf_deinit(void)
 		free(conf->conf_file);
 
 	pkg_src_list_deinit(&conf->pkg_src_list);
-	pkg_src_list_deinit(&conf->dist_src_list);
 	pkg_dest_list_deinit(&conf->pkg_dest_list);
 	nv_pair_list_deinit(&conf->arch_list);
 
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 91190b3..d38fd73 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -45,7 +45,6 @@ extern opkg_conf_t *conf;
 
 struct opkg_conf {
 	pkg_src_list_t pkg_src_list;
-	pkg_src_list_t dist_src_list;
 	pkg_dest_list_t pkg_dest_list;
 	pkg_dest_list_t tmp_dest_list;
 	nv_pair_list_t arch_list;
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 52c64ff..bf971d7 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -68,31 +68,6 @@ void pkg_hash_deinit(void)
 	hash_table_deinit(&conf->pkg_hash);
 }
 
-int dist_hash_add_from_file(const char *lists_dir, pkg_src_t * dist)
-{
-	nv_pair_list_elt_t *l;
-	char *list_file, *subname;
-
-	list_for_each_entry(l, &conf->arch_list.head, node) {
-		nv_pair_t *nv = (nv_pair_t *) l->data;
-		sprintf_alloc(&subname, "%s-%s", dist->name, nv->name);
-		sprintf_alloc(&list_file, "%s/%s", lists_dir, subname);
-
-		if (file_exists(list_file)) {
-			if (pkg_hash_add_from_file(list_file, dist, NULL, 0, 0, NULL, NULL)) {
-				free(list_file);
-				return -1;
-			}
-			pkg_src_list_append(&conf->pkg_src_list, subname,
-					    dist->value, "__dummy__", 0);
-		}
-
-		free(list_file);
-	}
-
-	return 0;
-}
-
 int
 pkg_hash_add_from_file(const char *file_name,
 		       pkg_src_t * src, pkg_dest_t * dest, int is_status_file, int state_flags,
diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h
index e5ab2e0..b10c878 100644
--- a/libopkg/pkg_hash.h
+++ b/libopkg/pkg_hash.h
@@ -28,7 +28,6 @@ void pkg_hash_deinit(void);
 
 void pkg_hash_fetch_available(pkg_vec_t * available);
 
-int dist_hash_add_from_file(const char *file_name, pkg_src_t * dist);
 int pkg_hash_add_from_file(const char *file_name, pkg_src_t * src,
 			   pkg_dest_t * dest, int is_status_file, int state_flags,
 			   void (*cb)(pkg_t *, void *), void *priv);
-- 
2.25.1



From mail at aparcar.org  Thu Sep 24 16:54:33 2020
From: mail at aparcar.org (Paul Spooren)
Date: Thu, 24 Sep 2020 10:54:33 -1000
Subject: [PATCH 2/2] libopkg: remove "extra_data" option
In-Reply-To: <20200924205433.1531208-1-mail@aparcar.org>
References: <20200924205433.1531208-1-mail@aparcar.org>
Message-ID: <20200924205433.1531208-2-mail@aparcar.org>

The "extra_data" allowed to add an extra option behind a repository
definition. This was only ever used to either ignore a specific feed by
setting it to "__dummy__" or adding a sub-folder in the repository path,
as done for Debian repositories.

Instead of using "__dummy__" it is cleaner to "comment out" the specific
repository and Debian repository structure is nowhere used in the
OpenWrt ecosystem, therefore it seem save to remove "extra_data".

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 libopkg/opkg.c         | 17 ++++-------------
 libopkg/opkg_cmd.c     | 20 ++++----------------
 libopkg/opkg_conf.c    | 22 +++-------------------
 libopkg/pkg_src.c      |  8 +-------
 libopkg/pkg_src.h      |  3 +--
 libopkg/pkg_src_list.c |  4 ++--
 libopkg/pkg_src_list.h |  3 +--
 7 files changed, 16 insertions(+), 61 deletions(-)

diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 3583488..191e028 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -529,13 +529,8 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
 
 		src = (pkg_src_t *) iter->data;
 
-		if (src->extra_data)	/* debian style? */
-			sprintf_alloc(&url, "%s/%s/%s", src->value,
-				      src->extra_data,
-				      src->gzip ? "Packages.gz" : "Packages");
-		else
-			sprintf_alloc(&url, "%s/%s", src->value,
-				      src->gzip ? "Packages.gz" : "Packages");
+		sprintf_alloc(&url, "%s/%s", src->value,
+			      src->gzip ? "Packages.gz" : "Packages");
 
 		sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
 
@@ -550,12 +545,8 @@ opkg_update_package_lists(opkg_progress_callback_t progress_callback,
 			char *sig_file_name;
 			/* download detached signitures to verify the package lists */
 			/* get the url for the sig file */
-			if (src->extra_data)	/* debian style? */
-				sprintf_alloc(&url, "%s/%s/%s", src->value,
-					      src->extra_data, "Packages.sig");
-			else
-				sprintf_alloc(&url, "%s/%s", src->value,
-					      "Packages.sig");
+			sprintf_alloc(&url, "%s/%s", src->value,
+				      "Packages.sig");
 
 			/* create filename for signature */
 			sprintf_alloc(&sig_file_name, "%s/%s.sig", lists_dir,
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index a329558..83e345e 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -117,16 +117,8 @@ static int opkg_update_cmd(int argc, char **argv)
 
 		src = (pkg_src_t *) iter->data;
 
-		if (src->extra_data && strcmp(src->extra_data, "__dummy__ "))
-			continue;
-
-		if (src->extra_data)	/* debian style? */
-			sprintf_alloc(&url, "%s/%s/%s", src->value,
-				      src->extra_data,
-				      src->gzip ? "Packages.gz" : "Packages");
-		else
-			sprintf_alloc(&url, "%s/%s", src->value,
-				      src->gzip ? "Packages.gz" : "Packages");
+		sprintf_alloc(&url, "%s/%s", src->value,
+			      src->gzip ? "Packages.gz" : "Packages");
 
 		sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
 		pkglist_dl_error = 0;
@@ -146,12 +138,8 @@ static int opkg_update_cmd(int argc, char **argv)
 		if (pkglist_dl_error == 0 && conf->check_signature) {
 			/* download detached signitures to verify the package lists */
 			/* get the url for the sig file */
-			if (src->extra_data)	/* debian style? */
-				sprintf_alloc(&url, "%s/%s/%s", src->value,
-					      src->extra_data, "Packages.sig");
-			else
-				sprintf_alloc(&url, "%s/%s", src->value,
-					      "Packages.sig");
+			sprintf_alloc(&url, "%s/%s", src->value,
+				      "Packages.sig");
 
 			/* create temporary file for it */
 			char *tmp_file_name;
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index ee151f5..5fe0be9 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -218,7 +218,7 @@ opkg_conf_parse_file(const char *filename,
 
 	while (1) {
 		char *line;
-		char *type, *name, *value, *extra;
+		char *type, *name, *value;
 
 		line_num++;
 
@@ -261,20 +261,6 @@ opkg_conf_parse_file(const char *filename,
 					 regmatch[9].rm_eo - regmatch[9].rm_so);
 		}
 
-		extra = NULL;
-		if (regmatch[11].rm_so > 0) {
-			if (regmatch[13].rm_so > 0
-			    && regmatch[13].rm_so != regmatch[13].rm_eo)
-				extra =
-				    xstrndup(line + regmatch[11].rm_so,
-					     regmatch[13].rm_eo -
-					     regmatch[11].rm_so);
-			else
-				extra = xstrndup(line + regmatch[11].rm_so,
-						 regmatch[11].rm_eo -
-						 regmatch[11].rm_so);
-		}
-
 		if (regmatch[13].rm_so != regmatch[13].rm_eo
 		    && strncmp(type, "dist", 4) != 0) {
 			opkg_msg(ERROR,
@@ -294,7 +280,7 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) pkg_src_list, name)) {
 					pkg_src_list_append(pkg_src_list, name,
-							    value, extra, 0);
+							    value, 0);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate src declaration (%s %s). "
@@ -304,7 +290,7 @@ opkg_conf_parse_file(const char *filename,
 				if (!nv_pair_list_find
 				    ((nv_pair_list_t *) pkg_src_list, name)) {
 					pkg_src_list_append(pkg_src_list, name,
-							    value, extra, 1);
+							    value, 1);
 				} else {
 					opkg_msg(ERROR,
 						 "Duplicate src declaration (%s %s). "
@@ -338,8 +324,6 @@ opkg_conf_parse_file(const char *filename,
 		free(type);
 		free(name);
 		free(value);
-		if (extra)
-			free(extra);
 
 NEXT_LINE:
 		free(line);
diff --git a/libopkg/pkg_src.c b/libopkg/pkg_src.c
index fae3ce3..83ede16 100644
--- a/libopkg/pkg_src.c
+++ b/libopkg/pkg_src.c
@@ -19,15 +19,11 @@
 #include "libbb/libbb.h"
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-		 const char *extra_data, int gzip)
+		 int gzip)
 {
 	src->gzip = gzip;
 	src->name = xstrdup(name);
 	src->value = xstrdup(base_url);
-	if (extra_data)
-		src->extra_data = xstrdup(extra_data);
-	else
-		src->extra_data = NULL;
 	return 0;
 }
 
@@ -35,6 +31,4 @@ void pkg_src_deinit(pkg_src_t * src)
 {
 	free(src->name);
 	free(src->value);
-	if (src->extra_data)
-		free(src->extra_data);
 }
diff --git a/libopkg/pkg_src.h b/libopkg/pkg_src.h
index 1320f1f..e5e7a42 100644
--- a/libopkg/pkg_src.h
+++ b/libopkg/pkg_src.h
@@ -23,12 +23,11 @@
 typedef struct {
 	char *name;
 	char *value;
-	char *extra_data;
 	int gzip;
 } pkg_src_t;
 
 int pkg_src_init(pkg_src_t * src, const char *name, const char *base_url,
-		 const char *extra_data, int gzip);
+		 int gzip);
 void pkg_src_deinit(pkg_src_t * src);
 
 #endif
diff --git a/libopkg/pkg_src_list.c b/libopkg/pkg_src_list.c
index cc24438..5259423 100644
--- a/libopkg/pkg_src_list.c
+++ b/libopkg/pkg_src_list.c
@@ -42,11 +42,11 @@ void pkg_src_list_deinit(pkg_src_list_t * list)
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list,
 			       const char *name, const char *base_url,
-			       const char *extra_data, int gzip)
+			       int gzip)
 {
 	/* freed in pkg_src_list_deinit */
 	pkg_src_t *pkg_src = xcalloc(1, sizeof(pkg_src_t));
-	pkg_src_init(pkg_src, name, base_url, extra_data, gzip);
+	pkg_src_init(pkg_src, name, base_url, gzip);
 
 	void_list_append((void_list_t *) list, pkg_src);
 
diff --git a/libopkg/pkg_src_list.h b/libopkg/pkg_src_list.h
index 71a10f6..0852614 100644
--- a/libopkg/pkg_src_list.h
+++ b/libopkg/pkg_src_list.h
@@ -37,7 +37,6 @@ void pkg_src_list_init(pkg_src_list_t * list);
 void pkg_src_list_deinit(pkg_src_list_t * list);
 
 pkg_src_t *pkg_src_list_append(pkg_src_list_t * list, const char *name,
-			       const char *root_dir, const char *extra_data,
-			       int gzip);
+			       const char *root_dir, int gzip);
 
 #endif
-- 
2.25.1



From yszhou4tech at gmail.com  Thu Sep 24 22:37:08 2020
From: yszhou4tech at gmail.com (Yousong Zhou)
Date: Fri, 25 Sep 2020 10:37:08 +0800
Subject: Dnssec is never enabled on recent master
In-Reply-To: <CAENOc+za16-cVMi2PjN1Vh4q681yVjpwQQraqUghMj65TaX0Vw@mail.gmail.com>
References: <CAENOc+za16-cVMi2PjN1Vh4q681yVjpwQQraqUghMj65TaX0Vw@mail.gmail.com>
Message-ID: <CAECwjAg9oFuCcs44HX=5uGTZc95CdqqwZxcVDHQ7jpjChguwmg@mail.gmail.com>

On Tue, 22 Sep 2020 at 19:00, Sami Olmari <sami at olmari.fi> wrote:
>
> This commit https://github.com/openwrt/openwrt/commit/064dc1e81bc85f6ef8becc38854292853a59d2c2
> breaks all dnssec, it will never get enabled despite /etc/config/dhcp
> enabling it. Reverting this commit made dnssec to work again. So this
> needs either reverting, or some more elaborate fix.

Should be fixed now with
https://git.openwrt.org/7dc78d1d2893b672544e8c26026ce961a7248a82 .

Sorry for the inconvenience and possible hazard exposed.  It's a logic invert ;(

Regards,
                yousong

>
> Additionally I got this message when troubleshooting this at irc:
> "While at it, ask please to fix trust-anchor match too (it's not an
> option, the option just contains that word at the end)"
>
> Thank you!
>
> --
>  Sami Olmari
>  Oy Olmari Ab
>  Vaasa Hacklab ry


From e9hack at gmail.com  Fri Sep 25 04:12:20 2020
From: e9hack at gmail.com (e9hack)
Date: Fri, 25 Sep 2020 10:12:20 +0200
Subject: ddns-scripts is broken since last major update
Message-ID: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>

Hi,

since last update, ddns-scripts doesn't work any more. The log files contains the following output:

 094310       : ************ ************** ************** **************
 094310  note : PID '6635' started at 2020-09-25 09:43
 094310       : ddns version  : 2.8.0-24
 094310       : uci configuration:
ddns.do_de.check_interval='1'
ddns.do_de.check_unit='minutes'
ddns.do_de.domain='xxxxxxx.net'
ddns.do_de.enabled='1'
ddns.do_de.force_interval='12'
ddns.do_de.force_unit='hours'
ddns.do_de.interface='wan'
ddns.do_de.ip_network='wan'
ddns.do_de.ip_source='network'
ddns.do_de.lookup_host='xxxxxxx.net'
ddns.do_de.password='***PW***'
ddns.do_de.service_name='do.de'
ddns.do_de.use_https='1'
ddns.do_de.username='xxxx-xxxxxxx-xxxxx'
ddns.do_de=service
 094311       : verbose mode  : 0 - run normal, NO console output
 094311  WARN : No update_url found/defined or no update_script found/defined! - TERMINATE
 094311  WARN : PID '6635' exit WITH ERROR '1' at 2020-09-25 09:43

The same occurs for dynv6.com.

Regards,
Hartmut



From ansuelsmth at gmail.com  Fri Sep 25 05:26:45 2020
From: ansuelsmth at gmail.com (Ansuel Smith)
Date: Fri, 25 Sep 2020 11:26:45 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
Message-ID: <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>

>
> Hi,
>
> since last update, ddns-scripts doesn't work any more. The log files contains the following output:
>

We changed how the services files is handled... You now need to both
download the service with the 'ddns' command or install the companion
package with all the services preinstalled.


From fe at dev.tdt.de  Fri Sep 25 05:49:32 2020
From: fe at dev.tdt.de (Florian Eckert)
Date: Fri, 25 Sep 2020 11:49:32 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
Message-ID: <1e9e80ebf76a687b928745c2fee6ea0f@dev.tdt.de>

Hello Hartmut

> since last update, ddns-scripts doesn't work any more. The log files
> contains the following output:

The current handling of the large file service and service6 with all 
services was complicated.
Therefore I have outsourced the information of every service into 
different JSON files.
These files have been moved to an extra package 'ddns-scripts_service'.
If you want to have all services, you have to install this package.
With the following commands.

opkg update
opkg install ddns-scripts_service

Or you could install individual services from the package github repo 
feed with the following command

ddns service update
ddns service list-available
ddns service install <name>


Then it should work again.


Regards

Florian


From e9hack at gmail.com  Fri Sep 25 05:56:11 2020
From: e9hack at gmail.com (e9hack)
Date: Fri, 25 Sep 2020 11:56:11 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
Message-ID: <d5b3479d-bae1-c83a-362e-09e97ca7600e@gmail.com>

It looks like a configuration problem. If ddns-scripts_service isn't selected together with ddns-scripts, it doesn't work. 

Regards,
Hartmut



From mail at adrianschmutzler.de  Fri Sep 25 12:19:29 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Fri, 25 Sep 2020 18:19:29 +0200
Subject: [PATCH 1/4] base-files/functions.sh: read grep output by line
In-Reply-To: <20200920053140.35255-1-rosenp@gmail.com>
References: <20200920053140.35255-1-rosenp@gmail.com>
Message-ID: <00b301d69357$a77ad090$f67071b0$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Rosen Penev
> Sent: Sonntag, 20. September 2020 07:32
> To: openwrt-devel at lists.openwrt.org
> Subject: [PATCH 1/4] base-files/functions.sh: read grep output by line
> 
> From: https://github.com/koalaman/shellcheck/wiki/SC2013
> 
> For loops by default (subject to $IFS) read word by word.
> Additionally, glob expansion will occur.
> 
> I believe the intended use case of these loops is to read lines.

for the patches 1/4 and 2/4 in this series I'm not really sure whether they provide substantial benefit or just solve the problem differently.

Thus, I am going to wait on additional positive feedback here, and if there is none, I consider rejecting them (as that means that there is not benefit to outweigh the risk of regressions).

Best

Adrian

> 
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  package/base-files/files/lib/functions.sh | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/package/base-files/files/lib/functions.sh b/package/base-
> files/files/lib/functions.sh
> index 7da0c872fa..59bb0fe711 100755
> --- a/package/base-files/files/lib/functions.sh
> +++ b/package/base-files/files/lib/functions.sh
> @@ -182,7 +182,8 @@ default_prerm() {
>  	fi
> 
>  	local shell="$(command -v bash)"
> -	for i in $(grep -s "^/etc/init.d/"
> "$root/usr/lib/opkg/info/${pkgname}.list"); do
> +	grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list" |
> while IFS= read -r i
> +	do
>  		if [ -n "$root" ]; then
>  			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i"
> disable
>  		else
> @@ -260,7 +261,8 @@ default_postinst() {
> 
>  		if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
>  			[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
> -			for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
> +			grep -s "^/etc/uci-defaults/" "$filelist" | while IFS=
> read -r i
> +			do
>  				( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) &&
> rm -f "$i"
>  			done
>  			uci commit
> @@ -270,7 +272,8 @@ default_postinst() {
>  	fi
> 
>  	local shell="$(command -v bash)"
> -	for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
> +	grep -s "^/etc/init.d/" "$root$filelist" | while IFS= read -r i
> +	do
>  		if [ -n "$root" ]; then
>  			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i"
> enable
>  		else
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200925/7801d228/attachment.sig>

From hacks at slashdirt.org  Fri Sep 25 15:09:26 2020
From: hacks at slashdirt.org (Thibaut)
Date: Fri, 25 Sep 2020 21:09:26 +0200
Subject: [PATCH] generic: platform/mikrotik: implement multi caldata
In-Reply-To: <20200824103840.38920-1-hacks@slashdirt.org>
References: <20200824103840.38920-1-hacks@slashdirt.org>
Message-ID: <B25DF90D-164F-4D54-8663-8E74ECC4E28A@slashdirt.org>

Ping?

> Le 24 ao?t 2020 ? 12:38, Thibaut VAR?NE <hacks at slashdirt.org> a ?crit :
> 
> MikroTik recently changed again the way they store wlan calibration data
> on devices. Prior to this change, ERD calibration data for all available
> radios was stored within a single identifier node ("tag" in RouterBoot
> parlance).
> 
> Recent devices have been seen with calibration (and BDF) data stored in
> separate identifiers within LZOR packing for each radio: this patch
> addresses this by:
> 1) ensuring that both variants are properly supported,
> 2) preserving backward compatibility with existing data consumers,
> 3) allowing for more than 2 calibration blobs to be exposed via sysfs.
> 
> Specifically, before this patch, the driver would provide a single sysfs
> file named /sys/firmware/mikrotik/hard_config/wlan_data that contained
> whatever calibration data found on the device's flash. After this patch,
> when executed on a device that uses the old style storage, this behavior
> is unchanged, but when executed on a device that uses new style storage
> (for either traditional "ERD" packing or "LZOR" packing), the driver
> replaces that single file with a folder containing one or more files
> each containing the data encoded within individual identifiers.
> 
> As far as OpenWRT is concerned, this means that for devices which are
> known to exist with both styles of data storage, a suitable hotplug stub
> could look like this for e.g. the second radio:
> 
> wdata="/sys/firmware/mikrotik/hard_config/wlan_data"
> ( [ -f "$wdata" ] && caldata_sysfsload_from_file "$wdata" 0x8000 0x2f20 ) || \
> ( [ -d "$wdata" ] && caldata_sysfsload_from_file "$wdata/data_2" 0x0 0x2f20 )
> 
> This patch has been tested with LZOR old and new style packing on ipq4019,
> and with old style on ath79.
> 
> Tested-by: John Thomson <git at johnthomson.fastmail.com.au>
> Tested-by: ??????? ??????? <admin at ublaze.ru>
> Tested-by: Alen Opa?i? <subixonfire at gmail.com>
> Signed-off-by: Thibaut VAR?NE <hacks at slashdirt.org>
> ---
> .../drivers/platform/mikrotik/rb_hardconfig.c | 139 +++++++++++++-----
> 1 file changed, 106 insertions(+), 33 deletions(-)
> 
> diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c
> index 8861814be4..41dea98b5e 100644
> --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c
> +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c
> @@ -39,7 +39,7 @@
> 
> #include "routerboot.h"
> 
> -#define RB_HARDCONFIG_VER		"0.05"
> +#define RB_HARDCONFIG_VER		"0.06"
> #define RB_HC_PR_PFX			"[rb_hardconfig] "
> 
> /* ID values for hardware settings */
> @@ -76,6 +76,17 @@
> #define RB_HW_OPT_HAS_TS_FOR_ADC	BIT(22)
> #define RB_HW_OPT_HAS_PLC		BIT(29)
> 
> +/*
> + * Tag ID values for ERD data.
> + * Mikrotik used to pack all calibration data under a single tag id 0x1, but
> + * recently switched to a new scheme where each radio calibration gets a
> + * separate tag. The new scheme has tag id bit 15 always set and seems to be
> + * mutually exclusive with the old scheme.
> + */
> +#define RB_WLAN_ERD_ID_SOLO		0x0001
> +#define RB_WLAN_ERD_ID_MULTI_8001	0x8001
> +#define RB_WLAN_ERD_ID_MULTI_8201	0x8201
> +
> static struct kobject *hc_kobj;
> static u8 *hc_buf;		// ro buffer after init(): no locking required
> static size_t hc_buflen;
> @@ -351,10 +362,22 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
> 				     loff_t off, size_t count);
> 
> static struct hc_wlan_attr {
> +	const u16 erd_tag_id;
> 	struct bin_attribute battr;
> 	u16 pld_ofs;
> 	u16 pld_len;
> -} hc_wlandata_battr = {
> +} hc_wd_multi_battrs[] = {
> +	{
> +		.erd_tag_id = RB_WLAN_ERD_ID_MULTI_8001,
> +		.battr = __BIN_ATTR(data_0, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
> +	}, {
> +		.erd_tag_id = RB_WLAN_ERD_ID_MULTI_8201,
> +		.battr = __BIN_ATTR(data_2, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
> +	}
> +};
> +
> +static struct hc_wlan_attr hc_wd_solo_battr = {
> +	.erd_tag_id = RB_WLAN_ERD_ID_SOLO,
> 	.battr = __BIN_ATTR(wlan_data, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
> };
> 
> @@ -426,19 +449,19 @@ static struct hc_attr {
> /*
>  * If the RB_ID_WLAN_DATA payload starts with RB_MAGIC_ERD, then past
>  * that magic number the payload itself contains a routerboot tag node
> - * locating the LZO-compressed calibration data at id 0x1.
> + * locating the LZO-compressed calibration data. So far this scheme is only
> + * known to use a single tag at id 0x1.
>  */
> -static int hc_wlan_data_unpack_erd(const u8 *inbuf, size_t inlen,
> +static int hc_wlan_data_unpack_erd(const u16 tag_id, const u8 *inbuf, size_t inlen,
> 				   void *outbuf, size_t *outlen)
> {
> 	u16 lzo_ofs, lzo_len;
> 	int ret;
> 
> 	/* Find embedded tag */
> -	ret = routerboot_tag_find(inbuf, inlen, 0x1,	// always id 1
> -				  &lzo_ofs, &lzo_len);
> +	ret = routerboot_tag_find(inbuf, inlen, tag_id, &lzo_ofs, &lzo_len);
> 	if (ret) {
> -		pr_debug(RB_HC_PR_PFX "ERD data not found\n");
> +		pr_debug(RB_HC_PR_PFX "no ERD data for id 0x%04x\n", tag_id);
> 		goto fail;
> 	}
> 
> @@ -461,10 +484,10 @@ fail:
>  * that magic number is a payload that must be appended to the hc_lzor_prefix,
>  * the resulting blob is LZO-compressed. In the LZO decompression result,
>  * the RB_MAGIC_ERD magic number (aligned) must be located. Following that
> - * magic, there is a routerboot tag node (id 0x1) locating the RLE-encoded
> + * magic, there is one or more routerboot tag node(s) locating the RLE-encoded
>  * calibration data payload.
>  */
> -static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
> +static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t inlen,
> 				    void *outbuf, size_t *outlen)
> {
> 	u16 rle_ofs, rle_len;
> @@ -492,10 +515,8 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
> 	if (ret) {
> 		if (LZO_E_INPUT_NOT_CONSUMED == ret) {
> 			/*
> -			 * The tag length appears to always be aligned (probably
> -			 * because it is the "root" RB_ID_WLAN_DATA tag), thus
> -			 * the LZO payload may be padded, which can trigger a
> -			 * spurious error which we ignore here.
> +			 * The tag length is always aligned thus the LZO payload may be padded,
> +			 * which can trigger a spurious error which we ignore here.
> 			 */
> 			pr_debug(RB_HC_PR_PFX "LZOR: LZO EOF before buffer end - this may be harmless\n");
> 		} else {
> @@ -520,9 +541,9 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
> 	templen -= (u8 *)needle - tempbuf;
> 
> 	/* Past magic. Look for tag node */
> -	ret = routerboot_tag_find((u8 *)needle, templen, 0x1, &rle_ofs, &rle_len);
> +	ret = routerboot_tag_find((u8 *)needle, templen, tag_id, &rle_ofs, &rle_len);
> 	if (ret) {
> -		pr_debug(RB_HC_PR_PFX "LZOR: RLE data not found\n");
> +		pr_debug(RB_HC_PR_PFX "LZOR: no RLE data for id 0x%04x\n", tag_id);
> 		goto fail;
> 	}
> 
> @@ -542,7 +563,7 @@ fail:
> 	return ret;
> }
> 
> -static int hc_wlan_data_unpack(const size_t tofs, size_t tlen,
> +static int hc_wlan_data_unpack(const u16 tag_id, const size_t tofs, size_t tlen,
> 			       void *outbuf, size_t *outlen)
> {
> 	const u8 *lbuf;
> @@ -562,23 +583,25 @@ static int hc_wlan_data_unpack(const size_t tofs, size_t tlen,
> 		/* Skip magic */
> 		lbuf += sizeof(magic);
> 		tlen -= sizeof(magic);
> -		ret = hc_wlan_data_unpack_lzor(lbuf, tlen, outbuf, outlen);
> +		ret = hc_wlan_data_unpack_lzor(tag_id, lbuf, tlen, outbuf, outlen);
> 		break;
> 	case RB_MAGIC_ERD:
> 		/* Skip magic */
> 		lbuf += sizeof(magic);
> 		tlen -= sizeof(magic);
> -		ret = hc_wlan_data_unpack_erd(lbuf, tlen, outbuf, outlen);
> +		ret = hc_wlan_data_unpack_erd(tag_id, lbuf, tlen, outbuf, outlen);
> 		break;
> 	default:
> 		/*
> 		 * If the RB_ID_WLAN_DATA payload doesn't start with a
> 		 * magic number, the payload itself is the raw RLE-encoded
> -		 * calibration data.
> +		 * calibration data. Only RB_WLAN_ERD_ID_SOLO makes sense here.
> 		 */
> -		ret = routerboot_rle_decode(lbuf, tlen, outbuf, outlen);
> -		if (ret)
> -			pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret);
> +		if (RB_WLAN_ERD_ID_SOLO == tag_id) {
> +			ret = routerboot_rle_decode(lbuf, tlen, outbuf, outlen);
> +			if (ret)
> +				pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret);
> +		}
> 		break;
> 	}
> 
> @@ -633,7 +656,7 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
> 	if (!outbuf)
> 		return -ENOMEM;
> 
> -	ret = hc_wlan_data_unpack(hc_wattr->pld_ofs, hc_wattr->pld_len, outbuf, &outlen);
> +	ret = hc_wlan_data_unpack(hc_wattr->erd_tag_id, hc_wattr->pld_ofs, hc_wattr->pld_len, outbuf, &outlen);
> 	if (ret) {
> 		kfree(outbuf);
> 		return ret;
> @@ -655,14 +678,17 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
> 
> int __init rb_hardconfig_init(struct kobject *rb_kobj)
> {
> +	struct kobject *hc_wlan_kobj;
> 	struct mtd_info *mtd;
> -	size_t bytes_read, buflen;
> +	size_t bytes_read, buflen, outlen;
> 	const u8 *buf;
> -	int i, ret;
> +	void *outbuf;
> +	int i, j, ret;
> 	u32 magic;
> 
> 	hc_buf = NULL;
> 	hc_kobj = NULL;
> +	hc_wlan_kobj = NULL;
> 
> 	// TODO allow override
> 	mtd = get_mtd_device_nm(RB_MTD_HARD_CONFIG);
> @@ -713,15 +739,62 @@ int __init rb_hardconfig_init(struct kobject *rb_kobj)
> 		/* Account for skipped magic */
> 		hc_attrs[i].pld_ofs += sizeof(magic);
> 
> -		/* Special case RB_ID_WLAN_DATA to prep and create the binary attribute */
> +		/*
> +		 * Special case RB_ID_WLAN_DATA to prep and create the binary attribute.
> +		 * We first check if the data is "old style" within a single tag (or no tag at all):
> +		 * If it is we publish this single blob as a binary attribute child of hc_kobj to
> +		 * preserve backward compatibility.
> +		 * If it isn't and instead uses multiple ERD tags, we create a subfolder and
> +		 * publish the known ones there.
> +		 */
> 		if ((RB_ID_WLAN_DATA == hc_attrs[i].tag_id) && hc_attrs[i].pld_len) {
> -			hc_wlandata_battr.pld_ofs = hc_attrs[i].pld_ofs;
> -			hc_wlandata_battr.pld_len = hc_attrs[i].pld_len;
> -
> -			ret = sysfs_create_bin_file(hc_kobj, &hc_wlandata_battr.battr);
> -			if (ret)
> -				pr_warn(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n",
> -				       hc_wlandata_battr.battr.attr.name, ret);
> +			outlen = RB_ART_SIZE;
> +			outbuf = kmalloc(outlen, GFP_KERNEL);
> +			if (!outbuf) {
> +				pr_warn(RB_HC_PR_PFX "Out of memory parsing WLAN tag\n");
> +				continue;
> +			}
> +
> +			/* Test ID_SOLO first, if found: done */
> +			ret = hc_wlan_data_unpack(RB_WLAN_ERD_ID_SOLO, hc_attrs[i].pld_ofs, hc_attrs[i].pld_len, outbuf, &outlen);
> +			if (!ret) {
> +				hc_wd_solo_battr.pld_ofs = hc_attrs[i].pld_ofs;
> +				hc_wd_solo_battr.pld_len = hc_attrs[i].pld_len;
> +
> +				ret = sysfs_create_bin_file(hc_kobj, &hc_wd_solo_battr.battr);
> +				if (ret)
> +					pr_warn(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n",
> +						hc_wd_solo_battr.battr.attr.name, ret);
> +			}
> +			/* Otherwise, create "wlan_data" subtree and publish known data */
> +			else {
> +				hc_wlan_kobj = kobject_create_and_add("wlan_data", hc_kobj);
> +				if (!hc_wlan_kobj) {
> +					kfree(outbuf);
> +					pr_warn(RB_HC_PR_PFX "Could not create wlan_data sysfs folder\n");
> +					continue;
> +				}
> +
> +				for (j = 0; j < ARRAY_SIZE(hc_wd_multi_battrs); j++) {
> +					outlen = RB_ART_SIZE;
> +					ret = hc_wlan_data_unpack(hc_wd_multi_battrs[j].erd_tag_id,
> +								  hc_attrs[i].pld_ofs, hc_attrs[i].pld_len, outbuf, &outlen);
> +					if (ret) {
> +						hc_wd_multi_battrs[j].pld_ofs = hc_wd_multi_battrs[j].pld_len = 0;
> +						continue;
> +					}
> +
> +					hc_wd_multi_battrs[j].pld_ofs = hc_attrs[i].pld_ofs;
> +					hc_wd_multi_battrs[j].pld_len = hc_attrs[i].pld_len;
> +
> +					ret = sysfs_create_bin_file(hc_wlan_kobj, &hc_wd_multi_battrs[j].battr);
> +					if (ret)
> +						pr_warn(RB_HC_PR_PFX "Could not create wlan_data/%s sysfs entry (%d)\n",
> +							hc_wd_multi_battrs[j].battr.attr.name, ret);
> +				}
> +			}
> +
> +			kfree(outbuf);
> 		}
> 		/* All other tags are published via standard attributes */
> 		else {
> -- 
> 2.24.3 (Apple Git-128)
> 



From rosenp at gmail.com  Fri Sep 25 22:22:25 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 25 Sep 2020 19:22:25 -0700
Subject: [PATCH 2/4] base-files/functions.sh: do not iterate over ls
In-Reply-To: <ab677310-9dbd-3e08-d159-eff1b29aa1d7@web.de>
References: <20200920053140.35255-1-rosenp@gmail.com>
 <20200920053140.35255-2-rosenp@gmail.com>
 <ab677310-9dbd-3e08-d159-eff1b29aa1d7@web.de>
Message-ID: <CAKxU2N9ziBHtSv7VnnVnJj2vvkddZVJ0QzbCu5meKWQC9R-vsA@mail.gmail.com>

On Sun, Sep 20, 2020 at 3:15 AM <edgar.soldin at web.de> wrote:
>
> On 20.09.2020 07:31, Rosen Penev wrote:
> > -     for file in $(ls $1/*.sh 2>/dev/null); do
> > -             . $file
> > +     for file in "$1"/*.sh; do
> > +             [ -e "$file" ] || break
> > +             . "$file"
>
> the existence check is probably meant to catch "../*.sh" entry found if no files match. as files will likely not vanish during the loop this will probably work.
> still it'll break the loop completely without any need. using 'continue' instead of 'break' would not break the loop and be safer here.
I was confused on this.
https://github.com/koalaman/shellcheck/wiki/SC2045 lists break.
http://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_.2A.mp3.29
lists continue. I'll make the change.
>
> ..ede
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From hurricos at gmail.com  Fri Sep 25 23:13:05 2020
From: hurricos at gmail.com (Martin Kennedy)
Date: Fri, 25 Sep 2020 23:13:05 -0400
Subject: Support for packages written in Go on powerpc_464fp
Message-ID: <CANA18UxUHRPF9zO_wBF80Mo_tAEQFew=Yv3PFRGN=C3Kh5GYbQ@mail.gmail.com>

Hi there,

I'm not quite sure why, but I'm not able to install e.g. Restic on my
MX60W (CPU: APM82181). I think it's because the golang package doesn't
include this architecture in its list of supported architectures?

Yet the HOST_GO_VALID_OS_ARCH variable in packages/golang/Makefile
mentions powerpc.

What would need to be done to get Go packages to compile for the APM82181?

- Martin K


From gvalkov at abv.bg  Sat Sep 26 00:41:42 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Sat, 26 Sep 2020 07:41:42 +0300
Subject: [PATCH v2] mac80211: fix regression in sta connection monitor
In-Reply-To: <20200922102434.42727-1-nbd@nbd.name>
References: <20200922102434.42727-1-nbd@nbd.name>
Message-ID: <FD88F09D-5FEA-4A15-B586-95843830F737@abv.bg>

Hi Felix!

With your latest suggestion, it takes between 10 and 17 hours for the connection to drop, then long five minutes to reconnect.
Notice the order of code execution in the original code of ieee80211_sta_tx_notify():
probe_send_count is always cleared when ack is true. But before clearing probe_send_count, we need to check if ieee80211_is_any_nullfunc() returns true and probe_send_count > 0: if yes, we must call ieee80211_queue_work(). You cleared probe_send_count ahead of time, so the condition to run ieee80211_queue_work() will never be met.

To spare your time, I did spend one week to find the cause, then another learning every detail about the code and testing various solutions, including those you proposed. While I do not have experience with mac80211?s design, I?m quite good at preserving the exact behaviour during large scale refactoring. And in my fix I tried changing as little as possible to keep the patch small, preserving both your changes and the original design behaviour.

Good luck, and thank you for being a long time supporter of this amazing project!

Georgi

> On 2020-09-22, at 1:24 PM, Felix Fietkau <nbd at nbd.name> wrote:
> 
> When a frame was acked and probe frames were sent, the connection monitoring
> needs to be reset, otherwise it will keep probing until the connection is
> considered dead, even though frames have been acked in the mean time.
> 
> Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
> Reported-by: Georgi Valkov <gvalkov at abv.bg>
> Signed-off-by: Felix Fietkau <nbd at nbd.name>
> ---
> v2: reset connection monitor when a frame was acked (not just for nulldata)
> 
> net/mac80211/status.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
> 
> diff --git a/net/mac80211/status.c b/net/mac80211/status.c
> index 7fe5bececfd9..cc870d1f7db6 100644
> --- a/net/mac80211/status.c
> +++ b/net/mac80211/status.c
> @@ -1120,6 +1120,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
> 	noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
> 
> 	if (pubsta) {
> +		struct ieee80211_sub_if_data *sdata = sta->sdata;
> +
> 		if (!acked && !noack_success)
> 			sta->status_stats.retry_failed++;
> 		sta->status_stats.retry_count += retry_count;
> @@ -1134,6 +1136,13 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
> 				/* Track when last packet was ACKed */
> 				sta->status_stats.last_pkt_time = jiffies;
> 
> +				/* Reset connection monitor */
> +				if (sdata->vif.type == NL80211_IFTYPE_STATION &&
> +				    unlikely(sdata->u.mgd.probe_send_count > 0)) {
> +					sdata->u.mgd.probe_send_count = 0;
> +					ieee80211_queue_work(&local->hw, &sdata->work);
> +				}
> +
> 				if (info->status.is_valid_ack_signal) {
> 					sta->status_stats.last_ack_signal =
> 							 (s8)info->status.ack_signal;
> -- 
> 2.28.0
> 
> 



From nbd at nbd.name  Sat Sep 26 02:11:17 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Sat, 26 Sep 2020 08:11:17 +0200
Subject: [PATCH v2] mac80211: fix regression in sta connection monitor
In-Reply-To: <FD88F09D-5FEA-4A15-B586-95843830F737@abv.bg>
References: <20200922102434.42727-1-nbd@nbd.name>
 <FD88F09D-5FEA-4A15-B586-95843830F737@abv.bg>
Message-ID: <3762d906-31ff-8386-b9ea-d7b06ea07397@nbd.name>


Hi Georgi,

thanks for testing and for your insight into this issue.

On 2020-09-26 06:41, Georgi Valkov wrote:
> Hi Felix!
> 
> With your latest suggestion, it takes between 10 and 17 hours for the connection to drop, then long five minutes to reconnect.
> Notice the order of code execution in the original code of ieee80211_sta_tx_notify():
> probe_send_count is always cleared when ack is true. But before clearing probe_send_count, we need to check if ieee80211_is_any_nullfunc() returns true and probe_send_count > 0: if yes, we must call ieee80211_queue_work(). You cleared probe_send_count ahead of time, so the condition to run ieee80211_queue_work() will never be met.
The condition in ieee80211_sta_tx_notify may not be met, but
ieee80211_queue_work is called from ieee80211_tx_status_ext in that
case. Any idea why that is not enough?

> To spare your time, I did spend one week to find the cause, then another learning every detail about the code and testing various solutions, including those you proposed. While I do not have experience with mac80211?s design, I?m quite good at preserving the exact behaviour during large scale refactoring. And in my fix I tried changing as little as possible to keep the patch small, preserving both your changes and the original design behaviour.
And the reason I'm still proposing changes to it is because your patch
does not take into account no-skb or 802.3 tx status.
I'll try to make a v3 patch that leaves more of the original code intact
at the cost of a little more duplication.

- Felix


From gvalkov at abv.bg  Sat Sep 26 03:31:42 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Sat, 26 Sep 2020 10:31:42 +0300
Subject: [PATCH v2] mac80211: fix regression in sta connection monitor
In-Reply-To: <3762d906-31ff-8386-b9ea-d7b06ea07397@nbd.name>
References: <20200922102434.42727-1-nbd@nbd.name>
 <FD88F09D-5FEA-4A15-B586-95843830F737@abv.bg>
 <3762d906-31ff-8386-b9ea-d7b06ea07397@nbd.name>
Message-ID: <E4065653-11EF-4E3C-8767-2F9789609026@abv.bg>


> thanks for testing and for your insight into this issue.
I?m happy to help!

> On 2020-09-26 06:41, Georgi Valkov wrote:
>> Hi Felix!
>> 
>> With your latest suggestion, it takes between 10 and 17 hours for the connection to drop, then long five minutes to reconnect.
>> Notice the order of code execution in the original code of ieee80211_sta_tx_notify():
>> probe_send_count is always cleared when ack is true. But before clearing probe_send_count, we need to check if ieee80211_is_any_nullfunc() returns true and probe_send_count > 0: if yes, we must call ieee80211_queue_work(). You cleared probe_send_count ahead of time, so the condition to run ieee80211_queue_work() will never be met.
> The condition in ieee80211_sta_tx_notify may not be met, but
> ieee80211_queue_work is called from ieee80211_tx_status_ext in that
> case. Any idea why that is not enough?

Whenever that condition is met and probe_send_count is reset there, ieee80211_queue_work() is called for sure. Could that be the problem? Because in the original code we also check the result from ieee80211_is_any_nullfunc(). We can also add a trace e.g. printk() to shine some light on the order of events, hopefully without flooding the kernel log too much and without impact on the performance?
You can send me patches directly without committing to master and I will test them.

>> To spare your time, I did spend one week to find the cause, then another learning every detail about the code and testing various solutions, including those you proposed. While I do not have experience with mac80211?s design, I?m quite good at preserving the exact behaviour during large scale refactoring. And in my fix I tried changing as little as possible to keep the patch small, preserving both your changes and the original design behaviour.
> And the reason I'm still proposing changes to it is because your patch
> does not take into account no-skb or 802.3 tx status.
> I'll try to make a v3 patch that leaves more of the original code intact
> at the cost of a little more duplication.
Good point. You are familiar with how it should work, and I only know the changes. You can add the common code into a new function to make it easier to follow.

I?m curious: the original RX code used to call ieee80211_sta_tx_notify(). Do we need to clear probe_send_count or do anything else there? I suppose you removed that because it will be performed later. Either way we should not touch that before the issue is resolved.


Georgi

From a.heider at gmail.com  Sat Sep 26 04:52:52 2020
From: a.heider at gmail.com (Andre Heider)
Date: Sat, 26 Sep 2020 10:52:52 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
Message-ID: <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>

Hi,

On 25/09/2020 11:26, Ansuel Smith wrote:
>>
>> Hi,
>>
>> since last update, ddns-scripts doesn't work any more. The log files contains the following output:
>>
> 
> We changed how the services files is handled... You now need to both
> download the service with the 'ddns' command or install the companion
> package with all the services preinstalled.

but the non existing backwards compatibility sucks though. This move 
breaks every installation relying on a provider which now moved to the 
new package.

And the `ddns` command is basically just a stripped down opkg in sh. It 
just duplicates some required stuff, for what? And if I read that right, 
if one uses that approach, one needs to redo the setup after each image 
update since the dynamically downloaded provider is not gone from the 
filesystem.

I think this needs to be more user friendly and less setup breaking.

Regards,
Andre


From ansuelsmth at gmail.com  Sat Sep 26 06:30:28 2020
From: ansuelsmth at gmail.com (Ansuel Smith)
Date: Sat, 26 Sep 2020 12:30:28 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
Message-ID: <CA+_ehUwmcoui7_KarZ2JOdUc9+VxaNr=27ZUTsAFP5WgfXDSRA@mail.gmail.com>

Il giorno sab 26 set 2020 alle ore 10:52 Andre Heider
<a.heider at gmail.com> ha scritto:
>
> Hi,
>
> On 25/09/2020 11:26, Ansuel Smith wrote:
> >>
> >> Hi,
> >>
> >> since last update, ddns-scripts doesn't work any more. The log files contains the following output:
> >>
> >
> > We changed how the services files is handled... You now need to both
> > download the service with the 'ddns' command or install the companion
> > package with all the services preinstalled.
>
> but the non existing backwards compatibility sucks though. This move
> breaks every installation relying on a provider which now moved to the
> new package.
>
> And the `ddns` command is basically just a stripped down opkg in sh. It
> just duplicates some required stuff, for what? And if I read that right,
> if one uses that approach, one needs to redo the setup after each image
> update since the dynamically downloaded provider is not gone from the
> filesystem.
>
> I think this needs to be more user friendly and less setup breaking.
>
> Regards,
> Andre

Ok one solution would be to add a feature to autodownload the json file
for already created service (if the json is not found)
This change was done to light up the package since 99% of the time you
don't need all the service but just one. We can also set the downloaded
json to be kept across system updates. Thx for pointing this problem..


From eckert.florian at googlemail.com  Sat Sep 26 06:54:27 2020
From: eckert.florian at googlemail.com (Florian Eckert)
Date: Sat, 26 Sep 2020 12:54:27 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
Message-ID: <CALPCC5xp_8sVT14KUtdSp3bjmVED4KcuNE8q0f6AWVwhaDzJbg@mail.gmail.com>

Hello Andre,

thanks for your remarks, but I have to say this is a master branch and
this is *not* a stable branch!
The current implementation is not maintainable so I thought we have to
refactor this package.
If something is changed then something can also be broken.
This is not intended but can happen.

> but the non existing backwards compatibility sucks though. This move
> breaks every installation relying on a provider which now moved to the
> new package.

There will always be new packages and you have to adapt.
The other possibility was to leave the new files in the ddns-scripts package.
This would have increased the size of the package!
Then others would have been upset about the size of the package.
How to do it there is always someone who doesn't like it!

> And the `ddns` command is basically just a stripped down opkg in sh.

Not everyone needs all service providers.
Therefore the possibility to download the providers and not to install
the package.
It is also possible that the service urls change during the life cycle
of the software.
This can be updated by downloading the service files.

> I think this needs to be more user friendly and less setup breaking.

As I said, thanks for the feedback I and Ansual are working on it.

Regards,

Florian


From a.heider at gmail.com  Sat Sep 26 07:01:49 2020
From: a.heider at gmail.com (Andre Heider)
Date: Sat, 26 Sep 2020 13:01:49 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <CA+_ehUwmcoui7_KarZ2JOdUc9+VxaNr=27ZUTsAFP5WgfXDSRA@mail.gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
 <CA+_ehUwmcoui7_KarZ2JOdUc9+VxaNr=27ZUTsAFP5WgfXDSRA@mail.gmail.com>
Message-ID: <dba75d0a-ea6e-d2e8-f033-aebdf45b4fd7@gmail.com>

On 26/09/2020 12:30, Ansuel Smith wrote:
> Il giorno sab 26 set 2020 alle ore 10:52 Andre Heider
> <a.heider at gmail.com> ha scritto:
>>
>> Hi,
>>
>> On 25/09/2020 11:26, Ansuel Smith wrote:
>>>>
>>>> Hi,
>>>>
>>>> since last update, ddns-scripts doesn't work any more. The log files contains the following output:
>>>>
>>>
>>> We changed how the services files is handled... You now need to both
>>> download the service with the 'ddns' command or install the companion
>>> package with all the services preinstalled.
>>
>> but the non existing backwards compatibility sucks though. This move
>> breaks every installation relying on a provider which now moved to the
>> new package.
>>
>> And the `ddns` command is basically just a stripped down opkg in sh. It
>> just duplicates some required stuff, for what? And if I read that right,
>> if one uses that approach, one needs to redo the setup after each image
>> update since the dynamically downloaded provider is not gone from the
>> filesystem.
>>
>> I think this needs to be more user friendly and less setup breaking.
>>
>> Regards,
>> Andre
> 
> Ok one solution would be to add a feature to autodownload the json file
> for already created service (if the json is not found)
> This change was done to light up the package since 99% of the time you
> don't need all the service but just one. We can also set the downloaded
> json to be kept across system updates. Thx for pointing this problem..
> 

Ok, but having a set of quite some providers doesn't have to be bad 
thing. Was this done to just get the number down or because of space 
savings?

Because if it's the latter, it doesn't look like it would save that much:
data.tar.gz, extracted from ddns-scripts_service_2.8.0-24_all.ipk, so 
all 81 providers, is just 4453 bytes. Having all providers on the jffs2 
compressed filesystem probably occupies the similar space?

Regards,
Andre


From eckert.florian at googlemail.com  Sat Sep 26 07:31:05 2020
From: eckert.florian at googlemail.com (Florian Eckert)
Date: Sat, 26 Sep 2020 13:31:05 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <dba75d0a-ea6e-d2e8-f033-aebdf45b4fd7@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
 <CA+_ehUwmcoui7_KarZ2JOdUc9+VxaNr=27ZUTsAFP5WgfXDSRA@mail.gmail.com>
 <dba75d0a-ea6e-d2e8-f033-aebdf45b4fd7@gmail.com>
Message-ID: <CALPCC5xg2OmEPF5v_37ciSOCU7bHWLzUWrFzxVSRNs3JLvCm9A@mail.gmail.com>

> Ok, but having a set of quite some providers doesn't have to be bad
> thing. Was this done to just get the number down or because of space
> savings?

Because of  space saving.

> Because if it's the latter, it doesn't look like it would save that much:
> data.tar.gz, extracted from ddns-scripts_service_2.8.0-24_all.ipk, so
> all 81 providers, is just 4453 bytes. Having all providers on the jffs2
> compressed filesystem probably occupies the similar space?

I have not tried that.
I only saw in my file system that the memory consumption was much
higher due to the change from one file to individual json files.

Regards

Florian


From a.heider at gmail.com  Sat Sep 26 08:48:34 2020
From: a.heider at gmail.com (Andre Heider)
Date: Sat, 26 Sep 2020 14:48:34 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <CALPCC5xp_8sVT14KUtdSp3bjmVED4KcuNE8q0f6AWVwhaDzJbg@mail.gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
 <CALPCC5xp_8sVT14KUtdSp3bjmVED4KcuNE8q0f6AWVwhaDzJbg@mail.gmail.com>
Message-ID: <ea139acb-e85d-4b4b-1623-8be09fa4ab80@gmail.com>

On 26/09/2020 12:54, Florian Eckert wrote:
> Hello Andre,
> 
> thanks for your remarks, but I have to say this is a master branch and
> this is *not* a stable branch!
> The current implementation is not maintainable so I thought we have to
> refactor this package.
> If something is changed then something can also be broken.
> This is not intended but can happen.
> 
>> but the non existing backwards compatibility sucks though. This move
>> breaks every installation relying on a provider which now moved to the
>> new package.
> 
> There will always be new packages and you have to adapt.
> The other possibility was to leave the new files in the ddns-scripts package.
> This would have increased the size of the package!
> Then others would have been upset about the size of the package.
> How to do it there is always someone who doesn't like it!

How about a package for each provider? Then you don't need to whip up 
your own update script, which needs special handling everywhere else. 
Just use the opkg infrastructure like everything else.

If you want to keep backward capability, you could then
* move the main script to a "core" package
* create an "all" package, which just depends on all providers
* make the package of the old name depend on those two

That way, the ddns setup doesn't break for updates.

> 
>> And the `ddns` command is basically just a stripped down opkg in sh.
> 
> Not everyone needs all service providers.
> Therefore the possibility to download the providers and not to install
> the package.
> It is also possible that the service urls change during the life cycle
> of the software.
> This can be updated by downloading the service files.
> 
>> I think this needs to be more user friendly and less setup breaking.
> 
> As I said, thanks for the feedback I and Ansual are working on it.
> 
> Regards,
> 
> Florian
> 



From ansuelsmth at gmail.com  Sat Sep 26 08:53:29 2020
From: ansuelsmth at gmail.com (Ansuel Smith)
Date: Sat, 26 Sep 2020 14:53:29 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <ea139acb-e85d-4b4b-1623-8be09fa4ab80@gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
 <CALPCC5xp_8sVT14KUtdSp3bjmVED4KcuNE8q0f6AWVwhaDzJbg@mail.gmail.com>
 <ea139acb-e85d-4b4b-1623-8be09fa4ab80@gmail.com>
Message-ID: <CA+_ehUwnOcrVKo4agasGpEPXtOt9E+YR0X_okgQcuYaA8NV-9A@mail.gmail.com>

Il giorno sab 26 set 2020 alle ore 14:48 Andre Heider
<a.heider at gmail.com> ha scritto:
>
> On 26/09/2020 12:54, Florian Eckert wrote:
> > Hello Andre,
> >
> > thanks for your remarks, but I have to say this is a master branch and
> > this is *not* a stable branch!
> > The current implementation is not maintainable so I thought we have to
> > refactor this package.
> > If something is changed then something can also be broken.
> > This is not intended but can happen.
> >
> >> but the non existing backwards compatibility sucks though. This move
> >> breaks every installation relying on a provider which now moved to the
> >> new package.
> >
> > There will always be new packages and you have to adapt.
> > The other possibility was to leave the new files in the ddns-scripts package.
> > This would have increased the size of the package!
> > Then others would have been upset about the size of the package.
> > How to do it there is always someone who doesn't like it!
>
> How about a package for each provider? Then you don't need to whip up
> your own update script, which needs special handling everywhere else.
> Just use the opkg infrastructure like everything else.
>
> If you want to keep backward capability, you could then
> * move the main script to a "core" package
> * create an "all" package, which just depends on all providers
> * make the package of the old name depend on those two
>
> That way, the ddns setup doesn't break for updates.
>

This is what we will do (to quickly fix the problem the ddns-script will depend
on the "all" script package. This way we can keep the core and the service file
separate and save compatibility). Creating a package for each service
is massive.
It would mean 73+ new package that just contain a json file.

> >
> >> And the `ddns` command is basically just a stripped down opkg in sh.
> >
> > Not everyone needs all service providers.
> > Therefore the possibility to download the providers and not to install
> > the package.
> > It is also possible that the service urls change during the life cycle
> > of the software.
> > This can be updated by downloading the service files.
> >
> >> I think this needs to be more user friendly and less setup breaking.
> >
> > As I said, thanks for the feedback I and Ansual are working on it.
> >
> > Regards,
> >
> > Florian
> >
>


From nick.lowe at gmail.com  Sat Sep 26 11:06:23 2020
From: nick.lowe at gmail.com (Nick Lowe)
Date: Sat, 26 Sep 2020 16:06:23 +0100
Subject: [PATCH] hostapd: Add cell_density data rates option
Message-ID: <20200926150623.42441-1-nick.lowe@gmail.com>

Add a cell_density option to configure data rates for normal, high and
very high cell density wireless deployments.

The purpose of using a minimum basic/mandatory data rate that is higher
than 6 Mb/s, or 5.5 Mb/s (802.11b compatible), in high cell density
environments is to transmit broadcast/multicast data frames using less
airtime or to reduce management overheads where significant co-channel
interference (CCI) exists and cannot be avoided.

Caution: Without careful design and validation, configuration of a too
high minimum basic/mandatory data rate can sacrifice connection stability
or disrupt the ability to reliably connect and authenticate for little to
no capacity benefit. This is because this configuration affects the
ability of clients to hear and demodulate management, control and
broadcast/multicast data frames.

Deployments that have not been specifically designed and validated are
usually best suited to use 6, 12 and 24 Mb/s as basic/mandatory data
rates.

Only usually seek to configure a 12 Mb/s, or 11 Mb/s (802.11b
compatible), minimum basic/mandatory rate in high cell density
deployments that have been designed and validated for this.

For many deployments, the minimum basic/mandatory data rate should not be
configured above 12 Mb/s to 18 Mb/s, 24 Mb/s or higher. Such a
configuration is only appropriate for use in very high cell density
deployment scenarios.

A cell_density of Very High (3) should only be used where a deployment
has a valid use case and has been designed and validated specifically for
this use, nearly always with highly directional antennas - an example
would be stadium deployments. For example, with a 24 Mb/s OFDM minimum
basic/mandatory data rate, approximately a -73 dBm RSSI is required to
decode frames. Many clients will not have roamed elsewhere by the time
that they experience -73 dBm and, where they do, they frequently may not
hear and be able to demodulate beacon, control or broadcast/multicast
data frames causing connectivity issues.

There is a myth that disabling lower basic/mandatory data rates will
improve roaming and avoid sticky clients. For 802.11n, 802.11ac and
802.11ax clients this is not correct as clients will shift to and use
lower MCS rates and not to the 802.11b or 802.11g/802.11a rates that are
able to be used as basic/mandatory data rates.

There is a myth that disabling lower basic/mandatory data rates will
ensure that clients only use higher data rates and that better
performance is assured. For 802.11n, 802.11ac and 802.11ax clients this
is not correct as clients will shift around and use MCS rates and not the
802.11b or 802.11g/802.11a rates that able to be used as basic/mandatory
data rates.

Cell Density

0 - Disabled (Default)
Setting cell_density to 0 does not configure data rates. This is the
default.

1 - Normal Cell Density
Setting cell_density to 1 configures the basic/mandatory rates to 6, 12
and 24 Mb/s OFDM rates where legacy_rates is 0. Supported rates lower
than the minimum basic/mandatory rate are not offered.
Setting cell_density to 1 configures the basic/mandatory rates to the 5.5
and 11 Mb/s DSSS rates where legacy_rates is 1. Supported rates lower
than the minimum basic/mandatory rate are not offered.

2 - High Cell Density
Setting the cell_density to 2 configures the basic/mandatory rates to the
12 and 24 Mb/s OFDM rates where legacy_rates is 0. Supported rates lower
than the minimum basic/mandatory rate are not offered.
Setting the cell_density to 2 configures the basic/mandatory rates to the
11 Mb/s DSSS rate where legacy_rates is 1. Supported rates lower than the
minimum basic/mandatory rate are not offered.

3 - Very High Cell Density
Setting the cell_density to 3 configures the basic/mandatory rates to the
24 Mb/s OFDM rate where legacy_rates is 0. Supported rates lower than the
minimum basic/mandatory rate are not offered.
Setting the cell_density to 3 only has effect where legacy_rates is 0,
this has the same effect as being configured with a cell_density of 2.

Where specified, the basic_rate and supported_rates options continue to
override both the cell_density and legacy_rates options.

Signed-off-by: Nick Lowe <nick.lowe at gmail.com>
---
 .../network/services/hostapd/files/hostapd.sh | 67 +++++++++++++++----
 1 file changed, 54 insertions(+), 13 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index b33e8e1edc..d2a4ada1ad 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -98,6 +98,7 @@ hostapd_common_add_device_config() {
 	config_add_int local_pwr_constraint
 	config_add_string require_mode
 	config_add_boolean legacy_rates
+	config_add_int cell_density
 
 	config_add_string acs_chan_bias
 	config_add_array hostapd_options
@@ -113,7 +114,7 @@ hostapd_prepare_device_config() {
 	local base_cfg=
 
 	json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
-		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode
+		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density
 
 	hostapd_set_log_options base_cfg
 
@@ -122,8 +123,7 @@ hostapd_prepare_device_config() {
 	set_default doth 1
 	set_default legacy_rates 1
 	set_default airtime_mode 0
-
-	[ "$hwmode" = "b" ] && legacy_rates=1
+	set_default cell_density 0
 
 	[ -n "$country" ] && {
 		append base_cfg "country_code=$country" "$N"
@@ -144,16 +144,57 @@ hostapd_prepare_device_config() {
 	json_get_values rate_list supported_rates
 
 	[ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
-	[ "$legacy_rates" -eq 0 ] && set_default require_mode g
-
-	[ "$hwmode" = "g" ] && {
-		[ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
-		[ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000"
-	}
-
-	case "$require_mode" in
-		n) append base_cfg "require_ht=1" "$N";;
-		ac) append base_cfg "require_vht=1" "$N";;
+	if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then
+		[ -n "$require_mode" ] && legacy_rates=0
+		case "$require_mode" in
+			n) append base_cfg "require_ht=1" "$N";;
+			ac) append base_cfg "require_vht=1" "$N";;
+		esac
+	fi
+	case "$hwmode" in
+		b)
+			if [ "$cell_density" -eq 1 ]; then
+				set_default rate_list "5500 11000"
+				set_default basic_rate_list "5500 11000"
+			elif [ "$cell_density" -ge 2 ]; then
+				set_default rate_list "11000"
+				set_default basic_rate_list "11000"
+			fi
+		;;
+		g)
+			if [ "$cell_density" -eq 1 ]; then
+				if [ "$legacy_rates" -eq 0 ]; then
+					set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
+					set_default basic_rate_list "6000 12000 24000"
+				else
+					set_default rate_list "5500 6000 9000 11000 12000 18000 24000 36000 48000 54000"
+					set_default basic_rate_list "5500 11000"
+				fi
+			elif [ "$cell_density" -eq 2 ] || [ "$legacy_rates" -ne 0 ]; then
+				if [ "$legacy_rates" -eq 0 ]; then
+					set_default rate_list "12000 18000 24000 36000 48000 54000"
+					set_default basic_rate_list "12000 24000"
+				else
+					set_default rate_list "11000 12000 18000 24000 36000 48000 54000"
+					set_default basic_rate_list "11000"
+				fi
+			elif [ "$cell_density" -ge 3 ]; then
+				set_default rate_list "24000 36000 48000 54000"
+				set_default basic_rate_list "24000"
+			fi
+		;;
+		a)
+			if [ "$cell_density" -eq 1 ]; then
+				set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
+				set_default basic_rate_list "6000 12000 24000"
+			elif [ "$cell_density" -eq 2 ]; then
+				set_default rate_list "12000 18000 24000 36000 48000 54000"
+				set_default basic_rate_list "12000 24000"
+			elif [ "$cell_density" -ge 3 ]; then
+				set_default rate_list "24000 36000 48000 54000"
+				set_default basic_rate_list "24000"
+			fi
+		;;
 	esac
 
 	for r in $rate_list; do
-- 
2.27.0



From a.heider at gmail.com  Sat Sep 26 11:33:35 2020
From: a.heider at gmail.com (Andre Heider)
Date: Sat, 26 Sep 2020 17:33:35 +0200
Subject: ddns-scripts is broken since last major update
In-Reply-To: <CA+_ehUwnOcrVKo4agasGpEPXtOt9E+YR0X_okgQcuYaA8NV-9A@mail.gmail.com>
References: <51be54b6-3fb3-2f3f-b930-244019f6048b@gmail.com>
 <CA+_ehUx43A7CDXZUwQL4PEhk+YnUZ+D4+JuyL4=z8NP72aT1cQ@mail.gmail.com>
 <c1d33fc5-68b6-0232-1bd5-80d351c10b24@gmail.com>
 <CALPCC5xp_8sVT14KUtdSp3bjmVED4KcuNE8q0f6AWVwhaDzJbg@mail.gmail.com>
 <ea139acb-e85d-4b4b-1623-8be09fa4ab80@gmail.com>
 <CA+_ehUwnOcrVKo4agasGpEPXtOt9E+YR0X_okgQcuYaA8NV-9A@mail.gmail.com>
Message-ID: <aa09c85d-436c-116b-14b6-ca85d13baa8e@gmail.com>

On 26/09/2020 14:53, Ansuel Smith wrote:
> Il giorno sab 26 set 2020 alle ore 14:48 Andre Heider
> <a.heider at gmail.com> ha scritto:
>>
>> On 26/09/2020 12:54, Florian Eckert wrote:
>>> Hello Andre,
>>>
>>> thanks for your remarks, but I have to say this is a master branch and
>>> this is *not* a stable branch!
>>> The current implementation is not maintainable so I thought we have to
>>> refactor this package.
>>> If something is changed then something can also be broken.
>>> This is not intended but can happen.
>>>
>>>> but the non existing backwards compatibility sucks though. This move
>>>> breaks every installation relying on a provider which now moved to the
>>>> new package.
>>>
>>> There will always be new packages and you have to adapt.
>>> The other possibility was to leave the new files in the ddns-scripts package.
>>> This would have increased the size of the package!
>>> Then others would have been upset about the size of the package.
>>> How to do it there is always someone who doesn't like it!
>>
>> How about a package for each provider? Then you don't need to whip up
>> your own update script, which needs special handling everywhere else.
>> Just use the opkg infrastructure like everything else.
>>
>> If you want to keep backward capability, you could then
>> * move the main script to a "core" package
>> * create an "all" package, which just depends on all providers
>> * make the package of the old name depend on those two
>>
>> That way, the ddns setup doesn't break for updates.
>>
> 
> This is what we will do (to quickly fix the problem the ddns-script will depend
> on the "all" script package. This way we can keep the core and the service file
> separate and save compatibility). Creating a package for each service
> is massive.
> It would mean 73+ new package that just contain a json file.

right, that may be a little too much...

Another though:
It looks like the script downloads providers to the same location as the 
new package installs to. I didn't check, but opkg might not install at 
all or just overwrite those if one installs the package after letting 
the script download providers?

Maybe use another location for those dynamic downloads and add it to 
/lib/upgrade/keep.d/ for sysupgrades?

Thanks!
Andre

> 
>>>
>>>> And the `ddns` command is basically just a stripped down opkg in sh.
>>>
>>> Not everyone needs all service providers.
>>> Therefore the possibility to download the providers and not to install
>>> the package.
>>> It is also possible that the service urls change during the life cycle
>>> of the software.
>>> This can be updated by downloading the service files.
>>>
>>>> I think this needs to be more user friendly and less setup breaking.
>>>
>>> As I said, thanks for the feedback I and Ansual are working on it.
>>>
>>> Regards,
>>>
>>> Florian
>>>
>>



From freifunk at adrianschmutzler.de  Sat Sep 26 12:25:20 2020
From: freifunk at adrianschmutzler.de (Adrian Schmutzler)
Date: Sat, 26 Sep 2020 18:25:20 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
Message-ID: <20200926162520.2751-1-freifunk@adrianschmutzler.de>

Currently, we request LED labels in OpenWrt to follow the scheme

  modelname:color:function

However, specifying the modelname at the beginning is actually
entirely useless for the devices we support in OpenWrt. On the
contrary, having this part actually introduces inconvenience in
several aspects:

  - We need to ensure/check consistency with the DTS compatible
  - We have various exceptions where not the model name is used,
    but the vendor name (like tp-link), which is hard to track
    and justify even for core-developers
  - Having model-based components will not allow to share
    identical LED definitions in DTSI files
  - The inconsistency in what's used for the model part complicates
    several scripts, e.g. board.d/01_leds or LED migrations from
    ar71xx where this was even more messy

Apart from our needs, upstream has deprecated the label property
entirely and introduced new properties to specify color and
function properties separately. However, the implementation does
not appear to be ready and probably won't become ready and/or
match our requirements in the foreseeable future.

However, the limitation of generic LEDs to color and function
properties follows the same idea pointed out above. Generic LEDs
will get names like "green:status" or "red:indicator" then, and
if a "devicename" is prepended, it will be the one of an internal
device, like "phy1:amber:status".

With this patch, we move into the same direction, and just drop
the boardname from the LED labels. This allows to consolidate
a few definitions in DTSI files (will be much more on ramips),
and to drop a few migrations compared to ar71xx that just changed
the boardname. But mainly, it will liberate us from a completely
useless subject to take care of for device support review and
maintenance.
To also drop the boardname from existing configurations, a simple
migration routine is added unconditionally.

Although this seems unfamiliar at first look, a quick check in kernel
for the arm/arm64 dts files revealed that while 1033 lines have
labels with three parts *:*:*, still 284 actually use a two-part
labelling *:*, and thus is also acceptable and not even rare there.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---

This is an RFC, the code is entirely untested.
However, there is nothing particularly complicated about it regarding
the implementation anyway.

---
 .../files/lib/functions/migrations.sh         | 23 ++++++++++++++
 .../ath79/dts/ar1022_iodata_wn-ag300dgr.dts   | 12 ++++----
 .../ath79/dts/ar1022_sitecom_wlr-7100.dts     |  6 ++--
 .../dts/ar7100_mikrotik_routerboard-4xx.dtsi  | 12 ++++----
 .../ath79/dts/ar7161_adtran_bsap1880.dtsi     |  8 ++---
 .../linux/ath79/dts/ar7161_aruba_ap-105.dts   | 12 ++++----
 .../dts/ar7161_buffalo_wzr-hp-ag300h.dtsi     | 16 +++++-----
 .../ath79/dts/ar7161_dlink_dir-825-b1.dts     | 16 +++++-----
 .../linux/ath79/dts/ar7161_jjplus_ja76pf2.dts |  6 ++--
 target/linux/ath79/dts/ar7161_meraki_mr16.dts | 14 ++++-----
 .../linux/ath79/dts/ar7161_netgear_wndr.dtsi  | 16 +++++-----
 .../ath79/dts/ar7161_siemens_ws-ap3610.dts    | 12 ++++----
 .../ath79/dts/ar7161_ubnt_routerstation.dtsi  |  2 +-
 .../ath79/dts/ar7240_buffalo_whr-g301n.dts    | 18 +++++------
 .../ath79/dts/ar7240_dlink_dir-615-e4.dts     | 20 ++++++-------
 .../ath79/dts/ar7240_engenius_enh202-v1.dts   | 12 ++++----
 .../ath79/dts/ar7240_netgear_wnr1000-v2.dts   | 28 ++++++++---------
 .../ath79/dts/ar7240_netgear_wnr612-v2.dtsi   | 10 +++----
 target/linux/ath79/dts/ar7240_tplink.dtsi     |  6 ++--
 .../linux/ath79/dts/ar7240_tplink_tl-wa.dtsi  |  2 +-
 .../linux/ath79/dts/ar7240_tplink_tl-wr.dtsi  | 10 +++----
 .../ath79/dts/ar7241_netgear_wnr2000-v3.dts   | 28 ++++++++---------
 .../ath79/dts/ar7241_netgear_wnr2200.dtsi     | 30 +++++++++----------
 target/linux/ath79/dts/ar7241_tplink.dtsi     |  4 +--
 .../ath79/dts/ar7241_tplink_tl-mr3220-v1.dts  |  2 +-
 .../ath79/dts/ar7241_tplink_tl-mr3420-v1.dts  |  2 +-
 .../ath79/dts/ar7241_tplink_tl-mr3x20.dtsi    |  2 +-
 .../ath79/dts/ar7241_tplink_tl-wr841-v7.dts   |  2 +-
 .../ath79/dts/ar7241_tplink_tl-wr842n-v1.dts  |  8 ++---
 .../linux/ath79/dts/ar7241_ubnt_airrouter.dts |  4 +--
 target/linux/ath79/dts/ar7241_ubnt_unifi.dts  |  4 +--
 .../linux/ath79/dts/ar7242_avm_fritz300e.dts  | 16 +++++-----
 .../ath79/dts/ar7242_buffalo_bhr-4grv.dts     |  2 +-
 .../ath79/dts/ar7242_buffalo_wzr-bhr.dtsi     |  4 +--
 .../dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts  | 14 ++++-----
 .../ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts |  8 ++---
 .../ath79/dts/ar7242_tplink_tl-wr2543-v1.dts  |  8 ++---
 target/linux/ath79/dts/ar7242_ubnt_sw.dtsi    |  2 +-
 .../ath79/dts/ar724x_ubnt_xm_outdoor.dtsi     |  8 ++---
 .../ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts |  6 ++--
 .../dts/ar9132_tplink_tl-wr1043nd-v1.dts      |  8 ++---
 .../ath79/dts/ar9132_tplink_tl-wr941-v2.dts   |  8 ++---
 .../linux/ath79/dts/ar9330_dlink_dir-505.dts  |  4 +--
 .../ath79/dts/ar9330_glinet_gl-ar150.dts      |  6 ++--
 target/linux/ath79/dts/ar9330_pqi_air-pen.dts |  4 +--
 .../ath79/dts/ar9331_8dev_carambola2.dts      |  6 ++--
 .../ath79/dts/ar9331_alfa-network_ap121f.dts  |  6 ++--
 target/linux/ath79/dts/ar9331_arduino_yun.dts |  4 +--
 .../dts/ar9331_embeddedwireless_dorin.dts     |  2 +-
 .../linux/ath79/dts/ar9331_etactica_eg200.dts |  8 ++---
 .../linux/ath79/dts/ar9331_glinet_64xx.dtsi   |  4 +--
 .../linux/ath79/dts/ar9331_glinet_gl-mifi.dts |  8 ++---
 .../linux/ath79/dts/ar9331_pisen_ts-d084.dts  |  2 +-
 .../linux/ath79/dts/ar9331_pisen_wmm003n.dts  |  2 +-
 .../ath79/dts/ar9331_tplink_tl-mr3020-v1.dts  |  8 ++---
 .../ath79/dts/ar9331_tplink_tl-mr3040-v2.dts  |  6 ++--
 .../dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi |  2 +-
 .../ath79/dts/ar9331_tplink_tl-wr710n.dtsi    |  2 +-
 .../dts/ar9331_tplink_tl-wr741nd-v4.dtsi      | 16 +++++-----
 .../dts/ar9341_engenius_ens202ext-v1.dts      | 10 +++----
 target/linux/ath79/dts/ar9341_pcs_cr3000.dts  | 14 ++++-----
 .../linux/ath79/dts/ar9341_pisen_wmb001n.dts  | 12 ++++----
 target/linux/ath79/dts/ar9341_tplink.dtsi     | 16 +++++-----
 .../ath79/dts/ar9341_tplink_tl-mr3420-v2.dts  |  2 +-
 .../ath79/dts/ar9341_tplink_tl-wa850re-v1.dts | 16 +++++-----
 .../ath79/dts/ar9341_tplink_tl-wa860re-v1.dts | 10 +++----
 .../ath79/dts/ar9341_tplink_tl-wa901nd-v3.dts |  8 ++---
 .../ath79/dts/ar9341_tplink_tl-wr842n-v2.dts  |  2 +-
 .../linux/ath79/dts/ar9342_iodata_etg3-r.dts  |  4 +--
 .../ath79/dts/ar9342_ubnt_nanobeam-ac.dts     |  8 ++---
 .../ath79/dts/ar9342_ubnt_nanostation-ac.dts  |  8 ++---
 .../dts/ar9342_ubnt_powerbeam-5ac-gen2.dts    |  8 ++---
 target/linux/ath79/dts/ar9342_ubnt_xw.dtsi    |  8 ++---
 .../ath79/dts/ar9344_aerohive_hiveap-121.dts  |  4 +--
 .../ath79/dts/ar9344_comfast_cf-e120a-v3.dts  | 14 ++++-----
 .../ath79/dts/ar9344_compex_wpj344-16m.dts    | 10 +++----
 .../ath79/dts/ar9344_devolo_magic-2-wifi.dts  |  6 ++--
 .../ath79/dts/ar9344_dlink_dir-825-c1.dts     | 16 +++++-----
 .../ath79/dts/ar9344_dlink_dir-835-a1.dts     | 10 +++----
 .../ath79/dts/ar9344_enterasys_ws-ap3705i.dts | 12 ++++----
 .../ar9344_mikrotik_routerboard-sxt-5n.dtsi   | 14 ++++-----
 .../linux/ath79/dts/ar9344_netgear_wndr.dtsi  | 12 ++++----
 .../ath79/dts/ar9344_netgear_wndr_usb.dtsi    |  2 +-
 .../ath79/dts/ar9344_netgear_wndr_wan.dtsi    |  4 +--
 .../linux/ath79/dts/ar9344_ocedo_raccoon.dts  |  8 ++---
 target/linux/ath79/dts/ar9344_pcs_cap324.dts  | 12 ++++----
 target/linux/ath79/dts/ar9344_pcs_cr5000.dts  |  6 ++--
 target/linux/ath79/dts/ar9344_qihoo_c301.dts  |  4 +--
 .../dts/ar9344_teltonika_rut955-h7v3c0.dts    | 14 ++++-----
 .../ath79/dts/ar9344_teltonika_rut955.dts     | 14 ++++-----
 .../ath79/dts/ar9344_tplink_cpe610-v1.dts     |  4 +--
 .../ath79/dts/ar9344_tplink_cpe610-v2.dts     |  4 +--
 .../ath79/dts/ar9344_tplink_cpe_1port.dtsi    | 10 +++----
 .../ath79/dts/ar9344_tplink_cpe_2port.dtsi    | 12 ++++----
 .../ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts |  2 +-
 .../ath79/dts/ar9344_tplink_tl-wdr4300.dtsi   |  4 +--
 .../ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi   |  8 ++---
 .../ath79/dts/ar9344_ubnt_unifi-ap-pro.dts    |  4 +--
 .../linux/ath79/dts/ar9344_wd_mynet-n750.dts  |  8 ++---
 .../ar9344_wd_mynet-wifi-rangeextender.dts    | 12 ++++----
 .../ath79/dts/ar9344_winchannel_wb2000.dts    |  8 ++---
 .../ath79/dts/ar9344_zbtlink_zbt-wd323.dts    |  6 ++--
 .../ath79/dts/qca9531_comfast_cf-e130n-v2.dts | 14 ++++-----
 .../ath79/dts/qca9531_comfast_cf-e313ac.dts   | 14 ++++-----
 .../ath79/dts/qca9531_comfast_cf-e314n-v2.dts | 14 ++++-----
 .../linux/ath79/dts/qca9531_comfast_cf-e5.dts | 12 ++++----
 .../ath79/dts/qca9531_comfast_cf-e560ac.dts   | 14 ++++-----
 .../ath79/dts/qca9531_comfast_cf-ew72.dts     |  6 ++--
 .../dts/qca9531_comfast_cf-wr752ac-v1.dts     |  6 ++--
 .../ath79/dts/qca9531_compex_wpj531-16m.dts   |  8 ++---
 .../ath79/dts/qca9531_dlink_dch-g020-a1.dts   |  8 ++---
 .../ath79/dts/qca9531_engenius_ews511ap.dts   | 10 +++----
 .../dts/qca9531_glinet_gl-ar300m-lite.dts     |  8 ++---
 .../ath79/dts/qca9531_glinet_gl-ar300m.dtsi   |  8 ++---
 .../ath79/dts/qca9531_glinet_gl-ar750.dts     |  6 ++--
 .../ath79/dts/qca9531_glinet_gl-x750.dts      | 10 +++----
 target/linux/ath79/dts/qca9531_telco_t1.dts   | 12 ++++----
 .../dts/qca9531_tplink_archer-d50-v1.dts      | 16 +++++-----
 .../ath79/dts/qca9531_tplink_tl-mr3420-v3.dts | 20 ++++++-------
 .../ath79/dts/qca9531_tplink_tl-mr6400-v1.dts | 12 ++++----
 .../dts/qca9531_tplink_tl-wr902ac-v1.dts      | 12 ++++----
 .../linux/ath79/dts/qca9531_yuncore_a770.dts  |  8 ++---
 .../ath79/dts/qca9533_comfast_cf-e110n-v2.dts | 14 ++++-----
 .../ath79/dts/qca9533_dlink_dap-13xx.dtsi     | 12 ++++----
 .../qca9533_mikrotik_routerboard-lhg-hb.dtsi  | 16 +++++-----
 .../ath79/dts/qca9533_tplink_cpe210.dtsi      |  2 +-
 .../ath79/dts/qca9533_tplink_cpe220-v3.dts    |  4 +--
 .../ath79/dts/qca9533_tplink_cpexxx.dtsi      |  8 ++---
 .../ath79/dts/qca9533_tplink_tl-wa801nd.dtsi  | 10 +++----
 .../dts/qca9533_tplink_tl-wa850re-v2.dts      | 16 +++++-----
 .../ath79/dts/qca9533_tplink_tl-wr802n.dtsi   |  2 +-
 .../dts/qca9533_tplink_tl-wr841-v11.dtsi      |  4 +--
 .../ath79/dts/qca9533_tplink_tl-wr841.dtsi    | 14 ++++-----
 .../ath79/dts/qca9533_tplink_tl-wr842n-v3.dts | 20 ++++++-------
 .../ath79/dts/qca953x_tplink_tl-wr810n.dtsi   |  2 +-
 .../ath79/dts/qca9556_avm_fritz1750e.dts      | 16 +++++-----
 .../linux/ath79/dts/qca9556_avm_fritz450e.dts | 12 ++++----
 .../linux/ath79/dts/qca9556_avm_fritzdvbc.dts | 16 +++++-----
 .../ath79/dts/qca9557_buffalo_bhr-4grv2.dts   |  8 ++---
 .../ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi   | 10 +++----
 .../ath79/dts/qca9557_iodata_wn-ac1167dgr.dts |  2 +-
 .../ath79/dts/qca9557_iodata_wn-ac1600dgr.dts |  2 +-
 .../dts/qca9557_iodata_wn-ac1600dgr2.dts      |  2 +-
 .../linux/ath79/dts/qca9557_zyxel_nbg6616.dts | 12 ++++----
 .../dts/qca9558_allnet_all-wap02860ac.dts     |  8 ++---
 .../dts/qca9558_comfast_cf-wr650ac-v1.dts     | 26 ----------------
 .../dts/qca9558_comfast_cf-wr650ac-v2.dts     | 26 ----------------
 .../ath79/dts/qca9558_comfast_cf-wr650ac.dtsi | 26 ++++++++++++++++
 .../ath79/dts/qca9558_devolo_dvl1200e.dts     |  4 +--
 .../ath79/dts/qca9558_devolo_dvl1200i.dts     |  4 +--
 .../ath79/dts/qca9558_devolo_dvl1750c.dts     |  4 +--
 .../ath79/dts/qca9558_devolo_dvl1750e.dts     |  4 +--
 .../ath79/dts/qca9558_devolo_dvl1750i.dts     |  4 +--
 .../ath79/dts/qca9558_devolo_dvl1750x.dts     |  4 +--
 .../ath79/dts/qca9558_dlink_dap-2695-a1.dts   |  6 ++--
 .../ath79/dts/qca9558_domywifi_dw33d.dts      | 10 +++----
 .../ath79/dts/qca9558_engenius_ecb1750.dts    |  8 ++---
 .../ath79/dts/qca9558_engenius_epg5000.dts    | 10 +++----
 .../qca9558_librerouter_librerouter-v1.dts    |  6 ++--
 ..._mikrotik_routerboard-921gs-5hpacd-15s.dts |  2 +-
 ...58_mikrotik_routerboard-922uags-5hpacd.dts |  2 +-
 .../dts/qca9558_mikrotik_routerboard-92x.dtsi |  2 +-
 .../ath79/dts/qca9558_netgear_ex7300.dtsi     | 18 +++++------
 .../linux/ath79/dts/qca9558_ocedo_koala.dts   |  8 ++---
 .../linux/ath79/dts/qca9558_ocedo_ursus.dts   |  4 +--
 .../ath79/dts/qca9558_openmesh_om5p-ac-v2.dts |  8 ++---
 .../ath79/dts/qca9558_sitecom_wlr-8100.dts    |  8 ++---
 .../ath79/dts/qca9558_tplink_archer-c.dtsi    | 10 +++----
 .../ath79/dts/qca9558_tplink_archer-c5-v1.dts |  2 +-
 .../ath79/dts/qca9558_tplink_archer-c7-v1.dts |  2 +-
 .../ath79/dts/qca9558_tplink_archer-c7-v2.dts |  2 +-
 .../ath79/dts/qca9558_tplink_archer-d7.dtsi   | 10 +++----
 .../ath79/dts/qca9558_tplink_re350k-v1.dts    | 10 +++----
 .../linux/ath79/dts/qca9558_tplink_rex5x.dtsi | 14 ++++-----
 .../dts/qca9558_tplink_tl-wdr4900-v2.dts      | 12 ++++----
 .../ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi |  8 ++---
 .../dts/qca9558_tplink_tl-wr941n-v7-cn.dts    |  6 ++--
 .../ath79/dts/qca9558_trendnet_tew-823dru.dts |  8 ++---
 .../linux/ath79/dts/qca9558_zyxel_nbg6716.dts | 14 ++++-----
 .../linux/ath79/dts/qca9561_avm_fritz4020.dts | 12 ++++----
 .../dts/qca9561_tplink_archer-c25-v1.dts      | 20 ++++++-------
 .../dts/qca9561_tplink_archer-c59-v1.dts      |  2 +-
 .../dts/qca9561_tplink_archer-c59-v2.dts      |  2 +-
 .../ath79/dts/qca9561_tplink_archer-c5x.dtsi  | 14 ++++-----
 .../dts/qca9561_tplink_archer-c60-v1.dts      |  4 +--
 .../dts/qca9561_tplink_archer-c60-v2.dts      |  4 +--
 .../dts/qca9561_tplink_archer-c60-v3.dts      |  2 +-
 .../ath79/dts/qca9561_tplink_archer-c6x.dtsi  | 10 +++----
 .../dts/qca9561_tplink_eap225-wall-v2.dts     |  2 +-
 .../ath79/dts/qca9561_xiaomi_mi-router-4q.dts |  6 ++--
 .../linux/ath79/dts/qca9563_compex_wpj563.dts |  8 ++---
 .../ath79/dts/qca9563_dlink_dir-842-c.dtsi    | 27 +++++++++++++++++
 .../ath79/dts/qca9563_dlink_dir-842-c1.dts    | 27 -----------------
 .../ath79/dts/qca9563_dlink_dir-842-c2.dts    | 27 -----------------
 .../ath79/dts/qca9563_dlink_dir-842-c3.dts    | 27 -----------------
 .../ath79/dts/qca9563_dlink_dir-859-a1.dts    |  8 ++---
 .../dts/qca9563_elecom_wrc-1750ghbk2-i.dts    |  6 ++--
 .../dts/qca9563_elecom_wrc-300ghbk2-i.dts     |  4 +--
 .../ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi |  2 +-
 .../ath79/dts/qca9563_glinet_gl-ar750s.dtsi   |  6 ++--
 .../linux/ath79/dts/qca9563_nec_wg1200cr.dts  |  4 +--
 .../linux/ath79/dts/qca9563_nec_wg800hp.dts   | 16 +++++-----
 .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 14 ++++-----
 .../ath79/dts/qca9563_netgear_wndr4300-v2.dts |  2 +-
 .../ath79/dts/qca9563_netgear_wndr4500-v3.dts |  4 +--
 .../linux/ath79/dts/qca9563_phicomm_k2t.dts   |  6 ++--
 .../ath79/dts/qca9563_rosinson_wr818.dts      |  4 +--
 .../ath79/dts/qca9563_tplink_archer-c2-v3.dts | 20 ++++++-------
 .../dts/qca9563_tplink_archer-c6-v2-us.dts    | 14 ++++-----
 .../ath79/dts/qca9563_tplink_archer-c6-v2.dts | 14 ++++-----
 .../ath79/dts/qca9563_tplink_archer-c7-v4.dts | 24 +++++++--------
 .../dts/qca9563_tplink_archer-x7-v5.dtsi      | 22 +++++++-------
 .../ath79/dts/qca9563_tplink_eap245-v3.dts    |  4 +--
 .../linux/ath79/dts/qca9563_tplink_re450.dtsi | 14 ++++-----
 .../ath79/dts/qca9563_tplink_tl-wpa8630.dtsi  |  8 ++---
 .../ath79/dts/qca9563_tplink_tl-wr1043n.dtsi  | 18 +++++------
 .../dts/qca9563_tplink_tl-wr1043nd-v4.dts     |  2 +-
 .../linux/ath79/dts/qca9563_ubnt_unifiac.dtsi |  4 +--
 .../linux/ath79/dts/qca9563_yuncore_a782.dts  |  4 +--
 .../ath79/dts/qca9563_yuncore_xd4200.dts      |  4 +--
 .../ath79/dts/tp9343_tplink_tl-wa901nd.dtsi   |  8 ++---
 .../ath79/dts/tp9343_tplink_tl-wr940n-v3.dtsi | 18 +++++------
 .../ath79/dts/tp9343_tplink_tl-wr940n-v4.dts  | 18 +++++------
 .../ath79/dts/tp9343_tplink_tl-wr940n-v6.dts  |  4 +--
 .../etc/uci-defaults/04_led_migration         | 29 ++----------------
 .../etc/uci-defaults/04_led_migration         |  6 ++--
 .../etc/uci-defaults/04_led_migration         | 13 ++++++++
 .../etc/uci-defaults/04_led_migration         |  6 ++--
 228 files changed, 1031 insertions(+), 1106 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration

diff --git a/package/base-files/files/lib/functions/migrations.sh b/package/base-files/files/lib/functions/migrations.sh
index b180a0242f..f7039a4e1d 100644
--- a/package/base-files/files/lib/functions/migrations.sh
+++ b/package/base-files/files/lib/functions/migrations.sh
@@ -28,11 +28,34 @@ migrate_led_sysfs() {
 	done;
 }
 
+remove_board_led_sysfs() {
+	local cfg="$1"
+	local sysfs
+	local name
+	local new_sysfs
+
+	config_get sysfs ${cfg} sysfs
+	config_get name ${cfg} name
+
+	echo "${sysfs}" | grep -q ":.*:" || return
+
+	new_sysfs=$(echo ${sysfs} | sed "s/^[^:]*://")
+
+	uci set system.${cfg}.sysfs="${new_sysfs}"
+
+	logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}"
+}
+
 migrate_leds() {
 	config_load system
 	config_foreach migrate_led_sysfs led "$@"
 }
 
+remove_board_leds() {
+	config_load system
+	config_foreach remove_board_led_sysfs led
+}
+
 migrations_apply() {
 	local realm="$1"
 	[ -n "$(uci changes ${realm})" ] && uci -q commit ${realm}
diff --git a/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts b/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
index 89ddf12998..f0d262c847 100644
--- a/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
+++ b/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
@@ -20,34 +20,34 @@
 		compatible = "gpio-leds";
 
 		led_router: router {
-			label = "wn-ag300dgr:green:router";
+			label = "green:router";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		children {
-			label = "wn-ag300dgr:green:children";
+			label = "green:children";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		eco {
-			label = "wn-ag300dgr:green:eco";
+			label = "green:eco";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		notification {
-			label = "wn-ag300dgr:amber:notification";
+			label = "amber:notification";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "wn-ag300dgr:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g {
-			label = "wn-ag300dgr:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
index bc20d70eed..787b516056 100644
--- a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
+++ b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
@@ -36,18 +36,18 @@
 		compatible = "gpio-leds";
 
 		ops {
-			label = "wlr-7100:white:ops";
+			label = "white:ops";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power: power {
-			label = "wlr-7100:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "wlr-7100:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi b/target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi
index 733479ff4e..e34c304b47 100644
--- a/target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi
+++ b/target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi
@@ -16,33 +16,33 @@
 		compatible = "gpio-leds";
 
 		led_user: user {
-			label = "mikrotik:yellow:user";
+			label = "yellow:user";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		led1 {
-			label = "mikrotik:green:led1";
+			label = "green:led1";
 			gpios = <&cpld_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led2 {
-			label = "mikrotik:green:led2";
+			label = "green:led2";
 			gpios = <&cpld_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		led3 {
-			label = "mikrotik:green:led3";
+			label = "green:led3";
 			gpios = <&cpld_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		led4 {
-			label = "mikrotik:green:led4";
+			label = "green:led4";
 			gpios = <&cpld_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		led5 {
-			label = "mikrotik:green:led5";
+			label = "green:led5";
 			gpios = <&cpld_gpio 8 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_adtran_bsap1880.dtsi b/target/linux/ath79/dts/ar7161_adtran_bsap1880.dtsi
index 17e42d7ba0..344241a322 100644
--- a/target/linux/ath79/dts/ar7161_adtran_bsap1880.dtsi
+++ b/target/linux/ath79/dts/ar7161_adtran_bsap1880.dtsi
@@ -21,24 +21,24 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "bluesocket:green:wifi5g";
+			label = "green:wifi5g";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan2g {
-			label = "bluesocket:green:wifi2g";
+			label = "green:wifi2g";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_status_green: status_green {
-			label = "bluesocket:green:status";
+			label = "green:status";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		led_status_yellow: status_yellow {
-			label = "bluesocket:yellow:status";
+			label = "yellow:status";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_aruba_ap-105.dts b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts
index d7f1a0711f..65c0be073b 100644
--- a/target/linux/ath79/dts/ar7161_aruba_ap-105.dts
+++ b/target/linux/ath79/dts/ar7161_aruba_ap-105.dts
@@ -32,23 +32,23 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "ap-105:green:power";
+			label = "green:power";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_red: power_red {
-			label = "ap-105:red:power";
+			label = "red:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			panic-indicator;
 		};
 
 		wifi_2g_red {
-			label = "ap-105:red:wlan2g";
+			label = "red:wlan2g";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi_5g_red {
-			label = "ap-105:red:wlan5g";
+			label = "red:wlan5g";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -57,13 +57,13 @@
 		compatible = "gpio-leds";
 
 		wifi_2g_green {
-			label = "ap-105:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi_5g_green {
-			label = "ap-105:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
index 1a509d864e..053c91557b 100644
--- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
+++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi
@@ -23,7 +23,7 @@
 		compatible = "gpio-leds";
 
 		led_diag: diag {
-			label = "buffalo:red:diag";
+			label = "red:diag";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -32,41 +32,41 @@
 		compatible = "gpio-leds";
 
 		band2g_a {
-			label = "buffalo:amber:band2g";
+			label = "amber:band2g";
 			gpios = <&ath9k0 1 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "buffalo:green:usb";
+			label = "green:usb";
 			gpios = <&ath9k0 3 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&usb_ohci_port>, <&usb_ehci_port>;
 			linux,default-trigger = "usbport";
 		};
 
 		band2g_g {
-			label = "buffalo:green:band2g";
+			label = "green:band2g";
 			gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		band5g_g {
-			label = "buffalo:green:band5g";
+			label = "green:band5g";
 			gpios = <&ath9k1 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		router {
-			label = "buffalo:green:router";
+			label = "green:router";
 			gpios = <&ath9k1 3 GPIO_ACTIVE_LOW>;
 		};
 
 		movie_engine {
-			label = "buffalo:blue:movie_engine";
+			label = "blue:movie_engine";
 			gpios = <&ath9k1 4 GPIO_ACTIVE_LOW>;
 		};
 
 		band5g_a {
-			label = "buffalo:amber:band5g";
+			label = "amber:band5g";
 			gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
index c67b94b117..85fd54b396 100644
--- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
+++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
@@ -27,35 +27,35 @@
 		compatible = "gpio-leds";
 
 		usb {
-			label = "d-link:blue:usb";
+			label = "blue:usb";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&usb_ohci_port>, <&usb_ehci_port>;
 			linux,default-trigger = "usbport";
 		};
 
 		led_power_orange: power_orange {
-			label = "d-link:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_power_blue: power_blue {
-			label = "d-link:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "d-link:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		planet_orange {
-			label = "d-link:orange:planet";
+			label = "orange:planet";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		planet_blue {
-			label = "d-link:blue:planet";
+			label = "blue:planet";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -64,13 +64,13 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "d-link:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g {
-			label = "d-link:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts
index abcecd0406..8a27452eb8 100644
--- a/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts
+++ b/target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts
@@ -36,17 +36,17 @@
 		compatible = "gpio-leds";
 
 		led_d2: d2 {
-			label = "ja76pf2:green:d2";
+			label = "green:d2";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		d3 {
-			label = "ja76pf2:green:d3";
+			label = "green:d3";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		d4 {
-			label = "ja76pf2:green:d4";
+			label = "green:d4";
 			gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_meraki_mr16.dts b/target/linux/ath79/dts/ar7161_meraki_mr16.dts
index fa7e607288..afc49ce865 100644
--- a/target/linux/ath79/dts/ar7161_meraki_mr16.dts
+++ b/target/linux/ath79/dts/ar7161_meraki_mr16.dts
@@ -27,38 +27,38 @@
 		compatible = "gpio-leds";
 
 		wifi1 {
-			label = "mr16:green:wifi1";
+			label = "green:wifi1";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi2 {
-			label = "mr16:green:wifi2";
+			label = "green:wifi2";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi3 {
-			label = "mr16:green:wifi3";
+			label = "green:wifi3";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi4 {
-			label = "mr16:green:wifi4";
+			label = "green:wifi4";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "mr16:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_orange: power_orange {
-			label = "mr16:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 			panic-indicator;
 		};
 
 		led_power_green: power_green {
-			label = "mr16:green:power";
+			label = "green:power";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi b/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi
index db47126623..9e41b61357 100644
--- a/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi
+++ b/target/linux/ath79/dts/ar7161_netgear_wndr.dtsi
@@ -25,7 +25,7 @@
 		compatible = "reset-leds";
 
 		usb_led {
-			label = "netgear:green:usb";
+			label = "green:usb";
 			resets = <&rst 12>;
 			trigger-sources = <&usb_ohci_port>, <&usb_ehci_port>;
 			linux,default-trigger = "usbport";
@@ -36,28 +36,28 @@
 		compatible = "gpio-leds";
 
 		wps {
-			label = "netgear:orange:wps";
+			label = "orange:wps";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_orange: power_orange {
-			label = "netgear:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_green {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -66,12 +66,12 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "netgear:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 		wlan5g {
-			label = "netgear:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts b/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts
index 22ae58929c..3c1d97f25e 100644
--- a/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts
+++ b/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts
@@ -28,34 +28,34 @@
 		compatible = "gpio-leds";
 
 		led_power_green: led_power_green {
-			label = "ws-ap3610:green:power";
+			label = "green:power";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_red: led_power_red {
-			label = "ws-ap3610:red:power";
+			label = "red:power";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wlan5_blue {
-			label = "ws-ap3610:blue:wlan5";
+			label = "blue:wlan5";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_wlan5_green {
-			label = "ws-ap3610:green:wlan5";
+			label = "green:wlan5";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wlan2_blue {
-			label = "ws-ap3610:blue:wlan2";
+			label = "blue:wlan2";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		led_wlan2_green {
-			label = "ws-ap3610:green:wlan2";
+			label = "green:wlan2";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
index 16407128ab..cd0e5015a9 100644
--- a/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
+++ b/target/linux/ath79/dts/ar7161_ubnt_routerstation.dtsi
@@ -24,7 +24,7 @@
 		compatible = "gpio-leds";
 
 		led_rf: rf_green {
-			label = "ubnt:green:rf";
+			label = "green:rf";
 			gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7240_buffalo_whr-g301n.dts b/target/linux/ath79/dts/ar7240_buffalo_whr-g301n.dts
index 576f84d88c..e93c5ca652 100644
--- a/target/linux/ath79/dts/ar7240_buffalo_whr-g301n.dts
+++ b/target/linux/ath79/dts/ar7240_buffalo_whr-g301n.dts
@@ -55,42 +55,42 @@
 		pinctrl-0 = <&switch_led_pins>;
 
 		security {
-			label = "whr-g301n:orange:security";
+			label = "orange:security";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led_diag: diag {
-			label = "whr-g301n:red:diag";
+			label = "red:diag";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		router {
-			label = "whr-g301n:green:router";
+			label = "green:router";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "whr-g301n:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "whr-g301n:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "whr-g301n:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "whr-g301n:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "whr-g301n:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -99,7 +99,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "whr-g301n:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts b/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts
index 511216838c..b632d3b8a8 100644
--- a/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts
+++ b/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts
@@ -40,47 +40,47 @@
 		pinctrl-0 = <&switch_led_pins>;
 
 		led_power_green: power_green {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_power_amber: power_amber {
-			label = "d-link:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		wps {
-			label = "d-link:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "d-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "d-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "d-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "d-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "d-link:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
 
 		wan_green {
-			label = "d-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -89,7 +89,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "d-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts b/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts
index d8f98ba6c0..4752ad1edd 100644
--- a/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts
+++ b/target/linux/ath79/dts/ar7240_engenius_enh202-v1.dts
@@ -34,27 +34,27 @@
 		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
 
 		rssilow {
-			label = "enh202-v1:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimedium {
-			label = "enh202-v1:amber:rssimedium";
+			label = "amber:rssimedium";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "enh202-v1:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "enh202-v1:amber:lan";
+			label = "amber:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "enh202-v1:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -63,7 +63,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "enh202-v1:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_netgear_wnr1000-v2.dts b/target/linux/ath79/dts/ar7240_netgear_wnr1000-v2.dts
index ec0001b867..d67af04d1c 100644
--- a/target/linux/ath79/dts/ar7240_netgear_wnr1000-v2.dts
+++ b/target/linux/ath79/dts/ar7240_netgear_wnr1000-v2.dts
@@ -54,63 +54,63 @@
 		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wan_green {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "netgear:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_green {
-			label = "netgear:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_amber {
-			label = "netgear:amber:lan1";
+			label = "amber:lan1";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_green {
-			label = "netgear:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_amber {
-			label = "netgear:amber:lan2";
+			label = "amber:lan2";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_green {
-			label = "netgear:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_amber {
-			label = "netgear:amber:lan3";
+			label = "amber:lan3";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_green {
-			label = "netgear:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_amber {
-			label = "netgear:amber:lan4";
+			label = "amber:lan4";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -119,12 +119,12 @@
 		compatible = "gpio-leds";
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&ath9k 5 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan_blue {
-			label = "netgear:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
index f3d06b5fd5..44dbe9c55e 100644
--- a/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
+++ b/target/linux/ath79/dts/ar7240_netgear_wnr612-v2.dtsi
@@ -33,22 +33,22 @@
 		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
 
 		led_power: power {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "netgear:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "netgear:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -57,7 +57,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "netgear:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_tplink.dtsi b/target/linux/ath79/dts/ar7240_tplink.dtsi
index 7e54cd46b1..23d12e4edf 100644
--- a/target/linux/ath79/dts/ar7240_tplink.dtsi
+++ b/target/linux/ath79/dts/ar7240_tplink.dtsi
@@ -39,12 +39,12 @@
 		pinctrl-0 = <&pinmux_switch_led_pins>;
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -53,7 +53,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi b/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi
index 7ec0469dcd..e0ac582f9d 100644
--- a/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi
+++ b/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi
@@ -4,7 +4,7 @@
 
 &leds {
 	lan {
-		label = "tp-link:green:lan";
+		label = "green:lan";
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/ar7240_tplink_tl-wr.dtsi b/target/linux/ath79/dts/ar7240_tplink_tl-wr.dtsi
index 5ceada8375..bd6caacdf6 100644
--- a/target/linux/ath79/dts/ar7240_tplink_tl-wr.dtsi
+++ b/target/linux/ath79/dts/ar7240_tplink_tl-wr.dtsi
@@ -4,27 +4,27 @@
 
 &leds {
 	lan1 {
-		label = "tp-link:green:lan1";
+		label = "green:lan1";
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 	};
 
 	lan2 {
-		label = "tp-link:green:lan2";
+		label = "green:lan2";
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 	};
 
 	lan3 {
-		label = "tp-link:green:lan3";
+		label = "green:lan3";
 		gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 	};
 
 	lan4 {
-		label = "tp-link:green:lan4";
+		label = "green:lan4";
 		gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 	};
 
 	wan {
-		label = "tp-link:green:wan";
+		label = "green:wan";
 		gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/ar7241_netgear_wnr2000-v3.dts b/target/linux/ath79/dts/ar7241_netgear_wnr2000-v3.dts
index 1b303711a8..1b124f3f2e 100644
--- a/target/linux/ath79/dts/ar7241_netgear_wnr2000-v3.dts
+++ b/target/linux/ath79/dts/ar7241_netgear_wnr2000-v3.dts
@@ -57,57 +57,57 @@
 		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
 
 		wan_green {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "netgear:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_green {
-			label = "netgear:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_amber {
-			label = "netgear:amber:lan1";
+			label = "amber:lan1";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_green {
-			label = "netgear:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_amber {
-			label = "netgear:amber:lan2";
+			label = "amber:lan2";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_green {
-			label = "netgear:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_amber {
-			label = "netgear:amber:lan3";
+			label = "amber:lan3";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_green {
-			label = "netgear:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_amber {
-			label = "netgear:amber:lan4";
+			label = "amber:lan4";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -116,18 +116,18 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&ath9k 3 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&ath9k 2 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wlan_blue {
-			label = "netgear:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_netgear_wnr2200.dtsi b/target/linux/ath79/dts/ar7241_netgear_wnr2200.dtsi
index ec4dd871cc..62614166db 100644
--- a/target/linux/ath79/dts/ar7241_netgear_wnr2200.dtsi
+++ b/target/linux/ath79/dts/ar7241_netgear_wnr2200.dtsi
@@ -51,62 +51,62 @@
 		pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins &clks_disable_pins>;
 
 		wan_green {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "netgear:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_green {
-			label = "netgear:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1_amber {
-			label = "netgear:amber:lan1";
+			label = "amber:lan1";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_green {
-			label = "netgear:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2_amber {
-			label = "netgear:amber:lan2";
+			label = "amber:lan2";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_green {
-			label = "netgear:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3_amber {
-			label = "netgear:amber:lan3";
+			label = "amber:lan3";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_green {
-			label = "netgear:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4_amber {
-			label = "netgear:amber:lan4";
+			label = "amber:lan4";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		usb_green {
-			label = "netgear:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
@@ -117,18 +117,18 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&ath9k 2 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wlan_blue {
-			label = "netgear:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_tplink.dtsi b/target/linux/ath79/dts/ar7241_tplink.dtsi
index 3cbedc3bf8..62884f0902 100644
--- a/target/linux/ath79/dts/ar7241_tplink.dtsi
+++ b/target/linux/ath79/dts/ar7241_tplink.dtsi
@@ -36,12 +36,12 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-mr3220-v1.dts b/target/linux/ath79/dts/ar7241_tplink_tl-mr3220-v1.dts
index 9d0f34924f..af8e297b1d 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-mr3220-v1.dts
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-mr3220-v1.dts
@@ -10,7 +10,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-mr3420-v1.dts b/target/linux/ath79/dts/ar7241_tplink_tl-mr3420-v1.dts
index e39f2ee3f9..cae2f5477d 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-mr3420-v1.dts
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-mr3420-v1.dts
@@ -10,7 +10,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
index 9d4f3f2027..218ea5e429 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi
@@ -17,7 +17,7 @@
 
 &leds {
 	led3g {
-		label = "tp-link:green:3g";
+		label = "green:3g";
 		gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-wr841-v7.dts b/target/linux/ath79/dts/ar7241_tplink_tl-wr841-v7.dts
index cc138cd59f..17e06dfac7 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-wr841-v7.dts
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-wr841-v7.dts
@@ -10,7 +10,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
index c02154a902..b0f6c3695a 100644
--- a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
+++ b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts
@@ -39,17 +39,17 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led3g {
-			label = "tp-link:green:3g";
+			label = "green:3g";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
@@ -60,7 +60,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
index db192cd30b..fcc66c018c 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
@@ -19,12 +19,12 @@
 		compatible = "gpio-leds";
 
 		led_globe: globe {
-			label = "ubnt:green:globe";
+			label = "green:globe";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		power {
-			label = "ubnt:green:power";
+			label = "green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
index 963c241d81..c4c0235f7b 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts
@@ -37,12 +37,12 @@
 		compatible = "gpio-leds";
 
 		led_dome_green: dome_green {
-			label = "ubnt:green:dome";
+			label = "green:dome";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		dome_orange {
-			label = "ubnt:orange:dome";
+			label = "orange:dome";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts
index c4af52a76a..3a002aaedf 100644
--- a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts
+++ b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts
@@ -32,18 +32,18 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "fritz300e:green:power";
+			label = "green:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		lan {
-			label = "fritz300e:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "fritz300e:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
@@ -53,27 +53,27 @@
 		compatible = "gpio-leds";
 
 		rssi0 {
-			label = "fritz300e:green:rssi0";
+			label = "green:rssi0";
 			gpios = <&ath9k 10 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "fritz300e:green:rssi1";
+			label = "green:rssi1";
 			gpios = <&ath9k 4 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "fritz300e:green:rssi2";
+			label = "green:rssi2";
 			gpios = <&ath9k 6 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi3 {
-			label = "fritz300e:green:rssi3";
+			label = "green:rssi3";
 			gpios = <&ath9k 7 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi4 {
-			label = "fritz300e:green:rssi4";
+			label = "green:rssi4";
 			gpios = <&ath9k 5 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts b/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts
index 46d7e0f331..3b2dc0ecfc 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts
+++ b/target/linux/ath79/dts/ar7242_buffalo_bhr-4grv.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	sec_vpn {
-		label = "buffalo:orange:vpn";
+		label = "orange:vpn";
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
index 89e77224ca..2840f91ec1 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi
@@ -40,12 +40,12 @@
 		compatible = "gpio-leds";
 
 		led_diag: diag {
-			label = "buffalo:red:diag";
+			label = "red:diag";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "buffalo:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
index 1a3aec00fa..f035f86c7c 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts
@@ -66,7 +66,7 @@
 		compatible = "gpio-leds";
 
 		led_diag: diag {
-			label = "buffalo:red:diag";
+			label = "red:diag";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -75,35 +75,35 @@
 		compatible = "gpio-leds";
 
 		usb {
-			label = "buffalo:blue:usb";
+			label = "blue:usb";
 			gpios = <&ath9k 4 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
 		};
 
 		wireless {
-			label = "buffalo:green:wireless";
+			label = "green:wireless";
 			gpios = <&ath9k 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		security {
-			label = "buffalo:orange:security";
+			label = "orange:security";
 			gpios = <&ath9k 6 GPIO_ACTIVE_LOW>;
 		};
 
 		router {
-			label = "buffalo:green:router";
+			label = "green:router";
 			gpios = <&ath9k 7 GPIO_ACTIVE_LOW>;
 		};
 
 		movie_engine_on {
-			label = "buffalo:blue:movie_engine_on";
+			label = "blue:movie_engine_on";
 			gpios = <&ath9k 8 GPIO_ACTIVE_LOW>;
 		};
 
 		movie_engine_off {
-			label = "buffalo:blue:movie_engine_off";
+			label = "blue:movie_engine_off";
 			gpios = <&ath9k 9 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts
index 8bf89e4ecd..4f186c2c11 100644
--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts
+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts
@@ -14,17 +14,17 @@
 		compatible = "gpio-leds";
 
 		led_movie_engine {
-			label = "buffalo:blue:movie_engine";
+			label = "blue:movie_engine";
 			gpios = <&ath9k 13 GPIO_ACTIVE_LOW>;
 		};
 
 		router {
-			label = "buffalo:green:router";
+			label = "green:router";
 			gpios = <&ath9k 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wireless {
-			label = "buffalo:green:wireless";
+			label = "green:wireless";
 			gpios = <&ath9k 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
@@ -58,7 +58,7 @@
 
 &leds {
 	sec_vpn {
-		label = "buffalo:orange:security";
+		label = "orange:security";
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts
index 0ac10a56f9..dd4cbf03eb 100644
--- a/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts
+++ b/target/linux/ath79/dts/ar7242_tplink_tl-wr2543-v1.dts
@@ -49,12 +49,12 @@
 		compatible = "gpio-leds";
 
 		led_wps: wps {
-			label = "tplink:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "tplink:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
@@ -65,13 +65,13 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "tplink:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g {
-			label = "tplink:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar7242_ubnt_sw.dtsi b/target/linux/ath79/dts/ar7242_ubnt_sw.dtsi
index 43b24dae5a..52e83ea8d0 100644
--- a/target/linux/ath79/dts/ar7242_ubnt_sw.dtsi
+++ b/target/linux/ath79/dts/ar7242_ubnt_sw.dtsi
@@ -24,7 +24,7 @@
 		compatible = "gpio-leds";
 
 		led_usr: usr {
-			label = "ubnt:yellow:usr";
+			label = "yellow:usr";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
index a28f8fbcd4..eab08d1d74 100644
--- a/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
+++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
@@ -11,22 +11,22 @@
 		compatible = "gpio-leds";
 
 		link1 {
-			label = "ubnt:red:link1";
+			label = "red:link1";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		link2 {
-			label = "ubnt:orange:link2";
+			label = "orange:link2";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		link3 {
-			label = "ubnt:green:link3";
+			label = "green:link3";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_link4: link4 {
-			label = "ubnt:green:link4";
+			label = "green:link4";
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts
index 662ffa2e5c..c8697d193d 100644
--- a/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts
+++ b/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts
@@ -45,17 +45,17 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts
index 3ff992a841..e17303a0fb 100644
--- a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts
+++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts
@@ -45,25 +45,25 @@
 		compatible = "gpio-leds";
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
 		};
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "heartbeat";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts
index a35dbc2d1a..ad517d8baf 100644
--- a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts
+++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts
@@ -39,22 +39,22 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		qss_r {
-			label = "tp-link:red:qss";
+			label = "red:qss";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		qss_g {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9330_dlink_dir-505.dts b/target/linux/ath79/dts/ar9330_dlink_dir-505.dts
index b0d68fb35f..15e29f552e 100644
--- a/target/linux/ath79/dts/ar9330_dlink_dir-505.dts
+++ b/target/linux/ath79/dts/ar9330_dlink_dir-505.dts
@@ -39,12 +39,12 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		led_power_green: power {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
 
 		led_status_red: status {
-			label = "d-link:red:status";
+			label = "red:status";
 			gpios = <&gpio 26 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts
index 389c6d1e4b..26b3b3f04c 100644
--- a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts
+++ b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts
@@ -22,18 +22,18 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "gl-ar150:orange:wlan";
+			label = "orange:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		configurable {
-			label = "gl-ar150:green:configurable";
+			label = "green:configurable";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_power: power {
-			label = "gl-ar150:green:power";
+			label = "green:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/dts/ar9330_pqi_air-pen.dts b/target/linux/ath79/dts/ar9330_pqi_air-pen.dts
index a551a4a4f4..7d04b01377 100644
--- a/target/linux/ath79/dts/ar9330_pqi_air-pen.dts
+++ b/target/linux/ath79/dts/ar9330_pqi_air-pen.dts
@@ -20,13 +20,13 @@
 		compatible = "gpio-leds";
 
 		led_wlan: wlan {
-			label = "air-pen:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps {
-			label = "air-pen:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_8dev_carambola2.dts b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts
index de6d9f85d7..85e70495fc 100644
--- a/target/linux/ath79/dts/ar9331_8dev_carambola2.dts
+++ b/target/linux/ath79/dts/ar9331_8dev_carambola2.dts
@@ -18,18 +18,18 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "carambola2:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		eth0 {
-			label = "carambola2:orange:eth0";
+			label = "orange:eth0";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		eth1 {
-			label = "carambola2:orange:eth1";
+			label = "orange:eth1";
 			gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts b/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts
index 53c2af3b19..d005bf0dc4 100644
--- a/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts
+++ b/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts
@@ -37,17 +37,17 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "ap121f:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		led_vpn: vpn {
-			label = "ap121f:green:vpn";
+			label = "green:vpn";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "ap121f:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9331_arduino_yun.dts b/target/linux/ath79/dts/ar9331_arduino_yun.dts
index e00a8c638e..8ce5beb059 100644
--- a/target/linux/ath79/dts/ar9331_arduino_yun.dts
+++ b/target/linux/ath79/dts/ar9331_arduino_yun.dts
@@ -53,13 +53,13 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "yun:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		usb {
-			label = "yun:white:usb";
+			label = "white:usb";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 			trigger-sources = <&hub_port1>;
 			linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
index d0f9f9b724..9303121408 100644
--- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
+++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
@@ -21,7 +21,7 @@
 		compatible = "gpio-leds";
 
 		led_status: status {
-			label = "dorin:green:status";
+			label = "green:status";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_etactica_eg200.dts b/target/linux/ath79/dts/ar9331_etactica_eg200.dts
index 9df6de1685..0d7b7cfb84 100644
--- a/target/linux/ath79/dts/ar9331_etactica_eg200.dts
+++ b/target/linux/ath79/dts/ar9331_etactica_eg200.dts
@@ -31,22 +31,22 @@
 		pinctrl-0 = <&switch_led_disable_pins>;
 
 		modbus {
-			label = "eg200:red:modbus";
+			label = "red:modbus";
 			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_etactica: etactica {
-			label = "eg200:red:etactica";
+			label = "red:etactica";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 
 		eth0 {
-			label = "eg200:red:eth0";
+			label = "red:eth0";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "eg200:red:wlan";
+			label = "red:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9331_glinet_64xx.dtsi b/target/linux/ath79/dts/ar9331_glinet_64xx.dtsi
index c96aaa2222..8cdc9ac4ca 100644
--- a/target/linux/ath79/dts/ar9331_glinet_64xx.dtsi
+++ b/target/linux/ath79/dts/ar9331_glinet_64xx.dtsi
@@ -26,13 +26,13 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "gl-inet:red:wlan";
+			label = "red:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "gl-inet:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts b/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts
index ead81adc55..d62bdd9d67 100644
--- a/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts
+++ b/target/linux/ath79/dts/ar9331_glinet_gl-mifi.dts
@@ -18,23 +18,23 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "gl-mifi:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "gl-mifi:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
 		};
 
 		wan {
-			label = "gl-mifi:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
 		};
 
 		3g4g {
-			label = "gl-mifi:green:3g4g";
+			label = "green:3g4g";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_pisen_ts-d084.dts b/target/linux/ath79/dts/ar9331_pisen_ts-d084.dts
index 40ebcccd2b..8632011de3 100644
--- a/target/linux/ath79/dts/ar9331_pisen_ts-d084.dts
+++ b/target/linux/ath79/dts/ar9331_pisen_ts-d084.dts
@@ -33,7 +33,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "ts-d084:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts
index 812b5b0ec7..cdc92f697d 100644
--- a/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts
+++ b/target/linux/ath79/dts/ar9331_pisen_wmm003n.dts
@@ -32,7 +32,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "pisen:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts
index 5ea2569fed..7c52ae1617 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts
@@ -22,23 +22,23 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wps: wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 26 GPIO_ACTIVE_LOW>;
 		};
 
 		led3g {
-			label = "tp-link:green:3g";
+			label = "green:3g";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts
index 2c8dddbe5e..da04aad6cb 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts
@@ -23,18 +23,18 @@
 		pinctrl-0 = <&switch_led_disable_pins>;
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 26 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_lan: lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		led3g {
-			label = "tp-link:green:3g";
+			label = "green:3g";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
index 236609d958..4ea658713d 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
@@ -30,7 +30,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tl-wr703n:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi
index b8a4fe96b5..db43484112 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr710n.dtsi
@@ -30,7 +30,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tl-wr710n:green:system";
+			label = "green:system";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi
index ed120b4776..c1d88f4812 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi
@@ -43,42 +43,42 @@
 		pinctrl-0 = <&switch_led_disable_pins>;
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts b/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts
index 354e276f7b..da1e59d4c3 100644
--- a/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts
+++ b/target/linux/ath79/dts/ar9341_engenius_ens202ext-v1.dts
@@ -32,29 +32,29 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "ens202ext-v1:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan {
-			label = "ens202ext-v1:amber:wlan";
+			label = "amber:wlan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		rssilow {
-			label = "ens202ext-v1:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimedium {
-			label = "ens202ext-v1:amber:rssimedium";
+			label = "amber:rssimedium";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		rssihigh {
-			label = "ens202ext-v1:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts
index d3fd4f114b..7eafd1acd4 100644
--- a/target/linux/ath79/dts/ar9341_pcs_cr3000.dts
+++ b/target/linux/ath79/dts/ar9341_pcs_cr3000.dts
@@ -42,39 +42,39 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "pcs:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "pcs:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan {
-			label = "pcs:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "pcs:blue:lan1";
+			label = "blue:lan1";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "pcs:blue:lan2";
+			label = "blue:lan2";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "pcs:blue:lan3";
+			label = "blue:lan3";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "pcs:blue:lan4";
+			label = "blue:lan4";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts
index 685afa5b74..7057c3b1ad 100644
--- a/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts
+++ b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts
@@ -64,32 +64,32 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		volume1 {
-			label = "wmb001n:blue:volume1";
+			label = "blue:volume1";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		volume2 {
-			label = "wmb001n:blue:volume2";
+			label = "blue:volume2";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		volume3 {
-			label = "wmb001n:blue:volume3";
+			label = "blue:volume3";
 			gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
 		};
 
 		volume4 {
-			label = "wmb001n:blue:volume4";
+			label = "blue:volume4";
 			gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
 		};
 
 		volume5 {
-			label = "wmb001n:blue:volume5";
+			label = "blue:volume5";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_wifi: wifi {
-			label = "wmb001n:blue:wifi";
+			label = "blue:wifi";
 			gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_tplink.dtsi b/target/linux/ath79/dts/ar9341_tplink.dtsi
index dc97b103a4..f229a1917e 100644
--- a/target/linux/ath79/dts/ar9341_tplink.dtsi
+++ b/target/linux/ath79/dts/ar9341_tplink.dtsi
@@ -19,44 +19,44 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-mr3420-v2.dts b/target/linux/ath79/dts/ar9341_tplink_tl-mr3420-v2.dts
index 460277c077..750522ded1 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-mr3420-v2.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-mr3420-v2.dts
@@ -27,7 +27,7 @@
 
 &leds {
 	usb {
-		label = "tp-link:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wa850re-v1.dts b/target/linux/ath79/dts/ar9341_tplink_tl-wa850re-v1.dts
index b3de436e92..12755aea2f 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-wa850re-v1.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wa850re-v1.dts
@@ -35,43 +35,43 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "tp-link:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_re: re {
-			label = "tp-link:blue:re";
+			label = "blue:re";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		signal1 {
-			label = "tp-link:blue:signal1";
+			label = "blue:signal1";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		signal2 {
-			label = "tp-link:blue:signal2";
+			label = "blue:signal2";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		signal3 {
-			label = "tp-link:blue:signal3";
+			label = "blue:signal3";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		signal4 {
-			label = "tp-link:blue:signal4";
+			label = "blue:signal4";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		signal5 {
-			label = "tp-link:blue:signal5";
+			label = "blue:signal5";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wa860re-v1.dts b/target/linux/ath79/dts/ar9341_tplink_tl-wa860re-v1.dts
index 36abbb1c31..9f540f82d9 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-wa860re-v1.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wa860re-v1.dts
@@ -42,29 +42,29 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_green: power_green {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_power_orange: power_orange {
-			label = "tp-link:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan_green {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan_orange {
-			label = "tp-link:orange:wlan";
+			label = "orange:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wa901nd-v3.dts b/target/linux/ath79/dts/ar9341_tplink_tl-wa901nd-v3.dts
index 420d03861f..4a4e51f4b8 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-wa901nd-v3.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wa901nd-v3.dts
@@ -28,23 +28,23 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
index 0932fe9da2..cb6b25e664 100644
--- a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts
@@ -37,7 +37,7 @@
 
 &leds {
 	usb {
-		label = "tp-link:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts b/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts
index bd088a39cf..58845f4cb6 100644
--- a/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts
+++ b/target/linux/ath79/dts/ar9342_iodata_etg3-r.dts
@@ -20,13 +20,13 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "etg3-r:green:power";
+			label = "green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		notification {
-			label = "etg3-r:green:notification";
+			label = "green:notification";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts
index 38cd058134..6f6e4c6bb6 100644
--- a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts
+++ b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-ac.dts
@@ -16,22 +16,22 @@
 		compatible = "gpio-leds";
 
 		rssi0 {
-			label = "ubnt:blue:rssi0";
+			label = "blue:rssi0";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "ubnt:blue:rssi1";
+			label = "blue:rssi1";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "ubnt:blue:rssi2";
+			label = "blue:rssi2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssi3: rssi3 {
-			label = "ubnt:blue:rssi3";
+			label = "blue:rssi3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanostation-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_nanostation-ac.dts
index 4fcb7cd139..6114650ac5 100644
--- a/target/linux/ath79/dts/ar9342_ubnt_nanostation-ac.dts
+++ b/target/linux/ath79/dts/ar9342_ubnt_nanostation-ac.dts
@@ -16,22 +16,22 @@
 		compatible = "gpio-leds";
 
 		rssi0 {
-			label = "ubnt:blue:rssi0";
+			label = "blue:rssi0";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "ubnt:blue:rssi1";
+			label = "blue:rssi1";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "ubnt:blue:rssi2";
+			label = "blue:rssi2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssi3: rssi3 {
-			label = "ubnt:blue:rssi3";
+			label = "blue:rssi3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_powerbeam-5ac-gen2.dts b/target/linux/ath79/dts/ar9342_ubnt_powerbeam-5ac-gen2.dts
index 68b608a017..7e4b9cd415 100644
--- a/target/linux/ath79/dts/ar9342_ubnt_powerbeam-5ac-gen2.dts
+++ b/target/linux/ath79/dts/ar9342_ubnt_powerbeam-5ac-gen2.dts
@@ -16,22 +16,22 @@
 		compatible = "gpio-leds";
 
 		rssi0 {
-			label = "ubnt:blue:rssi0";
+			label = "blue:rssi0";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "ubnt:blue:rssi1";
+			label = "blue:rssi1";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "ubnt:blue:rssi2";
+			label = "blue:rssi2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssi3: rssi3 {
-			label = "ubnt:blue:rssi3";
+			label = "blue:rssi3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
index a0012a7461..ff4e177ca8 100644
--- a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
+++ b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
@@ -21,22 +21,22 @@
 		compatible = "gpio-leds";
 
 		link1 {
-			label = "ubnt:red:link1";
+			label = "red:link1";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		link2 {
-			label = "ubnt:orange:link2";
+			label = "orange:link2";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		link3 {
-			label = "ubnt:green:link3";
+			label = "green:link3";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_link4: link4 {
-			label = "ubnt:green:link4";
+			label = "green:link4";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_aerohive_hiveap-121.dts b/target/linux/ath79/dts/ar9344_aerohive_hiveap-121.dts
index c3ac486471..aed25e2f67 100644
--- a/target/linux/ath79/dts/ar9344_aerohive_hiveap-121.dts
+++ b/target/linux/ath79/dts/ar9344_aerohive_hiveap-121.dts
@@ -36,12 +36,12 @@
 		compatible = "gpio-leds";
 
 		led_power_orange: power_orange {
-			label = "hiveap-121:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_white: power_white {
-			label = "hiveap-121:white:power";
+			label = "white:power";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_comfast_cf-e120a-v3.dts b/target/linux/ath79/dts/ar9344_comfast_cf-e120a-v3.dts
index 0bbde9ebfd..95f798cc0f 100644
--- a/target/linux/ath79/dts/ar9344_comfast_cf-e120a-v3.dts
+++ b/target/linux/ath79/dts/ar9344_comfast_cf-e120a-v3.dts
@@ -24,38 +24,38 @@
 		pinctrl-0 = <&led_rssimediumhigh_pin>;
 
 		wan {
-			label = "cf-e120a-v3:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "cf-e120a-v3:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "cf-e120a-v3:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		rssilow {
-			label = "cf-e120a-v3:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "cf-e120a-v3:red:rssimediumlow";
+			label = "red:rssimediumlow";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "cf-e120a-v3:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "cf-e120a-v3:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_compex_wpj344-16m.dts b/target/linux/ath79/dts/ar9344_compex_wpj344-16m.dts
index c2dfa6ba2d..a6a4811053 100644
--- a/target/linux/ath79/dts/ar9344_compex_wpj344-16m.dts
+++ b/target/linux/ath79/dts/ar9344_compex_wpj344-16m.dts
@@ -21,27 +21,27 @@
 		compatible = "gpio-leds";
 
 		led_status: status {
-			label = "wpj344:green:status";
+			label = "green:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		sig1 {
-			label = "wpj344:red:sig1";
+			label = "red:sig1";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		sig2 {
-			label = "wpj344:yellow:sig2";
+			label = "yellow:sig2";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		sig3 {
-			label = "wpj344:green:sig3";
+			label = "green:sig3";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		sig4 {
-			label = "wpj344:green:sig4";
+			label = "green:sig4";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts b/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts
index 59ec9451fc..a35c177b3c 100644
--- a/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts
+++ b/target/linux/ath79/dts/ar9344_devolo_magic-2-wifi.dts
@@ -20,18 +20,18 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "devolo:white:wlan";
+			label = "white:wlan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		led_dlan_white: dlan_white {
-			label = "devolo:white:dlan";
+			label = "white:dlan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_dlan_red: dlan_red {
-			label = "devolo:red:dlan";
+			label = "red:dlan";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 			panic-indicator;
 		};
diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-825-c1.dts b/target/linux/ath79/dts/ar9344_dlink_dir-825-c1.dts
index 2c242a1b0a..bd4c58f3c9 100644
--- a/target/linux/ath79/dts/ar9344_dlink_dir-825-c1.dts
+++ b/target/linux/ath79/dts/ar9344_dlink_dir-825-c1.dts
@@ -21,40 +21,40 @@
 		pinctrl-0 = <&enable_gpio_11>;
 
 		led_power_blue: power_blue {
-			label = "d-link:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "d-link:blue:usb";
+			label = "blue:usb";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port1>;
 		};
 
 		wan_blue {
-			label = "d-link:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "d-link:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps {
-			label = "d-link:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_orange: power_orange {
-			label = "d-link:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_orange {
-			label = "d-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -63,7 +63,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "d-link:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-835-a1.dts b/target/linux/ath79/dts/ar9344_dlink_dir-835-a1.dts
index 17c58073d5..189945848d 100644
--- a/target/linux/ath79/dts/ar9344_dlink_dir-835-a1.dts
+++ b/target/linux/ath79/dts/ar9344_dlink_dir-835-a1.dts
@@ -18,27 +18,27 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_green {
-			label = "d-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "d-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_orange: power_orange {
-			label = "d-link:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_orange {
-			label = "d-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts b/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
index 35d6c55b59..26e98f8711 100644
--- a/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
+++ b/target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
@@ -45,27 +45,27 @@
 		pinctrl-0 = <&enable_gpio_11 &enable_gpio_16>;
 
 		led_power_green: power_green {
-			label = "ws-ap3705i:green:power";
+			label = "green:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_red: power_red {
-			label = "ws-ap3705i:red:power";
+			label = "red:power";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan_blue {
-			label = "ws-ap3705i:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan_green {
-			label = "ws-ap3705i:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
 		};
 
 		radio2 {
-			label = "ws-ap3705i:green:radio2";
+			label = "green:radio2";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
@@ -75,7 +75,7 @@
 		compatible = "gpio-leds";
 
 		radio1 {
-			label = "ws-ap3705i:green:radio1";
+			label = "green:radio1";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
index e95ffc787a..789069632b 100644
--- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
+++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
@@ -21,38 +21,38 @@
 		compatible = "gpio-leds";
 
 		power {
-			label = "mikrotik:green:power";
+			label = "green:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		rssilow {
-			label = "mikrotik:green:rssilow";
+			label = "green:rssilow";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "mikrotik:green:rssimediumlow";
+			label = "green:rssimediumlow";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimedium {
-			label = "mikrotik:green:rssimedium";
+			label = "green:rssimedium";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "mikrotik:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		rssihigh {
-			label = "mikrotik:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		led_user: user {
-			label = "mikrotik:green:user";
+			label = "green:user";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi b/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi
index ad9caa690e..92b0beccd7 100644
--- a/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi
+++ b/target/linux/ath79/dts/ar9344_netgear_wndr.dtsi
@@ -47,35 +47,35 @@
 		pinctrl-0 = <&enable_gpio_11>;
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wlan2g_green {
-			label = "netgear:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g_blue {
-			label = "netgear:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_amber {
-			label = "netgear:amber:wps";
+			label = "amber:wps";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_netgear_wndr_usb.dtsi b/target/linux/ath79/dts/ar9344_netgear_wndr_usb.dtsi
index e3780632e9..0ca3b761bf 100644
--- a/target/linux/ath79/dts/ar9344_netgear_wndr_usb.dtsi
+++ b/target/linux/ath79/dts/ar9344_netgear_wndr_usb.dtsi
@@ -2,7 +2,7 @@
 
 &leds {
 	usb_green {
-		label = "netgear:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9344_netgear_wndr_wan.dtsi b/target/linux/ath79/dts/ar9344_netgear_wndr_wan.dtsi
index 91c2971f8c..da6020769f 100644
--- a/target/linux/ath79/dts/ar9344_netgear_wndr_wan.dtsi
+++ b/target/linux/ath79/dts/ar9344_netgear_wndr_wan.dtsi
@@ -2,12 +2,12 @@
 
 &leds {
 	wan_green {
-		label = "netgear:green:wan";
+		label = "green:wan";
 		gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 	};
 
 	wan_amber {
-		label = "netgear:amber:wan";
+		label = "amber:wan";
 		gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
index 428f35cd2f..443f0c6724 100644
--- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
+++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts
@@ -24,19 +24,19 @@
 		compatible = "gpio-leds";
 
 		power {
-			label = "raccoon:green:power";
+			label = "green:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "raccoon:yellow:wlan24";
+			label = "yellow:wlan24";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_system: system {
-			label = "raccoon:blue:sys";
+			label = "blue:sys";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -45,7 +45,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "raccoon:red:wlan5";
+			label = "red:wlan5";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_pcs_cap324.dts b/target/linux/ath79/dts/ar9344_pcs_cap324.dts
index 27f750baba..0d20475459 100644
--- a/target/linux/ath79/dts/ar9344_pcs_cap324.dts
+++ b/target/linux/ath79/dts/ar9344_pcs_cap324.dts
@@ -35,35 +35,35 @@
 		compatible = "gpio-leds";
 
 		led_power_amber: power_amber {
-			label = "pcs:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_green: power_green {
-			label = "pcs:green:power";
+			label = "green:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan_amber {
-			label = "pcs:amber:wlan";
+			label = "amber:wlan";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan_green {
-			label = "pcs:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan_amber {
-			label = "pcs:lan:amber";
+			label = "lan:amber";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan_green {
-			label = "pcs:lan:green";
+			label = "lan:green";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts
index 9886c3dee5..3ab1cb34b3 100644
--- a/target/linux/ath79/dts/ar9344_pcs_cr5000.dts
+++ b/target/linux/ath79/dts/ar9344_pcs_cr5000.dts
@@ -42,20 +42,20 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "pcs:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>,
 				<&gpio 4 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "pcs:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps_white {
-			label = "pcs:white:wps";
+			label = "white:wps";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts
index 9d1cd52440..dff2644b11 100644
--- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts
+++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts
@@ -21,12 +21,12 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		led_wlan_g: wlan_g {
-			label = "c301:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wlan_o: wlan_o {
-			label = "c301:orange:wlan";
+			label = "orange:wlan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts b/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts
index 7a5bda64c5..f61f2bf628 100644
--- a/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts
+++ b/target/linux/ath79/dts/ar9344_teltonika_rut955-h7v3c0.dts
@@ -18,37 +18,37 @@
 		compatible = "gpio-leds";
 
 		signal0 {
-			label = "rut955:green:signal0";
+			label = "green:signal0";
 			gpios = <&gpio_ext 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal1 {
-			label = "rut955:green:signal1";
+			label = "green:signal1";
 			gpios = <&gpio_ext 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal2 {
-			label = "rut955:green:signal2";
+			label = "green:signal2";
 			gpios = <&gpio_ext 2 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal3 {
-			label = "rut955:green:signal3";
+			label = "green:signal3";
 			gpios = <&gpio_ext 3 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal4 {
-			label = "rut955:green:signal4";
+			label = "green:signal4";
 			gpios = <&gpio_ext 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_system_red: system_red {
-			label = "rut955:red:system";
+			label = "red:system";
 			gpios = <&gpio_ext 5 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_system_green: system_green {
-			label = "rut955:green:system";
+			label = "green:system";
 			gpios = <&gpio_ext 6 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/dts/ar9344_teltonika_rut955.dts b/target/linux/ath79/dts/ar9344_teltonika_rut955.dts
index b158d8709a..98ad19cdeb 100644
--- a/target/linux/ath79/dts/ar9344_teltonika_rut955.dts
+++ b/target/linux/ath79/dts/ar9344_teltonika_rut955.dts
@@ -17,37 +17,37 @@
 		compatible = "gpio-leds";
 
 		signal0 {
-			label = "rut955:green:signal0";
+			label = "green:signal0";
 			gpios = <&gpio_ext 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal1 {
-			label = "rut955:green:signal1";
+			label = "green:signal1";
 			gpios = <&gpio_ext 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal2 {
-			label = "rut955:green:signal2";
+			label = "green:signal2";
 			gpios = <&gpio_ext 2 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal3 {
-			label = "rut955:green:signal3";
+			label = "green:signal3";
 			gpios = <&gpio_ext 3 GPIO_ACTIVE_HIGH>;
 		};
 
 		signal4 {
-			label = "rut955:green:signal4";
+			label = "green:signal4";
 			gpios = <&gpio_ext 4 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_system_red: system_red {
-			label = "rut955:red:system";
+			label = "red:system";
 			gpios = <&gpio_ext 5 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_system_green: system_green {
-			label = "rut955:green:system";
+			label = "green:system";
 			gpios = <&gpio_ext 6 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe610-v1.dts b/target/linux/ath79/dts/ar9344_tplink_cpe610-v1.dts
index 3b89b77412..c495eb298c 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe610-v1.dts
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe610-v1.dts
@@ -16,12 +16,12 @@
 		compatible = "gpio-leds";
 
 		led_lan: lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe610-v2.dts b/target/linux/ath79/dts/ar9344_tplink_cpe610-v2.dts
index 346c2aa19f..fa533d9f50 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe610-v2.dts
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe610-v2.dts
@@ -16,12 +16,12 @@
 		compatible = "gpio-leds";
 
 		led_lan: lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe_1port.dtsi b/target/linux/ath79/dts/ar9344_tplink_cpe_1port.dtsi
index be29d944b2..a1dca81093 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe_1port.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe_1port.dtsi
@@ -14,27 +14,27 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		link1 {
-			label = "tp-link:green:link1";
+			label = "green:link1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		link2 {
-			label = "tp-link:green:link2";
+			label = "green:link2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		link3 {
-			label = "tp-link:green:link3";
+			label = "green:link3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_system: link4 {
-			label = "tp-link:green:link4";
+			label = "green:link4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe_2port.dtsi b/target/linux/ath79/dts/ar9344_tplink_cpe_2port.dtsi
index 089114f21b..1fce869160 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe_2port.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe_2port.dtsi
@@ -14,32 +14,32 @@
 		compatible = "gpio-leds";
 
 		lan0 {
-			label = "tp-link:green:lan0";
+			label = "green:lan0";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		link1 {
-			label = "tp-link:green:link1";
+			label = "green:link1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		link2 {
-			label = "tp-link:green:link2";
+			label = "green:link2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		link3 {
-			label = "tp-link:green:link3";
+			label = "green:link3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_link4: link4 {
-			label = "tp-link:green:link4";
+			label = "green:link4";
 		};
 	};
 };
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
index af992249f6..59a06346ae 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
@@ -13,7 +13,7 @@
 
 &leds {
 	usb {
-		label = "tp-link:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		linux,default-trigger = "usbport";
 		trigger-sources = <&hub_port>;
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
index fd9f2b48ca..21fd079e1a 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
@@ -38,14 +38,14 @@
 
 &leds {
 	usb1 {
-		label = "tp-link:green:usb1";
+		label = "green:usb1";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port1>;
 		linux,default-trigger = "usbport";
 	};
 
 	usb2 {
-		label = "tp-link:green:usb2";
+		label = "green:usb2";
 		gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port2>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
index 68d79a6745..e7430988ad 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
@@ -17,19 +17,19 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -38,7 +38,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts b/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts
index c0b0f0bd41..da3b0c63aa 100644
--- a/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts
+++ b/target/linux/ath79/dts/ar9344_ubnt_unifi-ap-pro.dts
@@ -21,12 +21,12 @@
 		compatible = "gpio-leds";
 
 		led_white: led-white {
-			label = "ubnt:white:dome";
+			label = "white:dome";
 			gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_blue: led-blue {
-			label = "ubnt:blue:dome";
+			label = "blue:dome";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts b/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts
index 00ae776f04..c440d71721 100644
--- a/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts
+++ b/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts
@@ -24,22 +24,22 @@
 		compatible = "gpio-leds";
 
 		wifi {
-			label = "mynet-n750:blue:wireless";
+			label = "blue:wireless";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		};
 
 		internet {
-			label = "mynet-n750:blue:internet";
+			label = "blue:internet";
 			gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
 		};
 
 		wps {
-			label = "mynet-n750:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_power: power {
-			label = "mynet-n750:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts
index 77e0a0b20f..6bacee4b4d 100644
--- a/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts
+++ b/target/linux/ath79/dts/ar9344_wd_mynet-wifi-rangeextender.dts
@@ -24,34 +24,34 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "mynet-wifi-rangeextender:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 			/* LED has no off state. It's either on or it blinks */
 		};
 
 		lan {
-			label = "mynet-wifi-rangeextender:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi {
-			label = "mynet-wifi-rangeextender:blue:wifi";
+			label = "blue:wifi";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi-rssi-low {
-			label = "mynet-wifi-rangeextender:blue:rssi-low";
+			label = "blue:rssi-low";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi-rssi-med {
-			label = "mynet-wifi-rangeextender:blue:rssi-med";
+			label = "blue:rssi-med";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi-rssi-max {
-			label = "mynet-wifi-rangeextender:blue:rssi-max";
+			label = "blue:rssi-max";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/ar9344_winchannel_wb2000.dts b/target/linux/ath79/dts/ar9344_winchannel_wb2000.dts
index c897b23015..cd2e389ccd 100644
--- a/target/linux/ath79/dts/ar9344_winchannel_wb2000.dts
+++ b/target/linux/ath79/dts/ar9344_winchannel_wb2000.dts
@@ -38,20 +38,20 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "wb2000:green:2g";
+			label = "green:2g";
 			gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		usb {
-			label = "wb2000:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
 			trigger-sources = <&hub_port1>, <&hub_port2>;
 			linux,default-trigger = "usbport";
 		};
 
 		led_system: system {
-			label = "wb2000:green:system";
+			label = "green:system";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
@@ -71,7 +71,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "wb2000:green:5g";
+			label = "green:5g";
 			gpios = <&ath9k 6 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts
index 58780a0417..fd587c5da0 100644
--- a/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts
+++ b/target/linux/ath79/dts/ar9344_zbtlink_zbt-wd323.dts
@@ -48,18 +48,18 @@
 		pinctrl-0 = <&enable_gpio20_gpio22>;
 
 		wifi {
-			label = "zbt-wd323:green:wifi";
+			label = "green:wifi";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan1 {
-			label = "zbt-wd323:orange:lan1";
+			label = "orange:lan1";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "zbt-wd323:orange:lan2";
+			label = "orange:lan2";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts
index ac1df6bf68..749acedcda 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-e130n-v2.dts
@@ -23,38 +23,38 @@
 		pinctrl-names = "default";
 
 		wlan {
-			label = "cf-e130n-v2:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "cf-e130n-v2:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		unused {
-			label = "cf-e130n-v2:green:unused";
+			label = "green:unused";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "cf-e130n-v2:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "cf-e130n-v2:red:rssimediumlow";
+			label = "red:rssimediumlow";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "cf-e130n-v2:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "cf-e130n-v2:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts
index a7c2571fda..7e2ff5d0ee 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts
@@ -22,38 +22,38 @@
 		pinctrl-names = "default";
 
 		wlan {
-			label = "cf-e313ac:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "cf-e313ac:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "cf-e313ac:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "cf-e313ac:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "cf-e313ac:red:rssimediumlow";
+			label = "red:rssimediumlow";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "cf-e313ac:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "cf-e313ac:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e314n-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e314n-v2.dts
index ff975567d1..723c9eda13 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-e314n-v2.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-e314n-v2.dts
@@ -23,37 +23,37 @@
 		pinctrl-0 = <&jtag_disable_pins &led_rssilow_pin &led_rssimediumhigh_pin &led_rssihigh_pin>;
 
 		wan {
-			label = "cf-e314n-v2:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "cf-e314n-v2:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "cf-e314n-v2:red:signal1";
+			label = "red:signal1";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "cf-e314n-v2:red:signal2";
+			label = "red:signal2";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "cf-e314n-v2:green:signal3";
+			label = "green:signal3";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "cf-e314n-v2:green:signal4";
+			label = "green:signal4";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "cf-e314n-v2:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts
index d5711334fd..5c69a9bde0 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-e5.dts
@@ -29,33 +29,33 @@
 		pinctrl-0 = <&jtag_disable_pins &led_wan_pin>;
 
 		wan {
-			label = "cf-e5:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "cf-e5:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "cf-e5:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		rssi0 {
-			label = "cf-e5:blue:rssi0";
+			label = "blue:rssi0";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "cf-e5:blue:rssi1";
+			label = "blue:rssi1";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "cf-e5:blue:rssi2";
+			label = "blue:rssi2";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-e560ac.dts b/target/linux/ath79/dts/qca9531_comfast_cf-e560ac.dts
index 847dae6895..46b08da838 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-e560ac.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-e560ac.dts
@@ -35,37 +35,37 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		lan1 {
-			label = "cf-e560ac:blue:lan1";
+			label = "blue:lan1";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "cf-e560ac:blue:lan2";
+			label = "blue:lan2";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "cf-e560ac:blue:lan3";
+			label = "blue:lan3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "cf-e560ac:blue:lan4";
+			label = "blue:lan4";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		led_system: system {
-			label = "cf-e560ac:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "cf-e560ac:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "cf-e560ac:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-ew72.dts b/target/linux/ath79/dts/qca9531_comfast_cf-ew72.dts
index ad5275c0a1..f52467c4e2 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-ew72.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-ew72.dts
@@ -23,17 +23,17 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		lan {
-			label = "cf-ew72:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wan: wan {
-			label = "cf-ew72:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "cf-ew72:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-wr752ac-v1.dts b/target/linux/ath79/dts/qca9531_comfast_cf-wr752ac-v1.dts
index 467dfaeb15..2fbdc8fd07 100644
--- a/target/linux/ath79/dts/qca9531_comfast_cf-wr752ac-v1.dts
+++ b/target/linux/ath79/dts/qca9531_comfast_cf-wr752ac-v1.dts
@@ -23,17 +23,17 @@
 		pinctrl-0 = <&jtag_disable_pins &pinmux_led_rssihigh &pinmux_led_rssilow>;
 
 		led_lan: lan {
-			label = "cf-wr752ac-v1:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssihigh {
-			label = "cf-wr752ac-v1:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "cf-wr752ac-v1:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_compex_wpj531-16m.dts b/target/linux/ath79/dts/qca9531_compex_wpj531-16m.dts
index 4b4e23e1aa..2cc9d46fac 100644
--- a/target/linux/ath79/dts/qca9531_compex_wpj531-16m.dts
+++ b/target/linux/ath79/dts/qca9531_compex_wpj531-16m.dts
@@ -39,22 +39,22 @@
 		pinctrl-0 = <&pinmux_led_eth_pins>;
 
 		sig1 {
-			label = "wpj531:red:sig1";
+			label = "red:sig1";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		sig2 {
-			label = "wpj531:yellow:sig2";
+			label = "yellow:sig2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		sig3 {
-			label = "wpj531:green:sig3";
+			label = "green:sig3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_sig4: sig4 {
-			label = "wpj531:green:sig4";
+			label = "green:sig4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts b/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts
index b3fc8ea0bf..dafce16a2a 100644
--- a/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts
+++ b/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts
@@ -42,14 +42,14 @@
 		compatible = "gpio-export";
 
 		usb_power {
-			label = "d-link:power:usb";
+			label = "power:usb";
 			gpio-export,name = "d-link:power:usb";
 			gpio-export,output = <0>;
 			gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>;
 		};
 
 		zwave_power {
-			label = "d-link:power:zwave";
+			label = "power:zwave";
 			gpio-export,name = "d-link:power:zwave";
 			gpio-export,output = <0>;
 			gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>;
@@ -76,12 +76,12 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		status {
-			label = "d-link:red:status";
+			label = "red:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts b/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts
index 5ca651cfc4..eb91d7e0b4 100644
--- a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts
+++ b/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts
@@ -33,29 +33,29 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "ews511ap:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		lan1 {
-			label = "ews511ap:blue:lan1";
+			label = "blue:lan1";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "ews511ap:blue:lan2";
+			label = "blue:lan2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "ews511ap:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g {
-			label = "ews511ap:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
index 5a92d83669..cf531ed8c4 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
@@ -21,13 +21,9 @@
 };
 
 &led_status {
-	label = "gl-ar300m-lite:red:status";
-};
-
-&led_lan {
-	label = "gl-ar300m-lite:green:lan";
+	label = "red:status";
 };
 
 &led_wlan {
-	label = "gl-ar300m-lite:green:wlan";
+	label = "green:wlan";
 };
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi
index 617076b074..86c895fc6a 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi
@@ -43,17 +43,17 @@
 		// Colors for non-Lite versions
 
 		led_status: status {
-			label = "gl-ar300m:green:status";
+			label = "green:status";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
-		led_lan: lan {
-			label = "gl-ar300m:green:lan";
+		lan {
+			label = "green:lan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_wlan: wlan {
-			label = "gl-ar300m:red:wlan";
+			label = "red:wlan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts
index 1bc41839d1..57a7ed1a0c 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts
@@ -40,19 +40,19 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "gl-ar750:white:power";
+			label = "white:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "gl-ar750:white:wlan2g";
+			label = "white:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "gl-ar750:white:wlan5g";
+			label = "white:wlan5g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts
index f423e709f9..acb458f7ec 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts
@@ -26,30 +26,30 @@
 		compatible = "gpio-leds";
 
 		power {
-			label = "gl-x750:green:power";
+			label = "green:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "gl-x750:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "gl-x750:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan {
-			label = "gl-x750:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		4g {
-			label = "gl-x750:green:4g";
+			label = "green:4g";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_telco_t1.dts b/target/linux/ath79/dts/qca9531_telco_t1.dts
index 98b52a7b24..455bfb336f 100644
--- a/target/linux/ath79/dts/qca9531_telco_t1.dts
+++ b/target/linux/ath79/dts/qca9531_telco_t1.dts
@@ -33,33 +33,33 @@
 		pinctrl-0 = <&jtag_disable_pins &pinmux_led_wan_pin>;
 
 		wan {
-			label = "t1:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "t1:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "t1:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_rssi0: rssi0 {
-			label = "t1:blue:rssi0";
+			label = "blue:rssi0";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi1 {
-			label = "t1:blue:rssi1";
+			label = "blue:rssi1";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "t1:blue:rssi2";
+			label = "blue:rssi2";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_tplink_archer-d50-v1.dts b/target/linux/ath79/dts/qca9531_tplink_archer-d50-v1.dts
index 65b85a78f1..f6bd7ad58f 100644
--- a/target/linux/ath79/dts/qca9531_tplink_archer-d50-v1.dts
+++ b/target/linux/ath79/dts/qca9531_tplink_archer-d50-v1.dts
@@ -21,46 +21,46 @@
 		compatible = "gpio-leds";
 
 		wlan2g {
-			label = "tp-link:white:wlan2g";
+			label = "white:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:white:wlan5g";
+			label = "white:wlan5g";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		qss {
-			label = "tp-link:white:qss";
+			label = "white:qss";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:white:wan";
+			label = "white:wan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:white:lan";
+			label = "white:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "tp-link:white:usb";
+			label = "white:usb";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		internet {
-			label = "tp-link:white:internet";
+			label = "white:internet";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_system: system {
-			label = "tp-link:white:system";
+			label = "white:system";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-mr3420-v3.dts b/target/linux/ath79/dts/qca9531_tplink_tl-mr3420-v3.dts
index 92da0b1a5e..2f6c4147c9 100644
--- a/target/linux/ath79/dts/qca9531_tplink_tl-mr3420-v3.dts
+++ b/target/linux/ath79/dts/qca9531_tplink_tl-mr3420-v3.dts
@@ -58,56 +58,56 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port>;
 			linux,default-trigger = "usbport";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
index 6ab63ebde0..bd3858e59a 100644
--- a/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
+++ b/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
@@ -22,38 +22,38 @@
 
 		/* D12 */
 		wan {
-			label = "tp-link:white:wan";
+			label = "white:wan";
 			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		/* D11 */
 		4g {
-			label = "tp-link:white:4g";
+			label = "white:4g";
 			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		/* D5 */
 		wps {
-			label = "tp-link:white:wps";
+			label = "white:wps";
 			gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
 		};
 
 		/* D3 */
 		wlan {
-			label = "tp-link:white:wlan";
+			label = "white:wlan";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		/* D2 */
 		led_power: power {
-			label = "tp-link:white:power";
+			label = "white:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		/* D4 */
 		lan {
-			label = "tp-link:white:lan";
+			label = "white:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
index e6fc128229..a162d9030f 100644
--- a/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
+++ b/target/linux/ath79/dts/qca9531_tplink_tl-wr902ac-v1.dts
@@ -21,36 +21,36 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		internet {
-			label = "tp-link:green:internet";
+			label = "green:internet";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9531_yuncore_a770.dts b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
index 4a0fa49474..aaa9e1f908 100644
--- a/target/linux/ath79/dts/qca9531_yuncore_a770.dts
+++ b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
@@ -31,23 +31,23 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "a770:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		led_status: status {
-			label = "a770:green:status";
+			label = "green:status";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wan {
-			label = "a770:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "a770:red:wlan2g";
+			label = "red:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9533_comfast_cf-e110n-v2.dts b/target/linux/ath79/dts/qca9533_comfast_cf-e110n-v2.dts
index 7643717c0e..961caa8ade 100644
--- a/target/linux/ath79/dts/qca9533_comfast_cf-e110n-v2.dts
+++ b/target/linux/ath79/dts/qca9533_comfast_cf-e110n-v2.dts
@@ -23,32 +23,32 @@
 		pinctrl-0 = <&jtag_disable_pins &led_rssilow_pin &led_rssimediumhigh_pin &led_rssihigh_pin>;
 
 		wan {
-			label = "cf-e110n-v2:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "cf-e110n-v2:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "cf-e110n-v2:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "cf-e110n-v2:red:rssimediumlow";
+			label = "red:rssimediumlow";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "cf-e110n-v2:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_rssihigh: rssihigh {
-			label = "cf-e110n-v2:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -57,7 +57,7 @@
 		compatible = "gpio-leds";
 
 		wlan {
-			label = "cf-e110n-v2:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi b/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi
index 9b3a66f703..5002079940 100644
--- a/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi
+++ b/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi
@@ -33,32 +33,32 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		led_status: status {
-			label = "d-link:red:status";
+			label = "red:status";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "d-link:red:rssilow";
+			label = "red:rssilow";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "d-link:green:rssimediumlow";
+			label = "green:rssimediumlow";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "d-link:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		rssihigh {
-			label = "d-link:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi
index f54e757c62..5448b7beb0 100644
--- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi
+++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi
@@ -20,39 +20,39 @@
 		pinctrl-0 = <&led_wan_pin>;
 
 		power {
-			label = "mikrotik:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		led_user: user {
-			label = "mikrotik:green:user";
+			label = "green:user";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "mikrotik:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "mikrotik:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		rssilow {
-			label = "mikrotik:green:rssilow";
+			label = "green:rssilow";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "mikrotik:green:rssimediumlow";
+			label = "green:rssimediumlow";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "mikrotik:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
@@ -60,7 +60,7 @@
 		unregistered here to avoid conflict.
 
 		rssihigh {
-			label = "mikrotik:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 		*/
diff --git a/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi b/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi
index 5edd2adc83..3295776bf9 100644
--- a/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_cpe210.dtsi
@@ -4,7 +4,7 @@
 
 &leds {
 	lan {
-		label = "tp-link:green:lan";
+		label = "green:lan";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9533_tplink_cpe220-v3.dts b/target/linux/ath79/dts/qca9533_tplink_cpe220-v3.dts
index 2722c59b0e..1d8098944a 100644
--- a/target/linux/ath79/dts/qca9533_tplink_cpe220-v3.dts
+++ b/target/linux/ath79/dts/qca9533_tplink_cpe220-v3.dts
@@ -9,12 +9,12 @@
 
 &leds {
 	lan0 {
-		label = "tp-link:green:lan0";
+		label = "green:lan0";
 		gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 	};
 
 	lan1 {
-		label = "tp-link:green:lan1";
+		label = "green:lan1";
 		gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi b/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi
index 387bd6ba1d..7c64dcc24f 100644
--- a/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_cpexxx.dtsi
@@ -18,22 +18,22 @@
 		compatible = "gpio-leds";
 
 		link1 {
-			label = "tp-link:green:link1";
+			label = "green:link1";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		link2 {
-			label = "tp-link:green:link2";
+			label = "green:link2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		link3 {
-			label = "tp-link:green:link3";
+			label = "green:link3";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		led_link4: link4 {
-			label = "tp-link:green:link4";
+			label = "green:link4";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wa801nd.dtsi b/target/linux/ath79/dts/qca9533_tplink_tl-wa801nd.dtsi
index efe892e288..c45280aff0 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wa801nd.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wa801nd.dtsi
@@ -18,28 +18,28 @@
 		compatible = "gpio-leds";
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		security_red {
-			label = "tp-link:red:security";
+			label = "red:security";
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		security_green {
-			label = "tp-link:green:security";
+			label = "green:security";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
index 537c577918..7d8519ef9b 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wa850re-v2.dts
@@ -24,42 +24,42 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		lan {
-			label = "tp-link:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_re: re {
-			label = "tp-link:blue:re";
+			label = "blue:re";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		signal1 {
-			label = "tp-link:blue:signal1";
+			label = "blue:signal1";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		signal2 {
-			label = "tp-link:blue:signal2";
+			label = "blue:signal2";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		signal3 {
-			label = "tp-link:blue:signal3";
+			label = "blue:signal3";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		signal4 {
-			label = "tp-link:blue:signal4";
+			label = "blue:signal4";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		led_signal5: signal5 {
-			label = "tp-link:blue:signal5";
+			label = "blue:signal5";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr802n.dtsi b/target/linux/ath79/dts/qca9533_tplink_tl-wr802n.dtsi
index 8bb708c6b6..b6349e5371 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wr802n.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr802n.dtsi
@@ -18,7 +18,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dtsi b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dtsi
index a0d0afcccf..027ed82cbe 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr841-v11.dtsi
@@ -13,12 +13,12 @@
 
 &leds {
 	led_system: system {
-		label = "tp-link:green:system";
+		label = "green:system";
 		gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 	};
 
 	wan_orange {
-		label = "tp-link:orange:wan";
+		label = "orange:wan";
 		gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi b/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi
index e85f37f425..b68cd87e98 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr841.dtsi
@@ -14,38 +14,38 @@
 		compatible = "gpio-leds";
 
 		wifi {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_qss: qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts b/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts
index 25447b8bff..269ca03645 100644
--- a/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts
+++ b/target/linux/ath79/dts/qca9533_tplink_tl-wr842n-v3.dts
@@ -21,54 +21,54 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wifi {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_green {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_red {
-			label = "tp-link:red:wan";
+			label = "red:wan";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port>;
diff --git a/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi b/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi
index 6c1d583f01..091d6696a3 100644
--- a/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi
+++ b/target/linux/ath79/dts/qca953x_tplink_tl-wr810n.dtsi
@@ -18,7 +18,7 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts b/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts
index 43bf582b5a..bdb983cd7c 100644
--- a/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts
+++ b/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts
@@ -45,43 +45,43 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "fritz1750e:green:power";
+			label = "green:power";
 			gpios = <&spi_gpio 6 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "fritz1750e:green:wlan";
+			label = "green:wlan";
 			gpios = <&spi_gpio 5 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		lan {
-			label = "fritz1750e:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 		};
 
 		rssi0 {
-			label = "fritz1750e:green:rssi0";
+			label = "green:rssi0";
 			gpios = <&spi_gpio 0 GPIO_ACTIVE_HIGH>;
 		};
 
 		rssi1 {
-			label = "fritz1750e:green:rssi1";
+			label = "green:rssi1";
 			gpios = <&spi_gpio 1 GPIO_ACTIVE_HIGH>;
 		};
 
 		rssi2 {
-			label = "fritz1750e:green:rssi2";
+			label = "green:rssi2";
 			gpios = <&spi_gpio 2 GPIO_ACTIVE_HIGH>;
 		};
 
 		rssi3 {
-			label = "fritz1750e:green:rssi3";
+			label = "green:rssi3";
 			gpios = <&spi_gpio 3 GPIO_ACTIVE_HIGH>;
 		};
 
 		rssi4 {
-			label = "fritz1750e:green:rssi4";
+			label = "green:rssi4";
 			gpios = <&spi_gpio 4 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9556_avm_fritz450e.dts b/target/linux/ath79/dts/qca9556_avm_fritz450e.dts
index 86cd7153e3..0d30535976 100644
--- a/target/linux/ath79/dts/qca9556_avm_fritz450e.dts
+++ b/target/linux/ath79/dts/qca9556_avm_fritz450e.dts
@@ -19,33 +19,33 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "fritz450e:green:power";
+			label = "green:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan {
-			label = "fritz450e:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "fritz450e:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi2 {
-			label = "fritz450e:green:rssi2";
+			label = "green:rssi2";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi3 {
-			label = "fritz450e:green:rssi3";
+			label = "green:rssi3";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		rssi4 {
-			label = "fritz450e:green:rssi4";
+			label = "green:rssi4";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9556_avm_fritzdvbc.dts b/target/linux/ath79/dts/qca9556_avm_fritzdvbc.dts
index 28b19f92ef..bf1c026d17 100644
--- a/target/linux/ath79/dts/qca9556_avm_fritzdvbc.dts
+++ b/target/linux/ath79/dts/qca9556_avm_fritzdvbc.dts
@@ -48,43 +48,43 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "fritzdvbc:green:power";
+			label = "green:power";
 			gpios = <&spi_gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "fritzdvbc:green:wlan";
+			label = "green:wlan";
 			gpios = <&spi_gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		tv {
-			label = "fritzdvbc:green:tv";
+			label = "green:tv";
 			gpios = <&spi_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		rssihigh {
-			label = "fritzdvbc:green:rssihigh";
+			label = "green:rssihigh";
 			gpios = <&spi_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumhigh {
-			label = "fritzdvbc:green:rssimediumhigh";
+			label = "green:rssimediumhigh";
 			gpios = <&spi_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimedium {
-			label = "fritzdvbc:green:rssimedium";
+			label = "green:rssimedium";
 			gpios = <&spi_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		rssimediumlow {
-			label = "fritzdvbc:green:rssimediumlow";
+			label = "green:rssimediumlow";
 			gpios = <&spi_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		rssilow {
-			label = "fritzdvbc:green:rssilow";
+			label = "green:rssilow";
 			gpios = <&spi_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts b/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts
index d629c751de..33053771ad 100644
--- a/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts
+++ b/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts
@@ -20,23 +20,23 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "bhr-4grv2:green:power";
+			label = "green:power";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		diag {
-			label = "bhr-4grv2:orange:diag";
+			label = "orange:diag";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		vpn_orange {
-			label = "bhr-4grv2:orange:vpn";
+			label = "orange:vpn";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		vpn_green {
-			label = "bhr-4grv2:green:vpn";
+			label = "green:vpn";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
index d4aa0d742a..f19e186796 100644
--- a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
+++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
@@ -17,30 +17,30 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "iodata:green:power";
+			label = "green:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		eco {
-			label = "iodata:green:eco";
+			label = "green:eco";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan5g {
-			label = "iodata:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan2g {
-			label = "iodata:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		notification {
-			label = "iodata:amber:notification";
+			label = "amber:notification";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts
index e259cb0266..9a938aff30 100644
--- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts
+++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac1167dgr.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	copy {
-		label = "iodata:green:copy";
+		label = "green:copy";
 		gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts
index 2054643302..1e7d92db3f 100644
--- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts
+++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	function {
-		label = "iodata:green:function";
+		label = "green:function";
 		gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts
index 388bd3ef09..af2607d7b7 100644
--- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts
+++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr2.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	copy {
-		label = "iodata:green:copy";
+		label = "green:copy";
 		gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts
index 5898518f20..d56fab120b 100644
--- a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts
+++ b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts
@@ -17,38 +17,38 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "nbg6616:green:power";
+			label = "green:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		usb1 {
-			label = "nbg6616:green:usb1";
+			label = "green:usb1";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port0>;
 		};
 
 		usb2 {
-			label = "nbg6616:green:usb2";
+			label = "green:usb2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port1>;
 		};
 
 		wifi2g {
-			label = "nbg6616:green:wifi2g";
+			label = "green:wifi2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5g {
-			label = "nbg6616:green:wifi5g";
+			label = "green:wifi5g";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps {
-			label = "nbg6616:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts
index d825eb005b..1cca39de38 100644
--- a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts
+++ b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts
@@ -31,25 +31,25 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "all-wap02860ac:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "all-wap02860ac:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "all-wap02860ac:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps {
-			label = "all-wap02860ac:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v1.dts b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v1.dts
index d04f61193a..240d20ff1f 100644
--- a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v1.dts
+++ b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v1.dts
@@ -5,32 +5,6 @@
 / {
 	compatible = "comfast,cf-wr650ac-v1", "qca,qca9558";
 	model = "Comfast CF-WR650AC v1";
-
-	leds {
-		compatible = "gpio-leds";
-
-		wps {
-			label = "cf-wr650ac-v1:blue:wps";
-			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
-		};
-
-		network {
-			label = "cf-wr650ac-v1:blue:network";
-			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
-		};
-
-		wlan2g {
-			label = "cf-wr650ac-v1:blue:wlan2";
-			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy1tpt";
-		};
-
-		wlan5g {
-			label = "cf-wr650ac-v1:blue:wlan5";
-			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy0tpt";
-		};
-	};
 };
 
 &spi {
diff --git a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v2.dts b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v2.dts
index 6edd75d61a..1b20c3b615 100644
--- a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v2.dts
+++ b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac-v2.dts
@@ -5,32 +5,6 @@
 / {
 	compatible = "comfast,cf-wr650ac-v2", "qca,qca9558";
 	model = "Comfast CF-WR650AC v2";
-
-	leds {
-		compatible = "gpio-leds";
-
-		wps {
-			label = "cf-wr650ac-v2:blue:wps";
-			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
-		};
-
-		network {
-			label = "cf-wr650ac-v2:blue:network";
-			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
-		};
-
-		wlan2g {
-			label = "cf-wr650ac-v2:blue:wlan2";
-			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy1tpt";
-		};
-
-		wlan5g {
-			label = "cf-wr650ac-v2:blue:wlan5";
-			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy0tpt";
-		};
-	};
 };
 
 &spi {
diff --git a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi
index b57bcc3942..5d32551274 100644
--- a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi
+++ b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi
@@ -17,6 +17,32 @@
 		};
 	};
 
+	leds {
+		compatible = "gpio-leds";
+
+		wps {
+			label = "blue:wps";
+			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
+		};
+
+		network {
+			label = "blue:network";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		wlan2g {
+			label = "blue:wlan2";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1tpt";
+		};
+
+		wlan5g {
+			label = "blue:wlan5";
+			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+	};
+
 	watchdog {
 		compatible = "linux,wdt-gpio";
 		gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts
index 3164d783ff..6efdfcab3c 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_status_blue: status_blue {
-			label = "dvl1200e:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_status_red: status_red {
-			label = "dvl1200e:red:status";
+			label = "red:status";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts
index 11ac6fd18f..4ef43be4ba 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_status_blue: status_blue {
-			label = "dvl1200i:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_status_red: status_red {
-			label = "dvl1200i:red:status";
+			label = "red:status";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts
index 11325a69c8..1cf5c09d72 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_status_blue: status_blue {
-			label = "dvl1750c:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_status_red: status_red {
-			label = "dvl1750c:red:status";
+			label = "red:status";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
index 7de8ee0bdb..6a6228327f 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts
@@ -34,13 +34,13 @@
 		compatible = "gpio-leds";
 
 		led_status_blue: status_blue {
-			label = "dvl1750e:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_status_red: status_red {
-			label = "dvl1750e:red:status";
+			label = "red:status";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts
index 7ba011faf2..59a9f4c523 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_status_blue: status_blue {
-			label = "dvl1750i:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_status_red: status_red {
-			label = "dvl1750i:red:status";
+			label = "red:status";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750x.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750x.dts
index a113097f62..8352b37f4a 100644
--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750x.dts
+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750x.dts
@@ -18,12 +18,12 @@
 
 		led_status_red: status_red {
 			/* This LED is not visible on the external casing. */
-			label = "dvl1750x:red:status";
+			label = "red:status";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "dvl1750x:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_dlink_dap-2695-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dap-2695-a1.dts
index 2cd05d9159..f0cf22511a 100644
--- a/target/linux/ath79/dts/qca9558_dlink_dap-2695-a1.dts
+++ b/target/linux/ath79/dts/qca9558_dlink_dap-2695-a1.dts
@@ -20,18 +20,18 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "d-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_power_red: power_red {
-			label = "d-link:red:power";
+			label = "red:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi2g {
-			label = "d-link:green:wifi2g";
+			label = "green:wifi2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts
index 776e92ceec..4af1860aca 100644
--- a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts
+++ b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts
@@ -20,32 +20,32 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "dw33d:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		mmc {
-			label = "dw33d:blue:mmc";
+			label = "blue:mmc";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		usb {
-			label = "dw33d:blue:usb";
+			label = "blue:usb";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port1>;
 			linux,default-trigger = "usbport";
 		};
 
 		wlan2g {
-			label = "dw33d:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		internet {
-			label = "dw33d:blue:internet";
+			label = "blue:internet";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts
index e4e3ca3409..5e38f2e459 100644
--- a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts
+++ b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts
@@ -20,25 +20,25 @@
 		compatible = "gpio-leds";
 
 		led_power_orange: power_orange {
-			label = "ecb1750:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "ecb1750:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "ecb1750:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "ecb1750:blue:lan";
+			label = "blue:lan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
index aa14fd4f3f..9d37664306 100644
--- a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
+++ b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts
@@ -20,30 +20,30 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "epg5000:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "epg5000:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "epg5000:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps_amber {
-			label = "epg5000:amber:wps";
+			label = "amber:wps";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_blue {
-			label = "epg5000:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts
index ccead91cfc..c4a73f2563 100644
--- a/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts
+++ b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts
@@ -20,19 +20,19 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "librerouter-v1:green:system";
+			label = "green:system";
 			gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		wifi_green {
-			label = "librerouter-v1:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		status_blue {
-			label = "librerouter-v1:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts
index 222de88784..d1f307bd48 100644
--- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts
+++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-921gs-5hpacd-15s.dts
@@ -10,7 +10,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "mikrotik:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&ath10k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts
index 3936fd993e..34cc35735f 100644
--- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts
+++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts
@@ -10,7 +10,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "mikrotik:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&ath10k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi
index 57aeedd677..70b3ee68c3 100644
--- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi
+++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi
@@ -17,7 +17,7 @@
 		compatible = "gpio-leds";
 
 		led_user: user {
-			label = "mikrotik:green:user";
+			label = "green:user";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi
index bbecdfce83..04abb8717e 100644
--- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi
+++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi
@@ -44,47 +44,47 @@
 		compatible = "gpio-leds";
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		left_blue {
-			label = "netgear:blue:left";
+			label = "blue:left";
 			gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		right_blue {
-			label = "netgear:blue:right";
+			label = "blue:right";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		client_red {
-			label = "netgear:red:client";
+			label = "red:client";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		client_green {
-			label = "netgear:green:client";
+			label = "green:client";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		router_red {
-			label = "netgear:red:router";
+			label = "red:router";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		router_green {
-			label = "netgear:green:router";
+			label = "green:router";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
index eefa839b88..dbefa40dcf 100644
--- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts
+++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts
@@ -21,25 +21,25 @@
 		compatible = "gpio-leds";
 
 		power {
-			label = "koala:green:power";
+			label = "green:power";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wifi2 {
-			label = "koala:yellow:wlan2";
+			label = "yellow:wlan2";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5 {
-			label = "koala:red:wlan58";
+			label = "red:wlan58";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		led_system: system {
-			label = "koala:blue:sys";
+			label = "blue:sys";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
index eb93201ab0..8c7a7af91b 100644
--- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
+++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts
@@ -13,13 +13,13 @@
 		compatible = "gpio-leds";
 
 		wifi2 {
-			label = "ursus:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5 {
-			label = "ursus:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
index 51a22f09a2..eb196eb2e5 100644
--- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
+++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts
@@ -20,22 +20,22 @@
 		compatible = "gpio-leds";
 
 		power {
-			label = "om5pac:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi_green {
-			label = "om5pac:green:wifi";
+			label = "green:wifi";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi_yellow {
-			label = "om5pac:yellow:wifi";
+			label = "yellow:wifi";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi_red {
-			label = "om5pac:red:wifi";
+			label = "red:wifi";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
index 0b191149cd..412a6e7b33 100644
--- a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
+++ b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
@@ -36,24 +36,24 @@
 		compatible = "gpio-leds";
 
 		led_status_amber: status_amber {
-			label = "wlr-8100:amber:status";
+			label = "amber:status";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		ops {
-			label = "wlr-8100:white:ops";
+			label = "white:ops";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi2g {
-			label = "wlr-8100:blue:wifi2g";
+			label = "blue:wifi2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5g {
-			label = "wlr-8100:blue:wifi5g";
+			label = "blue:wifi5g";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
index 83458df56d..d59d87b5e6 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
@@ -18,33 +18,33 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		usb1 {
-			label = "tp-link:green:usb1";
+			label = "green:usb1";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port1>;
 			linux,default-trigger = "usbport";
 		};
 
 		usb2 {
-			label = "tp-link:green:usb2";
+			label = "green:usb2";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c5-v1.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c5-v1.dts
index c8381296c1..9ffbce0a21 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c5-v1.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c5-v1.dts
@@ -18,7 +18,7 @@
 
 &leds {
 	wlan5g {
-		label = "tp-link:green:wlan5g";
+		label = "green:wlan5g";
 		gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		linux,default-trigger = "phy0tpt";
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v1.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v1.dts
index ee35fa6599..e2d1d63813 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v1.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v1.dts
@@ -18,7 +18,7 @@
 
 &leds {
 	wlan5g {
-		label = "tp-link:green:wlan5g";
+		label = "green:wlan5g";
 		gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		linux,default-trigger = "phy0tpt";
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
index 634c23c356..be99b8e3e4 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
@@ -18,7 +18,7 @@
 
 &leds {
 	wlan5g {
-		label = "tp-link:green:wlan5g";
+		label = "green:wlan5g";
 		gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		linux,default-trigger = "phy0tpt";
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi
index 6d7e0dd5e6..598c5570aa 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi
@@ -17,30 +17,30 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:white:system";
+			label = "white:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan {
-			label = "tp-link:white:wlan";
+			label = "white:wlan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:white:lan";
+			label = "white:lan";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 
 		usb {
-			label = "tp-link:white:usb";
+			label = "white:usb";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port1>, <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		qss {
-			label = "tp-link:white:qss";
+			label = "white:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
index 3e57326e0b..11ebbdacea 100644
--- a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts
@@ -46,30 +46,30 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g_green {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan2g_red {
-			label = "tp-link:red:wlan2g";
+			label = "red:wlan2g";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan5g_green {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan5g_red {
-			label = "tp-link:red:wlan5g";
+			label = "red:wlan5g";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi b/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi
index 0c11d786c9..55f4edf19e 100644
--- a/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi
@@ -19,39 +19,39 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "tp-link:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan_link {
-			label = "tp-link:green:lan_link";
+			label = "green:lan_link";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 
 		lan_data {
-			label = "tp-link:green:lan_data";
+			label = "green:lan_data";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_blue {
-			label = "tp-link:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
 		};
 
 		wps_red {
-			label = "tp-link:red:wps";
+			label = "red:wps";
 			gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
index 70e14c4ebe..9f241ebc2f 100644
--- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts
@@ -21,33 +21,33 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		usb1 {
-			label = "tp-link:green:usb1";
+			label = "green:usb1";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port1>;
 			linux,default-trigger = "usbport";
 		};
 
 		usb2 {
-			label = "tp-link:green:usb2";
+			label = "green:usb2";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wlan2g {
-			label = "tp-link:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		qss {
-			label = "tp-link:blue:qss";
+			label = "blue:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -56,7 +56,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g {
-			label = "tp-link:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
index 6173a5ca75..476162a00e 100644
--- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi
@@ -18,26 +18,26 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "heartbeat";
 		};
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wifi_green {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi_wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts
index 82dee361bc..bbbf69fa59 100644
--- a/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts
@@ -21,19 +21,19 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
index 881e3c88ab..871b69af78 100644
--- a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
+++ b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
@@ -20,22 +20,22 @@
 		compatible = "gpio-leds";
 
 		power_orange {
-			label = "trendnet:orange:power";
+			label = "orange:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_green: power_green {
-			label = "trendnet:green:power";
+			label = "green:power";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 		};
 
 		planet_green {
-			label = "trendnet:green:planet";
+			label = "green:planet";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 
 		planet_orange {
-			label = "trendnet:orange:planet";
+			label = "orange:planet";
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
index 5dd06803e7..94991a8f49 100644
--- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
+++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts
@@ -17,43 +17,43 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "nbg6716:white:power";
+			label = "white:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		internet {
-			label = "nbg6716:white:internet";
+			label = "white:internet";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		usb1 {
-			label = "nbg6716:white:usb1";
+			label = "white:usb1";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port1>;
 		};
 
 		usb2 {
-			label = "nbg6716:white:usb2";
+			label = "white:usb2";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "usbport";
 			trigger-sources = <&hub_port0>;
 		};
 
 		wifi2g {
-			label = "nbg6716:white:wifi2g";
+			label = "white:wifi2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5g {
-			label = "nbg6716:white:wifi5g";
+			label = "white:wifi5g";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps {
-			label = "nbg6716:white:wps";
+			label = "white:wps";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9561_avm_fritz4020.dts b/target/linux/ath79/dts/qca9561_avm_fritz4020.dts
index e05f4bb45f..e7e421c076 100644
--- a/target/linux/ath79/dts/qca9561_avm_fritz4020.dts
+++ b/target/linux/ath79/dts/qca9561_avm_fritz4020.dts
@@ -46,34 +46,34 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "fritz4020:green:power";
+			label = "green:power";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan {
-			label = "fritz4020:green:wlan";
+			label = "green:wlan";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "fritz4020:green:lan";
+			label = "green:lan";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "fritz4020:green:wan";
+			label = "green:wan";
 			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		info {
-			label = "fritz4020:green:info";
+			label = "green:info";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		led_info_red: info_red {
-			label = "fritz4020:red:info";
+			label = "red:info";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c25-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c25-v1.dts
index 02f54097f3..6659bbe688 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c25-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c25-v1.dts
@@ -57,55 +57,55 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan_green {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "tp-link:amber:wan";
+			label = "amber:wan";
 			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
index fe8569c427..4430d05247 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	usb {
-		label = "tp-link:green:usb";
+		label = "green:usb";
 		gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>;
 		linux,default-trigger = "usbport";
 		trigger-sources = <&hub_port>;
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
index 2d62944421..c407dc3cde 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v2.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	usb	{
-		label =	"tp-link:green:usb";
+		label =	"green:usb";
 		gpios =	<&led_gpio 7 GPIO_ACTIVE_LOW>;
 		linux,default-trigger =	"usbport";
 		trigger-sources	= <&hub_port>;
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
index a5933d27e7..9ba6ccfafd 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
@@ -40,40 +40,40 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan_green {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "tp-link:amber:wan";
+			label = "amber:wan";
 			gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
index a46b537d3e..2a6bea30f2 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v1.dts
@@ -9,12 +9,12 @@
 
 &leds {
 	wan_amber {
-		label = "tp-link:amber:wan";
+		label = "amber:wan";
 		gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 	};
 
 	wps {
-		label = "tp-link:green:wps";
+		label = "green:wps";
 		gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
index 5c8564154c..afef276db2 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v2.dts
@@ -9,12 +9,12 @@
 
 &leds {
 	wan_amber {
-		label = "tp-link:amber:wan";
+		label = "amber:wan";
 		gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 	};
 
 	wps {
-		label = "tp-link:green:wps";
+		label = "green:wps";
 		gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
index 67cef957c9..cda2a3615b 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c60-v3.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	wan_amber {
-		label = "tp-link:amber:wan";
+		label = "amber:wan";
 		gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 	};
 };
diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi b/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
index 9c46a1b222..7ba94aa42e 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c6x.dtsi
@@ -34,30 +34,30 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan_green {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9561_tplink_eap225-wall-v2.dts b/target/linux/ath79/dts/qca9561_tplink_eap225-wall-v2.dts
index 0e93e06e2f..21203451cb 100644
--- a/target/linux/ath79/dts/qca9561_tplink_eap225-wall-v2.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_eap225-wall-v2.dts
@@ -39,7 +39,7 @@
 		compatible = "gpio-leds";
 
 		led_status: status {
-			label = "tp-link:white:status";
+			label = "white:status";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/dts/qca9561_xiaomi_mi-router-4q.dts b/target/linux/ath79/dts/qca9561_xiaomi_mi-router-4q.dts
index 077724d4b9..a403877c89 100644
--- a/target/linux/ath79/dts/qca9561_xiaomi_mi-router-4q.dts
+++ b/target/linux/ath79/dts/qca9561_xiaomi_mi-router-4q.dts
@@ -36,17 +36,17 @@
 		compatible = "gpio-leds";
 
 		led_red: led_red {
-			label = "mi-router-4q:red:led";
+			label = "red:led";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		led_yellow: led_yellow {
-			label = "mi-router-4q:yellow:led";
+			label = "yellow:led";
 			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
 		};
 
 		led_blue: led_blue {
-			label = "mi-router-4q:blue:led";
+			label = "blue:led";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_compex_wpj563.dts b/target/linux/ath79/dts/qca9563_compex_wpj563.dts
index a85f99881c..913155a0bd 100644
--- a/target/linux/ath79/dts/qca9563_compex_wpj563.dts
+++ b/target/linux/ath79/dts/qca9563_compex_wpj563.dts
@@ -37,22 +37,22 @@
 		compatible = "gpio-leds";
 
 		sig1 {
-			label = "wpj563:green:sig1";
+			label = "green:sig1";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		sig2 {
-			label = "wpj563:green:sig2";
+			label = "green:sig2";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		sig3 {
-			label = "wpj563:green:sig4";
+			label = "green:sig4";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		led_sig4: sig4 {
-			label = "wpj563:green:sig4";
+			label = "green:sig4";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi
index 754d5fad1c..02a3e3e44a 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c.dtsi
@@ -6,6 +6,13 @@
 #include <dt-bindings/input/input.h>
 
 / {
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
 	keys {
 		compatible = "gpio-keys";
 
@@ -21,6 +28,26 @@
 			debounce-interval = <60>;
 		};
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_power: power {
+			label = "green:power";
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+
+		wps {
+			label = "green:wps";
+			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+		};
+
+		wlan {
+			label = "green:wlan";
+			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+	};
 };
 
 &uart {
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts
index de7ad15cc7..23f912df32 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c1.dts
@@ -5,31 +5,4 @@
 / {
 	compatible = "dlink,dir-842-c1", "qca,qca9563";
 	model = "D-Link DIR-842 C1";
-
-	aliases {
-		led-boot = &led_power;
-		led-failsafe = &led_power;
-		led-running = &led_power;
-		led-upgrade = &led_power;
-	};
-
-	leds {
-		compatible = "gpio-leds";
-
-		led_power: power {
-			label = "dir-842-c1:green:power";
-			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
-		};
-
-		wps {
-			label = "dir-842-c1:green:wps";
-			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
-		};
-
-		wlan {
-			label = "dir-842-c1:green:wlan";
-			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy0tpt";
-		};
-	};
 };
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts
index de0e554b7b..1a62764a92 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c2.dts
@@ -5,33 +5,6 @@
 / {
 	compatible = "dlink,dir-842-c2", "qca,qca9563";
 	model = "D-Link DIR-842 C2";
-
-	aliases {
-		led-boot = &led_power;
-		led-failsafe = &led_power;
-		led-running = &led_power;
-		led-upgrade = &led_power;
-	};
-
-	leds {
-		compatible = "gpio-leds";
-
-		led_power: power {
-			label = "dir-842-c2:green:power";
-			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
-		};
-
-		wps {
-			label = "dir-842-c2:green:wps";
-			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
-		};
-
-		wlan {
-			label = "dir-842-c2:green:wlan";
-			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy0tpt";
-		};
-	};
 };
 
 &usb_phy0 {
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts b/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts
index 6954a330dc..e43113ad5f 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-842-c3.dts
@@ -5,31 +5,4 @@
 / {
 	compatible = "dlink,dir-842-c3", "qca,qca9563";
 	model = "D-Link DIR-842 C3";
-
-	aliases {
-		led-boot = &led_power;
-		led-failsafe = &led_power;
-		led-running = &led_power;
-		led-upgrade = &led_power;
-	};
-
-	leds {
-		compatible = "gpio-leds";
-
-		led_power: power {
-			label = "dir-842-c3:green:power";
-			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
-		};
-
-		wps {
-			label = "dir-842-c3:green:wps";
-			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
-		};
-
-		wlan {
-			label = "dir-842-c3:green:wlan";
-			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy0tpt";
-		};
-	};
 };
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
index 0197921ec4..572a0bc6ea 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts
@@ -20,22 +20,22 @@
 		compatible = "gpio-leds";
 
 		wps {
-			label = "dir-859-a1:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power: power {
-			label = "dir-859-a1:green:power";
+			label = "green:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		internet {
-			label = "dir-859-a1:green:internet";
+			label = "green:internet";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "dir-859-a1:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts
index c4450fea1a..b4f7718230 100644
--- a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts
+++ b/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts
@@ -9,19 +9,19 @@
 
 &leds {
 	led_power: power {
-		label = "elecom:blue:power";
+		label = "blue:power";
 		gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		default-state = "on";
 	};
 
 	wlan2g {
-		label = "elecom:blue:wlan2g";
+		label = "blue:wlan2g";
 		gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		linux,default-trigger = "phy1tpt";
 	};
 
 	wlan5g {
-		label = "elecom:blue:wlan5g";
+		label = "blue:wlan5g";
 		gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
 		linux,default-trigger = "phy0tpt";
 	};
diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts
index 18074c72b4..3af6f59d09 100644
--- a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts
+++ b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts
@@ -9,13 +9,13 @@
 
 &leds {
 	led_power: power {
-		label = "elecom:white:power";
+		label = "white:power";
 		gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
 		default-state = "on";
 	};
 
 	wlan2g {
-		label = "elecom:white:wlan2g";
+		label = "white:wlan2g";
 		gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		linux,default-trigger = "phy0tpt";
 	};
diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi b/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi
index ebe4a0ff52..7efdfa62af 100644
--- a/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi
+++ b/target/linux/ath79/dts/qca9563_elecom_wrc-ghbk2-i.dtsi
@@ -17,7 +17,7 @@
 		compatible = "gpio-leds";
 
 		wps {
-			label = "elecom:red:wps";
+			label = "red:wps";
 			gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
index 762cc895ea..24b0860d7c 100644
--- a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
+++ b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
@@ -41,19 +41,19 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "gl-ar750s:green:power";
+			label = "green:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		led_wlan2g: wlan2g {
-			label = "gl-ar750s:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		led_wlan5g: wlan5g {
-			label = "gl-ar750s:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts b/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts
index d5a14ab470..0f77cfa5f1 100644
--- a/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts
+++ b/target/linux/ath79/dts/qca9563_nec_wg1200cr.dts
@@ -21,13 +21,13 @@
 		/* other LEDs are connected to ath10k (QCA9888) gpiochip */
 
 		led_power_green: power_green {
-			label = "wg1200cr:green:power";
+			label = "green:power";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		led_power_red: power_red {
-			label = "wg1200cr:red:power";
+			label = "red:power";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts
index 607db3ca22..befd1620e9 100644
--- a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts
+++ b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts
@@ -22,44 +22,44 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		wlan2g_red {
-			label = "wg800hp:red:wlan2g";
+			label = "red:wlan2g";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		active_red {
-			label = "wg800hp:red:active";
+			label = "red:active";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		active_green {
-			label = "wg800hp:green:active";
+			label = "green:active";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_red: power_red {
-			label = "wg800hp:red:power";
+			label = "red:power";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_green: power_green {
-			label = "wg800hp:green:power";
+			label = "green:power";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan5g_red {
-			label = "wg800hp:red:wlan5g";
+			label = "red:wlan5g";
 			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
 		};
 
 		wlan5g_green {
-			label = "wg800hp:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan2g_green {
-			label = "wg800hp:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
index 173dfdd557..ca29336147 100644
--- a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
+++ b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
@@ -49,34 +49,34 @@
 		pinctrl-0 = <&jtag_disable_pins>;
 
 		led_power_green: power_green {
-			label = "netgear:green:power";
+			label = "green:power";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		led_power_amber: power_amber {
-			label = "netgear:amber:power";
+			label = "amber:power";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wan_green {
-			label = "netgear:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_amber {
-			label = "netgear:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g_green {
-			label = "netgear:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wps_green {
-			label = "netgear:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -85,7 +85,7 @@
 		compatible = "gpio-leds";
 
 		wlan5g_blue {
-			label = "netgear:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&ath9k 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr4300-v2.dts b/target/linux/ath79/dts/qca9563_netgear_wndr4300-v2.dts
index 07e2ad0548..8682413b0b 100644
--- a/target/linux/ath79/dts/qca9563_netgear_wndr4300-v2.dts
+++ b/target/linux/ath79/dts/qca9563_netgear_wndr4300-v2.dts
@@ -9,7 +9,7 @@
 
 &leds {
 	usb_green {
-		label = "netgear:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port0>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr4500-v3.dts b/target/linux/ath79/dts/qca9563_netgear_wndr4500-v3.dts
index d5cd01eac4..6e25215501 100644
--- a/target/linux/ath79/dts/qca9563_netgear_wndr4500-v3.dts
+++ b/target/linux/ath79/dts/qca9563_netgear_wndr4500-v3.dts
@@ -9,14 +9,14 @@
 
 &leds {
 	usb1_green {
-		label = "netgear:green:usb1";
+		label = "green:usb1";
 		gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port0>;
 		linux,default-trigger = "usbport";
 	};
 
 	usb2_green {
-		label = "netgear:green:usb2";
+		label = "green:usb2";
 		gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port1>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts b/target/linux/ath79/dts/qca9563_phicomm_k2t.dts
index 94a10d45f7..e89a4de1ee 100644
--- a/target/linux/ath79/dts/qca9563_phicomm_k2t.dts
+++ b/target/linux/ath79/dts/qca9563_phicomm_k2t.dts
@@ -20,17 +20,17 @@
 		compatible = "gpio-leds";
 
 		status_blue {
-			label = "phicomm:blue:status";
+			label = "blue:status";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		led_status_red: status_red {
-			label = "phicomm:red:status";
+			label = "red:status";
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
 
 		status_yellow {
-			label = "phicomm:yellow:status";
+			label = "yellow:status";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_rosinson_wr818.dts b/target/linux/ath79/dts/qca9563_rosinson_wr818.dts
index d37e1aed37..ce73d0838f 100644
--- a/target/linux/ath79/dts/qca9563_rosinson_wr818.dts
+++ b/target/linux/ath79/dts/qca9563_rosinson_wr818.dts
@@ -20,12 +20,12 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "wr818:red:system";
+			label = "red:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi_2g {
-			label = "wr818:red:wifi2g";
+			label = "red:wifi2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts
index 2ef5bee281..95ac123f48 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c2-v3.dts
@@ -20,55 +20,55 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wifi2g {
-			label = "tp-link:green:wifi2g";
+			label = "green:wifi2g";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5g {
-			label = "tp-link:green:wifi5g";
+			label = "green:wifi5g";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi_wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
index d09ee56d53..399f410612 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2-us.dts
@@ -17,40 +17,40 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
index 9f4386c2c2..d00320ad02 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts
@@ -17,40 +17,40 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:amber:wan";
+			label = "amber:wan";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
index 5f66570013..77ba6c4ffb 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
@@ -57,69 +57,69 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		usb1 {
-			label = "tp-link:green:usb1";
+			label = "green:usb1";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port1>;
 			linux,default-trigger = "usbport";
 		};
 
 		usb2 {
-			label = "tp-link:green:usb2";
+			label = "green:usb2";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
index 7f79165cb4..63c9977c6c 100644
--- a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi
@@ -18,62 +18,62 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		usb {
-			label = "tp-link:green:usb";
+			label = "green:usb";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&hub_port0>;
 			linux,default-trigger = "usbport";
 		};
 
 		wlan5g {
-			label = "tp-link:green:wlan5g";
+			label = "green:wlan5g";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wlan2g {
-			label = "tp-link:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_eap245-v3.dts b/target/linux/ath79/dts/qca9563_tplink_eap245-v3.dts
index 321b6296d1..184c208f58 100644
--- a/target/linux/ath79/dts/qca9563_tplink_eap245-v3.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_eap245-v3.dts
@@ -21,13 +21,13 @@
 		compatible = "gpio-leds";
 
 		led_status_green: status_green {
-			label = "tp-link:green:status";
+			label = "green:status";
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
 
 		led_status_amber: status_amber {
-			label = "tp-link:amber:status";
+			label = "amber:status";
 			gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_re450.dtsi b/target/linux/ath79/dts/qca9563_tplink_re450.dtsi
index ed8d90710e..85b9cf6a10 100644
--- a/target/linux/ath79/dts/qca9563_tplink_re450.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_re450.dtsi
@@ -19,39 +19,39 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:blue:power";
+			label = "blue:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan2g {
-			label = "tp-link:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wlan5g {
-			label = "tp-link:blue:wlan5g";
+			label = "blue:wlan5g";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		lan_link {
-			label = "tp-link:green:lan_link";
+			label = "green:lan_link";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		lan_data {
-			label = "tp-link:green:lan_data";
+			label = "green:lan_data";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 		};
 
 		wps_blue {
-			label = "tp-link:blue:wps";
+			label = "blue:wps";
 			gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
 		};
 
 		wps_red {
-			label = "tp-link:red:wps";
+			label = "red:wps";
 			gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630.dtsi
index 49fa914bd3..0ce1da832c 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630.dtsi
@@ -49,23 +49,23 @@
 		compatible = "gpio-leds";
 
 		led_power: power {
-			label = "tp-link:green:power";
+			label = "green:power";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		wifi2g {
-			label = "tp-link:green:wifi2g";
+			label = "green:wifi2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
 
 		wifi5g {
-			label = "tp-link:green:wifi5g";
+			label = "green:wifi5g";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi
index 2704d4c8cd..b8f48047e2 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043n.dtsi
@@ -18,49 +18,49 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "heartbeat";
 		};
 
 		wifi_green {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wifi_wps {
-			label = "tp-link:green:wps";
+			label = "green:wps";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 		};
 
 		wan {
-			label = "tp-link:green:wan";
+			label = "green:wan";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_fail {
-			label = "tp-link:orange:wan";
+			label = "orange:wan";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 
 		lan1 {
-			label = "tp-link:green:lan1";
+			label = "green:lan1";
 			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:green:lan2";
+			label = "green:lan2";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:green:lan3";
+			label = "green:lan3";
 			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:green:lan4";
+			label = "green:lan4";
 			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
index 7603898def..2f2d59ebd3 100644
--- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts
@@ -80,7 +80,7 @@
 
 &leds {
 	usb {
-		label = "tp-link:green:usb";
+		label = "green:usb";
 		gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&hub_port0>;
 		linux,default-trigger = "usbport";
diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
index 51cefa3f34..7a5a957f7b 100644
--- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
+++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi
@@ -17,12 +17,12 @@
 		compatible = "gpio-leds";
 
 		led_white: led_white {
-			label = "ubnt:white:dome";
+			label = "white:dome";
 			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
 		};
 
 		led_blue: led_blue {
-			label = "ubnt:blue:dome";
+			label = "blue:dome";
 			gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
 		};
 	};
diff --git a/target/linux/ath79/dts/qca9563_yuncore_a782.dts b/target/linux/ath79/dts/qca9563_yuncore_a782.dts
index 3774b75365..5a84195bfb 100644
--- a/target/linux/ath79/dts/qca9563_yuncore_a782.dts
+++ b/target/linux/ath79/dts/qca9563_yuncore_a782.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "a782:red:system";
+			label = "red:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wlan2g {
-			label = "a782:green:wlan2g";
+			label = "green:wlan2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/qca9563_yuncore_xd4200.dts b/target/linux/ath79/dts/qca9563_yuncore_xd4200.dts
index 5865e9526b..05032fc955 100644
--- a/target/linux/ath79/dts/qca9563_yuncore_xd4200.dts
+++ b/target/linux/ath79/dts/qca9563_yuncore_xd4200.dts
@@ -17,13 +17,13 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "xd4200:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
 			default-state = "keep";
 		};
 
 		wlan2g {
-			label = "xd4200:blue:wlan2g";
+			label = "blue:wlan2g";
 			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1tpt";
 		};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi b/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi
index 992c14842b..6b27468551 100644
--- a/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi
+++ b/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi
@@ -24,23 +24,23 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:green:system";
+			label = "green:system";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		qss {
-			label = "tp-link:green:qss";
+			label = "green:qss";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		lan {
-			label = "tp-link:green:lan";
+			label = "green:lan";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:green:wlan";
+			label = "green:wlan";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v3.dtsi b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v3.dtsi
index dcb450a2d3..5c897b16a0 100644
--- a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v3.dtsi
+++ b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v3.dtsi
@@ -14,49 +14,49 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		qss {
-			label = "tp-link:blue:qss";
+			label = "blue:qss";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan_blue {
-			label = "tp-link:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_red {
-			label = "tp-link:red:wan";
+			label = "red:wan";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan1 {
-			label = "tp-link:blue:lan1";
+			label = "blue:lan1";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:blue:lan2";
+			label = "blue:lan2";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:blue:lan3";
+			label = "blue:lan3";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:blue:lan4";
+			label = "blue:lan4";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v4.dts b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v4.dts
index 88aff2c4cc..21a2be993c 100644
--- a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v4.dts
+++ b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v4.dts
@@ -17,49 +17,49 @@
 		compatible = "gpio-leds";
 
 		led_system: system {
-			label = "tp-link:blue:system";
+			label = "blue:system";
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
 
 		qss {
-			label = "tp-link:blue:qss";
+			label = "blue:qss";
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan {
-			label = "tp-link:blue:wlan";
+			label = "blue:wlan";
 			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0tpt";
 		};
 
 		wan_blue {
-			label = "tp-link:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		wan_red {
-			label = "tp-link:red:wan";
+			label = "red:wan";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 		};
 
 		lan1 {
-			label = "tp-link:blue:lan1";
+			label = "blue:lan1";
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 
 		lan2 {
-			label = "tp-link:blue:lan2";
+			label = "blue:lan2";
 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
 		};
 
 		lan3 {
-			label = "tp-link:blue:lan3";
+			label = "blue:lan3";
 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
 		};
 
 		lan4 {
-			label = "tp-link:blue:lan4";
+			label = "blue:lan4";
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 	};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v6.dts b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v6.dts
index 5a6e65464a..4334b70ce8 100644
--- a/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v6.dts
+++ b/target/linux/ath79/dts/tp9343_tplink_tl-wr940n-v6.dts
@@ -17,12 +17,12 @@
 		compatible = "gpio-leds";
 
 		wan_blue {
-			label = "tp-link:blue:wan";
+			label = "blue:wan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		};
 
 		led_diag_orange: diag_orange {
-			label = "tp-link:orange:diag";
+			label = "orange:diag";
 			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
 			default-state = "on";
 		};
diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration
index 02bdbb8476..04711541c3 100644
--- a/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration
@@ -2,12 +2,8 @@
 . /lib/functions/migrations.sh
 
 board=$(board_name)
-boardonly="${board##*,}"
 
 case "$board" in
-arduino,yun)
-	migrate_leds "arduino:=yun:"
-	;;
 dlink,dap-1330-a1)
 	migrate_leds ":red:power=:red:status" \
 		":red:wifi=:red:rssilow" \
@@ -29,32 +25,13 @@ tplink,tl-wdr4300-v1-il|\
 tplink,tl-wdr4310-v1)
 	migrate_leds ":blue:=:green:"
 	;;
-tplink,archer-c25-v1|\
-tplink,archer-c58-v1|\
-tplink,archer-c59-v1|\
-tplink,archer-c59-v2|\
-tplink,archer-c60-v1|\
-tplink,archer-c60-v2|\
-tplink,archer-c7-v4|\
-tplink,archer-c7-v5|\
-tplink,tl-wr902ac-v1)
-	migrate_leds "^$boardonly:=tp-link:"
-	;;
-tplink,re355-v1)
-	migrate_leds "re355:=tp-link:"
-	;;
-tplink,re450-v1)
-	migrate_leds "re450:=tp-link:"
-	;;
 tplink,tl-wpa8630-v1)
-	migrate_leds "^tl-wpa8630:=tp-link:" \
-		':wlan$=:wifi2g' ':wlan5$=:wifi5g'
-	;;
-wd,mynet-n750)
-	migrate_leds "wd:=mynet-n750:"
+	migrate_leds ':wlan$=:wifi2g' ':wlan5$=:wifi5g'
 	;;
 esac
 
+remove_board_leds
+
 migrations_apply system
 
 exit 0
diff --git a/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration
index c12a7ac02c..4d9a6d11a9 100644
--- a/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration
@@ -2,14 +2,12 @@
 . /lib/functions/migrations.sh
 
 board=$(board_name)
-boardonly="${board##*,}"
 
 case "$board" in
-mikrotik,*)
-	migrate_leds "^rb:=mikrotik:"
-	;;
 esac
 
+remove_board_leds
+
 migrations_apply system
 
 exit 0
diff --git a/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration
new file mode 100644
index 0000000000..4d9a6d11a9
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration
@@ -0,0 +1,13 @@
+. /lib/functions.sh
+. /lib/functions/migrations.sh
+
+board=$(board_name)
+
+case "$board" in
+esac
+
+remove_board_leds
+
+migrations_apply system
+
+exit 0
diff --git a/target/linux/ath79/tiny/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/tiny/base-files/etc/uci-defaults/04_led_migration
index 377135f530..07ec5848e1 100644
--- a/target/linux/ath79/tiny/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ath79/tiny/base-files/etc/uci-defaults/04_led_migration
@@ -2,17 +2,15 @@
 . /lib/functions/migrations.sh
 
 board=$(board_name)
-boardonly="${board##*,}"
 
 case "$board" in
 tplink,tl-wr802n-v1)
 	migrate_leds ":blue:=:green:"
 	;;
-tplink,tl-wr802n-v2)
-	migrate_leds "^$boardonly:=tp-link:"
-	;;
 esac
 
+remove_board_leds
+
 migrations_apply system
 
 exit 0
-- 
2.20.1



From philipp_subx at redfish-solutions.com  Sat Sep 26 18:02:40 2020
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sat, 26 Sep 2020 16:02:40 -0600
Subject: Meson files missing breaking build
Message-ID: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>

Hi.

I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?

Various things like lighttpd and glib2 don?t want to build because of Meson.

I get errors like this:


make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
. /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2

Applying ./patches/001-no-libelf.patch using plaintext: 
patching file gio/meson.build

Applying ./patches/002-no-tests.patch using plaintext: 
patching file meson.build

Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext: 
patching file glib/valgrind.h

Applying ./patches/004-no-distutils.patch using plaintext: 
patching file meson.build

Applying ./patches/005-uclibc.patch using plaintext: 
patching file meson.build
touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
/home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
make[1]: *** [package/feeds/packages/glib2/compile] Error 2
make[1]: Leaving directory '/home/philipp/lede'
/home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
make: *** [package/glib2/compile] Error 2


That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.

MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.

Where is this supposed to be created?

I need to be able to get back to building packages, but I?m dead in my tracks.

Any guidance appreciated.

Thanks,

-Philip



From devel-sven at geroedel.de  Sat Sep 26 18:51:50 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Sun, 27 Sep 2020 00:51:50 +0200
Subject: ath79: move 8/32 boards to tiny subtarget
In-Reply-To: <9009300.hBHk0JINo9@strike>
References: <5836172.LP2CDrWvR4@strike>
 <00c601d68ed3$42699e30$c73cda90$@adrianschmutzler.de>
 <9009300.hBHk0JINo9@strike>
Message-ID: <2424747.c2yPOVA1kM@strike>

Am Sonntag, 20. September 2020, 15:32:52 CEST schrieb Sven Roederer:
> > Actually, this narrows down to a question that struck me several times
> > already:
> > 
> > Now, that 4 MB flash devices are not "supported" anymore, how should we
> > deal with the "tiny" subtargets:
> > 
> > 1. We keep the tiny subtargets configured for low flash, so people still
> > trying to build 4 MB flash devices still can use this. (This will also
> > benefit a few devices with kernel size restrictions; however, this is a
> > much smaller set than in earlier times; most of these devices have
> > dual-stage bootloaders now or died anyway).
> > 
> > 2. We convert the tiny targets to low-memory targets; this will improve
> > the
> > situation for a few devices (like you mentioned), but will make it much
> > harder to still build the 4M flash devices without major changes. Apart
> > from ath79, I don't know whether this would make sense for other targets
> > like the old subtargets on ramips. This poses the risk of having some
> > targets low-mem and some small-flash, which I'd like to avoid.
> > Additionally, we will have to change back from low-mem to small-flash
> > again
> > when we start to hit limits with the 8M devices.
> > 
> > 3. Though not intended by this conversation, the third option is obviously
> > to just ignore all 4M or 32M devices from now on (as actually announced by
> > the 4/32 warning), and design the tiny targets based on the requirements
> > of
> > the 8M devices that will start to become a "problem" soon (either due to
> > kernel size restrictions or because of small rootfs). Actually, we already
> > went into this direction by using wpad-basic-wolfssl on tiny targets as
> > well.
> 
> Adrian,
> 
> thanks for reminding that 4/32 have be planned to phase out after 19.07. 
> This will or have to be done in the near future.
> Reading  your points my quick idea was: "Moving the 4/32 and 8/32 to the
> tiny- target for 20.xx and removing this target after 20.xx bramch-off".
> This shows clearly for 20.xx what will happen soon and the user can prepare
> for this finally. The code can possibly also cahnged to take more advantage
> of "low_mem" and "small_flash" flags for the "next 8/64 round".
> regarding yout concerns that mixing 4/32 and 8/32 will make some more
> devices not usable I think like: this will break probably some 4/32 on
> tiny, but will make some 8/32 more usable. As the 4/32 warning is around
> fror some years now, nobody should be really surprised that the boards
> "dying" and that the 4/32 boards dying before the 8/32.
> 
> Best Sven

An alternative might be to consolidate all Low_Mem and Small_Flash boards to 
tiny for 20.xx and set them to source-only after branching 20.xx.

Sven




From lynxis at fe80.eu  Sun Sep 27 00:16:17 2020
From: lynxis at fe80.eu (Alexander 'lynxis' Couzens)
Date: Sun, 27 Sep 2020 06:16:17 +0200
Subject: [PATCH] omap: update uboot to v2020.04
In-Reply-To: <20200921185314.20536222@lazus.yip>
References: <20200904073049.1255919-1-a.heider@gmail.com>
 <925fb705-473f-075b-7b4b-ff0d48556464@gmail.com>
 <20200921185314.20536222@lazus.yip>
Message-ID: <20200927061617.7f50ba4f@lazus.yip>

On Mon, 21 Sep 2020 18:53:13 +0200
Alexander 'lynxis' Couzens <lynxis at fe80.eu> wrote:

> > do you mind to take a quick look? In the end this is just a tiny
> > package bump! :)  
> 
> let me have a tiny look on other devices ;)

the pandaboards fails, but the bbb boots. same as before.
the panda is only booting the spl.
i'll have a look tomorrow on the panda with jtag but it's not a blocker
for your patch. it didn't worked before.

i'll merge your patch within the next week.

best,
lynxis
-- 
Alexander Couzens

mail: lynxis at fe80.eu
jabber: lynxis at fe80.eu
gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200927/ca26da6e/attachment.sig>

From a.heider at gmail.com  Sun Sep 27 02:13:14 2020
From: a.heider at gmail.com (Andre Heider)
Date: Sun, 27 Sep 2020 08:13:14 +0200
Subject: Meson files missing breaking build
In-Reply-To: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
References: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
Message-ID: <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>

On 27/09/2020 00:02, Philip Prindeville wrote:
> Hi.
> 
> I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?
> 
> Various things like lighttpd and glib2 don?t want to build because of Meson.
> 
> I get errors like this:
> 
> 
> make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
> . /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
> [ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2
> 
> Applying ./patches/001-no-libelf.patch using plaintext:
> patching file gio/meson.build
> 
> Applying ./patches/002-no-tests.patch using plaintext:
> patching file meson.build
> 
> Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext:
> patching file glib/valgrind.h
> 
> Applying ./patches/004-no-distutils.patch using plaintext:
> patching file meson.build
> 
> Applying ./patches/005-uclibc.patch using plaintext:
> patching file meson.build
> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
> rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
> rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
> /home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
> bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
> Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
> make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
> make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
> time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
> package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
> make[1]: *** [package/feeds/packages/glib2/compile] Error 2
> make[1]: Leaving directory '/home/philipp/lede'
> /home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
> make: *** [package/glib2/compile] Error 2
> 
> 
> That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.
> 
> MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.
> 
> Where is this supposed to be created?

It's created by the meson host package, see devel/meson/Makefile.

Sounds like your build dirs are borked, try `make dirclean`?

> 
> I need to be able to get back to building packages, but I?m dead in my tracks.
> 
> Any guidance appreciated.
> 
> Thanks,
> 
> -Philip
> 


From rosenp at gmail.com  Sun Sep 27 02:53:26 2020
From: rosenp at gmail.com (Rosen Penev)
Date: Sat, 26 Sep 2020 23:53:26 -0700
Subject: Meson files missing breaking build
In-Reply-To: <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
References: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
 <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
Message-ID: <CAKxU2N9=fdED1U7dBV5skZ+BDnEepi2qhb2mXM-QvvVT8XZrhg@mail.gmail.com>

On Sat, Sep 26, 2020 at 11:13 PM Andre Heider <a.heider at gmail.com> wrote:
>
> On 27/09/2020 00:02, Philip Prindeville wrote:
> > Hi.
> >
> > I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?
> >
> > Various things like lighttpd and glib2 don?t want to build because of Meson.
> >
> > I get errors like this:
> >
> >
> > make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
> > touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
> > . /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
> > [ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2
> >
> > Applying ./patches/001-no-libelf.patch using plaintext:
> > patching file gio/meson.build
> >
> > Applying ./patches/002-no-tests.patch using plaintext:
> > patching file meson.build
> >
> > Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext:
> > patching file glib/valgrind.h
> >
> > Applying ./patches/004-no-distutils.patch using plaintext:
> > patching file meson.build
> >
> > Applying ./patches/005-uclibc.patch using plaintext:
> > patching file meson.build
> > touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
> > rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
> > rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
> > /home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
> > bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
> > Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
> > make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
> > make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
> > time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
> > package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
> > make[1]: *** [package/feeds/packages/glib2/compile] Error 2
> > make[1]: Leaving directory '/home/philipp/lede'
> > /home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
> > make: *** [package/glib2/compile] Error 2
> >
> >
> > That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.
> >
> > MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.
> >
> > Where is this supposed to be created?
>
> It's created by the meson host package, see devel/meson/Makefile.
>
> Sounds like your build dirs are borked, try `make dirclean`?
Since I was CC'd...

The issue is in his build environment. None of the buildbots have any
issues. No other user does either.
>
> >
> > I need to be able to get back to building packages, but I?m dead in my tracks.
> >
> > Any guidance appreciated.
> >
> > Thanks,
> >
> > -Philip
> >
>


From sander at svanheule.net  Sun Sep 27 09:59:33 2020
From: sander at svanheule.net (Sander Vanheule)
Date: Sun, 27 Sep 2020 15:59:33 +0200
Subject: [PATCH] ath79: switch to kernel loader for ar9344 CPE/WBS
Message-ID: <20200927135933.419394-1-sander@svanheule.net>

Now that firmware partitions starting with an ELF kernel loader can be
split automatically, move the TP-Link ar9344-based CPE and WBS devices
from an OKLI loader to a plain kernel loader.

This reduces the size of the device images a bit (2kB for initramfs and
sysupgrade). More importantly it takes away the requirement to
periodically resize the kernel partition to allow for larger kernels.

Note that the firmware size in tplink-safeloader.c is one erase block
smaller than the one in the DTSI, due to some runtime space reclamation
happening on these devices.

Also rebases tplink-eap2x5 on the new tplink-safeloader-elf base device.

Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
I've build tested this patch for all affected devices, but I cannot test
these new images on the CPE/WBS devices as I do not have these. Any
volunteer willing to test this patch on their device would be welcome to
do so.

 target/linux/ath79/dts/ar9344_tplink_cpe.dtsi | 15 +--------
 target/linux/ath79/image/common-tp-link.mk    |  8 ++---
 target/linux/ath79/image/generic-tp-link.mk   | 27 +++++++--------
 tools/firmware-utils/Makefile                 |  2 +-
 tools/firmware-utils/src/tplink-safeloader.c  | 33 +++++++------------
 5 files changed, 27 insertions(+), 58 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
index 044f6c5c19..27c85a8491 100644
--- a/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
@@ -63,22 +63,9 @@
 			};
 
 			partition at 40000 {
+				compatible = "openwrt,elf";
 				label = "firmware";
 				reg = <0x040000 0x780000>;
-
-				compatible = "fixed-partitions";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				partition at 0 {
-					label = "kernel";
-					reg = <0x000000 0x300000>;
-				};
-
-				partition at 300000 {
-					label = "rootfs";
-					reg = <0x300000 0x480000>;
-				};
 			};
 
 			partition at 7c0000 {
diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk
index 0b7b0e1935..7ce71811bb 100644
--- a/target/linux/ath79/image/common-tp-link.mk
+++ b/target/linux/ath79/image/common-tp-link.mk
@@ -84,13 +84,9 @@ define Device/tplink-safeloader-uimage
   KERNEL_INITRAMFS := $$(KERNEL)
 endef
 
-define Device/tplink-safeloader-okli
+define Device/tplink-safeloader-elf
   $(Device/tplink-safeloader)
   LOADER_TYPE := elf
-  LOADER_FLASH_OFFS := 0x43000
-  COMPILE := loader-$(1).elf
-  COMPILE/loader-$(1).elf := loader-okli-compile
-  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | \
-	loader-okli $(1) 12288
+  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel
   KERNEL_INITRAMFS := $$(KERNEL)
 endef
diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index 22d1ac8a9e..3a066c1fd6 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -247,7 +247,7 @@ endef
 TARGET_DEVICES += tplink_archer-d7b-v1
 
 define Device/tplink_cpe210-v1
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE210
@@ -285,7 +285,7 @@ endef
 TARGET_DEVICES += tplink_cpe210-v3
 
 define Device/tplink_cpe220-v2
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE220
@@ -308,7 +308,7 @@ endef
 TARGET_DEVICES += tplink_cpe220-v3
 
 define Device/tplink_cpe510-v1
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE510
@@ -320,7 +320,7 @@ endef
 TARGET_DEVICES += tplink_cpe510-v1
 
 define Device/tplink_cpe510-v2
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE510
@@ -332,7 +332,7 @@ endef
 TARGET_DEVICES += tplink_cpe510-v2
 
 define Device/tplink_cpe510-v3
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE510
@@ -343,7 +343,7 @@ endef
 TARGET_DEVICES += tplink_cpe510-v3
 
 define Device/tplink_cpe610-v1
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE610
@@ -353,7 +353,7 @@ endef
 TARGET_DEVICES += tplink_cpe610-v1
 
 define Device/tplink_cpe610-v2
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := CPE610
@@ -363,10 +363,7 @@ endef
 TARGET_DEVICES += tplink_cpe610-v2
 
 define Device/tplink-eap2x5
-  $(Device/tplink-safeloader)
-  LOADER_TYPE := elf
-  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel
-  KERNEL_INITRAMFS := $$(KERNEL)
+  $(Device/tplink-safeloader-elf)
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | \
 	pad-extra 128
 endef
@@ -737,7 +734,7 @@ endef
 TARGET_DEVICES += tplink_tl-wr902ac-v1
 
 define Device/tplink_wbs210-v1
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := WBS210
@@ -749,7 +746,7 @@ endef
 TARGET_DEVICES += tplink_wbs210-v1
 
 define Device/tplink_wbs210-v2
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := WBS210
@@ -760,7 +757,7 @@ endef
 TARGET_DEVICES += tplink_wbs210-v2
 
 define Device/tplink_wbs510-v1
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := WBS510
@@ -772,7 +769,7 @@ endef
 TARGET_DEVICES += tplink_wbs510-v1
 
 define Device/tplink_wbs510-v2
-  $(Device/tplink-safeloader-okli)
+  $(Device/tplink-safeloader-elf)
   SOC := ar9344
   IMAGE_SIZE := 7680k
   DEVICE_MODEL := WBS510
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..7f1754a347 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME := firmware-utils
-PKG_RELEASE := 3
+PKG_RELEASE := 4
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/kernel.mk
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 82166a9ebb..5674d2fecb 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -140,8 +140,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -263,8 +262,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -342,8 +340,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -384,8 +381,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -426,8 +422,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -466,8 +461,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -506,8 +500,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -538,8 +531,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -570,8 +562,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -603,8 +594,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
@@ -636,8 +626,7 @@ static struct device_info boards[] = {
 			{"default-mac", 0x30000, 0x00020},
 			{"product-info", 0x31100, 0x00100},
 			{"signature", 0x32000, 0x00400},
-			{"os-image", 0x40000, 0x300000},
-			{"file-system", 0x340000, 0x470000},
+			{"firmware", 0x40000, 0x770000},
 			{"soft-version", 0x7b0000, 0x00100},
 			{"support-list", 0x7b1000, 0x00400},
 			{"user-config", 0x7c0000, 0x10000},
-- 
2.26.2



From gvalkov at abv.bg  Sun Sep 27 13:02:38 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Sun, 27 Sep 2020 20:02:38 +0300
Subject: json-c: Embed RPATH on macOS to prevent error in ucert: dyld: Library
 not loaded: libjson-c.5.dylib
Message-ID: <9268FF20-9C63-42FA-8879-038D4069A25D@abv.bg>

Hello Felix!
Can you please review and commit this patch? There is also a link to the pull-request below.

json-c: Embed RPATH on macOS to prevent error in ucert: dyld: Library not loaded: libjson-c.5.dylib
https://github.com/openwrt/openwrt/pull/3391
https://bugs.openwrt.org/index.php?do=details&task_id=3328

---
 .../patches/002-Embed-RPATH-on-macOS.patch    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 package/libs/libjson-c/patches/002-Embed-RPATH-on-macOS.patch

diff --git a/package/libs/libjson-c/patches/002-Embed-RPATH-on-macOS.patch b/package/libs/libjson-c/patches/002-Embed-RPATH-on-macOS.patch
new file mode 100644
index 0000000000..352f3407e1
--- /dev/null
+++ b/package/libs/libjson-c/patches/002-Embed-RPATH-on-macOS.patch
@@ -0,0 +1,20 @@
+Index: json-c-0.14/CMakeLists.txt
+===================================================================
+--- json-c-0.14.orig/CMakeLists.txt
++++ json-c-0.14/CMakeLists.txt
+@@ -2,6 +2,15 @@
+ # specially true in old embedded systems (OpenWRT and friends) where CMake isn't necessarily upgraded.
+ cmake_minimum_required(VERSION 2.8)
+ 
++# Embed RPATH on macOS
++if(POLICY CMP0042)
++	cmake_policy(SET CMP0042 NEW)
++endif()
++
++if(POLICY CMP0068)
++	cmake_policy(SET CMP0068 NEW)
++endif()
++
+ if(POLICY CMP0048)
+ 	cmake_policy(SET CMP0048 NEW)
+ endif()
-- 
2.24.3 (Apple Git-128)


By the way, do you know someone who can add support for building on macOS with Xcode 12? Starting with a fresh clone, the build process of some host tools like bc fails due to incorrect detection by autoconf. The current workaround is to rename /Applications/Xcode.app and copy Xcode 11 in its place. I will create a separate e-mail for that. Do you know who is the maintainer of autoconf?




From gvalkov at abv.bg  Sun Sep 27 13:06:31 2020
From: gvalkov at abv.bg (Georgi Valkov)
Date: Sun, 27 Sep 2020 20:06:31 +0300
Subject: Building on macOS with Xcode 12, clang 12
Message-ID: <D07C07EB-EECF-4D31-A9AB-FD2C7D4D49C8@abv.bg>

Can anyone please add support for building on macOS with Xcode 12?
Starting with a fresh clone, the build process of some host tools like bc fails due to incorrect detection by autoconf:
For example, with Xcode 12 the build for bc fails because of the following line in config.h.
When building with Xcode 11 this line is commented out and everything compiles correctly.
#define ptrdiff_t size_t

The current workaround for building OpenWRT on macOS is to rename the /Applications/Xcode.app and copy Xcode 11 in its place.

Making all in bc
make[6]: Entering directory '/Volumes/test/openwrt/build_dir/host/bc-1.06.95/bc?
?
In file included from string.c:31:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/stddef.h:35:26: error: typedef redefinition with different types ('long' vs '__darwin_size_t' (aka 'unsigned long'))
typedef __PTRDIFF_TYPE__ ptrdiff_t;
                         ^
../config.h:121:19: note: expanded from macro 'ptrdiff_t'
#define ptrdiff_t size_t
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h:31:32: note: previous definition is here
typedef __darwin_size_t        size_t;


If anyone knows the maintainer of autoconf, please add them to this e-mail!

Georgi Valkov



From philipp_subx at redfish-solutions.com  Sun Sep 27 14:32:16 2020
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sun, 27 Sep 2020 12:32:16 -0600
Subject: Meson files missing breaking build
In-Reply-To: <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
References: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
 <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
Message-ID: <CE150FEC-4F88-4084-85FD-ADD6D75352F5@redfish-solutions.com>



> On Sep 27, 2020, at 12:13 AM, Andre Heider <a.heider at gmail.com> wrote:
> 
> On 27/09/2020 00:02, Philip Prindeville wrote:
>> Hi.
>> I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?
>> Various things like lighttpd and glib2 don?t want to build because of Meson.
>> I get errors like this:
>> make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
>> . /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
>> [ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2
>> Applying ./patches/001-no-libelf.patch using plaintext:
>> patching file gio/meson.build
>> Applying ./patches/002-no-tests.patch using plaintext:
>> patching file meson.build
>> Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext:
>> patching file glib/valgrind.h
>> Applying ./patches/004-no-distutils.patch using plaintext:
>> patching file meson.build
>> Applying ./patches/005-uclibc.patch using plaintext:
>> patching file meson.build
>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
>> rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
>> rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
>> /home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
>> bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
>> Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
>> make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
>> make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
>> time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
>> package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
>> make[1]: *** [package/feeds/packages/glib2/compile] Error 2
>> make[1]: Leaving directory '/home/philipp/lede'
>> /home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
>> make: *** [package/glib2/compile] Error 2
>> That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.
>> MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.
>> Where is this supposed to be created?
> 
> It's created by the meson host package, see devel/meson/Makefile.
> 
> Sounds like your build dirs are borked, try `make dirclean`?


Did that.

Can someone else confirm that they are able to build x86_64 on Ubuntu 18.02?



> 
>> I need to be able to get back to building packages, but I?m dead in my tracks.
>> Any guidance appreciated.
>> Thanks,
>> -Philip
> 



From philipp_subx at redfish-solutions.com  Sun Sep 27 15:44:22 2020
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Sun, 27 Sep 2020 13:44:22 -0600
Subject: Meson files missing breaking build
In-Reply-To: <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
References: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
 <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
Message-ID: <AD66F46B-9ECC-41D4-9440-68C422486750@redfish-solutions.com>



> On Sep 27, 2020, at 12:13 AM, Andre Heider <a.heider at gmail.com> wrote:
> 
> On 27/09/2020 00:02, Philip Prindeville wrote:
>> Hi.
>> I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?
>> Various things like lighttpd and glib2 don?t want to build because of Meson.
>> I get errors like this:
>> make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
>> . /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
>> [ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2
>> Applying ./patches/001-no-libelf.patch using plaintext:
>> patching file gio/meson.build
>> Applying ./patches/002-no-tests.patch using plaintext:
>> patching file meson.build
>> Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext:
>> patching file glib/valgrind.h
>> Applying ./patches/004-no-distutils.patch using plaintext:
>> patching file meson.build
>> Applying ./patches/005-uclibc.patch using plaintext:
>> patching file meson.build
>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
>> rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
>> rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
>> /home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
>> bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
>> Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
>> make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
>> make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
>> time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
>> package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
>> make[1]: *** [package/feeds/packages/glib2/compile] Error 2
>> make[1]: Leaving directory '/home/philipp/lede'
>> /home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
>> make: *** [package/glib2/compile] Error 2
>> That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.
>> MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.
>> Where is this supposed to be created?
> 
> It's created by the meson host package, see devel/meson/Makefile.
> 
> Sounds like your build dirs are borked, try `make dirclean`?


Do I need to do anything explicit to get meson to build and install a host version?

-Philip

> 
>> I need to be able to get back to building packages, but I?m dead in my tracks.
>> Any guidance appreciated.
>> Thanks,
>> -Philip
> 



From noreply at github.com  Sun Sep 27 16:45:56 2020
From: noreply at github.com (Stephen Walker)
Date: Sun, 27 Sep 2020 13:45:56 -0700
Subject: [sdwalker/sdwalker.github.io] aee9e7: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/5286f4-aee9e7@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: aee9e7bea5ea722b638dfce41e9413f5de356ac0
      https://github.com/sdwalker/sdwalker.github.io/commit/aee9e7bea5ea722b638dfce41e9413f5de356ac0
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2020-09-27 (Sun, 27 Sep 2020)

  Changed paths:
    M uscan/index-18.06.html
    M uscan/index-19.07.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From devel-sven at geroedel.de  Sun Sep 27 17:07:38 2020
From: devel-sven at geroedel.de (Sven Roederer)
Date: Sun, 27 Sep 2020 23:07:38 +0200
Subject: [PATCH] build, imagebuilder: Do not require compilers
Message-ID: <20200927210738.21460-1-devel-sven@geroedel.de>

The buildroot and SDK both require the compilers (gcc, g++) to be
installed on the host system, however the ImageBuilder uses precompiled
binaries.

This patch changes the prerequirements checks to skip the checking for
the compilers if running as ImageBuilder. A similar change has been
made for libncurses-dev in 4a1a58a3e2d2.

Signed-off-by: Sven Roederer <devel-sven at geroedel.de>
---
 include/prereq-build.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 4637c6ca50..f67a01299e 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -26,6 +26,7 @@ $(eval $(call TestHostCommand,proper-umask, \
 	Please build with umask 022 - other values produce broken packages, \
 	umask | grep -xE 0?0[012][012]))
 
+ifndef IB
 $(eval $(call SetupHostCommand,gcc, \
 	Please install the GNU C Compiler (gcc) 4.8 or later, \
 	$(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
@@ -37,7 +38,9 @@ $(eval $(call TestHostCommand,working-gcc, \
 	it appears to be broken, \
 	echo 'int main(int argc, char **argv) { return 0; }' | \
 		gcc -x c -o $(TMP_DIR)/a.out -))
+endif
 
+ifndef IB
 $(eval $(call SetupHostCommand,g++, \
 	Please install the GNU C++ Compiler (g++) 4.8 or later, \
 	$(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
@@ -50,6 +53,7 @@ $(eval $(call TestHostCommand,working-g++, \
 	echo 'int main(int argc, char **argv) { return 0; }' | \
 		g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
 		$(TMP_DIR)/a.out))
+endif
 
 ifndef IB
 $(eval $(call TestHostCommand,ncurses, \
-- 
2.20.1



From mail at adrianschmutzler.de  Sun Sep 27 17:55:16 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Sun, 27 Sep 2020 23:55:16 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
Message-ID: <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Adrian Schmutzler
> Sent: Samstag, 26. September 2020 18:25
> To: openwrt-devel at lists.openwrt.org
> Subject: [RFC PATCH] ath79: remove model name from LED labels
> 
> Currently, we request LED labels in OpenWrt to follow the scheme
> 
>   modelname:color:function
> 
> However, specifying the modelname at the beginning is actually
> entirely useless for the devices we support in OpenWrt. On the
> contrary, having this part actually introduces inconvenience in
> several aspects:

I've added the missing 01_leds changes, ramips targets and a few minor things and pushed everything to a PR here:

https://github.com/openwrt/openwrt/pull/3464

Best

Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200927/504d21dc/attachment.sig>

From cotequeiroz at gmail.com  Sun Sep 27 18:01:27 2020
From: cotequeiroz at gmail.com (Eneas U de Queiroz)
Date: Sun, 27 Sep 2020 19:01:27 -0300
Subject: [PATCH] openssl: bump to 1.1.1h
Message-ID: <20200927220127.16674-1-cotequeiroz@gmail.com>

This is a bug-fix release.  Patches were refreshed.

Signed-off-by: Eneas U de Queiroz <cotequeiroz at gmail.com>

--

Run-tested on mvebu/WRT3200ACM using nginx and uhttpd.

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 8fe00d970b..9696748106 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
 PKG_BASE:=1.1.1
-PKG_BUGFIX:=g
+PKG_BUGFIX:=h
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
@@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \
 	ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
 	http://www.openssl.org/source/ \
 	http://www.openssl.org/source/old/$(PKG_BASE)/
-PKG_HASH:=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
+PKG_HASH:=5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch
index 0f91a9d5da..98944103b5 100644
--- a/package/libs/openssl/patches/100-Configure-afalg-support.patch
+++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch
@@ -12,7 +12,7 @@ diff --git a/Configure b/Configure
 index 5a699836f3..74d057c219 100755
 --- a/Configure
 +++ b/Configure
-@@ -1532,7 +1532,9 @@ unless ($disabled{"crypto-mdebug-backtrace"})
+@@ -1545,7 +1545,9 @@ unless ($disabled{"crypto-mdebug-backtrace"})
  
  unless ($disabled{afalgeng}) {
      $config{afalgeng}="";
diff --git a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
index fa79cc6022..7f33cb9dae 100644
--- a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
+++ b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
@@ -11,7 +11,7 @@ diff --git a/Configure b/Configure
 index 74d057c219..5813e9f8fe 100755
 --- a/Configure
 +++ b/Configure
-@@ -296,7 +296,7 @@ my $auto_threads=1;    # enable threads automatically? true by default
+@@ -318,7 +318,7 @@ my $auto_threads=1;    # enable threads automatically? true by default
  my $default_ranlib;
  
  # Top level directories to build
@@ -20,7 +20,7 @@ index 74d057c219..5813e9f8fe 100755
  # crypto/ subdirectories to build
  $config{sdirs} = [
      "objects",
-@@ -308,7 +308,7 @@ $config{sdirs} = [
+@@ -330,7 +330,7 @@ $config{sdirs} = [
      "cms", "ts", "srp", "cmac", "ct", "async", "kdf", "store"
      ];
  # test/ subdirectories to build


From a.heider at gmail.com  Mon Sep 28 02:09:11 2020
From: a.heider at gmail.com (Andre Heider)
Date: Mon, 28 Sep 2020 08:09:11 +0200
Subject: Meson files missing breaking build
In-Reply-To: <AD66F46B-9ECC-41D4-9440-68C422486750@redfish-solutions.com>
References: <BC477931-A508-40A2-8DEB-5E0A581273BF@redfish-solutions.com>
 <8e9a7d65-498e-c7f1-96d9-3eba9f56c651@gmail.com>
 <AD66F46B-9ECC-41D4-9440-68C422486750@redfish-solutions.com>
Message-ID: <dd2f0a09-f4f3-1e9c-954d-784526790bda@gmail.com>

On 27/09/2020 21:44, Philip Prindeville wrote:
> 
> 
>> On Sep 27, 2020, at 12:13 AM, Andre Heider <a.heider at gmail.com> wrote:
>>
>> On 27/09/2020 00:02, Philip Prindeville wrote:
>>> Hi.
>>> I?m having issues building a lot of packages lately, going back to June or July.  Not sure what changed then.  Maybe the 0.54.3 update to Meson?
>>> Various things like lighttpd and glib2 don?t want to build because of Meson.
>>> I get errors like this:
>>> make[2]: Entering directory '/home/philipp/lede/feeds/packages/libs/glib2'
>>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53_check
>>> . /home/philipp/lede/include/shell.sh; xzcat /home/philipp/lede/dl/glib-2.65.2.tar.xz | tar -C /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.. -xf -
>>> [ ! -d ./src/ ] || cp -fpR ./src/. /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2
>>> Applying ./patches/001-no-libelf.patch using plaintext:
>>> patching file gio/meson.build
>>> Applying ./patches/002-no-tests.patch using plaintext:
>>> patching file meson.build
>>> Applying ./patches/003-valgrind.h-mips16-fix.patch using plaintext:
>>> patching file glib/valgrind.h
>>> Applying ./patches/004-no-distutils.patch using plaintext:
>>> patching file meson.build
>>> Applying ./patches/005-uclibc.patch using plaintext:
>>> patching file meson.build
>>> touch /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.prepared_4c066b52530f924da7f5ef0d019bc503_6664517399ebbbc92a37c5bb081b5c53
>>> rm -f /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_*
>>> rm -f /home/philipp/lede/staging_dir/target-x86_64_musl/stamp/.glib2_installed
>>> /home/philipp/lede/staging_dir/host/bin/sed -e "s|@CC@|'gcc',|" -e "s|@CXX@|'g++',|" -e "s|@PKGCONFIG@|/home/philipp/lede/staging_dir/host/bin/pkg-config|" -e "s|@CFLAGS@|'-O2', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include', '-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@CXXFLAGS@|'-I/home/philipp/lede/staging_dir/host/include', '-I/home/philipp/lede/staging_dir/hostpkg/include', '-I/home/philipp/lede/staging_dir/target-x86_64_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/philipp/lede/staging_dir/host/lib', '-L/home/philipp/lede/staging_dir/hostpkg/lib', '-L/home/philipp/lede/staging_dir/target-x86_64_musl/host/lib', '-liconv', '-Wl,-rpath,/home/philipp/lede/staging_dir/hostpkg/lib',|" -e "s|@PREFIX@|/home/philipp/lede/staging_dir/hostpkg|" < /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in > /home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/openwrt-native.txt
>>> bash: /home/philipp/lede/staging_dir/hostpkg/lib/meson/openwrt-native.txt.in: No such file or directory
>>> Makefile:142: recipe for target '/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94' failed
>>> make[2]: *** [/home/philipp/lede/build_dir/target-x86_64_musl/glib-2.65.2/.configured_efb2d3cf01c707184fb77fd0fe149f94] Error 1
>>> make[2]: Leaving directory '/home/philipp/lede/feeds/packages/libs/glib2'
>>> time: package/feeds/packages/glib2/compile#0.97#0.33#1.14
>>> package/Makefile:111: recipe for target 'package/feeds/packages/glib2/compile' failed
>>> make[1]: *** [package/feeds/packages/glib2/compile] Error 2
>>> make[1]: Leaving directory '/home/philipp/lede'
>>> /home/philipp/lede/include/toplevel.mk:233: recipe for target 'package/glib2/compile' failed
>>> make: *** [package/glib2/compile] Error 2
>>> That seems to be an invocation of Meson/CreateNativeFile, defined in feeds/packages/devel/meson/meson.mk, where $(MESON_DIR)/openwrt-cross.txt.in has never been installed.
>>> MESON_DIR is $(STAGING_DIR_HOSTPKG)/lib/meson, but staging_dir/hostpkg/lib/meson doesn?t exist.
>>> Where is this supposed to be created?
>>
>> It's created by the meson host package, see devel/meson/Makefile.
>>
>> Sounds like your build dirs are borked, try `make dirclean`?
> 
> 
> Do I need to do anything explicit to get meson to build and install a host version?

Of course not.

> 
> -Philip
> 
>>
>>> I need to be able to get back to building packages, but I?m dead in my tracks.
>>> Any guidance appreciated.
>>> Thanks,
>>> -Philip
>>
> 


From dengqf6 at mail2.sysu.edu.cn  Mon Sep 28 04:54:09 2020
From: dengqf6 at mail2.sysu.edu.cn (DENG Qingfang)
Date: Mon, 28 Sep 2020 16:54:09 +0800
Subject: [PATCH] toolchain/binutils: update to 2.35.1
Message-ID: <20200928085409.32630-1-dengqf6@mail2.sysu.edu.cn>

Update binutils 2.35 to 2.35.1

Signed-off-by: DENG Qingfang <dengqf6 at mail2.sysu.edu.cn>
---
 toolchain/binutils/Config.in                                | 6 +++---
 toolchain/binutils/Config.version                           | 4 ++--
 toolchain/binutils/Makefile                                 | 4 ++--
 .../{2.35 => 2.35.1}/300-001_ld_makefile_patch.patch        | 0
 .../{2.35 => 2.35.1}/400-mips_no_dynamic_linking_sym.patch  | 0
 .../500-Change-default-emulation-for-mips64-linux.patch     | 0
 6 files changed, 7 insertions(+), 7 deletions(-)
 rename toolchain/binutils/patches/{2.35 => 2.35.1}/300-001_ld_makefile_patch.patch (100%)
 rename toolchain/binutils/patches/{2.35 => 2.35.1}/400-mips_no_dynamic_linking_sym.patch (100%)
 rename toolchain/binutils/patches/{2.35 => 2.35.1}/500-Change-default-emulation-for-mips64-linux.patch (100%)

diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
index 2303888f12..3d9e8284e9 100644
--- a/toolchain/binutils/Config.in
+++ b/toolchain/binutils/Config.in
@@ -14,9 +14,9 @@ choice
 		bool "Binutils 2.34"
 		select BINUTILS_VERSION_2_34
 
-	config BINUTILS_USE_VERSION_2_35
-		bool "Binutils 2.35"
-		select BINUTILS_VERSION_2_35
+	config BINUTILS_USE_VERSION_2_35_1
+		bool "Binutils 2.35.1"
+		select BINUTILS_VERSION_2_35_1
 endchoice
 
 config EXTRA_BINUTILS_CONFIG_OPTIONS
diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version
index 9d43675f1a..ed3018328e 100644
--- a/toolchain/binutils/Config.version
+++ b/toolchain/binutils/Config.version
@@ -5,11 +5,11 @@ config BINUTILS_VERSION_2_34
 	default y if !TOOLCHAINOPTS
 	bool
 
-config BINUTILS_VERSION_2_35
+config BINUTILS_VERSION_2_35_1
 	bool
 
 config BINUTILS_VERSION
 	string
 	default "2.32"			if BINUTILS_VERSION_2_32
 	default "2.34"			if BINUTILS_VERSION_2_34
-	default "2.35"			if BINUTILS_VERSION_2_35
+	default "2.35.1"			if BINUTILS_VERSION_2_35_1
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index 204ff3ffff..da86794480 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -23,8 +23,8 @@ ifeq ($(PKG_VERSION),2.34)
   PKG_HASH:=f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952
 endif
 
-ifeq ($(PKG_VERSION),2.35)
-  PKG_HASH:=1b11659fb49e20e18db460d44485f09442c8c56d5df165de9461eb09c8302f85
+ifeq ($(PKG_VERSION),2.35.1)
+  PKG_HASH:=3ced91db9bf01182b7e420eab68039f2083aed0a214c0424e257eae3ddee8607
 endif
 
 HOST_BUILD_PARALLEL:=1
diff --git a/toolchain/binutils/patches/2.35/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.35.1/300-001_ld_makefile_patch.patch
similarity index 100%
rename from toolchain/binutils/patches/2.35/300-001_ld_makefile_patch.patch
rename to toolchain/binutils/patches/2.35.1/300-001_ld_makefile_patch.patch
diff --git a/toolchain/binutils/patches/2.35/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.35.1/400-mips_no_dynamic_linking_sym.patch
similarity index 100%
rename from toolchain/binutils/patches/2.35/400-mips_no_dynamic_linking_sym.patch
rename to toolchain/binutils/patches/2.35.1/400-mips_no_dynamic_linking_sym.patch
diff --git a/toolchain/binutils/patches/2.35/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.35.1/500-Change-default-emulation-for-mips64-linux.patch
similarity index 100%
rename from toolchain/binutils/patches/2.35/500-Change-default-emulation-for-mips64-linux.patch
rename to toolchain/binutils/patches/2.35.1/500-Change-default-emulation-for-mips64-linux.patch
-- 
2.25.1





From cotequeiroz at gmail.com  Mon Sep 28 06:46:33 2020
From: cotequeiroz at gmail.com (Eneas U de Queiroz)
Date: Mon, 28 Sep 2020 07:46:33 -0300
Subject: [PATCH 19.07] openssl: bump to 1.1.1h
Message-ID: <20200928104633.7598-1-cotequeiroz@gmail.com>

This is a bug-fix release.  Patches were refreshed.

Signed-off-by: Eneas U de Queiroz <cotequeiroz at gmail.com>
(cherry picked from commit 475838de1a33d49d1a0b81aad374a8db6dd2b3c8)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 8fe00d970b..9696748106 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
 PKG_BASE:=1.1.1
-PKG_BUGFIX:=g
+PKG_BUGFIX:=h
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
@@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \
 	ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
 	http://www.openssl.org/source/ \
 	http://www.openssl.org/source/old/$(PKG_BASE)/
-PKG_HASH:=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
+PKG_HASH:=5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch
index 0f91a9d5da..98944103b5 100644
--- a/package/libs/openssl/patches/100-Configure-afalg-support.patch
+++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch
@@ -12,7 +12,7 @@ diff --git a/Configure b/Configure
 index 5a699836f3..74d057c219 100755
 --- a/Configure
 +++ b/Configure
-@@ -1532,7 +1532,9 @@ unless ($disabled{"crypto-mdebug-backtrace"})
+@@ -1545,7 +1545,9 @@ unless ($disabled{"crypto-mdebug-backtrace"})
  
  unless ($disabled{afalgeng}) {
      $config{afalgeng}="";
diff --git a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
index fa79cc6022..7f33cb9dae 100644
--- a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
+++ b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch
@@ -11,7 +11,7 @@ diff --git a/Configure b/Configure
 index 74d057c219..5813e9f8fe 100755
 --- a/Configure
 +++ b/Configure
-@@ -296,7 +296,7 @@ my $auto_threads=1;    # enable threads automatically? true by default
+@@ -318,7 +318,7 @@ my $auto_threads=1;    # enable threads automatically? true by default
  my $default_ranlib;
  
  # Top level directories to build
@@ -20,7 +20,7 @@ index 74d057c219..5813e9f8fe 100755
  # crypto/ subdirectories to build
  $config{sdirs} = [
      "objects",
-@@ -308,7 +308,7 @@ $config{sdirs} = [
+@@ -330,7 +330,7 @@ $config{sdirs} = [
      "cms", "ts", "srp", "cmac", "ct", "async", "kdf", "store"
      ];
  # test/ subdirectories to build


From todorcolov at abv.bg  Mon Sep 28 12:37:34 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Mon, 28 Sep 2020 19:37:34 +0300
Subject: [PATCH v4 0/4] ipq806x: add support for Linksys E8350-v1
Message-ID: <20200928163738.2348371-1-todorcolov@abv.bg>

bundle of 4 patches to add support for Linksys E8350 dual band wifi router type AC2350

FCC ID: Q87-E8350
	- device specifications are already in place under the openwrt wiki URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
	- successful test firmware has been confirmed by me and several users under developer forum: https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
	via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
		- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: +2 / +3
		- WLAN ath10k 2Ghz: via /etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
		- WLAN quantenna 5Ghz: set during quantenna firmware load - it has separate SPI flash not accessible via Openwrt OS

	The device label lists only one mac address

Installation:
	via stock WEB interface

Notes:
	Quantenna 5Ghz Wifi requires separate packages for loading its firmware and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350 v1
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys E8350v1 FW header genarator

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
 target/linux/ipq806x/image/Makefile           |  29 +++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 tools/firmware-utils/Makefile                 |   1 +
 tools/firmware-utils/src/addfwhdr.c           | 233 +++++++++++++++++
 10 files changed, 519 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

-- 
2.28.0



From todorcolov at abv.bg  Mon Sep 28 12:37:35 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Mon, 28 Sep 2020 19:37:35 +0300
Subject: [PATCH v4 1/4] ipq806x: add support for Linksys E8350 v1
In-Reply-To: <20200928163738.2348371-1-todorcolov@abv.bg>
References: <20200928163738.2348371-1-todorcolov@abv.bg>
Message-ID: <20200928163738.2348371-2-todorcolov@abv.bg>

Signed-off-by: Todor Colov <todorcolov at abv.bg>
---
 .../ipq806x/base-files/etc/board.d/01_leds    |   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh        |   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts    | 246 ++++++++++++++++++
 target/linux/ipq806x/image/Makefile           |  29 +++
 .../0069-arm-boot-add-dts-files.patch         |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 620fc12f41..e7f0b8dd7a 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -23,6 +23,9 @@ edgecore,ecw5410)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt"
 	;;
+linksys,e8350-v1)
+        ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+        ;;
 nec,wg2600hp)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 3f9d96881d..88ec76b2c9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -60,6 +60,7 @@ qcom,ipq8064-db149)
 	ucidef_add_switch "switch0" \
 		"1:lan" "2:lan" "3:lan" "4:lan" "6u at eth1" "5:wan" "0u at eth0"
 	;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
 	hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
 	ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index f61e8ee878..f1df0a4d3a 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
 		nand_do_upgrade "$1"
 		;;
 	compex,wpq864|\
+	linksys,e8350-v1|\
 	netgear,d7800 |\
 	netgear,r7500 |\
 	netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 0000000000..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+	model = "Linksys E8350 V1 WiFi Router";
+	compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+	memory at 0 {
+		reg = <0x42000000 0x1e000000>;
+		device_type = "memory";
+	};
+
+	aliases {
+		serial0 = &gsbi4_serial;
+
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&button_pins>;
+		pinctrl-names = "default";
+
+		reset {
+			label = "reset";
+			gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		wifi {
+			label = "wifi";
+			gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+		};
+	};
+
+	nand-controller at 1ac00000 {
+		compatible = "qcom,ipq806x-nand";
+		reg = <0x1ac00000 0x800>;
+		clocks = <&gcc EBI2_CLK>,
+			<&gcc EBI2_AON_CLK>;
+		clock-names = "core", "aon";
+		dmas = <&adm_dma 3>;
+		dma-names = "rxtx";
+		qcom,cmd-crci = <15>;
+		qcom,data-crci = <3>;
+
+		nand at 0 {
+			reg = <0>;
+
+			nand-ecc-strength = <4>;
+			nand-bus-width = <8>;
+
+			partitions {
+				compatible = "fixed-partitions";
+
+				partition at 0 {
+					label = "ubi";
+					reg = <0 0x4000000>;
+				};
+	
+				partition at 4000000 {
+					label = "extra";
+					reg = <0x4000000 0x4000000>;
+				};
+			};
+		};
+	};
+
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&led_pins>;
+		pinctrl-names = "default";
+
+		led_power: power {
+			label = "e8350-v1:green:power";
+			gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+		};
+
+		wps {
+			label = "e8350-v1:green:wps";
+			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
+                };
+
+		wifi {
+			label = "e8350-v1:green:wifi";
+			gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&qcom_pinmux {
+	button_pins: button_pins {
+		mux {
+			pins = "gpio68","gpio65", "gpio67";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	led_pins: led_pins {
+		mux {
+			pins = "gpio26","gpio53", "gpio54";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+};
+
+&gsbi4 {
+	qcom,mode = <GSBI_PROT_I2C_UART>;
+	status = "okay";
+	serial at 16340000 {
+		status = "okay";
+	};
+	/*
+	* The i2c device on gsbi4 should not be enabled.
+	* On ipq806x designs gsbi4 i2c is meant for exclusive
+	* RPM usage. Turning this on in kernel manifests as
+	* i2c failure for the RPM.
+	*/
+};
+&gsbi5 {
+	qcom,mode = <GSBI_PROT_SPI>;
+	status = "okay";
+
+	spi5: spi at 1a280000 {
+		status = "okay";
+
+		pinctrl-0 = <&spi_pins>;
+		pinctrl-names = "default";
+
+		cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
+
+		m25p80 at 0 {
+			compatible = "jedec,spi-nor";
+			spi-max-frequency = <51200000>;
+			reg = <0>;
+
+			partitions {
+				compatible = "qcom,smem";
+			};
+		};
+	};
+};
+
+&sata_phy {
+	status = "okay";
+};
+
+&sata {
+	status = "okay";
+};
+
+&usb3_0 {
+	clocks = <&gcc USB30_1_MASTER_CLK>;
+	status = "okay";
+};
+
+&usb3_1 {
+	clocks = <&gcc USB30_0_MASTER_CLK>;
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
+
+&pcie1 {
+	status = "okay";
+};
+
+&pcie2 {
+	status = "okay";
+};
+
+&mdio0 {
+	status = "okay";
+
+	pinctrl-0 = <&mdio0_pins>;
+	pinctrl-names = "default";
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+		qca,ar8327-initvals = <
+			0x00004 0x7600000   /* PAD0_MODE */
+			0x00008 0x1000000   /* PAD5_MODE */
+			0x0000c 0x80        /* PAD6_MODE */
+			0x00010 0x2613a0    /* PWS_REG */
+			0x000e4 0x6a545     /* MAC_POWER_SEL */
+			0x000e0 0xc74164de  /* SGMII_CTRL */
+			0x0007c 0x4e        /* PORT0_STATUS */
+			0x00094 0x4e        /* PORT6_STATUS */
+			>;
+	};
+};
+
+&gmac1 {
+	status = "okay";
+	phy-mode = "rgmii";
+	qcom,id = <1>;
+
+	pinctrl-0 = <&rgmii2_pins>;
+	pinctrl-names = "default";
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&gmac2 {
+	status = "okay";
+	phy-mode = "sgmii";
+	qcom,id = <2>;
+
+	fixed-link {
+		speed = <1000>;
+		full-duplex;
+	};
+};
+
+&tcsr {
+	qcom,usb-ctrl-select = <TCSR_USB_SELECT_USB3_DUAL>;
+	compatible = "qcom,tcsr";
+};
+
+&adm_dma {
+	status = "okay";
+};
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index ec73630ae5..d10d3c37f7 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -13,6 +13,17 @@ define Build/buffalo-rootfs-cksum
 	) >> $@
 endef
 
+# tune addpattern for Linksys E8350-V1 fw pattern generation
+define Build/linksys-bin
+        $(STAGING_DIR_HOST)/bin/addpattern -p $(FW_DEVICE_ID) -v $(FW_VERSION) $(if $(SERIAL),-s $(SERIAL)) -i $@ -o $@.new
+        mv $@.new $@
+endef
+# Use Linksys fw header generator to upgrade openwrt factory image over the native Linksys WEB interface
+define Build/linksys-addfwhdr
+        -$(STAGING_DIR_HOST)/bin/addfwhdr -i $@ -o $@.new \
+       	;mv "$@.new" "$@"
+endef
+
 define Device/Default
 	PROFILES := Default
 	KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
@@ -122,6 +133,24 @@ define Device/edgecore_ecw5410
 endef
 TARGET_DEVICES += edgecore_ecw5410
 
+define Device/linksys_e8350-v1
+        $(call Device/LegacyImage)
+        DEVICE_VENDOR := Linksys
+        DEVICE_MODEL := E8350
+        DEVICE_VARIANT := v1
+        SOC := qcom-ipq8064
+        FW_VERSION := v1.0.03.003
+        FW_DEVICE_ID := 8350
+        PAGESIZE := 2048
+        BLOCKSIZE := 128k
+        KERNEL_IN_UBI := 1
+        IMAGES = factory.bin sysupgrade.ubi
+        IMAGE/sysupgrade.ubi := append-ubi | check-size 0x04000000 | append-metadata
+        IMAGE/factory.bin := append-ubi | check-size 0x04000000 | linksys-addfwhdr | linksys-bin
+        DEVICE_PACKAGES := ath10k-firmware-qca988x-ct
+endef
+TARGET_DEVICES += linksys_e8350-v1
+
 define Device/linksys_ea7500-v1
 	$(call Device/LegacyImage)
 	DEVICE_VENDOR := Linksys
diff --git a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
index 7e15b87e39..6579233f32 100644
--- a/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq806x/patches-5.4/0069-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -843,6 +843,20 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -843,6 +843,21 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-ipq4019-ap.dk07.1-c1.dtb \
  	qcom-ipq4019-ap.dk07.1-c2.dtb \
  	qcom-ipq8064-ap148.dtb \
@@ -18,6 +18,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq8064-d7800.dtb \
 +	qcom-ipq8064-db149.dtb \
 +	qcom-ipq8064-ap161.dtb \
++	qcom-ipq8064-e8350-v1.dtb \
 +	qcom-ipq8064-ea7500-v1.dtb \
 +	qcom-ipq8064-ea8500.dtb \
 +	qcom-ipq8064-r7500.dtb \
-- 
2.28.0



From todorcolov at abv.bg  Mon Sep 28 12:37:36 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Mon, 28 Sep 2020 19:37:36 +0300
Subject: [PATCH v4 2/4] package: fix nand.sh fwtool trailer removal for UBIFS
In-Reply-To: <20200928163738.2348371-1-todorcolov@abv.bg>
References: <20200928163738.2348371-1-todorcolov@abv.bg>
Message-ID: <20200928163738.2348371-3-todorcolov@abv.bg>

Signed-off-by: Todor Colov <todorcolov at abv.bg>
---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
 	local mtddev="/dev/mtd${mtdnum}"
 	ubidetach -p "${mtddev}" || true
 	sync
+	fwtool -q -t -i /dev/null "$1"
 	ubiformat "${mtddev}" -y -f "${ubi_file}"
 	ubiattach -p "${mtddev}"
 	nand_do_upgrade_success
-- 
2.28.0



From todorcolov at abv.bg  Mon Sep 28 12:37:37 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Mon, 28 Sep 2020 19:37:37 +0300
Subject: [PATCH v4 3/4] package: fix wifi off/on functional button
In-Reply-To: <20200928163738.2348371-1-todorcolov@abv.bg>
References: <20200928163738.2348371-1-todorcolov@abv.bg>
Message-ID: <20200928163738.2348371-4-todorcolov@abv.bg>

Signed-off-by: Todor Colov <todorcolov at abv.bg>
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0



From todorcolov at abv.bg  Mon Sep 28 12:37:38 2020
From: todorcolov at abv.bg (Todor Colov)
Date: Mon, 28 Sep 2020 19:37:38 +0300
Subject: [PATCH v4 4/4] tools: addfwhrd Linksys E8350v1 FW header genarator
In-Reply-To: <20200928163738.2348371-1-todorcolov@abv.bg>
References: <20200928163738.2348371-1-todorcolov@abv.bg>
Message-ID: <20200928163738.2348371-5-todorcolov@abv.bg>

Signed-off-by: Todor Colov <todorcolov at abv.bg>
---
 tools/firmware-utils/Makefile       |   1 +
 tools/firmware-utils/src/addfwhdr.c | 233 ++++++++++++++++++++++++++++
 2 files changed, 234 insertions(+)
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..b83acc7652 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -25,6 +25,7 @@ endef
 define Host/Compile
 	mkdir -p $(HOST_BUILD_DIR)/bin
 	$(call cc,add_header)
+	$(call cc,addfwhdr cyg_crc32)
 	$(call cc,addpattern)
 	$(call cc,asustrx)
 	$(call cc,buffalo-enc buffalo-lib,-Wall)
diff --git a/tools/firmware-utils/src/addfwhdr.c b/tools/firmware-utils/src/addfwhdr.c
new file mode 100644
index 0000000000..ada56e6abf
--- /dev/null
+++ b/tools/firmware-utils/src/addfwhdr.c
@@ -0,0 +1,233 @@
+/*
+	Linksys e8350 v1 firmware header generator
+*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <getopt.h>
+#include <time.h>
+#include <sys/time.h>
+
+#include "cyg_crc.h"
+#define AC2350          20
+#define USA             1
+
+#if LOCALE == USA
+	#define CYBERTAN_VERSION        "v1.0.03"
+	#define SERIAL_NUMBER   "003"
+	#define MINOR_VERSION   ""
+	#define BUILD_KEYWORD   " B"
+	#define BUILD_NUMBER    SERIAL_NUMBER
+	#define BETA_VERSION    " "
+	#define CYBERTAN_UBOOT_VERSION      "v1.0"
+#else   // ETSI
+	#define CYBERTAN_VERSION    "v1.0.00"
+	#define SERIAL_NUMBER       "01"
+	#define MINOR_VERSION       ""
+	#define BUILD_KEYWORD   " B"
+	#define BUILD_NUMBER    SERIAL_NUMBER
+	#define BETA_VERSION    " "
+	#define CYBERTAN_UBOOT_VERSION      "v1.0"
+#endif
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+	unsigned int magic;             /* "CHDR" */
+	unsigned int len;               /* Length of file including header */
+	unsigned int crc32;             /* 32-bit CRC */
+	unsigned int res;
+};
+
+#define MAX_BUF	1024
+#define CRC32_INIT_VALUE 0xffffffff	/* Initial CRC32 checksum value */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char   uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short  uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned int    uint32;
+#endif
+
+typedef uint32_t cyg_uint32;
+typedef uint16_t cyg_uint16;
+
+extern cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len);
+//extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+	va_list args;
+	va_start(args, str);
+	vfprintf(stderr, str, args);
+	fputc('\n', stderr);
+	exit(1);
+}
+
+int fill_null0(int size)
+{
+	unsigned char buf[1];
+	int i;
+
+	fprintf(stderr,"Fill null\n");
+
+	buf[0] = 0xff;
+	for (i=0 ; i< size; i++ )
+		if (write(fd_w, buf, 1) != 1)
+			return 0;
+
+	return 1;
+}
+
+long file_open(const char *name)
+{
+	struct stat sb;
+	if ((fd = open(name, O_RDONLY, 0)) < 0){
+		die("Unable to open `%s' : %m", name);
+	}
+
+	if (fstat (fd, &sb))
+		die("Unable to stat `%s' : %m", name);
+
+	return sb.st_size;
+}
+
+void usage(void)
+{
+	die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+	uint input_size,c;
+	char *input_file=NULL, *output_file=NULL;
+	int opt;
+	int option_index=0;
+	int garbage = 0;
+	char *buf = NULL;
+	extern char *optarg;
+	extern int optind, opterr, optopt;
+	
+	struct cbt_fw_header *fwhdr;
+	uint32 crc;	
+
+	static struct option long_options[] =
+	{
+		{"input", 1, 0, 'i'},
+		{"output", 1, 0, 'o'},
+		{"garbage", 0, 0, 'g'},
+		{0, 0, 0, 0}
+	};
+
+	printf("\n---------- add fw header --------\n");
+
+	fwhdr  = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+
+	while(1){
+		opt = getopt_long(argc, argv, "i:o:g",long_options, &option_index);
+		if(opt == -1)
+			break;
+		switch(opt){
+			case 'h' : 
+				usage(); break;
+			case 'i' :
+				input_file = optarg;
+				printf("input file is [%s]\n",input_file); break;
+			case 'o' :
+				output_file = optarg;
+				printf("output file is [%s]\n",output_file); break;
+			case 'g' :
+				garbage = 1; break;
+			default :
+				usage();
+		}
+	}
+
+	if(!input_file || !output_file)
+	{
+		printf("You must specify the input and output file!\n");
+		usage();
+	}
+
+	
+	unlink(output_file);
+	if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREAD | S_IWRITE)) < 0){
+		die("Unable to open `%s' : %m", output_file);
+	}
+	
+	fwhdr = malloc(sizeof(struct cbt_fw_header));
+	memset(fwhdr, 0, sizeof(struct cbt_fw_header));	
+	
+	memcpy((char *)&fwhdr->magic, FWHDR_MAGIC_STR, sizeof(fwhdr->magic));
+	
+	input_size = file_open(input_file);
+	if(!(buf = malloc(input_size)))
+	{
+		perror("malloc");
+		goto fail;
+	}
+	c = read(fd, buf, input_size);
+	fwhdr->len = input_size + sizeof(struct cbt_fw_header);
+
+	fwhdr->res = fwhdr->res | 0x1;
+	
+	//junzhao add fw build date in cbt_fw_header for calculate MD5
+	#if 0
+	{
+	       static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+	       int year, day, mon=1;
+	char temp[10]={0};
+	       unsigned char *p_date = (unsigned char *)&fwhdr->res;
+	int j;
+
+	sscanf(__DATE__, "%s %d %d", temp, &day, &year);
+
+	for(j=0;j<12;j++) {
+		if(!strcmp(temp, months[j])) {
+			mon = j+1;
+			break;
+		}
+	}
+	p_date[0]= year-2000;
+	p_date[1]= mon;
+	p_date[2]= day;
+
+	       printf("%s: Build date(20%d-%d-%d)\n", __FUNCTION__, p_date[0], p_date[1], p_date[2]);
+
+	}
+	#endif
+	//end
+
+	crc = cyg_crc32_accumulate(CRC32_INIT_VALUE,(uint8 *)&fwhdr->res, 4);
+	crc = cyg_crc32_accumulate(crc,(uint8 *)&buf[0], input_size);
+	
+	fwhdr->crc32 = crc;
+
+	/* write code pattern header */
+	write(fd_w, fwhdr, sizeof(struct cbt_fw_header));
+
+	if(write(fd_w, buf, c)!=c)
+		die("Write call failed!\n");
+	
+fail:
+	if(buf)
+		free(buf);
+	close (fd);
+	close (fd_w);
+	
+	return 0;
+}
-- 
2.28.0



From mail at aparcar.org  Tue Sep 29 03:35:20 2020
From: mail at aparcar.org (Paul Spooren)
Date: Mon, 28 Sep 2020 21:35:20 -1000
Subject: [PATCH] build, imagebuilder: Do not require compilers
In-Reply-To: <20200927210738.21460-1-devel-sven@geroedel.de>
Message-ID: <C5ZOHKL3BVE7.329IM1IJQ5XAP@dawn>

On Sun Sep 27, 2020 at 11:07 AM HST, Sven Roederer wrote:
> The buildroot and SDK both require the compilers (gcc, g++) to be
> installed on the host system, however the ImageBuilder uses precompiled
> binaries.
>
> This patch changes the prerequirements checks to skip the checking for
> the compilers if running as ImageBuilder. A similar change has been
> made for libncurses-dev in 4a1a58a3e2d2.
>
> Signed-off-by: Sven Roederer <devel-sven at geroedel.de>

Acked-by: Paul Spooren <mail at aparcar.org>

> ---
> include/prereq-build.mk | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/prereq-build.mk b/include/prereq-build.mk
> index 4637c6ca50..f67a01299e 100644
> --- a/include/prereq-build.mk
> +++ b/include/prereq-build.mk
> @@ -26,6 +26,7 @@ $(eval $(call TestHostCommand,proper-umask, \
> Please build with umask 022 - other values produce broken packages, \
> umask | grep -xE 0?0[012][012]))
>  
> +ifndef IB
> $(eval $(call SetupHostCommand,gcc, \
> Please install the GNU C Compiler (gcc) 4.8 or later, \
> $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
> @@ -37,7 +38,9 @@ $(eval $(call TestHostCommand,working-gcc, \
> it appears to be broken, \
> echo 'int main(int argc, char **argv) { return 0; }' | \
> gcc -x c -o $(TMP_DIR)/a.out -))
> +endif
>  
> +ifndef IB
> $(eval $(call SetupHostCommand,g++, \
> Please install the GNU C++ Compiler (g++) 4.8 or later, \
> $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
> @@ -50,6 +53,7 @@ $(eval $(call TestHostCommand,working-g++, \
> echo 'int main(int argc, char **argv) { return 0; }' | \
> g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
> $(TMP_DIR)/a.out))
> +endif
>  
> ifndef IB
> $(eval $(call TestHostCommand,ncurses, \
> --
> 2.20.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From sander at svanheule.net  Tue Sep 29 12:20:06 2020
From: sander at svanheule.net (Sander Vanheule)
Date: Tue, 29 Sep 2020 18:20:06 +0200
Subject: [PATCH] rtl838x: clean up build instructions
Message-ID: <20200929162006.236206-1-sander@svanheule.net>

The Device/Default recipe was defined, but never used. Move definitions
that are not device-specific to Device/Default, and use it for
allnet_all-sg8208m. This should make it more straightforward to add new
devices.

The modified uImage recipe can also be simplified, similar to how
ath79/common-netgear.mk does it.

Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
 target/linux/rtl838x/image/Makefile | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/target/linux/rtl838x/image/Makefile b/target/linux/rtl838x/image/Makefile
index eef1fe0a33..0174e47449 100644
--- a/target/linux/rtl838x/image/Makefile
+++ b/target/linux/rtl838x/image/Makefile
@@ -7,36 +7,32 @@ include $(INCLUDE_DIR)/image.mk
 KERNEL_LOADADDR = 0x80000000
 KERNEL_ENTRY = 0x80000400
 
-define Build/custom-uimage
-	mkimage -A $(LINUX_KARCH) \
-		-O linux -T kernel \
-		-C gzip -a $(KERNEL_LOADADDR) $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC),) \
-		-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-		-n '$(1)' -d $@ $@.new
-	mv $@.new $@
-endef
+DEVICE_VARS += UIMAGE_MAGIC
 
+define Build/realtek-uImage
+	$(call Build/uImage,$(1) $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC),))
+endef
 
 define Device/Default
   PROFILES = Default
-  KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
-  KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | uImage gzip
+  KERNEL := kernel-bin | append-dtb | gzip | realtek-uImage gzip
+  KERNEL_INITRAMFS := $$(KERNEL)
   DEVICE_DTS_DIR := ../dts
   DEVICE_DTS = $$(SOC)_$(1)
   SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
   IMAGES := sysupgrade.bin
-  IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | \
-	append-metadata | check-size
+  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
+      append-metadata | check-size
 endef
 
 define Device/allnet_all-sg8208m
+  $(Device/Default)
   SOC := rtl8382
   IMAGE_SIZE := 7168k
   DEVICE_VENDOR := ALLNET
   DEVICE_MODEL := ALL-SG8208M
   UIMAGE_MAGIC := 0x00000006
-  KERNEL := kernel-bin | append-dtb | gzip | custom-uimage 2.2.2.0
-  KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | custom-uimage 2.2.2.0
+  UIMAGE_NAME := 2.2.2.0
   DEVICE_PACKAGES := ip-full ip-bridge kmod-gpio-button-hotplug tc
 endef
 TARGET_DEVICES += allnet_all-sg8208m
-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:21:54 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:21:54 -0500
Subject: [PATCH 0/5] Improvements to the hardware watchdog code of procd
Message-ID: <a9d594fc-17c9-4ba6-7d99-28150e53ffe7@meshplusplus.com>

This set of patches makes various minor improvements to the hardware
watchdog code of procd.

The first patch adds a new feature to allow the watchdog to be manually
tickled via ubus.

The other patches are minor optimizations and improvements.

Michael Jones (5):
? initd: Add ubus argument to trigger watchdog tickle.
? initd: Re-use the watchdog_set_cloexec() function from watchdog_open()
? initd: Ensure that watchdog frequency changes apply right away
? initd: Don't search the environment list if the watchdog fd is initialized
? initd: Convert the watchdog_fd return value from char* to int

?initd/preinit.c | 11 ++++++++---
?system.c??????? |? 7 ++++++-
?sysupgrade.c??? |? 8 +++++---
?watchdog.c????? | 19 ++++++-------------
?watchdog.h????? |? 6 +++---
?5 files changed, 28 insertions(+), 23 deletions(-)

-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:21:59 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:21:59 -0500
Subject: [PATCH 1/5] initd: Add ubus argument to trigger watchdog tickle.
Message-ID: <1bd3926c-4d8c-5bfd-ef2f-336c6f30ef36@meshplusplus.com>

Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
?system.c | 5 +++++
?1 file changed, 5 insertions(+)

diff --git a/system.c b/system.c
index 0fb98f1..ef7943a 100644
--- a/system.c
+++ b/system.c
@@ -325,6 +325,7 @@ enum {
???? WDT_TIMEOUT,
???? WDT_MAGICCLOSE,
???? WDT_STOP,
+??? WDT_TICKLE,
???? __WDT_MAX
?};
?
@@ -333,6 +334,7 @@ static const struct blobmsg_policy
watchdog_policy[__WDT_MAX] = {
???? [WDT_TIMEOUT] = { .name = "timeout", .type = BLOBMSG_TYPE_INT32 },
???? [WDT_MAGICCLOSE] = { .name = "magicclose", .type = BLOBMSG_TYPE_BOOL },
???? [WDT_STOP] = { .name = "stop", .type = BLOBMSG_TYPE_BOOL },
+??? [WDT_TICKLE] = { .name = "tickle", .type = BLOBMSG_TYPE_BOOL },
?};
?
?static int watchdog_set(struct ubus_context *ctx, struct ubus_object *obj,
@@ -367,6 +369,9 @@ static int watchdog_set(struct ubus_context *ctx,
struct ubus_object *obj,
???? ??? watchdog_timeout(timeout);
???? }
?
+??? if (tb[WDT_TICKLE] && blobmsg_get_bool(tb[WDT_TICKLE]))
+??? ??? watchdog_ping();
+
???? if (tb[WDT_MAGICCLOSE])
???? ??? watchdog_set_magicclose(blobmsg_get_bool(tb[WDT_MAGICCLOSE]));
?
-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:22:04 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:22:04 -0500
Subject: [PATCH 3/5] initd: Ensure that watchdog frequency changes apply right
 away
Message-ID: <33a0253a-1bd6-d223-2cd6-1e92ed8a4ccc@meshplusplus.com>

If the watchdog frequency is changed from high to low,
the watchdog won't be tickled again until the previous
period has expired, which may result in a watchdog timeout.
This change ensures that the new frequency is applied immediately.

Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
?watchdog.c | 1 +
?1 file changed, 1 insertion(+)

diff --git a/watchdog.c b/watchdog.c
index 20b6e20..20830c3 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -140,6 +140,7 @@ int watchdog_frequency(int frequency)
???? if (frequency) {
???? ??? DEBUG(4, "Set watchdog frequency: %ds\n", frequency);
???? ??? wdt_frequency = frequency;
+??? ??? watchdog_timeout_cb(&wdt_timeout);
???? }
?
???? return wdt_frequency;
-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:22:12 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:22:12 -0500
Subject: [PATCH 2/5] initd: Re-use the watchdog_set_cloexec() function from,
 watchdog_open()
Message-ID: <e0774132-1795-337a-5dec-07e5a257186e@meshplusplus.com>

Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
?watchdog.c | 3 +--
?1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/watchdog.c b/watchdog.c
index 9d770b4..20b6e20 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -65,8 +65,7 @@ static int watchdog_open(bool cloexec)
???? if (wdt_fd < 0)
???? ??? return wdt_fd;
?
-??? if (cloexec)
-??? ??? fcntl(wdt_fd, F_SETFD, fcntl(wdt_fd, F_GETFD) | FD_CLOEXEC);
+??? watchdog_set_cloexec(cloexec);
?
???? return wdt_fd;
?}
-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:22:19 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:22:19 -0500
Subject: [PATCH 4/5] initd: Don't search the environment list if the watchdog, 
 fd is initialized
Message-ID: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>

Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
?watchdog.c | 4 ++--
?1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/watchdog.c b/watchdog.c
index 20830c3..ac5b656 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
?
?static int watchdog_open(bool cloexec)
?{
-??? char *env = getenv("WDTFD");
-
???? if (wdt_fd >= 0)
???? ??? return wdt_fd;
?
+??? char *env = getenv("WDTFD");
+
???? if (env) {
???? ??? DEBUG(2, "Watchdog handover: fd=%s\n", env);
???? ??? wdt_fd = atoi(env);
-- 
2.26.2



From mike at meshplusplus.com  Tue Sep 29 12:22:24 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 11:22:24 -0500
Subject: [PATCH 5/5] initd: Convert the watchdog_fd return value from char* to
 int
Message-ID: <156b08bb-28f9-946f-134a-3d425d518fe3@meshplusplus.com>

This change improves the frequently called path of determining
if the watchdog is alive when responding to ubus transactions
at the expense of complicating the less frequently called code
of transitioning to the upgraded binary, and transitioning from
pre-init to procd.

Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
?initd/preinit.c | 11 ++++++++---
?system.c??????? |? 2 +-
?sysupgrade.c??? |? 8 +++++---
?watchdog.c????? | 11 ++---------
?watchdog.h????? |? 6 +++---
?5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/initd/preinit.c b/initd/preinit.c
index 9dfe5c1..255ceeb 100644
--- a/initd/preinit.c
+++ b/initd/preinit.c
@@ -90,7 +90,7 @@ fail:
?static void
?spawn_procd(struct uloop_process *proc, int ret)
?{
-??? char *wdt_fd = watchdog_fd();
+??? int wdt_fd = watchdog_fd();
???? char *argv[] = { "/sbin/procd", NULL};
???? char dbg[2];
?
@@ -104,8 +104,13 @@ spawn_procd(struct uloop_process *proc, int ret)
???? check_sysupgrade();
?
???? DEBUG(2, "Exec to real procd now\n");
-??? if (wdt_fd)
-??? ??? setenv("WDTFD", wdt_fd, 1);
+
+??? if (wdt_fd >= 0) {
+??? ??? char fd_buf[12];
+??? ??? snprintf(fd_buf, sizeof(fd_buf), "%d", wdt_fd);
+??? ??? setenv("WDTFD", fd_buf, 1);
+??? }
+
???? check_dbglvl();
???? if (debug > 0) {
???? ??? snprintf(dbg, 2, "%d", debug);
diff --git a/system.c b/system.c
index ef7943a..caae0ec 100644
--- a/system.c
+++ b/system.c
@@ -378,7 +378,7 @@ static int watchdog_set(struct ubus_context *ctx,
struct ubus_object *obj,
???? if (tb[WDT_STOP])
???? ??? watchdog_set_stopped(blobmsg_get_bool(tb[WDT_STOP]));
?
-??? if (watchdog_fd() == NULL)
+??? if (watchdog_fd() < 0)
???? ??? status = "offline";
???? else if (watchdog_get_stopped())
???? ??? status = "stopped";
diff --git a/sysupgrade.c b/sysupgrade.c
index fc588b0..20e1ef0 100644
--- a/sysupgrade.c
+++ b/sysupgrade.c
@@ -29,7 +29,7 @@ void sysupgrade_exec_upgraded(const char *prefix, char
*path,
???? ??? ??? ????? const char *backup, char *command,
???? ??? ??? ????? struct blob_attr *options)
?{
-??? char *wdt_fd = watchdog_fd();
+??? int wdt_fd = watchdog_fd();
???? char *argv[] = { "/sbin/upgraded", NULL, NULL, NULL};
???? struct blob_attr *option;
???? int rem;
@@ -44,9 +44,11 @@ void sysupgrade_exec_upgraded(const char *prefix,
char *path,
???? argv[1] = path;
???? argv[2] = command;
?
-??? if (wdt_fd) {
+??? if (wdt_fd >= 0) {
+??? ??? char fd_buf[12];
+??? ??? snprintf(fd_buf, sizeof(fd_buf), "%d", wdt_fd);
???? ??? watchdog_set_cloexec(false);
-??? ??? setenv("WDTFD", wdt_fd, 1);
+??? ??? setenv("WDTFD", fd_buf, 1);
???? }
?
???? if (backup)
diff --git a/watchdog.c b/watchdog.c
index ac5b656..3c565d2 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -146,16 +146,9 @@ int watchdog_frequency(int frequency)
???? return wdt_frequency;
?}
?
-char* watchdog_fd(void)
+int watchdog_fd(void)
?{
-??? static char fd_buf[12];
-
-??? if (wdt_fd < 0)
-??? ??? return NULL;
-
-??? snprintf(fd_buf, sizeof(fd_buf), "%d", wdt_fd);
-
-??? return fd_buf;
+??? return wdt_fd;
?}
?
?void watchdog_init(int preinit)
diff --git a/watchdog.h b/watchdog.h
index 73c75d5..3c35d9a 100644
--- a/watchdog.h
+++ b/watchdog.h
@@ -19,7 +19,7 @@
?
?#ifndef DISABLE_INIT
?void watchdog_init(int preinit);
-char* watchdog_fd(void);
+int watchdog_fd(void);
?int watchdog_timeout(int timeout);
?int watchdog_frequency(int frequency);
?void watchdog_set_magicclose(bool val);
@@ -33,9 +33,9 @@ static inline void watchdog_init(int preinit)
?{
?}
?
-static inline char* watchdog_fd(void)
+static inline int watchdog_fd(void)
?{
-??? return "";
+??? return -1;
?}
?
?static inline int watchdog_timeout(int timeout)
-- 
2.26.2



From mail at adrianschmutzler.de  Tue Sep 29 13:44:54 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Tue, 29 Sep 2020 19:44:54 +0200
Subject: [PATCH] rtl838x: clean up build instructions
In-Reply-To: <20200929162006.236206-1-sander@svanheule.net>
References: <20200929162006.236206-1-sander@svanheule.net>
Message-ID: <020001d69688$3e230750$ba6915f0$@adrianschmutzler.de>

Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Sander Vanheule
> Sent: Dienstag, 29. September 2020 18:20
> To: openwrt-devel at lists.openwrt.org
> Cc: Sander Vanheule <sander at svanheule.net>
> Subject: [PATCH] rtl838x: clean up build instructions
> 
> The Device/Default recipe was defined, but never used. Move definitions
> that are not device-specific to Device/Default, and use it for allnet_all-
> sg8208m. This should make it more straightforward to add new devices.
> 
> The modified uImage recipe can also be simplified, similar to how
> ath79/common-netgear.mk does it.
> 
> Signed-off-by: Sander Vanheule <sander at svanheule.net>
> ---
>  target/linux/rtl838x/image/Makefile | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/target/linux/rtl838x/image/Makefile
> b/target/linux/rtl838x/image/Makefile
> index eef1fe0a33..0174e47449 100644
> --- a/target/linux/rtl838x/image/Makefile
> +++ b/target/linux/rtl838x/image/Makefile
> @@ -7,36 +7,32 @@ include $(INCLUDE_DIR)/image.mk  KERNEL_LOADADDR
> = 0x80000000  KERNEL_ENTRY = 0x80000400
> 
> -define Build/custom-uimage
> -	mkimage -A $(LINUX_KARCH) \
> -		-O linux -T kernel \
> -		-C gzip -a $(KERNEL_LOADADDR) $(if $(UIMAGE_MAGIC),-M
> $(UIMAGE_MAGIC),) \
> -		-e $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> -		-n '$(1)' -d $@ $@.new
> -	mv $@.new $@
> -endef
> +DEVICE_VARS += UIMAGE_MAGIC
> 
> +define Build/realtek-uImage
> +	$(call Build/uImage,$(1) $(if $(UIMAGE_MAGIC),-M
> $(UIMAGE_MAGIC),))
> +endef

I like the idea, but don't like this hack with the argument.
Either we can move the if here into image-commands.mk (which won't work if we need UIMAGE_MAGIC only for certain recipes ...), or I'd keep the old one.

> 
>  define Device/Default
>    PROFILES = Default
> -  KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
> -  KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | uImage gzip
> +  KERNEL := kernel-bin | append-dtb | gzip | realtek-uImage gzip

So, can we assume that we always need the magic for this target?

> + KERNEL_INITRAMFS := $$(KERNEL)
>    DEVICE_DTS_DIR := ../dts
>    DEVICE_DTS = $$(SOC)_$(1)
>    SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
>    IMAGES := sysupgrade.bin
> -  IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs |
> pad-rootfs | \
> -	append-metadata | check-size
> +  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
> +      append-metadata | check-size

I'm not sure whether this is correct, but it should be a separate change anyway.

>  endef
> 
>  define Device/allnet_all-sg8208m
> +  $(Device/Default)

Device/Default is added to all devices by default (if it's defined) automatically!

https://github.com/openwrt/openwrt/blob/master/include/image.mk#L696

So, this would actually add it a second time.

Best

Adrian

>    SOC := rtl8382
>    IMAGE_SIZE := 7168k
>    DEVICE_VENDOR := ALLNET
>    DEVICE_MODEL := ALL-SG8208M
>    UIMAGE_MAGIC := 0x00000006
> -  KERNEL := kernel-bin | append-dtb | gzip | custom-uimage 2.2.2.0
> -  KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | custom-uimage
> 2.2.2.0
> +  UIMAGE_NAME := 2.2.2.0
>    DEVICE_PACKAGES := ip-full ip-bridge kmod-gpio-button-hotplug tc  endef
> TARGET_DEVICES += allnet_all-sg8208m
> --
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200929/2e822078/attachment.sig>

From john at phrozen.org  Tue Sep 29 14:47:44 2020
From: john at phrozen.org (John Crispin)
Date: Tue, 29 Sep 2020 20:47:44 +0200
Subject: [PATCH 4/5] initd: Don't search the environment list if the
 watchdog, fd is initialized
In-Reply-To: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
References: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
Message-ID: <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>


On 29.09.20 18:22, Michael Jones wrote:
> Signed-off-by: Michael Jones <mike at meshplusplus.com>
> ---
>  ?watchdog.c | 4 ++--
>  ?1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/watchdog.c b/watchdog.c
> index 20830c3..ac5b656 100644
> --- a/watchdog.c
> +++ b/watchdog.c
> @@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
>   
>  ?static int watchdog_open(bool cloexec)
>  ?{
> -??? char *env = getenv("WDTFD");
> -
>  ???? if (wdt_fd >= 0)
>  ???? ??? return wdt_fd;
>   
> +??? char *env = getenv("WDTFD");
> +
>  ???? if (env) {
>  ???? ??? DEBUG(2, "Watchdog handover: fd=%s\n", env);
>  ???? ??? wdt_fd = atoi(env);

this breaks c99 compliance

 ??? John



From mike at meshplusplus.com  Tue Sep 29 14:55:35 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 13:55:35 -0500
Subject: [PATCH 4/5] initd: Don't search the environment list if the
 watchdog, fd is initialized
In-Reply-To: <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>
References: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
 <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>
Message-ID: <CAJQUmm4pc8b6AgXBrmfmdcrg_KhX98ytgTHJP7b4ZPWZ3Pj=Fw@mail.gmail.com>

On Tue, Sep 29, 2020 at 1:47 PM John Crispin <john at phrozen.org> wrote:
>
>
> On 29.09.20 18:22, Michael Jones wrote:
> > Signed-off-by: Michael Jones <mike at meshplusplus.com>
> > ---
> >   watchdog.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/watchdog.c b/watchdog.c
> > index 20830c3..ac5b656 100644
> > --- a/watchdog.c
> > +++ b/watchdog.c
> > @@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
> >
> >   static int watchdog_open(bool cloexec)
> >   {
> > -    char *env = getenv("WDTFD");
> > -
> >       if (wdt_fd >= 0)
> >           return wdt_fd;
> >
> > +    char *env = getenv("WDTFD");
> > +
> >       if (env) {
> >           DEBUG(2, "Watchdog handover: fd=%s\n", env);
> >           wdt_fd = atoi(env);
>
> this breaks c99 compliance
>
>      John
>

Do you mean C89 compliance? This should compile just fine in C99.

C99 was released 20 years ago, and C89 30 years ago. I'm personally
not interested in supporting either.

The patch can be modified, or used as inspiration, by someone who is
concerned about C89/C99 compliance and would like to see the
watchdog_open() function improved in this way.


From john at phrozen.org  Tue Sep 29 14:59:30 2020
From: john at phrozen.org (John Crispin)
Date: Tue, 29 Sep 2020 20:59:30 +0200
Subject: [PATCH 4/5] initd: Don't search the environment list if the
 watchdog, fd is initialized
In-Reply-To: <CAJQUmm4pc8b6AgXBrmfmdcrg_KhX98ytgTHJP7b4ZPWZ3Pj=Fw@mail.gmail.com>
References: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
 <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>
 <CAJQUmm4pc8b6AgXBrmfmdcrg_KhX98ytgTHJP7b4ZPWZ3Pj=Fw@mail.gmail.com>
Message-ID: <2f48f1c8-9f25-cdfc-048b-37b68ca6e7ce@phrozen.org>


On 29.09.20 20:55, Michael Jones wrote:
> On Tue, Sep 29, 2020 at 1:47 PM John Crispin <john at phrozen.org> wrote:
>>
>> On 29.09.20 18:22, Michael Jones wrote:
>>> Signed-off-by: Michael Jones <mike at meshplusplus.com>
>>> ---
>>>    watchdog.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/watchdog.c b/watchdog.c
>>> index 20830c3..ac5b656 100644
>>> --- a/watchdog.c
>>> +++ b/watchdog.c
>>> @@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
>>>
>>>    static int watchdog_open(bool cloexec)
>>>    {
>>> -    char *env = getenv("WDTFD");
>>> -
>>>        if (wdt_fd >= 0)
>>>            return wdt_fd;
>>>
>>> +    char *env = getenv("WDTFD");
>>> +
>>>        if (env) {
>>>            DEBUG(2, "Watchdog handover: fd=%s\n", env);
>>>            wdt_fd = atoi(env);
>> this breaks c99 compliance
>>
>>       John
>>
> Do you mean C89 compliance? This should compile just fine in C99.
>
> C99 was released 20 years ago, and C89 30 years ago. I'm personally
> not interested in supporting either.
>
> The patch can be modified, or used as inspiration, by someone who is
> concerned about C89/C99 compliance and would like to see the
> watchdog_open() function improved in this way.


variable declarations should always be at the start of the function.

 ??? John



From mike at meshplusplus.com  Tue Sep 29 15:00:52 2020
From: mike at meshplusplus.com (Michael Jones)
Date: Tue, 29 Sep 2020 14:00:52 -0500
Subject: [PATCH 4/5] initd: Don't search the environment list if the
 watchdog, fd is initialized
In-Reply-To: <2f48f1c8-9f25-cdfc-048b-37b68ca6e7ce@phrozen.org>
References: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
 <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>
 <CAJQUmm4pc8b6AgXBrmfmdcrg_KhX98ytgTHJP7b4ZPWZ3Pj=Fw@mail.gmail.com>
 <2f48f1c8-9f25-cdfc-048b-37b68ca6e7ce@phrozen.org>
Message-ID: <CAJQUmm7z4g-m59WmZS4ybx-mfKfZyNMCDX0CZZeS3608Ee=LQg@mail.gmail.com>

On Tue, Sep 29, 2020 at 1:59 PM John Crispin <john at phrozen.org> wrote:
>
>
> On 29.09.20 20:55, Michael Jones wrote:
> > On Tue, Sep 29, 2020 at 1:47 PM John Crispin <john at phrozen.org> wrote:
> >>
> >> On 29.09.20 18:22, Michael Jones wrote:
> >>> Signed-off-by: Michael Jones <mike at meshplusplus.com>
> >>> ---
> >>>    watchdog.c | 4 ++--
> >>>    1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/watchdog.c b/watchdog.c
> >>> index 20830c3..ac5b656 100644
> >>> --- a/watchdog.c
> >>> +++ b/watchdog.c
> >>> @@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
> >>>
> >>>    static int watchdog_open(bool cloexec)
> >>>    {
> >>> -    char *env = getenv("WDTFD");
> >>> -
> >>>        if (wdt_fd >= 0)
> >>>            return wdt_fd;
> >>>
> >>> +    char *env = getenv("WDTFD");
> >>> +
> >>>        if (env) {
> >>>            DEBUG(2, "Watchdog handover: fd=%s\n", env);
> >>>            wdt_fd = atoi(env);
> >> this breaks c99 compliance
> >>
> >>       John
> >>
> > Do you mean C89 compliance? This should compile just fine in C99.
> >
> > C99 was released 20 years ago, and C89 30 years ago. I'm personally
> > not interested in supporting either.
> >
> > The patch can be modified, or used as inspiration, by someone who is
> > concerned about C89/C99 compliance and would like to see the
> > watchdog_open() function improved in this way.
>
>
> variable declarations should always be at the start of the function.
>
>      John
>

Sorry, I disagree, and there was no documentation that I could see
anywhere related to this on either the OpenWRT wiki, or the procd
repository.

Take the patches or leave them. I'm not going to make updates.


From john at phrozen.org  Tue Sep 29 15:06:51 2020
From: john at phrozen.org (John Crispin)
Date: Tue, 29 Sep 2020 21:06:51 +0200
Subject: [PATCH 4/5] initd: Don't search the environment list if the
 watchdog, fd is initialized
In-Reply-To: <CAJQUmm7z4g-m59WmZS4ybx-mfKfZyNMCDX0CZZeS3608Ee=LQg@mail.gmail.com>
References: <888e39cb-5cce-762e-d52a-0b23459f78e8@meshplusplus.com>
 <292a46f4-1c4b-ad09-c632-f639472dea3f@phrozen.org>
 <CAJQUmm4pc8b6AgXBrmfmdcrg_KhX98ytgTHJP7b4ZPWZ3Pj=Fw@mail.gmail.com>
 <2f48f1c8-9f25-cdfc-048b-37b68ca6e7ce@phrozen.org>
 <CAJQUmm7z4g-m59WmZS4ybx-mfKfZyNMCDX0CZZeS3608Ee=LQg@mail.gmail.com>
Message-ID: <24ec1d13-b5ed-9cf8-57c9-2f80fa6d6e2d@phrozen.org>


On 29.09.20 21:00, Michael Jones wrote:
> On Tue, Sep 29, 2020 at 1:59 PM John Crispin <john at phrozen.org> wrote:
>>
>> On 29.09.20 20:55, Michael Jones wrote:
>>> On Tue, Sep 29, 2020 at 1:47 PM John Crispin <john at phrozen.org> wrote:
>>>> On 29.09.20 18:22, Michael Jones wrote:
>>>>> Signed-off-by: Michael Jones <mike at meshplusplus.com>
>>>>> ---
>>>>>     watchdog.c | 4 ++--
>>>>>     1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/watchdog.c b/watchdog.c
>>>>> index 20830c3..ac5b656 100644
>>>>> --- a/watchdog.c
>>>>> +++ b/watchdog.c
>>>>> @@ -49,11 +49,11 @@ static void watchdog_timeout_cb(struct uloop_timeout *t)
>>>>>
>>>>>     static int watchdog_open(bool cloexec)
>>>>>     {
>>>>> -    char *env = getenv("WDTFD");
>>>>> -
>>>>>         if (wdt_fd >= 0)
>>>>>             return wdt_fd;
>>>>>
>>>>> +    char *env = getenv("WDTFD");
>>>>> +
>>>>>         if (env) {
>>>>>             DEBUG(2, "Watchdog handover: fd=%s\n", env);
>>>>>             wdt_fd = atoi(env);
>>>> this breaks c99 compliance
>>>>
>>>>        John
>>>>
>>> Do you mean C89 compliance? This should compile just fine in C99.
>>>
>>> C99 was released 20 years ago, and C89 30 years ago. I'm personally
>>> not interested in supporting either.
>>>
>>> The patch can be modified, or used as inspiration, by someone who is
>>> concerned about C89/C99 compliance and would like to see the
>>> watchdog_open() function improved in this way.
>>
>> variable declarations should always be at the start of the function.
>>
>>       John
>>
> Sorry, I disagree, and there was no documentation that I could see
> anywhere related to this on either the OpenWRT wiki, or the procd
> repository.
>
> Take the patches or leave them. I'm not going to make updates.
>
ok !


From sander at svanheule.net  Tue Sep 29 15:44:06 2020
From: sander at svanheule.net (Sander Vanheule)
Date: Tue, 29 Sep 2020 21:44:06 +0200
Subject: [PATCH] rtl838x: clean up build instructions
In-Reply-To: <020001d69688$3e230750$ba6915f0$@adrianschmutzler.de>
References: <20200929162006.236206-1-sander@svanheule.net>
 <020001d69688$3e230750$ba6915f0$@adrianschmutzler.de>
Message-ID: <b0ad43ef7c23bca7929c3d346756cf809cea8a09.camel@svanheule.net>

Hi Adrian,

On Tue, 2020-09-29 at 19:44 +0200, Adrian Schmutzler wrote:
> > -define Build/custom-uimage
> > -	mkimage -A $(LINUX_KARCH) \
> > -		-O linux -T kernel \
> > -		-C gzip -a $(KERNEL_LOADADDR) $(if $(UIMAGE_MAGIC),-M
> > $(UIMAGE_MAGIC),) \
> > -		-e $(if
> > $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> > -		-n '$(1)' -d $@ $@.new
> > -	mv $@.new $@
> > -endef
> > +DEVICE_VARS += UIMAGE_MAGIC
> > 
> > +define Build/realtek-uImage
> > +	$(call Build/uImage,$(1) $(if $(UIMAGE_MAGIC),-M
> > $(UIMAGE_MAGIC),))
> > +endef
> 
> I like the idea, but don't like this hack with the argument.
> Either we can move the if here into image-commands.mk (which won't
> work if we need UIMAGE_MAGIC only for certain recipes ...), or I'd
> keep the old one.

I got this from target/linux/ath79/image/common-netgear.mk, but with
the optional UIMAGE_MAGIC from the original recipe. I do agree it's a
hack.

To check if the above works for both cases, I've tested this with
UIMAGE_MAGIC left undefined. Then I got the standard header magic, as
expected. So I'm not sure what you mean with "won't work if we only
need UIMAGE_MAGIC for certain recipes".

If you have no objections, I can try to turn this change into a
treewide patch so all platforms have access to (optional) custom uImage
magic bytes.

> >  define Device/Default
> >    PROFILES = Default
> > -  KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
> > -  KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | uImage gzip
> > +  KERNEL := kernel-bin | append-dtb | gzip | realtek-uImage gzip
> 
> So, can we assume that we always need the magic for this target?

As far as I can tell, the Realtek SDK seems to push OEMs to use a
custom magic. I've checked a few of the vendor firmware files for the
devices listed at https://biot.com/switches/hardware:
* Cisco SF220-24, SG220-28: 0x8380000
* D-Link DGS-1210 (Rev F): 0x12345000
* Netgear: per-device magic (like they do on other platforms)
* Zyxel GS1900-10HP, GS1900-24E: 0x83800000

The default here appears to be 0x8380000, which could go into
Device/Default then.

For devices using an older SDK (with kernel 2.6), gzip compression is
used. On the GS110TPP, with a newer SDK (and 3.18 kernel), lzma
compression is used.

> > + KERNEL_INITRAMFS := $$(KERNEL)
> >    DEVICE_DTS_DIR := ../dts
> >    DEVICE_DTS = $$(SOC)_$(1)
> >    SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
> >    IMAGES := sysupgrade.bin
> > -  IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-
> > rootfs |
> > pad-rootfs | \
> > -	append-metadata | check-size
> > +  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
> > +      append-metadata | check-size
> 
> I'm not sure whether this is correct, but it should be a separate
> change anyway.

Okay, I'll take it out of this patch and (wait to) introduce it with
another patch.

I've also had a short discussion with Birger about this. The firmware
files provided by the vendors are uImages with an initramfs, so there
doesn't really appear to be any reference for the sysupgrade images
anyway. Persistence is achieved by using a separate config partition?.

[1] https://biot.com/switches/gs110tpp#firmware

> >  endef
> > 
> >  define Device/allnet_all-sg8208m
> > +  $(Device/Default)
> 
> Device/Default is added to all devices by default (if it's defined)
> automatically!
> 
> https://github.com/openwrt/openwrt/blob/master/include/image.mk#L696
> 
> So, this would actually add it a second time.

That's my lack of experience the OpenWrt code shining through again,
I'll take it out.

Best,
Sander



From mail at adrianschmutzler.de  Wed Sep 30 07:43:26 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 30 Sep 2020 13:43:26 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
Message-ID: <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Adrian Schmutzler
> Sent: Sonntag, 27. September 2020 23:55
> To: openwrt-devel at lists.openwrt.org
> Subject: RE: [RFC PATCH] ath79: remove model name from LED labels

Hi all,

since there doesn't seem to be any interest in the subject initially, I'd also be interested if there are any general objections towards dropping "devicename" and using "color:function" scheme on LEDs.

I'd actually be quite happy to get rid of this obstacle that annoyed me consistently throughout my involvement with OpenWrt.

Best

Adrian

> 
> > -----Original Message-----
> > From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> > On Behalf Of Adrian Schmutzler
> > Sent: Samstag, 26. September 2020 18:25
> > To: openwrt-devel at lists.openwrt.org
> > Subject: [RFC PATCH] ath79: remove model name from LED labels
> >
> > Currently, we request LED labels in OpenWrt to follow the scheme
> >
> >   modelname:color:function
> >
> > However, specifying the modelname at the beginning is actually
> > entirely useless for the devices we support in OpenWrt. On the
> > contrary, having this part actually introduces inconvenience in
> > several aspects:
> 
> I've added the missing 01_leds changes, ramips targets and a few minor
> things and pushed everything to a PR here:
> 
> https://github.com/openwrt/openwrt/pull/3464
> 
> Best
> 
> Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200930/72c92bb1/attachment.sig>

From nbd at nbd.name  Wed Sep 30 07:53:59 2020
From: nbd at nbd.name (Felix Fietkau)
Date: Wed, 30 Sep 2020 13:53:59 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
Message-ID: <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>


On 2020-09-30 13:43, Adrian Schmutzler wrote:
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of Adrian Schmutzler
>> Sent: Sonntag, 27. September 2020 23:55
>> To: openwrt-devel at lists.openwrt.org
>> Subject: RE: [RFC PATCH] ath79: remove model name from LED labels
> 
> Hi all,
> 
> since there doesn't seem to be any interest in the subject initially, I'd also be interested if there are any general objections towards dropping "devicename" and using "color:function" scheme on LEDs.
> 
> I'd actually be quite happy to get rid of this obstacle that annoyed me consistently throughout my involvement with OpenWrt.
The devicename in the LEDs has also annoyed me often enough. No idea why
it was added in the first place.
I think getting rid of it is a really good idea.

- Felix


From pepe2k at gmail.com  Wed Sep 30 08:22:52 2020
From: pepe2k at gmail.com (Piotr Dymacz)
Date: Wed, 30 Sep 2020 14:22:52 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
 <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
Message-ID: <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>

Hi Felix, Adrian,

On 30.09.2020 13:53, Felix Fietkau wrote:
> 
> On 2020-09-30 13:43, Adrian Schmutzler wrote:
>>> -----Original Message-----
>>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>>> On Behalf Of Adrian Schmutzler
>>> Sent: Sonntag, 27. September 2020 23:55
>>> To: openwrt-devel at lists.openwrt.org
>>> Subject: RE: [RFC PATCH] ath79: remove model name from LED labels
>> 
>> Hi all,
>> 
>> since there doesn't seem to be any interest in the subject initially, I'd also be interested if there are any general objections towards dropping "devicename" and using "color:function" scheme on LEDs.
>> 
>> I'd actually be quite happy to get rid of this obstacle that annoyed me consistently throughout my involvement with OpenWrt.
> The devicename in the LEDs has also annoyed me often enough. No idea why
> it was added in the first place.

It comes from upstream (2006-2008):

https://github.com/torvalds/linux/commit/75c1d31d9ea71025b73430c696b727e8aa15872d

https://github.com/torvalds/linux/commit/6c152beefbf90579d21afc4f7e075b1f801f9a75

> I think getting rid of it is a really good idea.

It doesn't bring us closer to the current upstream approach (functions 
and colors IDs) but should make things easier for contributors and 
reviewers.

-- 
Cheers,
Piotr

> 
> - Felix
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 



From mail at adrianschmutzler.de  Wed Sep 30 08:49:08 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 30 Sep 2020 14:49:08 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
 <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
 <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>
Message-ID: <013f01d69728$16b89590$4429c0b0$@adrianschmutzler.de>

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Piotr Dymacz
> Sent: Mittwoch, 30. September 2020 14:23
> To: Felix Fietkau <nbd at nbd.name>; Adrian Schmutzler
> <mail at adrianschmutzler.de>; openwrt-devel at lists.openwrt.org
> Subject: Re: [RFC PATCH] ath79: remove model name from LED labels
> 
> Hi Felix, Adrian,
> 
> On 30.09.2020 13:53, Felix Fietkau wrote:
> >
> > On 2020-09-30 13:43, Adrian Schmutzler wrote:
> >>> -----Original Message-----
> >>> From: openwrt-devel [mailto:openwrt-devel-
> bounces at lists.openwrt.org]
> >>> On Behalf Of Adrian Schmutzler
> >>> Sent: Sonntag, 27. September 2020 23:55
> >>> To: openwrt-devel at lists.openwrt.org
> >>> Subject: RE: [RFC PATCH] ath79: remove model name from LED labels
> >>
> >> Hi all,
> >>
> >> since there doesn't seem to be any interest in the subject initially, I'd also
> be interested if there are any general objections towards dropping
> "devicename" and using "color:function" scheme on LEDs.
> >>
> >> I'd actually be quite happy to get rid of this obstacle that annoyed me
> consistently throughout my involvement with OpenWrt.
> > The devicename in the LEDs has also annoyed me often enough. No idea
> > why it was added in the first place.
> 
> It comes from upstream (2006-2008):
> 
> https://github.com/torvalds/linux/commit/75c1d31d9ea71025b73430c696b7
> 27e8aa15872d
> 
> https://github.com/torvalds/linux/commit/6c152beefbf90579d21afc4f7e075
> b1f801f9a75
> 
> > I think getting rid of it is a really good idea.
> 
> It doesn't bring us closer to the current upstream approach (functions and
> colors IDs) but should make things easier for contributors and reviewers.

Actually, it does, since the new upstream approach does not include a devicename in its legacy meaning (i.e. the name of the "whole" device). Instead, they _plan_ to use the name of internal devices (e.g. phy0) for the first part of the LED name when applicable (e.g. wlan0:green:activity for the WiFi 2.4g LED). The LEDs "assigned" to the whole device itself will then have only two parts, e.g. "green:power", and that's exactly what I want to do now anyway.

While we cannot use the upstream approach at the moment as it's not ready, the removal of devicename seems a good step for now, and as I understand it it's still a step into the right direction.

Thanks for your feedback.

Best

Adrian

Further reading:
https://github.com/openwrt/openwrt/pull/3437
https://www.spinics.net/lists/linux-leds/msg16592.html
https://www.spinics.net/lists/linux-leds/msg16594.html

> 
> --
> Cheers,
> Piotr
> 
> >
> > - Felix
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200930/6e7b806c/attachment-0001.sig>

From henrique at nic.br  Wed Sep 30 10:47:03 2020
From: henrique at nic.br (Henrique de Moraes Holschuh)
Date: Wed, 30 Sep 2020 11:47:03 -0300
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <013f01d69728$16b89590$4429c0b0$@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
 <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
 <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>
 <013f01d69728$16b89590$4429c0b0$@adrianschmutzler.de>
Message-ID: <69266670-f8c1-e7ee-d8bb-1e54387814e2@nic.br>

On 30/09/2020 09:49, Adrian Schmutzler wrote:
> While we cannot use the upstream approach at the moment as it's not ready, the removal of devicename seems a good step for now, and as I understand it it's still a step into the right direction.

As an user and downstream maintainer, I'd only ask that config migration 
scripts are provided where applicable.

With that caveat sorted, looks like an overall win to me.

-- 
Henrique de Moraes Holschuh
Analista de Projetos
Centro de Estudos e Pesquisas em Tecnologias de Redes e Opera??es 
(Ceptro.br)
+55 11 5509-3537 R.:4023
INOC 22548*625
www.nic.br


From mail at adrianschmutzler.de  Wed Sep 30 12:11:40 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 30 Sep 2020 18:11:40 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <69266670-f8c1-e7ee-d8bb-1e54387814e2@nic.br>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
 <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
 <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>
 <013f01d69728$16b89590$4429c0b0$@adrianschmutzler.de>
 <69266670-f8c1-e7ee-d8bb-1e54387814e2@nic.br>
Message-ID: <01bd01d69744$6230bd60$26923820$@adrianschmutzler.de>

Hi Henrique,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Henrique de Moraes Holschuh
> Sent: Mittwoch, 30. September 2020 16:47
> To: openwrt-devel at lists.openwrt.org
> Subject: Re: [RFC PATCH] ath79: remove model name from LED labels
> 
> On 30/09/2020 09:49, Adrian Schmutzler wrote:
> > While we cannot use the upstream approach at the moment as it's not
> ready, the removal of devicename seems a good step for now, and as I
> understand it it's still a step into the right direction.
> 
> As an user and downstream maintainer, I'd only ask that config migration
> scripts are provided where applicable.

Migration is currently planned like this:

https://github.com/openwrt/openwrt/pull/3464/commits/a5e71ead5744e40d73f8ca9370a569d5e0998fed

(Not tested yet.)

The idea is essentially to look for uci LED sysfs entries (/etc/config/system) with two colons, and if those are found, the part before the first colon is removed, e.g.

dir-789:green:status -> green:status

This unconditional measure should work nicely for targets like ath79. However, it will make it impossible to intentionally add a devicename unless an exception is created. On other targets where we will have upstream devices mixed with locally managed ones, the migration will have to be triggered based on the board name.
On mixed targets, we could also consider to just use the policy on new devices and don't touch the old etc.

If somebody has a better idea or if there is another location that stores the LED names I didn't think of, please tell me.

Best

Adrian

> 
> With that caveat sorted, looks like an overall win to me.
> 
> --
> Henrique de Moraes Holschuh
> Analista de Projetos
> Centro de Estudos e Pesquisas em Tecnologias de Redes e Opera??es
> (Ceptro.br)
> +55 11 5509-3537 R.:4023
> INOC 22548*625
> www.nic.br
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200930/f9524772/attachment.sig>

From martin.blumenstingl at googlemail.com  Wed Sep 30 14:55:28 2020
From: martin.blumenstingl at googlemail.com (Martin Blumenstingl)
Date: Wed, 30 Sep 2020 20:55:28 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
Message-ID: <CAFBinCDCGqCf06BhSGWXihkwPzBjKMakv8yjQH0ZzxbPyg-t-A@mail.gmail.com>

Hi Adrian,

On Sat, Sep 26, 2020 at 6:33 PM Adrian Schmutzler
<freifunk at adrianschmutzler.de> wrote:
[...]
> Apart from our needs, upstream has deprecated the label property
> entirely and introduced new properties to specify color and
> function properties separately. However, the implementation does
> not appear to be ready and probably won't become ready and/or
> match our requirements in the foreseeable future.
I recently did an experiment with the color and function properties
and it's working well for me with my F9K1115V2
to make it work I had to come up with a (simple) patch that parses the
"color" property: [0]

there's no feedback in this mail - my goal is to understand what the
concerns are so I don't "just" start porting some of my boards to the
new way that's recommended upstream only to see this patch then being
rejected in OpenWrt.


Thank you!
Martin


[0] https://github.com/xdarklight/openwrt/commit/eddaa9004f1897688a15befbd37234f9de1a7ae1.patch


From mail at adrianschmutzler.de  Wed Sep 30 15:11:35 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 30 Sep 2020 21:11:35 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <CAFBinCDCGqCf06BhSGWXihkwPzBjKMakv8yjQH0ZzxbPyg-t-A@mail.gmail.com>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <CAFBinCDCGqCf06BhSGWXihkwPzBjKMakv8yjQH0ZzxbPyg-t-A@mail.gmail.com>
Message-ID: <022301d6975d$84562880$8d027980$@adrianschmutzler.de>

Hi Martin,

> -----Original Message-----
> From: Martin Blumenstingl [mailto:martin.blumenstingl at googlemail.com]
> Sent: Mittwoch, 30. September 2020 20:55
> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> Cc: openwrt-devel at lists.openwrt.org
> Subject: Re: [RFC PATCH] ath79: remove model name from LED labels
> 
> Hi Adrian,
> 
> On Sat, Sep 26, 2020 at 6:33 PM Adrian Schmutzler
> <freifunk at adrianschmutzler.de> wrote:
> [...]
> > Apart from our needs, upstream has deprecated the label property
> > entirely and introduced new properties to specify color and function
> > properties separately. However, the implementation does not appear to
> > be ready and probably won't become ready and/or match our
> requirements
> > in the foreseeable future.
> I recently did an experiment with the color and function properties and it's
> working well for me with my F9K1115V2 to make it work I had to come up
> with a (simple) patch that parses the "color" property: [0]
> 
> there's no feedback in this mail - my goal is to understand what the concerns
> are so I don't "just" start porting some of my boards to the new way that's
> recommended upstream only to see this patch then being rejected in
> OpenWrt.

My initial idea was to go the same way; have a look at these two comment where I summarized the response from upstream and why I consider that not helpful:

https://github.com/openwrt/openwrt/pull/3437#issuecomment-696377807
https://github.com/openwrt/openwrt/pull/3437#issuecomment-699492366

Apart from that, I'm aware that we obviously have the option to _partially_ implement the upstream solution, i.e. use the color ids and just put the last part of the former label into function. However, as discussed in the referenced comments, this would essentially be an abuse of "function" as far as upstream sees it: We should create the corresponding LED_FUNCTION entries instead of putting strings into "function" directly, and my proposals for adding some of them were rejected.
Of course, we could just ignore that, and put into function what we like. That would work perfectly, it's just a little more complicated to implement in user-space as your patch shows. Nevertheless, I just hesitate to implement a system against its intention (color/function) when we have an alternate solution that we can use as intended (label).

Apart from that, as stated in the referenced comments, your solution will break anyway when kernel starts to use the devicename strings again for internal "devices" like phy0/wlan0/etc. as proposed in the discussion at linux-leds (e.g. wlan0:green:activity instead of green:wlan2g).

As I said in the PR, unfortunately all of this is essentially very unsatisfying at the moment. So, what I plan to do with the labels is as much improvement as I can get for now.

Best

Adrian

> 
> 
> Thank you!
> Martin
> 
> 
> [0]
> https://github.com/xdarklight/openwrt/commit/eddaa9004f1897688a15befb
> d37234f9de1a7ae1.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200930/edb5242e/attachment.sig>

From john at phrozen.org  Wed Sep 30 16:13:36 2020
From: john at phrozen.org (John Crispin)
Date: Wed, 30 Sep 2020 22:13:36 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <01bd01d69744$6230bd60$26923820$@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <002201d69518$e54dc040$afe940c0$@adrianschmutzler.de>
 <00b101d6971e$ea0e7f40$be2b7dc0$@adrianschmutzler.de>
 <34962cdc-6fad-647d-f3f5-8f3f1e08dfd7@nbd.name>
 <4ff90efa-2712-1de0-da6c-3dca4aeb2590@gmail.com>
 <013f01d69728$16b89590$4429c0b0$@adrianschmutzler.de>
 <69266670-f8c1-e7ee-d8bb-1e54387814e2@nic.br>
 <01bd01d69744$6230bd60$26923820$@adrianschmutzler.de>
Message-ID: <d257f414-470d-250c-28ff-a401a777ada6@phrozen.org>

skimmed over the thread and wondered what upstream does. a quick search 
yielded ...

-- https://www.kernel.org/doc/html/latest/leds/leds-class.html

Examples of proper LED names:

?red:disk?
?white:flash?
?red:indicator?
?phy1:green:wlan?
?phy3::wlan?
?:kbd_backlight?
?input5::kbd_backlight?
?input3::numlock?
?input3::scrolllock?
?input3::capslock?
?mmc1::status?
?white:status?

so there is not $board:: listed.

a script to drop the ^foo: from uci looks feasible. as a second step 
unifying the :function part should be a no brainer and a few greps 
showed that this look pretty consistent already.

I am certainly in favour of this.

 ??? John



From martin.blumenstingl at googlemail.com  Wed Sep 30 16:19:18 2020
From: martin.blumenstingl at googlemail.com (Martin Blumenstingl)
Date: Wed, 30 Sep 2020 22:19:18 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <022301d6975d$84562880$8d027980$@adrianschmutzler.de>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <CAFBinCDCGqCf06BhSGWXihkwPzBjKMakv8yjQH0ZzxbPyg-t-A@mail.gmail.com>
 <022301d6975d$84562880$8d027980$@adrianschmutzler.de>
Message-ID: <CAFBinCBLysfTS2Mgb4fJ_D-L1vfXFzR_KgxCgqdUx4VvS-p=Fg@mail.gmail.com>

Hi Adrian,

On Wed, Sep 30, 2020 at 9:11 PM Adrian Schmutzler
<mail at adrianschmutzler.de> wrote:
>
> Hi Martin,
>
> > -----Original Message-----
> > From: Martin Blumenstingl [mailto:martin.blumenstingl at googlemail.com]
> > Sent: Mittwoch, 30. September 2020 20:55
> > To: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> > Cc: openwrt-devel at lists.openwrt.org
> > Subject: Re: [RFC PATCH] ath79: remove model name from LED labels
> >
> > Hi Adrian,
> >
> > On Sat, Sep 26, 2020 at 6:33 PM Adrian Schmutzler
> > <freifunk at adrianschmutzler.de> wrote:
> > [...]
> > > Apart from our needs, upstream has deprecated the label property
> > > entirely and introduced new properties to specify color and function
> > > properties separately. However, the implementation does not appear to
> > > be ready and probably won't become ready and/or match our
> > requirements
> > > in the foreseeable future.
> > I recently did an experiment with the color and function properties and it's
> > working well for me with my F9K1115V2 to make it work I had to come up
> > with a (simple) patch that parses the "color" property: [0]
> >
> > there's no feedback in this mail - my goal is to understand what the concerns
> > are so I don't "just" start porting some of my boards to the new way that's
> > recommended upstream only to see this patch then being rejected in
> > OpenWrt.
>
> My initial idea was to go the same way; have a look at these two comment where I summarized the response from upstream and why I consider that not helpful:
>
> https://github.com/openwrt/openwrt/pull/3437#issuecomment-696377807
> https://github.com/openwrt/openwrt/pull/3437#issuecomment-699492366
Thanks for the background info!

> Apart from that, I'm aware that we obviously have the option to _partially_ implement the upstream solution, i.e. use the color ids and just put the last part of the former label into function. However, as discussed in the referenced comments, this would essentially be an abuse of "function" as far as upstream sees it: We should create the corresponding LED_FUNCTION entries instead of putting strings into "function" directly, and my proposals for adding some of them were rejected.
> Of course, we could just ignore that, and put into function what we like. That would work perfectly, it's just a little more complicated to implement in user-space as your patch shows. Nevertheless, I just hesitate to implement a system against its intention (color/function) when we have an alternate solution that we can use as intended (label).
I see

> Apart from that, as stated in the referenced comments, your solution will break anyway when kernel starts to use the devicename strings again for internal "devices" like phy0/wlan0/etc. as proposed in the discussion at linux-leds (e.g. wlan0:green:activity instead of green:wlan2g).
it will break again for anything that requires setting the default
trigger from userspace
my hope is that most LEDs will not need userspace handling for their
default behavior anymore, for example all LAN or wifi activity LEDs.
I'm not sure about corner-cases though (for example: 2GHz wifi
specific WPS LED- if that's used anywhere)

> As I said in the PR, unfortunately all of this is essentially very unsatisfying at the moment. So, what I plan to do with the labels is as much improvement as I can get for now.
my personal opinion: I would skip this intermediate step and work with
upstream to implement the LED-triggers where needed. Then backport
these patches and switch to that ABI. Rafa? did this with
ledtrig-usbport
that is because I'm not sure how hard the migration for this
intermediate step is. if much effort is required then I'd rather spend
time on something that will be usable in the future rather than
spending time on some temporary solution


Best regards,
Martin


From mail at adrianschmutzler.de  Wed Sep 30 16:55:52 2020
From: mail at adrianschmutzler.de (Adrian Schmutzler)
Date: Wed, 30 Sep 2020 22:55:52 +0200
Subject: [RFC PATCH] ath79: remove model name from LED labels
In-Reply-To: <CAFBinCBLysfTS2Mgb4fJ_D-L1vfXFzR_KgxCgqdUx4VvS-p=Fg@mail.gmail.com>
References: <20200926162520.2751-1-freifunk@adrianschmutzler.de>
 <CAFBinCDCGqCf06BhSGWXihkwPzBjKMakv8yjQH0ZzxbPyg-t-A@mail.gmail.com>
 <022301d6975d$84562880$8d027980$@adrianschmutzler.de>
 <CAFBinCBLysfTS2Mgb4fJ_D-L1vfXFzR_KgxCgqdUx4VvS-p=Fg@mail.gmail.com>
Message-ID: <028f01d6976c$157c5420$4074fc60$@adrianschmutzler.de>

> > As I said in the PR, unfortunately all of this is essentially very unsatisfying at
> the moment. So, what I plan to do with the labels is as much improvement as
> I can get for now.
> my personal opinion: I would skip this intermediate step and work with
> upstream to implement the LED-triggers where needed. Then backport
> these patches and switch to that ABI. Rafa? did this with ledtrig-usbport that
> is because I'm not sure how hard the migration for this intermediate step is.
> if much effort is required then I'd rather spend time on something that will
> be usable in the future rather than spending time on some temporary
> solution

Well, upstream isn't ready yet, and based on what it looks like now the upstream solution will make things more complicated at first.
In any case, we will need a whole lot of work both for implementation and migration (as far as I can tell from a concept).

Nevertheless, the removal of the board names is a necessary intermediate step. It will be the same amount of work (actually not much) now or later, but we will have to do it in any case. So let's do it now, so we can get the benefits right now as well. An then let's see whether upstream will reach a state where it becomes usable at some point and try to implement it then.

Best

Adrian



> 
> 
> Best regards,
> Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200930/6a11418d/attachment.sig>

