f39e7fe15f2a18815c632c9c13f6dc44af9ff0f4
[project/firmware-utils.git] / src / tplink-safeloader.c
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
4 All rights reserved.
5 */
6
7
8 /*
9 tplink-safeloader
10
11 Image generation tool for the TP-LINK SafeLoader as seen on
12 TP-LINK Pharos devices (CPE210/220/510/520)
13 */
14
15
16 #include <assert.h>
17 #include <ctype.h>
18 #include <errno.h>
19 #include <stdbool.h>
20 #include <stddef.h>
21 #include <stdio.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <time.h>
26 #include <unistd.h>
27
28 #include <arpa/inet.h>
29
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <limits.h>
33
34 #include "md5.h"
35
36
37 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
38
39
40 #define MAX_PARTITIONS 32
41
42 /** An image partition table entry */
43 struct image_partition_entry {
44 const char *name;
45 size_t size;
46 uint8_t *data;
47 };
48
49 /** A flash partition table entry */
50 struct flash_partition_entry {
51 const char *name;
52 uint32_t base;
53 uint32_t size;
54 };
55
56 /** Flash partition names table entry */
57 struct factory_partition_names {
58 const char *partition_table;
59 const char *soft_ver;
60 const char *os_image;
61 const char *support_list;
62 const char *file_system;
63 const char *extra_para;
64 };
65
66 /** Partition trailing padding definitions
67 * Values 0x00 to 0xff are reserved to indicate the padding value
68 * Values from 0x100 are reserved to indicate other behaviour */
69 enum partition_trail_value {
70 PART_TRAIL_00 = 0x00,
71 PART_TRAIL_FF = 0xff,
72 PART_TRAIL_MAX = 0xff,
73 PART_TRAIL_NONE = 0x100
74 };
75
76 /** soft-version value overwrite types
77 * The default (for an uninitialised soft_ver field) is to use the numerical
78 * version number "0.0.0"
79 */
80 enum soft_ver_type {
81 SOFT_VER_TYPE_NUMERIC = 0,
82 SOFT_VER_TYPE_TEXT = 1,
83 };
84
85 /** Firmware layout description */
86 struct device_info {
87 const char *id;
88 const char *vendor;
89 const char *support_list;
90 enum partition_trail_value part_trail;
91 struct {
92 enum soft_ver_type type;
93 union {
94 const char *text;
95 uint8_t num[3];
96 };
97 } soft_ver;
98 uint32_t soft_ver_compat_level;
99 struct flash_partition_entry partitions[MAX_PARTITIONS+1];
100 const char *first_sysupgrade_partition;
101 const char *last_sysupgrade_partition;
102 struct factory_partition_names partition_names;
103 };
104
105 #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t}
106 #define SOFT_VER_NUMERIC(_maj, _min, _patch) { \
107 .type = SOFT_VER_TYPE_NUMERIC, \
108 .num = {_maj, _min, _patch}}
109 #define SOFT_VER_DEFAULT SOFT_VER_NUMERIC(0, 0, 0)
110
111 struct __attribute__((__packed__)) meta_header {
112 uint32_t length;
113 uint32_t zero;
114 };
115
116 /** The content of the soft-version structure */
117 struct __attribute__((__packed__)) soft_version {
118 uint8_t pad1;
119 uint8_t version_major;
120 uint8_t version_minor;
121 uint8_t version_patch;
122 uint8_t year_hi;
123 uint8_t year_lo;
124 uint8_t month;
125 uint8_t day;
126 uint32_t rev;
127 uint32_t compat_level;
128 };
129
130 /*
131 * Safeloader image type
132 * Safeloader images contain a 0x14 byte preamble with image size (big endian
133 * UINT32) and md5 checksum (16 bytes).
134 *
135 * SAFEFLOADER_TYPE_DEFAULT
136 * Standard preamble with size including preamble length, and checksum.
137 * Header of 0x1000 bytes, contents of which are not specified.
138 * Payload starts at offset 0x1014.
139 *
140 * SAFELOADER_TYPE_VENDOR
141 * Standard preamble with size including preamble length, and checksum.
142 * Header contains up to 0x1000 bytes of vendor data, starting with a big endian
143 * UINT32 size, followed by that number of bytes containing (text) data.
144 * Padded with 0xFF. Payload starts at offset 0x1014.
145 *
146 * SAFELOADER_TYPE_CLOUD
147 * Standard preamble with size including preamble length, and checksum.
148 * Followed by the 'fw-type:Cloud' string and some (unknown) data.
149 * Payload starts at offset 0x1014.
150 *
151 * SAFELOADER_TYPE_QNEW
152 * Reversed order preamble, with (apparent) md5 checksum before the image
153 * size. The size does not include the preamble length.
154 * Header starts with 0x3C bytes, starting with the string '?NEW' (format not
155 * understood). Then another 0x1000 bytes follow, with the data payload
156 * starting at 0x1050.
157 */
158 enum safeloader_image_type {
159 SAFELOADER_TYPE_DEFAULT,
160 SAFELOADER_TYPE_VENDOR,
161 SAFELOADER_TYPE_CLOUD,
162 SAFELOADER_TYPE_QNEW,
163 };
164
165 /* Internal representation of safeloader image data */
166 struct safeloader_image_info {
167 enum safeloader_image_type type;
168 size_t payload_offset;
169 struct flash_partition_entry entries[MAX_PARTITIONS];
170 };
171
172 #define SAFELOADER_PREAMBLE_SIZE 0x14
173 #define SAFELOADER_HEADER_SIZE 0x1000
174 #define SAFELOADER_PAYLOAD_OFFSET (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_HEADER_SIZE)
175
176 #define SAFELOADER_QNEW_HEADER_SIZE 0x3C
177 #define SAFELOADER_QNEW_PAYLOAD_OFFSET \
178 (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_QNEW_HEADER_SIZE + SAFELOADER_HEADER_SIZE)
179
180 #define SAFELOADER_PAYLOAD_TABLE_SIZE 0x800
181
182 static const uint8_t jffs2_eof_mark[4] = {0xde, 0xad, 0xc0, 0xde};
183
184
185 /**
186 Salt for the MD5 hash
187
188 Fortunately, TP-LINK seems to use the same salt for most devices which use
189 the new image format.
190 */
191 static const uint8_t md5_salt[16] = {
192 0x7a, 0x2b, 0x15, 0xed,
193 0x9b, 0x98, 0x59, 0x6d,
194 0xe5, 0x04, 0xab, 0x44,
195 0xac, 0x2a, 0x9f, 0x4e,
196 };
197
198
199 /** Firmware layout table */
200 static struct device_info boards[] = {
201 /** Firmware layout for the CPE210/220 V1 */
202 {
203 .id = "CPE210",
204 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
205 .support_list =
206 "SupportList:\r\n"
207 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
208 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
209 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
210 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
211 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
212 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
213 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
214 .part_trail = 0xff,
215 .soft_ver = SOFT_VER_DEFAULT,
216
217 .partitions = {
218 {"fs-uboot", 0x00000, 0x20000},
219 {"partition-table", 0x20000, 0x02000},
220 {"default-mac", 0x30000, 0x00020},
221 {"product-info", 0x31100, 0x00100},
222 {"signature", 0x32000, 0x00400},
223 {"firmware", 0x40000, 0x770000},
224 {"soft-version", 0x7b0000, 0x00100},
225 {"support-list", 0x7b1000, 0x00400},
226 {"user-config", 0x7c0000, 0x10000},
227 {"default-config", 0x7d0000, 0x10000},
228 {"log", 0x7e0000, 0x10000},
229 {"radio", 0x7f0000, 0x10000},
230 {NULL, 0, 0}
231 },
232
233 .first_sysupgrade_partition = "os-image",
234 .last_sysupgrade_partition = "support-list",
235 },
236
237 /** Firmware layout for the CPE210 V2 */
238 {
239 .id = "CPE210V2",
240 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
241 .support_list =
242 "SupportList:\r\n"
243 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
244 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
245 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
246 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
247 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
248 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
249 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
250 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
251 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
252 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
253 .part_trail = 0xff,
254 .soft_ver = SOFT_VER_DEFAULT,
255
256 .partitions = {
257 {"fs-uboot", 0x00000, 0x20000},
258 {"partition-table", 0x20000, 0x02000},
259 {"default-mac", 0x30000, 0x00020},
260 {"product-info", 0x31100, 0x00100},
261 {"device-info", 0x31400, 0x00400},
262 {"signature", 0x32000, 0x00400},
263 {"device-id", 0x33000, 0x00100},
264 {"firmware", 0x40000, 0x770000},
265 {"soft-version", 0x7b0000, 0x00100},
266 {"support-list", 0x7b1000, 0x01000},
267 {"user-config", 0x7c0000, 0x10000},
268 {"default-config", 0x7d0000, 0x10000},
269 {"log", 0x7e0000, 0x10000},
270 {"radio", 0x7f0000, 0x10000},
271 {NULL, 0, 0}
272 },
273
274 .first_sysupgrade_partition = "os-image",
275 .last_sysupgrade_partition = "support-list",
276 },
277
278 /** Firmware layout for the CPE210 V3 */
279 {
280 .id = "CPE210V3",
281 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
282 .support_list =
283 "SupportList:\r\n"
284 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
285 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
286 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
287 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
288 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
289 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
290 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
291 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
292 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
293 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
294 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
295 .part_trail = 0xff,
296 .soft_ver = SOFT_VER_DEFAULT,
297
298 .partitions = {
299 {"fs-uboot", 0x00000, 0x20000},
300 {"partition-table", 0x20000, 0x01000},
301 {"default-mac", 0x30000, 0x00020},
302 {"product-info", 0x31100, 0x00100},
303 {"device-info", 0x31400, 0x00400},
304 {"signature", 0x32000, 0x00400},
305 {"device-id", 0x33000, 0x00100},
306 {"firmware", 0x40000, 0x770000},
307 {"soft-version", 0x7b0000, 0x00100},
308 {"support-list", 0x7b1000, 0x01000},
309 {"user-config", 0x7c0000, 0x10000},
310 {"default-config", 0x7d0000, 0x10000},
311 {"log", 0x7e0000, 0x10000},
312 {"radio", 0x7f0000, 0x10000},
313 {NULL, 0, 0}
314 },
315
316 .first_sysupgrade_partition = "os-image",
317 .last_sysupgrade_partition = "support-list",
318 },
319
320 /** Firmware layout for the CPE220 V2 */
321 {
322 .id = "CPE220V2",
323 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
324 .support_list =
325 "SupportList:\r\n"
326 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
327 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
328 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
329 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
330 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
331 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
332 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
333 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
334 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
335 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
336 .part_trail = 0xff,
337 .soft_ver = SOFT_VER_DEFAULT,
338
339 .partitions = {
340 {"fs-uboot", 0x00000, 0x20000},
341 {"partition-table", 0x20000, 0x02000},
342 {"default-mac", 0x30000, 0x00020},
343 {"product-info", 0x31100, 0x00100},
344 {"signature", 0x32000, 0x00400},
345 {"firmware", 0x40000, 0x770000},
346 {"soft-version", 0x7b0000, 0x00100},
347 {"support-list", 0x7b1000, 0x00400},
348 {"user-config", 0x7c0000, 0x10000},
349 {"default-config", 0x7d0000, 0x10000},
350 {"log", 0x7e0000, 0x10000},
351 {"radio", 0x7f0000, 0x10000},
352 {NULL, 0, 0}
353 },
354
355 .first_sysupgrade_partition = "os-image",
356 .last_sysupgrade_partition = "support-list",
357 },
358
359 /** Firmware layout for the CPE220 V3 */
360 {
361 .id = "CPE220V3",
362 .vendor = "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
363 .support_list =
364 "SupportList:\r\n"
365 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
366 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
367 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
368 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
369 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
370 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
371 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
372 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
373 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
374 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
375 .part_trail = 0xff,
376 .soft_ver = SOFT_VER_DEFAULT,
377
378 .partitions = {
379 {"fs-uboot", 0x00000, 0x20000},
380 {"partition-table", 0x20000, 0x02000},
381 {"default-mac", 0x30000, 0x00020},
382 {"product-info", 0x31100, 0x00100},
383 {"device-info", 0x31400, 0x00400},
384 {"signature", 0x32000, 0x00400},
385 {"device-id", 0x33000, 0x00100},
386 {"firmware", 0x40000, 0x770000},
387 {"soft-version", 0x7b0000, 0x00100},
388 {"support-list", 0x7b1000, 0x01000},
389 {"user-config", 0x7c0000, 0x10000},
390 {"default-config", 0x7d0000, 0x10000},
391 {"log", 0x7e0000, 0x10000},
392 {"radio", 0x7f0000, 0x10000},
393 {NULL, 0, 0}
394 },
395
396 .first_sysupgrade_partition = "os-image",
397 .last_sysupgrade_partition = "support-list",
398 },
399
400 /** Firmware layout for the CPE510/520 V1 */
401 {
402 .id = "CPE510",
403 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
404 .support_list =
405 "SupportList:\r\n"
406 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
407 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
408 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
409 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
410 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
411 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
412 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
413 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
414 .part_trail = 0xff,
415 .soft_ver = SOFT_VER_DEFAULT,
416
417 .partitions = {
418 {"fs-uboot", 0x00000, 0x20000},
419 {"partition-table", 0x20000, 0x02000},
420 {"default-mac", 0x30000, 0x00020},
421 {"product-info", 0x31100, 0x00100},
422 {"signature", 0x32000, 0x00400},
423 {"firmware", 0x40000, 0x770000},
424 {"soft-version", 0x7b0000, 0x00100},
425 {"support-list", 0x7b1000, 0x00400},
426 {"user-config", 0x7c0000, 0x10000},
427 {"default-config", 0x7d0000, 0x10000},
428 {"log", 0x7e0000, 0x10000},
429 {"radio", 0x7f0000, 0x10000},
430 {NULL, 0, 0}
431 },
432
433 .first_sysupgrade_partition = "os-image",
434 .last_sysupgrade_partition = "support-list",
435 },
436
437 /** Firmware layout for the CPE510 V2 */
438 {
439 .id = "CPE510V2",
440 .vendor = "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
441 .support_list =
442 "SupportList:\r\n"
443 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
444 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
445 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
446 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
447 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
448 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
449 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
450 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
451 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
452 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
453 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
454 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
455 .part_trail = 0xff,
456 .soft_ver = SOFT_VER_DEFAULT,
457
458 .partitions = {
459 {"fs-uboot", 0x00000, 0x20000},
460 {"partition-table", 0x20000, 0x02000},
461 {"default-mac", 0x30000, 0x00020},
462 {"product-info", 0x31100, 0x00100},
463 {"signature", 0x32000, 0x00400},
464 {"firmware", 0x40000, 0x770000},
465 {"soft-version", 0x7b0000, 0x00100},
466 {"support-list", 0x7b1000, 0x00400},
467 {"user-config", 0x7c0000, 0x10000},
468 {"default-config", 0x7d0000, 0x10000},
469 {"log", 0x7e0000, 0x10000},
470 {"radio", 0x7f0000, 0x10000},
471 {NULL, 0, 0}
472 },
473
474 .first_sysupgrade_partition = "os-image",
475 .last_sysupgrade_partition = "support-list",
476 },
477
478 /** Firmware layout for the CPE510 V3 */
479 {
480 .id = "CPE510V3",
481 .vendor = "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
482 .support_list =
483 "SupportList:\r\n"
484 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
485 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
486 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
487 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
488 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
489 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
490 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
491 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
492 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
493 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
494 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
495 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
496 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
497 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
498 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
499 .part_trail = 0xff,
500 .soft_ver = SOFT_VER_DEFAULT,
501
502 .partitions = {
503 {"fs-uboot", 0x00000, 0x20000},
504 {"partition-table", 0x20000, 0x02000},
505 {"default-mac", 0x30000, 0x00020},
506 {"product-info", 0x31100, 0x00100},
507 {"signature", 0x32000, 0x00400},
508 {"firmware", 0x40000, 0x770000},
509 {"soft-version", 0x7b0000, 0x00100},
510 {"support-list", 0x7b1000, 0x00400},
511 {"user-config", 0x7c0000, 0x10000},
512 {"default-config", 0x7d0000, 0x10000},
513 {"log", 0x7e0000, 0x10000},
514 {"radio", 0x7f0000, 0x10000},
515 {NULL, 0, 0}
516 },
517
518 .first_sysupgrade_partition = "os-image",
519 .last_sysupgrade_partition = "support-list",
520 },
521
522 /** Firmware layout for the CPE605V1 */
523 {
524 .id = "CPE605V1",
525 .vendor = "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
526 .support_list =
527 "SupportList:\r\n"
528 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
529 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
530 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
531 .part_trail = 0x00,
532 .soft_ver = SOFT_VER_DEFAULT,
533
534 .partitions = {
535 {"fs-uboot", 0x00000, 0x20000},
536 {"partition-table", 0x20000, 0x02000},
537 {"default-mac", 0x30000, 0x00020},
538 {"serial-number", 0x30100, 0x00020},
539 {"product-info", 0x31100, 0x00100},
540 {"device-info", 0x31400, 0x00400},
541 {"signature", 0x32000, 0x00400},
542 {"device-id", 0x33000, 0x00100},
543 {"firmware", 0x40000, 0x770000},
544 {"soft-version", 0x7b0000, 0x00100},
545 {"support-list", 0x7b1000, 0x01000},
546 {"user-config", 0x7c0000, 0x10000},
547 {"default-config", 0x7d0000, 0x10000},
548 {"log", 0x7e0000, 0x10000},
549 {"radio", 0x7f0000, 0x10000},
550 {NULL, 0, 0}
551 },
552
553 .first_sysupgrade_partition = "os-image",
554 .last_sysupgrade_partition = "support-list",
555 },
556
557 /** Firmware layout for the CPE610V1 */
558 {
559 .id = "CPE610V1",
560 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
561 .support_list =
562 "SupportList:\r\n"
563 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
564 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
565 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
566 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
567 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
568 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
569 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
570 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
571 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
572 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
573 .part_trail = 0xff,
574 .soft_ver = SOFT_VER_DEFAULT,
575
576 .partitions = {
577 {"fs-uboot", 0x00000, 0x20000},
578 {"partition-table", 0x20000, 0x02000},
579 {"default-mac", 0x30000, 0x00020},
580 {"product-info", 0x31100, 0x00100},
581 {"signature", 0x32000, 0x00400},
582 {"firmware", 0x40000, 0x770000},
583 {"soft-version", 0x7b0000, 0x00100},
584 {"support-list", 0x7b1000, 0x00400},
585 {"user-config", 0x7c0000, 0x10000},
586 {"default-config", 0x7d0000, 0x10000},
587 {"log", 0x7e0000, 0x10000},
588 {"radio", 0x7f0000, 0x10000},
589 {NULL, 0, 0}
590 },
591
592 .first_sysupgrade_partition = "os-image",
593 .last_sysupgrade_partition = "support-list",
594 },
595
596 /** Firmware layout for the CPE610V2 */
597 {
598 .id = "CPE610V2",
599 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
600 .support_list =
601 "SupportList:\r\n"
602 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
603 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
604 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
605 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
606 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
607 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
608 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
609 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
610 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
611 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
612 .part_trail = 0xff,
613 .soft_ver = SOFT_VER_DEFAULT,
614
615 .partitions = {
616 {"fs-uboot", 0x00000, 0x20000},
617 {"partition-table", 0x20000, 0x02000},
618 {"default-mac", 0x30000, 0x00020},
619 {"product-info", 0x31100, 0x00100},
620 {"signature", 0x32000, 0x00400},
621 {"firmware", 0x40000, 0x770000},
622 {"soft-version", 0x7b0000, 0x00100},
623 {"support-list", 0x7b1000, 0x00400},
624 {"user-config", 0x7c0000, 0x10000},
625 {"default-config", 0x7d0000, 0x10000},
626 {"log", 0x7e0000, 0x10000},
627 {"radio", 0x7f0000, 0x10000},
628 {NULL, 0, 0}
629 },
630
631 .first_sysupgrade_partition = "os-image",
632 .last_sysupgrade_partition = "support-list",
633 },
634 /** Firmware layout for the CPE710 V1 */
635 {
636 .id = "CPE710V1",
637 .vendor = "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
638 .support_list =
639 "SupportList:\r\n"
640 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
641 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
642 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
643 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
644 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
645 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
646 .part_trail = 0xff,
647 .soft_ver = SOFT_VER_DEFAULT,
648
649 .partitions = {
650 {"fs-uboot", 0x00000, 0x50000},
651 {"partition-table", 0x50000, 0x02000},
652 {"default-mac", 0x60000, 0x00020},
653 {"serial-number", 0x60100, 0x00020},
654 {"product-info", 0x61100, 0x00100},
655 {"device-info", 0x61400, 0x00400},
656 {"signature", 0x62000, 0x00400},
657 {"device-id", 0x63000, 0x00100},
658 {"firmware", 0x70000, 0xf40000},
659 {"soft-version", 0xfb0000, 0x00100},
660 {"support-list", 0xfb1000, 0x01000},
661 {"user-config", 0xfc0000, 0x10000},
662 {"default-config", 0xfd0000, 0x10000},
663 {"log", 0xfe0000, 0x10000},
664 {"radio", 0xff0000, 0x10000},
665 {NULL, 0, 0}
666 },
667
668 .first_sysupgrade_partition = "os-image",
669 .last_sysupgrade_partition = "support-list",
670 },
671
672 {
673 .id = "WBS210",
674 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
675 .support_list =
676 "SupportList:\r\n"
677 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
678 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
679 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
680 .part_trail = 0xff,
681 .soft_ver = SOFT_VER_DEFAULT,
682
683 .partitions = {
684 {"fs-uboot", 0x00000, 0x20000},
685 {"partition-table", 0x20000, 0x02000},
686 {"default-mac", 0x30000, 0x00020},
687 {"product-info", 0x31100, 0x00100},
688 {"signature", 0x32000, 0x00400},
689 {"firmware", 0x40000, 0x770000},
690 {"soft-version", 0x7b0000, 0x00100},
691 {"support-list", 0x7b1000, 0x00400},
692 {"user-config", 0x7c0000, 0x10000},
693 {"default-config", 0x7d0000, 0x10000},
694 {"log", 0x7e0000, 0x10000},
695 {"radio", 0x7f0000, 0x10000},
696 {NULL, 0, 0}
697 },
698
699 .first_sysupgrade_partition = "os-image",
700 .last_sysupgrade_partition = "support-list",
701 },
702
703 {
704 .id = "WBS210V2",
705 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
706 .support_list =
707 "SupportList:\r\n"
708 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
709 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
710 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
711 .part_trail = 0xff,
712 .soft_ver = SOFT_VER_DEFAULT,
713
714 .partitions = {
715 {"fs-uboot", 0x00000, 0x20000},
716 {"partition-table", 0x20000, 0x02000},
717 {"default-mac", 0x30000, 0x00020},
718 {"product-info", 0x31100, 0x00100},
719 {"signature", 0x32000, 0x00400},
720 {"firmware", 0x40000, 0x770000},
721 {"soft-version", 0x7b0000, 0x00100},
722 {"support-list", 0x7b1000, 0x00400},
723 {"user-config", 0x7c0000, 0x10000},
724 {"default-config", 0x7d0000, 0x10000},
725 {"log", 0x7e0000, 0x10000},
726 {"radio", 0x7f0000, 0x10000},
727 {NULL, 0, 0}
728 },
729
730 .first_sysupgrade_partition = "os-image",
731 .last_sysupgrade_partition = "support-list",
732 },
733
734 {
735 .id = "WBS510",
736 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
737 .support_list =
738 "SupportList:\r\n"
739 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
740 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
741 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
742 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
743 .part_trail = 0xff,
744 .soft_ver = SOFT_VER_DEFAULT,
745
746 .partitions = {
747 {"fs-uboot", 0x00000, 0x20000},
748 {"partition-table", 0x20000, 0x02000},
749 {"default-mac", 0x30000, 0x00020},
750 {"product-info", 0x31100, 0x00100},
751 {"signature", 0x32000, 0x00400},
752 {"firmware", 0x40000, 0x770000},
753 {"soft-version", 0x7b0000, 0x00100},
754 {"support-list", 0x7b1000, 0x00400},
755 {"user-config", 0x7c0000, 0x10000},
756 {"default-config", 0x7d0000, 0x10000},
757 {"log", 0x7e0000, 0x10000},
758 {"radio", 0x7f0000, 0x10000},
759 {NULL, 0, 0}
760 },
761
762 .first_sysupgrade_partition = "os-image",
763 .last_sysupgrade_partition = "support-list",
764 },
765
766 {
767 .id = "WBS510V2",
768 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
769 .support_list =
770 "SupportList:\r\n"
771 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
772 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
773 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
774 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
775 .part_trail = 0xff,
776 .soft_ver = SOFT_VER_DEFAULT,
777
778 .partitions = {
779 {"fs-uboot", 0x00000, 0x20000},
780 {"partition-table", 0x20000, 0x02000},
781 {"default-mac", 0x30000, 0x00020},
782 {"product-info", 0x31100, 0x00100},
783 {"signature", 0x32000, 0x00400},
784 {"firmware", 0x40000, 0x770000},
785 {"soft-version", 0x7b0000, 0x00100},
786 {"support-list", 0x7b1000, 0x00400},
787 {"user-config", 0x7c0000, 0x10000},
788 {"default-config", 0x7d0000, 0x10000},
789 {"log", 0x7e0000, 0x10000},
790 {"radio", 0x7f0000, 0x10000},
791 {NULL, 0, 0}
792 },
793
794 .first_sysupgrade_partition = "os-image",
795 .last_sysupgrade_partition = "support-list",
796 },
797
798 /** Firmware layout for the AD7200 */
799 {
800 .id = "AD7200",
801 .vendor = "",
802 .support_list =
803 "SupportList:\r\n"
804 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
805 .part_trail = 0x00,
806 .soft_ver = SOFT_VER_DEFAULT,
807
808 .partitions = {
809 {"SBL1", 0x00000, 0x20000},
810 {"MIBIB", 0x20000, 0x20000},
811 {"SBL2", 0x40000, 0x20000},
812 {"SBL3", 0x60000, 0x30000},
813 {"DDRCONFIG", 0x90000, 0x10000},
814 {"SSD", 0xa0000, 0x10000},
815 {"TZ", 0xb0000, 0x30000},
816 {"RPM", 0xe0000, 0x20000},
817 {"fs-uboot", 0x100000, 0x70000},
818 {"uboot-env", 0x170000, 0x40000},
819 {"radio", 0x1b0000, 0x40000},
820 {"os-image", 0x1f0000, 0x400000},
821 {"file-system", 0x5f0000, 0x1900000},
822 {"default-mac", 0x1ef0000, 0x00200},
823 {"pin", 0x1ef0200, 0x00200},
824 {"device-id", 0x1ef0400, 0x00200},
825 {"product-info", 0x1ef0600, 0x0fa00},
826 {"partition-table", 0x1f00000, 0x10000},
827 {"soft-version", 0x1f10000, 0x10000},
828 {"support-list", 0x1f20000, 0x10000},
829 {"profile", 0x1f30000, 0x10000},
830 {"default-config", 0x1f40000, 0x10000},
831 {"user-config", 0x1f50000, 0x40000},
832 {"qos-db", 0x1f90000, 0x40000},
833 {"usb-config", 0x1fd0000, 0x10000},
834 {"log", 0x1fe0000, 0x20000},
835 {NULL, 0, 0}
836 },
837
838 .first_sysupgrade_partition = "os-image",
839 .last_sysupgrade_partition = "file-system"
840 },
841
842 /** Firmware layout for the C2600 */
843 {
844 .id = "C2600",
845 .vendor = "",
846 .support_list =
847 "SupportList:\r\n"
848 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
849 .part_trail = 0x00,
850 .soft_ver = SOFT_VER_DEFAULT,
851
852 /**
853 We use a bigger os-image partition than the stock images (and thus
854 smaller file-system), as our kernel doesn't fit in the stock firmware's
855 2 MB os-image since kernel 4.14.
856 */
857 .partitions = {
858 {"SBL1", 0x00000, 0x20000},
859 {"MIBIB", 0x20000, 0x20000},
860 {"SBL2", 0x40000, 0x20000},
861 {"SBL3", 0x60000, 0x30000},
862 {"DDRCONFIG", 0x90000, 0x10000},
863 {"SSD", 0xa0000, 0x10000},
864 {"TZ", 0xb0000, 0x30000},
865 {"RPM", 0xe0000, 0x20000},
866 {"fs-uboot", 0x100000, 0x70000},
867 {"uboot-env", 0x170000, 0x40000},
868 {"radio", 0x1b0000, 0x40000},
869 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
870 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
871 {"default-mac", 0x1ef0000, 0x00200},
872 {"pin", 0x1ef0200, 0x00200},
873 {"product-info", 0x1ef0400, 0x0fc00},
874 {"partition-table", 0x1f00000, 0x10000},
875 {"soft-version", 0x1f10000, 0x10000},
876 {"support-list", 0x1f20000, 0x10000},
877 {"profile", 0x1f30000, 0x10000},
878 {"default-config", 0x1f40000, 0x10000},
879 {"user-config", 0x1f50000, 0x40000},
880 {"qos-db", 0x1f90000, 0x40000},
881 {"usb-config", 0x1fd0000, 0x10000},
882 {"log", 0x1fe0000, 0x20000},
883 {NULL, 0, 0}
884 },
885
886 .first_sysupgrade_partition = "os-image",
887 .last_sysupgrade_partition = "file-system"
888 },
889
890 /** Firmware layout for the A7-V5 */
891 {
892 .id = "ARCHER-A7-V5",
893 .support_list =
894 "SupportList:\n"
895 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
896 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
897 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
898 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
899 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
900 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
901 .part_trail = 0x00,
902 .soft_ver = SOFT_VER_TEXT("soft_ver:7.0.0\n"),
903
904 /* We're using a dynamic kernel/rootfs split here */
905 .partitions = {
906 {"factory-boot", 0x00000, 0x20000},
907 {"fs-uboot", 0x20000, 0x20000},
908 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
909 /* Stock: name file-system base 0x160000 size 0xda0000 */
910 {"default-mac", 0xf40000, 0x00200},
911 {"pin", 0xf40200, 0x00200},
912 {"device-id", 0xf40400, 0x00100},
913 {"product-info", 0xf40500, 0x0fb00},
914 {"soft-version", 0xf50000, 0x00100},
915 {"extra-para", 0xf51000, 0x01000},
916 {"support-list", 0xf52000, 0x0a000},
917 {"profile", 0xf5c000, 0x04000},
918 {"default-config", 0xf60000, 0x10000},
919 {"user-config", 0xf70000, 0x40000},
920 {"certificate", 0xfb0000, 0x10000},
921 {"partition-table", 0xfc0000, 0x10000},
922 {"log", 0xfd0000, 0x20000},
923 {"radio", 0xff0000, 0x10000},
924 {NULL, 0, 0}
925 },
926
927 .first_sysupgrade_partition = "os-image",
928 .last_sysupgrade_partition = "file-system",
929 },
930
931 /** Firmware layout for the Archer A9 v6 */
932 {
933 .id = "ARCHER-A9-V6",
934 .support_list =
935 "SupportList:\n"
936 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
937 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
938 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
939 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
940 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
941 .part_trail = 0x00,
942 .soft_ver = SOFT_VER_TEXT("soft_ver:1.1.0\n"),
943
944 /* We're using a dynamic kernel/rootfs split here */
945 .partitions = {
946 {"factory-boot", 0x00000, 0x20000},
947 {"fs-uboot", 0x20000, 0x20000},
948 {"partition-table", 0x40000, 0x10000},
949 {"radio", 0x50000, 0x10000},
950 {"default-mac", 0x60000, 0x00200},
951 {"pin", 0x60200, 0x00200},
952 {"device-id", 0x60400, 0x00100},
953 {"product-info", 0x60500, 0x0fb00},
954 {"soft-version", 0x70000, 0x01000},
955 {"extra-para", 0x71000, 0x01000},
956 {"support-list", 0x72000, 0x0a000},
957 {"profile", 0x7c000, 0x04000},
958 {"user-config", 0x80000, 0x10000},
959 {"ap-config", 0x90000, 0x10000},
960 {"apdef-config", 0xa0000, 0x10000},
961 {"router-config", 0xb0000, 0x10000},
962 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
963 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
964 {"log", 0xfc0000, 0x20000},
965 {"certificate", 0xfe0000, 0x10000},
966 {"default-config", 0xff0000, 0x10000},
967 {NULL, 0, 0}
968 },
969
970 .first_sysupgrade_partition = "os-image",
971 .last_sysupgrade_partition = "file-system",
972 },
973
974 /** Firmware layout for the C2v3 */
975 {
976 .id = "ARCHER-C2-V3",
977 .support_list =
978 "SupportList:\n"
979 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
980 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
981 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
982 .part_trail = 0x00,
983 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.1\n"),
984
985 /** We're using a dynamic kernel/rootfs split here */
986
987 .partitions = {
988 {"factory-boot", 0x00000, 0x20000},
989 {"fs-uboot", 0x20000, 0x10000},
990 {"firmware", 0x30000, 0x7a0000},
991 {"user-config", 0x7d0000, 0x04000},
992 {"default-mac", 0x7e0000, 0x00100},
993 {"device-id", 0x7e0100, 0x00100},
994 {"extra-para", 0x7e0200, 0x00100},
995 {"pin", 0x7e0300, 0x00100},
996 {"support-list", 0x7e0400, 0x00400},
997 {"soft-version", 0x7e0800, 0x00400},
998 {"product-info", 0x7e0c00, 0x01400},
999 {"partition-table", 0x7e2000, 0x01000},
1000 {"profile", 0x7e3000, 0x01000},
1001 {"default-config", 0x7e4000, 0x04000},
1002 {"merge-config", 0x7ec000, 0x02000},
1003 {"qos-db", 0x7ee000, 0x02000},
1004 {"radio", 0x7f0000, 0x10000},
1005 {NULL, 0, 0}
1006 },
1007
1008 .first_sysupgrade_partition = "os-image",
1009 .last_sysupgrade_partition = "file-system",
1010 },
1011
1012 /** Firmware layout for the C25v1 */
1013 {
1014 .id = "ARCHER-C25-V1",
1015 .support_list =
1016 "SupportList:\n"
1017 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1018 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1019 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1020 .part_trail = 0x00,
1021 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1022
1023 /* We're using a dynamic kernel/rootfs split here */
1024 .partitions = {
1025 {"factory-boot", 0x00000, 0x20000},
1026 {"fs-uboot", 0x20000, 0x10000},
1027 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1028 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1029 {"user-config", 0x7d0000, 0x04000},
1030 {"default-mac", 0x7e0000, 0x00100},
1031 {"device-id", 0x7e0100, 0x00100},
1032 {"extra-para", 0x7e0200, 0x00100},
1033 {"pin", 0x7e0300, 0x00100},
1034 {"support-list", 0x7e0400, 0x00400},
1035 {"soft-version", 0x7e0800, 0x00400},
1036 {"product-info", 0x7e0c00, 0x01400},
1037 {"partition-table", 0x7e2000, 0x01000},
1038 {"profile", 0x7e3000, 0x01000},
1039 {"default-config", 0x7e4000, 0x04000},
1040 {"merge-config", 0x7ec000, 0x02000},
1041 {"qos-db", 0x7ee000, 0x02000},
1042 {"radio", 0x7f0000, 0x10000},
1043 {NULL, 0, 0}
1044 },
1045
1046 .first_sysupgrade_partition = "os-image",
1047 .last_sysupgrade_partition = "file-system",
1048 },
1049
1050 /** Firmware layout for the C58v1 */
1051 {
1052 .id = "ARCHER-C58-V1",
1053 .vendor = "",
1054 .support_list =
1055 "SupportList:\r\n"
1056 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1057 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1058 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1059 .part_trail = 0x00,
1060 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1061
1062 .partitions = {
1063 {"fs-uboot", 0x00000, 0x10000},
1064 {"default-mac", 0x10000, 0x00200},
1065 {"pin", 0x10200, 0x00200},
1066 {"product-info", 0x10400, 0x00100},
1067 {"partition-table", 0x10500, 0x00800},
1068 {"soft-version", 0x11300, 0x00200},
1069 {"support-list", 0x11500, 0x00100},
1070 {"device-id", 0x11600, 0x00100},
1071 {"profile", 0x11700, 0x03900},
1072 {"default-config", 0x15000, 0x04000},
1073 {"user-config", 0x19000, 0x04000},
1074 {"firmware", 0x20000, 0x7c8000},
1075 {"certyficate", 0x7e8000, 0x08000},
1076 {"radio", 0x7f0000, 0x10000},
1077 {NULL, 0, 0}
1078 },
1079
1080 .first_sysupgrade_partition = "os-image",
1081 .last_sysupgrade_partition = "file-system",
1082 },
1083
1084 /** Firmware layout for the C59v1 */
1085 {
1086 .id = "ARCHER-C59-V1",
1087 .vendor = "",
1088 .support_list =
1089 "SupportList:\r\n"
1090 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1091 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1092 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1093 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1094 .part_trail = 0x00,
1095 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1096
1097 /* We're using a dynamic kernel/rootfs split here */
1098 .partitions = {
1099 {"fs-uboot", 0x00000, 0x10000},
1100 {"default-mac", 0x10000, 0x00200},
1101 {"pin", 0x10200, 0x00200},
1102 {"device-id", 0x10400, 0x00100},
1103 {"product-info", 0x10500, 0x0fb00},
1104 {"firmware", 0x20000, 0xe30000},
1105 {"partition-table", 0xe50000, 0x10000},
1106 {"soft-version", 0xe60000, 0x10000},
1107 {"support-list", 0xe70000, 0x10000},
1108 {"profile", 0xe80000, 0x10000},
1109 {"default-config", 0xe90000, 0x10000},
1110 {"user-config", 0xea0000, 0x40000},
1111 {"usb-config", 0xee0000, 0x10000},
1112 {"certificate", 0xef0000, 0x10000},
1113 {"qos-db", 0xf00000, 0x40000},
1114 {"log", 0xfe0000, 0x10000},
1115 {"radio", 0xff0000, 0x10000},
1116 {NULL, 0, 0}
1117 },
1118
1119 .first_sysupgrade_partition = "os-image",
1120 .last_sysupgrade_partition = "file-system",
1121 },
1122
1123 /** Firmware layout for the C59v2 */
1124 {
1125 .id = "ARCHER-C59-V2",
1126 .vendor = "",
1127 .support_list =
1128 "SupportList:\r\n"
1129 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1130 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1131 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1132 .part_trail = 0x00,
1133 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1134
1135 /** We're using a dynamic kernel/rootfs split here */
1136 .partitions = {
1137 {"factory-boot", 0x00000, 0x20000},
1138 {"fs-uboot", 0x20000, 0x10000},
1139 {"default-mac", 0x30000, 0x00200},
1140 {"pin", 0x30200, 0x00200},
1141 {"device-id", 0x30400, 0x00100},
1142 {"product-info", 0x30500, 0x0fb00},
1143 {"firmware", 0x40000, 0xe10000},
1144 {"partition-table", 0xe50000, 0x10000},
1145 {"soft-version", 0xe60000, 0x10000},
1146 {"support-list", 0xe70000, 0x10000},
1147 {"profile", 0xe80000, 0x10000},
1148 {"default-config", 0xe90000, 0x10000},
1149 {"user-config", 0xea0000, 0x40000},
1150 {"usb-config", 0xee0000, 0x10000},
1151 {"certificate", 0xef0000, 0x10000},
1152 {"extra-para", 0xf00000, 0x10000},
1153 {"qos-db", 0xf10000, 0x30000},
1154 {"log", 0xfe0000, 0x10000},
1155 {"radio", 0xff0000, 0x10000},
1156 {NULL, 0, 0}
1157 },
1158
1159 .first_sysupgrade_partition = "os-image",
1160 .last_sysupgrade_partition = "file-system",
1161 },
1162
1163 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1164 {
1165 .id = "ARCHER-C6-V2",
1166 .vendor = "",
1167 .support_list =
1168 "SupportList:\r\n"
1169 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1170 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1171 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1172 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1173 .part_trail = 0x00,
1174 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1175
1176 .partitions = {
1177 {"fs-uboot", 0x00000, 0x20000},
1178 {"default-mac", 0x20000, 0x00200},
1179 {"pin", 0x20200, 0x00100},
1180 {"product-info", 0x20300, 0x00200},
1181 {"device-id", 0x20500, 0x0fb00},
1182 {"firmware", 0x30000, 0x7a9400},
1183 {"soft-version", 0x7d9400, 0x00100},
1184 {"extra-para", 0x7d9500, 0x00100},
1185 {"support-list", 0x7d9600, 0x00200},
1186 {"profile", 0x7d9800, 0x03000},
1187 {"default-config", 0x7dc800, 0x03000},
1188 {"partition-table", 0x7df800, 0x00800},
1189 {"user-config", 0x7e0000, 0x0c000},
1190 {"certificate", 0x7ec000, 0x04000},
1191 {"radio", 0x7f0000, 0x10000},
1192 {NULL, 0, 0}
1193 },
1194
1195 .first_sysupgrade_partition = "os-image",
1196 .last_sysupgrade_partition = "file-system",
1197 },
1198
1199 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1200 {
1201 .id = "ARCHER-C6-V2-US",
1202 .vendor = "",
1203 .support_list =
1204 "SupportList:\n"
1205 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1206 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1207 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1208 .part_trail = 0x00,
1209 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1210
1211 .partitions = {
1212 {"factory-boot", 0x00000, 0x20000},
1213 {"default-mac", 0x20000, 0x00200},
1214 {"pin", 0x20200, 0x00100},
1215 {"product-info", 0x20300, 0x00200},
1216 {"device-id", 0x20500, 0x0fb00},
1217 {"fs-uboot", 0x30000, 0x20000},
1218 {"firmware", 0x50000, 0xf89400},
1219 {"soft-version", 0xfd9400, 0x00100},
1220 {"extra-para", 0xfd9500, 0x00100},
1221 {"support-list", 0xfd9600, 0x00200},
1222 {"profile", 0xfd9800, 0x03000},
1223 {"default-config", 0xfdc800, 0x03000},
1224 {"partition-table", 0xfdf800, 0x00800},
1225 {"user-config", 0xfe0000, 0x0c000},
1226 {"certificate", 0xfec000, 0x04000},
1227 {"radio", 0xff0000, 0x10000},
1228 {NULL, 0, 0}
1229 },
1230 .first_sysupgrade_partition = "os-image",
1231 .last_sysupgrade_partition = "file-system",
1232 },
1233 /** Firmware layout for the Archer C6 v3 */
1234 {
1235 .id = "ARCHER-C6-V3",
1236 .vendor = "",
1237 .support_list =
1238 "SupportList:\n"
1239 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1240 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1241 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1242 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1243 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1244 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1245 .part_trail = 0x00,
1246 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1247
1248 .partitions = {
1249 {"fs-uboot", 0x00000, 0x40000},
1250 {"firmware", 0x40000, 0xf60000},
1251 {"default-mac", 0xfa0000, 0x00200},
1252 {"pin", 0xfa0200, 0x00100},
1253 {"device-id", 0xfa0300, 0x00100},
1254 {"product-info", 0xfa0400, 0x0fc00},
1255 {"default-config", 0xfb0000, 0x08000},
1256 {"ap-def-config", 0xfb8000, 0x08000},
1257 {"user-config", 0xfc0000, 0x0a000},
1258 {"ag-config", 0xfca000, 0x04000},
1259 {"certificate", 0xfce000, 0x02000},
1260 {"ap-config", 0xfd0000, 0x06000},
1261 {"router-config", 0xfd6000, 0x06000},
1262 {"favicon", 0xfdc000, 0x02000},
1263 {"logo", 0xfde000, 0x02000},
1264 {"partition-table", 0xfe0000, 0x00800},
1265 {"soft-version", 0xfe0800, 0x00100},
1266 {"support-list", 0xfe0900, 0x00200},
1267 {"profile", 0xfe0b00, 0x03000},
1268 {"extra-para", 0xfe3b00, 0x00100},
1269 {"radio", 0xff0000, 0x10000},
1270 {NULL, 0, 0}
1271 },
1272 .first_sysupgrade_partition = "os-image",
1273 .last_sysupgrade_partition = "file-system",
1274 },
1275 /** Firmware layout for the Archer A6 v3 */
1276 {
1277 .id = "ARCHER-A6-V3",
1278 .vendor = "",
1279 .support_list =
1280 "SupportList:\n"
1281 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1282 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1283 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1284 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1285 .part_trail = 0x00,
1286 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1287
1288 .partitions = {
1289 {"fs-uboot", 0x00000, 0x40000},
1290 {"firmware", 0x40000, 0xf60000},
1291 {"default-mac", 0xfa0000, 0x00200},
1292 {"pin", 0xfa0200, 0x00100},
1293 {"device-id", 0xfa0300, 0x00100},
1294 {"product-info", 0xfa0400, 0x0fc00},
1295 {"default-config", 0xfb0000, 0x08000},
1296 {"ap-def-config", 0xfb8000, 0x08000},
1297 {"user-config", 0xfc0000, 0x0a000},
1298 {"ag-config", 0xfca000, 0x04000},
1299 {"certificate", 0xfce000, 0x02000},
1300 {"ap-config", 0xfd0000, 0x06000},
1301 {"router-config", 0xfd6000, 0x06000},
1302 {"favicon", 0xfdc000, 0x02000},
1303 {"logo", 0xfde000, 0x02000},
1304 {"partition-table", 0xfe0000, 0x00800},
1305 {"soft-version", 0xfe0800, 0x00100},
1306 {"support-list", 0xfe0900, 0x00200},
1307 {"profile", 0xfe0b00, 0x03000},
1308 {"extra-para", 0xfe3b00, 0x00100},
1309 {"radio", 0xff0000, 0x10000},
1310 {NULL, 0, 0}
1311 },
1312 .first_sysupgrade_partition = "os-image",
1313 .last_sysupgrade_partition = "file-system",
1314 },
1315 /** Firmware layout for the Archer C6U v1 */
1316 {
1317 .id = "ARCHER-C6U-V1",
1318 .vendor = "",
1319 .support_list =
1320 "SupportList:\n"
1321 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1322 .part_trail = 0x00,
1323 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1324
1325 .partitions = {
1326 {"fs-uboot", 0x00000, 0x40000},
1327 {"firmware", 0x40000, 0xf60000},
1328 {"default-mac", 0xfa0000, 0x00200},
1329 {"pin", 0xfa0200, 0x00100},
1330 {"device-id", 0xfa0300, 0x00100},
1331 {"product-info", 0xfa0400, 0x0fc00},
1332 {"default-config", 0xfb0000, 0x08000},
1333 {"ap-def-config", 0xfb8000, 0x08000},
1334 {"user-config", 0xfc0000, 0x0c000},
1335 {"certificate", 0xfcc000, 0x04000},
1336 {"ap-config", 0xfd0000, 0x08000},
1337 {"router-config", 0xfd8000, 0x08000},
1338 {"partition-table", 0xfe0000, 0x00800},
1339 {"soft-version", 0xfe0800, 0x00100},
1340 {"support-list", 0xfe0900, 0x00200},
1341 {"profile", 0xfe0b00, 0x03000},
1342 {"extra-para", 0xfe3b00, 0x00100},
1343 {"radio", 0xff0000, 0x10000},
1344 {NULL, 0, 0}
1345 },
1346 .first_sysupgrade_partition = "os-image",
1347 .last_sysupgrade_partition = "file-system",
1348 },
1349 /** Firmware layout for the C60v1 */
1350 {
1351 .id = "ARCHER-C60-V1",
1352 .vendor = "",
1353 .support_list =
1354 "SupportList:\r\n"
1355 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1356 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1357 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1358 .part_trail = 0x00,
1359 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1360
1361 .partitions = {
1362 {"fs-uboot", 0x00000, 0x10000},
1363 {"default-mac", 0x10000, 0x00200},
1364 {"pin", 0x10200, 0x00200},
1365 {"product-info", 0x10400, 0x00100},
1366 {"partition-table", 0x10500, 0x00800},
1367 {"soft-version", 0x11300, 0x00200},
1368 {"support-list", 0x11500, 0x00100},
1369 {"device-id", 0x11600, 0x00100},
1370 {"profile", 0x11700, 0x03900},
1371 {"default-config", 0x15000, 0x04000},
1372 {"user-config", 0x19000, 0x04000},
1373 {"firmware", 0x20000, 0x7c8000},
1374 {"certyficate", 0x7e8000, 0x08000},
1375 {"radio", 0x7f0000, 0x10000},
1376 {NULL, 0, 0}
1377 },
1378
1379 .first_sysupgrade_partition = "os-image",
1380 .last_sysupgrade_partition = "file-system",
1381 },
1382
1383 /** Firmware layout for the C60v2 */
1384 {
1385 .id = "ARCHER-C60-V2",
1386 .vendor = "",
1387 .support_list =
1388 "SupportList:\r\n"
1389 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1390 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1391 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1392 .part_trail = 0x00,
1393 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1394
1395 .partitions = {
1396 {"factory-boot", 0x00000, 0x1fb00},
1397 {"default-mac", 0x1fb00, 0x00200},
1398 {"pin", 0x1fd00, 0x00100},
1399 {"product-info", 0x1fe00, 0x00100},
1400 {"device-id", 0x1ff00, 0x00100},
1401 {"fs-uboot", 0x20000, 0x10000},
1402 {"firmware", 0x30000, 0x7a0000},
1403 {"soft-version", 0x7d9500, 0x00100},
1404 {"support-list", 0x7d9600, 0x00100},
1405 {"extra-para", 0x7d9700, 0x00100},
1406 {"profile", 0x7d9800, 0x03000},
1407 {"default-config", 0x7dc800, 0x03000},
1408 {"partition-table", 0x7df800, 0x00800},
1409 {"user-config", 0x7e0000, 0x0c000},
1410 {"certificate", 0x7ec000, 0x04000},
1411 {"radio", 0x7f0000, 0x10000},
1412 {NULL, 0, 0}
1413 },
1414
1415 .first_sysupgrade_partition = "os-image",
1416 .last_sysupgrade_partition = "file-system",
1417 },
1418
1419 /** Firmware layout for the C60v3 */
1420 {
1421 .id = "ARCHER-C60-V3",
1422 .vendor = "",
1423 .support_list =
1424 "SupportList:\r\n"
1425 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1426 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1427 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1428 .part_trail = 0x00,
1429 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1430
1431 .partitions = {
1432 {"factory-boot", 0x00000, 0x1fb00},
1433 {"default-mac", 0x1fb00, 0x00200},
1434 {"pin", 0x1fd00, 0x00100},
1435 {"product-info", 0x1fe00, 0x00100},
1436 {"device-id", 0x1ff00, 0x00100},
1437 {"fs-uboot", 0x20000, 0x10000},
1438 {"firmware", 0x30000, 0x7a0000},
1439 {"soft-version", 0x7d9500, 0x00100},
1440 {"support-list", 0x7d9600, 0x00100},
1441 {"extra-para", 0x7d9700, 0x00100},
1442 {"profile", 0x7d9800, 0x03000},
1443 {"default-config", 0x7dc800, 0x03000},
1444 {"partition-table", 0x7df800, 0x00800},
1445 {"user-config", 0x7e0000, 0x0c000},
1446 {"certificate", 0x7ec000, 0x04000},
1447 {"radio", 0x7f0000, 0x10000},
1448 {NULL, 0, 0}
1449 },
1450
1451 .first_sysupgrade_partition = "os-image",
1452 .last_sysupgrade_partition = "file-system",
1453 },
1454
1455 /** Firmware layout for the C5 */
1456 {
1457 .id = "ARCHER-C5-V2",
1458 .vendor = "",
1459 .support_list =
1460 "SupportList:\r\n"
1461 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1462 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1463 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1464 .part_trail = 0x00,
1465 .soft_ver = SOFT_VER_DEFAULT,
1466
1467 .partitions = {
1468 {"fs-uboot", 0x00000, 0x40000},
1469 {"os-image", 0x40000, 0x200000},
1470 {"file-system", 0x240000, 0xc00000},
1471 {"default-mac", 0xe40000, 0x00200},
1472 {"pin", 0xe40200, 0x00200},
1473 {"product-info", 0xe40400, 0x00200},
1474 {"partition-table", 0xe50000, 0x10000},
1475 {"soft-version", 0xe60000, 0x00200},
1476 {"support-list", 0xe61000, 0x0f000},
1477 {"profile", 0xe70000, 0x10000},
1478 {"default-config", 0xe80000, 0x10000},
1479 {"user-config", 0xe90000, 0x50000},
1480 {"log", 0xee0000, 0x100000},
1481 {"radio_bk", 0xfe0000, 0x10000},
1482 {"radio", 0xff0000, 0x10000},
1483 {NULL, 0, 0}
1484 },
1485
1486 .first_sysupgrade_partition = "os-image",
1487 .last_sysupgrade_partition = "file-system"
1488 },
1489
1490 /** Firmware layout for the C7 */
1491 {
1492 .id = "ARCHER-C7-V4",
1493 .support_list =
1494 "SupportList:\n"
1495 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1496 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1497 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1498 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1499 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1500 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1501 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1502 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1503 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1504 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1505 .part_trail = 0x00,
1506 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1507
1508 /* We're using a dynamic kernel/rootfs split here */
1509 .partitions = {
1510 {"factory-boot", 0x00000, 0x20000},
1511 {"fs-uboot", 0x20000, 0x20000},
1512 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1513 /* Stock: name file-system base 0x160000 size 0xda0000 */
1514 {"default-mac", 0xf00000, 0x00200},
1515 {"pin", 0xf00200, 0x00200},
1516 {"device-id", 0xf00400, 0x00100},
1517 {"product-info", 0xf00500, 0x0fb00},
1518 {"soft-version", 0xf10000, 0x00100},
1519 {"extra-para", 0xf11000, 0x01000},
1520 {"support-list", 0xf12000, 0x0a000},
1521 {"profile", 0xf1c000, 0x04000},
1522 {"default-config", 0xf20000, 0x10000},
1523 {"user-config", 0xf30000, 0x40000},
1524 {"qos-db", 0xf70000, 0x40000},
1525 {"certificate", 0xfb0000, 0x10000},
1526 {"partition-table", 0xfc0000, 0x10000},
1527 {"log", 0xfd0000, 0x20000},
1528 {"radio", 0xff0000, 0x10000},
1529 {NULL, 0, 0}
1530 },
1531
1532 .first_sysupgrade_partition = "os-image",
1533 .last_sysupgrade_partition = "file-system",
1534 },
1535
1536 /** Firmware layout for the C7 v5*/
1537 {
1538 .id = "ARCHER-C7-V5",
1539 .support_list =
1540 "SupportList:\n"
1541 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1542 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1543 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1544 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1545 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1546 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1547 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1548 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1549
1550 .part_trail = 0x00,
1551 .soft_ver = SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1552
1553 /* We're using a dynamic kernel/rootfs split here */
1554 .partitions = {
1555 {"factory-boot", 0x00000, 0x20000},
1556 {"fs-uboot", 0x20000, 0x20000},
1557 {"partition-table", 0x40000, 0x10000},
1558 {"radio", 0x50000, 0x10000},
1559 {"default-mac", 0x60000, 0x00200},
1560 {"pin", 0x60200, 0x00200},
1561 {"device-id", 0x60400, 0x00100},
1562 {"product-info", 0x60500, 0x0fb00},
1563 {"soft-version", 0x70000, 0x01000},
1564 {"extra-para", 0x71000, 0x01000},
1565 {"support-list", 0x72000, 0x0a000},
1566 {"profile", 0x7c000, 0x04000},
1567 {"user-config", 0x80000, 0x40000},
1568
1569
1570 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1571 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1572
1573 {"log", 0xfc0000, 0x20000},
1574 {"certificate", 0xfe0000, 0x10000},
1575 {"default-config", 0xff0000, 0x10000},
1576 {NULL, 0, 0}
1577
1578 },
1579
1580 .first_sysupgrade_partition = "os-image",
1581 .last_sysupgrade_partition = "file-system",
1582 },
1583
1584 /** Firmware layout for the C9 */
1585 {
1586 .id = "ARCHERC9",
1587 .vendor = "",
1588 .support_list =
1589 "SupportList:\n"
1590 "{product_name:ArcherC9,"
1591 "product_ver:1.0.0,"
1592 "special_id:00000000}\n",
1593 .part_trail = 0x00,
1594 .soft_ver = SOFT_VER_DEFAULT,
1595
1596 .partitions = {
1597 {"fs-uboot", 0x00000, 0x40000},
1598 {"os-image", 0x40000, 0x200000},
1599 {"file-system", 0x240000, 0xc00000},
1600 {"default-mac", 0xe40000, 0x00200},
1601 {"pin", 0xe40200, 0x00200},
1602 {"product-info", 0xe40400, 0x00200},
1603 {"partition-table", 0xe50000, 0x10000},
1604 {"soft-version", 0xe60000, 0x00200},
1605 {"support-list", 0xe61000, 0x0f000},
1606 {"profile", 0xe70000, 0x10000},
1607 {"default-config", 0xe80000, 0x10000},
1608 {"user-config", 0xe90000, 0x50000},
1609 {"log", 0xee0000, 0x100000},
1610 {"radio_bk", 0xfe0000, 0x10000},
1611 {"radio", 0xff0000, 0x10000},
1612 {NULL, 0, 0}
1613 },
1614
1615 .first_sysupgrade_partition = "os-image",
1616 .last_sysupgrade_partition = "file-system"
1617 },
1618
1619 /** Firmware layout for the Deco M4R v1 and v2 */
1620 {
1621 .id = "DECO-M4R-V1",
1622 .vendor = "",
1623 .support_list =
1624 "SupportList:\n"
1625 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1626 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1627 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1628 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1629 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1630 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1631 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1632 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1633 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1634 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1635 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1636 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1637 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1638 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1639 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1640 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1641 .part_trail = 0x00,
1642 .soft_ver = SOFT_VER_DEFAULT,
1643
1644 .partitions = {
1645 {"fs-uboot", 0x00000, 0x80000},
1646 {"firmware", 0x80000, 0xe00000},
1647 {"product-info", 0xe80000, 0x05000},
1648 {"default-mac", 0xe85000, 0x01000},
1649 {"device-id", 0xe86000, 0x01000},
1650 {"support-list", 0xe87000, 0x10000},
1651 {"user-config", 0xea7000, 0x10000},
1652 {"device-config", 0xeb7000, 0x10000},
1653 {"group-info", 0xec7000, 0x10000},
1654 {"partition-table", 0xed7000, 0x02000},
1655 {"soft-version", 0xed9000, 0x10000},
1656 {"profile", 0xee9000, 0x10000},
1657 {"default-config", 0xef9000, 0x10000},
1658 {"url-sig", 0xfe0000, 0x10000},
1659 {"radio", 0xff0000, 0x10000},
1660 {NULL, 0, 0}
1661 },
1662 .first_sysupgrade_partition = "os-image",
1663 .last_sysupgrade_partition = "file-system",
1664 },
1665
1666 /** Firmware layout for the Deco M4R v4 */
1667 {
1668 .id = "DECO-M4R-V4",
1669 .vendor = "",
1670 .support_list =
1671 "SupportList:\n"
1672 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1673 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1674 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1675 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1676 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1677 .part_trail = 0x00,
1678 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1679
1680 .partitions = {
1681 {"fs-uboot", 0x00000, 0x40000},
1682 {"firmware", 0x40000, 0xf60000},
1683 {"default-mac", 0xfa0000, 0x00300},
1684 {"device-id", 0xfa0300, 0x00100},
1685 {"product-info", 0xfa0400, 0x0fc00},
1686 {"group-info", 0xfb0000, 0x04000},
1687 {"user-config", 0xfb4000, 0x0c000},
1688 {"device-config", 0xfc0000, 0x10000},
1689 {"default-config", 0xfd0000, 0x10000},
1690 {"partition-table", 0xfe0000, 0x00800},
1691 {"soft-version", 0xfe0800, 0x00100},
1692 {"support-list", 0xfe0900, 0x00200},
1693 {"profile", 0xfe0b00, 0x03000},
1694 {"extra-para", 0xfe3b00, 0x00100},
1695 {"radio", 0xff0000, 0x10000},
1696 {NULL, 0, 0}
1697 },
1698 .first_sysupgrade_partition = "os-image",
1699 .last_sysupgrade_partition = "file-system",
1700 },
1701
1702 /** Firmware layout for the Deco S4 v2 */
1703 {
1704 .id = "DECO-S4-V2",
1705 .vendor = "",
1706 .support_list =
1707 "SupportList:\n"
1708 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1709 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1710 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1711 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1712 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1713 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1714 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1715 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1716 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1717 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1718 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1719 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1720 .part_trail = 0x00,
1721 .soft_ver = SOFT_VER_DEFAULT,
1722
1723 .partitions = {
1724 {"fs-uboot", 0x00000, 0x80000},
1725 {"product-info", 0x80000, 0x05000},
1726 {"default-mac", 0x85000, 0x01000},
1727 {"device-id", 0x86000, 0x01000},
1728 {"support-list", 0x87000, 0x10000},
1729 {"user-config", 0xa7000, 0x10000},
1730 {"device-config", 0xb7000, 0x10000},
1731 {"group-info", 0xc7000, 0x10000},
1732 {"partition-table", 0xd7000, 0x02000},
1733 {"soft-version", 0xd9000, 0x10000},
1734 {"profile", 0xe9000, 0x10000},
1735 {"default-config", 0xf9000, 0x10000},
1736 {"url-sig", 0x1e0000, 0x10000},
1737 {"radio", 0x1f0000, 0x10000},
1738 {"firmware", 0x200000, 0xe00000},
1739 {NULL, 0, 0}
1740 },
1741 .first_sysupgrade_partition = "os-image",
1742 .last_sysupgrade_partition = "file-system",
1743 },
1744
1745 /** Firmware layout for the EAP120 */
1746 {
1747 .id = "EAP120",
1748 .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1749 .support_list =
1750 "SupportList:\r\n"
1751 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1752 .part_trail = 0xff,
1753 .soft_ver = SOFT_VER_DEFAULT,
1754
1755 .partitions = {
1756 {"fs-uboot", 0x00000, 0x20000},
1757 {"partition-table", 0x20000, 0x02000},
1758 {"default-mac", 0x30000, 0x00020},
1759 {"support-list", 0x31000, 0x00100},
1760 {"product-info", 0x31100, 0x00100},
1761 {"soft-version", 0x32000, 0x00100},
1762 {"os-image", 0x40000, 0x180000},
1763 {"file-system", 0x1c0000, 0x600000},
1764 {"user-config", 0x7c0000, 0x10000},
1765 {"backup-config", 0x7d0000, 0x10000},
1766 {"log", 0x7e0000, 0x10000},
1767 {"radio", 0x7f0000, 0x10000},
1768 {NULL, 0, 0}
1769 },
1770
1771 .first_sysupgrade_partition = "os-image",
1772 .last_sysupgrade_partition = "file-system"
1773 },
1774
1775 /** Firmware layout for the EAP225-Outdoor v1 */
1776 {
1777 .id = "EAP225-OUTDOOR-V1",
1778 .support_list =
1779 "SupportList:\r\n"
1780 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1781 .part_trail = PART_TRAIL_NONE,
1782 .soft_ver = SOFT_VER_DEFAULT,
1783 .soft_ver_compat_level = 1,
1784
1785 .partitions = {
1786 {"fs-uboot", 0x00000, 0x20000},
1787 {"partition-table", 0x20000, 0x02000},
1788 {"default-mac", 0x30000, 0x01000},
1789 {"support-list", 0x31000, 0x00100},
1790 {"product-info", 0x31100, 0x00400},
1791 {"soft-version", 0x32000, 0x00100},
1792 {"firmware", 0x40000, 0xd80000},
1793 {"user-config", 0xdc0000, 0x30000},
1794 {"mutil-log", 0xf30000, 0x80000},
1795 {"oops", 0xfb0000, 0x40000},
1796 {"radio", 0xff0000, 0x10000},
1797 {NULL, 0, 0}
1798 },
1799
1800 .first_sysupgrade_partition = "os-image",
1801 .last_sysupgrade_partition = "file-system"
1802 },
1803
1804 /** Firmware layout for the EAP225 v1 */
1805 {
1806 .id = "EAP225-V1",
1807 .support_list =
1808 "SupportList:\r\n"
1809 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1810 .part_trail = PART_TRAIL_NONE,
1811 .soft_ver = SOFT_VER_DEFAULT,
1812
1813 .partitions = {
1814 {"fs-uboot", 0x00000, 0x20000},
1815 {"partition-table", 0x20000, 0x02000},
1816 {"default-mac", 0x30000, 0x01000},
1817 {"support-list", 0x31000, 0x00100},
1818 {"product-info", 0x31100, 0x00400},
1819 {"soft-version", 0x32000, 0x00100},
1820 {"firmware", 0x40000, 0xd80000},
1821 {"user-config", 0xdc0000, 0x30000},
1822 {"radio", 0xff0000, 0x10000},
1823 {NULL, 0, 0}
1824 },
1825
1826 .first_sysupgrade_partition = "os-image",
1827 .last_sysupgrade_partition = "file-system"
1828 },
1829
1830 /** Firmware layout for the EAP225 v3
1831 * Also compatible with:
1832 * - EAP225 v3.20
1833 * - EAP225 v4
1834 * - EAP225-Outdoor v1
1835 * - EAP225-Outdoor v3
1836 * */
1837 {
1838 .id = "EAP225-V3",
1839 .support_list =
1840 "SupportList:\r\n"
1841 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1842 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1843 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1844 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1845 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1846 .part_trail = PART_TRAIL_NONE,
1847 .soft_ver = SOFT_VER_DEFAULT,
1848 .soft_ver_compat_level = 1,
1849
1850 .partitions = {
1851 {"fs-uboot", 0x00000, 0x20000},
1852 {"partition-table", 0x20000, 0x02000},
1853 {"default-mac", 0x30000, 0x01000},
1854 {"support-list", 0x31000, 0x00100},
1855 {"product-info", 0x31100, 0x00400},
1856 {"soft-version", 0x32000, 0x00100},
1857 {"firmware", 0x40000, 0xd80000},
1858 {"user-config", 0xdc0000, 0x30000},
1859 {"mutil-log", 0xf30000, 0x80000},
1860 {"oops", 0xfb0000, 0x40000},
1861 {"radio", 0xff0000, 0x10000},
1862 {NULL, 0, 0}
1863 },
1864
1865 .first_sysupgrade_partition = "os-image",
1866 .last_sysupgrade_partition = "file-system"
1867 },
1868
1869 /** Firmware layout for the EAP225-Wall v2 */
1870 {
1871 .id = "EAP225-WALL-V2",
1872 .support_list =
1873 "SupportList:\r\n"
1874 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1875 .part_trail = PART_TRAIL_NONE,
1876 .soft_ver = SOFT_VER_DEFAULT,
1877 .soft_ver_compat_level = 1,
1878
1879 .partitions = {
1880 {"fs-uboot", 0x00000, 0x20000},
1881 {"partition-table", 0x20000, 0x02000},
1882 {"default-mac", 0x30000, 0x01000},
1883 {"support-list", 0x31000, 0x00100},
1884 {"product-info", 0x31100, 0x00400},
1885 {"soft-version", 0x32000, 0x00100},
1886 {"firmware", 0x40000, 0xd80000},
1887 {"user-config", 0xdc0000, 0x30000},
1888 {"mutil-log", 0xf30000, 0x80000},
1889 {"oops", 0xfb0000, 0x40000},
1890 {"radio", 0xff0000, 0x10000},
1891 {NULL, 0, 0}
1892 },
1893
1894 .first_sysupgrade_partition = "os-image",
1895 .last_sysupgrade_partition = "file-system"
1896 },
1897
1898 /** Firmware layout for the EAP235-Wall v1 */
1899 {
1900 .id = "EAP235-WALL-V1",
1901 .support_list =
1902 "SupportList:\r\n"
1903 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1904 .part_trail = PART_TRAIL_NONE,
1905 .soft_ver = SOFT_VER_NUMERIC(3, 0, 0),
1906 .soft_ver_compat_level = 1,
1907
1908 .partitions = {
1909 {"fs-uboot", 0x00000, 0x80000},
1910 {"partition-table", 0x80000, 0x02000},
1911 {"default-mac", 0x90000, 0x01000},
1912 {"support-list", 0x91000, 0x00100},
1913 {"product-info", 0x91100, 0x00400},
1914 {"soft-version", 0x92000, 0x00100},
1915 {"firmware", 0xa0000, 0xd20000},
1916 {"user-config", 0xdc0000, 0x30000},
1917 {"mutil-log", 0xf30000, 0x80000},
1918 {"oops", 0xfb0000, 0x40000},
1919 {"radio", 0xff0000, 0x10000},
1920 {NULL, 0, 0}
1921 },
1922
1923 .first_sysupgrade_partition = "os-image",
1924 .last_sysupgrade_partition = "file-system"
1925 },
1926
1927 /** Firmware layout for the EAP245 v1 */
1928 {
1929 .id = "EAP245-V1",
1930 .support_list =
1931 "SupportList:\r\n"
1932 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1933 .part_trail = PART_TRAIL_NONE,
1934 .soft_ver = SOFT_VER_DEFAULT,
1935
1936 .partitions = {
1937 {"fs-uboot", 0x00000, 0x20000},
1938 {"partition-table", 0x20000, 0x02000},
1939 {"default-mac", 0x30000, 0x01000},
1940 {"support-list", 0x31000, 0x00100},
1941 {"product-info", 0x31100, 0x00400},
1942 {"soft-version", 0x32000, 0x00100},
1943 {"firmware", 0x40000, 0xd80000},
1944 {"user-config", 0xdc0000, 0x30000},
1945 {"radio", 0xff0000, 0x10000},
1946 {NULL, 0, 0}
1947 },
1948
1949 .first_sysupgrade_partition = "os-image",
1950 .last_sysupgrade_partition = "file-system"
1951 },
1952
1953 /** Firmware layout for the EAP245 v3 */
1954 {
1955 .id = "EAP245-V3",
1956 .support_list =
1957 "SupportList:\r\n"
1958 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
1959 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
1960 .part_trail = PART_TRAIL_NONE,
1961 .soft_ver = SOFT_VER_DEFAULT,
1962 .soft_ver_compat_level = 1,
1963
1964 /** Firmware partition with dynamic kernel/rootfs split */
1965 .partitions = {
1966 {"factroy-boot", 0x00000, 0x40000},
1967 {"fs-uboot", 0x40000, 0x40000},
1968 {"partition-table", 0x80000, 0x10000},
1969 {"default-mac", 0x90000, 0x01000},
1970 {"support-list", 0x91000, 0x00100},
1971 {"product-info", 0x91100, 0x00400},
1972 {"soft-version", 0x92000, 0x00100},
1973 {"radio", 0xa0000, 0x10000},
1974 {"extra-para", 0xb0000, 0x10000},
1975 {"firmware", 0xc0000, 0xe40000},
1976 {"config", 0xf00000, 0x30000},
1977 {"mutil-log", 0xf30000, 0x80000},
1978 {"oops", 0xfb0000, 0x40000},
1979 {NULL, 0, 0}
1980 },
1981
1982 .first_sysupgrade_partition = "os-image",
1983 .last_sysupgrade_partition = "file-system"
1984 },
1985
1986 /** Firmware layout for the EAP615-Wall v1 */
1987 {
1988 .id = "EAP615-WALL-V1",
1989 .soft_ver = SOFT_VER_DEFAULT,
1990 .soft_ver_compat_level = 1,
1991 .support_list =
1992 "SupportList:\r\n"
1993 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
1994 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
1995 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
1996 .part_trail = PART_TRAIL_NONE,
1997
1998 .partitions = {
1999 {"fs-uboot", 0x00000, 0x80000},
2000 {"partition-table", 0x80000, 0x02000},
2001 {"default-mac", 0x90000, 0x01000},
2002 {"support-list", 0x91000, 0x00100},
2003 {"product-info", 0x91100, 0x00400},
2004 {"soft-version", 0x92000, 0x00100},
2005 {"firmware", 0xa0000, 0xcf0000},
2006 {"user-config", 0xd90000, 0x60000},
2007 {"mutil-log", 0xf30000, 0x80000},
2008 {"oops", 0xfb0000, 0x40000},
2009 {"radio", 0xff0000, 0x10000},
2010 {NULL, 0, 0}
2011 },
2012
2013 .first_sysupgrade_partition = "os-image",
2014 .last_sysupgrade_partition = "file-system"
2015 },
2016
2017 /** Firmware layout for the TL-WA1201 v2 */
2018 {
2019 .id = "TL-WA1201-V2",
2020 .vendor = "",
2021 .support_list =
2022 "SupportList:\n"
2023 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2024 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2025 .part_trail = 0x00,
2026 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2027
2028 .partitions = {
2029 {"fs-uboot", 0x00000, 0x20000},
2030 {"default-mac", 0x20000, 0x00200},
2031 {"pin", 0x20200, 0x00100},
2032 {"product-info", 0x20300, 0x00200},
2033 {"device-id", 0x20500, 0x0fb00},
2034 {"firmware", 0x30000, 0xce0000},
2035 {"portal-logo", 0xd10000, 0x20000},
2036 {"portal-back", 0xd30000, 0x200000},
2037 {"soft-version", 0xf30000, 0x00200},
2038 {"extra-para", 0xf30200, 0x00200},
2039 {"support-list", 0xf30400, 0x00200},
2040 {"profile", 0xf30600, 0x0fa00},
2041 {"apdef-config", 0xf40000, 0x10000},
2042 {"ap-config", 0xf50000, 0x10000},
2043 {"redef-config", 0xf60000, 0x10000},
2044 {"re-config", 0xf70000, 0x10000},
2045 {"multidef-config", 0xf80000, 0x10000},
2046 {"multi-config", 0xf90000, 0x10000},
2047 {"clientdef-config", 0xfa0000, 0x10000},
2048 {"client-config", 0xfb0000, 0x10000},
2049 {"partition-table", 0xfc0000, 0x10000},
2050 {"user-config", 0xfd0000, 0x10000},
2051 {"certificate", 0xfe0000, 0x10000},
2052 {"radio", 0xff0000, 0x10000},
2053 {NULL, 0, 0}
2054 },
2055 .first_sysupgrade_partition = "os-image",
2056 .last_sysupgrade_partition = "file-system",
2057 },
2058
2059 /** Firmware layout for the TL-WA850RE v2 */
2060 {
2061 .id = "TLWA850REV2",
2062 .vendor = "",
2063 .support_list =
2064 "SupportList:\n"
2065 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2066 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2067 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2068 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2069 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2070 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2071 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2072 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2073 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2074 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2075 .part_trail = 0x00,
2076 .soft_ver = SOFT_VER_DEFAULT,
2077
2078 /**
2079 576KB were moved from file-system to os-image
2080 in comparison to the stock image
2081 */
2082 .partitions = {
2083 {"fs-uboot", 0x00000, 0x20000},
2084 {"firmware", 0x20000, 0x390000},
2085 {"partition-table", 0x3b0000, 0x02000},
2086 {"default-mac", 0x3c0000, 0x00020},
2087 {"pin", 0x3c0100, 0x00020},
2088 {"product-info", 0x3c1000, 0x01000},
2089 {"soft-version", 0x3c2000, 0x00100},
2090 {"support-list", 0x3c3000, 0x01000},
2091 {"profile", 0x3c4000, 0x08000},
2092 {"user-config", 0x3d0000, 0x10000},
2093 {"default-config", 0x3e0000, 0x10000},
2094 {"radio", 0x3f0000, 0x10000},
2095 {NULL, 0, 0}
2096 },
2097
2098 .first_sysupgrade_partition = "os-image",
2099 .last_sysupgrade_partition = "file-system"
2100 },
2101
2102 /** Firmware layout for the TL-WA855RE v1 */
2103 {
2104 .id = "TLWA855REV1",
2105 .vendor = "",
2106 .support_list =
2107 "SupportList:\n"
2108 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2109 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2110 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2111 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2112 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2113 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2114 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2115 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2116 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2117 .part_trail = 0x00,
2118 .soft_ver = SOFT_VER_DEFAULT,
2119
2120 .partitions = {
2121 {"fs-uboot", 0x00000, 0x20000},
2122 {"os-image", 0x20000, 0x150000},
2123 {"file-system", 0x170000, 0x240000},
2124 {"partition-table", 0x3b0000, 0x02000},
2125 {"default-mac", 0x3c0000, 0x00020},
2126 {"pin", 0x3c0100, 0x00020},
2127 {"product-info", 0x3c1000, 0x01000},
2128 {"soft-version", 0x3c2000, 0x00100},
2129 {"support-list", 0x3c3000, 0x01000},
2130 {"profile", 0x3c4000, 0x08000},
2131 {"user-config", 0x3d0000, 0x10000},
2132 {"default-config", 0x3e0000, 0x10000},
2133 {"radio", 0x3f0000, 0x10000},
2134 {NULL, 0, 0}
2135 },
2136
2137 .first_sysupgrade_partition = "os-image",
2138 .last_sysupgrade_partition = "file-system"
2139 },
2140
2141 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2142 {
2143 .id = "TL-WPA8630P-V2.0-EU",
2144 .vendor = "",
2145 .support_list =
2146 "SupportList:\n"
2147 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2148 .part_trail = 0x00,
2149 .soft_ver = SOFT_VER_DEFAULT,
2150
2151 .partitions = {
2152 {"factory-uboot", 0x00000, 0x20000},
2153 {"fs-uboot", 0x20000, 0x20000},
2154 {"firmware", 0x40000, 0x5e0000},
2155 {"partition-table", 0x620000, 0x02000},
2156 {"default-mac", 0x630000, 0x00020},
2157 {"pin", 0x630100, 0x00020},
2158 {"device-id", 0x630200, 0x00030},
2159 {"product-info", 0x631100, 0x01000},
2160 {"extra-para", 0x632100, 0x01000},
2161 {"soft-version", 0x640000, 0x01000},
2162 {"support-list", 0x641000, 0x01000},
2163 {"profile", 0x642000, 0x08000},
2164 {"user-config", 0x650000, 0x10000},
2165 {"default-config", 0x660000, 0x10000},
2166 {"default-nvm", 0x670000, 0xc0000},
2167 {"default-pib", 0x730000, 0x40000},
2168 {"radio", 0x7f0000, 0x10000},
2169 {NULL, 0, 0}
2170 },
2171
2172 .first_sysupgrade_partition = "os-image",
2173 .last_sysupgrade_partition = "file-system"
2174 },
2175
2176 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2177 {
2178 .id = "TL-WPA8630P-V2-INT",
2179 .vendor = "",
2180 .support_list =
2181 "SupportList:\n"
2182 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2183 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2184 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2185 .part_trail = 0x00,
2186 .soft_ver = SOFT_VER_DEFAULT,
2187
2188 .partitions = {
2189 {"factory-uboot", 0x00000, 0x20000},
2190 {"fs-uboot", 0x20000, 0x20000},
2191 {"firmware", 0x40000, 0x5e0000},
2192 {"partition-table", 0x620000, 0x02000},
2193 {"extra-para", 0x632100, 0x01000},
2194 {"soft-version", 0x640000, 0x01000},
2195 {"support-list", 0x641000, 0x01000},
2196 {"profile", 0x642000, 0x08000},
2197 {"user-config", 0x650000, 0x10000},
2198 {"default-config", 0x660000, 0x10000},
2199 {"default-nvm", 0x670000, 0xc0000},
2200 {"default-pib", 0x730000, 0x40000},
2201 {"default-mac", 0x7e0000, 0x00020},
2202 {"pin", 0x7e0100, 0x00020},
2203 {"device-id", 0x7e0200, 0x00030},
2204 {"product-info", 0x7e1100, 0x01000},
2205 {"radio", 0x7f0000, 0x10000},
2206 {NULL, 0, 0}
2207 },
2208
2209 .first_sysupgrade_partition = "os-image",
2210 .last_sysupgrade_partition = "file-system"
2211 },
2212
2213 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2214 {
2215 .id = "TL-WPA8630P-V2.1-EU",
2216 .vendor = "",
2217 .support_list =
2218 "SupportList:\n"
2219 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2220 .part_trail = 0x00,
2221 .soft_ver = SOFT_VER_DEFAULT,
2222
2223 .partitions = {
2224 {"factory-uboot", 0x00000, 0x20000},
2225 {"fs-uboot", 0x20000, 0x20000},
2226 {"firmware", 0x40000, 0x5e0000},
2227 {"extra-para", 0x680000, 0x01000},
2228 {"product-info", 0x690000, 0x01000},
2229 {"partition-table", 0x6a0000, 0x02000},
2230 {"soft-version", 0x6b0000, 0x01000},
2231 {"support-list", 0x6b1000, 0x01000},
2232 {"profile", 0x6b2000, 0x08000},
2233 {"user-config", 0x6c0000, 0x10000},
2234 {"default-config", 0x6d0000, 0x10000},
2235 {"default-nvm", 0x6e0000, 0xc0000},
2236 {"default-pib", 0x7a0000, 0x40000},
2237 {"default-mac", 0x7e0000, 0x00020},
2238 {"pin", 0x7e0100, 0x00020},
2239 {"device-id", 0x7e0200, 0x00030},
2240 {"radio", 0x7f0000, 0x10000},
2241 {NULL, 0, 0}
2242 },
2243
2244 .first_sysupgrade_partition = "os-image",
2245 .last_sysupgrade_partition = "file-system"
2246 },
2247
2248 /** Firmware layout for the TL-WPA8631P v3 */
2249 {
2250 .id = "TL-WPA8631P-V3",
2251 .vendor = "",
2252 .support_list =
2253 "SupportList:\n"
2254 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2255 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2256 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2257 .part_trail = 0x00,
2258 .soft_ver = SOFT_VER_DEFAULT,
2259
2260 .partitions = {
2261 {"fs-uboot", 0x00000, 0x20000},
2262 {"firmware", 0x20000, 0x710000},
2263 {"partition-table", 0x730000, 0x02000},
2264 {"default-mac", 0x732000, 0x00020},
2265 {"pin", 0x732100, 0x00020},
2266 {"device-id", 0x732200, 0x00030},
2267 {"default-region", 0x732300, 0x00010},
2268 {"product-info", 0x732400, 0x00200},
2269 {"extra-para", 0x732600, 0x00200},
2270 {"soft-version", 0x732800, 0x00200},
2271 {"support-list", 0x732a00, 0x00100},
2272 {"profile", 0x732b00, 0x00100},
2273 {"default-config", 0x732c00, 0x00800},
2274 {"plc-type", 0x733400, 0x00020},
2275 {"default-pib", 0x733500, 0x06000},
2276 {"user-config", 0x740000, 0x10000},
2277 {"plc-pib", 0x750000, 0x10000},
2278 {"plc-nvm", 0x760000, 0x90000},
2279 {"radio", 0x7f0000, 0x10000},
2280 {NULL, 0, 0}
2281 },
2282
2283 .first_sysupgrade_partition = "os-image",
2284 .last_sysupgrade_partition = "file-system"
2285 },
2286
2287 /** Firmware layout for the TL-WR1043 v5 */
2288 {
2289 .id = "TLWR1043NV5",
2290 .vendor = "",
2291 .support_list =
2292 "SupportList:\n"
2293 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2294 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2295 .part_trail = 0x00,
2296 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2297 .partitions = {
2298 {"factory-boot", 0x00000, 0x20000},
2299 {"fs-uboot", 0x20000, 0x20000},
2300 {"firmware", 0x40000, 0xec0000},
2301 {"default-mac", 0xf00000, 0x00200},
2302 {"pin", 0xf00200, 0x00200},
2303 {"device-id", 0xf00400, 0x00100},
2304 {"product-info", 0xf00500, 0x0fb00},
2305 {"soft-version", 0xf10000, 0x01000},
2306 {"extra-para", 0xf11000, 0x01000},
2307 {"support-list", 0xf12000, 0x0a000},
2308 {"profile", 0xf1c000, 0x04000},
2309 {"default-config", 0xf20000, 0x10000},
2310 {"user-config", 0xf30000, 0x40000},
2311 {"qos-db", 0xf70000, 0x40000},
2312 {"certificate", 0xfb0000, 0x10000},
2313 {"partition-table", 0xfc0000, 0x10000},
2314 {"log", 0xfd0000, 0x20000},
2315 {"radio", 0xff0000, 0x10000},
2316 {NULL, 0, 0}
2317 },
2318 .first_sysupgrade_partition = "os-image",
2319 .last_sysupgrade_partition = "file-system"
2320 },
2321
2322 /** Firmware layout for the TL-WR1043 v4 */
2323 {
2324 .id = "TLWR1043NDV4",
2325 .vendor = "",
2326 .support_list =
2327 "SupportList:\n"
2328 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2329 .part_trail = 0x00,
2330 .soft_ver = SOFT_VER_DEFAULT,
2331
2332 /* We're using a dynamic kernel/rootfs split here */
2333 .partitions = {
2334 {"fs-uboot", 0x00000, 0x20000},
2335 {"firmware", 0x20000, 0xf30000},
2336 {"default-mac", 0xf50000, 0x00200},
2337 {"pin", 0xf50200, 0x00200},
2338 {"product-info", 0xf50400, 0x0fc00},
2339 {"soft-version", 0xf60000, 0x0b000},
2340 {"support-list", 0xf6b000, 0x04000},
2341 {"profile", 0xf70000, 0x04000},
2342 {"default-config", 0xf74000, 0x0b000},
2343 {"user-config", 0xf80000, 0x40000},
2344 {"partition-table", 0xfc0000, 0x10000},
2345 {"log", 0xfd0000, 0x20000},
2346 {"radio", 0xff0000, 0x10000},
2347 {NULL, 0, 0}
2348 },
2349
2350 .first_sysupgrade_partition = "os-image",
2351 .last_sysupgrade_partition = "file-system"
2352 },
2353
2354 /** Firmware layout for the TL-WR902AC v1 */
2355 {
2356 .id = "TL-WR902AC-V1",
2357 .vendor = "",
2358 .support_list =
2359 "SupportList:\n"
2360 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2361 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2362 .part_trail = 0x00,
2363 .soft_ver = SOFT_VER_DEFAULT,
2364
2365 /**
2366 384KB were moved from file-system to os-image
2367 in comparison to the stock image
2368 */
2369 .partitions = {
2370 {"fs-uboot", 0x00000, 0x20000},
2371 {"firmware", 0x20000, 0x730000},
2372 {"default-mac", 0x750000, 0x00200},
2373 {"pin", 0x750200, 0x00200},
2374 {"product-info", 0x750400, 0x0fc00},
2375 {"soft-version", 0x760000, 0x0b000},
2376 {"support-list", 0x76b000, 0x04000},
2377 {"profile", 0x770000, 0x04000},
2378 {"default-config", 0x774000, 0x0b000},
2379 {"user-config", 0x780000, 0x40000},
2380 {"partition-table", 0x7c0000, 0x10000},
2381 {"log", 0x7d0000, 0x20000},
2382 {"radio", 0x7f0000, 0x10000},
2383 {NULL, 0, 0}
2384 },
2385
2386 .first_sysupgrade_partition = "os-image",
2387 .last_sysupgrade_partition = "file-system",
2388 },
2389
2390 /** Firmware layout for the TL-WR941HP v1 */
2391 {
2392 .id = "TL-WR941HP-V1",
2393 .vendor = "",
2394 .support_list =
2395 "SupportList:\n"
2396 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2397 .part_trail = 0x00,
2398 .soft_ver = SOFT_VER_DEFAULT,
2399
2400 .partitions = {
2401 {"fs-uboot", 0x00000, 0x20000},
2402 {"firmware", 0x20000, 0x730000},
2403 {"default-mac", 0x750000, 0x00200},
2404 {"pin", 0x750200, 0x00200},
2405 {"product-info", 0x750400, 0x0fc00},
2406 {"soft-version", 0x760000, 0x0b000},
2407 {"support-list", 0x76b000, 0x04000},
2408 {"profile", 0x770000, 0x04000},
2409 {"default-config", 0x774000, 0x0b000},
2410 {"user-config", 0x780000, 0x40000},
2411 {"partition-table", 0x7c0000, 0x10000},
2412 {"log", 0x7d0000, 0x20000},
2413 {"radio", 0x7f0000, 0x10000},
2414 {NULL, 0, 0}
2415 },
2416
2417 .first_sysupgrade_partition = "os-image",
2418 .last_sysupgrade_partition = "file-system",
2419 },
2420
2421 /** Firmware layout for the TL-WR942N V1 */
2422 {
2423 .id = "TLWR942NV1",
2424 .vendor = "",
2425 .support_list =
2426 "SupportList:\r\n"
2427 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2428 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2429 .part_trail = 0x00,
2430 .soft_ver = SOFT_VER_DEFAULT,
2431
2432 .partitions = {
2433 {"fs-uboot", 0x00000, 0x20000},
2434 {"firmware", 0x20000, 0xe20000},
2435 {"default-mac", 0xe40000, 0x00200},
2436 {"pin", 0xe40200, 0x00200},
2437 {"product-info", 0xe40400, 0x0fc00},
2438 {"partition-table", 0xe50000, 0x10000},
2439 {"soft-version", 0xe60000, 0x10000},
2440 {"support-list", 0xe70000, 0x10000},
2441 {"profile", 0xe80000, 0x10000},
2442 {"default-config", 0xe90000, 0x10000},
2443 {"user-config", 0xea0000, 0x40000},
2444 {"qos-db", 0xee0000, 0x40000},
2445 {"certificate", 0xf20000, 0x10000},
2446 {"usb-config", 0xfb0000, 0x10000},
2447 {"log", 0xfc0000, 0x20000},
2448 {"radio-bk", 0xfe0000, 0x10000},
2449 {"radio", 0xff0000, 0x10000},
2450 {NULL, 0, 0}
2451 },
2452
2453 .first_sysupgrade_partition = "os-image",
2454 .last_sysupgrade_partition = "file-system",
2455 },
2456
2457 /** Firmware layout for the RE200 v2 */
2458 {
2459 .id = "RE200-V2",
2460 .vendor = "",
2461 .support_list =
2462 "SupportList:\n"
2463 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2464 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2465 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2466 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2467 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2468 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2469 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2470 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2471 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2472 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2473 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2474 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2475 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2476 .part_trail = 0x00,
2477 .soft_ver = SOFT_VER_DEFAULT,
2478
2479 .partitions = {
2480 {"fs-uboot", 0x00000, 0x20000},
2481 {"firmware", 0x20000, 0x7a0000},
2482 {"partition-table", 0x7c0000, 0x02000},
2483 {"default-mac", 0x7c2000, 0x00020},
2484 {"pin", 0x7c2100, 0x00020},
2485 {"product-info", 0x7c3100, 0x01000},
2486 {"soft-version", 0x7c4200, 0x01000},
2487 {"support-list", 0x7c5200, 0x01000},
2488 {"profile", 0x7c6200, 0x08000},
2489 {"config-info", 0x7ce200, 0x00400},
2490 {"user-config", 0x7d0000, 0x10000},
2491 {"default-config", 0x7e0000, 0x10000},
2492 {"radio", 0x7f0000, 0x10000},
2493 {NULL, 0, 0}
2494 },
2495
2496 .first_sysupgrade_partition = "os-image",
2497 .last_sysupgrade_partition = "file-system"
2498 },
2499
2500 /** Firmware layout for the RE200 v3 */
2501 {
2502 .id = "RE200-V3",
2503 .vendor = "",
2504 .support_list =
2505 "SupportList:\n"
2506 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2507 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2508 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2509 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2510 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2511 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2512 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2513 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2514 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2515 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2516 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2517 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2518 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2519 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2520 .part_trail = 0x00,
2521 .soft_ver = SOFT_VER_DEFAULT,
2522
2523 .partitions = {
2524 {"fs-uboot", 0x00000, 0x20000},
2525 {"firmware", 0x20000, 0x7a0000},
2526 {"partition-table", 0x7c0000, 0x02000},
2527 {"default-mac", 0x7c2000, 0x00020},
2528 {"pin", 0x7c2100, 0x00020},
2529 {"product-info", 0x7c3100, 0x01000},
2530 {"soft-version", 0x7c4200, 0x01000},
2531 {"support-list", 0x7c5200, 0x01000},
2532 {"profile", 0x7c6200, 0x08000},
2533 {"config-info", 0x7ce200, 0x00400},
2534 {"user-config", 0x7d0000, 0x10000},
2535 {"default-config", 0x7e0000, 0x10000},
2536 {"radio", 0x7f0000, 0x10000},
2537 {NULL, 0, 0}
2538 },
2539
2540 .first_sysupgrade_partition = "os-image",
2541 .last_sysupgrade_partition = "file-system"
2542 },
2543
2544 /** Firmware layout for the RE200 v4 */
2545 {
2546 .id = "RE200-V4",
2547 .vendor = "",
2548 .support_list =
2549 "SupportList:\n"
2550 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2551 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2552 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2553 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2554 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2555 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2556 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2557 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2558 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2559 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2560 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2561 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2562 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2563 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2564 .part_trail = 0x00,
2565 .soft_ver = SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2566
2567 .partitions = {
2568 {"fs-uboot", 0x00000, 0x20000},
2569 {"firmware", 0x20000, 0x7a0000},
2570 {"partition-table", 0x7c0000, 0x02000},
2571 {"default-mac", 0x7c2000, 0x00020},
2572 {"pin", 0x7c2100, 0x00020},
2573 {"product-info", 0x7c3100, 0x01000},
2574 {"soft-version", 0x7c4200, 0x01000},
2575 {"support-list", 0x7c5200, 0x01000},
2576 {"profile", 0x7c6200, 0x08000},
2577 {"config-info", 0x7ce200, 0x00400},
2578 {"user-config", 0x7d0000, 0x10000},
2579 {"default-config", 0x7e0000, 0x10000},
2580 {"radio", 0x7f0000, 0x10000},
2581 {NULL, 0, 0}
2582 },
2583
2584 .first_sysupgrade_partition = "os-image",
2585 .last_sysupgrade_partition = "file-system"
2586 },
2587
2588 /** Firmware layout for the RE220 v2 */
2589 {
2590 .id = "RE220-V2",
2591 .vendor = "",
2592 .support_list =
2593 "SupportList:\n"
2594 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2595 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2596 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2597 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2598 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2599 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2600 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2601 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2602 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2603 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2604 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2605 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2606 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2607 .part_trail = 0x00,
2608 .soft_ver = SOFT_VER_DEFAULT,
2609
2610 .partitions = {
2611 {"fs-uboot", 0x00000, 0x20000},
2612 {"firmware", 0x20000, 0x7a0000},
2613 {"partition-table", 0x7c0000, 0x02000},
2614 {"default-mac", 0x7c2000, 0x00020},
2615 {"pin", 0x7c2100, 0x00020},
2616 {"product-info", 0x7c3100, 0x01000},
2617 {"soft-version", 0x7c4200, 0x01000},
2618 {"support-list", 0x7c5200, 0x01000},
2619 {"profile", 0x7c6200, 0x08000},
2620 {"config-info", 0x7ce200, 0x00400},
2621 {"user-config", 0x7d0000, 0x10000},
2622 {"default-config", 0x7e0000, 0x10000},
2623 {"radio", 0x7f0000, 0x10000},
2624 {NULL, 0, 0}
2625 },
2626
2627 .first_sysupgrade_partition = "os-image",
2628 .last_sysupgrade_partition = "file-system"
2629 },
2630
2631 /** Firmware layout for the RE305 v1 */
2632 {
2633 .id = "RE305-V1",
2634 .vendor = "",
2635 .support_list =
2636 "SupportList:\n"
2637 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2638 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2639 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2640 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2641 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2642 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2643 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2644 .part_trail = 0x00,
2645 .soft_ver = SOFT_VER_DEFAULT,
2646
2647 .partitions = {
2648 {"fs-uboot", 0x00000, 0x20000},
2649 {"firmware", 0x20000, 0x5e0000},
2650 {"partition-table", 0x600000, 0x02000},
2651 {"default-mac", 0x610000, 0x00020},
2652 {"pin", 0x610100, 0x00020},
2653 {"product-info", 0x611100, 0x01000},
2654 {"soft-version", 0x620000, 0x01000},
2655 {"support-list", 0x621000, 0x01000},
2656 {"profile", 0x622000, 0x08000},
2657 {"user-config", 0x630000, 0x10000},
2658 {"default-config", 0x640000, 0x10000},
2659 {"radio", 0x7f0000, 0x10000},
2660 {NULL, 0, 0}
2661 },
2662
2663 .first_sysupgrade_partition = "os-image",
2664 .last_sysupgrade_partition = "file-system"
2665 },
2666
2667 /** Firmware layout for the RE305 v3 */
2668 {
2669 .id = "RE305-V3",
2670 .vendor = "",
2671 .support_list =
2672 "SupportList:\n"
2673 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2674 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2675 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2676 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2677 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2678 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2679 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2680 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2681 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2682 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2683 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2684 .part_trail = 0x00,
2685 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2686
2687 .partitions = {
2688 {"fs-uboot", 0x00000, 0x20000},
2689 {"firmware", 0x20000, 0x7a0000},
2690 {"partition-table", 0x7c0000, 0x02000},
2691 {"default-mac", 0x7c2000, 0x00020},
2692 {"pin", 0x7c2100, 0x00020},
2693 {"product-info", 0x7c3100, 0x01000},
2694 {"soft-version", 0x7c4200, 0x01000},
2695 {"support-list", 0x7c5200, 0x01000},
2696 {"profile", 0x7c6200, 0x08000},
2697 {"config-info", 0x7ce200, 0x00400},
2698 {"user-config", 0x7d0000, 0x10000},
2699 {"default-config", 0x7e0000, 0x10000},
2700 {"radio", 0x7f0000, 0x10000},
2701 {NULL, 0, 0}
2702 },
2703
2704 .first_sysupgrade_partition = "os-image",
2705 .last_sysupgrade_partition = "file-system"
2706 },
2707
2708 /** Firmware layout for the RE350 v1 */
2709 {
2710 .id = "RE350-V1",
2711 .vendor = "",
2712 .support_list =
2713 "SupportList:\n"
2714 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2715 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2716 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2717 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2718 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2719 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2720 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2721 .part_trail = 0x00,
2722 .soft_ver = SOFT_VER_DEFAULT,
2723
2724 /** We're using a dynamic kernel/rootfs split here */
2725 .partitions = {
2726 {"fs-uboot", 0x00000, 0x20000},
2727 {"firmware", 0x20000, 0x5e0000},
2728 {"partition-table", 0x600000, 0x02000},
2729 {"default-mac", 0x610000, 0x00020},
2730 {"pin", 0x610100, 0x00020},
2731 {"product-info", 0x611100, 0x01000},
2732 {"soft-version", 0x620000, 0x01000},
2733 {"support-list", 0x621000, 0x01000},
2734 {"profile", 0x622000, 0x08000},
2735 {"user-config", 0x630000, 0x10000},
2736 {"default-config", 0x640000, 0x10000},
2737 {"radio", 0x7f0000, 0x10000},
2738 {NULL, 0, 0}
2739 },
2740
2741 .first_sysupgrade_partition = "os-image",
2742 .last_sysupgrade_partition = "file-system"
2743 },
2744
2745 /** Firmware layout for the RE350K v1 */
2746 {
2747 .id = "RE350K-V1",
2748 .vendor = "",
2749 .support_list =
2750 "SupportList:\n"
2751 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2752 .part_trail = 0x00,
2753 .soft_ver = SOFT_VER_DEFAULT,
2754
2755 /** We're using a dynamic kernel/rootfs split here */
2756 .partitions = {
2757 {"fs-uboot", 0x00000, 0x20000},
2758 {"firmware", 0x20000, 0xd70000},
2759 {"partition-table", 0xd90000, 0x02000},
2760 {"default-mac", 0xda0000, 0x00020},
2761 {"pin", 0xda0100, 0x00020},
2762 {"product-info", 0xda1100, 0x01000},
2763 {"soft-version", 0xdb0000, 0x01000},
2764 {"support-list", 0xdb1000, 0x01000},
2765 {"profile", 0xdb2000, 0x08000},
2766 {"user-config", 0xdc0000, 0x10000},
2767 {"default-config", 0xdd0000, 0x10000},
2768 {"device-id", 0xde0000, 0x00108},
2769 {"radio", 0xff0000, 0x10000},
2770 {NULL, 0, 0}
2771 },
2772
2773 .first_sysupgrade_partition = "os-image",
2774 .last_sysupgrade_partition = "file-system"
2775 },
2776
2777 /** Firmware layout for the RE355 */
2778 {
2779 .id = "RE355",
2780 .vendor = "",
2781 .support_list =
2782 "SupportList:\r\n"
2783 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2784 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2785 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2786 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2787 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2788 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2789 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2790 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2791 .part_trail = 0x00,
2792 .soft_ver = SOFT_VER_DEFAULT,
2793
2794 /* We're using a dynamic kernel/rootfs split here */
2795 .partitions = {
2796 {"fs-uboot", 0x00000, 0x20000},
2797 {"firmware", 0x20000, 0x5e0000},
2798 {"partition-table", 0x600000, 0x02000},
2799 {"default-mac", 0x610000, 0x00020},
2800 {"pin", 0x610100, 0x00020},
2801 {"product-info", 0x611100, 0x01000},
2802 {"soft-version", 0x620000, 0x01000},
2803 {"support-list", 0x621000, 0x01000},
2804 {"profile", 0x622000, 0x08000},
2805 {"user-config", 0x630000, 0x10000},
2806 {"default-config", 0x640000, 0x10000},
2807 {"radio", 0x7f0000, 0x10000},
2808 {NULL, 0, 0}
2809 },
2810
2811 .first_sysupgrade_partition = "os-image",
2812 .last_sysupgrade_partition = "file-system"
2813 },
2814
2815 /** Firmware layout for the RE450 */
2816 {
2817 .id = "RE450",
2818 .vendor = "",
2819 .support_list =
2820 "SupportList:\r\n"
2821 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2822 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2823 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2824 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2825 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2826 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2827 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2828 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2829 .part_trail = 0x00,
2830 .soft_ver = SOFT_VER_DEFAULT,
2831
2832 /** We're using a dynamic kernel/rootfs split here */
2833 .partitions = {
2834 {"fs-uboot", 0x00000, 0x20000},
2835 {"firmware", 0x20000, 0x5e0000},
2836 {"partition-table", 0x600000, 0x02000},
2837 {"default-mac", 0x610000, 0x00020},
2838 {"pin", 0x610100, 0x00020},
2839 {"product-info", 0x611100, 0x01000},
2840 {"soft-version", 0x620000, 0x01000},
2841 {"support-list", 0x621000, 0x01000},
2842 {"profile", 0x622000, 0x08000},
2843 {"user-config", 0x630000, 0x10000},
2844 {"default-config", 0x640000, 0x10000},
2845 {"radio", 0x7f0000, 0x10000},
2846 {NULL, 0, 0}
2847 },
2848
2849 .first_sysupgrade_partition = "os-image",
2850 .last_sysupgrade_partition = "file-system"
2851 },
2852
2853 /** Firmware layout for the RE450 v2 */
2854 {
2855 .id = "RE450-V2",
2856 .vendor = "",
2857 .support_list =
2858 "SupportList:\r\n"
2859 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2860 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2861 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2862 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2863 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2864 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2865 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2866 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2867 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2868 .part_trail = 0x00,
2869 .soft_ver = SOFT_VER_DEFAULT,
2870
2871 /* We're using a dynamic kernel/rootfs split here */
2872 .partitions = {
2873 {"fs-uboot", 0x00000, 0x20000},
2874 {"firmware", 0x20000, 0x5e0000},
2875 {"partition-table", 0x600000, 0x02000},
2876 {"default-mac", 0x610000, 0x00020},
2877 {"pin", 0x610100, 0x00020},
2878 {"product-info", 0x611100, 0x01000},
2879 {"soft-version", 0x620000, 0x01000},
2880 {"support-list", 0x621000, 0x01000},
2881 {"profile", 0x622000, 0x08000},
2882 {"user-config", 0x630000, 0x10000},
2883 {"default-config", 0x640000, 0x10000},
2884 {"radio", 0x7f0000, 0x10000},
2885 {NULL, 0, 0}
2886 },
2887
2888 .first_sysupgrade_partition = "os-image",
2889 .last_sysupgrade_partition = "file-system"
2890 },
2891
2892 /** Firmware layout for the RE450 v3 */
2893 {
2894 .id = "RE450-V3",
2895 .vendor = "",
2896 .support_list =
2897 "SupportList:\r\n"
2898 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2899 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2900 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2901 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2902 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2903 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2904 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2905 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2906 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2907 .part_trail = 0x00,
2908 .soft_ver = SOFT_VER_DEFAULT,
2909
2910 /* We're using a dynamic kernel/rootfs split here */
2911 .partitions = {
2912 {"fs-uboot", 0x00000, 0x20000},
2913 {"default-mac", 0x20000, 0x00020},
2914 {"pin", 0x20020, 0x00020},
2915 {"product-info", 0x21000, 0x01000},
2916 {"partition-table", 0x22000, 0x02000},
2917 {"soft-version", 0x24000, 0x01000},
2918 {"support-list", 0x25000, 0x01000},
2919 {"profile", 0x26000, 0x08000},
2920 {"user-config", 0x2e000, 0x10000},
2921 {"default-config", 0x3e000, 0x10000},
2922 {"config-info", 0x4e000, 0x00400},
2923 {"firmware", 0x50000, 0x7a0000},
2924 {"radio", 0x7f0000, 0x10000},
2925 {NULL, 0, 0}
2926 },
2927
2928 .first_sysupgrade_partition = "os-image",
2929 .last_sysupgrade_partition = "file-system"
2930 },
2931
2932 /** Firmware layout for the RE455 v1 */
2933 {
2934 .id = "RE455-V1",
2935 .vendor = "",
2936 .support_list =
2937 "SupportList:\r\n"
2938 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2939 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2940 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2941 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2942 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2943 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2944 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2945 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2946 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2947 .part_trail = 0x00,
2948 .soft_ver = SOFT_VER_DEFAULT,
2949
2950 /* We're using a dynamic kernel/rootfs split here */
2951 .partitions = {
2952 {"fs-uboot", 0x00000, 0x20000},
2953 {"default-mac", 0x20000, 0x00020},
2954 {"pin", 0x20020, 0x00020},
2955 {"product-info", 0x21000, 0x01000},
2956 {"partition-table", 0x22000, 0x02000},
2957 {"soft-version", 0x24000, 0x01000},
2958 {"support-list", 0x25000, 0x01000},
2959 {"profile", 0x26000, 0x08000},
2960 {"user-config", 0x2e000, 0x10000},
2961 {"default-config", 0x3e000, 0x10000},
2962 {"config-info", 0x4e000, 0x00400},
2963 {"firmware", 0x50000, 0x7a0000},
2964 {"radio", 0x7f0000, 0x10000},
2965 {NULL, 0, 0}
2966 },
2967
2968 .first_sysupgrade_partition = "os-image",
2969 .last_sysupgrade_partition = "file-system"
2970 },
2971
2972 /** Firmware layout for the RE500 */
2973 {
2974 .id = "RE500-V1",
2975 .vendor = "",
2976 .support_list =
2977 "SupportList:\r\n"
2978 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2979 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2980 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2981 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2982 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2983 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2984 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2985 .part_trail = 0x00,
2986 .soft_ver = SOFT_VER_DEFAULT,
2987
2988 /* We're using a dynamic kernel/rootfs split here */
2989 .partitions = {
2990 {"fs-uboot", 0x00000, 0x20000},
2991 {"firmware", 0x20000, 0xde0000},
2992 {"partition-table", 0xe00000, 0x02000},
2993 {"default-mac", 0xe10000, 0x00020},
2994 {"pin", 0xe10100, 0x00020},
2995 {"product-info", 0xe11100, 0x01000},
2996 {"soft-version", 0xe20000, 0x01000},
2997 {"support-list", 0xe21000, 0x01000},
2998 {"profile", 0xe22000, 0x08000},
2999 {"user-config", 0xe30000, 0x10000},
3000 {"default-config", 0xe40000, 0x10000},
3001 {"radio", 0xff0000, 0x10000},
3002 {NULL, 0, 0}
3003 },
3004
3005 .first_sysupgrade_partition = "os-image",
3006 .last_sysupgrade_partition = "file-system"
3007 },
3008
3009 /** Firmware layout for the RE650 */
3010 {
3011 .id = "RE650-V1",
3012 .vendor = "",
3013 .support_list =
3014 "SupportList:\r\n"
3015 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
3016 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
3017 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3018 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3019 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3020 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3021 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3022 .part_trail = 0x00,
3023 .soft_ver = SOFT_VER_DEFAULT,
3024
3025 /* We're using a dynamic kernel/rootfs split here */
3026 .partitions = {
3027 {"fs-uboot", 0x00000, 0x20000},
3028 {"firmware", 0x20000, 0xde0000},
3029 {"partition-table", 0xe00000, 0x02000},
3030 {"default-mac", 0xe10000, 0x00020},
3031 {"pin", 0xe10100, 0x00020},
3032 {"product-info", 0xe11100, 0x01000},
3033 {"soft-version", 0xe20000, 0x01000},
3034 {"support-list", 0xe21000, 0x01000},
3035 {"profile", 0xe22000, 0x08000},
3036 {"user-config", 0xe30000, 0x10000},
3037 {"default-config", 0xe40000, 0x10000},
3038 {"radio", 0xff0000, 0x10000},
3039 {NULL, 0, 0}
3040 },
3041
3042 .first_sysupgrade_partition = "os-image",
3043 .last_sysupgrade_partition = "file-system"
3044 },
3045 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3046 {
3047 .id = "RE650-V2",
3048 .vendor = "",
3049 .support_list =
3050 "SupportList:\n"
3051 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3052 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3053 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3054 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3055 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3056 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3057 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3058 .part_trail = 0x00,
3059 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3060 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3061
3062 /* We're using a dynamic kernel/rootfs split here */
3063 .partitions = {
3064 {"fs-uboot", 0x00000, 0x20000},
3065 {"firmware", 0x20000, 0x7a0000},
3066 {"partition-table", 0x7c0000, 0x02000},
3067 {"default-mac", 0x7c2000, 0x00020},
3068 {"pin", 0x7c2100, 0x00020},
3069 {"product-info", 0x7c3100, 0x01000},
3070 {"soft-version", 0x7c4200, 0x01000},
3071 {"support-list", 0x7c5200, 0x01000},
3072 {"profile", 0x7c6200, 0x08000},
3073 {"config-info", 0x7ce200, 0x00400},
3074 {"user-config", 0x7d0000, 0x10000},
3075 {"default-config", 0x7e0000, 0x10000},
3076 {"radio", 0x7f0000, 0x10000},
3077 {NULL, 0, 0}
3078 },
3079
3080 .first_sysupgrade_partition = "os-image",
3081 .last_sysupgrade_partition = "file-system"
3082 },
3083
3084 /** Firmware layout for the Mercusys MR70X */
3085 {
3086 .id = "MR70X",
3087 .vendor = "",
3088 .support_list =
3089 "SupportList:\n"
3090 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3091 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3092 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3093 .part_trail = 0x00,
3094 .soft_ver = SOFT_VER_DEFAULT,
3095
3096 .partitions = {
3097 {"fs-uboot", 0x00000, 0x40000},
3098 {"firmware", 0x40000, 0xf60000},
3099 {"default-mac", 0xfa0000, 0x00200},
3100 {"pin", 0xfa0200, 0x00100},
3101 {"device-id", 0xfa0300, 0x00100},
3102 {"product-info", 0xfa0400, 0x0fc00},
3103 {"default-config", 0xfb0000, 0x08000},
3104 {"ap-def-config", 0xfb8000, 0x08000},
3105 {"user-config", 0xfc0000, 0x0a000},
3106 {"ag-config", 0xfca000, 0x04000},
3107 {"certificate", 0xfce000, 0x02000},
3108 {"ap-config", 0xfd0000, 0x06000},
3109 {"router-config", 0xfd6000, 0x06000},
3110 {"favicon", 0xfdc000, 0x02000},
3111 {"logo", 0xfde000, 0x02000},
3112 {"partition-table", 0xfe0000, 0x00800},
3113 {"soft-version", 0xfe0800, 0x00100},
3114 {"support-list", 0xfe0900, 0x00200},
3115 {"profile", 0xfe0b00, 0x03000},
3116 {"extra-para", 0xfe3b00, 0x00100},
3117 {"radio", 0xff0000, 0x10000},
3118 {NULL, 0, 0}
3119 },
3120
3121 .first_sysupgrade_partition = "os-image",
3122 .last_sysupgrade_partition = "file-system"
3123 },
3124
3125 {}
3126 };
3127
3128 #define error(_ret, _errno, _str, ...) \
3129 do { \
3130 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3131 strerror(_errno)); \
3132 if (_ret) \
3133 exit(_ret); \
3134 } while (0)
3135
3136
3137 /** Stores a uint32 as big endian */
3138 static inline void put32(uint8_t *buf, uint32_t val) {
3139 buf[0] = val >> 24;
3140 buf[1] = val >> 16;
3141 buf[2] = val >> 8;
3142 buf[3] = val;
3143 }
3144
3145 static inline bool meta_partition_should_pad(enum partition_trail_value pv)
3146 {
3147 return (pv >= 0) && (pv <= PART_TRAIL_MAX);
3148 }
3149
3150 /** Allocate a padded meta partition with a correctly initialised header
3151 * If the `data` pointer is NULL, then the required space is only allocated,
3152 * otherwise `data_len` bytes will be copied from `data` into the partition
3153 * entry. */
3154 static struct image_partition_entry init_meta_partition_entry(
3155 const char *name, const void *data, uint32_t data_len,
3156 enum partition_trail_value pad_value)
3157 {
3158 uint32_t total_len = sizeof(struct meta_header) + data_len;
3159 if (meta_partition_should_pad(pad_value))
3160 total_len += 1;
3161
3162 struct image_partition_entry entry = {
3163 .name = name,
3164 .size = total_len,
3165 .data = malloc(total_len)
3166 };
3167 if (!entry.data)
3168 error(1, errno, "failed to allocate meta partition entry");
3169
3170 struct meta_header *header = (struct meta_header *)entry.data;
3171 header->length = htonl(data_len);
3172 header->zero = 0;
3173
3174 if (data)
3175 memcpy(entry.data+sizeof(*header), data, data_len);
3176
3177 if (meta_partition_should_pad(pad_value))
3178 entry.data[total_len - 1] = (uint8_t) pad_value;
3179
3180 return entry;
3181 }
3182
3183 /** Allocates a new image partition */
3184 static struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
3185 struct image_partition_entry entry = {name, len, malloc(len)};
3186 if (!entry.data)
3187 error(1, errno, "malloc");
3188
3189 return entry;
3190 }
3191
3192 /** Sets up default partition names whenever custom names aren't specified */
3193 static void set_partition_names(struct device_info *info)
3194 {
3195 if (!info->partition_names.partition_table)
3196 info->partition_names.partition_table = "partition-table";
3197 if (!info->partition_names.soft_ver)
3198 info->partition_names.soft_ver = "soft-version";
3199 if (!info->partition_names.os_image)
3200 info->partition_names.os_image = "os-image";
3201 if (!info->partition_names.support_list)
3202 info->partition_names.support_list = "support-list";
3203 if (!info->partition_names.file_system)
3204 info->partition_names.file_system = "file-system";
3205 if (!info->partition_names.extra_para)
3206 info->partition_names.extra_para = "extra-para";
3207 }
3208
3209 /** Frees an image partition */
3210 static void free_image_partition(struct image_partition_entry *entry)
3211 {
3212 void *data = entry->data;
3213
3214 entry->name = NULL;
3215 entry->size = 0;
3216 entry->data = NULL;
3217
3218 free(data);
3219 }
3220
3221 static time_t source_date_epoch = -1;
3222 static void set_source_date_epoch() {
3223 char *env = getenv("SOURCE_DATE_EPOCH");
3224 char *endptr = env;
3225 errno = 0;
3226 if (env && *env) {
3227 source_date_epoch = strtoull(env, &endptr, 10);
3228 if (errno || (endptr && *endptr != '\0')) {
3229 fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
3230 exit(1);
3231 }
3232 }
3233 }
3234
3235 /** Generates the partition-table partition */
3236 static struct image_partition_entry make_partition_table(const struct device_info *p)
3237 {
3238 struct image_partition_entry entry = alloc_image_partition(p->partition_names.partition_table, SAFELOADER_PAYLOAD_TABLE_SIZE);
3239
3240 char *s = (char *)entry.data, *end = (char *)(s+entry.size);
3241
3242 *(s++) = 0x00;
3243 *(s++) = 0x04;
3244 *(s++) = 0x00;
3245 *(s++) = 0x00;
3246
3247 size_t i;
3248 for (i = 0; p->partitions[i].name; i++) {
3249 size_t len = end-s;
3250 size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n",
3251 p->partitions[i].name, p->partitions[i].base, p->partitions[i].size);
3252
3253 if (w > len-1)
3254 error(1, 0, "flash partition table overflow?");
3255
3256 s += w;
3257 }
3258
3259 s++;
3260
3261 memset(s, 0xff, end-s);
3262
3263 return entry;
3264 }
3265
3266
3267 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3268 static inline uint8_t bcd(uint8_t v) {
3269 return 0x10 * (v/10) + v%10;
3270 }
3271
3272
3273 /** Generates the soft-version partition */
3274 static struct image_partition_entry make_soft_version(const struct device_info *info, uint32_t rev)
3275 {
3276 /** If an info string is provided, use this instead of
3277 * the structured data, and include the null-termination */
3278 if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) {
3279 uint32_t len = strlen(info->soft_ver.text) + 1;
3280 return init_meta_partition_entry(info->partition_names.soft_ver,
3281 info->soft_ver.text, len, info->part_trail);
3282 }
3283
3284 time_t t;
3285
3286 if (source_date_epoch != -1)
3287 t = source_date_epoch;
3288 else if (time(&t) == (time_t)(-1))
3289 error(1, errno, "time");
3290
3291 struct tm *tm = gmtime(&t);
3292
3293 struct soft_version s = {
3294 .pad1 = 0xff,
3295
3296 .version_major = info->soft_ver.num[0],
3297 .version_minor = info->soft_ver.num[1],
3298 .version_patch = info->soft_ver.num[2],
3299
3300 .year_hi = bcd((1900+tm->tm_year)/100),
3301 .year_lo = bcd(tm->tm_year%100),
3302 .month = bcd(tm->tm_mon+1),
3303 .day = bcd(tm->tm_mday),
3304 .rev = htonl(rev),
3305
3306 .compat_level = htonl(info->soft_ver_compat_level)
3307 };
3308
3309 if (info->soft_ver_compat_level == 0)
3310 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3311 (uint8_t *)(&s.compat_level) - (uint8_t *)(&s),
3312 info->part_trail);
3313 else
3314 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3315 sizeof(s), info->part_trail);
3316 }
3317
3318 /** Generates the support-list partition */
3319 static struct image_partition_entry make_support_list(
3320 const struct device_info *info)
3321 {
3322 uint32_t len = strlen(info->support_list);
3323 return init_meta_partition_entry(info->partition_names.support_list, info->support_list,
3324 len, info->part_trail);
3325 }
3326
3327 /** Partition with extra-para data */
3328 static struct image_partition_entry make_extra_para(
3329 const struct device_info *info, const uint8_t *extra_para, size_t len)
3330 {
3331 return init_meta_partition_entry(info->partition_names.extra_para, extra_para, len,
3332 info->part_trail);
3333 }
3334
3335 /** Creates a new image partition with an arbitrary name from a file */
3336 static struct image_partition_entry read_file(const char *part_name, const char *filename, bool add_jffs2_eof, struct flash_partition_entry *file_system_partition) {
3337 struct stat statbuf;
3338
3339 if (stat(filename, &statbuf) < 0)
3340 error(1, errno, "unable to stat file `%s'", filename);
3341
3342 size_t len = statbuf.st_size;
3343
3344 if (add_jffs2_eof) {
3345 if (file_system_partition)
3346 len = ALIGN(len + file_system_partition->base, 0x10000) + sizeof(jffs2_eof_mark) - file_system_partition->base;
3347 else
3348 len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark);
3349 }
3350
3351 struct image_partition_entry entry = alloc_image_partition(part_name, len);
3352
3353 FILE *file = fopen(filename, "rb");
3354 if (!file)
3355 error(1, errno, "unable to open file `%s'", filename);
3356
3357 if (fread(entry.data, statbuf.st_size, 1, file) != 1)
3358 error(1, errno, "unable to read file `%s'", filename);
3359
3360 if (add_jffs2_eof) {
3361 uint8_t *eof = entry.data + statbuf.st_size, *end = entry.data+entry.size;
3362
3363 memset(eof, 0xff, end - eof - sizeof(jffs2_eof_mark));
3364 memcpy(end - sizeof(jffs2_eof_mark), jffs2_eof_mark, sizeof(jffs2_eof_mark));
3365 }
3366
3367 fclose(file);
3368
3369 return entry;
3370 }
3371
3372 /**
3373 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3374
3375 Example image partition table:
3376
3377 fwup-ptn partition-table base 0x00800 size 0x00800
3378 fwup-ptn os-image base 0x01000 size 0x113b45
3379 fwup-ptn file-system base 0x114b45 size 0x1d0004
3380 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3381
3382 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3383 the end of the partition table is marked with a zero byte.
3384
3385 The firmware image must contain at least the partition-table and support-list partitions
3386 to be accepted. There aren't any alignment constraints for the image partitions.
3387
3388 The partition-table partition contains the actual flash layout; partitions
3389 from the image partition table are mapped to the corresponding flash partitions during
3390 the firmware upgrade. The support-list partition contains a list of devices supported by
3391 the firmware image.
3392
3393 The base offsets in the firmware partition table are relative to the end
3394 of the vendor information block, so the partition-table partition will
3395 actually start at offset 0x1814 of the image.
3396
3397 I think partition-table must be the first partition in the firmware image.
3398 */
3399 static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) {
3400 size_t i, j;
3401 char *image_pt = (char *)buffer, *end = image_pt + SAFELOADER_PAYLOAD_TABLE_SIZE;
3402
3403 size_t base = SAFELOADER_PAYLOAD_TABLE_SIZE;
3404 for (i = 0; parts[i].name; i++) {
3405 for (j = 0; flash_parts[j].name; j++) {
3406 if (!strcmp(flash_parts[j].name, parts[i].name)) {
3407 if (parts[i].size > flash_parts[j].size)
3408 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts[j].name, (unsigned)flash_parts[j].size);
3409 break;
3410 }
3411 }
3412
3413 assert(flash_parts[j].name);
3414
3415 memcpy(buffer + base, parts[i].data, parts[i].size);
3416
3417 size_t len = end-image_pt;
3418 size_t w = snprintf(image_pt, len, "fwup-ptn %s base 0x%05x size 0x%05x\t\r\n", parts[i].name, (unsigned)base, (unsigned)parts[i].size);
3419
3420 if (w > len-1)
3421 error(1, 0, "image partition table overflow?");
3422
3423 image_pt += w;
3424
3425 base += parts[i].size;
3426 }
3427 }
3428
3429 /** Generates and writes the image MD5 checksum */
3430 static void put_md5(uint8_t *md5, uint8_t *buffer, unsigned int len) {
3431 MD5_CTX ctx;
3432
3433 MD5_Init(&ctx);
3434 MD5_Update(&ctx, md5_salt, (unsigned int)sizeof(md5_salt));
3435 MD5_Update(&ctx, buffer, len);
3436 MD5_Final(md5, &ctx);
3437 }
3438
3439
3440 /**
3441 Generates the firmware image in factory format
3442
3443 Image format:
3444
3445 Bytes (hex) Usage
3446 ----------- -----
3447 0000-0003 Image size (4 bytes, big endian)
3448 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3449 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3450 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3451 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3452 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3453 1814-xxxx Firmware partitions
3454 */
3455 static void * generate_factory_image(struct device_info *info, const struct image_partition_entry *parts, size_t *len) {
3456 *len = SAFELOADER_PAYLOAD_OFFSET + SAFELOADER_PAYLOAD_TABLE_SIZE;
3457
3458 size_t i;
3459 for (i = 0; parts[i].name; i++)
3460 *len += parts[i].size;
3461
3462 uint8_t *image = malloc(*len);
3463 if (!image)
3464 error(1, errno, "malloc");
3465
3466 memset(image, 0xff, *len);
3467 put32(image, *len);
3468
3469 if (info->vendor) {
3470 size_t vendor_len = strlen(info->vendor);
3471 put32(image + SAFELOADER_PREAMBLE_SIZE, vendor_len);
3472 memcpy(image + SAFELOADER_PREAMBLE_SIZE + 0x4, info->vendor, vendor_len);
3473 }
3474
3475 put_partitions(image + SAFELOADER_PAYLOAD_OFFSET, info->partitions, parts);
3476 put_md5(image + 0x04, image + SAFELOADER_PREAMBLE_SIZE, *len - SAFELOADER_PREAMBLE_SIZE);
3477
3478 return image;
3479 }
3480
3481 /**
3482 Generates the firmware image in sysupgrade format
3483
3484 This makes some assumptions about the provided flash and image partition tables and
3485 should be generalized when TP-LINK starts building its safeloader into hardware with
3486 different flash layouts.
3487 */
3488 static void * generate_sysupgrade_image(struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) {
3489 size_t i, j;
3490 size_t flash_first_partition_index = 0;
3491 size_t flash_last_partition_index = 0;
3492 const struct flash_partition_entry *flash_first_partition = NULL;
3493 const struct flash_partition_entry *flash_last_partition = NULL;
3494 const struct image_partition_entry *image_last_partition = NULL;
3495
3496 /** Find first and last partitions */
3497 for (i = 0; info->partitions[i].name; i++) {
3498 if (!strcmp(info->partitions[i].name, info->first_sysupgrade_partition)) {
3499 flash_first_partition = &info->partitions[i];
3500 flash_first_partition_index = i;
3501 } else if (!strcmp(info->partitions[i].name, info->last_sysupgrade_partition)) {
3502 flash_last_partition = &info->partitions[i];
3503 flash_last_partition_index = i;
3504 }
3505 }
3506
3507 assert(flash_first_partition && flash_last_partition);
3508 assert(flash_first_partition_index < flash_last_partition_index);
3509
3510 /** Find last partition from image to calculate needed size */
3511 for (i = 0; image_parts[i].name; i++) {
3512 if (!strcmp(image_parts[i].name, info->last_sysupgrade_partition)) {
3513 image_last_partition = &image_parts[i];
3514 break;
3515 }
3516 }
3517
3518 assert(image_last_partition);
3519
3520 *len = flash_last_partition->base - flash_first_partition->base + image_last_partition->size;
3521
3522 uint8_t *image = malloc(*len);
3523 if (!image)
3524 error(1, errno, "malloc");
3525
3526 memset(image, 0xff, *len);
3527
3528 for (i = flash_first_partition_index; i <= flash_last_partition_index; i++) {
3529 for (j = 0; image_parts[j].name; j++) {
3530 if (!strcmp(info->partitions[i].name, image_parts[j].name)) {
3531 if (image_parts[j].size > info->partitions[i].size)
3532 error(1, 0, "%s partition too big (more than %u bytes)", info->partitions[i].name, (unsigned)info->partitions[i].size);
3533 memcpy(image + info->partitions[i].base - flash_first_partition->base, image_parts[j].data, image_parts[j].size);
3534 break;
3535 }
3536
3537 assert(image_parts[j].name);
3538 }
3539 }
3540
3541 return image;
3542 }
3543
3544 /** Generates an image according to a given layout and writes it to a file */
3545 static void build_image(const char *output,
3546 const char *kernel_image,
3547 const char *rootfs_image,
3548 uint32_t rev,
3549 bool add_jffs2_eof,
3550 bool sysupgrade,
3551 struct device_info *info) {
3552
3553 size_t i;
3554
3555 struct image_partition_entry parts[7] = {};
3556
3557 struct flash_partition_entry *firmware_partition = NULL;
3558 struct flash_partition_entry *os_image_partition = NULL;
3559 struct flash_partition_entry *file_system_partition = NULL;
3560 size_t firmware_partition_index = 0;
3561
3562 set_partition_names(info);
3563
3564 for (i = 0; info->partitions[i].name; i++) {
3565 if (!strcmp(info->partitions[i].name, "firmware"))
3566 {
3567 firmware_partition = &info->partitions[i];
3568 firmware_partition_index = i;
3569 }
3570 }
3571
3572 if (firmware_partition)
3573 {
3574 os_image_partition = &info->partitions[firmware_partition_index];
3575 file_system_partition = &info->partitions[firmware_partition_index + 1];
3576
3577 struct stat kernel;
3578 if (stat(kernel_image, &kernel) < 0)
3579 error(1, errno, "unable to stat file `%s'", kernel_image);
3580
3581 if (kernel.st_size > firmware_partition->size)
3582 error(1, 0, "kernel overflowed firmware partition\n");
3583
3584 for (i = MAX_PARTITIONS-1; i >= firmware_partition_index + 1; i--)
3585 info->partitions[i+1] = info->partitions[i];
3586
3587 file_system_partition->name = info->partition_names.file_system;
3588
3589 file_system_partition->base = firmware_partition->base + kernel.st_size;
3590
3591 /* Align partition start to erase blocks for factory images only */
3592 if (!sysupgrade)
3593 file_system_partition->base = ALIGN(firmware_partition->base + kernel.st_size, 0x10000);
3594
3595 file_system_partition->size = firmware_partition->size - file_system_partition->base;
3596
3597 os_image_partition->name = info->partition_names.os_image;
3598
3599 os_image_partition->size = kernel.st_size;
3600 }
3601
3602 parts[0] = make_partition_table(info);
3603 parts[1] = make_soft_version(info, rev);
3604 parts[2] = make_support_list(info);
3605 parts[3] = read_file(info->partition_names.os_image, kernel_image, false, NULL);
3606 parts[4] = read_file(info->partition_names.file_system, rootfs_image, add_jffs2_eof, file_system_partition);
3607
3608
3609 /* Some devices need the extra-para partition to accept the firmware */
3610 if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||
3611 strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
3612 strcasecmp(info->id, "ARCHER-A9-V6") == 0 ||
3613 strcasecmp(info->id, "ARCHER-C2-V3") == 0 ||
3614 strcasecmp(info->id, "ARCHER-C7-V4") == 0 ||
3615 strcasecmp(info->id, "ARCHER-C7-V5") == 0 ||
3616 strcasecmp(info->id, "ARCHER-C25-V1") == 0 ||
3617 strcasecmp(info->id, "ARCHER-C59-V2") == 0 ||
3618 strcasecmp(info->id, "ARCHER-C60-V2") == 0 ||
3619 strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
3620 strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
3621 strcasecmp(info->id, "ARCHER-C6-V3") == 0 ||
3622 strcasecmp(info->id, "DECO-M4R-V4") == 0 ||
3623 strcasecmp(info->id, "MR70X") == 0 ||
3624 strcasecmp(info->id, "TLWR1043NV5") == 0) {
3625 const uint8_t extra_para[2] = {0x01, 0x00};
3626 parts[5] = make_extra_para(info, extra_para,
3627 sizeof(extra_para));
3628 } else if (strcasecmp(info->id, "ARCHER-C6-V2") == 0 ||
3629 strcasecmp(info->id, "TL-WA1201-V2") == 0) {
3630 const uint8_t extra_para[2] = {0x00, 0x01};
3631 parts[5] = make_extra_para(info, extra_para,
3632 sizeof(extra_para));
3633 } else if (strcasecmp(info->id, "ARCHER-C6-V2-US") == 0 ||
3634 strcasecmp(info->id, "EAP245-V3") == 0) {
3635 const uint8_t extra_para[2] = {0x01, 0x01};
3636 parts[5] = make_extra_para(info, extra_para,
3637 sizeof(extra_para));
3638 }
3639
3640 size_t len;
3641 void *image;
3642 if (sysupgrade)
3643 image = generate_sysupgrade_image(info, parts, &len);
3644 else
3645 image = generate_factory_image(info, parts, &len);
3646
3647 FILE *file = fopen(output, "wb");
3648 if (!file)
3649 error(1, errno, "unable to open output file");
3650
3651 if (fwrite(image, len, 1, file) != 1)
3652 error(1, 0, "unable to write output file");
3653
3654 fclose(file);
3655
3656 free(image);
3657
3658 for (i = 0; parts[i].name; i++)
3659 free_image_partition(&parts[i]);
3660 }
3661
3662 /** Usage output */
3663 static void usage(const char *argv0) {
3664 fprintf(stderr,
3665 "Usage: %s [OPTIONS...]\n"
3666 "\n"
3667 "Options:\n"
3668 " -h show this help\n"
3669 "\n"
3670 "Info about an image:\n"
3671 " -i <file> input file to read from\n"
3672 "Create a new image:\n"
3673 " -B <board> create image for the board specified with <board>\n"
3674 " -k <file> read kernel image from the file <file>\n"
3675 " -r <file> read rootfs image from the file <file>\n"
3676 " -o <file> write output to the file <file>\n"
3677 " -V <rev> sets the revision number to <rev>\n"
3678 " -j add jffs2 end-of-filesystem markers\n"
3679 " -S create sysupgrade instead of factory image\n"
3680 "Extract an old image:\n"
3681 " -x <file> extract all oem firmware partition\n"
3682 " -d <dir> destination to extract the firmware partition\n"
3683 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3684 argv0
3685 );
3686 };
3687
3688
3689 static struct device_info *find_board(const char *id)
3690 {
3691 struct device_info *board = NULL;
3692
3693 for (board = boards; board->id != NULL; board++)
3694 if (strcasecmp(id, board->id) == 0)
3695 return board;
3696
3697 return NULL;
3698 }
3699
3700 static int add_flash_partition(
3701 struct flash_partition_entry *part_list,
3702 size_t max_entries,
3703 const char *name,
3704 unsigned long base,
3705 unsigned long size)
3706 {
3707 size_t ptr;
3708 /* check if the list has a free entry */
3709 for (ptr = 0; ptr < max_entries; ptr++, part_list++) {
3710 if (part_list->name == NULL &&
3711 part_list->base == 0 &&
3712 part_list->size == 0)
3713 break;
3714 }
3715
3716 if (ptr == max_entries) {
3717 error(1, 0, "No free flash part entry available.");
3718 }
3719
3720 part_list->name = calloc(1, strlen(name) + 1);
3721 if (!part_list->name) {
3722 error(1, 0, "Unable to allocate memory");
3723 }
3724
3725 memcpy((char *)part_list->name, name, strlen(name));
3726 part_list->base = base;
3727 part_list->size = size;
3728
3729 return 0;
3730 }
3731
3732 /** read the partition table into struct flash_partition_entry */
3733 enum PARTITION_TABLE_TYPE {
3734 PARTITION_TABLE_FWUP,
3735 PARTITION_TABLE_FLASH,
3736 };
3737
3738 static int read_partition_table(
3739 FILE *file, long offset,
3740 struct flash_partition_entry *entries, size_t max_entries,
3741 int type)
3742 {
3743 char buf[SAFELOADER_PAYLOAD_TABLE_SIZE];
3744 char *ptr, *end;
3745 const char *parthdr = NULL;
3746 const char *fwuphdr = "fwup-ptn";
3747 const char *flashhdr = "partition";
3748
3749 /* TODO: search for the partition table */
3750
3751 switch(type) {
3752 case PARTITION_TABLE_FWUP:
3753 parthdr = fwuphdr;
3754 break;
3755 case PARTITION_TABLE_FLASH:
3756 parthdr = flashhdr;
3757 break;
3758 default:
3759 error(1, 0, "Invalid partition table");
3760 }
3761
3762 if (fseek(file, offset, SEEK_SET) < 0)
3763 error(1, errno, "Can not seek in the firmware");
3764
3765 if (fread(buf, sizeof(buf), 1, file) != 1)
3766 error(1, errno, "Can not read fwup-ptn from the firmware");
3767
3768 buf[sizeof(buf) - 1] = '\0';
3769
3770 /* look for the partition header */
3771 if (memcmp(buf, parthdr, strlen(parthdr)) != 0) {
3772 fprintf(stderr, "DEBUG: can not find fwuphdr\n");
3773 return 1;
3774 }
3775
3776 ptr = buf;
3777 end = buf + sizeof(buf);
3778 while ((ptr + strlen(parthdr)) < end &&
3779 memcmp(ptr, parthdr, strlen(parthdr)) == 0) {
3780 char *end_part;
3781 char *end_element;
3782
3783 char name[32] = { 0 };
3784 int name_len = 0;
3785 unsigned long base = 0;
3786 unsigned long size = 0;
3787
3788 end_part = memchr(ptr, '\n', (end - ptr));
3789 if (end_part == NULL) {
3790 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3791 break;
3792 }
3793
3794 for (int i = 0; i <= 4; i++) {
3795 if (end_part <= ptr)
3796 break;
3797
3798 end_element = memchr(ptr, 0x20, (end_part - ptr));
3799 if (end_element == NULL) {
3800 error(1, errno, "Ignoring the rest of the partition entries.");
3801 break;
3802 }
3803
3804 switch (i) {
3805 /* partition header */
3806 case 0:
3807 ptr = end_element + 1;
3808 continue;
3809 /* name */
3810 case 1:
3811 name_len = (end_element - ptr) > 31 ? 31 : (end_element - ptr);
3812 strncpy(name, ptr, name_len);
3813 name[name_len] = '\0';
3814 ptr = end_element + 1;
3815 continue;
3816
3817 /* string "base" */
3818 case 2:
3819 ptr = end_element + 1;
3820 continue;
3821
3822 /* actual base */
3823 case 3:
3824 base = strtoul(ptr, NULL, 16);
3825 ptr = end_element + 1;
3826 continue;
3827
3828 /* string "size" */
3829 case 4:
3830 ptr = end_element + 1;
3831 /* actual size. The last element doesn't have a sepeartor */
3832 size = strtoul(ptr, NULL, 16);
3833 /* the part ends with 0x09, 0x0d, 0x0a */
3834 ptr = end_part + 1;
3835 add_flash_partition(entries, max_entries, name, base, size);
3836 continue;
3837 }
3838 }
3839 }
3840
3841 return 0;
3842 }
3843
3844 static void safeloader_read_partition(FILE *input_file, size_t payload_offset,
3845 struct flash_partition_entry *entry,
3846 struct image_partition_entry *part)
3847 {
3848 size_t part_size = entry->size;
3849 void *part_data = malloc(part_size);
3850
3851 if (fseek(input_file, payload_offset, SEEK_SET))
3852 error(1, errno, "Failed to seek to partition data");
3853
3854 if (!part_data)
3855 error(1, ENOMEM, "Failed to allocate partition data");
3856
3857 if (fread(part_data, 1, part_size, input_file) < part_size)
3858 error(1, errno, "Failed to read partition data");
3859
3860 part->data = part_data;
3861 part->size = part_size;
3862 part->name = entry->name;
3863 }
3864
3865 static void safeloader_parse_image(FILE *input_file, struct safeloader_image_info *image)
3866 {
3867 static const char *HEADER_ID_CLOUD = "fw-type:Cloud";
3868 static const char *HEADER_ID_QNEW = "?NEW";
3869
3870 char buf[64];
3871
3872 if (!input_file)
3873 return;
3874
3875 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
3876
3877 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3878 error(1, errno, "Can not read image header");
3879
3880 if (memcmp(HEADER_ID_QNEW, &buf[0], strlen(HEADER_ID_QNEW)) == 0)
3881 image->type = SAFELOADER_TYPE_QNEW;
3882 else if (memcmp(HEADER_ID_CLOUD, &buf[0], strlen(HEADER_ID_CLOUD)) == 0)
3883 image->type = SAFELOADER_TYPE_CLOUD;
3884 else if (ntohl(*((uint32_t *) &buf[0])) <= SAFELOADER_HEADER_SIZE)
3885 image->type = SAFELOADER_TYPE_VENDOR;
3886 else
3887 image->type = SAFELOADER_TYPE_DEFAULT;
3888
3889 switch (image->type) {
3890 case SAFELOADER_TYPE_DEFAULT:
3891 case SAFELOADER_TYPE_VENDOR:
3892 case SAFELOADER_TYPE_CLOUD:
3893 image->payload_offset = SAFELOADER_PAYLOAD_OFFSET;
3894 break;
3895 case SAFELOADER_TYPE_QNEW:
3896 image->payload_offset = SAFELOADER_QNEW_PAYLOAD_OFFSET;
3897 break;
3898 }
3899
3900 /* Parse image partition table */
3901 read_partition_table(input_file, image->payload_offset, &image->entries[0],
3902 MAX_PARTITIONS, PARTITION_TABLE_FWUP);
3903 }
3904
3905 static void write_partition(
3906 FILE *input_file,
3907 size_t firmware_offset,
3908 struct flash_partition_entry *entry,
3909 FILE *output_file)
3910 {
3911 char buf[4096];
3912 size_t offset;
3913
3914 fseek(input_file, entry->base + firmware_offset, SEEK_SET);
3915
3916 for (offset = 0; sizeof(buf) + offset <= entry->size; offset += sizeof(buf)) {
3917 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3918 error(1, errno, "Can not read partition from input_file");
3919
3920 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
3921 error(1, errno, "Can not write partition to output_file");
3922 }
3923 /* write last chunk smaller than buffer */
3924 if (offset < entry->size) {
3925 offset = entry->size - offset;
3926 if (fread(buf, offset, 1, input_file) != 1)
3927 error(1, errno, "Can not read partition from input_file");
3928 if (fwrite(buf, offset, 1, output_file) != 1)
3929 error(1, errno, "Can not write partition to output_file");
3930 }
3931 }
3932
3933 static int extract_firmware_partition(FILE *input_file, size_t firmware_offset, struct flash_partition_entry *entry, const char *output_directory)
3934 {
3935 FILE *output_file;
3936 char output[PATH_MAX];
3937
3938 snprintf(output, PATH_MAX, "%s/%s", output_directory, entry->name);
3939 output_file = fopen(output, "wb+");
3940 if (output_file == NULL) {
3941 error(1, errno, "Can not open output file %s", output);
3942 }
3943
3944 write_partition(input_file, firmware_offset, entry, output_file);
3945
3946 fclose(output_file);
3947
3948 return 0;
3949 }
3950
3951 /** extract all partitions from the firmware file */
3952 static int extract_firmware(const char *input, const char *output_directory)
3953 {
3954 struct safeloader_image_info info = {};
3955 struct stat statbuf;
3956 FILE *input_file;
3957
3958 /* check input file */
3959 if (stat(input, &statbuf)) {
3960 error(1, errno, "Can not read input firmware %s", input);
3961 }
3962
3963 /* check if output directory exists */
3964 if (stat(output_directory, &statbuf)) {
3965 error(1, errno, "Failed to stat output directory %s", output_directory);
3966 }
3967
3968 if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
3969 error(1, errno, "Given output directory is not a directory %s", output_directory);
3970 }
3971
3972 input_file = fopen(input, "rb");
3973 safeloader_parse_image(input_file, &info);
3974
3975 for (size_t i = 0; i < MAX_PARTITIONS && info.entries[i].name; i++)
3976 extract_firmware_partition(input_file, info.payload_offset, &info.entries[i], output_directory);
3977
3978 return 0;
3979 }
3980
3981 static struct flash_partition_entry *find_partition(
3982 struct flash_partition_entry *entries, size_t max_entries,
3983 const char *name, const char *error_msg)
3984 {
3985 for (size_t i = 0; i < max_entries; i++, entries++) {
3986 if (strcmp(entries->name, name) == 0)
3987 return entries;
3988 }
3989
3990 if (error_msg) {
3991 error(1, 0, "%s", error_msg);
3992 }
3993
3994 return NULL;
3995 }
3996
3997 static int firmware_info(const char *input)
3998 {
3999 struct safeloader_image_info info = {};
4000 struct image_partition_entry part = {};
4001 struct flash_partition_entry *e;
4002 FILE *input_file;
4003
4004 input_file = fopen(input, "rb");
4005
4006 safeloader_parse_image(input_file, &info);
4007
4008 if (info.type == SAFELOADER_TYPE_VENDOR) {
4009 char buf[SAFELOADER_HEADER_SIZE] = {};
4010 uint32_t vendor_size;
4011
4012 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
4013 fread(&vendor_size, sizeof(uint32_t), 1, input_file);
4014
4015 vendor_size = ntohl(vendor_size);
4016 fread(buf, vendor_size, 1, input_file);
4017
4018 printf("Firmware vendor string:\n");
4019 fwrite(buf, strnlen(buf, vendor_size), 1, stdout);
4020 printf("\n");
4021 }
4022
4023 printf("Firmware image partitions:\n");
4024 printf("%-8s %-8s %s\n", "base", "size", "name");
4025
4026 e = &info.entries[0];
4027 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4028 printf("%08x %08x %s\n", e->base, e->size, e->name);
4029
4030 e = find_partition(&info.entries[0], MAX_PARTITIONS, "soft-version", NULL);
4031 if (e) {
4032 struct soft_version *s;
4033 unsigned int ascii_len;
4034 const uint8_t *buf;
4035 size_t data_len;
4036 bool isstr;
4037
4038 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4039 data_len = ntohl(((struct meta_header *) part.data)->length);
4040 buf = part.data + sizeof(struct meta_header);
4041
4042 /* Check for (null-terminated) string */
4043 ascii_len = 0;
4044 while (ascii_len < data_len && isascii(buf[ascii_len]))
4045 ascii_len++;
4046
4047 isstr = ascii_len == data_len;
4048
4049 printf("\n[Software version]\n");
4050 if (isstr) {
4051 fwrite(buf, strnlen((const char *) buf, data_len), 1, stdout);
4052 putchar('\n');
4053 } else if (data_len >= offsetof(struct soft_version, rev)) {
4054 s = (struct soft_version *) buf;
4055
4056 printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch);
4057 printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day);
4058 printf("Revision: %d\n", ntohl(s->rev));
4059 } else {
4060 printf("Failed to parse data\n");
4061 }
4062
4063 free_image_partition(&part);
4064 }
4065
4066 e = find_partition(&info.entries[0], MAX_PARTITIONS, "support-list", NULL);
4067 if (e) {
4068 size_t data_len;
4069
4070 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4071 data_len = ntohl(((struct meta_header *) part.data)->length);
4072
4073 printf("\n[Support list]\n");
4074 fwrite(part.data + sizeof(struct meta_header), data_len, 1, stdout);
4075 printf("\n");
4076
4077 free_image_partition(&part);
4078 }
4079
4080 e = find_partition(&info.entries[0], MAX_PARTITIONS, "partition-table", NULL);
4081 if (e) {
4082 size_t flash_table_offset = info.payload_offset + e->base + 4;
4083 struct flash_partition_entry parts[MAX_PARTITIONS] = {};
4084
4085 if (read_partition_table(input_file, flash_table_offset, parts, MAX_PARTITIONS, PARTITION_TABLE_FLASH))
4086 error(1, 0, "Error can not read the partition table (partition)");
4087
4088 printf("\n[Partition table]\n");
4089 printf("%-8s %-8s %s\n", "base", "size", "name");
4090
4091 e = &parts[0];
4092 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4093 printf("%08x %08x %s\n", e->base, e->size, e->name);
4094 }
4095
4096 fclose(input_file);
4097
4098 return 0;
4099 }
4100
4101 static void write_ff(FILE *output_file, size_t size)
4102 {
4103 char buf[4096];
4104 size_t offset;
4105
4106 memset(buf, 0xff, sizeof(buf));
4107
4108 for (offset = 0; offset + sizeof(buf) < size ; offset += sizeof(buf)) {
4109 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
4110 error(1, errno, "Can not write 0xff to output_file");
4111 }
4112
4113 /* write last chunk smaller than buffer */
4114 if (offset < size) {
4115 offset = size - offset;
4116 if (fwrite(buf, offset, 1, output_file) != 1)
4117 error(1, errno, "Can not write partition to output_file");
4118 }
4119 }
4120
4121 static void convert_firmware(const char *input, const char *output)
4122 {
4123 struct flash_partition_entry flash[MAX_PARTITIONS] = {};
4124 struct flash_partition_entry *fwup_partition_table;
4125 struct flash_partition_entry *flash_file_system;
4126 struct flash_partition_entry *fwup_file_system;
4127 struct flash_partition_entry *flash_os_image;
4128 struct flash_partition_entry *fwup_os_image;
4129 struct safeloader_image_info info = {};
4130 size_t flash_table_offset;
4131 struct stat statbuf;
4132 FILE *output_file;
4133 FILE *input_file;
4134
4135 /* check input file */
4136 if (stat(input, &statbuf)) {
4137 error(1, errno, "Can not read input firmware %s", input);
4138 }
4139
4140 input_file = fopen(input, "rb");
4141 if (!input_file)
4142 error(1, 0, "Can not open input firmware %s", input);
4143
4144 output_file = fopen(output, "wb");
4145 if (!output_file)
4146 error(1, 0, "Can not open output firmware %s", output);
4147
4148 input_file = fopen(input, "rb");
4149 safeloader_parse_image(input_file, &info);
4150
4151 fwup_os_image = find_partition(info.entries, MAX_PARTITIONS,
4152 "os-image", "Error can not find os-image partition (fwup)");
4153 fwup_file_system = find_partition(info.entries, MAX_PARTITIONS,
4154 "file-system", "Error can not find file-system partition (fwup)");
4155 fwup_partition_table = find_partition(info.entries, MAX_PARTITIONS,
4156 "partition-table", "Error can not find partition-table partition");
4157
4158 /* the flash partition table has a 0x00000004 magic haeder */
4159 flash_table_offset = info.payload_offset + fwup_partition_table->base + 4;
4160 if (read_partition_table(input_file, flash_table_offset, flash, MAX_PARTITIONS, PARTITION_TABLE_FLASH) != 0)
4161 error(1, 0, "Error can not read the partition table (flash)");
4162
4163 flash_os_image = find_partition(flash, MAX_PARTITIONS,
4164 "os-image", "Error can not find os-image partition (flash)");
4165 flash_file_system = find_partition(flash, MAX_PARTITIONS,
4166 "file-system", "Error can not find file-system partition (flash)");
4167
4168 /* write os_image to 0x0 */
4169 write_partition(input_file, info.payload_offset, fwup_os_image, output_file);
4170 write_ff(output_file, flash_os_image->size - fwup_os_image->size);
4171
4172 /* write file-system behind os_image */
4173 fseek(output_file, flash_file_system->base - flash_os_image->base, SEEK_SET);
4174 write_partition(input_file, info.payload_offset, fwup_file_system, output_file);
4175
4176 fclose(output_file);
4177 fclose(input_file);
4178 }
4179
4180 int main(int argc, char *argv[]) {
4181 const char *info_image = NULL, *board = NULL, *kernel_image = NULL, *rootfs_image = NULL, *output = NULL;
4182 const char *extract_image = NULL, *output_directory = NULL, *convert_image = NULL;
4183 bool add_jffs2_eof = false, sysupgrade = false;
4184 unsigned rev = 0;
4185 struct device_info *info;
4186 set_source_date_epoch();
4187
4188 while (true) {
4189 int c;
4190
4191 c = getopt(argc, argv, "i:B:k:r:o:V:jSh:x:d:z:");
4192 if (c == -1)
4193 break;
4194
4195 switch (c) {
4196 case 'i':
4197 info_image = optarg;
4198 break;
4199
4200 case 'B':
4201 board = optarg;
4202 break;
4203
4204 case 'k':
4205 kernel_image = optarg;
4206 break;
4207
4208 case 'r':
4209 rootfs_image = optarg;
4210 break;
4211
4212 case 'o':
4213 output = optarg;
4214 break;
4215
4216 case 'V':
4217 sscanf(optarg, "r%u", &rev);
4218 break;
4219
4220 case 'j':
4221 add_jffs2_eof = true;
4222 break;
4223
4224 case 'S':
4225 sysupgrade = true;
4226 break;
4227
4228 case 'h':
4229 usage(argv[0]);
4230 return 0;
4231
4232 case 'd':
4233 output_directory = optarg;
4234 break;
4235
4236 case 'x':
4237 extract_image = optarg;
4238 break;
4239
4240 case 'z':
4241 convert_image = optarg;
4242 break;
4243
4244 default:
4245 usage(argv[0]);
4246 return 1;
4247 }
4248 }
4249
4250 if (info_image) {
4251 firmware_info(info_image);
4252 } else if (extract_image || output_directory) {
4253 if (!extract_image)
4254 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4255 if (!output_directory)
4256 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4257 extract_firmware(extract_image, output_directory);
4258 } else if (convert_image) {
4259 if (!output)
4260 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4261 convert_firmware(convert_image, output);
4262 } else {
4263 if (!board)
4264 error(1, 0, "no board has been specified");
4265 if (!kernel_image)
4266 error(1, 0, "no kernel image has been specified");
4267 if (!rootfs_image)
4268 error(1, 0, "no rootfs image has been specified");
4269 if (!output)
4270 error(1, 0, "no output filename has been specified");
4271
4272 info = find_board(board);
4273
4274 if (info == NULL)
4275 error(1, 0, "unsupported board %s", board);
4276
4277 build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, info);
4278 }
4279
4280 return 0;
4281 }