[PATCH v2] tplink-safeloader: Add support for Deco M4R V4

Mark Ceeha hi at shiz.me
Sun Jan 29 06:28:42 PST 2023


Software version:
  soft_ver:1.0.0 Build 20211202 Rel. 69482

Partition table:
  00000000 00040000 fs-uboot
  00040000 00400000 os-image
  00440000 00b60000 file-system
  00fa0000 00000300 default-mac
  00fa0300 00000100 device-id
  00fa0400 0000fc00 product-info
  00fb0000 00004000 group-info
  00fb4000 0000c000 user-config
  00fc0000 00010000 device-config
  00fd0000 00010000 default-config
  00fe0000 00000800 partition-table
  00fe0800 00000100 soft-version
  00fe0900 00000200 support-list
  00fe0b00 00003000 profile
  00fe3b00 00000100 extra-para
  00ff0000 00010000 radio

`os-image` and `file-system` have been merged into `firmware`.

Signed-off-by: Mark Ceeha <hi at shiz.me>
---
v2:
- Change `soft_ver` to 1.0.0; while the TP-Link stock firmware cares
  about the version and if it's not older than the current `soft_ver`,
  it will not allow you to flash OpenWrt anyway as the image is not signed.
  U-Boot accepts unsigned images, and does not care about the `soft_ver`,
  so we'll just make it consistent with the initial firmware release
  this partition table was checked against.
- Fix style issues pointed out by Sander.
---
 src/tplink-safeloader.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
index ddb5dff..d9e1605 100644
--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -1612,6 +1612,42 @@ static struct device_info boards[] = {
 		.last_sysupgrade_partition = "file-system",
 	},
 
+	/** Firmware layout for the Deco M4R v4 */
+	{
+		.id     = "DECO-M4R-V4",
+		.vendor = "",
+		.support_list =
+			"SupportList:\n"
+			"{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
+			"{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
+			"{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
+			"{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
+			"{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
+		.part_trail = 0x00,
+		.soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
+
+		.partitions = {
+			{"fs-uboot", 0x00000, 0x40000},
+			{"firmware", 0x40000, 0xf60000},
+			{"default-mac", 0xfa0000, 0x00300},
+			{"device-id", 0xfa0300, 0x00100},
+			{"product-info", 0xfa0400, 0x0fc00},
+			{"group-info", 0xfb0000, 0x04000},
+			{"user-config", 0xfb4000, 0x0c000},
+			{"device-config", 0xfc0000, 0x10000},
+			{"default-config", 0xfd0000, 0x10000},
+			{"partition-table", 0xfe0000, 0x00800},
+			{"soft-version", 0xfe0800, 0x00100},
+			{"support-list", 0xfe0900, 0x00200},
+			{"profile", 0xfe0b00, 0x03000},
+			{"extra-para", 0xfe3b00, 0x00100},
+			{"radio", 0xff0000, 0x10000},
+			{NULL, 0, 0}
+		},
+		.first_sysupgrade_partition = "os-image",
+		.last_sysupgrade_partition = "file-system",
+	},
+
 	/** Firmware layout for the Deco S4 v2 */
 	{
 		.id     = "DECO-S4-V2",
@@ -3525,6 +3561,7 @@ static void build_image(const char *output,
 	    strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
 	    strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
 	    strcasecmp(info->id, "ARCHER-C6-V3") == 0 ||
+	    strcasecmp(info->id, "DECO-M4R-V4") == 0 ||
 	    strcasecmp(info->id, "MR70X") == 0 ||
 	    strcasecmp(info->id, "TLWR1043NV5") == 0) {
 		const uint8_t extra_para[2] = {0x01, 0x00};
-- 
2.39.0




More information about the openwrt-devel mailing list