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

Sander Vanheule sander at svanheule.net
Sun Apr 24 04:42:47 PDT 2022


Hi,

On Fri, 2022-04-22 at 01:09 +0300, Foica David wrote:
> 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",

DECO-M4R is too generic in my opinion. Given that this is for v1/v2, and v3/v4 will use a
different ID. You could this to DECO-M4R-V1 to match the first supported version.

> +               .vendor = "",
> +               .support_list =
> +                       "SupportList:\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
> +                       "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
> +                       "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\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 */

These comments aren't really needed, you can drop them. You already included the original
layout in the commit message, which is sufficient. There's also no unused space, so the
used offset and size are self-explanatory.

Best,
Sander

> +                       {"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",




More information about the openwrt-devel mailing list