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.20,special_id:45550000}\n"
982 "{product_name:Archer AX23,product_ver:1.0,special_id:4A500000}\n"
983 "{product_name:Archer AX23,product_ver:1.20,special_id:4A500000}\n"
984 "{product_name:Archer AX23,product_ver:1.0,special_id:4B520000}\n"
985 "{product_name:Archer AX23,product_ver:1.0,special_id:52550000}\n"
986 "{product_name:Archer AX1800,product_ver:1.20,special_id:52550000}\n"
987 "{product_name:Archer AX23,product_ver:1.0.0,special_id:55530000}\n"
988 "{product_name:Archer AX23,product_ver:1.20,special_id:55530000}\n"
989 "{product_name:Archer AX23,product_ver:1.0.0,special_id:43410000}\n"
990 "{product_name:Archer AX23,product_ver:1.0.0,special_id:54570000}\n",
992 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.3\n"),
995 {"fs-uboot", 0x00000, 0x40000},
996 {"firmware", 0x40000, 0xf60000},
997 {"default-mac", 0xfa0000, 0x00200},
998 {"pin", 0xfa0200, 0x00100},
999 {"device-id", 0xfa0300, 0x00100},
1000 {"product-info", 0xfa0400, 0x0fc00},
1001 {"default-config", 0xfb0000, 0x08000},
1002 {"ap-def-config", 0xfb8000, 0x08000},
1003 {"user-config", 0xfc0000, 0x0a000},
1004 {"ag-config", 0xfca000, 0x04000},
1005 {"certificate", 0xfce000, 0x02000},
1006 {"ap-config", 0xfd0000, 0x06000},
1007 {"router-config", 0xfd6000, 0x06000},
1008 {"favicon", 0xfdc000, 0x02000},
1009 {"logo", 0xfde000, 0x02000},
1010 {"partition-table", 0xfe0000, 0x00800},
1011 {"soft-version", 0xfe0800, 0x00100},
1012 {"support-list", 0xfe0900, 0x00200},
1013 {"profile", 0xfe0b00, 0x03000},
1014 {"extra-para", 0xfe3b00, 0x00100},
1015 {"radio", 0xff0000, 0x10000},
1018 .first_sysupgrade_partition
= "os-image",
1019 .last_sysupgrade_partition
= "file-system",
1021 /** Firmware layout for the C2v3 */
1023 .id
= "ARCHER-C2-V3",
1026 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
1027 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
1028 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
1030 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.1\n"),
1032 /** We're using a dynamic kernel/rootfs split here */
1035 {"factory-boot", 0x00000, 0x20000},
1036 {"fs-uboot", 0x20000, 0x10000},
1037 {"firmware", 0x30000, 0x7a0000},
1038 {"user-config", 0x7d0000, 0x04000},
1039 {"default-mac", 0x7e0000, 0x00100},
1040 {"device-id", 0x7e0100, 0x00100},
1041 {"extra-para", 0x7e0200, 0x00100},
1042 {"pin", 0x7e0300, 0x00100},
1043 {"support-list", 0x7e0400, 0x00400},
1044 {"soft-version", 0x7e0800, 0x00400},
1045 {"product-info", 0x7e0c00, 0x01400},
1046 {"partition-table", 0x7e2000, 0x01000},
1047 {"profile", 0x7e3000, 0x01000},
1048 {"default-config", 0x7e4000, 0x04000},
1049 {"merge-config", 0x7ec000, 0x02000},
1050 {"qos-db", 0x7ee000, 0x02000},
1051 {"radio", 0x7f0000, 0x10000},
1055 .first_sysupgrade_partition
= "os-image",
1056 .last_sysupgrade_partition
= "file-system",
1059 /** Firmware layout for the C25v1 */
1061 .id
= "ARCHER-C25-V1",
1064 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1065 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1066 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1068 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1070 /* We're using a dynamic kernel/rootfs split here */
1072 {"factory-boot", 0x00000, 0x20000},
1073 {"fs-uboot", 0x20000, 0x10000},
1074 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1075 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1076 {"user-config", 0x7d0000, 0x04000},
1077 {"default-mac", 0x7e0000, 0x00100},
1078 {"device-id", 0x7e0100, 0x00100},
1079 {"extra-para", 0x7e0200, 0x00100},
1080 {"pin", 0x7e0300, 0x00100},
1081 {"support-list", 0x7e0400, 0x00400},
1082 {"soft-version", 0x7e0800, 0x00400},
1083 {"product-info", 0x7e0c00, 0x01400},
1084 {"partition-table", 0x7e2000, 0x01000},
1085 {"profile", 0x7e3000, 0x01000},
1086 {"default-config", 0x7e4000, 0x04000},
1087 {"merge-config", 0x7ec000, 0x02000},
1088 {"qos-db", 0x7ee000, 0x02000},
1089 {"radio", 0x7f0000, 0x10000},
1093 .first_sysupgrade_partition
= "os-image",
1094 .last_sysupgrade_partition
= "file-system",
1097 /** Firmware layout for the C58v1 */
1099 .id
= "ARCHER-C58-V1",
1103 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1104 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1105 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1107 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1110 {"fs-uboot", 0x00000, 0x10000},
1111 {"default-mac", 0x10000, 0x00200},
1112 {"pin", 0x10200, 0x00200},
1113 {"product-info", 0x10400, 0x00100},
1114 {"partition-table", 0x10500, 0x00800},
1115 {"soft-version", 0x11300, 0x00200},
1116 {"support-list", 0x11500, 0x00100},
1117 {"device-id", 0x11600, 0x00100},
1118 {"profile", 0x11700, 0x03900},
1119 {"default-config", 0x15000, 0x04000},
1120 {"user-config", 0x19000, 0x04000},
1121 {"firmware", 0x20000, 0x7c8000},
1122 {"certyficate", 0x7e8000, 0x08000},
1123 {"radio", 0x7f0000, 0x10000},
1127 .first_sysupgrade_partition
= "os-image",
1128 .last_sysupgrade_partition
= "file-system",
1131 /** Firmware layout for the C59v1 */
1133 .id
= "ARCHER-C59-V1",
1137 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1138 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1139 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1140 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1142 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1144 /* We're using a dynamic kernel/rootfs split here */
1146 {"fs-uboot", 0x00000, 0x10000},
1147 {"default-mac", 0x10000, 0x00200},
1148 {"pin", 0x10200, 0x00200},
1149 {"device-id", 0x10400, 0x00100},
1150 {"product-info", 0x10500, 0x0fb00},
1151 {"firmware", 0x20000, 0xe30000},
1152 {"partition-table", 0xe50000, 0x10000},
1153 {"soft-version", 0xe60000, 0x10000},
1154 {"support-list", 0xe70000, 0x10000},
1155 {"profile", 0xe80000, 0x10000},
1156 {"default-config", 0xe90000, 0x10000},
1157 {"user-config", 0xea0000, 0x40000},
1158 {"usb-config", 0xee0000, 0x10000},
1159 {"certificate", 0xef0000, 0x10000},
1160 {"qos-db", 0xf00000, 0x40000},
1161 {"log", 0xfe0000, 0x10000},
1162 {"radio", 0xff0000, 0x10000},
1166 .first_sysupgrade_partition
= "os-image",
1167 .last_sysupgrade_partition
= "file-system",
1170 /** Firmware layout for the C59v2 */
1172 .id
= "ARCHER-C59-V2",
1176 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1177 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1178 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1180 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1182 /** We're using a dynamic kernel/rootfs split here */
1184 {"factory-boot", 0x00000, 0x20000},
1185 {"fs-uboot", 0x20000, 0x10000},
1186 {"default-mac", 0x30000, 0x00200},
1187 {"pin", 0x30200, 0x00200},
1188 {"device-id", 0x30400, 0x00100},
1189 {"product-info", 0x30500, 0x0fb00},
1190 {"firmware", 0x40000, 0xe10000},
1191 {"partition-table", 0xe50000, 0x10000},
1192 {"soft-version", 0xe60000, 0x10000},
1193 {"support-list", 0xe70000, 0x10000},
1194 {"profile", 0xe80000, 0x10000},
1195 {"default-config", 0xe90000, 0x10000},
1196 {"user-config", 0xea0000, 0x40000},
1197 {"usb-config", 0xee0000, 0x10000},
1198 {"certificate", 0xef0000, 0x10000},
1199 {"extra-para", 0xf00000, 0x10000},
1200 {"qos-db", 0xf10000, 0x30000},
1201 {"log", 0xfe0000, 0x10000},
1202 {"radio", 0xff0000, 0x10000},
1206 .first_sysupgrade_partition
= "os-image",
1207 .last_sysupgrade_partition
= "file-system",
1210 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1212 .id
= "ARCHER-C6-V2",
1216 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1217 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1218 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1219 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1221 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1224 {"fs-uboot", 0x00000, 0x20000},
1225 {"default-mac", 0x20000, 0x00200},
1226 {"pin", 0x20200, 0x00100},
1227 {"product-info", 0x20300, 0x00200},
1228 {"device-id", 0x20500, 0x0fb00},
1229 {"firmware", 0x30000, 0x7a9400},
1230 {"soft-version", 0x7d9400, 0x00100},
1231 {"extra-para", 0x7d9500, 0x00100},
1232 {"support-list", 0x7d9600, 0x00200},
1233 {"profile", 0x7d9800, 0x03000},
1234 {"default-config", 0x7dc800, 0x03000},
1235 {"partition-table", 0x7df800, 0x00800},
1236 {"user-config", 0x7e0000, 0x0c000},
1237 {"certificate", 0x7ec000, 0x04000},
1238 {"radio", 0x7f0000, 0x10000},
1242 .first_sysupgrade_partition
= "os-image",
1243 .last_sysupgrade_partition
= "file-system",
1246 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1248 .id
= "ARCHER-C6-V2-US",
1252 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1253 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1254 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1256 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1259 {"factory-boot", 0x00000, 0x20000},
1260 {"default-mac", 0x20000, 0x00200},
1261 {"pin", 0x20200, 0x00100},
1262 {"product-info", 0x20300, 0x00200},
1263 {"device-id", 0x20500, 0x0fb00},
1264 {"fs-uboot", 0x30000, 0x20000},
1265 {"firmware", 0x50000, 0xf89400},
1266 {"soft-version", 0xfd9400, 0x00100},
1267 {"extra-para", 0xfd9500, 0x00100},
1268 {"support-list", 0xfd9600, 0x00200},
1269 {"profile", 0xfd9800, 0x03000},
1270 {"default-config", 0xfdc800, 0x03000},
1271 {"partition-table", 0xfdf800, 0x00800},
1272 {"user-config", 0xfe0000, 0x0c000},
1273 {"certificate", 0xfec000, 0x04000},
1274 {"radio", 0xff0000, 0x10000},
1277 .first_sysupgrade_partition
= "os-image",
1278 .last_sysupgrade_partition
= "file-system",
1280 /** Firmware layout for the Archer C6 v3 */
1282 .id
= "ARCHER-C6-V3",
1286 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1287 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1288 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1289 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1290 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1291 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1293 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1296 {"fs-uboot", 0x00000, 0x40000},
1297 {"firmware", 0x40000, 0xf60000},
1298 {"default-mac", 0xfa0000, 0x00200},
1299 {"pin", 0xfa0200, 0x00100},
1300 {"device-id", 0xfa0300, 0x00100},
1301 {"product-info", 0xfa0400, 0x0fc00},
1302 {"default-config", 0xfb0000, 0x08000},
1303 {"ap-def-config", 0xfb8000, 0x08000},
1304 {"user-config", 0xfc0000, 0x0a000},
1305 {"ag-config", 0xfca000, 0x04000},
1306 {"certificate", 0xfce000, 0x02000},
1307 {"ap-config", 0xfd0000, 0x06000},
1308 {"router-config", 0xfd6000, 0x06000},
1309 {"favicon", 0xfdc000, 0x02000},
1310 {"logo", 0xfde000, 0x02000},
1311 {"partition-table", 0xfe0000, 0x00800},
1312 {"soft-version", 0xfe0800, 0x00100},
1313 {"support-list", 0xfe0900, 0x00200},
1314 {"profile", 0xfe0b00, 0x03000},
1315 {"extra-para", 0xfe3b00, 0x00100},
1316 {"radio", 0xff0000, 0x10000},
1319 .first_sysupgrade_partition
= "os-image",
1320 .last_sysupgrade_partition
= "file-system",
1322 /** Firmware layout for the Archer A6 v3 */
1324 .id
= "ARCHER-A6-V3",
1328 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1329 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1330 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1331 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1333 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1336 {"fs-uboot", 0x00000, 0x40000},
1337 {"firmware", 0x40000, 0xf60000},
1338 {"default-mac", 0xfa0000, 0x00200},
1339 {"pin", 0xfa0200, 0x00100},
1340 {"device-id", 0xfa0300, 0x00100},
1341 {"product-info", 0xfa0400, 0x0fc00},
1342 {"default-config", 0xfb0000, 0x08000},
1343 {"ap-def-config", 0xfb8000, 0x08000},
1344 {"user-config", 0xfc0000, 0x0a000},
1345 {"ag-config", 0xfca000, 0x04000},
1346 {"certificate", 0xfce000, 0x02000},
1347 {"ap-config", 0xfd0000, 0x06000},
1348 {"router-config", 0xfd6000, 0x06000},
1349 {"favicon", 0xfdc000, 0x02000},
1350 {"logo", 0xfde000, 0x02000},
1351 {"partition-table", 0xfe0000, 0x00800},
1352 {"soft-version", 0xfe0800, 0x00100},
1353 {"support-list", 0xfe0900, 0x00200},
1354 {"profile", 0xfe0b00, 0x03000},
1355 {"extra-para", 0xfe3b00, 0x00100},
1356 {"radio", 0xff0000, 0x10000},
1359 .first_sysupgrade_partition
= "os-image",
1360 .last_sysupgrade_partition
= "file-system",
1362 /** Firmware layout for the Archer C6U v1 */
1364 .id
= "ARCHER-C6U-V1",
1368 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1370 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1373 {"fs-uboot", 0x00000, 0x40000},
1374 {"firmware", 0x40000, 0xf60000},
1375 {"default-mac", 0xfa0000, 0x00200},
1376 {"pin", 0xfa0200, 0x00100},
1377 {"device-id", 0xfa0300, 0x00100},
1378 {"product-info", 0xfa0400, 0x0fc00},
1379 {"default-config", 0xfb0000, 0x08000},
1380 {"ap-def-config", 0xfb8000, 0x08000},
1381 {"user-config", 0xfc0000, 0x0c000},
1382 {"certificate", 0xfcc000, 0x04000},
1383 {"ap-config", 0xfd0000, 0x08000},
1384 {"router-config", 0xfd8000, 0x08000},
1385 {"partition-table", 0xfe0000, 0x00800},
1386 {"soft-version", 0xfe0800, 0x00100},
1387 {"support-list", 0xfe0900, 0x00200},
1388 {"profile", 0xfe0b00, 0x03000},
1389 {"extra-para", 0xfe3b00, 0x00100},
1390 {"radio", 0xff0000, 0x10000},
1393 .first_sysupgrade_partition
= "os-image",
1394 .last_sysupgrade_partition
= "file-system",
1396 /** Firmware layout for the C60v1 */
1398 .id
= "ARCHER-C60-V1",
1402 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1403 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1404 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1406 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1409 {"fs-uboot", 0x00000, 0x10000},
1410 {"default-mac", 0x10000, 0x00200},
1411 {"pin", 0x10200, 0x00200},
1412 {"product-info", 0x10400, 0x00100},
1413 {"partition-table", 0x10500, 0x00800},
1414 {"soft-version", 0x11300, 0x00200},
1415 {"support-list", 0x11500, 0x00100},
1416 {"device-id", 0x11600, 0x00100},
1417 {"profile", 0x11700, 0x03900},
1418 {"default-config", 0x15000, 0x04000},
1419 {"user-config", 0x19000, 0x04000},
1420 {"firmware", 0x20000, 0x7c8000},
1421 {"certyficate", 0x7e8000, 0x08000},
1422 {"radio", 0x7f0000, 0x10000},
1426 .first_sysupgrade_partition
= "os-image",
1427 .last_sysupgrade_partition
= "file-system",
1430 /** Firmware layout for the C60v2 */
1432 .id
= "ARCHER-C60-V2",
1436 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1437 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1438 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1440 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1443 {"factory-boot", 0x00000, 0x1fb00},
1444 {"default-mac", 0x1fb00, 0x00200},
1445 {"pin", 0x1fd00, 0x00100},
1446 {"product-info", 0x1fe00, 0x00100},
1447 {"device-id", 0x1ff00, 0x00100},
1448 {"fs-uboot", 0x20000, 0x10000},
1449 {"firmware", 0x30000, 0x7a0000},
1450 {"soft-version", 0x7d9500, 0x00100},
1451 {"support-list", 0x7d9600, 0x00100},
1452 {"extra-para", 0x7d9700, 0x00100},
1453 {"profile", 0x7d9800, 0x03000},
1454 {"default-config", 0x7dc800, 0x03000},
1455 {"partition-table", 0x7df800, 0x00800},
1456 {"user-config", 0x7e0000, 0x0c000},
1457 {"certificate", 0x7ec000, 0x04000},
1458 {"radio", 0x7f0000, 0x10000},
1462 .first_sysupgrade_partition
= "os-image",
1463 .last_sysupgrade_partition
= "file-system",
1466 /** Firmware layout for the C60v3 */
1468 .id
= "ARCHER-C60-V3",
1472 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1473 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1474 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1476 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1479 {"factory-boot", 0x00000, 0x1fb00},
1480 {"default-mac", 0x1fb00, 0x00200},
1481 {"pin", 0x1fd00, 0x00100},
1482 {"product-info", 0x1fe00, 0x00100},
1483 {"device-id", 0x1ff00, 0x00100},
1484 {"fs-uboot", 0x20000, 0x10000},
1485 {"firmware", 0x30000, 0x7a0000},
1486 {"soft-version", 0x7d9500, 0x00100},
1487 {"support-list", 0x7d9600, 0x00100},
1488 {"extra-para", 0x7d9700, 0x00100},
1489 {"profile", 0x7d9800, 0x03000},
1490 {"default-config", 0x7dc800, 0x03000},
1491 {"partition-table", 0x7df800, 0x00800},
1492 {"user-config", 0x7e0000, 0x0c000},
1493 {"certificate", 0x7ec000, 0x04000},
1494 {"radio", 0x7f0000, 0x10000},
1498 .first_sysupgrade_partition
= "os-image",
1499 .last_sysupgrade_partition
= "file-system",
1502 /** Firmware layout for the C5 */
1504 .id
= "ARCHER-C5-V2",
1508 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1509 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1510 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1512 .soft_ver
= SOFT_VER_DEFAULT
,
1515 {"fs-uboot", 0x00000, 0x40000},
1516 {"os-image", 0x40000, 0x200000},
1517 {"file-system", 0x240000, 0xc00000},
1518 {"default-mac", 0xe40000, 0x00200},
1519 {"pin", 0xe40200, 0x00200},
1520 {"product-info", 0xe40400, 0x00200},
1521 {"partition-table", 0xe50000, 0x10000},
1522 {"soft-version", 0xe60000, 0x00200},
1523 {"support-list", 0xe61000, 0x0f000},
1524 {"profile", 0xe70000, 0x10000},
1525 {"default-config", 0xe80000, 0x10000},
1526 {"user-config", 0xe90000, 0x50000},
1527 {"log", 0xee0000, 0x100000},
1528 {"radio_bk", 0xfe0000, 0x10000},
1529 {"radio", 0xff0000, 0x10000},
1533 .first_sysupgrade_partition
= "os-image",
1534 .last_sysupgrade_partition
= "file-system"
1537 /** Firmware layout for the C7 */
1539 .id
= "ARCHER-C7-V4",
1542 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1543 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1544 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1545 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1546 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1547 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1548 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1549 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1550 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1551 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1553 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1555 /* We're using a dynamic kernel/rootfs split here */
1557 {"factory-boot", 0x00000, 0x20000},
1558 {"fs-uboot", 0x20000, 0x20000},
1559 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1560 /* Stock: name file-system base 0x160000 size 0xda0000 */
1561 {"default-mac", 0xf00000, 0x00200},
1562 {"pin", 0xf00200, 0x00200},
1563 {"device-id", 0xf00400, 0x00100},
1564 {"product-info", 0xf00500, 0x0fb00},
1565 {"soft-version", 0xf10000, 0x00100},
1566 {"extra-para", 0xf11000, 0x01000},
1567 {"support-list", 0xf12000, 0x0a000},
1568 {"profile", 0xf1c000, 0x04000},
1569 {"default-config", 0xf20000, 0x10000},
1570 {"user-config", 0xf30000, 0x40000},
1571 {"qos-db", 0xf70000, 0x40000},
1572 {"certificate", 0xfb0000, 0x10000},
1573 {"partition-table", 0xfc0000, 0x10000},
1574 {"log", 0xfd0000, 0x20000},
1575 {"radio", 0xff0000, 0x10000},
1579 .first_sysupgrade_partition
= "os-image",
1580 .last_sysupgrade_partition
= "file-system",
1583 /** Firmware layout for the C7 v5*/
1585 .id
= "ARCHER-C7-V5",
1588 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1589 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1590 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1591 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1592 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1593 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1594 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1595 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1598 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1600 /* We're using a dynamic kernel/rootfs split here */
1602 {"factory-boot", 0x00000, 0x20000},
1603 {"fs-uboot", 0x20000, 0x20000},
1604 {"partition-table", 0x40000, 0x10000},
1605 {"radio", 0x50000, 0x10000},
1606 {"default-mac", 0x60000, 0x00200},
1607 {"pin", 0x60200, 0x00200},
1608 {"device-id", 0x60400, 0x00100},
1609 {"product-info", 0x60500, 0x0fb00},
1610 {"soft-version", 0x70000, 0x01000},
1611 {"extra-para", 0x71000, 0x01000},
1612 {"support-list", 0x72000, 0x0a000},
1613 {"profile", 0x7c000, 0x04000},
1614 {"user-config", 0x80000, 0x40000},
1617 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1618 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1620 {"log", 0xfc0000, 0x20000},
1621 {"certificate", 0xfe0000, 0x10000},
1622 {"default-config", 0xff0000, 0x10000},
1627 .first_sysupgrade_partition
= "os-image",
1628 .last_sysupgrade_partition
= "file-system",
1631 /** Firmware layout for the C9 */
1637 "{product_name:ArcherC9,"
1638 "product_ver:1.0.0,"
1639 "special_id:00000000}\n",
1641 .soft_ver
= SOFT_VER_DEFAULT
,
1644 {"fs-uboot", 0x00000, 0x40000},
1645 {"os-image", 0x40000, 0x200000},
1646 {"file-system", 0x240000, 0xc00000},
1647 {"default-mac", 0xe40000, 0x00200},
1648 {"pin", 0xe40200, 0x00200},
1649 {"product-info", 0xe40400, 0x00200},
1650 {"partition-table", 0xe50000, 0x10000},
1651 {"soft-version", 0xe60000, 0x00200},
1652 {"support-list", 0xe61000, 0x0f000},
1653 {"profile", 0xe70000, 0x10000},
1654 {"default-config", 0xe80000, 0x10000},
1655 {"user-config", 0xe90000, 0x50000},
1656 {"log", 0xee0000, 0x100000},
1657 {"radio_bk", 0xfe0000, 0x10000},
1658 {"radio", 0xff0000, 0x10000},
1662 .first_sysupgrade_partition
= "os-image",
1663 .last_sysupgrade_partition
= "file-system"
1666 /** Firmware layout for the Deco M4R v1 and v2 */
1668 .id
= "DECO-M4R-V1",
1672 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1673 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1674 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1675 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1676 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1677 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1678 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1679 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1680 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1681 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1682 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1683 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1684 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1685 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1686 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1687 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1689 .soft_ver
= SOFT_VER_DEFAULT
,
1692 {"fs-uboot", 0x00000, 0x80000},
1693 {"firmware", 0x80000, 0xe00000},
1694 {"product-info", 0xe80000, 0x05000},
1695 {"default-mac", 0xe85000, 0x01000},
1696 {"device-id", 0xe86000, 0x01000},
1697 {"support-list", 0xe87000, 0x10000},
1698 {"user-config", 0xea7000, 0x10000},
1699 {"device-config", 0xeb7000, 0x10000},
1700 {"group-info", 0xec7000, 0x10000},
1701 {"partition-table", 0xed7000, 0x02000},
1702 {"soft-version", 0xed9000, 0x10000},
1703 {"profile", 0xee9000, 0x10000},
1704 {"default-config", 0xef9000, 0x10000},
1705 {"url-sig", 0xfe0000, 0x10000},
1706 {"radio", 0xff0000, 0x10000},
1709 .first_sysupgrade_partition
= "os-image",
1710 .last_sysupgrade_partition
= "file-system",
1713 /** Firmware layout for the Deco M4R v4 */
1715 .id
= "DECO-M4R-V4",
1719 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1720 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1721 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1722 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1723 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1725 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1728 {"fs-uboot", 0x00000, 0x40000},
1729 {"firmware", 0x40000, 0xf60000},
1730 {"default-mac", 0xfa0000, 0x00300},
1731 {"device-id", 0xfa0300, 0x00100},
1732 {"product-info", 0xfa0400, 0x0fc00},
1733 {"group-info", 0xfb0000, 0x04000},
1734 {"user-config", 0xfb4000, 0x0c000},
1735 {"device-config", 0xfc0000, 0x10000},
1736 {"default-config", 0xfd0000, 0x10000},
1737 {"partition-table", 0xfe0000, 0x00800},
1738 {"soft-version", 0xfe0800, 0x00100},
1739 {"support-list", 0xfe0900, 0x00200},
1740 {"profile", 0xfe0b00, 0x03000},
1741 {"extra-para", 0xfe3b00, 0x00100},
1742 {"radio", 0xff0000, 0x10000},
1745 .first_sysupgrade_partition
= "os-image",
1746 .last_sysupgrade_partition
= "file-system",
1749 /** Firmware layout for the Deco S4 v2 */
1755 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1756 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1757 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1758 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1759 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1760 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1761 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1762 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1763 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1764 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1765 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1766 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1768 .soft_ver
= SOFT_VER_DEFAULT
,
1771 {"fs-uboot", 0x00000, 0x80000},
1772 {"product-info", 0x80000, 0x05000},
1773 {"default-mac", 0x85000, 0x01000},
1774 {"device-id", 0x86000, 0x01000},
1775 {"support-list", 0x87000, 0x10000},
1776 {"user-config", 0xa7000, 0x10000},
1777 {"device-config", 0xb7000, 0x10000},
1778 {"group-info", 0xc7000, 0x10000},
1779 {"partition-table", 0xd7000, 0x02000},
1780 {"soft-version", 0xd9000, 0x10000},
1781 {"profile", 0xe9000, 0x10000},
1782 {"default-config", 0xf9000, 0x10000},
1783 {"url-sig", 0x1e0000, 0x10000},
1784 {"radio", 0x1f0000, 0x10000},
1785 {"firmware", 0x200000, 0xe00000},
1788 .first_sysupgrade_partition
= "os-image",
1789 .last_sysupgrade_partition
= "file-system",
1792 /** Firmware layout for the EAP120 */
1795 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1798 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1800 .soft_ver
= SOFT_VER_DEFAULT
,
1803 {"fs-uboot", 0x00000, 0x20000},
1804 {"partition-table", 0x20000, 0x02000},
1805 {"default-mac", 0x30000, 0x00020},
1806 {"support-list", 0x31000, 0x00100},
1807 {"product-info", 0x31100, 0x00100},
1808 {"soft-version", 0x32000, 0x00100},
1809 {"os-image", 0x40000, 0x180000},
1810 {"file-system", 0x1c0000, 0x600000},
1811 {"user-config", 0x7c0000, 0x10000},
1812 {"backup-config", 0x7d0000, 0x10000},
1813 {"log", 0x7e0000, 0x10000},
1814 {"radio", 0x7f0000, 0x10000},
1818 .first_sysupgrade_partition
= "os-image",
1819 .last_sysupgrade_partition
= "file-system"
1822 /** Firmware layout for the EAP225-Outdoor v1 */
1824 .id
= "EAP225-OUTDOOR-V1",
1827 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1828 .part_trail
= PART_TRAIL_NONE
,
1829 .soft_ver
= SOFT_VER_DEFAULT
,
1830 .soft_ver_compat_level
= 1,
1833 {"fs-uboot", 0x00000, 0x20000},
1834 {"partition-table", 0x20000, 0x02000},
1835 {"default-mac", 0x30000, 0x01000},
1836 {"support-list", 0x31000, 0x00100},
1837 {"product-info", 0x31100, 0x00400},
1838 {"soft-version", 0x32000, 0x00100},
1839 {"firmware", 0x40000, 0xd80000},
1840 {"user-config", 0xdc0000, 0x30000},
1841 {"mutil-log", 0xf30000, 0x80000},
1842 {"oops", 0xfb0000, 0x40000},
1843 {"radio", 0xff0000, 0x10000},
1847 .first_sysupgrade_partition
= "os-image",
1848 .last_sysupgrade_partition
= "file-system"
1851 /** Firmware layout for the EAP225 v1 */
1856 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1857 .part_trail
= PART_TRAIL_NONE
,
1858 .soft_ver
= SOFT_VER_DEFAULT
,
1861 {"fs-uboot", 0x00000, 0x20000},
1862 {"partition-table", 0x20000, 0x02000},
1863 {"default-mac", 0x30000, 0x01000},
1864 {"support-list", 0x31000, 0x00100},
1865 {"product-info", 0x31100, 0x00400},
1866 {"soft-version", 0x32000, 0x00100},
1867 {"firmware", 0x40000, 0xd80000},
1868 {"user-config", 0xdc0000, 0x30000},
1869 {"radio", 0xff0000, 0x10000},
1873 .first_sysupgrade_partition
= "os-image",
1874 .last_sysupgrade_partition
= "file-system"
1877 /** Firmware layout for the EAP225 v3
1878 * Also compatible with:
1881 * - EAP225-Outdoor v1
1882 * - EAP225-Outdoor v3
1888 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1889 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1890 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1891 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1892 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1893 .part_trail
= PART_TRAIL_NONE
,
1894 .soft_ver
= SOFT_VER_DEFAULT
,
1895 .soft_ver_compat_level
= 1,
1898 {"fs-uboot", 0x00000, 0x20000},
1899 {"partition-table", 0x20000, 0x02000},
1900 {"default-mac", 0x30000, 0x01000},
1901 {"support-list", 0x31000, 0x00100},
1902 {"product-info", 0x31100, 0x00400},
1903 {"soft-version", 0x32000, 0x00100},
1904 {"firmware", 0x40000, 0xd80000},
1905 {"user-config", 0xdc0000, 0x30000},
1906 {"mutil-log", 0xf30000, 0x80000},
1907 {"oops", 0xfb0000, 0x40000},
1908 {"radio", 0xff0000, 0x10000},
1912 .first_sysupgrade_partition
= "os-image",
1913 .last_sysupgrade_partition
= "file-system"
1916 /** Firmware layout for the EAP225-Wall v2 */
1918 .id
= "EAP225-WALL-V2",
1921 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1922 .part_trail
= PART_TRAIL_NONE
,
1923 .soft_ver
= SOFT_VER_DEFAULT
,
1924 .soft_ver_compat_level
= 1,
1927 {"fs-uboot", 0x00000, 0x20000},
1928 {"partition-table", 0x20000, 0x02000},
1929 {"default-mac", 0x30000, 0x01000},
1930 {"support-list", 0x31000, 0x00100},
1931 {"product-info", 0x31100, 0x00400},
1932 {"soft-version", 0x32000, 0x00100},
1933 {"firmware", 0x40000, 0xd80000},
1934 {"user-config", 0xdc0000, 0x30000},
1935 {"mutil-log", 0xf30000, 0x80000},
1936 {"oops", 0xfb0000, 0x40000},
1937 {"radio", 0xff0000, 0x10000},
1941 .first_sysupgrade_partition
= "os-image",
1942 .last_sysupgrade_partition
= "file-system"
1945 /** Firmware layout for the EAP235-Wall v1 */
1947 .id
= "EAP235-WALL-V1",
1950 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1951 .part_trail
= PART_TRAIL_NONE
,
1952 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1953 .soft_ver_compat_level
= 1,
1956 {"fs-uboot", 0x00000, 0x80000},
1957 {"partition-table", 0x80000, 0x02000},
1958 {"default-mac", 0x90000, 0x01000},
1959 {"support-list", 0x91000, 0x00100},
1960 {"product-info", 0x91100, 0x00400},
1961 {"soft-version", 0x92000, 0x00100},
1962 {"firmware", 0xa0000, 0xd20000},
1963 {"user-config", 0xdc0000, 0x30000},
1964 {"mutil-log", 0xf30000, 0x80000},
1965 {"oops", 0xfb0000, 0x40000},
1966 {"radio", 0xff0000, 0x10000},
1970 .first_sysupgrade_partition
= "os-image",
1971 .last_sysupgrade_partition
= "file-system"
1974 /** Firmware layout for the EAP245 v1 */
1979 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1980 .part_trail
= PART_TRAIL_NONE
,
1981 .soft_ver
= SOFT_VER_DEFAULT
,
1984 {"fs-uboot", 0x00000, 0x20000},
1985 {"partition-table", 0x20000, 0x02000},
1986 {"default-mac", 0x30000, 0x01000},
1987 {"support-list", 0x31000, 0x00100},
1988 {"product-info", 0x31100, 0x00400},
1989 {"soft-version", 0x32000, 0x00100},
1990 {"firmware", 0x40000, 0xd80000},
1991 {"user-config", 0xdc0000, 0x30000},
1992 {"radio", 0xff0000, 0x10000},
1996 .first_sysupgrade_partition
= "os-image",
1997 .last_sysupgrade_partition
= "file-system"
2000 /** Firmware layout for the EAP245 v3 */
2005 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
2006 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
2007 .part_trail
= PART_TRAIL_NONE
,
2008 .soft_ver
= SOFT_VER_DEFAULT
,
2009 .soft_ver_compat_level
= 1,
2011 /** Firmware partition with dynamic kernel/rootfs split */
2013 {"factroy-boot", 0x00000, 0x40000},
2014 {"fs-uboot", 0x40000, 0x40000},
2015 {"partition-table", 0x80000, 0x10000},
2016 {"default-mac", 0x90000, 0x01000},
2017 {"support-list", 0x91000, 0x00100},
2018 {"product-info", 0x91100, 0x00400},
2019 {"soft-version", 0x92000, 0x00100},
2020 {"radio", 0xa0000, 0x10000},
2021 {"extra-para", 0xb0000, 0x10000},
2022 {"firmware", 0xc0000, 0xe40000},
2023 {"config", 0xf00000, 0x30000},
2024 {"mutil-log", 0xf30000, 0x80000},
2025 {"oops", 0xfb0000, 0x40000},
2029 .first_sysupgrade_partition
= "os-image",
2030 .last_sysupgrade_partition
= "file-system"
2033 /** Firmware layout for the EAP615-Wall v1 */
2035 .id
= "EAP615-WALL-V1",
2036 .soft_ver
= SOFT_VER_DEFAULT
,
2037 .soft_ver_compat_level
= 1,
2040 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
2041 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
2042 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
2043 .part_trail
= PART_TRAIL_NONE
,
2046 {"fs-uboot", 0x00000, 0x80000},
2047 {"partition-table", 0x80000, 0x02000},
2048 {"default-mac", 0x90000, 0x01000},
2049 {"support-list", 0x91000, 0x00100},
2050 {"product-info", 0x91100, 0x00400},
2051 {"soft-version", 0x92000, 0x00100},
2052 {"firmware", 0xa0000, 0xcf0000},
2053 {"user-config", 0xd90000, 0x60000},
2054 {"mutil-log", 0xf30000, 0x80000},
2055 {"oops", 0xfb0000, 0x40000},
2056 {"radio", 0xff0000, 0x10000},
2060 .first_sysupgrade_partition
= "os-image",
2061 .last_sysupgrade_partition
= "file-system"
2064 /** Firmware layout for the TL-WA1201 v2 */
2066 .id
= "TL-WA1201-V2",
2070 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2071 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2073 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2076 {"fs-uboot", 0x00000, 0x20000},
2077 {"default-mac", 0x20000, 0x00200},
2078 {"pin", 0x20200, 0x00100},
2079 {"product-info", 0x20300, 0x00200},
2080 {"device-id", 0x20500, 0x0fb00},
2081 {"firmware", 0x30000, 0xce0000},
2082 {"portal-logo", 0xd10000, 0x20000},
2083 {"portal-back", 0xd30000, 0x200000},
2084 {"soft-version", 0xf30000, 0x00200},
2085 {"extra-para", 0xf30200, 0x00200},
2086 {"support-list", 0xf30400, 0x00200},
2087 {"profile", 0xf30600, 0x0fa00},
2088 {"apdef-config", 0xf40000, 0x10000},
2089 {"ap-config", 0xf50000, 0x10000},
2090 {"redef-config", 0xf60000, 0x10000},
2091 {"re-config", 0xf70000, 0x10000},
2092 {"multidef-config", 0xf80000, 0x10000},
2093 {"multi-config", 0xf90000, 0x10000},
2094 {"clientdef-config", 0xfa0000, 0x10000},
2095 {"client-config", 0xfb0000, 0x10000},
2096 {"partition-table", 0xfc0000, 0x10000},
2097 {"user-config", 0xfd0000, 0x10000},
2098 {"certificate", 0xfe0000, 0x10000},
2099 {"radio", 0xff0000, 0x10000},
2102 .first_sysupgrade_partition
= "os-image",
2103 .last_sysupgrade_partition
= "file-system",
2106 /** Firmware layout for the TL-WA850RE v2 */
2108 .id
= "TLWA850REV2",
2112 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2113 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2114 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2115 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2116 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2117 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2118 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2119 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2120 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2121 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2123 .soft_ver
= SOFT_VER_DEFAULT
,
2126 576KB were moved from file-system to os-image
2127 in comparison to the stock image
2130 {"fs-uboot", 0x00000, 0x20000},
2131 {"firmware", 0x20000, 0x390000},
2132 {"partition-table", 0x3b0000, 0x02000},
2133 {"default-mac", 0x3c0000, 0x00020},
2134 {"pin", 0x3c0100, 0x00020},
2135 {"product-info", 0x3c1000, 0x01000},
2136 {"soft-version", 0x3c2000, 0x00100},
2137 {"support-list", 0x3c3000, 0x01000},
2138 {"profile", 0x3c4000, 0x08000},
2139 {"user-config", 0x3d0000, 0x10000},
2140 {"default-config", 0x3e0000, 0x10000},
2141 {"radio", 0x3f0000, 0x10000},
2145 .first_sysupgrade_partition
= "os-image",
2146 .last_sysupgrade_partition
= "file-system"
2149 /** Firmware layout for the TL-WA855RE v1 */
2151 .id
= "TLWA855REV1",
2155 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2156 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2157 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2158 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2159 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2160 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2161 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2162 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2163 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2165 .soft_ver
= SOFT_VER_DEFAULT
,
2168 {"fs-uboot", 0x00000, 0x20000},
2169 {"os-image", 0x20000, 0x150000},
2170 {"file-system", 0x170000, 0x240000},
2171 {"partition-table", 0x3b0000, 0x02000},
2172 {"default-mac", 0x3c0000, 0x00020},
2173 {"pin", 0x3c0100, 0x00020},
2174 {"product-info", 0x3c1000, 0x01000},
2175 {"soft-version", 0x3c2000, 0x00100},
2176 {"support-list", 0x3c3000, 0x01000},
2177 {"profile", 0x3c4000, 0x08000},
2178 {"user-config", 0x3d0000, 0x10000},
2179 {"default-config", 0x3e0000, 0x10000},
2180 {"radio", 0x3f0000, 0x10000},
2184 .first_sysupgrade_partition
= "os-image",
2185 .last_sysupgrade_partition
= "file-system"
2188 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2190 .id
= "TL-WPA8630P-V2.0-EU",
2194 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2196 .soft_ver
= SOFT_VER_DEFAULT
,
2199 {"factory-uboot", 0x00000, 0x20000},
2200 {"fs-uboot", 0x20000, 0x20000},
2201 {"firmware", 0x40000, 0x5e0000},
2202 {"partition-table", 0x620000, 0x02000},
2203 {"default-mac", 0x630000, 0x00020},
2204 {"pin", 0x630100, 0x00020},
2205 {"device-id", 0x630200, 0x00030},
2206 {"product-info", 0x631100, 0x01000},
2207 {"extra-para", 0x632100, 0x01000},
2208 {"soft-version", 0x640000, 0x01000},
2209 {"support-list", 0x641000, 0x01000},
2210 {"profile", 0x642000, 0x08000},
2211 {"user-config", 0x650000, 0x10000},
2212 {"default-config", 0x660000, 0x10000},
2213 {"default-nvm", 0x670000, 0xc0000},
2214 {"default-pib", 0x730000, 0x40000},
2215 {"radio", 0x7f0000, 0x10000},
2219 .first_sysupgrade_partition
= "os-image",
2220 .last_sysupgrade_partition
= "file-system"
2223 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2225 .id
= "TL-WPA8630P-V2-INT",
2229 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2230 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2231 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2233 .soft_ver
= SOFT_VER_DEFAULT
,
2236 {"factory-uboot", 0x00000, 0x20000},
2237 {"fs-uboot", 0x20000, 0x20000},
2238 {"firmware", 0x40000, 0x5e0000},
2239 {"partition-table", 0x620000, 0x02000},
2240 {"extra-para", 0x632100, 0x01000},
2241 {"soft-version", 0x640000, 0x01000},
2242 {"support-list", 0x641000, 0x01000},
2243 {"profile", 0x642000, 0x08000},
2244 {"user-config", 0x650000, 0x10000},
2245 {"default-config", 0x660000, 0x10000},
2246 {"default-nvm", 0x670000, 0xc0000},
2247 {"default-pib", 0x730000, 0x40000},
2248 {"default-mac", 0x7e0000, 0x00020},
2249 {"pin", 0x7e0100, 0x00020},
2250 {"device-id", 0x7e0200, 0x00030},
2251 {"product-info", 0x7e1100, 0x01000},
2252 {"radio", 0x7f0000, 0x10000},
2256 .first_sysupgrade_partition
= "os-image",
2257 .last_sysupgrade_partition
= "file-system"
2260 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2262 .id
= "TL-WPA8630P-V2.1-EU",
2266 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2268 .soft_ver
= SOFT_VER_DEFAULT
,
2271 {"factory-uboot", 0x00000, 0x20000},
2272 {"fs-uboot", 0x20000, 0x20000},
2273 {"firmware", 0x40000, 0x5e0000},
2274 {"extra-para", 0x680000, 0x01000},
2275 {"product-info", 0x690000, 0x01000},
2276 {"partition-table", 0x6a0000, 0x02000},
2277 {"soft-version", 0x6b0000, 0x01000},
2278 {"support-list", 0x6b1000, 0x01000},
2279 {"profile", 0x6b2000, 0x08000},
2280 {"user-config", 0x6c0000, 0x10000},
2281 {"default-config", 0x6d0000, 0x10000},
2282 {"default-nvm", 0x6e0000, 0xc0000},
2283 {"default-pib", 0x7a0000, 0x40000},
2284 {"default-mac", 0x7e0000, 0x00020},
2285 {"pin", 0x7e0100, 0x00020},
2286 {"device-id", 0x7e0200, 0x00030},
2287 {"radio", 0x7f0000, 0x10000},
2291 .first_sysupgrade_partition
= "os-image",
2292 .last_sysupgrade_partition
= "file-system"
2295 /** Firmware layout for the TL-WPA8631P v3 */
2297 .id
= "TL-WPA8631P-V3",
2301 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2302 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2303 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2305 .soft_ver
= SOFT_VER_DEFAULT
,
2308 {"fs-uboot", 0x00000, 0x20000},
2309 {"firmware", 0x20000, 0x710000},
2310 {"partition-table", 0x730000, 0x02000},
2311 {"default-mac", 0x732000, 0x00020},
2312 {"pin", 0x732100, 0x00020},
2313 {"device-id", 0x732200, 0x00030},
2314 {"default-region", 0x732300, 0x00010},
2315 {"product-info", 0x732400, 0x00200},
2316 {"extra-para", 0x732600, 0x00200},
2317 {"soft-version", 0x732800, 0x00200},
2318 {"support-list", 0x732a00, 0x00100},
2319 {"profile", 0x732b00, 0x00100},
2320 {"default-config", 0x732c00, 0x00800},
2321 {"plc-type", 0x733400, 0x00020},
2322 {"default-pib", 0x733500, 0x06000},
2323 {"user-config", 0x740000, 0x10000},
2324 {"plc-pib", 0x750000, 0x10000},
2325 {"plc-nvm", 0x760000, 0x90000},
2326 {"radio", 0x7f0000, 0x10000},
2330 .first_sysupgrade_partition
= "os-image",
2331 .last_sysupgrade_partition
= "file-system"
2334 /** Firmware layout for the TL-WR1043 v5 */
2336 .id
= "TLWR1043NV5",
2340 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2341 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2343 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2345 {"factory-boot", 0x00000, 0x20000},
2346 {"fs-uboot", 0x20000, 0x20000},
2347 {"firmware", 0x40000, 0xec0000},
2348 {"default-mac", 0xf00000, 0x00200},
2349 {"pin", 0xf00200, 0x00200},
2350 {"device-id", 0xf00400, 0x00100},
2351 {"product-info", 0xf00500, 0x0fb00},
2352 {"soft-version", 0xf10000, 0x01000},
2353 {"extra-para", 0xf11000, 0x01000},
2354 {"support-list", 0xf12000, 0x0a000},
2355 {"profile", 0xf1c000, 0x04000},
2356 {"default-config", 0xf20000, 0x10000},
2357 {"user-config", 0xf30000, 0x40000},
2358 {"qos-db", 0xf70000, 0x40000},
2359 {"certificate", 0xfb0000, 0x10000},
2360 {"partition-table", 0xfc0000, 0x10000},
2361 {"log", 0xfd0000, 0x20000},
2362 {"radio", 0xff0000, 0x10000},
2365 .first_sysupgrade_partition
= "os-image",
2366 .last_sysupgrade_partition
= "file-system"
2369 /** Firmware layout for the TL-WR1043 v4 */
2371 .id
= "TLWR1043NDV4",
2375 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2377 .soft_ver
= SOFT_VER_DEFAULT
,
2379 /* We're using a dynamic kernel/rootfs split here */
2381 {"fs-uboot", 0x00000, 0x20000},
2382 {"firmware", 0x20000, 0xf30000},
2383 {"default-mac", 0xf50000, 0x00200},
2384 {"pin", 0xf50200, 0x00200},
2385 {"product-info", 0xf50400, 0x0fc00},
2386 {"soft-version", 0xf60000, 0x0b000},
2387 {"support-list", 0xf6b000, 0x04000},
2388 {"profile", 0xf70000, 0x04000},
2389 {"default-config", 0xf74000, 0x0b000},
2390 {"user-config", 0xf80000, 0x40000},
2391 {"partition-table", 0xfc0000, 0x10000},
2392 {"log", 0xfd0000, 0x20000},
2393 {"radio", 0xff0000, 0x10000},
2397 .first_sysupgrade_partition
= "os-image",
2398 .last_sysupgrade_partition
= "file-system"
2401 /** Firmware layout for the TL-WR902AC v1 */
2403 .id
= "TL-WR902AC-V1",
2407 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2408 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2410 .soft_ver
= SOFT_VER_DEFAULT
,
2413 384KB were moved from file-system to os-image
2414 in comparison to the stock image
2417 {"fs-uboot", 0x00000, 0x20000},
2418 {"firmware", 0x20000, 0x730000},
2419 {"default-mac", 0x750000, 0x00200},
2420 {"pin", 0x750200, 0x00200},
2421 {"product-info", 0x750400, 0x0fc00},
2422 {"soft-version", 0x760000, 0x0b000},
2423 {"support-list", 0x76b000, 0x04000},
2424 {"profile", 0x770000, 0x04000},
2425 {"default-config", 0x774000, 0x0b000},
2426 {"user-config", 0x780000, 0x40000},
2427 {"partition-table", 0x7c0000, 0x10000},
2428 {"log", 0x7d0000, 0x20000},
2429 {"radio", 0x7f0000, 0x10000},
2433 .first_sysupgrade_partition
= "os-image",
2434 .last_sysupgrade_partition
= "file-system",
2437 /** Firmware layout for the TL-WR941HP v1 */
2439 .id
= "TL-WR941HP-V1",
2443 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2445 .soft_ver
= SOFT_VER_DEFAULT
,
2448 {"fs-uboot", 0x00000, 0x20000},
2449 {"firmware", 0x20000, 0x730000},
2450 {"default-mac", 0x750000, 0x00200},
2451 {"pin", 0x750200, 0x00200},
2452 {"product-info", 0x750400, 0x0fc00},
2453 {"soft-version", 0x760000, 0x0b000},
2454 {"support-list", 0x76b000, 0x04000},
2455 {"profile", 0x770000, 0x04000},
2456 {"default-config", 0x774000, 0x0b000},
2457 {"user-config", 0x780000, 0x40000},
2458 {"partition-table", 0x7c0000, 0x10000},
2459 {"log", 0x7d0000, 0x20000},
2460 {"radio", 0x7f0000, 0x10000},
2464 .first_sysupgrade_partition
= "os-image",
2465 .last_sysupgrade_partition
= "file-system",
2468 /** Firmware layout for the TL-WR942N V1 */
2474 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2475 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2477 .soft_ver
= SOFT_VER_DEFAULT
,
2480 {"fs-uboot", 0x00000, 0x20000},
2481 {"firmware", 0x20000, 0xe20000},
2482 {"default-mac", 0xe40000, 0x00200},
2483 {"pin", 0xe40200, 0x00200},
2484 {"product-info", 0xe40400, 0x0fc00},
2485 {"partition-table", 0xe50000, 0x10000},
2486 {"soft-version", 0xe60000, 0x10000},
2487 {"support-list", 0xe70000, 0x10000},
2488 {"profile", 0xe80000, 0x10000},
2489 {"default-config", 0xe90000, 0x10000},
2490 {"user-config", 0xea0000, 0x40000},
2491 {"qos-db", 0xee0000, 0x40000},
2492 {"certificate", 0xf20000, 0x10000},
2493 {"usb-config", 0xfb0000, 0x10000},
2494 {"log", 0xfc0000, 0x20000},
2495 {"radio-bk", 0xfe0000, 0x10000},
2496 {"radio", 0xff0000, 0x10000},
2500 .first_sysupgrade_partition
= "os-image",
2501 .last_sysupgrade_partition
= "file-system",
2504 /** Firmware layout for the RE200 v2 */
2510 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2511 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2512 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2513 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2514 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2515 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2516 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2517 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2518 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2519 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2520 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2521 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2522 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2524 .soft_ver
= SOFT_VER_DEFAULT
,
2527 {"fs-uboot", 0x00000, 0x20000},
2528 {"firmware", 0x20000, 0x7a0000},
2529 {"partition-table", 0x7c0000, 0x02000},
2530 {"default-mac", 0x7c2000, 0x00020},
2531 {"pin", 0x7c2100, 0x00020},
2532 {"product-info", 0x7c3100, 0x01000},
2533 {"soft-version", 0x7c4200, 0x01000},
2534 {"support-list", 0x7c5200, 0x01000},
2535 {"profile", 0x7c6200, 0x08000},
2536 {"config-info", 0x7ce200, 0x00400},
2537 {"user-config", 0x7d0000, 0x10000},
2538 {"default-config", 0x7e0000, 0x10000},
2539 {"radio", 0x7f0000, 0x10000},
2543 .first_sysupgrade_partition
= "os-image",
2544 .last_sysupgrade_partition
= "file-system"
2547 /** Firmware layout for the RE200 v3 */
2553 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2554 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2555 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2556 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2557 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2558 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2559 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2560 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2561 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2562 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2563 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2564 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2565 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2566 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2568 .soft_ver
= SOFT_VER_DEFAULT
,
2571 {"fs-uboot", 0x00000, 0x20000},
2572 {"firmware", 0x20000, 0x7a0000},
2573 {"partition-table", 0x7c0000, 0x02000},
2574 {"default-mac", 0x7c2000, 0x00020},
2575 {"pin", 0x7c2100, 0x00020},
2576 {"product-info", 0x7c3100, 0x01000},
2577 {"soft-version", 0x7c4200, 0x01000},
2578 {"support-list", 0x7c5200, 0x01000},
2579 {"profile", 0x7c6200, 0x08000},
2580 {"config-info", 0x7ce200, 0x00400},
2581 {"user-config", 0x7d0000, 0x10000},
2582 {"default-config", 0x7e0000, 0x10000},
2583 {"radio", 0x7f0000, 0x10000},
2587 .first_sysupgrade_partition
= "os-image",
2588 .last_sysupgrade_partition
= "file-system"
2591 /** Firmware layout for the RE200 v4 */
2597 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2598 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2599 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2600 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2601 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2602 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2603 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2604 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2605 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2606 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2607 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2608 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2609 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2610 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2612 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2615 {"fs-uboot", 0x00000, 0x20000},
2616 {"firmware", 0x20000, 0x7a0000},
2617 {"partition-table", 0x7c0000, 0x02000},
2618 {"default-mac", 0x7c2000, 0x00020},
2619 {"pin", 0x7c2100, 0x00020},
2620 {"product-info", 0x7c3100, 0x01000},
2621 {"soft-version", 0x7c4200, 0x01000},
2622 {"support-list", 0x7c5200, 0x01000},
2623 {"profile", 0x7c6200, 0x08000},
2624 {"config-info", 0x7ce200, 0x00400},
2625 {"user-config", 0x7d0000, 0x10000},
2626 {"default-config", 0x7e0000, 0x10000},
2627 {"radio", 0x7f0000, 0x10000},
2631 .first_sysupgrade_partition
= "os-image",
2632 .last_sysupgrade_partition
= "file-system"
2635 /** Firmware layout for the RE220 v2 */
2641 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2642 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2643 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2644 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2645 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2646 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2647 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2648 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2649 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2650 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2651 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2652 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2653 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2655 .soft_ver
= SOFT_VER_DEFAULT
,
2658 {"fs-uboot", 0x00000, 0x20000},
2659 {"firmware", 0x20000, 0x7a0000},
2660 {"partition-table", 0x7c0000, 0x02000},
2661 {"default-mac", 0x7c2000, 0x00020},
2662 {"pin", 0x7c2100, 0x00020},
2663 {"product-info", 0x7c3100, 0x01000},
2664 {"soft-version", 0x7c4200, 0x01000},
2665 {"support-list", 0x7c5200, 0x01000},
2666 {"profile", 0x7c6200, 0x08000},
2667 {"config-info", 0x7ce200, 0x00400},
2668 {"user-config", 0x7d0000, 0x10000},
2669 {"default-config", 0x7e0000, 0x10000},
2670 {"radio", 0x7f0000, 0x10000},
2674 .first_sysupgrade_partition
= "os-image",
2675 .last_sysupgrade_partition
= "file-system"
2678 /** Firmware layout for the RE305 v1 */
2684 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2685 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2686 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2687 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2688 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2689 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2690 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2692 .soft_ver
= SOFT_VER_DEFAULT
,
2695 {"fs-uboot", 0x00000, 0x20000},
2696 {"firmware", 0x20000, 0x5e0000},
2697 {"partition-table", 0x600000, 0x02000},
2698 {"default-mac", 0x610000, 0x00020},
2699 {"pin", 0x610100, 0x00020},
2700 {"product-info", 0x611100, 0x01000},
2701 {"soft-version", 0x620000, 0x01000},
2702 {"support-list", 0x621000, 0x01000},
2703 {"profile", 0x622000, 0x08000},
2704 {"user-config", 0x630000, 0x10000},
2705 {"default-config", 0x640000, 0x10000},
2706 {"radio", 0x7f0000, 0x10000},
2710 .first_sysupgrade_partition
= "os-image",
2711 .last_sysupgrade_partition
= "file-system"
2714 /** Firmware layout for the RE305 v3 */
2720 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2721 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2722 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2723 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2724 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2725 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2726 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2727 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2728 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2729 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2730 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2732 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2735 {"fs-uboot", 0x00000, 0x20000},
2736 {"firmware", 0x20000, 0x7a0000},
2737 {"partition-table", 0x7c0000, 0x02000},
2738 {"default-mac", 0x7c2000, 0x00020},
2739 {"pin", 0x7c2100, 0x00020},
2740 {"product-info", 0x7c3100, 0x01000},
2741 {"soft-version", 0x7c4200, 0x01000},
2742 {"support-list", 0x7c5200, 0x01000},
2743 {"profile", 0x7c6200, 0x08000},
2744 {"config-info", 0x7ce200, 0x00400},
2745 {"user-config", 0x7d0000, 0x10000},
2746 {"default-config", 0x7e0000, 0x10000},
2747 {"radio", 0x7f0000, 0x10000},
2751 .first_sysupgrade_partition
= "os-image",
2752 .last_sysupgrade_partition
= "file-system"
2755 /** Firmware layout for the RE350 v1 */
2761 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2762 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2763 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2764 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2765 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2766 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2767 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2769 .soft_ver
= SOFT_VER_DEFAULT
,
2771 /** We're using a dynamic kernel/rootfs split here */
2773 {"fs-uboot", 0x00000, 0x20000},
2774 {"firmware", 0x20000, 0x5e0000},
2775 {"partition-table", 0x600000, 0x02000},
2776 {"default-mac", 0x610000, 0x00020},
2777 {"pin", 0x610100, 0x00020},
2778 {"product-info", 0x611100, 0x01000},
2779 {"soft-version", 0x620000, 0x01000},
2780 {"support-list", 0x621000, 0x01000},
2781 {"profile", 0x622000, 0x08000},
2782 {"user-config", 0x630000, 0x10000},
2783 {"default-config", 0x640000, 0x10000},
2784 {"radio", 0x7f0000, 0x10000},
2788 .first_sysupgrade_partition
= "os-image",
2789 .last_sysupgrade_partition
= "file-system"
2792 /** Firmware layout for the RE350K v1 */
2798 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2800 .soft_ver
= SOFT_VER_DEFAULT
,
2802 /** We're using a dynamic kernel/rootfs split here */
2804 {"fs-uboot", 0x00000, 0x20000},
2805 {"firmware", 0x20000, 0xd70000},
2806 {"partition-table", 0xd90000, 0x02000},
2807 {"default-mac", 0xda0000, 0x00020},
2808 {"pin", 0xda0100, 0x00020},
2809 {"product-info", 0xda1100, 0x01000},
2810 {"soft-version", 0xdb0000, 0x01000},
2811 {"support-list", 0xdb1000, 0x01000},
2812 {"profile", 0xdb2000, 0x08000},
2813 {"user-config", 0xdc0000, 0x10000},
2814 {"default-config", 0xdd0000, 0x10000},
2815 {"device-id", 0xde0000, 0x00108},
2816 {"radio", 0xff0000, 0x10000},
2820 .first_sysupgrade_partition
= "os-image",
2821 .last_sysupgrade_partition
= "file-system"
2824 /** Firmware layout for the RE355 */
2830 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2831 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2832 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2833 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2834 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2835 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2836 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2837 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2839 .soft_ver
= SOFT_VER_DEFAULT
,
2841 /* We're using a dynamic kernel/rootfs split here */
2843 {"fs-uboot", 0x00000, 0x20000},
2844 {"firmware", 0x20000, 0x5e0000},
2845 {"partition-table", 0x600000, 0x02000},
2846 {"default-mac", 0x610000, 0x00020},
2847 {"pin", 0x610100, 0x00020},
2848 {"product-info", 0x611100, 0x01000},
2849 {"soft-version", 0x620000, 0x01000},
2850 {"support-list", 0x621000, 0x01000},
2851 {"profile", 0x622000, 0x08000},
2852 {"user-config", 0x630000, 0x10000},
2853 {"default-config", 0x640000, 0x10000},
2854 {"radio", 0x7f0000, 0x10000},
2858 .first_sysupgrade_partition
= "os-image",
2859 .last_sysupgrade_partition
= "file-system"
2862 /** Firmware layout for the RE450 */
2868 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2869 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2870 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2871 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2872 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2873 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2874 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2875 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2877 .soft_ver
= SOFT_VER_DEFAULT
,
2879 /** We're using a dynamic kernel/rootfs split here */
2881 {"fs-uboot", 0x00000, 0x20000},
2882 {"firmware", 0x20000, 0x5e0000},
2883 {"partition-table", 0x600000, 0x02000},
2884 {"default-mac", 0x610000, 0x00020},
2885 {"pin", 0x610100, 0x00020},
2886 {"product-info", 0x611100, 0x01000},
2887 {"soft-version", 0x620000, 0x01000},
2888 {"support-list", 0x621000, 0x01000},
2889 {"profile", 0x622000, 0x08000},
2890 {"user-config", 0x630000, 0x10000},
2891 {"default-config", 0x640000, 0x10000},
2892 {"radio", 0x7f0000, 0x10000},
2896 .first_sysupgrade_partition
= "os-image",
2897 .last_sysupgrade_partition
= "file-system"
2900 /** Firmware layout for the RE450 v2 */
2906 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2907 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2908 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2909 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2910 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2911 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2912 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2913 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2914 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2916 .soft_ver
= SOFT_VER_DEFAULT
,
2918 /* We're using a dynamic kernel/rootfs split here */
2920 {"fs-uboot", 0x00000, 0x20000},
2921 {"firmware", 0x20000, 0x5e0000},
2922 {"partition-table", 0x600000, 0x02000},
2923 {"default-mac", 0x610000, 0x00020},
2924 {"pin", 0x610100, 0x00020},
2925 {"product-info", 0x611100, 0x01000},
2926 {"soft-version", 0x620000, 0x01000},
2927 {"support-list", 0x621000, 0x01000},
2928 {"profile", 0x622000, 0x08000},
2929 {"user-config", 0x630000, 0x10000},
2930 {"default-config", 0x640000, 0x10000},
2931 {"radio", 0x7f0000, 0x10000},
2935 .first_sysupgrade_partition
= "os-image",
2936 .last_sysupgrade_partition
= "file-system"
2939 /** Firmware layout for the RE450 v3 */
2945 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2946 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2947 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2948 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2949 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2950 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2951 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2952 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2953 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2955 .soft_ver
= SOFT_VER_DEFAULT
,
2957 /* We're using a dynamic kernel/rootfs split here */
2959 {"fs-uboot", 0x00000, 0x20000},
2960 {"default-mac", 0x20000, 0x00020},
2961 {"pin", 0x20020, 0x00020},
2962 {"product-info", 0x21000, 0x01000},
2963 {"partition-table", 0x22000, 0x02000},
2964 {"soft-version", 0x24000, 0x01000},
2965 {"support-list", 0x25000, 0x01000},
2966 {"profile", 0x26000, 0x08000},
2967 {"user-config", 0x2e000, 0x10000},
2968 {"default-config", 0x3e000, 0x10000},
2969 {"config-info", 0x4e000, 0x00400},
2970 {"firmware", 0x50000, 0x7a0000},
2971 {"radio", 0x7f0000, 0x10000},
2975 .first_sysupgrade_partition
= "os-image",
2976 .last_sysupgrade_partition
= "file-system"
2979 /** Firmware layout for the RE455 v1 */
2985 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2986 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2987 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2988 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2989 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2990 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2991 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2992 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2993 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2995 .soft_ver
= SOFT_VER_DEFAULT
,
2997 /* We're using a dynamic kernel/rootfs split here */
2999 {"fs-uboot", 0x00000, 0x20000},
3000 {"default-mac", 0x20000, 0x00020},
3001 {"pin", 0x20020, 0x00020},
3002 {"product-info", 0x21000, 0x01000},
3003 {"partition-table", 0x22000, 0x02000},
3004 {"soft-version", 0x24000, 0x01000},
3005 {"support-list", 0x25000, 0x01000},
3006 {"profile", 0x26000, 0x08000},
3007 {"user-config", 0x2e000, 0x10000},
3008 {"default-config", 0x3e000, 0x10000},
3009 {"config-info", 0x4e000, 0x00400},
3010 {"firmware", 0x50000, 0x7a0000},
3011 {"radio", 0x7f0000, 0x10000},
3015 .first_sysupgrade_partition
= "os-image",
3016 .last_sysupgrade_partition
= "file-system"
3019 /** Firmware layout for the RE500 */
3025 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
3026 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
3027 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
3028 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
3029 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
3030 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
3031 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
3033 .soft_ver
= SOFT_VER_DEFAULT
,
3035 /* We're using a dynamic kernel/rootfs split here */
3037 {"fs-uboot", 0x00000, 0x20000},
3038 {"firmware", 0x20000, 0xde0000},
3039 {"partition-table", 0xe00000, 0x02000},
3040 {"default-mac", 0xe10000, 0x00020},
3041 {"pin", 0xe10100, 0x00020},
3042 {"product-info", 0xe11100, 0x01000},
3043 {"soft-version", 0xe20000, 0x01000},
3044 {"support-list", 0xe21000, 0x01000},
3045 {"profile", 0xe22000, 0x08000},
3046 {"user-config", 0xe30000, 0x10000},
3047 {"default-config", 0xe40000, 0x10000},
3048 {"radio", 0xff0000, 0x10000},
3052 .first_sysupgrade_partition
= "os-image",
3053 .last_sysupgrade_partition
= "file-system"
3056 /** Firmware layout for the RE650 */
3062 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
3063 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
3064 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3065 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3066 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3067 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3068 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3070 .soft_ver
= SOFT_VER_DEFAULT
,
3072 /* We're using a dynamic kernel/rootfs split here */
3074 {"fs-uboot", 0x00000, 0x20000},
3075 {"firmware", 0x20000, 0xde0000},
3076 {"partition-table", 0xe00000, 0x02000},
3077 {"default-mac", 0xe10000, 0x00020},
3078 {"pin", 0xe10100, 0x00020},
3079 {"product-info", 0xe11100, 0x01000},
3080 {"soft-version", 0xe20000, 0x01000},
3081 {"support-list", 0xe21000, 0x01000},
3082 {"profile", 0xe22000, 0x08000},
3083 {"user-config", 0xe30000, 0x10000},
3084 {"default-config", 0xe40000, 0x10000},
3085 {"radio", 0xff0000, 0x10000},
3089 .first_sysupgrade_partition
= "os-image",
3090 .last_sysupgrade_partition
= "file-system"
3092 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3098 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3099 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3100 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3101 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3102 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3103 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3104 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3106 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3107 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3109 /* We're using a dynamic kernel/rootfs split here */
3111 {"fs-uboot", 0x00000, 0x20000},
3112 {"firmware", 0x20000, 0x7a0000},
3113 {"partition-table", 0x7c0000, 0x02000},
3114 {"default-mac", 0x7c2000, 0x00020},
3115 {"pin", 0x7c2100, 0x00020},
3116 {"product-info", 0x7c3100, 0x01000},
3117 {"soft-version", 0x7c4200, 0x01000},
3118 {"support-list", 0x7c5200, 0x01000},
3119 {"profile", 0x7c6200, 0x08000},
3120 {"config-info", 0x7ce200, 0x00400},
3121 {"user-config", 0x7d0000, 0x10000},
3122 {"default-config", 0x7e0000, 0x10000},
3123 {"radio", 0x7f0000, 0x10000},
3127 .first_sysupgrade_partition
= "os-image",
3128 .last_sysupgrade_partition
= "file-system"
3131 /** Firmware layout for the Mercusys MR70X */
3137 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3138 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3139 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3141 .soft_ver
= SOFT_VER_DEFAULT
,
3144 {"fs-uboot", 0x00000, 0x40000},
3145 {"firmware", 0x40000, 0xf60000},
3146 {"default-mac", 0xfa0000, 0x00200},
3147 {"pin", 0xfa0200, 0x00100},
3148 {"device-id", 0xfa0300, 0x00100},
3149 {"product-info", 0xfa0400, 0x0fc00},
3150 {"default-config", 0xfb0000, 0x08000},
3151 {"ap-def-config", 0xfb8000, 0x08000},
3152 {"user-config", 0xfc0000, 0x0a000},
3153 {"ag-config", 0xfca000, 0x04000},
3154 {"certificate", 0xfce000, 0x02000},
3155 {"ap-config", 0xfd0000, 0x06000},
3156 {"router-config", 0xfd6000, 0x06000},
3157 {"favicon", 0xfdc000, 0x02000},
3158 {"logo", 0xfde000, 0x02000},
3159 {"partition-table", 0xfe0000, 0x00800},
3160 {"soft-version", 0xfe0800, 0x00100},
3161 {"support-list", 0xfe0900, 0x00200},
3162 {"profile", 0xfe0b00, 0x03000},
3163 {"extra-para", 0xfe3b00, 0x00100},
3164 {"radio", 0xff0000, 0x10000},
3168 .first_sysupgrade_partition
= "os-image",
3169 .last_sysupgrade_partition
= "file-system"
3175 #define error(_ret, _errno, _str, ...) \
3177 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3178 strerror(_errno)); \
3184 /** Stores a uint32 as big endian */
3185 static inline void put32(uint8_t *buf
, uint32_t val
) {
3192 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3194 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3197 /** Allocate a padded meta partition with a correctly initialised header
3198 * If the `data` pointer is NULL, then the required space is only allocated,
3199 * otherwise `data_len` bytes will be copied from `data` into the partition
3201 static struct image_partition_entry
init_meta_partition_entry(
3202 const char *name
, const void *data
, uint32_t data_len
,
3203 enum partition_trail_value pad_value
)
3205 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3206 if (meta_partition_should_pad(pad_value
))
3209 struct image_partition_entry entry
= {
3212 .data
= malloc(total_len
)
3215 error(1, errno
, "failed to allocate meta partition entry");
3217 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3218 header
->length
= htonl(data_len
);
3222 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3224 if (meta_partition_should_pad(pad_value
))
3225 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3230 /** Allocates a new image partition */
3231 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3232 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3234 error(1, errno
, "malloc");
3239 /** Sets up default partition names whenever custom names aren't specified */
3240 static void set_partition_names(struct device_info
*info
)
3242 if (!info
->partition_names
.partition_table
)
3243 info
->partition_names
.partition_table
= "partition-table";
3244 if (!info
->partition_names
.soft_ver
)
3245 info
->partition_names
.soft_ver
= "soft-version";
3246 if (!info
->partition_names
.os_image
)
3247 info
->partition_names
.os_image
= "os-image";
3248 if (!info
->partition_names
.support_list
)
3249 info
->partition_names
.support_list
= "support-list";
3250 if (!info
->partition_names
.file_system
)
3251 info
->partition_names
.file_system
= "file-system";
3252 if (!info
->partition_names
.extra_para
)
3253 info
->partition_names
.extra_para
= "extra-para";
3256 /** Frees an image partition */
3257 static void free_image_partition(struct image_partition_entry
*entry
)
3259 void *data
= entry
->data
;
3268 static time_t source_date_epoch
= -1;
3269 static void set_source_date_epoch() {
3270 char *env
= getenv("SOURCE_DATE_EPOCH");
3274 source_date_epoch
= strtoull(env
, &endptr
, 10);
3275 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3276 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3282 /** Generates the partition-table partition */
3283 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3285 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, SAFELOADER_PAYLOAD_TABLE_SIZE
);
3287 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3295 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3297 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3298 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3301 error(1, 0, "flash partition table overflow?");
3308 memset(s
, 0xff, end
-s
);
3314 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3315 static inline uint8_t bcd(uint8_t v
) {
3316 return 0x10 * (v
/10) + v
%10;
3320 /** Generates the soft-version partition */
3321 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3323 /** If an info string is provided, use this instead of
3324 * the structured data, and include the null-termination */
3325 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3326 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3327 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3328 info
->soft_ver
.text
, len
, info
->part_trail
);
3333 if (source_date_epoch
!= -1)
3334 t
= source_date_epoch
;
3335 else if (time(&t
) == (time_t)(-1))
3336 error(1, errno
, "time");
3338 struct tm
*tm
= gmtime(&t
);
3340 struct soft_version s
= {
3343 .version_major
= info
->soft_ver
.num
[0],
3344 .version_minor
= info
->soft_ver
.num
[1],
3345 .version_patch
= info
->soft_ver
.num
[2],
3347 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3348 .year_lo
= bcd(tm
->tm_year
%100),
3349 .month
= bcd(tm
->tm_mon
+1),
3350 .day
= bcd(tm
->tm_mday
),
3353 .compat_level
= htonl(info
->soft_ver_compat_level
)
3356 if (info
->soft_ver_compat_level
== 0)
3357 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3358 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3361 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3362 sizeof(s
), info
->part_trail
);
3365 /** Generates the support-list partition */
3366 static struct image_partition_entry
make_support_list(
3367 const struct device_info
*info
)
3369 uint32_t len
= strlen(info
->support_list
);
3370 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3371 len
, info
->part_trail
);
3374 /** Partition with extra-para data */
3375 static struct image_partition_entry
make_extra_para(
3376 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3378 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3382 /** Creates a new image partition with an arbitrary name from a file */
3383 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
) {
3384 struct stat statbuf
;
3386 if (stat(filename
, &statbuf
) < 0)
3387 error(1, errno
, "unable to stat file `%s'", filename
);
3389 size_t len
= statbuf
.st_size
;
3391 if (add_jffs2_eof
) {
3392 if (file_system_partition
)
3393 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3395 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3398 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3400 FILE *file
= fopen(filename
, "rb");
3402 error(1, errno
, "unable to open file `%s'", filename
);
3404 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3405 error(1, errno
, "unable to read file `%s'", filename
);
3407 if (add_jffs2_eof
) {
3408 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3410 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3411 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3420 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3422 Example image partition table:
3424 fwup-ptn partition-table base 0x00800 size 0x00800
3425 fwup-ptn os-image base 0x01000 size 0x113b45
3426 fwup-ptn file-system base 0x114b45 size 0x1d0004
3427 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3429 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3430 the end of the partition table is marked with a zero byte.
3432 The firmware image must contain at least the partition-table and support-list partitions
3433 to be accepted. There aren't any alignment constraints for the image partitions.
3435 The partition-table partition contains the actual flash layout; partitions
3436 from the image partition table are mapped to the corresponding flash partitions during
3437 the firmware upgrade. The support-list partition contains a list of devices supported by
3440 The base offsets in the firmware partition table are relative to the end
3441 of the vendor information block, so the partition-table partition will
3442 actually start at offset 0x1814 of the image.
3444 I think partition-table must be the first partition in the firmware image.
3446 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3448 char *image_pt
= (char *)buffer
, *end
= image_pt
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3450 size_t base
= SAFELOADER_PAYLOAD_TABLE_SIZE
;
3451 for (i
= 0; parts
[i
].name
; i
++) {
3452 for (j
= 0; flash_parts
[j
].name
; j
++) {
3453 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3454 if (parts
[i
].size
> flash_parts
[j
].size
)
3455 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3460 assert(flash_parts
[j
].name
);
3462 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3464 size_t len
= end
-image_pt
;
3465 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
);
3468 error(1, 0, "image partition table overflow?");
3472 base
+= parts
[i
].size
;
3476 /** Generates and writes the image MD5 checksum */
3477 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3481 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3482 MD5_Update(&ctx
, buffer
, len
);
3483 MD5_Final(md5
, &ctx
);
3488 Generates the firmware image in factory format
3494 0000-0003 Image size (4 bytes, big endian)
3495 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3496 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3497 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3498 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3499 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3500 1814-xxxx Firmware partitions
3502 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3503 *len
= SAFELOADER_PAYLOAD_OFFSET
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3506 for (i
= 0; parts
[i
].name
; i
++)
3507 *len
+= parts
[i
].size
;
3509 uint8_t *image
= malloc(*len
);
3511 error(1, errno
, "malloc");
3513 memset(image
, 0xff, *len
);
3517 size_t vendor_len
= strlen(info
->vendor
);
3518 put32(image
+ SAFELOADER_PREAMBLE_SIZE
, vendor_len
);
3519 memcpy(image
+ SAFELOADER_PREAMBLE_SIZE
+ 0x4, info
->vendor
, vendor_len
);
3522 put_partitions(image
+ SAFELOADER_PAYLOAD_OFFSET
, info
->partitions
, parts
);
3523 put_md5(image
+ 0x04, image
+ SAFELOADER_PREAMBLE_SIZE
, *len
- SAFELOADER_PREAMBLE_SIZE
);
3529 Generates the firmware image in sysupgrade format
3531 This makes some assumptions about the provided flash and image partition tables and
3532 should be generalized when TP-LINK starts building its safeloader into hardware with
3533 different flash layouts.
3535 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3537 size_t flash_first_partition_index
= 0;
3538 size_t flash_last_partition_index
= 0;
3539 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3540 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3541 const struct image_partition_entry
*image_last_partition
= NULL
;
3543 /** Find first and last partitions */
3544 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3545 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3546 flash_first_partition
= &info
->partitions
[i
];
3547 flash_first_partition_index
= i
;
3548 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3549 flash_last_partition
= &info
->partitions
[i
];
3550 flash_last_partition_index
= i
;
3554 assert(flash_first_partition
&& flash_last_partition
);
3555 assert(flash_first_partition_index
< flash_last_partition_index
);
3557 /** Find last partition from image to calculate needed size */
3558 for (i
= 0; image_parts
[i
].name
; i
++) {
3559 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3560 image_last_partition
= &image_parts
[i
];
3565 assert(image_last_partition
);
3567 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3569 uint8_t *image
= malloc(*len
);
3571 error(1, errno
, "malloc");
3573 memset(image
, 0xff, *len
);
3575 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3576 for (j
= 0; image_parts
[j
].name
; j
++) {
3577 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3578 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3579 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3580 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3584 assert(image_parts
[j
].name
);
3591 /** Generates an image according to a given layout and writes it to a file */
3592 static void build_image(const char *output
,
3593 const char *kernel_image
,
3594 const char *rootfs_image
,
3598 struct device_info
*info
) {
3602 struct image_partition_entry parts
[7] = {};
3604 struct flash_partition_entry
*firmware_partition
= NULL
;
3605 struct flash_partition_entry
*os_image_partition
= NULL
;
3606 struct flash_partition_entry
*file_system_partition
= NULL
;
3607 size_t firmware_partition_index
= 0;
3609 set_partition_names(info
);
3611 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3612 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3614 firmware_partition
= &info
->partitions
[i
];
3615 firmware_partition_index
= i
;
3619 if (firmware_partition
)
3621 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3622 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3625 if (stat(kernel_image
, &kernel
) < 0)
3626 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3628 if (kernel
.st_size
> firmware_partition
->size
)
3629 error(1, 0, "kernel overflowed firmware partition\n");
3631 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3632 info
->partitions
[i
+1] = info
->partitions
[i
];
3634 file_system_partition
->name
= info
->partition_names
.file_system
;
3636 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3638 /* Align partition start to erase blocks for factory images only */
3640 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3642 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3644 os_image_partition
->name
= info
->partition_names
.os_image
;
3646 os_image_partition
->size
= kernel
.st_size
;
3649 parts
[0] = make_partition_table(info
);
3650 parts
[1] = make_soft_version(info
, rev
);
3651 parts
[2] = make_support_list(info
);
3652 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3653 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3656 /* Some devices need the extra-para partition to accept the firmware */
3657 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3658 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3659 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3660 strcasecmp(info
->id
, "ARCHER-AX23-V1") == 0 ||
3661 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3662 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3663 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3664 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3665 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3666 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3667 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3668 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3669 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3670 strcasecmp(info
->id
, "DECO-M4R-V4") == 0 ||
3671 strcasecmp(info
->id
, "MR70X") == 0 ||
3672 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3673 const uint8_t extra_para
[2] = {0x01, 0x00};
3674 parts
[5] = make_extra_para(info
, extra_para
,
3675 sizeof(extra_para
));
3676 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3677 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3678 const uint8_t extra_para
[2] = {0x00, 0x01};
3679 parts
[5] = make_extra_para(info
, extra_para
,
3680 sizeof(extra_para
));
3681 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3682 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3683 const uint8_t extra_para
[2] = {0x01, 0x01};
3684 parts
[5] = make_extra_para(info
, extra_para
,
3685 sizeof(extra_para
));
3691 image
= generate_sysupgrade_image(info
, parts
, &len
);
3693 image
= generate_factory_image(info
, parts
, &len
);
3695 FILE *file
= fopen(output
, "wb");
3697 error(1, errno
, "unable to open output file");
3699 if (fwrite(image
, len
, 1, file
) != 1)
3700 error(1, 0, "unable to write output file");
3706 for (i
= 0; parts
[i
].name
; i
++)
3707 free_image_partition(&parts
[i
]);
3711 static void usage(const char *argv0
) {
3713 "Usage: %s [OPTIONS...]\n"
3716 " -h show this help\n"
3718 "Info about an image:\n"
3719 " -i <file> input file to read from\n"
3720 "Create a new image:\n"
3721 " -B <board> create image for the board specified with <board>\n"
3722 " -k <file> read kernel image from the file <file>\n"
3723 " -r <file> read rootfs image from the file <file>\n"
3724 " -o <file> write output to the file <file>\n"
3725 " -V <rev> sets the revision number to <rev>\n"
3726 " -j add jffs2 end-of-filesystem markers\n"
3727 " -S create sysupgrade instead of factory image\n"
3728 "Extract an old image:\n"
3729 " -x <file> extract all oem firmware partition\n"
3730 " -d <dir> destination to extract the firmware partition\n"
3731 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3737 static struct device_info
*find_board(const char *id
)
3739 struct device_info
*board
= NULL
;
3741 for (board
= boards
; board
->id
!= NULL
; board
++)
3742 if (strcasecmp(id
, board
->id
) == 0)
3748 static int add_flash_partition(
3749 struct flash_partition_entry
*part_list
,
3756 /* check if the list has a free entry */
3757 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3758 if (part_list
->name
== NULL
&&
3759 part_list
->base
== 0 &&
3760 part_list
->size
== 0)
3764 if (ptr
== max_entries
) {
3765 error(1, 0, "No free flash part entry available.");
3768 part_list
->name
= calloc(1, strlen(name
) + 1);
3769 if (!part_list
->name
) {
3770 error(1, 0, "Unable to allocate memory");
3773 memcpy((char *)part_list
->name
, name
, strlen(name
));
3774 part_list
->base
= base
;
3775 part_list
->size
= size
;
3780 /** read the partition table into struct flash_partition_entry */
3781 enum PARTITION_TABLE_TYPE
{
3782 PARTITION_TABLE_FWUP
,
3783 PARTITION_TABLE_FLASH
,
3786 static int read_partition_table(
3787 FILE *file
, long offset
,
3788 struct flash_partition_entry
*entries
, size_t max_entries
,
3791 char buf
[SAFELOADER_PAYLOAD_TABLE_SIZE
];
3793 const char *parthdr
= NULL
;
3794 const char *fwuphdr
= "fwup-ptn";
3795 const char *flashhdr
= "partition";
3797 /* TODO: search for the partition table */
3800 case PARTITION_TABLE_FWUP
:
3803 case PARTITION_TABLE_FLASH
:
3807 error(1, 0, "Invalid partition table");
3810 if (fseek(file
, offset
, SEEK_SET
) < 0)
3811 error(1, errno
, "Can not seek in the firmware");
3813 if (fread(buf
, sizeof(buf
), 1, file
) != 1)
3814 error(1, errno
, "Can not read fwup-ptn from the firmware");
3816 buf
[sizeof(buf
) - 1] = '\0';
3818 /* look for the partition header */
3819 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3820 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3825 end
= buf
+ sizeof(buf
);
3826 while ((ptr
+ strlen(parthdr
)) < end
&&
3827 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3831 char name
[32] = { 0 };
3833 unsigned long base
= 0;
3834 unsigned long size
= 0;
3836 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3837 if (end_part
== NULL
) {
3838 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3842 for (int i
= 0; i
<= 4; i
++) {
3843 if (end_part
<= ptr
)
3846 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3847 if (end_element
== NULL
) {
3848 error(1, errno
, "Ignoring the rest of the partition entries.");
3853 /* partition header */
3855 ptr
= end_element
+ 1;
3859 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3860 strncpy(name
, ptr
, name_len
);
3861 name
[name_len
] = '\0';
3862 ptr
= end_element
+ 1;
3867 ptr
= end_element
+ 1;
3872 base
= strtoul(ptr
, NULL
, 16);
3873 ptr
= end_element
+ 1;
3878 ptr
= end_element
+ 1;
3879 /* actual size. The last element doesn't have a sepeartor */
3880 size
= strtoul(ptr
, NULL
, 16);
3881 /* the part ends with 0x09, 0x0d, 0x0a */
3883 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3892 static void safeloader_read_partition(FILE *input_file
, size_t payload_offset
,
3893 struct flash_partition_entry
*entry
,
3894 struct image_partition_entry
*part
)
3896 size_t part_size
= entry
->size
;
3897 void *part_data
= malloc(part_size
);
3899 if (fseek(input_file
, payload_offset
, SEEK_SET
))
3900 error(1, errno
, "Failed to seek to partition data");
3903 error(1, ENOMEM
, "Failed to allocate partition data");
3905 if (fread(part_data
, 1, part_size
, input_file
) < part_size
)
3906 error(1, errno
, "Failed to read partition data");
3908 part
->data
= part_data
;
3909 part
->size
= part_size
;
3910 part
->name
= entry
->name
;
3913 static void safeloader_parse_image(FILE *input_file
, struct safeloader_image_info
*image
)
3915 static const char *HEADER_ID_CLOUD
= "fw-type:Cloud";
3916 static const char *HEADER_ID_QNEW
= "?NEW";
3923 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
3925 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3926 error(1, errno
, "Can not read image header");
3928 if (memcmp(HEADER_ID_QNEW
, &buf
[0], strlen(HEADER_ID_QNEW
)) == 0)
3929 image
->type
= SAFELOADER_TYPE_QNEW
;
3930 else if (memcmp(HEADER_ID_CLOUD
, &buf
[0], strlen(HEADER_ID_CLOUD
)) == 0)
3931 image
->type
= SAFELOADER_TYPE_CLOUD
;
3932 else if (ntohl(*((uint32_t *) &buf
[0])) <= SAFELOADER_HEADER_SIZE
)
3933 image
->type
= SAFELOADER_TYPE_VENDOR
;
3935 image
->type
= SAFELOADER_TYPE_DEFAULT
;
3937 switch (image
->type
) {
3938 case SAFELOADER_TYPE_DEFAULT
:
3939 case SAFELOADER_TYPE_VENDOR
:
3940 case SAFELOADER_TYPE_CLOUD
:
3941 image
->payload_offset
= SAFELOADER_PAYLOAD_OFFSET
;
3943 case SAFELOADER_TYPE_QNEW
:
3944 image
->payload_offset
= SAFELOADER_QNEW_PAYLOAD_OFFSET
;
3948 /* Parse image partition table */
3949 read_partition_table(input_file
, image
->payload_offset
, &image
->entries
[0],
3950 MAX_PARTITIONS
, PARTITION_TABLE_FWUP
);
3953 static void write_partition(
3955 size_t firmware_offset
,
3956 struct flash_partition_entry
*entry
,
3962 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3964 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3965 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3966 error(1, errno
, "Can not read partition from input_file");
3968 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3969 error(1, errno
, "Can not write partition to output_file");
3971 /* write last chunk smaller than buffer */
3972 if (offset
< entry
->size
) {
3973 offset
= entry
->size
- offset
;
3974 if (fread(buf
, offset
, 1, input_file
) != 1)
3975 error(1, errno
, "Can not read partition from input_file");
3976 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3977 error(1, errno
, "Can not write partition to output_file");
3981 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3984 char output
[PATH_MAX
];
3986 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3987 output_file
= fopen(output
, "wb+");
3988 if (output_file
== NULL
) {
3989 error(1, errno
, "Can not open output file %s", output
);
3992 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3994 fclose(output_file
);
3999 /** extract all partitions from the firmware file */
4000 static int extract_firmware(const char *input
, const char *output_directory
)
4002 struct safeloader_image_info info
= {};
4003 struct stat statbuf
;
4006 /* check input file */
4007 if (stat(input
, &statbuf
)) {
4008 error(1, errno
, "Can not read input firmware %s", input
);
4011 /* check if output directory exists */
4012 if (stat(output_directory
, &statbuf
)) {
4013 error(1, errno
, "Failed to stat output directory %s", output_directory
);
4016 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
4017 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
4020 input_file
= fopen(input
, "rb");
4021 safeloader_parse_image(input_file
, &info
);
4023 for (size_t i
= 0; i
< MAX_PARTITIONS
&& info
.entries
[i
].name
; i
++)
4024 extract_firmware_partition(input_file
, info
.payload_offset
, &info
.entries
[i
], output_directory
);
4029 static struct flash_partition_entry
*find_partition(
4030 struct flash_partition_entry
*entries
, size_t max_entries
,
4031 const char *name
, const char *error_msg
)
4033 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
4034 if (strcmp(entries
->name
, name
) == 0)
4039 error(1, 0, "%s", error_msg
);
4045 static int firmware_info(const char *input
)
4047 struct safeloader_image_info info
= {};
4048 struct image_partition_entry part
= {};
4049 struct flash_partition_entry
*e
;
4052 input_file
= fopen(input
, "rb");
4054 safeloader_parse_image(input_file
, &info
);
4056 if (info
.type
== SAFELOADER_TYPE_VENDOR
) {
4057 char buf
[SAFELOADER_HEADER_SIZE
] = {};
4058 uint32_t vendor_size
;
4060 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
4061 fread(&vendor_size
, sizeof(uint32_t), 1, input_file
);
4063 vendor_size
= ntohl(vendor_size
);
4064 fread(buf
, vendor_size
, 1, input_file
);
4066 printf("Firmware vendor string:\n");
4067 fwrite(buf
, strnlen(buf
, vendor_size
), 1, stdout
);
4071 printf("Firmware image partitions:\n");
4072 printf("%-8s %-8s %s\n", "base", "size", "name");
4074 e
= &info
.entries
[0];
4075 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4076 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4078 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "soft-version", NULL
);
4080 struct soft_version
*s
;
4081 unsigned int ascii_len
;
4086 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4087 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4088 buf
= part
.data
+ sizeof(struct meta_header
);
4090 /* Check for (null-terminated) string */
4092 while (ascii_len
< data_len
&& isascii(buf
[ascii_len
]))
4095 isstr
= ascii_len
== data_len
;
4097 printf("\n[Software version]\n");
4099 fwrite(buf
, strnlen((const char *) buf
, data_len
), 1, stdout
);
4101 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
4102 s
= (struct soft_version
*) buf
;
4104 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
4105 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
4106 printf("Revision: %d\n", ntohl(s
->rev
));
4108 printf("Failed to parse data\n");
4111 free_image_partition(&part
);
4114 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "support-list", NULL
);
4118 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
4119 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
4121 printf("\n[Support list]\n");
4122 fwrite(part
.data
+ sizeof(struct meta_header
), data_len
, 1, stdout
);
4125 free_image_partition(&part
);
4128 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "partition-table", NULL
);
4130 size_t flash_table_offset
= info
.payload_offset
+ e
->base
+ 4;
4131 struct flash_partition_entry parts
[MAX_PARTITIONS
] = {};
4133 if (read_partition_table(input_file
, flash_table_offset
, parts
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
))
4134 error(1, 0, "Error can not read the partition table (partition)");
4136 printf("\n[Partition table]\n");
4137 printf("%-8s %-8s %s\n", "base", "size", "name");
4140 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4141 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4149 static void write_ff(FILE *output_file
, size_t size
)
4154 memset(buf
, 0xff, sizeof(buf
));
4156 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
4157 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
4158 error(1, errno
, "Can not write 0xff to output_file");
4161 /* write last chunk smaller than buffer */
4162 if (offset
< size
) {
4163 offset
= size
- offset
;
4164 if (fwrite(buf
, offset
, 1, output_file
) != 1)
4165 error(1, errno
, "Can not write partition to output_file");
4169 static void convert_firmware(const char *input
, const char *output
)
4171 struct flash_partition_entry flash
[MAX_PARTITIONS
] = {};
4172 struct flash_partition_entry
*fwup_partition_table
;
4173 struct flash_partition_entry
*flash_file_system
;
4174 struct flash_partition_entry
*fwup_file_system
;
4175 struct flash_partition_entry
*flash_os_image
;
4176 struct flash_partition_entry
*fwup_os_image
;
4177 struct safeloader_image_info info
= {};
4178 size_t flash_table_offset
;
4179 struct stat statbuf
;
4183 /* check input file */
4184 if (stat(input
, &statbuf
)) {
4185 error(1, errno
, "Can not read input firmware %s", input
);
4188 input_file
= fopen(input
, "rb");
4190 error(1, 0, "Can not open input firmware %s", input
);
4192 output_file
= fopen(output
, "wb");
4194 error(1, 0, "Can not open output firmware %s", output
);
4196 input_file
= fopen(input
, "rb");
4197 safeloader_parse_image(input_file
, &info
);
4199 fwup_os_image
= find_partition(info
.entries
, MAX_PARTITIONS
,
4200 "os-image", "Error can not find os-image partition (fwup)");
4201 fwup_file_system
= find_partition(info
.entries
, MAX_PARTITIONS
,
4202 "file-system", "Error can not find file-system partition (fwup)");
4203 fwup_partition_table
= find_partition(info
.entries
, MAX_PARTITIONS
,
4204 "partition-table", "Error can not find partition-table partition");
4206 /* the flash partition table has a 0x00000004 magic haeder */
4207 flash_table_offset
= info
.payload_offset
+ fwup_partition_table
->base
+ 4;
4208 if (read_partition_table(input_file
, flash_table_offset
, flash
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
) != 0)
4209 error(1, 0, "Error can not read the partition table (flash)");
4211 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4212 "os-image", "Error can not find os-image partition (flash)");
4213 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4214 "file-system", "Error can not find file-system partition (flash)");
4216 /* write os_image to 0x0 */
4217 write_partition(input_file
, info
.payload_offset
, fwup_os_image
, output_file
);
4218 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4220 /* write file-system behind os_image */
4221 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4222 write_partition(input_file
, info
.payload_offset
, fwup_file_system
, output_file
);
4224 fclose(output_file
);
4228 int main(int argc
, char *argv
[]) {
4229 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4230 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4231 bool add_jffs2_eof
= false, sysupgrade
= false;
4233 struct device_info
*info
;
4234 set_source_date_epoch();
4239 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4245 info_image
= optarg
;
4253 kernel_image
= optarg
;
4257 rootfs_image
= optarg
;
4265 sscanf(optarg
, "r%u", &rev
);
4269 add_jffs2_eof
= true;
4281 output_directory
= optarg
;
4285 extract_image
= optarg
;
4289 convert_image
= optarg
;
4299 firmware_info(info_image
);
4300 } else if (extract_image
|| output_directory
) {
4302 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4303 if (!output_directory
)
4304 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4305 extract_firmware(extract_image
, output_directory
);
4306 } else if (convert_image
) {
4308 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4309 convert_firmware(convert_image
, output
);
4312 error(1, 0, "no board has been specified");
4314 error(1, 0, "no kernel image has been specified");
4316 error(1, 0, "no rootfs image has been specified");
4318 error(1, 0, "no output filename has been specified");
4320 info
= find_board(board
);
4323 error(1, 0, "unsupported board %s", board
);
4325 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);