1 // SPDX-License-Identifier: BSD-2-Clause
3 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
11 Image generation tool for the TP-LINK SafeLoader as seen on
12 TP-LINK Pharos devices (CPE210/220/510/520)
28 #include <arpa/inet.h>
30 #include <sys/types.h>
37 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
40 #define MAX_PARTITIONS 32
42 /** An image partition table entry */
43 struct image_partition_entry
{
49 /** A flash partition table entry */
50 struct flash_partition_entry
{
56 /** Flash partition names table entry */
57 struct factory_partition_names
{
58 const char *partition_table
;
61 const char *support_list
;
62 const char *file_system
;
63 const char *extra_para
;
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
{
72 PART_TRAIL_MAX
= 0xff,
73 PART_TRAIL_NONE
= 0x100
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"
81 SOFT_VER_TYPE_NUMERIC
= 0,
82 SOFT_VER_TYPE_TEXT
= 1,
85 /** Firmware layout description */
89 const char *support_list
;
90 enum partition_trail_value part_trail
;
92 enum soft_ver_type type
;
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
;
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)
111 struct __attribute__((__packed__
)) meta_header
{
116 /** The content of the soft-version structure */
117 struct __attribute__((__packed__
)) soft_version
{
119 uint8_t version_major
;
120 uint8_t version_minor
;
121 uint8_t version_patch
;
127 uint32_t compat_level
;
131 * Safeloader image type
132 * Safeloader images contain a 0x14 byte preamble with image size (big endian
133 * UINT32) and md5 checksum (16 bytes).
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.
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.
146 enum safeloader_image_type
{
147 SAFELOADER_TYPE_DEFAULT
,
148 SAFELOADER_TYPE_VENDOR
,
151 /* Internal representation of safeloader image data */
152 struct safeloader_image_info
{
153 enum safeloader_image_type type
;
154 size_t payload_offset
;
155 struct flash_partition_entry entries
[MAX_PARTITIONS
];
158 #define SAFELOADER_PREAMBLE_SIZE 0x14
159 #define SAFELOADER_HEADER_SIZE 0x1000
160 #define SAFELOADER_PAYLOAD_OFFSET (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_HEADER_SIZE)
162 #define SAFELOADER_PAYLOAD_TABLE_SIZE 0x800
164 static const uint8_t jffs2_eof_mark
[4] = {0xde, 0xad, 0xc0, 0xde};
168 Salt for the MD5 hash
170 Fortunately, TP-LINK seems to use the same salt for most devices which use
171 the new image format.
173 static const uint8_t md5_salt
[16] = {
174 0x7a, 0x2b, 0x15, 0xed,
175 0x9b, 0x98, 0x59, 0x6d,
176 0xe5, 0x04, 0xab, 0x44,
177 0xac, 0x2a, 0x9f, 0x4e,
181 /** Firmware layout table */
182 static struct device_info boards
[] = {
183 /** Firmware layout for the CPE210/220 V1 */
186 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
189 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
190 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
191 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
192 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
193 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
194 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
195 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
197 .soft_ver
= SOFT_VER_DEFAULT
,
200 {"fs-uboot", 0x00000, 0x20000},
201 {"partition-table", 0x20000, 0x02000},
202 {"default-mac", 0x30000, 0x00020},
203 {"product-info", 0x31100, 0x00100},
204 {"signature", 0x32000, 0x00400},
205 {"firmware", 0x40000, 0x770000},
206 {"soft-version", 0x7b0000, 0x00100},
207 {"support-list", 0x7b1000, 0x00400},
208 {"user-config", 0x7c0000, 0x10000},
209 {"default-config", 0x7d0000, 0x10000},
210 {"log", 0x7e0000, 0x10000},
211 {"radio", 0x7f0000, 0x10000},
215 .first_sysupgrade_partition
= "os-image",
216 .last_sysupgrade_partition
= "support-list",
219 /** Firmware layout for the CPE210 V2 */
222 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
225 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
226 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
227 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
228 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
229 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
230 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
231 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
232 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
233 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
234 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
236 .soft_ver
= SOFT_VER_DEFAULT
,
239 {"fs-uboot", 0x00000, 0x20000},
240 {"partition-table", 0x20000, 0x02000},
241 {"default-mac", 0x30000, 0x00020},
242 {"product-info", 0x31100, 0x00100},
243 {"device-info", 0x31400, 0x00400},
244 {"signature", 0x32000, 0x00400},
245 {"device-id", 0x33000, 0x00100},
246 {"firmware", 0x40000, 0x770000},
247 {"soft-version", 0x7b0000, 0x00100},
248 {"support-list", 0x7b1000, 0x01000},
249 {"user-config", 0x7c0000, 0x10000},
250 {"default-config", 0x7d0000, 0x10000},
251 {"log", 0x7e0000, 0x10000},
252 {"radio", 0x7f0000, 0x10000},
256 .first_sysupgrade_partition
= "os-image",
257 .last_sysupgrade_partition
= "support-list",
260 /** Firmware layout for the CPE210 V3 */
263 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
266 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
267 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
268 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
269 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
270 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
271 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
272 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
273 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
274 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
275 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
276 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
278 .soft_ver
= SOFT_VER_DEFAULT
,
281 {"fs-uboot", 0x00000, 0x20000},
282 {"partition-table", 0x20000, 0x01000},
283 {"default-mac", 0x30000, 0x00020},
284 {"product-info", 0x31100, 0x00100},
285 {"device-info", 0x31400, 0x00400},
286 {"signature", 0x32000, 0x00400},
287 {"device-id", 0x33000, 0x00100},
288 {"firmware", 0x40000, 0x770000},
289 {"soft-version", 0x7b0000, 0x00100},
290 {"support-list", 0x7b1000, 0x01000},
291 {"user-config", 0x7c0000, 0x10000},
292 {"default-config", 0x7d0000, 0x10000},
293 {"log", 0x7e0000, 0x10000},
294 {"radio", 0x7f0000, 0x10000},
298 .first_sysupgrade_partition
= "os-image",
299 .last_sysupgrade_partition
= "support-list",
302 /** Firmware layout for the CPE220 V2 */
305 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
308 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
309 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
310 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
311 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
312 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
313 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
314 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
315 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
316 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
317 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
319 .soft_ver
= SOFT_VER_DEFAULT
,
322 {"fs-uboot", 0x00000, 0x20000},
323 {"partition-table", 0x20000, 0x02000},
324 {"default-mac", 0x30000, 0x00020},
325 {"product-info", 0x31100, 0x00100},
326 {"signature", 0x32000, 0x00400},
327 {"firmware", 0x40000, 0x770000},
328 {"soft-version", 0x7b0000, 0x00100},
329 {"support-list", 0x7b1000, 0x00400},
330 {"user-config", 0x7c0000, 0x10000},
331 {"default-config", 0x7d0000, 0x10000},
332 {"log", 0x7e0000, 0x10000},
333 {"radio", 0x7f0000, 0x10000},
337 .first_sysupgrade_partition
= "os-image",
338 .last_sysupgrade_partition
= "support-list",
341 /** Firmware layout for the CPE220 V3 */
344 .vendor
= "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
347 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
348 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
349 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
350 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
351 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
352 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
353 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
354 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
355 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
356 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
358 .soft_ver
= SOFT_VER_DEFAULT
,
361 {"fs-uboot", 0x00000, 0x20000},
362 {"partition-table", 0x20000, 0x02000},
363 {"default-mac", 0x30000, 0x00020},
364 {"product-info", 0x31100, 0x00100},
365 {"device-info", 0x31400, 0x00400},
366 {"signature", 0x32000, 0x00400},
367 {"device-id", 0x33000, 0x00100},
368 {"firmware", 0x40000, 0x770000},
369 {"soft-version", 0x7b0000, 0x00100},
370 {"support-list", 0x7b1000, 0x01000},
371 {"user-config", 0x7c0000, 0x10000},
372 {"default-config", 0x7d0000, 0x10000},
373 {"log", 0x7e0000, 0x10000},
374 {"radio", 0x7f0000, 0x10000},
378 .first_sysupgrade_partition
= "os-image",
379 .last_sysupgrade_partition
= "support-list",
382 /** Firmware layout for the CPE510/520 V1 */
385 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
388 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
389 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
390 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
391 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
392 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
393 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
394 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
395 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
397 .soft_ver
= SOFT_VER_DEFAULT
,
400 {"fs-uboot", 0x00000, 0x20000},
401 {"partition-table", 0x20000, 0x02000},
402 {"default-mac", 0x30000, 0x00020},
403 {"product-info", 0x31100, 0x00100},
404 {"signature", 0x32000, 0x00400},
405 {"firmware", 0x40000, 0x770000},
406 {"soft-version", 0x7b0000, 0x00100},
407 {"support-list", 0x7b1000, 0x00400},
408 {"user-config", 0x7c0000, 0x10000},
409 {"default-config", 0x7d0000, 0x10000},
410 {"log", 0x7e0000, 0x10000},
411 {"radio", 0x7f0000, 0x10000},
415 .first_sysupgrade_partition
= "os-image",
416 .last_sysupgrade_partition
= "support-list",
419 /** Firmware layout for the CPE510 V2 */
422 .vendor
= "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
425 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
426 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
427 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
428 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
429 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
430 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
431 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
432 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
433 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
434 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
435 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
436 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
438 .soft_ver
= SOFT_VER_DEFAULT
,
441 {"fs-uboot", 0x00000, 0x20000},
442 {"partition-table", 0x20000, 0x02000},
443 {"default-mac", 0x30000, 0x00020},
444 {"product-info", 0x31100, 0x00100},
445 {"signature", 0x32000, 0x00400},
446 {"firmware", 0x40000, 0x770000},
447 {"soft-version", 0x7b0000, 0x00100},
448 {"support-list", 0x7b1000, 0x00400},
449 {"user-config", 0x7c0000, 0x10000},
450 {"default-config", 0x7d0000, 0x10000},
451 {"log", 0x7e0000, 0x10000},
452 {"radio", 0x7f0000, 0x10000},
456 .first_sysupgrade_partition
= "os-image",
457 .last_sysupgrade_partition
= "support-list",
460 /** Firmware layout for the CPE510 V3 */
463 .vendor
= "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
466 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
467 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
468 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
469 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
470 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
471 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
472 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
473 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
474 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
475 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
476 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
477 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
478 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
479 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
480 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
482 .soft_ver
= SOFT_VER_DEFAULT
,
485 {"fs-uboot", 0x00000, 0x20000},
486 {"partition-table", 0x20000, 0x02000},
487 {"default-mac", 0x30000, 0x00020},
488 {"product-info", 0x31100, 0x00100},
489 {"signature", 0x32000, 0x00400},
490 {"firmware", 0x40000, 0x770000},
491 {"soft-version", 0x7b0000, 0x00100},
492 {"support-list", 0x7b1000, 0x00400},
493 {"user-config", 0x7c0000, 0x10000},
494 {"default-config", 0x7d0000, 0x10000},
495 {"log", 0x7e0000, 0x10000},
496 {"radio", 0x7f0000, 0x10000},
500 .first_sysupgrade_partition
= "os-image",
501 .last_sysupgrade_partition
= "support-list",
504 /** Firmware layout for the CPE605V1 */
507 .vendor
= "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
510 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
511 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
512 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
514 .soft_ver
= SOFT_VER_DEFAULT
,
517 {"fs-uboot", 0x00000, 0x20000},
518 {"partition-table", 0x20000, 0x02000},
519 {"default-mac", 0x30000, 0x00020},
520 {"serial-number", 0x30100, 0x00020},
521 {"product-info", 0x31100, 0x00100},
522 {"device-info", 0x31400, 0x00400},
523 {"signature", 0x32000, 0x00400},
524 {"device-id", 0x33000, 0x00100},
525 {"firmware", 0x40000, 0x770000},
526 {"soft-version", 0x7b0000, 0x00100},
527 {"support-list", 0x7b1000, 0x01000},
528 {"user-config", 0x7c0000, 0x10000},
529 {"default-config", 0x7d0000, 0x10000},
530 {"log", 0x7e0000, 0x10000},
531 {"radio", 0x7f0000, 0x10000},
535 .first_sysupgrade_partition
= "os-image",
536 .last_sysupgrade_partition
= "support-list",
539 /** Firmware layout for the CPE610V1 */
542 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
545 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
546 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
547 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
548 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
549 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
550 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
551 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
552 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
553 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
554 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
556 .soft_ver
= SOFT_VER_DEFAULT
,
559 {"fs-uboot", 0x00000, 0x20000},
560 {"partition-table", 0x20000, 0x02000},
561 {"default-mac", 0x30000, 0x00020},
562 {"product-info", 0x31100, 0x00100},
563 {"signature", 0x32000, 0x00400},
564 {"firmware", 0x40000, 0x770000},
565 {"soft-version", 0x7b0000, 0x00100},
566 {"support-list", 0x7b1000, 0x00400},
567 {"user-config", 0x7c0000, 0x10000},
568 {"default-config", 0x7d0000, 0x10000},
569 {"log", 0x7e0000, 0x10000},
570 {"radio", 0x7f0000, 0x10000},
574 .first_sysupgrade_partition
= "os-image",
575 .last_sysupgrade_partition
= "support-list",
578 /** Firmware layout for the CPE610V2 */
581 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
584 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
585 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
586 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
587 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
588 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
589 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
590 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
591 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
592 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
593 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
595 .soft_ver
= SOFT_VER_DEFAULT
,
598 {"fs-uboot", 0x00000, 0x20000},
599 {"partition-table", 0x20000, 0x02000},
600 {"default-mac", 0x30000, 0x00020},
601 {"product-info", 0x31100, 0x00100},
602 {"signature", 0x32000, 0x00400},
603 {"firmware", 0x40000, 0x770000},
604 {"soft-version", 0x7b0000, 0x00100},
605 {"support-list", 0x7b1000, 0x00400},
606 {"user-config", 0x7c0000, 0x10000},
607 {"default-config", 0x7d0000, 0x10000},
608 {"log", 0x7e0000, 0x10000},
609 {"radio", 0x7f0000, 0x10000},
613 .first_sysupgrade_partition
= "os-image",
614 .last_sysupgrade_partition
= "support-list",
616 /** Firmware layout for the CPE710 V1 */
619 .vendor
= "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
622 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
623 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
624 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
625 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
626 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
627 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
629 .soft_ver
= SOFT_VER_DEFAULT
,
632 {"fs-uboot", 0x00000, 0x50000},
633 {"partition-table", 0x50000, 0x02000},
634 {"default-mac", 0x60000, 0x00020},
635 {"serial-number", 0x60100, 0x00020},
636 {"product-info", 0x61100, 0x00100},
637 {"device-info", 0x61400, 0x00400},
638 {"signature", 0x62000, 0x00400},
639 {"device-id", 0x63000, 0x00100},
640 {"firmware", 0x70000, 0xf40000},
641 {"soft-version", 0xfb0000, 0x00100},
642 {"support-list", 0xfb1000, 0x01000},
643 {"user-config", 0xfc0000, 0x10000},
644 {"default-config", 0xfd0000, 0x10000},
645 {"log", 0xfe0000, 0x10000},
646 {"radio", 0xff0000, 0x10000},
650 .first_sysupgrade_partition
= "os-image",
651 .last_sysupgrade_partition
= "support-list",
656 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
659 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
660 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
661 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
663 .soft_ver
= SOFT_VER_DEFAULT
,
666 {"fs-uboot", 0x00000, 0x20000},
667 {"partition-table", 0x20000, 0x02000},
668 {"default-mac", 0x30000, 0x00020},
669 {"product-info", 0x31100, 0x00100},
670 {"signature", 0x32000, 0x00400},
671 {"firmware", 0x40000, 0x770000},
672 {"soft-version", 0x7b0000, 0x00100},
673 {"support-list", 0x7b1000, 0x00400},
674 {"user-config", 0x7c0000, 0x10000},
675 {"default-config", 0x7d0000, 0x10000},
676 {"log", 0x7e0000, 0x10000},
677 {"radio", 0x7f0000, 0x10000},
681 .first_sysupgrade_partition
= "os-image",
682 .last_sysupgrade_partition
= "support-list",
687 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
690 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
691 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
692 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
694 .soft_ver
= SOFT_VER_DEFAULT
,
697 {"fs-uboot", 0x00000, 0x20000},
698 {"partition-table", 0x20000, 0x02000},
699 {"default-mac", 0x30000, 0x00020},
700 {"product-info", 0x31100, 0x00100},
701 {"signature", 0x32000, 0x00400},
702 {"firmware", 0x40000, 0x770000},
703 {"soft-version", 0x7b0000, 0x00100},
704 {"support-list", 0x7b1000, 0x00400},
705 {"user-config", 0x7c0000, 0x10000},
706 {"default-config", 0x7d0000, 0x10000},
707 {"log", 0x7e0000, 0x10000},
708 {"radio", 0x7f0000, 0x10000},
712 .first_sysupgrade_partition
= "os-image",
713 .last_sysupgrade_partition
= "support-list",
718 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
721 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
722 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
723 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
724 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
726 .soft_ver
= SOFT_VER_DEFAULT
,
729 {"fs-uboot", 0x00000, 0x20000},
730 {"partition-table", 0x20000, 0x02000},
731 {"default-mac", 0x30000, 0x00020},
732 {"product-info", 0x31100, 0x00100},
733 {"signature", 0x32000, 0x00400},
734 {"firmware", 0x40000, 0x770000},
735 {"soft-version", 0x7b0000, 0x00100},
736 {"support-list", 0x7b1000, 0x00400},
737 {"user-config", 0x7c0000, 0x10000},
738 {"default-config", 0x7d0000, 0x10000},
739 {"log", 0x7e0000, 0x10000},
740 {"radio", 0x7f0000, 0x10000},
744 .first_sysupgrade_partition
= "os-image",
745 .last_sysupgrade_partition
= "support-list",
750 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
753 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
754 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
755 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
756 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
758 .soft_ver
= SOFT_VER_DEFAULT
,
761 {"fs-uboot", 0x00000, 0x20000},
762 {"partition-table", 0x20000, 0x02000},
763 {"default-mac", 0x30000, 0x00020},
764 {"product-info", 0x31100, 0x00100},
765 {"signature", 0x32000, 0x00400},
766 {"firmware", 0x40000, 0x770000},
767 {"soft-version", 0x7b0000, 0x00100},
768 {"support-list", 0x7b1000, 0x00400},
769 {"user-config", 0x7c0000, 0x10000},
770 {"default-config", 0x7d0000, 0x10000},
771 {"log", 0x7e0000, 0x10000},
772 {"radio", 0x7f0000, 0x10000},
776 .first_sysupgrade_partition
= "os-image",
777 .last_sysupgrade_partition
= "support-list",
780 /** Firmware layout for the AD7200 */
786 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
788 .soft_ver
= SOFT_VER_DEFAULT
,
791 {"SBL1", 0x00000, 0x20000},
792 {"MIBIB", 0x20000, 0x20000},
793 {"SBL2", 0x40000, 0x20000},
794 {"SBL3", 0x60000, 0x30000},
795 {"DDRCONFIG", 0x90000, 0x10000},
796 {"SSD", 0xa0000, 0x10000},
797 {"TZ", 0xb0000, 0x30000},
798 {"RPM", 0xe0000, 0x20000},
799 {"fs-uboot", 0x100000, 0x70000},
800 {"uboot-env", 0x170000, 0x40000},
801 {"radio", 0x1b0000, 0x40000},
802 {"os-image", 0x1f0000, 0x400000},
803 {"file-system", 0x5f0000, 0x1900000},
804 {"default-mac", 0x1ef0000, 0x00200},
805 {"pin", 0x1ef0200, 0x00200},
806 {"device-id", 0x1ef0400, 0x00200},
807 {"product-info", 0x1ef0600, 0x0fa00},
808 {"partition-table", 0x1f00000, 0x10000},
809 {"soft-version", 0x1f10000, 0x10000},
810 {"support-list", 0x1f20000, 0x10000},
811 {"profile", 0x1f30000, 0x10000},
812 {"default-config", 0x1f40000, 0x10000},
813 {"user-config", 0x1f50000, 0x40000},
814 {"qos-db", 0x1f90000, 0x40000},
815 {"usb-config", 0x1fd0000, 0x10000},
816 {"log", 0x1fe0000, 0x20000},
820 .first_sysupgrade_partition
= "os-image",
821 .last_sysupgrade_partition
= "file-system"
824 /** Firmware layout for the C2600 */
830 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
832 .soft_ver
= SOFT_VER_DEFAULT
,
835 We use a bigger os-image partition than the stock images (and thus
836 smaller file-system), as our kernel doesn't fit in the stock firmware's
837 2 MB os-image since kernel 4.14.
840 {"SBL1", 0x00000, 0x20000},
841 {"MIBIB", 0x20000, 0x20000},
842 {"SBL2", 0x40000, 0x20000},
843 {"SBL3", 0x60000, 0x30000},
844 {"DDRCONFIG", 0x90000, 0x10000},
845 {"SSD", 0xa0000, 0x10000},
846 {"TZ", 0xb0000, 0x30000},
847 {"RPM", 0xe0000, 0x20000},
848 {"fs-uboot", 0x100000, 0x70000},
849 {"uboot-env", 0x170000, 0x40000},
850 {"radio", 0x1b0000, 0x40000},
851 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
852 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
853 {"default-mac", 0x1ef0000, 0x00200},
854 {"pin", 0x1ef0200, 0x00200},
855 {"product-info", 0x1ef0400, 0x0fc00},
856 {"partition-table", 0x1f00000, 0x10000},
857 {"soft-version", 0x1f10000, 0x10000},
858 {"support-list", 0x1f20000, 0x10000},
859 {"profile", 0x1f30000, 0x10000},
860 {"default-config", 0x1f40000, 0x10000},
861 {"user-config", 0x1f50000, 0x40000},
862 {"qos-db", 0x1f90000, 0x40000},
863 {"usb-config", 0x1fd0000, 0x10000},
864 {"log", 0x1fe0000, 0x20000},
868 .first_sysupgrade_partition
= "os-image",
869 .last_sysupgrade_partition
= "file-system"
872 /** Firmware layout for the A7-V5 */
874 .id
= "ARCHER-A7-V5",
877 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
878 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
879 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
880 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
881 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
882 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
884 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
886 /* We're using a dynamic kernel/rootfs split here */
888 {"factory-boot", 0x00000, 0x20000},
889 {"fs-uboot", 0x20000, 0x20000},
890 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
891 /* Stock: name file-system base 0x160000 size 0xda0000 */
892 {"default-mac", 0xf40000, 0x00200},
893 {"pin", 0xf40200, 0x00200},
894 {"device-id", 0xf40400, 0x00100},
895 {"product-info", 0xf40500, 0x0fb00},
896 {"soft-version", 0xf50000, 0x00100},
897 {"extra-para", 0xf51000, 0x01000},
898 {"support-list", 0xf52000, 0x0a000},
899 {"profile", 0xf5c000, 0x04000},
900 {"default-config", 0xf60000, 0x10000},
901 {"user-config", 0xf70000, 0x40000},
902 {"certificate", 0xfb0000, 0x10000},
903 {"partition-table", 0xfc0000, 0x10000},
904 {"log", 0xfd0000, 0x20000},
905 {"radio", 0xff0000, 0x10000},
909 .first_sysupgrade_partition
= "os-image",
910 .last_sysupgrade_partition
= "file-system",
913 /** Firmware layout for the Archer A9 v6 */
915 .id
= "ARCHER-A9-V6",
918 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
919 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
920 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
921 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
922 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
924 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
926 /* We're using a dynamic kernel/rootfs split here */
928 {"factory-boot", 0x00000, 0x20000},
929 {"fs-uboot", 0x20000, 0x20000},
930 {"partition-table", 0x40000, 0x10000},
931 {"radio", 0x50000, 0x10000},
932 {"default-mac", 0x60000, 0x00200},
933 {"pin", 0x60200, 0x00200},
934 {"device-id", 0x60400, 0x00100},
935 {"product-info", 0x60500, 0x0fb00},
936 {"soft-version", 0x70000, 0x01000},
937 {"extra-para", 0x71000, 0x01000},
938 {"support-list", 0x72000, 0x0a000},
939 {"profile", 0x7c000, 0x04000},
940 {"user-config", 0x80000, 0x10000},
941 {"ap-config", 0x90000, 0x10000},
942 {"apdef-config", 0xa0000, 0x10000},
943 {"router-config", 0xb0000, 0x10000},
944 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
945 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
946 {"log", 0xfc0000, 0x20000},
947 {"certificate", 0xfe0000, 0x10000},
948 {"default-config", 0xff0000, 0x10000},
952 .first_sysupgrade_partition
= "os-image",
953 .last_sysupgrade_partition
= "file-system",
956 /** Firmware layout for the C2v3 */
958 .id
= "ARCHER-C2-V3",
961 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
962 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
963 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
965 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.1\n"),
967 /** We're using a dynamic kernel/rootfs split here */
970 {"factory-boot", 0x00000, 0x20000},
971 {"fs-uboot", 0x20000, 0x10000},
972 {"firmware", 0x30000, 0x7a0000},
973 {"user-config", 0x7d0000, 0x04000},
974 {"default-mac", 0x7e0000, 0x00100},
975 {"device-id", 0x7e0100, 0x00100},
976 {"extra-para", 0x7e0200, 0x00100},
977 {"pin", 0x7e0300, 0x00100},
978 {"support-list", 0x7e0400, 0x00400},
979 {"soft-version", 0x7e0800, 0x00400},
980 {"product-info", 0x7e0c00, 0x01400},
981 {"partition-table", 0x7e2000, 0x01000},
982 {"profile", 0x7e3000, 0x01000},
983 {"default-config", 0x7e4000, 0x04000},
984 {"merge-config", 0x7ec000, 0x02000},
985 {"qos-db", 0x7ee000, 0x02000},
986 {"radio", 0x7f0000, 0x10000},
990 .first_sysupgrade_partition
= "os-image",
991 .last_sysupgrade_partition
= "file-system",
994 /** Firmware layout for the C25v1 */
996 .id
= "ARCHER-C25-V1",
999 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1000 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1001 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1003 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1005 /* We're using a dynamic kernel/rootfs split here */
1007 {"factory-boot", 0x00000, 0x20000},
1008 {"fs-uboot", 0x20000, 0x10000},
1009 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1010 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1011 {"user-config", 0x7d0000, 0x04000},
1012 {"default-mac", 0x7e0000, 0x00100},
1013 {"device-id", 0x7e0100, 0x00100},
1014 {"extra-para", 0x7e0200, 0x00100},
1015 {"pin", 0x7e0300, 0x00100},
1016 {"support-list", 0x7e0400, 0x00400},
1017 {"soft-version", 0x7e0800, 0x00400},
1018 {"product-info", 0x7e0c00, 0x01400},
1019 {"partition-table", 0x7e2000, 0x01000},
1020 {"profile", 0x7e3000, 0x01000},
1021 {"default-config", 0x7e4000, 0x04000},
1022 {"merge-config", 0x7ec000, 0x02000},
1023 {"qos-db", 0x7ee000, 0x02000},
1024 {"radio", 0x7f0000, 0x10000},
1028 .first_sysupgrade_partition
= "os-image",
1029 .last_sysupgrade_partition
= "file-system",
1032 /** Firmware layout for the C58v1 */
1034 .id
= "ARCHER-C58-V1",
1038 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1039 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1040 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1042 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1045 {"fs-uboot", 0x00000, 0x10000},
1046 {"default-mac", 0x10000, 0x00200},
1047 {"pin", 0x10200, 0x00200},
1048 {"product-info", 0x10400, 0x00100},
1049 {"partition-table", 0x10500, 0x00800},
1050 {"soft-version", 0x11300, 0x00200},
1051 {"support-list", 0x11500, 0x00100},
1052 {"device-id", 0x11600, 0x00100},
1053 {"profile", 0x11700, 0x03900},
1054 {"default-config", 0x15000, 0x04000},
1055 {"user-config", 0x19000, 0x04000},
1056 {"firmware", 0x20000, 0x7c8000},
1057 {"certyficate", 0x7e8000, 0x08000},
1058 {"radio", 0x7f0000, 0x10000},
1062 .first_sysupgrade_partition
= "os-image",
1063 .last_sysupgrade_partition
= "file-system",
1066 /** Firmware layout for the C59v1 */
1068 .id
= "ARCHER-C59-V1",
1072 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1073 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1074 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1075 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1077 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1079 /* We're using a dynamic kernel/rootfs split here */
1081 {"fs-uboot", 0x00000, 0x10000},
1082 {"default-mac", 0x10000, 0x00200},
1083 {"pin", 0x10200, 0x00200},
1084 {"device-id", 0x10400, 0x00100},
1085 {"product-info", 0x10500, 0x0fb00},
1086 {"firmware", 0x20000, 0xe30000},
1087 {"partition-table", 0xe50000, 0x10000},
1088 {"soft-version", 0xe60000, 0x10000},
1089 {"support-list", 0xe70000, 0x10000},
1090 {"profile", 0xe80000, 0x10000},
1091 {"default-config", 0xe90000, 0x10000},
1092 {"user-config", 0xea0000, 0x40000},
1093 {"usb-config", 0xee0000, 0x10000},
1094 {"certificate", 0xef0000, 0x10000},
1095 {"qos-db", 0xf00000, 0x40000},
1096 {"log", 0xfe0000, 0x10000},
1097 {"radio", 0xff0000, 0x10000},
1101 .first_sysupgrade_partition
= "os-image",
1102 .last_sysupgrade_partition
= "file-system",
1105 /** Firmware layout for the C59v2 */
1107 .id
= "ARCHER-C59-V2",
1111 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1112 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1113 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1115 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1117 /** We're using a dynamic kernel/rootfs split here */
1119 {"factory-boot", 0x00000, 0x20000},
1120 {"fs-uboot", 0x20000, 0x10000},
1121 {"default-mac", 0x30000, 0x00200},
1122 {"pin", 0x30200, 0x00200},
1123 {"device-id", 0x30400, 0x00100},
1124 {"product-info", 0x30500, 0x0fb00},
1125 {"firmware", 0x40000, 0xe10000},
1126 {"partition-table", 0xe50000, 0x10000},
1127 {"soft-version", 0xe60000, 0x10000},
1128 {"support-list", 0xe70000, 0x10000},
1129 {"profile", 0xe80000, 0x10000},
1130 {"default-config", 0xe90000, 0x10000},
1131 {"user-config", 0xea0000, 0x40000},
1132 {"usb-config", 0xee0000, 0x10000},
1133 {"certificate", 0xef0000, 0x10000},
1134 {"extra-para", 0xf00000, 0x10000},
1135 {"qos-db", 0xf10000, 0x30000},
1136 {"log", 0xfe0000, 0x10000},
1137 {"radio", 0xff0000, 0x10000},
1141 .first_sysupgrade_partition
= "os-image",
1142 .last_sysupgrade_partition
= "file-system",
1145 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1147 .id
= "ARCHER-C6-V2",
1151 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1152 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1153 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1154 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1156 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1159 {"fs-uboot", 0x00000, 0x20000},
1160 {"default-mac", 0x20000, 0x00200},
1161 {"pin", 0x20200, 0x00100},
1162 {"product-info", 0x20300, 0x00200},
1163 {"device-id", 0x20500, 0x0fb00},
1164 {"firmware", 0x30000, 0x7a9400},
1165 {"soft-version", 0x7d9400, 0x00100},
1166 {"extra-para", 0x7d9500, 0x00100},
1167 {"support-list", 0x7d9600, 0x00200},
1168 {"profile", 0x7d9800, 0x03000},
1169 {"default-config", 0x7dc800, 0x03000},
1170 {"partition-table", 0x7df800, 0x00800},
1171 {"user-config", 0x7e0000, 0x0c000},
1172 {"certificate", 0x7ec000, 0x04000},
1173 {"radio", 0x7f0000, 0x10000},
1177 .first_sysupgrade_partition
= "os-image",
1178 .last_sysupgrade_partition
= "file-system",
1181 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1183 .id
= "ARCHER-C6-V2-US",
1187 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1188 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1189 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1191 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1194 {"factory-boot", 0x00000, 0x20000},
1195 {"default-mac", 0x20000, 0x00200},
1196 {"pin", 0x20200, 0x00100},
1197 {"product-info", 0x20300, 0x00200},
1198 {"device-id", 0x20500, 0x0fb00},
1199 {"fs-uboot", 0x30000, 0x20000},
1200 {"firmware", 0x50000, 0xf89400},
1201 {"soft-version", 0xfd9400, 0x00100},
1202 {"extra-para", 0xfd9500, 0x00100},
1203 {"support-list", 0xfd9600, 0x00200},
1204 {"profile", 0xfd9800, 0x03000},
1205 {"default-config", 0xfdc800, 0x03000},
1206 {"partition-table", 0xfdf800, 0x00800},
1207 {"user-config", 0xfe0000, 0x0c000},
1208 {"certificate", 0xfec000, 0x04000},
1209 {"radio", 0xff0000, 0x10000},
1212 .first_sysupgrade_partition
= "os-image",
1213 .last_sysupgrade_partition
= "file-system",
1215 /** Firmware layout for the Archer C6 v3 */
1217 .id
= "ARCHER-C6-V3",
1221 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1222 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1223 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1224 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1225 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1226 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1228 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1231 {"fs-uboot", 0x00000, 0x40000},
1232 {"firmware", 0x40000, 0xf60000},
1233 {"default-mac", 0xfa0000, 0x00200},
1234 {"pin", 0xfa0200, 0x00100},
1235 {"device-id", 0xfa0300, 0x00100},
1236 {"product-info", 0xfa0400, 0x0fc00},
1237 {"default-config", 0xfb0000, 0x08000},
1238 {"ap-def-config", 0xfb8000, 0x08000},
1239 {"user-config", 0xfc0000, 0x0a000},
1240 {"ag-config", 0xfca000, 0x04000},
1241 {"certificate", 0xfce000, 0x02000},
1242 {"ap-config", 0xfd0000, 0x06000},
1243 {"router-config", 0xfd6000, 0x06000},
1244 {"favicon", 0xfdc000, 0x02000},
1245 {"logo", 0xfde000, 0x02000},
1246 {"partition-table", 0xfe0000, 0x00800},
1247 {"soft-version", 0xfe0800, 0x00100},
1248 {"support-list", 0xfe0900, 0x00200},
1249 {"profile", 0xfe0b00, 0x03000},
1250 {"extra-para", 0xfe3b00, 0x00100},
1251 {"radio", 0xff0000, 0x10000},
1254 .first_sysupgrade_partition
= "os-image",
1255 .last_sysupgrade_partition
= "file-system",
1257 /** Firmware layout for the Archer A6 v3 */
1259 .id
= "ARCHER-A6-V3",
1263 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1264 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1265 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1266 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1268 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1271 {"fs-uboot", 0x00000, 0x40000},
1272 {"firmware", 0x40000, 0xf60000},
1273 {"default-mac", 0xfa0000, 0x00200},
1274 {"pin", 0xfa0200, 0x00100},
1275 {"device-id", 0xfa0300, 0x00100},
1276 {"product-info", 0xfa0400, 0x0fc00},
1277 {"default-config", 0xfb0000, 0x08000},
1278 {"ap-def-config", 0xfb8000, 0x08000},
1279 {"user-config", 0xfc0000, 0x0a000},
1280 {"ag-config", 0xfca000, 0x04000},
1281 {"certificate", 0xfce000, 0x02000},
1282 {"ap-config", 0xfd0000, 0x06000},
1283 {"router-config", 0xfd6000, 0x06000},
1284 {"favicon", 0xfdc000, 0x02000},
1285 {"logo", 0xfde000, 0x02000},
1286 {"partition-table", 0xfe0000, 0x00800},
1287 {"soft-version", 0xfe0800, 0x00100},
1288 {"support-list", 0xfe0900, 0x00200},
1289 {"profile", 0xfe0b00, 0x03000},
1290 {"extra-para", 0xfe3b00, 0x00100},
1291 {"radio", 0xff0000, 0x10000},
1294 .first_sysupgrade_partition
= "os-image",
1295 .last_sysupgrade_partition
= "file-system",
1297 /** Firmware layout for the Archer C6U v1 */
1299 .id
= "ARCHER-C6U-V1",
1303 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1305 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1308 {"fs-uboot", 0x00000, 0x40000},
1309 {"firmware", 0x40000, 0xf60000},
1310 {"default-mac", 0xfa0000, 0x00200},
1311 {"pin", 0xfa0200, 0x00100},
1312 {"device-id", 0xfa0300, 0x00100},
1313 {"product-info", 0xfa0400, 0x0fc00},
1314 {"default-config", 0xfb0000, 0x08000},
1315 {"ap-def-config", 0xfb8000, 0x08000},
1316 {"user-config", 0xfc0000, 0x0c000},
1317 {"certificate", 0xfcc000, 0x04000},
1318 {"ap-config", 0xfd0000, 0x08000},
1319 {"router-config", 0xfd8000, 0x08000},
1320 {"partition-table", 0xfe0000, 0x00800},
1321 {"soft-version", 0xfe0800, 0x00100},
1322 {"support-list", 0xfe0900, 0x00200},
1323 {"profile", 0xfe0b00, 0x03000},
1324 {"extra-para", 0xfe3b00, 0x00100},
1325 {"radio", 0xff0000, 0x10000},
1328 .first_sysupgrade_partition
= "os-image",
1329 .last_sysupgrade_partition
= "file-system",
1331 /** Firmware layout for the C60v1 */
1333 .id
= "ARCHER-C60-V1",
1337 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1338 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1339 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1341 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1344 {"fs-uboot", 0x00000, 0x10000},
1345 {"default-mac", 0x10000, 0x00200},
1346 {"pin", 0x10200, 0x00200},
1347 {"product-info", 0x10400, 0x00100},
1348 {"partition-table", 0x10500, 0x00800},
1349 {"soft-version", 0x11300, 0x00200},
1350 {"support-list", 0x11500, 0x00100},
1351 {"device-id", 0x11600, 0x00100},
1352 {"profile", 0x11700, 0x03900},
1353 {"default-config", 0x15000, 0x04000},
1354 {"user-config", 0x19000, 0x04000},
1355 {"firmware", 0x20000, 0x7c8000},
1356 {"certyficate", 0x7e8000, 0x08000},
1357 {"radio", 0x7f0000, 0x10000},
1361 .first_sysupgrade_partition
= "os-image",
1362 .last_sysupgrade_partition
= "file-system",
1365 /** Firmware layout for the C60v2 */
1367 .id
= "ARCHER-C60-V2",
1371 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1372 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1373 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1375 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1378 {"factory-boot", 0x00000, 0x1fb00},
1379 {"default-mac", 0x1fb00, 0x00200},
1380 {"pin", 0x1fd00, 0x00100},
1381 {"product-info", 0x1fe00, 0x00100},
1382 {"device-id", 0x1ff00, 0x00100},
1383 {"fs-uboot", 0x20000, 0x10000},
1384 {"firmware", 0x30000, 0x7a0000},
1385 {"soft-version", 0x7d9500, 0x00100},
1386 {"support-list", 0x7d9600, 0x00100},
1387 {"extra-para", 0x7d9700, 0x00100},
1388 {"profile", 0x7d9800, 0x03000},
1389 {"default-config", 0x7dc800, 0x03000},
1390 {"partition-table", 0x7df800, 0x00800},
1391 {"user-config", 0x7e0000, 0x0c000},
1392 {"certificate", 0x7ec000, 0x04000},
1393 {"radio", 0x7f0000, 0x10000},
1397 .first_sysupgrade_partition
= "os-image",
1398 .last_sysupgrade_partition
= "file-system",
1401 /** Firmware layout for the C60v3 */
1403 .id
= "ARCHER-C60-V3",
1407 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1408 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1409 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1411 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1414 {"factory-boot", 0x00000, 0x1fb00},
1415 {"default-mac", 0x1fb00, 0x00200},
1416 {"pin", 0x1fd00, 0x00100},
1417 {"product-info", 0x1fe00, 0x00100},
1418 {"device-id", 0x1ff00, 0x00100},
1419 {"fs-uboot", 0x20000, 0x10000},
1420 {"firmware", 0x30000, 0x7a0000},
1421 {"soft-version", 0x7d9500, 0x00100},
1422 {"support-list", 0x7d9600, 0x00100},
1423 {"extra-para", 0x7d9700, 0x00100},
1424 {"profile", 0x7d9800, 0x03000},
1425 {"default-config", 0x7dc800, 0x03000},
1426 {"partition-table", 0x7df800, 0x00800},
1427 {"user-config", 0x7e0000, 0x0c000},
1428 {"certificate", 0x7ec000, 0x04000},
1429 {"radio", 0x7f0000, 0x10000},
1433 .first_sysupgrade_partition
= "os-image",
1434 .last_sysupgrade_partition
= "file-system",
1437 /** Firmware layout for the C5 */
1439 .id
= "ARCHER-C5-V2",
1443 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1444 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1445 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1447 .soft_ver
= SOFT_VER_DEFAULT
,
1450 {"fs-uboot", 0x00000, 0x40000},
1451 {"os-image", 0x40000, 0x200000},
1452 {"file-system", 0x240000, 0xc00000},
1453 {"default-mac", 0xe40000, 0x00200},
1454 {"pin", 0xe40200, 0x00200},
1455 {"product-info", 0xe40400, 0x00200},
1456 {"partition-table", 0xe50000, 0x10000},
1457 {"soft-version", 0xe60000, 0x00200},
1458 {"support-list", 0xe61000, 0x0f000},
1459 {"profile", 0xe70000, 0x10000},
1460 {"default-config", 0xe80000, 0x10000},
1461 {"user-config", 0xe90000, 0x50000},
1462 {"log", 0xee0000, 0x100000},
1463 {"radio_bk", 0xfe0000, 0x10000},
1464 {"radio", 0xff0000, 0x10000},
1468 .first_sysupgrade_partition
= "os-image",
1469 .last_sysupgrade_partition
= "file-system"
1472 /** Firmware layout for the C7 */
1474 .id
= "ARCHER-C7-V4",
1477 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1478 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1479 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1480 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1481 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1482 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1483 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1484 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1485 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1486 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1488 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1490 /* We're using a dynamic kernel/rootfs split here */
1492 {"factory-boot", 0x00000, 0x20000},
1493 {"fs-uboot", 0x20000, 0x20000},
1494 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1495 /* Stock: name file-system base 0x160000 size 0xda0000 */
1496 {"default-mac", 0xf00000, 0x00200},
1497 {"pin", 0xf00200, 0x00200},
1498 {"device-id", 0xf00400, 0x00100},
1499 {"product-info", 0xf00500, 0x0fb00},
1500 {"soft-version", 0xf10000, 0x00100},
1501 {"extra-para", 0xf11000, 0x01000},
1502 {"support-list", 0xf12000, 0x0a000},
1503 {"profile", 0xf1c000, 0x04000},
1504 {"default-config", 0xf20000, 0x10000},
1505 {"user-config", 0xf30000, 0x40000},
1506 {"qos-db", 0xf70000, 0x40000},
1507 {"certificate", 0xfb0000, 0x10000},
1508 {"partition-table", 0xfc0000, 0x10000},
1509 {"log", 0xfd0000, 0x20000},
1510 {"radio", 0xff0000, 0x10000},
1514 .first_sysupgrade_partition
= "os-image",
1515 .last_sysupgrade_partition
= "file-system",
1518 /** Firmware layout for the C7 v5*/
1520 .id
= "ARCHER-C7-V5",
1523 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1524 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1525 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1526 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1527 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1528 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1529 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1530 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1533 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1535 /* We're using a dynamic kernel/rootfs split here */
1537 {"factory-boot", 0x00000, 0x20000},
1538 {"fs-uboot", 0x20000, 0x20000},
1539 {"partition-table", 0x40000, 0x10000},
1540 {"radio", 0x50000, 0x10000},
1541 {"default-mac", 0x60000, 0x00200},
1542 {"pin", 0x60200, 0x00200},
1543 {"device-id", 0x60400, 0x00100},
1544 {"product-info", 0x60500, 0x0fb00},
1545 {"soft-version", 0x70000, 0x01000},
1546 {"extra-para", 0x71000, 0x01000},
1547 {"support-list", 0x72000, 0x0a000},
1548 {"profile", 0x7c000, 0x04000},
1549 {"user-config", 0x80000, 0x40000},
1552 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1553 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1555 {"log", 0xfc0000, 0x20000},
1556 {"certificate", 0xfe0000, 0x10000},
1557 {"default-config", 0xff0000, 0x10000},
1562 .first_sysupgrade_partition
= "os-image",
1563 .last_sysupgrade_partition
= "file-system",
1566 /** Firmware layout for the C9 */
1572 "{product_name:ArcherC9,"
1573 "product_ver:1.0.0,"
1574 "special_id:00000000}\n",
1576 .soft_ver
= SOFT_VER_DEFAULT
,
1579 {"fs-uboot", 0x00000, 0x40000},
1580 {"os-image", 0x40000, 0x200000},
1581 {"file-system", 0x240000, 0xc00000},
1582 {"default-mac", 0xe40000, 0x00200},
1583 {"pin", 0xe40200, 0x00200},
1584 {"product-info", 0xe40400, 0x00200},
1585 {"partition-table", 0xe50000, 0x10000},
1586 {"soft-version", 0xe60000, 0x00200},
1587 {"support-list", 0xe61000, 0x0f000},
1588 {"profile", 0xe70000, 0x10000},
1589 {"default-config", 0xe80000, 0x10000},
1590 {"user-config", 0xe90000, 0x50000},
1591 {"log", 0xee0000, 0x100000},
1592 {"radio_bk", 0xfe0000, 0x10000},
1593 {"radio", 0xff0000, 0x10000},
1597 .first_sysupgrade_partition
= "os-image",
1598 .last_sysupgrade_partition
= "file-system"
1601 /** Firmware layout for the Deco M4R v1 and v2 */
1603 .id
= "DECO-M4R-V1",
1607 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1608 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1609 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1610 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1611 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1612 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1613 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1614 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1615 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1616 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1617 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1618 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1619 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1620 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1621 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1622 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1624 .soft_ver
= SOFT_VER_DEFAULT
,
1627 {"fs-uboot", 0x00000, 0x80000},
1628 {"firmware", 0x80000, 0xe00000},
1629 {"product-info", 0xe80000, 0x05000},
1630 {"default-mac", 0xe85000, 0x01000},
1631 {"device-id", 0xe86000, 0x01000},
1632 {"support-list", 0xe87000, 0x10000},
1633 {"user-config", 0xea7000, 0x10000},
1634 {"device-config", 0xeb7000, 0x10000},
1635 {"group-info", 0xec7000, 0x10000},
1636 {"partition-table", 0xed7000, 0x02000},
1637 {"soft-version", 0xed9000, 0x10000},
1638 {"profile", 0xee9000, 0x10000},
1639 {"default-config", 0xef9000, 0x10000},
1640 {"url-sig", 0xfe0000, 0x10000},
1641 {"radio", 0xff0000, 0x10000},
1644 .first_sysupgrade_partition
= "os-image",
1645 .last_sysupgrade_partition
= "file-system",
1648 /** Firmware layout for the Deco M4R v4 */
1650 .id
= "DECO-M4R-V4",
1654 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1655 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1656 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1657 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1658 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1660 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1663 {"fs-uboot", 0x00000, 0x40000},
1664 {"firmware", 0x40000, 0xf60000},
1665 {"default-mac", 0xfa0000, 0x00300},
1666 {"device-id", 0xfa0300, 0x00100},
1667 {"product-info", 0xfa0400, 0x0fc00},
1668 {"group-info", 0xfb0000, 0x04000},
1669 {"user-config", 0xfb4000, 0x0c000},
1670 {"device-config", 0xfc0000, 0x10000},
1671 {"default-config", 0xfd0000, 0x10000},
1672 {"partition-table", 0xfe0000, 0x00800},
1673 {"soft-version", 0xfe0800, 0x00100},
1674 {"support-list", 0xfe0900, 0x00200},
1675 {"profile", 0xfe0b00, 0x03000},
1676 {"extra-para", 0xfe3b00, 0x00100},
1677 {"radio", 0xff0000, 0x10000},
1680 .first_sysupgrade_partition
= "os-image",
1681 .last_sysupgrade_partition
= "file-system",
1684 /** Firmware layout for the Deco S4 v2 */
1690 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1691 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1692 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1693 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1694 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1695 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1696 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1697 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1698 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1699 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1700 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1701 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1703 .soft_ver
= SOFT_VER_DEFAULT
,
1706 {"fs-uboot", 0x00000, 0x80000},
1707 {"product-info", 0x80000, 0x05000},
1708 {"default-mac", 0x85000, 0x01000},
1709 {"device-id", 0x86000, 0x01000},
1710 {"support-list", 0x87000, 0x10000},
1711 {"user-config", 0xa7000, 0x10000},
1712 {"device-config", 0xb7000, 0x10000},
1713 {"group-info", 0xc7000, 0x10000},
1714 {"partition-table", 0xd7000, 0x02000},
1715 {"soft-version", 0xd9000, 0x10000},
1716 {"profile", 0xe9000, 0x10000},
1717 {"default-config", 0xf9000, 0x10000},
1718 {"url-sig", 0x1e0000, 0x10000},
1719 {"radio", 0x1f0000, 0x10000},
1720 {"firmware", 0x200000, 0xe00000},
1723 .first_sysupgrade_partition
= "os-image",
1724 .last_sysupgrade_partition
= "file-system",
1727 /** Firmware layout for the EAP120 */
1730 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1733 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1735 .soft_ver
= SOFT_VER_DEFAULT
,
1738 {"fs-uboot", 0x00000, 0x20000},
1739 {"partition-table", 0x20000, 0x02000},
1740 {"default-mac", 0x30000, 0x00020},
1741 {"support-list", 0x31000, 0x00100},
1742 {"product-info", 0x31100, 0x00100},
1743 {"soft-version", 0x32000, 0x00100},
1744 {"os-image", 0x40000, 0x180000},
1745 {"file-system", 0x1c0000, 0x600000},
1746 {"user-config", 0x7c0000, 0x10000},
1747 {"backup-config", 0x7d0000, 0x10000},
1748 {"log", 0x7e0000, 0x10000},
1749 {"radio", 0x7f0000, 0x10000},
1753 .first_sysupgrade_partition
= "os-image",
1754 .last_sysupgrade_partition
= "file-system"
1757 /** Firmware layout for the EAP225-Outdoor v1 */
1759 .id
= "EAP225-OUTDOOR-V1",
1762 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1763 .part_trail
= PART_TRAIL_NONE
,
1764 .soft_ver
= SOFT_VER_DEFAULT
,
1765 .soft_ver_compat_level
= 1,
1768 {"fs-uboot", 0x00000, 0x20000},
1769 {"partition-table", 0x20000, 0x02000},
1770 {"default-mac", 0x30000, 0x01000},
1771 {"support-list", 0x31000, 0x00100},
1772 {"product-info", 0x31100, 0x00400},
1773 {"soft-version", 0x32000, 0x00100},
1774 {"firmware", 0x40000, 0xd80000},
1775 {"user-config", 0xdc0000, 0x30000},
1776 {"mutil-log", 0xf30000, 0x80000},
1777 {"oops", 0xfb0000, 0x40000},
1778 {"radio", 0xff0000, 0x10000},
1782 .first_sysupgrade_partition
= "os-image",
1783 .last_sysupgrade_partition
= "file-system"
1786 /** Firmware layout for the EAP225 v1 */
1791 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1792 .part_trail
= PART_TRAIL_NONE
,
1793 .soft_ver
= SOFT_VER_DEFAULT
,
1796 {"fs-uboot", 0x00000, 0x20000},
1797 {"partition-table", 0x20000, 0x02000},
1798 {"default-mac", 0x30000, 0x01000},
1799 {"support-list", 0x31000, 0x00100},
1800 {"product-info", 0x31100, 0x00400},
1801 {"soft-version", 0x32000, 0x00100},
1802 {"firmware", 0x40000, 0xd80000},
1803 {"user-config", 0xdc0000, 0x30000},
1804 {"radio", 0xff0000, 0x10000},
1808 .first_sysupgrade_partition
= "os-image",
1809 .last_sysupgrade_partition
= "file-system"
1812 /** Firmware layout for the EAP225 v3
1813 * Also compatible with:
1816 * - EAP225-Outdoor v1
1817 * - EAP225-Outdoor v3
1823 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1824 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1825 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1826 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1827 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1828 .part_trail
= PART_TRAIL_NONE
,
1829 .soft_ver
= SOFT_VER_DEFAULT
,
1830 .soft_ver_compat_level
= 1,
1833 {"fs-uboot", 0x00000, 0x20000},
1834 {"partition-table", 0x20000, 0x02000},
1835 {"default-mac", 0x30000, 0x01000},
1836 {"support-list", 0x31000, 0x00100},
1837 {"product-info", 0x31100, 0x00400},
1838 {"soft-version", 0x32000, 0x00100},
1839 {"firmware", 0x40000, 0xd80000},
1840 {"user-config", 0xdc0000, 0x30000},
1841 {"mutil-log", 0xf30000, 0x80000},
1842 {"oops", 0xfb0000, 0x40000},
1843 {"radio", 0xff0000, 0x10000},
1847 .first_sysupgrade_partition
= "os-image",
1848 .last_sysupgrade_partition
= "file-system"
1851 /** Firmware layout for the EAP225-Wall v2 */
1853 .id
= "EAP225-WALL-V2",
1856 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1857 .part_trail
= PART_TRAIL_NONE
,
1858 .soft_ver
= SOFT_VER_DEFAULT
,
1859 .soft_ver_compat_level
= 1,
1862 {"fs-uboot", 0x00000, 0x20000},
1863 {"partition-table", 0x20000, 0x02000},
1864 {"default-mac", 0x30000, 0x01000},
1865 {"support-list", 0x31000, 0x00100},
1866 {"product-info", 0x31100, 0x00400},
1867 {"soft-version", 0x32000, 0x00100},
1868 {"firmware", 0x40000, 0xd80000},
1869 {"user-config", 0xdc0000, 0x30000},
1870 {"mutil-log", 0xf30000, 0x80000},
1871 {"oops", 0xfb0000, 0x40000},
1872 {"radio", 0xff0000, 0x10000},
1876 .first_sysupgrade_partition
= "os-image",
1877 .last_sysupgrade_partition
= "file-system"
1880 /** Firmware layout for the EAP235-Wall v1 */
1882 .id
= "EAP235-WALL-V1",
1885 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1886 .part_trail
= PART_TRAIL_NONE
,
1887 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1888 .soft_ver_compat_level
= 1,
1891 {"fs-uboot", 0x00000, 0x80000},
1892 {"partition-table", 0x80000, 0x02000},
1893 {"default-mac", 0x90000, 0x01000},
1894 {"support-list", 0x91000, 0x00100},
1895 {"product-info", 0x91100, 0x00400},
1896 {"soft-version", 0x92000, 0x00100},
1897 {"firmware", 0xa0000, 0xd20000},
1898 {"user-config", 0xdc0000, 0x30000},
1899 {"mutil-log", 0xf30000, 0x80000},
1900 {"oops", 0xfb0000, 0x40000},
1901 {"radio", 0xff0000, 0x10000},
1905 .first_sysupgrade_partition
= "os-image",
1906 .last_sysupgrade_partition
= "file-system"
1909 /** Firmware layout for the EAP245 v1 */
1914 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1915 .part_trail
= PART_TRAIL_NONE
,
1916 .soft_ver
= SOFT_VER_DEFAULT
,
1919 {"fs-uboot", 0x00000, 0x20000},
1920 {"partition-table", 0x20000, 0x02000},
1921 {"default-mac", 0x30000, 0x01000},
1922 {"support-list", 0x31000, 0x00100},
1923 {"product-info", 0x31100, 0x00400},
1924 {"soft-version", 0x32000, 0x00100},
1925 {"firmware", 0x40000, 0xd80000},
1926 {"user-config", 0xdc0000, 0x30000},
1927 {"radio", 0xff0000, 0x10000},
1931 .first_sysupgrade_partition
= "os-image",
1932 .last_sysupgrade_partition
= "file-system"
1935 /** Firmware layout for the EAP245 v3 */
1940 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
1941 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
1942 .part_trail
= PART_TRAIL_NONE
,
1943 .soft_ver
= SOFT_VER_DEFAULT
,
1944 .soft_ver_compat_level
= 1,
1946 /** Firmware partition with dynamic kernel/rootfs split */
1948 {"factroy-boot", 0x00000, 0x40000},
1949 {"fs-uboot", 0x40000, 0x40000},
1950 {"partition-table", 0x80000, 0x10000},
1951 {"default-mac", 0x90000, 0x01000},
1952 {"support-list", 0x91000, 0x00100},
1953 {"product-info", 0x91100, 0x00400},
1954 {"soft-version", 0x92000, 0x00100},
1955 {"radio", 0xa0000, 0x10000},
1956 {"extra-para", 0xb0000, 0x10000},
1957 {"firmware", 0xc0000, 0xe40000},
1958 {"config", 0xf00000, 0x30000},
1959 {"mutil-log", 0xf30000, 0x80000},
1960 {"oops", 0xfb0000, 0x40000},
1964 .first_sysupgrade_partition
= "os-image",
1965 .last_sysupgrade_partition
= "file-system"
1968 /** Firmware layout for the EAP615-Wall v1 */
1970 .id
= "EAP615-WALL-V1",
1971 .soft_ver
= SOFT_VER_DEFAULT
,
1972 .soft_ver_compat_level
= 1,
1975 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
1976 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
1977 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
1978 .part_trail
= PART_TRAIL_NONE
,
1981 {"fs-uboot", 0x00000, 0x80000},
1982 {"partition-table", 0x80000, 0x02000},
1983 {"default-mac", 0x90000, 0x01000},
1984 {"support-list", 0x91000, 0x00100},
1985 {"product-info", 0x91100, 0x00400},
1986 {"soft-version", 0x92000, 0x00100},
1987 {"firmware", 0xa0000, 0xcf0000},
1988 {"user-config", 0xd90000, 0x60000},
1989 {"mutil-log", 0xf30000, 0x80000},
1990 {"oops", 0xfb0000, 0x40000},
1991 {"radio", 0xff0000, 0x10000},
1995 .first_sysupgrade_partition
= "os-image",
1996 .last_sysupgrade_partition
= "file-system"
1999 /** Firmware layout for the TL-WA1201 v2 */
2001 .id
= "TL-WA1201-V2",
2005 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2006 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2008 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2011 {"fs-uboot", 0x00000, 0x20000},
2012 {"default-mac", 0x20000, 0x00200},
2013 {"pin", 0x20200, 0x00100},
2014 {"product-info", 0x20300, 0x00200},
2015 {"device-id", 0x20500, 0x0fb00},
2016 {"firmware", 0x30000, 0xce0000},
2017 {"portal-logo", 0xd10000, 0x20000},
2018 {"portal-back", 0xd30000, 0x200000},
2019 {"soft-version", 0xf30000, 0x00200},
2020 {"extra-para", 0xf30200, 0x00200},
2021 {"support-list", 0xf30400, 0x00200},
2022 {"profile", 0xf30600, 0x0fa00},
2023 {"apdef-config", 0xf40000, 0x10000},
2024 {"ap-config", 0xf50000, 0x10000},
2025 {"redef-config", 0xf60000, 0x10000},
2026 {"re-config", 0xf70000, 0x10000},
2027 {"multidef-config", 0xf80000, 0x10000},
2028 {"multi-config", 0xf90000, 0x10000},
2029 {"clientdef-config", 0xfa0000, 0x10000},
2030 {"client-config", 0xfb0000, 0x10000},
2031 {"partition-table", 0xfc0000, 0x10000},
2032 {"user-config", 0xfd0000, 0x10000},
2033 {"certificate", 0xfe0000, 0x10000},
2034 {"radio", 0xff0000, 0x10000},
2037 .first_sysupgrade_partition
= "os-image",
2038 .last_sysupgrade_partition
= "file-system",
2041 /** Firmware layout for the TL-WA850RE v2 */
2043 .id
= "TLWA850REV2",
2047 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2048 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2049 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2050 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2051 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2052 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2053 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2054 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2055 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2056 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2058 .soft_ver
= SOFT_VER_DEFAULT
,
2061 576KB were moved from file-system to os-image
2062 in comparison to the stock image
2065 {"fs-uboot", 0x00000, 0x20000},
2066 {"firmware", 0x20000, 0x390000},
2067 {"partition-table", 0x3b0000, 0x02000},
2068 {"default-mac", 0x3c0000, 0x00020},
2069 {"pin", 0x3c0100, 0x00020},
2070 {"product-info", 0x3c1000, 0x01000},
2071 {"soft-version", 0x3c2000, 0x00100},
2072 {"support-list", 0x3c3000, 0x01000},
2073 {"profile", 0x3c4000, 0x08000},
2074 {"user-config", 0x3d0000, 0x10000},
2075 {"default-config", 0x3e0000, 0x10000},
2076 {"radio", 0x3f0000, 0x10000},
2080 .first_sysupgrade_partition
= "os-image",
2081 .last_sysupgrade_partition
= "file-system"
2084 /** Firmware layout for the TL-WA855RE v1 */
2086 .id
= "TLWA855REV1",
2090 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2091 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2092 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2093 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2094 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2095 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2096 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2097 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2098 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2100 .soft_ver
= SOFT_VER_DEFAULT
,
2103 {"fs-uboot", 0x00000, 0x20000},
2104 {"os-image", 0x20000, 0x150000},
2105 {"file-system", 0x170000, 0x240000},
2106 {"partition-table", 0x3b0000, 0x02000},
2107 {"default-mac", 0x3c0000, 0x00020},
2108 {"pin", 0x3c0100, 0x00020},
2109 {"product-info", 0x3c1000, 0x01000},
2110 {"soft-version", 0x3c2000, 0x00100},
2111 {"support-list", 0x3c3000, 0x01000},
2112 {"profile", 0x3c4000, 0x08000},
2113 {"user-config", 0x3d0000, 0x10000},
2114 {"default-config", 0x3e0000, 0x10000},
2115 {"radio", 0x3f0000, 0x10000},
2119 .first_sysupgrade_partition
= "os-image",
2120 .last_sysupgrade_partition
= "file-system"
2123 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2125 .id
= "TL-WPA8630P-V2.0-EU",
2129 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2131 .soft_ver
= SOFT_VER_DEFAULT
,
2134 {"factory-uboot", 0x00000, 0x20000},
2135 {"fs-uboot", 0x20000, 0x20000},
2136 {"firmware", 0x40000, 0x5e0000},
2137 {"partition-table", 0x620000, 0x02000},
2138 {"default-mac", 0x630000, 0x00020},
2139 {"pin", 0x630100, 0x00020},
2140 {"device-id", 0x630200, 0x00030},
2141 {"product-info", 0x631100, 0x01000},
2142 {"extra-para", 0x632100, 0x01000},
2143 {"soft-version", 0x640000, 0x01000},
2144 {"support-list", 0x641000, 0x01000},
2145 {"profile", 0x642000, 0x08000},
2146 {"user-config", 0x650000, 0x10000},
2147 {"default-config", 0x660000, 0x10000},
2148 {"default-nvm", 0x670000, 0xc0000},
2149 {"default-pib", 0x730000, 0x40000},
2150 {"radio", 0x7f0000, 0x10000},
2154 .first_sysupgrade_partition
= "os-image",
2155 .last_sysupgrade_partition
= "file-system"
2158 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2160 .id
= "TL-WPA8630P-V2-INT",
2164 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2165 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2166 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2168 .soft_ver
= SOFT_VER_DEFAULT
,
2171 {"factory-uboot", 0x00000, 0x20000},
2172 {"fs-uboot", 0x20000, 0x20000},
2173 {"firmware", 0x40000, 0x5e0000},
2174 {"partition-table", 0x620000, 0x02000},
2175 {"extra-para", 0x632100, 0x01000},
2176 {"soft-version", 0x640000, 0x01000},
2177 {"support-list", 0x641000, 0x01000},
2178 {"profile", 0x642000, 0x08000},
2179 {"user-config", 0x650000, 0x10000},
2180 {"default-config", 0x660000, 0x10000},
2181 {"default-nvm", 0x670000, 0xc0000},
2182 {"default-pib", 0x730000, 0x40000},
2183 {"default-mac", 0x7e0000, 0x00020},
2184 {"pin", 0x7e0100, 0x00020},
2185 {"device-id", 0x7e0200, 0x00030},
2186 {"product-info", 0x7e1100, 0x01000},
2187 {"radio", 0x7f0000, 0x10000},
2191 .first_sysupgrade_partition
= "os-image",
2192 .last_sysupgrade_partition
= "file-system"
2195 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2197 .id
= "TL-WPA8630P-V2.1-EU",
2201 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2203 .soft_ver
= SOFT_VER_DEFAULT
,
2206 {"factory-uboot", 0x00000, 0x20000},
2207 {"fs-uboot", 0x20000, 0x20000},
2208 {"firmware", 0x40000, 0x5e0000},
2209 {"extra-para", 0x680000, 0x01000},
2210 {"product-info", 0x690000, 0x01000},
2211 {"partition-table", 0x6a0000, 0x02000},
2212 {"soft-version", 0x6b0000, 0x01000},
2213 {"support-list", 0x6b1000, 0x01000},
2214 {"profile", 0x6b2000, 0x08000},
2215 {"user-config", 0x6c0000, 0x10000},
2216 {"default-config", 0x6d0000, 0x10000},
2217 {"default-nvm", 0x6e0000, 0xc0000},
2218 {"default-pib", 0x7a0000, 0x40000},
2219 {"default-mac", 0x7e0000, 0x00020},
2220 {"pin", 0x7e0100, 0x00020},
2221 {"device-id", 0x7e0200, 0x00030},
2222 {"radio", 0x7f0000, 0x10000},
2226 .first_sysupgrade_partition
= "os-image",
2227 .last_sysupgrade_partition
= "file-system"
2230 /** Firmware layout for the TL-WPA8631P v3 */
2232 .id
= "TL-WPA8631P-V3",
2236 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2237 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2238 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2240 .soft_ver
= SOFT_VER_DEFAULT
,
2243 {"fs-uboot", 0x00000, 0x20000},
2244 {"firmware", 0x20000, 0x710000},
2245 {"partition-table", 0x730000, 0x02000},
2246 {"default-mac", 0x732000, 0x00020},
2247 {"pin", 0x732100, 0x00020},
2248 {"device-id", 0x732200, 0x00030},
2249 {"default-region", 0x732300, 0x00010},
2250 {"product-info", 0x732400, 0x00200},
2251 {"extra-para", 0x732600, 0x00200},
2252 {"soft-version", 0x732800, 0x00200},
2253 {"support-list", 0x732a00, 0x00100},
2254 {"profile", 0x732b00, 0x00100},
2255 {"default-config", 0x732c00, 0x00800},
2256 {"plc-type", 0x733400, 0x00020},
2257 {"default-pib", 0x733500, 0x06000},
2258 {"user-config", 0x740000, 0x10000},
2259 {"plc-pib", 0x750000, 0x10000},
2260 {"plc-nvm", 0x760000, 0x90000},
2261 {"radio", 0x7f0000, 0x10000},
2265 .first_sysupgrade_partition
= "os-image",
2266 .last_sysupgrade_partition
= "file-system"
2269 /** Firmware layout for the TL-WR1043 v5 */
2271 .id
= "TLWR1043NV5",
2275 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2276 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2278 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2280 {"factory-boot", 0x00000, 0x20000},
2281 {"fs-uboot", 0x20000, 0x20000},
2282 {"firmware", 0x40000, 0xec0000},
2283 {"default-mac", 0xf00000, 0x00200},
2284 {"pin", 0xf00200, 0x00200},
2285 {"device-id", 0xf00400, 0x00100},
2286 {"product-info", 0xf00500, 0x0fb00},
2287 {"soft-version", 0xf10000, 0x01000},
2288 {"extra-para", 0xf11000, 0x01000},
2289 {"support-list", 0xf12000, 0x0a000},
2290 {"profile", 0xf1c000, 0x04000},
2291 {"default-config", 0xf20000, 0x10000},
2292 {"user-config", 0xf30000, 0x40000},
2293 {"qos-db", 0xf70000, 0x40000},
2294 {"certificate", 0xfb0000, 0x10000},
2295 {"partition-table", 0xfc0000, 0x10000},
2296 {"log", 0xfd0000, 0x20000},
2297 {"radio", 0xff0000, 0x10000},
2300 .first_sysupgrade_partition
= "os-image",
2301 .last_sysupgrade_partition
= "file-system"
2304 /** Firmware layout for the TL-WR1043 v4 */
2306 .id
= "TLWR1043NDV4",
2310 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2312 .soft_ver
= SOFT_VER_DEFAULT
,
2314 /* We're using a dynamic kernel/rootfs split here */
2316 {"fs-uboot", 0x00000, 0x20000},
2317 {"firmware", 0x20000, 0xf30000},
2318 {"default-mac", 0xf50000, 0x00200},
2319 {"pin", 0xf50200, 0x00200},
2320 {"product-info", 0xf50400, 0x0fc00},
2321 {"soft-version", 0xf60000, 0x0b000},
2322 {"support-list", 0xf6b000, 0x04000},
2323 {"profile", 0xf70000, 0x04000},
2324 {"default-config", 0xf74000, 0x0b000},
2325 {"user-config", 0xf80000, 0x40000},
2326 {"partition-table", 0xfc0000, 0x10000},
2327 {"log", 0xfd0000, 0x20000},
2328 {"radio", 0xff0000, 0x10000},
2332 .first_sysupgrade_partition
= "os-image",
2333 .last_sysupgrade_partition
= "file-system"
2336 /** Firmware layout for the TL-WR902AC v1 */
2338 .id
= "TL-WR902AC-V1",
2342 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2343 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2345 .soft_ver
= SOFT_VER_DEFAULT
,
2348 384KB were moved from file-system to os-image
2349 in comparison to the stock image
2352 {"fs-uboot", 0x00000, 0x20000},
2353 {"firmware", 0x20000, 0x730000},
2354 {"default-mac", 0x750000, 0x00200},
2355 {"pin", 0x750200, 0x00200},
2356 {"product-info", 0x750400, 0x0fc00},
2357 {"soft-version", 0x760000, 0x0b000},
2358 {"support-list", 0x76b000, 0x04000},
2359 {"profile", 0x770000, 0x04000},
2360 {"default-config", 0x774000, 0x0b000},
2361 {"user-config", 0x780000, 0x40000},
2362 {"partition-table", 0x7c0000, 0x10000},
2363 {"log", 0x7d0000, 0x20000},
2364 {"radio", 0x7f0000, 0x10000},
2368 .first_sysupgrade_partition
= "os-image",
2369 .last_sysupgrade_partition
= "file-system",
2372 /** Firmware layout for the TL-WR941HP v1 */
2374 .id
= "TL-WR941HP-V1",
2378 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2380 .soft_ver
= SOFT_VER_DEFAULT
,
2383 {"fs-uboot", 0x00000, 0x20000},
2384 {"firmware", 0x20000, 0x730000},
2385 {"default-mac", 0x750000, 0x00200},
2386 {"pin", 0x750200, 0x00200},
2387 {"product-info", 0x750400, 0x0fc00},
2388 {"soft-version", 0x760000, 0x0b000},
2389 {"support-list", 0x76b000, 0x04000},
2390 {"profile", 0x770000, 0x04000},
2391 {"default-config", 0x774000, 0x0b000},
2392 {"user-config", 0x780000, 0x40000},
2393 {"partition-table", 0x7c0000, 0x10000},
2394 {"log", 0x7d0000, 0x20000},
2395 {"radio", 0x7f0000, 0x10000},
2399 .first_sysupgrade_partition
= "os-image",
2400 .last_sysupgrade_partition
= "file-system",
2403 /** Firmware layout for the TL-WR942N V1 */
2409 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2410 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2412 .soft_ver
= SOFT_VER_DEFAULT
,
2415 {"fs-uboot", 0x00000, 0x20000},
2416 {"firmware", 0x20000, 0xe20000},
2417 {"default-mac", 0xe40000, 0x00200},
2418 {"pin", 0xe40200, 0x00200},
2419 {"product-info", 0xe40400, 0x0fc00},
2420 {"partition-table", 0xe50000, 0x10000},
2421 {"soft-version", 0xe60000, 0x10000},
2422 {"support-list", 0xe70000, 0x10000},
2423 {"profile", 0xe80000, 0x10000},
2424 {"default-config", 0xe90000, 0x10000},
2425 {"user-config", 0xea0000, 0x40000},
2426 {"qos-db", 0xee0000, 0x40000},
2427 {"certificate", 0xf20000, 0x10000},
2428 {"usb-config", 0xfb0000, 0x10000},
2429 {"log", 0xfc0000, 0x20000},
2430 {"radio-bk", 0xfe0000, 0x10000},
2431 {"radio", 0xff0000, 0x10000},
2435 .first_sysupgrade_partition
= "os-image",
2436 .last_sysupgrade_partition
= "file-system",
2439 /** Firmware layout for the RE200 v2 */
2445 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2446 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2447 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2448 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2449 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2450 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2451 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2452 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2453 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2454 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2455 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2456 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2457 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2459 .soft_ver
= SOFT_VER_DEFAULT
,
2462 {"fs-uboot", 0x00000, 0x20000},
2463 {"firmware", 0x20000, 0x7a0000},
2464 {"partition-table", 0x7c0000, 0x02000},
2465 {"default-mac", 0x7c2000, 0x00020},
2466 {"pin", 0x7c2100, 0x00020},
2467 {"product-info", 0x7c3100, 0x01000},
2468 {"soft-version", 0x7c4200, 0x01000},
2469 {"support-list", 0x7c5200, 0x01000},
2470 {"profile", 0x7c6200, 0x08000},
2471 {"config-info", 0x7ce200, 0x00400},
2472 {"user-config", 0x7d0000, 0x10000},
2473 {"default-config", 0x7e0000, 0x10000},
2474 {"radio", 0x7f0000, 0x10000},
2478 .first_sysupgrade_partition
= "os-image",
2479 .last_sysupgrade_partition
= "file-system"
2482 /** Firmware layout for the RE200 v3 */
2488 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2489 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2490 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2491 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2492 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2493 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2494 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2495 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2496 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2497 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2498 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2499 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2500 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2501 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2503 .soft_ver
= SOFT_VER_DEFAULT
,
2506 {"fs-uboot", 0x00000, 0x20000},
2507 {"firmware", 0x20000, 0x7a0000},
2508 {"partition-table", 0x7c0000, 0x02000},
2509 {"default-mac", 0x7c2000, 0x00020},
2510 {"pin", 0x7c2100, 0x00020},
2511 {"product-info", 0x7c3100, 0x01000},
2512 {"soft-version", 0x7c4200, 0x01000},
2513 {"support-list", 0x7c5200, 0x01000},
2514 {"profile", 0x7c6200, 0x08000},
2515 {"config-info", 0x7ce200, 0x00400},
2516 {"user-config", 0x7d0000, 0x10000},
2517 {"default-config", 0x7e0000, 0x10000},
2518 {"radio", 0x7f0000, 0x10000},
2522 .first_sysupgrade_partition
= "os-image",
2523 .last_sysupgrade_partition
= "file-system"
2526 /** Firmware layout for the RE200 v4 */
2532 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2533 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2534 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2535 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2536 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2537 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2538 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2539 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2540 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2541 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2542 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2543 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2544 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2545 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2547 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2550 {"fs-uboot", 0x00000, 0x20000},
2551 {"firmware", 0x20000, 0x7a0000},
2552 {"partition-table", 0x7c0000, 0x02000},
2553 {"default-mac", 0x7c2000, 0x00020},
2554 {"pin", 0x7c2100, 0x00020},
2555 {"product-info", 0x7c3100, 0x01000},
2556 {"soft-version", 0x7c4200, 0x01000},
2557 {"support-list", 0x7c5200, 0x01000},
2558 {"profile", 0x7c6200, 0x08000},
2559 {"config-info", 0x7ce200, 0x00400},
2560 {"user-config", 0x7d0000, 0x10000},
2561 {"default-config", 0x7e0000, 0x10000},
2562 {"radio", 0x7f0000, 0x10000},
2566 .first_sysupgrade_partition
= "os-image",
2567 .last_sysupgrade_partition
= "file-system"
2570 /** Firmware layout for the RE220 v2 */
2576 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2577 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2578 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2579 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2580 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2581 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2582 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2583 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2584 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2585 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2586 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2587 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2588 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2590 .soft_ver
= SOFT_VER_DEFAULT
,
2593 {"fs-uboot", 0x00000, 0x20000},
2594 {"firmware", 0x20000, 0x7a0000},
2595 {"partition-table", 0x7c0000, 0x02000},
2596 {"default-mac", 0x7c2000, 0x00020},
2597 {"pin", 0x7c2100, 0x00020},
2598 {"product-info", 0x7c3100, 0x01000},
2599 {"soft-version", 0x7c4200, 0x01000},
2600 {"support-list", 0x7c5200, 0x01000},
2601 {"profile", 0x7c6200, 0x08000},
2602 {"config-info", 0x7ce200, 0x00400},
2603 {"user-config", 0x7d0000, 0x10000},
2604 {"default-config", 0x7e0000, 0x10000},
2605 {"radio", 0x7f0000, 0x10000},
2609 .first_sysupgrade_partition
= "os-image",
2610 .last_sysupgrade_partition
= "file-system"
2613 /** Firmware layout for the RE305 v1 */
2619 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2620 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2621 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2622 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2623 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2624 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2625 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2627 .soft_ver
= SOFT_VER_DEFAULT
,
2630 {"fs-uboot", 0x00000, 0x20000},
2631 {"firmware", 0x20000, 0x5e0000},
2632 {"partition-table", 0x600000, 0x02000},
2633 {"default-mac", 0x610000, 0x00020},
2634 {"pin", 0x610100, 0x00020},
2635 {"product-info", 0x611100, 0x01000},
2636 {"soft-version", 0x620000, 0x01000},
2637 {"support-list", 0x621000, 0x01000},
2638 {"profile", 0x622000, 0x08000},
2639 {"user-config", 0x630000, 0x10000},
2640 {"default-config", 0x640000, 0x10000},
2641 {"radio", 0x7f0000, 0x10000},
2645 .first_sysupgrade_partition
= "os-image",
2646 .last_sysupgrade_partition
= "file-system"
2649 /** Firmware layout for the RE305 v3 */
2655 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2656 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2657 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2658 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2659 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2660 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2661 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2662 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2663 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2664 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2665 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2667 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2670 {"fs-uboot", 0x00000, 0x20000},
2671 {"firmware", 0x20000, 0x7a0000},
2672 {"partition-table", 0x7c0000, 0x02000},
2673 {"default-mac", 0x7c2000, 0x00020},
2674 {"pin", 0x7c2100, 0x00020},
2675 {"product-info", 0x7c3100, 0x01000},
2676 {"soft-version", 0x7c4200, 0x01000},
2677 {"support-list", 0x7c5200, 0x01000},
2678 {"profile", 0x7c6200, 0x08000},
2679 {"config-info", 0x7ce200, 0x00400},
2680 {"user-config", 0x7d0000, 0x10000},
2681 {"default-config", 0x7e0000, 0x10000},
2682 {"radio", 0x7f0000, 0x10000},
2686 .first_sysupgrade_partition
= "os-image",
2687 .last_sysupgrade_partition
= "file-system"
2690 /** Firmware layout for the RE350 v1 */
2696 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2697 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2698 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2699 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2700 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2701 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2702 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2704 .soft_ver
= SOFT_VER_DEFAULT
,
2706 /** We're using a dynamic kernel/rootfs split here */
2708 {"fs-uboot", 0x00000, 0x20000},
2709 {"firmware", 0x20000, 0x5e0000},
2710 {"partition-table", 0x600000, 0x02000},
2711 {"default-mac", 0x610000, 0x00020},
2712 {"pin", 0x610100, 0x00020},
2713 {"product-info", 0x611100, 0x01000},
2714 {"soft-version", 0x620000, 0x01000},
2715 {"support-list", 0x621000, 0x01000},
2716 {"profile", 0x622000, 0x08000},
2717 {"user-config", 0x630000, 0x10000},
2718 {"default-config", 0x640000, 0x10000},
2719 {"radio", 0x7f0000, 0x10000},
2723 .first_sysupgrade_partition
= "os-image",
2724 .last_sysupgrade_partition
= "file-system"
2727 /** Firmware layout for the RE350K v1 */
2733 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2735 .soft_ver
= SOFT_VER_DEFAULT
,
2737 /** We're using a dynamic kernel/rootfs split here */
2739 {"fs-uboot", 0x00000, 0x20000},
2740 {"firmware", 0x20000, 0xd70000},
2741 {"partition-table", 0xd90000, 0x02000},
2742 {"default-mac", 0xda0000, 0x00020},
2743 {"pin", 0xda0100, 0x00020},
2744 {"product-info", 0xda1100, 0x01000},
2745 {"soft-version", 0xdb0000, 0x01000},
2746 {"support-list", 0xdb1000, 0x01000},
2747 {"profile", 0xdb2000, 0x08000},
2748 {"user-config", 0xdc0000, 0x10000},
2749 {"default-config", 0xdd0000, 0x10000},
2750 {"device-id", 0xde0000, 0x00108},
2751 {"radio", 0xff0000, 0x10000},
2755 .first_sysupgrade_partition
= "os-image",
2756 .last_sysupgrade_partition
= "file-system"
2759 /** Firmware layout for the RE355 */
2765 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2766 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2767 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2768 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2769 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2770 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2771 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2772 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2774 .soft_ver
= SOFT_VER_DEFAULT
,
2776 /* We're using a dynamic kernel/rootfs split here */
2778 {"fs-uboot", 0x00000, 0x20000},
2779 {"firmware", 0x20000, 0x5e0000},
2780 {"partition-table", 0x600000, 0x02000},
2781 {"default-mac", 0x610000, 0x00020},
2782 {"pin", 0x610100, 0x00020},
2783 {"product-info", 0x611100, 0x01000},
2784 {"soft-version", 0x620000, 0x01000},
2785 {"support-list", 0x621000, 0x01000},
2786 {"profile", 0x622000, 0x08000},
2787 {"user-config", 0x630000, 0x10000},
2788 {"default-config", 0x640000, 0x10000},
2789 {"radio", 0x7f0000, 0x10000},
2793 .first_sysupgrade_partition
= "os-image",
2794 .last_sysupgrade_partition
= "file-system"
2797 /** Firmware layout for the RE450 */
2803 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2804 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2805 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2806 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2807 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2808 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2809 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2810 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2812 .soft_ver
= SOFT_VER_DEFAULT
,
2814 /** We're using a dynamic kernel/rootfs split here */
2816 {"fs-uboot", 0x00000, 0x20000},
2817 {"firmware", 0x20000, 0x5e0000},
2818 {"partition-table", 0x600000, 0x02000},
2819 {"default-mac", 0x610000, 0x00020},
2820 {"pin", 0x610100, 0x00020},
2821 {"product-info", 0x611100, 0x01000},
2822 {"soft-version", 0x620000, 0x01000},
2823 {"support-list", 0x621000, 0x01000},
2824 {"profile", 0x622000, 0x08000},
2825 {"user-config", 0x630000, 0x10000},
2826 {"default-config", 0x640000, 0x10000},
2827 {"radio", 0x7f0000, 0x10000},
2831 .first_sysupgrade_partition
= "os-image",
2832 .last_sysupgrade_partition
= "file-system"
2835 /** Firmware layout for the RE450 v2 */
2841 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2842 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2843 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2844 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2845 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2846 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2847 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2848 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2849 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2851 .soft_ver
= SOFT_VER_DEFAULT
,
2853 /* We're using a dynamic kernel/rootfs split here */
2855 {"fs-uboot", 0x00000, 0x20000},
2856 {"firmware", 0x20000, 0x5e0000},
2857 {"partition-table", 0x600000, 0x02000},
2858 {"default-mac", 0x610000, 0x00020},
2859 {"pin", 0x610100, 0x00020},
2860 {"product-info", 0x611100, 0x01000},
2861 {"soft-version", 0x620000, 0x01000},
2862 {"support-list", 0x621000, 0x01000},
2863 {"profile", 0x622000, 0x08000},
2864 {"user-config", 0x630000, 0x10000},
2865 {"default-config", 0x640000, 0x10000},
2866 {"radio", 0x7f0000, 0x10000},
2870 .first_sysupgrade_partition
= "os-image",
2871 .last_sysupgrade_partition
= "file-system"
2874 /** Firmware layout for the RE450 v3 */
2880 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2881 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2882 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2883 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2884 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2885 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2886 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2887 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2888 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2890 .soft_ver
= SOFT_VER_DEFAULT
,
2892 /* We're using a dynamic kernel/rootfs split here */
2894 {"fs-uboot", 0x00000, 0x20000},
2895 {"default-mac", 0x20000, 0x00020},
2896 {"pin", 0x20020, 0x00020},
2897 {"product-info", 0x21000, 0x01000},
2898 {"partition-table", 0x22000, 0x02000},
2899 {"soft-version", 0x24000, 0x01000},
2900 {"support-list", 0x25000, 0x01000},
2901 {"profile", 0x26000, 0x08000},
2902 {"user-config", 0x2e000, 0x10000},
2903 {"default-config", 0x3e000, 0x10000},
2904 {"config-info", 0x4e000, 0x00400},
2905 {"firmware", 0x50000, 0x7a0000},
2906 {"radio", 0x7f0000, 0x10000},
2910 .first_sysupgrade_partition
= "os-image",
2911 .last_sysupgrade_partition
= "file-system"
2914 /** Firmware layout for the RE455 v1 */
2920 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2921 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2922 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2923 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2924 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2925 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2926 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2927 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2928 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2930 .soft_ver
= SOFT_VER_DEFAULT
,
2932 /* We're using a dynamic kernel/rootfs split here */
2934 {"fs-uboot", 0x00000, 0x20000},
2935 {"default-mac", 0x20000, 0x00020},
2936 {"pin", 0x20020, 0x00020},
2937 {"product-info", 0x21000, 0x01000},
2938 {"partition-table", 0x22000, 0x02000},
2939 {"soft-version", 0x24000, 0x01000},
2940 {"support-list", 0x25000, 0x01000},
2941 {"profile", 0x26000, 0x08000},
2942 {"user-config", 0x2e000, 0x10000},
2943 {"default-config", 0x3e000, 0x10000},
2944 {"config-info", 0x4e000, 0x00400},
2945 {"firmware", 0x50000, 0x7a0000},
2946 {"radio", 0x7f0000, 0x10000},
2950 .first_sysupgrade_partition
= "os-image",
2951 .last_sysupgrade_partition
= "file-system"
2954 /** Firmware layout for the RE500 */
2960 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2961 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2962 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2963 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2964 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2965 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2966 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2968 .soft_ver
= SOFT_VER_DEFAULT
,
2970 /* We're using a dynamic kernel/rootfs split here */
2972 {"fs-uboot", 0x00000, 0x20000},
2973 {"firmware", 0x20000, 0xde0000},
2974 {"partition-table", 0xe00000, 0x02000},
2975 {"default-mac", 0xe10000, 0x00020},
2976 {"pin", 0xe10100, 0x00020},
2977 {"product-info", 0xe11100, 0x01000},
2978 {"soft-version", 0xe20000, 0x01000},
2979 {"support-list", 0xe21000, 0x01000},
2980 {"profile", 0xe22000, 0x08000},
2981 {"user-config", 0xe30000, 0x10000},
2982 {"default-config", 0xe40000, 0x10000},
2983 {"radio", 0xff0000, 0x10000},
2987 .first_sysupgrade_partition
= "os-image",
2988 .last_sysupgrade_partition
= "file-system"
2991 /** Firmware layout for the RE650 */
2997 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2998 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2999 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3000 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3001 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3002 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3003 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3005 .soft_ver
= SOFT_VER_DEFAULT
,
3007 /* We're using a dynamic kernel/rootfs split here */
3009 {"fs-uboot", 0x00000, 0x20000},
3010 {"firmware", 0x20000, 0xde0000},
3011 {"partition-table", 0xe00000, 0x02000},
3012 {"default-mac", 0xe10000, 0x00020},
3013 {"pin", 0xe10100, 0x00020},
3014 {"product-info", 0xe11100, 0x01000},
3015 {"soft-version", 0xe20000, 0x01000},
3016 {"support-list", 0xe21000, 0x01000},
3017 {"profile", 0xe22000, 0x08000},
3018 {"user-config", 0xe30000, 0x10000},
3019 {"default-config", 0xe40000, 0x10000},
3020 {"radio", 0xff0000, 0x10000},
3024 .first_sysupgrade_partition
= "os-image",
3025 .last_sysupgrade_partition
= "file-system"
3027 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3033 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3034 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3035 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3036 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3037 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3038 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3039 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3041 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3042 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3044 /* We're using a dynamic kernel/rootfs split here */
3046 {"fs-uboot", 0x00000, 0x20000},
3047 {"firmware", 0x20000, 0x7a0000},
3048 {"partition-table", 0x7c0000, 0x02000},
3049 {"default-mac", 0x7c2000, 0x00020},
3050 {"pin", 0x7c2100, 0x00020},
3051 {"product-info", 0x7c3100, 0x01000},
3052 {"soft-version", 0x7c4200, 0x01000},
3053 {"support-list", 0x7c5200, 0x01000},
3054 {"profile", 0x7c6200, 0x08000},
3055 {"config-info", 0x7ce200, 0x00400},
3056 {"user-config", 0x7d0000, 0x10000},
3057 {"default-config", 0x7e0000, 0x10000},
3058 {"radio", 0x7f0000, 0x10000},
3062 .first_sysupgrade_partition
= "os-image",
3063 .last_sysupgrade_partition
= "file-system"
3066 /** Firmware layout for the Mercusys MR70X */
3072 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3073 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3074 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3076 .soft_ver
= SOFT_VER_DEFAULT
,
3079 {"fs-uboot", 0x00000, 0x40000},
3080 {"firmware", 0x40000, 0xf60000},
3081 {"default-mac", 0xfa0000, 0x00200},
3082 {"pin", 0xfa0200, 0x00100},
3083 {"device-id", 0xfa0300, 0x00100},
3084 {"product-info", 0xfa0400, 0x0fc00},
3085 {"default-config", 0xfb0000, 0x08000},
3086 {"ap-def-config", 0xfb8000, 0x08000},
3087 {"user-config", 0xfc0000, 0x0a000},
3088 {"ag-config", 0xfca000, 0x04000},
3089 {"certificate", 0xfce000, 0x02000},
3090 {"ap-config", 0xfd0000, 0x06000},
3091 {"router-config", 0xfd6000, 0x06000},
3092 {"favicon", 0xfdc000, 0x02000},
3093 {"logo", 0xfde000, 0x02000},
3094 {"partition-table", 0xfe0000, 0x00800},
3095 {"soft-version", 0xfe0800, 0x00100},
3096 {"support-list", 0xfe0900, 0x00200},
3097 {"profile", 0xfe0b00, 0x03000},
3098 {"extra-para", 0xfe3b00, 0x00100},
3099 {"radio", 0xff0000, 0x10000},
3103 .first_sysupgrade_partition
= "os-image",
3104 .last_sysupgrade_partition
= "file-system"
3110 #define error(_ret, _errno, _str, ...) \
3112 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3113 strerror(_errno)); \
3119 /** Stores a uint32 as big endian */
3120 static inline void put32(uint8_t *buf
, uint32_t val
) {
3127 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3129 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3132 /** Allocate a padded meta partition with a correctly initialised header
3133 * If the `data` pointer is NULL, then the required space is only allocated,
3134 * otherwise `data_len` bytes will be copied from `data` into the partition
3136 static struct image_partition_entry
init_meta_partition_entry(
3137 const char *name
, const void *data
, uint32_t data_len
,
3138 enum partition_trail_value pad_value
)
3140 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3141 if (meta_partition_should_pad(pad_value
))
3144 struct image_partition_entry entry
= {
3147 .data
= malloc(total_len
)
3150 error(1, errno
, "failed to allocate meta partition entry");
3152 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3153 header
->length
= htonl(data_len
);
3157 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3159 if (meta_partition_should_pad(pad_value
))
3160 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3165 /** Allocates a new image partition */
3166 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3167 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3169 error(1, errno
, "malloc");
3174 /** Sets up default partition names whenever custom names aren't specified */
3175 static void set_partition_names(struct device_info
*info
)
3177 if (!info
->partition_names
.partition_table
)
3178 info
->partition_names
.partition_table
= "partition-table";
3179 if (!info
->partition_names
.soft_ver
)
3180 info
->partition_names
.soft_ver
= "soft-version";
3181 if (!info
->partition_names
.os_image
)
3182 info
->partition_names
.os_image
= "os-image";
3183 if (!info
->partition_names
.support_list
)
3184 info
->partition_names
.support_list
= "support-list";
3185 if (!info
->partition_names
.file_system
)
3186 info
->partition_names
.file_system
= "file-system";
3187 if (!info
->partition_names
.extra_para
)
3188 info
->partition_names
.extra_para
= "extra-para";
3191 /** Frees an image partition */
3192 static void free_image_partition(struct image_partition_entry
*entry
)
3194 void *data
= entry
->data
;
3203 static time_t source_date_epoch
= -1;
3204 static void set_source_date_epoch() {
3205 char *env
= getenv("SOURCE_DATE_EPOCH");
3209 source_date_epoch
= strtoull(env
, &endptr
, 10);
3210 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3211 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3217 /** Generates the partition-table partition */
3218 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3220 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, SAFELOADER_PAYLOAD_TABLE_SIZE
);
3222 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3230 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3232 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3233 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3236 error(1, 0, "flash partition table overflow?");
3243 memset(s
, 0xff, end
-s
);
3249 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3250 static inline uint8_t bcd(uint8_t v
) {
3251 return 0x10 * (v
/10) + v
%10;
3255 /** Generates the soft-version partition */
3256 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3258 /** If an info string is provided, use this instead of
3259 * the structured data, and include the null-termination */
3260 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3261 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3262 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3263 info
->soft_ver
.text
, len
, info
->part_trail
);
3268 if (source_date_epoch
!= -1)
3269 t
= source_date_epoch
;
3270 else if (time(&t
) == (time_t)(-1))
3271 error(1, errno
, "time");
3273 struct tm
*tm
= gmtime(&t
);
3275 struct soft_version s
= {
3278 .version_major
= info
->soft_ver
.num
[0],
3279 .version_minor
= info
->soft_ver
.num
[1],
3280 .version_patch
= info
->soft_ver
.num
[2],
3282 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3283 .year_lo
= bcd(tm
->tm_year
%100),
3284 .month
= bcd(tm
->tm_mon
+1),
3285 .day
= bcd(tm
->tm_mday
),
3288 .compat_level
= htonl(info
->soft_ver_compat_level
)
3291 if (info
->soft_ver_compat_level
== 0)
3292 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3293 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3296 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3297 sizeof(s
), info
->part_trail
);
3300 /** Generates the support-list partition */
3301 static struct image_partition_entry
make_support_list(
3302 const struct device_info
*info
)
3304 uint32_t len
= strlen(info
->support_list
);
3305 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3306 len
, info
->part_trail
);
3309 /** Partition with extra-para data */
3310 static struct image_partition_entry
make_extra_para(
3311 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3313 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3317 /** Creates a new image partition with an arbitrary name from a file */
3318 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
) {
3319 struct stat statbuf
;
3321 if (stat(filename
, &statbuf
) < 0)
3322 error(1, errno
, "unable to stat file `%s'", filename
);
3324 size_t len
= statbuf
.st_size
;
3326 if (add_jffs2_eof
) {
3327 if (file_system_partition
)
3328 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3330 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3333 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3335 FILE *file
= fopen(filename
, "rb");
3337 error(1, errno
, "unable to open file `%s'", filename
);
3339 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3340 error(1, errno
, "unable to read file `%s'", filename
);
3342 if (add_jffs2_eof
) {
3343 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3345 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3346 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3355 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3357 Example image partition table:
3359 fwup-ptn partition-table base 0x00800 size 0x00800
3360 fwup-ptn os-image base 0x01000 size 0x113b45
3361 fwup-ptn file-system base 0x114b45 size 0x1d0004
3362 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3364 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3365 the end of the partition table is marked with a zero byte.
3367 The firmware image must contain at least the partition-table and support-list partitions
3368 to be accepted. There aren't any alignment constraints for the image partitions.
3370 The partition-table partition contains the actual flash layout; partitions
3371 from the image partition table are mapped to the corresponding flash partitions during
3372 the firmware upgrade. The support-list partition contains a list of devices supported by
3375 The base offsets in the firmware partition table are relative to the end
3376 of the vendor information block, so the partition-table partition will
3377 actually start at offset 0x1814 of the image.
3379 I think partition-table must be the first partition in the firmware image.
3381 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3383 char *image_pt
= (char *)buffer
, *end
= image_pt
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3385 size_t base
= SAFELOADER_PAYLOAD_TABLE_SIZE
;
3386 for (i
= 0; parts
[i
].name
; i
++) {
3387 for (j
= 0; flash_parts
[j
].name
; j
++) {
3388 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3389 if (parts
[i
].size
> flash_parts
[j
].size
)
3390 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3395 assert(flash_parts
[j
].name
);
3397 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3399 size_t len
= end
-image_pt
;
3400 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
);
3403 error(1, 0, "image partition table overflow?");
3407 base
+= parts
[i
].size
;
3411 /** Generates and writes the image MD5 checksum */
3412 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3416 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3417 MD5_Update(&ctx
, buffer
, len
);
3418 MD5_Final(md5
, &ctx
);
3423 Generates the firmware image in factory format
3429 0000-0003 Image size (4 bytes, big endian)
3430 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3431 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3432 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3433 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3434 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3435 1814-xxxx Firmware partitions
3437 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3438 *len
= SAFELOADER_PAYLOAD_OFFSET
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3441 for (i
= 0; parts
[i
].name
; i
++)
3442 *len
+= parts
[i
].size
;
3444 uint8_t *image
= malloc(*len
);
3446 error(1, errno
, "malloc");
3448 memset(image
, 0xff, *len
);
3452 size_t vendor_len
= strlen(info
->vendor
);
3453 put32(image
+ SAFELOADER_PREAMBLE_SIZE
, vendor_len
);
3454 memcpy(image
+ SAFELOADER_PREAMBLE_SIZE
+ 0x4, info
->vendor
, vendor_len
);
3457 put_partitions(image
+ SAFELOADER_PAYLOAD_OFFSET
, info
->partitions
, parts
);
3458 put_md5(image
+ 0x04, image
+ SAFELOADER_PREAMBLE_SIZE
, *len
- SAFELOADER_PREAMBLE_SIZE
);
3464 Generates the firmware image in sysupgrade format
3466 This makes some assumptions about the provided flash and image partition tables and
3467 should be generalized when TP-LINK starts building its safeloader into hardware with
3468 different flash layouts.
3470 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3472 size_t flash_first_partition_index
= 0;
3473 size_t flash_last_partition_index
= 0;
3474 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3475 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3476 const struct image_partition_entry
*image_last_partition
= NULL
;
3478 /** Find first and last partitions */
3479 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3480 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3481 flash_first_partition
= &info
->partitions
[i
];
3482 flash_first_partition_index
= i
;
3483 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3484 flash_last_partition
= &info
->partitions
[i
];
3485 flash_last_partition_index
= i
;
3489 assert(flash_first_partition
&& flash_last_partition
);
3490 assert(flash_first_partition_index
< flash_last_partition_index
);
3492 /** Find last partition from image to calculate needed size */
3493 for (i
= 0; image_parts
[i
].name
; i
++) {
3494 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3495 image_last_partition
= &image_parts
[i
];
3500 assert(image_last_partition
);
3502 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3504 uint8_t *image
= malloc(*len
);
3506 error(1, errno
, "malloc");
3508 memset(image
, 0xff, *len
);
3510 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3511 for (j
= 0; image_parts
[j
].name
; j
++) {
3512 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3513 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3514 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3515 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3519 assert(image_parts
[j
].name
);
3526 /** Generates an image according to a given layout and writes it to a file */
3527 static void build_image(const char *output
,
3528 const char *kernel_image
,
3529 const char *rootfs_image
,
3533 struct device_info
*info
) {
3537 struct image_partition_entry parts
[7] = {};
3539 struct flash_partition_entry
*firmware_partition
= NULL
;
3540 struct flash_partition_entry
*os_image_partition
= NULL
;
3541 struct flash_partition_entry
*file_system_partition
= NULL
;
3542 size_t firmware_partition_index
= 0;
3544 set_partition_names(info
);
3546 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3547 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3549 firmware_partition
= &info
->partitions
[i
];
3550 firmware_partition_index
= i
;
3554 if (firmware_partition
)
3556 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3557 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3560 if (stat(kernel_image
, &kernel
) < 0)
3561 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3563 if (kernel
.st_size
> firmware_partition
->size
)
3564 error(1, 0, "kernel overflowed firmware partition\n");
3566 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3567 info
->partitions
[i
+1] = info
->partitions
[i
];
3569 file_system_partition
->name
= info
->partition_names
.file_system
;
3571 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3573 /* Align partition start to erase blocks for factory images only */
3575 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3577 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3579 os_image_partition
->name
= info
->partition_names
.os_image
;
3581 os_image_partition
->size
= kernel
.st_size
;
3584 parts
[0] = make_partition_table(info
);
3585 parts
[1] = make_soft_version(info
, rev
);
3586 parts
[2] = make_support_list(info
);
3587 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3588 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3591 /* Some devices need the extra-para partition to accept the firmware */
3592 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3593 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3594 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3595 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3596 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3597 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3598 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3599 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3600 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3601 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3602 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3603 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3604 strcasecmp(info
->id
, "DECO-M4R-V4") == 0 ||
3605 strcasecmp(info
->id
, "MR70X") == 0 ||
3606 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3607 const uint8_t extra_para
[2] = {0x01, 0x00};
3608 parts
[5] = make_extra_para(info
, extra_para
,
3609 sizeof(extra_para
));
3610 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3611 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3612 const uint8_t extra_para
[2] = {0x00, 0x01};
3613 parts
[5] = make_extra_para(info
, extra_para
,
3614 sizeof(extra_para
));
3615 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3616 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3617 const uint8_t extra_para
[2] = {0x01, 0x01};
3618 parts
[5] = make_extra_para(info
, extra_para
,
3619 sizeof(extra_para
));
3625 image
= generate_sysupgrade_image(info
, parts
, &len
);
3627 image
= generate_factory_image(info
, parts
, &len
);
3629 FILE *file
= fopen(output
, "wb");
3631 error(1, errno
, "unable to open output file");
3633 if (fwrite(image
, len
, 1, file
) != 1)
3634 error(1, 0, "unable to write output file");
3640 for (i
= 0; parts
[i
].name
; i
++)
3641 free_image_partition(&parts
[i
]);
3645 static void usage(const char *argv0
) {
3647 "Usage: %s [OPTIONS...]\n"
3650 " -h show this help\n"
3652 "Info about an image:\n"
3653 " -i <file> input file to read from\n"
3654 "Create a new image:\n"
3655 " -B <board> create image for the board specified with <board>\n"
3656 " -k <file> read kernel image from the file <file>\n"
3657 " -r <file> read rootfs image from the file <file>\n"
3658 " -o <file> write output to the file <file>\n"
3659 " -V <rev> sets the revision number to <rev>\n"
3660 " -j add jffs2 end-of-filesystem markers\n"
3661 " -S create sysupgrade instead of factory image\n"
3662 "Extract an old image:\n"
3663 " -x <file> extract all oem firmware partition\n"
3664 " -d <dir> destination to extract the firmware partition\n"
3665 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3671 static struct device_info
*find_board(const char *id
)
3673 struct device_info
*board
= NULL
;
3675 for (board
= boards
; board
->id
!= NULL
; board
++)
3676 if (strcasecmp(id
, board
->id
) == 0)
3682 static int add_flash_partition(
3683 struct flash_partition_entry
*part_list
,
3690 /* check if the list has a free entry */
3691 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3692 if (part_list
->name
== NULL
&&
3693 part_list
->base
== 0 &&
3694 part_list
->size
== 0)
3698 if (ptr
== max_entries
) {
3699 error(1, 0, "No free flash part entry available.");
3702 part_list
->name
= calloc(1, strlen(name
) + 1);
3703 if (!part_list
->name
) {
3704 error(1, 0, "Unable to allocate memory");
3707 memcpy((char *)part_list
->name
, name
, strlen(name
));
3708 part_list
->base
= base
;
3709 part_list
->size
= size
;
3714 /** read the partition table into struct flash_partition_entry */
3715 enum PARTITION_TABLE_TYPE
{
3716 PARTITION_TABLE_FWUP
,
3717 PARTITION_TABLE_FLASH
,
3720 static int read_partition_table(
3721 FILE *file
, long offset
,
3722 struct flash_partition_entry
*entries
, size_t max_entries
,
3725 char buf
[SAFELOADER_PAYLOAD_TABLE_SIZE
];
3727 const char *parthdr
= NULL
;
3728 const char *fwuphdr
= "fwup-ptn";
3729 const char *flashhdr
= "partition";
3731 /* TODO: search for the partition table */
3734 case PARTITION_TABLE_FWUP
:
3737 case PARTITION_TABLE_FLASH
:
3741 error(1, 0, "Invalid partition table");
3744 if (fseek(file
, offset
, SEEK_SET
) < 0)
3745 error(1, errno
, "Can not seek in the firmware");
3747 if (fread(buf
, sizeof(buf
), 1, file
) != 1)
3748 error(1, errno
, "Can not read fwup-ptn from the firmware");
3750 buf
[sizeof(buf
) - 1] = '\0';
3752 /* look for the partition header */
3753 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3754 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3759 end
= buf
+ sizeof(buf
);
3760 while ((ptr
+ strlen(parthdr
)) < end
&&
3761 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3765 char name
[32] = { 0 };
3767 unsigned long base
= 0;
3768 unsigned long size
= 0;
3770 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3771 if (end_part
== NULL
) {
3772 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3776 for (int i
= 0; i
<= 4; i
++) {
3777 if (end_part
<= ptr
)
3780 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3781 if (end_element
== NULL
) {
3782 error(1, errno
, "Ignoring the rest of the partition entries.");
3787 /* partition header */
3789 ptr
= end_element
+ 1;
3793 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3794 strncpy(name
, ptr
, name_len
);
3795 name
[name_len
] = '\0';
3796 ptr
= end_element
+ 1;
3801 ptr
= end_element
+ 1;
3806 base
= strtoul(ptr
, NULL
, 16);
3807 ptr
= end_element
+ 1;
3812 ptr
= end_element
+ 1;
3813 /* actual size. The last element doesn't have a sepeartor */
3814 size
= strtoul(ptr
, NULL
, 16);
3815 /* the part ends with 0x09, 0x0d, 0x0a */
3817 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3826 static void safeloader_read_partition(FILE *input_file
, size_t payload_offset
,
3827 struct flash_partition_entry
*entry
,
3828 struct image_partition_entry
*part
)
3830 size_t part_size
= entry
->size
;
3831 void *part_data
= malloc(part_size
);
3833 if (fseek(input_file
, payload_offset
, SEEK_SET
))
3834 error(1, errno
, "Failed to seek to partition data");
3837 error(1, ENOMEM
, "Failed to allocate partition data");
3839 if (fread(part_data
, 1, part_size
, input_file
) < part_size
)
3840 error(1, errno
, "Failed to read partition data");
3842 part
->data
= part_data
;
3843 part
->size
= part_size
;
3844 part
->name
= entry
->name
;
3847 static void safeloader_parse_image(FILE *input_file
, struct safeloader_image_info
*image
)
3854 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
3856 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3857 error(1, errno
, "Can not read image header");
3859 if (ntohl(*((uint32_t *) &buf
[0])) <= SAFELOADER_HEADER_SIZE
)
3860 image
->type
= SAFELOADER_TYPE_VENDOR
;
3862 image
->type
= SAFELOADER_TYPE_DEFAULT
;
3864 image
->payload_offset
= SAFELOADER_PAYLOAD_OFFSET
;
3866 /* Parse image partition table */
3867 read_partition_table(input_file
, image
->payload_offset
, &image
->entries
[0],
3868 MAX_PARTITIONS
, PARTITION_TABLE_FWUP
);
3871 static void write_partition(
3873 size_t firmware_offset
,
3874 struct flash_partition_entry
*entry
,
3880 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3882 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3883 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3884 error(1, errno
, "Can not read partition from input_file");
3886 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3887 error(1, errno
, "Can not write partition to output_file");
3889 /* write last chunk smaller than buffer */
3890 if (offset
< entry
->size
) {
3891 offset
= entry
->size
- offset
;
3892 if (fread(buf
, offset
, 1, input_file
) != 1)
3893 error(1, errno
, "Can not read partition from input_file");
3894 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3895 error(1, errno
, "Can not write partition to output_file");
3899 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3902 char output
[PATH_MAX
];
3904 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3905 output_file
= fopen(output
, "wb+");
3906 if (output_file
== NULL
) {
3907 error(1, errno
, "Can not open output file %s", output
);
3910 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3912 fclose(output_file
);
3917 /** extract all partitions from the firmware file */
3918 static int extract_firmware(const char *input
, const char *output_directory
)
3920 struct safeloader_image_info info
= {};
3921 struct stat statbuf
;
3924 /* check input file */
3925 if (stat(input
, &statbuf
)) {
3926 error(1, errno
, "Can not read input firmware %s", input
);
3929 /* check if output directory exists */
3930 if (stat(output_directory
, &statbuf
)) {
3931 error(1, errno
, "Failed to stat output directory %s", output_directory
);
3934 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
3935 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
3938 input_file
= fopen(input
, "rb");
3939 safeloader_parse_image(input_file
, &info
);
3941 for (size_t i
= 0; i
< MAX_PARTITIONS
&& info
.entries
[i
].name
; i
++)
3942 extract_firmware_partition(input_file
, info
.payload_offset
, &info
.entries
[i
], output_directory
);
3947 static struct flash_partition_entry
*find_partition(
3948 struct flash_partition_entry
*entries
, size_t max_entries
,
3949 const char *name
, const char *error_msg
)
3951 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
3952 if (strcmp(entries
->name
, name
) == 0)
3957 error(1, 0, "%s", error_msg
);
3963 static int firmware_info(const char *input
)
3965 struct safeloader_image_info info
= {};
3966 struct image_partition_entry part
= {};
3967 struct flash_partition_entry
*e
;
3970 input_file
= fopen(input
, "rb");
3972 safeloader_parse_image(input_file
, &info
);
3974 if (info
.type
== SAFELOADER_TYPE_VENDOR
) {
3975 char buf
[SAFELOADER_HEADER_SIZE
] = {};
3976 uint32_t vendor_size
;
3978 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
3979 fread(&vendor_size
, sizeof(uint32_t), 1, input_file
);
3981 vendor_size
= ntohl(vendor_size
);
3982 fread(buf
, vendor_size
, 1, input_file
);
3984 printf("Firmware vendor string:\n");
3985 fwrite(buf
, strnlen(buf
, vendor_size
), 1, stdout
);
3989 printf("Firmware image partitions:\n");
3990 printf("%-8s %-8s %s\n", "base", "size", "name");
3992 e
= &info
.entries
[0];
3993 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
3994 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
3996 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "soft-version", NULL
);
3998 struct soft_version
*s
;
3999 unsigned int ascii_len
;
4004 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4005 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4006 buf
= part
.data
+ sizeof(struct meta_header
);
4008 /* Check for (null-terminated) string */
4010 while (ascii_len
< data_len
&& isascii(buf
[ascii_len
]))
4013 isstr
= ascii_len
== data_len
;
4015 printf("\n[Software version]\n");
4017 fwrite(buf
, strnlen((const char *) buf
, data_len
), 1, stdout
);
4019 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
4020 s
= (struct soft_version
*) buf
;
4022 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
4023 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
4024 printf("Revision: %d\n", ntohl(s
->rev
));
4026 printf("Failed to parse data\n");
4029 free_image_partition(&part
);
4032 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "support-list", NULL
);
4036 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4037 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4039 printf("\n[Support list]\n");
4040 fwrite(part
.data
+ sizeof(struct meta_header
), data_len
, 1, stdout
);
4043 free_image_partition(&part
);
4046 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "partition-table", NULL
);
4048 size_t flash_table_offset
= info
.payload_offset
+ e
->base
+ 4;
4049 struct flash_partition_entry parts
[MAX_PARTITIONS
] = {};
4051 if (read_partition_table(input_file
, flash_table_offset
, parts
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
))
4052 error(1, 0, "Error can not read the partition table (partition)");
4054 printf("\n[Partition table]\n");
4055 printf("%-8s %-8s %s\n", "base", "size", "name");
4058 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4059 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4067 static void write_ff(FILE *output_file
, size_t size
)
4072 memset(buf
, 0xff, sizeof(buf
));
4074 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
4075 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
4076 error(1, errno
, "Can not write 0xff to output_file");
4079 /* write last chunk smaller than buffer */
4080 if (offset
< size
) {
4081 offset
= size
- offset
;
4082 if (fwrite(buf
, offset
, 1, output_file
) != 1)
4083 error(1, errno
, "Can not write partition to output_file");
4087 static void convert_firmware(const char *input
, const char *output
)
4089 struct flash_partition_entry flash
[MAX_PARTITIONS
] = {};
4090 struct flash_partition_entry
*fwup_partition_table
;
4091 struct flash_partition_entry
*flash_file_system
;
4092 struct flash_partition_entry
*fwup_file_system
;
4093 struct flash_partition_entry
*flash_os_image
;
4094 struct flash_partition_entry
*fwup_os_image
;
4095 struct safeloader_image_info info
= {};
4096 size_t flash_table_offset
;
4097 struct stat statbuf
;
4101 /* check input file */
4102 if (stat(input
, &statbuf
)) {
4103 error(1, errno
, "Can not read input firmware %s", input
);
4106 input_file
= fopen(input
, "rb");
4108 error(1, 0, "Can not open input firmware %s", input
);
4110 output_file
= fopen(output
, "wb");
4112 error(1, 0, "Can not open output firmware %s", output
);
4114 input_file
= fopen(input
, "rb");
4115 safeloader_parse_image(input_file
, &info
);
4117 fwup_os_image
= find_partition(info
.entries
, MAX_PARTITIONS
,
4118 "os-image", "Error can not find os-image partition (fwup)");
4119 fwup_file_system
= find_partition(info
.entries
, MAX_PARTITIONS
,
4120 "file-system", "Error can not find file-system partition (fwup)");
4121 fwup_partition_table
= find_partition(info
.entries
, MAX_PARTITIONS
,
4122 "partition-table", "Error can not find partition-table partition");
4124 /* the flash partition table has a 0x00000004 magic haeder */
4125 flash_table_offset
= info
.payload_offset
+ fwup_partition_table
->base
+ 4;
4126 if (read_partition_table(input_file
, flash_table_offset
, flash
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
) != 0)
4127 error(1, 0, "Error can not read the partition table (flash)");
4129 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4130 "os-image", "Error can not find os-image partition (flash)");
4131 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4132 "file-system", "Error can not find file-system partition (flash)");
4134 /* write os_image to 0x0 */
4135 write_partition(input_file
, info
.payload_offset
, fwup_os_image
, output_file
);
4136 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4138 /* write file-system behind os_image */
4139 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4140 write_partition(input_file
, info
.payload_offset
, fwup_file_system
, output_file
);
4142 fclose(output_file
);
4146 int main(int argc
, char *argv
[]) {
4147 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4148 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4149 bool add_jffs2_eof
= false, sysupgrade
= false;
4151 struct device_info
*info
;
4152 set_source_date_epoch();
4157 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4163 info_image
= optarg
;
4171 kernel_image
= optarg
;
4175 rootfs_image
= optarg
;
4183 sscanf(optarg
, "r%u", &rev
);
4187 add_jffs2_eof
= true;
4199 output_directory
= optarg
;
4203 extract_image
= optarg
;
4207 convert_image
= optarg
;
4217 firmware_info(info_image
);
4218 } else if (extract_image
|| output_directory
) {
4220 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4221 if (!output_directory
)
4222 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4223 extract_firmware(extract_image
, output_directory
);
4224 } else if (convert_image
) {
4226 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4227 convert_firmware(convert_image
, output
);
4230 error(1, 0, "no board has been specified");
4232 error(1, 0, "no kernel image has been specified");
4234 error(1, 0, "no rootfs image has been specified");
4236 error(1, 0, "no output filename has been specified");
4238 info
= find_board(board
);
4241 error(1, 0, "unsupported board %s", board
);
4243 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);