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 S4 v2 */
1621 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1622 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1623 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1624 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1625 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1626 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1627 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1628 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1629 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1630 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1631 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1632 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1634 .soft_ver
= SOFT_VER_DEFAULT
,
1637 {"fs-uboot", 0x00000, 0x80000},
1638 {"product-info", 0x80000, 0x05000},
1639 {"default-mac", 0x85000, 0x01000},
1640 {"device-id", 0x86000, 0x01000},
1641 {"support-list", 0x87000, 0x10000},
1642 {"user-config", 0xa7000, 0x10000},
1643 {"device-config", 0xb7000, 0x10000},
1644 {"group-info", 0xc7000, 0x10000},
1645 {"partition-table", 0xd7000, 0x02000},
1646 {"soft-version", 0xd9000, 0x10000},
1647 {"profile", 0xe9000, 0x10000},
1648 {"default-config", 0xf9000, 0x10000},
1649 {"url-sig", 0x1e0000, 0x10000},
1650 {"radio", 0x1f0000, 0x10000},
1651 {"firmware", 0x200000, 0xe00000},
1654 .first_sysupgrade_partition
= "os-image",
1655 .last_sysupgrade_partition
= "file-system",
1658 /** Firmware layout for the EAP120 */
1661 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1664 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1666 .soft_ver
= SOFT_VER_DEFAULT
,
1669 {"fs-uboot", 0x00000, 0x20000},
1670 {"partition-table", 0x20000, 0x02000},
1671 {"default-mac", 0x30000, 0x00020},
1672 {"support-list", 0x31000, 0x00100},
1673 {"product-info", 0x31100, 0x00100},
1674 {"soft-version", 0x32000, 0x00100},
1675 {"os-image", 0x40000, 0x180000},
1676 {"file-system", 0x1c0000, 0x600000},
1677 {"user-config", 0x7c0000, 0x10000},
1678 {"backup-config", 0x7d0000, 0x10000},
1679 {"log", 0x7e0000, 0x10000},
1680 {"radio", 0x7f0000, 0x10000},
1684 .first_sysupgrade_partition
= "os-image",
1685 .last_sysupgrade_partition
= "file-system"
1688 /** Firmware layout for the EAP225-Outdoor v1 */
1690 .id
= "EAP225-OUTDOOR-V1",
1693 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1694 .part_trail
= PART_TRAIL_NONE
,
1695 .soft_ver
= SOFT_VER_DEFAULT
,
1696 .soft_ver_compat_level
= 1,
1699 {"fs-uboot", 0x00000, 0x20000},
1700 {"partition-table", 0x20000, 0x02000},
1701 {"default-mac", 0x30000, 0x01000},
1702 {"support-list", 0x31000, 0x00100},
1703 {"product-info", 0x31100, 0x00400},
1704 {"soft-version", 0x32000, 0x00100},
1705 {"firmware", 0x40000, 0xd80000},
1706 {"user-config", 0xdc0000, 0x30000},
1707 {"mutil-log", 0xf30000, 0x80000},
1708 {"oops", 0xfb0000, 0x40000},
1709 {"radio", 0xff0000, 0x10000},
1713 .first_sysupgrade_partition
= "os-image",
1714 .last_sysupgrade_partition
= "file-system"
1717 /** Firmware layout for the EAP225 v1 */
1722 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1723 .part_trail
= PART_TRAIL_NONE
,
1724 .soft_ver
= SOFT_VER_DEFAULT
,
1727 {"fs-uboot", 0x00000, 0x20000},
1728 {"partition-table", 0x20000, 0x02000},
1729 {"default-mac", 0x30000, 0x01000},
1730 {"support-list", 0x31000, 0x00100},
1731 {"product-info", 0x31100, 0x00400},
1732 {"soft-version", 0x32000, 0x00100},
1733 {"firmware", 0x40000, 0xd80000},
1734 {"user-config", 0xdc0000, 0x30000},
1735 {"radio", 0xff0000, 0x10000},
1739 .first_sysupgrade_partition
= "os-image",
1740 .last_sysupgrade_partition
= "file-system"
1743 /** Firmware layout for the EAP225 v3
1744 * Also compatible with:
1747 * - EAP225-Outdoor v1
1748 * - EAP225-Outdoor v3
1754 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1755 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1756 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1757 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1758 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1759 .part_trail
= PART_TRAIL_NONE
,
1760 .soft_ver
= SOFT_VER_DEFAULT
,
1761 .soft_ver_compat_level
= 1,
1764 {"fs-uboot", 0x00000, 0x20000},
1765 {"partition-table", 0x20000, 0x02000},
1766 {"default-mac", 0x30000, 0x01000},
1767 {"support-list", 0x31000, 0x00100},
1768 {"product-info", 0x31100, 0x00400},
1769 {"soft-version", 0x32000, 0x00100},
1770 {"firmware", 0x40000, 0xd80000},
1771 {"user-config", 0xdc0000, 0x30000},
1772 {"mutil-log", 0xf30000, 0x80000},
1773 {"oops", 0xfb0000, 0x40000},
1774 {"radio", 0xff0000, 0x10000},
1778 .first_sysupgrade_partition
= "os-image",
1779 .last_sysupgrade_partition
= "file-system"
1782 /** Firmware layout for the EAP225-Wall v2 */
1784 .id
= "EAP225-WALL-V2",
1787 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1788 .part_trail
= PART_TRAIL_NONE
,
1789 .soft_ver
= SOFT_VER_DEFAULT
,
1790 .soft_ver_compat_level
= 1,
1793 {"fs-uboot", 0x00000, 0x20000},
1794 {"partition-table", 0x20000, 0x02000},
1795 {"default-mac", 0x30000, 0x01000},
1796 {"support-list", 0x31000, 0x00100},
1797 {"product-info", 0x31100, 0x00400},
1798 {"soft-version", 0x32000, 0x00100},
1799 {"firmware", 0x40000, 0xd80000},
1800 {"user-config", 0xdc0000, 0x30000},
1801 {"mutil-log", 0xf30000, 0x80000},
1802 {"oops", 0xfb0000, 0x40000},
1803 {"radio", 0xff0000, 0x10000},
1807 .first_sysupgrade_partition
= "os-image",
1808 .last_sysupgrade_partition
= "file-system"
1811 /** Firmware layout for the EAP235-Wall v1 */
1813 .id
= "EAP235-WALL-V1",
1816 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1817 .part_trail
= PART_TRAIL_NONE
,
1818 .soft_ver
= SOFT_VER_NUMERIC(3, 0, 0),
1819 .soft_ver_compat_level
= 1,
1822 {"fs-uboot", 0x00000, 0x80000},
1823 {"partition-table", 0x80000, 0x02000},
1824 {"default-mac", 0x90000, 0x01000},
1825 {"support-list", 0x91000, 0x00100},
1826 {"product-info", 0x91100, 0x00400},
1827 {"soft-version", 0x92000, 0x00100},
1828 {"firmware", 0xa0000, 0xd20000},
1829 {"user-config", 0xdc0000, 0x30000},
1830 {"mutil-log", 0xf30000, 0x80000},
1831 {"oops", 0xfb0000, 0x40000},
1832 {"radio", 0xff0000, 0x10000},
1836 .first_sysupgrade_partition
= "os-image",
1837 .last_sysupgrade_partition
= "file-system"
1840 /** Firmware layout for the EAP245 v1 */
1845 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1846 .part_trail
= PART_TRAIL_NONE
,
1847 .soft_ver
= SOFT_VER_DEFAULT
,
1850 {"fs-uboot", 0x00000, 0x20000},
1851 {"partition-table", 0x20000, 0x02000},
1852 {"default-mac", 0x30000, 0x01000},
1853 {"support-list", 0x31000, 0x00100},
1854 {"product-info", 0x31100, 0x00400},
1855 {"soft-version", 0x32000, 0x00100},
1856 {"firmware", 0x40000, 0xd80000},
1857 {"user-config", 0xdc0000, 0x30000},
1858 {"radio", 0xff0000, 0x10000},
1862 .first_sysupgrade_partition
= "os-image",
1863 .last_sysupgrade_partition
= "file-system"
1866 /** Firmware layout for the EAP245 v3 */
1871 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
1872 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
1873 .part_trail
= PART_TRAIL_NONE
,
1874 .soft_ver
= SOFT_VER_DEFAULT
,
1875 .soft_ver_compat_level
= 1,
1877 /** Firmware partition with dynamic kernel/rootfs split */
1879 {"factroy-boot", 0x00000, 0x40000},
1880 {"fs-uboot", 0x40000, 0x40000},
1881 {"partition-table", 0x80000, 0x10000},
1882 {"default-mac", 0x90000, 0x01000},
1883 {"support-list", 0x91000, 0x00100},
1884 {"product-info", 0x91100, 0x00400},
1885 {"soft-version", 0x92000, 0x00100},
1886 {"radio", 0xa0000, 0x10000},
1887 {"extra-para", 0xb0000, 0x10000},
1888 {"firmware", 0xc0000, 0xe40000},
1889 {"config", 0xf00000, 0x30000},
1890 {"mutil-log", 0xf30000, 0x80000},
1891 {"oops", 0xfb0000, 0x40000},
1895 .first_sysupgrade_partition
= "os-image",
1896 .last_sysupgrade_partition
= "file-system"
1899 /** Firmware layout for the EAP615-Wall v1 */
1901 .id
= "EAP615-WALL-V1",
1902 .soft_ver
= SOFT_VER_DEFAULT
,
1903 .soft_ver_compat_level
= 1,
1906 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
1907 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
1908 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
1909 .part_trail
= PART_TRAIL_NONE
,
1912 {"fs-uboot", 0x00000, 0x80000},
1913 {"partition-table", 0x80000, 0x02000},
1914 {"default-mac", 0x90000, 0x01000},
1915 {"support-list", 0x91000, 0x00100},
1916 {"product-info", 0x91100, 0x00400},
1917 {"soft-version", 0x92000, 0x00100},
1918 {"firmware", 0xa0000, 0xcf0000},
1919 {"user-config", 0xd90000, 0x60000},
1920 {"mutil-log", 0xf30000, 0x80000},
1921 {"oops", 0xfb0000, 0x40000},
1922 {"radio", 0xff0000, 0x10000},
1926 .first_sysupgrade_partition
= "os-image",
1927 .last_sysupgrade_partition
= "file-system"
1930 /** Firmware layout for the TL-WA1201 v2 */
1932 .id
= "TL-WA1201-V2",
1936 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
1937 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
1939 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
1942 {"fs-uboot", 0x00000, 0x20000},
1943 {"default-mac", 0x20000, 0x00200},
1944 {"pin", 0x20200, 0x00100},
1945 {"product-info", 0x20300, 0x00200},
1946 {"device-id", 0x20500, 0x0fb00},
1947 {"firmware", 0x30000, 0xce0000},
1948 {"portal-logo", 0xd10000, 0x20000},
1949 {"portal-back", 0xd30000, 0x200000},
1950 {"soft-version", 0xf30000, 0x00200},
1951 {"extra-para", 0xf30200, 0x00200},
1952 {"support-list", 0xf30400, 0x00200},
1953 {"profile", 0xf30600, 0x0fa00},
1954 {"apdef-config", 0xf40000, 0x10000},
1955 {"ap-config", 0xf50000, 0x10000},
1956 {"redef-config", 0xf60000, 0x10000},
1957 {"re-config", 0xf70000, 0x10000},
1958 {"multidef-config", 0xf80000, 0x10000},
1959 {"multi-config", 0xf90000, 0x10000},
1960 {"clientdef-config", 0xfa0000, 0x10000},
1961 {"client-config", 0xfb0000, 0x10000},
1962 {"partition-table", 0xfc0000, 0x10000},
1963 {"user-config", 0xfd0000, 0x10000},
1964 {"certificate", 0xfe0000, 0x10000},
1965 {"radio", 0xff0000, 0x10000},
1968 .first_sysupgrade_partition
= "os-image",
1969 .last_sysupgrade_partition
= "file-system",
1972 /** Firmware layout for the TL-WA850RE v2 */
1974 .id
= "TLWA850REV2",
1978 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
1979 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
1980 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
1981 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
1982 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
1983 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
1984 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
1985 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
1986 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
1987 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
1989 .soft_ver
= SOFT_VER_DEFAULT
,
1992 576KB were moved from file-system to os-image
1993 in comparison to the stock image
1996 {"fs-uboot", 0x00000, 0x20000},
1997 {"firmware", 0x20000, 0x390000},
1998 {"partition-table", 0x3b0000, 0x02000},
1999 {"default-mac", 0x3c0000, 0x00020},
2000 {"pin", 0x3c0100, 0x00020},
2001 {"product-info", 0x3c1000, 0x01000},
2002 {"soft-version", 0x3c2000, 0x00100},
2003 {"support-list", 0x3c3000, 0x01000},
2004 {"profile", 0x3c4000, 0x08000},
2005 {"user-config", 0x3d0000, 0x10000},
2006 {"default-config", 0x3e0000, 0x10000},
2007 {"radio", 0x3f0000, 0x10000},
2011 .first_sysupgrade_partition
= "os-image",
2012 .last_sysupgrade_partition
= "file-system"
2015 /** Firmware layout for the TL-WA855RE v1 */
2017 .id
= "TLWA855REV1",
2021 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2022 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2023 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2024 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2025 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2026 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2027 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2028 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2029 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2031 .soft_ver
= SOFT_VER_DEFAULT
,
2034 {"fs-uboot", 0x00000, 0x20000},
2035 {"os-image", 0x20000, 0x150000},
2036 {"file-system", 0x170000, 0x240000},
2037 {"partition-table", 0x3b0000, 0x02000},
2038 {"default-mac", 0x3c0000, 0x00020},
2039 {"pin", 0x3c0100, 0x00020},
2040 {"product-info", 0x3c1000, 0x01000},
2041 {"soft-version", 0x3c2000, 0x00100},
2042 {"support-list", 0x3c3000, 0x01000},
2043 {"profile", 0x3c4000, 0x08000},
2044 {"user-config", 0x3d0000, 0x10000},
2045 {"default-config", 0x3e0000, 0x10000},
2046 {"radio", 0x3f0000, 0x10000},
2050 .first_sysupgrade_partition
= "os-image",
2051 .last_sysupgrade_partition
= "file-system"
2054 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2056 .id
= "TL-WPA8630P-V2.0-EU",
2060 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2062 .soft_ver
= SOFT_VER_DEFAULT
,
2065 {"factory-uboot", 0x00000, 0x20000},
2066 {"fs-uboot", 0x20000, 0x20000},
2067 {"firmware", 0x40000, 0x5e0000},
2068 {"partition-table", 0x620000, 0x02000},
2069 {"default-mac", 0x630000, 0x00020},
2070 {"pin", 0x630100, 0x00020},
2071 {"device-id", 0x630200, 0x00030},
2072 {"product-info", 0x631100, 0x01000},
2073 {"extra-para", 0x632100, 0x01000},
2074 {"soft-version", 0x640000, 0x01000},
2075 {"support-list", 0x641000, 0x01000},
2076 {"profile", 0x642000, 0x08000},
2077 {"user-config", 0x650000, 0x10000},
2078 {"default-config", 0x660000, 0x10000},
2079 {"default-nvm", 0x670000, 0xc0000},
2080 {"default-pib", 0x730000, 0x40000},
2081 {"radio", 0x7f0000, 0x10000},
2085 .first_sysupgrade_partition
= "os-image",
2086 .last_sysupgrade_partition
= "file-system"
2089 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2091 .id
= "TL-WPA8630P-V2-INT",
2095 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2096 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2097 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2099 .soft_ver
= SOFT_VER_DEFAULT
,
2102 {"factory-uboot", 0x00000, 0x20000},
2103 {"fs-uboot", 0x20000, 0x20000},
2104 {"firmware", 0x40000, 0x5e0000},
2105 {"partition-table", 0x620000, 0x02000},
2106 {"extra-para", 0x632100, 0x01000},
2107 {"soft-version", 0x640000, 0x01000},
2108 {"support-list", 0x641000, 0x01000},
2109 {"profile", 0x642000, 0x08000},
2110 {"user-config", 0x650000, 0x10000},
2111 {"default-config", 0x660000, 0x10000},
2112 {"default-nvm", 0x670000, 0xc0000},
2113 {"default-pib", 0x730000, 0x40000},
2114 {"default-mac", 0x7e0000, 0x00020},
2115 {"pin", 0x7e0100, 0x00020},
2116 {"device-id", 0x7e0200, 0x00030},
2117 {"product-info", 0x7e1100, 0x01000},
2118 {"radio", 0x7f0000, 0x10000},
2122 .first_sysupgrade_partition
= "os-image",
2123 .last_sysupgrade_partition
= "file-system"
2126 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2128 .id
= "TL-WPA8630P-V2.1-EU",
2132 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2134 .soft_ver
= SOFT_VER_DEFAULT
,
2137 {"factory-uboot", 0x00000, 0x20000},
2138 {"fs-uboot", 0x20000, 0x20000},
2139 {"firmware", 0x40000, 0x5e0000},
2140 {"extra-para", 0x680000, 0x01000},
2141 {"product-info", 0x690000, 0x01000},
2142 {"partition-table", 0x6a0000, 0x02000},
2143 {"soft-version", 0x6b0000, 0x01000},
2144 {"support-list", 0x6b1000, 0x01000},
2145 {"profile", 0x6b2000, 0x08000},
2146 {"user-config", 0x6c0000, 0x10000},
2147 {"default-config", 0x6d0000, 0x10000},
2148 {"default-nvm", 0x6e0000, 0xc0000},
2149 {"default-pib", 0x7a0000, 0x40000},
2150 {"default-mac", 0x7e0000, 0x00020},
2151 {"pin", 0x7e0100, 0x00020},
2152 {"device-id", 0x7e0200, 0x00030},
2153 {"radio", 0x7f0000, 0x10000},
2157 .first_sysupgrade_partition
= "os-image",
2158 .last_sysupgrade_partition
= "file-system"
2161 /** Firmware layout for the TL-WPA8631P v3 */
2163 .id
= "TL-WPA8631P-V3",
2167 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2168 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2169 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2171 .soft_ver
= SOFT_VER_DEFAULT
,
2174 {"fs-uboot", 0x00000, 0x20000},
2175 {"firmware", 0x20000, 0x710000},
2176 {"partition-table", 0x730000, 0x02000},
2177 {"default-mac", 0x732000, 0x00020},
2178 {"pin", 0x732100, 0x00020},
2179 {"device-id", 0x732200, 0x00030},
2180 {"default-region", 0x732300, 0x00010},
2181 {"product-info", 0x732400, 0x00200},
2182 {"extra-para", 0x732600, 0x00200},
2183 {"soft-version", 0x732800, 0x00200},
2184 {"support-list", 0x732a00, 0x00100},
2185 {"profile", 0x732b00, 0x00100},
2186 {"default-config", 0x732c00, 0x00800},
2187 {"plc-type", 0x733400, 0x00020},
2188 {"default-pib", 0x733500, 0x06000},
2189 {"user-config", 0x740000, 0x10000},
2190 {"plc-pib", 0x750000, 0x10000},
2191 {"plc-nvm", 0x760000, 0x90000},
2192 {"radio", 0x7f0000, 0x10000},
2196 .first_sysupgrade_partition
= "os-image",
2197 .last_sysupgrade_partition
= "file-system"
2200 /** Firmware layout for the TL-WR1043 v5 */
2202 .id
= "TLWR1043NV5",
2206 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2207 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2209 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2211 {"factory-boot", 0x00000, 0x20000},
2212 {"fs-uboot", 0x20000, 0x20000},
2213 {"firmware", 0x40000, 0xec0000},
2214 {"default-mac", 0xf00000, 0x00200},
2215 {"pin", 0xf00200, 0x00200},
2216 {"device-id", 0xf00400, 0x00100},
2217 {"product-info", 0xf00500, 0x0fb00},
2218 {"soft-version", 0xf10000, 0x01000},
2219 {"extra-para", 0xf11000, 0x01000},
2220 {"support-list", 0xf12000, 0x0a000},
2221 {"profile", 0xf1c000, 0x04000},
2222 {"default-config", 0xf20000, 0x10000},
2223 {"user-config", 0xf30000, 0x40000},
2224 {"qos-db", 0xf70000, 0x40000},
2225 {"certificate", 0xfb0000, 0x10000},
2226 {"partition-table", 0xfc0000, 0x10000},
2227 {"log", 0xfd0000, 0x20000},
2228 {"radio", 0xff0000, 0x10000},
2231 .first_sysupgrade_partition
= "os-image",
2232 .last_sysupgrade_partition
= "file-system"
2235 /** Firmware layout for the TL-WR1043 v4 */
2237 .id
= "TLWR1043NDV4",
2241 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2243 .soft_ver
= SOFT_VER_DEFAULT
,
2245 /* We're using a dynamic kernel/rootfs split here */
2247 {"fs-uboot", 0x00000, 0x20000},
2248 {"firmware", 0x20000, 0xf30000},
2249 {"default-mac", 0xf50000, 0x00200},
2250 {"pin", 0xf50200, 0x00200},
2251 {"product-info", 0xf50400, 0x0fc00},
2252 {"soft-version", 0xf60000, 0x0b000},
2253 {"support-list", 0xf6b000, 0x04000},
2254 {"profile", 0xf70000, 0x04000},
2255 {"default-config", 0xf74000, 0x0b000},
2256 {"user-config", 0xf80000, 0x40000},
2257 {"partition-table", 0xfc0000, 0x10000},
2258 {"log", 0xfd0000, 0x20000},
2259 {"radio", 0xff0000, 0x10000},
2263 .first_sysupgrade_partition
= "os-image",
2264 .last_sysupgrade_partition
= "file-system"
2267 /** Firmware layout for the TL-WR902AC v1 */
2269 .id
= "TL-WR902AC-V1",
2273 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2274 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2276 .soft_ver
= SOFT_VER_DEFAULT
,
2279 384KB were moved from file-system to os-image
2280 in comparison to the stock image
2283 {"fs-uboot", 0x00000, 0x20000},
2284 {"firmware", 0x20000, 0x730000},
2285 {"default-mac", 0x750000, 0x00200},
2286 {"pin", 0x750200, 0x00200},
2287 {"product-info", 0x750400, 0x0fc00},
2288 {"soft-version", 0x760000, 0x0b000},
2289 {"support-list", 0x76b000, 0x04000},
2290 {"profile", 0x770000, 0x04000},
2291 {"default-config", 0x774000, 0x0b000},
2292 {"user-config", 0x780000, 0x40000},
2293 {"partition-table", 0x7c0000, 0x10000},
2294 {"log", 0x7d0000, 0x20000},
2295 {"radio", 0x7f0000, 0x10000},
2299 .first_sysupgrade_partition
= "os-image",
2300 .last_sysupgrade_partition
= "file-system",
2303 /** Firmware layout for the TL-WR941HP v1 */
2305 .id
= "TL-WR941HP-V1",
2309 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2311 .soft_ver
= SOFT_VER_DEFAULT
,
2314 {"fs-uboot", 0x00000, 0x20000},
2315 {"firmware", 0x20000, 0x730000},
2316 {"default-mac", 0x750000, 0x00200},
2317 {"pin", 0x750200, 0x00200},
2318 {"product-info", 0x750400, 0x0fc00},
2319 {"soft-version", 0x760000, 0x0b000},
2320 {"support-list", 0x76b000, 0x04000},
2321 {"profile", 0x770000, 0x04000},
2322 {"default-config", 0x774000, 0x0b000},
2323 {"user-config", 0x780000, 0x40000},
2324 {"partition-table", 0x7c0000, 0x10000},
2325 {"log", 0x7d0000, 0x20000},
2326 {"radio", 0x7f0000, 0x10000},
2330 .first_sysupgrade_partition
= "os-image",
2331 .last_sysupgrade_partition
= "file-system",
2334 /** Firmware layout for the TL-WR942N V1 */
2340 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2341 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2343 .soft_ver
= SOFT_VER_DEFAULT
,
2346 {"fs-uboot", 0x00000, 0x20000},
2347 {"firmware", 0x20000, 0xe20000},
2348 {"default-mac", 0xe40000, 0x00200},
2349 {"pin", 0xe40200, 0x00200},
2350 {"product-info", 0xe40400, 0x0fc00},
2351 {"partition-table", 0xe50000, 0x10000},
2352 {"soft-version", 0xe60000, 0x10000},
2353 {"support-list", 0xe70000, 0x10000},
2354 {"profile", 0xe80000, 0x10000},
2355 {"default-config", 0xe90000, 0x10000},
2356 {"user-config", 0xea0000, 0x40000},
2357 {"qos-db", 0xee0000, 0x40000},
2358 {"certificate", 0xf20000, 0x10000},
2359 {"usb-config", 0xfb0000, 0x10000},
2360 {"log", 0xfc0000, 0x20000},
2361 {"radio-bk", 0xfe0000, 0x10000},
2362 {"radio", 0xff0000, 0x10000},
2366 .first_sysupgrade_partition
= "os-image",
2367 .last_sysupgrade_partition
= "file-system",
2370 /** Firmware layout for the RE200 v2 */
2376 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2377 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2378 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2379 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2380 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2381 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2382 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2383 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2384 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2385 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2386 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2387 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2388 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2390 .soft_ver
= SOFT_VER_DEFAULT
,
2393 {"fs-uboot", 0x00000, 0x20000},
2394 {"firmware", 0x20000, 0x7a0000},
2395 {"partition-table", 0x7c0000, 0x02000},
2396 {"default-mac", 0x7c2000, 0x00020},
2397 {"pin", 0x7c2100, 0x00020},
2398 {"product-info", 0x7c3100, 0x01000},
2399 {"soft-version", 0x7c4200, 0x01000},
2400 {"support-list", 0x7c5200, 0x01000},
2401 {"profile", 0x7c6200, 0x08000},
2402 {"config-info", 0x7ce200, 0x00400},
2403 {"user-config", 0x7d0000, 0x10000},
2404 {"default-config", 0x7e0000, 0x10000},
2405 {"radio", 0x7f0000, 0x10000},
2409 .first_sysupgrade_partition
= "os-image",
2410 .last_sysupgrade_partition
= "file-system"
2413 /** Firmware layout for the RE200 v3 */
2419 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2420 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2421 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2422 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2423 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2424 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2425 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2426 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2427 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2428 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2429 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2430 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2431 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2432 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2434 .soft_ver
= SOFT_VER_DEFAULT
,
2437 {"fs-uboot", 0x00000, 0x20000},
2438 {"firmware", 0x20000, 0x7a0000},
2439 {"partition-table", 0x7c0000, 0x02000},
2440 {"default-mac", 0x7c2000, 0x00020},
2441 {"pin", 0x7c2100, 0x00020},
2442 {"product-info", 0x7c3100, 0x01000},
2443 {"soft-version", 0x7c4200, 0x01000},
2444 {"support-list", 0x7c5200, 0x01000},
2445 {"profile", 0x7c6200, 0x08000},
2446 {"config-info", 0x7ce200, 0x00400},
2447 {"user-config", 0x7d0000, 0x10000},
2448 {"default-config", 0x7e0000, 0x10000},
2449 {"radio", 0x7f0000, 0x10000},
2453 .first_sysupgrade_partition
= "os-image",
2454 .last_sysupgrade_partition
= "file-system"
2457 /** Firmware layout for the RE200 v4 */
2463 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2464 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2465 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2466 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2467 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2468 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2469 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2470 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2471 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2472 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2473 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2474 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2475 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2476 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2478 .soft_ver
= SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2481 {"fs-uboot", 0x00000, 0x20000},
2482 {"firmware", 0x20000, 0x7a0000},
2483 {"partition-table", 0x7c0000, 0x02000},
2484 {"default-mac", 0x7c2000, 0x00020},
2485 {"pin", 0x7c2100, 0x00020},
2486 {"product-info", 0x7c3100, 0x01000},
2487 {"soft-version", 0x7c4200, 0x01000},
2488 {"support-list", 0x7c5200, 0x01000},
2489 {"profile", 0x7c6200, 0x08000},
2490 {"config-info", 0x7ce200, 0x00400},
2491 {"user-config", 0x7d0000, 0x10000},
2492 {"default-config", 0x7e0000, 0x10000},
2493 {"radio", 0x7f0000, 0x10000},
2497 .first_sysupgrade_partition
= "os-image",
2498 .last_sysupgrade_partition
= "file-system"
2501 /** Firmware layout for the RE220 v2 */
2507 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2508 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2509 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2510 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2511 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2512 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2513 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2514 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2515 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2516 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2517 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2518 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2519 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2521 .soft_ver
= SOFT_VER_DEFAULT
,
2524 {"fs-uboot", 0x00000, 0x20000},
2525 {"firmware", 0x20000, 0x7a0000},
2526 {"partition-table", 0x7c0000, 0x02000},
2527 {"default-mac", 0x7c2000, 0x00020},
2528 {"pin", 0x7c2100, 0x00020},
2529 {"product-info", 0x7c3100, 0x01000},
2530 {"soft-version", 0x7c4200, 0x01000},
2531 {"support-list", 0x7c5200, 0x01000},
2532 {"profile", 0x7c6200, 0x08000},
2533 {"config-info", 0x7ce200, 0x00400},
2534 {"user-config", 0x7d0000, 0x10000},
2535 {"default-config", 0x7e0000, 0x10000},
2536 {"radio", 0x7f0000, 0x10000},
2540 .first_sysupgrade_partition
= "os-image",
2541 .last_sysupgrade_partition
= "file-system"
2544 /** Firmware layout for the RE305 v1 */
2550 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2551 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2552 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2553 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2554 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2555 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2556 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2558 .soft_ver
= SOFT_VER_DEFAULT
,
2561 {"fs-uboot", 0x00000, 0x20000},
2562 {"firmware", 0x20000, 0x5e0000},
2563 {"partition-table", 0x600000, 0x02000},
2564 {"default-mac", 0x610000, 0x00020},
2565 {"pin", 0x610100, 0x00020},
2566 {"product-info", 0x611100, 0x01000},
2567 {"soft-version", 0x620000, 0x01000},
2568 {"support-list", 0x621000, 0x01000},
2569 {"profile", 0x622000, 0x08000},
2570 {"user-config", 0x630000, 0x10000},
2571 {"default-config", 0x640000, 0x10000},
2572 {"radio", 0x7f0000, 0x10000},
2576 .first_sysupgrade_partition
= "os-image",
2577 .last_sysupgrade_partition
= "file-system"
2580 /** Firmware layout for the RE305 v3 */
2586 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2587 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2588 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2589 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2590 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2591 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2592 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2593 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2594 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2595 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2596 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2598 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2601 {"fs-uboot", 0x00000, 0x20000},
2602 {"firmware", 0x20000, 0x7a0000},
2603 {"partition-table", 0x7c0000, 0x02000},
2604 {"default-mac", 0x7c2000, 0x00020},
2605 {"pin", 0x7c2100, 0x00020},
2606 {"product-info", 0x7c3100, 0x01000},
2607 {"soft-version", 0x7c4200, 0x01000},
2608 {"support-list", 0x7c5200, 0x01000},
2609 {"profile", 0x7c6200, 0x08000},
2610 {"config-info", 0x7ce200, 0x00400},
2611 {"user-config", 0x7d0000, 0x10000},
2612 {"default-config", 0x7e0000, 0x10000},
2613 {"radio", 0x7f0000, 0x10000},
2617 .first_sysupgrade_partition
= "os-image",
2618 .last_sysupgrade_partition
= "file-system"
2621 /** Firmware layout for the RE350 v1 */
2627 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2628 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2629 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2630 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2631 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2632 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2633 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2635 .soft_ver
= SOFT_VER_DEFAULT
,
2637 /** We're using a dynamic kernel/rootfs split here */
2639 {"fs-uboot", 0x00000, 0x20000},
2640 {"firmware", 0x20000, 0x5e0000},
2641 {"partition-table", 0x600000, 0x02000},
2642 {"default-mac", 0x610000, 0x00020},
2643 {"pin", 0x610100, 0x00020},
2644 {"product-info", 0x611100, 0x01000},
2645 {"soft-version", 0x620000, 0x01000},
2646 {"support-list", 0x621000, 0x01000},
2647 {"profile", 0x622000, 0x08000},
2648 {"user-config", 0x630000, 0x10000},
2649 {"default-config", 0x640000, 0x10000},
2650 {"radio", 0x7f0000, 0x10000},
2654 .first_sysupgrade_partition
= "os-image",
2655 .last_sysupgrade_partition
= "file-system"
2658 /** Firmware layout for the RE350K v1 */
2664 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2666 .soft_ver
= SOFT_VER_DEFAULT
,
2668 /** We're using a dynamic kernel/rootfs split here */
2670 {"fs-uboot", 0x00000, 0x20000},
2671 {"firmware", 0x20000, 0xd70000},
2672 {"partition-table", 0xd90000, 0x02000},
2673 {"default-mac", 0xda0000, 0x00020},
2674 {"pin", 0xda0100, 0x00020},
2675 {"product-info", 0xda1100, 0x01000},
2676 {"soft-version", 0xdb0000, 0x01000},
2677 {"support-list", 0xdb1000, 0x01000},
2678 {"profile", 0xdb2000, 0x08000},
2679 {"user-config", 0xdc0000, 0x10000},
2680 {"default-config", 0xdd0000, 0x10000},
2681 {"device-id", 0xde0000, 0x00108},
2682 {"radio", 0xff0000, 0x10000},
2686 .first_sysupgrade_partition
= "os-image",
2687 .last_sysupgrade_partition
= "file-system"
2690 /** Firmware layout for the RE355 */
2696 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2697 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2698 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2699 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2700 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2701 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2702 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2703 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2705 .soft_ver
= SOFT_VER_DEFAULT
,
2707 /* We're using a dynamic kernel/rootfs split here */
2709 {"fs-uboot", 0x00000, 0x20000},
2710 {"firmware", 0x20000, 0x5e0000},
2711 {"partition-table", 0x600000, 0x02000},
2712 {"default-mac", 0x610000, 0x00020},
2713 {"pin", 0x610100, 0x00020},
2714 {"product-info", 0x611100, 0x01000},
2715 {"soft-version", 0x620000, 0x01000},
2716 {"support-list", 0x621000, 0x01000},
2717 {"profile", 0x622000, 0x08000},
2718 {"user-config", 0x630000, 0x10000},
2719 {"default-config", 0x640000, 0x10000},
2720 {"radio", 0x7f0000, 0x10000},
2724 .first_sysupgrade_partition
= "os-image",
2725 .last_sysupgrade_partition
= "file-system"
2728 /** Firmware layout for the RE450 */
2734 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2735 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2736 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2737 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2738 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2739 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2740 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2741 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2743 .soft_ver
= SOFT_VER_DEFAULT
,
2745 /** We're using a dynamic kernel/rootfs split here */
2747 {"fs-uboot", 0x00000, 0x20000},
2748 {"firmware", 0x20000, 0x5e0000},
2749 {"partition-table", 0x600000, 0x02000},
2750 {"default-mac", 0x610000, 0x00020},
2751 {"pin", 0x610100, 0x00020},
2752 {"product-info", 0x611100, 0x01000},
2753 {"soft-version", 0x620000, 0x01000},
2754 {"support-list", 0x621000, 0x01000},
2755 {"profile", 0x622000, 0x08000},
2756 {"user-config", 0x630000, 0x10000},
2757 {"default-config", 0x640000, 0x10000},
2758 {"radio", 0x7f0000, 0x10000},
2762 .first_sysupgrade_partition
= "os-image",
2763 .last_sysupgrade_partition
= "file-system"
2766 /** Firmware layout for the RE450 v2 */
2772 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2773 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2774 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2775 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2776 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2777 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2778 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2779 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2780 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2782 .soft_ver
= SOFT_VER_DEFAULT
,
2784 /* We're using a dynamic kernel/rootfs split here */
2786 {"fs-uboot", 0x00000, 0x20000},
2787 {"firmware", 0x20000, 0x5e0000},
2788 {"partition-table", 0x600000, 0x02000},
2789 {"default-mac", 0x610000, 0x00020},
2790 {"pin", 0x610100, 0x00020},
2791 {"product-info", 0x611100, 0x01000},
2792 {"soft-version", 0x620000, 0x01000},
2793 {"support-list", 0x621000, 0x01000},
2794 {"profile", 0x622000, 0x08000},
2795 {"user-config", 0x630000, 0x10000},
2796 {"default-config", 0x640000, 0x10000},
2797 {"radio", 0x7f0000, 0x10000},
2801 .first_sysupgrade_partition
= "os-image",
2802 .last_sysupgrade_partition
= "file-system"
2805 /** Firmware layout for the RE450 v3 */
2811 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2812 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2813 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2814 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2815 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2816 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2817 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2818 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2819 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2821 .soft_ver
= SOFT_VER_DEFAULT
,
2823 /* We're using a dynamic kernel/rootfs split here */
2825 {"fs-uboot", 0x00000, 0x20000},
2826 {"default-mac", 0x20000, 0x00020},
2827 {"pin", 0x20020, 0x00020},
2828 {"product-info", 0x21000, 0x01000},
2829 {"partition-table", 0x22000, 0x02000},
2830 {"soft-version", 0x24000, 0x01000},
2831 {"support-list", 0x25000, 0x01000},
2832 {"profile", 0x26000, 0x08000},
2833 {"user-config", 0x2e000, 0x10000},
2834 {"default-config", 0x3e000, 0x10000},
2835 {"config-info", 0x4e000, 0x00400},
2836 {"firmware", 0x50000, 0x7a0000},
2837 {"radio", 0x7f0000, 0x10000},
2841 .first_sysupgrade_partition
= "os-image",
2842 .last_sysupgrade_partition
= "file-system"
2845 /** Firmware layout for the RE455 v1 */
2851 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2852 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2853 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2854 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2855 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2856 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2857 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2858 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2859 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2861 .soft_ver
= SOFT_VER_DEFAULT
,
2863 /* We're using a dynamic kernel/rootfs split here */
2865 {"fs-uboot", 0x00000, 0x20000},
2866 {"default-mac", 0x20000, 0x00020},
2867 {"pin", 0x20020, 0x00020},
2868 {"product-info", 0x21000, 0x01000},
2869 {"partition-table", 0x22000, 0x02000},
2870 {"soft-version", 0x24000, 0x01000},
2871 {"support-list", 0x25000, 0x01000},
2872 {"profile", 0x26000, 0x08000},
2873 {"user-config", 0x2e000, 0x10000},
2874 {"default-config", 0x3e000, 0x10000},
2875 {"config-info", 0x4e000, 0x00400},
2876 {"firmware", 0x50000, 0x7a0000},
2877 {"radio", 0x7f0000, 0x10000},
2881 .first_sysupgrade_partition
= "os-image",
2882 .last_sysupgrade_partition
= "file-system"
2885 /** Firmware layout for the RE500 */
2891 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2892 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2893 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2894 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2895 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2896 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2897 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2899 .soft_ver
= SOFT_VER_DEFAULT
,
2901 /* We're using a dynamic kernel/rootfs split here */
2903 {"fs-uboot", 0x00000, 0x20000},
2904 {"firmware", 0x20000, 0xde0000},
2905 {"partition-table", 0xe00000, 0x02000},
2906 {"default-mac", 0xe10000, 0x00020},
2907 {"pin", 0xe10100, 0x00020},
2908 {"product-info", 0xe11100, 0x01000},
2909 {"soft-version", 0xe20000, 0x01000},
2910 {"support-list", 0xe21000, 0x01000},
2911 {"profile", 0xe22000, 0x08000},
2912 {"user-config", 0xe30000, 0x10000},
2913 {"default-config", 0xe40000, 0x10000},
2914 {"radio", 0xff0000, 0x10000},
2918 .first_sysupgrade_partition
= "os-image",
2919 .last_sysupgrade_partition
= "file-system"
2922 /** Firmware layout for the RE650 */
2928 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2929 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2930 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2931 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2932 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2933 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2934 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2936 .soft_ver
= SOFT_VER_DEFAULT
,
2938 /* We're using a dynamic kernel/rootfs split here */
2940 {"fs-uboot", 0x00000, 0x20000},
2941 {"firmware", 0x20000, 0xde0000},
2942 {"partition-table", 0xe00000, 0x02000},
2943 {"default-mac", 0xe10000, 0x00020},
2944 {"pin", 0xe10100, 0x00020},
2945 {"product-info", 0xe11100, 0x01000},
2946 {"soft-version", 0xe20000, 0x01000},
2947 {"support-list", 0xe21000, 0x01000},
2948 {"profile", 0xe22000, 0x08000},
2949 {"user-config", 0xe30000, 0x10000},
2950 {"default-config", 0xe40000, 0x10000},
2951 {"radio", 0xff0000, 0x10000},
2955 .first_sysupgrade_partition
= "os-image",
2956 .last_sysupgrade_partition
= "file-system"
2958 /** Firmware layout for the RE650 V2 (8MB Flash)*/
2964 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
2965 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
2966 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
2967 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
2968 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
2969 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
2970 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
2972 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
2973 .soft_ver
= SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2975 /* We're using a dynamic kernel/rootfs split here */
2977 {"fs-uboot", 0x00000, 0x20000},
2978 {"firmware", 0x20000, 0x7a0000},
2979 {"partition-table", 0x7c0000, 0x02000},
2980 {"default-mac", 0x7c2000, 0x00020},
2981 {"pin", 0x7c2100, 0x00020},
2982 {"product-info", 0x7c3100, 0x01000},
2983 {"soft-version", 0x7c4200, 0x01000},
2984 {"support-list", 0x7c5200, 0x01000},
2985 {"profile", 0x7c6200, 0x08000},
2986 {"config-info", 0x7ce200, 0x00400},
2987 {"user-config", 0x7d0000, 0x10000},
2988 {"default-config", 0x7e0000, 0x10000},
2989 {"radio", 0x7f0000, 0x10000},
2993 .first_sysupgrade_partition
= "os-image",
2994 .last_sysupgrade_partition
= "file-system"
2997 /** Firmware layout for the Mercusys MR70X */
3003 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3004 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3005 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3007 .soft_ver
= SOFT_VER_DEFAULT
,
3010 {"fs-uboot", 0x00000, 0x40000},
3011 {"firmware", 0x40000, 0xf60000},
3012 {"default-mac", 0xfa0000, 0x00200},
3013 {"pin", 0xfa0200, 0x00100},
3014 {"device-id", 0xfa0300, 0x00100},
3015 {"product-info", 0xfa0400, 0x0fc00},
3016 {"default-config", 0xfb0000, 0x08000},
3017 {"ap-def-config", 0xfb8000, 0x08000},
3018 {"user-config", 0xfc0000, 0x0a000},
3019 {"ag-config", 0xfca000, 0x04000},
3020 {"certificate", 0xfce000, 0x02000},
3021 {"ap-config", 0xfd0000, 0x06000},
3022 {"router-config", 0xfd6000, 0x06000},
3023 {"favicon", 0xfdc000, 0x02000},
3024 {"logo", 0xfde000, 0x02000},
3025 {"partition-table", 0xfe0000, 0x00800},
3026 {"soft-version", 0xfe0800, 0x00100},
3027 {"support-list", 0xfe0900, 0x00200},
3028 {"profile", 0xfe0b00, 0x03000},
3029 {"extra-para", 0xfe3b00, 0x00100},
3030 {"radio", 0xff0000, 0x10000},
3034 .first_sysupgrade_partition
= "os-image",
3035 .last_sysupgrade_partition
= "file-system"
3041 #define error(_ret, _errno, _str, ...) \
3043 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3044 strerror(_errno)); \
3050 /** Stores a uint32 as big endian */
3051 static inline void put32(uint8_t *buf
, uint32_t val
) {
3058 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
3060 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
3063 /** Allocate a padded meta partition with a correctly initialised header
3064 * If the `data` pointer is NULL, then the required space is only allocated,
3065 * otherwise `data_len` bytes will be copied from `data` into the partition
3067 static struct image_partition_entry
init_meta_partition_entry(
3068 const char *name
, const void *data
, uint32_t data_len
,
3069 enum partition_trail_value pad_value
)
3071 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
3072 if (meta_partition_should_pad(pad_value
))
3075 struct image_partition_entry entry
= {
3078 .data
= malloc(total_len
)
3081 error(1, errno
, "failed to allocate meta partition entry");
3083 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
3084 header
->length
= htonl(data_len
);
3088 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
3090 if (meta_partition_should_pad(pad_value
))
3091 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
3096 /** Allocates a new image partition */
3097 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
3098 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
3100 error(1, errno
, "malloc");
3105 /** Sets up default partition names whenever custom names aren't specified */
3106 static void set_partition_names(struct device_info
*info
)
3108 if (!info
->partition_names
.partition_table
)
3109 info
->partition_names
.partition_table
= "partition-table";
3110 if (!info
->partition_names
.soft_ver
)
3111 info
->partition_names
.soft_ver
= "soft-version";
3112 if (!info
->partition_names
.os_image
)
3113 info
->partition_names
.os_image
= "os-image";
3114 if (!info
->partition_names
.support_list
)
3115 info
->partition_names
.support_list
= "support-list";
3116 if (!info
->partition_names
.file_system
)
3117 info
->partition_names
.file_system
= "file-system";
3118 if (!info
->partition_names
.extra_para
)
3119 info
->partition_names
.extra_para
= "extra-para";
3122 /** Frees an image partition */
3123 static void free_image_partition(struct image_partition_entry entry
) {
3127 static time_t source_date_epoch
= -1;
3128 static void set_source_date_epoch() {
3129 char *env
= getenv("SOURCE_DATE_EPOCH");
3133 source_date_epoch
= strtoull(env
, &endptr
, 10);
3134 if (errno
|| (endptr
&& *endptr
!= '\0')) {
3135 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
3141 /** Generates the partition-table partition */
3142 static struct image_partition_entry
make_partition_table(const struct device_info
*p
)
3144 struct image_partition_entry entry
= alloc_image_partition(p
->partition_names
.partition_table
, 0x800);
3146 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
3154 for (i
= 0; p
->partitions
[i
].name
; i
++) {
3156 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n",
3157 p
->partitions
[i
].name
, p
->partitions
[i
].base
, p
->partitions
[i
].size
);
3160 error(1, 0, "flash partition table overflow?");
3167 memset(s
, 0xff, end
-s
);
3173 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3174 static inline uint8_t bcd(uint8_t v
) {
3175 return 0x10 * (v
/10) + v
%10;
3179 /** Generates the soft-version partition */
3180 static struct image_partition_entry
make_soft_version(const struct device_info
*info
, uint32_t rev
)
3182 /** If an info string is provided, use this instead of
3183 * the structured data, and include the null-termination */
3184 if (info
->soft_ver
.type
== SOFT_VER_TYPE_TEXT
) {
3185 uint32_t len
= strlen(info
->soft_ver
.text
) + 1;
3186 return init_meta_partition_entry(info
->partition_names
.soft_ver
,
3187 info
->soft_ver
.text
, len
, info
->part_trail
);
3192 if (source_date_epoch
!= -1)
3193 t
= source_date_epoch
;
3194 else if (time(&t
) == (time_t)(-1))
3195 error(1, errno
, "time");
3197 struct tm
*tm
= gmtime(&t
);
3199 struct soft_version s
= {
3202 .version_major
= info
->soft_ver
.num
[0],
3203 .version_minor
= info
->soft_ver
.num
[1],
3204 .version_patch
= info
->soft_ver
.num
[2],
3206 .year_hi
= bcd((1900+tm
->tm_year
)/100),
3207 .year_lo
= bcd(tm
->tm_year
%100),
3208 .month
= bcd(tm
->tm_mon
+1),
3209 .day
= bcd(tm
->tm_mday
),
3212 .compat_level
= htonl(info
->soft_ver_compat_level
)
3215 if (info
->soft_ver_compat_level
== 0)
3216 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3217 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
3220 return init_meta_partition_entry(info
->partition_names
.soft_ver
, &s
,
3221 sizeof(s
), info
->part_trail
);
3224 /** Generates the support-list partition */
3225 static struct image_partition_entry
make_support_list(
3226 const struct device_info
*info
)
3228 uint32_t len
= strlen(info
->support_list
);
3229 return init_meta_partition_entry(info
->partition_names
.support_list
, info
->support_list
,
3230 len
, info
->part_trail
);
3233 /** Partition with extra-para data */
3234 static struct image_partition_entry
make_extra_para(
3235 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
3237 return init_meta_partition_entry(info
->partition_names
.extra_para
, extra_para
, len
,
3241 /** Creates a new image partition with an arbitrary name from a file */
3242 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
) {
3243 struct stat statbuf
;
3245 if (stat(filename
, &statbuf
) < 0)
3246 error(1, errno
, "unable to stat file `%s'", filename
);
3248 size_t len
= statbuf
.st_size
;
3250 if (add_jffs2_eof
) {
3251 if (file_system_partition
)
3252 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
3254 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
3257 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
3259 FILE *file
= fopen(filename
, "rb");
3261 error(1, errno
, "unable to open file `%s'", filename
);
3263 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
3264 error(1, errno
, "unable to read file `%s'", filename
);
3266 if (add_jffs2_eof
) {
3267 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
3269 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
3270 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
3279 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3281 Example image partition table:
3283 fwup-ptn partition-table base 0x00800 size 0x00800
3284 fwup-ptn os-image base 0x01000 size 0x113b45
3285 fwup-ptn file-system base 0x114b45 size 0x1d0004
3286 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3288 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3289 the end of the partition table is marked with a zero byte.
3291 The firmware image must contain at least the partition-table and support-list partitions
3292 to be accepted. There aren't any alignment constraints for the image partitions.
3294 The partition-table partition contains the actual flash layout; partitions
3295 from the image partition table are mapped to the corresponding flash partitions during
3296 the firmware upgrade. The support-list partition contains a list of devices supported by
3299 The base offsets in the firmware partition table are relative to the end
3300 of the vendor information block, so the partition-table partition will
3301 actually start at offset 0x1814 of the image.
3303 I think partition-table must be the first partition in the firmware image.
3305 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
3307 char *image_pt
= (char *)buffer
, *end
= image_pt
+ 0x800;
3309 size_t base
= 0x800;
3310 for (i
= 0; parts
[i
].name
; i
++) {
3311 for (j
= 0; flash_parts
[j
].name
; j
++) {
3312 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
3313 if (parts
[i
].size
> flash_parts
[j
].size
)
3314 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
3319 assert(flash_parts
[j
].name
);
3321 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
3323 size_t len
= end
-image_pt
;
3324 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
);
3327 error(1, 0, "image partition table overflow?");
3331 base
+= parts
[i
].size
;
3335 /** Generates and writes the image MD5 checksum */
3336 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
3340 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
3341 MD5_Update(&ctx
, buffer
, len
);
3342 MD5_Final(md5
, &ctx
);
3347 Generates the firmware image in factory format
3353 0000-0003 Image size (4 bytes, big endian)
3354 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3355 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3356 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3357 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3358 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3359 1814-xxxx Firmware partitions
3361 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
3365 for (i
= 0; parts
[i
].name
; i
++)
3366 *len
+= parts
[i
].size
;
3368 uint8_t *image
= malloc(*len
);
3370 error(1, errno
, "malloc");
3372 memset(image
, 0xff, *len
);
3376 size_t vendor_len
= strlen(info
->vendor
);
3377 put32(image
+0x14, vendor_len
);
3378 memcpy(image
+0x18, info
->vendor
, vendor_len
);
3381 put_partitions(image
+ 0x1014, info
->partitions
, parts
);
3382 put_md5(image
+0x04, image
+0x14, *len
-0x14);
3388 Generates the firmware image in sysupgrade format
3390 This makes some assumptions about the provided flash and image partition tables and
3391 should be generalized when TP-LINK starts building its safeloader into hardware with
3392 different flash layouts.
3394 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
3396 size_t flash_first_partition_index
= 0;
3397 size_t flash_last_partition_index
= 0;
3398 const struct flash_partition_entry
*flash_first_partition
= NULL
;
3399 const struct flash_partition_entry
*flash_last_partition
= NULL
;
3400 const struct image_partition_entry
*image_last_partition
= NULL
;
3402 /** Find first and last partitions */
3403 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3404 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
3405 flash_first_partition
= &info
->partitions
[i
];
3406 flash_first_partition_index
= i
;
3407 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
3408 flash_last_partition
= &info
->partitions
[i
];
3409 flash_last_partition_index
= i
;
3413 assert(flash_first_partition
&& flash_last_partition
);
3414 assert(flash_first_partition_index
< flash_last_partition_index
);
3416 /** Find last partition from image to calculate needed size */
3417 for (i
= 0; image_parts
[i
].name
; i
++) {
3418 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
3419 image_last_partition
= &image_parts
[i
];
3424 assert(image_last_partition
);
3426 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
3428 uint8_t *image
= malloc(*len
);
3430 error(1, errno
, "malloc");
3432 memset(image
, 0xff, *len
);
3434 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
3435 for (j
= 0; image_parts
[j
].name
; j
++) {
3436 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
3437 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
3438 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
3439 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
3443 assert(image_parts
[j
].name
);
3450 /** Generates an image according to a given layout and writes it to a file */
3451 static void build_image(const char *output
,
3452 const char *kernel_image
,
3453 const char *rootfs_image
,
3457 struct device_info
*info
) {
3461 struct image_partition_entry parts
[7] = {};
3463 struct flash_partition_entry
*firmware_partition
= NULL
;
3464 struct flash_partition_entry
*os_image_partition
= NULL
;
3465 struct flash_partition_entry
*file_system_partition
= NULL
;
3466 size_t firmware_partition_index
= 0;
3468 set_partition_names(info
);
3470 for (i
= 0; info
->partitions
[i
].name
; i
++) {
3471 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
3473 firmware_partition
= &info
->partitions
[i
];
3474 firmware_partition_index
= i
;
3478 if (firmware_partition
)
3480 os_image_partition
= &info
->partitions
[firmware_partition_index
];
3481 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
3484 if (stat(kernel_image
, &kernel
) < 0)
3485 error(1, errno
, "unable to stat file `%s'", kernel_image
);
3487 if (kernel
.st_size
> firmware_partition
->size
)
3488 error(1, 0, "kernel overflowed firmware partition\n");
3490 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
3491 info
->partitions
[i
+1] = info
->partitions
[i
];
3493 file_system_partition
->name
= info
->partition_names
.file_system
;
3495 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
3497 /* Align partition start to erase blocks for factory images only */
3499 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
3501 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
3503 os_image_partition
->name
= info
->partition_names
.os_image
;
3505 os_image_partition
->size
= kernel
.st_size
;
3508 parts
[0] = make_partition_table(info
);
3509 parts
[1] = make_soft_version(info
, rev
);
3510 parts
[2] = make_support_list(info
);
3511 parts
[3] = read_file(info
->partition_names
.os_image
, kernel_image
, false, NULL
);
3512 parts
[4] = read_file(info
->partition_names
.file_system
, rootfs_image
, add_jffs2_eof
, file_system_partition
);
3515 /* Some devices need the extra-para partition to accept the firmware */
3516 if (strcasecmp(info
->id
, "ARCHER-A6-V3") == 0 ||
3517 strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
3518 strcasecmp(info
->id
, "ARCHER-A9-V6") == 0 ||
3519 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
3520 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
3521 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
3522 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
3523 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
3524 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
3525 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
3526 strcasecmp(info
->id
, "ARCHER-C6U-V1") == 0 ||
3527 strcasecmp(info
->id
, "ARCHER-C6-V3") == 0 ||
3528 strcasecmp(info
->id
, "MR70X") == 0 ||
3529 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
3530 const uint8_t extra_para
[2] = {0x01, 0x00};
3531 parts
[5] = make_extra_para(info
, extra_para
,
3532 sizeof(extra_para
));
3533 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0 ||
3534 strcasecmp(info
->id
, "TL-WA1201-V2") == 0) {
3535 const uint8_t extra_para
[2] = {0x00, 0x01};
3536 parts
[5] = make_extra_para(info
, extra_para
,
3537 sizeof(extra_para
));
3538 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
3539 strcasecmp(info
->id
, "EAP245-V3") == 0) {
3540 const uint8_t extra_para
[2] = {0x01, 0x01};
3541 parts
[5] = make_extra_para(info
, extra_para
,
3542 sizeof(extra_para
));
3548 image
= generate_sysupgrade_image(info
, parts
, &len
);
3550 image
= generate_factory_image(info
, parts
, &len
);
3552 FILE *file
= fopen(output
, "wb");
3554 error(1, errno
, "unable to open output file");
3556 if (fwrite(image
, len
, 1, file
) != 1)
3557 error(1, 0, "unable to write output file");
3563 for (i
= 0; parts
[i
].name
; i
++)
3564 free_image_partition(parts
[i
]);
3568 static void usage(const char *argv0
) {
3570 "Usage: %s [OPTIONS...]\n"
3573 " -h show this help\n"
3575 "Info about an image:\n"
3576 " -i <file> input file to read from\n"
3577 "Create a new image:\n"
3578 " -B <board> create image for the board specified with <board>\n"
3579 " -k <file> read kernel image from the file <file>\n"
3580 " -r <file> read rootfs image from the file <file>\n"
3581 " -o <file> write output to the file <file>\n"
3582 " -V <rev> sets the revision number to <rev>\n"
3583 " -j add jffs2 end-of-filesystem markers\n"
3584 " -S create sysupgrade instead of factory image\n"
3585 "Extract an old image:\n"
3586 " -x <file> extract all oem firmware partition\n"
3587 " -d <dir> destination to extract the firmware partition\n"
3588 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3594 static struct device_info
*find_board(const char *id
)
3596 struct device_info
*board
= NULL
;
3598 for (board
= boards
; board
->id
!= NULL
; board
++)
3599 if (strcasecmp(id
, board
->id
) == 0)
3605 static int add_flash_partition(
3606 struct flash_partition_entry
*part_list
,
3613 /* check if the list has a free entry */
3614 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
3615 if (part_list
->name
== NULL
&&
3616 part_list
->base
== 0 &&
3617 part_list
->size
== 0)
3621 if (ptr
== max_entries
) {
3622 error(1, 0, "No free flash part entry available.");
3625 part_list
->name
= calloc(1, strlen(name
) + 1);
3626 if (!part_list
->name
) {
3627 error(1, 0, "Unable to allocate memory");
3630 memcpy((char *)part_list
->name
, name
, strlen(name
));
3631 part_list
->base
= base
;
3632 part_list
->size
= size
;
3637 /** read the partition table into struct flash_partition_entry */
3638 static int read_partition_table(
3639 FILE *file
, long offset
,
3640 struct flash_partition_entry
*entries
, size_t max_entries
,
3645 const char *parthdr
= NULL
;
3646 const char *fwuphdr
= "fwup-ptn";
3647 const char *flashhdr
= "partition";
3649 /* TODO: search for the partition table */
3659 error(1, 0, "Invalid partition table");
3662 if (fseek(file
, offset
, SEEK_SET
) < 0)
3663 error(1, errno
, "Can not seek in the firmware");
3665 if (fread(buf
, 2048, 1, file
) != 1)
3666 error(1, errno
, "Can not read fwup-ptn from the firmware");
3670 /* look for the partition header */
3671 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
3672 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
3677 end
= buf
+ sizeof(buf
);
3678 while ((ptr
+ strlen(parthdr
)) < end
&&
3679 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
3683 char name
[32] = { 0 };
3685 unsigned long base
= 0;
3686 unsigned long size
= 0;
3688 end_part
= memchr(ptr
, '\n', (end
- ptr
));
3689 if (end_part
== NULL
) {
3690 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3694 for (int i
= 0; i
<= 4; i
++) {
3695 if (end_part
<= ptr
)
3698 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
3699 if (end_element
== NULL
) {
3700 error(1, errno
, "Ignoring the rest of the partition entries.");
3705 /* partition header */
3707 ptr
= end_element
+ 1;
3711 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
3712 strncpy(name
, ptr
, name_len
);
3713 name
[name_len
] = '\0';
3714 ptr
= end_element
+ 1;
3719 ptr
= end_element
+ 1;
3724 base
= strtoul(ptr
, NULL
, 16);
3725 ptr
= end_element
+ 1;
3730 ptr
= end_element
+ 1;
3731 /* actual size. The last element doesn't have a sepeartor */
3732 size
= strtoul(ptr
, NULL
, 16);
3733 /* the part ends with 0x09, 0x0d, 0x0a */
3735 add_flash_partition(entries
, max_entries
, name
, base
, size
);
3744 static void write_partition(
3746 size_t firmware_offset
,
3747 struct flash_partition_entry
*entry
,
3753 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
3755 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
3756 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
3757 error(1, errno
, "Can not read partition from input_file");
3759 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3760 error(1, errno
, "Can not write partition to output_file");
3762 /* write last chunk smaller than buffer */
3763 if (offset
< entry
->size
) {
3764 offset
= entry
->size
- offset
;
3765 if (fread(buf
, offset
, 1, input_file
) != 1)
3766 error(1, errno
, "Can not read partition from input_file");
3767 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3768 error(1, errno
, "Can not write partition to output_file");
3772 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3775 char output
[PATH_MAX
];
3777 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3778 output_file
= fopen(output
, "wb+");
3779 if (output_file
== NULL
) {
3780 error(1, errno
, "Can not open output file %s", output
);
3783 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3785 fclose(output_file
);
3790 /** extract all partitions from the firmware file */
3791 static int extract_firmware(const char *input
, const char *output_directory
)
3793 struct flash_partition_entry entries
[16] = { 0 };
3794 size_t max_entries
= 16;
3795 size_t firmware_offset
= 0x1014;
3798 struct stat statbuf
;
3800 /* check input file */
3801 if (stat(input
, &statbuf
)) {
3802 error(1, errno
, "Can not read input firmware %s", input
);
3805 /* check if output directory exists */
3806 if (stat(output_directory
, &statbuf
)) {
3807 error(1, errno
, "Failed to stat output directory %s", output_directory
);
3810 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
3811 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
3814 input_file
= fopen(input
, "rb");
3816 if (read_partition_table(input_file
, firmware_offset
, entries
, 16, 0) != 0) {
3817 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3820 for (size_t i
= 0; i
< max_entries
; i
++) {
3821 if (entries
[i
].name
== NULL
&&
3822 entries
[i
].base
== 0 &&
3823 entries
[i
].size
== 0)
3826 extract_firmware_partition(input_file
, firmware_offset
, &entries
[i
], output_directory
);
3832 static struct flash_partition_entry
*find_partition(
3833 struct flash_partition_entry
*entries
, size_t max_entries
,
3834 const char *name
, const char *error_msg
)
3836 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
3837 if (strcmp(entries
->name
, name
) == 0)
3842 error(1, 0, "%s", error_msg
);
3848 static int firmware_info(const char *input
)
3850 struct flash_partition_entry pointers
[MAX_PARTITIONS
] = { };
3851 struct flash_partition_entry
*e
;
3855 fp
= fopen(input
, "r");
3857 if (read_partition_table(fp
, 0x1014, pointers
, MAX_PARTITIONS
, 0)) {
3858 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3861 printf("Firmware image partitions:\n");
3862 printf("%-8s %-8s %s\n", "base", "size", "name");
3863 for (i
= 0; i
< MAX_PARTITIONS
; i
++) {
3866 if (!e
->name
&& !e
->base
&& !e
->size
)
3869 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
? e
->name
: "");
3872 e
= find_partition(pointers
, MAX_PARTITIONS
, "soft-version", NULL
);
3874 size_t data_len
= e
->size
- sizeof(struct meta_header
);
3875 char *buf
= malloc(data_len
);
3876 struct soft_version
*s
;
3881 error(1, errno
, "Failed to alloc buffer");
3883 if (fseek(fp
, 0x1014 + e
->base
+ sizeof(struct meta_header
), SEEK_SET
))
3884 error(1, errno
, "Can not seek in the firmware");
3886 if (fread(buf
, data_len
, 1, fp
) != 1)
3887 error(1, errno
, "Can not read fwup-ptn data from the firmware");
3889 /* Check for string ignoring padding character */
3891 for (i
= 0; i
< data_len
- 1; i
++) {
3892 if (!isascii(buf
[i
])) {
3898 printf("\n[Software version]\n");
3900 fwrite(buf
, data_len
, 1, stdout
);
3902 } else if (data_len
>= offsetof(struct soft_version
, rev
)) {
3903 s
= (struct soft_version
*)buf
;
3905 printf("Version: %d.%d.%d\n", s
->version_major
, s
->version_minor
, s
->version_patch
);
3906 printf("Date: %02x%02x-%02x-%02x\n", s
->year_hi
, s
->year_lo
, s
->month
, s
->day
);
3907 printf("Revision: %d\n", ntohl(s
->rev
));
3909 printf("Failed to parse data\n");
3915 e
= find_partition(pointers
, MAX_PARTITIONS
, "support-list", NULL
);
3920 size_t max_length
= sizeof(buf
) - 1;
3922 if (fseek(fp
, 0x1014 + e
->base
+ sizeof(struct meta_header
), SEEK_SET
))
3923 error(1, errno
, "Can not seek in the firmware");
3925 printf("\n[Support list]\n");
3926 for (length
= e
->size
- sizeof(struct meta_header
); length
; length
-= bytes
) {
3927 bytes
= fread(buf
, 1, length
> max_length
? max_length
: length
, fp
);
3929 error(1, errno
, "Can not read fwup-ptn data from the firmware");
3937 e
= find_partition(pointers
, MAX_PARTITIONS
, "partition-table", NULL
);
3939 struct flash_partition_entry parts
[MAX_PARTITIONS
] = { };
3941 if (read_partition_table(fp
, 0x1014 + e
->base
+ 4, parts
, MAX_PARTITIONS
, 1)) {
3942 error(1, 0, "Error can not read the partition table (partition)");
3945 printf("\n[Partition table]\n");
3946 printf("%-8s %-8s %s\n", "base", "size", "name");
3947 for (i
= 0; i
< MAX_PARTITIONS
; i
++) {
3950 if (!e
->name
&& !e
->base
&& !e
->size
)
3953 printf("%08x %08x %s\n", e
->base
, e
->size
, e
->name
? e
->name
: "");
3962 static void write_ff(FILE *output_file
, size_t size
)
3967 memset(buf
, 0xff, sizeof(buf
));
3969 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
3970 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3971 error(1, errno
, "Can not write 0xff to output_file");
3974 /* write last chunk smaller than buffer */
3975 if (offset
< size
) {
3976 offset
= size
- offset
;
3977 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3978 error(1, errno
, "Can not write partition to output_file");
3982 static void convert_firmware(const char *input
, const char *output
)
3984 struct flash_partition_entry fwup
[MAX_PARTITIONS
] = { 0 };
3985 struct flash_partition_entry flash
[MAX_PARTITIONS
] = { 0 };
3986 struct flash_partition_entry
*fwup_os_image
= NULL
, *fwup_file_system
= NULL
;
3987 struct flash_partition_entry
*flash_os_image
= NULL
, *flash_file_system
= NULL
;
3988 struct flash_partition_entry
*fwup_partition_table
= NULL
;
3989 size_t firmware_offset
= 0x1014;
3990 FILE *input_file
, *output_file
;
3992 struct stat statbuf
;
3994 /* check input file */
3995 if (stat(input
, &statbuf
)) {
3996 error(1, errno
, "Can not read input firmware %s", input
);
3999 input_file
= fopen(input
, "rb");
4001 error(1, 0, "Can not open input firmware %s", input
);
4003 output_file
= fopen(output
, "wb");
4005 error(1, 0, "Can not open output firmware %s", output
);
4007 if (read_partition_table(input_file
, firmware_offset
, fwup
, MAX_PARTITIONS
, 0) != 0) {
4008 error(1, 0, "Error can not read the partition table (fwup-ptn)");
4011 fwup_os_image
= find_partition(fwup
, MAX_PARTITIONS
,
4012 "os-image", "Error can not find os-image partition (fwup)");
4013 fwup_file_system
= find_partition(fwup
, MAX_PARTITIONS
,
4014 "file-system", "Error can not find file-system partition (fwup)");
4015 fwup_partition_table
= find_partition(fwup
, MAX_PARTITIONS
,
4016 "partition-table", "Error can not find partition-table partition");
4018 /* the flash partition table has a 0x00000004 magic haeder */
4019 if (read_partition_table(input_file
, firmware_offset
+ fwup_partition_table
->base
+ 4, flash
, MAX_PARTITIONS
, 1) != 0)
4020 error(1, 0, "Error can not read the partition table (flash)");
4022 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
4023 "os-image", "Error can not find os-image partition (flash)");
4024 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
4025 "file-system", "Error can not find file-system partition (flash)");
4027 /* write os_image to 0x0 */
4028 write_partition(input_file
, firmware_offset
, fwup_os_image
, output_file
);
4029 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
4031 /* write file-system behind os_image */
4032 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
4033 write_partition(input_file
, firmware_offset
, fwup_file_system
, output_file
);
4034 write_ff(output_file
, flash_file_system
->size
- fwup_file_system
->size
);
4036 fclose(output_file
);
4040 int main(int argc
, char *argv
[]) {
4041 const char *info_image
= NULL
, *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
4042 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
4043 bool add_jffs2_eof
= false, sysupgrade
= false;
4045 struct device_info
*info
;
4046 set_source_date_epoch();
4051 c
= getopt(argc
, argv
, "i:B:k:r:o:V:jSh:x:d:z:");
4057 info_image
= optarg
;
4065 kernel_image
= optarg
;
4069 rootfs_image
= optarg
;
4077 sscanf(optarg
, "r%u", &rev
);
4081 add_jffs2_eof
= true;
4093 output_directory
= optarg
;
4097 extract_image
= optarg
;
4101 convert_image
= optarg
;
4111 firmware_info(info_image
);
4112 } else if (extract_image
|| output_directory
) {
4114 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4115 if (!output_directory
)
4116 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4117 extract_firmware(extract_image
, output_directory
);
4118 } else if (convert_image
) {
4120 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4121 convert_firmware(convert_image
, output
);
4124 error(1, 0, "no board has been specified");
4126 error(1, 0, "no kernel image has been specified");
4128 error(1, 0, "no rootfs image has been specified");
4130 error(1, 0, "no output filename has been specified");
4132 info
= find_board(board
);
4135 error(1, 0, "unsupported board %s", board
);
4137 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);