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 * SAFELOADER_TYPE_CLOUD
147 * Standard preamble with size including preamble length, and checksum.
148 * Followed by the 'fw-type:Cloud' string and some (unknown) data.
149 * Payload starts at offset 0x1014.
151 * SAFELOADER_TYPE_QNEW
152 * Reversed order preamble, with (apparent) md5 checksum before the image
153 * size. The size does not include the preamble length.
154 * Header starts with 0x3C bytes, starting with the string '?NEW' (format not
155 * understood). Then another 0x1000 bytes follow, with the data payload
156 * starting at 0x1050.
158 enum safeloader_image_type
{
159 SAFELOADER_TYPE_DEFAULT
,
160 SAFELOADER_TYPE_VENDOR
,
161 SAFELOADER_TYPE_CLOUD
,
162 SAFELOADER_TYPE_QNEW
,
165 /* Internal representation of safeloader image data */
166 struct safeloader_image_info
{
167 enum safeloader_image_type type
;
168 size_t payload_offset
;
169 struct flash_partition_entry entries
[MAX_PARTITIONS
];
172 #define SAFELOADER_PREAMBLE_SIZE 0x14
173 #define SAFELOADER_HEADER_SIZE 0x1000
174 #define SAFELOADER_PAYLOAD_OFFSET (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_HEADER_SIZE)
176 #define SAFELOADER_QNEW_HEADER_SIZE 0x3C
177 #define SAFELOADER_QNEW_PAYLOAD_OFFSET \
178 (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_QNEW_HEADER_SIZE + SAFELOADER_HEADER_SIZE)
180 #define SAFELOADER_PAYLOAD_TABLE_SIZE 0x800
182 static const uint8_t jffs2_eof_mark
[4] = {0xde, 0xad, 0xc0, 0xde};
186 Salt for the MD5 hash
188 Fortunately, TP-LINK seems to use the same salt for most devices which use
189 the new image format.
191 static const uint8_t md5_salt
[16] = {
192 0x7a, 0x2b, 0x15, 0xed,
193 0x9b, 0x98, 0x59, 0x6d,
194 0xe5, 0x04, 0xab, 0x44,
195 0xac, 0x2a, 0x9f, 0x4e,
199 /** Firmware layout table */
200 static struct device_info boards
[] = {
201 /** Firmware layout for the CPE210/220 V1 */
204 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
207 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
208 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
209 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
210 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
211 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
212 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
213 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
215 .soft_ver
= SOFT_VER_DEFAULT
,
218 {"fs-uboot", 0x00000, 0x20000},
219 {"partition-table", 0x20000, 0x02000},
220 {"default-mac", 0x30000, 0x00020},
221 {"product-info", 0x31100, 0x00100},
222 {"signature", 0x32000, 0x00400},
223 {"firmware", 0x40000, 0x770000},
224 {"soft-version", 0x7b0000, 0x00100},
225 {"support-list", 0x7b1000, 0x00400},
226 {"user-config", 0x7c0000, 0x10000},
227 {"default-config", 0x7d0000, 0x10000},
228 {"log", 0x7e0000, 0x10000},
229 {"radio", 0x7f0000, 0x10000},
233 .first_sysupgrade_partition
= "os-image",
234 .last_sysupgrade_partition
= "support-list",
237 /** Firmware layout for the CPE210 V2 */
240 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
243 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
244 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
245 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
246 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
247 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
248 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
249 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
250 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
251 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
252 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
254 .soft_ver
= SOFT_VER_DEFAULT
,
257 {"fs-uboot", 0x00000, 0x20000},
258 {"partition-table", 0x20000, 0x02000},
259 {"default-mac", 0x30000, 0x00020},
260 {"product-info", 0x31100, 0x00100},
261 {"device-info", 0x31400, 0x00400},
262 {"signature", 0x32000, 0x00400},
263 {"device-id", 0x33000, 0x00100},
264 {"firmware", 0x40000, 0x770000},
265 {"soft-version", 0x7b0000, 0x00100},
266 {"support-list", 0x7b1000, 0x01000},
267 {"user-config", 0x7c0000, 0x10000},
268 {"default-config", 0x7d0000, 0x10000},
269 {"log", 0x7e0000, 0x10000},
270 {"radio", 0x7f0000, 0x10000},
274 .first_sysupgrade_partition
= "os-image",
275 .last_sysupgrade_partition
= "support-list",
278 /** Firmware layout for the CPE210 V3 */
281 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
284 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
285 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
286 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
287 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
288 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
289 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
290 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
291 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
292 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
293 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
294 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
296 .soft_ver
= SOFT_VER_DEFAULT
,
299 {"fs-uboot", 0x00000, 0x20000},
300 {"partition-table", 0x20000, 0x01000},
301 {"default-mac", 0x30000, 0x00020},
302 {"product-info", 0x31100, 0x00100},
303 {"device-info", 0x31400, 0x00400},
304 {"signature", 0x32000, 0x00400},
305 {"device-id", 0x33000, 0x00100},
306 {"firmware", 0x40000, 0x770000},
307 {"soft-version", 0x7b0000, 0x00100},
308 {"support-list", 0x7b1000, 0x01000},
309 {"user-config", 0x7c0000, 0x10000},
310 {"default-config", 0x7d0000, 0x10000},
311 {"log", 0x7e0000, 0x10000},
312 {"radio", 0x7f0000, 0x10000},
316 .first_sysupgrade_partition
= "os-image",
317 .last_sysupgrade_partition
= "support-list",
320 /** Firmware layout for the CPE220 V2 */
323 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
326 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
327 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
328 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
329 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
330 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
331 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
332 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
333 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
334 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
335 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
337 .soft_ver
= SOFT_VER_DEFAULT
,
340 {"fs-uboot", 0x00000, 0x20000},
341 {"partition-table", 0x20000, 0x02000},
342 {"default-mac", 0x30000, 0x00020},
343 {"product-info", 0x31100, 0x00100},
344 {"signature", 0x32000, 0x00400},
345 {"firmware", 0x40000, 0x770000},
346 {"soft-version", 0x7b0000, 0x00100},
347 {"support-list", 0x7b1000, 0x00400},
348 {"user-config", 0x7c0000, 0x10000},
349 {"default-config", 0x7d0000, 0x10000},
350 {"log", 0x7e0000, 0x10000},
351 {"radio", 0x7f0000, 0x10000},
355 .first_sysupgrade_partition
= "os-image",
356 .last_sysupgrade_partition
= "support-list",
359 /** Firmware layout for the CPE220 V3 */
362 .vendor
= "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
365 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
366 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
367 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
368 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
369 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
370 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
371 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
372 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
373 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
374 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
376 .soft_ver
= SOFT_VER_DEFAULT
,
379 {"fs-uboot", 0x00000, 0x20000},
380 {"partition-table", 0x20000, 0x02000},
381 {"default-mac", 0x30000, 0x00020},
382 {"product-info", 0x31100, 0x00100},
383 {"device-info", 0x31400, 0x00400},
384 {"signature", 0x32000, 0x00400},
385 {"device-id", 0x33000, 0x00100},
386 {"firmware", 0x40000, 0x770000},
387 {"soft-version", 0x7b0000, 0x00100},
388 {"support-list", 0x7b1000, 0x01000},
389 {"user-config", 0x7c0000, 0x10000},
390 {"default-config", 0x7d0000, 0x10000},
391 {"log", 0x7e0000, 0x10000},
392 {"radio", 0x7f0000, 0x10000},
396 .first_sysupgrade_partition
= "os-image",
397 .last_sysupgrade_partition
= "support-list",
400 /** Firmware layout for the CPE510/520 V1 */
403 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
406 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
407 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
408 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
409 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
410 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
411 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
412 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
413 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
415 .soft_ver
= SOFT_VER_DEFAULT
,
418 {"fs-uboot", 0x00000, 0x20000},
419 {"partition-table", 0x20000, 0x02000},
420 {"default-mac", 0x30000, 0x00020},
421 {"product-info", 0x31100, 0x00100},
422 {"signature", 0x32000, 0x00400},
423 {"firmware", 0x40000, 0x770000},
424 {"soft-version", 0x7b0000, 0x00100},
425 {"support-list", 0x7b1000, 0x00400},
426 {"user-config", 0x7c0000, 0x10000},
427 {"default-config", 0x7d0000, 0x10000},
428 {"log", 0x7e0000, 0x10000},
429 {"radio", 0x7f0000, 0x10000},
433 .first_sysupgrade_partition
= "os-image",
434 .last_sysupgrade_partition
= "support-list",
437 /** Firmware layout for the CPE510 V2 */
440 .vendor
= "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
443 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
444 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
445 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
446 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
447 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
448 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
449 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
450 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
451 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
452 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
453 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
454 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
456 .soft_ver
= SOFT_VER_DEFAULT
,
459 {"fs-uboot", 0x00000, 0x20000},
460 {"partition-table", 0x20000, 0x02000},
461 {"default-mac", 0x30000, 0x00020},
462 {"product-info", 0x31100, 0x00100},
463 {"signature", 0x32000, 0x00400},
464 {"firmware", 0x40000, 0x770000},
465 {"soft-version", 0x7b0000, 0x00100},
466 {"support-list", 0x7b1000, 0x00400},
467 {"user-config", 0x7c0000, 0x10000},
468 {"default-config", 0x7d0000, 0x10000},
469 {"log", 0x7e0000, 0x10000},
470 {"radio", 0x7f0000, 0x10000},
474 .first_sysupgrade_partition
= "os-image",
475 .last_sysupgrade_partition
= "support-list",
478 /** Firmware layout for the CPE510 V3 */
481 .vendor
= "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
484 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
485 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
486 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
487 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
488 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
489 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
490 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
491 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
492 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
493 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
494 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
495 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
496 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
497 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
498 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
500 .soft_ver
= SOFT_VER_DEFAULT
,
503 {"fs-uboot", 0x00000, 0x20000},
504 {"partition-table", 0x20000, 0x02000},
505 {"default-mac", 0x30000, 0x00020},
506 {"product-info", 0x31100, 0x00100},
507 {"signature", 0x32000, 0x00400},
508 {"firmware", 0x40000, 0x770000},
509 {"soft-version", 0x7b0000, 0x00100},
510 {"support-list", 0x7b1000, 0x00400},
511 {"user-config", 0x7c0000, 0x10000},
512 {"default-config", 0x7d0000, 0x10000},
513 {"log", 0x7e0000, 0x10000},
514 {"radio", 0x7f0000, 0x10000},
518 .first_sysupgrade_partition
= "os-image",
519 .last_sysupgrade_partition
= "support-list",
522 /** Firmware layout for the CPE605V1 */
525 .vendor
= "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
528 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
529 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
530 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
532 .soft_ver
= SOFT_VER_DEFAULT
,
535 {"fs-uboot", 0x00000, 0x20000},
536 {"partition-table", 0x20000, 0x02000},
537 {"default-mac", 0x30000, 0x00020},
538 {"serial-number", 0x30100, 0x00020},
539 {"product-info", 0x31100, 0x00100},
540 {"device-info", 0x31400, 0x00400},
541 {"signature", 0x32000, 0x00400},
542 {"device-id", 0x33000, 0x00100},
543 {"firmware", 0x40000, 0x770000},
544 {"soft-version", 0x7b0000, 0x00100},
545 {"support-list", 0x7b1000, 0x01000},
546 {"user-config", 0x7c0000, 0x10000},
547 {"default-config", 0x7d0000, 0x10000},
548 {"log", 0x7e0000, 0x10000},
549 {"radio", 0x7f0000, 0x10000},
553 .first_sysupgrade_partition
= "os-image",
554 .last_sysupgrade_partition
= "support-list",
557 /** Firmware layout for the CPE610V1 */
560 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
563 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
564 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
565 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
566 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
567 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
568 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
569 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
570 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
571 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
572 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
574 .soft_ver
= SOFT_VER_DEFAULT
,
577 {"fs-uboot", 0x00000, 0x20000},
578 {"partition-table", 0x20000, 0x02000},
579 {"default-mac", 0x30000, 0x00020},
580 {"product-info", 0x31100, 0x00100},
581 {"signature", 0x32000, 0x00400},
582 {"firmware", 0x40000, 0x770000},
583 {"soft-version", 0x7b0000, 0x00100},
584 {"support-list", 0x7b1000, 0x00400},
585 {"user-config", 0x7c0000, 0x10000},
586 {"default-config", 0x7d0000, 0x10000},
587 {"log", 0x7e0000, 0x10000},
588 {"radio", 0x7f0000, 0x10000},
592 .first_sysupgrade_partition
= "os-image",
593 .last_sysupgrade_partition
= "support-list",
596 /** Firmware layout for the CPE610V2 */
599 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
602 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
603 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
604 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
605 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
606 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
607 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
608 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
609 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
610 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
611 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
613 .soft_ver
= SOFT_VER_DEFAULT
,
616 {"fs-uboot", 0x00000, 0x20000},
617 {"partition-table", 0x20000, 0x02000},
618 {"default-mac", 0x30000, 0x00020},
619 {"product-info", 0x31100, 0x00100},
620 {"signature", 0x32000, 0x00400},
621 {"firmware", 0x40000, 0x770000},
622 {"soft-version", 0x7b0000, 0x00100},
623 {"support-list", 0x7b1000, 0x00400},
624 {"user-config", 0x7c0000, 0x10000},
625 {"default-config", 0x7d0000, 0x10000},
626 {"log", 0x7e0000, 0x10000},
627 {"radio", 0x7f0000, 0x10000},
631 .first_sysupgrade_partition
= "os-image",
632 .last_sysupgrade_partition
= "support-list",
634 /** Firmware layout for the CPE710 V1 */
637 .vendor
= "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
640 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
641 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
642 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
643 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
644 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
645 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
647 .soft_ver
= SOFT_VER_DEFAULT
,
650 {"fs-uboot", 0x00000, 0x50000},
651 {"partition-table", 0x50000, 0x02000},
652 {"default-mac", 0x60000, 0x00020},
653 {"serial-number", 0x60100, 0x00020},
654 {"product-info", 0x61100, 0x00100},
655 {"device-info", 0x61400, 0x00400},
656 {"signature", 0x62000, 0x00400},
657 {"device-id", 0x63000, 0x00100},
658 {"firmware", 0x70000, 0xf40000},
659 {"soft-version", 0xfb0000, 0x00100},
660 {"support-list", 0xfb1000, 0x01000},
661 {"user-config", 0xfc0000, 0x10000},
662 {"default-config", 0xfd0000, 0x10000},
663 {"log", 0xfe0000, 0x10000},
664 {"radio", 0xff0000, 0x10000},
668 .first_sysupgrade_partition
= "os-image",
669 .last_sysupgrade_partition
= "support-list",
674 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
677 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
678 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
679 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
681 .soft_ver
= SOFT_VER_DEFAULT
,
684 {"fs-uboot", 0x00000, 0x20000},
685 {"partition-table", 0x20000, 0x02000},
686 {"default-mac", 0x30000, 0x00020},
687 {"product-info", 0x31100, 0x00100},
688 {"signature", 0x32000, 0x00400},
689 {"firmware", 0x40000, 0x770000},
690 {"soft-version", 0x7b0000, 0x00100},
691 {"support-list", 0x7b1000, 0x00400},
692 {"user-config", 0x7c0000, 0x10000},
693 {"default-config", 0x7d0000, 0x10000},
694 {"log", 0x7e0000, 0x10000},
695 {"radio", 0x7f0000, 0x10000},
699 .first_sysupgrade_partition
= "os-image",
700 .last_sysupgrade_partition
= "support-list",
705 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
708 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
709 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
710 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
712 .soft_ver
= SOFT_VER_DEFAULT
,
715 {"fs-uboot", 0x00000, 0x20000},
716 {"partition-table", 0x20000, 0x02000},
717 {"default-mac", 0x30000, 0x00020},
718 {"product-info", 0x31100, 0x00100},
719 {"signature", 0x32000, 0x00400},
720 {"firmware", 0x40000, 0x770000},
721 {"soft-version", 0x7b0000, 0x00100},
722 {"support-list", 0x7b1000, 0x00400},
723 {"user-config", 0x7c0000, 0x10000},
724 {"default-config", 0x7d0000, 0x10000},
725 {"log", 0x7e0000, 0x10000},
726 {"radio", 0x7f0000, 0x10000},
730 .first_sysupgrade_partition
= "os-image",
731 .last_sysupgrade_partition
= "support-list",
736 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
739 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
740 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
741 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
742 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
744 .soft_ver
= SOFT_VER_DEFAULT
,
747 {"fs-uboot", 0x00000, 0x20000},
748 {"partition-table", 0x20000, 0x02000},
749 {"default-mac", 0x30000, 0x00020},
750 {"product-info", 0x31100, 0x00100},
751 {"signature", 0x32000, 0x00400},
752 {"firmware", 0x40000, 0x770000},
753 {"soft-version", 0x7b0000, 0x00100},
754 {"support-list", 0x7b1000, 0x00400},
755 {"user-config", 0x7c0000, 0x10000},
756 {"default-config", 0x7d0000, 0x10000},
757 {"log", 0x7e0000, 0x10000},
758 {"radio", 0x7f0000, 0x10000},
762 .first_sysupgrade_partition
= "os-image",
763 .last_sysupgrade_partition
= "support-list",
768 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
771 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
772 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
773 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
774 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
776 .soft_ver
= SOFT_VER_DEFAULT
,
779 {"fs-uboot", 0x00000, 0x20000},
780 {"partition-table", 0x20000, 0x02000},
781 {"default-mac", 0x30000, 0x00020},
782 {"product-info", 0x31100, 0x00100},
783 {"signature", 0x32000, 0x00400},
784 {"firmware", 0x40000, 0x770000},
785 {"soft-version", 0x7b0000, 0x00100},
786 {"support-list", 0x7b1000, 0x00400},
787 {"user-config", 0x7c0000, 0x10000},
788 {"default-config", 0x7d0000, 0x10000},
789 {"log", 0x7e0000, 0x10000},
790 {"radio", 0x7f0000, 0x10000},
794 .first_sysupgrade_partition
= "os-image",
795 .last_sysupgrade_partition
= "support-list",
798 /** Firmware layout for the AD7200 */
804 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
806 .soft_ver
= SOFT_VER_DEFAULT
,
809 {"SBL1", 0x00000, 0x20000},
810 {"MIBIB", 0x20000, 0x20000},
811 {"SBL2", 0x40000, 0x20000},
812 {"SBL3", 0x60000, 0x30000},
813 {"DDRCONFIG", 0x90000, 0x10000},
814 {"SSD", 0xa0000, 0x10000},
815 {"TZ", 0xb0000, 0x30000},
816 {"RPM", 0xe0000, 0x20000},
817 {"fs-uboot", 0x100000, 0x70000},
818 {"uboot-env", 0x170000, 0x40000},
819 {"radio", 0x1b0000, 0x40000},
820 {"os-image", 0x1f0000, 0x400000},
821 {"file-system", 0x5f0000, 0x1900000},
822 {"default-mac", 0x1ef0000, 0x00200},
823 {"pin", 0x1ef0200, 0x00200},
824 {"device-id", 0x1ef0400, 0x00200},
825 {"product-info", 0x1ef0600, 0x0fa00},
826 {"partition-table", 0x1f00000, 0x10000},
827 {"soft-version", 0x1f10000, 0x10000},
828 {"support-list", 0x1f20000, 0x10000},
829 {"profile", 0x1f30000, 0x10000},
830 {"default-config", 0x1f40000, 0x10000},
831 {"user-config", 0x1f50000, 0x40000},
832 {"qos-db", 0x1f90000, 0x40000},
833 {"usb-config", 0x1fd0000, 0x10000},
834 {"log", 0x1fe0000, 0x20000},
838 .first_sysupgrade_partition
= "os-image",
839 .last_sysupgrade_partition
= "file-system"
842 /** Firmware layout for the C2600 */
848 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
850 .soft_ver
= SOFT_VER_DEFAULT
,
853 We use a bigger os-image partition than the stock images (and thus
854 smaller file-system), as our kernel doesn't fit in the stock firmware's
855 2 MB os-image since kernel 4.14.
858 {"SBL1", 0x00000, 0x20000},
859 {"MIBIB", 0x20000, 0x20000},
860 {"SBL2", 0x40000, 0x20000},
861 {"SBL3", 0x60000, 0x30000},
862 {"DDRCONFIG", 0x90000, 0x10000},
863 {"SSD", 0xa0000, 0x10000},
864 {"TZ", 0xb0000, 0x30000},
865 {"RPM", 0xe0000, 0x20000},
866 {"fs-uboot", 0x100000, 0x70000},
867 {"uboot-env", 0x170000, 0x40000},
868 {"radio", 0x1b0000, 0x40000},
869 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
870 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
871 {"default-mac", 0x1ef0000, 0x00200},
872 {"pin", 0x1ef0200, 0x00200},
873 {"product-info", 0x1ef0400, 0x0fc00},
874 {"partition-table", 0x1f00000, 0x10000},
875 {"soft-version", 0x1f10000, 0x10000},
876 {"support-list", 0x1f20000, 0x10000},
877 {"profile", 0x1f30000, 0x10000},
878 {"default-config", 0x1f40000, 0x10000},
879 {"user-config", 0x1f50000, 0x40000},
880 {"qos-db", 0x1f90000, 0x40000},
881 {"usb-config", 0x1fd0000, 0x10000},
882 {"log", 0x1fe0000, 0x20000},
886 .first_sysupgrade_partition
= "os-image",
887 .last_sysupgrade_partition
= "file-system"
890 /** Firmware layout for the A7-V5 */
892 .id
= "ARCHER-A7-V5",
895 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
896 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
897 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
898 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
899 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
900 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
902 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
904 /* We're using a dynamic kernel/rootfs split here */
906 {"factory-boot", 0x00000, 0x20000},
907 {"fs-uboot", 0x20000, 0x20000},
908 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
909 /* Stock: name file-system base 0x160000 size 0xda0000 */
910 {"default-mac", 0xf40000, 0x00200},
911 {"pin", 0xf40200, 0x00200},
912 {"device-id", 0xf40400, 0x00100},
913 {"product-info", 0xf40500, 0x0fb00},
914 {"soft-version", 0xf50000, 0x00100},
915 {"extra-para", 0xf51000, 0x01000},
916 {"support-list", 0xf52000, 0x0a000},
917 {"profile", 0xf5c000, 0x04000},
918 {"default-config", 0xf60000, 0x10000},
919 {"user-config", 0xf70000, 0x40000},
920 {"certificate", 0xfb0000, 0x10000},
921 {"partition-table", 0xfc0000, 0x10000},
922 {"log", 0xfd0000, 0x20000},
923 {"radio", 0xff0000, 0x10000},
927 .first_sysupgrade_partition
= "os-image",
928 .last_sysupgrade_partition
= "file-system",
931 /** Firmware layout for the Archer A9 v6 */
933 .id
= "ARCHER-A9-V6",
936 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
937 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
938 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
939 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
940 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
942 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
944 /* We're using a dynamic kernel/rootfs split here */
946 {"factory-boot", 0x00000, 0x20000},
947 {"fs-uboot", 0x20000, 0x20000},
948 {"partition-table", 0x40000, 0x10000},
949 {"radio", 0x50000, 0x10000},
950 {"default-mac", 0x60000, 0x00200},
951 {"pin", 0x60200, 0x00200},
952 {"device-id", 0x60400, 0x00100},
953 {"product-info", 0x60500, 0x0fb00},
954 {"soft-version", 0x70000, 0x01000},
955 {"extra-para", 0x71000, 0x01000},
956 {"support-list", 0x72000, 0x0a000},
957 {"profile", 0x7c000, 0x04000},
958 {"user-config", 0x80000, 0x10000},
959 {"ap-config", 0x90000, 0x10000},
960 {"apdef-config", 0xa0000, 0x10000},
961 {"router-config", 0xb0000, 0x10000},
962 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
963 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
964 {"log", 0xfc0000, 0x20000},
965 {"certificate", 0xfe0000, 0x10000},
966 {"default-config", 0xff0000, 0x10000},
970 .first_sysupgrade_partition
= "os-image",
971 .last_sysupgrade_partition
= "file-system",
974 /** Firmware layout for the Archer AX23 v1 */
976 .id
= "ARCHER-AX23-V1",
980 "{product_name:Archer AX23,product_ver:1.0,special_id:45550000}\n"
981 "{product_name:Archer AX23,product_ver:1.0,special_id:4A500000}\n"
982 "{product_name:Archer AX23,product_ver:1.0,special_id:4B520000}\n"
983 "{product_name:Archer AX23,product_ver:1.0,special_id:52550000}\n"
984 "{product_name:Archer AX23,product_ver:1.0.0,special_id:43410000}\n"
985 "{product_name:Archer AX23,product_ver:1.0.0,special_id:54570000}\n"
986 "{product_name:Archer AX23,product_ver:1.0.0,special_id:55530000}\n"
987 "{product_name:Archer AX23,product_ver:1.20,special_id:45550000}\n"
988 "{product_name:Archer AX23,product_ver:1.20,special_id:4A500000}\n"
989 "{product_name:Archer AX23,product_ver:1.20,special_id:55530000}\n"
990 "{product_name:Archer AX1800,product_ver:1.20,special_id:45550000}\n"
991 "{product_name:Archer AX1800,product_ver:1.20,special_id:52550000}\n",
993 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.3\n"),
996 {"fs-uboot", 0x00000, 0x40000},
997 {"firmware", 0x40000, 0xf60000},
998 {"default-mac", 0xfa0000, 0x00200},
999 {"pin", 0xfa0200, 0x00100},
1000 {"device-id", 0xfa0300, 0x00100},
1001 {"product-info", 0xfa0400, 0x0fc00},
1002 {"default-config", 0xfb0000, 0x08000},
1003 {"ap-def-config", 0xfb8000, 0x08000},
1004 {"user-config", 0xfc0000, 0x0a000},
1005 {"ag-config", 0xfca000, 0x04000},
1006 {"certificate", 0xfce000, 0x02000},
1007 {"ap-config", 0xfd0000, 0x06000},
1008 {"router-config", 0xfd6000, 0x06000},
1009 {"favicon", 0xfdc000, 0x02000},
1010 {"logo", 0xfde000, 0x02000},
1011 {"partition-table", 0xfe0000, 0x00800},
1012 {"soft-version", 0xfe0800, 0x00100},
1013 {"support-list", 0xfe0900, 0x00400},
1014 {"profile", 0xfe0d00, 0x03000},
1015 {"extra-para", 0xfe3d00, 0x00100},
1016 {"radio", 0xff0000, 0x10000},
1019 .first_sysupgrade_partition
= "os-image",
1020 .last_sysupgrade_partition
= "file-system",
1022 /** Firmware layout for the C2v3 */
1024 .id
= "ARCHER-C2-V3",
1027 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
1028 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
1029 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
1031 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.1\n"),
1033 /** We're using a dynamic kernel/rootfs split here */
1036 {"factory-boot", 0x00000, 0x20000},
1037 {"fs-uboot", 0x20000, 0x10000},
1038 {"firmware", 0x30000, 0x7a0000},
1039 {"user-config", 0x7d0000, 0x04000},
1040 {"default-mac", 0x7e0000, 0x00100},
1041 {"device-id", 0x7e0100, 0x00100},
1042 {"extra-para", 0x7e0200, 0x00100},
1043 {"pin", 0x7e0300, 0x00100},
1044 {"support-list", 0x7e0400, 0x00400},
1045 {"soft-version", 0x7e0800, 0x00400},
1046 {"product-info", 0x7e0c00, 0x01400},
1047 {"partition-table", 0x7e2000, 0x01000},
1048 {"profile", 0x7e3000, 0x01000},
1049 {"default-config", 0x7e4000, 0x04000},
1050 {"merge-config", 0x7ec000, 0x02000},
1051 {"qos-db", 0x7ee000, 0x02000},
1052 {"radio", 0x7f0000, 0x10000},
1056 .first_sysupgrade_partition
= "os-image",
1057 .last_sysupgrade_partition
= "file-system",
1060 /** Firmware layout for the C25v1 */
1062 .id
= "ARCHER-C25-V1",
1065 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1066 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1067 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1069 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1071 /* We're using a dynamic kernel/rootfs split here */
1073 {"factory-boot", 0x00000, 0x20000},
1074 {"fs-uboot", 0x20000, 0x10000},
1075 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1076 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1077 {"user-config", 0x7d0000, 0x04000},
1078 {"default-mac", 0x7e0000, 0x00100},
1079 {"device-id", 0x7e0100, 0x00100},
1080 {"extra-para", 0x7e0200, 0x00100},
1081 {"pin", 0x7e0300, 0x00100},
1082 {"support-list", 0x7e0400, 0x00400},
1083 {"soft-version", 0x7e0800, 0x00400},
1084 {"product-info", 0x7e0c00, 0x01400},
1085 {"partition-table", 0x7e2000, 0x01000},
1086 {"profile", 0x7e3000, 0x01000},
1087 {"default-config", 0x7e4000, 0x04000},
1088 {"merge-config", 0x7ec000, 0x02000},
1089 {"qos-db", 0x7ee000, 0x02000},
1090 {"radio", 0x7f0000, 0x10000},
1094 .first_sysupgrade_partition
= "os-image",
1095 .last_sysupgrade_partition
= "file-system",
1098 /** Firmware layout for the C58v1 */
1100 .id
= "ARCHER-C58-V1",
1104 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1105 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1106 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1108 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1111 {"fs-uboot", 0x00000, 0x10000},
1112 {"default-mac", 0x10000, 0x00200},
1113 {"pin", 0x10200, 0x00200},
1114 {"product-info", 0x10400, 0x00100},
1115 {"partition-table", 0x10500, 0x00800},
1116 {"soft-version", 0x11300, 0x00200},
1117 {"support-list", 0x11500, 0x00100},
1118 {"device-id", 0x11600, 0x00100},
1119 {"profile", 0x11700, 0x03900},
1120 {"default-config", 0x15000, 0x04000},
1121 {"user-config", 0x19000, 0x04000},
1122 {"firmware", 0x20000, 0x7c8000},
1123 {"certyficate", 0x7e8000, 0x08000},
1124 {"radio", 0x7f0000, 0x10000},
1128 .first_sysupgrade_partition
= "os-image",
1129 .last_sysupgrade_partition
= "file-system",
1132 /** Firmware layout for the C59v1 */
1134 .id
= "ARCHER-C59-V1",
1138 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1139 "{product_name:Archer C59,product_ver:1.0.0,special_id:43410000}\r\n"
1140 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1141 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1142 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1144 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1146 /* We're using a dynamic kernel/rootfs split here */
1148 {"fs-uboot", 0x00000, 0x10000},
1149 {"default-mac", 0x10000, 0x00200},
1150 {"pin", 0x10200, 0x00200},
1151 {"device-id", 0x10400, 0x00100},
1152 {"product-info", 0x10500, 0x0fb00},
1153 {"firmware", 0x20000, 0xe30000},
1154 {"partition-table", 0xe50000, 0x10000},
1155 {"soft-version", 0xe60000, 0x10000},
1156 {"support-list", 0xe70000, 0x10000},
1157 {"profile", 0xe80000, 0x10000},
1158 {"default-config", 0xe90000, 0x10000},
1159 {"user-config", 0xea0000, 0x40000},
1160 {"usb-config", 0xee0000, 0x10000},
1161 {"certificate", 0xef0000, 0x10000},
1162 {"qos-db", 0xf00000, 0x40000},
1163 {"log", 0xfe0000, 0x10000},
1164 {"radio", 0xff0000, 0x10000},
1168 .first_sysupgrade_partition
= "os-image",
1169 .last_sysupgrade_partition
= "file-system",
1172 /** Firmware layout for the C59v2 */
1174 .id
= "ARCHER-C59-V2",
1178 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1179 "{product_name:Archer C59,product_ver:2.0.0,special_id:43410000}\r\n"
1180 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1181 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1183 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1185 /** We're using a dynamic kernel/rootfs split here */
1187 {"factory-boot", 0x00000, 0x20000},
1188 {"fs-uboot", 0x20000, 0x10000},
1189 {"default-mac", 0x30000, 0x00200},
1190 {"pin", 0x30200, 0x00200},
1191 {"device-id", 0x30400, 0x00100},
1192 {"product-info", 0x30500, 0x0fb00},
1193 {"firmware", 0x40000, 0xe10000},
1194 {"partition-table", 0xe50000, 0x10000},
1195 {"soft-version", 0xe60000, 0x10000},
1196 {"support-list", 0xe70000, 0x10000},
1197 {"profile", 0xe80000, 0x10000},
1198 {"default-config", 0xe90000, 0x10000},
1199 {"user-config", 0xea0000, 0x40000},
1200 {"usb-config", 0xee0000, 0x10000},
1201 {"certificate", 0xef0000, 0x10000},
1202 {"extra-para", 0xf00000, 0x10000},
1203 {"qos-db", 0xf10000, 0x30000},
1204 {"log", 0xfe0000, 0x10000},
1205 {"radio", 0xff0000, 0x10000},
1209 .first_sysupgrade_partition
= "os-image",
1210 .last_sysupgrade_partition
= "file-system",
1213 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1215 .id
= "ARCHER-C6-V2",
1219 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1220 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1221 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1222 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1224 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1227 {"fs-uboot", 0x00000, 0x20000},
1228 {"default-mac", 0x20000, 0x00200},
1229 {"pin", 0x20200, 0x00100},
1230 {"product-info", 0x20300, 0x00200},
1231 {"device-id", 0x20500, 0x0fb00},
1232 {"firmware", 0x30000, 0x7a9400},
1233 {"soft-version", 0x7d9400, 0x00100},
1234 {"extra-para", 0x7d9500, 0x00100},
1235 {"support-list", 0x7d9600, 0x00200},
1236 {"profile", 0x7d9800, 0x03000},
1237 {"default-config", 0x7dc800, 0x03000},
1238 {"partition-table", 0x7df800, 0x00800},
1239 {"user-config", 0x7e0000, 0x0c000},
1240 {"certificate", 0x7ec000, 0x04000},
1241 {"radio", 0x7f0000, 0x10000},
1245 .first_sysupgrade_partition
= "os-image",
1246 .last_sysupgrade_partition
= "file-system",
1249 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1251 .id
= "ARCHER-C6-V2-US",
1255 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1256 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1257 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1259 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1262 {"factory-boot", 0x00000, 0x20000},
1263 {"default-mac", 0x20000, 0x00200},
1264 {"pin", 0x20200, 0x00100},
1265 {"product-info", 0x20300, 0x00200},
1266 {"device-id", 0x20500, 0x0fb00},
1267 {"fs-uboot", 0x30000, 0x20000},
1268 {"firmware", 0x50000, 0xf89400},
1269 {"soft-version", 0xfd9400, 0x00100},
1270 {"extra-para", 0xfd9500, 0x00100},
1271 {"support-list", 0xfd9600, 0x00200},
1272 {"profile", 0xfd9800, 0x03000},
1273 {"default-config", 0xfdc800, 0x03000},
1274 {"partition-table", 0xfdf800, 0x00800},
1275 {"user-config", 0xfe0000, 0x0c000},
1276 {"certificate", 0xfec000, 0x04000},
1277 {"radio", 0xff0000, 0x10000},
1280 .first_sysupgrade_partition
= "os-image",
1281 .last_sysupgrade_partition
= "file-system",
1283 /** Firmware layout for the Archer C6 v3 */
1285 .id
= "ARCHER-C6-V3",
1289 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1290 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1291 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1292 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1293 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1294 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1296 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1299 {"fs-uboot", 0x00000, 0x40000},
1300 {"firmware", 0x40000, 0xf60000},
1301 {"default-mac", 0xfa0000, 0x00200},
1302 {"pin", 0xfa0200, 0x00100},
1303 {"device-id", 0xfa0300, 0x00100},
1304 {"product-info", 0xfa0400, 0x0fc00},
1305 {"default-config", 0xfb0000, 0x08000},
1306 {"ap-def-config", 0xfb8000, 0x08000},
1307 {"user-config", 0xfc0000, 0x0a000},
1308 {"ag-config", 0xfca000, 0x04000},
1309 {"certificate", 0xfce000, 0x02000},
1310 {"ap-config", 0xfd0000, 0x06000},
1311 {"router-config", 0xfd6000, 0x06000},
1312 {"favicon", 0xfdc000, 0x02000},
1313 {"logo", 0xfde000, 0x02000},
1314 {"partition-table", 0xfe0000, 0x00800},
1315 {"soft-version", 0xfe0800, 0x00100},
1316 {"support-list", 0xfe0900, 0x00200},
1317 {"profile", 0xfe0b00, 0x03000},
1318 {"extra-para", 0xfe3b00, 0x00100},
1319 {"radio", 0xff0000, 0x10000},
1322 .first_sysupgrade_partition
= "os-image",
1323 .last_sysupgrade_partition
= "file-system",
1325 /** Firmware layout for the Archer A6 v3 */
1327 .id
= "ARCHER-A6-V3",
1331 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1332 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1333 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1334 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1336 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1339 {"fs-uboot", 0x00000, 0x40000},
1340 {"firmware", 0x40000, 0xf60000},
1341 {"default-mac", 0xfa0000, 0x00200},
1342 {"pin", 0xfa0200, 0x00100},
1343 {"device-id", 0xfa0300, 0x00100},
1344 {"product-info", 0xfa0400, 0x0fc00},
1345 {"default-config", 0xfb0000, 0x08000},
1346 {"ap-def-config", 0xfb8000, 0x08000},
1347 {"user-config", 0xfc0000, 0x0a000},
1348 {"ag-config", 0xfca000, 0x04000},
1349 {"certificate", 0xfce000, 0x02000},
1350 {"ap-config", 0xfd0000, 0x06000},
1351 {"router-config", 0xfd6000, 0x06000},
1352 {"favicon", 0xfdc000, 0x02000},
1353 {"logo", 0xfde000, 0x02000},
1354 {"partition-table", 0xfe0000, 0x00800},
1355 {"soft-version", 0xfe0800, 0x00100},
1356 {"support-list", 0xfe0900, 0x00200},
1357 {"profile", 0xfe0b00, 0x03000},
1358 {"extra-para", 0xfe3b00, 0x00100},
1359 {"radio", 0xff0000, 0x10000},
1362 .first_sysupgrade_partition
= "os-image",
1363 .last_sysupgrade_partition
= "file-system",
1365 /** Firmware layout for the Archer C6U v1 */
1367 .id
= "ARCHER-C6U-V1",
1371 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1373 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1376 {"fs-uboot", 0x00000, 0x40000},
1377 {"firmware", 0x40000, 0xf60000},
1378 {"default-mac", 0xfa0000, 0x00200},
1379 {"pin", 0xfa0200, 0x00100},
1380 {"device-id", 0xfa0300, 0x00100},
1381 {"product-info", 0xfa0400, 0x0fc00},
1382 {"default-config", 0xfb0000, 0x08000},
1383 {"ap-def-config", 0xfb8000, 0x08000},
1384 {"user-config", 0xfc0000, 0x0c000},
1385 {"certificate", 0xfcc000, 0x04000},
1386 {"ap-config", 0xfd0000, 0x08000},
1387 {"router-config", 0xfd8000, 0x08000},
1388 {"partition-table", 0xfe0000, 0x00800},
1389 {"soft-version", 0xfe0800, 0x00100},
1390 {"support-list", 0xfe0900, 0x00200},
1391 {"profile", 0xfe0b00, 0x03000},
1392 {"extra-para", 0xfe3b00, 0x00100},
1393 {"radio", 0xff0000, 0x10000},
1396 .first_sysupgrade_partition
= "os-image",
1397 .last_sysupgrade_partition
= "file-system",
1399 /** Firmware layout for the C60v1 */
1401 .id
= "ARCHER-C60-V1",
1405 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1406 "{product_name:Archer C60,product_ver:1.0.0,special_id:43410000}\r\n"
1407 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1408 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1410 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1413 {"fs-uboot", 0x00000, 0x10000},
1414 {"default-mac", 0x10000, 0x00200},
1415 {"pin", 0x10200, 0x00200},
1416 {"product-info", 0x10400, 0x00100},
1417 {"partition-table", 0x10500, 0x00800},
1418 {"soft-version", 0x11300, 0x00200},
1419 {"support-list", 0x11500, 0x00100},
1420 {"device-id", 0x11600, 0x00100},
1421 {"profile", 0x11700, 0x03900},
1422 {"default-config", 0x15000, 0x04000},
1423 {"user-config", 0x19000, 0x04000},
1424 {"firmware", 0x20000, 0x7c8000},
1425 {"certyficate", 0x7e8000, 0x08000},
1426 {"radio", 0x7f0000, 0x10000},
1430 .first_sysupgrade_partition
= "os-image",
1431 .last_sysupgrade_partition
= "file-system",
1434 /** Firmware layout for the C60v2 */
1436 .id
= "ARCHER-C60-V2",
1440 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1441 "{product_name:Archer C60,product_ver:2.0.0,special_id:43410000}\r\n"
1442 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1443 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1445 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1448 {"factory-boot", 0x00000, 0x1fb00},
1449 {"default-mac", 0x1fb00, 0x00200},
1450 {"pin", 0x1fd00, 0x00100},
1451 {"product-info", 0x1fe00, 0x00100},
1452 {"device-id", 0x1ff00, 0x00100},
1453 {"fs-uboot", 0x20000, 0x10000},
1454 {"firmware", 0x30000, 0x7a0000},
1455 {"soft-version", 0x7d9500, 0x00100},
1456 {"support-list", 0x7d9600, 0x00100},
1457 {"extra-para", 0x7d9700, 0x00100},
1458 {"profile", 0x7d9800, 0x03000},
1459 {"default-config", 0x7dc800, 0x03000},
1460 {"partition-table", 0x7df800, 0x00800},
1461 {"user-config", 0x7e0000, 0x0c000},
1462 {"certificate", 0x7ec000, 0x04000},
1463 {"radio", 0x7f0000, 0x10000},
1467 .first_sysupgrade_partition
= "os-image",
1468 .last_sysupgrade_partition
= "file-system",
1471 /** Firmware layout for the C60v3 */
1473 .id
= "ARCHER-C60-V3",
1477 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1478 "{product_name:Archer C60,product_ver:3.0.0,special_id:43410000}\r\n"
1479 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1480 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1482 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1485 {"factory-boot", 0x00000, 0x1fb00},
1486 {"default-mac", 0x1fb00, 0x00200},
1487 {"pin", 0x1fd00, 0x00100},
1488 {"product-info", 0x1fe00, 0x00100},
1489 {"device-id", 0x1ff00, 0x00100},
1490 {"fs-uboot", 0x20000, 0x10000},
1491 {"firmware", 0x30000, 0x7a0000},
1492 {"soft-version", 0x7d9500, 0x00100},
1493 {"support-list", 0x7d9600, 0x00100},
1494 {"extra-para", 0x7d9700, 0x00100},
1495 {"profile", 0x7d9800, 0x03000},
1496 {"default-config", 0x7dc800, 0x03000},
1497 {"partition-table", 0x7df800, 0x00800},
1498 {"user-config", 0x7e0000, 0x0c000},
1499 {"certificate", 0x7ec000, 0x04000},
1500 {"radio", 0x7f0000, 0x10000},
1504 .first_sysupgrade_partition
= "os-image",
1505 .last_sysupgrade_partition
= "file-system",
1508 /** Firmware layout for the C5 */
1510 .id
= "ARCHER-C5-V2",
1514 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1515 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1516 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1518 .soft_ver
= SOFT_VER_DEFAULT
,
1521 {"fs-uboot", 0x00000, 0x40000},
1522 {"os-image", 0x40000, 0x200000},
1523 {"file-system", 0x240000, 0xc00000},
1524 {"default-mac", 0xe40000, 0x00200},
1525 {"pin", 0xe40200, 0x00200},
1526 {"product-info", 0xe40400, 0x00200},
1527 {"partition-table", 0xe50000, 0x10000},
1528 {"soft-version", 0xe60000, 0x00200},
1529 {"support-list", 0xe61000, 0x0f000},
1530 {"profile", 0xe70000, 0x10000},
1531 {"default-config", 0xe80000, 0x10000},
1532 {"user-config", 0xe90000, 0x50000},
1533 {"log", 0xee0000, 0x100000},
1534 {"radio_bk", 0xfe0000, 0x10000},
1535 {"radio", 0xff0000, 0x10000},
1539 .first_sysupgrade_partition
= "os-image",
1540 .last_sysupgrade_partition
= "file-system"
1543 /** Firmware layout for the C7 */
1545 .id
= "ARCHER-C7-V4",
1548 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1549 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1550 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1551 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1552 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1553 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1554 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1555 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1556 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1557 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1559 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1561 /* We're using a dynamic kernel/rootfs split here */
1563 {"factory-boot", 0x00000, 0x20000},
1564 {"fs-uboot", 0x20000, 0x20000},
1565 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1566 /* Stock: name file-system base 0x160000 size 0xda0000 */
1567 {"default-mac", 0xf00000, 0x00200},
1568 {"pin", 0xf00200, 0x00200},
1569 {"device-id", 0xf00400, 0x00100},
1570 {"product-info", 0xf00500, 0x0fb00},
1571 {"soft-version", 0xf10000, 0x00100},
1572 {"extra-para", 0xf11000, 0x01000},
1573 {"support-list", 0xf12000, 0x0a000},
1574 {"profile", 0xf1c000, 0x04000},
1575 {"default-config", 0xf20000, 0x10000},
1576 {"user-config", 0xf30000, 0x40000},
1577 {"qos-db", 0xf70000, 0x40000},
1578 {"certificate", 0xfb0000, 0x10000},
1579 {"partition-table", 0xfc0000, 0x10000},
1580 {"log", 0xfd0000, 0x20000},
1581 {"radio", 0xff0000, 0x10000},
1585 .first_sysupgrade_partition
= "os-image",
1586 .last_sysupgrade_partition
= "file-system",
1589 /** Firmware layout for the C7 v5*/
1591 .id
= "ARCHER-C7-V5",
1594 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1595 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1596 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1597 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1598 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1599 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1600 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1601 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1604 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1606 /* We're using a dynamic kernel/rootfs split here */
1608 {"factory-boot", 0x00000, 0x20000},
1609 {"fs-uboot", 0x20000, 0x20000},
1610 {"partition-table", 0x40000, 0x10000},
1611 {"radio", 0x50000, 0x10000},
1612 {"default-mac", 0x60000, 0x00200},
1613 {"pin", 0x60200, 0x00200},
1614 {"device-id", 0x60400, 0x00100},
1615 {"product-info", 0x60500, 0x0fb00},
1616 {"soft-version", 0x70000, 0x01000},
1617 {"extra-para", 0x71000, 0x01000},
1618 {"support-list", 0x72000, 0x0a000},
1619 {"profile", 0x7c000, 0x04000},
1620 {"user-config", 0x80000, 0x40000},
1623 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1624 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1626 {"log", 0xfc0000, 0x20000},
1627 {"certificate", 0xfe0000, 0x10000},
1628 {"default-config", 0xff0000, 0x10000},
1633 .first_sysupgrade_partition
= "os-image",
1634 .last_sysupgrade_partition
= "file-system",
1637 /** Firmware layout for the C9 */
1643 "{product_name:ArcherC9,"
1644 "product_ver:1.0.0,"
1645 "special_id:00000000}\n",
1647 .soft_ver
= SOFT_VER_DEFAULT
,
1650 {"fs-uboot", 0x00000, 0x40000},
1651 {"os-image", 0x40000, 0x200000},
1652 {"file-system", 0x240000, 0xc00000},
1653 {"default-mac", 0xe40000, 0x00200},
1654 {"pin", 0xe40200, 0x00200},
1655 {"product-info", 0xe40400, 0x00200},
1656 {"partition-table", 0xe50000, 0x10000},
1657 {"soft-version", 0xe60000, 0x00200},
1658 {"support-list", 0xe61000, 0x0f000},
1659 {"profile", 0xe70000, 0x10000},
1660 {"default-config", 0xe80000, 0x10000},
1661 {"user-config", 0xe90000, 0x50000},
1662 {"log", 0xee0000, 0x100000},
1663 {"radio_bk", 0xfe0000, 0x10000},
1664 {"radio", 0xff0000, 0x10000},
1668 .first_sysupgrade_partition
= "os-image",
1669 .last_sysupgrade_partition
= "file-system"
1672 /** Firmware layout for the Deco M4R v1 and v2 */
1674 .id
= "DECO-M4R-V1",
1678 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1679 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1680 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1681 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1682 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1683 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1684 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1685 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1686 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1687 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1688 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1689 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1690 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1691 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1692 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1693 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1695 .soft_ver
= SOFT_VER_DEFAULT
,
1698 {"fs-uboot", 0x00000, 0x80000},
1699 {"firmware", 0x80000, 0xe00000},
1700 {"product-info", 0xe80000, 0x05000},
1701 {"default-mac", 0xe85000, 0x01000},
1702 {"device-id", 0xe86000, 0x01000},
1703 {"support-list", 0xe87000, 0x10000},
1704 {"user-config", 0xea7000, 0x10000},
1705 {"device-config", 0xeb7000, 0x10000},
1706 {"group-info", 0xec7000, 0x10000},
1707 {"partition-table", 0xed7000, 0x02000},
1708 {"soft-version", 0xed9000, 0x10000},
1709 {"profile", 0xee9000, 0x10000},
1710 {"default-config", 0xef9000, 0x10000},
1711 {"url-sig", 0xfe0000, 0x10000},
1712 {"radio", 0xff0000, 0x10000},
1715 .first_sysupgrade_partition
= "os-image",
1716 .last_sysupgrade_partition
= "file-system",
1719 /** Firmware layout for the Deco M4R v4 */
1721 .id
= "DECO-M4R-V4",
1725 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1726 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1727 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1728 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1729 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1731 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1734 {"fs-uboot", 0x00000, 0x40000},
1735 {"firmware", 0x40000, 0xf60000},
1736 {"default-mac", 0xfa0000, 0x00300},
1737 {"device-id", 0xfa0300, 0x00100},
1738 {"product-info", 0xfa0400, 0x0fc00},
1739 {"group-info", 0xfb0000, 0x04000},
1740 {"user-config", 0xfb4000, 0x0c000},
1741 {"device-config", 0xfc0000, 0x10000},
1742 {"default-config", 0xfd0000, 0x10000},
1743 {"partition-table", 0xfe0000, 0x00800},
1744 {"soft-version", 0xfe0800, 0x00100},
1745 {"support-list", 0xfe0900, 0x00200},
1746 {"profile", 0xfe0b00, 0x03000},
1747 {"extra-para", 0xfe3b00, 0x00100},
1748 {"radio", 0xff0000, 0x10000},
1751 .first_sysupgrade_partition
= "os-image",
1752 .last_sysupgrade_partition
= "file-system",
1755 /** Firmware layout for the Deco S4 v2 */
1761 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1762 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1763 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1764 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1765 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1766 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1767 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1768 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1769 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1770 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1771 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1772 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1774 .soft_ver
= SOFT_VER_DEFAULT
,
1777 {"fs-uboot", 0x00000, 0x80000},
1778 {"product-info", 0x80000, 0x05000},
1779 {"default-mac", 0x85000, 0x01000},
1780 {"device-id", 0x86000, 0x01000},
1781 {"support-list", 0x87000, 0x10000},
1782 {"user-config", 0xa7000, 0x10000},
1783 {"device-config", 0xb7000, 0x10000},
1784 {"group-info", 0xc7000, 0x10000},
1785 {"partition-table", 0xd7000, 0x02000},
1786 {"soft-version", 0xd9000, 0x10000},
1787 {"profile", 0xe9000, 0x10000},
1788 {"default-config", 0xf9000, 0x10000},
1789 {"url-sig", 0x1e0000, 0x10000},
1790 {"radio", 0x1f0000, 0x10000},
1791 {"firmware", 0x200000, 0xe00000},
1794 .first_sysupgrade_partition
= "os-image",
1795 .last_sysupgrade_partition
= "file-system",
1798 /** Firmware layout for the EAP120 */
1801 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1804 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1806 .soft_ver
= SOFT_VER_DEFAULT
,
1809 {"fs-uboot", 0x00000, 0x20000},
1810 {"partition-table", 0x20000, 0x02000},
1811 {"default-mac", 0x30000, 0x00020},
1812 {"support-list", 0x31000, 0x00100},
1813 {"product-info", 0x31100, 0x00100},
1814 {"soft-version", 0x32000, 0x00100},
1815 {"os-image", 0x40000, 0x180000},
1816 {"file-system", 0x1c0000, 0x600000},
1817 {"user-config", 0x7c0000, 0x10000},
1818 {"backup-config", 0x7d0000, 0x10000},
1819 {"log", 0x7e0000, 0x10000},
1820 {"radio", 0x7f0000, 0x10000},
1824 .first_sysupgrade_partition
= "os-image",
1825 .last_sysupgrade_partition
= "file-system"
1828 /** Firmware layout for the EAP225-Outdoor v1 */
1830 .id
= "EAP225-OUTDOOR-V1",
1833 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1834 .part_trail
= PART_TRAIL_NONE
,
1835 .soft_ver
= SOFT_VER_DEFAULT
,
1836 .soft_ver_compat_level
= 1,
1839 {"fs-uboot", 0x00000, 0x20000},
1840 {"partition-table", 0x20000, 0x02000},
1841 {"default-mac", 0x30000, 0x01000},
1842 {"support-list", 0x31000, 0x00100},
1843 {"product-info", 0x31100, 0x00400},
1844 {"soft-version", 0x32000, 0x00100},
1845 {"firmware", 0x40000, 0xd80000},
1846 {"user-config", 0xdc0000, 0x30000},
1847 {"mutil-log", 0xf30000, 0x80000},
1848 {"oops", 0xfb0000, 0x40000},
1849 {"radio", 0xff0000, 0x10000},
1853 .first_sysupgrade_partition
= "os-image",
1854 .last_sysupgrade_partition
= "file-system"
1857 /** Firmware layout for the EAP225 v1 */
1862 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1863 .part_trail
= PART_TRAIL_NONE
,
1864 .soft_ver
= SOFT_VER_DEFAULT
,
1867 {"fs-uboot", 0x00000, 0x20000},
1868 {"partition-table", 0x20000, 0x02000},
1869 {"default-mac", 0x30000, 0x01000},
1870 {"support-list", 0x31000, 0x00100},
1871 {"product-info", 0x31100, 0x00400},
1872 {"soft-version", 0x32000, 0x00100},
1873 {"firmware", 0x40000, 0xd80000},
1874 {"user-config", 0xdc0000, 0x30000},
1875 {"radio", 0xff0000, 0x10000},
1879 .first_sysupgrade_partition
= "os-image",
1880 .last_sysupgrade_partition
= "file-system"
1883 /** Firmware layout for the EAP225 v3
1884 * Also compatible with:
1887 * - EAP225-Outdoor v1
1888 * - EAP225-Outdoor v3
1894 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1895 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1896 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1897 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1898 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1899 .part_trail
= PART_TRAIL_NONE
,
1900 .soft_ver
= SOFT_VER_DEFAULT
,
1901 .soft_ver_compat_level
= 1,
1904 {"fs-uboot", 0x00000, 0x20000},
1905 {"partition-table", 0x20000, 0x02000},
1906 {"default-mac", 0x30000, 0x01000},
1907 {"support-list", 0x31000, 0x00100},
1908 {"product-info", 0x31100, 0x00400},
1909 {"soft-version", 0x32000, 0x00100},
1910 {"firmware", 0x40000, 0xd80000},
1911 {"user-config", 0xdc0000, 0x30000},
1912 {"mutil-log", 0xf30000, 0x80000},
1913 {"oops", 0xfb0000, 0x40000},
1914 {"radio", 0xff0000, 0x10000},
1918 .first_sysupgrade_partition
= "os-image",
1919 .last_sysupgrade_partition
= "file-system"
1922 /** Firmware layout for the EAP225-Wall v2 */
1924 .id
= "EAP225-WALL-V2",
1927 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1928 .part_trail
= PART_TRAIL_NONE
,
1929 .soft_ver
= SOFT_VER_DEFAULT
,
1930 .soft_ver_compat_level
= 1,
1933 {"fs-uboot", 0x00000, 0x20000},
1934 {"partition-table", 0x20000, 0x02000},
1935 {"default-mac", 0x30000, 0x01000},
1936 {"support-list", 0x31000, 0x00100},
1937 {"product-info", 0x31100, 0x00400},
1938 {"soft-version", 0x32000, 0x00100},
1939 {"firmware", 0x40000, 0xd80000},
1940 {"user-config", 0xdc0000, 0x30000},
1941 {"mutil-log", 0xf30000, 0x80000},
1942 {"oops", 0xfb0000, 0x40000},
1943 {"radio", 0xff0000, 0x10000},
1947 .first_sysupgrade_partition
= "os-image",
1948 .last_sysupgrade_partition
= "file-system"
1951 /** Firmware layout for the EAP235-Wall v1 */
1953 .id
= "EAP235-WALL-V1",
1956 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1957 .part_trail
= PART_TRAIL_NONE
,
1958 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1959 .soft_ver_compat_level
= 1,
1962 {"fs-uboot", 0x00000, 0x80000},
1963 {"partition-table", 0x80000, 0x02000},
1964 {"default-mac", 0x90000, 0x01000},
1965 {"support-list", 0x91000, 0x00100},
1966 {"product-info", 0x91100, 0x00400},
1967 {"soft-version", 0x92000, 0x00100},
1968 {"firmware", 0xa0000, 0xd20000},
1969 {"user-config", 0xdc0000, 0x30000},
1970 {"mutil-log", 0xf30000, 0x80000},
1971 {"oops", 0xfb0000, 0x40000},
1972 {"radio", 0xff0000, 0x10000},
1976 .first_sysupgrade_partition
= "os-image",
1977 .last_sysupgrade_partition
= "file-system"
1980 /** Firmware layout for the EAP245 v1 */
1985 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1986 .part_trail
= PART_TRAIL_NONE
,
1987 .soft_ver
= SOFT_VER_DEFAULT
,
1990 {"fs-uboot", 0x00000, 0x20000},
1991 {"partition-table", 0x20000, 0x02000},
1992 {"default-mac", 0x30000, 0x01000},
1993 {"support-list", 0x31000, 0x00100},
1994 {"product-info", 0x31100, 0x00400},
1995 {"soft-version", 0x32000, 0x00100},
1996 {"firmware", 0x40000, 0xd80000},
1997 {"user-config", 0xdc0000, 0x30000},
1998 {"radio", 0xff0000, 0x10000},
2002 .first_sysupgrade_partition
= "os-image",
2003 .last_sysupgrade_partition
= "file-system"
2006 /** Firmware layout for the EAP245 v3 */
2011 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
2012 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
2013 .part_trail
= PART_TRAIL_NONE
,
2014 .soft_ver
= SOFT_VER_DEFAULT
,
2015 .soft_ver_compat_level
= 1,
2017 /** Firmware partition with dynamic kernel/rootfs split */
2019 {"factroy-boot", 0x00000, 0x40000},
2020 {"fs-uboot", 0x40000, 0x40000},
2021 {"partition-table", 0x80000, 0x10000},
2022 {"default-mac", 0x90000, 0x01000},
2023 {"support-list", 0x91000, 0x00100},
2024 {"product-info", 0x91100, 0x00400},
2025 {"soft-version", 0x92000, 0x00100},
2026 {"radio", 0xa0000, 0x10000},
2027 {"extra-para", 0xb0000, 0x10000},
2028 {"firmware", 0xc0000, 0xe40000},
2029 {"config", 0xf00000, 0x30000},
2030 {"mutil-log", 0xf30000, 0x80000},
2031 {"oops", 0xfb0000, 0x40000},
2035 .first_sysupgrade_partition
= "os-image",
2036 .last_sysupgrade_partition
= "file-system"
2039 /** Firmware layout for the EAP615-Wall v1 */
2041 .id
= "EAP615-WALL-V1",
2042 .soft_ver
= SOFT_VER_DEFAULT
,
2043 .soft_ver_compat_level
= 1,
2046 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
2047 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
2048 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
2049 .part_trail
= PART_TRAIL_NONE
,
2052 {"fs-uboot", 0x00000, 0x80000},
2053 {"partition-table", 0x80000, 0x02000},
2054 {"default-mac", 0x90000, 0x01000},
2055 {"support-list", 0x91000, 0x00100},
2056 {"product-info", 0x91100, 0x00400},
2057 {"soft-version", 0x92000, 0x00100},
2058 {"firmware", 0xa0000, 0xcf0000},
2059 {"user-config", 0xd90000, 0x60000},
2060 {"mutil-log", 0xf30000, 0x80000},
2061 {"oops", 0xfb0000, 0x40000},
2062 {"radio", 0xff0000, 0x10000},
2066 .first_sysupgrade_partition
= "os-image",
2067 .last_sysupgrade_partition
= "file-system"
2070 /** Firmware layout for the TL-WA1201 v2 */
2072 .id
= "TL-WA1201-V2",
2076 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2077 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2079 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2082 {"fs-uboot", 0x00000, 0x20000},
2083 {"default-mac", 0x20000, 0x00200},
2084 {"pin", 0x20200, 0x00100},
2085 {"product-info", 0x20300, 0x00200},
2086 {"device-id", 0x20500, 0x0fb00},
2087 {"firmware", 0x30000, 0xce0000},
2088 {"portal-logo", 0xd10000, 0x20000},
2089 {"portal-back", 0xd30000, 0x200000},
2090 {"soft-version", 0xf30000, 0x00200},
2091 {"extra-para", 0xf30200, 0x00200},
2092 {"support-list", 0xf30400, 0x00200},
2093 {"profile", 0xf30600, 0x0fa00},
2094 {"apdef-config", 0xf40000, 0x10000},
2095 {"ap-config", 0xf50000, 0x10000},
2096 {"redef-config", 0xf60000, 0x10000},
2097 {"re-config", 0xf70000, 0x10000},
2098 {"multidef-config", 0xf80000, 0x10000},
2099 {"multi-config", 0xf90000, 0x10000},
2100 {"clientdef-config", 0xfa0000, 0x10000},
2101 {"client-config", 0xfb0000, 0x10000},
2102 {"partition-table", 0xfc0000, 0x10000},
2103 {"user-config", 0xfd0000, 0x10000},
2104 {"certificate", 0xfe0000, 0x10000},
2105 {"radio", 0xff0000, 0x10000},
2108 .first_sysupgrade_partition
= "os-image",
2109 .last_sysupgrade_partition
= "file-system",
2112 /** Firmware layout for the TL-WA850RE v2 */
2114 .id
= "TLWA850REV2",
2118 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2119 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2120 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2121 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2122 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2123 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2124 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2125 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2126 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2127 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2129 .soft_ver
= SOFT_VER_DEFAULT
,
2132 576KB were moved from file-system to os-image
2133 in comparison to the stock image
2136 {"fs-uboot", 0x00000, 0x20000},
2137 {"firmware", 0x20000, 0x390000},
2138 {"partition-table", 0x3b0000, 0x02000},
2139 {"default-mac", 0x3c0000, 0x00020},
2140 {"pin", 0x3c0100, 0x00020},
2141 {"product-info", 0x3c1000, 0x01000},
2142 {"soft-version", 0x3c2000, 0x00100},
2143 {"support-list", 0x3c3000, 0x01000},
2144 {"profile", 0x3c4000, 0x08000},
2145 {"user-config", 0x3d0000, 0x10000},
2146 {"default-config", 0x3e0000, 0x10000},
2147 {"radio", 0x3f0000, 0x10000},
2151 .first_sysupgrade_partition
= "os-image",
2152 .last_sysupgrade_partition
= "file-system"
2155 /** Firmware layout for the TL-WA855RE v1 */
2157 .id
= "TLWA855REV1",
2161 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2162 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2163 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2164 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2165 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2166 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2167 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2168 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2169 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2171 .soft_ver
= SOFT_VER_DEFAULT
,
2174 {"fs-uboot", 0x00000, 0x20000},
2175 {"os-image", 0x20000, 0x150000},
2176 {"file-system", 0x170000, 0x240000},
2177 {"partition-table", 0x3b0000, 0x02000},
2178 {"default-mac", 0x3c0000, 0x00020},
2179 {"pin", 0x3c0100, 0x00020},
2180 {"product-info", 0x3c1000, 0x01000},
2181 {"soft-version", 0x3c2000, 0x00100},
2182 {"support-list", 0x3c3000, 0x01000},
2183 {"profile", 0x3c4000, 0x08000},
2184 {"user-config", 0x3d0000, 0x10000},
2185 {"default-config", 0x3e0000, 0x10000},
2186 {"radio", 0x3f0000, 0x10000},
2190 .first_sysupgrade_partition
= "os-image",
2191 .last_sysupgrade_partition
= "file-system"
2194 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2196 .id
= "TL-WPA8630P-V2.0-EU",
2200 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2202 .soft_ver
= SOFT_VER_DEFAULT
,
2205 {"factory-uboot", 0x00000, 0x20000},
2206 {"fs-uboot", 0x20000, 0x20000},
2207 {"firmware", 0x40000, 0x5e0000},
2208 {"partition-table", 0x620000, 0x02000},
2209 {"default-mac", 0x630000, 0x00020},
2210 {"pin", 0x630100, 0x00020},
2211 {"device-id", 0x630200, 0x00030},
2212 {"product-info", 0x631100, 0x01000},
2213 {"extra-para", 0x632100, 0x01000},
2214 {"soft-version", 0x640000, 0x01000},
2215 {"support-list", 0x641000, 0x01000},
2216 {"profile", 0x642000, 0x08000},
2217 {"user-config", 0x650000, 0x10000},
2218 {"default-config", 0x660000, 0x10000},
2219 {"default-nvm", 0x670000, 0xc0000},
2220 {"default-pib", 0x730000, 0x40000},
2221 {"radio", 0x7f0000, 0x10000},
2225 .first_sysupgrade_partition
= "os-image",
2226 .last_sysupgrade_partition
= "file-system"
2229 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2231 .id
= "TL-WPA8630P-V2-INT",
2235 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2236 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2237 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2239 .soft_ver
= SOFT_VER_DEFAULT
,
2242 {"factory-uboot", 0x00000, 0x20000},
2243 {"fs-uboot", 0x20000, 0x20000},
2244 {"firmware", 0x40000, 0x5e0000},
2245 {"partition-table", 0x620000, 0x02000},
2246 {"extra-para", 0x632100, 0x01000},
2247 {"soft-version", 0x640000, 0x01000},
2248 {"support-list", 0x641000, 0x01000},
2249 {"profile", 0x642000, 0x08000},
2250 {"user-config", 0x650000, 0x10000},
2251 {"default-config", 0x660000, 0x10000},
2252 {"default-nvm", 0x670000, 0xc0000},
2253 {"default-pib", 0x730000, 0x40000},
2254 {"default-mac", 0x7e0000, 0x00020},
2255 {"pin", 0x7e0100, 0x00020},
2256 {"device-id", 0x7e0200, 0x00030},
2257 {"product-info", 0x7e1100, 0x01000},
2258 {"radio", 0x7f0000, 0x10000},
2262 .first_sysupgrade_partition
= "os-image",
2263 .last_sysupgrade_partition
= "file-system"
2266 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2268 .id
= "TL-WPA8630P-V2.1-EU",
2272 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2274 .soft_ver
= SOFT_VER_DEFAULT
,
2277 {"factory-uboot", 0x00000, 0x20000},
2278 {"fs-uboot", 0x20000, 0x20000},
2279 {"firmware", 0x40000, 0x5e0000},
2280 {"extra-para", 0x680000, 0x01000},
2281 {"product-info", 0x690000, 0x01000},
2282 {"partition-table", 0x6a0000, 0x02000},
2283 {"soft-version", 0x6b0000, 0x01000},
2284 {"support-list", 0x6b1000, 0x01000},
2285 {"profile", 0x6b2000, 0x08000},
2286 {"user-config", 0x6c0000, 0x10000},
2287 {"default-config", 0x6d0000, 0x10000},
2288 {"default-nvm", 0x6e0000, 0xc0000},
2289 {"default-pib", 0x7a0000, 0x40000},
2290 {"default-mac", 0x7e0000, 0x00020},
2291 {"pin", 0x7e0100, 0x00020},
2292 {"device-id", 0x7e0200, 0x00030},
2293 {"radio", 0x7f0000, 0x10000},
2297 .first_sysupgrade_partition
= "os-image",
2298 .last_sysupgrade_partition
= "file-system"
2301 /** Firmware layout for the TL-WPA8631P v3 */
2303 .id
= "TL-WPA8631P-V3",
2307 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2308 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2309 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2311 .soft_ver
= SOFT_VER_DEFAULT
,
2314 {"fs-uboot", 0x00000, 0x20000},
2315 {"firmware", 0x20000, 0x710000},
2316 {"partition-table", 0x730000, 0x02000},
2317 {"default-mac", 0x732000, 0x00020},
2318 {"pin", 0x732100, 0x00020},
2319 {"device-id", 0x732200, 0x00030},
2320 {"default-region", 0x732300, 0x00010},
2321 {"product-info", 0x732400, 0x00200},
2322 {"extra-para", 0x732600, 0x00200},
2323 {"soft-version", 0x732800, 0x00200},
2324 {"support-list", 0x732a00, 0x00100},
2325 {"profile", 0x732b00, 0x00100},
2326 {"default-config", 0x732c00, 0x00800},
2327 {"plc-type", 0x733400, 0x00020},
2328 {"default-pib", 0x733500, 0x06000},
2329 {"user-config", 0x740000, 0x10000},
2330 {"plc-pib", 0x750000, 0x10000},
2331 {"plc-nvm", 0x760000, 0x90000},
2332 {"radio", 0x7f0000, 0x10000},
2336 .first_sysupgrade_partition
= "os-image",
2337 .last_sysupgrade_partition
= "file-system"
2340 /** Firmware layout for the TL-WR1043 v5 */
2342 .id
= "TLWR1043NV5",
2346 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2347 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2349 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2351 {"factory-boot", 0x00000, 0x20000},
2352 {"fs-uboot", 0x20000, 0x20000},
2353 {"firmware", 0x40000, 0xec0000},
2354 {"default-mac", 0xf00000, 0x00200},
2355 {"pin", 0xf00200, 0x00200},
2356 {"device-id", 0xf00400, 0x00100},
2357 {"product-info", 0xf00500, 0x0fb00},
2358 {"soft-version", 0xf10000, 0x01000},
2359 {"extra-para", 0xf11000, 0x01000},
2360 {"support-list", 0xf12000, 0x0a000},
2361 {"profile", 0xf1c000, 0x04000},
2362 {"default-config", 0xf20000, 0x10000},
2363 {"user-config", 0xf30000, 0x40000},
2364 {"qos-db", 0xf70000, 0x40000},
2365 {"certificate", 0xfb0000, 0x10000},
2366 {"partition-table", 0xfc0000, 0x10000},
2367 {"log", 0xfd0000, 0x20000},
2368 {"radio", 0xff0000, 0x10000},
2371 .first_sysupgrade_partition
= "os-image",
2372 .last_sysupgrade_partition
= "file-system"
2375 /** Firmware layout for the TL-WR1043 v4 */
2377 .id
= "TLWR1043NDV4",
2381 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2383 .soft_ver
= SOFT_VER_DEFAULT
,
2385 /* We're using a dynamic kernel/rootfs split here */
2387 {"fs-uboot", 0x00000, 0x20000},
2388 {"firmware", 0x20000, 0xf30000},
2389 {"default-mac", 0xf50000, 0x00200},
2390 {"pin", 0xf50200, 0x00200},
2391 {"product-info", 0xf50400, 0x0fc00},
2392 {"soft-version", 0xf60000, 0x0b000},
2393 {"support-list", 0xf6b000, 0x04000},
2394 {"profile", 0xf70000, 0x04000},
2395 {"default-config", 0xf74000, 0x0b000},
2396 {"user-config", 0xf80000, 0x40000},
2397 {"partition-table", 0xfc0000, 0x10000},
2398 {"log", 0xfd0000, 0x20000},
2399 {"radio", 0xff0000, 0x10000},
2403 .first_sysupgrade_partition
= "os-image",
2404 .last_sysupgrade_partition
= "file-system"
2407 /** Firmware layout for the TL-WR902AC v1 */
2409 .id
= "TL-WR902AC-V1",
2413 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2414 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2416 .soft_ver
= SOFT_VER_DEFAULT
,
2419 384KB were moved from file-system to os-image
2420 in comparison to the stock image
2423 {"fs-uboot", 0x00000, 0x20000},
2424 {"firmware", 0x20000, 0x730000},
2425 {"default-mac", 0x750000, 0x00200},
2426 {"pin", 0x750200, 0x00200},
2427 {"product-info", 0x750400, 0x0fc00},
2428 {"soft-version", 0x760000, 0x0b000},
2429 {"support-list", 0x76b000, 0x04000},
2430 {"profile", 0x770000, 0x04000},
2431 {"default-config", 0x774000, 0x0b000},
2432 {"user-config", 0x780000, 0x40000},
2433 {"partition-table", 0x7c0000, 0x10000},
2434 {"log", 0x7d0000, 0x20000},
2435 {"radio", 0x7f0000, 0x10000},
2439 .first_sysupgrade_partition
= "os-image",
2440 .last_sysupgrade_partition
= "file-system",
2443 /** Firmware layout for the TL-WR941HP v1 */
2445 .id
= "TL-WR941HP-V1",
2449 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2451 .soft_ver
= SOFT_VER_DEFAULT
,
2454 {"fs-uboot", 0x00000, 0x20000},
2455 {"firmware", 0x20000, 0x730000},
2456 {"default-mac", 0x750000, 0x00200},
2457 {"pin", 0x750200, 0x00200},
2458 {"product-info", 0x750400, 0x0fc00},
2459 {"soft-version", 0x760000, 0x0b000},
2460 {"support-list", 0x76b000, 0x04000},
2461 {"profile", 0x770000, 0x04000},
2462 {"default-config", 0x774000, 0x0b000},
2463 {"user-config", 0x780000, 0x40000},
2464 {"partition-table", 0x7c0000, 0x10000},
2465 {"log", 0x7d0000, 0x20000},
2466 {"radio", 0x7f0000, 0x10000},
2470 .first_sysupgrade_partition
= "os-image",
2471 .last_sysupgrade_partition
= "file-system",
2474 /** Firmware layout for the TL-WR942N V1 */
2480 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2481 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2483 .soft_ver
= SOFT_VER_DEFAULT
,
2486 {"fs-uboot", 0x00000, 0x20000},
2487 {"firmware", 0x20000, 0xe20000},
2488 {"default-mac", 0xe40000, 0x00200},
2489 {"pin", 0xe40200, 0x00200},
2490 {"product-info", 0xe40400, 0x0fc00},
2491 {"partition-table", 0xe50000, 0x10000},
2492 {"soft-version", 0xe60000, 0x10000},
2493 {"support-list", 0xe70000, 0x10000},
2494 {"profile", 0xe80000, 0x10000},
2495 {"default-config", 0xe90000, 0x10000},
2496 {"user-config", 0xea0000, 0x40000},
2497 {"qos-db", 0xee0000, 0x40000},
2498 {"certificate", 0xf20000, 0x10000},
2499 {"usb-config", 0xfb0000, 0x10000},
2500 {"log", 0xfc0000, 0x20000},
2501 {"radio-bk", 0xfe0000, 0x10000},
2502 {"radio", 0xff0000, 0x10000},
2506 .first_sysupgrade_partition
= "os-image",
2507 .last_sysupgrade_partition
= "file-system",
2510 /** Firmware layout for the RE200 v2 */
2516 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2517 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2518 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2519 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2520 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2521 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2522 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2523 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2524 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2525 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2526 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2527 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2528 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2530 .soft_ver
= SOFT_VER_DEFAULT
,
2533 {"fs-uboot", 0x00000, 0x20000},
2534 {"firmware", 0x20000, 0x7a0000},
2535 {"partition-table", 0x7c0000, 0x02000},
2536 {"default-mac", 0x7c2000, 0x00020},
2537 {"pin", 0x7c2100, 0x00020},
2538 {"product-info", 0x7c3100, 0x01000},
2539 {"soft-version", 0x7c4200, 0x01000},
2540 {"support-list", 0x7c5200, 0x01000},
2541 {"profile", 0x7c6200, 0x08000},
2542 {"config-info", 0x7ce200, 0x00400},
2543 {"user-config", 0x7d0000, 0x10000},
2544 {"default-config", 0x7e0000, 0x10000},
2545 {"radio", 0x7f0000, 0x10000},
2549 .first_sysupgrade_partition
= "os-image",
2550 .last_sysupgrade_partition
= "file-system"
2553 /** Firmware layout for the RE200 v3 */
2559 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2560 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2561 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2562 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2563 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2564 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2565 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2566 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2567 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2568 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2569 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2570 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2571 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2572 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2574 .soft_ver
= SOFT_VER_DEFAULT
,
2577 {"fs-uboot", 0x00000, 0x20000},
2578 {"firmware", 0x20000, 0x7a0000},
2579 {"partition-table", 0x7c0000, 0x02000},
2580 {"default-mac", 0x7c2000, 0x00020},
2581 {"pin", 0x7c2100, 0x00020},
2582 {"product-info", 0x7c3100, 0x01000},
2583 {"soft-version", 0x7c4200, 0x01000},
2584 {"support-list", 0x7c5200, 0x01000},
2585 {"profile", 0x7c6200, 0x08000},
2586 {"config-info", 0x7ce200, 0x00400},
2587 {"user-config", 0x7d0000, 0x10000},
2588 {"default-config", 0x7e0000, 0x10000},
2589 {"radio", 0x7f0000, 0x10000},
2593 .first_sysupgrade_partition
= "os-image",
2594 .last_sysupgrade_partition
= "file-system"
2597 /** Firmware layout for the RE200 v4 */
2603 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2604 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2605 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2606 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2607 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2608 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2609 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2610 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2611 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2612 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2613 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2614 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2615 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2616 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2618 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2621 {"fs-uboot", 0x00000, 0x20000},
2622 {"firmware", 0x20000, 0x7a0000},
2623 {"partition-table", 0x7c0000, 0x02000},
2624 {"default-mac", 0x7c2000, 0x00020},
2625 {"pin", 0x7c2100, 0x00020},
2626 {"product-info", 0x7c3100, 0x01000},
2627 {"soft-version", 0x7c4200, 0x01000},
2628 {"support-list", 0x7c5200, 0x01000},
2629 {"profile", 0x7c6200, 0x08000},
2630 {"config-info", 0x7ce200, 0x00400},
2631 {"user-config", 0x7d0000, 0x10000},
2632 {"default-config", 0x7e0000, 0x10000},
2633 {"radio", 0x7f0000, 0x10000},
2637 .first_sysupgrade_partition
= "os-image",
2638 .last_sysupgrade_partition
= "file-system"
2641 /** Firmware layout for the RE220 v2 */
2647 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2648 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2649 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2650 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2651 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2652 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2653 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2654 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2655 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2656 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2657 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2658 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2659 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2661 .soft_ver
= SOFT_VER_DEFAULT
,
2664 {"fs-uboot", 0x00000, 0x20000},
2665 {"firmware", 0x20000, 0x7a0000},
2666 {"partition-table", 0x7c0000, 0x02000},
2667 {"default-mac", 0x7c2000, 0x00020},
2668 {"pin", 0x7c2100, 0x00020},
2669 {"product-info", 0x7c3100, 0x01000},
2670 {"soft-version", 0x7c4200, 0x01000},
2671 {"support-list", 0x7c5200, 0x01000},
2672 {"profile", 0x7c6200, 0x08000},
2673 {"config-info", 0x7ce200, 0x00400},
2674 {"user-config", 0x7d0000, 0x10000},
2675 {"default-config", 0x7e0000, 0x10000},
2676 {"radio", 0x7f0000, 0x10000},
2680 .first_sysupgrade_partition
= "os-image",
2681 .last_sysupgrade_partition
= "file-system"
2684 /** Firmware layout for the RE305 v1 */
2690 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2691 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2692 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2693 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2694 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2695 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2696 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2698 .soft_ver
= SOFT_VER_DEFAULT
,
2701 {"fs-uboot", 0x00000, 0x20000},
2702 {"firmware", 0x20000, 0x5e0000},
2703 {"partition-table", 0x600000, 0x02000},
2704 {"default-mac", 0x610000, 0x00020},
2705 {"pin", 0x610100, 0x00020},
2706 {"product-info", 0x611100, 0x01000},
2707 {"soft-version", 0x620000, 0x01000},
2708 {"support-list", 0x621000, 0x01000},
2709 {"profile", 0x622000, 0x08000},
2710 {"user-config", 0x630000, 0x10000},
2711 {"default-config", 0x640000, 0x10000},
2712 {"radio", 0x7f0000, 0x10000},
2716 .first_sysupgrade_partition
= "os-image",
2717 .last_sysupgrade_partition
= "file-system"
2720 /** Firmware layout for the RE305 v3 */
2726 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2727 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2728 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2729 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2730 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2731 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2732 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2733 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2734 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2735 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2736 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2738 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2741 {"fs-uboot", 0x00000, 0x20000},
2742 {"firmware", 0x20000, 0x7a0000},
2743 {"partition-table", 0x7c0000, 0x02000},
2744 {"default-mac", 0x7c2000, 0x00020},
2745 {"pin", 0x7c2100, 0x00020},
2746 {"product-info", 0x7c3100, 0x01000},
2747 {"soft-version", 0x7c4200, 0x01000},
2748 {"support-list", 0x7c5200, 0x01000},
2749 {"profile", 0x7c6200, 0x08000},
2750 {"config-info", 0x7ce200, 0x00400},
2751 {"user-config", 0x7d0000, 0x10000},
2752 {"default-config", 0x7e0000, 0x10000},
2753 {"radio", 0x7f0000, 0x10000},
2757 .first_sysupgrade_partition
= "os-image",
2758 .last_sysupgrade_partition
= "file-system"
2761 /** Firmware layout for the RE350 v1 */
2767 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2768 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2769 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2770 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2771 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2772 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2773 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2775 .soft_ver
= SOFT_VER_DEFAULT
,
2777 /** We're using a dynamic kernel/rootfs split here */
2779 {"fs-uboot", 0x00000, 0x20000},
2780 {"firmware", 0x20000, 0x5e0000},
2781 {"partition-table", 0x600000, 0x02000},
2782 {"default-mac", 0x610000, 0x00020},
2783 {"pin", 0x610100, 0x00020},
2784 {"product-info", 0x611100, 0x01000},
2785 {"soft-version", 0x620000, 0x01000},
2786 {"support-list", 0x621000, 0x01000},
2787 {"profile", 0x622000, 0x08000},
2788 {"user-config", 0x630000, 0x10000},
2789 {"default-config", 0x640000, 0x10000},
2790 {"radio", 0x7f0000, 0x10000},
2794 .first_sysupgrade_partition
= "os-image",
2795 .last_sysupgrade_partition
= "file-system"
2798 /** Firmware layout for the RE350K v1 */
2804 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2806 .soft_ver
= SOFT_VER_DEFAULT
,
2808 /** We're using a dynamic kernel/rootfs split here */
2810 {"fs-uboot", 0x00000, 0x20000},
2811 {"firmware", 0x20000, 0xd70000},
2812 {"partition-table", 0xd90000, 0x02000},
2813 {"default-mac", 0xda0000, 0x00020},
2814 {"pin", 0xda0100, 0x00020},
2815 {"product-info", 0xda1100, 0x01000},
2816 {"soft-version", 0xdb0000, 0x01000},
2817 {"support-list", 0xdb1000, 0x01000},
2818 {"profile", 0xdb2000, 0x08000},
2819 {"user-config", 0xdc0000, 0x10000},
2820 {"default-config", 0xdd0000, 0x10000},
2821 {"device-id", 0xde0000, 0x00108},
2822 {"radio", 0xff0000, 0x10000},
2826 .first_sysupgrade_partition
= "os-image",
2827 .last_sysupgrade_partition
= "file-system"
2830 /** Firmware layout for the RE355 */
2836 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2837 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2838 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2839 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2840 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2841 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2842 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2843 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2845 .soft_ver
= SOFT_VER_DEFAULT
,
2847 /* We're using a dynamic kernel/rootfs split here */
2849 {"fs-uboot", 0x00000, 0x20000},
2850 {"firmware", 0x20000, 0x5e0000},
2851 {"partition-table", 0x600000, 0x02000},
2852 {"default-mac", 0x610000, 0x00020},
2853 {"pin", 0x610100, 0x00020},
2854 {"product-info", 0x611100, 0x01000},
2855 {"soft-version", 0x620000, 0x01000},
2856 {"support-list", 0x621000, 0x01000},
2857 {"profile", 0x622000, 0x08000},
2858 {"user-config", 0x630000, 0x10000},
2859 {"default-config", 0x640000, 0x10000},
2860 {"radio", 0x7f0000, 0x10000},
2864 .first_sysupgrade_partition
= "os-image",
2865 .last_sysupgrade_partition
= "file-system"
2868 /** Firmware layout for the RE450 */
2874 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2875 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2876 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2877 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2878 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2879 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2880 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2881 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2883 .soft_ver
= SOFT_VER_DEFAULT
,
2885 /** We're using a dynamic kernel/rootfs split here */
2887 {"fs-uboot", 0x00000, 0x20000},
2888 {"firmware", 0x20000, 0x5e0000},
2889 {"partition-table", 0x600000, 0x02000},
2890 {"default-mac", 0x610000, 0x00020},
2891 {"pin", 0x610100, 0x00020},
2892 {"product-info", 0x611100, 0x01000},
2893 {"soft-version", 0x620000, 0x01000},
2894 {"support-list", 0x621000, 0x01000},
2895 {"profile", 0x622000, 0x08000},
2896 {"user-config", 0x630000, 0x10000},
2897 {"default-config", 0x640000, 0x10000},
2898 {"radio", 0x7f0000, 0x10000},
2902 .first_sysupgrade_partition
= "os-image",
2903 .last_sysupgrade_partition
= "file-system"
2906 /** Firmware layout for the RE450 v2 */
2912 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2913 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2914 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2915 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2916 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2917 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2918 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2919 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2920 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2922 .soft_ver
= SOFT_VER_DEFAULT
,
2924 /* We're using a dynamic kernel/rootfs split here */
2926 {"fs-uboot", 0x00000, 0x20000},
2927 {"firmware", 0x20000, 0x5e0000},
2928 {"partition-table", 0x600000, 0x02000},
2929 {"default-mac", 0x610000, 0x00020},
2930 {"pin", 0x610100, 0x00020},
2931 {"product-info", 0x611100, 0x01000},
2932 {"soft-version", 0x620000, 0x01000},
2933 {"support-list", 0x621000, 0x01000},
2934 {"profile", 0x622000, 0x08000},
2935 {"user-config", 0x630000, 0x10000},
2936 {"default-config", 0x640000, 0x10000},
2937 {"radio", 0x7f0000, 0x10000},
2941 .first_sysupgrade_partition
= "os-image",
2942 .last_sysupgrade_partition
= "file-system"
2945 /** Firmware layout for the RE450 v3 */
2951 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2952 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2953 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2954 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2955 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2956 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2957 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2958 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2959 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2961 .soft_ver
= SOFT_VER_DEFAULT
,
2963 /* We're using a dynamic kernel/rootfs split here */
2965 {"fs-uboot", 0x00000, 0x20000},
2966 {"default-mac", 0x20000, 0x00020},
2967 {"pin", 0x20020, 0x00020},
2968 {"product-info", 0x21000, 0x01000},
2969 {"partition-table", 0x22000, 0x02000},
2970 {"soft-version", 0x24000, 0x01000},
2971 {"support-list", 0x25000, 0x01000},
2972 {"profile", 0x26000, 0x08000},
2973 {"user-config", 0x2e000, 0x10000},
2974 {"default-config", 0x3e000, 0x10000},
2975 {"config-info", 0x4e000, 0x00400},
2976 {"firmware", 0x50000, 0x7a0000},
2977 {"radio", 0x7f0000, 0x10000},
2981 .first_sysupgrade_partition
= "os-image",
2982 .last_sysupgrade_partition
= "file-system"
2985 /** Firmware layout for the RE455 v1 */
2991 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2992 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2993 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2994 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2995 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2996 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2997 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2998 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2999 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
3001 .soft_ver
= SOFT_VER_DEFAULT
,
3003 /* We're using a dynamic kernel/rootfs split here */
3005 {"fs-uboot", 0x00000, 0x20000},
3006 {"default-mac", 0x20000, 0x00020},
3007 {"pin", 0x20020, 0x00020},
3008 {"product-info", 0x21000, 0x01000},
3009 {"partition-table", 0x22000, 0x02000},
3010 {"soft-version", 0x24000, 0x01000},
3011 {"support-list", 0x25000, 0x01000},
3012 {"profile", 0x26000, 0x08000},
3013 {"user-config", 0x2e000, 0x10000},
3014 {"default-config", 0x3e000, 0x10000},
3015 {"config-info", 0x4e000, 0x00400},
3016 {"firmware", 0x50000, 0x7a0000},
3017 {"radio", 0x7f0000, 0x10000},
3021 .first_sysupgrade_partition
= "os-image",
3022 .last_sysupgrade_partition
= "file-system"
3025 /** Firmware layout for the RE500 */
3031 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
3032 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
3033 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
3034 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
3035 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
3036 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
3037 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
3039 .soft_ver
= SOFT_VER_DEFAULT
,
3041 /* We're using a dynamic kernel/rootfs split here */
3043 {"fs-uboot", 0x00000, 0x20000},
3044 {"firmware", 0x20000, 0xde0000},
3045 {"partition-table", 0xe00000, 0x02000},
3046 {"default-mac", 0xe10000, 0x00020},
3047 {"pin", 0xe10100, 0x00020},
3048 {"product-info", 0xe11100, 0x01000},
3049 {"soft-version", 0xe20000, 0x01000},
3050 {"support-list", 0xe21000, 0x01000},
3051 {"profile", 0xe22000, 0x08000},
3052 {"user-config", 0xe30000, 0x10000},
3053 {"default-config", 0xe40000, 0x10000},
3054 {"radio", 0xff0000, 0x10000},
3058 .first_sysupgrade_partition
= "os-image",
3059 .last_sysupgrade_partition
= "file-system"
3062 /** Firmware layout for the RE650 */
3068 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
3069 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
3070 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3071 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3072 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3073 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3074 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3076 .soft_ver
= SOFT_VER_DEFAULT
,
3078 /* We're using a dynamic kernel/rootfs split here */
3080 {"fs-uboot", 0x00000, 0x20000},
3081 {"firmware", 0x20000, 0xde0000},
3082 {"partition-table", 0xe00000, 0x02000},
3083 {"default-mac", 0xe10000, 0x00020},
3084 {"pin", 0xe10100, 0x00020},
3085 {"product-info", 0xe11100, 0x01000},
3086 {"soft-version", 0xe20000, 0x01000},
3087 {"support-list", 0xe21000, 0x01000},
3088 {"profile", 0xe22000, 0x08000},
3089 {"user-config", 0xe30000, 0x10000},
3090 {"default-config", 0xe40000, 0x10000},
3091 {"radio", 0xff0000, 0x10000},
3095 .first_sysupgrade_partition
= "os-image",
3096 .last_sysupgrade_partition
= "file-system"
3098 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3104 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3105 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3106 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3107 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3108 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3109 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3110 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3112 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3113 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3115 /* We're using a dynamic kernel/rootfs split here */
3117 {"fs-uboot", 0x00000, 0x20000},
3118 {"firmware", 0x20000, 0x7a0000},
3119 {"partition-table", 0x7c0000, 0x02000},
3120 {"default-mac", 0x7c2000, 0x00020},
3121 {"pin", 0x7c2100, 0x00020},
3122 {"product-info", 0x7c3100, 0x01000},
3123 {"soft-version", 0x7c4200, 0x01000},
3124 {"support-list", 0x7c5200, 0x01000},
3125 {"profile", 0x7c6200, 0x08000},
3126 {"config-info", 0x7ce200, 0x00400},
3127 {"user-config", 0x7d0000, 0x10000},
3128 {"default-config", 0x7e0000, 0x10000},
3129 {"radio", 0x7f0000, 0x10000},
3133 .first_sysupgrade_partition
= "os-image",
3134 .last_sysupgrade_partition
= "file-system"
3137 /** Firmware layout for the Mercusys MR70X */
3143 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3144 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3145 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3147 .soft_ver
= SOFT_VER_DEFAULT
,
3150 {"fs-uboot", 0x00000, 0x40000},
3151 {"firmware", 0x40000, 0xf60000},
3152 {"default-mac", 0xfa0000, 0x00200},
3153 {"pin", 0xfa0200, 0x00100},
3154 {"device-id", 0xfa0300, 0x00100},
3155 {"product-info", 0xfa0400, 0x0fc00},
3156 {"default-config", 0xfb0000, 0x08000},
3157 {"ap-def-config", 0xfb8000, 0x08000},
3158 {"user-config", 0xfc0000, 0x0a000},
3159 {"ag-config", 0xfca000, 0x04000},
3160 {"certificate", 0xfce000, 0x02000},
3161 {"ap-config", 0xfd0000, 0x06000},
3162 {"router-config", 0xfd6000, 0x06000},
3163 {"favicon", 0xfdc000, 0x02000},
3164 {"logo", 0xfde000, 0x02000},
3165 {"partition-table", 0xfe0000, 0x00800},
3166 {"soft-version", 0xfe0800, 0x00100},
3167 {"support-list", 0xfe0900, 0x00200},
3168 {"profile", 0xfe0b00, 0x03000},
3169 {"extra-para", 0xfe3b00, 0x00100},
3170 {"radio", 0xff0000, 0x10000},
3174 .first_sysupgrade_partition
= "os-image",
3175 .last_sysupgrade_partition
= "file-system"
3181 #define error(_ret, _errno, _str, ...) \
3183 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3184 strerror(_errno)); \
3190 /** Stores a uint32 as big endian */
3191 static inline void put32(uint8_t *buf
, uint32_t val
) {
3198 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3200 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3203 /** Allocate a padded meta partition with a correctly initialised header
3204 * If the `data` pointer is NULL, then the required space is only allocated,
3205 * otherwise `data_len` bytes will be copied from `data` into the partition
3207 static struct image_partition_entry
init_meta_partition_entry(
3208 const char *name
, const void *data
, uint32_t data_len
,
3209 enum partition_trail_value pad_value
)
3211 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3212 if (meta_partition_should_pad(pad_value
))
3215 struct image_partition_entry entry
= {
3218 .data
= malloc(total_len
)
3221 error(1, errno
, "failed to allocate meta partition entry");
3223 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3224 header
->length
= htonl(data_len
);
3228 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3230 if (meta_partition_should_pad(pad_value
))
3231 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3236 /** Allocates a new image partition */
3237 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3238 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3240 error(1, errno
, "malloc");
3245 /** Sets up default partition names whenever custom names aren't specified */
3246 static void set_partition_names(struct device_info
*info
)
3248 if (!info
->partition_names
.partition_table
)
3249 info
->partition_names
.partition_table
= "partition-table";
3250 if (!info
->partition_names
.soft_ver
)
3251 info
->partition_names
.soft_ver
= "soft-version";
3252 if (!info
->partition_names
.os_image
)
3253 info
->partition_names
.os_image
= "os-image";
3254 if (!info
->partition_names
.support_list
)
3255 info
->partition_names
.support_list
= "support-list";
3256 if (!info
->partition_names
.file_system
)
3257 info
->partition_names
.file_system
= "file-system";
3258 if (!info
->partition_names
.extra_para
)
3259 info
->partition_names
.extra_para
= "extra-para";
3262 /** Frees an image partition */
3263 static void free_image_partition(struct image_partition_entry
*entry
)
3265 void *data
= entry
->data
;
3274 static time_t source_date_epoch
= -1;
3275 static void set_source_date_epoch() {
3276 char *env
= getenv("SOURCE_DATE_EPOCH");
3280 source_date_epoch
= strtoull(env
, &endptr
, 10);
3281 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3282 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3288 /** Generates the partition-table partition */
3289 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3291 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, SAFELOADER_PAYLOAD_TABLE_SIZE
);
3293 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3301 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3303 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3304 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3307 error(1, 0, "flash partition table overflow?");
3314 memset(s
, 0xff, end
-s
);
3320 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3321 static inline uint8_t bcd(uint8_t v
) {
3322 return 0x10 * (v
/10) + v
%10;
3326 /** Generates the soft-version partition */
3327 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3329 /** If an info string is provided, use this instead of
3330 * the structured data, and include the null-termination */
3331 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3332 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3333 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3334 info
->soft_ver
.text
, len
, info
->part_trail
);
3339 if (source_date_epoch
!= -1)
3340 t
= source_date_epoch
;
3341 else if (time(&t
) == (time_t)(-1))
3342 error(1, errno
, "time");
3344 struct tm
*tm
= gmtime(&t
);
3346 struct soft_version s
= {
3349 .version_major
= info
->soft_ver
.num
[0],
3350 .version_minor
= info
->soft_ver
.num
[1],
3351 .version_patch
= info
->soft_ver
.num
[2],
3353 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3354 .year_lo
= bcd(tm
->tm_year
%100),
3355 .month
= bcd(tm
->tm_mon
+1),
3356 .day
= bcd(tm
->tm_mday
),
3359 .compat_level
= htonl(info
->soft_ver_compat_level
)
3362 if (info
->soft_ver_compat_level
== 0)
3363 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3364 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3367 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3368 sizeof(s
), info
->part_trail
);
3371 /** Generates the support-list partition */
3372 static struct image_partition_entry
make_support_list(
3373 const struct device_info
*info
)
3375 uint32_t len
= strlen(info
->support_list
);
3376 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3377 len
, info
->part_trail
);
3380 /** Partition with extra-para data */
3381 static struct image_partition_entry
make_extra_para(
3382 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3384 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3388 /** Creates a new image partition with an arbitrary name from a file */
3389 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
) {
3390 struct stat statbuf
;
3392 if (stat(filename
, &statbuf
) < 0)
3393 error(1, errno
, "unable to stat file `%s'", filename
);
3395 size_t len
= statbuf
.st_size
;
3397 if (add_jffs2_eof
) {
3398 if (file_system_partition
)
3399 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3401 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3404 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3406 FILE *file
= fopen(filename
, "rb");
3408 error(1, errno
, "unable to open file `%s'", filename
);
3410 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3411 error(1, errno
, "unable to read file `%s'", filename
);
3413 if (add_jffs2_eof
) {
3414 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3416 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3417 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3426 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3428 Example image partition table:
3430 fwup-ptn partition-table base 0x00800 size 0x00800
3431 fwup-ptn os-image base 0x01000 size 0x113b45
3432 fwup-ptn file-system base 0x114b45 size 0x1d0004
3433 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3435 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3436 the end of the partition table is marked with a zero byte.
3438 The firmware image must contain at least the partition-table and support-list partitions
3439 to be accepted. There aren't any alignment constraints for the image partitions.
3441 The partition-table partition contains the actual flash layout; partitions
3442 from the image partition table are mapped to the corresponding flash partitions during
3443 the firmware upgrade. The support-list partition contains a list of devices supported by
3446 The base offsets in the firmware partition table are relative to the end
3447 of the vendor information block, so the partition-table partition will
3448 actually start at offset 0x1814 of the image.
3450 I think partition-table must be the first partition in the firmware image.
3452 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3454 char *image_pt
= (char *)buffer
, *end
= image_pt
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3456 size_t base
= SAFELOADER_PAYLOAD_TABLE_SIZE
;
3457 for (i
= 0; parts
[i
].name
; i
++) {
3458 for (j
= 0; flash_parts
[j
].name
; j
++) {
3459 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3460 if (parts
[i
].size
> flash_parts
[j
].size
)
3461 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3466 assert(flash_parts
[j
].name
);
3468 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3470 size_t len
= end
-image_pt
;
3471 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
);
3474 error(1, 0, "image partition table overflow?");
3478 base
+= parts
[i
].size
;
3482 /** Generates and writes the image MD5 checksum */
3483 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3487 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3488 MD5_Update(&ctx
, buffer
, len
);
3489 MD5_Final(md5
, &ctx
);
3494 Generates the firmware image in factory format
3500 0000-0003 Image size (4 bytes, big endian)
3501 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3502 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3503 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3504 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3505 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3506 1814-xxxx Firmware partitions
3508 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3509 *len
= SAFELOADER_PAYLOAD_OFFSET
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3512 for (i
= 0; parts
[i
].name
; i
++)
3513 *len
+= parts
[i
].size
;
3515 uint8_t *image
= malloc(*len
);
3517 error(1, errno
, "malloc");
3519 memset(image
, 0xff, *len
);
3523 size_t vendor_len
= strlen(info
->vendor
);
3524 put32(image
+ SAFELOADER_PREAMBLE_SIZE
, vendor_len
);
3525 memcpy(image
+ SAFELOADER_PREAMBLE_SIZE
+ 0x4, info
->vendor
, vendor_len
);
3528 put_partitions(image
+ SAFELOADER_PAYLOAD_OFFSET
, info
->partitions
, parts
);
3529 put_md5(image
+ 0x04, image
+ SAFELOADER_PREAMBLE_SIZE
, *len
- SAFELOADER_PREAMBLE_SIZE
);
3535 Generates the firmware image in sysupgrade format
3537 This makes some assumptions about the provided flash and image partition tables and
3538 should be generalized when TP-LINK starts building its safeloader into hardware with
3539 different flash layouts.
3541 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3543 size_t flash_first_partition_index
= 0;
3544 size_t flash_last_partition_index
= 0;
3545 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3546 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3547 const struct image_partition_entry
*image_last_partition
= NULL
;
3549 /** Find first and last partitions */
3550 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3551 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3552 flash_first_partition
= &info
->partitions
[i
];
3553 flash_first_partition_index
= i
;
3554 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3555 flash_last_partition
= &info
->partitions
[i
];
3556 flash_last_partition_index
= i
;
3560 assert(flash_first_partition
&& flash_last_partition
);
3561 assert(flash_first_partition_index
< flash_last_partition_index
);
3563 /** Find last partition from image to calculate needed size */
3564 for (i
= 0; image_parts
[i
].name
; i
++) {
3565 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3566 image_last_partition
= &image_parts
[i
];
3571 assert(image_last_partition
);
3573 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3575 uint8_t *image
= malloc(*len
);
3577 error(1, errno
, "malloc");
3579 memset(image
, 0xff, *len
);
3581 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3582 for (j
= 0; image_parts
[j
].name
; j
++) {
3583 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3584 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3585 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3586 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3590 assert(image_parts
[j
].name
);
3597 /** Generates an image according to a given layout and writes it to a file */
3598 static void build_image(const char *output
,
3599 const char *kernel_image
,
3600 const char *rootfs_image
,
3604 struct device_info
*info
) {
3608 struct image_partition_entry parts
[7] = {};
3610 struct flash_partition_entry
*firmware_partition
= NULL
;
3611 struct flash_partition_entry
*os_image_partition
= NULL
;
3612 struct flash_partition_entry
*file_system_partition
= NULL
;
3613 size_t firmware_partition_index
= 0;
3615 set_partition_names(info
);
3617 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3618 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3620 firmware_partition
= &info
->partitions
[i
];
3621 firmware_partition_index
= i
;
3625 if (firmware_partition
)
3627 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3628 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3631 if (stat(kernel_image
, &kernel
) < 0)
3632 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3634 if (kernel
.st_size
> firmware_partition
->size
)
3635 error(1, 0, "kernel overflowed firmware partition\n");
3637 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3638 info
->partitions
[i
+1] = info
->partitions
[i
];
3640 file_system_partition
->name
= info
->partition_names
.file_system
;
3642 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3644 /* Align partition start to erase blocks for factory images only */
3646 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3648 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3650 os_image_partition
->name
= info
->partition_names
.os_image
;
3652 os_image_partition
->size
= kernel
.st_size
;
3655 parts
[0] = make_partition_table(info
);
3656 parts
[1] = make_soft_version(info
, rev
);
3657 parts
[2] = make_support_list(info
);
3658 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3659 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3662 /* Some devices need the extra-para partition to accept the firmware */
3663 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3664 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3665 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3666 strcasecmp(info
->id
, "ARCHER-AX23-V1") == 0 ||
3667 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3668 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3669 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3670 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3671 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3672 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3673 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3674 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3675 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3676 strcasecmp(info
->id
, "DECO-M4R-V4") == 0 ||
3677 strcasecmp(info
->id
, "MR70X") == 0 ||
3678 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3679 const uint8_t extra_para
[2] = {0x01, 0x00};
3680 parts
[5] = make_extra_para(info
, extra_para
,
3681 sizeof(extra_para
));
3682 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3683 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3684 const uint8_t extra_para
[2] = {0x00, 0x01};
3685 parts
[5] = make_extra_para(info
, extra_para
,
3686 sizeof(extra_para
));
3687 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3688 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3689 const uint8_t extra_para
[2] = {0x01, 0x01};
3690 parts
[5] = make_extra_para(info
, extra_para
,
3691 sizeof(extra_para
));
3697 image
= generate_sysupgrade_image(info
, parts
, &len
);
3699 image
= generate_factory_image(info
, parts
, &len
);
3701 FILE *file
= fopen(output
, "wb");
3703 error(1, errno
, "unable to open output file");
3705 if (fwrite(image
, len
, 1, file
) != 1)
3706 error(1, 0, "unable to write output file");
3712 for (i
= 0; parts
[i
].name
; i
++)
3713 free_image_partition(&parts
[i
]);
3717 static void usage(const char *argv0
) {
3719 "Usage: %s [OPTIONS...]\n"
3722 " -h show this help\n"
3724 "Info about an image:\n"
3725 " -i <file> input file to read from\n"
3726 "Create a new image:\n"
3727 " -B <board> create image for the board specified with <board>\n"
3728 " -k <file> read kernel image from the file <file>\n"
3729 " -r <file> read rootfs image from the file <file>\n"
3730 " -o <file> write output to the file <file>\n"
3731 " -V <rev> sets the revision number to <rev>\n"
3732 " -j add jffs2 end-of-filesystem markers\n"
3733 " -S create sysupgrade instead of factory image\n"
3734 "Extract an old image:\n"
3735 " -x <file> extract all oem firmware partition\n"
3736 " -d <dir> destination to extract the firmware partition\n"
3737 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3743 static struct device_info
*find_board(const char *id
)
3745 struct device_info
*board
= NULL
;
3747 for (board
= boards
; board
->id
!= NULL
; board
++)
3748 if (strcasecmp(id
, board
->id
) == 0)
3754 static int add_flash_partition(
3755 struct flash_partition_entry
*part_list
,
3762 /* check if the list has a free entry */
3763 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3764 if (part_list
->name
== NULL
&&
3765 part_list
->base
== 0 &&
3766 part_list
->size
== 0)
3770 if (ptr
== max_entries
) {
3771 error(1, 0, "No free flash part entry available.");
3774 part_list
->name
= calloc(1, strlen(name
) + 1);
3775 if (!part_list
->name
) {
3776 error(1, 0, "Unable to allocate memory");
3779 memcpy((char *)part_list
->name
, name
, strlen(name
));
3780 part_list
->base
= base
;
3781 part_list
->size
= size
;
3786 /** read the partition table into struct flash_partition_entry */
3787 enum PARTITION_TABLE_TYPE
{
3788 PARTITION_TABLE_FWUP
,
3789 PARTITION_TABLE_FLASH
,
3792 static int read_partition_table(
3793 FILE *file
, long offset
,
3794 struct flash_partition_entry
*entries
, size_t max_entries
,
3797 char buf
[SAFELOADER_PAYLOAD_TABLE_SIZE
];
3799 const char *parthdr
= NULL
;
3800 const char *fwuphdr
= "fwup-ptn";
3801 const char *flashhdr
= "partition";
3803 /* TODO: search for the partition table */
3806 case PARTITION_TABLE_FWUP
:
3809 case PARTITION_TABLE_FLASH
:
3813 error(1, 0, "Invalid partition table");
3816 if (fseek(file
, offset
, SEEK_SET
) < 0)
3817 error(1, errno
, "Can not seek in the firmware");
3819 if (fread(buf
, sizeof(buf
), 1, file
) != 1)
3820 error(1, errno
, "Can not read fwup-ptn from the firmware");
3822 buf
[sizeof(buf
) - 1] = '\0';
3824 /* look for the partition header */
3825 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3826 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3831 end
= buf
+ sizeof(buf
);
3832 while ((ptr
+ strlen(parthdr
)) < end
&&
3833 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3837 char name
[32] = { 0 };
3839 unsigned long base
= 0;
3840 unsigned long size
= 0;
3842 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3843 if (end_part
== NULL
) {
3844 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3848 for (int i
= 0; i
<= 4; i
++) {
3849 if (end_part
<= ptr
)
3852 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3853 if (end_element
== NULL
) {
3854 error(1, errno
, "Ignoring the rest of the partition entries.");
3859 /* partition header */
3861 ptr
= end_element
+ 1;
3865 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3866 strncpy(name
, ptr
, name_len
);
3867 name
[name_len
] = '\0';
3868 ptr
= end_element
+ 1;
3873 ptr
= end_element
+ 1;
3878 base
= strtoul(ptr
, NULL
, 16);
3879 ptr
= end_element
+ 1;
3884 ptr
= end_element
+ 1;
3885 /* actual size. The last element doesn't have a sepeartor */
3886 size
= strtoul(ptr
, NULL
, 16);
3887 /* the part ends with 0x09, 0x0d, 0x0a */
3889 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3898 static void safeloader_read_partition(FILE *input_file
, size_t payload_offset
,
3899 struct flash_partition_entry
*entry
,
3900 struct image_partition_entry
*part
)
3902 size_t part_size
= entry
->size
;
3903 void *part_data
= malloc(part_size
);
3905 if (fseek(input_file
, payload_offset
, SEEK_SET
))
3906 error(1, errno
, "Failed to seek to partition data");
3909 error(1, ENOMEM
, "Failed to allocate partition data");
3911 if (fread(part_data
, 1, part_size
, input_file
) < part_size
)
3912 error(1, errno
, "Failed to read partition data");
3914 part
->data
= part_data
;
3915 part
->size
= part_size
;
3916 part
->name
= entry
->name
;
3919 static void safeloader_parse_image(FILE *input_file
, struct safeloader_image_info
*image
)
3921 static const char *HEADER_ID_CLOUD
= "fw-type:Cloud";
3922 static const char *HEADER_ID_QNEW
= "?NEW";
3929 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
3931 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3932 error(1, errno
, "Can not read image header");
3934 if (memcmp(HEADER_ID_QNEW
, &buf
[0], strlen(HEADER_ID_QNEW
)) == 0)
3935 image
->type
= SAFELOADER_TYPE_QNEW
;
3936 else if (memcmp(HEADER_ID_CLOUD
, &buf
[0], strlen(HEADER_ID_CLOUD
)) == 0)
3937 image
->type
= SAFELOADER_TYPE_CLOUD
;
3938 else if (ntohl(*((uint32_t *) &buf
[0])) <= SAFELOADER_HEADER_SIZE
)
3939 image
->type
= SAFELOADER_TYPE_VENDOR
;
3941 image
->type
= SAFELOADER_TYPE_DEFAULT
;
3943 switch (image
->type
) {
3944 case SAFELOADER_TYPE_DEFAULT
:
3945 case SAFELOADER_TYPE_VENDOR
:
3946 case SAFELOADER_TYPE_CLOUD
:
3947 image
->payload_offset
= SAFELOADER_PAYLOAD_OFFSET
;
3949 case SAFELOADER_TYPE_QNEW
:
3950 image
->payload_offset
= SAFELOADER_QNEW_PAYLOAD_OFFSET
;
3954 /* Parse image partition table */
3955 read_partition_table(input_file
, image
->payload_offset
, &image
->entries
[0],
3956 MAX_PARTITIONS
, PARTITION_TABLE_FWUP
);
3959 static void write_partition(
3961 size_t firmware_offset
,
3962 struct flash_partition_entry
*entry
,
3968 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3970 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3971 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3972 error(1, errno
, "Can not read partition from input_file");
3974 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3975 error(1, errno
, "Can not write partition to output_file");
3977 /* write last chunk smaller than buffer */
3978 if (offset
< entry
->size
) {
3979 offset
= entry
->size
- offset
;
3980 if (fread(buf
, offset
, 1, input_file
) != 1)
3981 error(1, errno
, "Can not read partition from input_file");
3982 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3983 error(1, errno
, "Can not write partition to output_file");
3987 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3990 char output
[PATH_MAX
];
3992 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3993 output_file
= fopen(output
, "wb+");
3994 if (output_file
== NULL
) {
3995 error(1, errno
, "Can not open output file %s", output
);
3998 write_partition(input_file
, firmware_offset
, entry
, output_file
);
4000 fclose(output_file
);
4005 /** extract all partitions from the firmware file */
4006 static int extract_firmware(const char *input
, const char *output_directory
)
4008 struct safeloader_image_info info
= {};
4009 struct stat statbuf
;
4012 /* check input file */
4013 if (stat(input
, &statbuf
)) {
4014 error(1, errno
, "Can not read input firmware %s", input
);
4017 /* check if output directory exists */
4018 if (stat(output_directory
, &statbuf
)) {
4019 error(1, errno
, "Failed to stat output directory %s", output_directory
);
4022 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
4023 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
4026 input_file
= fopen(input
, "rb");
4027 safeloader_parse_image(input_file
, &info
);
4029 for (size_t i
= 0; i
< MAX_PARTITIONS
&& info
.entries
[i
].name
; i
++)
4030 extract_firmware_partition(input_file
, info
.payload_offset
, &info
.entries
[i
], output_directory
);
4035 static struct flash_partition_entry
*find_partition(
4036 struct flash_partition_entry
*entries
, size_t max_entries
,
4037 const char *name
, const char *error_msg
)
4039 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
4040 if (strcmp(entries
->name
, name
) == 0)
4045 error(1, 0, "%s", error_msg
);
4051 static int firmware_info(const char *input
)
4053 struct safeloader_image_info info
= {};
4054 struct image_partition_entry part
= {};
4055 struct flash_partition_entry
*e
;
4058 input_file
= fopen(input
, "rb");
4060 safeloader_parse_image(input_file
, &info
);
4062 if (info
.type
== SAFELOADER_TYPE_VENDOR
) {
4063 char buf
[SAFELOADER_HEADER_SIZE
] = {};
4064 uint32_t vendor_size
;
4066 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
4067 fread(&vendor_size
, sizeof(uint32_t), 1, input_file
);
4069 vendor_size
= ntohl(vendor_size
);
4070 fread(buf
, vendor_size
, 1, input_file
);
4072 printf("Firmware vendor string:\n");
4073 fwrite(buf
, strnlen(buf
, vendor_size
), 1, stdout
);
4077 printf("Firmware image partitions:\n");
4078 printf("%-8s %-8s %s\n", "base", "size", "name");
4080 e
= &info
.entries
[0];
4081 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4082 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4084 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "soft-version", NULL
);
4086 struct soft_version
*s
;
4087 unsigned int ascii_len
;
4092 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4093 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4094 buf
= part
.data
+ sizeof(struct meta_header
);
4096 /* Check for (null-terminated) string */
4098 while (ascii_len
< data_len
&& isascii(buf
[ascii_len
]))
4101 isstr
= ascii_len
== data_len
;
4103 printf("\n[Software version]\n");
4105 fwrite(buf
, strnlen((const char *) buf
, data_len
), 1, stdout
);
4107 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
4108 s
= (struct soft_version
*) buf
;
4110 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
4111 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
4112 printf("Revision: %d\n", ntohl(s
->rev
));
4114 printf("Failed to parse data\n");
4117 free_image_partition(&part
);
4120 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "support-list", NULL
);
4124 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4125 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4127 printf("\n[Support list]\n");
4128 fwrite(part
.data
+ sizeof(struct meta_header
), data_len
, 1, stdout
);
4131 free_image_partition(&part
);
4134 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "partition-table", NULL
);
4136 size_t flash_table_offset
= info
.payload_offset
+ e
->base
+ 4;
4137 struct flash_partition_entry parts
[MAX_PARTITIONS
] = {};
4139 if (read_partition_table(input_file
, flash_table_offset
, parts
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
))
4140 error(1, 0, "Error can not read the partition table (partition)");
4142 printf("\n[Partition table]\n");
4143 printf("%-8s %-8s %s\n", "base", "size", "name");
4146 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4147 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4155 static void write_ff(FILE *output_file
, size_t size
)
4160 memset(buf
, 0xff, sizeof(buf
));
4162 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
4163 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
4164 error(1, errno
, "Can not write 0xff to output_file");
4167 /* write last chunk smaller than buffer */
4168 if (offset
< size
) {
4169 offset
= size
- offset
;
4170 if (fwrite(buf
, offset
, 1, output_file
) != 1)
4171 error(1, errno
, "Can not write partition to output_file");
4175 static void convert_firmware(const char *input
, const char *output
)
4177 struct flash_partition_entry flash
[MAX_PARTITIONS
] = {};
4178 struct flash_partition_entry
*fwup_partition_table
;
4179 struct flash_partition_entry
*flash_file_system
;
4180 struct flash_partition_entry
*fwup_file_system
;
4181 struct flash_partition_entry
*flash_os_image
;
4182 struct flash_partition_entry
*fwup_os_image
;
4183 struct safeloader_image_info info
= {};
4184 size_t flash_table_offset
;
4185 struct stat statbuf
;
4189 /* check input file */
4190 if (stat(input
, &statbuf
)) {
4191 error(1, errno
, "Can not read input firmware %s", input
);
4194 input_file
= fopen(input
, "rb");
4196 error(1, 0, "Can not open input firmware %s", input
);
4198 output_file
= fopen(output
, "wb");
4200 error(1, 0, "Can not open output firmware %s", output
);
4202 input_file
= fopen(input
, "rb");
4203 safeloader_parse_image(input_file
, &info
);
4205 fwup_os_image
= find_partition(info
.entries
, MAX_PARTITIONS
,
4206 "os-image", "Error can not find os-image partition (fwup)");
4207 fwup_file_system
= find_partition(info
.entries
, MAX_PARTITIONS
,
4208 "file-system", "Error can not find file-system partition (fwup)");
4209 fwup_partition_table
= find_partition(info
.entries
, MAX_PARTITIONS
,
4210 "partition-table", "Error can not find partition-table partition");
4212 /* the flash partition table has a 0x00000004 magic haeder */
4213 flash_table_offset
= info
.payload_offset
+ fwup_partition_table
->base
+ 4;
4214 if (read_partition_table(input_file
, flash_table_offset
, flash
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
) != 0)
4215 error(1, 0, "Error can not read the partition table (flash)");
4217 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4218 "os-image", "Error can not find os-image partition (flash)");
4219 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4220 "file-system", "Error can not find file-system partition (flash)");
4222 /* write os_image to 0x0 */
4223 write_partition(input_file
, info
.payload_offset
, fwup_os_image
, output_file
);
4224 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4226 /* write file-system behind os_image */
4227 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4228 write_partition(input_file
, info
.payload_offset
, fwup_file_system
, output_file
);
4230 fclose(output_file
);
4234 int main(int argc
, char *argv
[]) {
4235 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4236 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4237 bool add_jffs2_eof
= false, sysupgrade
= false;
4239 struct device_info
*info
;
4240 set_source_date_epoch();
4245 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4251 info_image
= optarg
;
4259 kernel_image
= optarg
;
4263 rootfs_image
= optarg
;
4271 sscanf(optarg
, "r%u", &rev
);
4275 add_jffs2_eof
= true;
4287 output_directory
= optarg
;
4291 extract_image
= optarg
;
4295 convert_image
= optarg
;
4305 firmware_info(info_image
);
4306 } else if (extract_image
|| output_directory
) {
4308 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4309 if (!output_directory
)
4310 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4311 extract_firmware(extract_image
, output_directory
);
4312 } else if (convert_image
) {
4314 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4315 convert_firmware(convert_image
, output
);
4318 error(1, 0, "no board has been specified");
4320 error(1, 0, "no kernel image has been specified");
4322 error(1, 0, "no rootfs image has been specified");
4324 error(1, 0, "no output filename has been specified");
4326 info
= find_board(board
);
4329 error(1, 0, "unsupported board %s", board
);
4331 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);