ramips: add support for TP-Link RE305 v1
[project/firmware-utils.git] / src / tplink-safeloader.c
index c09ea347b2ac6259a86278cfbb4d149278c3e10b..3b17eba0b173f0987c366803fe10852add86e7d0 100644 (file)
@@ -120,8 +120,8 @@ static const uint8_t md5_salt[16] = {
 static struct device_info boards[] = {
        /** Firmware layout for the CPE210/220 V1 */
        {
-               .id     = "CPE210",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "CPE210",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
@@ -233,8 +233,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the CPE220 V2 */
        {
-               .id     = "CPE220V2",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "CPE220V2",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
@@ -314,8 +314,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the CPE510/520 V1 */
        {
-               .id     = "CPE510",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "CPE510",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
@@ -475,8 +475,8 @@ static struct device_info boards[] = {
        },
 
        {
-               .id     = "WBS210",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "WBS210",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
@@ -507,8 +507,8 @@ static struct device_info boards[] = {
        },
 
        {
-               .id     = "WBS210V2",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "WBS210V2",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
@@ -539,8 +539,8 @@ static struct device_info boards[] = {
        },
 
        {
-               .id     = "WBS510",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "WBS510",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
@@ -572,8 +572,8 @@ static struct device_info boards[] = {
        },
 
        {
-               .id     = "WBS510V2",
-               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+               .id     = "WBS510V2",
+               .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
                .support_list =
                        "SupportList:\r\n"
                        "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
@@ -606,7 +606,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C2600 */
        {
-               .id = "C2600",
+               .id     = "C2600",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -654,7 +654,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the A7-V5 */
        {
-               .id = "ARCHER-A7-V5",
+               .id     = "ARCHER-A7-V5",
                .support_list =
                        "SupportList:\n"
                        "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
@@ -694,7 +694,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C2v3 */
        {
-               .id = "ARCHER-C2-V3",
+               .id     = "ARCHER-C2-V3",
                .support_list =
                        "SupportList:\n"
                        "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
@@ -732,7 +732,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C25v1 */
        {
-               .id = "ARCHER-C25-V1",
+               .id     = "ARCHER-C25-V1",
                .support_list =
                        "SupportList:\n"
                        "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
@@ -770,8 +770,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C58v1 */
        {
-               .id     = "ARCHER-C58-V1",
-               .vendor = "",
+               .id     = "ARCHER-C58-V1",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
@@ -804,8 +804,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C59v1 */
        {
-               .id     = "ARCHER-C59-V1",
-               .vendor = "",
+               .id     = "ARCHER-C59-V1",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
@@ -843,8 +843,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C59v2 */
        {
-               .id     = "ARCHER-C59-V2",
-               .vendor = "",
+               .id     = "ARCHER-C59-V2",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
@@ -883,8 +883,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
        {
-               .id     = "ARCHER-C6-V2",
-               .vendor = "",
+               .id     = "ARCHER-C6-V2",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
@@ -953,8 +953,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C60v1 */
        {
-               .id     = "ARCHER-C60-V1",
-               .vendor = "",
+               .id     = "ARCHER-C60-V1",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
@@ -987,8 +987,8 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C60v2 */
        {
-               .id     = "ARCHER-C60-V2",
-               .vendor = "",
+               .id     = "ARCHER-C60-V2",
+               .vendor = "",
                .support_list =
                        "SupportList:\r\n"
                        "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
@@ -1023,7 +1023,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C5 */
        {
-               .id = "ARCHER-C5-V2",
+               .id     = "ARCHER-C5-V2",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -1058,7 +1058,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C7 */
        {
-               .id = "ARCHER-C7-V4",
+               .id     = "ARCHER-C7-V4",
                .support_list =
                        "SupportList:\n"
                        "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
@@ -1104,7 +1104,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C7 v5*/
        {
-               .id = "ARCHER-C7-V5",
+               .id     = "ARCHER-C7-V5",
                .support_list =
                        "SupportList:\n"
                        "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
@@ -1152,7 +1152,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the C9 */
        {
-               .id = "ARCHERC9",
+               .id     = "ARCHERC9",
                .vendor = "",
                .support_list =
                        "SupportList:\n"
@@ -1437,9 +1437,45 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "file-system",
        },
 
+  /** Firmware layout for the RE305 v1 */
+       {
+               .id     = "RE305-V1",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
+                       "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
+               .support_trail = '\x00',
+               .soft_ver = NULL,
+
+               .partitions = {
+                       {"fs-uboot", 0x00000, 0x20000},
+                       {"firmware", 0x20000, 0x5e0000},
+                       {"partition-table", 0x600000, 0x02000},
+                       {"default-mac", 0x610000, 0x00020},
+                       {"pin", 0x610100, 0x00020},
+                       {"product-info", 0x611100, 0x01000},
+                       {"soft-version", 0x620000, 0x01000},
+                       {"support-list", 0x621000, 0x01000},
+                       {"profile", 0x622000, 0x08000},
+                       {"user-config", 0x630000, 0x10000},
+                       {"default-config", 0x640000, 0x10000},
+                       {"radio", 0x7f0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
        /** Firmware layout for the RE350 v1 */
        {
-               .id = "RE350-V1",
+               .id     = "RE350-V1",
                .vendor = "",
                .support_list =
                        "SupportList:\n"
@@ -1476,7 +1512,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the RE350K v1 */
        {
-               .id = "RE350K-V1",
+               .id     = "RE350K-V1",
                .vendor = "",
                .support_list =
                        "SupportList:\n"
@@ -1508,7 +1544,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the RE355 */
        {
-               .id = "RE355",
+               .id     = "RE355",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -1546,7 +1582,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the RE450 */
        {
-               .id = "RE450",
+               .id     = "RE450",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -1584,7 +1620,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the RE450 v2 */
        {
-               .id = "RE450-V2",
+               .id     = "RE450-V2",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -1624,7 +1660,7 @@ static struct device_info boards[] = {
 
        /** Firmware layout for the RE650 */
        {
-               .id = "RE650-V1",
+               .id     = "RE650-V1",
                .vendor = "",
                .support_list =
                        "SupportList:\r\n"
@@ -1698,13 +1734,13 @@ static void set_source_date_epoch() {
        char *env = getenv("SOURCE_DATE_EPOCH");
        char *endptr = env;
        errno = 0;
-        if (env && *env) {
+       if (env && *env) {
                source_date_epoch = strtoull(env, &endptr, 10);
                if (errno || (endptr && *endptr != '\0')) {
                        fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
                        exit(1);
                }
-        }
+       }
 }
 
 /** Generates the partition-table partition */