[PATCH] TP-Link CPE210 v3: Fix tplink-safeloader

Adrian Schmutzler mail at adrianschmutzler.de
Di Nov 19 18:38:18 CET 2019


Diesen uralten Patch sollten wir auch noch mit reinnehmen, damit unser Support der CPE210 mit dem in openwrt-19.07 (ar71xx) kompatibel ist. Sonst fliegt uns das später um die Ohren, wenn einer die CPE210v3 mit der v2 geflasht hat oder umgekehrt. Und die ist ja mit nicht kaputtem Support schon nicht so lustig.

Ich hätte hier gerne 1-2 Acked-by, dann rebase und applie ich das. (bzw. backporte den aktuellen Support-Stand aus 19.07).

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf Of
> Adrian Schmutzler
> Sent: Mittwoch, 27. März 2019 22:15
> To: franken-dev at freifunk.net
> Subject: [PATCH] TP-Link CPE210 v3: Fix tplink-safeloader
> 
> 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 at adrianschmutzler.de>
> Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  ...are-utils-tplink-safeloader-Add-CPE210-v3.patch | 59
> +++++++++++++++-------
>  ...-ar71xx-Add-support-for-TP-Link-CPE210-v3.patch | 29 +++++++----
>  2 files changed, 59 insertions(+), 29 deletions(-)
> 
> diff --git
> a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v
> 3.patch
> b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v
> 3.patch
> index 941b7d73..294c13de 100644
> ---
> a/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v
> 3.patch
> +++
> b/build_patches/openwrt/0011-firmware-utils-tplink-safeloader-Add-CPE210-v
> 3.patch
> @@ -7,36 +7,59 @@ Add TP-Link CPE210 v3 to the support list.
>  It's identical to the v2.
> 
>  Signed-off-by: Robert Marko <robimarko at gmail.com>
> +[Use separate definition to prevent cross-updates]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>  ---
> - tools/firmware-utils/src/tplink-safeloader.c | 8 ++++++--
> - 1 file changed, 6 insertions(+), 2 deletions(-)
> + tools/firmware-utils/src/tplink-safeloader.c | 36
> ++++++++++++++++++++++++++++
> + 1 file changed, 36 insertions(+)
> 
>  diff --git a/tools/firmware-utils/src/tplink-safeloader.c
> b/tools/firmware-utils/src/tplink-safeloader.c
> -index 4b227e1c97..01885683c3 100644
> +index 4b227e1c97..de15faf679 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,
> -
> ++		.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",
>  --
>  2.11.0
> 
> diff --git
> a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patc
> h
> b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patc
> h
> index 7d6af911..42bc3abd 100644
> ---
> a/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patc
> h
> +++
> b/build_patches/openwrt/0012-ar71xx-Add-support-for-TP-Link-CPE210-v3.patc
> h
> @@ -24,15 +24,17 @@ Stock TFTP server IP:192.168.0.100
>  Stock device TFTP address:192.168.0.254
> 
>  Signed-off-by: Robert Marko <robimarko at gmail.com>
> +[Adjusted device definition for dynamic partitioning]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>  ---
> - 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(-)
> + 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            | 12
> ++++++++++++
> + 7 files changed, 26 insertions(+), 2 deletions(-)
> 
>  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
> @@ -124,17 +126,22 @@ 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 338b2db2d6..387909ee00 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
>  +
> --
> 2.11.0
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : openpgp-digital-signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 834 bytes
Beschreibung: nicht verfügbar
URL         : <https://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20191119/3f9c475d/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev