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
;
130 /* Internal representation of safeloader image data */
131 struct safeloader_image_info
{
132 size_t payload_offset
;
133 struct flash_partition_entry entries
[MAX_PARTITIONS
];
136 #define SAFELOADER_PREAMBLE_SIZE 0x14
137 #define SAFELOADER_HEADER_SIZE 0x1000
138 #define SAFELOADER_PAYLOAD_OFFSET (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_HEADER_SIZE)
140 #define SAFELOADER_PAYLOAD_TABLE_SIZE 0x800
142 static const uint8_t jffs2_eof_mark
[4] = {0xde, 0xad, 0xc0, 0xde};
146 Salt for the MD5 hash
148 Fortunately, TP-LINK seems to use the same salt for most devices which use
149 the new image format.
151 static const uint8_t md5_salt
[16] = {
152 0x7a, 0x2b, 0x15, 0xed,
153 0x9b, 0x98, 0x59, 0x6d,
154 0xe5, 0x04, 0xab, 0x44,
155 0xac, 0x2a, 0x9f, 0x4e,
159 /** Firmware layout table */
160 static struct device_info boards
[] = {
161 /** Firmware layout for the CPE210/220 V1 */
164 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
167 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
168 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
169 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
170 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
171 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
172 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
173 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
175 .soft_ver
= SOFT_VER_DEFAULT
,
178 {"fs-uboot", 0x00000, 0x20000},
179 {"partition-table", 0x20000, 0x02000},
180 {"default-mac", 0x30000, 0x00020},
181 {"product-info", 0x31100, 0x00100},
182 {"signature", 0x32000, 0x00400},
183 {"firmware", 0x40000, 0x770000},
184 {"soft-version", 0x7b0000, 0x00100},
185 {"support-list", 0x7b1000, 0x00400},
186 {"user-config", 0x7c0000, 0x10000},
187 {"default-config", 0x7d0000, 0x10000},
188 {"log", 0x7e0000, 0x10000},
189 {"radio", 0x7f0000, 0x10000},
193 .first_sysupgrade_partition
= "os-image",
194 .last_sysupgrade_partition
= "support-list",
197 /** Firmware layout for the CPE210 V2 */
200 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
203 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
204 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
205 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
206 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
207 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
208 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
209 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
210 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
211 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
212 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
214 .soft_ver
= SOFT_VER_DEFAULT
,
217 {"fs-uboot", 0x00000, 0x20000},
218 {"partition-table", 0x20000, 0x02000},
219 {"default-mac", 0x30000, 0x00020},
220 {"product-info", 0x31100, 0x00100},
221 {"device-info", 0x31400, 0x00400},
222 {"signature", 0x32000, 0x00400},
223 {"device-id", 0x33000, 0x00100},
224 {"firmware", 0x40000, 0x770000},
225 {"soft-version", 0x7b0000, 0x00100},
226 {"support-list", 0x7b1000, 0x01000},
227 {"user-config", 0x7c0000, 0x10000},
228 {"default-config", 0x7d0000, 0x10000},
229 {"log", 0x7e0000, 0x10000},
230 {"radio", 0x7f0000, 0x10000},
234 .first_sysupgrade_partition
= "os-image",
235 .last_sysupgrade_partition
= "support-list",
238 /** Firmware layout for the CPE210 V3 */
241 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
244 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
245 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
246 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
247 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
248 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
249 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
250 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
251 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
252 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
253 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
254 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
256 .soft_ver
= SOFT_VER_DEFAULT
,
259 {"fs-uboot", 0x00000, 0x20000},
260 {"partition-table", 0x20000, 0x01000},
261 {"default-mac", 0x30000, 0x00020},
262 {"product-info", 0x31100, 0x00100},
263 {"device-info", 0x31400, 0x00400},
264 {"signature", 0x32000, 0x00400},
265 {"device-id", 0x33000, 0x00100},
266 {"firmware", 0x40000, 0x770000},
267 {"soft-version", 0x7b0000, 0x00100},
268 {"support-list", 0x7b1000, 0x01000},
269 {"user-config", 0x7c0000, 0x10000},
270 {"default-config", 0x7d0000, 0x10000},
271 {"log", 0x7e0000, 0x10000},
272 {"radio", 0x7f0000, 0x10000},
276 .first_sysupgrade_partition
= "os-image",
277 .last_sysupgrade_partition
= "support-list",
280 /** Firmware layout for the CPE220 V2 */
283 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
286 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
287 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
288 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
289 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
290 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
291 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
292 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
293 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
294 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
295 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
297 .soft_ver
= SOFT_VER_DEFAULT
,
300 {"fs-uboot", 0x00000, 0x20000},
301 {"partition-table", 0x20000, 0x02000},
302 {"default-mac", 0x30000, 0x00020},
303 {"product-info", 0x31100, 0x00100},
304 {"signature", 0x32000, 0x00400},
305 {"firmware", 0x40000, 0x770000},
306 {"soft-version", 0x7b0000, 0x00100},
307 {"support-list", 0x7b1000, 0x00400},
308 {"user-config", 0x7c0000, 0x10000},
309 {"default-config", 0x7d0000, 0x10000},
310 {"log", 0x7e0000, 0x10000},
311 {"radio", 0x7f0000, 0x10000},
315 .first_sysupgrade_partition
= "os-image",
316 .last_sysupgrade_partition
= "support-list",
319 /** Firmware layout for the CPE220 V3 */
322 .vendor
= "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
325 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
326 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
327 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
328 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
329 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
330 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
331 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
332 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
333 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
334 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
336 .soft_ver
= SOFT_VER_DEFAULT
,
339 {"fs-uboot", 0x00000, 0x20000},
340 {"partition-table", 0x20000, 0x02000},
341 {"default-mac", 0x30000, 0x00020},
342 {"product-info", 0x31100, 0x00100},
343 {"device-info", 0x31400, 0x00400},
344 {"signature", 0x32000, 0x00400},
345 {"device-id", 0x33000, 0x00100},
346 {"firmware", 0x40000, 0x770000},
347 {"soft-version", 0x7b0000, 0x00100},
348 {"support-list", 0x7b1000, 0x01000},
349 {"user-config", 0x7c0000, 0x10000},
350 {"default-config", 0x7d0000, 0x10000},
351 {"log", 0x7e0000, 0x10000},
352 {"radio", 0x7f0000, 0x10000},
356 .first_sysupgrade_partition
= "os-image",
357 .last_sysupgrade_partition
= "support-list",
360 /** Firmware layout for the CPE510/520 V1 */
363 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
366 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
367 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
368 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
369 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
370 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
371 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
372 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
373 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
375 .soft_ver
= SOFT_VER_DEFAULT
,
378 {"fs-uboot", 0x00000, 0x20000},
379 {"partition-table", 0x20000, 0x02000},
380 {"default-mac", 0x30000, 0x00020},
381 {"product-info", 0x31100, 0x00100},
382 {"signature", 0x32000, 0x00400},
383 {"firmware", 0x40000, 0x770000},
384 {"soft-version", 0x7b0000, 0x00100},
385 {"support-list", 0x7b1000, 0x00400},
386 {"user-config", 0x7c0000, 0x10000},
387 {"default-config", 0x7d0000, 0x10000},
388 {"log", 0x7e0000, 0x10000},
389 {"radio", 0x7f0000, 0x10000},
393 .first_sysupgrade_partition
= "os-image",
394 .last_sysupgrade_partition
= "support-list",
397 /** Firmware layout for the CPE510 V2 */
400 .vendor
= "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
403 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
404 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
405 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
406 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
407 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
408 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
409 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
410 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
411 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
412 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
413 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
414 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
416 .soft_ver
= SOFT_VER_DEFAULT
,
419 {"fs-uboot", 0x00000, 0x20000},
420 {"partition-table", 0x20000, 0x02000},
421 {"default-mac", 0x30000, 0x00020},
422 {"product-info", 0x31100, 0x00100},
423 {"signature", 0x32000, 0x00400},
424 {"firmware", 0x40000, 0x770000},
425 {"soft-version", 0x7b0000, 0x00100},
426 {"support-list", 0x7b1000, 0x00400},
427 {"user-config", 0x7c0000, 0x10000},
428 {"default-config", 0x7d0000, 0x10000},
429 {"log", 0x7e0000, 0x10000},
430 {"radio", 0x7f0000, 0x10000},
434 .first_sysupgrade_partition
= "os-image",
435 .last_sysupgrade_partition
= "support-list",
438 /** Firmware layout for the CPE510 V3 */
441 .vendor
= "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
444 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
445 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
446 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
447 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
448 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
449 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
450 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
451 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
452 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
453 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
454 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
455 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
456 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
457 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
458 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
460 .soft_ver
= SOFT_VER_DEFAULT
,
463 {"fs-uboot", 0x00000, 0x20000},
464 {"partition-table", 0x20000, 0x02000},
465 {"default-mac", 0x30000, 0x00020},
466 {"product-info", 0x31100, 0x00100},
467 {"signature", 0x32000, 0x00400},
468 {"firmware", 0x40000, 0x770000},
469 {"soft-version", 0x7b0000, 0x00100},
470 {"support-list", 0x7b1000, 0x00400},
471 {"user-config", 0x7c0000, 0x10000},
472 {"default-config", 0x7d0000, 0x10000},
473 {"log", 0x7e0000, 0x10000},
474 {"radio", 0x7f0000, 0x10000},
478 .first_sysupgrade_partition
= "os-image",
479 .last_sysupgrade_partition
= "support-list",
482 /** Firmware layout for the CPE605V1 */
485 .vendor
= "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
488 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
489 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
490 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
492 .soft_ver
= SOFT_VER_DEFAULT
,
495 {"fs-uboot", 0x00000, 0x20000},
496 {"partition-table", 0x20000, 0x02000},
497 {"default-mac", 0x30000, 0x00020},
498 {"serial-number", 0x30100, 0x00020},
499 {"product-info", 0x31100, 0x00100},
500 {"device-info", 0x31400, 0x00400},
501 {"signature", 0x32000, 0x00400},
502 {"device-id", 0x33000, 0x00100},
503 {"firmware", 0x40000, 0x770000},
504 {"soft-version", 0x7b0000, 0x00100},
505 {"support-list", 0x7b1000, 0x01000},
506 {"user-config", 0x7c0000, 0x10000},
507 {"default-config", 0x7d0000, 0x10000},
508 {"log", 0x7e0000, 0x10000},
509 {"radio", 0x7f0000, 0x10000},
513 .first_sysupgrade_partition
= "os-image",
514 .last_sysupgrade_partition
= "support-list",
517 /** Firmware layout for the CPE610V1 */
520 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
523 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
524 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
525 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
526 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
527 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
528 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
529 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
530 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
531 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
532 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
534 .soft_ver
= SOFT_VER_DEFAULT
,
537 {"fs-uboot", 0x00000, 0x20000},
538 {"partition-table", 0x20000, 0x02000},
539 {"default-mac", 0x30000, 0x00020},
540 {"product-info", 0x31100, 0x00100},
541 {"signature", 0x32000, 0x00400},
542 {"firmware", 0x40000, 0x770000},
543 {"soft-version", 0x7b0000, 0x00100},
544 {"support-list", 0x7b1000, 0x00400},
545 {"user-config", 0x7c0000, 0x10000},
546 {"default-config", 0x7d0000, 0x10000},
547 {"log", 0x7e0000, 0x10000},
548 {"radio", 0x7f0000, 0x10000},
552 .first_sysupgrade_partition
= "os-image",
553 .last_sysupgrade_partition
= "support-list",
556 /** Firmware layout for the CPE610V2 */
559 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
562 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
563 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
564 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
565 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
566 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
567 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
568 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
569 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
570 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
571 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
573 .soft_ver
= SOFT_VER_DEFAULT
,
576 {"fs-uboot", 0x00000, 0x20000},
577 {"partition-table", 0x20000, 0x02000},
578 {"default-mac", 0x30000, 0x00020},
579 {"product-info", 0x31100, 0x00100},
580 {"signature", 0x32000, 0x00400},
581 {"firmware", 0x40000, 0x770000},
582 {"soft-version", 0x7b0000, 0x00100},
583 {"support-list", 0x7b1000, 0x00400},
584 {"user-config", 0x7c0000, 0x10000},
585 {"default-config", 0x7d0000, 0x10000},
586 {"log", 0x7e0000, 0x10000},
587 {"radio", 0x7f0000, 0x10000},
591 .first_sysupgrade_partition
= "os-image",
592 .last_sysupgrade_partition
= "support-list",
594 /** Firmware layout for the CPE710 V1 */
597 .vendor
= "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
600 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
601 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
602 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
603 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
604 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
605 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
607 .soft_ver
= SOFT_VER_DEFAULT
,
610 {"fs-uboot", 0x00000, 0x50000},
611 {"partition-table", 0x50000, 0x02000},
612 {"default-mac", 0x60000, 0x00020},
613 {"serial-number", 0x60100, 0x00020},
614 {"product-info", 0x61100, 0x00100},
615 {"device-info", 0x61400, 0x00400},
616 {"signature", 0x62000, 0x00400},
617 {"device-id", 0x63000, 0x00100},
618 {"firmware", 0x70000, 0xf40000},
619 {"soft-version", 0xfb0000, 0x00100},
620 {"support-list", 0xfb1000, 0x01000},
621 {"user-config", 0xfc0000, 0x10000},
622 {"default-config", 0xfd0000, 0x10000},
623 {"log", 0xfe0000, 0x10000},
624 {"radio", 0xff0000, 0x10000},
628 .first_sysupgrade_partition
= "os-image",
629 .last_sysupgrade_partition
= "support-list",
634 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
637 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
638 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
639 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
641 .soft_ver
= SOFT_VER_DEFAULT
,
644 {"fs-uboot", 0x00000, 0x20000},
645 {"partition-table", 0x20000, 0x02000},
646 {"default-mac", 0x30000, 0x00020},
647 {"product-info", 0x31100, 0x00100},
648 {"signature", 0x32000, 0x00400},
649 {"firmware", 0x40000, 0x770000},
650 {"soft-version", 0x7b0000, 0x00100},
651 {"support-list", 0x7b1000, 0x00400},
652 {"user-config", 0x7c0000, 0x10000},
653 {"default-config", 0x7d0000, 0x10000},
654 {"log", 0x7e0000, 0x10000},
655 {"radio", 0x7f0000, 0x10000},
659 .first_sysupgrade_partition
= "os-image",
660 .last_sysupgrade_partition
= "support-list",
665 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
668 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
669 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
670 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
672 .soft_ver
= SOFT_VER_DEFAULT
,
675 {"fs-uboot", 0x00000, 0x20000},
676 {"partition-table", 0x20000, 0x02000},
677 {"default-mac", 0x30000, 0x00020},
678 {"product-info", 0x31100, 0x00100},
679 {"signature", 0x32000, 0x00400},
680 {"firmware", 0x40000, 0x770000},
681 {"soft-version", 0x7b0000, 0x00100},
682 {"support-list", 0x7b1000, 0x00400},
683 {"user-config", 0x7c0000, 0x10000},
684 {"default-config", 0x7d0000, 0x10000},
685 {"log", 0x7e0000, 0x10000},
686 {"radio", 0x7f0000, 0x10000},
690 .first_sysupgrade_partition
= "os-image",
691 .last_sysupgrade_partition
= "support-list",
696 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
699 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
700 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
701 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
702 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
704 .soft_ver
= SOFT_VER_DEFAULT
,
707 {"fs-uboot", 0x00000, 0x20000},
708 {"partition-table", 0x20000, 0x02000},
709 {"default-mac", 0x30000, 0x00020},
710 {"product-info", 0x31100, 0x00100},
711 {"signature", 0x32000, 0x00400},
712 {"firmware", 0x40000, 0x770000},
713 {"soft-version", 0x7b0000, 0x00100},
714 {"support-list", 0x7b1000, 0x00400},
715 {"user-config", 0x7c0000, 0x10000},
716 {"default-config", 0x7d0000, 0x10000},
717 {"log", 0x7e0000, 0x10000},
718 {"radio", 0x7f0000, 0x10000},
722 .first_sysupgrade_partition
= "os-image",
723 .last_sysupgrade_partition
= "support-list",
728 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
731 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
732 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
733 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
734 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
736 .soft_ver
= SOFT_VER_DEFAULT
,
739 {"fs-uboot", 0x00000, 0x20000},
740 {"partition-table", 0x20000, 0x02000},
741 {"default-mac", 0x30000, 0x00020},
742 {"product-info", 0x31100, 0x00100},
743 {"signature", 0x32000, 0x00400},
744 {"firmware", 0x40000, 0x770000},
745 {"soft-version", 0x7b0000, 0x00100},
746 {"support-list", 0x7b1000, 0x00400},
747 {"user-config", 0x7c0000, 0x10000},
748 {"default-config", 0x7d0000, 0x10000},
749 {"log", 0x7e0000, 0x10000},
750 {"radio", 0x7f0000, 0x10000},
754 .first_sysupgrade_partition
= "os-image",
755 .last_sysupgrade_partition
= "support-list",
758 /** Firmware layout for the AD7200 */
764 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
766 .soft_ver
= SOFT_VER_DEFAULT
,
769 {"SBL1", 0x00000, 0x20000},
770 {"MIBIB", 0x20000, 0x20000},
771 {"SBL2", 0x40000, 0x20000},
772 {"SBL3", 0x60000, 0x30000},
773 {"DDRCONFIG", 0x90000, 0x10000},
774 {"SSD", 0xa0000, 0x10000},
775 {"TZ", 0xb0000, 0x30000},
776 {"RPM", 0xe0000, 0x20000},
777 {"fs-uboot", 0x100000, 0x70000},
778 {"uboot-env", 0x170000, 0x40000},
779 {"radio", 0x1b0000, 0x40000},
780 {"os-image", 0x1f0000, 0x400000},
781 {"file-system", 0x5f0000, 0x1900000},
782 {"default-mac", 0x1ef0000, 0x00200},
783 {"pin", 0x1ef0200, 0x00200},
784 {"device-id", 0x1ef0400, 0x00200},
785 {"product-info", 0x1ef0600, 0x0fa00},
786 {"partition-table", 0x1f00000, 0x10000},
787 {"soft-version", 0x1f10000, 0x10000},
788 {"support-list", 0x1f20000, 0x10000},
789 {"profile", 0x1f30000, 0x10000},
790 {"default-config", 0x1f40000, 0x10000},
791 {"user-config", 0x1f50000, 0x40000},
792 {"qos-db", 0x1f90000, 0x40000},
793 {"usb-config", 0x1fd0000, 0x10000},
794 {"log", 0x1fe0000, 0x20000},
798 .first_sysupgrade_partition
= "os-image",
799 .last_sysupgrade_partition
= "file-system"
802 /** Firmware layout for the C2600 */
808 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
810 .soft_ver
= SOFT_VER_DEFAULT
,
813 We use a bigger os-image partition than the stock images (and thus
814 smaller file-system), as our kernel doesn't fit in the stock firmware's
815 2 MB os-image since kernel 4.14.
818 {"SBL1", 0x00000, 0x20000},
819 {"MIBIB", 0x20000, 0x20000},
820 {"SBL2", 0x40000, 0x20000},
821 {"SBL3", 0x60000, 0x30000},
822 {"DDRCONFIG", 0x90000, 0x10000},
823 {"SSD", 0xa0000, 0x10000},
824 {"TZ", 0xb0000, 0x30000},
825 {"RPM", 0xe0000, 0x20000},
826 {"fs-uboot", 0x100000, 0x70000},
827 {"uboot-env", 0x170000, 0x40000},
828 {"radio", 0x1b0000, 0x40000},
829 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
830 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
831 {"default-mac", 0x1ef0000, 0x00200},
832 {"pin", 0x1ef0200, 0x00200},
833 {"product-info", 0x1ef0400, 0x0fc00},
834 {"partition-table", 0x1f00000, 0x10000},
835 {"soft-version", 0x1f10000, 0x10000},
836 {"support-list", 0x1f20000, 0x10000},
837 {"profile", 0x1f30000, 0x10000},
838 {"default-config", 0x1f40000, 0x10000},
839 {"user-config", 0x1f50000, 0x40000},
840 {"qos-db", 0x1f90000, 0x40000},
841 {"usb-config", 0x1fd0000, 0x10000},
842 {"log", 0x1fe0000, 0x20000},
846 .first_sysupgrade_partition
= "os-image",
847 .last_sysupgrade_partition
= "file-system"
850 /** Firmware layout for the A7-V5 */
852 .id
= "ARCHER-A7-V5",
855 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
856 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
857 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
858 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
859 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
860 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
862 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
864 /* We're using a dynamic kernel/rootfs split here */
866 {"factory-boot", 0x00000, 0x20000},
867 {"fs-uboot", 0x20000, 0x20000},
868 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
869 /* Stock: name file-system base 0x160000 size 0xda0000 */
870 {"default-mac", 0xf40000, 0x00200},
871 {"pin", 0xf40200, 0x00200},
872 {"device-id", 0xf40400, 0x00100},
873 {"product-info", 0xf40500, 0x0fb00},
874 {"soft-version", 0xf50000, 0x00100},
875 {"extra-para", 0xf51000, 0x01000},
876 {"support-list", 0xf52000, 0x0a000},
877 {"profile", 0xf5c000, 0x04000},
878 {"default-config", 0xf60000, 0x10000},
879 {"user-config", 0xf70000, 0x40000},
880 {"certificate", 0xfb0000, 0x10000},
881 {"partition-table", 0xfc0000, 0x10000},
882 {"log", 0xfd0000, 0x20000},
883 {"radio", 0xff0000, 0x10000},
887 .first_sysupgrade_partition
= "os-image",
888 .last_sysupgrade_partition
= "file-system",
891 /** Firmware layout for the Archer A9 v6 */
893 .id
= "ARCHER-A9-V6",
896 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
897 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
898 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
899 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
900 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
902 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
904 /* We're using a dynamic kernel/rootfs split here */
906 {"factory-boot", 0x00000, 0x20000},
907 {"fs-uboot", 0x20000, 0x20000},
908 {"partition-table", 0x40000, 0x10000},
909 {"radio", 0x50000, 0x10000},
910 {"default-mac", 0x60000, 0x00200},
911 {"pin", 0x60200, 0x00200},
912 {"device-id", 0x60400, 0x00100},
913 {"product-info", 0x60500, 0x0fb00},
914 {"soft-version", 0x70000, 0x01000},
915 {"extra-para", 0x71000, 0x01000},
916 {"support-list", 0x72000, 0x0a000},
917 {"profile", 0x7c000, 0x04000},
918 {"user-config", 0x80000, 0x10000},
919 {"ap-config", 0x90000, 0x10000},
920 {"apdef-config", 0xa0000, 0x10000},
921 {"router-config", 0xb0000, 0x10000},
922 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
923 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
924 {"log", 0xfc0000, 0x20000},
925 {"certificate", 0xfe0000, 0x10000},
926 {"default-config", 0xff0000, 0x10000},
930 .first_sysupgrade_partition
= "os-image",
931 .last_sysupgrade_partition
= "file-system",
934 /** Firmware layout for the C2v3 */
936 .id
= "ARCHER-C2-V3",
939 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
940 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
941 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
943 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.1\n"),
945 /** We're using a dynamic kernel/rootfs split here */
948 {"factory-boot", 0x00000, 0x20000},
949 {"fs-uboot", 0x20000, 0x10000},
950 {"firmware", 0x30000, 0x7a0000},
951 {"user-config", 0x7d0000, 0x04000},
952 {"default-mac", 0x7e0000, 0x00100},
953 {"device-id", 0x7e0100, 0x00100},
954 {"extra-para", 0x7e0200, 0x00100},
955 {"pin", 0x7e0300, 0x00100},
956 {"support-list", 0x7e0400, 0x00400},
957 {"soft-version", 0x7e0800, 0x00400},
958 {"product-info", 0x7e0c00, 0x01400},
959 {"partition-table", 0x7e2000, 0x01000},
960 {"profile", 0x7e3000, 0x01000},
961 {"default-config", 0x7e4000, 0x04000},
962 {"merge-config", 0x7ec000, 0x02000},
963 {"qos-db", 0x7ee000, 0x02000},
964 {"radio", 0x7f0000, 0x10000},
968 .first_sysupgrade_partition
= "os-image",
969 .last_sysupgrade_partition
= "file-system",
972 /** Firmware layout for the C25v1 */
974 .id
= "ARCHER-C25-V1",
977 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
978 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
979 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
981 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
983 /* We're using a dynamic kernel/rootfs split here */
985 {"factory-boot", 0x00000, 0x20000},
986 {"fs-uboot", 0x20000, 0x10000},
987 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
988 /* Stock: name file-system base 0x130000 size 0x6a0000 */
989 {"user-config", 0x7d0000, 0x04000},
990 {"default-mac", 0x7e0000, 0x00100},
991 {"device-id", 0x7e0100, 0x00100},
992 {"extra-para", 0x7e0200, 0x00100},
993 {"pin", 0x7e0300, 0x00100},
994 {"support-list", 0x7e0400, 0x00400},
995 {"soft-version", 0x7e0800, 0x00400},
996 {"product-info", 0x7e0c00, 0x01400},
997 {"partition-table", 0x7e2000, 0x01000},
998 {"profile", 0x7e3000, 0x01000},
999 {"default-config", 0x7e4000, 0x04000},
1000 {"merge-config", 0x7ec000, 0x02000},
1001 {"qos-db", 0x7ee000, 0x02000},
1002 {"radio", 0x7f0000, 0x10000},
1006 .first_sysupgrade_partition
= "os-image",
1007 .last_sysupgrade_partition
= "file-system",
1010 /** Firmware layout for the C58v1 */
1012 .id
= "ARCHER-C58-V1",
1016 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1017 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1018 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1020 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1023 {"fs-uboot", 0x00000, 0x10000},
1024 {"default-mac", 0x10000, 0x00200},
1025 {"pin", 0x10200, 0x00200},
1026 {"product-info", 0x10400, 0x00100},
1027 {"partition-table", 0x10500, 0x00800},
1028 {"soft-version", 0x11300, 0x00200},
1029 {"support-list", 0x11500, 0x00100},
1030 {"device-id", 0x11600, 0x00100},
1031 {"profile", 0x11700, 0x03900},
1032 {"default-config", 0x15000, 0x04000},
1033 {"user-config", 0x19000, 0x04000},
1034 {"firmware", 0x20000, 0x7c8000},
1035 {"certyficate", 0x7e8000, 0x08000},
1036 {"radio", 0x7f0000, 0x10000},
1040 .first_sysupgrade_partition
= "os-image",
1041 .last_sysupgrade_partition
= "file-system",
1044 /** Firmware layout for the C59v1 */
1046 .id
= "ARCHER-C59-V1",
1050 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1051 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1052 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1053 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1055 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1057 /* We're using a dynamic kernel/rootfs split here */
1059 {"fs-uboot", 0x00000, 0x10000},
1060 {"default-mac", 0x10000, 0x00200},
1061 {"pin", 0x10200, 0x00200},
1062 {"device-id", 0x10400, 0x00100},
1063 {"product-info", 0x10500, 0x0fb00},
1064 {"firmware", 0x20000, 0xe30000},
1065 {"partition-table", 0xe50000, 0x10000},
1066 {"soft-version", 0xe60000, 0x10000},
1067 {"support-list", 0xe70000, 0x10000},
1068 {"profile", 0xe80000, 0x10000},
1069 {"default-config", 0xe90000, 0x10000},
1070 {"user-config", 0xea0000, 0x40000},
1071 {"usb-config", 0xee0000, 0x10000},
1072 {"certificate", 0xef0000, 0x10000},
1073 {"qos-db", 0xf00000, 0x40000},
1074 {"log", 0xfe0000, 0x10000},
1075 {"radio", 0xff0000, 0x10000},
1079 .first_sysupgrade_partition
= "os-image",
1080 .last_sysupgrade_partition
= "file-system",
1083 /** Firmware layout for the C59v2 */
1085 .id
= "ARCHER-C59-V2",
1089 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1090 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1091 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1093 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1095 /** We're using a dynamic kernel/rootfs split here */
1097 {"factory-boot", 0x00000, 0x20000},
1098 {"fs-uboot", 0x20000, 0x10000},
1099 {"default-mac", 0x30000, 0x00200},
1100 {"pin", 0x30200, 0x00200},
1101 {"device-id", 0x30400, 0x00100},
1102 {"product-info", 0x30500, 0x0fb00},
1103 {"firmware", 0x40000, 0xe10000},
1104 {"partition-table", 0xe50000, 0x10000},
1105 {"soft-version", 0xe60000, 0x10000},
1106 {"support-list", 0xe70000, 0x10000},
1107 {"profile", 0xe80000, 0x10000},
1108 {"default-config", 0xe90000, 0x10000},
1109 {"user-config", 0xea0000, 0x40000},
1110 {"usb-config", 0xee0000, 0x10000},
1111 {"certificate", 0xef0000, 0x10000},
1112 {"extra-para", 0xf00000, 0x10000},
1113 {"qos-db", 0xf10000, 0x30000},
1114 {"log", 0xfe0000, 0x10000},
1115 {"radio", 0xff0000, 0x10000},
1119 .first_sysupgrade_partition
= "os-image",
1120 .last_sysupgrade_partition
= "file-system",
1123 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1125 .id
= "ARCHER-C6-V2",
1129 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1130 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1131 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1132 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1134 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1137 {"fs-uboot", 0x00000, 0x20000},
1138 {"default-mac", 0x20000, 0x00200},
1139 {"pin", 0x20200, 0x00100},
1140 {"product-info", 0x20300, 0x00200},
1141 {"device-id", 0x20500, 0x0fb00},
1142 {"firmware", 0x30000, 0x7a9400},
1143 {"soft-version", 0x7d9400, 0x00100},
1144 {"extra-para", 0x7d9500, 0x00100},
1145 {"support-list", 0x7d9600, 0x00200},
1146 {"profile", 0x7d9800, 0x03000},
1147 {"default-config", 0x7dc800, 0x03000},
1148 {"partition-table", 0x7df800, 0x00800},
1149 {"user-config", 0x7e0000, 0x0c000},
1150 {"certificate", 0x7ec000, 0x04000},
1151 {"radio", 0x7f0000, 0x10000},
1155 .first_sysupgrade_partition
= "os-image",
1156 .last_sysupgrade_partition
= "file-system",
1159 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1161 .id
= "ARCHER-C6-V2-US",
1165 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1166 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1167 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1169 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1172 {"factory-boot", 0x00000, 0x20000},
1173 {"default-mac", 0x20000, 0x00200},
1174 {"pin", 0x20200, 0x00100},
1175 {"product-info", 0x20300, 0x00200},
1176 {"device-id", 0x20500, 0x0fb00},
1177 {"fs-uboot", 0x30000, 0x20000},
1178 {"firmware", 0x50000, 0xf89400},
1179 {"soft-version", 0xfd9400, 0x00100},
1180 {"extra-para", 0xfd9500, 0x00100},
1181 {"support-list", 0xfd9600, 0x00200},
1182 {"profile", 0xfd9800, 0x03000},
1183 {"default-config", 0xfdc800, 0x03000},
1184 {"partition-table", 0xfdf800, 0x00800},
1185 {"user-config", 0xfe0000, 0x0c000},
1186 {"certificate", 0xfec000, 0x04000},
1187 {"radio", 0xff0000, 0x10000},
1190 .first_sysupgrade_partition
= "os-image",
1191 .last_sysupgrade_partition
= "file-system",
1193 /** Firmware layout for the Archer C6 v3 */
1195 .id
= "ARCHER-C6-V3",
1199 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1200 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1201 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1202 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1203 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1204 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1206 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1209 {"fs-uboot", 0x00000, 0x40000},
1210 {"firmware", 0x40000, 0xf60000},
1211 {"default-mac", 0xfa0000, 0x00200},
1212 {"pin", 0xfa0200, 0x00100},
1213 {"device-id", 0xfa0300, 0x00100},
1214 {"product-info", 0xfa0400, 0x0fc00},
1215 {"default-config", 0xfb0000, 0x08000},
1216 {"ap-def-config", 0xfb8000, 0x08000},
1217 {"user-config", 0xfc0000, 0x0a000},
1218 {"ag-config", 0xfca000, 0x04000},
1219 {"certificate", 0xfce000, 0x02000},
1220 {"ap-config", 0xfd0000, 0x06000},
1221 {"router-config", 0xfd6000, 0x06000},
1222 {"favicon", 0xfdc000, 0x02000},
1223 {"logo", 0xfde000, 0x02000},
1224 {"partition-table", 0xfe0000, 0x00800},
1225 {"soft-version", 0xfe0800, 0x00100},
1226 {"support-list", 0xfe0900, 0x00200},
1227 {"profile", 0xfe0b00, 0x03000},
1228 {"extra-para", 0xfe3b00, 0x00100},
1229 {"radio", 0xff0000, 0x10000},
1232 .first_sysupgrade_partition
= "os-image",
1233 .last_sysupgrade_partition
= "file-system",
1235 /** Firmware layout for the Archer A6 v3 */
1237 .id
= "ARCHER-A6-V3",
1241 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1242 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1243 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1244 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1246 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1249 {"fs-uboot", 0x00000, 0x40000},
1250 {"firmware", 0x40000, 0xf60000},
1251 {"default-mac", 0xfa0000, 0x00200},
1252 {"pin", 0xfa0200, 0x00100},
1253 {"device-id", 0xfa0300, 0x00100},
1254 {"product-info", 0xfa0400, 0x0fc00},
1255 {"default-config", 0xfb0000, 0x08000},
1256 {"ap-def-config", 0xfb8000, 0x08000},
1257 {"user-config", 0xfc0000, 0x0a000},
1258 {"ag-config", 0xfca000, 0x04000},
1259 {"certificate", 0xfce000, 0x02000},
1260 {"ap-config", 0xfd0000, 0x06000},
1261 {"router-config", 0xfd6000, 0x06000},
1262 {"favicon", 0xfdc000, 0x02000},
1263 {"logo", 0xfde000, 0x02000},
1264 {"partition-table", 0xfe0000, 0x00800},
1265 {"soft-version", 0xfe0800, 0x00100},
1266 {"support-list", 0xfe0900, 0x00200},
1267 {"profile", 0xfe0b00, 0x03000},
1268 {"extra-para", 0xfe3b00, 0x00100},
1269 {"radio", 0xff0000, 0x10000},
1272 .first_sysupgrade_partition
= "os-image",
1273 .last_sysupgrade_partition
= "file-system",
1275 /** Firmware layout for the Archer C6U v1 */
1277 .id
= "ARCHER-C6U-V1",
1281 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1283 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1286 {"fs-uboot", 0x00000, 0x40000},
1287 {"firmware", 0x40000, 0xf60000},
1288 {"default-mac", 0xfa0000, 0x00200},
1289 {"pin", 0xfa0200, 0x00100},
1290 {"device-id", 0xfa0300, 0x00100},
1291 {"product-info", 0xfa0400, 0x0fc00},
1292 {"default-config", 0xfb0000, 0x08000},
1293 {"ap-def-config", 0xfb8000, 0x08000},
1294 {"user-config", 0xfc0000, 0x0c000},
1295 {"certificate", 0xfcc000, 0x04000},
1296 {"ap-config", 0xfd0000, 0x08000},
1297 {"router-config", 0xfd8000, 0x08000},
1298 {"partition-table", 0xfe0000, 0x00800},
1299 {"soft-version", 0xfe0800, 0x00100},
1300 {"support-list", 0xfe0900, 0x00200},
1301 {"profile", 0xfe0b00, 0x03000},
1302 {"extra-para", 0xfe3b00, 0x00100},
1303 {"radio", 0xff0000, 0x10000},
1306 .first_sysupgrade_partition
= "os-image",
1307 .last_sysupgrade_partition
= "file-system",
1309 /** Firmware layout for the C60v1 */
1311 .id
= "ARCHER-C60-V1",
1315 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1316 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1317 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1319 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1322 {"fs-uboot", 0x00000, 0x10000},
1323 {"default-mac", 0x10000, 0x00200},
1324 {"pin", 0x10200, 0x00200},
1325 {"product-info", 0x10400, 0x00100},
1326 {"partition-table", 0x10500, 0x00800},
1327 {"soft-version", 0x11300, 0x00200},
1328 {"support-list", 0x11500, 0x00100},
1329 {"device-id", 0x11600, 0x00100},
1330 {"profile", 0x11700, 0x03900},
1331 {"default-config", 0x15000, 0x04000},
1332 {"user-config", 0x19000, 0x04000},
1333 {"firmware", 0x20000, 0x7c8000},
1334 {"certyficate", 0x7e8000, 0x08000},
1335 {"radio", 0x7f0000, 0x10000},
1339 .first_sysupgrade_partition
= "os-image",
1340 .last_sysupgrade_partition
= "file-system",
1343 /** Firmware layout for the C60v2 */
1345 .id
= "ARCHER-C60-V2",
1349 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1350 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1351 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1353 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1356 {"factory-boot", 0x00000, 0x1fb00},
1357 {"default-mac", 0x1fb00, 0x00200},
1358 {"pin", 0x1fd00, 0x00100},
1359 {"product-info", 0x1fe00, 0x00100},
1360 {"device-id", 0x1ff00, 0x00100},
1361 {"fs-uboot", 0x20000, 0x10000},
1362 {"firmware", 0x30000, 0x7a0000},
1363 {"soft-version", 0x7d9500, 0x00100},
1364 {"support-list", 0x7d9600, 0x00100},
1365 {"extra-para", 0x7d9700, 0x00100},
1366 {"profile", 0x7d9800, 0x03000},
1367 {"default-config", 0x7dc800, 0x03000},
1368 {"partition-table", 0x7df800, 0x00800},
1369 {"user-config", 0x7e0000, 0x0c000},
1370 {"certificate", 0x7ec000, 0x04000},
1371 {"radio", 0x7f0000, 0x10000},
1375 .first_sysupgrade_partition
= "os-image",
1376 .last_sysupgrade_partition
= "file-system",
1379 /** Firmware layout for the C60v3 */
1381 .id
= "ARCHER-C60-V3",
1385 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1386 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1387 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1389 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1392 {"factory-boot", 0x00000, 0x1fb00},
1393 {"default-mac", 0x1fb00, 0x00200},
1394 {"pin", 0x1fd00, 0x00100},
1395 {"product-info", 0x1fe00, 0x00100},
1396 {"device-id", 0x1ff00, 0x00100},
1397 {"fs-uboot", 0x20000, 0x10000},
1398 {"firmware", 0x30000, 0x7a0000},
1399 {"soft-version", 0x7d9500, 0x00100},
1400 {"support-list", 0x7d9600, 0x00100},
1401 {"extra-para", 0x7d9700, 0x00100},
1402 {"profile", 0x7d9800, 0x03000},
1403 {"default-config", 0x7dc800, 0x03000},
1404 {"partition-table", 0x7df800, 0x00800},
1405 {"user-config", 0x7e0000, 0x0c000},
1406 {"certificate", 0x7ec000, 0x04000},
1407 {"radio", 0x7f0000, 0x10000},
1411 .first_sysupgrade_partition
= "os-image",
1412 .last_sysupgrade_partition
= "file-system",
1415 /** Firmware layout for the C5 */
1417 .id
= "ARCHER-C5-V2",
1421 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1422 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1423 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1425 .soft_ver
= SOFT_VER_DEFAULT
,
1428 {"fs-uboot", 0x00000, 0x40000},
1429 {"os-image", 0x40000, 0x200000},
1430 {"file-system", 0x240000, 0xc00000},
1431 {"default-mac", 0xe40000, 0x00200},
1432 {"pin", 0xe40200, 0x00200},
1433 {"product-info", 0xe40400, 0x00200},
1434 {"partition-table", 0xe50000, 0x10000},
1435 {"soft-version", 0xe60000, 0x00200},
1436 {"support-list", 0xe61000, 0x0f000},
1437 {"profile", 0xe70000, 0x10000},
1438 {"default-config", 0xe80000, 0x10000},
1439 {"user-config", 0xe90000, 0x50000},
1440 {"log", 0xee0000, 0x100000},
1441 {"radio_bk", 0xfe0000, 0x10000},
1442 {"radio", 0xff0000, 0x10000},
1446 .first_sysupgrade_partition
= "os-image",
1447 .last_sysupgrade_partition
= "file-system"
1450 /** Firmware layout for the C7 */
1452 .id
= "ARCHER-C7-V4",
1455 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1456 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1457 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1458 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1459 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1460 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1461 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1462 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1463 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1464 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1466 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1468 /* We're using a dynamic kernel/rootfs split here */
1470 {"factory-boot", 0x00000, 0x20000},
1471 {"fs-uboot", 0x20000, 0x20000},
1472 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1473 /* Stock: name file-system base 0x160000 size 0xda0000 */
1474 {"default-mac", 0xf00000, 0x00200},
1475 {"pin", 0xf00200, 0x00200},
1476 {"device-id", 0xf00400, 0x00100},
1477 {"product-info", 0xf00500, 0x0fb00},
1478 {"soft-version", 0xf10000, 0x00100},
1479 {"extra-para", 0xf11000, 0x01000},
1480 {"support-list", 0xf12000, 0x0a000},
1481 {"profile", 0xf1c000, 0x04000},
1482 {"default-config", 0xf20000, 0x10000},
1483 {"user-config", 0xf30000, 0x40000},
1484 {"qos-db", 0xf70000, 0x40000},
1485 {"certificate", 0xfb0000, 0x10000},
1486 {"partition-table", 0xfc0000, 0x10000},
1487 {"log", 0xfd0000, 0x20000},
1488 {"radio", 0xff0000, 0x10000},
1492 .first_sysupgrade_partition
= "os-image",
1493 .last_sysupgrade_partition
= "file-system",
1496 /** Firmware layout for the C7 v5*/
1498 .id
= "ARCHER-C7-V5",
1501 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1502 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1503 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1504 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1505 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1506 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1507 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1508 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1511 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1513 /* We're using a dynamic kernel/rootfs split here */
1515 {"factory-boot", 0x00000, 0x20000},
1516 {"fs-uboot", 0x20000, 0x20000},
1517 {"partition-table", 0x40000, 0x10000},
1518 {"radio", 0x50000, 0x10000},
1519 {"default-mac", 0x60000, 0x00200},
1520 {"pin", 0x60200, 0x00200},
1521 {"device-id", 0x60400, 0x00100},
1522 {"product-info", 0x60500, 0x0fb00},
1523 {"soft-version", 0x70000, 0x01000},
1524 {"extra-para", 0x71000, 0x01000},
1525 {"support-list", 0x72000, 0x0a000},
1526 {"profile", 0x7c000, 0x04000},
1527 {"user-config", 0x80000, 0x40000},
1530 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1531 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1533 {"log", 0xfc0000, 0x20000},
1534 {"certificate", 0xfe0000, 0x10000},
1535 {"default-config", 0xff0000, 0x10000},
1540 .first_sysupgrade_partition
= "os-image",
1541 .last_sysupgrade_partition
= "file-system",
1544 /** Firmware layout for the C9 */
1550 "{product_name:ArcherC9,"
1551 "product_ver:1.0.0,"
1552 "special_id:00000000}\n",
1554 .soft_ver
= SOFT_VER_DEFAULT
,
1557 {"fs-uboot", 0x00000, 0x40000},
1558 {"os-image", 0x40000, 0x200000},
1559 {"file-system", 0x240000, 0xc00000},
1560 {"default-mac", 0xe40000, 0x00200},
1561 {"pin", 0xe40200, 0x00200},
1562 {"product-info", 0xe40400, 0x00200},
1563 {"partition-table", 0xe50000, 0x10000},
1564 {"soft-version", 0xe60000, 0x00200},
1565 {"support-list", 0xe61000, 0x0f000},
1566 {"profile", 0xe70000, 0x10000},
1567 {"default-config", 0xe80000, 0x10000},
1568 {"user-config", 0xe90000, 0x50000},
1569 {"log", 0xee0000, 0x100000},
1570 {"radio_bk", 0xfe0000, 0x10000},
1571 {"radio", 0xff0000, 0x10000},
1575 .first_sysupgrade_partition
= "os-image",
1576 .last_sysupgrade_partition
= "file-system"
1579 /** Firmware layout for the Deco M4R v1 and v2 */
1581 .id
= "DECO-M4R-V1",
1585 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1586 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1587 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1588 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1589 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1590 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1591 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1592 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1593 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1594 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1595 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1596 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1597 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1598 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1599 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1600 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1602 .soft_ver
= SOFT_VER_DEFAULT
,
1605 {"fs-uboot", 0x00000, 0x80000},
1606 {"firmware", 0x80000, 0xe00000},
1607 {"product-info", 0xe80000, 0x05000},
1608 {"default-mac", 0xe85000, 0x01000},
1609 {"device-id", 0xe86000, 0x01000},
1610 {"support-list", 0xe87000, 0x10000},
1611 {"user-config", 0xea7000, 0x10000},
1612 {"device-config", 0xeb7000, 0x10000},
1613 {"group-info", 0xec7000, 0x10000},
1614 {"partition-table", 0xed7000, 0x02000},
1615 {"soft-version", 0xed9000, 0x10000},
1616 {"profile", 0xee9000, 0x10000},
1617 {"default-config", 0xef9000, 0x10000},
1618 {"url-sig", 0xfe0000, 0x10000},
1619 {"radio", 0xff0000, 0x10000},
1622 .first_sysupgrade_partition
= "os-image",
1623 .last_sysupgrade_partition
= "file-system",
1626 /** Firmware layout for the Deco M4R v4 */
1628 .id
= "DECO-M4R-V4",
1632 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1633 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1634 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1635 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1636 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1638 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1641 {"fs-uboot", 0x00000, 0x40000},
1642 {"firmware", 0x40000, 0xf60000},
1643 {"default-mac", 0xfa0000, 0x00300},
1644 {"device-id", 0xfa0300, 0x00100},
1645 {"product-info", 0xfa0400, 0x0fc00},
1646 {"group-info", 0xfb0000, 0x04000},
1647 {"user-config", 0xfb4000, 0x0c000},
1648 {"device-config", 0xfc0000, 0x10000},
1649 {"default-config", 0xfd0000, 0x10000},
1650 {"partition-table", 0xfe0000, 0x00800},
1651 {"soft-version", 0xfe0800, 0x00100},
1652 {"support-list", 0xfe0900, 0x00200},
1653 {"profile", 0xfe0b00, 0x03000},
1654 {"extra-para", 0xfe3b00, 0x00100},
1655 {"radio", 0xff0000, 0x10000},
1658 .first_sysupgrade_partition
= "os-image",
1659 .last_sysupgrade_partition
= "file-system",
1662 /** Firmware layout for the Deco S4 v2 */
1668 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1669 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1670 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1671 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1672 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1673 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1674 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1675 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1676 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1677 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1678 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1679 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1681 .soft_ver
= SOFT_VER_DEFAULT
,
1684 {"fs-uboot", 0x00000, 0x80000},
1685 {"product-info", 0x80000, 0x05000},
1686 {"default-mac", 0x85000, 0x01000},
1687 {"device-id", 0x86000, 0x01000},
1688 {"support-list", 0x87000, 0x10000},
1689 {"user-config", 0xa7000, 0x10000},
1690 {"device-config", 0xb7000, 0x10000},
1691 {"group-info", 0xc7000, 0x10000},
1692 {"partition-table", 0xd7000, 0x02000},
1693 {"soft-version", 0xd9000, 0x10000},
1694 {"profile", 0xe9000, 0x10000},
1695 {"default-config", 0xf9000, 0x10000},
1696 {"url-sig", 0x1e0000, 0x10000},
1697 {"radio", 0x1f0000, 0x10000},
1698 {"firmware", 0x200000, 0xe00000},
1701 .first_sysupgrade_partition
= "os-image",
1702 .last_sysupgrade_partition
= "file-system",
1705 /** Firmware layout for the EAP120 */
1708 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1711 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1713 .soft_ver
= SOFT_VER_DEFAULT
,
1716 {"fs-uboot", 0x00000, 0x20000},
1717 {"partition-table", 0x20000, 0x02000},
1718 {"default-mac", 0x30000, 0x00020},
1719 {"support-list", 0x31000, 0x00100},
1720 {"product-info", 0x31100, 0x00100},
1721 {"soft-version", 0x32000, 0x00100},
1722 {"os-image", 0x40000, 0x180000},
1723 {"file-system", 0x1c0000, 0x600000},
1724 {"user-config", 0x7c0000, 0x10000},
1725 {"backup-config", 0x7d0000, 0x10000},
1726 {"log", 0x7e0000, 0x10000},
1727 {"radio", 0x7f0000, 0x10000},
1731 .first_sysupgrade_partition
= "os-image",
1732 .last_sysupgrade_partition
= "file-system"
1735 /** Firmware layout for the EAP225-Outdoor v1 */
1737 .id
= "EAP225-OUTDOOR-V1",
1740 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1741 .part_trail
= PART_TRAIL_NONE
,
1742 .soft_ver
= SOFT_VER_DEFAULT
,
1743 .soft_ver_compat_level
= 1,
1746 {"fs-uboot", 0x00000, 0x20000},
1747 {"partition-table", 0x20000, 0x02000},
1748 {"default-mac", 0x30000, 0x01000},
1749 {"support-list", 0x31000, 0x00100},
1750 {"product-info", 0x31100, 0x00400},
1751 {"soft-version", 0x32000, 0x00100},
1752 {"firmware", 0x40000, 0xd80000},
1753 {"user-config", 0xdc0000, 0x30000},
1754 {"mutil-log", 0xf30000, 0x80000},
1755 {"oops", 0xfb0000, 0x40000},
1756 {"radio", 0xff0000, 0x10000},
1760 .first_sysupgrade_partition
= "os-image",
1761 .last_sysupgrade_partition
= "file-system"
1764 /** Firmware layout for the EAP225 v1 */
1769 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1770 .part_trail
= PART_TRAIL_NONE
,
1771 .soft_ver
= SOFT_VER_DEFAULT
,
1774 {"fs-uboot", 0x00000, 0x20000},
1775 {"partition-table", 0x20000, 0x02000},
1776 {"default-mac", 0x30000, 0x01000},
1777 {"support-list", 0x31000, 0x00100},
1778 {"product-info", 0x31100, 0x00400},
1779 {"soft-version", 0x32000, 0x00100},
1780 {"firmware", 0x40000, 0xd80000},
1781 {"user-config", 0xdc0000, 0x30000},
1782 {"radio", 0xff0000, 0x10000},
1786 .first_sysupgrade_partition
= "os-image",
1787 .last_sysupgrade_partition
= "file-system"
1790 /** Firmware layout for the EAP225 v3
1791 * Also compatible with:
1794 * - EAP225-Outdoor v1
1795 * - EAP225-Outdoor v3
1801 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1802 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1803 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1804 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1805 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1806 .part_trail
= PART_TRAIL_NONE
,
1807 .soft_ver
= SOFT_VER_DEFAULT
,
1808 .soft_ver_compat_level
= 1,
1811 {"fs-uboot", 0x00000, 0x20000},
1812 {"partition-table", 0x20000, 0x02000},
1813 {"default-mac", 0x30000, 0x01000},
1814 {"support-list", 0x31000, 0x00100},
1815 {"product-info", 0x31100, 0x00400},
1816 {"soft-version", 0x32000, 0x00100},
1817 {"firmware", 0x40000, 0xd80000},
1818 {"user-config", 0xdc0000, 0x30000},
1819 {"mutil-log", 0xf30000, 0x80000},
1820 {"oops", 0xfb0000, 0x40000},
1821 {"radio", 0xff0000, 0x10000},
1825 .first_sysupgrade_partition
= "os-image",
1826 .last_sysupgrade_partition
= "file-system"
1829 /** Firmware layout for the EAP225-Wall v2 */
1831 .id
= "EAP225-WALL-V2",
1834 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1835 .part_trail
= PART_TRAIL_NONE
,
1836 .soft_ver
= SOFT_VER_DEFAULT
,
1837 .soft_ver_compat_level
= 1,
1840 {"fs-uboot", 0x00000, 0x20000},
1841 {"partition-table", 0x20000, 0x02000},
1842 {"default-mac", 0x30000, 0x01000},
1843 {"support-list", 0x31000, 0x00100},
1844 {"product-info", 0x31100, 0x00400},
1845 {"soft-version", 0x32000, 0x00100},
1846 {"firmware", 0x40000, 0xd80000},
1847 {"user-config", 0xdc0000, 0x30000},
1848 {"mutil-log", 0xf30000, 0x80000},
1849 {"oops", 0xfb0000, 0x40000},
1850 {"radio", 0xff0000, 0x10000},
1854 .first_sysupgrade_partition
= "os-image",
1855 .last_sysupgrade_partition
= "file-system"
1858 /** Firmware layout for the EAP235-Wall v1 */
1860 .id
= "EAP235-WALL-V1",
1863 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1864 .part_trail
= PART_TRAIL_NONE
,
1865 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1866 .soft_ver_compat_level
= 1,
1869 {"fs-uboot", 0x00000, 0x80000},
1870 {"partition-table", 0x80000, 0x02000},
1871 {"default-mac", 0x90000, 0x01000},
1872 {"support-list", 0x91000, 0x00100},
1873 {"product-info", 0x91100, 0x00400},
1874 {"soft-version", 0x92000, 0x00100},
1875 {"firmware", 0xa0000, 0xd20000},
1876 {"user-config", 0xdc0000, 0x30000},
1877 {"mutil-log", 0xf30000, 0x80000},
1878 {"oops", 0xfb0000, 0x40000},
1879 {"radio", 0xff0000, 0x10000},
1883 .first_sysupgrade_partition
= "os-image",
1884 .last_sysupgrade_partition
= "file-system"
1887 /** Firmware layout for the EAP245 v1 */
1892 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1893 .part_trail
= PART_TRAIL_NONE
,
1894 .soft_ver
= SOFT_VER_DEFAULT
,
1897 {"fs-uboot", 0x00000, 0x20000},
1898 {"partition-table", 0x20000, 0x02000},
1899 {"default-mac", 0x30000, 0x01000},
1900 {"support-list", 0x31000, 0x00100},
1901 {"product-info", 0x31100, 0x00400},
1902 {"soft-version", 0x32000, 0x00100},
1903 {"firmware", 0x40000, 0xd80000},
1904 {"user-config", 0xdc0000, 0x30000},
1905 {"radio", 0xff0000, 0x10000},
1909 .first_sysupgrade_partition
= "os-image",
1910 .last_sysupgrade_partition
= "file-system"
1913 /** Firmware layout for the EAP245 v3 */
1918 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
1919 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
1920 .part_trail
= PART_TRAIL_NONE
,
1921 .soft_ver
= SOFT_VER_DEFAULT
,
1922 .soft_ver_compat_level
= 1,
1924 /** Firmware partition with dynamic kernel/rootfs split */
1926 {"factroy-boot", 0x00000, 0x40000},
1927 {"fs-uboot", 0x40000, 0x40000},
1928 {"partition-table", 0x80000, 0x10000},
1929 {"default-mac", 0x90000, 0x01000},
1930 {"support-list", 0x91000, 0x00100},
1931 {"product-info", 0x91100, 0x00400},
1932 {"soft-version", 0x92000, 0x00100},
1933 {"radio", 0xa0000, 0x10000},
1934 {"extra-para", 0xb0000, 0x10000},
1935 {"firmware", 0xc0000, 0xe40000},
1936 {"config", 0xf00000, 0x30000},
1937 {"mutil-log", 0xf30000, 0x80000},
1938 {"oops", 0xfb0000, 0x40000},
1942 .first_sysupgrade_partition
= "os-image",
1943 .last_sysupgrade_partition
= "file-system"
1946 /** Firmware layout for the EAP615-Wall v1 */
1948 .id
= "EAP615-WALL-V1",
1949 .soft_ver
= SOFT_VER_DEFAULT
,
1950 .soft_ver_compat_level
= 1,
1953 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
1954 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
1955 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
1956 .part_trail
= PART_TRAIL_NONE
,
1959 {"fs-uboot", 0x00000, 0x80000},
1960 {"partition-table", 0x80000, 0x02000},
1961 {"default-mac", 0x90000, 0x01000},
1962 {"support-list", 0x91000, 0x00100},
1963 {"product-info", 0x91100, 0x00400},
1964 {"soft-version", 0x92000, 0x00100},
1965 {"firmware", 0xa0000, 0xcf0000},
1966 {"user-config", 0xd90000, 0x60000},
1967 {"mutil-log", 0xf30000, 0x80000},
1968 {"oops", 0xfb0000, 0x40000},
1969 {"radio", 0xff0000, 0x10000},
1973 .first_sysupgrade_partition
= "os-image",
1974 .last_sysupgrade_partition
= "file-system"
1977 /** Firmware layout for the TL-WA1201 v2 */
1979 .id
= "TL-WA1201-V2",
1983 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
1984 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
1986 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
1989 {"fs-uboot", 0x00000, 0x20000},
1990 {"default-mac", 0x20000, 0x00200},
1991 {"pin", 0x20200, 0x00100},
1992 {"product-info", 0x20300, 0x00200},
1993 {"device-id", 0x20500, 0x0fb00},
1994 {"firmware", 0x30000, 0xce0000},
1995 {"portal-logo", 0xd10000, 0x20000},
1996 {"portal-back", 0xd30000, 0x200000},
1997 {"soft-version", 0xf30000, 0x00200},
1998 {"extra-para", 0xf30200, 0x00200},
1999 {"support-list", 0xf30400, 0x00200},
2000 {"profile", 0xf30600, 0x0fa00},
2001 {"apdef-config", 0xf40000, 0x10000},
2002 {"ap-config", 0xf50000, 0x10000},
2003 {"redef-config", 0xf60000, 0x10000},
2004 {"re-config", 0xf70000, 0x10000},
2005 {"multidef-config", 0xf80000, 0x10000},
2006 {"multi-config", 0xf90000, 0x10000},
2007 {"clientdef-config", 0xfa0000, 0x10000},
2008 {"client-config", 0xfb0000, 0x10000},
2009 {"partition-table", 0xfc0000, 0x10000},
2010 {"user-config", 0xfd0000, 0x10000},
2011 {"certificate", 0xfe0000, 0x10000},
2012 {"radio", 0xff0000, 0x10000},
2015 .first_sysupgrade_partition
= "os-image",
2016 .last_sysupgrade_partition
= "file-system",
2019 /** Firmware layout for the TL-WA850RE v2 */
2021 .id
= "TLWA850REV2",
2025 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2026 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2027 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2028 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2029 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2030 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2031 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2032 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2033 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2034 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2036 .soft_ver
= SOFT_VER_DEFAULT
,
2039 576KB were moved from file-system to os-image
2040 in comparison to the stock image
2043 {"fs-uboot", 0x00000, 0x20000},
2044 {"firmware", 0x20000, 0x390000},
2045 {"partition-table", 0x3b0000, 0x02000},
2046 {"default-mac", 0x3c0000, 0x00020},
2047 {"pin", 0x3c0100, 0x00020},
2048 {"product-info", 0x3c1000, 0x01000},
2049 {"soft-version", 0x3c2000, 0x00100},
2050 {"support-list", 0x3c3000, 0x01000},
2051 {"profile", 0x3c4000, 0x08000},
2052 {"user-config", 0x3d0000, 0x10000},
2053 {"default-config", 0x3e0000, 0x10000},
2054 {"radio", 0x3f0000, 0x10000},
2058 .first_sysupgrade_partition
= "os-image",
2059 .last_sysupgrade_partition
= "file-system"
2062 /** Firmware layout for the TL-WA855RE v1 */
2064 .id
= "TLWA855REV1",
2068 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2069 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2070 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2071 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2072 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2073 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2074 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2075 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2076 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2078 .soft_ver
= SOFT_VER_DEFAULT
,
2081 {"fs-uboot", 0x00000, 0x20000},
2082 {"os-image", 0x20000, 0x150000},
2083 {"file-system", 0x170000, 0x240000},
2084 {"partition-table", 0x3b0000, 0x02000},
2085 {"default-mac", 0x3c0000, 0x00020},
2086 {"pin", 0x3c0100, 0x00020},
2087 {"product-info", 0x3c1000, 0x01000},
2088 {"soft-version", 0x3c2000, 0x00100},
2089 {"support-list", 0x3c3000, 0x01000},
2090 {"profile", 0x3c4000, 0x08000},
2091 {"user-config", 0x3d0000, 0x10000},
2092 {"default-config", 0x3e0000, 0x10000},
2093 {"radio", 0x3f0000, 0x10000},
2097 .first_sysupgrade_partition
= "os-image",
2098 .last_sysupgrade_partition
= "file-system"
2101 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2103 .id
= "TL-WPA8630P-V2.0-EU",
2107 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2109 .soft_ver
= SOFT_VER_DEFAULT
,
2112 {"factory-uboot", 0x00000, 0x20000},
2113 {"fs-uboot", 0x20000, 0x20000},
2114 {"firmware", 0x40000, 0x5e0000},
2115 {"partition-table", 0x620000, 0x02000},
2116 {"default-mac", 0x630000, 0x00020},
2117 {"pin", 0x630100, 0x00020},
2118 {"device-id", 0x630200, 0x00030},
2119 {"product-info", 0x631100, 0x01000},
2120 {"extra-para", 0x632100, 0x01000},
2121 {"soft-version", 0x640000, 0x01000},
2122 {"support-list", 0x641000, 0x01000},
2123 {"profile", 0x642000, 0x08000},
2124 {"user-config", 0x650000, 0x10000},
2125 {"default-config", 0x660000, 0x10000},
2126 {"default-nvm", 0x670000, 0xc0000},
2127 {"default-pib", 0x730000, 0x40000},
2128 {"radio", 0x7f0000, 0x10000},
2132 .first_sysupgrade_partition
= "os-image",
2133 .last_sysupgrade_partition
= "file-system"
2136 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2138 .id
= "TL-WPA8630P-V2-INT",
2142 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2143 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2144 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2146 .soft_ver
= SOFT_VER_DEFAULT
,
2149 {"factory-uboot", 0x00000, 0x20000},
2150 {"fs-uboot", 0x20000, 0x20000},
2151 {"firmware", 0x40000, 0x5e0000},
2152 {"partition-table", 0x620000, 0x02000},
2153 {"extra-para", 0x632100, 0x01000},
2154 {"soft-version", 0x640000, 0x01000},
2155 {"support-list", 0x641000, 0x01000},
2156 {"profile", 0x642000, 0x08000},
2157 {"user-config", 0x650000, 0x10000},
2158 {"default-config", 0x660000, 0x10000},
2159 {"default-nvm", 0x670000, 0xc0000},
2160 {"default-pib", 0x730000, 0x40000},
2161 {"default-mac", 0x7e0000, 0x00020},
2162 {"pin", 0x7e0100, 0x00020},
2163 {"device-id", 0x7e0200, 0x00030},
2164 {"product-info", 0x7e1100, 0x01000},
2165 {"radio", 0x7f0000, 0x10000},
2169 .first_sysupgrade_partition
= "os-image",
2170 .last_sysupgrade_partition
= "file-system"
2173 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2175 .id
= "TL-WPA8630P-V2.1-EU",
2179 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2181 .soft_ver
= SOFT_VER_DEFAULT
,
2184 {"factory-uboot", 0x00000, 0x20000},
2185 {"fs-uboot", 0x20000, 0x20000},
2186 {"firmware", 0x40000, 0x5e0000},
2187 {"extra-para", 0x680000, 0x01000},
2188 {"product-info", 0x690000, 0x01000},
2189 {"partition-table", 0x6a0000, 0x02000},
2190 {"soft-version", 0x6b0000, 0x01000},
2191 {"support-list", 0x6b1000, 0x01000},
2192 {"profile", 0x6b2000, 0x08000},
2193 {"user-config", 0x6c0000, 0x10000},
2194 {"default-config", 0x6d0000, 0x10000},
2195 {"default-nvm", 0x6e0000, 0xc0000},
2196 {"default-pib", 0x7a0000, 0x40000},
2197 {"default-mac", 0x7e0000, 0x00020},
2198 {"pin", 0x7e0100, 0x00020},
2199 {"device-id", 0x7e0200, 0x00030},
2200 {"radio", 0x7f0000, 0x10000},
2204 .first_sysupgrade_partition
= "os-image",
2205 .last_sysupgrade_partition
= "file-system"
2208 /** Firmware layout for the TL-WPA8631P v3 */
2210 .id
= "TL-WPA8631P-V3",
2214 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2215 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2216 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2218 .soft_ver
= SOFT_VER_DEFAULT
,
2221 {"fs-uboot", 0x00000, 0x20000},
2222 {"firmware", 0x20000, 0x710000},
2223 {"partition-table", 0x730000, 0x02000},
2224 {"default-mac", 0x732000, 0x00020},
2225 {"pin", 0x732100, 0x00020},
2226 {"device-id", 0x732200, 0x00030},
2227 {"default-region", 0x732300, 0x00010},
2228 {"product-info", 0x732400, 0x00200},
2229 {"extra-para", 0x732600, 0x00200},
2230 {"soft-version", 0x732800, 0x00200},
2231 {"support-list", 0x732a00, 0x00100},
2232 {"profile", 0x732b00, 0x00100},
2233 {"default-config", 0x732c00, 0x00800},
2234 {"plc-type", 0x733400, 0x00020},
2235 {"default-pib", 0x733500, 0x06000},
2236 {"user-config", 0x740000, 0x10000},
2237 {"plc-pib", 0x750000, 0x10000},
2238 {"plc-nvm", 0x760000, 0x90000},
2239 {"radio", 0x7f0000, 0x10000},
2243 .first_sysupgrade_partition
= "os-image",
2244 .last_sysupgrade_partition
= "file-system"
2247 /** Firmware layout for the TL-WR1043 v5 */
2249 .id
= "TLWR1043NV5",
2253 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2254 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2256 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2258 {"factory-boot", 0x00000, 0x20000},
2259 {"fs-uboot", 0x20000, 0x20000},
2260 {"firmware", 0x40000, 0xec0000},
2261 {"default-mac", 0xf00000, 0x00200},
2262 {"pin", 0xf00200, 0x00200},
2263 {"device-id", 0xf00400, 0x00100},
2264 {"product-info", 0xf00500, 0x0fb00},
2265 {"soft-version", 0xf10000, 0x01000},
2266 {"extra-para", 0xf11000, 0x01000},
2267 {"support-list", 0xf12000, 0x0a000},
2268 {"profile", 0xf1c000, 0x04000},
2269 {"default-config", 0xf20000, 0x10000},
2270 {"user-config", 0xf30000, 0x40000},
2271 {"qos-db", 0xf70000, 0x40000},
2272 {"certificate", 0xfb0000, 0x10000},
2273 {"partition-table", 0xfc0000, 0x10000},
2274 {"log", 0xfd0000, 0x20000},
2275 {"radio", 0xff0000, 0x10000},
2278 .first_sysupgrade_partition
= "os-image",
2279 .last_sysupgrade_partition
= "file-system"
2282 /** Firmware layout for the TL-WR1043 v4 */
2284 .id
= "TLWR1043NDV4",
2288 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2290 .soft_ver
= SOFT_VER_DEFAULT
,
2292 /* We're using a dynamic kernel/rootfs split here */
2294 {"fs-uboot", 0x00000, 0x20000},
2295 {"firmware", 0x20000, 0xf30000},
2296 {"default-mac", 0xf50000, 0x00200},
2297 {"pin", 0xf50200, 0x00200},
2298 {"product-info", 0xf50400, 0x0fc00},
2299 {"soft-version", 0xf60000, 0x0b000},
2300 {"support-list", 0xf6b000, 0x04000},
2301 {"profile", 0xf70000, 0x04000},
2302 {"default-config", 0xf74000, 0x0b000},
2303 {"user-config", 0xf80000, 0x40000},
2304 {"partition-table", 0xfc0000, 0x10000},
2305 {"log", 0xfd0000, 0x20000},
2306 {"radio", 0xff0000, 0x10000},
2310 .first_sysupgrade_partition
= "os-image",
2311 .last_sysupgrade_partition
= "file-system"
2314 /** Firmware layout for the TL-WR902AC v1 */
2316 .id
= "TL-WR902AC-V1",
2320 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2321 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2323 .soft_ver
= SOFT_VER_DEFAULT
,
2326 384KB were moved from file-system to os-image
2327 in comparison to the stock image
2330 {"fs-uboot", 0x00000, 0x20000},
2331 {"firmware", 0x20000, 0x730000},
2332 {"default-mac", 0x750000, 0x00200},
2333 {"pin", 0x750200, 0x00200},
2334 {"product-info", 0x750400, 0x0fc00},
2335 {"soft-version", 0x760000, 0x0b000},
2336 {"support-list", 0x76b000, 0x04000},
2337 {"profile", 0x770000, 0x04000},
2338 {"default-config", 0x774000, 0x0b000},
2339 {"user-config", 0x780000, 0x40000},
2340 {"partition-table", 0x7c0000, 0x10000},
2341 {"log", 0x7d0000, 0x20000},
2342 {"radio", 0x7f0000, 0x10000},
2346 .first_sysupgrade_partition
= "os-image",
2347 .last_sysupgrade_partition
= "file-system",
2350 /** Firmware layout for the TL-WR941HP v1 */
2352 .id
= "TL-WR941HP-V1",
2356 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2358 .soft_ver
= SOFT_VER_DEFAULT
,
2361 {"fs-uboot", 0x00000, 0x20000},
2362 {"firmware", 0x20000, 0x730000},
2363 {"default-mac", 0x750000, 0x00200},
2364 {"pin", 0x750200, 0x00200},
2365 {"product-info", 0x750400, 0x0fc00},
2366 {"soft-version", 0x760000, 0x0b000},
2367 {"support-list", 0x76b000, 0x04000},
2368 {"profile", 0x770000, 0x04000},
2369 {"default-config", 0x774000, 0x0b000},
2370 {"user-config", 0x780000, 0x40000},
2371 {"partition-table", 0x7c0000, 0x10000},
2372 {"log", 0x7d0000, 0x20000},
2373 {"radio", 0x7f0000, 0x10000},
2377 .first_sysupgrade_partition
= "os-image",
2378 .last_sysupgrade_partition
= "file-system",
2381 /** Firmware layout for the TL-WR942N V1 */
2387 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2388 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2390 .soft_ver
= SOFT_VER_DEFAULT
,
2393 {"fs-uboot", 0x00000, 0x20000},
2394 {"firmware", 0x20000, 0xe20000},
2395 {"default-mac", 0xe40000, 0x00200},
2396 {"pin", 0xe40200, 0x00200},
2397 {"product-info", 0xe40400, 0x0fc00},
2398 {"partition-table", 0xe50000, 0x10000},
2399 {"soft-version", 0xe60000, 0x10000},
2400 {"support-list", 0xe70000, 0x10000},
2401 {"profile", 0xe80000, 0x10000},
2402 {"default-config", 0xe90000, 0x10000},
2403 {"user-config", 0xea0000, 0x40000},
2404 {"qos-db", 0xee0000, 0x40000},
2405 {"certificate", 0xf20000, 0x10000},
2406 {"usb-config", 0xfb0000, 0x10000},
2407 {"log", 0xfc0000, 0x20000},
2408 {"radio-bk", 0xfe0000, 0x10000},
2409 {"radio", 0xff0000, 0x10000},
2413 .first_sysupgrade_partition
= "os-image",
2414 .last_sysupgrade_partition
= "file-system",
2417 /** Firmware layout for the RE200 v2 */
2423 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2424 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2425 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2426 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2427 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2428 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2429 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2430 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2431 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2432 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2433 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2434 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2435 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2437 .soft_ver
= SOFT_VER_DEFAULT
,
2440 {"fs-uboot", 0x00000, 0x20000},
2441 {"firmware", 0x20000, 0x7a0000},
2442 {"partition-table", 0x7c0000, 0x02000},
2443 {"default-mac", 0x7c2000, 0x00020},
2444 {"pin", 0x7c2100, 0x00020},
2445 {"product-info", 0x7c3100, 0x01000},
2446 {"soft-version", 0x7c4200, 0x01000},
2447 {"support-list", 0x7c5200, 0x01000},
2448 {"profile", 0x7c6200, 0x08000},
2449 {"config-info", 0x7ce200, 0x00400},
2450 {"user-config", 0x7d0000, 0x10000},
2451 {"default-config", 0x7e0000, 0x10000},
2452 {"radio", 0x7f0000, 0x10000},
2456 .first_sysupgrade_partition
= "os-image",
2457 .last_sysupgrade_partition
= "file-system"
2460 /** Firmware layout for the RE200 v3 */
2466 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2467 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2468 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2469 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2470 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2471 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2472 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2473 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2474 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2475 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2476 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2477 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2478 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2479 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2481 .soft_ver
= SOFT_VER_DEFAULT
,
2484 {"fs-uboot", 0x00000, 0x20000},
2485 {"firmware", 0x20000, 0x7a0000},
2486 {"partition-table", 0x7c0000, 0x02000},
2487 {"default-mac", 0x7c2000, 0x00020},
2488 {"pin", 0x7c2100, 0x00020},
2489 {"product-info", 0x7c3100, 0x01000},
2490 {"soft-version", 0x7c4200, 0x01000},
2491 {"support-list", 0x7c5200, 0x01000},
2492 {"profile", 0x7c6200, 0x08000},
2493 {"config-info", 0x7ce200, 0x00400},
2494 {"user-config", 0x7d0000, 0x10000},
2495 {"default-config", 0x7e0000, 0x10000},
2496 {"radio", 0x7f0000, 0x10000},
2500 .first_sysupgrade_partition
= "os-image",
2501 .last_sysupgrade_partition
= "file-system"
2504 /** Firmware layout for the RE200 v4 */
2510 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2511 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2512 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2513 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2514 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2515 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2516 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2517 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2518 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2519 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2520 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2521 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2522 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2523 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2525 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2528 {"fs-uboot", 0x00000, 0x20000},
2529 {"firmware", 0x20000, 0x7a0000},
2530 {"partition-table", 0x7c0000, 0x02000},
2531 {"default-mac", 0x7c2000, 0x00020},
2532 {"pin", 0x7c2100, 0x00020},
2533 {"product-info", 0x7c3100, 0x01000},
2534 {"soft-version", 0x7c4200, 0x01000},
2535 {"support-list", 0x7c5200, 0x01000},
2536 {"profile", 0x7c6200, 0x08000},
2537 {"config-info", 0x7ce200, 0x00400},
2538 {"user-config", 0x7d0000, 0x10000},
2539 {"default-config", 0x7e0000, 0x10000},
2540 {"radio", 0x7f0000, 0x10000},
2544 .first_sysupgrade_partition
= "os-image",
2545 .last_sysupgrade_partition
= "file-system"
2548 /** Firmware layout for the RE220 v2 */
2554 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2555 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2556 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2557 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2558 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2559 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2560 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2561 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2562 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2563 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2564 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2565 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2566 "{product_name:RE220,product_ver:2.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 RE305 v1 */
2597 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2598 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2599 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2600 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2601 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2602 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2603 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2605 .soft_ver
= SOFT_VER_DEFAULT
,
2608 {"fs-uboot", 0x00000, 0x20000},
2609 {"firmware", 0x20000, 0x5e0000},
2610 {"partition-table", 0x600000, 0x02000},
2611 {"default-mac", 0x610000, 0x00020},
2612 {"pin", 0x610100, 0x00020},
2613 {"product-info", 0x611100, 0x01000},
2614 {"soft-version", 0x620000, 0x01000},
2615 {"support-list", 0x621000, 0x01000},
2616 {"profile", 0x622000, 0x08000},
2617 {"user-config", 0x630000, 0x10000},
2618 {"default-config", 0x640000, 0x10000},
2619 {"radio", 0x7f0000, 0x10000},
2623 .first_sysupgrade_partition
= "os-image",
2624 .last_sysupgrade_partition
= "file-system"
2627 /** Firmware layout for the RE305 v3 */
2633 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2634 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2635 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2636 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2637 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2638 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2639 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2640 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2641 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2642 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2643 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2645 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2648 {"fs-uboot", 0x00000, 0x20000},
2649 {"firmware", 0x20000, 0x7a0000},
2650 {"partition-table", 0x7c0000, 0x02000},
2651 {"default-mac", 0x7c2000, 0x00020},
2652 {"pin", 0x7c2100, 0x00020},
2653 {"product-info", 0x7c3100, 0x01000},
2654 {"soft-version", 0x7c4200, 0x01000},
2655 {"support-list", 0x7c5200, 0x01000},
2656 {"profile", 0x7c6200, 0x08000},
2657 {"config-info", 0x7ce200, 0x00400},
2658 {"user-config", 0x7d0000, 0x10000},
2659 {"default-config", 0x7e0000, 0x10000},
2660 {"radio", 0x7f0000, 0x10000},
2664 .first_sysupgrade_partition
= "os-image",
2665 .last_sysupgrade_partition
= "file-system"
2668 /** Firmware layout for the RE350 v1 */
2674 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2675 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2676 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2677 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2678 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2679 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2680 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2682 .soft_ver
= SOFT_VER_DEFAULT
,
2684 /** We're using a dynamic kernel/rootfs split here */
2686 {"fs-uboot", 0x00000, 0x20000},
2687 {"firmware", 0x20000, 0x5e0000},
2688 {"partition-table", 0x600000, 0x02000},
2689 {"default-mac", 0x610000, 0x00020},
2690 {"pin", 0x610100, 0x00020},
2691 {"product-info", 0x611100, 0x01000},
2692 {"soft-version", 0x620000, 0x01000},
2693 {"support-list", 0x621000, 0x01000},
2694 {"profile", 0x622000, 0x08000},
2695 {"user-config", 0x630000, 0x10000},
2696 {"default-config", 0x640000, 0x10000},
2697 {"radio", 0x7f0000, 0x10000},
2701 .first_sysupgrade_partition
= "os-image",
2702 .last_sysupgrade_partition
= "file-system"
2705 /** Firmware layout for the RE350K v1 */
2711 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2713 .soft_ver
= SOFT_VER_DEFAULT
,
2715 /** We're using a dynamic kernel/rootfs split here */
2717 {"fs-uboot", 0x00000, 0x20000},
2718 {"firmware", 0x20000, 0xd70000},
2719 {"partition-table", 0xd90000, 0x02000},
2720 {"default-mac", 0xda0000, 0x00020},
2721 {"pin", 0xda0100, 0x00020},
2722 {"product-info", 0xda1100, 0x01000},
2723 {"soft-version", 0xdb0000, 0x01000},
2724 {"support-list", 0xdb1000, 0x01000},
2725 {"profile", 0xdb2000, 0x08000},
2726 {"user-config", 0xdc0000, 0x10000},
2727 {"default-config", 0xdd0000, 0x10000},
2728 {"device-id", 0xde0000, 0x00108},
2729 {"radio", 0xff0000, 0x10000},
2733 .first_sysupgrade_partition
= "os-image",
2734 .last_sysupgrade_partition
= "file-system"
2737 /** Firmware layout for the RE355 */
2743 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2744 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2745 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2746 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2747 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2748 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2749 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2750 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2752 .soft_ver
= SOFT_VER_DEFAULT
,
2754 /* We're using a dynamic kernel/rootfs split here */
2756 {"fs-uboot", 0x00000, 0x20000},
2757 {"firmware", 0x20000, 0x5e0000},
2758 {"partition-table", 0x600000, 0x02000},
2759 {"default-mac", 0x610000, 0x00020},
2760 {"pin", 0x610100, 0x00020},
2761 {"product-info", 0x611100, 0x01000},
2762 {"soft-version", 0x620000, 0x01000},
2763 {"support-list", 0x621000, 0x01000},
2764 {"profile", 0x622000, 0x08000},
2765 {"user-config", 0x630000, 0x10000},
2766 {"default-config", 0x640000, 0x10000},
2767 {"radio", 0x7f0000, 0x10000},
2771 .first_sysupgrade_partition
= "os-image",
2772 .last_sysupgrade_partition
= "file-system"
2775 /** Firmware layout for the RE450 */
2781 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2782 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2783 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2784 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2785 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2786 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2787 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2788 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2790 .soft_ver
= SOFT_VER_DEFAULT
,
2792 /** We're using a dynamic kernel/rootfs split here */
2794 {"fs-uboot", 0x00000, 0x20000},
2795 {"firmware", 0x20000, 0x5e0000},
2796 {"partition-table", 0x600000, 0x02000},
2797 {"default-mac", 0x610000, 0x00020},
2798 {"pin", 0x610100, 0x00020},
2799 {"product-info", 0x611100, 0x01000},
2800 {"soft-version", 0x620000, 0x01000},
2801 {"support-list", 0x621000, 0x01000},
2802 {"profile", 0x622000, 0x08000},
2803 {"user-config", 0x630000, 0x10000},
2804 {"default-config", 0x640000, 0x10000},
2805 {"radio", 0x7f0000, 0x10000},
2809 .first_sysupgrade_partition
= "os-image",
2810 .last_sysupgrade_partition
= "file-system"
2813 /** Firmware layout for the RE450 v2 */
2819 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2820 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2821 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2822 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2823 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2824 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2825 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2826 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2827 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2829 .soft_ver
= SOFT_VER_DEFAULT
,
2831 /* We're using a dynamic kernel/rootfs split here */
2833 {"fs-uboot", 0x00000, 0x20000},
2834 {"firmware", 0x20000, 0x5e0000},
2835 {"partition-table", 0x600000, 0x02000},
2836 {"default-mac", 0x610000, 0x00020},
2837 {"pin", 0x610100, 0x00020},
2838 {"product-info", 0x611100, 0x01000},
2839 {"soft-version", 0x620000, 0x01000},
2840 {"support-list", 0x621000, 0x01000},
2841 {"profile", 0x622000, 0x08000},
2842 {"user-config", 0x630000, 0x10000},
2843 {"default-config", 0x640000, 0x10000},
2844 {"radio", 0x7f0000, 0x10000},
2848 .first_sysupgrade_partition
= "os-image",
2849 .last_sysupgrade_partition
= "file-system"
2852 /** Firmware layout for the RE450 v3 */
2858 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2859 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2860 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2861 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2862 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2863 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2864 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2865 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2866 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2868 .soft_ver
= SOFT_VER_DEFAULT
,
2870 /* We're using a dynamic kernel/rootfs split here */
2872 {"fs-uboot", 0x00000, 0x20000},
2873 {"default-mac", 0x20000, 0x00020},
2874 {"pin", 0x20020, 0x00020},
2875 {"product-info", 0x21000, 0x01000},
2876 {"partition-table", 0x22000, 0x02000},
2877 {"soft-version", 0x24000, 0x01000},
2878 {"support-list", 0x25000, 0x01000},
2879 {"profile", 0x26000, 0x08000},
2880 {"user-config", 0x2e000, 0x10000},
2881 {"default-config", 0x3e000, 0x10000},
2882 {"config-info", 0x4e000, 0x00400},
2883 {"firmware", 0x50000, 0x7a0000},
2884 {"radio", 0x7f0000, 0x10000},
2888 .first_sysupgrade_partition
= "os-image",
2889 .last_sysupgrade_partition
= "file-system"
2892 /** Firmware layout for the RE455 v1 */
2898 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2899 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2900 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2901 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2902 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2903 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2904 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2905 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2906 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2908 .soft_ver
= SOFT_VER_DEFAULT
,
2910 /* We're using a dynamic kernel/rootfs split here */
2912 {"fs-uboot", 0x00000, 0x20000},
2913 {"default-mac", 0x20000, 0x00020},
2914 {"pin", 0x20020, 0x00020},
2915 {"product-info", 0x21000, 0x01000},
2916 {"partition-table", 0x22000, 0x02000},
2917 {"soft-version", 0x24000, 0x01000},
2918 {"support-list", 0x25000, 0x01000},
2919 {"profile", 0x26000, 0x08000},
2920 {"user-config", 0x2e000, 0x10000},
2921 {"default-config", 0x3e000, 0x10000},
2922 {"config-info", 0x4e000, 0x00400},
2923 {"firmware", 0x50000, 0x7a0000},
2924 {"radio", 0x7f0000, 0x10000},
2928 .first_sysupgrade_partition
= "os-image",
2929 .last_sysupgrade_partition
= "file-system"
2932 /** Firmware layout for the RE500 */
2938 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2939 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2940 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2941 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2942 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2943 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2944 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2946 .soft_ver
= SOFT_VER_DEFAULT
,
2948 /* We're using a dynamic kernel/rootfs split here */
2950 {"fs-uboot", 0x00000, 0x20000},
2951 {"firmware", 0x20000, 0xde0000},
2952 {"partition-table", 0xe00000, 0x02000},
2953 {"default-mac", 0xe10000, 0x00020},
2954 {"pin", 0xe10100, 0x00020},
2955 {"product-info", 0xe11100, 0x01000},
2956 {"soft-version", 0xe20000, 0x01000},
2957 {"support-list", 0xe21000, 0x01000},
2958 {"profile", 0xe22000, 0x08000},
2959 {"user-config", 0xe30000, 0x10000},
2960 {"default-config", 0xe40000, 0x10000},
2961 {"radio", 0xff0000, 0x10000},
2965 .first_sysupgrade_partition
= "os-image",
2966 .last_sysupgrade_partition
= "file-system"
2969 /** Firmware layout for the RE650 */
2975 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2976 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2977 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2978 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2979 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2980 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2981 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2983 .soft_ver
= SOFT_VER_DEFAULT
,
2985 /* We're using a dynamic kernel/rootfs split here */
2987 {"fs-uboot", 0x00000, 0x20000},
2988 {"firmware", 0x20000, 0xde0000},
2989 {"partition-table", 0xe00000, 0x02000},
2990 {"default-mac", 0xe10000, 0x00020},
2991 {"pin", 0xe10100, 0x00020},
2992 {"product-info", 0xe11100, 0x01000},
2993 {"soft-version", 0xe20000, 0x01000},
2994 {"support-list", 0xe21000, 0x01000},
2995 {"profile", 0xe22000, 0x08000},
2996 {"user-config", 0xe30000, 0x10000},
2997 {"default-config", 0xe40000, 0x10000},
2998 {"radio", 0xff0000, 0x10000},
3002 .first_sysupgrade_partition
= "os-image",
3003 .last_sysupgrade_partition
= "file-system"
3005 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3011 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3012 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3013 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3014 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3015 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3016 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3017 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3019 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3020 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3022 /* We're using a dynamic kernel/rootfs split here */
3024 {"fs-uboot", 0x00000, 0x20000},
3025 {"firmware", 0x20000, 0x7a0000},
3026 {"partition-table", 0x7c0000, 0x02000},
3027 {"default-mac", 0x7c2000, 0x00020},
3028 {"pin", 0x7c2100, 0x00020},
3029 {"product-info", 0x7c3100, 0x01000},
3030 {"soft-version", 0x7c4200, 0x01000},
3031 {"support-list", 0x7c5200, 0x01000},
3032 {"profile", 0x7c6200, 0x08000},
3033 {"config-info", 0x7ce200, 0x00400},
3034 {"user-config", 0x7d0000, 0x10000},
3035 {"default-config", 0x7e0000, 0x10000},
3036 {"radio", 0x7f0000, 0x10000},
3040 .first_sysupgrade_partition
= "os-image",
3041 .last_sysupgrade_partition
= "file-system"
3044 /** Firmware layout for the Mercusys MR70X */
3050 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3051 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3052 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3054 .soft_ver
= SOFT_VER_DEFAULT
,
3057 {"fs-uboot", 0x00000, 0x40000},
3058 {"firmware", 0x40000, 0xf60000},
3059 {"default-mac", 0xfa0000, 0x00200},
3060 {"pin", 0xfa0200, 0x00100},
3061 {"device-id", 0xfa0300, 0x00100},
3062 {"product-info", 0xfa0400, 0x0fc00},
3063 {"default-config", 0xfb0000, 0x08000},
3064 {"ap-def-config", 0xfb8000, 0x08000},
3065 {"user-config", 0xfc0000, 0x0a000},
3066 {"ag-config", 0xfca000, 0x04000},
3067 {"certificate", 0xfce000, 0x02000},
3068 {"ap-config", 0xfd0000, 0x06000},
3069 {"router-config", 0xfd6000, 0x06000},
3070 {"favicon", 0xfdc000, 0x02000},
3071 {"logo", 0xfde000, 0x02000},
3072 {"partition-table", 0xfe0000, 0x00800},
3073 {"soft-version", 0xfe0800, 0x00100},
3074 {"support-list", 0xfe0900, 0x00200},
3075 {"profile", 0xfe0b00, 0x03000},
3076 {"extra-para", 0xfe3b00, 0x00100},
3077 {"radio", 0xff0000, 0x10000},
3081 .first_sysupgrade_partition
= "os-image",
3082 .last_sysupgrade_partition
= "file-system"
3088 #define error(_ret, _errno, _str, ...) \
3090 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3091 strerror(_errno)); \
3097 /** Stores a uint32 as big endian */
3098 static inline void put32(uint8_t *buf
, uint32_t val
) {
3105 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3107 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3110 /** Allocate a padded meta partition with a correctly initialised header
3111 * If the `data` pointer is NULL, then the required space is only allocated,
3112 * otherwise `data_len` bytes will be copied from `data` into the partition
3114 static struct image_partition_entry
init_meta_partition_entry(
3115 const char *name
, const void *data
, uint32_t data_len
,
3116 enum partition_trail_value pad_value
)
3118 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3119 if (meta_partition_should_pad(pad_value
))
3122 struct image_partition_entry entry
= {
3125 .data
= malloc(total_len
)
3128 error(1, errno
, "failed to allocate meta partition entry");
3130 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3131 header
->length
= htonl(data_len
);
3135 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3137 if (meta_partition_should_pad(pad_value
))
3138 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3143 /** Allocates a new image partition */
3144 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3145 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3147 error(1, errno
, "malloc");
3152 /** Sets up default partition names whenever custom names aren't specified */
3153 static void set_partition_names(struct device_info
*info
)
3155 if (!info
->partition_names
.partition_table
)
3156 info
->partition_names
.partition_table
= "partition-table";
3157 if (!info
->partition_names
.soft_ver
)
3158 info
->partition_names
.soft_ver
= "soft-version";
3159 if (!info
->partition_names
.os_image
)
3160 info
->partition_names
.os_image
= "os-image";
3161 if (!info
->partition_names
.support_list
)
3162 info
->partition_names
.support_list
= "support-list";
3163 if (!info
->partition_names
.file_system
)
3164 info
->partition_names
.file_system
= "file-system";
3165 if (!info
->partition_names
.extra_para
)
3166 info
->partition_names
.extra_para
= "extra-para";
3169 /** Frees an image partition */
3170 static void free_image_partition(struct image_partition_entry
*entry
)
3172 void *data
= entry
->data
;
3181 static time_t source_date_epoch
= -1;
3182 static void set_source_date_epoch() {
3183 char *env
= getenv("SOURCE_DATE_EPOCH");
3187 source_date_epoch
= strtoull(env
, &endptr
, 10);
3188 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3189 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3195 /** Generates the partition-table partition */
3196 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3198 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, SAFELOADER_PAYLOAD_TABLE_SIZE
);
3200 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3208 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3210 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3211 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3214 error(1, 0, "flash partition table overflow?");
3221 memset(s
, 0xff, end
-s
);
3227 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3228 static inline uint8_t bcd(uint8_t v
) {
3229 return 0x10 * (v
/10) + v
%10;
3233 /** Generates the soft-version partition */
3234 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3236 /** If an info string is provided, use this instead of
3237 * the structured data, and include the null-termination */
3238 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3239 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3240 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3241 info
->soft_ver
.text
, len
, info
->part_trail
);
3246 if (source_date_epoch
!= -1)
3247 t
= source_date_epoch
;
3248 else if (time(&t
) == (time_t)(-1))
3249 error(1, errno
, "time");
3251 struct tm
*tm
= gmtime(&t
);
3253 struct soft_version s
= {
3256 .version_major
= info
->soft_ver
.num
[0],
3257 .version_minor
= info
->soft_ver
.num
[1],
3258 .version_patch
= info
->soft_ver
.num
[2],
3260 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3261 .year_lo
= bcd(tm
->tm_year
%100),
3262 .month
= bcd(tm
->tm_mon
+1),
3263 .day
= bcd(tm
->tm_mday
),
3266 .compat_level
= htonl(info
->soft_ver_compat_level
)
3269 if (info
->soft_ver_compat_level
== 0)
3270 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3271 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3274 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3275 sizeof(s
), info
->part_trail
);
3278 /** Generates the support-list partition */
3279 static struct image_partition_entry
make_support_list(
3280 const struct device_info
*info
)
3282 uint32_t len
= strlen(info
->support_list
);
3283 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3284 len
, info
->part_trail
);
3287 /** Partition with extra-para data */
3288 static struct image_partition_entry
make_extra_para(
3289 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3291 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3295 /** Creates a new image partition with an arbitrary name from a file */
3296 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
) {
3297 struct stat statbuf
;
3299 if (stat(filename
, &statbuf
) < 0)
3300 error(1, errno
, "unable to stat file `%s'", filename
);
3302 size_t len
= statbuf
.st_size
;
3304 if (add_jffs2_eof
) {
3305 if (file_system_partition
)
3306 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3308 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3311 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3313 FILE *file
= fopen(filename
, "rb");
3315 error(1, errno
, "unable to open file `%s'", filename
);
3317 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3318 error(1, errno
, "unable to read file `%s'", filename
);
3320 if (add_jffs2_eof
) {
3321 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3323 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3324 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3333 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3335 Example image partition table:
3337 fwup-ptn partition-table base 0x00800 size 0x00800
3338 fwup-ptn os-image base 0x01000 size 0x113b45
3339 fwup-ptn file-system base 0x114b45 size 0x1d0004
3340 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3342 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3343 the end of the partition table is marked with a zero byte.
3345 The firmware image must contain at least the partition-table and support-list partitions
3346 to be accepted. There aren't any alignment constraints for the image partitions.
3348 The partition-table partition contains the actual flash layout; partitions
3349 from the image partition table are mapped to the corresponding flash partitions during
3350 the firmware upgrade. The support-list partition contains a list of devices supported by
3353 The base offsets in the firmware partition table are relative to the end
3354 of the vendor information block, so the partition-table partition will
3355 actually start at offset 0x1814 of the image.
3357 I think partition-table must be the first partition in the firmware image.
3359 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3361 char *image_pt
= (char *)buffer
, *end
= image_pt
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3363 size_t base
= SAFELOADER_PAYLOAD_TABLE_SIZE
;
3364 for (i
= 0; parts
[i
].name
; i
++) {
3365 for (j
= 0; flash_parts
[j
].name
; j
++) {
3366 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3367 if (parts
[i
].size
> flash_parts
[j
].size
)
3368 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3373 assert(flash_parts
[j
].name
);
3375 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3377 size_t len
= end
-image_pt
;
3378 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
);
3381 error(1, 0, "image partition table overflow?");
3385 base
+= parts
[i
].size
;
3389 /** Generates and writes the image MD5 checksum */
3390 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3394 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3395 MD5_Update(&ctx
, buffer
, len
);
3396 MD5_Final(md5
, &ctx
);
3401 Generates the firmware image in factory format
3407 0000-0003 Image size (4 bytes, big endian)
3408 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3409 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3410 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3411 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3412 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3413 1814-xxxx Firmware partitions
3415 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3416 *len
= SAFELOADER_PAYLOAD_OFFSET
+ SAFELOADER_PAYLOAD_TABLE_SIZE
;
3419 for (i
= 0; parts
[i
].name
; i
++)
3420 *len
+= parts
[i
].size
;
3422 uint8_t *image
= malloc(*len
);
3424 error(1, errno
, "malloc");
3426 memset(image
, 0xff, *len
);
3430 size_t vendor_len
= strlen(info
->vendor
);
3431 put32(image
+ SAFELOADER_PREAMBLE_SIZE
, vendor_len
);
3432 memcpy(image
+ SAFELOADER_PREAMBLE_SIZE
+ 0x4, info
->vendor
, vendor_len
);
3435 put_partitions(image
+ SAFELOADER_PAYLOAD_OFFSET
, info
->partitions
, parts
);
3436 put_md5(image
+ 0x04, image
+ SAFELOADER_PREAMBLE_SIZE
, *len
- SAFELOADER_PREAMBLE_SIZE
);
3442 Generates the firmware image in sysupgrade format
3444 This makes some assumptions about the provided flash and image partition tables and
3445 should be generalized when TP-LINK starts building its safeloader into hardware with
3446 different flash layouts.
3448 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3450 size_t flash_first_partition_index
= 0;
3451 size_t flash_last_partition_index
= 0;
3452 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3453 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3454 const struct image_partition_entry
*image_last_partition
= NULL
;
3456 /** Find first and last partitions */
3457 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3458 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3459 flash_first_partition
= &info
->partitions
[i
];
3460 flash_first_partition_index
= i
;
3461 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3462 flash_last_partition
= &info
->partitions
[i
];
3463 flash_last_partition_index
= i
;
3467 assert(flash_first_partition
&& flash_last_partition
);
3468 assert(flash_first_partition_index
< flash_last_partition_index
);
3470 /** Find last partition from image to calculate needed size */
3471 for (i
= 0; image_parts
[i
].name
; i
++) {
3472 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3473 image_last_partition
= &image_parts
[i
];
3478 assert(image_last_partition
);
3480 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3482 uint8_t *image
= malloc(*len
);
3484 error(1, errno
, "malloc");
3486 memset(image
, 0xff, *len
);
3488 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3489 for (j
= 0; image_parts
[j
].name
; j
++) {
3490 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3491 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3492 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3493 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3497 assert(image_parts
[j
].name
);
3504 /** Generates an image according to a given layout and writes it to a file */
3505 static void build_image(const char *output
,
3506 const char *kernel_image
,
3507 const char *rootfs_image
,
3511 struct device_info
*info
) {
3515 struct image_partition_entry parts
[7] = {};
3517 struct flash_partition_entry
*firmware_partition
= NULL
;
3518 struct flash_partition_entry
*os_image_partition
= NULL
;
3519 struct flash_partition_entry
*file_system_partition
= NULL
;
3520 size_t firmware_partition_index
= 0;
3522 set_partition_names(info
);
3524 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3525 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3527 firmware_partition
= &info
->partitions
[i
];
3528 firmware_partition_index
= i
;
3532 if (firmware_partition
)
3534 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3535 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3538 if (stat(kernel_image
, &kernel
) < 0)
3539 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3541 if (kernel
.st_size
> firmware_partition
->size
)
3542 error(1, 0, "kernel overflowed firmware partition\n");
3544 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3545 info
->partitions
[i
+1] = info
->partitions
[i
];
3547 file_system_partition
->name
= info
->partition_names
.file_system
;
3549 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3551 /* Align partition start to erase blocks for factory images only */
3553 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3555 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3557 os_image_partition
->name
= info
->partition_names
.os_image
;
3559 os_image_partition
->size
= kernel
.st_size
;
3562 parts
[0] = make_partition_table(info
);
3563 parts
[1] = make_soft_version(info
, rev
);
3564 parts
[2] = make_support_list(info
);
3565 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3566 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3569 /* Some devices need the extra-para partition to accept the firmware */
3570 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3571 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3572 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3573 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3574 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3575 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3576 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3577 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3578 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3579 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3580 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3581 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3582 strcasecmp(info
->id
, "DECO-M4R-V4") == 0 ||
3583 strcasecmp(info
->id
, "MR70X") == 0 ||
3584 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3585 const uint8_t extra_para
[2] = {0x01, 0x00};
3586 parts
[5] = make_extra_para(info
, extra_para
,
3587 sizeof(extra_para
));
3588 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3589 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3590 const uint8_t extra_para
[2] = {0x00, 0x01};
3591 parts
[5] = make_extra_para(info
, extra_para
,
3592 sizeof(extra_para
));
3593 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3594 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3595 const uint8_t extra_para
[2] = {0x01, 0x01};
3596 parts
[5] = make_extra_para(info
, extra_para
,
3597 sizeof(extra_para
));
3603 image
= generate_sysupgrade_image(info
, parts
, &len
);
3605 image
= generate_factory_image(info
, parts
, &len
);
3607 FILE *file
= fopen(output
, "wb");
3609 error(1, errno
, "unable to open output file");
3611 if (fwrite(image
, len
, 1, file
) != 1)
3612 error(1, 0, "unable to write output file");
3618 for (i
= 0; parts
[i
].name
; i
++)
3619 free_image_partition(&parts
[i
]);
3623 static void usage(const char *argv0
) {
3625 "Usage: %s [OPTIONS...]\n"
3628 " -h show this help\n"
3630 "Info about an image:\n"
3631 " -i <file> input file to read from\n"
3632 "Create a new image:\n"
3633 " -B <board> create image for the board specified with <board>\n"
3634 " -k <file> read kernel image from the file <file>\n"
3635 " -r <file> read rootfs image from the file <file>\n"
3636 " -o <file> write output to the file <file>\n"
3637 " -V <rev> sets the revision number to <rev>\n"
3638 " -j add jffs2 end-of-filesystem markers\n"
3639 " -S create sysupgrade instead of factory image\n"
3640 "Extract an old image:\n"
3641 " -x <file> extract all oem firmware partition\n"
3642 " -d <dir> destination to extract the firmware partition\n"
3643 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3649 static struct device_info
*find_board(const char *id
)
3651 struct device_info
*board
= NULL
;
3653 for (board
= boards
; board
->id
!= NULL
; board
++)
3654 if (strcasecmp(id
, board
->id
) == 0)
3660 static int add_flash_partition(
3661 struct flash_partition_entry
*part_list
,
3668 /* check if the list has a free entry */
3669 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3670 if (part_list
->name
== NULL
&&
3671 part_list
->base
== 0 &&
3672 part_list
->size
== 0)
3676 if (ptr
== max_entries
) {
3677 error(1, 0, "No free flash part entry available.");
3680 part_list
->name
= calloc(1, strlen(name
) + 1);
3681 if (!part_list
->name
) {
3682 error(1, 0, "Unable to allocate memory");
3685 memcpy((char *)part_list
->name
, name
, strlen(name
));
3686 part_list
->base
= base
;
3687 part_list
->size
= size
;
3692 /** read the partition table into struct flash_partition_entry */
3693 enum PARTITION_TABLE_TYPE
{
3694 PARTITION_TABLE_FWUP
,
3695 PARTITION_TABLE_FLASH
,
3698 static int read_partition_table(
3699 FILE *file
, long offset
,
3700 struct flash_partition_entry
*entries
, size_t max_entries
,
3703 char buf
[SAFELOADER_PAYLOAD_TABLE_SIZE
];
3705 const char *parthdr
= NULL
;
3706 const char *fwuphdr
= "fwup-ptn";
3707 const char *flashhdr
= "partition";
3709 /* TODO: search for the partition table */
3712 case PARTITION_TABLE_FWUP
:
3715 case PARTITION_TABLE_FLASH
:
3719 error(1, 0, "Invalid partition table");
3722 if (fseek(file
, offset
, SEEK_SET
) < 0)
3723 error(1, errno
, "Can not seek in the firmware");
3725 if (fread(buf
, sizeof(buf
), 1, file
) != 1)
3726 error(1, errno
, "Can not read fwup-ptn from the firmware");
3728 buf
[sizeof(buf
) - 1] = '\0';
3730 /* look for the partition header */
3731 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3732 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3737 end
= buf
+ sizeof(buf
);
3738 while ((ptr
+ strlen(parthdr
)) < end
&&
3739 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3743 char name
[32] = { 0 };
3745 unsigned long base
= 0;
3746 unsigned long size
= 0;
3748 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3749 if (end_part
== NULL
) {
3750 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3754 for (int i
= 0; i
<= 4; i
++) {
3755 if (end_part
<= ptr
)
3758 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3759 if (end_element
== NULL
) {
3760 error(1, errno
, "Ignoring the rest of the partition entries.");
3765 /* partition header */
3767 ptr
= end_element
+ 1;
3771 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3772 strncpy(name
, ptr
, name_len
);
3773 name
[name_len
] = '\0';
3774 ptr
= end_element
+ 1;
3779 ptr
= end_element
+ 1;
3784 base
= strtoul(ptr
, NULL
, 16);
3785 ptr
= end_element
+ 1;
3790 ptr
= end_element
+ 1;
3791 /* actual size. The last element doesn't have a sepeartor */
3792 size
= strtoul(ptr
, NULL
, 16);
3793 /* the part ends with 0x09, 0x0d, 0x0a */
3795 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3804 static void safeloader_read_partition(FILE *input_file
, size_t payload_offset
,
3805 struct flash_partition_entry
*entry
,
3806 struct image_partition_entry
*part
)
3808 size_t part_size
= entry
->size
;
3809 void *part_data
= malloc(part_size
);
3811 if (fseek(input_file
, payload_offset
, SEEK_SET
))
3812 error(1, errno
, "Failed to seek to partition data");
3815 error(1, ENOMEM
, "Failed to allocate partition data");
3817 if (fread(part_data
, 1, part_size
, input_file
) < part_size
)
3818 error(1, errno
, "Failed to read partition data");
3820 part
->data
= part_data
;
3821 part
->size
= part_size
;
3822 part
->name
= entry
->name
;
3825 static void safeloader_parse_image(FILE *input_file
, struct safeloader_image_info
*image
)
3832 fseek(input_file
, SAFELOADER_PREAMBLE_SIZE
, SEEK_SET
);
3834 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3835 error(1, errno
, "Can not read image header");
3837 image
->payload_offset
= SAFELOADER_PAYLOAD_OFFSET
;
3839 /* Parse image partition table */
3840 read_partition_table(input_file
, image
->payload_offset
, &image
->entries
[0],
3841 MAX_PARTITIONS
, PARTITION_TABLE_FWUP
);
3844 static void write_partition(
3846 size_t firmware_offset
,
3847 struct flash_partition_entry
*entry
,
3853 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3855 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3856 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3857 error(1, errno
, "Can not read partition from input_file");
3859 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3860 error(1, errno
, "Can not write partition to output_file");
3862 /* write last chunk smaller than buffer */
3863 if (offset
< entry
->size
) {
3864 offset
= entry
->size
- offset
;
3865 if (fread(buf
, offset
, 1, input_file
) != 1)
3866 error(1, errno
, "Can not read partition from input_file");
3867 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3868 error(1, errno
, "Can not write partition to output_file");
3872 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3875 char output
[PATH_MAX
];
3877 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3878 output_file
= fopen(output
, "wb+");
3879 if (output_file
== NULL
) {
3880 error(1, errno
, "Can not open output file %s", output
);
3883 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3885 fclose(output_file
);
3890 /** extract all partitions from the firmware file */
3891 static int extract_firmware(const char *input
, const char *output_directory
)
3893 struct safeloader_image_info info
= {};
3894 struct stat statbuf
;
3897 /* check input file */
3898 if (stat(input
, &statbuf
)) {
3899 error(1, errno
, "Can not read input firmware %s", input
);
3902 /* check if output directory exists */
3903 if (stat(output_directory
, &statbuf
)) {
3904 error(1, errno
, "Failed to stat output directory %s", output_directory
);
3907 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
3908 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
3911 input_file
= fopen(input
, "rb");
3912 safeloader_parse_image(input_file
, &info
);
3914 for (size_t i
= 0; i
< MAX_PARTITIONS
&& info
.entries
[i
].name
; i
++)
3915 extract_firmware_partition(input_file
, info
.payload_offset
, &info
.entries
[i
], output_directory
);
3920 static struct flash_partition_entry
*find_partition(
3921 struct flash_partition_entry
*entries
, size_t max_entries
,
3922 const char *name
, const char *error_msg
)
3924 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
3925 if (strcmp(entries
->name
, name
) == 0)
3930 error(1, 0, "%s", error_msg
);
3936 static int firmware_info(const char *input
)
3938 struct safeloader_image_info info
= {};
3939 struct image_partition_entry part
= {};
3940 struct flash_partition_entry
*e
;
3943 input_file
= fopen(input
, "rb");
3945 safeloader_parse_image(input_file
, &info
);
3947 printf("Firmware image partitions:\n");
3948 printf("%-8s %-8s %s\n", "base", "size", "name");
3950 e
= &info
.entries
[0];
3951 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
3952 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
3954 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "soft-version", NULL
);
3956 struct soft_version
*s
;
3957 unsigned int ascii_len
;
3962 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
3963 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
3964 buf
= part
.data
+ sizeof(struct meta_header
);
3966 /* Check for (null-terminated) string */
3968 while (ascii_len
< data_len
&& isascii(buf
[ascii_len
]))
3971 isstr
= ascii_len
== data_len
;
3973 printf("\n[Software version]\n");
3975 fwrite(buf
, strnlen((const char *) buf
, data_len
), 1, stdout
);
3977 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
3978 s
= (struct soft_version
*) buf
;
3980 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
3981 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
3982 printf("Revision: %d\n", ntohl(s
->rev
));
3984 printf("Failed to parse data\n");
3987 free_image_partition(&part
);
3990 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "support-list", NULL
);
3994 safeloader_read_partition(input_file
, info
.payload_offset
+ e
->base
, e
, &part
);
3995 data_len
= ntohl(((struct meta_header
*) part
.data
)->length
);
3997 printf("\n[Support list]\n");
3998 fwrite(part
.data
+ sizeof(struct meta_header
), data_len
, 1, stdout
);
4001 free_image_partition(&part
);
4004 e
= find_partition(&info
.entries
[0], MAX_PARTITIONS
, "partition-table", NULL
);
4006 size_t flash_table_offset
= info
.payload_offset
+ e
->base
+ 4;
4007 struct flash_partition_entry parts
[MAX_PARTITIONS
] = {};
4009 if (read_partition_table(input_file
, flash_table_offset
, parts
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
))
4010 error(1, 0, "Error can not read the partition table (partition)");
4012 printf("\n[Partition table]\n");
4013 printf("%-8s %-8s %s\n", "base", "size", "name");
4016 for (unsigned int i
= 0; i
< MAX_PARTITIONS
&& e
->name
; i
++, e
++)
4017 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
);
4025 static void write_ff(FILE *output_file
, size_t size
)
4030 memset(buf
, 0xff, sizeof(buf
));
4032 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
4033 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
4034 error(1, errno
, "Can not write 0xff to output_file");
4037 /* write last chunk smaller than buffer */
4038 if (offset
< size
) {
4039 offset
= size
- offset
;
4040 if (fwrite(buf
, offset
, 1, output_file
) != 1)
4041 error(1, errno
, "Can not write partition to output_file");
4045 static void convert_firmware(const char *input
, const char *output
)
4047 struct flash_partition_entry flash
[MAX_PARTITIONS
] = {};
4048 struct flash_partition_entry
*fwup_partition_table
;
4049 struct flash_partition_entry
*flash_file_system
;
4050 struct flash_partition_entry
*fwup_file_system
;
4051 struct flash_partition_entry
*flash_os_image
;
4052 struct flash_partition_entry
*fwup_os_image
;
4053 struct safeloader_image_info info
= {};
4054 size_t flash_table_offset
;
4055 struct stat statbuf
;
4059 /* check input file */
4060 if (stat(input
, &statbuf
)) {
4061 error(1, errno
, "Can not read input firmware %s", input
);
4064 input_file
= fopen(input
, "rb");
4066 error(1, 0, "Can not open input firmware %s", input
);
4068 output_file
= fopen(output
, "wb");
4070 error(1, 0, "Can not open output firmware %s", output
);
4072 input_file
= fopen(input
, "rb");
4073 safeloader_parse_image(input_file
, &info
);
4075 fwup_os_image
= find_partition(info
.entries
, MAX_PARTITIONS
,
4076 "os-image", "Error can not find os-image partition (fwup)");
4077 fwup_file_system
= find_partition(info
.entries
, MAX_PARTITIONS
,
4078 "file-system", "Error can not find file-system partition (fwup)");
4079 fwup_partition_table
= find_partition(info
.entries
, MAX_PARTITIONS
,
4080 "partition-table", "Error can not find partition-table partition");
4082 /* the flash partition table has a 0x00000004 magic haeder */
4083 flash_table_offset
= info
.payload_offset
+ fwup_partition_table
->base
+ 4;
4084 if (read_partition_table(input_file
, flash_table_offset
, flash
, MAX_PARTITIONS
, PARTITION_TABLE_FLASH
) != 0)
4085 error(1, 0, "Error can not read the partition table (flash)");
4087 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4088 "os-image", "Error can not find os-image partition (flash)");
4089 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4090 "file-system", "Error can not find file-system partition (flash)");
4092 /* write os_image to 0x0 */
4093 write_partition(input_file
, info
.payload_offset
, fwup_os_image
, output_file
);
4094 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4096 /* write file-system behind os_image */
4097 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4098 write_partition(input_file
, info
.payload_offset
, fwup_file_system
, output_file
);
4100 fclose(output_file
);
4104 int main(int argc
, char *argv
[]) {
4105 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4106 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4107 bool add_jffs2_eof
= false, sysupgrade
= false;
4109 struct device_info
*info
;
4110 set_source_date_epoch();
4115 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4121 info_image
= optarg
;
4129 kernel_image
= optarg
;
4133 rootfs_image
= optarg
;
4141 sscanf(optarg
, "r%u", &rev
);
4145 add_jffs2_eof
= true;
4157 output_directory
= optarg
;
4161 extract_image
= optarg
;
4165 convert_image
= optarg
;
4175 firmware_info(info_image
);
4176 } else if (extract_image
|| output_directory
) {
4178 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4179 if (!output_directory
)
4180 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4181 extract_firmware(extract_image
, output_directory
);
4182 } else if (convert_image
) {
4184 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4185 convert_firmware(convert_image
, output
);
4188 error(1, 0, "no board has been specified");
4190 error(1, 0, "no kernel image has been specified");
4192 error(1, 0, "no rootfs image has been specified");
4194 error(1, 0, "no output filename has been specified");
4196 info
= find_board(board
);
4199 error(1, 0, "unsupported board %s", board
);
4201 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);