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"
434 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
435 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
436 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
441 {"fs-uboot", 0x00000, 0x20000},
442 {"partition-table", 0x20000, 0x02000},
443 {"default-mac", 0x30000, 0x00020},
444 {"product-info", 0x31100, 0x00100},
445 {"signature", 0x32000, 0x00400},
446 {"os-image", 0x40000, 0x300000},
447 {"file-system", 0x340000, 0x470000},
448 {"soft-version", 0x7b0000, 0x00100},
449 {"support-list", 0x7b1000, 0x00400},
450 {"user-config", 0x7c0000, 0x10000},
451 {"default-config", 0x7d0000, 0x10000},
452 {"log", 0x7e0000, 0x10000},
453 {"radio", 0x7f0000, 0x10000},
457 .first_sysupgrade_partition
= "os-image",
458 .last_sysupgrade_partition
= "support-list",
461 /** Firmware layout for the CPE610V1 */
464 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
467 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
468 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
469 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
470 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
471 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
472 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
473 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
474 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
475 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
476 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
481 {"fs-uboot", 0x00000, 0x20000},
482 {"partition-table", 0x20000, 0x02000},
483 {"default-mac", 0x30000, 0x00020},
484 {"product-info", 0x31100, 0x00100},
485 {"signature", 0x32000, 0x00400},
486 {"os-image", 0x40000, 0x300000},
487 {"file-system", 0x340000, 0x470000},
488 {"soft-version", 0x7b0000, 0x00100},
489 {"support-list", 0x7b1000, 0x00400},
490 {"user-config", 0x7c0000, 0x10000},
491 {"default-config", 0x7d0000, 0x10000},
492 {"log", 0x7e0000, 0x10000},
493 {"radio", 0x7f0000, 0x10000},
497 .first_sysupgrade_partition
= "os-image",
498 .last_sysupgrade_partition
= "support-list",
501 /** Firmware layout for the CPE610V2 */
504 .vendor
= "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
507 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
508 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
509 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
510 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
511 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
512 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
513 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
514 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
515 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
516 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
521 {"fs-uboot", 0x00000, 0x20000},
522 {"partition-table", 0x20000, 0x02000},
523 {"default-mac", 0x30000, 0x00020},
524 {"product-info", 0x31100, 0x00100},
525 {"signature", 0x32000, 0x00400},
526 {"os-image", 0x40000, 0x300000},
527 {"file-system", 0x340000, 0x470000},
528 {"soft-version", 0x7b0000, 0x00100},
529 {"support-list", 0x7b1000, 0x00400},
530 {"user-config", 0x7c0000, 0x10000},
531 {"default-config", 0x7d0000, 0x10000},
532 {"log", 0x7e0000, 0x10000},
533 {"radio", 0x7f0000, 0x10000},
537 .first_sysupgrade_partition
= "os-image",
538 .last_sysupgrade_partition
= "support-list",
543 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
546 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
547 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
548 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
553 {"fs-uboot", 0x00000, 0x20000},
554 {"partition-table", 0x20000, 0x02000},
555 {"default-mac", 0x30000, 0x00020},
556 {"product-info", 0x31100, 0x00100},
557 {"signature", 0x32000, 0x00400},
558 {"os-image", 0x40000, 0x300000},
559 {"file-system", 0x340000, 0x470000},
560 {"soft-version", 0x7b0000, 0x00100},
561 {"support-list", 0x7b1000, 0x00400},
562 {"user-config", 0x7c0000, 0x10000},
563 {"default-config", 0x7d0000, 0x10000},
564 {"log", 0x7e0000, 0x10000},
565 {"radio", 0x7f0000, 0x10000},
569 .first_sysupgrade_partition
= "os-image",
570 .last_sysupgrade_partition
= "support-list",
575 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
578 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
579 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
580 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
585 {"fs-uboot", 0x00000, 0x20000},
586 {"partition-table", 0x20000, 0x02000},
587 {"default-mac", 0x30000, 0x00020},
588 {"product-info", 0x31100, 0x00100},
589 {"signature", 0x32000, 0x00400},
590 {"os-image", 0x40000, 0x300000},
591 {"file-system", 0x340000, 0x470000},
592 {"soft-version", 0x7b0000, 0x00100},
593 {"support-list", 0x7b1000, 0x00400},
594 {"user-config", 0x7c0000, 0x10000},
595 {"default-config", 0x7d0000, 0x10000},
596 {"log", 0x7e0000, 0x10000},
597 {"radio", 0x7f0000, 0x10000},
601 .first_sysupgrade_partition
= "os-image",
602 .last_sysupgrade_partition
= "support-list",
607 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
610 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
611 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
612 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
613 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
618 {"fs-uboot", 0x00000, 0x20000},
619 {"partition-table", 0x20000, 0x02000},
620 {"default-mac", 0x30000, 0x00020},
621 {"product-info", 0x31100, 0x00100},
622 {"signature", 0x32000, 0x00400},
623 {"os-image", 0x40000, 0x300000},
624 {"file-system", 0x340000, 0x470000},
625 {"soft-version", 0x7b0000, 0x00100},
626 {"support-list", 0x7b1000, 0x00400},
627 {"user-config", 0x7c0000, 0x10000},
628 {"default-config", 0x7d0000, 0x10000},
629 {"log", 0x7e0000, 0x10000},
630 {"radio", 0x7f0000, 0x10000},
634 .first_sysupgrade_partition
= "os-image",
635 .last_sysupgrade_partition
= "support-list",
640 .vendor
= "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
643 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
644 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
645 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
646 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
651 {"fs-uboot", 0x00000, 0x20000},
652 {"partition-table", 0x20000, 0x02000},
653 {"default-mac", 0x30000, 0x00020},
654 {"product-info", 0x31100, 0x00100},
655 {"signature", 0x32000, 0x00400},
656 {"os-image", 0x40000, 0x300000},
657 {"file-system", 0x340000, 0x470000},
658 {"soft-version", 0x7b0000, 0x00100},
659 {"support-list", 0x7b1000, 0x00400},
660 {"user-config", 0x7c0000, 0x10000},
661 {"default-config", 0x7d0000, 0x10000},
662 {"log", 0x7e0000, 0x10000},
663 {"radio", 0x7f0000, 0x10000},
667 .first_sysupgrade_partition
= "os-image",
668 .last_sysupgrade_partition
= "support-list",
671 /** Firmware layout for the AD7200 */
677 "{product_name:Talon AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
682 {"SBL1", 0x00000, 0x20000},
683 {"MIBIB", 0x20000, 0x20000},
684 {"SBL2", 0x40000, 0x20000},
685 {"SBL3", 0x60000, 0x30000},
686 {"DDRCONFIG", 0x90000, 0x10000},
687 {"SSD", 0xa0000, 0x10000},
688 {"TZ", 0xb0000, 0x30000},
689 {"RPM", 0xe0000, 0x20000},
690 {"fs-uboot", 0x100000, 0x70000},
691 {"uboot-env", 0x170000, 0x40000},
692 {"radio", 0x1b0000, 0x40000},
693 {"os-image", 0x1f0000, 0x400000},
694 {"file-system", 0x5f0000, 0x1900000},
695 {"default-mac", 0x1ef0000, 0x00200},
696 {"pin", 0x1ef0200, 0x00200},
697 {"device-id", 0x1ef0400, 0x00200},
698 {"product-info", 0x1ef0600, 0x0fa00},
699 {"partition-table", 0x1f00000, 0x10000},
700 {"soft-version", 0x1f10000, 0x10000},
701 {"support-list", 0x1f20000, 0x10000},
702 {"profile", 0x1f30000, 0x10000},
703 {"default-config", 0x1f40000, 0x10000},
704 {"user-config", 0x1f50000, 0x40000},
705 {"qos-db", 0x1f90000, 0x40000},
706 {"usb-config", 0x1fd0000, 0x10000},
707 {"log", 0x1fe0000, 0x20000},
711 .first_sysupgrade_partition
= "os-image",
712 .last_sysupgrade_partition
= "file-system"
715 /** Firmware layout for the C2600 */
721 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
726 We use a bigger os-image partition than the stock images (and thus
727 smaller file-system), as our kernel doesn't fit in the stock firmware's
728 2 MB os-image since kernel 4.14.
731 {"SBL1", 0x00000, 0x20000},
732 {"MIBIB", 0x20000, 0x20000},
733 {"SBL2", 0x40000, 0x20000},
734 {"SBL3", 0x60000, 0x30000},
735 {"DDRCONFIG", 0x90000, 0x10000},
736 {"SSD", 0xa0000, 0x10000},
737 {"TZ", 0xb0000, 0x30000},
738 {"RPM", 0xe0000, 0x20000},
739 {"fs-uboot", 0x100000, 0x70000},
740 {"uboot-env", 0x170000, 0x40000},
741 {"radio", 0x1b0000, 0x40000},
742 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
743 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
744 {"default-mac", 0x1ef0000, 0x00200},
745 {"pin", 0x1ef0200, 0x00200},
746 {"product-info", 0x1ef0400, 0x0fc00},
747 {"partition-table", 0x1f00000, 0x10000},
748 {"soft-version", 0x1f10000, 0x10000},
749 {"support-list", 0x1f20000, 0x10000},
750 {"profile", 0x1f30000, 0x10000},
751 {"default-config", 0x1f40000, 0x10000},
752 {"user-config", 0x1f50000, 0x40000},
753 {"qos-db", 0x1f90000, 0x40000},
754 {"usb-config", 0x1fd0000, 0x10000},
755 {"log", 0x1fe0000, 0x20000},
759 .first_sysupgrade_partition
= "os-image",
760 .last_sysupgrade_partition
= "file-system"
763 /** Firmware layout for the A7-V5 */
765 .id
= "ARCHER-A7-V5",
768 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
769 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
770 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
771 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
772 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n",
774 .soft_ver
= "soft_ver:1.0.0\n",
776 /* We're using a dynamic kernel/rootfs split here */
778 {"factory-boot", 0x00000, 0x20000},
779 {"fs-uboot", 0x20000, 0x20000},
780 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
781 /* Stock: name file-system base 0x160000 size 0xda0000 */
782 {"default-mac", 0xf40000, 0x00200},
783 {"pin", 0xf40200, 0x00200},
784 {"device-id", 0xf40400, 0x00100},
785 {"product-info", 0xf40500, 0x0fb00},
786 {"soft-version", 0xf50000, 0x00100},
787 {"extra-para", 0xf51000, 0x01000},
788 {"support-list", 0xf52000, 0x0a000},
789 {"profile", 0xf5c000, 0x04000},
790 {"default-config", 0xf60000, 0x10000},
791 {"user-config", 0xf70000, 0x40000},
792 {"certificate", 0xfb0000, 0x10000},
793 {"partition-table", 0xfc0000, 0x10000},
794 {"log", 0xfd0000, 0x20000},
795 {"radio", 0xff0000, 0x10000},
799 .first_sysupgrade_partition
= "os-image",
800 .last_sysupgrade_partition
= "file-system",
803 /** Firmware layout for the C2v3 */
805 .id
= "ARCHER-C2-V3",
808 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
809 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
810 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
812 .soft_ver
= "soft_ver:3.0.1\n",
814 /** We're using a dynamic kernel/rootfs split here */
817 {"factory-boot", 0x00000, 0x20000},
818 {"fs-uboot", 0x20000, 0x10000},
819 {"firmware", 0x30000, 0x7a0000},
820 {"user-config", 0x7d0000, 0x04000},
821 {"default-mac", 0x7e0000, 0x00100},
822 {"device-id", 0x7e0100, 0x00100},
823 {"extra-para", 0x7e0200, 0x00100},
824 {"pin", 0x7e0300, 0x00100},
825 {"support-list", 0x7e0400, 0x00400},
826 {"soft-version", 0x7e0800, 0x00400},
827 {"product-info", 0x7e0c00, 0x01400},
828 {"partition-table", 0x7e2000, 0x01000},
829 {"profile", 0x7e3000, 0x01000},
830 {"default-config", 0x7e4000, 0x04000},
831 {"merge-config", 0x7ec000, 0x02000},
832 {"qos-db", 0x7ee000, 0x02000},
833 {"radio", 0x7f0000, 0x10000},
837 .first_sysupgrade_partition
= "os-image",
838 .last_sysupgrade_partition
= "file-system",
841 /** Firmware layout for the C25v1 */
843 .id
= "ARCHER-C25-V1",
846 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
847 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
848 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
850 .soft_ver
= "soft_ver:1.0.0\n",
852 /* We're using a dynamic kernel/rootfs split here */
854 {"factory-boot", 0x00000, 0x20000},
855 {"fs-uboot", 0x20000, 0x10000},
856 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
857 /* Stock: name file-system base 0x130000 size 0x6a0000 */
858 {"user-config", 0x7d0000, 0x04000},
859 {"default-mac", 0x7e0000, 0x00100},
860 {"device-id", 0x7e0100, 0x00100},
861 {"extra-para", 0x7e0200, 0x00100},
862 {"pin", 0x7e0300, 0x00100},
863 {"support-list", 0x7e0400, 0x00400},
864 {"soft-version", 0x7e0800, 0x00400},
865 {"product-info", 0x7e0c00, 0x01400},
866 {"partition-table", 0x7e2000, 0x01000},
867 {"profile", 0x7e3000, 0x01000},
868 {"default-config", 0x7e4000, 0x04000},
869 {"merge-config", 0x7ec000, 0x02000},
870 {"qos-db", 0x7ee000, 0x02000},
871 {"radio", 0x7f0000, 0x10000},
875 .first_sysupgrade_partition
= "os-image",
876 .last_sysupgrade_partition
= "file-system",
879 /** Firmware layout for the C58v1 */
881 .id
= "ARCHER-C58-V1",
885 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
886 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
887 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
889 .soft_ver
= "soft_ver:1.0.0\n",
892 {"fs-uboot", 0x00000, 0x10000},
893 {"default-mac", 0x10000, 0x00200},
894 {"pin", 0x10200, 0x00200},
895 {"product-info", 0x10400, 0x00100},
896 {"partition-table", 0x10500, 0x00800},
897 {"soft-version", 0x11300, 0x00200},
898 {"support-list", 0x11500, 0x00100},
899 {"device-id", 0x11600, 0x00100},
900 {"profile", 0x11700, 0x03900},
901 {"default-config", 0x15000, 0x04000},
902 {"user-config", 0x19000, 0x04000},
903 {"firmware", 0x20000, 0x7c8000},
904 {"certyficate", 0x7e8000, 0x08000},
905 {"radio", 0x7f0000, 0x10000},
909 .first_sysupgrade_partition
= "os-image",
910 .last_sysupgrade_partition
= "file-system",
913 /** Firmware layout for the C59v1 */
915 .id
= "ARCHER-C59-V1",
919 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
920 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
921 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
922 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
924 .soft_ver
= "soft_ver:1.0.0\n",
926 /* We're using a dynamic kernel/rootfs split here */
928 {"fs-uboot", 0x00000, 0x10000},
929 {"default-mac", 0x10000, 0x00200},
930 {"pin", 0x10200, 0x00200},
931 {"device-id", 0x10400, 0x00100},
932 {"product-info", 0x10500, 0x0fb00},
933 {"firmware", 0x20000, 0xe30000},
934 {"partition-table", 0xe50000, 0x10000},
935 {"soft-version", 0xe60000, 0x10000},
936 {"support-list", 0xe70000, 0x10000},
937 {"profile", 0xe80000, 0x10000},
938 {"default-config", 0xe90000, 0x10000},
939 {"user-config", 0xea0000, 0x40000},
940 {"usb-config", 0xee0000, 0x10000},
941 {"certificate", 0xef0000, 0x10000},
942 {"qos-db", 0xf00000, 0x40000},
943 {"log", 0xfe0000, 0x10000},
944 {"radio", 0xff0000, 0x10000},
948 .first_sysupgrade_partition
= "os-image",
949 .last_sysupgrade_partition
= "file-system",
952 /** Firmware layout for the C59v2 */
954 .id
= "ARCHER-C59-V2",
958 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
959 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
960 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
962 .soft_ver
= "soft_ver:2.0.0 Build 20161206 rel.7303\n",
964 /** We're using a dynamic kernel/rootfs split here */
966 {"factory-boot", 0x00000, 0x20000},
967 {"fs-uboot", 0x20000, 0x10000},
968 {"default-mac", 0x30000, 0x00200},
969 {"pin", 0x30200, 0x00200},
970 {"device-id", 0x30400, 0x00100},
971 {"product-info", 0x30500, 0x0fb00},
972 {"firmware", 0x40000, 0xe10000},
973 {"partition-table", 0xe50000, 0x10000},
974 {"soft-version", 0xe60000, 0x10000},
975 {"support-list", 0xe70000, 0x10000},
976 {"profile", 0xe80000, 0x10000},
977 {"default-config", 0xe90000, 0x10000},
978 {"user-config", 0xea0000, 0x40000},
979 {"usb-config", 0xee0000, 0x10000},
980 {"certificate", 0xef0000, 0x10000},
981 {"extra-para", 0xf00000, 0x10000},
982 {"qos-db", 0xf10000, 0x30000},
983 {"log", 0xfe0000, 0x10000},
984 {"radio", 0xff0000, 0x10000},
988 .first_sysupgrade_partition
= "os-image",
989 .last_sysupgrade_partition
= "file-system",
992 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
994 .id
= "ARCHER-C6-V2",
998 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
999 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1000 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1002 .soft_ver
= "soft_ver:1.9.1\n",
1005 {"fs-uboot", 0x00000, 0x20000},
1006 {"default-mac", 0x20000, 0x00200},
1007 {"pin", 0x20200, 0x00100},
1008 {"product-info", 0x20300, 0x00200},
1009 {"device-id", 0x20500, 0x0fb00},
1010 {"firmware", 0x30000, 0x7a9400},
1011 {"soft-version", 0x7d9400, 0x00100},
1012 {"extra-para", 0x7d9500, 0x00100},
1013 {"support-list", 0x7d9600, 0x00200},
1014 {"profile", 0x7d9800, 0x03000},
1015 {"default-config", 0x7dc800, 0x03000},
1016 {"partition-table", 0x7df800, 0x00800},
1017 {"user-config", 0x7e0000, 0x0c000},
1018 {"certificate", 0x7ec000, 0x04000},
1019 {"radio", 0x7f0000, 0x10000},
1023 .first_sysupgrade_partition
= "os-image",
1024 .last_sysupgrade_partition
= "file-system",
1027 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1029 .id
= "ARCHER-C6-V2-US",
1033 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1034 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1035 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1037 .soft_ver
= "soft_ver:1.9.1\n",
1040 {"factory-boot", 0x00000, 0x20000},
1041 {"default-mac", 0x20000, 0x00200},
1042 {"pin", 0x20200, 0x00100},
1043 {"product-info", 0x20300, 0x00200},
1044 {"device-id", 0x20500, 0x0fb00},
1045 {"fs-uboot", 0x30000, 0x20000},
1046 {"firmware", 0x50000, 0xf89400},
1047 {"soft-version", 0xfd9400, 0x00100},
1048 {"extra-para", 0xfd9500, 0x00100},
1049 {"support-list", 0xfd9600, 0x00200},
1050 {"profile", 0xfd9800, 0x03000},
1051 {"default-config", 0xfdc800, 0x03000},
1052 {"partition-table", 0xfdf800, 0x00800},
1053 {"user-config", 0xfe0000, 0x0c000},
1054 {"certificate", 0xfec000, 0x04000},
1055 {"radio", 0xff0000, 0x10000},
1058 .first_sysupgrade_partition
= "os-image",
1059 .last_sysupgrade_partition
= "file-system",
1062 /** Firmware layout for the C60v1 */
1064 .id
= "ARCHER-C60-V1",
1068 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1069 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1070 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1072 .soft_ver
= "soft_ver:1.0.0\n",
1075 {"fs-uboot", 0x00000, 0x10000},
1076 {"default-mac", 0x10000, 0x00200},
1077 {"pin", 0x10200, 0x00200},
1078 {"product-info", 0x10400, 0x00100},
1079 {"partition-table", 0x10500, 0x00800},
1080 {"soft-version", 0x11300, 0x00200},
1081 {"support-list", 0x11500, 0x00100},
1082 {"device-id", 0x11600, 0x00100},
1083 {"profile", 0x11700, 0x03900},
1084 {"default-config", 0x15000, 0x04000},
1085 {"user-config", 0x19000, 0x04000},
1086 {"firmware", 0x20000, 0x7c8000},
1087 {"certyficate", 0x7e8000, 0x08000},
1088 {"radio", 0x7f0000, 0x10000},
1092 .first_sysupgrade_partition
= "os-image",
1093 .last_sysupgrade_partition
= "file-system",
1096 /** Firmware layout for the C60v2 */
1098 .id
= "ARCHER-C60-V2",
1102 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1103 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1104 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1106 .soft_ver
= "soft_ver:2.0.0\n",
1109 {"factory-boot", 0x00000, 0x1fb00},
1110 {"default-mac", 0x1fb00, 0x00200},
1111 {"pin", 0x1fd00, 0x00100},
1112 {"product-info", 0x1fe00, 0x00100},
1113 {"device-id", 0x1ff00, 0x00100},
1114 {"fs-uboot", 0x20000, 0x10000},
1115 {"firmware", 0x30000, 0x7a0000},
1116 {"soft-version", 0x7d9500, 0x00100},
1117 {"support-list", 0x7d9600, 0x00100},
1118 {"extra-para", 0x7d9700, 0x00100},
1119 {"profile", 0x7d9800, 0x03000},
1120 {"default-config", 0x7dc800, 0x03000},
1121 {"partition-table", 0x7df800, 0x00800},
1122 {"user-config", 0x7e0000, 0x0c000},
1123 {"certificate", 0x7ec000, 0x04000},
1124 {"radio", 0x7f0000, 0x10000},
1128 .first_sysupgrade_partition
= "os-image",
1129 .last_sysupgrade_partition
= "file-system",
1132 /** Firmware layout for the C60v3 */
1134 .id
= "ARCHER-C60-V3",
1138 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1139 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1140 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1142 .soft_ver
= "soft_ver:3.0.0\n",
1145 {"factory-boot", 0x00000, 0x1fb00},
1146 {"default-mac", 0x1fb00, 0x00200},
1147 {"pin", 0x1fd00, 0x00100},
1148 {"product-info", 0x1fe00, 0x00100},
1149 {"device-id", 0x1ff00, 0x00100},
1150 {"fs-uboot", 0x20000, 0x10000},
1151 {"firmware", 0x30000, 0x7a0000},
1152 {"soft-version", 0x7d9500, 0x00100},
1153 {"support-list", 0x7d9600, 0x00100},
1154 {"extra-para", 0x7d9700, 0x00100},
1155 {"profile", 0x7d9800, 0x03000},
1156 {"default-config", 0x7dc800, 0x03000},
1157 {"partition-table", 0x7df800, 0x00800},
1158 {"user-config", 0x7e0000, 0x0c000},
1159 {"certificate", 0x7ec000, 0x04000},
1160 {"radio", 0x7f0000, 0x10000},
1164 .first_sysupgrade_partition
= "os-image",
1165 .last_sysupgrade_partition
= "file-system",
1168 /** Firmware layout for the C5 */
1170 .id
= "ARCHER-C5-V2",
1174 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1175 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1176 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1181 {"fs-uboot", 0x00000, 0x40000},
1182 {"os-image", 0x40000, 0x200000},
1183 {"file-system", 0x240000, 0xc00000},
1184 {"default-mac", 0xe40000, 0x00200},
1185 {"pin", 0xe40200, 0x00200},
1186 {"product-info", 0xe40400, 0x00200},
1187 {"partition-table", 0xe50000, 0x10000},
1188 {"soft-version", 0xe60000, 0x00200},
1189 {"support-list", 0xe61000, 0x0f000},
1190 {"profile", 0xe70000, 0x10000},
1191 {"default-config", 0xe80000, 0x10000},
1192 {"user-config", 0xe90000, 0x50000},
1193 {"log", 0xee0000, 0x100000},
1194 {"radio_bk", 0xfe0000, 0x10000},
1195 {"radio", 0xff0000, 0x10000},
1199 .first_sysupgrade_partition
= "os-image",
1200 .last_sysupgrade_partition
= "file-system"
1203 /** Firmware layout for the C7 */
1205 .id
= "ARCHER-C7-V4",
1208 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1209 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1210 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1211 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1212 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1213 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1214 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1215 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1216 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1217 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1219 .soft_ver
= "soft_ver:1.0.0\n",
1221 /* We're using a dynamic kernel/rootfs split here */
1223 {"factory-boot", 0x00000, 0x20000},
1224 {"fs-uboot", 0x20000, 0x20000},
1225 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1226 /* Stock: name file-system base 0x160000 size 0xda0000 */
1227 {"default-mac", 0xf00000, 0x00200},
1228 {"pin", 0xf00200, 0x00200},
1229 {"device-id", 0xf00400, 0x00100},
1230 {"product-info", 0xf00500, 0x0fb00},
1231 {"soft-version", 0xf10000, 0x00100},
1232 {"extra-para", 0xf11000, 0x01000},
1233 {"support-list", 0xf12000, 0x0a000},
1234 {"profile", 0xf1c000, 0x04000},
1235 {"default-config", 0xf20000, 0x10000},
1236 {"user-config", 0xf30000, 0x40000},
1237 {"qos-db", 0xf70000, 0x40000},
1238 {"certificate", 0xfb0000, 0x10000},
1239 {"partition-table", 0xfc0000, 0x10000},
1240 {"log", 0xfd0000, 0x20000},
1241 {"radio", 0xff0000, 0x10000},
1245 .first_sysupgrade_partition
= "os-image",
1246 .last_sysupgrade_partition
= "file-system",
1249 /** Firmware layout for the C7 v5*/
1251 .id
= "ARCHER-C7-V5",
1254 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1255 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1256 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1257 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1258 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1259 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1260 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1261 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1264 .soft_ver
= "soft_ver:1.0.0\n",
1266 /* We're using a dynamic kernel/rootfs split here */
1268 {"factory-boot", 0x00000, 0x20000},
1269 {"fs-uboot", 0x20000, 0x20000},
1270 {"partition-table", 0x40000, 0x10000},
1271 {"radio", 0x50000, 0x10000},
1272 {"default-mac", 0x60000, 0x00200},
1273 {"pin", 0x60200, 0x00200},
1274 {"device-id", 0x60400, 0x00100},
1275 {"product-info", 0x60500, 0x0fb00},
1276 {"soft-version", 0x70000, 0x01000},
1277 {"extra-para", 0x71000, 0x01000},
1278 {"support-list", 0x72000, 0x0a000},
1279 {"profile", 0x7c000, 0x04000},
1280 {"user-config", 0x80000, 0x40000},
1283 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1284 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1286 {"log", 0xfc0000, 0x20000},
1287 {"certificate", 0xfe0000, 0x10000},
1288 {"default-config", 0xff0000, 0x10000},
1293 .first_sysupgrade_partition
= "os-image",
1294 .last_sysupgrade_partition
= "file-system",
1297 /** Firmware layout for the C9 */
1303 "{product_name:ArcherC9,"
1304 "product_ver:1.0.0,"
1305 "special_id:00000000}\n",
1310 {"fs-uboot", 0x00000, 0x40000},
1311 {"os-image", 0x40000, 0x200000},
1312 {"file-system", 0x240000, 0xc00000},
1313 {"default-mac", 0xe40000, 0x00200},
1314 {"pin", 0xe40200, 0x00200},
1315 {"product-info", 0xe40400, 0x00200},
1316 {"partition-table", 0xe50000, 0x10000},
1317 {"soft-version", 0xe60000, 0x00200},
1318 {"support-list", 0xe61000, 0x0f000},
1319 {"profile", 0xe70000, 0x10000},
1320 {"default-config", 0xe80000, 0x10000},
1321 {"user-config", 0xe90000, 0x50000},
1322 {"log", 0xee0000, 0x100000},
1323 {"radio_bk", 0xfe0000, 0x10000},
1324 {"radio", 0xff0000, 0x10000},
1328 .first_sysupgrade_partition
= "os-image",
1329 .last_sysupgrade_partition
= "file-system"
1332 /** Firmware layout for the EAP120 */
1335 .vendor
= "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1338 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1343 {"fs-uboot", 0x00000, 0x20000},
1344 {"partition-table", 0x20000, 0x02000},
1345 {"default-mac", 0x30000, 0x00020},
1346 {"support-list", 0x31000, 0x00100},
1347 {"product-info", 0x31100, 0x00100},
1348 {"soft-version", 0x32000, 0x00100},
1349 {"os-image", 0x40000, 0x180000},
1350 {"file-system", 0x1c0000, 0x600000},
1351 {"user-config", 0x7c0000, 0x10000},
1352 {"backup-config", 0x7d0000, 0x10000},
1353 {"log", 0x7e0000, 0x10000},
1354 {"radio", 0x7f0000, 0x10000},
1358 .first_sysupgrade_partition
= "os-image",
1359 .last_sysupgrade_partition
= "file-system"
1362 /** Firmware layout for the EAP225-Outdoor v1 */
1364 .id
= "EAP225-OUTDOOR-V1",
1367 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1368 .part_trail
= PART_TRAIL_NONE
,
1370 .soft_ver_compat_level
= 1,
1373 {"fs-uboot", 0x00000, 0x20000},
1374 {"partition-table", 0x20000, 0x02000},
1375 {"default-mac", 0x30000, 0x01000},
1376 {"support-list", 0x31000, 0x00100},
1377 {"product-info", 0x31100, 0x00400},
1378 {"soft-version", 0x32000, 0x00100},
1379 {"firmware", 0x40000, 0xd80000},
1380 {"user-config", 0xdc0000, 0x30000},
1381 {"mutil-log", 0xf30000, 0x80000},
1382 {"oops", 0xfb0000, 0x40000},
1383 {"radio", 0xff0000, 0x10000},
1387 .first_sysupgrade_partition
= "os-image",
1388 .last_sysupgrade_partition
= "file-system"
1391 /** Firmware layout for the EAP225 v3 */
1396 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n",
1397 .part_trail
= PART_TRAIL_NONE
,
1399 .soft_ver_compat_level
= 1,
1402 {"fs-uboot", 0x00000, 0x20000},
1403 {"partition-table", 0x20000, 0x02000},
1404 {"default-mac", 0x30000, 0x01000},
1405 {"support-list", 0x31000, 0x00100},
1406 {"product-info", 0x31100, 0x00400},
1407 {"soft-version", 0x32000, 0x00100},
1408 {"firmware", 0x40000, 0xd80000},
1409 {"user-config", 0xdc0000, 0x30000},
1410 {"mutil-log", 0xf30000, 0x80000},
1411 {"oops", 0xfb0000, 0x40000},
1412 {"radio", 0xff0000, 0x10000},
1416 .first_sysupgrade_partition
= "os-image",
1417 .last_sysupgrade_partition
= "file-system"
1420 /** Firmware layout for the EAP225-Wall v2 */
1422 .id
= "EAP225-WALL-V2",
1425 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1426 .part_trail
= PART_TRAIL_NONE
,
1428 .soft_ver_compat_level
= 1,
1431 {"fs-uboot", 0x00000, 0x20000},
1432 {"partition-table", 0x20000, 0x02000},
1433 {"default-mac", 0x30000, 0x01000},
1434 {"support-list", 0x31000, 0x00100},
1435 {"product-info", 0x31100, 0x00400},
1436 {"soft-version", 0x32000, 0x00100},
1437 {"firmware", 0x40000, 0xd80000},
1438 {"user-config", 0xdc0000, 0x30000},
1439 {"mutil-log", 0xf30000, 0x80000},
1440 {"oops", 0xfb0000, 0x40000},
1441 {"radio", 0xff0000, 0x10000},
1445 .first_sysupgrade_partition
= "os-image",
1446 .last_sysupgrade_partition
= "file-system"
1449 /** Firmware layout for the EAP245 v1 */
1454 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1455 .part_trail
= PART_TRAIL_NONE
,
1459 {"fs-uboot", 0x00000, 0x20000},
1460 {"partition-table", 0x20000, 0x02000},
1461 {"default-mac", 0x30000, 0x01000},
1462 {"support-list", 0x31000, 0x00100},
1463 {"product-info", 0x31100, 0x00400},
1464 {"soft-version", 0x32000, 0x00100},
1465 {"firmware", 0x40000, 0xd80000},
1466 {"user-config", 0xdc0000, 0x30000},
1467 {"radio", 0xff0000, 0x10000},
1471 .first_sysupgrade_partition
= "os-image",
1472 .last_sysupgrade_partition
= "file-system"
1475 /** Firmware layout for the EAP245 v3 */
1480 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n",
1481 .part_trail
= PART_TRAIL_NONE
,
1483 .soft_ver_compat_level
= 1,
1485 /** Firmware partition with dynamic kernel/rootfs split */
1487 {"factroy-boot", 0x00000, 0x40000},
1488 {"fs-uboot", 0x40000, 0x40000},
1489 {"partition-table", 0x80000, 0x10000},
1490 {"default-mac", 0x90000, 0x01000},
1491 {"support-list", 0x91000, 0x00100},
1492 {"product-info", 0x91100, 0x00400},
1493 {"soft-version", 0x92000, 0x00100},
1494 {"radio", 0xa0000, 0x10000},
1495 {"extra-para", 0xb0000, 0x10000},
1496 {"firmware", 0xc0000, 0xe40000},
1497 {"config", 0xf00000, 0x30000},
1498 {"mutil-log", 0xf30000, 0x80000},
1499 {"oops", 0xfb0000, 0x40000},
1503 .first_sysupgrade_partition
= "os-image",
1504 .last_sysupgrade_partition
= "file-system"
1507 /** Firmware layout for the TL-WA850RE v2 */
1509 .id
= "TLWA850REV2",
1513 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
1514 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
1515 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
1516 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
1517 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
1518 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
1519 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
1520 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
1521 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
1522 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
1527 576KB were moved from file-system to os-image
1528 in comparison to the stock image
1531 {"fs-uboot", 0x00000, 0x20000},
1532 {"firmware", 0x20000, 0x390000},
1533 {"partition-table", 0x3b0000, 0x02000},
1534 {"default-mac", 0x3c0000, 0x00020},
1535 {"pin", 0x3c0100, 0x00020},
1536 {"product-info", 0x3c1000, 0x01000},
1537 {"soft-version", 0x3c2000, 0x00100},
1538 {"support-list", 0x3c3000, 0x01000},
1539 {"profile", 0x3c4000, 0x08000},
1540 {"user-config", 0x3d0000, 0x10000},
1541 {"default-config", 0x3e0000, 0x10000},
1542 {"radio", 0x3f0000, 0x10000},
1546 .first_sysupgrade_partition
= "os-image",
1547 .last_sysupgrade_partition
= "file-system"
1550 /** Firmware layout for the TL-WA855RE v1 */
1552 .id
= "TLWA855REV1",
1556 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
1557 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
1558 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
1559 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
1560 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
1561 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
1562 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
1563 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
1564 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
1569 {"fs-uboot", 0x00000, 0x20000},
1570 {"os-image", 0x20000, 0x150000},
1571 {"file-system", 0x170000, 0x240000},
1572 {"partition-table", 0x3b0000, 0x02000},
1573 {"default-mac", 0x3c0000, 0x00020},
1574 {"pin", 0x3c0100, 0x00020},
1575 {"product-info", 0x3c1000, 0x01000},
1576 {"soft-version", 0x3c2000, 0x00100},
1577 {"support-list", 0x3c3000, 0x01000},
1578 {"profile", 0x3c4000, 0x08000},
1579 {"user-config", 0x3d0000, 0x10000},
1580 {"default-config", 0x3e0000, 0x10000},
1581 {"radio", 0x3f0000, 0x10000},
1585 .first_sysupgrade_partition
= "os-image",
1586 .last_sysupgrade_partition
= "file-system"
1589 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
1591 .id
= "TL-WPA8630P-V2.0-EU",
1595 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
1600 {"factory-uboot", 0x00000, 0x20000},
1601 {"fs-uboot", 0x20000, 0x20000},
1602 {"firmware", 0x40000, 0x5e0000},
1603 {"partition-table", 0x620000, 0x02000},
1604 {"default-mac", 0x630000, 0x00020},
1605 {"pin", 0x630100, 0x00020},
1606 {"device-id", 0x630200, 0x00030},
1607 {"product-info", 0x631100, 0x01000},
1608 {"extra-para", 0x632100, 0x01000},
1609 {"soft-version", 0x640000, 0x01000},
1610 {"support-list", 0x641000, 0x01000},
1611 {"profile", 0x642000, 0x08000},
1612 {"user-config", 0x650000, 0x10000},
1613 {"default-config", 0x660000, 0x10000},
1614 {"default-nvm", 0x670000, 0xc0000},
1615 {"default-pib", 0x730000, 0x40000},
1616 {"radio", 0x7f0000, 0x10000},
1620 .first_sysupgrade_partition
= "os-image",
1621 .last_sysupgrade_partition
= "file-system"
1624 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
1626 .id
= "TL-WPA8630P-V2-INT",
1630 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
1631 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
1632 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
1637 {"factory-uboot", 0x00000, 0x20000},
1638 {"fs-uboot", 0x20000, 0x20000},
1639 {"firmware", 0x40000, 0x5e0000},
1640 {"partition-table", 0x620000, 0x02000},
1641 {"extra-para", 0x632100, 0x01000},
1642 {"soft-version", 0x640000, 0x01000},
1643 {"support-list", 0x641000, 0x01000},
1644 {"profile", 0x642000, 0x08000},
1645 {"user-config", 0x650000, 0x10000},
1646 {"default-config", 0x660000, 0x10000},
1647 {"default-nvm", 0x670000, 0xc0000},
1648 {"default-pib", 0x730000, 0x40000},
1649 {"default-mac", 0x7e0000, 0x00020},
1650 {"pin", 0x7e0100, 0x00020},
1651 {"device-id", 0x7e0200, 0x00030},
1652 {"product-info", 0x7e1100, 0x01000},
1653 {"radio", 0x7f0000, 0x10000},
1657 .first_sysupgrade_partition
= "os-image",
1658 .last_sysupgrade_partition
= "file-system"
1661 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
1663 .id
= "TL-WPA8630P-V2.1-EU",
1667 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
1672 {"factory-uboot", 0x00000, 0x20000},
1673 {"fs-uboot", 0x20000, 0x20000},
1674 {"firmware", 0x40000, 0x5e0000},
1675 {"extra-para", 0x680000, 0x01000},
1676 {"product-info", 0x690000, 0x01000},
1677 {"partition-table", 0x6a0000, 0x02000},
1678 {"soft-version", 0x6b0000, 0x01000},
1679 {"support-list", 0x6b1000, 0x01000},
1680 {"profile", 0x6b2000, 0x08000},
1681 {"user-config", 0x6c0000, 0x10000},
1682 {"default-config", 0x6d0000, 0x10000},
1683 {"default-nvm", 0x6e0000, 0xc0000},
1684 {"default-pib", 0x7a0000, 0x40000},
1685 {"default-mac", 0x7e0000, 0x00020},
1686 {"pin", 0x7e0100, 0x00020},
1687 {"device-id", 0x7e0200, 0x00030},
1688 {"radio", 0x7f0000, 0x10000},
1692 .first_sysupgrade_partition
= "os-image",
1693 .last_sysupgrade_partition
= "file-system"
1696 /** Firmware layout for the TL-WR1043 v5 */
1698 .id
= "TLWR1043NV5",
1702 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
1703 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
1705 .soft_ver
= "soft_ver:1.0.0\n",
1707 {"factory-boot", 0x00000, 0x20000},
1708 {"fs-uboot", 0x20000, 0x20000},
1709 {"firmware", 0x40000, 0xec0000},
1710 {"default-mac", 0xf00000, 0x00200},
1711 {"pin", 0xf00200, 0x00200},
1712 {"device-id", 0xf00400, 0x00100},
1713 {"product-info", 0xf00500, 0x0fb00},
1714 {"soft-version", 0xf10000, 0x01000},
1715 {"extra-para", 0xf11000, 0x01000},
1716 {"support-list", 0xf12000, 0x0a000},
1717 {"profile", 0xf1c000, 0x04000},
1718 {"default-config", 0xf20000, 0x10000},
1719 {"user-config", 0xf30000, 0x40000},
1720 {"qos-db", 0xf70000, 0x40000},
1721 {"certificate", 0xfb0000, 0x10000},
1722 {"partition-table", 0xfc0000, 0x10000},
1723 {"log", 0xfd0000, 0x20000},
1724 {"radio", 0xff0000, 0x10000},
1727 .first_sysupgrade_partition
= "os-image",
1728 .last_sysupgrade_partition
= "file-system"
1731 /** Firmware layout for the TL-WR1043 v4 */
1733 .id
= "TLWR1043NDV4",
1737 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
1741 /* We're using a dynamic kernel/rootfs split here */
1743 {"fs-uboot", 0x00000, 0x20000},
1744 {"firmware", 0x20000, 0xf30000},
1745 {"default-mac", 0xf50000, 0x00200},
1746 {"pin", 0xf50200, 0x00200},
1747 {"product-info", 0xf50400, 0x0fc00},
1748 {"soft-version", 0xf60000, 0x0b000},
1749 {"support-list", 0xf6b000, 0x04000},
1750 {"profile", 0xf70000, 0x04000},
1751 {"default-config", 0xf74000, 0x0b000},
1752 {"user-config", 0xf80000, 0x40000},
1753 {"partition-table", 0xfc0000, 0x10000},
1754 {"log", 0xfd0000, 0x20000},
1755 {"radio", 0xff0000, 0x10000},
1759 .first_sysupgrade_partition
= "os-image",
1760 .last_sysupgrade_partition
= "file-system"
1763 /** Firmware layout for the TL-WR902AC v1 */
1765 .id
= "TL-WR902AC-V1",
1769 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
1770 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
1775 384KB were moved from file-system to os-image
1776 in comparison to the stock image
1779 {"fs-uboot", 0x00000, 0x20000},
1780 {"firmware", 0x20000, 0x730000},
1781 {"default-mac", 0x750000, 0x00200},
1782 {"pin", 0x750200, 0x00200},
1783 {"product-info", 0x750400, 0x0fc00},
1784 {"soft-version", 0x760000, 0x0b000},
1785 {"support-list", 0x76b000, 0x04000},
1786 {"profile", 0x770000, 0x04000},
1787 {"default-config", 0x774000, 0x0b000},
1788 {"user-config", 0x780000, 0x40000},
1789 {"partition-table", 0x7c0000, 0x10000},
1790 {"log", 0x7d0000, 0x20000},
1791 {"radio", 0x7f0000, 0x10000},
1795 .first_sysupgrade_partition
= "os-image",
1796 .last_sysupgrade_partition
= "file-system",
1799 /** Firmware layout for the TL-WR942N V1 */
1805 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
1806 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
1811 {"fs-uboot", 0x00000, 0x20000},
1812 {"firmware", 0x20000, 0xe20000},
1813 {"default-mac", 0xe40000, 0x00200},
1814 {"pin", 0xe40200, 0x00200},
1815 {"product-info", 0xe40400, 0x0fc00},
1816 {"partition-table", 0xe50000, 0x10000},
1817 {"soft-version", 0xe60000, 0x10000},
1818 {"support-list", 0xe70000, 0x10000},
1819 {"profile", 0xe80000, 0x10000},
1820 {"default-config", 0xe90000, 0x10000},
1821 {"user-config", 0xea0000, 0x40000},
1822 {"qos-db", 0xee0000, 0x40000},
1823 {"certificate", 0xf20000, 0x10000},
1824 {"usb-config", 0xfb0000, 0x10000},
1825 {"log", 0xfc0000, 0x20000},
1826 {"radio-bk", 0xfe0000, 0x10000},
1827 {"radio", 0xff0000, 0x10000},
1831 .first_sysupgrade_partition
= "os-image",
1832 .last_sysupgrade_partition
= "file-system",
1835 /** Firmware layout for the RE200 v2 */
1841 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
1842 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
1843 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
1844 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
1845 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
1846 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
1847 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
1848 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
1849 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
1850 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
1851 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
1852 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
1853 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
1858 {"fs-uboot", 0x00000, 0x20000},
1859 {"firmware", 0x20000, 0x7a0000},
1860 {"partition-table", 0x7c0000, 0x02000},
1861 {"default-mac", 0x7c2000, 0x00020},
1862 {"pin", 0x7c2100, 0x00020},
1863 {"product-info", 0x7c3100, 0x01000},
1864 {"soft-version", 0x7c4200, 0x01000},
1865 {"support-list", 0x7c5200, 0x01000},
1866 {"profile", 0x7c6200, 0x08000},
1867 {"config-info", 0x7ce200, 0x00400},
1868 {"user-config", 0x7d0000, 0x10000},
1869 {"default-config", 0x7e0000, 0x10000},
1870 {"radio", 0x7f0000, 0x10000},
1874 .first_sysupgrade_partition
= "os-image",
1875 .last_sysupgrade_partition
= "file-system"
1878 /** Firmware layout for the RE200 v3 */
1884 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
1885 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
1886 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
1887 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
1888 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
1889 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
1890 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
1891 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
1892 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
1893 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
1894 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
1895 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
1896 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
1897 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
1902 {"fs-uboot", 0x00000, 0x20000},
1903 {"firmware", 0x20000, 0x7a0000},
1904 {"partition-table", 0x7c0000, 0x02000},
1905 {"default-mac", 0x7c2000, 0x00020},
1906 {"pin", 0x7c2100, 0x00020},
1907 {"product-info", 0x7c3100, 0x01000},
1908 {"soft-version", 0x7c4200, 0x01000},
1909 {"support-list", 0x7c5200, 0x01000},
1910 {"profile", 0x7c6200, 0x08000},
1911 {"config-info", 0x7ce200, 0x00400},
1912 {"user-config", 0x7d0000, 0x10000},
1913 {"default-config", 0x7e0000, 0x10000},
1914 {"radio", 0x7f0000, 0x10000},
1918 .first_sysupgrade_partition
= "os-image",
1919 .last_sysupgrade_partition
= "file-system"
1922 /** Firmware layout for the RE200 v4 */
1928 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
1929 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
1930 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
1931 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
1932 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
1933 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
1934 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
1935 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
1936 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
1937 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
1938 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
1939 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
1940 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
1941 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
1943 .soft_ver
= "soft_ver:1.1.0\n",
1946 {"fs-uboot", 0x00000, 0x20000},
1947 {"firmware", 0x20000, 0x7a0000},
1948 {"partition-table", 0x7c0000, 0x02000},
1949 {"default-mac", 0x7c2000, 0x00020},
1950 {"pin", 0x7c2100, 0x00020},
1951 {"product-info", 0x7c3100, 0x01000},
1952 {"soft-version", 0x7c4200, 0x01000},
1953 {"support-list", 0x7c5200, 0x01000},
1954 {"profile", 0x7c6200, 0x08000},
1955 {"config-info", 0x7ce200, 0x00400},
1956 {"user-config", 0x7d0000, 0x10000},
1957 {"default-config", 0x7e0000, 0x10000},
1958 {"radio", 0x7f0000, 0x10000},
1962 .first_sysupgrade_partition
= "os-image",
1963 .last_sysupgrade_partition
= "file-system"
1966 /** Firmware layout for the RE220 v2 */
1972 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
1973 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
1974 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
1975 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
1976 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
1977 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
1978 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
1979 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
1980 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
1981 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
1982 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
1983 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
1984 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
1989 {"fs-uboot", 0x00000, 0x20000},
1990 {"firmware", 0x20000, 0x7a0000},
1991 {"partition-table", 0x7c0000, 0x02000},
1992 {"default-mac", 0x7c2000, 0x00020},
1993 {"pin", 0x7c2100, 0x00020},
1994 {"product-info", 0x7c3100, 0x01000},
1995 {"soft-version", 0x7c4200, 0x01000},
1996 {"support-list", 0x7c5200, 0x01000},
1997 {"profile", 0x7c6200, 0x08000},
1998 {"config-info", 0x7ce200, 0x00400},
1999 {"user-config", 0x7d0000, 0x10000},
2000 {"default-config", 0x7e0000, 0x10000},
2001 {"radio", 0x7f0000, 0x10000},
2005 .first_sysupgrade_partition
= "os-image",
2006 .last_sysupgrade_partition
= "file-system"
2009 /** Firmware layout for the RE305 v1 */
2015 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2016 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2017 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2018 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2019 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2020 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2021 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2026 {"fs-uboot", 0x00000, 0x20000},
2027 {"firmware", 0x20000, 0x5e0000},
2028 {"partition-table", 0x600000, 0x02000},
2029 {"default-mac", 0x610000, 0x00020},
2030 {"pin", 0x610100, 0x00020},
2031 {"product-info", 0x611100, 0x01000},
2032 {"soft-version", 0x620000, 0x01000},
2033 {"support-list", 0x621000, 0x01000},
2034 {"profile", 0x622000, 0x08000},
2035 {"user-config", 0x630000, 0x10000},
2036 {"default-config", 0x640000, 0x10000},
2037 {"radio", 0x7f0000, 0x10000},
2041 .first_sysupgrade_partition
= "os-image",
2042 .last_sysupgrade_partition
= "file-system"
2045 /** Firmware layout for the RE350 v1 */
2051 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2052 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2053 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2054 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2055 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2056 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2057 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2061 /** We're using a dynamic kernel/rootfs split here */
2063 {"fs-uboot", 0x00000, 0x20000},
2064 {"firmware", 0x20000, 0x5e0000},
2065 {"partition-table", 0x600000, 0x02000},
2066 {"default-mac", 0x610000, 0x00020},
2067 {"pin", 0x610100, 0x00020},
2068 {"product-info", 0x611100, 0x01000},
2069 {"soft-version", 0x620000, 0x01000},
2070 {"support-list", 0x621000, 0x01000},
2071 {"profile", 0x622000, 0x08000},
2072 {"user-config", 0x630000, 0x10000},
2073 {"default-config", 0x640000, 0x10000},
2074 {"radio", 0x7f0000, 0x10000},
2078 .first_sysupgrade_partition
= "os-image",
2079 .last_sysupgrade_partition
= "file-system"
2082 /** Firmware layout for the RE350K v1 */
2088 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2092 /** We're using a dynamic kernel/rootfs split here */
2094 {"fs-uboot", 0x00000, 0x20000},
2095 {"firmware", 0x20000, 0xd70000},
2096 {"partition-table", 0xd90000, 0x02000},
2097 {"default-mac", 0xda0000, 0x00020},
2098 {"pin", 0xda0100, 0x00020},
2099 {"product-info", 0xda1100, 0x01000},
2100 {"soft-version", 0xdb0000, 0x01000},
2101 {"support-list", 0xdb1000, 0x01000},
2102 {"profile", 0xdb2000, 0x08000},
2103 {"user-config", 0xdc0000, 0x10000},
2104 {"default-config", 0xdd0000, 0x10000},
2105 {"device-id", 0xde0000, 0x00108},
2106 {"radio", 0xff0000, 0x10000},
2110 .first_sysupgrade_partition
= "os-image",
2111 .last_sysupgrade_partition
= "file-system"
2114 /** Firmware layout for the RE355 */
2120 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2121 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2122 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2123 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2124 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2125 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2126 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2127 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2131 /* We're using a dynamic kernel/rootfs split here */
2133 {"fs-uboot", 0x00000, 0x20000},
2134 {"firmware", 0x20000, 0x5e0000},
2135 {"partition-table", 0x600000, 0x02000},
2136 {"default-mac", 0x610000, 0x00020},
2137 {"pin", 0x610100, 0x00020},
2138 {"product-info", 0x611100, 0x01000},
2139 {"soft-version", 0x620000, 0x01000},
2140 {"support-list", 0x621000, 0x01000},
2141 {"profile", 0x622000, 0x08000},
2142 {"user-config", 0x630000, 0x10000},
2143 {"default-config", 0x640000, 0x10000},
2144 {"radio", 0x7f0000, 0x10000},
2148 .first_sysupgrade_partition
= "os-image",
2149 .last_sysupgrade_partition
= "file-system"
2152 /** Firmware layout for the RE450 */
2158 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2159 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2160 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2161 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2162 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2163 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2164 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2165 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2169 /** We're using a dynamic kernel/rootfs split here */
2171 {"fs-uboot", 0x00000, 0x20000},
2172 {"firmware", 0x20000, 0x5e0000},
2173 {"partition-table", 0x600000, 0x02000},
2174 {"default-mac", 0x610000, 0x00020},
2175 {"pin", 0x610100, 0x00020},
2176 {"product-info", 0x611100, 0x01000},
2177 {"soft-version", 0x620000, 0x01000},
2178 {"support-list", 0x621000, 0x01000},
2179 {"profile", 0x622000, 0x08000},
2180 {"user-config", 0x630000, 0x10000},
2181 {"default-config", 0x640000, 0x10000},
2182 {"radio", 0x7f0000, 0x10000},
2186 .first_sysupgrade_partition
= "os-image",
2187 .last_sysupgrade_partition
= "file-system"
2190 /** Firmware layout for the RE450 v2 */
2196 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2197 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2198 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2199 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2200 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2201 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2202 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2203 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2204 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2208 /* We're using a dynamic kernel/rootfs split here */
2210 {"fs-uboot", 0x00000, 0x20000},
2211 {"firmware", 0x20000, 0x5e0000},
2212 {"partition-table", 0x600000, 0x02000},
2213 {"default-mac", 0x610000, 0x00020},
2214 {"pin", 0x610100, 0x00020},
2215 {"product-info", 0x611100, 0x01000},
2216 {"soft-version", 0x620000, 0x01000},
2217 {"support-list", 0x621000, 0x01000},
2218 {"profile", 0x622000, 0x08000},
2219 {"user-config", 0x630000, 0x10000},
2220 {"default-config", 0x640000, 0x10000},
2221 {"radio", 0x7f0000, 0x10000},
2225 .first_sysupgrade_partition
= "os-image",
2226 .last_sysupgrade_partition
= "file-system"
2229 /** Firmware layout for the RE450 v3 */
2235 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2236 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2237 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2238 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2239 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2240 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2241 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2242 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2243 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2247 /* We're using a dynamic kernel/rootfs split here */
2249 {"fs-uboot", 0x00000, 0x20000},
2250 {"default-mac", 0x20000, 0x00020},
2251 {"pin", 0x20020, 0x00020},
2252 {"product-info", 0x21000, 0x01000},
2253 {"partition-table", 0x22000, 0x02000},
2254 {"soft-version", 0x24000, 0x01000},
2255 {"support-list", 0x25000, 0x01000},
2256 {"profile", 0x26000, 0x08000},
2257 {"user-config", 0x2e000, 0x10000},
2258 {"default-config", 0x3e000, 0x10000},
2259 {"config-info", 0x4e000, 0x00400},
2260 {"firmware", 0x50000, 0x7a0000},
2261 {"radio", 0x7f0000, 0x10000},
2265 .first_sysupgrade_partition
= "os-image",
2266 .last_sysupgrade_partition
= "file-system"
2269 /** Firmware layout for the RE500 */
2275 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2276 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2277 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2278 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2279 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2280 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2281 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2285 /* We're using a dynamic kernel/rootfs split here */
2287 {"fs-uboot", 0x00000, 0x20000},
2288 {"firmware", 0x20000, 0xde0000},
2289 {"partition-table", 0xe00000, 0x02000},
2290 {"default-mac", 0xe10000, 0x00020},
2291 {"pin", 0xe10100, 0x00020},
2292 {"product-info", 0xe11100, 0x01000},
2293 {"soft-version", 0xe20000, 0x01000},
2294 {"support-list", 0xe21000, 0x01000},
2295 {"profile", 0xe22000, 0x08000},
2296 {"user-config", 0xe30000, 0x10000},
2297 {"default-config", 0xe40000, 0x10000},
2298 {"radio", 0xff0000, 0x10000},
2302 .first_sysupgrade_partition
= "os-image",
2303 .last_sysupgrade_partition
= "file-system"
2306 /** Firmware layout for the RE650 */
2312 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2313 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2314 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2315 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2316 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2317 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2318 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2322 /* We're using a dynamic kernel/rootfs split here */
2324 {"fs-uboot", 0x00000, 0x20000},
2325 {"firmware", 0x20000, 0xde0000},
2326 {"partition-table", 0xe00000, 0x02000},
2327 {"default-mac", 0xe10000, 0x00020},
2328 {"pin", 0xe10100, 0x00020},
2329 {"product-info", 0xe11100, 0x01000},
2330 {"soft-version", 0xe20000, 0x01000},
2331 {"support-list", 0xe21000, 0x01000},
2332 {"profile", 0xe22000, 0x08000},
2333 {"user-config", 0xe30000, 0x10000},
2334 {"default-config", 0xe40000, 0x10000},
2335 {"radio", 0xff0000, 0x10000},
2339 .first_sysupgrade_partition
= "os-image",
2340 .last_sysupgrade_partition
= "file-system"
2346 #define error(_ret, _errno, _str, ...) \
2348 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
2349 strerror(_errno)); \
2355 /** Stores a uint32 as big endian */
2356 static inline void put32(uint8_t *buf
, uint32_t val
) {
2363 static inline bool meta_partition_should_pad(enum partition_trail_value pv
)
2365 return (pv
>= 0) && (pv
<= PART_TRAIL_MAX
);
2368 /** Allocate a padded meta partition with a correctly initialised header
2369 * If the `data` pointer is NULL, then the required space is only allocated,
2370 * otherwise `data_len` bytes will be copied from `data` into the partition
2372 static struct image_partition_entry
init_meta_partition_entry(
2373 const char *name
, const void *data
, uint32_t data_len
,
2374 enum partition_trail_value pad_value
)
2376 uint32_t total_len
= sizeof(struct meta_header
) + data_len
;
2377 if (meta_partition_should_pad(pad_value
))
2380 struct image_partition_entry entry
= {
2383 .data
= malloc(total_len
)
2386 error(1, errno
, "failed to allocate meta partition entry");
2388 struct meta_header
*header
= (struct meta_header
*)entry
.data
;
2389 header
->length
= htonl(data_len
);
2393 memcpy(entry
.data
+sizeof(*header
), data
, data_len
);
2395 if (meta_partition_should_pad(pad_value
))
2396 entry
.data
[total_len
- 1] = (uint8_t) pad_value
;
2401 /** Allocates a new image partition */
2402 static struct image_partition_entry
alloc_image_partition(const char *name
, size_t len
) {
2403 struct image_partition_entry entry
= {name
, len
, malloc(len
)};
2405 error(1, errno
, "malloc");
2410 /** Frees an image partition */
2411 static void free_image_partition(struct image_partition_entry entry
) {
2415 static time_t source_date_epoch
= -1;
2416 static void set_source_date_epoch() {
2417 char *env
= getenv("SOURCE_DATE_EPOCH");
2421 source_date_epoch
= strtoull(env
, &endptr
, 10);
2422 if (errno
|| (endptr
&& *endptr
!= '\0')) {
2423 fprintf(stderr
, "Invalid SOURCE_DATE_EPOCH");
2429 /** Generates the partition-table partition */
2430 static struct image_partition_entry
make_partition_table(const struct flash_partition_entry
*p
) {
2431 struct image_partition_entry entry
= alloc_image_partition("partition-table", 0x800);
2433 char *s
= (char *)entry
.data
, *end
= (char *)(s
+entry
.size
);
2441 for (i
= 0; p
[i
].name
; i
++) {
2443 size_t w
= snprintf(s
, len
, "partition %s base 0x%05x size 0x%05x\n", p
[i
].name
, p
[i
].base
, p
[i
].size
);
2446 error(1, 0, "flash partition table overflow?");
2453 memset(s
, 0xff, end
-s
);
2459 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
2460 static inline uint8_t bcd(uint8_t v
) {
2461 return 0x10 * (v
/10) + v
%10;
2465 /** Generates the soft-version partition */
2466 static struct image_partition_entry
make_soft_version(
2467 const struct device_info
*info
, uint32_t rev
)
2469 /** If an info string is provided, use this instead of
2470 * the structured data, and include the null-termination */
2471 if (info
->soft_ver
) {
2472 uint32_t len
= strlen(info
->soft_ver
) + 1;
2473 return init_meta_partition_entry("soft-version",
2474 info
->soft_ver
, len
, info
->part_trail
);
2479 if (source_date_epoch
!= -1)
2480 t
= source_date_epoch
;
2481 else if (time(&t
) == (time_t)(-1))
2482 error(1, errno
, "time");
2484 struct tm
*tm
= gmtime(&t
);
2486 struct soft_version s
= {
2493 .year_hi
= bcd((1900+tm
->tm_year
)/100),
2494 .year_lo
= bcd(tm
->tm_year
%100),
2495 .month
= bcd(tm
->tm_mon
+1),
2496 .day
= bcd(tm
->tm_mday
),
2498 .compat_level
= htonl(info
->soft_ver_compat_level
)
2501 if (info
->soft_ver_compat_level
== 0)
2502 return init_meta_partition_entry("soft-version", &s
,
2503 (uint8_t *)(&s
.compat_level
) - (uint8_t *)(&s
),
2506 return init_meta_partition_entry("soft-version", &s
,
2507 sizeof(s
), info
->part_trail
);
2510 /** Generates the support-list partition */
2511 static struct image_partition_entry
make_support_list(
2512 const struct device_info
*info
)
2514 uint32_t len
= strlen(info
->support_list
);
2515 return init_meta_partition_entry("support-list", info
->support_list
,
2516 len
, info
->part_trail
);
2519 /** Partition with extra-para data */
2520 static struct image_partition_entry
make_extra_para(
2521 const struct device_info
*info
, const uint8_t *extra_para
, size_t len
)
2523 return init_meta_partition_entry("extra-para", extra_para
, len
,
2527 /** Creates a new image partition with an arbitrary name from a file */
2528 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
) {
2529 struct stat statbuf
;
2531 if (stat(filename
, &statbuf
) < 0)
2532 error(1, errno
, "unable to stat file `%s'", filename
);
2534 size_t len
= statbuf
.st_size
;
2536 if (add_jffs2_eof
) {
2537 if (file_system_partition
)
2538 len
= ALIGN(len
+ file_system_partition
->base
, 0x10000) + sizeof(jffs2_eof_mark
) - file_system_partition
->base
;
2540 len
= ALIGN(len
, 0x10000) + sizeof(jffs2_eof_mark
);
2543 struct image_partition_entry entry
= alloc_image_partition(part_name
, len
);
2545 FILE *file
= fopen(filename
, "rb");
2547 error(1, errno
, "unable to open file `%s'", filename
);
2549 if (fread(entry
.data
, statbuf
.st_size
, 1, file
) != 1)
2550 error(1, errno
, "unable to read file `%s'", filename
);
2552 if (add_jffs2_eof
) {
2553 uint8_t *eof
= entry
.data
+ statbuf
.st_size
, *end
= entry
.data
+entry
.size
;
2555 memset(eof
, 0xff, end
- eof
- sizeof(jffs2_eof_mark
));
2556 memcpy(end
- sizeof(jffs2_eof_mark
), jffs2_eof_mark
, sizeof(jffs2_eof_mark
));
2565 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
2567 Example image partition table:
2569 fwup-ptn partition-table base 0x00800 size 0x00800
2570 fwup-ptn os-image base 0x01000 size 0x113b45
2571 fwup-ptn file-system base 0x114b45 size 0x1d0004
2572 fwup-ptn support-list base 0x2e4b49 size 0x000d1
2574 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
2575 the end of the partition table is marked with a zero byte.
2577 The firmware image must contain at least the partition-table and support-list partitions
2578 to be accepted. There aren't any alignment constraints for the image partitions.
2580 The partition-table partition contains the actual flash layout; partitions
2581 from the image partition table are mapped to the corresponding flash partitions during
2582 the firmware upgrade. The support-list partition contains a list of devices supported by
2585 The base offsets in the firmware partition table are relative to the end
2586 of the vendor information block, so the partition-table partition will
2587 actually start at offset 0x1814 of the image.
2589 I think partition-table must be the first partition in the firmware image.
2591 static void put_partitions(uint8_t *buffer
, const struct flash_partition_entry
*flash_parts
, const struct image_partition_entry
*parts
) {
2593 char *image_pt
= (char *)buffer
, *end
= image_pt
+ 0x800;
2595 size_t base
= 0x800;
2596 for (i
= 0; parts
[i
].name