1 // SPDX-License-Identifier: BSD-2-Clause
3 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
11 Image generation tool for the TP-LINK SafeLoader as seen on
12 TP-LINK Pharos devices (CPE210/220/510/520)
28 #include <arpa/inet.h>
30 #include <sys/types.h>
37 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
40 #define MAX_PARTITIONS 32
42 /** An image partition table entry */
43 struct image_partition_entry
{
49 /** A flash partition table entry */
50 struct flash_partition_entry
{
56 /** Flash partition names table entry */
57 struct factory_partition_names
{
58 const char *partition_table
;
61 const char *support_list
;
62 const char *file_system
;
63 const char *extra_para
;
66 /** Partition trailing padding definitions
67 * Values 0x00 to 0xff are reserved to indicate the padding value
68 * Values from 0x100 are reserved to indicate other behaviour */
69 enum partition_trail_value
{
72 PART_TRAIL_MAX
= 0xff,
73 PART_TRAIL_NONE
= 0x100
76 /** soft-version value overwrite types
77 * The default (for an uninitialised soft_ver field) is to use the numerical
78 * version number "0.0.0"
81 SOFT_VER_TYPE_NUMERIC
= 0,
82 SOFT_VER_TYPE_TEXT
= 1,
85 /** Firmware layout description */
89 const char *support_list
;
90 enum partition_trail_value part_trail
;
92 enum soft_ver_type type
;
98 uint32_t soft_ver_compat_level
;
99 struct flash_partition_entry partitions
[MAX_PARTITIONS
+1];
100 const char *first_sysupgrade_partition
;
101 const char *last_sysupgrade_partition
;
102 struct factory_partition_names partition_names
;
105 #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t}
106 #define SOFT_VER_NUMERIC(_maj, _min, _patch) { \
107 .type = SOFT_VER_TYPE_NUMERIC, \
108 .num = {_maj, _min, _patch}}
109 #define SOFT_VER_DEFAULT SOFT_VER_NUMERIC(0, 0, 0)
111 struct __attribute__((__packed__
)) meta_header
{
116 /** The content of the soft-version structure */
117 struct __attribute__((__packed__
)) soft_version
{
119 uint8_t version_major
;
120 uint8_t version_minor
;
121 uint8_t version_patch
;
127 uint32_t compat_level
;
131 static const uint8_t jffs2_eof_mark
[4] = {0xde, 0xad, 0xc0, 0xde};
135 Salt for the MD5 hash
137 Fortunately, TP-LINK seems to use the same salt for most devices which use
138 the new image format.
140 static const uint8_t md5_salt
[16] = {
141 0x7a, 0x2b, 0x15, 0xed,
142 0x9b, 0x98, 0x59, 0x6d,
143 0xe5, 0x04, 0xab, 0x44,
144 0xac, 0x2a, 0x9f, 0x4e,
148 /** Firmware layout table */
149 static struct device_info boards
[] = {
150 /** Firmware layout for the CPE210/220 V1 */
153 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
156 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
157 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
158 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
159 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
160 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
161 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
162 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
164 .soft_ver
= SOFT_VER_DEFAULT
,
167 {"fs-uboot", 0x00000, 0x20000},
168 {"partition-table", 0x20000, 0x02000},
169 {"default-mac", 0x30000, 0x00020},
170 {"product-info", 0x31100, 0x00100},
171 {"signature", 0x32000, 0x00400},
172 {"firmware", 0x40000, 0x770000},
173 {"soft-version", 0x7b0000, 0x00100},
174 {"support-list", 0x7b1000, 0x00400},
175 {"user-config", 0x7c0000, 0x10000},
176 {"default-config", 0x7d0000, 0x10000},
177 {"log", 0x7e0000, 0x10000},
178 {"radio", 0x7f0000, 0x10000},
182 .first_sysupgrade_partition
= "os-image",
183 .last_sysupgrade_partition
= "support-list",
186 /** Firmware layout for the CPE210 V2 */
189 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
192 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
193 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
194 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
195 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
196 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
197 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
198 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
199 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
200 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
201 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
203 .soft_ver
= SOFT_VER_DEFAULT
,
206 {"fs-uboot", 0x00000, 0x20000},
207 {"partition-table", 0x20000, 0x02000},
208 {"default-mac", 0x30000, 0x00020},
209 {"product-info", 0x31100, 0x00100},
210 {"device-info", 0x31400, 0x00400},
211 {"signature", 0x32000, 0x00400},
212 {"device-id", 0x33000, 0x00100},
213 {"firmware", 0x40000, 0x770000},
214 {"soft-version", 0x7b0000, 0x00100},
215 {"support-list", 0x7b1000, 0x01000},
216 {"user-config", 0x7c0000, 0x10000},
217 {"default-config", 0x7d0000, 0x10000},
218 {"log", 0x7e0000, 0x10000},
219 {"radio", 0x7f0000, 0x10000},
223 .first_sysupgrade_partition
= "os-image",
224 .last_sysupgrade_partition
= "support-list",
227 /** Firmware layout for the CPE210 V3 */
230 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
233 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
234 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
235 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
236 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
237 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
238 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
239 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
240 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
241 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
242 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
243 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
245 .soft_ver
= SOFT_VER_DEFAULT
,
248 {"fs-uboot", 0x00000, 0x20000},
249 {"partition-table", 0x20000, 0x01000},
250 {"default-mac", 0x30000, 0x00020},
251 {"product-info", 0x31100, 0x00100},
252 {"device-info", 0x31400, 0x00400},
253 {"signature", 0x32000, 0x00400},
254 {"device-id", 0x33000, 0x00100},
255 {"firmware", 0x40000, 0x770000},
256 {"soft-version", 0x7b0000, 0x00100},
257 {"support-list", 0x7b1000, 0x01000},
258 {"user-config", 0x7c0000, 0x10000},
259 {"default-config", 0x7d0000, 0x10000},
260 {"log", 0x7e0000, 0x10000},
261 {"radio", 0x7f0000, 0x10000},
265 .first_sysupgrade_partition
= "os-image",
266 .last_sysupgrade_partition
= "support-list",
269 /** Firmware layout for the CPE220 V2 */
272 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
275 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
276 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
277 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
278 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
279 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
280 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
281 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
282 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
283 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
284 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
286 .soft_ver
= SOFT_VER_DEFAULT
,
289 {"fs-uboot", 0x00000, 0x20000},
290 {"partition-table", 0x20000, 0x02000},
291 {"default-mac", 0x30000, 0x00020},
292 {"product-info", 0x31100, 0x00100},
293 {"signature", 0x32000, 0x00400},
294 {"firmware", 0x40000, 0x770000},
295 {"soft-version", 0x7b0000, 0x00100},
296 {"support-list", 0x7b1000, 0x00400},
297 {"user-config", 0x7c0000, 0x10000},
298 {"default-config", 0x7d0000, 0x10000},
299 {"log", 0x7e0000, 0x10000},
300 {"radio", 0x7f0000, 0x10000},
304 .first_sysupgrade_partition
= "os-image",
305 .last_sysupgrade_partition
= "support-list",
308 /** Firmware layout for the CPE220 V3 */
311 .vendor
= "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
314 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
315 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
316 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
317 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
318 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
319 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
320 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
321 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
322 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
323 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
325 .soft_ver
= SOFT_VER_DEFAULT
,
328 {"fs-uboot", 0x00000, 0x20000},
329 {"partition-table", 0x20000, 0x02000},
330 {"default-mac", 0x30000, 0x00020},
331 {"product-info", 0x31100, 0x00100},
332 {"device-info", 0x31400, 0x00400},
333 {"signature", 0x32000, 0x00400},
334 {"device-id", 0x33000, 0x00100},
335 {"firmware", 0x40000, 0x770000},
336 {"soft-version", 0x7b0000, 0x00100},
337 {"support-list", 0x7b1000, 0x01000},
338 {"user-config", 0x7c0000, 0x10000},
339 {"default-config", 0x7d0000, 0x10000},
340 {"log", 0x7e0000, 0x10000},
341 {"radio", 0x7f0000, 0x10000},
345 .first_sysupgrade_partition
= "os-image",
346 .last_sysupgrade_partition
= "support-list",
349 /** Firmware layout for the CPE510/520 V1 */
352 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
355 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
356 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
357 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
358 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
359 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
360 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
361 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
362 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
364 .soft_ver
= SOFT_VER_DEFAULT
,
367 {"fs-uboot", 0x00000, 0x20000},
368 {"partition-table", 0x20000, 0x02000},
369 {"default-mac", 0x30000, 0x00020},
370 {"product-info", 0x31100, 0x00100},
371 {"signature", 0x32000, 0x00400},
372 {"firmware", 0x40000, 0x770000},
373 {"soft-version", 0x7b0000, 0x00100},
374 {"support-list", 0x7b1000, 0x00400},
375 {"user-config", 0x7c0000, 0x10000},
376 {"default-config", 0x7d0000, 0x10000},
377 {"log", 0x7e0000, 0x10000},
378 {"radio", 0x7f0000, 0x10000},
382 .first_sysupgrade_partition
= "os-image",
383 .last_sysupgrade_partition
= "support-list",
386 /** Firmware layout for the CPE510 V2 */
389 .vendor
= "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
392 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
393 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
394 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
395 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
396 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
397 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
398 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
399 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
400 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
401 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
402 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
403 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
405 .soft_ver
= SOFT_VER_DEFAULT
,
408 {"fs-uboot", 0x00000, 0x20000},
409 {"partition-table", 0x20000, 0x02000},
410 {"default-mac", 0x30000, 0x00020},
411 {"product-info", 0x31100, 0x00100},
412 {"signature", 0x32000, 0x00400},
413 {"firmware", 0x40000, 0x770000},
414 {"soft-version", 0x7b0000, 0x00100},
415 {"support-list", 0x7b1000, 0x00400},
416 {"user-config", 0x7c0000, 0x10000},
417 {"default-config", 0x7d0000, 0x10000},
418 {"log", 0x7e0000, 0x10000},
419 {"radio", 0x7f0000, 0x10000},
423 .first_sysupgrade_partition
= "os-image",
424 .last_sysupgrade_partition
= "support-list",
427 /** Firmware layout for the CPE510 V3 */
430 .vendor
= "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
433 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
434 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
435 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
436 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
437 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
438 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
439 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
440 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
441 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
442 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
443 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
444 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
445 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
446 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
447 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
449 .soft_ver
= SOFT_VER_DEFAULT
,
452 {"fs-uboot", 0x00000, 0x20000},
453 {"partition-table", 0x20000, 0x02000},
454 {"default-mac", 0x30000, 0x00020},
455 {"product-info", 0x31100, 0x00100},
456 {"signature", 0x32000, 0x00400},
457 {"firmware", 0x40000, 0x770000},
458 {"soft-version", 0x7b0000, 0x00100},
459 {"support-list", 0x7b1000, 0x00400},
460 {"user-config", 0x7c0000, 0x10000},
461 {"default-config", 0x7d0000, 0x10000},
462 {"log", 0x7e0000, 0x10000},
463 {"radio", 0x7f0000, 0x10000},
467 .first_sysupgrade_partition
= "os-image",
468 .last_sysupgrade_partition
= "support-list",
471 /** Firmware layout for the CPE605V1 */
474 .vendor
= "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
477 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
478 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
479 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
481 .soft_ver
= SOFT_VER_DEFAULT
,
484 {"fs-uboot", 0x00000, 0x20000},
485 {"partition-table", 0x20000, 0x02000},
486 {"default-mac", 0x30000, 0x00020},
487 {"serial-number", 0x30100, 0x00020},
488 {"product-info", 0x31100, 0x00100},
489 {"device-info", 0x31400, 0x00400},
490 {"signature", 0x32000, 0x00400},
491 {"device-id", 0x33000, 0x00100},
492 {"firmware", 0x40000, 0x770000},
493 {"soft-version", 0x7b0000, 0x00100},
494 {"support-list", 0x7b1000, 0x01000},
495 {"user-config", 0x7c0000, 0x10000},
496 {"default-config", 0x7d0000, 0x10000},
497 {"log", 0x7e0000, 0x10000},
498 {"radio", 0x7f0000, 0x10000},
502 .first_sysupgrade_partition
= "os-image",
503 .last_sysupgrade_partition
= "support-list",
506 /** Firmware layout for the CPE610V1 */
509 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
512 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
513 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
514 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
515 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
516 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
517 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
518 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
519 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
520 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
521 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
523 .soft_ver
= SOFT_VER_DEFAULT
,
526 {"fs-uboot", 0x00000, 0x20000},
527 {"partition-table", 0x20000, 0x02000},
528 {"default-mac", 0x30000, 0x00020},
529 {"product-info", 0x31100, 0x00100},
530 {"signature", 0x32000, 0x00400},
531 {"firmware", 0x40000, 0x770000},
532 {"soft-version", 0x7b0000, 0x00100},
533 {"support-list", 0x7b1000, 0x00400},
534 {"user-config", 0x7c0000, 0x10000},
535 {"default-config", 0x7d0000, 0x10000},
536 {"log", 0x7e0000, 0x10000},
537 {"radio", 0x7f0000, 0x10000},
541 .first_sysupgrade_partition
= "os-image",
542 .last_sysupgrade_partition
= "support-list",
545 /** Firmware layout for the CPE610V2 */
548 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
551 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
552 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
553 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
554 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
555 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
556 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
557 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
558 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
559 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
560 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
562 .soft_ver
= SOFT_VER_DEFAULT
,
565 {"fs-uboot", 0x00000, 0x20000},
566 {"partition-table", 0x20000, 0x02000},
567 {"default-mac", 0x30000, 0x00020},
568 {"product-info", 0x31100, 0x00100},
569 {"signature", 0x32000, 0x00400},
570 {"firmware", 0x40000, 0x770000},
571 {"soft-version", 0x7b0000, 0x00100},
572 {"support-list", 0x7b1000, 0x00400},
573 {"user-config", 0x7c0000, 0x10000},
574 {"default-config", 0x7d0000, 0x10000},
575 {"log", 0x7e0000, 0x10000},
576 {"radio", 0x7f0000, 0x10000},
580 .first_sysupgrade_partition
= "os-image",
581 .last_sysupgrade_partition
= "support-list",
583 /** Firmware layout for the CPE710 V1 */
586 .vendor
= "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
589 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
590 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
591 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
592 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
593 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
594 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
596 .soft_ver
= SOFT_VER_DEFAULT
,
599 {"fs-uboot", 0x00000, 0x50000},
600 {"partition-table", 0x50000, 0x02000},
601 {"default-mac", 0x60000, 0x00020},
602 {"serial-number", 0x60100, 0x00020},
603 {"product-info", 0x61100, 0x00100},
604 {"device-info", 0x61400, 0x00400},
605 {"signature", 0x62000, 0x00400},
606 {"device-id", 0x63000, 0x00100},
607 {"firmware", 0x70000, 0xf40000},
608 {"soft-version", 0xfb0000, 0x00100},
609 {"support-list", 0xfb1000, 0x01000},
610 {"user-config", 0xfc0000, 0x10000},
611 {"default-config", 0xfd0000, 0x10000},
612 {"log", 0xfe0000, 0x10000},
613 {"radio", 0xff0000, 0x10000},
617 .first_sysupgrade_partition
= "os-image",
618 .last_sysupgrade_partition
= "support-list",
623 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
626 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
627 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
628 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
630 .soft_ver
= SOFT_VER_DEFAULT
,
633 {"fs-uboot", 0x00000, 0x20000},
634 {"partition-table", 0x20000, 0x02000},
635 {"default-mac", 0x30000, 0x00020},
636 {"product-info", 0x31100, 0x00100},
637 {"signature", 0x32000, 0x00400},
638 {"firmware", 0x40000, 0x770000},
639 {"soft-version", 0x7b0000, 0x00100},
640 {"support-list", 0x7b1000, 0x00400},
641 {"user-config", 0x7c0000, 0x10000},
642 {"default-config", 0x7d0000, 0x10000},
643 {"log", 0x7e0000, 0x10000},
644 {"radio", 0x7f0000, 0x10000},
648 .first_sysupgrade_partition
= "os-image",
649 .last_sysupgrade_partition
= "support-list",
654 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
657 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
658 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
659 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
661 .soft_ver
= SOFT_VER_DEFAULT
,
664 {"fs-uboot", 0x00000, 0x20000},
665 {"partition-table", 0x20000, 0x02000},
666 {"default-mac", 0x30000, 0x00020},
667 {"product-info", 0x31100, 0x00100},
668 {"signature", 0x32000, 0x00400},
669 {"firmware", 0x40000, 0x770000},
670 {"soft-version", 0x7b0000, 0x00100},
671 {"support-list", 0x7b1000, 0x00400},
672 {"user-config", 0x7c0000, 0x10000},
673 {"default-config", 0x7d0000, 0x10000},
674 {"log", 0x7e0000, 0x10000},
675 {"radio", 0x7f0000, 0x10000},
679 .first_sysupgrade_partition
= "os-image",
680 .last_sysupgrade_partition
= "support-list",
685 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
688 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
689 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
690 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
691 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
693 .soft_ver
= SOFT_VER_DEFAULT
,
696 {"fs-uboot", 0x00000, 0x20000},
697 {"partition-table", 0x20000, 0x02000},
698 {"default-mac", 0x30000, 0x00020},
699 {"product-info", 0x31100, 0x00100},
700 {"signature", 0x32000, 0x00400},
701 {"firmware", 0x40000, 0x770000},
702 {"soft-version", 0x7b0000, 0x00100},
703 {"support-list", 0x7b1000, 0x00400},
704 {"user-config", 0x7c0000, 0x10000},
705 {"default-config", 0x7d0000, 0x10000},
706 {"log", 0x7e0000, 0x10000},
707 {"radio", 0x7f0000, 0x10000},
711 .first_sysupgrade_partition
= "os-image",
712 .last_sysupgrade_partition
= "support-list",
717 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
720 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
721 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
722 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
723 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
725 .soft_ver
= SOFT_VER_DEFAULT
,
728 {"fs-uboot", 0x00000, 0x20000},
729 {"partition-table", 0x20000, 0x02000},
730 {"default-mac", 0x30000, 0x00020},
731 {"product-info", 0x31100, 0x00100},
732 {"signature", 0x32000, 0x00400},
733 {"firmware", 0x40000, 0x770000},
734 {"soft-version", 0x7b0000, 0x00100},
735 {"support-list", 0x7b1000, 0x00400},
736 {"user-config", 0x7c0000, 0x10000},
737 {"default-config", 0x7d0000, 0x10000},
738 {"log", 0x7e0000, 0x10000},
739 {"radio", 0x7f0000, 0x10000},
743 .first_sysupgrade_partition
= "os-image",
744 .last_sysupgrade_partition
= "support-list",
747 /** Firmware layout for the AD7200 */
753 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
755 .soft_ver
= SOFT_VER_DEFAULT
,
758 {"SBL1", 0x00000, 0x20000},
759 {"MIBIB", 0x20000, 0x20000},
760 {"SBL2", 0x40000, 0x20000},
761 {"SBL3", 0x60000, 0x30000},
762 {"DDRCONFIG", 0x90000, 0x10000},
763 {"SSD", 0xa0000, 0x10000},
764 {"TZ", 0xb0000, 0x30000},
765 {"RPM", 0xe0000, 0x20000},
766 {"fs-uboot", 0x100000, 0x70000},
767 {"uboot-env", 0x170000, 0x40000},
768 {"radio", 0x1b0000, 0x40000},
769 {"os-image", 0x1f0000, 0x400000},
770 {"file-system", 0x5f0000, 0x1900000},
771 {"default-mac", 0x1ef0000, 0x00200},
772 {"pin", 0x1ef0200, 0x00200},
773 {"device-id", 0x1ef0400, 0x00200},
774 {"product-info", 0x1ef0600, 0x0fa00},
775 {"partition-table", 0x1f00000, 0x10000},
776 {"soft-version", 0x1f10000, 0x10000},
777 {"support-list", 0x1f20000, 0x10000},
778 {"profile", 0x1f30000, 0x10000},
779 {"default-config", 0x1f40000, 0x10000},
780 {"user-config", 0x1f50000, 0x40000},
781 {"qos-db", 0x1f90000, 0x40000},
782 {"usb-config", 0x1fd0000, 0x10000},
783 {"log", 0x1fe0000, 0x20000},
787 .first_sysupgrade_partition
= "os-image",
788 .last_sysupgrade_partition
= "file-system"
791 /** Firmware layout for the C2600 */
797 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
799 .soft_ver
= SOFT_VER_DEFAULT
,
802 We use a bigger os-image partition than the stock images (and thus
803 smaller file-system), as our kernel doesn't fit in the stock firmware's
804 2 MB os-image since kernel 4.14.
807 {"SBL1", 0x00000, 0x20000},
808 {"MIBIB", 0x20000, 0x20000},
809 {"SBL2", 0x40000, 0x20000},
810 {"SBL3", 0x60000, 0x30000},
811 {"DDRCONFIG", 0x90000, 0x10000},
812 {"SSD", 0xa0000, 0x10000},
813 {"TZ", 0xb0000, 0x30000},
814 {"RPM", 0xe0000, 0x20000},
815 {"fs-uboot", 0x100000, 0x70000},
816 {"uboot-env", 0x170000, 0x40000},
817 {"radio", 0x1b0000, 0x40000},
818 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
819 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
820 {"default-mac", 0x1ef0000, 0x00200},
821 {"pin", 0x1ef0200, 0x00200},
822 {"product-info", 0x1ef0400, 0x0fc00},
823 {"partition-table", 0x1f00000, 0x10000},
824 {"soft-version", 0x1f10000, 0x10000},
825 {"support-list", 0x1f20000, 0x10000},
826 {"profile", 0x1f30000, 0x10000},
827 {"default-config", 0x1f40000, 0x10000},
828 {"user-config", 0x1f50000, 0x40000},
829 {"qos-db", 0x1f90000, 0x40000},
830 {"usb-config", 0x1fd0000, 0x10000},
831 {"log", 0x1fe0000, 0x20000},
835 .first_sysupgrade_partition
= "os-image",
836 .last_sysupgrade_partition
= "file-system"
839 /** Firmware layout for the A7-V5 */
841 .id
= "ARCHER-A7-V5",
844 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
845 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
846 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
847 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
848 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
849 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
851 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
853 /* We're using a dynamic kernel/rootfs split here */
855 {"factory-boot", 0x00000, 0x20000},
856 {"fs-uboot", 0x20000, 0x20000},
857 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
858 /* Stock: name file-system base 0x160000 size 0xda0000 */
859 {"default-mac", 0xf40000, 0x00200},
860 {"pin", 0xf40200, 0x00200},
861 {"device-id", 0xf40400, 0x00100},
862 {"product-info", 0xf40500, 0x0fb00},
863 {"soft-version", 0xf50000, 0x00100},
864 {"extra-para", 0xf51000, 0x01000},
865 {"support-list", 0xf52000, 0x0a000},
866 {"profile", 0xf5c000, 0x04000},
867 {"default-config", 0xf60000, 0x10000},
868 {"user-config", 0xf70000, 0x40000},
869 {"certificate", 0xfb0000, 0x10000},
870 {"partition-table", 0xfc0000, 0x10000},
871 {"log", 0xfd0000, 0x20000},
872 {"radio", 0xff0000, 0x10000},
876 .first_sysupgrade_partition
= "os-image",
877 .last_sysupgrade_partition
= "file-system",
880 /** Firmware layout for the Archer A9 v6 */
882 .id
= "ARCHER-A9-V6",
885 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
886 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
887 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
888 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
889 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
891 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
893 /* We're using a dynamic kernel/rootfs split here */
895 {"factory-boot", 0x00000, 0x20000},
896 {"fs-uboot", 0x20000, 0x20000},
897 {"partition-table", 0x40000, 0x10000},
898 {"radio", 0x50000, 0x10000},
899 {"default-mac", 0x60000, 0x00200},
900 {"pin", 0x60200, 0x00200},
901 {"device-id", 0x60400, 0x00100},
902 {"product-info", 0x60500, 0x0fb00},
903 {"soft-version", 0x70000, 0x01000},
904 {"extra-para", 0x71000, 0x01000},
905 {"support-list", 0x72000, 0x0a000},
906 {"profile", 0x7c000, 0x04000},
907 {"user-config", 0x80000, 0x10000},
908 {"ap-config", 0x90000, 0x10000},
909 {"apdef-config", 0xa0000, 0x10000},
910 {"router-config", 0xb0000, 0x10000},
911 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
912 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
913 {"log", 0xfc0000, 0x20000},
914 {"certificate", 0xfe0000, 0x10000},
915 {"default-config", 0xff0000, 0x10000},
919 .first_sysupgrade_partition
= "os-image",
920 .last_sysupgrade_partition
= "file-system",
923 /** Firmware layout for the C2v3 */
925 .id
= "ARCHER-C2-V3",
928 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
929 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
930 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
932 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.1\n"),
934 /** We're using a dynamic kernel/rootfs split here */
937 {"factory-boot", 0x00000, 0x20000},
938 {"fs-uboot", 0x20000, 0x10000},
939 {"firmware", 0x30000, 0x7a0000},
940 {"user-config", 0x7d0000, 0x04000},
941 {"default-mac", 0x7e0000, 0x00100},
942 {"device-id", 0x7e0100, 0x00100},
943 {"extra-para", 0x7e0200, 0x00100},
944 {"pin", 0x7e0300, 0x00100},
945 {"support-list", 0x7e0400, 0x00400},
946 {"soft-version", 0x7e0800, 0x00400},
947 {"product-info", 0x7e0c00, 0x01400},
948 {"partition-table", 0x7e2000, 0x01000},
949 {"profile", 0x7e3000, 0x01000},
950 {"default-config", 0x7e4000, 0x04000},
951 {"merge-config", 0x7ec000, 0x02000},
952 {"qos-db", 0x7ee000, 0x02000},
953 {"radio", 0x7f0000, 0x10000},
957 .first_sysupgrade_partition
= "os-image",
958 .last_sysupgrade_partition
= "file-system",
961 /** Firmware layout for the C25v1 */
963 .id
= "ARCHER-C25-V1",
966 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
967 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
968 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
970 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
972 /* We're using a dynamic kernel/rootfs split here */
974 {"factory-boot", 0x00000, 0x20000},
975 {"fs-uboot", 0x20000, 0x10000},
976 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
977 /* Stock: name file-system base 0x130000 size 0x6a0000 */
978 {"user-config", 0x7d0000, 0x04000},
979 {"default-mac", 0x7e0000, 0x00100},
980 {"device-id", 0x7e0100, 0x00100},
981 {"extra-para", 0x7e0200, 0x00100},
982 {"pin", 0x7e0300, 0x00100},
983 {"support-list", 0x7e0400, 0x00400},
984 {"soft-version", 0x7e0800, 0x00400},
985 {"product-info", 0x7e0c00, 0x01400},
986 {"partition-table", 0x7e2000, 0x01000},
987 {"profile", 0x7e3000, 0x01000},
988 {"default-config", 0x7e4000, 0x04000},
989 {"merge-config", 0x7ec000, 0x02000},
990 {"qos-db", 0x7ee000, 0x02000},
991 {"radio", 0x7f0000, 0x10000},
995 .first_sysupgrade_partition
= "os-image",
996 .last_sysupgrade_partition
= "file-system",
999 /** Firmware layout for the C58v1 */
1001 .id
= "ARCHER-C58-V1",
1005 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1006 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1007 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1009 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1012 {"fs-uboot", 0x00000, 0x10000},
1013 {"default-mac", 0x10000, 0x00200},
1014 {"pin", 0x10200, 0x00200},
1015 {"product-info", 0x10400, 0x00100},
1016 {"partition-table", 0x10500, 0x00800},
1017 {"soft-version", 0x11300, 0x00200},
1018 {"support-list", 0x11500, 0x00100},
1019 {"device-id", 0x11600, 0x00100},
1020 {"profile", 0x11700, 0x03900},
1021 {"default-config", 0x15000, 0x04000},
1022 {"user-config", 0x19000, 0x04000},
1023 {"firmware", 0x20000, 0x7c8000},
1024 {"certyficate", 0x7e8000, 0x08000},
1025 {"radio", 0x7f0000, 0x10000},
1029 .first_sysupgrade_partition
= "os-image",
1030 .last_sysupgrade_partition
= "file-system",
1033 /** Firmware layout for the C59v1 */
1035 .id
= "ARCHER-C59-V1",
1039 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1040 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1041 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1042 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1044 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1046 /* We're using a dynamic kernel/rootfs split here */
1048 {"fs-uboot", 0x00000, 0x10000},
1049 {"default-mac", 0x10000, 0x00200},
1050 {"pin", 0x10200, 0x00200},
1051 {"device-id", 0x10400, 0x00100},
1052 {"product-info", 0x10500, 0x0fb00},
1053 {"firmware", 0x20000, 0xe30000},
1054 {"partition-table", 0xe50000, 0x10000},
1055 {"soft-version", 0xe60000, 0x10000},
1056 {"support-list", 0xe70000, 0x10000},
1057 {"profile", 0xe80000, 0x10000},
1058 {"default-config", 0xe90000, 0x10000},
1059 {"user-config", 0xea0000, 0x40000},
1060 {"usb-config", 0xee0000, 0x10000},
1061 {"certificate", 0xef0000, 0x10000},
1062 {"qos-db", 0xf00000, 0x40000},
1063 {"log", 0xfe0000, 0x10000},
1064 {"radio", 0xff0000, 0x10000},
1068 .first_sysupgrade_partition
= "os-image",
1069 .last_sysupgrade_partition
= "file-system",
1072 /** Firmware layout for the C59v2 */
1074 .id
= "ARCHER-C59-V2",
1078 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1079 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1080 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1082 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1084 /** We're using a dynamic kernel/rootfs split here */
1086 {"factory-boot", 0x00000, 0x20000},
1087 {"fs-uboot", 0x20000, 0x10000},
1088 {"default-mac", 0x30000, 0x00200},
1089 {"pin", 0x30200, 0x00200},
1090 {"device-id", 0x30400, 0x00100},
1091 {"product-info", 0x30500, 0x0fb00},
1092 {"firmware", 0x40000, 0xe10000},
1093 {"partition-table", 0xe50000, 0x10000},
1094 {"soft-version", 0xe60000, 0x10000},
1095 {"support-list", 0xe70000, 0x10000},
1096 {"profile", 0xe80000, 0x10000},
1097 {"default-config", 0xe90000, 0x10000},
1098 {"user-config", 0xea0000, 0x40000},
1099 {"usb-config", 0xee0000, 0x10000},
1100 {"certificate", 0xef0000, 0x10000},
1101 {"extra-para", 0xf00000, 0x10000},
1102 {"qos-db", 0xf10000, 0x30000},
1103 {"log", 0xfe0000, 0x10000},
1104 {"radio", 0xff0000, 0x10000},
1108 .first_sysupgrade_partition
= "os-image",
1109 .last_sysupgrade_partition
= "file-system",
1112 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1114 .id
= "ARCHER-C6-V2",
1118 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1119 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1120 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1121 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1123 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1126 {"fs-uboot", 0x00000, 0x20000},
1127 {"default-mac", 0x20000, 0x00200},
1128 {"pin", 0x20200, 0x00100},
1129 {"product-info", 0x20300, 0x00200},
1130 {"device-id", 0x20500, 0x0fb00},
1131 {"firmware", 0x30000, 0x7a9400},
1132 {"soft-version", 0x7d9400, 0x00100},
1133 {"extra-para", 0x7d9500, 0x00100},
1134 {"support-list", 0x7d9600, 0x00200},
1135 {"profile", 0x7d9800, 0x03000},
1136 {"default-config", 0x7dc800, 0x03000},
1137 {"partition-table", 0x7df800, 0x00800},
1138 {"user-config", 0x7e0000, 0x0c000},
1139 {"certificate", 0x7ec000, 0x04000},
1140 {"radio", 0x7f0000, 0x10000},
1144 .first_sysupgrade_partition
= "os-image",
1145 .last_sysupgrade_partition
= "file-system",
1148 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1150 .id
= "ARCHER-C6-V2-US",
1154 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1155 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1156 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1158 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1161 {"factory-boot", 0x00000, 0x20000},
1162 {"default-mac", 0x20000, 0x00200},
1163 {"pin", 0x20200, 0x00100},
1164 {"product-info", 0x20300, 0x00200},
1165 {"device-id", 0x20500, 0x0fb00},
1166 {"fs-uboot", 0x30000, 0x20000},
1167 {"firmware", 0x50000, 0xf89400},
1168 {"soft-version", 0xfd9400, 0x00100},
1169 {"extra-para", 0xfd9500, 0x00100},
1170 {"support-list", 0xfd9600, 0x00200},
1171 {"profile", 0xfd9800, 0x03000},
1172 {"default-config", 0xfdc800, 0x03000},
1173 {"partition-table", 0xfdf800, 0x00800},
1174 {"user-config", 0xfe0000, 0x0c000},
1175 {"certificate", 0xfec000, 0x04000},
1176 {"radio", 0xff0000, 0x10000},
1179 .first_sysupgrade_partition
= "os-image",
1180 .last_sysupgrade_partition
= "file-system",
1182 /** Firmware layout for the Archer C6 v3 */
1184 .id
= "ARCHER-C6-V3",
1188 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1189 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1190 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1191 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1192 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1193 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1195 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1198 {"fs-uboot", 0x00000, 0x40000},
1199 {"firmware", 0x40000, 0xf60000},
1200 {"default-mac", 0xfa0000, 0x00200},
1201 {"pin", 0xfa0200, 0x00100},
1202 {"device-id", 0xfa0300, 0x00100},
1203 {"product-info", 0xfa0400, 0x0fc00},
1204 {"default-config", 0xfb0000, 0x08000},
1205 {"ap-def-config", 0xfb8000, 0x08000},
1206 {"user-config", 0xfc0000, 0x0a000},
1207 {"ag-config", 0xfca000, 0x04000},
1208 {"certificate", 0xfce000, 0x02000},
1209 {"ap-config", 0xfd0000, 0x06000},
1210 {"router-config", 0xfd6000, 0x06000},
1211 {"favicon", 0xfdc000, 0x02000},
1212 {"logo", 0xfde000, 0x02000},
1213 {"partition-table", 0xfe0000, 0x00800},
1214 {"soft-version", 0xfe0800, 0x00100},
1215 {"support-list", 0xfe0900, 0x00200},
1216 {"profile", 0xfe0b00, 0x03000},
1217 {"extra-para", 0xfe3b00, 0x00100},
1218 {"radio", 0xff0000, 0x10000},
1221 .first_sysupgrade_partition
= "os-image",
1222 .last_sysupgrade_partition
= "file-system",
1224 /** Firmware layout for the Archer A6 v3 */
1226 .id
= "ARCHER-A6-V3",
1230 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1231 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1232 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1233 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1235 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1238 {"fs-uboot", 0x00000, 0x40000},
1239 {"firmware", 0x40000, 0xf60000},
1240 {"default-mac", 0xfa0000, 0x00200},
1241 {"pin", 0xfa0200, 0x00100},
1242 {"device-id", 0xfa0300, 0x00100},
1243 {"product-info", 0xfa0400, 0x0fc00},
1244 {"default-config", 0xfb0000, 0x08000},
1245 {"ap-def-config", 0xfb8000, 0x08000},
1246 {"user-config", 0xfc0000, 0x0a000},
1247 {"ag-config", 0xfca000, 0x04000},
1248 {"certificate", 0xfce000, 0x02000},
1249 {"ap-config", 0xfd0000, 0x06000},
1250 {"router-config", 0xfd6000, 0x06000},
1251 {"favicon", 0xfdc000, 0x02000},
1252 {"logo", 0xfde000, 0x02000},
1253 {"partition-table", 0xfe0000, 0x00800},
1254 {"soft-version", 0xfe0800, 0x00100},
1255 {"support-list", 0xfe0900, 0x00200},
1256 {"profile", 0xfe0b00, 0x03000},
1257 {"extra-para", 0xfe3b00, 0x00100},
1258 {"radio", 0xff0000, 0x10000},
1261 .first_sysupgrade_partition
= "os-image",
1262 .last_sysupgrade_partition
= "file-system",
1264 /** Firmware layout for the Archer C6U v1 */
1266 .id
= "ARCHER-C6U-V1",
1270 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1272 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1275 {"fs-uboot", 0x00000, 0x40000},
1276 {"firmware", 0x40000, 0xf60000},
1277 {"default-mac", 0xfa0000, 0x00200},
1278 {"pin", 0xfa0200, 0x00100},
1279 {"device-id", 0xfa0300, 0x00100},
1280 {"product-info", 0xfa0400, 0x0fc00},
1281 {"default-config", 0xfb0000, 0x08000},
1282 {"ap-def-config", 0xfb8000, 0x08000},
1283 {"user-config", 0xfc0000, 0x0c000},
1284 {"certificate", 0xfcc000, 0x04000},
1285 {"ap-config", 0xfd0000, 0x08000},
1286 {"router-config", 0xfd8000, 0x08000},
1287 {"partition-table", 0xfe0000, 0x00800},
1288 {"soft-version", 0xfe0800, 0x00100},
1289 {"support-list", 0xfe0900, 0x00200},
1290 {"profile", 0xfe0b00, 0x03000},
1291 {"extra-para", 0xfe3b00, 0x00100},
1292 {"radio", 0xff0000, 0x10000},
1295 .first_sysupgrade_partition
= "os-image",
1296 .last_sysupgrade_partition
= "file-system",
1298 /** Firmware layout for the C60v1 */
1300 .id
= "ARCHER-C60-V1",
1304 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1305 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1306 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1308 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1311 {"fs-uboot", 0x00000, 0x10000},
1312 {"default-mac", 0x10000, 0x00200},
1313 {"pin", 0x10200, 0x00200},
1314 {"product-info", 0x10400, 0x00100},
1315 {"partition-table", 0x10500, 0x00800},
1316 {"soft-version", 0x11300, 0x00200},
1317 {"support-list", 0x11500, 0x00100},
1318 {"device-id", 0x11600, 0x00100},
1319 {"profile", 0x11700, 0x03900},
1320 {"default-config", 0x15000, 0x04000},
1321 {"user-config", 0x19000, 0x04000},
1322 {"firmware", 0x20000, 0x7c8000},
1323 {"certyficate", 0x7e8000, 0x08000},
1324 {"radio", 0x7f0000, 0x10000},
1328 .first_sysupgrade_partition
= "os-image",
1329 .last_sysupgrade_partition
= "file-system",
1332 /** Firmware layout for the C60v2 */
1334 .id
= "ARCHER-C60-V2",
1338 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1339 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1340 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1342 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1345 {"factory-boot", 0x00000, 0x1fb00},
1346 {"default-mac", 0x1fb00, 0x00200},
1347 {"pin", 0x1fd00, 0x00100},
1348 {"product-info", 0x1fe00, 0x00100},
1349 {"device-id", 0x1ff00, 0x00100},
1350 {"fs-uboot", 0x20000, 0x10000},
1351 {"firmware", 0x30000, 0x7a0000},
1352 {"soft-version", 0x7d9500, 0x00100},
1353 {"support-list", 0x7d9600, 0x00100},
1354 {"extra-para", 0x7d9700, 0x00100},
1355 {"profile", 0x7d9800, 0x03000},
1356 {"default-config", 0x7dc800, 0x03000},
1357 {"partition-table", 0x7df800, 0x00800},
1358 {"user-config", 0x7e0000, 0x0c000},
1359 {"certificate", 0x7ec000, 0x04000},
1360 {"radio", 0x7f0000, 0x10000},
1364 .first_sysupgrade_partition
= "os-image",
1365 .last_sysupgrade_partition
= "file-system",
1368 /** Firmware layout for the C60v3 */
1370 .id
= "ARCHER-C60-V3",
1374 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1375 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1376 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1378 .soft_ver
= SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1381 {"factory-boot", 0x00000, 0x1fb00},
1382 {"default-mac", 0x1fb00, 0x00200},
1383 {"pin", 0x1fd00, 0x00100},
1384 {"product-info", 0x1fe00, 0x00100},
1385 {"device-id", 0x1ff00, 0x00100},
1386 {"fs-uboot", 0x20000, 0x10000},
1387 {"firmware", 0x30000, 0x7a0000},
1388 {"soft-version", 0x7d9500, 0x00100},
1389 {"support-list", 0x7d9600, 0x00100},
1390 {"extra-para", 0x7d9700, 0x00100},
1391 {"profile", 0x7d9800, 0x03000},
1392 {"default-config", 0x7dc800, 0x03000},
1393 {"partition-table", 0x7df800, 0x00800},
1394 {"user-config", 0x7e0000, 0x0c000},
1395 {"certificate", 0x7ec000, 0x04000},
1396 {"radio", 0x7f0000, 0x10000},
1400 .first_sysupgrade_partition
= "os-image",
1401 .last_sysupgrade_partition
= "file-system",
1404 /** Firmware layout for the C5 */
1406 .id
= "ARCHER-C5-V2",
1410 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1411 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1412 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1414 .soft_ver
= SOFT_VER_DEFAULT
,
1417 {"fs-uboot", 0x00000, 0x40000},
1418 {"os-image", 0x40000, 0x200000},
1419 {"file-system", 0x240000, 0xc00000},
1420 {"default-mac", 0xe40000, 0x00200},
1421 {"pin", 0xe40200, 0x00200},
1422 {"product-info", 0xe40400, 0x00200},
1423 {"partition-table", 0xe50000, 0x10000},
1424 {"soft-version", 0xe60000, 0x00200},
1425 {"support-list", 0xe61000, 0x0f000},
1426 {"profile", 0xe70000, 0x10000},
1427 {"default-config", 0xe80000, 0x10000},
1428 {"user-config", 0xe90000, 0x50000},
1429 {"log", 0xee0000, 0x100000},
1430 {"radio_bk", 0xfe0000, 0x10000},
1431 {"radio", 0xff0000, 0x10000},
1435 .first_sysupgrade_partition
= "os-image",
1436 .last_sysupgrade_partition
= "file-system"
1439 /** Firmware layout for the C7 */
1441 .id
= "ARCHER-C7-V4",
1444 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1445 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1446 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1447 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1448 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1449 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1450 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1451 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1452 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1453 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1455 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1457 /* We're using a dynamic kernel/rootfs split here */
1459 {"factory-boot", 0x00000, 0x20000},
1460 {"fs-uboot", 0x20000, 0x20000},
1461 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1462 /* Stock: name file-system base 0x160000 size 0xda0000 */
1463 {"default-mac", 0xf00000, 0x00200},
1464 {"pin", 0xf00200, 0x00200},
1465 {"device-id", 0xf00400, 0x00100},
1466 {"product-info", 0xf00500, 0x0fb00},
1467 {"soft-version", 0xf10000, 0x00100},
1468 {"extra-para", 0xf11000, 0x01000},
1469 {"support-list", 0xf12000, 0x0a000},
1470 {"profile", 0xf1c000, 0x04000},
1471 {"default-config", 0xf20000, 0x10000},
1472 {"user-config", 0xf30000, 0x40000},
1473 {"qos-db", 0xf70000, 0x40000},
1474 {"certificate", 0xfb0000, 0x10000},
1475 {"partition-table", 0xfc0000, 0x10000},
1476 {"log", 0xfd0000, 0x20000},
1477 {"radio", 0xff0000, 0x10000},
1481 .first_sysupgrade_partition
= "os-image",
1482 .last_sysupgrade_partition
= "file-system",
1485 /** Firmware layout for the C7 v5*/
1487 .id
= "ARCHER-C7-V5",
1490 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1491 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1492 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1493 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1494 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1495 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1496 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1497 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1500 .soft_ver
= SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1502 /* We're using a dynamic kernel/rootfs split here */
1504 {"factory-boot", 0x00000, 0x20000},
1505 {"fs-uboot", 0x20000, 0x20000},
1506 {"partition-table", 0x40000, 0x10000},
1507 {"radio", 0x50000, 0x10000},
1508 {"default-mac", 0x60000, 0x00200},
1509 {"pin", 0x60200, 0x00200},
1510 {"device-id", 0x60400, 0x00100},
1511 {"product-info", 0x60500, 0x0fb00},
1512 {"soft-version", 0x70000, 0x01000},
1513 {"extra-para", 0x71000, 0x01000},
1514 {"support-list", 0x72000, 0x0a000},
1515 {"profile", 0x7c000, 0x04000},
1516 {"user-config", 0x80000, 0x40000},
1519 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1520 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1522 {"log", 0xfc0000, 0x20000},
1523 {"certificate", 0xfe0000, 0x10000},
1524 {"default-config", 0xff0000, 0x10000},
1529 .first_sysupgrade_partition
= "os-image",
1530 .last_sysupgrade_partition
= "file-system",
1533 /** Firmware layout for the C9 */
1539 "{product_name:ArcherC9,"
1540 "product_ver:1.0.0,"
1541 "special_id:00000000}\n",
1543 .soft_ver
= SOFT_VER_DEFAULT
,
1546 {"fs-uboot", 0x00000, 0x40000},
1547 {"os-image", 0x40000, 0x200000},
1548 {"file-system", 0x240000, 0xc00000},
1549 {"default-mac", 0xe40000, 0x00200},
1550 {"pin", 0xe40200, 0x00200},
1551 {"product-info", 0xe40400, 0x00200},
1552 {"partition-table", 0xe50000, 0x10000},
1553 {"soft-version", 0xe60000, 0x00200},
1554 {"support-list", 0xe61000, 0x0f000},
1555 {"profile", 0xe70000, 0x10000},
1556 {"default-config", 0xe80000, 0x10000},
1557 {"user-config", 0xe90000, 0x50000},
1558 {"log", 0xee0000, 0x100000},
1559 {"radio_bk", 0xfe0000, 0x10000},
1560 {"radio", 0xff0000, 0x10000},
1564 .first_sysupgrade_partition
= "os-image",
1565 .last_sysupgrade_partition
= "file-system"
1568 /** Firmware layout for the Deco M4R v1 and v2 */
1570 .id
= "DECO-M4R-V1",
1574 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1575 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1576 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1577 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1578 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1579 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1580 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1581 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1582 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1583 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1584 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1585 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1586 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1587 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1588 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1589 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1591 .soft_ver
= SOFT_VER_DEFAULT
,
1594 {"fs-uboot", 0x00000, 0x80000},
1595 {"firmware", 0x80000, 0xe00000},
1596 {"product-info", 0xe80000, 0x05000},
1597 {"default-mac", 0xe85000, 0x01000},
1598 {"device-id", 0xe86000, 0x01000},
1599 {"support-list", 0xe87000, 0x10000},
1600 {"user-config", 0xea7000, 0x10000},
1601 {"device-config", 0xeb7000, 0x10000},
1602 {"group-info", 0xec7000, 0x10000},
1603 {"partition-table", 0xed7000, 0x02000},
1604 {"soft-version", 0xed9000, 0x10000},
1605 {"profile", 0xee9000, 0x10000},
1606 {"default-config", 0xef9000, 0x10000},
1607 {"url-sig", 0xfe0000, 0x10000},
1608 {"radio", 0xff0000, 0x10000},
1611 .first_sysupgrade_partition
= "os-image",
1612 .last_sysupgrade_partition
= "file-system",
1615 /** Firmware layout for the Deco M4R v4 */
1617 .id
= "DECO-M4R-V4",
1621 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1622 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1623 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1624 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1625 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1627 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1630 {"fs-uboot", 0x00000, 0x40000},
1631 {"firmware", 0x40000, 0xf60000},
1632 {"default-mac", 0xfa0000, 0x00300},
1633 {"device-id", 0xfa0300, 0x00100},
1634 {"product-info", 0xfa0400, 0x0fc00},
1635 {"group-info", 0xfb0000, 0x04000},
1636 {"user-config", 0xfb4000, 0x0c000},
1637 {"device-config", 0xfc0000, 0x10000},
1638 {"default-config", 0xfd0000, 0x10000},
1639 {"partition-table", 0xfe0000, 0x00800},
1640 {"soft-version", 0xfe0800, 0x00100},
1641 {"support-list", 0xfe0900, 0x00200},
1642 {"profile", 0xfe0b00, 0x03000},
1643 {"extra-para", 0xfe3b00, 0x00100},
1644 {"radio", 0xff0000, 0x10000},
1647 .first_sysupgrade_partition
= "os-image",
1648 .last_sysupgrade_partition
= "file-system",
1651 /** Firmware layout for the Deco S4 v2 */
1657 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1658 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1659 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1660 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1661 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1662 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1663 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1664 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1665 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1666 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1667 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1668 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1670 .soft_ver
= SOFT_VER_DEFAULT
,
1673 {"fs-uboot", 0x00000, 0x80000},
1674 {"product-info", 0x80000, 0x05000},
1675 {"default-mac", 0x85000, 0x01000},
1676 {"device-id", 0x86000, 0x01000},
1677 {"support-list", 0x87000, 0x10000},
1678 {"user-config", 0xa7000, 0x10000},
1679 {"device-config", 0xb7000, 0x10000},
1680 {"group-info", 0xc7000, 0x10000},
1681 {"partition-table", 0xd7000, 0x02000},
1682 {"soft-version", 0xd9000, 0x10000},
1683 {"profile", 0xe9000, 0x10000},
1684 {"default-config", 0xf9000, 0x10000},
1685 {"url-sig", 0x1e0000, 0x10000},
1686 {"radio", 0x1f0000, 0x10000},
1687 {"firmware", 0x200000, 0xe00000},
1690 .first_sysupgrade_partition
= "os-image",
1691 .last_sysupgrade_partition
= "file-system",
1694 /** Firmware layout for the EAP120 */
1697 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1700 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1702 .soft_ver
= SOFT_VER_DEFAULT
,
1705 {"fs-uboot", 0x00000, 0x20000},
1706 {"partition-table", 0x20000, 0x02000},
1707 {"default-mac", 0x30000, 0x00020},
1708 {"support-list", 0x31000, 0x00100},
1709 {"product-info", 0x31100, 0x00100},
1710 {"soft-version", 0x32000, 0x00100},
1711 {"os-image", 0x40000, 0x180000},
1712 {"file-system", 0x1c0000, 0x600000},
1713 {"user-config", 0x7c0000, 0x10000},
1714 {"backup-config", 0x7d0000, 0x10000},
1715 {"log", 0x7e0000, 0x10000},
1716 {"radio", 0x7f0000, 0x10000},
1720 .first_sysupgrade_partition
= "os-image",
1721 .last_sysupgrade_partition
= "file-system"
1724 /** Firmware layout for the EAP225-Outdoor v1 */
1726 .id
= "EAP225-OUTDOOR-V1",
1729 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1730 .part_trail
= PART_TRAIL_NONE
,
1731 .soft_ver
= SOFT_VER_DEFAULT
,
1732 .soft_ver_compat_level
= 1,
1735 {"fs-uboot", 0x00000, 0x20000},
1736 {"partition-table", 0x20000, 0x02000},
1737 {"default-mac", 0x30000, 0x01000},
1738 {"support-list", 0x31000, 0x00100},
1739 {"product-info", 0x31100, 0x00400},
1740 {"soft-version", 0x32000, 0x00100},
1741 {"firmware", 0x40000, 0xd80000},
1742 {"user-config", 0xdc0000, 0x30000},
1743 {"mutil-log", 0xf30000, 0x80000},
1744 {"oops", 0xfb0000, 0x40000},
1745 {"radio", 0xff0000, 0x10000},
1749 .first_sysupgrade_partition
= "os-image",
1750 .last_sysupgrade_partition
= "file-system"
1753 /** Firmware layout for the EAP225 v1 */
1758 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1759 .part_trail
= PART_TRAIL_NONE
,
1760 .soft_ver
= SOFT_VER_DEFAULT
,
1763 {"fs-uboot", 0x00000, 0x20000},
1764 {"partition-table", 0x20000, 0x02000},
1765 {"default-mac", 0x30000, 0x01000},
1766 {"support-list", 0x31000, 0x00100},
1767 {"product-info", 0x31100, 0x00400},
1768 {"soft-version", 0x32000, 0x00100},
1769 {"firmware", 0x40000, 0xd80000},
1770 {"user-config", 0xdc0000, 0x30000},
1771 {"radio", 0xff0000, 0x10000},
1775 .first_sysupgrade_partition
= "os-image",
1776 .last_sysupgrade_partition
= "file-system"
1779 /** Firmware layout for the EAP225 v3
1780 * Also compatible with:
1783 * - EAP225-Outdoor v1
1784 * - EAP225-Outdoor v3
1790 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1791 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1792 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1793 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1794 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1795 .part_trail
= PART_TRAIL_NONE
,
1796 .soft_ver
= SOFT_VER_DEFAULT
,
1797 .soft_ver_compat_level
= 1,
1800 {"fs-uboot", 0x00000, 0x20000},
1801 {"partition-table", 0x20000, 0x02000},
1802 {"default-mac", 0x30000, 0x01000},
1803 {"support-list", 0x31000, 0x00100},
1804 {"product-info", 0x31100, 0x00400},
1805 {"soft-version", 0x32000, 0x00100},
1806 {"firmware", 0x40000, 0xd80000},
1807 {"user-config", 0xdc0000, 0x30000},
1808 {"mutil-log", 0xf30000, 0x80000},
1809 {"oops", 0xfb0000, 0x40000},
1810 {"radio", 0xff0000, 0x10000},
1814 .first_sysupgrade_partition
= "os-image",
1815 .last_sysupgrade_partition
= "file-system"
1818 /** Firmware layout for the EAP225-Wall v2 */
1820 .id
= "EAP225-WALL-V2",
1823 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1824 .part_trail
= PART_TRAIL_NONE
,
1825 .soft_ver
= SOFT_VER_DEFAULT
,
1826 .soft_ver_compat_level
= 1,
1829 {"fs-uboot", 0x00000, 0x20000},
1830 {"partition-table", 0x20000, 0x02000},
1831 {"default-mac", 0x30000, 0x01000},
1832 {"support-list", 0x31000, 0x00100},
1833 {"product-info", 0x31100, 0x00400},
1834 {"soft-version", 0x32000, 0x00100},
1835 {"firmware", 0x40000, 0xd80000},
1836 {"user-config", 0xdc0000, 0x30000},
1837 {"mutil-log", 0xf30000, 0x80000},
1838 {"oops", 0xfb0000, 0x40000},
1839 {"radio", 0xff0000, 0x10000},
1843 .first_sysupgrade_partition
= "os-image",
1844 .last_sysupgrade_partition
= "file-system"
1847 /** Firmware layout for the EAP235-Wall v1 */
1849 .id
= "EAP235-WALL-V1",
1852 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1853 .part_trail
= PART_TRAIL_NONE
,
1854 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1855 .soft_ver_compat_level
= 1,
1858 {"fs-uboot", 0x00000, 0x80000},
1859 {"partition-table", 0x80000, 0x02000},
1860 {"default-mac", 0x90000, 0x01000},
1861 {"support-list", 0x91000, 0x00100},
1862 {"product-info", 0x91100, 0x00400},
1863 {"soft-version", 0x92000, 0x00100},
1864 {"firmware", 0xa0000, 0xd20000},
1865 {"user-config", 0xdc0000, 0x30000},
1866 {"mutil-log", 0xf30000, 0x80000},
1867 {"oops", 0xfb0000, 0x40000},
1868 {"radio", 0xff0000, 0x10000},
1872 .first_sysupgrade_partition
= "os-image",
1873 .last_sysupgrade_partition
= "file-system"
1876 /** Firmware layout for the EAP245 v1 */
1881 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1882 .part_trail
= PART_TRAIL_NONE
,
1883 .soft_ver
= SOFT_VER_DEFAULT
,
1886 {"fs-uboot", 0x00000, 0x20000},
1887 {"partition-table", 0x20000, 0x02000},
1888 {"default-mac", 0x30000, 0x01000},
1889 {"support-list", 0x31000, 0x00100},
1890 {"product-info", 0x31100, 0x00400},
1891 {"soft-version", 0x32000, 0x00100},
1892 {"firmware", 0x40000, 0xd80000},
1893 {"user-config", 0xdc0000, 0x30000},
1894 {"radio", 0xff0000, 0x10000},
1898 .first_sysupgrade_partition
= "os-image",
1899 .last_sysupgrade_partition
= "file-system"
1902 /** Firmware layout for the EAP245 v3 */
1907 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
1908 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
1909 .part_trail
= PART_TRAIL_NONE
,
1910 .soft_ver
= SOFT_VER_DEFAULT
,
1911 .soft_ver_compat_level
= 1,
1913 /** Firmware partition with dynamic kernel/rootfs split */
1915 {"factroy-boot", 0x00000, 0x40000},
1916 {"fs-uboot", 0x40000, 0x40000},
1917 {"partition-table", 0x80000, 0x10000},
1918 {"default-mac", 0x90000, 0x01000},
1919 {"support-list", 0x91000, 0x00100},
1920 {"product-info", 0x91100, 0x00400},
1921 {"soft-version", 0x92000, 0x00100},
1922 {"radio", 0xa0000, 0x10000},
1923 {"extra-para", 0xb0000, 0x10000},
1924 {"firmware", 0xc0000, 0xe40000},
1925 {"config", 0xf00000, 0x30000},
1926 {"mutil-log", 0xf30000, 0x80000},
1927 {"oops", 0xfb0000, 0x40000},
1931 .first_sysupgrade_partition
= "os-image",
1932 .last_sysupgrade_partition
= "file-system"
1935 /** Firmware layout for the EAP615-Wall v1 */
1937 .id
= "EAP615-WALL-V1",
1938 .soft_ver
= SOFT_VER_DEFAULT
,
1939 .soft_ver_compat_level
= 1,
1942 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
1943 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
1944 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
1945 .part_trail
= PART_TRAIL_NONE
,
1948 {"fs-uboot", 0x00000, 0x80000},
1949 {"partition-table", 0x80000, 0x02000},
1950 {"default-mac", 0x90000, 0x01000},
1951 {"support-list", 0x91000, 0x00100},
1952 {"product-info", 0x91100, 0x00400},
1953 {"soft-version", 0x92000, 0x00100},
1954 {"firmware", 0xa0000, 0xcf0000},
1955 {"user-config", 0xd90000, 0x60000},
1956 {"mutil-log", 0xf30000, 0x80000},
1957 {"oops", 0xfb0000, 0x40000},
1958 {"radio", 0xff0000, 0x10000},
1962 .first_sysupgrade_partition
= "os-image",
1963 .last_sysupgrade_partition
= "file-system"
1966 /** Firmware layout for the TL-WA1201 v2 */
1968 .id
= "TL-WA1201-V2",
1972 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
1973 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
1975 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
1978 {"fs-uboot", 0x00000, 0x20000},
1979 {"default-mac", 0x20000, 0x00200},
1980 {"pin", 0x20200, 0x00100},
1981 {"product-info", 0x20300, 0x00200},
1982 {"device-id", 0x20500, 0x0fb00},
1983 {"firmware", 0x30000, 0xce0000},
1984 {"portal-logo", 0xd10000, 0x20000},
1985 {"portal-back", 0xd30000, 0x200000},
1986 {"soft-version", 0xf30000, 0x00200},
1987 {"extra-para", 0xf30200, 0x00200},
1988 {"support-list", 0xf30400, 0x00200},
1989 {"profile", 0xf30600, 0x0fa00},
1990 {"apdef-config", 0xf40000, 0x10000},
1991 {"ap-config", 0xf50000, 0x10000},
1992 {"redef-config", 0xf60000, 0x10000},
1993 {"re-config", 0xf70000, 0x10000},
1994 {"multidef-config", 0xf80000, 0x10000},
1995 {"multi-config", 0xf90000, 0x10000},
1996 {"clientdef-config", 0xfa0000, 0x10000},
1997 {"client-config", 0xfb0000, 0x10000},
1998 {"partition-table", 0xfc0000, 0x10000},
1999 {"user-config", 0xfd0000, 0x10000},
2000 {"certificate", 0xfe0000, 0x10000},
2001 {"radio", 0xff0000, 0x10000},
2004 .first_sysupgrade_partition
= "os-image",
2005 .last_sysupgrade_partition
= "file-system",
2008 /** Firmware layout for the TL-WA850RE v2 */
2010 .id
= "TLWA850REV2",
2014 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2015 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2016 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2017 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2018 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2019 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2020 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2021 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2022 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2023 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2025 .soft_ver
= SOFT_VER_DEFAULT
,
2028 576KB were moved from file-system to os-image
2029 in comparison to the stock image
2032 {"fs-uboot", 0x00000, 0x20000},
2033 {"firmware", 0x20000, 0x390000},
2034 {"partition-table", 0x3b0000, 0x02000},
2035 {"default-mac", 0x3c0000, 0x00020},
2036 {"pin", 0x3c0100, 0x00020},
2037 {"product-info", 0x3c1000, 0x01000},
2038 {"soft-version", 0x3c2000, 0x00100},
2039 {"support-list", 0x3c3000, 0x01000},
2040 {"profile", 0x3c4000, 0x08000},
2041 {"user-config", 0x3d0000, 0x10000},
2042 {"default-config", 0x3e0000, 0x10000},
2043 {"radio", 0x3f0000, 0x10000},
2047 .first_sysupgrade_partition
= "os-image",
2048 .last_sysupgrade_partition
= "file-system"
2051 /** Firmware layout for the TL-WA855RE v1 */
2053 .id
= "TLWA855REV1",
2057 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2058 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2059 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2060 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2061 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2062 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2063 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2064 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2065 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2067 .soft_ver
= SOFT_VER_DEFAULT
,
2070 {"fs-uboot", 0x00000, 0x20000},
2071 {"os-image", 0x20000, 0x150000},
2072 {"file-system", 0x170000, 0x240000},
2073 {"partition-table", 0x3b0000, 0x02000},
2074 {"default-mac", 0x3c0000, 0x00020},
2075 {"pin", 0x3c0100, 0x00020},
2076 {"product-info", 0x3c1000, 0x01000},
2077 {"soft-version", 0x3c2000, 0x00100},
2078 {"support-list", 0x3c3000, 0x01000},
2079 {"profile", 0x3c4000, 0x08000},
2080 {"user-config", 0x3d0000, 0x10000},
2081 {"default-config", 0x3e0000, 0x10000},
2082 {"radio", 0x3f0000, 0x10000},
2086 .first_sysupgrade_partition
= "os-image",
2087 .last_sysupgrade_partition
= "file-system"
2090 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2092 .id
= "TL-WPA8630P-V2.0-EU",
2096 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2098 .soft_ver
= SOFT_VER_DEFAULT
,
2101 {"factory-uboot", 0x00000, 0x20000},
2102 {"fs-uboot", 0x20000, 0x20000},
2103 {"firmware", 0x40000, 0x5e0000},
2104 {"partition-table", 0x620000, 0x02000},
2105 {"default-mac", 0x630000, 0x00020},
2106 {"pin", 0x630100, 0x00020},
2107 {"device-id", 0x630200, 0x00030},
2108 {"product-info", 0x631100, 0x01000},
2109 {"extra-para", 0x632100, 0x01000},
2110 {"soft-version", 0x640000, 0x01000},
2111 {"support-list", 0x641000, 0x01000},
2112 {"profile", 0x642000, 0x08000},
2113 {"user-config", 0x650000, 0x10000},
2114 {"default-config", 0x660000, 0x10000},
2115 {"default-nvm", 0x670000, 0xc0000},
2116 {"default-pib", 0x730000, 0x40000},
2117 {"radio", 0x7f0000, 0x10000},
2121 .first_sysupgrade_partition
= "os-image",
2122 .last_sysupgrade_partition
= "file-system"
2125 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2127 .id
= "TL-WPA8630P-V2-INT",
2131 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2132 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2133 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2135 .soft_ver
= SOFT_VER_DEFAULT
,
2138 {"factory-uboot", 0x00000, 0x20000},
2139 {"fs-uboot", 0x20000, 0x20000},
2140 {"firmware", 0x40000, 0x5e0000},
2141 {"partition-table", 0x620000, 0x02000},
2142 {"extra-para", 0x632100, 0x01000},
2143 {"soft-version", 0x640000, 0x01000},
2144 {"support-list", 0x641000, 0x01000},
2145 {"profile", 0x642000, 0x08000},
2146 {"user-config", 0x650000, 0x10000},
2147 {"default-config", 0x660000, 0x10000},
2148 {"default-nvm", 0x670000, 0xc0000},
2149 {"default-pib", 0x730000, 0x40000},
2150 {"default-mac", 0x7e0000, 0x00020},
2151 {"pin", 0x7e0100, 0x00020},
2152 {"device-id", 0x7e0200, 0x00030},
2153 {"product-info", 0x7e1100, 0x01000},
2154 {"radio", 0x7f0000, 0x10000},
2158 .first_sysupgrade_partition
= "os-image",
2159 .last_sysupgrade_partition
= "file-system"
2162 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2164 .id
= "TL-WPA8630P-V2.1-EU",
2168 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2170 .soft_ver
= SOFT_VER_DEFAULT
,
2173 {"factory-uboot", 0x00000, 0x20000},
2174 {"fs-uboot", 0x20000, 0x20000},
2175 {"firmware", 0x40000, 0x5e0000},
2176 {"extra-para", 0x680000, 0x01000},
2177 {"product-info", 0x690000, 0x01000},
2178 {"partition-table", 0x6a0000, 0x02000},
2179 {"soft-version", 0x6b0000, 0x01000},
2180 {"support-list", 0x6b1000, 0x01000},
2181 {"profile", 0x6b2000, 0x08000},
2182 {"user-config", 0x6c0000, 0x10000},
2183 {"default-config", 0x6d0000, 0x10000},
2184 {"default-nvm", 0x6e0000, 0xc0000},
2185 {"default-pib", 0x7a0000, 0x40000},
2186 {"default-mac", 0x7e0000, 0x00020},
2187 {"pin", 0x7e0100, 0x00020},
2188 {"device-id", 0x7e0200, 0x00030},
2189 {"radio", 0x7f0000, 0x10000},
2193 .first_sysupgrade_partition
= "os-image",
2194 .last_sysupgrade_partition
= "file-system"
2197 /** Firmware layout for the TL-WPA8631P v3 */
2199 .id
= "TL-WPA8631P-V3",
2203 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2204 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2205 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2207 .soft_ver
= SOFT_VER_DEFAULT
,
2210 {"fs-uboot", 0x00000, 0x20000},
2211 {"firmware", 0x20000, 0x710000},
2212 {"partition-table", 0x730000, 0x02000},
2213 {"default-mac", 0x732000, 0x00020},
2214 {"pin", 0x732100, 0x00020},
2215 {"device-id", 0x732200, 0x00030},
2216 {"default-region", 0x732300, 0x00010},
2217 {"product-info", 0x732400, 0x00200},
2218 {"extra-para", 0x732600, 0x00200},
2219 {"soft-version", 0x732800, 0x00200},
2220 {"support-list", 0x732a00, 0x00100},
2221 {"profile", 0x732b00, 0x00100},
2222 {"default-config", 0x732c00, 0x00800},
2223 {"plc-type", 0x733400, 0x00020},
2224 {"default-pib", 0x733500, 0x06000},
2225 {"user-config", 0x740000, 0x10000},
2226 {"plc-pib", 0x750000, 0x10000},
2227 {"plc-nvm", 0x760000, 0x90000},
2228 {"radio", 0x7f0000, 0x10000},
2232 .first_sysupgrade_partition
= "os-image",
2233 .last_sysupgrade_partition
= "file-system"
2236 /** Firmware layout for the TL-WR1043 v5 */
2238 .id
= "TLWR1043NV5",
2242 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2243 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2245 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2247 {"factory-boot", 0x00000, 0x20000},
2248 {"fs-uboot", 0x20000, 0x20000},
2249 {"firmware", 0x40000, 0xec0000},
2250 {"default-mac", 0xf00000, 0x00200},
2251 {"pin", 0xf00200, 0x00200},
2252 {"device-id", 0xf00400, 0x00100},
2253 {"product-info", 0xf00500, 0x0fb00},
2254 {"soft-version", 0xf10000, 0x01000},
2255 {"extra-para", 0xf11000, 0x01000},
2256 {"support-list", 0xf12000, 0x0a000},
2257 {"profile", 0xf1c000, 0x04000},
2258 {"default-config", 0xf20000, 0x10000},
2259 {"user-config", 0xf30000, 0x40000},
2260 {"qos-db", 0xf70000, 0x40000},
2261 {"certificate", 0xfb0000, 0x10000},
2262 {"partition-table", 0xfc0000, 0x10000},
2263 {"log", 0xfd0000, 0x20000},
2264 {"radio", 0xff0000, 0x10000},
2267 .first_sysupgrade_partition
= "os-image",
2268 .last_sysupgrade_partition
= "file-system"
2271 /** Firmware layout for the TL-WR1043 v4 */
2273 .id
= "TLWR1043NDV4",
2277 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2279 .soft_ver
= SOFT_VER_DEFAULT
,
2281 /* We're using a dynamic kernel/rootfs split here */
2283 {"fs-uboot", 0x00000, 0x20000},
2284 {"firmware", 0x20000, 0xf30000},
2285 {"default-mac", 0xf50000, 0x00200},
2286 {"pin", 0xf50200, 0x00200},
2287 {"product-info", 0xf50400, 0x0fc00},
2288 {"soft-version", 0xf60000, 0x0b000},
2289 {"support-list", 0xf6b000, 0x04000},
2290 {"profile", 0xf70000, 0x04000},
2291 {"default-config", 0xf74000, 0x0b000},
2292 {"user-config", 0xf80000, 0x40000},
2293 {"partition-table", 0xfc0000, 0x10000},
2294 {"log", 0xfd0000, 0x20000},
2295 {"radio", 0xff0000, 0x10000},
2299 .first_sysupgrade_partition
= "os-image",
2300 .last_sysupgrade_partition
= "file-system"
2303 /** Firmware layout for the TL-WR902AC v1 */
2305 .id
= "TL-WR902AC-V1",
2309 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2310 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2312 .soft_ver
= SOFT_VER_DEFAULT
,
2315 384KB were moved from file-system to os-image
2316 in comparison to the stock image
2319 {"fs-uboot", 0x00000, 0x20000},
2320 {"firmware", 0x20000, 0x730000},
2321 {"default-mac", 0x750000, 0x00200},
2322 {"pin", 0x750200, 0x00200},
2323 {"product-info", 0x750400, 0x0fc00},
2324 {"soft-version", 0x760000, 0x0b000},
2325 {"support-list", 0x76b000, 0x04000},
2326 {"profile", 0x770000, 0x04000},
2327 {"default-config", 0x774000, 0x0b000},
2328 {"user-config", 0x780000, 0x40000},
2329 {"partition-table", 0x7c0000, 0x10000},
2330 {"log", 0x7d0000, 0x20000},
2331 {"radio", 0x7f0000, 0x10000},
2335 .first_sysupgrade_partition
= "os-image",
2336 .last_sysupgrade_partition
= "file-system",
2339 /** Firmware layout for the TL-WR941HP v1 */
2341 .id
= "TL-WR941HP-V1",
2345 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2347 .soft_ver
= SOFT_VER_DEFAULT
,
2350 {"fs-uboot", 0x00000, 0x20000},
2351 {"firmware", 0x20000, 0x730000},
2352 {"default-mac", 0x750000, 0x00200},
2353 {"pin", 0x750200, 0x00200},
2354 {"product-info", 0x750400, 0x0fc00},
2355 {"soft-version", 0x760000, 0x0b000},
2356 {"support-list", 0x76b000, 0x04000},
2357 {"profile", 0x770000, 0x04000},
2358 {"default-config", 0x774000, 0x0b000},
2359 {"user-config", 0x780000, 0x40000},
2360 {"partition-table", 0x7c0000, 0x10000},
2361 {"log", 0x7d0000, 0x20000},
2362 {"radio", 0x7f0000, 0x10000},
2366 .first_sysupgrade_partition
= "os-image",
2367 .last_sysupgrade_partition
= "file-system",
2370 /** Firmware layout for the TL-WR942N V1 */
2376 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2377 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2379 .soft_ver
= SOFT_VER_DEFAULT
,
2382 {"fs-uboot", 0x00000, 0x20000},
2383 {"firmware", 0x20000, 0xe20000},
2384 {"default-mac", 0xe40000, 0x00200},
2385 {"pin", 0xe40200, 0x00200},
2386 {"product-info", 0xe40400, 0x0fc00},
2387 {"partition-table", 0xe50000, 0x10000},
2388 {"soft-version", 0xe60000, 0x10000},
2389 {"support-list", 0xe70000, 0x10000},
2390 {"profile", 0xe80000, 0x10000},
2391 {"default-config", 0xe90000, 0x10000},
2392 {"user-config", 0xea0000, 0x40000},
2393 {"qos-db", 0xee0000, 0x40000},
2394 {"certificate", 0xf20000, 0x10000},
2395 {"usb-config", 0xfb0000, 0x10000},
2396 {"log", 0xfc0000, 0x20000},
2397 {"radio-bk", 0xfe0000, 0x10000},
2398 {"radio", 0xff0000, 0x10000},
2402 .first_sysupgrade_partition
= "os-image",
2403 .last_sysupgrade_partition
= "file-system",
2406 /** Firmware layout for the RE200 v2 */
2412 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2413 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2414 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2415 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2416 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2417 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2418 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2419 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2420 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2421 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2422 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2423 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2424 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2426 .soft_ver
= SOFT_VER_DEFAULT
,
2429 {"fs-uboot", 0x00000, 0x20000},
2430 {"firmware", 0x20000, 0x7a0000},
2431 {"partition-table", 0x7c0000, 0x02000},
2432 {"default-mac", 0x7c2000, 0x00020},
2433 {"pin", 0x7c2100, 0x00020},
2434 {"product-info", 0x7c3100, 0x01000},
2435 {"soft-version", 0x7c4200, 0x01000},
2436 {"support-list", 0x7c5200, 0x01000},
2437 {"profile", 0x7c6200, 0x08000},
2438 {"config-info", 0x7ce200, 0x00400},
2439 {"user-config", 0x7d0000, 0x10000},
2440 {"default-config", 0x7e0000, 0x10000},
2441 {"radio", 0x7f0000, 0x10000},
2445 .first_sysupgrade_partition
= "os-image",
2446 .last_sysupgrade_partition
= "file-system"
2449 /** Firmware layout for the RE200 v3 */
2455 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2456 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2457 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2458 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2459 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2460 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2461 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2462 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2463 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2464 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2465 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2466 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2467 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2468 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2470 .soft_ver
= SOFT_VER_DEFAULT
,
2473 {"fs-uboot", 0x00000, 0x20000},
2474 {"firmware", 0x20000, 0x7a0000},
2475 {"partition-table", 0x7c0000, 0x02000},
2476 {"default-mac", 0x7c2000, 0x00020},
2477 {"pin", 0x7c2100, 0x00020},
2478 {"product-info", 0x7c3100, 0x01000},
2479 {"soft-version", 0x7c4200, 0x01000},
2480 {"support-list", 0x7c5200, 0x01000},
2481 {"profile", 0x7c6200, 0x08000},
2482 {"config-info", 0x7ce200, 0x00400},
2483 {"user-config", 0x7d0000, 0x10000},
2484 {"default-config", 0x7e0000, 0x10000},
2485 {"radio", 0x7f0000, 0x10000},
2489 .first_sysupgrade_partition
= "os-image",
2490 .last_sysupgrade_partition
= "file-system"
2493 /** Firmware layout for the RE200 v4 */
2499 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2500 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2501 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2502 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2503 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2504 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2505 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2506 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2507 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2508 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2509 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2510 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2511 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2512 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2514 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2517 {"fs-uboot", 0x00000, 0x20000},
2518 {"firmware", 0x20000, 0x7a0000},
2519 {"partition-table", 0x7c0000, 0x02000},
2520 {"default-mac", 0x7c2000, 0x00020},
2521 {"pin", 0x7c2100, 0x00020},
2522 {"product-info", 0x7c3100, 0x01000},
2523 {"soft-version", 0x7c4200, 0x01000},
2524 {"support-list", 0x7c5200, 0x01000},
2525 {"profile", 0x7c6200, 0x08000},
2526 {"config-info", 0x7ce200, 0x00400},
2527 {"user-config", 0x7d0000, 0x10000},
2528 {"default-config", 0x7e0000, 0x10000},
2529 {"radio", 0x7f0000, 0x10000},
2533 .first_sysupgrade_partition
= "os-image",
2534 .last_sysupgrade_partition
= "file-system"
2537 /** Firmware layout for the RE220 v2 */
2543 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2544 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2545 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2546 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2547 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2548 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2549 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2550 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2551 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2552 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2553 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2554 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2555 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2557 .soft_ver
= SOFT_VER_DEFAULT
,
2560 {"fs-uboot", 0x00000, 0x20000},
2561 {"firmware", 0x20000, 0x7a0000},
2562 {"partition-table", 0x7c0000, 0x02000},
2563 {"default-mac", 0x7c2000, 0x00020},
2564 {"pin", 0x7c2100, 0x00020},
2565 {"product-info", 0x7c3100, 0x01000},
2566 {"soft-version", 0x7c4200, 0x01000},
2567 {"support-list", 0x7c5200, 0x01000},
2568 {"profile", 0x7c6200, 0x08000},
2569 {"config-info", 0x7ce200, 0x00400},
2570 {"user-config", 0x7d0000, 0x10000},
2571 {"default-config", 0x7e0000, 0x10000},
2572 {"radio", 0x7f0000, 0x10000},
2576 .first_sysupgrade_partition
= "os-image",
2577 .last_sysupgrade_partition
= "file-system"
2580 /** Firmware layout for the RE305 v1 */
2586 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2587 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2588 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2589 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2590 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2591 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2592 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2594 .soft_ver
= SOFT_VER_DEFAULT
,
2597 {"fs-uboot", 0x00000, 0x20000},
2598 {"firmware", 0x20000, 0x5e0000},
2599 {"partition-table", 0x600000, 0x02000},
2600 {"default-mac", 0x610000, 0x00020},
2601 {"pin", 0x610100, 0x00020},
2602 {"product-info", 0x611100, 0x01000},
2603 {"soft-version", 0x620000, 0x01000},
2604 {"support-list", 0x621000, 0x01000},
2605 {"profile", 0x622000, 0x08000},
2606 {"user-config", 0x630000, 0x10000},
2607 {"default-config", 0x640000, 0x10000},
2608 {"radio", 0x7f0000, 0x10000},
2612 .first_sysupgrade_partition
= "os-image",
2613 .last_sysupgrade_partition
= "file-system"
2616 /** Firmware layout for the RE305 v3 */
2622 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2623 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2624 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2625 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2626 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2627 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2628 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2629 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2630 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2631 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2632 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2634 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2637 {"fs-uboot", 0x00000, 0x20000},
2638 {"firmware", 0x20000, 0x7a0000},
2639 {"partition-table", 0x7c0000, 0x02000},
2640 {"default-mac", 0x7c2000, 0x00020},
2641 {"pin", 0x7c2100, 0x00020},
2642 {"product-info", 0x7c3100, 0x01000},
2643 {"soft-version", 0x7c4200, 0x01000},
2644 {"support-list", 0x7c5200, 0x01000},
2645 {"profile", 0x7c6200, 0x08000},
2646 {"config-info", 0x7ce200, 0x00400},
2647 {"user-config", 0x7d0000, 0x10000},
2648 {"default-config", 0x7e0000, 0x10000},
2649 {"radio", 0x7f0000, 0x10000},
2653 .first_sysupgrade_partition
= "os-image",
2654 .last_sysupgrade_partition
= "file-system"
2657 /** Firmware layout for the RE350 v1 */
2663 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2664 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2665 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2666 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2667 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2668 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2669 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2671 .soft_ver
= SOFT_VER_DEFAULT
,
2673 /** We're using a dynamic kernel/rootfs split here */
2675 {"fs-uboot", 0x00000, 0x20000},
2676 {"firmware", 0x20000, 0x5e0000},
2677 {"partition-table", 0x600000, 0x02000},
2678 {"default-mac", 0x610000, 0x00020},
2679 {"pin", 0x610100, 0x00020},
2680 {"product-info", 0x611100, 0x01000},
2681 {"soft-version", 0x620000, 0x01000},
2682 {"support-list", 0x621000, 0x01000},
2683 {"profile", 0x622000, 0x08000},
2684 {"user-config", 0x630000, 0x10000},
2685 {"default-config", 0x640000, 0x10000},
2686 {"radio", 0x7f0000, 0x10000},
2690 .first_sysupgrade_partition
= "os-image",
2691 .last_sysupgrade_partition
= "file-system"
2694 /** Firmware layout for the RE350K v1 */
2700 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2702 .soft_ver
= SOFT_VER_DEFAULT
,
2704 /** We're using a dynamic kernel/rootfs split here */
2706 {"fs-uboot", 0x00000, 0x20000},
2707 {"firmware", 0x20000, 0xd70000},
2708 {"partition-table", 0xd90000, 0x02000},
2709 {"default-mac", 0xda0000, 0x00020},
2710 {"pin", 0xda0100, 0x00020},
2711 {"product-info", 0xda1100, 0x01000},
2712 {"soft-version", 0xdb0000, 0x01000},
2713 {"support-list", 0xdb1000, 0x01000},
2714 {"profile", 0xdb2000, 0x08000},
2715 {"user-config", 0xdc0000, 0x10000},
2716 {"default-config", 0xdd0000, 0x10000},
2717 {"device-id", 0xde0000, 0x00108},
2718 {"radio", 0xff0000, 0x10000},
2722 .first_sysupgrade_partition
= "os-image",
2723 .last_sysupgrade_partition
= "file-system"
2726 /** Firmware layout for the RE355 */
2732 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2733 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2734 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2735 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2736 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2737 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2738 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2739 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2741 .soft_ver
= SOFT_VER_DEFAULT
,
2743 /* We're using a dynamic kernel/rootfs split here */
2745 {"fs-uboot", 0x00000, 0x20000},
2746 {"firmware", 0x20000, 0x5e0000},
2747 {"partition-table", 0x600000, 0x02000},
2748 {"default-mac", 0x610000, 0x00020},
2749 {"pin", 0x610100, 0x00020},
2750 {"product-info", 0x611100, 0x01000},
2751 {"soft-version", 0x620000, 0x01000},
2752 {"support-list", 0x621000, 0x01000},
2753 {"profile", 0x622000, 0x08000},
2754 {"user-config", 0x630000, 0x10000},
2755 {"default-config", 0x640000, 0x10000},
2756 {"radio", 0x7f0000, 0x10000},
2760 .first_sysupgrade_partition
= "os-image",
2761 .last_sysupgrade_partition
= "file-system"
2764 /** Firmware layout for the RE450 */
2770 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2771 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2772 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2773 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2774 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2775 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2776 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2777 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2779 .soft_ver
= SOFT_VER_DEFAULT
,
2781 /** We're using a dynamic kernel/rootfs split here */
2783 {"fs-uboot", 0x00000, 0x20000},
2784 {"firmware", 0x20000, 0x5e0000},
2785 {"partition-table", 0x600000, 0x02000},
2786 {"default-mac", 0x610000, 0x00020},
2787 {"pin", 0x610100, 0x00020},
2788 {"product-info", 0x611100, 0x01000},
2789 {"soft-version", 0x620000, 0x01000},
2790 {"support-list", 0x621000, 0x01000},
2791 {"profile", 0x622000, 0x08000},
2792 {"user-config", 0x630000, 0x10000},
2793 {"default-config", 0x640000, 0x10000},
2794 {"radio", 0x7f0000, 0x10000},
2798 .first_sysupgrade_partition
= "os-image",
2799 .last_sysupgrade_partition
= "file-system"
2802 /** Firmware layout for the RE450 v2 */
2808 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2809 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2810 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2811 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2812 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2813 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2814 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2815 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2816 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2818 .soft_ver
= SOFT_VER_DEFAULT
,
2820 /* We're using a dynamic kernel/rootfs split here */
2822 {"fs-uboot", 0x00000, 0x20000},
2823 {"firmware", 0x20000, 0x5e0000},
2824 {"partition-table", 0x600000, 0x02000},
2825 {"default-mac", 0x610000, 0x00020},
2826 {"pin", 0x610100, 0x00020},
2827 {"product-info", 0x611100, 0x01000},
2828 {"soft-version", 0x620000, 0x01000},
2829 {"support-list", 0x621000, 0x01000},
2830 {"profile", 0x622000, 0x08000},
2831 {"user-config", 0x630000, 0x10000},
2832 {"default-config", 0x640000, 0x10000},
2833 {"radio", 0x7f0000, 0x10000},
2837 .first_sysupgrade_partition
= "os-image",
2838 .last_sysupgrade_partition
= "file-system"
2841 /** Firmware layout for the RE450 v3 */
2847 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2848 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2849 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2850 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2851 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2852 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2853 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2854 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2855 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2857 .soft_ver
= SOFT_VER_DEFAULT
,
2859 /* We're using a dynamic kernel/rootfs split here */
2861 {"fs-uboot", 0x00000, 0x20000},
2862 {"default-mac", 0x20000, 0x00020},
2863 {"pin", 0x20020, 0x00020},
2864 {"product-info", 0x21000, 0x01000},
2865 {"partition-table", 0x22000, 0x02000},
2866 {"soft-version", 0x24000, 0x01000},
2867 {"support-list", 0x25000, 0x01000},
2868 {"profile", 0x26000, 0x08000},
2869 {"user-config", 0x2e000, 0x10000},
2870 {"default-config", 0x3e000, 0x10000},
2871 {"config-info", 0x4e000, 0x00400},
2872 {"firmware", 0x50000, 0x7a0000},
2873 {"radio", 0x7f0000, 0x10000},
2877 .first_sysupgrade_partition
= "os-image",
2878 .last_sysupgrade_partition
= "file-system"
2881 /** Firmware layout for the RE455 v1 */
2887 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2888 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2889 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2890 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2891 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2892 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2893 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2894 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2895 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2897 .soft_ver
= SOFT_VER_DEFAULT
,
2899 /* We're using a dynamic kernel/rootfs split here */
2901 {"fs-uboot", 0x00000, 0x20000},
2902 {"default-mac", 0x20000, 0x00020},
2903 {"pin", 0x20020, 0x00020},
2904 {"product-info", 0x21000, 0x01000},
2905 {"partition-table", 0x22000, 0x02000},
2906 {"soft-version", 0x24000, 0x01000},
2907 {"support-list", 0x25000, 0x01000},
2908 {"profile", 0x26000, 0x08000},
2909 {"user-config", 0x2e000, 0x10000},
2910 {"default-config", 0x3e000, 0x10000},
2911 {"config-info", 0x4e000, 0x00400},
2912 {"firmware", 0x50000, 0x7a0000},
2913 {"radio", 0x7f0000, 0x10000},
2917 .first_sysupgrade_partition
= "os-image",
2918 .last_sysupgrade_partition
= "file-system"
2921 /** Firmware layout for the RE500 */
2927 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2928 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2929 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2930 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2931 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2932 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2933 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2935 .soft_ver
= SOFT_VER_DEFAULT
,
2937 /* We're using a dynamic kernel/rootfs split here */
2939 {"fs-uboot", 0x00000, 0x20000},
2940 {"firmware", 0x20000, 0xde0000},
2941 {"partition-table", 0xe00000, 0x02000},
2942 {"default-mac", 0xe10000, 0x00020},
2943 {"pin", 0xe10100, 0x00020},
2944 {"product-info", 0xe11100, 0x01000},
2945 {"soft-version", 0xe20000, 0x01000},
2946 {"support-list", 0xe21000, 0x01000},
2947 {"profile", 0xe22000, 0x08000},
2948 {"user-config", 0xe30000, 0x10000},
2949 {"default-config", 0xe40000, 0x10000},
2950 {"radio", 0xff0000, 0x10000},
2954 .first_sysupgrade_partition
= "os-image",
2955 .last_sysupgrade_partition
= "file-system"
2958 /** Firmware layout for the RE650 */
2964 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2965 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2966 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2967 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2968 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2969 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2970 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2972 .soft_ver
= SOFT_VER_DEFAULT
,
2974 /* We're using a dynamic kernel/rootfs split here */
2976 {"fs-uboot", 0x00000, 0x20000},
2977 {"firmware", 0x20000, 0xde0000},
2978 {"partition-table", 0xe00000, 0x02000},
2979 {"default-mac", 0xe10000, 0x00020},
2980 {"pin", 0xe10100, 0x00020},
2981 {"product-info", 0xe11100, 0x01000},
2982 {"soft-version", 0xe20000, 0x01000},
2983 {"support-list", 0xe21000, 0x01000},
2984 {"profile", 0xe22000, 0x08000},
2985 {"user-config", 0xe30000, 0x10000},
2986 {"default-config", 0xe40000, 0x10000},
2987 {"radio", 0xff0000, 0x10000},
2991 .first_sysupgrade_partition
= "os-image",
2992 .last_sysupgrade_partition
= "file-system"
2994 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3000 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3001 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3002 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3003 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3004 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3005 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3006 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3008 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3009 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3011 /* We're using a dynamic kernel/rootfs split here */
3013 {"fs-uboot", 0x00000, 0x20000},
3014 {"firmware", 0x20000, 0x7a0000},
3015 {"partition-table", 0x7c0000, 0x02000},
3016 {"default-mac", 0x7c2000, 0x00020},
3017 {"pin", 0x7c2100, 0x00020},
3018 {"product-info", 0x7c3100, 0x01000},
3019 {"soft-version", 0x7c4200, 0x01000},
3020 {"support-list", 0x7c5200, 0x01000},
3021 {"profile", 0x7c6200, 0x08000},
3022 {"config-info", 0x7ce200, 0x00400},
3023 {"user-config", 0x7d0000, 0x10000},
3024 {"default-config", 0x7e0000, 0x10000},
3025 {"radio", 0x7f0000, 0x10000},
3029 .first_sysupgrade_partition
= "os-image",
3030 .last_sysupgrade_partition
= "file-system"
3033 /** Firmware layout for the Mercusys MR70X */
3039 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3040 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3041 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3043 .soft_ver
= SOFT_VER_DEFAULT
,
3046 {"fs-uboot", 0x00000, 0x40000},
3047 {"firmware", 0x40000, 0xf60000},
3048 {"default-mac", 0xfa0000, 0x00200},
3049 {"pin", 0xfa0200, 0x00100},
3050 {"device-id", 0xfa0300, 0x00100},
3051 {"product-info", 0xfa0400, 0x0fc00},
3052 {"default-config", 0xfb0000, 0x08000},
3053 {"ap-def-config", 0xfb8000, 0x08000},
3054 {"user-config", 0xfc0000, 0x0a000},
3055 {"ag-config", 0xfca000, 0x04000},
3056 {"certificate", 0xfce000, 0x02000},
3057 {"ap-config", 0xfd0000, 0x06000},
3058 {"router-config", 0xfd6000, 0x06000},
3059 {"favicon", 0xfdc000, 0x02000},
3060 {"logo", 0xfde000, 0x02000},
3061 {"partition-table", 0xfe0000, 0x00800},
3062 {"soft-version", 0xfe0800, 0x00100},
3063 {"support-list", 0xfe0900, 0x00200},
3064 {"profile", 0xfe0b00, 0x03000},
3065 {"extra-para", 0xfe3b00, 0x00100},
3066 {"radio", 0xff0000, 0x10000},
3070 .first_sysupgrade_partition
= "os-image",
3071 .last_sysupgrade_partition
= "file-system"
3077 #define error(_ret, _errno, _str, ...) \
3079 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3080 strerror(_errno)); \
3086 /** Stores a uint32 as big endian */
3087 static inline void put32(uint8_t *buf
, uint32_t val
) {
3094 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3096 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3099 /** Allocate a padded meta partition with a correctly initialised header
3100 * If the `data` pointer is NULL, then the required space is only allocated,
3101 * otherwise `data_len` bytes will be copied from `data` into the partition
3103 static struct image_partition_entry
init_meta_partition_entry(
3104 const char *name
, const void *data
, uint32_t data_len
,
3105 enum partition_trail_value pad_value
)
3107 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3108 if (meta_partition_should_pad(pad_value
))
3111 struct image_partition_entry entry
= {
3114 .data
= malloc(total_len
)
3117 error(1, errno
, "failed to allocate meta partition entry");
3119 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3120 header
->length
= htonl(data_len
);
3124 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3126 if (meta_partition_should_pad(pad_value
))
3127 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3132 /** Allocates a new image partition */
3133 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3134 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3136 error(1, errno
, "malloc");
3141 /** Sets up default partition names whenever custom names aren't specified */
3142 static void set_partition_names(struct device_info
*info
)
3144 if (!info
->partition_names
.partition_table
)
3145 info
->partition_names
.partition_table
= "partition-table";
3146 if (!info
->partition_names
.soft_ver
)
3147 info
->partition_names
.soft_ver
= "soft-version";
3148 if (!info
->partition_names
.os_image
)
3149 info
->partition_names
.os_image
= "os-image";
3150 if (!info
->partition_names
.support_list
)
3151 info
->partition_names
.support_list
= "support-list";
3152 if (!info
->partition_names
.file_system
)
3153 info
->partition_names
.file_system
= "file-system";
3154 if (!info
->partition_names
.extra_para
)
3155 info
->partition_names
.extra_para
= "extra-para";
3158 /** Frees an image partition */
3159 static void free_image_partition(struct image_partition_entry entry
) {
3163 static time_t source_date_epoch
= -1;
3164 static void set_source_date_epoch() {
3165 char *env
= getenv("SOURCE_DATE_EPOCH");
3169 source_date_epoch
= strtoull(env
, &endptr
, 10);
3170 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3171 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3177 /** Generates the partition-table partition */
3178 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3180 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, 0x800);
3182 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3190 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3192 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3193 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3196 error(1, 0, "flash partition table overflow?");
3203 memset(s
, 0xff, end
-s
);
3209 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3210 static inline uint8_t bcd(uint8_t v
) {
3211 return 0x10 * (v
/10) + v
%10;
3215 /** Generates the soft-version partition */
3216 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3218 /** If an info string is provided, use this instead of
3219 * the structured data, and include the null-termination */
3220 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3221 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3222 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3223 info
->soft_ver
.text
, len
, info
->part_trail
);
3228 if (source_date_epoch
!= -1)
3229 t
= source_date_epoch
;
3230 else if (time(&t
) == (time_t)(-1))
3231 error(1, errno
, "time");
3233 struct tm
*tm
= gmtime(&t
);
3235 struct soft_version s
= {
3238 .version_major
= info
->soft_ver
.num
[0],
3239 .version_minor
= info
->soft_ver
.num
[1],
3240 .version_patch
= info
->soft_ver
.num
[2],
3242 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3243 .year_lo
= bcd(tm
->tm_year
%100),
3244 .month
= bcd(tm
->tm_mon
+1),
3245 .day
= bcd(tm
->tm_mday
),
3248 .compat_level
= htonl(info
->soft_ver_compat_level
)
3251 if (info
->soft_ver_compat_level
== 0)
3252 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3253 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3256 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3257 sizeof(s
), info
->part_trail
);
3260 /** Generates the support-list partition */
3261 static struct image_partition_entry
make_support_list(
3262 const struct device_info
*info
)
3264 uint32_t len
= strlen(info
->support_list
);
3265 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3266 len
, info
->part_trail
);
3269 /** Partition with extra-para data */
3270 static struct image_partition_entry
make_extra_para(
3271 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3273 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3277 /** Creates a new image partition with an arbitrary name from a file */
3278 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
) {
3279 struct stat statbuf
;
3281 if (stat(filename
, &statbuf
) < 0)
3282 error(1, errno
, "unable to stat file `%s'", filename
);
3284 size_t len
= statbuf
.st_size
;
3286 if (add_jffs2_eof
) {
3287 if (file_system_partition
)
3288 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3290 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3293 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3295 FILE *file
= fopen(filename
, "rb");
3297 error(1, errno
, "unable to open file `%s'", filename
);
3299 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3300 error(1, errno
, "unable to read file `%s'", filename
);
3302 if (add_jffs2_eof
) {
3303 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3305 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3306 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3315 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3317 Example image partition table:
3319 fwup-ptn partition-table base 0x00800 size 0x00800
3320 fwup-ptn os-image base 0x01000 size 0x113b45
3321 fwup-ptn file-system base 0x114b45 size 0x1d0004
3322 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3324 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3325 the end of the partition table is marked with a zero byte.
3327 The firmware image must contain at least the partition-table and support-list partitions
3328 to be accepted. There aren't any alignment constraints for the image partitions.
3330 The partition-table partition contains the actual flash layout; partitions
3331 from the image partition table are mapped to the corresponding flash partitions during
3332 the firmware upgrade. The support-list partition contains a list of devices supported by
3335 The base offsets in the firmware partition table are relative to the end
3336 of the vendor information block, so the partition-table partition will
3337 actually start at offset 0x1814 of the image.
3339 I think partition-table must be the first partition in the firmware image.
3341 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3343 char *image_pt
= (char *)buffer
, *end
= image_pt
+ 0x800;
3345 size_t base
= 0x800;
3346 for (i
= 0; parts
[i
].name
; i
++) {
3347 for (j
= 0; flash_parts
[j
].name
; j
++) {
3348 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3349 if (parts
[i
].size
> flash_parts
[j
].size
)
3350 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3355 assert(flash_parts
[j
].name
);
3357 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3359 size_t len
= end
-image_pt
;
3360 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
);
3363 error(1, 0, "image partition table overflow?");
3367 base
+= parts
[i
].size
;
3371 /** Generates and writes the image MD5 checksum */
3372 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3376 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3377 MD5_Update(&ctx
, buffer
, len
);
3378 MD5_Final(md5
, &ctx
);
3383 Generates the firmware image in factory format
3389 0000-0003 Image size (4 bytes, big endian)
3390 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3391 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3392 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3393 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3394 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3395 1814-xxxx Firmware partitions
3397 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3401 for (i
= 0; parts
[i
].name
; i
++)
3402 *len
+= parts
[i
].size
;
3404 uint8_t *image
= malloc(*len
);
3406 error(1, errno
, "malloc");
3408 memset(image
, 0xff, *len
);
3412 size_t vendor_len
= strlen(info
->vendor
);
3413 put32(image
+0x14, vendor_len
);
3414 memcpy(image
+0x18, info
->vendor
, vendor_len
);
3417 put_partitions(image
+ 0x1014, info
->partitions
, parts
);
3418 put_md5(image
+0x04, image
+0x14, *len
-0x14);
3424 Generates the firmware image in sysupgrade format
3426 This makes some assumptions about the provided flash and image partition tables and
3427 should be generalized when TP-LINK starts building its safeloader into hardware with
3428 different flash layouts.
3430 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3432 size_t flash_first_partition_index
= 0;
3433 size_t flash_last_partition_index
= 0;
3434 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3435 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3436 const struct image_partition_entry
*image_last_partition
= NULL
;
3438 /** Find first and last partitions */
3439 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3440 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3441 flash_first_partition
= &info
->partitions
[i
];
3442 flash_first_partition_index
= i
;
3443 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3444 flash_last_partition
= &info
->partitions
[i
];
3445 flash_last_partition_index
= i
;
3449 assert(flash_first_partition
&& flash_last_partition
);
3450 assert(flash_first_partition_index
< flash_last_partition_index
);
3452 /** Find last partition from image to calculate needed size */
3453 for (i
= 0; image_parts
[i
].name
; i
++) {
3454 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3455 image_last_partition
= &image_parts
[i
];
3460 assert(image_last_partition
);
3462 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3464 uint8_t *image
= malloc(*len
);
3466 error(1, errno
, "malloc");
3468 memset(image
, 0xff, *len
);
3470 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3471 for (j
= 0; image_parts
[j
].name
; j
++) {
3472 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3473 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3474 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3475 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3479 assert(image_parts
[j
].name
);
3486 /** Generates an image according to a given layout and writes it to a file */
3487 static void build_image(const char *output
,
3488 const char *kernel_image
,
3489 const char *rootfs_image
,
3493 struct device_info
*info
) {
3497 struct image_partition_entry parts
[7] = {};
3499 struct flash_partition_entry
*firmware_partition
= NULL
;
3500 struct flash_partition_entry
*os_image_partition
= NULL
;
3501 struct flash_partition_entry
*file_system_partition
= NULL
;
3502 size_t firmware_partition_index
= 0;
3504 set_partition_names(info
);
3506 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3507 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3509 firmware_partition
= &info
->partitions
[i
];
3510 firmware_partition_index
= i
;
3514 if (firmware_partition
)
3516 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3517 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3520 if (stat(kernel_image
, &kernel
) < 0)
3521 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3523 if (kernel
.st_size
> firmware_partition
->size
)
3524 error(1, 0, "kernel overflowed firmware partition\n");
3526 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3527 info
->partitions
[i
+1] = info
->partitions
[i
];
3529 file_system_partition
->name
= info
->partition_names
.file_system
;
3531 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3533 /* Align partition start to erase blocks for factory images only */
3535 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3537 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3539 os_image_partition
->name
= info
->partition_names
.os_image
;
3541 os_image_partition
->size
= kernel
.st_size
;
3544 parts
[0] = make_partition_table(info
);
3545 parts
[1] = make_soft_version(info
, rev
);
3546 parts
[2] = make_support_list(info
);
3547 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3548 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3551 /* Some devices need the extra-para partition to accept the firmware */
3552 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3553 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3554 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3555 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3556 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3557 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3558 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3559 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3560 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3561 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3562 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3563 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3564 strcasecmp(info
->id
, "DECO-M4R-V4") == 0 ||
3565 strcasecmp(info
->id
, "MR70X") == 0 ||
3566 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3567 const uint8_t extra_para
[2] = {0x01, 0x00};
3568 parts
[5] = make_extra_para(info
, extra_para
,
3569 sizeof(extra_para
));
3570 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3571 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3572 const uint8_t extra_para
[2] = {0x00, 0x01};
3573 parts
[5] = make_extra_para(info
, extra_para
,
3574 sizeof(extra_para
));
3575 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3576 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3577 const uint8_t extra_para
[2] = {0x01, 0x01};
3578 parts
[5] = make_extra_para(info
, extra_para
,
3579 sizeof(extra_para
));
3585 image
= generate_sysupgrade_image(info
, parts
, &len
);
3587 image
= generate_factory_image(info
, parts
, &len
);
3589 FILE *file
= fopen(output
, "wb");
3591 error(1, errno
, "unable to open output file");
3593 if (fwrite(image
, len
, 1, file
) != 1)
3594 error(1, 0, "unable to write output file");
3600 for (i
= 0; parts
[i
].name
; i
++)
3601 free_image_partition(parts
[i
]);
3605 static void usage(const char *argv0
) {
3607 "Usage: %s [OPTIONS...]\n"
3610 " -h show this help\n"
3612 "Info about an image:\n"
3613 " -i <file> input file to read from\n"
3614 "Create a new image:\n"
3615 " -B <board> create image for the board specified with <board>\n"
3616 " -k <file> read kernel image from the file <file>\n"
3617 " -r <file> read rootfs image from the file <file>\n"
3618 " -o <file> write output to the file <file>\n"
3619 " -V <rev> sets the revision number to <rev>\n"
3620 " -j add jffs2 end-of-filesystem markers\n"
3621 " -S create sysupgrade instead of factory image\n"
3622 "Extract an old image:\n"
3623 " -x <file> extract all oem firmware partition\n"
3624 " -d <dir> destination to extract the firmware partition\n"
3625 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3631 static struct device_info
*find_board(const char *id
)
3633 struct device_info
*board
= NULL
;
3635 for (board
= boards
; board
->id
!= NULL
; board
++)
3636 if (strcasecmp(id
, board
->id
) == 0)
3642 static int add_flash_partition(
3643 struct flash_partition_entry
*part_list
,
3650 /* check if the list has a free entry */
3651 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3652 if (part_list
->name
== NULL
&&
3653 part_list
->base
== 0 &&
3654 part_list
->size
== 0)
3658 if (ptr
== max_entries
) {
3659 error(1, 0, "No free flash part entry available.");
3662 part_list
->name
= calloc(1, strlen(name
) + 1);
3663 if (!part_list
->name
) {
3664 error(1, 0, "Unable to allocate memory");
3667 memcpy((char *)part_list
->name
, name
, strlen(name
));
3668 part_list
->base
= base
;
3669 part_list
->size
= size
;
3674 /** read the partition table into struct flash_partition_entry */
3675 static int read_partition_table(
3676 FILE *file
, long offset
,
3677 struct flash_partition_entry
*entries
, size_t max_entries
,
3682 const char *parthdr
= NULL
;
3683 const char *fwuphdr
= "fwup-ptn";
3684 const char *flashhdr
= "partition";
3686 /* TODO: search for the partition table */
3696 error(1, 0, "Invalid partition table");
3699 if (fseek(file
, offset
, SEEK_SET
) < 0)
3700 error(1, errno
, "Can not seek in the firmware");
3702 if (fread(buf
, 2048, 1, file
) != 1)
3703 error(1, errno
, "Can not read fwup-ptn from the firmware");
3707 /* look for the partition header */
3708 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3709 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3714 end
= buf
+ sizeof(buf
);
3715 while ((ptr
+ strlen(parthdr
)) < end
&&
3716 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3720 char name
[32] = { 0 };
3722 unsigned long base
= 0;
3723 unsigned long size
= 0;
3725 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3726 if (end_part
== NULL
) {
3727 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3731 for (int i
= 0; i
<= 4; i
++) {
3732 if (end_part
<= ptr
)
3735 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3736 if (end_element
== NULL
) {
3737 error(1, errno
, "Ignoring the rest of the partition entries.");
3742 /* partition header */
3744 ptr
= end_element
+ 1;
3748 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3749 strncpy(name
, ptr
, name_len
);
3750 name
[name_len
] = '\0';
3751 ptr
= end_element
+ 1;
3756 ptr
= end_element
+ 1;
3761 base
= strtoul(ptr
, NULL
, 16);
3762 ptr
= end_element
+ 1;
3767 ptr
= end_element
+ 1;
3768 /* actual size. The last element doesn't have a sepeartor */
3769 size
= strtoul(ptr
, NULL
, 16);
3770 /* the part ends with 0x09, 0x0d, 0x0a */
3772 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3781 static void write_partition(
3783 size_t firmware_offset
,
3784 struct flash_partition_entry
*entry
,
3790 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3792 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3793 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3794 error(1, errno
, "Can not read partition from input_file");
3796 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3797 error(1, errno
, "Can not write partition to output_file");
3799 /* write last chunk smaller than buffer */
3800 if (offset
< entry
->size
) {
3801 offset
= entry
->size
- offset
;
3802 if (fread(buf
, offset
, 1, input_file
) != 1)
3803 error(1, errno
, "Can not read partition from input_file");
3804 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3805 error(1, errno
, "Can not write partition to output_file");
3809 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3812 char output
[PATH_MAX
];
3814 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3815 output_file
= fopen(output
, "wb+");
3816 if (output_file
== NULL
) {
3817 error(1, errno
, "Can not open output file %s", output
);
3820 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3822 fclose(output_file
);
3827 /** extract all partitions from the firmware file */
3828 static int extract_firmware(const char *input
, const char *output_directory
)
3830 struct flash_partition_entry entries
[16] = { 0 };
3831 size_t max_entries
= 16;
3832 size_t firmware_offset
= 0x1014;
3835 struct stat statbuf
;
3837 /* check input file */
3838 if (stat(input
, &statbuf
)) {
3839 error(1, errno
, "Can not read input firmware %s", input
);
3842 /* check if output directory exists */
3843 if (stat(output_directory
, &statbuf
)) {
3844 error(1, errno
, "Failed to stat output directory %s", output_directory
);
3847 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
3848 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
3851 input_file
= fopen(input
, "rb");
3853 if (read_partition_table(input_file
, firmware_offset
, entries
, 16, 0) != 0) {
3854 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3857 for (size_t i
= 0; i
< max_entries
; i
++) {
3858 if (entries
[i
].name
== NULL
&&
3859 entries
[i
].base
== 0 &&
3860 entries
[i
].size
== 0)
3863 extract_firmware_partition(input_file
, firmware_offset
, &entries
[i
], output_directory
);
3869 static struct flash_partition_entry
*find_partition(
3870 struct flash_partition_entry
*entries
, size_t max_entries
,
3871 const char *name
, const char *error_msg
)
3873 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
3874 if (strcmp(entries
->name
, name
) == 0)
3879 error(1, 0, "%s", error_msg
);
3885 static int firmware_info(const char *input
)
3887 struct flash_partition_entry pointers
[MAX_PARTITIONS
] = { };
3888 struct flash_partition_entry
*e
;
3892 fp
= fopen(input
, "r");
3894 if (read_partition_table(fp
, 0x1014, pointers
, MAX_PARTITIONS
, 0)) {
3895 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3898 printf("Firmware image partitions:\n");
3899 printf("%-8s %-8s %s\n", "base", "size", "name");
3900 for (i
= 0; i
< MAX_PARTITIONS
; i
++) {
3903 if (!e
->name
&& !e
->base
&& !e
->size
)
3906 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
? e
->name
: "");
3909 e
= find_partition(pointers
, MAX_PARTITIONS
, "soft-version", NULL
);
3911 size_t data_len
= e
->size
- sizeof(struct meta_header
);
3912 char *buf
= malloc(data_len
);
3913 struct soft_version
*s
;
3918 error(1, errno
, "Failed to alloc buffer");
3920 if (fseek(fp
, 0x1014 + e
->base
+ sizeof(struct meta_header
), SEEK_SET
))
3921 error(1, errno
, "Can not seek in the firmware");
3923 if (fread(buf
, data_len
, 1, fp
) != 1)
3924 error(1, errno
, "Can not read fwup-ptn data from the firmware");
3926 /* Check for string ignoring padding character */
3928 for (i
= 0; i
< data_len
- 1; i
++) {
3929 if (!isascii(buf
[i
])) {
3935 printf("\n[Software version]\n");
3937 fwrite(buf
, data_len
, 1, stdout
);
3939 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
3940 s
= (struct soft_version
*)buf
;
3942 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
3943 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
3944 printf("Revision: %d\n", ntohl(s
->rev
));
3946 printf("Failed to parse data\n");
3952 e
= find_partition(pointers
, MAX_PARTITIONS
, "support-list", NULL
);
3957 size_t max_length
= sizeof(buf
) - 1;
3959 if (fseek(fp
, 0x1014 + e
->base
+ sizeof(struct meta_header
), SEEK_SET
))
3960 error(1, errno
, "Can not seek in the firmware");
3962 printf("\n[Support list]\n");
3963 for (length
= e
->size
- sizeof(struct meta_header
); length
; length
-= bytes
) {
3964 bytes
= fread(buf
, 1, length
> max_length
? max_length
: length
, fp
);
3966 error(1, errno
, "Can not read fwup-ptn data from the firmware");
3974 e
= find_partition(pointers
, MAX_PARTITIONS
, "partition-table", NULL
);
3976 struct flash_partition_entry parts
[MAX_PARTITIONS
] = { };
3978 if (read_partition_table(fp
, 0x1014 + e
->base
+ 4, parts
, MAX_PARTITIONS
, 1)) {
3979 error(1, 0, "Error can not read the partition table (partition)");
3982 printf("\n[Partition table]\n");
3983 printf("%-8s %-8s %s\n", "base", "size", "name");
3984 for (i
= 0; i
< MAX_PARTITIONS
; i
++) {
3987 if (!e
->name
&& !e
->base
&& !e
->size
)
3990 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
? e
->name
: "");
3999 static void write_ff(FILE *output_file
, size_t size
)
4004 memset(buf
, 0xff, sizeof(buf
));
4006 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
4007 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
4008 error(1, errno
, "Can not write 0xff to output_file");
4011 /* write last chunk smaller than buffer */
4012 if (offset
< size
) {
4013 offset
= size
- offset
;
4014 if (fwrite(buf
, offset
, 1, output_file
) != 1)
4015 error(1, errno
, "Can not write partition to output_file");
4019 static void convert_firmware(const char *input
, const char *output
)
4021 struct flash_partition_entry fwup
[MAX_PARTITIONS
] = { 0 };
4022 struct flash_partition_entry flash
[MAX_PARTITIONS
] = { 0 };
4023 struct flash_partition_entry
*fwup_os_image
= NULL
, *fwup_file_system
= NULL
;
4024 struct flash_partition_entry
*flash_os_image
= NULL
, *flash_file_system
= NULL
;
4025 struct flash_partition_entry
*fwup_partition_table
= NULL
;
4026 size_t firmware_offset
= 0x1014;
4027 FILE *input_file
, *output_file
;
4029 struct stat statbuf
;
4031 /* check input file */
4032 if (stat(input
, &statbuf
)) {
4033 error(1, errno
, "Can not read input firmware %s", input
);
4036 input_file
= fopen(input
, "rb");
4038 error(1, 0, "Can not open input firmware %s", input
);
4040 output_file
= fopen(output
, "wb");
4042 error(1, 0, "Can not open output firmware %s", output
);
4044 if (read_partition_table(input_file
, firmware_offset
, fwup
, MAX_PARTITIONS
, 0) != 0) {
4045 error(1, 0, "Error can not read the partition table (fwup-ptn)");
4048 fwup_os_image
= find_partition(fwup
, MAX_PARTITIONS
,
4049 "os-image", "Error can not find os-image partition (fwup)");
4050 fwup_file_system
= find_partition(fwup
, MAX_PARTITIONS
,
4051 "file-system", "Error can not find file-system partition (fwup)");
4052 fwup_partition_table
= find_partition(fwup
, MAX_PARTITIONS
,
4053 "partition-table", "Error can not find partition-table partition");
4055 /* the flash partition table has a 0x00000004 magic haeder */
4056 if (read_partition_table(input_file
, firmware_offset
+ fwup_partition_table
->base
+ 4, flash
, MAX_PARTITIONS
, 1) != 0)
4057 error(1, 0, "Error can not read the partition table (flash)");
4059 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4060 "os-image", "Error can not find os-image partition (flash)");
4061 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4062 "file-system", "Error can not find file-system partition (flash)");
4064 /* write os_image to 0x0 */
4065 write_partition(input_file
, firmware_offset
, fwup_os_image
, output_file
);
4066 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4068 /* write file-system behind os_image */
4069 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4070 write_partition(input_file
, firmware_offset
, fwup_file_system
, output_file
);
4071 write_ff(output_file
, flash_file_system
->size
- fwup_file_system
->size
);
4073 fclose(output_file
);
4077 int main(int argc
, char *argv
[]) {
4078 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4079 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4080 bool add_jffs2_eof
= false, sysupgrade
= false;
4082 struct device_info
*info
;
4083 set_source_date_epoch();
4088 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4094 info_image
= optarg
;
4102 kernel_image
= optarg
;
4106 rootfs_image
= optarg
;
4114 sscanf(optarg
, "r%u", &rev
);
4118 add_jffs2_eof
= true;
4130 output_directory
= optarg
;
4134 extract_image
= optarg
;
4138 convert_image
= optarg
;
4148 firmware_info(info_image
);
4149 } else if (extract_image
|| output_directory
) {
4151 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4152 if (!output_directory
)
4153 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4154 extract_firmware(extract_image
, output_directory
);
4155 } else if (convert_image
) {
4157 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4158 convert_firmware(convert_image
, output
);
4161 error(1, 0, "no board has been specified");
4163 error(1, 0, "no kernel image has been specified");
4165 error(1, 0, "no rootfs image has been specified");
4167 error(1, 0, "no output filename has been specified");
4169 info
= find_board(board
);
4172 error(1, 0, "unsupported board %s", board
);
4174 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);