[Alternative PATCH v2 1/7] OpenWRT: Update OpenWrt, packages and routing to openwrt-18.06

Adrian Schmutzler mail at adrianschmutzler.de
Mi Okt 24 18:37:47 CEST 2018


All applied as discussed with Fabian.

> -----Original Message-----
> From: Fabian Bläse [mailto:fabian at blaese.de]
> Sent: Mittwoch, 17. Oktober 2018 18:36
> To: franken-dev at freifunk.net
> Cc: Adrian Schmutzler <freifunk at adrianschmutzler.de>; Fabian Bläse
> <fabian at blaese.de>
> Subject: [Alternative PATCH v2 1/7] OpenWRT: Update OpenWrt, packages and
> routing to openwrt-18.06
> 
> From: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> 
> Refresh patches.
> 
> Bumps batman-adv to 2018.1
> 
> This goes beyond 18.06.0 since the release contains bug which
> have been fixed in the later snapshots.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> Reviewed-by: Tim Niemeyer <tim at tn-x.org>
> [fabian at blaese.de: Use 18.06.1 for OpenWRT and packages]
> Signed-off-by: Fabian Bläse <fabian at blaese.de>
> ---
> Changes in v2:
> - Use OpenWRT 18.06.1
> ---
>  .../0001-sysupgrade-no-config-save.patch      |  12 +-
>  .../openwrt/0002-set-root-password.patch      |   6 +-
>  .../openwrt/0003-ntpd-host-as-string.patch    |   6 +-
>  ...patch => 0004-ar71xx-4.9-l2tp-stats.patch} |  12 +-
>  ...plink-safeloader-support-strings-as-.patch | 164 -----
>  ...dd-support-for-TP-Link-Archer-C25-v1.patch | 501 -------------
>  ...plink-safeloader-add-TP-Link-Archer-.patch | 114 ---
>  ...-update-qca9887-firmware-to-10.2.4-1.patch |  41 --
>  ...ktplinkfw-rework-combined-image-opti.patch | 264 -------
>  ...inkfw-combined-command-to-image-comm.patch | 103 ---
>  ...71xx-add-support-for-TL-WR1043N-v5.0.patch | 697 ------------------
>  ...t-apply-broken-power-limits-with-ATH.patch | 173 -----
>  ...ve-bs-partition-ro-flag-for-UniFi-AC.patch |  36 -
>  ...nterface-IDs-with-more-than-two-digi.patch |  35 -
>  buildscript                                   |   9 +-
>  15 files changed, 22 insertions(+), 2151 deletions(-)
>  rename build_patches/openwrt/{0004-ar71xx-4.4-l2tp-stats.patch => 0004-
> ar71xx-4.9-l2tp-stats.patch} (83%)
>  delete mode 100644 build_patches/openwrt/0005-firmware-utils-tplink-
> safeloader-support-strings-as-.patch
>  delete mode 100644 build_patches/openwrt/0006-ar71xx-add-support-for-TP-
> Link-Archer-C25-v1.patch
>  delete mode 100644 build_patches/openwrt/0007-firmware-utils-tplink-
> safeloader-add-TP-Link-Archer-.patch
>  delete mode 100644 build_patches/openwrt/0008-ath10k-firmware-update-
> qca9887-firmware-to-10.2.4-1.patch
>  delete mode 100644 build_patches/openwrt/0011-firmware-utils-mktplinkfw-
> rework-combined-image-opti.patch
>  delete mode 100644 build_patches/openwrt/0012-build-move-mktplinkfw-
> combined-command-to-image-comm.patch
>  delete mode 100644 build_patches/openwrt/0013-ar71xx-add-support-for-TL-
> WR1043N-v5.0.patch
>  delete mode 100644 build_patches/openwrt/0020-Revert-ath-do-not-apply-
> broken-power-limits-with-ATH.patch
>  delete mode 100644 build_patches/openwrt/0031-ar71xx-remove-bs-partition-
> ro-flag-for-UniFi-AC.patch
>  delete mode 100644 build_patches/routing/0001-alfred-Support-interface-IDs-
> with-more-than-two-digi.patch
> 
> diff --git a/build_patches/openwrt/0001-sysupgrade-no-config-save.patch
> b/build_patches/openwrt/0001-sysupgrade-no-config-save.patch
> index eabd5df..9cec414 100644
> --- a/build_patches/openwrt/0001-sysupgrade-no-config-save.patch
> +++ b/build_patches/openwrt/0001-sysupgrade-no-config-save.patch
> @@ -1,25 +1,25 @@
> -From 1115262b144c9fbdb9101a29681cf3d0f332f167 Mon Sep 17 00:00:00 2001
> +From 758b72379e994960ee1dcb0bf4f6db37140f59f0 Mon Sep 17 00:00:00 2001
>  From: Tim Niemeyer <tim at tn-x.org>
>  Date: Sat, 8 Jul 2017 10:46:59 +0200
> -Subject: [PATCH 1/7] sysupgrade no config save
> +Subject: [PATCH 1/4] sysupgrade no config save
> 
>  ---
>   package/base-files/files/sbin/sysupgrade | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
>  diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-
> files/files/sbin/sysupgrade
> -index c095ca8..4a97d36 100755
> +index bf5428a..e7d6f90 100755
>  --- a/package/base-files/files/sbin/sysupgrade
>  +++ b/package/base-files/files/sbin/sysupgrade
> -@@ -104,7 +104,7 @@ EOF
> +@@ -118,7 +118,7 @@ list_changed_conffiles() {
>   add_uci_conffiles() {
>   	local file="$1"
>   	( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
>  -		/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
>  +		/etc/sysupgrade.conf 2>/dev/null) \
>   		-type f -o -type l 2>/dev/null;
> - 	  opkg list-changed-conffiles ) | sort -u > "$file"
> + 	  list_changed_conffiles ) | sort -u > "$file"
>   	return 0
>  --
> -2.1.4
> +2.7.4
> 
> diff --git a/build_patches/openwrt/0002-set-root-password.patch
> b/build_patches/openwrt/0002-set-root-password.patch
> index c09165d..3837e0d 100644
> --- a/build_patches/openwrt/0002-set-root-password.patch
> +++ b/build_patches/openwrt/0002-set-root-password.patch
> @@ -1,7 +1,7 @@
> -From 5d70b1bbf367a69b876c49c22928e5897b1e8efd Mon Sep 17 00:00:00 2001
> +From b8eda046b9b2bbb5cf1feba5a0df67435aef240a Mon Sep 17 00:00:00 2001
>  From: Tim Niemeyer <tim at tn-x.org>
>  Date: Sat, 8 Jul 2017 10:47:28 +0200
> -Subject: [PATCH 2/7] set root password
> +Subject: [PATCH 2/4] set root password
> 
>  ---
>   package/base-files/files/etc/shadow | 2 +-
> @@ -18,5 +18,5 @@ index 4b4154f..b8d180a 100644
>   ftp:*:0:0:99999:7:::
>   network:*:0:0:99999:7:::
>  --
> -2.1.4
> +2.7.4
> 
> diff --git a/build_patches/openwrt/0003-ntpd-host-as-string.patch
> b/build_patches/openwrt/0003-ntpd-host-as-string.patch
> index ac492a0..0b7ffd9 100644
> --- a/build_patches/openwrt/0003-ntpd-host-as-string.patch
> +++ b/build_patches/openwrt/0003-ntpd-host-as-string.patch
> @@ -1,7 +1,7 @@
> -From 90e6f265608037301cd0b865b172a642dd2a254a Mon Sep 17 00:00:00 2001
> +From 5957781393de24387301ffb1d49ee115bb713928 Mon Sep 17 00:00:00 2001
>  From: Tim Niemeyer <tim at tn-x.org>
>  Date: Sat, 8 Jul 2017 10:47:56 +0200
> -Subject: [PATCH 3/7] ntpd host as string
> +Subject: [PATCH 3/4] ntpd host as string
> 
>  ---
>   package/utils/busybox/files/sysntpd | 2 +-
> @@ -21,5 +21,5 @@ index e693e40..12383a4 100755
> 
>   start_service() {
>  --
> -2.1.4
> +2.7.4
> 
> diff --git a/build_patches/openwrt/0004-ar71xx-4.4-l2tp-stats.patch
> b/build_patches/openwrt/0004-ar71xx-4.9-l2tp-stats.patch
> similarity index 83%
> rename from build_patches/openwrt/0004-ar71xx-4.4-l2tp-stats.patch
> rename to build_patches/openwrt/0004-ar71xx-4.9-l2tp-stats.patch
> index 5425702..283a812 100644
> --- a/build_patches/openwrt/0004-ar71xx-4.4-l2tp-stats.patch
> +++ b/build_patches/openwrt/0004-ar71xx-4.9-l2tp-stats.patch
> @@ -1,18 +1,18 @@
> -From f4724465e4cdbfecdd934893f6fc0c81f7038e1b Mon Sep 17 00:00:00 2001
> +From 3280eb51202a8b6b4af55165b1b795fbd3c7318c Mon Sep 17 00:00:00 2001
>  From: Tim Niemeyer <tim at tn-x.org>
>  Date: Sat, 8 Jul 2017 10:48:53 +0200
> -Subject: [PATCH 4/7] ar71xx-4.4-l2tp-stats
> +Subject: [PATCH 4/4] ar71xx-4.9-l2tp-stats
> 
>  ---
>   ...-stats-counter-overflow-on-32-bit-systems.patch | 38
> ++++++++++++++++++++++
>   1 file changed, 38 insertions(+)
> - create mode 100644 target/linux/ar71xx/patches-4.4/fix-l2tp-stats-counter-
> overflow-on-32-bit-systems.patch
> + create mode 100644 target/linux/ar71xx/patches-4.9/fix-l2tp-stats-counter-
> overflow-on-32-bit-systems.patch
> 
> -diff --git a/target/linux/ar71xx/patches-4.4/fix-l2tp-stats-counter-overflow-on-
> 32-bit-systems.patch b/target/linux/ar71xx/patches-4.4/fix-l2tp-stats-counter-
> overflow-on-32-bit-systems.patch
> +diff --git a/target/linux/ar71xx/patches-4.9/fix-l2tp-stats-counter-overflow-
> on-32-bit-systems.patch b/target/linux/ar71xx/patches-4.9/fix-l2tp-stats-
> counter-overflow-on-32-bit-systems.patch
>  new file mode 100644
>  index 0000000..4348aea
>  --- /dev/null
> -+++ b/target/linux/ar71xx/patches-4.4/fix-l2tp-stats-counter-overflow-on-32-
> bit-systems.patch
> ++++ b/target/linux/ar71xx/patches-4.9/fix-l2tp-stats-counter-overflow-on-32-
> bit-systems.patch
>  @@ -0,0 +1,38 @@
>  +From 19b1c8733b99f13005f2d8918bce588f0b2556f8 Mon Sep 17 00:00:00 2001
>  +From: Dominik Heidler <dominik at heidler.eu>
> @@ -53,5 +53,5 @@ index 0000000..4348aea
>  +2.7.2
>  +
>  --
> -2.1.4
> +2.7.4
> 
> diff --git a/build_patches/openwrt/0005-firmware-utils-tplink-safeloader-
> support-strings-as-.patch b/build_patches/openwrt/0005-firmware-utils-tplink-
> safeloader-support-strings-as-.patch
> deleted file mode 100644
> index 7286535..0000000
> --- a/build_patches/openwrt/0005-firmware-utils-tplink-safeloader-support-
> strings-as-.patch
> +++ /dev/null
> @@ -1,164 +0,0 @@
> -From aae9f1e0690e338c27fbb4d0326f05ca34f2ac55 Mon Sep 17 00:00:00 2001
> -From: Jan Niehusmann <jan at gondor.com>
> -Date: Fri, 19 May 2017 09:42:24 +0200
> -Subject: [PATCH 1/3] firmware-utils: tplink-safeloader: support strings as
> - soft_version
> -
> -Some TP-Link routers (C25, C59, C60) contain a version string instead
> -of a binary structure in the soft_version partition.
> -
> -Flashing LEDE from the original firmware's GUI, this version string
> -taken from the soft_ver partition of the firmware image is written to
> -the router's config partition.
> -
> -When using tftp recovery to go back to the original Archer C25 firmware,
> -a version check compares that version to the version of the firmware to
> -be flashed.
> -
> -Without proper contents in the config partition, reverting to the
> -original firmware fails.
> -
> -Therefore, write the string "soft_ver:1.0.0\n" to that soft_ver
> -partition.
> -
> -Signed-off-by: Jan Niehusmann <jan at gondor.com>
> -[Rebased on v17.01.2]
> -Signed-off-by: Tim Niemeyer <tim at tnx-x.org>
> -[Rebased on 97ebdf9]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - tools/firmware-utils/src/tplink-safeloader.c | 34
> +++++++++++++++++++++++++++-
> - 1 file changed, 33 insertions(+), 1 deletion(-)
> -
> -diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-
> utils/src/tplink-safeloader.c
> -index 4e3d205..688cdac 100644
> ---- a/tools/firmware-utils/src/tplink-safeloader.c
> -+++ b/tools/firmware-utils/src/tplink-safeloader.c
> -@@ -75,6 +75,7 @@ struct device_info {
> - 	const char *vendor;
> - 	const char *support_list;
> - 	char support_trail;
> -+	const char *soft_ver;
> - 	const struct flash_partition_entry partitions[MAX_PARTITIONS+1];
> - 	const char *first_sysupgrade_partition;
> - 	const char *last_sysupgrade_partition;
> -@@ -130,6 +131,7 @@ static struct device_info boards[] = {
> - 			"CPE220(TP-LINK|US|N300-2):1.1\r\n"
> - 			"CPE220(TP-LINK|EU|N300-2):1.1\r\n",
> - 		.support_trail = '\xff',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x20000},
> -@@ -167,6 +169,7 @@ static struct device_info boards[] = {
> - 			"CPE520(TP-LINK|US|N300-5):1.1\r\n"
> - 			"CPE520(TP-LINK|EU|N300-5):1.1\r\n",
> - 		.support_trail = '\xff',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x20000},
> -@@ -198,6 +201,7 @@ static struct device_info boards[] = {
> - 			"WBS210(TP-LINK|US|N300-2):1.20\r\n"
> - 			"WBS210(TP-LINK|EU|N300-2):1.20\r\n",
> - 		.support_trail = '\xff',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x20000},
> -@@ -229,6 +233,7 @@ static struct device_info boards[] = {
> - 			"WBS510(TP-LINK|US|N300-5):1.20\r\n"
> - 			"WBS510(TP-LINK|EU|N300-5):1.20\r\n",
> - 		.support_trail = '\xff',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x20000},
> -@@ -259,6 +264,7 @@ static struct device_info boards[] = {
> - 			"SupportList:\r\n"
> - 			"{product_name:Archer
> C2600,product_ver:1.0.0,special_id:00000000}\r\n",
> - 		.support_trail = '\x00',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"SBL1", 0x00000, 0x20000},
> -@@ -303,6 +309,7 @@ static struct device_info boards[] = {
> - 			"product_ver:2.0.0,"
> - 			"special_id:00000000}\r\n",
> - 		.support_trail = '\x00',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x40000},
> -@@ -337,6 +344,7 @@ static struct device_info boards[] = {
> - 			"product_ver:1.0.0,"
> - 			"special_id:00000000}\n",
> - 		.support_trail = '\x00',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x40000},
> -@@ -369,6 +377,7 @@ static struct device_info boards[] = {
> - 			"SupportList:\r\n"
> - 			"EAP120(TP-LINK|UN|N300-2):1.0\r\n",
> - 		.support_trail = '\xff',
> -+		.soft_ver = NULL,
> -
> - 		.partitions = {
> - 			{"fs-uboot", 0x00000, 0x20000},
> -@@ -398,6 +407,7 @@ static struct device_info boards[] = {
> - 			"SupportList:\n"
> - 			"{product_name:TL-
> WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
> - 		.support_trail = '\x00',
> -+		.soft_ver = NULL,
> -
> - 		/**
> - 		    We use a bigger os-image partition than the stock images (and
> thus
> -@@ -441,6 +451,7 @@ static struct device_info boards[] = {
> -
> 	"{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
> -
> 	"{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
> - 		.support_trail = '\x00',
> -+		.soft_ver = NULL,
> -
> - 		/**
> - 		   The flash partition table for RE450;
> -@@ -569,6 +580,23 @@ static struct image_partition_entry
> make_soft_version(uint32_t rev) {
> - 	return entry;
> - }
> -
> -+static struct image_partition_entry make_soft_version_from_string(const
> char *soft_ver) {
> -+	/** String length _including_ the terminating zero byte */
> -+	uint32_t ver_len = strlen(soft_ver) + 1;
> -+	/** Partition contains 64 bit header, the version string, and one
> additional null byte */
> -+	size_t partition_len = 2*sizeof(uint32_t) + ver_len + 1;
> -+	struct image_partition_entry entry = alloc_image_partition("soft-
> version", partition_len);
> -+
> -+	uint32_t *len = (uint32_t *)entry.data;
> -+	len[0] = htonl(ver_len);
> -+	len[1] = 0;
> -+	memcpy(&len[2], soft_ver, ver_len);
> -+
> -+	entry.data[partition_len - 1] = 0;
> -+
> -+	return entry;
> -+}
> -+
> - /** Generates the support-list partition */
> - static struct image_partition_entry make_support_list(const struct device_info
> *info) {
> - 	size_t len = strlen(info->support_list);
> -@@ -799,7 +827,11 @@ static void build_image(const char *output,
> - 	struct image_partition_entry parts[6] = {};
> -
> - 	parts[0] = make_partition_table(info->partitions);
> --	parts[1] = make_soft_version(rev);
> -+	if (info->soft_ver)
> -+		parts[1] = make_soft_version_from_string(info->soft_ver);
> -+	else
> -+		parts[1] = make_soft_version(rev);
> -+
> - 	parts[2] = make_support_list(info);
> - 	parts[3] = read_file("os-image", kernel_image, false);
> - 	parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0006-ar71xx-add-support-for-TP-Link-
> Archer-C25-v1.patch b/build_patches/openwrt/0006-ar71xx-add-support-for-
> TP-Link-Archer-C25-v1.patch
> deleted file mode 100644
> index 4d87258..0000000
> --- a/build_patches/openwrt/0006-ar71xx-add-support-for-TP-Link-Archer-C25-
> v1.patch
> +++ /dev/null
> @@ -1,501 +0,0 @@
> -From 1b2536059c42ab9b9b2ca69a4ceb508c197f95aa Mon Sep 17 00:00:00 2001
> -From: Ludwig Thomeczek <ledesrc at wxorx.net>
> -Date: Sat, 22 Apr 2017 18:21:47 +0200
> -Subject: [PATCH 2/3] ar71xx: add support for TP-Link Archer C25 v1
> -
> -The TP-Link Archer C25 is a low-cost dual-band router.
> -
> -Specification:
> -
> -- CPU: Atheros QCA9561 775 MHz
> -- RAM: 64 MB
> -- Flash: 8 MB
> -- Wifi: 3x3 2.4 GHz (integrated), 1x1 5 GHz QCA9887
> -- NET: 5x 10/100 Mbps Ethernet
> -
> -Some LEDs are controlled by an additional 74HC595 chip.
> -
> -Signed-off-by: Ludwig Thomeczek <ledesrc at wxorx.net>
> -[minor code style fixes, boards alphabetical order fixes,
> -reworked commit message]
> -Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
> -[Rebased on v17.01.2]
> -Signed-off-by: Tim Niemeyer <tim at tnx-x.org>
> -[Rebased on 97ebdf9]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - target/linux/ar71xx/base-files/etc/board.d/01_leds |   9 +
> - .../linux/ar71xx/base-files/etc/board.d/02_network |   1 +
> - target/linux/ar71xx/base-files/etc/diag.sh         |   1 +
> - .../etc/hotplug.d/firmware/11-ath10k-caldata       |   1 +
> - target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
> - .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
> - target/linux/ar71xx/config-4.4                     |   3 +
> - .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 +
> - target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
> - .../files/arch/mips/ath79/mach-archer-c25-v1.c     | 227
> +++++++++++++++++++++
> - .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
> - target/linux/ar71xx/image/tp-link.mk               |  24 +++
> - target/linux/ar71xx/mikrotik/config-default        |   1 +
> - target/linux/ar71xx/nand/config-default            |   1 +
> - 14 files changed, 285 insertions(+)
> - create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-archer-
> c25-v1.c
> -
> -diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -index 833522f..e1efb56 100755
> ---- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -@@ -53,6 +53,15 @@ ap121f)
> - 	ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
> - 	ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
> - 	;;
> -+archer-c25-v1)
> -+	ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
> -+	ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
> -+	ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g"
> "phy0tpt"
> -+	ucidef_set_led_switch "lan1" "LAN1" "$board:green:lan1" "switch0"
> "0x10"
> -+	ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0"
> "0x08"
> -+	ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0"
> "0x04"
> -+	ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0"
> "0x02"
> -+	;;
> - arduino-yun)
> - 	ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
> - 	ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
> -diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network
> b/target/linux/ar71xx/base-files/etc/board.d/02_network
> -index cb707f6..24ead87 100755
> ---- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> -+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> -@@ -122,6 +122,7 @@ ar71xx_setup_interfaces()
> - 	a60|\
> - 	alfa-ap96|\
> - 	alfa-nx|\
> -+	archer-c25-v1|\
> - 	dr344|\
> - 	gl-ar150|\
> - 	gl-ar300m|\
> -diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
> b/target/linux/ar71xx/base-files/etc/diag.sh
> -index bc2fc2f..38cc5d7 100644
> ---- a/target/linux/ar71xx/base-files/etc/diag.sh
> -+++ b/target/linux/ar71xx/base-files/etc/diag.sh
> -@@ -50,6 +50,7 @@ get_status_led() {
> - 	ap135-020)
> - 		status_led="ap135:green:status"
> - 		;;
> -+	archer-c25-v1|\
> - 	mr12|\
> - 	mr16|\
> - 	nbg6616|\
> -diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> caldata
> -index b3e23c9..68f90de 100644
> ---- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> -+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> caldata
> -@@ -92,6 +92,7 @@ case "$FIRMWARE" in
> - 		ath10kcal_extract "art" 20480 2116
> - 		ath10kcal_patch_mac $(macaddr_add $(cat
> /sys/class/net/eth0/address) -2)
> - 		;;
> -+	archer-c25-v1|\
> - 	tl-wdr6500-v2)
> - 		ath10kcal_extract "art" 20480 2116
> - 		ath10kcal_patch_mac $(macaddr_add $(cat
> /sys/class/net/eth1/address) -2)
> -diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -index bf36598..46711af 100755
> ---- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -@@ -460,6 +460,9 @@ ar71xx_board_detect() {
> - 	*AP90Q)
> - 		name="ap90q"
> - 		;;
> -+	*"Archer C25 v1")
> -+		name="archer-c25-v1"
> -+		;;
> - 	*"Archer C5")
> - 		name="archer-c5"
> - 		;;
> -diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -index 21ad2a6..e65f6e2 100755
> ---- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -@@ -206,6 +206,7 @@ platform_check_image() {
> - 	ap121f|\
> - 	ap132|\
> - 	ap90q|\
> -+	archer-c25-v1|\
> - 	bullet-m|\
> - 	c-55|\
> - 	carambola2|\
> -diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> -index a862245..0187775 100644
> ---- a/target/linux/ar71xx/config-4.4
> -+++ b/target/linux/ar71xx/config-4.4
> -@@ -51,6 +51,7 @@ CONFIG_ATH79_MACH_AP152=y
> - # CONFIG_ATH79_MACH_AP81 is not set
> - CONFIG_ATH79_MACH_AP90Q=y
> - CONFIG_ATH79_MACH_AP96=y
> -+CONFIG_ATH79_MACH_ARCHER_C25_V1=y
> - CONFIG_ATH79_MACH_ARCHER_C7=y
> - CONFIG_ATH79_MACH_ARDUINO_YUN=y
> - CONFIG_ATH79_MACH_AW_NR580=y
> -@@ -270,6 +271,7 @@ CONFIG_GENERIC_SMP_IDLE_THREAD=y
> - CONFIG_GENERIC_TIME_VSYSCALL=y
> - CONFIG_GPIOLIB=y
> - CONFIG_GPIOLIB_IRQCHIP=y
> -+CONFIG_GPIO_74X164=y
> - CONFIG_GPIO_DEVRES=y
> - # CONFIG_GPIO_LATCH is not set
> - CONFIG_GPIO_NXP_74HC153=y
> -@@ -336,6 +338,7 @@ CONFIG_LEDS_NU801=y
> - CONFIG_LIBFDT=y
> - CONFIG_MARVELL_PHY=y
> - CONFIG_MDIO_BITBANG=y
> -+CONFIG_SPI_GPIO=y
> - CONFIG_MDIO_BOARDINFO=y
> - CONFIG_MDIO_GPIO=y
> - CONFIG_MICREL_PHY=y
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -index 58d7e43..4112fd3 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -@@ -1234,6 +1234,17 @@ config ATH79_MACH_BSB
> - 	select ATH79_DEV_USB
> - 	select ATH79_DEV_WMAC
> -
> -+config ATH79_MACH_ARCHER_C25_V1
> -+	bool "TP-LINK Archer C25 v1 support"
> -+	select SOC_QCA956X
> -+	select ATH79_DEV_AP9X_PCI if PCI
> -+	select ATH79_DEV_ETH
> -+	select ATH79_DEV_GPIO_BUTTONS
> -+	select ATH79_DEV_LEDS_GPIO
> -+	select ATH79_DEV_M25P80
> -+	select ATH79_DEV_WMAC
> -+
> -+
> - config ATH79_MACH_ARCHER_C7
> - 	bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support"
> - 	select SOC_QCA955X
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> -index 7aee760..3365a43 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> -@@ -56,6 +56,7 @@ obj-$(CONFIG_ATH79_MACH_AP147)			+=
> mach-ap147.o
> - obj-$(CONFIG_ATH79_MACH_AP152)			+= mach-ap152.o
> - obj-$(CONFIG_ATH79_MACH_AP90Q)			+= mach-ap90q.o
> - obj-$(CONFIG_ATH79_MACH_AP96)			+= mach-ap96.o
> -+obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1)		+= mach-archer-
> c25-v1.o
> - obj-$(CONFIG_ATH79_MACH_ARCHER_C7)		+= mach-archer-c7.o
> - obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN)		+= mach-arduino-
> yun.o
> - obj-$(CONFIG_ATH79_MACH_AW_NR580)		+= mach-aw-nr580.o
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
> -new file mode 100644
> -index 0000000..a0f001c
> ---- /dev/null
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
> -@@ -0,0 +1,227 @@
> -+/*
> -+ *  TP-Link Archer C25 v1 board support
> -+ *
> -+ *  Copyright (C) 2017 Ludwig Thomeczek <ledesrc at wxorx.net>
> -+ *  based on mach-archer-c60/C59-v1.c
> -+ *  Copyright (C) 2016 Henryk Heisig <hyniu at o2.pl>
> -+ *
> -+ *  This program 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/platform_device.h>
> -+#include <linux/ath9k_platform.h>
> -+#include <linux/ar8216_platform.h>
> -+#include <asm/mach-ath79/ar71xx_regs.h>
> -+#include <linux/gpio.h>
> -+
> -+#include "common.h"
> -+#include "dev-m25p80.h"
> -+#include "machtypes.h"
> -+#include "pci.h"
> -+#include "dev-ap9x-pci.h"
> -+#include "dev-eth.h"
> -+#include "dev-gpio-buttons.h"
> -+#include "dev-leds-gpio.h"
> -+#include "dev-spi.h"
> -+#include "dev-usb.h"
> -+#include "dev-wmac.h"
> -+#include <linux/spi/spi_gpio.h>
> -+#include <linux/spi/74x164.h>
> -+
> -+#define ARCHER_C25_GPIO_SHIFT_OE	21 /* OE,   Output Enable */
> -+#define ARCHER_C25_GPIO_SHIFT_SER	14 /* DS,   Data Serial Input */
> -+#define ARCHER_C25_GPIO_SHIFT_SRCLK	15 /* SHCP, Shift Reg Clock Input
> */
> -+#define ARCHER_C25_GPIO_SHIFT_SRCLR	19 /* MR,   Master Reset */
> -+#define ARCHER_C25_GPIO_SHIFT_RCLK	16 /* STCP, Storage Reg Clock
> Input */
> -+
> -+#define ARCHER_C25_74HC_GPIO_BASE		QCA956X_GPIO_COUNT
> -+#define ARCHER_C25_74HC_GPIO_LED_WAN_AMBER	27
> -+#define ARCHER_C25_74HC_GPIO_LED_WAN_GREEN	28
> -+#define ARCHER_C25_74HC_GPIO_LED_WLAN2		29
> -+#define ARCHER_C25_74HC_GPIO_LED_WLAN5		30
> -+#define ARCHER_C25_74HC_GPIO_LED_LAN1		23
> -+#define ARCHER_C25_74HC_GPIO_LED_LAN2		24
> -+#define ARCHER_C25_74HC_GPIO_LED_LAN3		25
> -+#define ARCHER_C25_74HC_GPIO_LED_LAN4		26
> -+
> -+#define ARCHER_C25_V1_SSR_BIT_0			0
> -+#define ARCHER_C25_V1_SSR_BIT_1			1
> -+#define ARCHER_C25_V1_SSR_BIT_2			2
> -+#define ARCHER_C25_V1_SSR_BIT_3			3
> -+#define ARCHER_C25_V1_SSR_BIT_4			4
> -+#define ARCHER_C25_V1_SSR_BIT_5			5
> -+#define ARCHER_C25_V1_SSR_BIT_6			6
> -+#define ARCHER_C25_V1_SSR_BIT_7			7
> -+
> -+
> -+#define ARCHER_C25_V1_KEYS_POLL_INTERVAL	20
> -+#define ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL	\
> -+					(3 *
> ARCHER_C25_V1_KEYS_POLL_INTERVAL)
> -+
> -+#define ARCHER_C25_V1_GPIO_BTN_RESET		1
> -+#define ARCHER_C25_V1_GPIO_BTN_RFKILL		22
> -+
> -+#define ARCHER_C25_V1_GPIO_LED_POWER		17
> -+#define ARCHER_C25_V1_GPIO_LED_WPS		2
> -+
> -+#define ARCHER_C25_V1_WMAC_CALDATA_OFFSET	0x1000
> -+
> -+static struct spi_gpio_platform_data archer_c25_v1_spi_data = {
> -+	.sck		= ARCHER_C25_GPIO_SHIFT_SRCLK,
> -+	.miso		= SPI_GPIO_NO_MISO,
> -+	.mosi		= ARCHER_C25_GPIO_SHIFT_SER,
> -+	.num_chipselect	= 1,
> -+};
> -+
> -+static u8 archer_c25_v1_ssr_initdata[] __initdata = {
> -+	BIT(ARCHER_C25_V1_SSR_BIT_7) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_6) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_5) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_4) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_3) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_2) |
> -+	BIT(ARCHER_C25_V1_SSR_BIT_1)
> -+};
> -+
> -+static struct gen_74x164_chip_platform_data archer_c25_v1_ssr_data = {
> -+	.base = ARCHER_C25_74HC_GPIO_BASE,
> -+	.num_registers = ARRAY_SIZE(archer_c25_v1_ssr_initdata),
> -+	.init_data = archer_c25_v1_ssr_initdata,
> -+};
> -+
> -+static struct platform_device archer_c25_v1_spi_device = {
> -+	.name		= "spi_gpio",
> -+	.id		= 1,
> -+	.dev = {
> -+		.platform_data = &archer_c25_v1_spi_data,
> -+	},
> -+};
> -+
> -+static struct spi_board_info archer_c25_v1_spi_info[] = {
> -+	{
> -+		.bus_num		= 1,
> -+		.chip_select		= 0,
> -+		.max_speed_hz		= 10000000,
> -+		.modalias		= "74x164",
> -+		.platform_data		= &archer_c25_v1_ssr_data,
> -+		.controller_data	= (void *)
> ARCHER_C25_GPIO_SHIFT_RCLK,
> -+	},
> -+};
> -+
> -+static struct gpio_led archer_c25_v1_leds_gpio[] __initdata = {
> -+	{
> -+		.name		= "archer-c25-v1:green:power",
> -+		.gpio		= ARCHER_C25_V1_GPIO_LED_POWER,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:wps",
> -+		.gpio		= ARCHER_C25_V1_GPIO_LED_WPS,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:wlan2g",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_WLAN2,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:wlan5g",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_WLAN5,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:lan1",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_LAN1,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:lan2",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_LAN2,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:lan3",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_LAN3,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:lan4",
> -+		.gpio		= ARCHER_C25_74HC_GPIO_LED_LAN4,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:green:wan",
> -+		.gpio		=  ARCHER_C25_74HC_GPIO_LED_WAN_GREEN,
> -+		.active_low	= 1,
> -+	}, {
> -+		.name		= "archer-c25-v1:amber:wan",
> -+		.gpio		=  ARCHER_C25_74HC_GPIO_LED_WAN_AMBER,
> -+		.active_low	= 1,
> -+	},
> -+};
> -+
> -+static struct gpio_keys_button archer_c25_v1_gpio_keys[] __initdata = {
> -+	{
> -+		.desc			= "Reset button",
> -+		.type			= EV_KEY,
> -+		.code			= KEY_RESTART,
> -+		.debounce_interval	=
> ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
> -+		.gpio			= ARCHER_C25_V1_GPIO_BTN_RESET,
> -+		.active_low		= 1,
> -+	}, {
> -+		.desc			= "RFKILL button",
> -+		.type			= EV_KEY,
> -+		.code			= KEY_RFKILL,
> -+		.debounce_interval	=
> ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
> -+		.gpio			= ARCHER_C25_V1_GPIO_BTN_RFKILL,
> -+		.active_low		= 1,
> -+	},
> -+};
> -+
> -+static void __init archer_c25_v1_setup(void)
> -+{
> -+	u8 *mac = (u8 *) KSEG1ADDR(0x1f7e0008);
> -+	u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
> -+
> -+	ath79_register_m25p80(NULL);
> -+
> -+	spi_register_board_info(archer_c25_v1_spi_info,
> -+				ARRAY_SIZE(archer_c25_v1_spi_info));
> -+
> -+	platform_device_register(&archer_c25_v1_spi_device);
> -+
> -+	gpio_request_one(ARCHER_C25_GPIO_SHIFT_OE,
> -+			 GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
> -+			 "LED control");
> -+
> -+	gpio_request_one(ARCHER_C25_GPIO_SHIFT_SRCLR,
> -+			 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
> -+			 "LED reset");
> -+
> -+	ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c25_v1_leds_gpio),
> -+				 archer_c25_v1_leds_gpio);
> -+
> -+	ath79_register_gpio_keys_polled(-1,
> ARCHER_C25_V1_KEYS_POLL_INTERVAL,
> -+					ARRAY_SIZE(archer_c25_v1_gpio_keys),
> -+					archer_c25_v1_gpio_keys);
> -+
> -+	ath79_register_mdio(0, 0x0);
> -+	ath79_register_mdio(1, 0x0);
> -+
> -+	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> -+	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
> -+
> -+	/* WAN port */
> -+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
> -+	ath79_eth0_data.speed = SPEED_100;
> -+	ath79_eth0_data.duplex = DUPLEX_FULL;
> -+	ath79_eth0_data.phy_mask = BIT(4);
> -+	ath79_register_eth(0);
> -+
> -+	/* LAN ports */
> -+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
> -+	ath79_eth1_data.speed = SPEED_1000;
> -+	ath79_eth1_data.duplex = DUPLEX_FULL;
> -+	ath79_switch_data.phy_poll_mask |= BIT(4);
> -+	ath79_switch_data.phy4_mii_en = 1;
> -+	ath79_register_eth(1);
> -+
> -+	ath79_register_wmac(art +
> ARCHER_C25_V1_WMAC_CALDATA_OFFSET, mac);
> -+	ap91_pci_init(NULL, NULL);
> -+}
> -+
> -+MIPS_MACHINE(ATH79_MACH_ARCHER_C25_V1, "ARCHER-C25-V1", "TP-
> LINK Archer C25 v1",
> -+	     archer_c25_v1_setup);
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -index a12685c..8864e0d 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -@@ -40,6 +40,7 @@ enum ath79_mach_type {
> - 	ATH79_MACH_AP152,			/* Atheros AP152 reference
> board */
> - 	ATH79_MACH_AP90Q,			/* YunCore AP90Q */
> - 	ATH79_MACH_AP96,			/* Atheros AP96 */
> -+	ATH79_MACH_ARCHER_C25_V1,		/* TP-LINK Archer C25 V1
> board */
> - 	ATH79_MACH_ARCHER_C5,			/* TP-LINK Archer C5
> board */
> - 	ATH79_MACH_ARCHER_C7,			/* TP-LINK Archer C7
> board */
> - 	ATH79_MACH_ARCHER_C7_V2,		/* TP-LINK Archer C7 V2
> board */
> -diff --git a/target/linux/ar71xx/image/tp-link.mk
> b/target/linux/ar71xx/image/tp-link.mk
> -index 312152f..3e3780d 100644
> ---- a/target/linux/ar71xx/image/tp-link.mk
> -+++ b/target/linux/ar71xx/image/tp-link.mk
> -@@ -45,6 +45,14 @@ define Build/mktplinkfw-kernel
> - 	@mv $@.new $@
> - endef
> -
> -+define Build/uImageArcher
> -+	mkimage -A $(LINUX_KARCH) \
> -+			-O linux -T kernel \
> -+			-C $(1) -a $(KERNEL_LOADADDR) -e $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> -+			-n '$(call toupper,$(LINUX_KARCH)) LEDE Linux-
> $(LINUX_VERSION)' -d $@ $@.new
> -+	@mv $@.new $@
> -+endef
> -+
> - define Device/tplink
> -   TPLINK_HWREV := 0x1
> -   TPLINK_HEADER_VERSION := 1
> -@@ -95,6 +103,22 @@ $(Device/tplink)
> -   IMAGE_SIZE := 15872k
> - endef
> -
> -+define Device/archer-c25-v1
> -+  DEVICE_TITLE := TP-LINK Archer C25 v1
> -+  DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887
> -+  BOARDNAME := ARCHER-C25-V1
> -+  TPLINK_BOARD_NAME := ARCHER-C25-V1
> -+  DEVICE_PROFILE := ARCHERC25V1
> -+  IMAGE_SIZE := 7808k
> -+  LOADER_TYPE := elf
> -+  KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
> -+  IMAGES := sysupgrade.bin factory.bin
> -+  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
> -+  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
> -+  MTDPARTS := spi0.0:128k(factory-uboot)ro,64k(u-
> boot)ro,1536k(kernel),6272k(rootfs),128k(config)ro,64k(art)ro,7808k at 0x30000(f
> irmware)
> -+endef
> -+TARGET_DEVICES += archer-c25-v1
> -+
> - define Device/cpe510-520
> -   DEVICE_TITLE := TP-LINK CPE510/520
> -   DEVICE_PACKAGES := rssileds
> -diff --git a/target/linux/ar71xx/mikrotik/config-default
> b/target/linux/ar71xx/mikrotik/config-default
> -index f8d255f..376835a 100644
> ---- a/target/linux/ar71xx/mikrotik/config-default
> -+++ b/target/linux/ar71xx/mikrotik/config-default
> -@@ -16,6 +16,7 @@
> - # CONFIG_ATH79_MACH_AP152 is not set
> - # CONFIG_ATH79_MACH_AP90Q is not set
> - # CONFIG_ATH79_MACH_AP96 is not set
> -+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
> - # CONFIG_ATH79_MACH_ARCHER_C7 is not set
> - # CONFIG_ATH79_MACH_ARDUINO_YUN is not set
> - # CONFIG_ATH79_MACH_AW_NR580 is not set
> -diff --git a/target/linux/ar71xx/nand/config-default
> b/target/linux/ar71xx/nand/config-default
> -index c1b5e61..62be218 100644
> ---- a/target/linux/ar71xx/nand/config-default
> -+++ b/target/linux/ar71xx/nand/config-default
> -@@ -9,6 +9,7 @@
> - # CONFIG_ATH79_MACH_AP136 is not set
> - # CONFIG_ATH79_MACH_AP147 is not set
> - # CONFIG_ATH79_MACH_AP96 is not set
> -+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
> - # CONFIG_ATH79_MACH_ARCHER_C7 is not set
> - # CONFIG_ATH79_MACH_AW_NR580 is not set
> - # CONFIG_ATH79_MACH_CAP324 is not set
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0007-firmware-utils-tplink-safeloader-add-
> TP-Link-Archer-.patch b/build_patches/openwrt/0007-firmware-utils-tplink-
> safeloader-add-TP-Link-Archer-.patch
> deleted file mode 100644
> index de02778..0000000
> --- a/build_patches/openwrt/0007-firmware-utils-tplink-safeloader-add-TP-
> Link-Archer-.patch
> +++ /dev/null
> @@ -1,114 +0,0 @@
> -From 1186e1a8f31f7c86eeee3463f5e8469a3de36770 Mon Sep 17 00:00:00 2001
> -From: Ludwig Thomeczek <ledesrc at wxorx.net>
> -Date: Sat, 13 May 2017 11:40:48 +0200
> -Subject: [PATCH 3/3] firmware-utils: tplink-safeloader: add TP-Link Archer C25
> - v1
> -
> -This adds the necessary firmware layout definitions for the Archer C25.
> -It has an addtional partition containing some static data ("extra-para")
> -without which no factory flash is possible, therefore put_data() has been
> -added.
> -
> -Signed-off-by: Ludwig Thomeczek <ledesrc at wxorx.net>
> -[Rebased on v17.01.2]
> -Signed-off-by: Tim Niemeyer <tim at tnx-x.org>
> -[Rebased on 97ebdf9]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - tools/firmware-utils/src/tplink-safeloader.c | 59
> +++++++++++++++++++++++++++-
> - 1 file changed, 58 insertions(+), 1 deletion(-)
> -
> -diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-
> utils/src/tplink-safeloader.c
> -index 688cdac..2468426 100644
> ---- a/tools/firmware-utils/src/tplink-safeloader.c
> -+++ b/tools/firmware-utils/src/tplink-safeloader.c
> -@@ -299,6 +299,48 @@ static struct device_info boards[] = {
> - 		.last_sysupgrade_partition = "file-system"
> - 	},
> -
> -+	/** Firmware layout for the C25v1 */
> -+	{
> -+		.id = "ARCHER-C25-V1",
> -+		.support_list =
> -+			"SupportList:\n"
> -+
> 	"{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
> -+
> 	"{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
> -+
> 	"{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
> -+		.support_trail = '\x00',
> -+		.soft_ver = "soft_ver:1.0.0\n",
> -+
> -+		/**
> -+		    We use a bigger os-image partition than the stock images (and
> thus
> -+		    smaller file-system), as our kernel doesn't fit in the stock
> firmware's
> -+		    1MB os-image.
> -+		*/
> -+		.partitions = {
> -+			{"factory-boot", 0x00000, 0x20000},
> -+			{"fs-uboot", 0x20000, 0x10000},
> -+			{"os-image", 0x30000, 0x180000},	/* Stock: base
> 0x30000 size 0x100000 */
> -+			{"file-system", 0x1b0000, 0x620000},	/* Stock: base
> 0x130000 size 0x6a0000 */
> -+			{"user-config", 0x7d0000, 0x04000},
> -+			{"default-mac", 0x7e0000, 0x00100},
> -+			{"device-id", 0x7e0100, 0x00100},
> -+			{"extra-para", 0x7e0200, 0x00100},
> -+			{"pin", 0x7e0300, 0x00100},
> -+			{"support-list", 0x7e0400, 0x00400},
> -+			{"soft-version", 0x7e0800, 0x00400},
> -+			{"product-info", 0x7e0c00, 0x01400},
> -+			{"partition-table", 0x7e2000, 0x01000},
> -+			{"profile", 0x7e3000, 0x01000},
> -+			{"default-config", 0x7e4000, 0x04000},
> -+			{"merge-config", 0x7ec000, 0x02000},
> -+			{"qos-db", 0x7ee000, 0x02000},
> -+			{"radio", 0x7f0000, 0x10000},
> -+			{NULL, 0, 0}
> -+		},
> -+
> -+		.first_sysupgrade_partition = "os-image",
> -+		.last_sysupgrade_partition = "file-system",
> -+	},
> -+
> - 	/** Firmware layout for the C5 */
> - 	{
> - 		.id = "ARCHER-C5-V2",
> -@@ -643,6 +685,15 @@ static struct image_partition_entry read_file(const char
> *part_name, const char
> - 	return entry;
> - }
> -
> -+/** Creates a new image partition from arbitrary data */
> -+static struct image_partition_entry put_data(const char *part_name, const
> char *datain, size_t len) {
> -+
> -+	struct image_partition_entry entry = alloc_image_partition(part_name,
> len);
> -+
> -+	memcpy(entry.data, datain, len);
> -+
> -+	return entry;
> -+}
> -
> - /**
> -    Copies a list of image partitions into an image buffer and generates the image
> partition table while doing so
> -@@ -824,7 +875,8 @@ static void build_image(const char *output,
> - 		bool add_jffs2_eof,
> - 		bool sysupgrade,
> - 		const struct device_info *info) {
> --	struct image_partition_entry parts[6] = {};
> -+
> -+	struct image_partition_entry parts[7] = {};
> -
> - 	parts[0] = make_partition_table(info->partitions);
> - 	if (info->soft_ver)
> -@@ -836,6 +888,11 @@ static void build_image(const char *output,
> - 	parts[3] = read_file("os-image", kernel_image, false);
> - 	parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
> -
> -+	if (strcasecmp(info->id, "ARCHER-C25-V1") == 0) {
> -+		const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
> 0x00, 0x01, 0x00, 0x00};
> -+		parts[5] = put_data("extra-para", mdat, 11);
> -+	}
> -+
> - 	size_t len;
> - 	void *image;
> - 	if (sysupgrade)
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0008-ath10k-firmware-update-qca9887-
> firmware-to-10.2.4-1.patch b/build_patches/openwrt/0008-ath10k-firmware-
> update-qca9887-firmware-to-10.2.4-1.patch
> deleted file mode 100644
> index 8d88fa6..0000000
> --- a/build_patches/openwrt/0008-ath10k-firmware-update-qca9887-firmware-
> to-10.2.4-1.patch
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -From c50613a3f90b127fa33f2be37addc6762732ca8d Mon Sep 17 00:00:00 2001
> -From: Andreas Ziegler <github at andreas-ziegler.de>
> -Date: Sun, 6 Aug 2017 21:57:46 +0200
> -Subject: [PATCH] ath10k-firmware: update qca9887 firmware to 10.2.4-1.0-
> 00029
> -
> -Signed-off-by: Andreas Ziegler <github at andreas-ziegler.de>
> -[Rebased on 97ebdf9]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - package/firmware/ath10k-firmware/Makefile | 9 +++++----
> - 1 file changed, 5 insertions(+), 4 deletions(-)
> -
> -diff --git a/package/firmware/ath10k-firmware/Makefile
> b/package/firmware/ath10k-firmware/Makefile
> -index 8bf5729..d1d9fb3 100644
> ---- a/package/firmware/ath10k-firmware/Makefile
> -+++ b/package/firmware/ath10k-firmware/Makefile
> -@@ -37,16 +37,17 @@ $(Package/ath10k-firmware-default)
> -   TITLE:=ath10k-CT firmware for QCA9887 devices
> - endef
> -
> --QCA9887_REV:=3cce88e245f2d685e49411c4f80998f94baf67b8
> --QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00013
> --
> QCA9887_FIRMWARE_FILE_HASH:=5966408bd41f309edb595344b8dd088c0fed21
> 2debfd91e5f3e8a55ea119c16d
> -+QCA9887_REV:=3920dbf0a04c8918b839d5e5d9e2b8fbd5c7e692
> -+QCA9887_FIRMWARE_VERSION:=10.2.4-1.0
> -+QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00029
> -
> +QCA9887_FIRMWARE_FILE_HASH:=b27b4a2117b578a334b9b744e2095c4f86378
> fd4badfb7619c7e11712d714ab3
> -
> QCA9887_FIRMWARE_FILE_DL:=$(QCA9887_FIRMWARE_FILE).$(QCA9887_FIR
> MWARE_FILE_HASH)
> - QCA9887_BOARD_FILE:=board.bin
> -
> QCA9887_BOARD_FILE_HASH:=cf4df099f6ee05c181f55ce17297a1d32c61d725eb
> 96246fd315ad5587c42426
> -
> QCA9887_BOARD_FILE_DL:=$(QCA9887_BOARD_FILE).$(QCA9887_BOARD_FILE
> _HASH)
> -
> - define Download/ath10k-qca9887-firmware
> --  URL:=https://github.com/kvalo/ath10k-
> firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
> -+  URL:=https://github.com/kvalo/ath10k-
> firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/$(QCA9887_FIRMWARE_VERS
> ION)/
> -   URL_FILE:=$(QCA9887_FIRMWARE_FILE)
> -   FILE:=$(QCA9887_FIRMWARE_FILE_DL)
> -   HASH:=$(QCA9887_FIRMWARE_FILE_HASH)
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0011-firmware-utils-mktplinkfw-rework-
> combined-image-opti.patch b/build_patches/openwrt/0011-firmware-utils-
> mktplinkfw-rework-combined-image-opti.patch
> deleted file mode 100644
> index ee54c85..0000000
> --- a/build_patches/openwrt/0011-firmware-utils-mktplinkfw-rework-
> combined-image-opti.patch
> +++ /dev/null
> @@ -1,264 +0,0 @@
> -From b3cb0e75884222e141a40443c25d20deedf7a552 Mon Sep 17 00:00:00 2001
> -From: Piotr Dymacz <pepe2k at gmail.com>
> -Date: Thu, 6 Jul 2017 16:34:47 +0200
> -Subject: [PATCH] firmware-utils: mktplinkfw: rework combined image option
> -
> -We use combined option in "mktplinkfw" tool for generating initramfs
> -kernel images and header for kernel inside "safeloader" image type (in
> -fact, only for TL-WR1043ND v4 at this moment).
> -
> -There is also "mktplinkfw-kernel" tool, a stripped-down version, used
> -only for generating "simple" header, for safeloader image types.
> -
> -This changes how "mktplinkfw" handles combined images (which then will
> -allow us to drop the stripped-down version of the tool):
> -
> -- drop "ignore size" command line option (it was used only for combined
> -  images anyway)
> -- don't require "flash layout id" for combined images (we don't need and
> -  shouldn't limit size of the initramfs kernel and for kernels inside
> -  safeloader images, the "tplink-safeloader" tool does the size check)
> -- require kernel address and entry point in command line parameters for
> -  combined images (consequence of previous point)
> -- don't include md5 sum and firmware length values in header (they are
> -  needed only for update from vendor GUI and are ingored in case of
> -  initramfs and "tplink-safeloader" images)
> -- drop "fake" flash layout for TL-WR1043ND v4 as it's no longer needed
> -
> -Also, adjust "mktplinkfw-combined" command in ar71xx/image/tp-link.mk to
> -match introduced changes in "mktplinkfw" tool.
> -
> -Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
> -[Rebased on 8ad1b09]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - target/linux/ar71xx/image/tp-link.mk  |  7 ++-
> - tools/firmware-utils/src/mktplinkfw.c | 99 +++++++++++++++--------------------
> - 2 files changed, 44 insertions(+), 62 deletions(-)
> -
> -diff --git a/target/linux/ar71xx/image/tp-link.mk
> b/target/linux/ar71xx/image/tp-link.mk
> -index 32d16f9..2557858 100644
> ---- a/target/linux/ar71xx/image/tp-link.mk
> -+++ b/target/linux/ar71xx/image/tp-link.mk
> -@@ -26,11 +26,11 @@ endef
> - # -c combined image
> - define Build/mktplinkfw-combined
> - 	$(STAGING_DIR_HOST)/bin/mktplinkfw \
> --		-H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F
> $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $(1) \
> --		-m $(TPLINK_HEADER_VERSION) \
> -+		-H $(TPLINK_HWID) -W $(TPLINK_HWREV) -N OpenWrt -V
> $(REVISION) $(1) \
> -+		-L $(KERNEL_LOADADDR) -m $(TPLINK_HEADER_VERSION) \
> -+		-E $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> - 		-k $@ \
> - 		-o $@.new \
> --		-s -S \
> - 		-c
> - 	@mv $@.new $@
> - endef
> -@@ -849,7 +849,6 @@ define Device/tl-wr1043nd-v4
> -     BOARDNAME := TL-WR1043ND-v4
> -     DEVICE_PROFILE := TLWR1043
> -     TPLINK_HWID :=  0x10430004
> --    TPLINK_FLASHLAYOUT := 16Msafeloader
> -     MTDPARTS := spi0.0:128k(u-
> boot)ro,1536k(kernel),14016k(rootfs),128k(product-
> info)ro,320k(config)ro,64k(partition-
> table)ro,128k(logs)ro,64k(ART)ro,15552k at 0x20000(firmware)
> -     IMAGE_SIZE := 15552k
> -     TPLINK_BOARD_NAME := TLWR1043NDV4
> -diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-
> utils/src/mktplinkfw.c
> -index fbf8960..3cfe5f7 100644
> ---- a/tools/firmware-utils/src/mktplinkfw.c
> -+++ b/tools/firmware-utils/src/mktplinkfw.c
> -@@ -115,7 +115,6 @@ static uint32_t rootfs_align;
> - static struct file_info boot_info;
> - static int combined;
> - static int strip_padding;
> --static int ignore_size;
> - static int add_jffs2_eof;
> - static unsigned char jffs2_eof_mark[4] = {0xde, 0xad, 0xc0, 0xde};
> - static uint32_t fw_max_len;
> -@@ -178,20 +177,6 @@ static struct flash_layout layouts[] = {
> - 		.kernel_ep	= 0xc0000000,
> - 		.rootfs_ofs	= 0x2a0000,
> - 	}, {
> --		/*
> --			Some devices (e.g. TL-WR1043 v4) use a mktplinkfw
> kernel image
> --			embedded in a tplink-safeloader image as os-image
> partition.
> --
> --			We use a 1.5MB partition for the compressed kernel,
> which should
> --			be sufficient, but not too wasteful (the flash of the TL-
> WR1043 v4
> --			has 16MB in total).
> --		*/
> --		.id		= "16Msafeloader",
> --		.fw_max_len	= 0x180000,
> --		.kernel_la	= 0x80060000,
> --		.kernel_ep	= 0x80060000,
> --		.rootfs_ofs	= 0,
> --	}, {
> - 		/* terminating entry */
> - 	}
> - };
> -@@ -268,7 +253,6 @@ static void usage(int status)
> - "  -R <offset>     overwrite rootfs offset with <offset> (hexval prefixed with
> 0x)\n"
> - "  -o <file>       write output to the file <file>\n"
> - "  -s              strip padding from the end of the image\n"
> --"  -S              ignore firmware size limit (only for combined images)\n"
> - "  -j              add jffs2 end-of-filesystem markers\n"
> - "  -N <vendor>     set image vendor to <vendor>\n"
> - "  -V <version>    set image version to <version>\n"
> -@@ -358,7 +342,7 @@ static int check_options(void)
> - 	}
> - 	hw_id = strtoul(opt_hw_id, NULL, 0);
> -
> --	if (layout_id == NULL) {
> -+	if (!combined && layout_id == NULL) {
> - 		ERR("flash layout is not specified");
> - 		return -1;
> - 	}
> -@@ -376,26 +360,31 @@ static int check_options(void)
> - 		}
> - 	}
> -
> --	layout = find_layout(layout_id);
> --	if (layout == NULL) {
> --		ERR("unknown flash layout \"%s\"", layout_id);
> --		return -1;
> --	}
> -+	if (combined) {
> -+		if (!kernel_la || !kernel_ep) {
> -+			ERR("kernel loading address and entry point must be
> specified for combined image");
> -+			return -1;
> -+		}
> -+	} else {
> -+		layout = find_layout(layout_id);
> -+		if (layout == NULL) {
> -+			ERR("unknown flash layout \"%s\"", layout_id);
> -+			return -1;
> -+		}
> -
> --	if (!kernel_la)
> --		kernel_la = layout->kernel_la;
> --	if (!kernel_ep)
> --		kernel_ep = layout->kernel_ep;
> --	if (!rootfs_ofs)
> --		rootfs_ofs = layout->rootfs_ofs;
> -+		if (!kernel_la)
> -+			kernel_la = layout->kernel_la;
> -+		if (!kernel_ep)
> -+			kernel_ep = layout->kernel_ep;
> -+		if (!rootfs_ofs)
> -+			rootfs_ofs = layout->rootfs_ofs;
> -
> --	if (reserved_space > layout->fw_max_len) {
> --		ERR("reserved space is not valid");
> --		return -1;
> -+		if (reserved_space > layout->fw_max_len) {
> -+			ERR("reserved space is not valid");
> -+			return -1;
> -+		}
> - 	}
> -
> --	fw_max_len = layout->fw_max_len - reserved_space;
> --
> - 	if (kernel_info.file_name == NULL) {
> - 		ERR("no kernel image specified");
> - 		return -1;
> -@@ -407,18 +396,9 @@ static int check_options(void)
> -
> - 	kernel_len = kernel_info.file_size;
> -
> --	if (combined) {
> --		exceed_bytes = kernel_info.file_size - (fw_max_len -
> sizeof(struct fw_header));
> --		if (exceed_bytes > 0) {
> --			if (!ignore_size) {
> --				ERR("kernel image is too big by %i bytes",
> exceed_bytes);
> --				return -1;
> --			}
> --			layout->fw_max_len = sizeof(struct fw_header) +
> --					     kernel_info.file_size +
> --					     reserved_space;
> --		}
> --	} else {
> -+	if (!combined) {
> -+		fw_max_len = layout->fw_max_len - reserved_space;
> -+
> - 		if (rootfs_info.file_name == NULL) {
> - 			ERR("no rootfs image specified");
> - 			return -1;
> -@@ -490,17 +470,18 @@ static void fill_header(char *buf, int len)
> - 	hdr->hw_id = htonl(hw_id);
> - 	hdr->hw_rev = htonl(hw_rev);
> -
> --	if (boot_info.file_size == 0)
> --		memcpy(hdr->md5sum1, md5salt_normal, sizeof(hdr-
> >md5sum1));
> --	else
> --		memcpy(hdr->md5sum1, md5salt_boot, sizeof(hdr-
> >md5sum1));
> --
> - 	hdr->kernel_la = htonl(kernel_la);
> - 	hdr->kernel_ep = htonl(kernel_ep);
> --	hdr->fw_length = htonl(layout->fw_max_len);
> - 	hdr->kernel_ofs = htonl(sizeof(struct fw_header));
> - 	hdr->kernel_len = htonl(kernel_len);
> -+
> - 	if (!combined) {
> -+		if (boot_info.file_size == 0)
> -+			memcpy(hdr->md5sum1, md5salt_normal, sizeof(hdr-
> >md5sum1));
> -+		else
> -+			memcpy(hdr->md5sum1, md5salt_boot, sizeof(hdr-
> >md5sum1));
> -+
> -+		hdr->fw_length = htonl(layout->fw_max_len);
> - 		hdr->rootfs_ofs = htonl(rootfs_ofs);
> - 		hdr->rootfs_len = htonl(rootfs_info.file_size);
> - 	}
> -@@ -521,7 +502,8 @@ static void fill_header(char *buf, int len)
> - 		);
> - 	}
> -
> --	get_md5(buf, len, hdr->md5sum1);
> -+	if (!combined)
> -+		get_md5(buf, len, hdr->md5sum1);
> - }
> -
> - static int pad_jffs2(char *buf, int currlen)
> -@@ -598,7 +580,12 @@ static int build_fw(void)
> - 	int ret = EXIT_FAILURE;
> - 	int writelen = 0;
> -
> --	buflen = layout->fw_max_len;
> -+	writelen = sizeof(struct fw_header) + kernel_len;
> -+
> -+	if (combined)
> -+		buflen = writelen;
> -+	else
> -+		buflen = layout->fw_max_len;
> -
> - 	buf = malloc(buflen);
> - 	if (!buf) {
> -@@ -612,7 +599,6 @@ static int build_fw(void)
> - 	if (ret)
> - 		goto out_free_buf;
> -
> --	writelen = sizeof(struct fw_header) + kernel_len;
> -
> - 	if (!combined) {
> - 		if (rootfs_align)
> -@@ -805,7 +791,7 @@ int main(int argc, char *argv[])
> - 	while ( 1 ) {
> - 		int c;
> -
> --		c = getopt(argc, argv, "a:H:E:F:L:m:V:N:W:C:ci:k:r:R:o:xX:hsSjv:");
> -+		c = getopt(argc, argv, "a:H:E:F:L:m:V:N:W:C:ci:k:r:R:o:xX:ehsjv:");
> - 		if (c == -1)
> - 			break;
> -
> -@@ -861,9 +847,6 @@ int main(int argc, char *argv[])
> - 		case 's':
> - 			strip_padding = 1;
> - 			break;
> --		case 'S':
> --			ignore_size = 1;
> --			break;
> - 		case 'i':
> - 			inspect_info.file_name = optarg;
> - 			break;
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0012-build-move-mktplinkfw-combined-
> command-to-image-comm.patch b/build_patches/openwrt/0012-build-move-
> mktplinkfw-combined-command-to-image-comm.patch
> deleted file mode 100644
> index 4c29e3b..0000000
> --- a/build_patches/openwrt/0012-build-move-mktplinkfw-combined-
> command-to-image-comm.patch
> +++ /dev/null
> @@ -1,103 +0,0 @@
> -From f08f754993d5e9a1952400528ce5405910d1d1a4 Mon Sep 17 00:00:00 2001
> -From: Piotr Dymacz <pepe2k at gmail.com>
> -Date: Thu, 6 Jul 2017 18:10:22 +0200
> -Subject: [PATCH] build: move mktplinkfw-combined command to image-
> commands.mk
> -
> -We will need "mktplinkfw-combined" command also in the "ramips" target
> -for new MediaTek based TP-Link devices, with "safeloader" image type.
> -
> -Also, rename the command to "tplink-v1-header", use "VERSION_DIST"
> -variable instead of "OpenWrt" and allow passing additional parameters.
> -
> -Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
> -[Rebased on 8ad1b09]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - include/image-commands.mk            |  9 +++++++++
> - target/linux/ar71xx/image/tp-link.mk | 22 ++++------------------
> - 2 files changed, 13 insertions(+), 18 deletions(-)
> -
> -diff --git a/include/image-commands.mk b/include/image-commands.mk
> -index 04fa853..9e56ab8 100644
> ---- a/include/image-commands.mk
> -+++ b/include/image-commands.mk
> -@@ -165,6 +165,15 @@ define Build/combined-image
> - 	@mv $@.new $@
> - endef
> -
> -+define Build/tplink-v1-header
> -+	$(STAGING_DIR_HOST)/bin/mktplinkfw \
> -+		-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L
> $(KERNEL_LOADADDR) \
> -+		-E $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> -+		-m $(TPLINK_HEADER_VERSION) -N "$(VERSION_DIST)" -V
> $(REVISION) \
> -+		-k $@ -o $@.new $(1)
> -+	@mv $@.new $@
> -+endef
> -+
> - define Build/sysupgrade-tar
> - 	sh $(TOPDIR)/scripts/sysupgrade-tar.sh \
> - 		--board $(if
> $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
> -diff --git a/target/linux/ar71xx/image/tp-link.mk
> b/target/linux/ar71xx/image/tp-link.mk
> -index 2557858..685b09e 100644
> ---- a/target/linux/ar71xx/image/tp-link.mk
> -+++ b/target/linux/ar71xx/image/tp-link.mk
> -@@ -21,20 +21,6 @@ define Build/mktplinkfw
> - 		$(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new
> $@ || rm -f $@
> - endef
> -
> --# mktplinkfw-combined
> --#
> --# -c combined image
> --define Build/mktplinkfw-combined
> --	$(STAGING_DIR_HOST)/bin/mktplinkfw \
> --		-H $(TPLINK_HWID) -W $(TPLINK_HWREV) -N OpenWrt -V
> $(REVISION) $(1) \
> --		-L $(KERNEL_LOADADDR) -m $(TPLINK_HEADER_VERSION) \
> --		-E $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> --		-k $@ \
> --		-o $@.new \
> --		-c
> --	@mv $@.new $@
> --endef
> --
> - # add RE450 and similar header to the kernel image
> - define Build/mktplinkfw-kernel
> - 	$(STAGING_DIR_HOST)/bin/mktplinkfw-kernel \
> -@@ -58,7 +44,7 @@ define Device/tplink
> -   TPLINK_HEADER_VERSION := 1
> -   LOADER_TYPE := gz
> -   KERNEL := kernel-bin | patch-cmdline | lzma
> --  KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-
> combined
> -+  KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header
> -   IMAGES := sysupgrade.bin factory.bin
> -   IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
> -   IMAGE/factory.bin := append-rootfs | mktplinkfw factory
> -@@ -70,7 +56,7 @@ $(Device/tplink)
> -   COMPILE := loader-$(1).gz
> -   COMPILE/loader-$(1).gz := loader-okli-compile
> -   KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 |
> loader-okli $(1)
> --  KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-
> kernel-cmdline | mktplinkfw-combined
> -+  KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-
> kernel-cmdline | tplink-v1-header
> - endef
> -
> - define Device/tplink-4m
> -@@ -249,7 +235,7 @@ $(Device/tplink-8mlzma)
> -   DEVICE_TITLE := TP-LINK TL-WDR6500v2
> -   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
> kmod-ath10k ath10k-firmware-qca988x
> -   KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
> --  KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma |
> mktplinkfw-combined
> -+  KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma |
> tplink-v1-header
> -   BOARDNAME = TL-WDR6500-v2
> -   DEVICE_PROFILE = TLWDR6500V2
> -   TPLINK_HWID := 0x65000002
> -@@ -852,7 +838,7 @@ define Device/tl-wr1043nd-v4
> -     MTDPARTS := spi0.0:128k(u-
> boot)ro,1536k(kernel),14016k(rootfs),128k(product-
> info)ro,320k(config)ro,64k(partition-
> table)ro,128k(logs)ro,64k(ART)ro,15552k at 0x20000(firmware)
> -     IMAGE_SIZE := 15552k
> -     TPLINK_BOARD_NAME := TLWR1043NDV4
> --    KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-combined
> -+    KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header
> -     IMAGES := sysupgrade.bin factory.bin
> -     IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
> -     IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0013-ar71xx-add-support-for-TL-WR1043N-
> v5.0.patch b/build_patches/openwrt/0013-ar71xx-add-support-for-TL-
> WR1043N-v5.0.patch
> deleted file mode 100644
> index 24397dc..0000000
> --- a/build_patches/openwrt/0013-ar71xx-add-support-for-TL-WR1043N-
> v5.0.patch
> +++ /dev/null
> @@ -1,697 +0,0 @@
> -From 857e26a395a446da7b6bb3a1056ef3fb8d85cf65 Mon Sep 17 00:00:00 2001
> -From: majik-sheff <tim at tfthorpe.net>
> -Date: Mon, 25 Sep 2017 04:38:49 -0500
> -Subject: [PATCH] ar71xx: add support for TL-WR1043N v5.0
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -The hardware of the TP-Link WR-1043N v5 appears
> -to be to almost identical to the WR-1043NDv4, except
> -that the USB port has been removed and there is no
> -longer a removeable antenna option.
> -
> -The software is more in line with the Archer series in
> -that is uses a nested bootloader scheme. The factory
> -image should install from the stock interface.
> -
> -Set your Ethernet adapter to 192.168.0.10. Enable your TFTP
> -server with the firmware image in the root named fw.bin
> -(can be any name, just change the tftp command that comes later)
> -When the router starts its boot process,
> -press “enter” to interrupt auto boot.
> -
> -Enter the following commands:
> -tftp 0x80060000 fw.bin
> -erase 0x9f040000 +${filesize}
> -cp.b 0x80060000 0x9f040000 ${filesize}
> -reset
> -
> -Signed-off-by: Tim Thorpe <tim at tfthorpe.net>
> -[Rebased on 8ad1b09, Fixed TPLINK_BOARD_NAME]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - target/linux/ar71xx/base-files/etc/board.d/01_leds |  10 +-
> - .../linux/ar71xx/base-files/etc/board.d/02_network |   4 +
> - target/linux/ar71xx/base-files/etc/diag.sh         |   1 +
> - .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |  24 ++
> - target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
> - .../ar71xx/base-files/lib/upgrade/platform.sh      |   2 +
> - target/linux/ar71xx/config-4.4                     |   1 +
> - .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  10 +
> - .../files/arch/mips/ath79/mach-tl-wr1043nd-v4.c    | 316 +++++++++++++-------
> -
> - .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
> - target/linux/ar71xx/image/tp-link.mk               |  17 +-
> - target/linux/ar71xx/mikrotik/config-default        |   1 +
> - target/linux/ar71xx/nand/config-default            |   1 +
> - tools/firmware-utils/src/tplink-safeloader.c       |  39 ++-
> - 14 files changed, 310 insertions(+), 120 deletions(-)
> - create mode 100644 target/linux/ar71xx/base-
> files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
> -
> -diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -index e1efb56..5f58701 100755
> ---- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> -@@ -666,14 +666,20 @@ tl-wr1043nd-v2)
> - 	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
> - 	ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
> - 	;;
> --tl-wr1043nd-v4)
> --	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
> -+tl-wr1043nd-v4|\
> -+tl-wr1043n-v5)
> - 	ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
> - 	ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0"
> "0x20"
> - 	ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0"
> "0x10"
> - 	ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0"
> "0x08"
> - 	ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0"
> "0x04"
> - 	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0"
> "0x02"
> -+
> -+	case "$board" in
> -+		tl-wr1043nd-v4)
> -+		ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
> -+		;;
> -+	esac
> - 	;;
> - tl-wr2543n)
> - 	ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
> -diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network
> b/target/linux/ar71xx/base-files/etc/board.d/02_network
> -index 24ead87..e7a1702 100755
> ---- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> -+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> -@@ -235,6 +235,7 @@ ar71xx_setup_interfaces()
> - 	dir-835-a1|\
> - 	esr900|\
> - 	mynet-n750|\
> -+	tl-wr1043n-v5|\
> - 	sr3200|\
> - 	wndr3700v4|\
> - 	wndr4300)
> -@@ -485,6 +486,9 @@ ar71xx_setup_macs()
> - 		lan_mac=$(mtd_get_mac_binary product-info 8)
> - 		wan_mac=$(macaddr_add "$lan_mac" 1)
> - 		;;
> -+	tl-wr1043n-v5)
> -+		wan_mac=$(macaddr_add $(mtd_get_mac_binary product-info
> 8) 1)
> -+		;;
> - 	esr900)
> - 		wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
> - 		;;
> -diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
> b/target/linux/ar71xx/base-files/etc/diag.sh
> -index 38cc5d7..ec0c720 100644
> ---- a/target/linux/ar71xx/base-files/etc/diag.sh
> -+++ b/target/linux/ar71xx/base-files/etc/diag.sh
> -@@ -362,6 +362,7 @@ get_status_led() {
> - 	tl-wr1043nd|\
> - 	tl-wr1043nd-v2|\
> - 	tl-wr1043nd-v4|\
> -+	tl-wr1043n-v5|\
> - 	tl-wr741nd|\
> - 	tl-wr741nd-v4|\
> - 	tl-wa801nd-v3|\
> -diff --git a/target/linux/ar71xx/base-
> files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ar71xx/base-
> files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
> -new file mode 100644
> -index 0000000..4b0922f
> ---- /dev/null
> -+++ b/target/linux/ar71xx/base-
> files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
> -@@ -0,0 +1,24 @@
> -+#!/bin/ash
> -+
> -+[ "$ACTION" == "add" ] || exit 0
> -+
> -+PHYNBR=${DEVPATH##*/phy}
> -+
> -+[ -n $PHYNBR ] || exit 0
> -+
> -+. /lib/functions.sh
> -+. /lib/functions/system.sh
> -+
> -+board=$(board_name)
> -+
> -+case "$board" in
> -+	archer-c58-v1)
> -+		echo $(macaddr_add $(mtd_get_mac_binary mac 8)
> $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
> -+		;;
> -+	tl-wr1043n-v5)
> -+		echo $(macaddr_add $(mtd_get_mac_binary product-info 8)
> $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
> -+		;;
> -+	*)
> -+		;;
> -+esac
> -+
> -diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -index 46711af..de6042b 100755
> ---- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -@@ -944,6 +944,9 @@ ar71xx_board_detect() {
> - 	*"TL-WR1043ND v4")
> - 		name="tl-wr1043nd-v4"
> - 		;;
> -+	*"TL-WR1043N v5")
> -+		name="tl-wr1043n-v5"
> -+		;;
> - 	*TL-WR2543N*)
> - 		name="tl-wr2543n"
> - 		;;
> -diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -index e65f6e2..ec8e989 100755
> ---- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -@@ -261,6 +261,7 @@ platform_check_image() {
> - 	tew-712br|\
> - 	tew-732br|\
> - 	tew-823dru|\
> -+	tl-wr1043n-v5|\
> - 	unifi-outdoor|\
> - 	unifiac-lite|\
> - 	unifiac-pro|\
> -@@ -291,6 +292,7 @@ platform_check_image() {
> - 		;;
> - 	alfa-ap96|\
> - 	alfa-nx|\
> -+	tl-wr1043n-v5|\
> - 	ap121-mini|\
> - 	ap121|\
> - 	ap135-020|\
> -diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> -index 0187775..4cf0c6f 100644
> ---- a/target/linux/ar71xx/config-4.4
> -+++ b/target/linux/ar71xx/config-4.4
> -@@ -181,6 +181,7 @@ CONFIG_ATH79_MACH_TL_WR1041N_V2=y
> - CONFIG_ATH79_MACH_TL_WR1043ND=y
> - CONFIG_ATH79_MACH_TL_WR1043ND_V2=y
> - CONFIG_ATH79_MACH_TL_WR1043ND_V4=y
> -+CONFIG_ATH79_MACH_TL_WR1043N_V5=y
> - CONFIG_ATH79_MACH_TL_WR2543N=y
> - CONFIG_ATH79_MACH_TL_WR703N=y
> - CONFIG_ATH79_MACH_TL_WR720N_V3=y
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -index 4112fd3..94f25ee 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> -@@ -1596,6 +1596,16 @@ config ATH79_MACH_TL_WR1043ND_V4
> - 	select ATH79_DEV_USB
> - 	select ATH79_DEV_WMAC
> -
> -+config ATH79_MACH_TL_WR1043N_V5
> -+	bool "TP-LINK TL-WR1043N v5 support"
> -+	select SOC_QCA956X
> -+	select ATH79_DEV_GPIO_BUTTONS
> -+	select ATH79_DEV_LEDS_GPIO
> -+	select ATH79_DEV_SPI
> -+	select ATH79_DEV_WMAC
> -+	select ATH79_DEV_ETH
> -+	select ATH79_DEV_M25P80
> -+
> - config ATH79_MACH_TL_WR2543N
> - 	bool "TP-LINK TL-WR2543N/ND support"
> - 	select SOC_AR724X
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
> -index b1539c5..53a82d2 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
> -@@ -5,6 +5,7 @@
> -  *  Copyright (C) 2016 Matthias Schiffer <mschiffer at universe-factory.net>
> -  *  Copyright (C) 2016 Andreas Ziegler <github at andreas-ziegler.de>
> -  *  Copyright (C) 2016 Ludwig Thomeczek <ledesrc at wxorx.net>
> -+ *  Copyright (c) 2017 Tim Thorpe <tim at tfthorpe.net>
> -  *
> -  *  Derived from: mach-dir-869-a1.c
> -  *
> -@@ -38,153 +39,236 @@
> - #include "machtypes.h"
> - #include "nvram.h"
> -
> --#define TL_WR1043_V4_GPIO_BTN_RESET		2
> --#define TL_WR1043_V4_GPIO_BTN_RFKILL		5
> -+#define TL_WR1043_V4_GPIO_BTN_RESET       2
> -+#define TL_WR1043_V4_GPIO_BTN_RFKILL      5
> -
> --#define TL_WR1043_V4_GPIO_LED_WLAN		19
> --#define TL_WR1043_V4_GPIO_LED_USB		7
> --#define TL_WR1043_V4_GPIO_LED_WPS		1
> --#define TL_WR1043_V4_GPIO_LED_SYSTEM		6
> -+#define TL_WR1043_V4_GPIO_LED_WLAN       19
> -+#define TL_WR1043_V4_GPIO_LED_USB         7
> -+#define TL_WR1043_V4_GPIO_LED_WPS         1
> -+#define TL_WR1043_V4_GPIO_LED_SYSTEM      6
> -
> --#define TL_WR1043_V4_GPIO_USB_POWER		8
> -+#define TL_WR1043_V4_GPIO_USB_POWER       8
> -
> --#define TL_WR1043_V4_GPIO_LED_WAN		15
> --#define TL_WR1043_V4_GPIO_LED_LAN1		9
> --#define TL_WR1043_V4_GPIO_LED_LAN2		14
> --#define TL_WR1043_V4_GPIO_LED_LAN3		21
> --#define TL_WR1043_V4_GPIO_LED_LAN4		20
> -+#define TL_WR1043_V4_GPIO_LED_WAN        15
> -+#define TL_WR1043_V5_GPIO_LED_WAN_ORANGE 16
> -+#define TL_WR1043_V4_GPIO_LED_LAN1        9
> -+#define TL_WR1043_V4_GPIO_LED_LAN2       14
> -+#define TL_WR1043_V4_GPIO_LED_LAN3       21
> -+#define TL_WR1043_V4_GPIO_LED_LAN4       20
> -
> --#define TL_WR1043_V4_KEYS_POLL_INTERVAL		20 /* msecs */
> --#define TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL	(3 *
> TL_WR1043_V4_KEYS_POLL_INTERVAL)
> -+#define TL_WR1043_V4_KEYS_POLL_INTERVAL      20 /* msecs */
> -+#define TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL (3 *
> TL_WR1043_V4_KEYS_POLL_INTERVAL)
> -
> --#define TL_WR1043_V4_MAC_LOCATION		0x1ff50008
> --
> --#define TL_WR1043_V4_EEPROM_ADDR		0x1fff0000
> --#define TL_WR1043_V4_WMAC_CALDATA_OFFSET	0x1000
> -+#define TL_WR1043_V4_MAC_LOCATION        0x1ff50008
> -+#define TL_WR1043_V4_EEPROM_ADDR         0x1fff0000
> -+#define TL_WR1043_V4_WMAC_CALDATA_OFFSET     0x1000
> -+#define TL_WR1043_V5_MAC_LOCATION        0x1ff00008
> -+#define TL_WR1043_V5_DEF_PIN_LOCATION    0x1ff00208
> -+#define TL_WR1043_V5_TPLINK_XML_LOCATION 0x1ff1c008
> -
> - static struct gpio_led tl_wr1043nd_v4_leds_gpio[] __initdata = {
> --	{
> --		.name		= "tp-link:green:wps",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_WPS,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:system",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_SYSTEM,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:wlan",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_WLAN,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:usb",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_USB,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:wan",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_WAN,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:lan1",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_LAN1,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:lan2",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_LAN2,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:lan3",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_LAN3,
> --		.active_low	= 1,
> --	},
> --	{
> --		.name		= "tp-link:green:lan4",
> --		.gpio		= TL_WR1043_V4_GPIO_LED_LAN4,
> --		.active_low	= 1,
> --	},
> -+  {
> -+    .name        = "tp-link:green:wps",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WPS,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:system",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_SYSTEM,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:wlan",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WLAN,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:usb",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_USB,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:wan",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WAN,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan1",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN1,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan2",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN2,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan3",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN3,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan4",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN4,
> -+    .active_low  = 1,
> -+  },
> - };
> -
> - static struct gpio_keys_button tl_wr1043nd_v4_gpio_keys[] __initdata = {
> --	{
> --		.desc		= "Reset button",
> --		.type		= EV_KEY,
> --		.code		= KEY_RESTART,
> --		.debounce_interval =
> TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL,
> --		.gpio		= TL_WR1043_V4_GPIO_BTN_RESET,
> --		.active_low	= 1,
> --	},
> --	{
> --		.desc		= "RFKILL button",
> --		.type		= EV_KEY,
> --		.code		= KEY_RFKILL,
> --		.debounce_interval =
> TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL,
> --		.gpio		= TL_WR1043_V4_GPIO_BTN_RFKILL,
> --		.active_low	= 1,
> --	},
> -+  {
> -+    .desc              = "Reset button",
> -+    .type              = EV_KEY,
> -+    .code              = KEY_RESTART,
> -+    .debounce_interval = TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL,
> -+    .gpio              = TL_WR1043_V4_GPIO_BTN_RESET,
> -+    .active_low        = 1,
> -+  },
> -+  {
> -+    .desc              = "RFKILL button",
> -+    .type              = EV_KEY,
> -+    .code              = KEY_RFKILL,
> -+    .debounce_interval = TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL,
> -+    .gpio              = TL_WR1043_V4_GPIO_BTN_RFKILL,
> -+    .active_low        = 1,
> -+  },
> - };
> -
> - static struct ar8327_pad_cfg tl_wr1043nd_v4_ar8327_pad0_cfg = {
> --	.mode = AR8327_PAD_MAC_SGMII,
> --	.sgmii_delay_en = true,
> -+  .mode           = AR8327_PAD_MAC_SGMII,
> -+  .sgmii_delay_en = true,
> - };
> -
> - static struct ar8327_platform_data tl_wr1043nd_v4_ar8327_data = {
> --	.pad0_cfg = &tl_wr1043nd_v4_ar8327_pad0_cfg,
> --	.port0_cfg = {
> --		.force_link = 1,
> --		.speed = AR8327_PORT_SPEED_1000,
> --		.duplex = 1,
> --		.txpause = 1,
> --		.rxpause = 1,
> --	},
> -+  .pad0_cfg = &tl_wr1043nd_v4_ar8327_pad0_cfg,
> -+  .port0_cfg = {
> -+    .force_link = 1,
> -+    .speed      = AR8327_PORT_SPEED_1000,
> -+    .duplex     = 1,
> -+    .txpause    = 1,
> -+    .rxpause    = 1,
> -+  },
> - };
> -
> - static struct mdio_board_info tl_wr1043nd_v4_mdio0_info[] = {
> --	{
> --		.bus_id = "ag71xx-mdio.0",
> --		.phy_addr = 0,
> --		.platform_data = &tl_wr1043nd_v4_ar8327_data,
> --	},
> -+  {
> -+    .bus_id        = "ag71xx-mdio.0",
> -+    .phy_addr      = 0,
> -+    .platform_data = &tl_wr1043nd_v4_ar8327_data,
> -+  },
> - };
> -
> - static void __init tl_wr1043nd_v4_setup(void)
> - {
> --	u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043_V4_MAC_LOCATION);
> --	u8 *eeprom = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR);
> -+  u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043_V4_MAC_LOCATION);
> -+  u8 *eeprom = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR);
> -
> --	ath79_register_m25p80(NULL);
> -+  ath79_register_m25p80(NULL);
> -
> --	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> --	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
> --	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
> --	ath79_eth0_data.phy_mask = BIT(0);
> -+  ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> -+  ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
> -+  ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
> -+  ath79_eth0_data.phy_mask = BIT(0);
> -
> --	mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info,
> --	                            ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info));
> -+  mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info,
> -+                             ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info));
> -
> --	ath79_register_usb();
> --	ath79_register_mdio(0, 0);
> --	ath79_register_eth(0);
> -+  ath79_register_usb();
> -+  ath79_register_mdio(0, 0);
> -+  ath79_register_eth(0);
> -
> --	ath79_register_wmac(eeprom +
> TL_WR1043_V4_WMAC_CALDATA_OFFSET, mac);
> -+  ath79_register_wmac(eeprom + TL_WR1043_V4_WMAC_CALDATA_OFFSET,
> mac);
> -
> --	ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_v4_leds_gpio),
> --	                         tl_wr1043nd_v4_leds_gpio);
> -+  ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_v4_leds_gpio),
> -+                          tl_wr1043nd_v4_leds_gpio);
> -
> --	ath79_register_gpio_keys_polled(-1,
> TL_WR1043_V4_KEYS_POLL_INTERVAL,
> --	                                ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys),
> --	                                tl_wr1043nd_v4_gpio_keys);
> -+  ath79_register_gpio_keys_polled(-1, TL_WR1043_V4_KEYS_POLL_INTERVAL,
> -+                                 ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys),
> -+                                 tl_wr1043nd_v4_gpio_keys);
> -
> --	gpio_request_one(TL_WR1043_V4_GPIO_USB_POWER,
> --			 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
> --			 "USB power");
> -+  gpio_request_one(TL_WR1043_V4_GPIO_USB_POWER,
> -+                  GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
> -+                  "USB power");
> - }
> -
> - MIPS_MACHINE(ATH79_MACH_TL_WR1043ND_V4, "TL-WR1043ND-v4",
> --	     "TP-LINK TL-WR1043ND v4", tl_wr1043nd_v4_setup);
> -+            "TP-LINK TL-WR1043ND v4", tl_wr1043nd_v4_setup);
> -+
> -+static struct gpio_led tl_wr1043n_v5_leds_gpio[] __initdata = {
> -+  {
> -+    .name        = "tp-link:green:system",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_SYSTEM,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:wlan",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WLAN,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:wan",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WAN,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:orange:wan",
> -+    .gpio        = TL_WR1043_V5_GPIO_LED_WAN_ORANGE,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan1",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN1,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan2",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN2,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan3",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN3,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:lan4",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_LAN4,
> -+    .active_low  = 1,
> -+  },
> -+  {
> -+    .name        = "tp-link:green:wps",
> -+    .gpio        = TL_WR1043_V4_GPIO_LED_WPS,
> -+    .active_low  = 1,
> -+  },
> -+};
> -+
> -+/* The 1043Nv5 is identical to the 1043NDv4, only missing the usb and small
> firmware layout changes  */
> -+static void __init tl_wr1043nv5_setup(void)
> -+{
> -+  u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043_V5_MAC_LOCATION);
> -+  u8 *eeprom = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR);
> -+
> -+  ath79_register_m25p80(NULL);
> -+
> -+  ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> -+  ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
> -+  ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
> -+  ath79_eth0_data.phy_mask = BIT(0);
> -+
> -+  mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info,
> -+                             ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info));
> -+
> -+  ath79_register_mdio(0, 0);
> -+  ath79_register_eth(0);
> -+
> -+  ath79_register_wmac(eeprom + TL_WR1043_V4_WMAC_CALDATA_OFFSET,
> mac);
> -+
> -+  ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043n_v5_leds_gpio),
> -+                          tl_wr1043n_v5_leds_gpio);
> -+
> -+  ath79_register_gpio_keys_polled(-1, TL_WR1043_V4_KEYS_POLL_INTERVAL,
> -+                                 ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys),
> -+                                 tl_wr1043nd_v4_gpio_keys);
> -+}
> -+
> -+MIPS_MACHINE(ATH79_MACH_TL_WR1043N_V5, "TL-WR1043N-v5", "TP-
> LINK TL-WR1043N v5",
> -+            tl_wr1043nv5_setup);
> -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -index 8864e0d..11fc236 100644
> ---- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -@@ -217,6 +217,7 @@ enum ath79_mach_type {
> - 	ATH79_MACH_TL_WR1043ND,			/* TP-LINK TL-
> WR1043ND */
> - 	ATH79_MACH_TL_WR1043ND_V2,		/* TP-LINK TL-WR1043ND
> v2 */
> - 	ATH79_MACH_TL_WR1043ND_V4,		/* TP-LINK TL-WR1043ND
> v4 */
> -+	ATH79_MACH_TL_WR1043N_V5,		/* TP-LINK TL-WR1043N
> v5 */
> - 	ATH79_MACH_TL_WR2543N,			/* TP-LINK TL-
> WR2543N/ND */
> - 	ATH79_MACH_TL_WR703N,			/* TP-LINK TL-WR703N */
> - 	ATH79_MACH_TL_WR710N,			/* TP-LINK TL-WR710N */
> -diff --git a/target/linux/ar71xx/image/tp-link.mk
> b/target/linux/ar71xx/image/tp-link.mk
> -index 685b09e..61ebb09 100644
> ---- a/target/linux/ar71xx/image/tp-link.mk
> -+++ b/target/linux/ar71xx/image/tp-link.mk
> -@@ -843,7 +843,22 @@ define Device/tl-wr1043nd-v4
> -     IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
> -     IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
> - endef
> --TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-
> wr1043nd-v4
> -+define Device/tl-wr1043n-v5
> -+  $(Device/tplink)
> -+  DEVICE_TITLE := TP-LINK TL-WR1043N v5
> -+  BOARDNAME := TL-WR1043N-v5
> -+  DEVICE_PROFILE := TLWR1043
> -+  TPLINK_HWID :=  0x10430005
> -+  MTDPARTS := spi0.0:128k(factory-uboot)ro,128k(u-
> boot)ro,1536k(kernel),13568k(rootfs),128k(product-
> info)ro,640k(config)ro,64k(partition-
> table)ro,128k(logs)ro,64k(ART)ro,15104k at 0x40000(firmware)
> -+  IMAGE_SIZE := 15104k
> -+  TPLINK_BOARD_NAME := TLWR1043NV5
> -+  KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
> -+  IMAGES := sysupgrade.bin factory.bin
> -+  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
> -+	append-metadata | check-size $$$$(IMAGE_SIZE)
> -+  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
> -+endef
> -+TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-
> wr1043nd-v4 tl-wr1043n-v5
> -
> - define Device/tl-wr2543-v1
> -     $(Device/tplink-8mlzma)
> -diff --git a/target/linux/ar71xx/mikrotik/config-default
> b/target/linux/ar71xx/mikrotik/config-default
> -index 376835a..878f7e8 100644
> ---- a/target/linux/ar71xx/mikrotik/config-default
> -+++ b/target/linux/ar71xx/mikrotik/config-default
> -@@ -146,6 +146,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
> - # CONFIG_ATH79_MACH_TL_WR1043ND is not set
> - # CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set
> - # CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set
> -+# CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set
> - # CONFIG_ATH79_MACH_TL_WR2543N is not set
> - # CONFIG_ATH79_MACH_TL_WR703N is not set
> - # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set
> -diff --git a/target/linux/ar71xx/nand/config-default
> b/target/linux/ar71xx/nand/config-default
> -index 62be218..0ccbb4c 100644
> ---- a/target/linux/ar71xx/nand/config-default
> -+++ b/target/linux/ar71xx/nand/config-default
> -@@ -54,6 +54,7 @@
> - # CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set
> - # CONFIG_ATH79_MACH_TL_WR1043ND is not set
> - # CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set
> -+# CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set
> - # CONFIG_ATH79_MACH_TL_WR2543N is not set
> - # CONFIG_ATH79_MACH_TL_WR703N is not set
> - # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set
> -diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-
> utils/src/tplink-safeloader.c
> -index 2468426..72263a4 100644
> ---- a/tools/firmware-utils/src/tplink-safeloader.c
> -+++ b/tools/firmware-utils/src/tplink-safeloader.c
> -@@ -478,6 +478,42 @@ static struct device_info boards[] = {
> - 		.last_sysupgrade_partition = "file-system"
> - 	},
> -
> -+	/** Firmware layout for the TL-WR1043 v5 */
> -+	{
> -+		.id     = "TLWR1043NV5",
> -+		.vendor = "",
> -+		.support_list =
> -+			"SupportList:\n"
> -+			"{product_name:TL-
> WR1043N,product_ver:5.0.0,special_id:45550000}\n"
> -+			"{product_name:TL-
> WR1043N,product_ver:5.0.0,special_id:55530000}\n",
> -+		.support_trail = '\x00',
> -+		.soft_ver = "soft_ver:1.0.0\n",
> -+		.partitions = {
> -+			{"factory-boot", 0x00000, 0x20000},
> -+			{"fs-uboot", 0x20000, 0x20000},
> -+			{"os-image", 0x40000, 0x180000},
> -+			{"file-system", 0x1c0000, 0xd40000},
> -+			{"default-mac", 0xf00000, 0x00200},
> -+			{"pin", 0xf00200, 0x00200},
> -+			{"device-id", 0xf00400, 0x00100},
> -+			{"product-info", 0xf00500, 0x0fb00},
> -+			{"soft-version", 0xf10000, 0x01000},
> -+			{"extra-para", 0xf11000, 0x01000},
> -+			{"support-list", 0xf12000, 0x0a000},
> -+			{"profile", 0xf1c000, 0x04000},
> -+			{"default-config", 0xf20000, 0x10000},
> -+			{"user-config", 0xf30000, 0x40000},
> -+			{"qos-db", 0xf70000, 0x40000},
> -+			{"certificate", 0xfb0000, 0x10000},
> -+			{"partition-table", 0xfc0000, 0x10000},
> -+			{"log", 0xfd0000, 0x20000},
> -+			{"radio", 0xff0000, 0x10000},
> -+			{NULL, 0, 0}
> -+		},
> -+		.first_sysupgrade_partition = "os-image",
> -+		.last_sysupgrade_partition = "file-system"
> -+	},
> -+
> - 	/** Firmware layout for the RE450 */
> - 	{
> - 		.id = "RE450",
> -@@ -888,7 +924,8 @@ static void build_image(const char *output,
> - 	parts[3] = read_file("os-image", kernel_image, false);
> - 	parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
> -
> --	if (strcasecmp(info->id, "ARCHER-C25-V1") == 0) {
> -+	/* Some devices need the extra-para partition to accept the firmware */
> -+	if (strcasecmp(info->id, "ARCHER-C25-V1") == 0 || strcasecmp(info->id,
> "TLWR1043NV5") == 0) {
> - 		const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
> 0x00, 0x01, 0x00, 0x00};
> - 		parts[5] = put_data("extra-para", mdat, 11);
> - 	}
> ---
> -2.7.4
> -
> diff --git a/build_patches/openwrt/0020-Revert-ath-do-not-apply-broken-
> power-limits-with-ATH.patch b/build_patches/openwrt/0020-Revert-ath-do-
> not-apply-broken-power-limits-with-ATH.patch
> deleted file mode 100644
> index 760a454..0000000
> --- a/build_patches/openwrt/0020-Revert-ath-do-not-apply-broken-power-
> limits-with-ATH.patch
> +++ /dev/null
> @@ -1,173 +0,0 @@
> -From e1fb372bc2466a04fdf57d2f806e362931a43daf Mon Sep 17 00:00:00 2001
> -From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian at blaese.de>
> -Date: Sat, 20 Jan 2018 02:33:59 +0100
> -Subject: [PATCH] Revert "ath: do not apply broken power limits with
> - ATH_USER_REGD"
> -
> -This reverts commit a9728799bc41e68de4d50995bb4ad689784ef55e.
> -This is a workaround to fix txpower calculation
> ----
> - .../mac80211/patches/402-ath_regd_optional.patch   | 44 +++-------------------
> - .../mac80211/patches/403-world_regd_fixup.patch    |  4 +-
> - .../patches/406-ath_relax_default_regd.patch       |  8 ++--
> - 3 files changed, 12 insertions(+), 44 deletions(-)
> -
> -diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
> b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
> -index c8ede7f583..0d6d3dbdbd 100644
> ---- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
> -+++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
> -@@ -1,14 +1,6 @@
> - --- a/drivers/net/wireless/ath/regd.c
> - +++ b/drivers/net/wireless/ath/regd.c
> --@@ -24,6 +24,7 @@
> -- #include "regd_common.h"
> --
> -- static int __ath_regd_init(struct ath_regulatory *reg);
> --+static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn);
> --
> -- /*
> --  * This is a set of common rules used by our world regulatory domains.
> --@@ -116,6 +117,9 @@ static const struct ieee80211_regdomain
> -+@@ -116,6 +116,9 @@ static const struct ieee80211_regdomain
> -
> -  static bool dynamic_country_user_possible(struct ath_regulatory *reg)
> -  {
> -@@ -18,7 +10,7 @@
> -  	if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
> -  		return true;
> -
> --@@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl
> -+@@ -188,6 +191,8 @@ static bool dynamic_country_user_possibl
> -
> -  static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
> -  {
> -@@ -27,7 +19,7 @@
> -  	if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
> -  		return false;
> -  	if (!dynamic_country_user_possible(reg))
> --@@ -341,6 +347,9 @@ ath_reg_apply_beaconing_flags(struct wip
> -+@@ -341,6 +346,9 @@ ath_reg_apply_beaconing_flags(struct wip
> -  	struct ieee80211_channel *ch;
> -  	unsigned int i;
> -
> -@@ -37,7 +29,7 @@
> -  	for (band = 0; band < NUM_NL80211_BANDS; band++) {
> -  		if (!wiphy->bands[band])
> -  			continue;
> --@@ -374,6 +383,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
> -+@@ -374,6 +382,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
> -  {
> -  	struct ieee80211_supported_band *sband;
> -
> -@@ -47,7 +39,7 @@
> -  	sband = wiphy->bands[NL80211_BAND_2GHZ];
> -  	if (!sband)
> -  		return;
> --@@ -402,6 +414,9 @@ static void ath_reg_apply_radar_flags(st
> -+@@ -402,6 +413,9 @@ static void ath_reg_apply_radar_flags(st
> -  	struct ieee80211_channel *ch;
> -  	unsigned int i;
> -
> -@@ -57,19 +49,7 @@
> -  	if (!wiphy->bands[NL80211_BAND_5GHZ])
> -  		return;
> -
> --@@ -539,6 +554,11 @@ void ath_reg_notifier_apply(struct wiphy
> -- 		ath_reg_dyn_country(wiphy, reg, request);
> -- 		break;
> -- 	}
> --+
> --+	/* Prevent broken CTLs from being applied */
> --+	if (IS_ENABLED(CPTCFG_ATH_USER_REGD) &&
> --+	    reg->regpair != common->reg_world_copy.regpair)
> --+		reg->regpair = ath_get_regpair(WOR0_WORLD);
> -- }
> -- EXPORT_SYMBOL(ath_reg_notifier_apply);
> --
> --@@ -634,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator
> -+@@ -634,6 +648,10 @@ ath_regd_init_wiphy(struct ath_regulator
> -  	const struct ieee80211_regdomain *regd;
> -
> -  	wiphy->reg_notifier = reg_notifier;
> -@@ -80,18 +60,6 @@
> -  	wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
> -  				   REGULATORY_CUSTOM_REG;
> -
> --@@ -762,10 +786,7 @@ ath_regd_init(struct ath_regulatory *reg
> -- 	if (r)
> -- 		return r;
> --
> ---	if (ath_is_world_regd(reg))
> ---		memcpy(&common->reg_world_copy, reg,
> ---		       sizeof(struct ath_regulatory));
> ---
> --+	memcpy(&common->reg_world_copy, reg, sizeof(struct
> ath_regulatory));
> -- 	ath_regd_init_wiphy(reg, wiphy, reg_notifier);
> --
> -- 	return 0;
> - --- a/drivers/net/wireless/ath/Kconfig
> - +++ b/drivers/net/wireless/ath/Kconfig
> - @@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
> -diff --git a/package/kernel/mac80211/patches/403-world_regd_fixup.patch
> b/package/kernel/mac80211/patches/403-world_regd_fixup.patch
> -index 2043083158..2b04309ce5 100644
> ---- a/package/kernel/mac80211/patches/403-world_regd_fixup.patch
> -+++ b/package/kernel/mac80211/patches/403-world_regd_fixup.patch
> -@@ -1,6 +1,6 @@
> - --- a/drivers/net/wireless/ath/regd.c
> - +++ b/drivers/net/wireless/ath/regd.c
> --@@ -44,7 +44,8 @@ static struct reg_dmn_pair_mapping *ath_
> -+@@ -43,7 +43,8 @@ static int __ath_regd_init(struct ath_re
> -  					 NL80211_RRF_NO_OFDM)
> -
> -  /* We allow IBSS on these on a case by case basis by regulatory domain */
> -@@ -10,7 +10,7 @@
> -  					 NL80211_RRF_NO_IR)
> -  #define ATH9K_5GHZ_5470_5850	REG_RULE(5470-10, 5850+10, 80, 0, 30,\
> -  					 NL80211_RRF_NO_IR)
> --@@ -62,57 +63,56 @@ static struct reg_dmn_pair_mapping *ath_
> -+@@ -61,57 +62,56 @@ static int __ath_regd_init(struct ath_re
> -  #define ATH9K_5GHZ_NO_MIDBAND	ATH9K_5GHZ_5150_5350, \
> -  				ATH9K_5GHZ_5725_5850
> -
> -diff --git a/package/kernel/mac80211/patches/406-
> ath_relax_default_regd.patch b/package/kernel/mac80211/patches/406-
> ath_relax_default_regd.patch
> -index 35b0f2b76e..b6190b9363 100644
> ---- a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch
> -+++ b/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch
> -@@ -1,6 +1,6 @@
> - --- a/drivers/net/wireless/ath/regd.c
> - +++ b/drivers/net/wireless/ath/regd.c
> --@@ -115,6 +115,16 @@ static const struct ieee80211_regdomain
> -+@@ -114,6 +114,16 @@ static const struct ieee80211_regdomain
> -  	)
> -  };
> -
> -@@ -17,7 +17,7 @@
> -  static bool dynamic_country_user_possible(struct ath_regulatory *reg)
> -  {
> -  	if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
> --@@ -123,6 +133,9 @@ static bool dynamic_country_user_possibl
> -+@@ -122,6 +132,9 @@ static bool dynamic_country_user_possibl
> -  	if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
> -  		return true;
> -
> -@@ -27,7 +27,7 @@
> -  	switch (reg->country_code) {
> -  	case CTRY_UNITED_STATES:
> -  	case CTRY_JAPAN1:
> --@@ -208,11 +221,6 @@ static inline bool is_wwr_sku(u16 regd)
> -+@@ -207,11 +220,6 @@ static inline bool is_wwr_sku(u16 regd)
> -  		(regd == WORLD));
> -  }
> -
> -@@ -39,7 +39,7 @@
> -  bool ath_is_world_regd(struct ath_regulatory *reg)
> -  {
> -  	return is_wwr_sku(ath_regd_get_eepromRD(reg));
> --@@ -658,6 +666,9 @@ ath_regd_init_wiphy(struct ath_regulator
> -+@@ -652,6 +660,9 @@ ath_regd_init_wiphy(struct ath_regulator
> -  	if (IS_ENABLED(CPTCFG_ATH_USER_REGD))
> -  		return 0;
> -
> ---
> -2.11.0
> -
> diff --git a/build_patches/openwrt/0031-ar71xx-remove-bs-partition-ro-flag-
> for-UniFi-AC.patch b/build_patches/openwrt/0031-ar71xx-remove-bs-partition-
> ro-flag-for-UniFi-AC.patch
> deleted file mode 100644
> index 9814f66..0000000
> --- a/build_patches/openwrt/0031-ar71xx-remove-bs-partition-ro-flag-for-
> UniFi-AC.patch
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -From e873363e0541d8ded05635e8341efe564c5d9cff Mon Sep 17 00:00:00 2001
> -From: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> -Date: Tue, 10 Apr 2018 19:04:13 +0200
> -Subject: [PATCH] ar71xx: remove bs-partition ro-flag for UniFi AC
> -
> -This removes the read-only flag from the bs (bootselect) partition
> -on UniFi AC devices. This allows to correct the indicator from which
> -partition the device is booting its kernel from.
> -
> -See also:
> - - freifunk-gluon/gluon#1301freifunk-gluon/gluon#1301, ar71xx:  UBNT UniFi
> AP-AC Mesh/Lite/Pro sysupgrade broken
> - - https://bugs.lede-project.org/index.php?do=details&task_id=662
> -
> -Signed-off-by: David Bauer <mail at david-bauer.net>
> -[Backported to our lede-17.01 snapshot]
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - target/linux/ar71xx/image/ubnt.mk | 2 +-
> - 1 file changed, 1 insertion(+), 1 deletion(-)
> -
> -diff --git a/target/linux/ar71xx/image/ubnt.mk
> b/target/linux/ar71xx/image/ubnt.mk
> -index 68fe8ad..65ed708 100644
> ---- a/target/linux/ar71xx/image/ubnt.mk
> -+++ b/target/linux/ar71xx/image/ubnt.mk
> -@@ -82,7 +82,7 @@ define Device/ubnt-unifiac
> -   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
> -   DEVICE_PROFILE := UBNT
> -   IMAGE_SIZE := 7744k
> --  MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-
> env)ro,7744k(firmware),7744k(ubnt-
> airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
> -+  MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-
> env)ro,7744k(firmware),7744k(ubnt-
> airos)ro,128k(bs),256k(cfg)ro,64k(EEPROM)ro
> -   IMAGES := sysupgrade.bin
> -   IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-
> rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
> - endef
> ---
> -2.7.4
> -
> diff --git a/build_patches/routing/0001-alfred-Support-interface-IDs-with-more-
> than-two-digi.patch b/build_patches/routing/0001-alfred-Support-interface-
> IDs-with-more-than-two-digi.patch
> deleted file mode 100644
> index 6b21233..0000000
> --- a/build_patches/routing/0001-alfred-Support-interface-IDs-with-more-than-
> two-digi.patch
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -From 135bc605b4cf91d40ac97f1129a6a5a950f3ff72 Mon Sep 17 00:00:00 2001
> -From: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> -Date: Mon, 19 Mar 2018 14:16:54 +0100
> -Subject: [PATCH] alfred: Support interface IDs with more than two digits
> -
> -Occationally /proc/net/if_inet6 contains interface IDs with
> -three digits. In this case, the regex in wait_for_ll_address()
> -does not work anymore and alfred is not starting.
> -
> -This patch changes the evaluation so that fields are used instead
> -of the mere position by counting characters.
> -
> -Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ----
> - alfred/files/alfred.init | 4 ++--
> - 1 file changed, 2 insertions(+), 2 deletions(-)
> -
> -diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init
> -index 4c9a9e19..82934368 100755
> ---- a/alfred/files/alfred.init
> -+++ b/alfred/files/alfred.init
> -@@ -46,11 +46,11 @@ wait_for_ll_address()
> - 	for i in $(seq $timeout); do
> - 		# We look for
> - 		# - the link-local address (starts with fe80)
> --		# - without tentative flag (bit 0x40 in the flags field; the first char
> of the flags field begins 38 columns after the fe80 prefix
> -+		# - without tentative flag (bit 0x40 in the flags field; the first char
> of the fifth field is evaluated)
> - 		# - on interface $iface
> - 		if awk '
> - 			BEGIN { RET=1 }
> --			/^fe80.{37} [012389ab]/ { if ($6 == "'"$iface"'") RET=0 }
> -+			$1 ~ /^fe80/ && $5 ~ /^[012389ab]/ && $6 == "'"$iface"'"
> { RET=0 }
> - 			END { exit RET }
> - 		' /proc/net/if_inet6; then
> - 			return
> diff --git a/buildscript b/buildscript
> index 1a1cfdd..29918a2 100755
> --- a/buildscript
> +++ b/buildscript
> @@ -13,9 +13,9 @@
> 
>  builddir=./build
> 
> -OPENWRTREV="8ad1b09c6dcff814eb04084ef349f975025b7dc1" # LEDE from
> 2017-10-13
> +OPENWRTREV="70255e3d624cd393612069aae0a859d1acbbeeae" # openwrt-
> 18.06.1
>  OPENWRTURL="https://git.openwrt.org/openwrt/openwrt.git"
> -PACKAGEREV="21b2e3eb761ea79bf3a8d2b6368435887960f5c2" # lede-17.01.3
> +PACKAGEREV="35e0b737ab496f5b51e80079b0d8c9b442e223f5" # openwrt-
> 18.06.1
>  PACKAGEURL="https://git.openwrt.org/feed/packages.git"
> 
>  ## Feed definition [0]: name aka directory, [1]: url, [2]: revision, [3..n]: patches
> @@ -38,9 +38,8 @@ GLUON_PKGS="kmod-batman-adv-legacy micrond simple-
> tc uradvd"
>  #official openwrt routing packages
>  ROUTING=(routing
>           https://git.openwrt.org/feed/routing.git
> -         d11075cd40a88602bf4ba2b275f72100ddcb4767
> -         "0001-alfred-Support-interface-IDs-with-more-than-two-digi.patch"
> -         "0002-Add-batman-adv-patch-to-remove-gw-mode-switch-
> messag.patch") # lede-17.01
> +         1b9d1c419f0ecefda51922a7845ab2183d6acd76
> +         "0002-Add-batman-adv-patch-to-remove-gw-mode-switch-
> messag.patch") # openwrt-18.06 from 2018-06-13
>  ROUTING_PKGS="kmod-batman-adv batctl alfred"
> 
>  FFF=(fff)
> --
> 2.19.0
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : nicht verfügbar
Dateityp    : application/pgp-signature
Dateigröße  : 834 bytes
Beschreibung: nicht verfügbar
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20181024/fa69bb6b/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev