2 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 1. Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 Image generation tool for the TP-LINK SafeLoader as seen on
31 TP-LINK Pharos devices (CPE210/220/510/520)
45 #include <arpa/inet.h>
47 #include <sys/types.h>
54 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
57 #define MAX_PARTITIONS 32
59 /** An image partition table entry */
60 struct image_partition_entry
{
66 /** A flash partition table entry */
67 struct flash_partition_entry
{
73 /** Partition trailing padding definitions
74 * Values 0x00 to 0xff are reserved to indicate the padding value
75 * Values from 0x100 are reserved to indicate other behaviour */
76 enum partition_trail_value
{
79 PART_TRAIL_MAX
= 0xff,
80 PART_TRAIL_NONE
= 0x100
83 /** Firmware layout description */
87 const char *support_list
;
88 enum partition_trail_value part_trail
;
90 uint32_t soft_ver_compat_level
;
91 struct flash_partition_entry partitions
[MAX_PARTITIONS
+1];
92 const char *first_sysupgrade_partition
;
93 const char *last_sysupgrade_partition
;
96 struct __attribute__((__packed__
)) meta_header
{
101 /** The content of the soft-version structure */
102 struct __attribute__((__packed__
)) soft_version
{
104 uint8_t version_major
;
105 uint8_t version_minor
;
106 uint8_t version_patch
;
112 uint32_t compat_level
;
116 static const uint8_t jffs2_eof_mark
[4] = {0xde, 0xad, 0xc0, 0xde};
120 Salt for the MD5 hash
122 Fortunately, TP-LINK seems to use the same salt for most devices which use
123 the new image format.
125 static const uint8_t md5_salt
[16] = {
126 0x7a, 0x2b, 0x15, 0xed,
127 0x9b, 0x98, 0x59, 0x6d,
128 0xe5, 0x04, 0xab, 0x44,
129 0xac, 0x2a, 0x9f, 0x4e,
133 /** Firmware layout table */
134 static struct device_info boards
[] = {
135 /** Firmware layout for the CPE210/220 V1 */
138 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
141 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
142 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
143 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
144 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
145 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
146 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
147 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
152 {"fs-uboot", 0x00000, 0x20000},
153 {"partition-table", 0x20000, 0x02000},
154 {"default-mac", 0x30000, 0x00020},
155 {"product-info", 0x31100, 0x00100},
156 {"signature", 0x32000, 0x00400},
157 {"os-image", 0x40000, 0x300000},
158 {"file-system", 0x340000, 0x470000},
159 {"soft-version", 0x7b0000, 0x00100},
160 {"support-list", 0x7b1000, 0x00400},
161 {"user-config", 0x7c0000, 0x10000},
162 {"default-config", 0x7d0000, 0x10000},
163 {"log", 0x7e0000, 0x10000},
164 {"radio", 0x7f0000, 0x10000},
168 .first_sysupgrade_partition
= "os-image",
169 .last_sysupgrade_partition
= "support-list",
172 /** Firmware layout for the CPE210 V2 */
175 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
178 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
179 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
180 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
181 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
182 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
183 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
184 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
185 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
186 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
187 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
192 {"fs-uboot", 0x00000, 0x20000},
193 {"partition-table", 0x20000, 0x02000},
194 {"default-mac", 0x30000, 0x00020},
195 {"product-info", 0x31100, 0x00100},
196 {"device-info", 0x31400, 0x00400},
197 {"signature", 0x32000, 0x00400},
198 {"device-id", 0x33000, 0x00100},
199 {"firmware", 0x40000, 0x770000},
200 {"soft-version", 0x7b0000, 0x00100},
201 {"support-list", 0x7b1000, 0x01000},
202 {"user-config", 0x7c0000, 0x10000},
203 {"default-config", 0x7d0000, 0x10000},
204 {"log", 0x7e0000, 0x10000},
205 {"radio", 0x7f0000, 0x10000},
209 .first_sysupgrade_partition
= "os-image",
210 .last_sysupgrade_partition
= "support-list",
213 /** Firmware layout for the CPE210 V3 */
216 .vendor
= "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
219 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
220 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
221 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
222 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
223 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
224 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
225 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
226 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
227 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
228 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
229 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
234 {"fs-uboot", 0x00000, 0x20000},
235 {"partition-table", 0x20000, 0x01000},
236 {"default-mac", 0x30000, 0x00020},
237 {"product-info", 0x31100, 0x00100},
238 {"device-info", 0x31400, 0x00400},
239 {"signature", 0x32000, 0x00400},
240 {"device-id", 0x33000, 0x00100},
241 {"firmware", 0x40000, 0x770000},
242 {"soft-version", 0x7b0000, 0x00100},
243 {"support-list", 0x7b1000, 0x01000},
244 {"user-config", 0x7c0000, 0x10000},
245 {"default-config", 0x7d0000, 0x10000},
246 {"log", 0x7e0000, 0x10000},
247 {"radio", 0x7f0000, 0x10000},
251 .first_sysupgrade_partition
= "os-image",
252 .last_sysupgrade_partition
= "support-list",
255 /** Firmware layout for the CPE220 V2 */
258 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
261 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
262 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
263 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
264 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
265 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
266 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
267 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
268 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
269 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
270 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
275 {"fs-uboot", 0x00000, 0x20000},
276 {"partition-table", 0x20000, 0x02000},
277 {"default-mac", 0x30000, 0x00020},
278 {"product-info", 0x31100, 0x00100},
279 {"signature", 0x32000, 0x00400},
280 {"os-image", 0x40000, 0x300000},
281 {"file-system", 0x340000, 0x470000},
282 {"soft-version", 0x7b0000, 0x00100},
283 {"support-list", 0x7b1000, 0x00400},
284 {"user-config", 0x7c0000, 0x10000},
285 {"default-config", 0x7d0000, 0x10000},
286 {"log", 0x7e0000, 0x10000},
287 {"radio", 0x7f0000, 0x10000},
291 .first_sysupgrade_partition
= "os-image",
292 .last_sysupgrade_partition
= "support-list",
295 /** Firmware layout for the CPE220 V3 */
298 .vendor
= "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
301 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
302 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
303 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
304 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
305 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
306 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
307 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
308 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
309 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
310 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
315 {"fs-uboot", 0x00000, 0x20000},
316 {"partition-table", 0x20000, 0x02000},
317 {"default-mac", 0x30000, 0x00020},
318 {"product-info", 0x31100, 0x00100},
319 {"device-info", 0x31400, 0x00400},
320 {"signature", 0x32000, 0x00400},
321 {"device-id", 0x33000, 0x00100},
322 {"firmware", 0x40000, 0x770000},
323 {"soft-version", 0x7b0000, 0x00100},
324 {"support-list", 0x7b1000, 0x01000},
325 {"user-config", 0x7c0000, 0x10000},
326 {"default-config", 0x7d0000, 0x10000},
327 {"log", 0x7e0000, 0x10000},
328 {"radio", 0x7f0000, 0x10000},
332 .first_sysupgrade_partition
= "os-image",
333 .last_sysupgrade_partition
= "support-list",
336 /** Firmware layout for the CPE510/520 V1 */
339 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
342 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
343 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
344 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
345 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
346 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
347 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
348 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
349 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
354 {"fs-uboot", 0x00000, 0x20000},
355 {"partition-table", 0x20000, 0x02000},
356 {"default-mac", 0x30000, 0x00020},
357 {"product-info", 0x31100, 0x00100},
358 {"signature", 0x32000, 0x00400},
359 {"os-image", 0x40000, 0x300000},
360 {"file-system", 0x340000, 0x470000},
361 {"soft-version", 0x7b0000, 0x00100},
362 {"support-list", 0x7b1000, 0x00400},
363 {"user-config", 0x7c0000, 0x10000},
364 {"default-config", 0x7d0000, 0x10000},
365 {"log", 0x7e0000, 0x10000},
366 {"radio", 0x7f0000, 0x10000},
370 .first_sysupgrade_partition
= "os-image",
371 .last_sysupgrade_partition
= "support-list",
374 /** Firmware layout for the CPE510 V2 */
377 .vendor
= "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
380 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
381 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
382 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
383 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
384 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
385 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
386 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
387 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
388 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
389 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
390 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
391 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
396 {"fs-uboot", 0x00000, 0x20000},
397 {"partition-table", 0x20000, 0x02000},
398 {"default-mac", 0x30000, 0x00020},
399 {"product-info", 0x31100, 0x00100},
400 {"signature", 0x32000, 0x00400},
401 {"os-image", 0x40000, 0x300000},
402 {"file-system", 0x340000, 0x470000},
403 {"soft-version", 0x7b0000, 0x00100},
404 {"support-list", 0x7b1000, 0x00400},
405 {"user-config", 0x7c0000, 0x10000},
406 {"default-config", 0x7d0000, 0x10000},
407 {"log", 0x7e0000, 0x10000},
408 {"radio", 0x7f0000, 0x10000},
412 .first_sysupgrade_partition
= "os-image",
413 .last_sysupgrade_partition
= "support-list",
416 /** Firmware layout for the CPE510 V3 */
419 .vendor
= "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
422 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
423 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
424 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
425 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
426 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
427 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
428 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
429 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
430 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
431 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
432 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
433 "CPE510(TP-LINK|US|N300-5):3.0\r\n",
438 {"fs-uboot", 0x00000, 0x20000},
439 {"partition-table", 0x20000, 0x02000},
440 {"default-mac", 0x30000, 0x00020},
441 {"product-info", 0x31100, 0x00100},
442 {"signature", 0x32000, 0x00400},
443 {"os-image", 0x40000, 0x300000},
444 {"file-system", 0x340000, 0x470000},
445 {"soft-version", 0x7b0000, 0x00100},
446 {"support-list", 0x7b1000, 0x00400},
447 {"user-config", 0x7c0000, 0x10000},
448 {"default-config", 0x7d0000, 0x10000},
449 {"log", 0x7e0000, 0x10000},
450 {"radio", 0x7f0000, 0x10000},
454 .first_sysupgrade_partition
= "os-image",
455 .last_sysupgrade_partition
= "support-list",
458 /** Firmware layout for the CPE610V1 */
461 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
464 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
465 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
466 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
467 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
468 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
469 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
470 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
471 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
472 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
473 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
478 {"fs-uboot", 0x00000, 0x20000},
479 {"partition-table", 0x20000, 0x02000},
480 {"default-mac", 0x30000, 0x00020},
481 {"product-info", 0x31100, 0x00100},
482 {"signature", 0x32000, 0x00400},
483 {"os-image", 0x40000, 0x300000},
484 {"file-system", 0x340000, 0x470000},
485 {"soft-version", 0x7b0000, 0x00100},
486 {"support-list", 0x7b1000, 0x00400},
487 {"user-config", 0x7c0000, 0x10000},
488 {"default-config", 0x7d0000, 0x10000},
489 {"log", 0x7e0000, 0x10000},
490 {"radio", 0x7f0000, 0x10000},
494 .first_sysupgrade_partition
= "os-image",
495 .last_sysupgrade_partition
= "support-list",
498 /** Firmware layout for the CPE610V2 */
501 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
504 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
505 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
506 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
507 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
508 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
509 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
510 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
511 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
512 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
513 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
518 {"fs-uboot", 0x00000, 0x20000},
519 {"partition-table", 0x20000, 0x02000},
520 {"default-mac", 0x30000, 0x00020},
521 {"product-info", 0x31100, 0x00100},
522 {"signature", 0x32000, 0x00400},
523 {"os-image", 0x40000, 0x300000},
524 {"file-system", 0x340000, 0x470000},
525 {"soft-version", 0x7b0000, 0x00100},
526 {"support-list", 0x7b1000, 0x00400},
527 {"user-config", 0x7c0000, 0x10000},
528 {"default-config", 0x7d0000, 0x10000},
529 {"log", 0x7e0000, 0x10000},
530 {"radio", 0x7f0000, 0x10000},
534 .first_sysupgrade_partition
= "os-image",
535 .last_sysupgrade_partition
= "support-list",
540 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
543 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
544 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
545 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
550 {"fs-uboot", 0x00000, 0x20000},
551 {"partition-table", 0x20000, 0x02000},
552 {"default-mac", 0x30000, 0x00020},
553 {"product-info", 0x31100, 0x00100},
554 {"signature", 0x32000, 0x00400},
555 {"os-image", 0x40000, 0x300000},
556 {"file-system", 0x340000, 0x470000},
557 {"soft-version", 0x7b0000, 0x00100},
558 {"support-list", 0x7b1000, 0x00400},
559 {"user-config", 0x7c0000, 0x10000},
560 {"default-config", 0x7d0000, 0x10000},
561 {"log", 0x7e0000, 0x10000},
562 {"radio", 0x7f0000, 0x10000},
566 .first_sysupgrade_partition
= "os-image",
567 .last_sysupgrade_partition
= "support-list",
572 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
575 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
576 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
577 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
582 {"fs-uboot", 0x00000, 0x20000},
583 {"partition-table", 0x20000, 0x02000},
584 {"default-mac", 0x30000, 0x00020},
585 {"product-info", 0x31100, 0x00100},
586 {"signature", 0x32000, 0x00400},
587 {"os-image", 0x40000, 0x300000},
588 {"file-system", 0x340000, 0x470000},
589 {"soft-version", 0x7b0000, 0x00100},
590 {"support-list", 0x7b1000, 0x00400},
591 {"user-config", 0x7c0000, 0x10000},
592 {"default-config", 0x7d0000, 0x10000},
593 {"log", 0x7e0000, 0x10000},
594 {"radio", 0x7f0000, 0x10000},
598 .first_sysupgrade_partition
= "os-image",
599 .last_sysupgrade_partition
= "support-list",
604 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
607 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
608 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
609 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
610 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
615 {"fs-uboot", 0x00000, 0x20000},
616 {"partition-table", 0x20000, 0x02000},
617 {"default-mac", 0x30000, 0x00020},
618 {"product-info", 0x31100, 0x00100},
619 {"signature", 0x32000, 0x00400},
620 {"os-image", 0x40000, 0x300000},
621 {"file-system", 0x340000, 0x470000},
622 {"soft-version", 0x7b0000, 0x00100},
623 {"support-list", 0x7b1000, 0x00400},
624 {"user-config", 0x7c0000, 0x10000},
625 {"default-config", 0x7d0000, 0x10000},
626 {"log", 0x7e0000, 0x10000},
627 {"radio", 0x7f0000, 0x10000},
631 .first_sysupgrade_partition
= "os-image",
632 .last_sysupgrade_partition
= "support-list",
637 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
640 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
641 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
642 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
643 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
648 {"fs-uboot", 0x00000, 0x20000},
649 {"partition-table", 0x20000, 0x02000},
650 {"default-mac", 0x30000, 0x00020},
651 {"product-info", 0x31100, 0x00100},
652 {"signature", 0x32000, 0x00400},
653 {"os-image", 0x40000, 0x300000},
654 {"file-system", 0x340000, 0x470000},
655 {"soft-version", 0x7b0000, 0x00100},
656 {"support-list", 0x7b1000, 0x00400},
657 {"user-config", 0x7c0000, 0x10000},
658 {"default-config", 0x7d0000, 0x10000},
659 {"log", 0x7e0000, 0x10000},
660 {"radio", 0x7f0000, 0x10000},
664 .first_sysupgrade_partition
= "os-image",
665 .last_sysupgrade_partition
= "support-list",
668 /** Firmware layout for the C2600 */
674 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
679 We use a bigger os-image partition than the stock images (and thus
680 smaller file-system), as our kernel doesn't fit in the stock firmware's
681 2 MB os-image since kernel 4.14.
684 {"SBL1", 0x00000, 0x20000},
685 {"MIBIB", 0x20000, 0x20000},
686 {"SBL2", 0x40000, 0x20000},
687 {"SBL3", 0x60000, 0x30000},
688 {"DDRCONFIG", 0x90000, 0x10000},
689 {"SSD", 0xa0000, 0x10000},
690 {"TZ", 0xb0000, 0x30000},
691 {"RPM", 0xe0000, 0x20000},
692 {"fs-uboot", 0x100000, 0x70000},
693 {"uboot-env", 0x170000, 0x40000},
694 {"radio", 0x1b0000, 0x40000},
695 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
696 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
697 {"default-mac", 0x1ef0000, 0x00200},
698 {"pin", 0x1ef0200, 0x00200},
699 {"product-info", 0x1ef0400, 0x0fc00},
700 {"partition-table", 0x1f00000, 0x10000},
701 {"soft-version", 0x1f10000, 0x10000},
702 {"support-list", 0x1f20000, 0x10000},
703 {"profile", 0x1f30000, 0x10000},
704 {"default-config", 0x1f40000, 0x10000},
705 {"user-config", 0x1f50000, 0x40000},
706 {"qos-db", 0x1f90000, 0x40000},
707 {"usb-config", 0x1fd0000, 0x10000},
708 {"log", 0x1fe0000, 0x20000},
712 .first_sysupgrade_partition
= "os-image",
713 .last_sysupgrade_partition
= "file-system"
716 /** Firmware layout for the A7-V5 */
718 .id
= "ARCHER-A7-V5",
721 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
722 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
723 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
724 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
725 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n",
727 .soft_ver
= "soft_ver:1.0.0\n",
729 /* We're using a dynamic kernel/rootfs split here */
731 {"factory-boot", 0x00000, 0x20000},
732 {"fs-uboot", 0x20000, 0x20000},
733 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
734 /* Stock: name file-system base 0x160000 size 0xda0000 */
735 {"default-mac", 0xf40000, 0x00200},
736 {"pin", 0xf40200, 0x00200},
737 {"device-id", 0xf40400, 0x00100},
738 {"product-info", 0xf40500, 0x0fb00},
739 {"soft-version", 0xf50000, 0x00100},
740 {"extra-para", 0xf51000, 0x01000},
741 {"support-list", 0xf52000, 0x0a000},
742 {"profile", 0xf5c000, 0x04000},
743 {"default-config", 0xf60000, 0x10000},
744 {"user-config", 0xf70000, 0x40000},
745 {"certificate", 0xfb0000, 0x10000},
746 {"partition-table", 0xfc0000, 0x10000},
747 {"log", 0xfd0000, 0x20000},
748 {"radio", 0xff0000, 0x10000},
752 .first_sysupgrade_partition
= "os-image",
753 .last_sysupgrade_partition
= "file-system",
756 /** Firmware layout for the C2v3 */
758 .id
= "ARCHER-C2-V3",
761 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
762 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
763 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
765 .soft_ver
= "soft_ver:3.0.1\n",
767 /** We're using a dynamic kernel/rootfs split here */
770 {"factory-boot", 0x00000, 0x20000},
771 {"fs-uboot", 0x20000, 0x10000},
772 {"firmware", 0x30000, 0x7a0000},
773 {"user-config", 0x7d0000, 0x04000},
774 {"default-mac", 0x7e0000, 0x00100},
775 {"device-id", 0x7e0100, 0x00100},
776 {"extra-para", 0x7e0200, 0x00100},
777 {"pin", 0x7e0300, 0x00100},
778 {"support-list", 0x7e0400, 0x00400},
779 {"soft-version", 0x7e0800, 0x00400},
780 {"product-info", 0x7e0c00, 0x01400},
781 {"partition-table", 0x7e2000, 0x01000},
782 {"profile", 0x7e3000, 0x01000},
783 {"default-config", 0x7e4000, 0x04000},
784 {"merge-config", 0x7ec000, 0x02000},
785 {"qos-db", 0x7ee000, 0x02000},
786 {"radio", 0x7f0000, 0x10000},
790 .first_sysupgrade_partition
= "os-image",
791 .last_sysupgrade_partition
= "file-system",
794 /** Firmware layout for the C25v1 */
796 .id
= "ARCHER-C25-V1",
799 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
800 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
801 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
803 .soft_ver
= "soft_ver:1.0.0\n",
805 /* We're using a dynamic kernel/rootfs split here */
807 {"factory-boot", 0x00000, 0x20000},
808 {"fs-uboot", 0x20000, 0x10000},
809 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
810 /* Stock: name file-system base 0x130000 size 0x6a0000 */
811 {"user-config", 0x7d0000, 0x04000},
812 {"default-mac", 0x7e0000, 0x00100},
813 {"device-id", 0x7e0100, 0x00100},
814 {"extra-para", 0x7e0200, 0x00100},
815 {"pin", 0x7e0300, 0x00100},
816 {"support-list", 0x7e0400, 0x00400},
817 {"soft-version", 0x7e0800, 0x00400},
818 {"product-info", 0x7e0c00, 0x01400},
819 {"partition-table", 0x7e2000, 0x01000},
820 {"profile", 0x7e3000, 0x01000},
821 {"default-config", 0x7e4000, 0x04000},
822 {"merge-config", 0x7ec000, 0x02000},
823 {"qos-db", 0x7ee000, 0x02000},
824 {"radio", 0x7f0000, 0x10000},
828 .first_sysupgrade_partition
= "os-image",
829 .last_sysupgrade_partition
= "file-system",
832 /** Firmware layout for the C58v1 */
834 .id
= "ARCHER-C58-V1",
838 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
839 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
840 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
842 .soft_ver
= "soft_ver:1.0.0\n",
845 {"fs-uboot", 0x00000, 0x10000},
846 {"default-mac", 0x10000, 0x00200},
847 {"pin", 0x10200, 0x00200},
848 {"product-info", 0x10400, 0x00100},
849 {"partition-table", 0x10500, 0x00800},
850 {"soft-version", 0x11300, 0x00200},
851 {"support-list", 0x11500, 0x00100},
852 {"device-id", 0x11600, 0x00100},
853 {"profile", 0x11700, 0x03900},
854 {"default-config", 0x15000, 0x04000},
855 {"user-config", 0x19000, 0x04000},
856 {"firmware", 0x20000, 0x7c8000},
857 {"certyficate", 0x7e8000, 0x08000},
858 {"radio", 0x7f0000, 0x10000},
862 .first_sysupgrade_partition
= "os-image",
863 .last_sysupgrade_partition
= "file-system",
866 /** Firmware layout for the C59v1 */
868 .id
= "ARCHER-C59-V1",
872 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
873 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
874 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
875 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
877 .soft_ver
= "soft_ver:1.0.0\n",
879 /* We're using a dynamic kernel/rootfs split here */
881 {"fs-uboot", 0x00000, 0x10000},
882 {"default-mac", 0x10000, 0x00200},
883 {"pin", 0x10200, 0x00200},
884 {"device-id", 0x10400, 0x00100},
885 {"product-info", 0x10500, 0x0fb00},
886 {"firmware", 0x20000, 0xe30000},
887 {"partition-table", 0xe50000, 0x10000},
888 {"soft-version", 0xe60000, 0x10000},
889 {"support-list", 0xe70000, 0x10000},
890 {"profile", 0xe80000, 0x10000},
891 {"default-config", 0xe90000, 0x10000},
892 {"user-config", 0xea0000, 0x40000},
893 {"usb-config", 0xee0000, 0x10000},
894 {"certificate", 0xef0000, 0x10000},
895 {"qos-db", 0xf00000, 0x40000},
896 {"log", 0xfe0000, 0x10000},
897 {"radio", 0xff0000, 0x10000},
901 .first_sysupgrade_partition
= "os-image",
902 .last_sysupgrade_partition
= "file-system",
905 /** Firmware layout for the C59v2 */
907 .id
= "ARCHER-C59-V2",
911 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
912 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
913 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
915 .soft_ver
= "soft_ver:2.0.0 Build 20161206 rel.7303\n",
917 /** We're using a dynamic kernel/rootfs split here */
919 {"factory-boot", 0x00000, 0x20000},
920 {"fs-uboot", 0x20000, 0x10000},
921 {"default-mac", 0x30000, 0x00200},
922 {"pin", 0x30200, 0x00200},
923 {"device-id", 0x30400, 0x00100},
924 {"product-info", 0x30500, 0x0fb00},
925 {"firmware", 0x40000, 0xe10000},
926 {"partition-table", 0xe50000, 0x10000},
927 {"soft-version", 0xe60000, 0x10000},
928 {"support-list", 0xe70000, 0x10000},
929 {"profile", 0xe80000, 0x10000},
930 {"default-config", 0xe90000, 0x10000},
931 {"user-config", 0xea0000, 0x40000},
932 {"usb-config", 0xee0000, 0x10000},
933 {"certificate", 0xef0000, 0x10000},
934 {"extra-para", 0xf00000, 0x10000},
935 {"qos-db", 0xf10000, 0x30000},
936 {"log", 0xfe0000, 0x10000},
937 {"radio", 0xff0000, 0x10000},
941 .first_sysupgrade_partition
= "os-image",
942 .last_sysupgrade_partition
= "file-system",
945 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
947 .id
= "ARCHER-C6-V2",
951 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
952 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
953 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
955 .soft_ver
= "soft_ver:1.9.1\n",
958 {"fs-uboot", 0x00000, 0x20000},
959 {"default-mac", 0x20000, 0x00200},
960 {"pin", 0x20200, 0x00100},
961 {"product-info", 0x20300, 0x00200},
962 {"device-id", 0x20500, 0x0fb00},
963 {"firmware", 0x30000, 0x7a9400},
964 {"soft-version", 0x7d9400, 0x00100},
965 {"extra-para", 0x7d9500, 0x00100},
966 {"support-list", 0x7d9600, 0x00200},
967 {"profile", 0x7d9800, 0x03000},
968 {"default-config", 0x7dc800, 0x03000},
969 {"partition-table", 0x7df800, 0x00800},
970 {"user-config", 0x7e0000, 0x0c000},
971 {"certificate", 0x7ec000, 0x04000},
972 {"radio", 0x7f0000, 0x10000},
976 .first_sysupgrade_partition
= "os-image",
977 .last_sysupgrade_partition
= "file-system",
980 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
982 .id
= "ARCHER-C6-V2-US",
986 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
987 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
988 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
990 .soft_ver
= "soft_ver:1.9.1\n",
993 {"factory-boot", 0x00000, 0x20000},
994 {"default-mac", 0x20000, 0x00200},
995 {"pin", 0x20200, 0x00100},
996 {"product-info", 0x20300, 0x00200},
997 {"device-id", 0x20500, 0x0fb00},
998 {"fs-uboot", 0x30000, 0x20000},
999 {"firmware", 0x50000, 0xf89400},
1000 {"soft-version", 0xfd9400, 0x00100},
1001 {"extra-para", 0xfd9500, 0x00100},
1002 {"support-list", 0xfd9600, 0x00200},
1003 {"profile", 0xfd9800, 0x03000},
1004 {"default-config", 0xfdc800, 0x03000},
1005 {"partition-table", 0xfdf800, 0x00800},
1006 {"user-config", 0xfe0000, 0x0c000},
1007 {"certificate", 0xfec000, 0x04000},
1008 {"radio", 0xff0000, 0x10000},
1011 .first_sysupgrade_partition
= "os-image",
1012 .last_sysupgrade_partition
= "file-system",
1015 /** Firmware layout for the C60v1 */
1017 .id
= "ARCHER-C60-V1",
1021 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1022 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1023 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1025 .soft_ver
= "soft_ver:1.0.0\n",
1028 {"fs-uboot", 0x00000, 0x10000},
1029 {"default-mac", 0x10000, 0x00200},
1030 {"pin", 0x10200, 0x00200},
1031 {"product-info", 0x10400, 0x00100},
1032 {"partition-table", 0x10500, 0x00800},
1033 {"soft-version", 0x11300, 0x00200},
1034 {"support-list", 0x11500, 0x00100},
1035 {"device-id", 0x11600, 0x00100},
1036 {"profile", 0x11700, 0x03900},
1037 {"default-config", 0x15000, 0x04000},
1038 {"user-config", 0x19000, 0x04000},
1039 {"firmware", 0x20000, 0x7c8000},
1040 {"certyficate", 0x7e8000, 0x08000},
1041 {"radio", 0x7f0000, 0x10000},
1045 .first_sysupgrade_partition
= "os-image",
1046 .last_sysupgrade_partition
= "file-system",
1049 /** Firmware layout for the C60v2 */
1051 .id
= "ARCHER-C60-V2",
1055 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1056 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1057 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1059 .soft_ver
= "soft_ver:2.0.0\n",
1062 {"factory-boot", 0x00000, 0x1fb00},
1063 {"default-mac", 0x1fb00, 0x00200},
1064 {"pin", 0x1fd00, 0x00100},
1065 {"product-info", 0x1fe00, 0x00100},
1066 {"device-id", 0x1ff00, 0x00100},
1067 {"fs-uboot", 0x20000, 0x10000},
1068 {"firmware", 0x30000, 0x7a0000},
1069 {"soft-version", 0x7d9500, 0x00100},
1070 {"support-list", 0x7d9600, 0x00100},
1071 {"extra-para", 0x7d9700, 0x00100},
1072 {"profile", 0x7d9800, 0x03000},
1073 {"default-config", 0x7dc800, 0x03000},
1074 {"partition-table", 0x7df800, 0x00800},
1075 {"user-config", 0x7e0000, 0x0c000},
1076 {"certificate", 0x7ec000, 0x04000},
1077 {"radio", 0x7f0000, 0x10000},
1081 .first_sysupgrade_partition
= "os-image",
1082 .last_sysupgrade_partition
= "file-system",
1085 /** Firmware layout for the C60v3 */
1087 .id
= "ARCHER-C60-V3",
1091 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1092 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1093 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1095 .soft_ver
= "soft_ver:3.0.0\n",
1098 {"factory-boot", 0x00000, 0x1fb00},
1099 {"default-mac", 0x1fb00, 0x00200},
1100 {"pin", 0x1fd00, 0x00100},
1101 {"product-info", 0x1fe00, 0x00100},
1102 {"device-id", 0x1ff00, 0x00100},
1103 {"fs-uboot", 0x20000, 0x10000},
1104 {"firmware", 0x30000, 0x7a0000},
1105 {"soft-version", 0x7d9500, 0x00100},
1106 {"support-list", 0x7d9600, 0x00100},
1107 {"extra-para", 0x7d9700, 0x00100},
1108 {"profile", 0x7d9800, 0x03000},
1109 {"default-config", 0x7dc800, 0x03000},
1110 {"partition-table", 0x7df800, 0x00800},
1111 {"user-config", 0x7e0000, 0x0c000},
1112 {"certificate", 0x7ec000, 0x04000},
1113 {"radio", 0x7f0000, 0x10000},
1117 .first_sysupgrade_partition
= "os-image",
1118 .last_sysupgrade_partition
= "file-system",
1121 /** Firmware layout for the C5 */
1123 .id
= "ARCHER-C5-V2",
1127 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1128 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1129 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1134 {"fs-uboot", 0x00000, 0x40000},
1135 {"os-image", 0x40000, 0x200000},
1136 {"file-system", 0x240000, 0xc00000},
1137 {"default-mac", 0xe40000, 0x00200},
1138 {"pin", 0xe40200, 0x00200},
1139 {"product-info", 0xe40400, 0x00200},
1140 {"partition-table", 0xe50000, 0x10000},
1141 {"soft-version", 0xe60000, 0x00200},
1142 {"support-list", 0xe61000, 0x0f000},
1143 {"profile", 0xe70000, 0x10000},
1144 {"default-config", 0xe80000, 0x10000},
1145 {"user-config", 0xe90000, 0x50000},
1146 {"log", 0xee0000, 0x100000},
1147 {"radio_bk", 0xfe0000, 0x10000},
1148 {"radio", 0xff0000, 0x10000},
1152 .first_sysupgrade_partition
= "os-image",
1153 .last_sysupgrade_partition
= "file-system"
1156 /** Firmware layout for the C7 */
1158 .id
= "ARCHER-C7-V4",
1161 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1162 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1163 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1164 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1165 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1166 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1167 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1168 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1169 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1170 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1172 .soft_ver
= "soft_ver:1.0.0\n",
1174 /* We're using a dynamic kernel/rootfs split here */
1176 {"factory-boot", 0x00000, 0x20000},
1177 {"fs-uboot", 0x20000, 0x20000},
1178 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1179 /* Stock: name file-system base 0x160000 size 0xda0000 */
1180 {"default-mac", 0xf00000, 0x00200},
1181 {"pin", 0xf00200, 0x00200},
1182 {"device-id", 0xf00400, 0x00100},
1183 {"product-info", 0xf00500, 0x0fb00},
1184 {"soft-version", 0xf10000, 0x00100},
1185 {"extra-para", 0xf11000, 0x01000},
1186 {"support-list", 0xf12000, 0x0a000},
1187 {"profile", 0xf1c000, 0x04000},
1188 {"default-config", 0xf20000, 0x10000},
1189 {"user-config", 0xf30000, 0x40000},
1190 {"qos-db", 0xf70000, 0x40000},
1191 {"certificate", 0xfb0000, 0x10000},
1192 {"partition-table", 0xfc0000, 0x10000},
1193 {"log", 0xfd0000, 0x20000},
1194 {"radio", 0xff0000, 0x10000},
1198 .first_sysupgrade_partition
= "os-image",
1199 .last_sysupgrade_partition
= "file-system",
1202 /** Firmware layout for the C7 v5*/
1204 .id
= "ARCHER-C7-V5",
1207 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1208 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1209 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1210 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1211 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1212 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1213 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1214 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1217 .soft_ver
= "soft_ver:1.0.0\n",
1219 /* We're using a dynamic kernel/rootfs split here */
1221 {"factory-boot", 0x00000, 0x20000},
1222 {"fs-uboot", 0x20000, 0x20000},
1223 {"partition-table", 0x40000, 0x10000},
1224 {"radio", 0x50000, 0x10000},
1225 {"default-mac", 0x60000, 0x00200},
1226 {"pin", 0x60200, 0x00200},
1227 {"device-id", 0x60400, 0x00100},
1228 {"product-info", 0x60500, 0x0fb00},
1229 {"soft-version", 0x70000, 0x01000},
1230 {"extra-para", 0x71000, 0x01000},
1231 {"support-list", 0x72000, 0x0a000},
1232 {"profile", 0x7c000, 0x04000},
1233 {"user-config", 0x80000, 0x40000},
1236 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1237 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1239 {"log", 0xfc0000, 0x20000},
1240 {"certificate", 0xfe0000, 0x10000},
1241 {"default-config", 0xff0000, 0x10000},
1246 .first_sysupgrade_partition
= "os-image",
1247 .last_sysupgrade_partition
= "file-system",
1250 /** Firmware layout for the C9 */
1256 "{product_name:ArcherC9,"
1257 "product_ver:1.0.0,"
1258 "special_id:00000000}\n",
1263 {"fs-uboot", 0x00000, 0x40000},
1264 {"os-image", 0x40000, 0x200000},
1265 {"file-system", 0x240000, 0xc00000},
1266 {"default-mac", 0xe40000, 0x00200},
1267 {"pin", 0xe40200, 0x00200},
1268 {"product-info", 0xe40400, 0x00200},
1269 {"partition-table", 0xe50000, 0x10000},
1270 {"soft-version", 0xe60000, 0x00200},
1271 {"support-list", 0xe61000, 0x0f000},
1272 {"profile", 0xe70000, 0x10000},
1273 {"default-config", 0xe80000, 0x10000},
1274 {"user-config", 0xe90000, 0x50000},
1275 {"log", 0xee0000, 0x100000},
1276 {"radio_bk", 0xfe0000, 0x10000},
1277 {"radio", 0xff0000, 0x10000},
1281 .first_sysupgrade_partition
= "os-image",
1282 .last_sysupgrade_partition
= "file-system"
1285 /** Firmware layout for the EAP120 */
1288 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1291 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1296 {"fs-uboot", 0x00000, 0x20000},
1297 {"partition-table", 0x20000, 0x02000},
1298 {"default-mac", 0x30000, 0x00020},
1299 {"support-list", 0x31000, 0x00100},
1300 {"product-info", 0x31100, 0x00100},
1301 {"soft-version", 0x32000, 0x00100},
1302 {"os-image", 0x40000, 0x180000},
1303 {"file-system", 0x1c0000, 0x600000},
1304 {"user-config", 0x7c0000, 0x10000},
1305 {"backup-config", 0x7d0000, 0x10000},
1306 {"log", 0x7e0000, 0x10000},
1307 {"radio", 0x7f0000, 0x10000},
1311 .first_sysupgrade_partition
= "os-image",
1312 .last_sysupgrade_partition
= "file-system"
1315 /** Firmware layout for the EAP225-Outdoor v1 */
1317 .id
= "EAP225-OUTDOOR-V1",
1320 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1321 .part_trail
= PART_TRAIL_NONE
,
1323 .soft_ver_compat_level
= 1,
1326 {"fs-uboot", 0x00000, 0x20000},
1327 {"partition-table", 0x20000, 0x02000},
1328 {"default-mac", 0x30000, 0x01000},
1329 {"support-list", 0x31000, 0x00100},
1330 {"product-info", 0x31100, 0x00400},
1331 {"soft-version", 0x32000, 0x00100},
1332 {"firmware", 0x40000, 0xd80000},
1333 {"user-config", 0xdc0000, 0x30000},
1334 {"mutil-log", 0xf30000, 0x80000},
1335 {"oops", 0xfb0000, 0x40000},
1336 {"radio", 0xff0000, 0x10000},
1340 .first_sysupgrade_partition
= "os-image",
1341 .last_sysupgrade_partition
= "file-system"
1344 /** Firmware layout for the EAP225 v3 */
1349 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n",
1350 .part_trail
= PART_TRAIL_NONE
,
1352 .soft_ver_compat_level
= 1,
1355 {"fs-uboot", 0x00000, 0x20000},
1356 {"partition-table", 0x20000, 0x02000},
1357 {"default-mac", 0x30000, 0x01000},
1358 {"support-list", 0x31000, 0x00100},
1359 {"product-info", 0x31100, 0x00400},
1360 {"soft-version", 0x32000, 0x00100},
1361 {"firmware", 0x40000, 0xd80000},
1362 {"user-config", 0xdc0000, 0x30000},
1363 {"mutil-log", 0xf30000, 0x80000},
1364 {"oops", 0xfb0000, 0x40000},
1365 {"radio", 0xff0000, 0x10000},
1369 .first_sysupgrade_partition
= "os-image",
1370 .last_sysupgrade_partition
= "file-system"
1373 /** Firmware layout for the EAP225-Wall v2 */
1375 .id
= "EAP225-WALL-V2",
1378 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1379 .part_trail
= PART_TRAIL_NONE
,
1381 .soft_ver_compat_level
= 1,
1384 {"fs-uboot", 0x00000, 0x20000},
1385 {"partition-table", 0x20000, 0x02000},
1386 {"default-mac", 0x30000, 0x01000},
1387 {"support-list", 0x31000, 0x00100},
1388 {"product-info", 0x31100, 0x00400},
1389 {"soft-version", 0x32000, 0x00100},
1390 {"firmware", 0x40000, 0xd80000},
1391 {"user-config", 0xdc0000, 0x30000},
1392 {"mutil-log", 0xf30000, 0x80000},
1393 {"oops", 0xfb0000, 0x40000},
1394 {"radio", 0xff0000, 0x10000},
1398 .first_sysupgrade_partition
= "os-image",
1399 .last_sysupgrade_partition
= "file-system"
1402 /** Firmware layout for the EAP245 v1 */
1407 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1408 .part_trail
= PART_TRAIL_NONE
,
1412 {"fs-uboot", 0x00000, 0x20000},
1413 {"partition-table", 0x20000, 0x02000},
1414 {"default-mac", 0x30000, 0x01000},
1415 {"support-list", 0x31000, 0x00100},
1416 {"product-info", 0x31100, 0x00400},
1417 {"soft-version", 0x32000, 0x00100},
1418 {"firmware", 0x40000, 0xd80000},
1419 {"user-config", 0xdc0000, 0x30000},
1420 {"radio", 0xff0000, 0x10000},
1424 .first_sysupgrade_partition
= "os-image",
1425 .last_sysupgrade_partition
= "file-system"
1428 /** Firmware layout for the EAP245 v3 */
1433 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n",
1434 .part_trail
= PART_TRAIL_NONE
,
1436 .soft_ver_compat_level
= 1,
1438 /** Firmware partition with dynamic kernel/rootfs split */
1440 {"factroy-boot", 0x00000, 0x40000},
1441 {"fs-uboot", 0x40000, 0x40000},
1442 {"partition-table", 0x80000, 0x10000},
1443 {"default-mac", 0x90000, 0x01000},
1444 {"support-list", 0x91000, 0x00100},
1445 {"product-info", 0x91100, 0x00400},
1446 {"soft-version", 0x92000, 0x00100},
1447 {"radio", 0xa0000, 0x10000},
1448 {"extra-para", 0xb0000, 0x10000},
1449 {"firmware", 0xc0000, 0xe40000},
1450 {"config", 0xf00000, 0x30000},
1451 {"mutil-log", 0xf30000, 0x80000},
1452 {"oops", 0xfb0000, 0x40000},
1456 .first_sysupgrade_partition
= "os-image",
1457 .last_sysupgrade_partition
= "file-system"
1460 /** Firmware layout for the TL-WA850RE v2 */
1462 .id
= "TLWA850REV2",
1466 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
1467 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
1468 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
1469 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
1470 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
1471 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
1472 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
1473 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
1474 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
1475 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
1480 576KB were moved from file-system to os-image
1481 in comparison to the stock image
1484 {"fs-uboot", 0x00000, 0x20000},
1485 {"firmware", 0x20000, 0x390000},
1486 {"partition-table", 0x3b0000, 0x02000},
1487 {"default-mac", 0x3c0000, 0x00020},
1488 {"pin", 0x3c0100, 0x00020},
1489 {"product-info", 0x3c1000, 0x01000},
1490 {"soft-version", 0x3c2000, 0x00100},
1491 {"support-list", 0x3c3000, 0x01000},
1492 {"profile", 0x3c4000, 0x08000},
1493 {"user-config", 0x3d0000, 0x10000},
1494 {"default-config", 0x3e0000, 0x10000},
1495 {"radio", 0x3f0000, 0x10000},
1499 .first_sysupgrade_partition
= "os-image",
1500 .last_sysupgrade_partition
= "file-system"
1503 /** Firmware layout for the TL-WA855RE v1 */
1505 .id
= "TLWA855REV1",
1509 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
1510 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
1511 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
1512 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
1513 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
1514 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
1515 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
1516 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
1517 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
1522 {"fs-uboot", 0x00000, 0x20000},
1523 {"os-image", 0x20000, 0x150000},
1524 {"file-system", 0x170000, 0x240000},
1525 {"partition-table", 0x3b0000, 0x02000},
1526 {"default-mac", 0x3c0000, 0x00020},
1527 {"pin", 0x3c0100, 0x00020},
1528 {"product-info", 0x3c1000, 0x01000},
1529 {"soft-version", 0x3c2000, 0x00100},
1530 {"support-list", 0x3c3000, 0x01000},
1531 {"profile", 0x3c4000, 0x08000},
1532 {"user-config", 0x3d0000, 0x10000},
1533 {"default-config", 0x3e0000, 0x10000},
1534 {"radio", 0x3f0000, 0x10000},
1538 .first_sysupgrade_partition
= "os-image",
1539 .last_sysupgrade_partition
= "file-system"
1542 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
1544 .id
= "TL-WPA8630P-V2.0-EU",
1548 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
1553 {"factory-uboot", 0x00000, 0x20000},
1554 {"fs-uboot", 0x20000, 0x20000},
1555 {"firmware", 0x40000, 0x5e0000},
1556 {"partition-table", 0x620000, 0x02000},
1557 {"default-mac", 0x630000, 0x00020},
1558 {"pin", 0x630100, 0x00020},
1559 {"device-id", 0x630200, 0x00030},
1560 {"product-info", 0x631100, 0x01000},
1561 {"extra-para", 0x632100, 0x01000},
1562 {"soft-version", 0x640000, 0x01000},
1563 {"support-list", 0x641000, 0x01000},
1564 {"profile", 0x642000, 0x08000},
1565 {"user-config", 0x650000, 0x10000},
1566 {"default-config", 0x660000, 0x10000},
1567 {"default-nvm", 0x670000, 0xc0000},
1568 {"default-pib", 0x730000, 0x40000},
1569 {"radio", 0x7f0000, 0x10000},
1573 .first_sysupgrade_partition
= "os-image",
1574 .last_sysupgrade_partition
= "file-system"
1577 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
1579 .id
= "TL-WPA8630P-V2-INT",
1583 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
1584 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
1585 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
1590 {"factory-uboot", 0x00000, 0x20000},
1591 {"fs-uboot", 0x20000, 0x20000},
1592 {"firmware", 0x40000, 0x5e0000},
1593 {"partition-table", 0x620000, 0x02000},
1594 {"extra-para", 0x632100, 0x01000},
1595 {"soft-version", 0x640000, 0x01000},
1596 {"support-list", 0x641000, 0x01000},
1597 {"profile", 0x642000, 0x08000},
1598 {"user-config", 0x650000, 0x10000},
1599 {"default-config", 0x660000, 0x10000},
1600 {"default-nvm", 0x670000, 0xc0000},
1601 {"default-pib", 0x730000, 0x40000},
1602 {"default-mac", 0x7e0000, 0x00020},
1603 {"pin", 0x7e0100, 0x00020},
1604 {"device-id", 0x7e0200, 0x00030},
1605 {"product-info", 0x7e1100, 0x01000},
1606 {"radio", 0x7f0000, 0x10000},
1610 .first_sysupgrade_partition
= "os-image",
1611 .last_sysupgrade_partition
= "file-system"
1614 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
1616 .id
= "TL-WPA8630P-V2.1-EU",
1620 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
1625 {"factory-uboot", 0x00000, 0x20000},
1626 {"fs-uboot", 0x20000, 0x20000},
1627 {"firmware", 0x40000, 0x5e0000},
1628 {"extra-para", 0x680000, 0x01000},
1629 {"product-info", 0x690000, 0x01000},
1630 {"partition-table", 0x6a0000, 0x02000},
1631 {"soft-version", 0x6b0000, 0x01000},
1632 {"support-list", 0x6b1000, 0x01000},
1633 {"profile", 0x6b2000, 0x08000},
1634 {"user-config", 0x6c0000, 0x10000},
1635 {"default-config", 0x6d0000, 0x10000},
1636 {"default-nvm", 0x6e0000, 0xc0000},
1637 {"default-pib", 0x7a0000, 0x40000},
1638 {"default-mac", 0x7e0000, 0x00020},
1639 {"pin", 0x7e0100, 0x00020},
1640 {"device-id", 0x7e0200, 0x00030},
1641 {"radio", 0x7f0000, 0x10000},
1645 .first_sysupgrade_partition
= "os-image",
1646 .last_sysupgrade_partition
= "file-system"
1649 /** Firmware layout for the TL-WR1043 v5 */
1651 .id
= "TLWR1043NV5",
1655 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
1656 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
1658 .soft_ver
= "soft_ver:1.0.0\n",
1660 {"factory-boot", 0x00000, 0x20000},
1661 {"fs-uboot", 0x20000, 0x20000},
1662 {"firmware", 0x40000, 0xec0000},
1663 {"default-mac", 0xf00000, 0x00200},
1664 {"pin", 0xf00200, 0x00200},
1665 {"device-id", 0xf00400, 0x00100},
1666 {"product-info", 0xf00500, 0x0fb00},
1667 {"soft-version", 0xf10000, 0x01000},
1668 {"extra-para", 0xf11000, 0x01000},
1669 {"support-list", 0xf12000, 0x0a000},
1670 {"profile", 0xf1c000, 0x04000},
1671 {"default-config", 0xf20000, 0x10000},
1672 {"user-config", 0xf30000, 0x40000},
1673 {"qos-db", 0xf70000, 0x40000},
1674 {"certificate", 0xfb0000, 0x10000},
1675 {"partition-table", 0xfc0000, 0x10000},
1676 {"log", 0xfd0000, 0x20000},
1677 {"radio", 0xff0000, 0x10000},
1680 .first_sysupgrade_partition
= "os-image",
1681 .last_sysupgrade_partition
= "file-system"
1684 /** Firmware layout for the TL-WR1043 v4 */
1686 .id
= "TLWR1043NDV4",
1690 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
1694 /* We're using a dynamic kernel/rootfs split here */
1696 {"fs-uboot", 0x00000, 0x20000},
1697 {"firmware", 0x20000, 0xf30000},
1698 {"default-mac", 0xf50000, 0x00200},
1699 {"pin", 0xf50200, 0x00200},
1700 {"product-info", 0xf50400, 0x0fc00},
1701 {"soft-version", 0xf60000, 0x0b000},
1702 {"support-list", 0xf6b000, 0x04000},
1703 {"profile", 0xf70000, 0x04000},
1704 {"default-config", 0xf74000, 0x0b000},
1705 {"user-config", 0xf80000, 0x40000},
1706 {"partition-table", 0xfc0000, 0x10000},
1707 {"log", 0xfd0000, 0x20000},
1708 {"radio", 0xff0000, 0x10000},
1712 .first_sysupgrade_partition
= "os-image",
1713 .last_sysupgrade_partition
= "file-system"
1716 /** Firmware layout for the TL-WR902AC v1 */
1718 .id
= "TL-WR902AC-V1",
1722 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
1723 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
1728 384KB were moved from file-system to os-image
1729 in comparison to the stock image
1732 {"fs-uboot", 0x00000, 0x20000},
1733 {"firmware", 0x20000, 0x730000},
1734 {"default-mac", 0x750000, 0x00200},
1735 {"pin", 0x750200, 0x00200},
1736 {"product-info", 0x750400, 0x0fc00},
1737 {"soft-version", 0x760000, 0x0b000},
1738 {"support-list", 0x76b000, 0x04000},
1739 {"profile", 0x770000, 0x04000},
1740 {"default-config", 0x774000, 0x0b000},
1741 {"user-config", 0x780000, 0x40000},
1742 {"partition-table", 0x7c0000, 0x10000},
1743 {"log", 0x7d0000, 0x20000},
1744 {"radio", 0x7f0000, 0x10000},
1748 .first_sysupgrade_partition
= "os-image",
1749 .last_sysupgrade_partition
= "file-system",
1752 /** Firmware layout for the TL-WR942N V1 */
1758 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
1759 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
1764 {"fs-uboot", 0x00000, 0x20000},
1765 {"firmware", 0x20000, 0xe20000},
1766 {"default-mac", 0xe40000, 0x00200},
1767 {"pin", 0xe40200, 0x00200},
1768 {"product-info", 0xe40400, 0x0fc00},
1769 {"partition-table", 0xe50000, 0x10000},
1770 {"soft-version", 0xe60000, 0x10000},
1771 {"support-list", 0xe70000, 0x10000},
1772 {"profile", 0xe80000, 0x10000},
1773 {"default-config", 0xe90000, 0x10000},
1774 {"user-config", 0xea0000, 0x40000},
1775 {"qos-db", 0xee0000, 0x40000},
1776 {"certificate", 0xf20000, 0x10000},
1777 {"usb-config", 0xfb0000, 0x10000},
1778 {"log", 0xfc0000, 0x20000},
1779 {"radio-bk", 0xfe0000, 0x10000},
1780 {"radio", 0xff0000, 0x10000},
1784 .first_sysupgrade_partition
= "os-image",
1785 .last_sysupgrade_partition
= "file-system",
1788 /** Firmware layout for the RE200 v2 */
1794 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
1795 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
1796 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
1797 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
1798 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
1799 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
1800 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
1801 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
1802 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
1803 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
1804 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
1805 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
1806 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
1811 {"fs-uboot", 0x00000, 0x20000},
1812 {"firmware", 0x20000, 0x7a0000},
1813 {"partition-table", 0x7c0000, 0x02000},
1814 {"default-mac", 0x7c2000, 0x00020},
1815 {"pin", 0x7c2100, 0x00020},
1816 {"product-info", 0x7c3100, 0x01000},
1817 {"soft-version", 0x7c4200, 0x01000},
1818 {"support-list", 0x7c5200, 0x01000},
1819 {"profile", 0x7c6200, 0x08000},
1820 {"config-info", 0x7ce200, 0x00400},
1821 {"user-config", 0x7d0000, 0x10000},
1822 {"default-config", 0x7e0000, 0x10000},
1823 {"radio", 0x7f0000, 0x10000},
1827 .first_sysupgrade_partition
= "os-image",
1828 .last_sysupgrade_partition
= "file-system"
1831 /** Firmware layout for the RE200 v3 */
1837 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
1838 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
1839 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
1840 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
1841 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
1842 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
1843 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
1844 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
1845 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
1846 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
1847 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
1848 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
1849 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
1850 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
1855 {"fs-uboot", 0x00000, 0x20000},
1856 {"firmware", 0x20000, 0x7a0000},
1857 {"partition-table", 0x7c0000, 0x02000},
1858 {"default-mac", 0x7c2000, 0x00020},
1859 {"pin", 0x7c2100, 0x00020},
1860 {"product-info", 0x7c3100, 0x01000},
1861 {"soft-version", 0x7c4200, 0x01000},
1862 {"support-list", 0x7c5200, 0x01000},
1863 {"profile", 0x7c6200, 0x08000},
1864 {"config-info", 0x7ce200, 0x00400},
1865 {"user-config", 0x7d0000, 0x10000},
1866 {"default-config", 0x7e0000, 0x10000},
1867 {"radio", 0x7f0000, 0x10000},
1871 .first_sysupgrade_partition
= "os-image",
1872 .last_sysupgrade_partition
= "file-system"
1875 /** Firmware layout for the RE200 v4 */
1881 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
1882 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
1883 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
1884 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
1885 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
1886 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
1887 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
1888 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
1889 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
1890 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
1891 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
1892 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
1893 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
1894 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
1896 .soft_ver
= "soft_ver:1.1.0\n",
1899 {"fs-uboot", 0x00000, 0x20000},
1900 {"firmware", 0x20000, 0x7a0000},
1901 {"partition-table", 0x7c0000, 0x02000},
1902 {"default-mac", 0x7c2000, 0x00020},
1903 {"pin", 0x7c2100, 0x00020},
1904 {"product-info", 0x7c3100, 0x01000},
1905 {"soft-version", 0x7c4200, 0x01000},
1906 {"support-list", 0x7c5200, 0x01000},
1907 {"profile", 0x7c6200, 0x08000},
1908 {"config-info", 0x7ce200, 0x00400},
1909 {"user-config", 0x7d0000, 0x10000},
1910 {"default-config", 0x7e0000, 0x10000},
1911 {"radio", 0x7f0000, 0x10000},
1915 .first_sysupgrade_partition
= "os-image",
1916 .last_sysupgrade_partition
= "file-system"
1919 /** Firmware layout for the RE220 v2 */
1925 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
1926 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
1927 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
1928 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
1929 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
1930 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
1931 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
1932 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
1933 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
1934 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
1935 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
1936 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
1937 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
1942 {"fs-uboot", 0x00000, 0x20000},
1943 {"firmware", 0x20000, 0x7a0000},
1944 {"partition-table", 0x7c0000, 0x02000},
1945 {"default-mac", 0x7c2000, 0x00020},
1946 {"pin", 0x7c2100, 0x00020},
1947 {"product-info", 0x7c3100, 0x01000},
1948 {"soft-version", 0x7c4200, 0x01000},
1949 {"support-list", 0x7c5200, 0x01000},
1950 {"profile", 0x7c6200, 0x08000},
1951 {"config-info", 0x7ce200, 0x00400},
1952 {"user-config", 0x7d0000, 0x10000},
1953 {"default-config", 0x7e0000, 0x10000},
1954 {"radio", 0x7f0000, 0x10000},
1958 .first_sysupgrade_partition
= "os-image",
1959 .last_sysupgrade_partition
= "file-system"
1962 /** Firmware layout for the RE305 v1 */
1968 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
1969 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
1970 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
1971 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
1972 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
1973 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
1974 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
1979 {"fs-uboot", 0x00000, 0x20000},
1980 {"firmware", 0x20000, 0x5e0000},
1981 {"partition-table", 0x600000, 0x02000},
1982 {"default-mac", 0x610000, 0x00020},
1983 {"pin", 0x610100, 0x00020},
1984 {"product-info", 0x611100, 0x01000},
1985 {"soft-version", 0x620000, 0x01000},
1986 {"support-list", 0x621000, 0x01000},
1987 {"profile", 0x622000, 0x08000},
1988 {"user-config", 0x630000, 0x10000},
1989 {"default-config", 0x640000, 0x10000},
1990 {"radio", 0x7f0000, 0x10000},
1994 .first_sysupgrade_partition
= "os-image",
1995 .last_sysupgrade_partition
= "file-system"
1998 /** Firmware layout for the RE350 v1 */
2004 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2005 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2006 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2007 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2008 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2009 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2010 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2014 /** We're using a dynamic kernel/rootfs split here */
2016 {"fs-uboot", 0x00000, 0x20000},
2017 {"firmware", 0x20000, 0x5e0000},
2018 {"partition-table", 0x600000, 0x02000},
2019 {"default-mac", 0x610000, 0x00020},
2020 {"pin", 0x610100, 0x00020},
2021 {"product-info", 0x611100, 0x01000},
2022 {"soft-version", 0x620000, 0x01000},
2023 {"support-list", 0x621000, 0x01000},
2024 {"profile", 0x622000, 0x08000},
2025 {"user-config", 0x630000, 0x10000},
2026 {"default-config", 0x640000, 0x10000},
2027 {"radio", 0x7f0000, 0x10000},
2031 .first_sysupgrade_partition
= "os-image",
2032 .last_sysupgrade_partition
= "file-system"
2035 /** Firmware layout for the RE350K v1 */
2041 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2045 /** We're using a dynamic kernel/rootfs split here */
2047 {"fs-uboot", 0x00000, 0x20000},
2048 {"firmware", 0x20000, 0xd70000},
2049 {"partition-table", 0xd90000, 0x02000},
2050 {"default-mac", 0xda0000, 0x00020},
2051 {"pin", 0xda0100, 0x00020},
2052 {"product-info", 0xda1100, 0x01000},
2053 {"soft-version", 0xdb0000, 0x01000},
2054 {"support-list", 0xdb1000, 0x01000},
2055 {"profile", 0xdb2000, 0x08000},
2056 {"user-config", 0xdc0000, 0x10000},
2057 {"default-config", 0xdd0000, 0x10000},
2058 {"device-id", 0xde0000, 0x00108},
2059 {"radio", 0xff0000, 0x10000},
2063 .first_sysupgrade_partition
= "os-image",
2064 .last_sysupgrade_partition
= "file-system"
2067 /** Firmware layout for the RE355 */
2073 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2074 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2075 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2076 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2077 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2078 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2079 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2080 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2084 /* We're using a dynamic kernel/rootfs split here */
2086 {"fs-uboot", 0x00000, 0x20000},
2087 {"firmware", 0x20000, 0x5e0000},
2088 {"partition-table", 0x600000, 0x02000},
2089 {"default-mac", 0x610000, 0x00020},
2090 {"pin", 0x610100, 0x00020},
2091 {"product-info", 0x611100, 0x01000},
2092 {"soft-version", 0x620000, 0x01000},
2093 {"support-list", 0x621000, 0x01000},
2094 {"profile", 0x622000, 0x08000},
2095 {"user-config", 0x630000, 0x10000},
2096 {"default-config", 0x640000, 0x10000},
2097 {"radio", 0x7f0000, 0x10000},
2101 .first_sysupgrade_partition
= "os-image",
2102 .last_sysupgrade_partition
= "file-system"
2105 /** Firmware layout for the RE450 */
2111 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2112 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2113 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2114 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2115 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2116 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2117 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2118 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2122 /** We're using a dynamic kernel/rootfs split here */
2124 {"fs-uboot", 0x00000, 0x20000},
2125 {"firmware", 0x20000, 0x5e0000},
2126 {"partition-table", 0x600000, 0x02000},
2127 {"default-mac", 0x610000, 0x00020},
2128 {"pin", 0x610100, 0x00020},
2129 {"product-info", 0x611100, 0x01000},
2130 {"soft-version", 0x620000, 0x01000},
2131 {"support-list", 0x621000, 0x01000},
2132 {"profile", 0x622000, 0x08000},
2133 {"user-config", 0x630000, 0x10000},
2134 {"default-config", 0x640000, 0x10000},
2135 {"radio", 0x7f0000, 0x10000},
2139 .first_sysupgrade_partition
= "os-image",
2140 .last_sysupgrade_partition
= "file-system"
2143 /** Firmware layout for the RE450 v2 */
2149 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2150 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2151 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2152 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2153 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2154 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2155 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2156 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2157 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2161 /* We're using a dynamic kernel/rootfs split here */
2163 {"fs-uboot", 0x00000, 0x20000},
2164 {"firmware", 0x20000, 0x5e0000},
2165 {"partition-table", 0x600000, 0x02000},
2166 {"default-mac", 0x610000, 0x00020},
2167 {"pin", 0x610100, 0x00020},
2168 {"product-info", 0x611100, 0x01000},
2169 {"soft-version", 0x620000, 0x01000},
2170 {"support-list", 0x621000, 0x01000},
2171 {"profile", 0x622000, 0x08000},
2172 {"user-config", 0x630000, 0x10000},
2173 {"default-config", 0x640000, 0x10000},
2174 {"radio", 0x7f0000, 0x10000},
2178 .first_sysupgrade_partition
= "os-image",
2179 .last_sysupgrade_partition
= "file-system"
2182 /** Firmware layout for the RE450 v3 */
2188 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2189 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2190 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2191 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2192 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2193 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2194 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2195 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2196 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2200 /* We're using a dynamic kernel/rootfs split here */
2202 {"fs-uboot", 0x00000, 0x20000},
2203 {"default-mac", 0x20000, 0x00020},
2204 {"pin", 0x20020, 0x00020},
2205 {"product-info", 0x21000, 0x01000},
2206 {"partition-table", 0x22000, 0x02000},
2207 {"soft-version", 0x24000, 0x01000},
2208 {"support-list", 0x25000, 0x01000},
2209 {"profile", 0x26000, 0x08000},
2210 {"user-config", 0x2e000, 0x10000},
2211 {"default-config", 0x3e000, 0x10000},
2212 {"config-info", 0x4e000, 0x00400},
2213 {"firmware", 0x50000, 0x7a0000},
2214 {"radio", 0x7f0000, 0x10000},
2218 .first_sysupgrade_partition
= "os-image",
2219 .last_sysupgrade_partition
= "file-system"
2222 /** Firmware layout for the RE500 */
2228 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2229 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2230 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2231 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2232 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2233 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2234 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2238 /* We're using a dynamic kernel/rootfs split here */
2240 {"fs-uboot", 0x00000, 0x20000},
2241 {"firmware", 0x20000, 0xde0000},
2242 {"partition-table", 0xe00000, 0x02000},
2243 {"default-mac", 0xe10000, 0x00020},
2244 {"pin", 0xe10100, 0x00020},
2245 {"product-info", 0xe11100, 0x01000},
2246 {"soft-version", 0xe20000, 0x01000},
2247 {"support-list", 0xe21000, 0x01000},
2248 {"profile", 0xe22000, 0x08000},
2249 {"user-config", 0xe30000, 0x10000},
2250 {"default-config", 0xe40000, 0x10000},
2251 {"radio", 0xff0000, 0x10000},
2255 .first_sysupgrade_partition
= "os-image",
2256 .last_sysupgrade_partition
= "file-system"
2259 /** Firmware layout for the RE650 */
2265 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2266 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2267 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2268 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2269 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2270 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2271 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2275 /* We're using a dynamic kernel/rootfs split here */
2277 {"fs-uboot", 0x00000, 0x20000},
2278 {"firmware", 0x20000, 0xde0000},
2279 {"partition-table", 0xe00000, 0x02000},
2280 {"default-mac", 0xe10000, 0x00020},
2281 {"pin", 0xe10100, 0x00020},
2282 {"product-info", 0xe11100, 0x01000},
2283 {"soft-version", 0xe20000, 0x01000},
2284 {"support-list", 0xe21000, 0x01000},
2285 {"profile", 0xe22000, 0x08000},
2286 {"user-config", 0xe30000, 0x10000},
2287 {"default-config", 0xe40000, 0x10000},
2288 {"radio", 0xff0000, 0x10000},
2292 .first_sysupgrade_partition
= "os-image",
2293 .last_sysupgrade_partition
= "file-system"
2299 #define error(_ret, _errno, _str, ...) \
2301 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
2302 strerror(_errno)); \
2308 /** Stores a uint32 as big endian */
2309 static inline void put32(uint8_t *buf
, uint32_t val
) {
2316 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
2318 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
2321 /** Allocate a padded meta partition with a correctly initialised header
2322 * If the `data` pointer is NULL, then the required space is only allocated,
2323 * otherwise `data_len` bytes will be copied from `data` into the partition
2325 static struct image_partition_entry
init_meta_partition_entry(
2326 const char *name
, const void *data
, uint32_t data_len
,
2327 enum partition_trail_value pad_value
)
2329 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
2330 if (meta_partition_should_pad(pad_value
))
2333 struct image_partition_entry entry
= {
2336 .data
= malloc(total_len
)
2339 error(1, errno
, "failed to allocate meta partition entry");
2341 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
2342 header
->length
= htonl(data_len
);
2346 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
2348 if (meta_partition_should_pad(pad_value
))
2349 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
2354 /** Allocates a new image partition */
2355 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
2356 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
2358 error(1, errno
, "malloc");
2363 /** Frees an image partition */
2364 static void free_image_partition(struct image_partition_entry entry
) {
2368 static time_t source_date_epoch
= -1;
2369 static void set_source_date_epoch() {
2370 char *env
= getenv("SOURCE_DATE_EPOCH");
2374 source_date_epoch
= strtoull(env
, &endptr
, 10);
2375 if (errno
|| (endptr
&& *endptr
!= '\0')) {
2376 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
2382 /** Generates the partition-table partition */
2383 static struct image_partition_entry
make_partition_table(const struct flash_partition_entry
*p
) {
2384 struct image_partition_entry entry
= alloc_image_partition("partition-table", 0x800);
2386 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
2394 for (i
= 0; p
[i
].name
; i
++) {
2396 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n", p
[i
].name
, p
[i
].base
, p
[i
].size
);
2399 error(1, 0, "flash partition table overflow?");
2406 memset(s
, 0xff, end
-s
);
2412 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
2413 static inline uint8_t bcd(uint8_t v
) {
2414 return 0x10 * (v
/10) + v
%10;
2418 /** Generates the soft-version partition */
2419 static struct image_partition_entry
make_soft_version(
2420 const struct device_info
*info
, uint32_t rev
)
2422 /** If an info string is provided, use this instead of
2423 * the structured data, and include the null-termination */
2424 if (info
->soft_ver
) {
2425 uint32_t len
= strlen(info
->soft_ver
) + 1;
2426 return init_meta_partition_entry("soft-version",
2427 info
->soft_ver
, len
, info
->part_trail
);
2432 if (source_date_epoch
!= -1)
2433 t
= source_date_epoch
;
2434 else if (time(&t
) == (time_t)(-1))
2435 error(1, errno
, "time");
2437 struct tm
*tm
= gmtime(&t
);
2439 struct soft_version s
= {
2446 .year_hi
= bcd((1900+tm
->tm_year
)/100),
2447 .year_lo
= bcd(tm
->tm_year
%100),
2448 .month
= bcd(tm
->tm_mon
+1),
2449 .day
= bcd(tm
->tm_mday
),
2451 .compat_level
= htonl(info
->soft_ver_compat_level
)
2454 if (info
->soft_ver_compat_level
== 0)
2455 return init_meta_partition_entry("soft-version", &s
,
2456 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
2459 return init_meta_partition_entry("soft-version", &s
,
2460 sizeof(s
), info
->part_trail
);
2463 /** Generates the support-list partition */
2464 static struct image_partition_entry
make_support_list(
2465 const struct device_info
*info
)
2467 uint32_t len
= strlen(info
->support_list
);
2468 return init_meta_partition_entry("support-list", info
->support_list
,
2469 len
, info
->part_trail
);
2472 /** Partition with extra-para data */
2473 static struct image_partition_entry
make_extra_para(
2474 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
2476 return init_meta_partition_entry("extra-para", extra_para
, len
,
2480 /** Creates a new image partition with an arbitrary name from a file */
2481 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
) {
2482 struct stat statbuf
;
2484 if (stat(filename
, &statbuf
) < 0)
2485 error(1, errno
, "unable to stat file `%s'", filename
);
2487 size_t len
= statbuf
.st_size
;
2489 if (add_jffs2_eof
) {
2490 if (file_system_partition
)
2491 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
2493 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
2496 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
2498 FILE *file
= fopen(filename
, "rb");
2500 error(1, errno
, "unable to open file `%s'", filename
);
2502 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
2503 error(1, errno
, "unable to read file `%s'", filename
);
2505 if (add_jffs2_eof
) {
2506 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
2508 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
2509 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
2518 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
2520 Example image partition table:
2522 fwup-ptn partition-table base 0x00800 size 0x00800
2523 fwup-ptn os-image base 0x01000 size 0x113b45
2524 fwup-ptn file-system base 0x114b45 size 0x1d0004
2525 fwup-ptn support-list base 0x2e4b49 size 0x000d1
2527 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
2528 the end of the partition table is marked with a zero byte.
2530 The firmware image must contain at least the partition-table and support-list partitions
2531 to be accepted. There aren't any alignment constraints for the image partitions.
2533 The partition-table partition contains the actual flash layout; partitions
2534 from the image partition table are mapped to the corresponding flash partitions during
2535 the firmware upgrade. The support-list partition contains a list of devices supported by
2538 The base offsets in the firmware partition table are relative to the end
2539 of the vendor information block, so the partition-table partition will
2540 actually start at offset 0x1814 of the image.
2542 I think partition-table must be the first partition in the firmware image.
2544 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
2546 char *image_pt
= (char *)buffer
, *end
= image_pt
+ 0x800;
2548 size_t base
= 0x800;
2549 for (i
= 0; parts
[i
].name
; i
++) {
2550 for (j
= 0; flash_parts
[j
].name
; j
++) {
2551 if (!strcmp(flash_parts
[j
].name
, parts
[i
].name
)) {
2552 if (parts
[i
].size
> flash_parts
[j
].size
)
2553 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts
[j
].name
, (unsigned)flash_parts
[j
].size
);
2558 assert(flash_parts
[j
].name
);
2560 memcpy(buffer
+ base
, parts
[i
].data
, parts
[i
].size
);
2562 size_t len
= end
-image_pt
;
2563 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
);
2566 error(1, 0, "image partition table overflow?");
2570 base
+= parts
[i
].size
;
2574 /** Generates and writes the image MD5 checksum */
2575 static void put_md5(uint8_t *md5
, uint8_t *buffer
, unsigned int len
) {
2579 MD5_Update(&ctx
, md5_salt
, (unsigned int)sizeof(md5_salt
));
2580 MD5_Update(&ctx
, buffer
, len
);
2581 MD5_Final(md5
, &ctx
);
2586 Generates the firmware image in factory format
2592 0000-0003 Image size (4 bytes, big endian)
2593 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
2594 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
2595 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
2596 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
2597 1014-1813 Image partition table (2048 bytes, padded with 0xff)
2598 1814-xxxx Firmware partitions
2600 static void * generate_factory_image(struct device_info
*info
, const struct image_partition_entry
*parts
, size_t *len
) {
2604 for (i
= 0; parts
[i
].name
; i
++)
2605 *len
+= parts
[i
].size
;
2607 uint8_t *image
= malloc(*len
);
2609 error(1, errno
, "malloc");
2611 memset(image
, 0xff, *len
);
2615 size_t vendor_len
= strlen(info
->vendor
);
2616 put32(image
+0x14, vendor_len
);
2617 memcpy(image
+0x18, info
->vendor
, vendor_len
);
2620 put_partitions(image
+ 0x1014, info
->partitions
, parts
);
2621 put_md5(image
+0x04, image
+0x14, *len
-0x14);
2627 Generates the firmware image in sysupgrade format
2629 This makes some assumptions about the provided flash and image partition tables and
2630 should be generalized when TP-LINK starts building its safeloader into hardware with
2631 different flash layouts.
2633 static void * generate_sysupgrade_image(struct device_info
*info
, const struct image_partition_entry
*image_parts
, size_t *len
) {
2635 size_t flash_first_partition_index
= 0;
2636 size_t flash_last_partition_index
= 0;
2637 const struct flash_partition_entry
*flash_first_partition
= NULL
;
2638 const struct flash_partition_entry
*flash_last_partition
= NULL
;
2639 const struct image_partition_entry
*image_last_partition
= NULL
;
2641 /** Find first and last partitions */
2642 for (i
= 0; info
->partitions
[i
].name
; i
++) {
2643 if (!strcmp(info
->partitions
[i
].name
, info
->first_sysupgrade_partition
)) {
2644 flash_first_partition
= &info
->partitions
[i
];
2645 flash_first_partition_index
= i
;
2646 } else if (!strcmp(info
->partitions
[i
].name
, info
->last_sysupgrade_partition
)) {
2647 flash_last_partition
= &info
->partitions
[i
];
2648 flash_last_partition_index
= i
;
2652 assert(flash_first_partition
&& flash_last_partition
);
2653 assert(flash_first_partition_index
< flash_last_partition_index
);
2655 /** Find last partition from image to calculate needed size */
2656 for (i
= 0; image_parts
[i
].name
; i
++) {
2657 if (!strcmp(image_parts
[i
].name
, info
->last_sysupgrade_partition
)) {
2658 image_last_partition
= &image_parts
[i
];
2663 assert(image_last_partition
);
2665 *len
= flash_last_partition
->base
- flash_first_partition
->base
+ image_last_partition
->size
;
2667 uint8_t *image
= malloc(*len
);
2669 error(1, errno
, "malloc");
2671 memset(image
, 0xff, *len
);
2673 for (i
= flash_first_partition_index
; i
<= flash_last_partition_index
; i
++) {
2674 for (j
= 0; image_parts
[j
].name
; j
++) {
2675 if (!strcmp(info
->partitions
[i
].name
, image_parts
[j
].name
)) {
2676 if (image_parts
[j
].size
> info
->partitions
[i
].size
)
2677 error(1, 0, "%s partition too big (more than %u bytes)", info
->partitions
[i
].name
, (unsigned)info
->partitions
[i
].size
);
2678 memcpy(image
+ info
->partitions
[i
].base
- flash_first_partition
->base
, image_parts
[j
].data
, image_parts
[j
].size
);
2682 assert(image_parts
[j
].name
);
2689 /** Generates an image according to a given layout and writes it to a file */
2690 static void build_image(const char *output
,
2691 const char *kernel_image
,
2692 const char *rootfs_image
,
2696 struct device_info
*info
) {
2700 struct image_partition_entry parts
[7] = {};
2702 struct flash_partition_entry
*firmware_partition
= NULL
;
2703 struct flash_partition_entry
*os_image_partition
= NULL
;
2704 struct flash_partition_entry
*file_system_partition
= NULL
;
2705 size_t firmware_partition_index
= 0;
2707 for (i
= 0; info
->partitions
[i
].name
; i
++) {
2708 if (!strcmp(info
->partitions
[i
].name
, "firmware"))
2710 firmware_partition
= &info
->partitions
[i
];
2711 firmware_partition_index
= i
;
2715 if (firmware_partition
)
2717 os_image_partition
= &info
->partitions
[firmware_partition_index
];
2718 file_system_partition
= &info
->partitions
[firmware_partition_index
+ 1];
2721 if (stat(kernel_image
, &kernel
) < 0)
2722 error(1, errno
, "unable to stat file `%s'", kernel_image
);
2724 if (kernel
.st_size
> firmware_partition
->size
)
2725 error(1, 0, "kernel overflowed firmware partition\n");
2727 for (i
= MAX_PARTITIONS
-1; i
>= firmware_partition_index
+ 1; i
--)
2728 info
->partitions
[i
+1] = info
->partitions
[i
];
2730 file_system_partition
->name
= "file-system";
2731 file_system_partition
->base
= firmware_partition
->base
+ kernel
.st_size
;
2733 /* Align partition start to erase blocks for factory images only */
2735 file_system_partition
->base
= ALIGN(firmware_partition
->base
+ kernel
.st_size
, 0x10000);
2737 file_system_partition
->size
= firmware_partition
->size
- file_system_partition
->base
;
2739 os_image_partition
->name
= "os-image";
2740 os_image_partition
->size
= kernel
.st_size
;
2743 parts
[0] = make_partition_table(info
->partitions
);
2744 parts
[1] = make_soft_version(info
, rev
);
2745 parts
[2] = make_support_list(info
);
2746 parts
[3] = read_file("os-image", kernel_image
, false, NULL
);
2747 parts
[4] = read_file("file-system", rootfs_image
, add_jffs2_eof
, file_system_partition
);
2749 /* Some devices need the extra-para partition to accept the firmware */
2750 if (strcasecmp(info
->id
, "ARCHER-A7-V5") == 0 ||
2751 strcasecmp(info
->id
, "ARCHER-C2-V3") == 0 ||
2752 strcasecmp(info
->id
, "ARCHER-C7-V4") == 0 ||
2753 strcasecmp(info
->id
, "ARCHER-C7-V5") == 0 ||
2754 strcasecmp(info
->id
, "ARCHER-C25-V1") == 0 ||
2755 strcasecmp(info
->id
, "ARCHER-C59-V2") == 0 ||
2756 strcasecmp(info
->id
, "ARCHER-C60-V2") == 0 ||
2757 strcasecmp(info
->id
, "ARCHER-C60-V3") == 0 ||
2758 strcasecmp(info
->id
, "TLWR1043NV5") == 0) {
2759 const uint8_t extra_para
[2] = {0x01, 0x00};
2760 parts
[5] = make_extra_para(info
, extra_para
,
2761 sizeof(extra_para
));
2762 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2") == 0) {
2763 const uint8_t extra_para
[2] = {0x00, 0x01};
2764 parts
[5] = make_extra_para(info
, extra_para
,
2765 sizeof(extra_para
));
2766 } else if (strcasecmp(info
->id
, "ARCHER-C6-V2-US") == 0 ||
2767 strcasecmp(info
->id
, "EAP245-V3") == 0) {
2768 const uint8_t extra_para
[2] = {0x01, 0x01};
2769 parts
[5] = make_extra_para(info
, extra_para
,
2770 sizeof(extra_para
));
2776 image
= generate_sysupgrade_image(info
, parts
, &len
);
2778 image
= generate_factory_image(info
, parts
, &len
);
2780 FILE *file
= fopen(output
, "wb");
2782 error(1, errno
, "unable to open output file");
2784 if (fwrite(image
, len
, 1, file
) != 1)
2785 error(1, 0, "unable to write output file");
2791 for (i
= 0; parts
[i
].name
; i
++)
2792 free_image_partition(parts
[i
]);
2796 static void usage(const char *argv0
) {
2798 "Usage: %s [OPTIONS...]\n"
2801 " -h show this help\n"
2803 "Create a new image:\n"
2804 " -B <board> create image for the board specified with <board>\n"
2805 " -k <file> read kernel image from the file <file>\n"
2806 " -r <file> read rootfs image from the file <file>\n"
2807 " -o <file> write output to the file <file>\n"
2808 " -V <rev> sets the revision number to <rev>\n"
2809 " -j add jffs2 end-of-filesystem markers\n"
2810 " -S create sysupgrade instead of factory image\n"
2811 "Extract an old image:\n"
2812 " -x <file> extract all oem firmware partition\n"
2813 " -d <dir> destination to extract the firmware partition\n"
2814 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
2820 static struct device_info
*find_board(const char *id
)
2822 struct device_info
*board
= NULL
;
2824 for (board
= boards
; board
->id
!= NULL
; board
++)
2825 if (strcasecmp(id
, board
->id
) == 0)
2831 static int add_flash_partition(
2832 struct flash_partition_entry
*part_list
,
2839 /* check if the list has a free entry */
2840 for (ptr
= 0; ptr
< max_entries
; ptr
++, part_list
++) {
2841 if (part_list
->name
== NULL
&&
2842 part_list
->base
== 0 &&
2843 part_list
->size
== 0)
2847 if (ptr
== max_entries
) {
2848 error(1, 0, "No free flash part entry available.");
2851 part_list
->name
= calloc(1, strlen(name
) + 1);
2852 if (!part_list
->name
) {
2853 error(1, 0, "Unable to allocate memory");
2856 memcpy((char *)part_list
->name
, name
, strlen(name
));
2857 part_list
->base
= base
;
2858 part_list
->size
= size
;
2863 /** read the partition table into struct flash_partition_entry */
2864 static int read_partition_table(
2865 FILE *file
, long offset
,
2866 struct flash_partition_entry
*entries
, size_t max_entries
,
2871 const char *parthdr
= NULL
;
2872 const char *fwuphdr
= "fwup-ptn";
2873 const char *flashhdr
= "partition";
2875 /* TODO: search for the partition table */
2885 error(1, 0, "Invalid partition table");
2888 if (fseek(file
, offset
, SEEK_SET
) < 0)
2889 error(1, errno
, "Can not seek in the firmware");
2891 if (fread(buf
, 2048, 1, file
) != 1)
2892 error(1, errno
, "Can not read fwup-ptn from the firmware");
2896 /* look for the partition header */
2897 if (memcmp(buf
, parthdr
, strlen(parthdr
)) != 0) {
2898 fprintf(stderr
, "DEBUG: can not find fwuphdr\n");
2903 end
= buf
+ sizeof(buf
);
2904 while ((ptr
+ strlen(parthdr
)) < end
&&
2905 memcmp(ptr
, parthdr
, strlen(parthdr
)) == 0) {
2909 char name
[32] = { 0 };
2911 unsigned long base
= 0;
2912 unsigned long size
= 0;
2914 end_part
= memchr(ptr
, '\n', (end
- ptr
));
2915 if (end_part
== NULL
) {
2916 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
2920 for (int i
= 0; i
<= 4; i
++) {
2921 if (end_part
<= ptr
)
2924 end_element
= memchr(ptr
, 0x20, (end_part
- ptr
));
2925 if (end_element
== NULL
) {
2926 error(1, errno
, "Ignoring the rest of the partition entries.");
2931 /* partition header */
2933 ptr
= end_element
+ 1;
2937 name_len
= (end_element
- ptr
) > 31 ? 31 : (end_element
- ptr
);
2938 strncpy(name
, ptr
, name_len
);
2939 name
[name_len
] = '\0';
2940 ptr
= end_element
+ 1;
2945 ptr
= end_element
+ 1;
2950 base
= strtoul(ptr
, NULL
, 16);
2951 ptr
= end_element
+ 1;
2956 ptr
= end_element
+ 1;
2957 /* actual size. The last element doesn't have a sepeartor */
2958 size
= strtoul(ptr
, NULL
, 16);
2959 /* the part ends with 0x09, 0x0d, 0x0a */
2961 add_flash_partition(entries
, max_entries
, name
, base
, size
);
2970 static void write_partition(
2972 size_t firmware_offset
,
2973 struct flash_partition_entry
*entry
,
2979 fseek(input_file
, entry
->base
+ firmware_offset
, SEEK_SET
);
2981 for (offset
= 0; sizeof(buf
) + offset
<= entry
->size
; offset
+= sizeof(buf
)) {
2982 if (fread(buf
, sizeof(buf
), 1, input_file
) != 1)
2983 error(1, errno
, "Can not read partition from input_file");
2985 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
2986 error(1, errno
, "Can not write partition to output_file");
2988 /* write last chunk smaller than buffer */
2989 if (offset
< entry
->size
) {
2990 offset
= entry
->size
- offset
;
2991 if (fread(buf
, offset
, 1, input_file
) != 1)
2992 error(1, errno
, "Can not read partition from input_file");
2993 if (fwrite(buf
, offset
, 1, output_file
) != 1)
2994 error(1, errno
, "Can not write partition to output_file");
2998 static int extract_firmware_partition(FILE *input_file
, size_t firmware_offset
, struct flash_partition_entry
*entry
, const char *output_directory
)
3001 char output
[PATH_MAX
];
3003 snprintf(output
, PATH_MAX
, "%s/%s", output_directory
, entry
->name
);
3004 output_file
= fopen(output
, "wb+");
3005 if (output_file
== NULL
) {
3006 error(1, errno
, "Can not open output file %s", output
);
3009 write_partition(input_file
, firmware_offset
, entry
, output_file
);
3011 fclose(output_file
);
3016 /** extract all partitions from the firmware file */
3017 static int extract_firmware(const char *input
, const char *output_directory
)
3019 struct flash_partition_entry entries
[16] = { 0 };
3020 size_t max_entries
= 16;
3021 size_t firmware_offset
= 0x1014;
3024 struct stat statbuf
;
3026 /* check input file */
3027 if (stat(input
, &statbuf
)) {
3028 error(1, errno
, "Can not read input firmware %s", input
);
3031 /* check if output directory exists */
3032 if (stat(output_directory
, &statbuf
)) {
3033 error(1, errno
, "Failed to stat output directory %s", output_directory
);
3036 if ((statbuf
.st_mode
& S_IFMT
) != S_IFDIR
) {
3037 error(1, errno
, "Given output directory is not a directory %s", output_directory
);
3040 input_file
= fopen(input
, "rb");
3042 if (read_partition_table(input_file
, firmware_offset
, entries
, 16, 0) != 0) {
3043 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3046 for (size_t i
= 0; i
< max_entries
; i
++) {
3047 if (entries
[i
].name
== NULL
&&
3048 entries
[i
].base
== 0 &&
3049 entries
[i
].size
== 0)
3052 extract_firmware_partition(input_file
, firmware_offset
, &entries
[i
], output_directory
);
3058 static struct flash_partition_entry
*find_partition(
3059 struct flash_partition_entry
*entries
, size_t max_entries
,
3060 const char *name
, const char *error_msg
)
3062 for (size_t i
= 0; i
< max_entries
; i
++, entries
++) {
3063 if (strcmp(entries
->name
, name
) == 0)
3067 error(1, 0, "%s", error_msg
);
3071 static void write_ff(FILE *output_file
, size_t size
)
3076 memset(buf
, 0xff, sizeof(buf
));
3078 for (offset
= 0; offset
+ sizeof(buf
) < size
; offset
+= sizeof(buf
)) {
3079 if (fwrite(buf
, sizeof(buf
), 1, output_file
) != 1)
3080 error(1, errno
, "Can not write 0xff to output_file");
3083 /* write last chunk smaller than buffer */
3084 if (offset
< size
) {
3085 offset
= size
- offset
;
3086 if (fwrite(buf
, offset
, 1, output_file
) != 1)
3087 error(1, errno
, "Can not write partition to output_file");
3091 static void convert_firmware(const char *input
, const char *output
)
3093 struct flash_partition_entry fwup
[MAX_PARTITIONS
] = { 0 };
3094 struct flash_partition_entry flash
[MAX_PARTITIONS
] = { 0 };
3095 struct flash_partition_entry
*fwup_os_image
= NULL
, *fwup_file_system
= NULL
;
3096 struct flash_partition_entry
*flash_os_image
= NULL
, *flash_file_system
= NULL
;
3097 struct flash_partition_entry
*fwup_partition_table
= NULL
;
3098 size_t firmware_offset
= 0x1014;
3099 FILE *input_file
, *output_file
;
3101 struct stat statbuf
;
3103 /* check input file */
3104 if (stat(input
, &statbuf
)) {
3105 error(1, errno
, "Can not read input firmware %s", input
);
3108 input_file
= fopen(input
, "rb");
3110 error(1, 0, "Can not open input firmware %s", input
);
3112 output_file
= fopen(output
, "wb");
3114 error(1, 0, "Can not open output firmware %s", output
);
3116 if (read_partition_table(input_file
, firmware_offset
, fwup
, MAX_PARTITIONS
, 0) != 0) {
3117 error(1, 0, "Error can not read the partition table (fwup-ptn)");
3120 fwup_os_image
= find_partition(fwup
, MAX_PARTITIONS
,
3121 "os-image", "Error can not find os-image partition (fwup)");
3122 fwup_file_system
= find_partition(fwup
, MAX_PARTITIONS
,
3123 "file-system", "Error can not find file-system partition (fwup)");
3124 fwup_partition_table
= find_partition(fwup
, MAX_PARTITIONS
,
3125 "partition-table", "Error can not find partition-table partition");
3127 /* the flash partition table has a 0x00000004 magic haeder */
3128 if (read_partition_table(input_file
, firmware_offset
+ fwup_partition_table
->base
+ 4, flash
, MAX_PARTITIONS
, 1) != 0)
3129 error(1, 0, "Error can not read the partition table (flash)");
3131 flash_os_image
= find_partition(flash
, MAX_PARTITIONS
,
3132 "os-image", "Error can not find os-image partition (flash)");
3133 flash_file_system
= find_partition(flash
, MAX_PARTITIONS
,
3134 "file-system", "Error can not find file-system partition (flash)");
3136 /* write os_image to 0x0 */
3137 write_partition(input_file
, firmware_offset
, fwup_os_image
, output_file
);
3138 write_ff(output_file
, flash_os_image
->size
- fwup_os_image
->size
);
3140 /* write file-system behind os_image */
3141 fseek(output_file
, flash_file_system
->base
- flash_os_image
->base
, SEEK_SET
);
3142 write_partition(input_file
, firmware_offset
, fwup_file_system
, output_file
);
3143 write_ff(output_file
, flash_file_system
->size
- fwup_file_system
->size
);
3145 fclose(output_file
);
3149 int main(int argc
, char *argv
[]) {
3150 const char *board
= NULL
, *kernel_image
= NULL
, *rootfs_image
= NULL
, *output
= NULL
;
3151 const char *extract_image
= NULL
, *output_directory
= NULL
, *convert_image
= NULL
;
3152 bool add_jffs2_eof
= false, sysupgrade
= false;
3154 struct device_info
*info
;
3155 set_source_date_epoch();
3160 c
= getopt(argc
, argv
, "B:k:r:o:V:jSh:x:d:z:");
3170 kernel_image
= optarg
;
3174 rootfs_image
= optarg
;
3182 sscanf(optarg
, "r%u", &rev
);
3186 add_jffs2_eof
= true;
3198 output_directory
= optarg
;
3202 extract_image
= optarg
;
3206 convert_image
= optarg
;
3215 if (extract_image
|| output_directory
) {
3217 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
3218 if (!output_directory
)
3219 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
3220 extract_firmware(extract_image
, output_directory
);
3221 } else if (convert_image
) {
3223 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
3224 convert_firmware(convert_image
, output
);
3227 error(1, 0, "no board has been specified");
3229 error(1, 0, "no kernel image has been specified");
3231 error(1, 0, "no rootfs image has been specified");
3233 error(1, 0, "no output filename has been specified");
3235 info
= find_board(board
);
3238 error(1, 0, "unsupported board %s", board
);
3240 build_image(output
, kernel_image
, rootfs_image
, rev
, add_jffs2_eof
, sysupgrade
, info
);