build_patches: Fix tplink-safeloader for TP-Link CPE210 v3

Submitted by Adrian Schmutzler on Nov. 19, 2019, 9:48 p.m.

Details

Message ID 20191119214822.5096-1-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler Nov. 19, 2019, 9:48 p.m.
With the current OpenWrt patches, both CPE210 v2 and v3 can be
flashed with each other's images. Introduce a separate entry
in tplink_safeloader.c to prevent crossflashing.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

---

Changes in v2:
- rebase
---
 ...tils-tplink-safeloader-Add-CPE210-v3.patch | 64 ++++++++++++-------
 ...xx-Add-support-for-TP-Link-CPE210-v3.patch | 41 ++++++------
 2 files changed, 58 insertions(+), 47 deletions(-)

Patch hide | download patch | download mbox

diff --git a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
index 941b7d73..71b394ea 100644
--- a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
+++ b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
@@ -1,42 +1,58 @@ 
-From dc634e3bbd66089ea9d92f19983182bfdf2de13c Mon Sep 17 00:00:00 2001
 From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
 Date: Wed, 10 Oct 2018 20:05:53 +0200
-Subject: [PATCH 1/2] firmware-utils: tplink-safeloader: Add CPE210 v3
+Subject: firmware-utils: tplink-safeloader: Add CPE210 v3
 
 Add TP-Link CPE210 v3 to the support list.
 It's identical to the v2.
 
 Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- tools/firmware-utils/src/tplink-safeloader.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
+[Use separate definition to prevent cross-updates]
+Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
 
 diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
-index 4b227e1c97..01885683c3 100644
+index 4b227e1c97b6c5b236dba29dbdd5f0bcd68621cb..de15faf6796c993efc6c2a36b22bb1e978e3be90 100644
 --- a/tools/firmware-utils/src/tplink-safeloader.c
 +++ b/tools/firmware-utils/src/tplink-safeloader.c
-@@ -155,7 +155,7 @@ static struct device_info boards[] = {
+@@ -197,6 +197,42 @@ static struct device_info boards[] = {
  		.last_sysupgrade_partition = "support-list",
  	},
  
--	/** Firmware layout for the CPE210 V2 */
-+	/** Firmware layout for the CPE210 V2 and V3 */
- 	{
- 		.id     = "CPE210V2",
- 		.vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
-@@ -170,7 +170,11 @@ static struct device_info boards[] = {
- 			"CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
- 			"CPE210(TP-LINK|UN|N300-2):2.0\r\n"
- 			"CPE210(TP-LINK|EU|N300-2):2.0\r\n"
--			"CPE210(TP-LINK|US|N300-2):2.0\r\n",
-+			"CPE210(TP-LINK|US|N300-2):2.0\r\n"
++	/** Firmware layout for the CPE210 V3 */
++	{
++		.id     = "CPE210V3",
++		.vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
++		.support_list =
++			"SupportList:\r\n"
 +			"CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
 +			"CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
 +			"CPE210(TP-LINK|UN|N300-2):3.0\r\n"
 +			"CPE210(TP-LINK|EU|N300-2):3.0\r\n",
- 		.support_trail = '\xff',
- 		.soft_ver = NULL,
- 
--- 
-2.11.0
-
++		.support_trail = '\xff',
++		.soft_ver = NULL,
++
++		.partitions = {
++			{"fs-uboot", 0x00000, 0x20000},
++			{"partition-table", 0x20000, 0x02000},
++			{"default-mac", 0x30000, 0x00020},
++			{"product-info", 0x31100, 0x00100},
++			{"device-info", 0x31400, 0x00400},
++			{"signature", 0x32000, 0x00400},
++			{"device-id", 0x33000, 0x00100},
++			{"os-image", 0x40000, 0x1c0000},
++			{"file-system", 0x200000, 0x5b0000},
++			{"soft-version", 0x7b0000, 0x00100},
++			{"support-list", 0x7b1000, 0x01000},
++			{"user-config", 0x7c0000, 0x10000},
++			{"default-config", 0x7d0000, 0x10000},
++			{"log", 0x7e0000, 0x10000},
++			{"radio", 0x7f0000, 0x10000},
++			{NULL, 0, 0}
++		},
++
++		.first_sysupgrade_partition = "os-image",
++		.last_sysupgrade_partition = "support-list",
++	},
++
+ 	/** Firmware layout for the CPE510/520 */
+ 	{
+ 		.id	= "CPE510",
diff --git a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
index 7d6af911..20213733 100644
--- a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
+++ b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
@@ -1,7 +1,6 @@ 
-From 2eca1d93647356939a7388847a65cb2533cc5858 Mon Sep 17 00:00:00 2001
 From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
 Date: Wed, 10 Oct 2018 20:13:09 +0200
-Subject: [PATCH 2/2] ar71xx: Add support for TP-Link CPE210 v3
+Subject: ar71xx: Add support for TP-Link CPE210 v3
 
 Looks identical to the v2
 
@@ -24,18 +23,12 @@  Stock TFTP server IP:192.168.0.100
 Stock device TFTP address:192.168.0.254
 
 Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- target/linux/ar71xx/base-files/etc/board.d/01_leds      | 4 +++-
- target/linux/ar71xx/base-files/etc/board.d/02_network   | 1 +
- target/linux/ar71xx/base-files/lib/ar71xx.sh            | 4 ++++
- target/linux/ar71xx/base-files/lib/upgrade/platform.sh  | 3 ++-
- target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c | 3 +++
- target/linux/ar71xx/files/arch/mips/ath79/machtypes.h   | 1 +
- target/linux/ar71xx/image/generic-tp-link.mk            | 7 +++++++
- 7 files changed, 21 insertions(+), 2 deletions(-)
+[Adjusted for separate safeloader entry, do not inherit device
+definition from cpe210-v2]
+Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
 
 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 592133ac28..89cc0cbff7 100755
+index 23f3d23bf53883fb08944bc65b98cac06a16c0a5..e0222f3637b60b89a6ef6c0d10cfb20fbe73f075 100755
 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
 +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
 @@ -249,6 +249,7 @@ cf-e530n)
@@ -57,7 +50,7 @@  index 592133ac28..89cc0cbff7 100755
  		;;
  	*)
 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 6f5f07e1c5..0905a93785 100755
+index e9522252a2b8ba7de1c8ca7d070ff7f2897aade9..386d93e58451b953937320b1bfe8d71ed73c69fd 100755
 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
 +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
 @@ -75,6 +75,7 @@ ar71xx_setup_interfaces()
@@ -69,7 +62,7 @@  index 6f5f07e1c5..0905a93785 100755
  	eap120|\
  	eap300v2|\
 diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
-index ccbd4e77c3..2200069c64 100755
+index ccbd4e77c324a36e7fba6e6dccad59d8f94a3921..2200069c647b33220126e797b6a61928d1fb428e 100755
 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
 +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
 @@ -583,6 +583,10 @@ ar71xx_board_detect() {
@@ -84,7 +77,7 @@  index ccbd4e77c3..2200069c64 100755
  		name="cpe505n"
  		;;
 diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
-index ca1270b7fd..a04dd7441d 100755
+index ca1270b7fdc84c53f8417c226f18ca4fff1f27d8..a04dd7441d28e9db4dc7c744707bb5f35936da00 100755
 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
 @@ -587,7 +587,8 @@ platform_check_image() {
@@ -98,7 +91,7 @@  index ca1270b7fd..a04dd7441d 100755
  		return 1
  		;;
 diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
-index ceb1769ddd..f25a69f08e 100644
+index ceb1769ddd522d51014228fe65e2662f2f3e627c..f25a69f08e8a69d9b6de0ca9d7d7d14f8dff5fa0 100644
 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
 +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
 @@ -236,6 +236,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
@@ -112,7 +105,7 @@  index ceb1769ddd..f25a69f08e 100644
  	     cpe510_setup);
  
 diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
-index 80f6e1d95b..c82cb17cf6 100644
+index 80f6e1d95b7a4e5559e7d5da041b32d962ad4e84..c82cb17cf613bdb3796a15e384215d4579767468 100644
 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
 +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
 @@ -75,6 +75,7 @@ enum ath79_mach_type {
@@ -124,23 +117,25 @@  index 80f6e1d95b..c82cb17cf6 100644
  	ATH79_MACH_CPE510,			/* TP-LINK CPE510 */
  	ATH79_MACH_CPE830,			/* YunCore CPE830 */
 diff --git a/target/linux/ar71xx/image/generic-tp-link.mk b/target/linux/ar71xx/image/generic-tp-link.mk
-index 338b2db2d6..571235a3b3 100644
+index daf6c35ae4610d844bd9e8f44ea5deab72143a48..8ad1f6e38228b639d1d127937ba875c030a6a632 100644
 --- a/target/linux/ar71xx/image/generic-tp-link.mk
 +++ b/target/linux/ar71xx/image/generic-tp-link.mk
-@@ -195,6 +195,13 @@ define Device/cpe210-v2
+@@ -195,6 +195,18 @@ define Device/cpe210-v2
  endef
  TARGET_DEVICES += cpe210-v2
  
 +define Device/cpe210-v3
-+  $(Device/cpe210-v2)
++  $(Device/cpexxx)
 +  DEVICE_TITLE := TP-LINK CPE210 v3
 +  BOARDNAME := CPE210V3
++  TPLINK_BOARD_ID := CPE210V3
++  KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header
++  TPLINK_HWID := 0x0
++  TPLINK_HWREV := 0
++  TPLINK_HEADER_VERSION := 1
 +endef
 +TARGET_DEVICES += cpe210-v3
 +
  define Device/wbs210-v1
    $(Device/cpe510-520-v1)
    DEVICE_TITLE := TP-LINK WBS210 v1
--- 
-2.11.0
-

Comments

Fabian Blaese Nov. 20, 2019, 4:26 p.m.
Darüber, dass man ggf. nicht mehr das richtige Update flashen kann, wenn die falsche Version geflasht wurde, habe ich nicht nachgedacht.

Wenn dem tatsächlich so ist, wollen wir das denke ich in der Firmware haben.
Acked-by: Fabian Bläse <fabian@blaese.de>

Fabian

On 19.11.19 22:48, Adrian Schmutzler wrote:
> With the current OpenWrt patches, both CPE210 v2 and v3 can be
> flashed with each other's images. Introduce a separate entry
> in tplink_safeloader.c to prevent crossflashing.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> ---
> 
> Changes in v2:
> - rebase
> ---
>  ...tils-tplink-safeloader-Add-CPE210-v3.patch | 64 ++++++++++++-------
>  ...xx-Add-support-for-TP-Link-CPE210-v3.patch | 41 ++++++------
>  2 files changed, 58 insertions(+), 47 deletions(-)
> 
> diff --git a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
> index 941b7d73..71b394ea 100644
> --- a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
> +++ b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v3.patch
> @@ -1,42 +1,58 @@
> -From dc634e3bbd66089ea9d92f19983182bfdf2de13c Mon Sep 17 00:00:00 2001
>  From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>  Date: Wed, 10 Oct 2018 20:05:53 +0200
> -Subject: [PATCH 1/2] firmware-utils: tplink-safeloader: Add CPE210 v3
> +Subject: firmware-utils: tplink-safeloader: Add CPE210 v3
>  
>  Add TP-Link CPE210 v3 to the support list.
>  It's identical to the v2.
>  
>  Signed-off-by: Robert Marko <robimarko@gmail.com>
> ----
> - tools/firmware-utils/src/tplink-safeloader.c | 8 ++++++--
> - 1 file changed, 6 insertions(+), 2 deletions(-)
> +[Use separate definition to prevent cross-updates]
> +Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>  
>  diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
> -index 4b227e1c97..01885683c3 100644
> +index 4b227e1c97b6c5b236dba29dbdd5f0bcd68621cb..de15faf6796c993efc6c2a36b22bb1e978e3be90 100644
>  --- a/tools/firmware-utils/src/tplink-safeloader.c
>  +++ b/tools/firmware-utils/src/tplink-safeloader.c
> -@@ -155,7 +155,7 @@ static struct device_info boards[] = {
> +@@ -197,6 +197,42 @@ static struct device_info boards[] = {
>   		.last_sysupgrade_partition = "support-list",
>   	},
>   
> --	/** Firmware layout for the CPE210 V2 */
> -+	/** Firmware layout for the CPE210 V2 and V3 */
> - 	{
> - 		.id     = "CPE210V2",
> - 		.vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
> -@@ -170,7 +170,11 @@ static struct device_info boards[] = {
> - 			"CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
> - 			"CPE210(TP-LINK|UN|N300-2):2.0\r\n"
> - 			"CPE210(TP-LINK|EU|N300-2):2.0\r\n"
> --			"CPE210(TP-LINK|US|N300-2):2.0\r\n",
> -+			"CPE210(TP-LINK|US|N300-2):2.0\r\n"
> ++	/** Firmware layout for the CPE210 V3 */
> ++	{
> ++		.id     = "CPE210V3",
> ++		.vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
> ++		.support_list =
> ++			"SupportList:\r\n"
>  +			"CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
>  +			"CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
>  +			"CPE210(TP-LINK|UN|N300-2):3.0\r\n"
>  +			"CPE210(TP-LINK|EU|N300-2):3.0\r\n",
> - 		.support_trail = '\xff',
> - 		.soft_ver = NULL,
> - 
> --- 
> -2.11.0
> -
> ++		.support_trail = '\xff',
> ++		.soft_ver = NULL,
> ++
> ++		.partitions = {
> ++			{"fs-uboot", 0x00000, 0x20000},
> ++			{"partition-table", 0x20000, 0x02000},
> ++			{"default-mac", 0x30000, 0x00020},
> ++			{"product-info", 0x31100, 0x00100},
> ++			{"device-info", 0x31400, 0x00400},
> ++			{"signature", 0x32000, 0x00400},
> ++			{"device-id", 0x33000, 0x00100},
> ++			{"os-image", 0x40000, 0x1c0000},
> ++			{"file-system", 0x200000, 0x5b0000},
> ++			{"soft-version", 0x7b0000, 0x00100},
> ++			{"support-list", 0x7b1000, 0x01000},
> ++			{"user-config", 0x7c0000, 0x10000},
> ++			{"default-config", 0x7d0000, 0x10000},
> ++			{"log", 0x7e0000, 0x10000},
> ++			{"radio", 0x7f0000, 0x10000},
> ++			{NULL, 0, 0}
> ++		},
> ++
> ++		.first_sysupgrade_partition = "os-image",
> ++		.last_sysupgrade_partition = "support-list",
> ++	},
> ++
> + 	/** Firmware layout for the CPE510/520 */
> + 	{
> + 		.id	= "CPE510",
> diff --git a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
> index 7d6af911..20213733 100644
> --- a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
> +++ b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch
> @@ -1,7 +1,6 @@
> -From 2eca1d93647356939a7388847a65cb2533cc5858 Mon Sep 17 00:00:00 2001
>  From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>  Date: Wed, 10 Oct 2018 20:13:09 +0200
> -Subject: [PATCH 2/2] ar71xx: Add support for TP-Link CPE210 v3
> +Subject: ar71xx: Add support for TP-Link CPE210 v3
>  
>  Looks identical to the v2
>  
> @@ -24,18 +23,12 @@ Stock TFTP server IP:192.168.0.100
>  Stock device TFTP address:192.168.0.254
>  
>  Signed-off-by: Robert Marko <robimarko@gmail.com>
> ----
> - target/linux/ar71xx/base-files/etc/board.d/01_leds      | 4 +++-
> - target/linux/ar71xx/base-files/etc/board.d/02_network   | 1 +
> - target/linux/ar71xx/base-files/lib/ar71xx.sh            | 4 ++++
> - target/linux/ar71xx/base-files/lib/upgrade/platform.sh  | 3 ++-
> - target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c | 3 +++
> - target/linux/ar71xx/files/arch/mips/ath79/machtypes.h   | 1 +
> - target/linux/ar71xx/image/generic-tp-link.mk            | 7 +++++++
> - 7 files changed, 21 insertions(+), 2 deletions(-)
> +[Adjusted for separate safeloader entry, do not inherit device
> +definition from cpe210-v2]
> +Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>  
>  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 592133ac28..89cc0cbff7 100755
> +index 23f3d23bf53883fb08944bc65b98cac06a16c0a5..e0222f3637b60b89a6ef6c0d10cfb20fbe73f075 100755
>  --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
>  +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
>  @@ -249,6 +249,7 @@ cf-e530n)
> @@ -57,7 +50,7 @@ index 592133ac28..89cc0cbff7 100755
>   		;;
>   	*)
>  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 6f5f07e1c5..0905a93785 100755
> +index e9522252a2b8ba7de1c8ca7d070ff7f2897aade9..386d93e58451b953937320b1bfe8d71ed73c69fd 100755
>  --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
>  +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
>  @@ -75,6 +75,7 @@ ar71xx_setup_interfaces()
> @@ -69,7 +62,7 @@ index 6f5f07e1c5..0905a93785 100755
>   	eap120|\
>   	eap300v2|\
>  diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> -index ccbd4e77c3..2200069c64 100755
> +index ccbd4e77c324a36e7fba6e6dccad59d8f94a3921..2200069c647b33220126e797b6a61928d1fb428e 100755
>  --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
>  +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
>  @@ -583,6 +583,10 @@ ar71xx_board_detect() {
> @@ -84,7 +77,7 @@ index ccbd4e77c3..2200069c64 100755
>   		name="cpe505n"
>   		;;
>  diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> -index ca1270b7fd..a04dd7441d 100755
> +index ca1270b7fdc84c53f8417c226f18ca4fff1f27d8..a04dd7441d28e9db4dc7c744707bb5f35936da00 100755
>  --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>  +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>  @@ -587,7 +587,8 @@ platform_check_image() {
> @@ -98,7 +91,7 @@ index ca1270b7fd..a04dd7441d 100755
>   		return 1
>   		;;
>  diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
> -index ceb1769ddd..f25a69f08e 100644
> +index ceb1769ddd522d51014228fe65e2662f2f3e627c..f25a69f08e8a69d9b6de0ca9d7d7d14f8dff5fa0 100644
>  --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
>  +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
>  @@ -236,6 +236,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
> @@ -112,7 +105,7 @@ index ceb1769ddd..f25a69f08e 100644
>   	     cpe510_setup);
>   
>  diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> -index 80f6e1d95b..c82cb17cf6 100644
> +index 80f6e1d95b7a4e5559e7d5da041b32d962ad4e84..c82cb17cf613bdb3796a15e384215d4579767468 100644
>  --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
>  +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
>  @@ -75,6 +75,7 @@ enum ath79_mach_type {
> @@ -124,23 +117,25 @@ index 80f6e1d95b..c82cb17cf6 100644
>   	ATH79_MACH_CPE510,			/* TP-LINK CPE510 */
>   	ATH79_MACH_CPE830,			/* YunCore CPE830 */
>  diff --git a/target/linux/ar71xx/image/generic-tp-link.mk b/target/linux/ar71xx/image/generic-tp-link.mk
> -index 338b2db2d6..571235a3b3 100644
> +index daf6c35ae4610d844bd9e8f44ea5deab72143a48..8ad1f6e38228b639d1d127937ba875c030a6a632 100644
>  --- a/target/linux/ar71xx/image/generic-tp-link.mk
>  +++ b/target/linux/ar71xx/image/generic-tp-link.mk
> -@@ -195,6 +195,13 @@ define Device/cpe210-v2
> +@@ -195,6 +195,18 @@ define Device/cpe210-v2
>   endef
>   TARGET_DEVICES += cpe210-v2
>   
>  +define Device/cpe210-v3
> -+  $(Device/cpe210-v2)
> ++  $(Device/cpexxx)
>  +  DEVICE_TITLE := TP-LINK CPE210 v3
>  +  BOARDNAME := CPE210V3
> ++  TPLINK_BOARD_ID := CPE210V3
> ++  KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header
> ++  TPLINK_HWID := 0x0
> ++  TPLINK_HWREV := 0
> ++  TPLINK_HEADER_VERSION := 1
>  +endef
>  +TARGET_DEVICES += cpe210-v3
>  +
>   define Device/wbs210-v1
>     $(Device/cpe510-520-v1)
>     DEVICE_TITLE := TP-LINK WBS210 v1
> --- 
> -2.11.0
> -
>
Adrian Schmutzler Nov. 20, 2019, 4:36 p.m.
Hallo,

> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf Of Fabian Bläse
> Sent: Mittwoch, 20. November 2019 17:26
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-dev@freifunk.net
> Subject: Re: [PATCH] build_patches: Fix tplink-safeloader for TP-Link CPE210 v3
> 
> Darüber, dass man ggf. nicht mehr das richtige Update flashen kann, wenn die falsche Version geflasht wurde, habe ich nicht nachgedacht.
> Wenn dem tatsächlich so ist, wollen wir das denke ich in der Firmware haben. 

Um das nochmal genauer zu erklären:
Der safeloader bestimmt, welches Image als factory geflasht werden kann. Mit dem alten Patch (der auf einem Pull Request basiert) konnte man sowohl CPE210v2 und v3 mit jeweils beiden Images flashen. Danach legt das Image fest, welches Image danach geflasht werden kann. Hat man also ein v2 Image, kann man nur noch auf v2 updaten etc. (außer natürlich mit -F).

Am Schluss ist das sicher ein Randfall, aber ich hätte trotzdem gerne die finale Variante drin.

Grüße

Adrian
Fabian Blaese Nov. 20, 2019, 5:15 p.m.
Ah, jetzt seh ich erst.

Die CPE210 v3 hat im OpenWRT 18.06 überhaupt keinen Support und wir patchen das erst nachträglich drauf.
Im Endeffekt passt dieser Patch hier den build_patch ja nur so an, dass er so aussieht wie das, was im Endeffekt in OpenWRT 19.xy dann auch Upstream ist.
Passt, danke.

Reviewed-by: Fabian Bläse <fabian@blaese.de>

Gruß
Fabian

On 20.11.19 17:36, Adrian Schmutzler wrote:
> Hallo,
> 
>> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf Of Fabian Bläse
>> Sent: Mittwoch, 20. November 2019 17:26
>> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-dev@freifunk.net
>> Subject: Re: [PATCH] build_patches: Fix tplink-safeloader for TP-Link CPE210 v3
>>
>> Darüber, dass man ggf. nicht mehr das richtige Update flashen kann, wenn die falsche Version geflasht wurde, habe ich nicht nachgedacht.
>> Wenn dem tatsächlich so ist, wollen wir das denke ich in der Firmware haben. 
> 
> Um das nochmal genauer zu erklären:
> Der safeloader bestimmt, welches Image als factory geflasht werden kann. Mit dem alten Patch (der auf einem Pull Request basiert) konnte man sowohl CPE210v2 und v3 mit jeweils beiden Images flashen. Danach legt das Image fest, welches Image danach geflasht werden kann. Hat man also ein v2 Image, kann man nur noch auf v2 updaten etc. (außer natürlich mit -F).
> 
> Am Schluss ist das sicher ein Randfall, aber ich hätte trotzdem gerne die finale Variante drin.
> 
> Grüße
> 
> Adrian
>
Adrian Schmutzler Nov. 20, 2019, 5:44 p.m.
Hallo Fabian,

> Die CPE210 v3 hat im OpenWRT 18.06 überhaupt keinen Support und wir patchen das erst nachträglich drauf. 

Ja. Ich habe die beiden Patches vor einiger Zeit auch bei Gluon eingereicht.

> Im Endeffekt passt dieser Patch hier den build_patch ja nur so an, dass er so aussieht wie das, was im Endeffekt in OpenWRT 19.xy dann auch Upstream ist.

Ja, allerdings nicht ganz:
19.07 legt die Größe von kernel und rootfs in der firmware partition "automatisch" fest, während in 18.06 die beiden Partitionen einzeln angegeben werden (müssen).
Diese manuelle Festlegung der Partitionen und die entsprechenden Anpassungen im Makefile unterscheiden meinen Backport von der Upstream-Version. Dies ist nötig, da 18.06 den Treiber für das Splitting noch nicht hat. Das ist allerdings für die alte und neue Version der Patches in unserer Firmware gleich.

Grüße

Adrian
Fabian Blaese Nov. 20, 2019, 7:51 p.m.
applied.