[PATCH] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

Ole Kristian Lona ole.kristian at lona.name
Fri Apr 22 00:57:42 PDT 2022


I tried sending a patch yesterday for Deco M4R v3 and Deco M5. I am very new
to this "send patches to mailing-list" procedure. Did my patch ever reach
this list? (I got a message back regarding DMARC, and using original From:
Header, and it was hard to determine from the message whether it would
actually get delivered.)  Seems it would "fit" very nicely with this one, as
that would get at least most Deco M4Rs covered by tplink-safeloader. I will
try to find firmware from M4R v4, to verify whether it uses the same
partition scheme as v3.


Ole Kristian

-----Original Message-----
From: openwrt-devel <openwrt-devel-bounces at lists.openwrt.org> On Behalf Of
Foica David
Sent: fredag 22. april 2022 00:10
To: openwrt-devel at lists.openwrt.org
Cc: Foica David <superh552 at gmail.com>
Subject: [PATCH] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

Support creating images for TP-Link Deco M4R v1 and v2.

Original partition layout from OEM image:
 partition fs-uboot base 0x00000 size 0x80000  partition os-image base
0x80000 size 0x200000  partition file-system base 0x280000 size 0xc00000
partition product-info base 0xe80000 size 0x05000  partition default-mac
base 0xe85000 size 0x01000  partition device-id base 0xe86000 size 0x01000
partition support-list base 0xe87000 size 0x10000  partition user-config
base 0xea7000 size 0x10000  partition device-config base 0xeb7000 size
0x10000  partition group-info base 0xec7000 size 0x10000  partition
partition-table base 0xed7000 size 0x02000  partition soft-version base
0xed9000 size 0x10000  partition profile base 0xee9000 size 0x10000
partition default-config base 0xef9000 size 0x10000  partition url-sig base
0xfe0000 size 0x10000  partition radio base 0xff0000 size 0x10000

The 'os-image' and 'file-system' partitions were merged into 'firmware'
to make use of the automatic mtd split.

The first 2 versions of the device use the same firmware image,
v3 and v4 are different.

Signed-off-by: Foica David <superh552 at gmail.com>
 src/tplink-safeloader.c | 49 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index
c4727df..604cce8 100644
--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -1779,6 +1779,55 @@ static struct device_info boards[] = {
 		.last_sysupgrade_partition = "file-system"
+	/** Firmware layout for the Deco M4R v1 and v2 */
+	{
+		.id     = "DECO-M4R",
+		.vendor = "",
+		.support_list =
+			"SupportList:\n"
+		.part_trail = 0x00,
+		.soft_ver = SOFT_VER_DEFAULT,
+		/* We're using a dynamic kernel/rootfs split here */
+		.partitions = {
+			{"fs-uboot", 0x00000, 0x80000},
+			{"firmware", 0x80000, 0xe00000},	/** Stock:
name os-image base 0x80000 size 0x200000 */
+								/** Stock:
name file-system base 0x280000 size 0xc00000 */
+			{"product-info", 0xe80000, 0x05000},
+			{"default-mac", 0xe85000, 0x01000},
+			{"device-id", 0xe86000, 0x01000},
+			{"support-list", 0xe87000, 0x10000},
+			{"user-config", 0xea7000, 0x10000},
+			{"device-config", 0xeb7000, 0x10000},
+			{"group-info", 0xec7000, 0x10000},
+			{"partition-table", 0xed7000, 0x02000},
+			{"soft-version", 0xed9000, 0x10000},
+			{"profile", 0xee9000, 0x10000},
+			{"default-config", 0xef9000, 0x10000},
+			{"url-sig", 0xfe0000, 0x10000},
+			{"radio", 0xff0000, 0x10000},
+			{NULL, 0, 0}
+		},
+		.first_sysupgrade_partition = "os-image",
+		.last_sysupgrade_partition = "file-system",
+	},
 	/** Firmware layout for the TL-WA1201 v2 */
 		.id     = "TL-WA1201-V2",

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list