ath79: use dynamic partitioning for TP-Link CPE series
[openwrt/openwrt.git] / tools / firmware-utils / src / tplink-safeloader.c
index deba84c6d1c143f07ff4a27682131c9ee2a4dc0a..70e21f99cbe2dfa9805d522a2de73a04ce0e39fb 100644 (file)
@@ -154,8 +154,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -277,8 +276,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -356,8 +354,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -398,8 +395,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -443,8 +439,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -483,8 +478,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -523,8 +517,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -555,8 +548,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -587,8 +579,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -620,8 +611,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -653,8 +643,7 @@ static struct device_info boards[] = {
                        {"default-mac", 0x30000, 0x00020},
                        {"product-info", 0x31100, 0x00100},
                        {"signature", 0x32000, 0x00400},
-                       {"os-image", 0x40000, 0x300000},
-                       {"file-system", 0x340000, 0x470000},
+                       {"firmware", 0x40000, 0x770000},
                        {"soft-version", 0x7b0000, 0x00100},
                        {"support-list", 0x7b1000, 0x00400},
                        {"user-config", 0x7c0000, 0x10000},
@@ -668,6 +657,50 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "support-list",
        },
 
+       /** Firmware layout for the AD7200 */
+       {
+               .id = "AD7200",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\r\n"
+                       "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
+               .part_trail = 0x00,
+               .soft_ver = NULL,
+
+               .partitions = {
+                       {"SBL1", 0x00000, 0x20000},
+                       {"MIBIB", 0x20000, 0x20000},
+                       {"SBL2", 0x40000, 0x20000},
+                       {"SBL3", 0x60000, 0x30000},
+                       {"DDRCONFIG", 0x90000, 0x10000},
+                       {"SSD", 0xa0000, 0x10000},
+                       {"TZ", 0xb0000, 0x30000},
+                       {"RPM", 0xe0000, 0x20000},
+                       {"fs-uboot", 0x100000, 0x70000},
+                       {"uboot-env", 0x170000, 0x40000},
+                       {"radio", 0x1b0000, 0x40000},
+                       {"os-image", 0x1f0000, 0x400000},
+                       {"file-system", 0x5f0000, 0x1900000},
+                       {"default-mac", 0x1ef0000, 0x00200},
+                       {"pin", 0x1ef0200, 0x00200},
+                       {"device-id", 0x1ef0400, 0x00200},
+                       {"product-info", 0x1ef0600, 0x0fa00},
+                       {"partition-table", 0x1f00000, 0x10000},
+                       {"soft-version", 0x1f10000, 0x10000},
+                       {"support-list", 0x1f20000, 0x10000},
+                       {"profile", 0x1f30000, 0x10000},
+                       {"default-config", 0x1f40000, 0x10000},
+                       {"user-config", 0x1f50000, 0x40000},
+                       {"qos-db", 0x1f90000, 0x40000},
+                       {"usb-config", 0x1fd0000, 0x10000},
+                       {"log", 0x1fe0000, 0x20000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
        /** Firmware layout for the C2600 */
        {
                .id     = "C2600",
@@ -725,7 +758,8 @@ static struct device_info boards[] = {
                        "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
                        "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
                        "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
-                       "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n",
+                       "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
+                       "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
                .part_trail = 0x00,
                .soft_ver = "soft_ver:1.0.0\n",
 
@@ -1014,7 +1048,78 @@ static struct device_info boards[] = {
                .first_sysupgrade_partition = "os-image",
                .last_sysupgrade_partition = "file-system",
        },
+       /** Firmware layout for the Archer A6 v3  */
+       {
+               .id     = "ARCHER-A6-V3",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+                       "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
+                       "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n",
+               .part_trail = 0x00,
+               .soft_ver = "soft_ver:1.0.5\n",
 
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x40000},
+                       {"firmware", 0x40000, 0xf60000},
+                       {"default-mac", 0xfa0000, 0x00200},
+                       {"pin", 0xfa0200, 0x00100},
+                       {"device-id", 0xfa0300, 0x00100},
+                       {"product-info", 0xfa0400, 0x0fc00},
+                       {"default-config", 0xfb0000, 0x08000},
+                       {"ap-def-config", 0xfb8000, 0x08000},
+                       {"user-config", 0xfc0000, 0x0a000},
+                       {"ag-config", 0xfca000, 0x04000},
+                       {"certificate", 0xfce000, 0x02000},
+                       {"ap-config", 0xfd0000, 0x06000},
+                       {"router-config", 0xfd6000, 0x06000},
+                       {"favicon", 0xfdc000, 0x02000},
+                       {"logo", 0xfde000, 0x02000},
+                       {"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 Archer C6U v1 */
+       {
+               .id     = "ARCHER-C6U-V1",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+                       "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
+               .part_trail = 0x00,
+               .soft_ver = "soft_ver:1.0.2\n",
+
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x40000},
+                       {"firmware", 0x40000, 0xf60000},
+                       {"default-mac", 0xfa0000, 0x00200},
+                       {"pin", 0xfa0200, 0x00100},
+                       {"device-id", 0xfa0300, 0x00100},
+                       {"product-info", 0xfa0400, 0x0fc00},
+                       {"default-config", 0xfb0000, 0x08000},
+                       {"ap-def-config", 0xfb8000, 0x08000},
+                       {"user-config", 0xfc0000, 0x0c000},
+                       {"certificate", 0xfcc000, 0x04000},
+                       {"ap-config", 0xfd0000, 0x08000},
+                       {"router-config", 0xfd8000, 0x08000},
+                       {"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 C60v1 */
        {
                .id     = "ARCHER-C60-V1",
@@ -1217,7 +1322,7 @@ static struct device_info boards[] = {
                        "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
 
                .part_trail = 0x00,
-               .soft_ver = "soft_ver:1.0.0\n",
+               .soft_ver = "soft_ver:7.0.0\n",
 
                /* We're using a dynamic kernel/rootfs split here */
                .partitions = {
@@ -1402,6 +1507,35 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "file-system"
        },
 
+       /** Firmware layout for the EAP235-Wall v1 */
+       {
+               .id     = "EAP235-WALL-V1",
+               .support_list =
+                       "SupportList:\r\n"
+                       "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
+               .part_trail = PART_TRAIL_NONE,
+               .soft_ver = NULL,
+               .soft_ver_compat_level = 1,
+
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x80000},
+                       {"partition-table", 0x80000, 0x02000},
+                       {"default-mac", 0x90000, 0x01000},
+                       {"support-list", 0x91000, 0x00100},
+                       {"product-info", 0x91100, 0x00400},
+                       {"soft-version", 0x92000, 0x00100},
+                       {"firmware", 0xa0000, 0xd20000},
+                       {"user-config", 0xdc0000, 0x30000},
+                       {"mutil-log", 0xf30000, 0x80000},
+                       {"oops", 0xfb0000, 0x40000},
+                       {"radio", 0xff0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
        /** Firmware layout for the EAP245 v1 */
        {
                .id     = "EAP245-V1",
@@ -2750,7 +2884,8 @@ static void build_image(const char *output,
        parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, file_system_partition);
 
        /* Some devices need the extra-para partition to accept the firmware */
-       if (strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
+       if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||
+           strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
            strcasecmp(info->id, "ARCHER-C2-V3") == 0 ||
            strcasecmp(info->id, "ARCHER-C7-V4") == 0 ||
            strcasecmp(info->id, "ARCHER-C7-V5") == 0 ||
@@ -2758,6 +2893,7 @@ static void build_image(const char *output,
            strcasecmp(info->id, "ARCHER-C59-V2") == 0 ||
            strcasecmp(info->id, "ARCHER-C60-V2") == 0 ||
            strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
+           strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
            strcasecmp(info->id, "TLWR1043NV5") == 0) {
                const uint8_t extra_para[2] = {0x01, 0x00};
                parts[5] = make_extra_para(info, extra_para,