tplink-safeloader: add US-CA-TW support-list entries for Archer AX23v1
[project/firmware-utils.git] / src / tplink-safeloader.c
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
4 All rights reserved.
5 */
6
7
8 /*
9 tplink-safeloader
10
11 Image generation tool for the TP-LINK SafeLoader as seen on
12 TP-LINK Pharos devices (CPE210/220/510/520)
13 */
14
15
16 #include <assert.h>
17 #include <ctype.h>
18 #include <errno.h>
19 #include <stdbool.h>
20 #include <stddef.h>
21 #include <stdio.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <time.h>
26 #include <unistd.h>
27
28 #include <arpa/inet.h>
29
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <limits.h>
33
34 #include "md5.h"
35
36
37 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
38
39
40 #define MAX_PARTITIONS 32
41
42 /** An image partition table entry */
43 struct image_partition_entry {
44 const char *name;
45 size_t size;
46 uint8_t *data;
47 };
48
49 /** A flash partition table entry */
50 struct flash_partition_entry {
51 const char *name;
52 uint32_t base;
53 uint32_t size;
54 };
55
56 /** Flash partition names table entry */
57 struct factory_partition_names {
58 const char *partition_table;
59 const char *soft_ver;
60 const char *os_image;
61 const char *support_list;
62 const char *file_system;
63 const char *extra_para;
64 };
65
66 /** Partition trailing padding definitions
67 * Values 0x00 to 0xff are reserved to indicate the padding value
68 * Values from 0x100 are reserved to indicate other behaviour */
69 enum partition_trail_value {
70 PART_TRAIL_00 = 0x00,
71 PART_TRAIL_FF = 0xff,
72 PART_TRAIL_MAX = 0xff,
73 PART_TRAIL_NONE = 0x100
74 };
75
76 /** soft-version value overwrite types
77 * The default (for an uninitialised soft_ver field) is to use the numerical
78 * version number "0.0.0"
79 */
80 enum soft_ver_type {
81 SOFT_VER_TYPE_NUMERIC = 0,
82 SOFT_VER_TYPE_TEXT = 1,
83 };
84
85 /** Firmware layout description */
86 struct device_info {
87 const char *id;
88 const char *vendor;
89 const char *support_list;
90 enum partition_trail_value part_trail;
91 struct {
92 enum soft_ver_type type;
93 union {
94 const char *text;
95 uint8_t num[3];
96 };
97 } soft_ver;
98 uint32_t soft_ver_compat_level;
99 struct flash_partition_entry partitions[MAX_PARTITIONS+1];
100 const char *first_sysupgrade_partition;
101 const char *last_sysupgrade_partition;
102 struct factory_partition_names partition_names;
103 };
104
105 #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t}
106 #define SOFT_VER_NUMERIC(_maj, _min, _patch) { \
107 .type = SOFT_VER_TYPE_NUMERIC, \
108 .num = {_maj, _min, _patch}}
109 #define SOFT_VER_DEFAULT SOFT_VER_NUMERIC(0, 0, 0)
110
111 struct __attribute__((__packed__)) meta_header {
112 uint32_t length;
113 uint32_t zero;
114 };
115
116 /** The content of the soft-version structure */
117 struct __attribute__((__packed__)) soft_version {
118 uint8_t pad1;
119 uint8_t version_major;
120 uint8_t version_minor;
121 uint8_t version_patch;
122 uint8_t year_hi;
123 uint8_t year_lo;
124 uint8_t month;
125 uint8_t day;
126 uint32_t rev;
127 uint32_t compat_level;
128 };
129
130 /*
131 * Safeloader image type
132 * Safeloader images contain a 0x14 byte preamble with image size (big endian
133 * UINT32) and md5 checksum (16 bytes).
134 *
135 * SAFEFLOADER_TYPE_DEFAULT
136 * Standard preamble with size including preamble length, and checksum.
137 * Header of 0x1000 bytes, contents of which are not specified.
138 * Payload starts at offset 0x1014.
139 *
140 * SAFELOADER_TYPE_VENDOR
141 * Standard preamble with size including preamble length, and checksum.
142 * Header contains up to 0x1000 bytes of vendor data, starting with a big endian
143 * UINT32 size, followed by that number of bytes containing (text) data.
144 * Padded with 0xFF. Payload starts at offset 0x1014.
145 *
146 * SAFELOADER_TYPE_CLOUD
147 * Standard preamble with size including preamble length, and checksum.
148 * Followed by the 'fw-type:Cloud' string and some (unknown) data.
149 * Payload starts at offset 0x1014.
150 *
151 * SAFELOADER_TYPE_QNEW
152 * Reversed order preamble, with (apparent) md5 checksum before the image
153 * size. The size does not include the preamble length.
154 * Header starts with 0x3C bytes, starting with the string '?NEW' (format not
155 * understood). Then another 0x1000 bytes follow, with the data payload
156 * starting at 0x1050.
157 */
158 enum safeloader_image_type {
159 SAFELOADER_TYPE_DEFAULT,
160 SAFELOADER_TYPE_VENDOR,
161 SAFELOADER_TYPE_CLOUD,
162 SAFELOADER_TYPE_QNEW,
163 };
164
165 /* Internal representation of safeloader image data */
166 struct safeloader_image_info {
167 enum safeloader_image_type type;
168 size_t payload_offset;
169 struct flash_partition_entry entries[MAX_PARTITIONS];
170 };
171
172 #define SAFELOADER_PREAMBLE_SIZE 0x14
173 #define SAFELOADER_HEADER_SIZE 0x1000
174 #define SAFELOADER_PAYLOAD_OFFSET (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_HEADER_SIZE)
175
176 #define SAFELOADER_QNEW_HEADER_SIZE 0x3C
177 #define SAFELOADER_QNEW_PAYLOAD_OFFSET \
178 (SAFELOADER_PREAMBLE_SIZE + SAFELOADER_QNEW_HEADER_SIZE + SAFELOADER_HEADER_SIZE)
179
180 #define SAFELOADER_PAYLOAD_TABLE_SIZE 0x800
181
182 static const uint8_t jffs2_eof_mark[4] = {0xde, 0xad, 0xc0, 0xde};
183
184
185 /**
186 Salt for the MD5 hash
187
188 Fortunately, TP-LINK seems to use the same salt for most devices which use
189 the new image format.
190 */
191 static const uint8_t md5_salt[16] = {
192 0x7a, 0x2b, 0x15, 0xed,
193 0x9b, 0x98, 0x59, 0x6d,
194 0xe5, 0x04, 0xab, 0x44,
195 0xac, 0x2a, 0x9f, 0x4e,
196 };
197
198
199 /** Firmware layout table */
200 static struct device_info boards[] = {
201 /** Firmware layout for the CPE210/220 V1 */
202 {
203 .id = "CPE210",
204 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
205 .support_list =
206 "SupportList:\r\n"
207 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
208 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
209 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
210 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
211 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
212 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
213 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
214 .part_trail = 0xff,
215 .soft_ver = SOFT_VER_DEFAULT,
216
217 .partitions = {
218 {"fs-uboot", 0x00000, 0x20000},
219 {"partition-table", 0x20000, 0x02000},
220 {"default-mac", 0x30000, 0x00020},
221 {"product-info", 0x31100, 0x00100},
222 {"signature", 0x32000, 0x00400},
223 {"firmware", 0x40000, 0x770000},
224 {"soft-version", 0x7b0000, 0x00100},
225 {"support-list", 0x7b1000, 0x00400},
226 {"user-config", 0x7c0000, 0x10000},
227 {"default-config", 0x7d0000, 0x10000},
228 {"log", 0x7e0000, 0x10000},
229 {"radio", 0x7f0000, 0x10000},
230 {NULL, 0, 0}
231 },
232
233 .first_sysupgrade_partition = "os-image",
234 .last_sysupgrade_partition = "support-list",
235 },
236
237 /** Firmware layout for the CPE210 V2 */
238 {
239 .id = "CPE210V2",
240 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
241 .support_list =
242 "SupportList:\r\n"
243 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
244 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
245 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
246 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
247 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
248 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
249 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
250 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
251 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
252 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
253 .part_trail = 0xff,
254 .soft_ver = SOFT_VER_DEFAULT,
255
256 .partitions = {
257 {"fs-uboot", 0x00000, 0x20000},
258 {"partition-table", 0x20000, 0x02000},
259 {"default-mac", 0x30000, 0x00020},
260 {"product-info", 0x31100, 0x00100},
261 {"device-info", 0x31400, 0x00400},
262 {"signature", 0x32000, 0x00400},
263 {"device-id", 0x33000, 0x00100},
264 {"firmware", 0x40000, 0x770000},
265 {"soft-version", 0x7b0000, 0x00100},
266 {"support-list", 0x7b1000, 0x01000},
267 {"user-config", 0x7c0000, 0x10000},
268 {"default-config", 0x7d0000, 0x10000},
269 {"log", 0x7e0000, 0x10000},
270 {"radio", 0x7f0000, 0x10000},
271 {NULL, 0, 0}
272 },
273
274 .first_sysupgrade_partition = "os-image",
275 .last_sysupgrade_partition = "support-list",
276 },
277
278 /** Firmware layout for the CPE210 V3 */
279 {
280 .id = "CPE210V3",
281 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
282 .support_list =
283 "SupportList:\r\n"
284 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
285 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
286 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
287 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
288 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
289 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
290 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
291 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
292 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
293 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
294 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
295 .part_trail = 0xff,
296 .soft_ver = SOFT_VER_DEFAULT,
297
298 .partitions = {
299 {"fs-uboot", 0x00000, 0x20000},
300 {"partition-table", 0x20000, 0x01000},
301 {"default-mac", 0x30000, 0x00020},
302 {"product-info", 0x31100, 0x00100},
303 {"device-info", 0x31400, 0x00400},
304 {"signature", 0x32000, 0x00400},
305 {"device-id", 0x33000, 0x00100},
306 {"firmware", 0x40000, 0x770000},
307 {"soft-version", 0x7b0000, 0x00100},
308 {"support-list", 0x7b1000, 0x01000},
309 {"user-config", 0x7c0000, 0x10000},
310 {"default-config", 0x7d0000, 0x10000},
311 {"log", 0x7e0000, 0x10000},
312 {"radio", 0x7f0000, 0x10000},
313 {NULL, 0, 0}
314 },
315
316 .first_sysupgrade_partition = "os-image",
317 .last_sysupgrade_partition = "support-list",
318 },
319
320 /** Firmware layout for the CPE220 V2 */
321 {
322 .id = "CPE220V2",
323 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
324 .support_list =
325 "SupportList:\r\n"
326 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
327 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
328 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
329 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
330 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
331 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
332 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
333 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
334 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
335 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
336 .part_trail = 0xff,
337 .soft_ver = SOFT_VER_DEFAULT,
338
339 .partitions = {
340 {"fs-uboot", 0x00000, 0x20000},
341 {"partition-table", 0x20000, 0x02000},
342 {"default-mac", 0x30000, 0x00020},
343 {"product-info", 0x31100, 0x00100},
344 {"signature", 0x32000, 0x00400},
345 {"firmware", 0x40000, 0x770000},
346 {"soft-version", 0x7b0000, 0x00100},
347 {"support-list", 0x7b1000, 0x00400},
348 {"user-config", 0x7c0000, 0x10000},
349 {"default-config", 0x7d0000, 0x10000},
350 {"log", 0x7e0000, 0x10000},
351 {"radio", 0x7f0000, 0x10000},
352 {NULL, 0, 0}
353 },
354
355 .first_sysupgrade_partition = "os-image",
356 .last_sysupgrade_partition = "support-list",
357 },
358
359 /** Firmware layout for the CPE220 V3 */
360 {
361 .id = "CPE220V3",
362 .vendor = "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
363 .support_list =
364 "SupportList:\r\n"
365 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
366 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
367 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
368 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
369 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
370 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
371 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
372 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
373 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
374 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
375 .part_trail = 0xff,
376 .soft_ver = SOFT_VER_DEFAULT,
377
378 .partitions = {
379 {"fs-uboot", 0x00000, 0x20000},
380 {"partition-table", 0x20000, 0x02000},
381 {"default-mac", 0x30000, 0x00020},
382 {"product-info", 0x31100, 0x00100},
383 {"device-info", 0x31400, 0x00400},
384 {"signature", 0x32000, 0x00400},
385 {"device-id", 0x33000, 0x00100},
386 {"firmware", 0x40000, 0x770000},
387 {"soft-version", 0x7b0000, 0x00100},
388 {"support-list", 0x7b1000, 0x01000},
389 {"user-config", 0x7c0000, 0x10000},
390 {"default-config", 0x7d0000, 0x10000},
391 {"log", 0x7e0000, 0x10000},
392 {"radio", 0x7f0000, 0x10000},
393 {NULL, 0, 0}
394 },
395
396 .first_sysupgrade_partition = "os-image",
397 .last_sysupgrade_partition = "support-list",
398 },
399
400 /** Firmware layout for the CPE510/520 V1 */
401 {
402 .id = "CPE510",
403 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
404 .support_list =
405 "SupportList:\r\n"
406 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
407 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
408 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
409 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
410 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
411 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
412 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
413 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
414 .part_trail = 0xff,
415 .soft_ver = SOFT_VER_DEFAULT,
416
417 .partitions = {
418 {"fs-uboot", 0x00000, 0x20000},
419 {"partition-table", 0x20000, 0x02000},
420 {"default-mac", 0x30000, 0x00020},
421 {"product-info", 0x31100, 0x00100},
422 {"signature", 0x32000, 0x00400},
423 {"firmware", 0x40000, 0x770000},
424 {"soft-version", 0x7b0000, 0x00100},
425 {"support-list", 0x7b1000, 0x00400},
426 {"user-config", 0x7c0000, 0x10000},
427 {"default-config", 0x7d0000, 0x10000},
428 {"log", 0x7e0000, 0x10000},
429 {"radio", 0x7f0000, 0x10000},
430 {NULL, 0, 0}
431 },
432
433 .first_sysupgrade_partition = "os-image",
434 .last_sysupgrade_partition = "support-list",
435 },
436
437 /** Firmware layout for the CPE510 V2 */
438 {
439 .id = "CPE510V2",
440 .vendor = "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
441 .support_list =
442 "SupportList:\r\n"
443 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
444 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
445 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
446 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
447 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
448 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
449 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
450 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
451 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
452 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
453 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
454 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
455 .part_trail = 0xff,
456 .soft_ver = SOFT_VER_DEFAULT,
457
458 .partitions = {
459 {"fs-uboot", 0x00000, 0x20000},
460 {"partition-table", 0x20000, 0x02000},
461 {"default-mac", 0x30000, 0x00020},
462 {"product-info", 0x31100, 0x00100},
463 {"signature", 0x32000, 0x00400},
464 {"firmware", 0x40000, 0x770000},
465 {"soft-version", 0x7b0000, 0x00100},
466 {"support-list", 0x7b1000, 0x00400},
467 {"user-config", 0x7c0000, 0x10000},
468 {"default-config", 0x7d0000, 0x10000},
469 {"log", 0x7e0000, 0x10000},
470 {"radio", 0x7f0000, 0x10000},
471 {NULL, 0, 0}
472 },
473
474 .first_sysupgrade_partition = "os-image",
475 .last_sysupgrade_partition = "support-list",
476 },
477
478 /** Firmware layout for the CPE510 V3 */
479 {
480 .id = "CPE510V3",
481 .vendor = "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
482 .support_list =
483 "SupportList:\r\n"
484 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
485 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
486 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
487 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
488 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
489 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
490 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
491 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
492 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
493 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
494 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
495 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
496 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
497 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
498 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
499 .part_trail = 0xff,
500 .soft_ver = SOFT_VER_DEFAULT,
501
502 .partitions = {
503 {"fs-uboot", 0x00000, 0x20000},
504 {"partition-table", 0x20000, 0x02000},
505 {"default-mac", 0x30000, 0x00020},
506 {"product-info", 0x31100, 0x00100},
507 {"signature", 0x32000, 0x00400},
508 {"firmware", 0x40000, 0x770000},
509 {"soft-version", 0x7b0000, 0x00100},
510 {"support-list", 0x7b1000, 0x00400},
511 {"user-config", 0x7c0000, 0x10000},
512 {"default-config", 0x7d0000, 0x10000},
513 {"log", 0x7e0000, 0x10000},
514 {"radio", 0x7f0000, 0x10000},
515 {NULL, 0, 0}
516 },
517
518 .first_sysupgrade_partition = "os-image",
519 .last_sysupgrade_partition = "support-list",
520 },
521
522 /** Firmware layout for the CPE605V1 */
523 {
524 .id = "CPE605V1",
525 .vendor = "CPE605(TP-LINK|UN|N150-5):1.0\r\n",
526 .support_list =
527 "SupportList:\r\n"
528 "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
529 "CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
530 "CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n",
531 .part_trail = 0x00,
532 .soft_ver = SOFT_VER_DEFAULT,
533
534 .partitions = {
535 {"fs-uboot", 0x00000, 0x20000},
536 {"partition-table", 0x20000, 0x02000},
537 {"default-mac", 0x30000, 0x00020},
538 {"serial-number", 0x30100, 0x00020},
539 {"product-info", 0x31100, 0x00100},
540 {"device-info", 0x31400, 0x00400},
541 {"signature", 0x32000, 0x00400},
542 {"device-id", 0x33000, 0x00100},
543 {"firmware", 0x40000, 0x770000},
544 {"soft-version", 0x7b0000, 0x00100},
545 {"support-list", 0x7b1000, 0x01000},
546 {"user-config", 0x7c0000, 0x10000},
547 {"default-config", 0x7d0000, 0x10000},
548 {"log", 0x7e0000, 0x10000},
549 {"radio", 0x7f0000, 0x10000},
550 {NULL, 0, 0}
551 },
552
553 .first_sysupgrade_partition = "os-image",
554 .last_sysupgrade_partition = "support-list",
555 },
556
557 /** Firmware layout for the CPE610V1 */
558 {
559 .id = "CPE610V1",
560 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
561 .support_list =
562 "SupportList:\r\n"
563 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
564 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
565 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
566 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
567 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
568 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
569 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
570 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
571 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
572 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
573 .part_trail = 0xff,
574 .soft_ver = SOFT_VER_DEFAULT,
575
576 .partitions = {
577 {"fs-uboot", 0x00000, 0x20000},
578 {"partition-table", 0x20000, 0x02000},
579 {"default-mac", 0x30000, 0x00020},
580 {"product-info", 0x31100, 0x00100},
581 {"signature", 0x32000, 0x00400},
582 {"firmware", 0x40000, 0x770000},
583 {"soft-version", 0x7b0000, 0x00100},
584 {"support-list", 0x7b1000, 0x00400},
585 {"user-config", 0x7c0000, 0x10000},
586 {"default-config", 0x7d0000, 0x10000},
587 {"log", 0x7e0000, 0x10000},
588 {"radio", 0x7f0000, 0x10000},
589 {NULL, 0, 0}
590 },
591
592 .first_sysupgrade_partition = "os-image",
593 .last_sysupgrade_partition = "support-list",
594 },
595
596 /** Firmware layout for the CPE610V2 */
597 {
598 .id = "CPE610V2",
599 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
600 .support_list =
601 "SupportList:\r\n"
602 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
603 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
604 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
605 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
606 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
607 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
608 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
609 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
610 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
611 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
612 .part_trail = 0xff,
613 .soft_ver = SOFT_VER_DEFAULT,
614
615 .partitions = {
616 {"fs-uboot", 0x00000, 0x20000},
617 {"partition-table", 0x20000, 0x02000},
618 {"default-mac", 0x30000, 0x00020},
619 {"product-info", 0x31100, 0x00100},
620 {"signature", 0x32000, 0x00400},
621 {"firmware", 0x40000, 0x770000},
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},
628 {NULL, 0, 0}
629 },
630
631 .first_sysupgrade_partition = "os-image",
632 .last_sysupgrade_partition = "support-list",
633 },
634 /** Firmware layout for the CPE710 V1 */
635 {
636 .id = "CPE710V1",
637 .vendor = "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n",
638 .support_list =
639 "SupportList:\r\n"
640 "CPE710(TP-LINK|UN|AC866-5|00000000):1.0\r\n"
641 "CPE710(TP-LINK|EU|AC866-5|45550000):1.0\r\n"
642 "CPE710(TP-LINK|US|AC866-5|55530000):1.0\r\n"
643 "CPE710(TP-LINK|UN|AC866-5):1.0\r\n"
644 "CPE710(TP-LINK|EU|AC866-5):1.0\r\n"
645 "CPE710(TP-LINK|US|AC866-5):1.0\r\n",
646 .part_trail = 0xff,
647 .soft_ver = SOFT_VER_DEFAULT,
648
649 .partitions = {
650 {"fs-uboot", 0x00000, 0x50000},
651 {"partition-table", 0x50000, 0x02000},
652 {"default-mac", 0x60000, 0x00020},
653 {"serial-number", 0x60100, 0x00020},
654 {"product-info", 0x61100, 0x00100},
655 {"device-info", 0x61400, 0x00400},
656 {"signature", 0x62000, 0x00400},
657 {"device-id", 0x63000, 0x00100},
658 {"firmware", 0x70000, 0xf40000},
659 {"soft-version", 0xfb0000, 0x00100},
660 {"support-list", 0xfb1000, 0x01000},
661 {"user-config", 0xfc0000, 0x10000},
662 {"default-config", 0xfd0000, 0x10000},
663 {"log", 0xfe0000, 0x10000},
664 {"radio", 0xff0000, 0x10000},
665 {NULL, 0, 0}
666 },
667
668 .first_sysupgrade_partition = "os-image",
669 .last_sysupgrade_partition = "support-list",
670 },
671
672 {
673 .id = "WBS210",
674 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
675 .support_list =
676 "SupportList:\r\n"
677 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
678 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
679 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
680 .part_trail = 0xff,
681 .soft_ver = SOFT_VER_DEFAULT,
682
683 .partitions = {
684 {"fs-uboot", 0x00000, 0x20000},
685 {"partition-table", 0x20000, 0x02000},
686 {"default-mac", 0x30000, 0x00020},
687 {"product-info", 0x31100, 0x00100},
688 {"signature", 0x32000, 0x00400},
689 {"firmware", 0x40000, 0x770000},
690 {"soft-version", 0x7b0000, 0x00100},
691 {"support-list", 0x7b1000, 0x00400},
692 {"user-config", 0x7c0000, 0x10000},
693 {"default-config", 0x7d0000, 0x10000},
694 {"log", 0x7e0000, 0x10000},
695 {"radio", 0x7f0000, 0x10000},
696 {NULL, 0, 0}
697 },
698
699 .first_sysupgrade_partition = "os-image",
700 .last_sysupgrade_partition = "support-list",
701 },
702
703 {
704 .id = "WBS210V2",
705 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
706 .support_list =
707 "SupportList:\r\n"
708 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
709 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
710 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
711 .part_trail = 0xff,
712 .soft_ver = SOFT_VER_DEFAULT,
713
714 .partitions = {
715 {"fs-uboot", 0x00000, 0x20000},
716 {"partition-table", 0x20000, 0x02000},
717 {"default-mac", 0x30000, 0x00020},
718 {"product-info", 0x31100, 0x00100},
719 {"signature", 0x32000, 0x00400},
720 {"firmware", 0x40000, 0x770000},
721 {"soft-version", 0x7b0000, 0x00100},
722 {"support-list", 0x7b1000, 0x00400},
723 {"user-config", 0x7c0000, 0x10000},
724 {"default-config", 0x7d0000, 0x10000},
725 {"log", 0x7e0000, 0x10000},
726 {"radio", 0x7f0000, 0x10000},
727 {NULL, 0, 0}
728 },
729
730 .first_sysupgrade_partition = "os-image",
731 .last_sysupgrade_partition = "support-list",
732 },
733
734 {
735 .id = "WBS510",
736 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
737 .support_list =
738 "SupportList:\r\n"
739 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
740 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
741 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
742 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
743 .part_trail = 0xff,
744 .soft_ver = SOFT_VER_DEFAULT,
745
746 .partitions = {
747 {"fs-uboot", 0x00000, 0x20000},
748 {"partition-table", 0x20000, 0x02000},
749 {"default-mac", 0x30000, 0x00020},
750 {"product-info", 0x31100, 0x00100},
751 {"signature", 0x32000, 0x00400},
752 {"firmware", 0x40000, 0x770000},
753 {"soft-version", 0x7b0000, 0x00100},
754 {"support-list", 0x7b1000, 0x00400},
755 {"user-config", 0x7c0000, 0x10000},
756 {"default-config", 0x7d0000, 0x10000},
757 {"log", 0x7e0000, 0x10000},
758 {"radio", 0x7f0000, 0x10000},
759 {NULL, 0, 0}
760 },
761
762 .first_sysupgrade_partition = "os-image",
763 .last_sysupgrade_partition = "support-list",
764 },
765
766 {
767 .id = "WBS510V2",
768 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
769 .support_list =
770 "SupportList:\r\n"
771 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
772 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
773 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
774 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
775 .part_trail = 0xff,
776 .soft_ver = SOFT_VER_DEFAULT,
777
778 .partitions = {
779 {"fs-uboot", 0x00000, 0x20000},
780 {"partition-table", 0x20000, 0x02000},
781 {"default-mac", 0x30000, 0x00020},
782 {"product-info", 0x31100, 0x00100},
783 {"signature", 0x32000, 0x00400},
784 {"firmware", 0x40000, 0x770000},
785 {"soft-version", 0x7b0000, 0x00100},
786 {"support-list", 0x7b1000, 0x00400},
787 {"user-config", 0x7c0000, 0x10000},
788 {"default-config", 0x7d0000, 0x10000},
789 {"log", 0x7e0000, 0x10000},
790 {"radio", 0x7f0000, 0x10000},
791 {NULL, 0, 0}
792 },
793
794 .first_sysupgrade_partition = "os-image",
795 .last_sysupgrade_partition = "support-list",
796 },
797
798 /** Firmware layout for the AD7200 */
799 {
800 .id = "AD7200",
801 .vendor = "",
802 .support_list =
803 "SupportList:\r\n"
804 "{product_name:AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
805 .part_trail = 0x00,
806 .soft_ver = SOFT_VER_DEFAULT,
807
808 .partitions = {
809 {"SBL1", 0x00000, 0x20000},
810 {"MIBIB", 0x20000, 0x20000},
811 {"SBL2", 0x40000, 0x20000},
812 {"SBL3", 0x60000, 0x30000},
813 {"DDRCONFIG", 0x90000, 0x10000},
814 {"SSD", 0xa0000, 0x10000},
815 {"TZ", 0xb0000, 0x30000},
816 {"RPM", 0xe0000, 0x20000},
817 {"fs-uboot", 0x100000, 0x70000},
818 {"uboot-env", 0x170000, 0x40000},
819 {"radio", 0x1b0000, 0x40000},
820 {"os-image", 0x1f0000, 0x400000},
821 {"file-system", 0x5f0000, 0x1900000},
822 {"default-mac", 0x1ef0000, 0x00200},
823 {"pin", 0x1ef0200, 0x00200},
824 {"device-id", 0x1ef0400, 0x00200},
825 {"product-info", 0x1ef0600, 0x0fa00},
826 {"partition-table", 0x1f00000, 0x10000},
827 {"soft-version", 0x1f10000, 0x10000},
828 {"support-list", 0x1f20000, 0x10000},
829 {"profile", 0x1f30000, 0x10000},
830 {"default-config", 0x1f40000, 0x10000},
831 {"user-config", 0x1f50000, 0x40000},
832 {"qos-db", 0x1f90000, 0x40000},
833 {"usb-config", 0x1fd0000, 0x10000},
834 {"log", 0x1fe0000, 0x20000},
835 {NULL, 0, 0}
836 },
837
838 .first_sysupgrade_partition = "os-image",
839 .last_sysupgrade_partition = "file-system"
840 },
841
842 /** Firmware layout for the C2600 */
843 {
844 .id = "C2600",
845 .vendor = "",
846 .support_list =
847 "SupportList:\r\n"
848 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
849 .part_trail = 0x00,
850 .soft_ver = SOFT_VER_DEFAULT,
851
852 /**
853 We use a bigger os-image partition than the stock images (and thus
854 smaller file-system), as our kernel doesn't fit in the stock firmware's
855 2 MB os-image since kernel 4.14.
856 */
857 .partitions = {
858 {"SBL1", 0x00000, 0x20000},
859 {"MIBIB", 0x20000, 0x20000},
860 {"SBL2", 0x40000, 0x20000},
861 {"SBL3", 0x60000, 0x30000},
862 {"DDRCONFIG", 0x90000, 0x10000},
863 {"SSD", 0xa0000, 0x10000},
864 {"TZ", 0xb0000, 0x30000},
865 {"RPM", 0xe0000, 0x20000},
866 {"fs-uboot", 0x100000, 0x70000},
867 {"uboot-env", 0x170000, 0x40000},
868 {"radio", 0x1b0000, 0x40000},
869 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
870 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
871 {"default-mac", 0x1ef0000, 0x00200},
872 {"pin", 0x1ef0200, 0x00200},
873 {"product-info", 0x1ef0400, 0x0fc00},
874 {"partition-table", 0x1f00000, 0x10000},
875 {"soft-version", 0x1f10000, 0x10000},
876 {"support-list", 0x1f20000, 0x10000},
877 {"profile", 0x1f30000, 0x10000},
878 {"default-config", 0x1f40000, 0x10000},
879 {"user-config", 0x1f50000, 0x40000},
880 {"qos-db", 0x1f90000, 0x40000},
881 {"usb-config", 0x1fd0000, 0x10000},
882 {"log", 0x1fe0000, 0x20000},
883 {NULL, 0, 0}
884 },
885
886 .first_sysupgrade_partition = "os-image",
887 .last_sysupgrade_partition = "file-system"
888 },
889
890 /** Firmware layout for the A7-V5 */
891 {
892 .id = "ARCHER-A7-V5",
893 .support_list =
894 "SupportList:\n"
895 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
896 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
897 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
898 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
899 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n"
900 "{product_name:Archer A7,product_ver:5.0.0,special_id:52550000}\n",
901 .part_trail = 0x00,
902 .soft_ver = SOFT_VER_TEXT("soft_ver:7.0.0\n"),
903
904 /* We're using a dynamic kernel/rootfs split here */
905 .partitions = {
906 {"factory-boot", 0x00000, 0x20000},
907 {"fs-uboot", 0x20000, 0x20000},
908 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
909 /* Stock: name file-system base 0x160000 size 0xda0000 */
910 {"default-mac", 0xf40000, 0x00200},
911 {"pin", 0xf40200, 0x00200},
912 {"device-id", 0xf40400, 0x00100},
913 {"product-info", 0xf40500, 0x0fb00},
914 {"soft-version", 0xf50000, 0x00100},
915 {"extra-para", 0xf51000, 0x01000},
916 {"support-list", 0xf52000, 0x0a000},
917 {"profile", 0xf5c000, 0x04000},
918 {"default-config", 0xf60000, 0x10000},
919 {"user-config", 0xf70000, 0x40000},
920 {"certificate", 0xfb0000, 0x10000},
921 {"partition-table", 0xfc0000, 0x10000},
922 {"log", 0xfd0000, 0x20000},
923 {"radio", 0xff0000, 0x10000},
924 {NULL, 0, 0}
925 },
926
927 .first_sysupgrade_partition = "os-image",
928 .last_sysupgrade_partition = "file-system",
929 },
930
931 /** Firmware layout for the Archer A9 v6 */
932 {
933 .id = "ARCHER-A9-V6",
934 .support_list =
935 "SupportList:\n"
936 "{product_name:Archer A9,product_ver:6.0,special_id:55530000}\n"
937 "{product_name:Archer A9,product_ver:6.0,special_id:45550000}\n"
938 "{product_name:Archer A9,product_ver:6.0,special_id:52550000}\n"
939 "{product_name:Archer A9,product_ver:6.0,special_id:4A500000}\n"
940 "{product_name:Archer C90,product_ver:6.0,special_id:55530000}\n",
941 .part_trail = 0x00,
942 .soft_ver = SOFT_VER_TEXT("soft_ver:1.1.0\n"),
943
944 /* We're using a dynamic kernel/rootfs split here */
945 .partitions = {
946 {"factory-boot", 0x00000, 0x20000},
947 {"fs-uboot", 0x20000, 0x20000},
948 {"partition-table", 0x40000, 0x10000},
949 {"radio", 0x50000, 0x10000},
950 {"default-mac", 0x60000, 0x00200},
951 {"pin", 0x60200, 0x00200},
952 {"device-id", 0x60400, 0x00100},
953 {"product-info", 0x60500, 0x0fb00},
954 {"soft-version", 0x70000, 0x01000},
955 {"extra-para", 0x71000, 0x01000},
956 {"support-list", 0x72000, 0x0a000},
957 {"profile", 0x7c000, 0x04000},
958 {"user-config", 0x80000, 0x10000},
959 {"ap-config", 0x90000, 0x10000},
960 {"apdef-config", 0xa0000, 0x10000},
961 {"router-config", 0xb0000, 0x10000},
962 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
963 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
964 {"log", 0xfc0000, 0x20000},
965 {"certificate", 0xfe0000, 0x10000},
966 {"default-config", 0xff0000, 0x10000},
967 {NULL, 0, 0}
968 },
969
970 .first_sysupgrade_partition = "os-image",
971 .last_sysupgrade_partition = "file-system",
972 },
973
974 /** Firmware layout for the Archer AX23 v1 */
975 {
976 .id = "ARCHER-AX23-V1",
977 .vendor = "",
978 .support_list =
979 "SupportList:\n"
980 "{product_name:Archer AX23,product_ver:1.0,special_id:45550000}\n"
981 "{product_name:Archer AX23,product_ver:1.20,special_id:45550000}\n"
982 "{product_name:Archer AX23,product_ver:1.0,special_id:4A500000}\n"
983 "{product_name:Archer AX23,product_ver:1.20,special_id:4A500000}\n"
984 "{product_name:Archer AX23,product_ver:1.0,special_id:4B520000}\n"
985 "{product_name:Archer AX23,product_ver:1.0,special_id:52550000}\n"
986 "{product_name:Archer AX1800,product_ver:1.20,special_id:52550000}\n"
987 "{product_name:Archer AX23,product_ver:1.0.0,special_id:55530000}\n"
988 "{product_name:Archer AX23,product_ver:1.20,special_id:55530000}\n"
989 "{product_name:Archer AX23,product_ver:1.0.0,special_id:43410000}\n"
990 "{product_name:Archer AX23,product_ver:1.0.0,special_id:54570000}\n",
991 .part_trail = 0x00,
992 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.3\n"),
993
994 .partitions = {
995 {"fs-uboot", 0x00000, 0x40000},
996 {"firmware", 0x40000, 0xf60000},
997 {"default-mac", 0xfa0000, 0x00200},
998 {"pin", 0xfa0200, 0x00100},
999 {"device-id", 0xfa0300, 0x00100},
1000 {"product-info", 0xfa0400, 0x0fc00},
1001 {"default-config", 0xfb0000, 0x08000},
1002 {"ap-def-config", 0xfb8000, 0x08000},
1003 {"user-config", 0xfc0000, 0x0a000},
1004 {"ag-config", 0xfca000, 0x04000},
1005 {"certificate", 0xfce000, 0x02000},
1006 {"ap-config", 0xfd0000, 0x06000},
1007 {"router-config", 0xfd6000, 0x06000},
1008 {"favicon", 0xfdc000, 0x02000},
1009 {"logo", 0xfde000, 0x02000},
1010 {"partition-table", 0xfe0000, 0x00800},
1011 {"soft-version", 0xfe0800, 0x00100},
1012 {"support-list", 0xfe0900, 0x00200},
1013 {"profile", 0xfe0b00, 0x03000},
1014 {"extra-para", 0xfe3b00, 0x00100},
1015 {"radio", 0xff0000, 0x10000},
1016 {NULL, 0, 0}
1017 },
1018 .first_sysupgrade_partition = "os-image",
1019 .last_sysupgrade_partition = "file-system",
1020 },
1021 /** Firmware layout for the C2v3 */
1022 {
1023 .id = "ARCHER-C2-V3",
1024 .support_list =
1025 "SupportList:\n"
1026 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
1027 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
1028 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
1029 .part_trail = 0x00,
1030 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.1\n"),
1031
1032 /** We're using a dynamic kernel/rootfs split here */
1033
1034 .partitions = {
1035 {"factory-boot", 0x00000, 0x20000},
1036 {"fs-uboot", 0x20000, 0x10000},
1037 {"firmware", 0x30000, 0x7a0000},
1038 {"user-config", 0x7d0000, 0x04000},
1039 {"default-mac", 0x7e0000, 0x00100},
1040 {"device-id", 0x7e0100, 0x00100},
1041 {"extra-para", 0x7e0200, 0x00100},
1042 {"pin", 0x7e0300, 0x00100},
1043 {"support-list", 0x7e0400, 0x00400},
1044 {"soft-version", 0x7e0800, 0x00400},
1045 {"product-info", 0x7e0c00, 0x01400},
1046 {"partition-table", 0x7e2000, 0x01000},
1047 {"profile", 0x7e3000, 0x01000},
1048 {"default-config", 0x7e4000, 0x04000},
1049 {"merge-config", 0x7ec000, 0x02000},
1050 {"qos-db", 0x7ee000, 0x02000},
1051 {"radio", 0x7f0000, 0x10000},
1052 {NULL, 0, 0}
1053 },
1054
1055 .first_sysupgrade_partition = "os-image",
1056 .last_sysupgrade_partition = "file-system",
1057 },
1058
1059 /** Firmware layout for the C25v1 */
1060 {
1061 .id = "ARCHER-C25-V1",
1062 .support_list =
1063 "SupportList:\n"
1064 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1065 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1066 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1067 .part_trail = 0x00,
1068 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1069
1070 /* We're using a dynamic kernel/rootfs split here */
1071 .partitions = {
1072 {"factory-boot", 0x00000, 0x20000},
1073 {"fs-uboot", 0x20000, 0x10000},
1074 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1075 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1076 {"user-config", 0x7d0000, 0x04000},
1077 {"default-mac", 0x7e0000, 0x00100},
1078 {"device-id", 0x7e0100, 0x00100},
1079 {"extra-para", 0x7e0200, 0x00100},
1080 {"pin", 0x7e0300, 0x00100},
1081 {"support-list", 0x7e0400, 0x00400},
1082 {"soft-version", 0x7e0800, 0x00400},
1083 {"product-info", 0x7e0c00, 0x01400},
1084 {"partition-table", 0x7e2000, 0x01000},
1085 {"profile", 0x7e3000, 0x01000},
1086 {"default-config", 0x7e4000, 0x04000},
1087 {"merge-config", 0x7ec000, 0x02000},
1088 {"qos-db", 0x7ee000, 0x02000},
1089 {"radio", 0x7f0000, 0x10000},
1090 {NULL, 0, 0}
1091 },
1092
1093 .first_sysupgrade_partition = "os-image",
1094 .last_sysupgrade_partition = "file-system",
1095 },
1096
1097 /** Firmware layout for the C58v1 */
1098 {
1099 .id = "ARCHER-C58-V1",
1100 .vendor = "",
1101 .support_list =
1102 "SupportList:\r\n"
1103 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1104 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1105 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1106 .part_trail = 0x00,
1107 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1108
1109 .partitions = {
1110 {"fs-uboot", 0x00000, 0x10000},
1111 {"default-mac", 0x10000, 0x00200},
1112 {"pin", 0x10200, 0x00200},
1113 {"product-info", 0x10400, 0x00100},
1114 {"partition-table", 0x10500, 0x00800},
1115 {"soft-version", 0x11300, 0x00200},
1116 {"support-list", 0x11500, 0x00100},
1117 {"device-id", 0x11600, 0x00100},
1118 {"profile", 0x11700, 0x03900},
1119 {"default-config", 0x15000, 0x04000},
1120 {"user-config", 0x19000, 0x04000},
1121 {"firmware", 0x20000, 0x7c8000},
1122 {"certyficate", 0x7e8000, 0x08000},
1123 {"radio", 0x7f0000, 0x10000},
1124 {NULL, 0, 0}
1125 },
1126
1127 .first_sysupgrade_partition = "os-image",
1128 .last_sysupgrade_partition = "file-system",
1129 },
1130
1131 /** Firmware layout for the C59v1 */
1132 {
1133 .id = "ARCHER-C59-V1",
1134 .vendor = "",
1135 .support_list =
1136 "SupportList:\r\n"
1137 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1138 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1139 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1140 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1141 .part_trail = 0x00,
1142 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1143
1144 /* We're using a dynamic kernel/rootfs split here */
1145 .partitions = {
1146 {"fs-uboot", 0x00000, 0x10000},
1147 {"default-mac", 0x10000, 0x00200},
1148 {"pin", 0x10200, 0x00200},
1149 {"device-id", 0x10400, 0x00100},
1150 {"product-info", 0x10500, 0x0fb00},
1151 {"firmware", 0x20000, 0xe30000},
1152 {"partition-table", 0xe50000, 0x10000},
1153 {"soft-version", 0xe60000, 0x10000},
1154 {"support-list", 0xe70000, 0x10000},
1155 {"profile", 0xe80000, 0x10000},
1156 {"default-config", 0xe90000, 0x10000},
1157 {"user-config", 0xea0000, 0x40000},
1158 {"usb-config", 0xee0000, 0x10000},
1159 {"certificate", 0xef0000, 0x10000},
1160 {"qos-db", 0xf00000, 0x40000},
1161 {"log", 0xfe0000, 0x10000},
1162 {"radio", 0xff0000, 0x10000},
1163 {NULL, 0, 0}
1164 },
1165
1166 .first_sysupgrade_partition = "os-image",
1167 .last_sysupgrade_partition = "file-system",
1168 },
1169
1170 /** Firmware layout for the C59v2 */
1171 {
1172 .id = "ARCHER-C59-V2",
1173 .vendor = "",
1174 .support_list =
1175 "SupportList:\r\n"
1176 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1177 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1178 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1179 .part_trail = 0x00,
1180 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1181
1182 /** We're using a dynamic kernel/rootfs split here */
1183 .partitions = {
1184 {"factory-boot", 0x00000, 0x20000},
1185 {"fs-uboot", 0x20000, 0x10000},
1186 {"default-mac", 0x30000, 0x00200},
1187 {"pin", 0x30200, 0x00200},
1188 {"device-id", 0x30400, 0x00100},
1189 {"product-info", 0x30500, 0x0fb00},
1190 {"firmware", 0x40000, 0xe10000},
1191 {"partition-table", 0xe50000, 0x10000},
1192 {"soft-version", 0xe60000, 0x10000},
1193 {"support-list", 0xe70000, 0x10000},
1194 {"profile", 0xe80000, 0x10000},
1195 {"default-config", 0xe90000, 0x10000},
1196 {"user-config", 0xea0000, 0x40000},
1197 {"usb-config", 0xee0000, 0x10000},
1198 {"certificate", 0xef0000, 0x10000},
1199 {"extra-para", 0xf00000, 0x10000},
1200 {"qos-db", 0xf10000, 0x30000},
1201 {"log", 0xfe0000, 0x10000},
1202 {"radio", 0xff0000, 0x10000},
1203 {NULL, 0, 0}
1204 },
1205
1206 .first_sysupgrade_partition = "os-image",
1207 .last_sysupgrade_partition = "file-system",
1208 },
1209
1210 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1211 {
1212 .id = "ARCHER-C6-V2",
1213 .vendor = "",
1214 .support_list =
1215 "SupportList:\r\n"
1216 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1217 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1218 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1219 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1220 .part_trail = 0x00,
1221 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1222
1223 .partitions = {
1224 {"fs-uboot", 0x00000, 0x20000},
1225 {"default-mac", 0x20000, 0x00200},
1226 {"pin", 0x20200, 0x00100},
1227 {"product-info", 0x20300, 0x00200},
1228 {"device-id", 0x20500, 0x0fb00},
1229 {"firmware", 0x30000, 0x7a9400},
1230 {"soft-version", 0x7d9400, 0x00100},
1231 {"extra-para", 0x7d9500, 0x00100},
1232 {"support-list", 0x7d9600, 0x00200},
1233 {"profile", 0x7d9800, 0x03000},
1234 {"default-config", 0x7dc800, 0x03000},
1235 {"partition-table", 0x7df800, 0x00800},
1236 {"user-config", 0x7e0000, 0x0c000},
1237 {"certificate", 0x7ec000, 0x04000},
1238 {"radio", 0x7f0000, 0x10000},
1239 {NULL, 0, 0}
1240 },
1241
1242 .first_sysupgrade_partition = "os-image",
1243 .last_sysupgrade_partition = "file-system",
1244 },
1245
1246 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1247 {
1248 .id = "ARCHER-C6-V2-US",
1249 .vendor = "",
1250 .support_list =
1251 "SupportList:\n"
1252 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1253 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1254 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1255 .part_trail = 0x00,
1256 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1257
1258 .partitions = {
1259 {"factory-boot", 0x00000, 0x20000},
1260 {"default-mac", 0x20000, 0x00200},
1261 {"pin", 0x20200, 0x00100},
1262 {"product-info", 0x20300, 0x00200},
1263 {"device-id", 0x20500, 0x0fb00},
1264 {"fs-uboot", 0x30000, 0x20000},
1265 {"firmware", 0x50000, 0xf89400},
1266 {"soft-version", 0xfd9400, 0x00100},
1267 {"extra-para", 0xfd9500, 0x00100},
1268 {"support-list", 0xfd9600, 0x00200},
1269 {"profile", 0xfd9800, 0x03000},
1270 {"default-config", 0xfdc800, 0x03000},
1271 {"partition-table", 0xfdf800, 0x00800},
1272 {"user-config", 0xfe0000, 0x0c000},
1273 {"certificate", 0xfec000, 0x04000},
1274 {"radio", 0xff0000, 0x10000},
1275 {NULL, 0, 0}
1276 },
1277 .first_sysupgrade_partition = "os-image",
1278 .last_sysupgrade_partition = "file-system",
1279 },
1280 /** Firmware layout for the Archer C6 v3 */
1281 {
1282 .id = "ARCHER-C6-V3",
1283 .vendor = "",
1284 .support_list =
1285 "SupportList:\n"
1286 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1287 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1288 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1289 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1290 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1291 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1292 .part_trail = 0x00,
1293 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1294
1295 .partitions = {
1296 {"fs-uboot", 0x00000, 0x40000},
1297 {"firmware", 0x40000, 0xf60000},
1298 {"default-mac", 0xfa0000, 0x00200},
1299 {"pin", 0xfa0200, 0x00100},
1300 {"device-id", 0xfa0300, 0x00100},
1301 {"product-info", 0xfa0400, 0x0fc00},
1302 {"default-config", 0xfb0000, 0x08000},
1303 {"ap-def-config", 0xfb8000, 0x08000},
1304 {"user-config", 0xfc0000, 0x0a000},
1305 {"ag-config", 0xfca000, 0x04000},
1306 {"certificate", 0xfce000, 0x02000},
1307 {"ap-config", 0xfd0000, 0x06000},
1308 {"router-config", 0xfd6000, 0x06000},
1309 {"favicon", 0xfdc000, 0x02000},
1310 {"logo", 0xfde000, 0x02000},
1311 {"partition-table", 0xfe0000, 0x00800},
1312 {"soft-version", 0xfe0800, 0x00100},
1313 {"support-list", 0xfe0900, 0x00200},
1314 {"profile", 0xfe0b00, 0x03000},
1315 {"extra-para", 0xfe3b00, 0x00100},
1316 {"radio", 0xff0000, 0x10000},
1317 {NULL, 0, 0}
1318 },
1319 .first_sysupgrade_partition = "os-image",
1320 .last_sysupgrade_partition = "file-system",
1321 },
1322 /** Firmware layout for the Archer A6 v3 */
1323 {
1324 .id = "ARCHER-A6-V3",
1325 .vendor = "",
1326 .support_list =
1327 "SupportList:\n"
1328 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1329 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1330 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1331 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n",
1332 .part_trail = 0x00,
1333 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1334
1335 .partitions = {
1336 {"fs-uboot", 0x00000, 0x40000},
1337 {"firmware", 0x40000, 0xf60000},
1338 {"default-mac", 0xfa0000, 0x00200},
1339 {"pin", 0xfa0200, 0x00100},
1340 {"device-id", 0xfa0300, 0x00100},
1341 {"product-info", 0xfa0400, 0x0fc00},
1342 {"default-config", 0xfb0000, 0x08000},
1343 {"ap-def-config", 0xfb8000, 0x08000},
1344 {"user-config", 0xfc0000, 0x0a000},
1345 {"ag-config", 0xfca000, 0x04000},
1346 {"certificate", 0xfce000, 0x02000},
1347 {"ap-config", 0xfd0000, 0x06000},
1348 {"router-config", 0xfd6000, 0x06000},
1349 {"favicon", 0xfdc000, 0x02000},
1350 {"logo", 0xfde000, 0x02000},
1351 {"partition-table", 0xfe0000, 0x00800},
1352 {"soft-version", 0xfe0800, 0x00100},
1353 {"support-list", 0xfe0900, 0x00200},
1354 {"profile", 0xfe0b00, 0x03000},
1355 {"extra-para", 0xfe3b00, 0x00100},
1356 {"radio", 0xff0000, 0x10000},
1357 {NULL, 0, 0}
1358 },
1359 .first_sysupgrade_partition = "os-image",
1360 .last_sysupgrade_partition = "file-system",
1361 },
1362 /** Firmware layout for the Archer C6U v1 */
1363 {
1364 .id = "ARCHER-C6U-V1",
1365 .vendor = "",
1366 .support_list =
1367 "SupportList:\n"
1368 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1369 .part_trail = 0x00,
1370 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1371
1372 .partitions = {
1373 {"fs-uboot", 0x00000, 0x40000},
1374 {"firmware", 0x40000, 0xf60000},
1375 {"default-mac", 0xfa0000, 0x00200},
1376 {"pin", 0xfa0200, 0x00100},
1377 {"device-id", 0xfa0300, 0x00100},
1378 {"product-info", 0xfa0400, 0x0fc00},
1379 {"default-config", 0xfb0000, 0x08000},
1380 {"ap-def-config", 0xfb8000, 0x08000},
1381 {"user-config", 0xfc0000, 0x0c000},
1382 {"certificate", 0xfcc000, 0x04000},
1383 {"ap-config", 0xfd0000, 0x08000},
1384 {"router-config", 0xfd8000, 0x08000},
1385 {"partition-table", 0xfe0000, 0x00800},
1386 {"soft-version", 0xfe0800, 0x00100},
1387 {"support-list", 0xfe0900, 0x00200},
1388 {"profile", 0xfe0b00, 0x03000},
1389 {"extra-para", 0xfe3b00, 0x00100},
1390 {"radio", 0xff0000, 0x10000},
1391 {NULL, 0, 0}
1392 },
1393 .first_sysupgrade_partition = "os-image",
1394 .last_sysupgrade_partition = "file-system",
1395 },
1396 /** Firmware layout for the C60v1 */
1397 {
1398 .id = "ARCHER-C60-V1",
1399 .vendor = "",
1400 .support_list =
1401 "SupportList:\r\n"
1402 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1403 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1404 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1405 .part_trail = 0x00,
1406 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1407
1408 .partitions = {
1409 {"fs-uboot", 0x00000, 0x10000},
1410 {"default-mac", 0x10000, 0x00200},
1411 {"pin", 0x10200, 0x00200},
1412 {"product-info", 0x10400, 0x00100},
1413 {"partition-table", 0x10500, 0x00800},
1414 {"soft-version", 0x11300, 0x00200},
1415 {"support-list", 0x11500, 0x00100},
1416 {"device-id", 0x11600, 0x00100},
1417 {"profile", 0x11700, 0x03900},
1418 {"default-config", 0x15000, 0x04000},
1419 {"user-config", 0x19000, 0x04000},
1420 {"firmware", 0x20000, 0x7c8000},
1421 {"certyficate", 0x7e8000, 0x08000},
1422 {"radio", 0x7f0000, 0x10000},
1423 {NULL, 0, 0}
1424 },
1425
1426 .first_sysupgrade_partition = "os-image",
1427 .last_sysupgrade_partition = "file-system",
1428 },
1429
1430 /** Firmware layout for the C60v2 */
1431 {
1432 .id = "ARCHER-C60-V2",
1433 .vendor = "",
1434 .support_list =
1435 "SupportList:\r\n"
1436 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1437 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1438 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1439 .part_trail = 0x00,
1440 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1441
1442 .partitions = {
1443 {"factory-boot", 0x00000, 0x1fb00},
1444 {"default-mac", 0x1fb00, 0x00200},
1445 {"pin", 0x1fd00, 0x00100},
1446 {"product-info", 0x1fe00, 0x00100},
1447 {"device-id", 0x1ff00, 0x00100},
1448 {"fs-uboot", 0x20000, 0x10000},
1449 {"firmware", 0x30000, 0x7a0000},
1450 {"soft-version", 0x7d9500, 0x00100},
1451 {"support-list", 0x7d9600, 0x00100},
1452 {"extra-para", 0x7d9700, 0x00100},
1453 {"profile", 0x7d9800, 0x03000},
1454 {"default-config", 0x7dc800, 0x03000},
1455 {"partition-table", 0x7df800, 0x00800},
1456 {"user-config", 0x7e0000, 0x0c000},
1457 {"certificate", 0x7ec000, 0x04000},
1458 {"radio", 0x7f0000, 0x10000},
1459 {NULL, 0, 0}
1460 },
1461
1462 .first_sysupgrade_partition = "os-image",
1463 .last_sysupgrade_partition = "file-system",
1464 },
1465
1466 /** Firmware layout for the C60v3 */
1467 {
1468 .id = "ARCHER-C60-V3",
1469 .vendor = "",
1470 .support_list =
1471 "SupportList:\r\n"
1472 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1473 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1474 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1475 .part_trail = 0x00,
1476 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1477
1478 .partitions = {
1479 {"factory-boot", 0x00000, 0x1fb00},
1480 {"default-mac", 0x1fb00, 0x00200},
1481 {"pin", 0x1fd00, 0x00100},
1482 {"product-info", 0x1fe00, 0x00100},
1483 {"device-id", 0x1ff00, 0x00100},
1484 {"fs-uboot", 0x20000, 0x10000},
1485 {"firmware", 0x30000, 0x7a0000},
1486 {"soft-version", 0x7d9500, 0x00100},
1487 {"support-list", 0x7d9600, 0x00100},
1488 {"extra-para", 0x7d9700, 0x00100},
1489 {"profile", 0x7d9800, 0x03000},
1490 {"default-config", 0x7dc800, 0x03000},
1491 {"partition-table", 0x7df800, 0x00800},
1492 {"user-config", 0x7e0000, 0x0c000},
1493 {"certificate", 0x7ec000, 0x04000},
1494 {"radio", 0x7f0000, 0x10000},
1495 {NULL, 0, 0}
1496 },
1497
1498 .first_sysupgrade_partition = "os-image",
1499 .last_sysupgrade_partition = "file-system",
1500 },
1501
1502 /** Firmware layout for the C5 */
1503 {
1504 .id = "ARCHER-C5-V2",
1505 .vendor = "",
1506 .support_list =
1507 "SupportList:\r\n"
1508 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1509 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1510 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1511 .part_trail = 0x00,
1512 .soft_ver = SOFT_VER_DEFAULT,
1513
1514 .partitions = {
1515 {"fs-uboot", 0x00000, 0x40000},
1516 {"os-image", 0x40000, 0x200000},
1517 {"file-system", 0x240000, 0xc00000},
1518 {"default-mac", 0xe40000, 0x00200},
1519 {"pin", 0xe40200, 0x00200},
1520 {"product-info", 0xe40400, 0x00200},
1521 {"partition-table", 0xe50000, 0x10000},
1522 {"soft-version", 0xe60000, 0x00200},
1523 {"support-list", 0xe61000, 0x0f000},
1524 {"profile", 0xe70000, 0x10000},
1525 {"default-config", 0xe80000, 0x10000},
1526 {"user-config", 0xe90000, 0x50000},
1527 {"log", 0xee0000, 0x100000},
1528 {"radio_bk", 0xfe0000, 0x10000},
1529 {"radio", 0xff0000, 0x10000},
1530 {NULL, 0, 0}
1531 },
1532
1533 .first_sysupgrade_partition = "os-image",
1534 .last_sysupgrade_partition = "file-system"
1535 },
1536
1537 /** Firmware layout for the C7 */
1538 {
1539 .id = "ARCHER-C7-V4",
1540 .support_list =
1541 "SupportList:\n"
1542 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1543 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1544 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1545 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1546 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1547 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1548 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1549 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1550 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1551 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1552 .part_trail = 0x00,
1553 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1554
1555 /* We're using a dynamic kernel/rootfs split here */
1556 .partitions = {
1557 {"factory-boot", 0x00000, 0x20000},
1558 {"fs-uboot", 0x20000, 0x20000},
1559 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1560 /* Stock: name file-system base 0x160000 size 0xda0000 */
1561 {"default-mac", 0xf00000, 0x00200},
1562 {"pin", 0xf00200, 0x00200},
1563 {"device-id", 0xf00400, 0x00100},
1564 {"product-info", 0xf00500, 0x0fb00},
1565 {"soft-version", 0xf10000, 0x00100},
1566 {"extra-para", 0xf11000, 0x01000},
1567 {"support-list", 0xf12000, 0x0a000},
1568 {"profile", 0xf1c000, 0x04000},
1569 {"default-config", 0xf20000, 0x10000},
1570 {"user-config", 0xf30000, 0x40000},
1571 {"qos-db", 0xf70000, 0x40000},
1572 {"certificate", 0xfb0000, 0x10000},
1573 {"partition-table", 0xfc0000, 0x10000},
1574 {"log", 0xfd0000, 0x20000},
1575 {"radio", 0xff0000, 0x10000},
1576 {NULL, 0, 0}
1577 },
1578
1579 .first_sysupgrade_partition = "os-image",
1580 .last_sysupgrade_partition = "file-system",
1581 },
1582
1583 /** Firmware layout for the C7 v5*/
1584 {
1585 .id = "ARCHER-C7-V5",
1586 .support_list =
1587 "SupportList:\n"
1588 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1589 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1590 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1591 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1592 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1593 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1594 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1595 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1596
1597 .part_trail = 0x00,
1598 .soft_ver = SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1599
1600 /* We're using a dynamic kernel/rootfs split here */
1601 .partitions = {
1602 {"factory-boot", 0x00000, 0x20000},
1603 {"fs-uboot", 0x20000, 0x20000},
1604 {"partition-table", 0x40000, 0x10000},
1605 {"radio", 0x50000, 0x10000},
1606 {"default-mac", 0x60000, 0x00200},
1607 {"pin", 0x60200, 0x00200},
1608 {"device-id", 0x60400, 0x00100},
1609 {"product-info", 0x60500, 0x0fb00},
1610 {"soft-version", 0x70000, 0x01000},
1611 {"extra-para", 0x71000, 0x01000},
1612 {"support-list", 0x72000, 0x0a000},
1613 {"profile", 0x7c000, 0x04000},
1614 {"user-config", 0x80000, 0x40000},
1615
1616
1617 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1618 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1619
1620 {"log", 0xfc0000, 0x20000},
1621 {"certificate", 0xfe0000, 0x10000},
1622 {"default-config", 0xff0000, 0x10000},
1623 {NULL, 0, 0}
1624
1625 },
1626
1627 .first_sysupgrade_partition = "os-image",
1628 .last_sysupgrade_partition = "file-system",
1629 },
1630
1631 /** Firmware layout for the C9 */
1632 {
1633 .id = "ARCHERC9",
1634 .vendor = "",
1635 .support_list =
1636 "SupportList:\n"
1637 "{product_name:ArcherC9,"
1638 "product_ver:1.0.0,"
1639 "special_id:00000000}\n",
1640 .part_trail = 0x00,
1641 .soft_ver = SOFT_VER_DEFAULT,
1642
1643 .partitions = {
1644 {"fs-uboot", 0x00000, 0x40000},
1645 {"os-image", 0x40000, 0x200000},
1646 {"file-system", 0x240000, 0xc00000},
1647 {"default-mac", 0xe40000, 0x00200},
1648 {"pin", 0xe40200, 0x00200},
1649 {"product-info", 0xe40400, 0x00200},
1650 {"partition-table", 0xe50000, 0x10000},
1651 {"soft-version", 0xe60000, 0x00200},
1652 {"support-list", 0xe61000, 0x0f000},
1653 {"profile", 0xe70000, 0x10000},
1654 {"default-config", 0xe80000, 0x10000},
1655 {"user-config", 0xe90000, 0x50000},
1656 {"log", 0xee0000, 0x100000},
1657 {"radio_bk", 0xfe0000, 0x10000},
1658 {"radio", 0xff0000, 0x10000},
1659 {NULL, 0, 0}
1660 },
1661
1662 .first_sysupgrade_partition = "os-image",
1663 .last_sysupgrade_partition = "file-system"
1664 },
1665
1666 /** Firmware layout for the Deco M4R v1 and v2 */
1667 {
1668 .id = "DECO-M4R-V1",
1669 .vendor = "",
1670 .support_list =
1671 "SupportList:\n"
1672 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1673 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1674 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1675 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1676 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1677 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1678 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1679 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1680 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1681 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1682 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1683 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1684 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1685 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1686 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1687 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1688 .part_trail = 0x00,
1689 .soft_ver = SOFT_VER_DEFAULT,
1690
1691 .partitions = {
1692 {"fs-uboot", 0x00000, 0x80000},
1693 {"firmware", 0x80000, 0xe00000},
1694 {"product-info", 0xe80000, 0x05000},
1695 {"default-mac", 0xe85000, 0x01000},
1696 {"device-id", 0xe86000, 0x01000},
1697 {"support-list", 0xe87000, 0x10000},
1698 {"user-config", 0xea7000, 0x10000},
1699 {"device-config", 0xeb7000, 0x10000},
1700 {"group-info", 0xec7000, 0x10000},
1701 {"partition-table", 0xed7000, 0x02000},
1702 {"soft-version", 0xed9000, 0x10000},
1703 {"profile", 0xee9000, 0x10000},
1704 {"default-config", 0xef9000, 0x10000},
1705 {"url-sig", 0xfe0000, 0x10000},
1706 {"radio", 0xff0000, 0x10000},
1707 {NULL, 0, 0}
1708 },
1709 .first_sysupgrade_partition = "os-image",
1710 .last_sysupgrade_partition = "file-system",
1711 },
1712
1713 /** Firmware layout for the Deco M4R v4 */
1714 {
1715 .id = "DECO-M4R-V4",
1716 .vendor = "",
1717 .support_list =
1718 "SupportList:\n"
1719 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1720 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1721 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1722 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1723 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1724 .part_trail = 0x00,
1725 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1726
1727 .partitions = {
1728 {"fs-uboot", 0x00000, 0x40000},
1729 {"firmware", 0x40000, 0xf60000},
1730 {"default-mac", 0xfa0000, 0x00300},
1731 {"device-id", 0xfa0300, 0x00100},
1732 {"product-info", 0xfa0400, 0x0fc00},
1733 {"group-info", 0xfb0000, 0x04000},
1734 {"user-config", 0xfb4000, 0x0c000},
1735 {"device-config", 0xfc0000, 0x10000},
1736 {"default-config", 0xfd0000, 0x10000},
1737 {"partition-table", 0xfe0000, 0x00800},
1738 {"soft-version", 0xfe0800, 0x00100},
1739 {"support-list", 0xfe0900, 0x00200},
1740 {"profile", 0xfe0b00, 0x03000},
1741 {"extra-para", 0xfe3b00, 0x00100},
1742 {"radio", 0xff0000, 0x10000},
1743 {NULL, 0, 0}
1744 },
1745 .first_sysupgrade_partition = "os-image",
1746 .last_sysupgrade_partition = "file-system",
1747 },
1748
1749 /** Firmware layout for the Deco S4 v2 */
1750 {
1751 .id = "DECO-S4-V2",
1752 .vendor = "",
1753 .support_list =
1754 "SupportList:\n"
1755 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1756 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1757 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1758 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1759 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1760 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1761 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1762 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1763 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1764 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1765 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1766 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1767 .part_trail = 0x00,
1768 .soft_ver = SOFT_VER_DEFAULT,
1769
1770 .partitions = {
1771 {"fs-uboot", 0x00000, 0x80000},
1772 {"product-info", 0x80000, 0x05000},
1773 {"default-mac", 0x85000, 0x01000},
1774 {"device-id", 0x86000, 0x01000},
1775 {"support-list", 0x87000, 0x10000},
1776 {"user-config", 0xa7000, 0x10000},
1777 {"device-config", 0xb7000, 0x10000},
1778 {"group-info", 0xc7000, 0x10000},
1779 {"partition-table", 0xd7000, 0x02000},
1780 {"soft-version", 0xd9000, 0x10000},
1781 {"profile", 0xe9000, 0x10000},
1782 {"default-config", 0xf9000, 0x10000},
1783 {"url-sig", 0x1e0000, 0x10000},
1784 {"radio", 0x1f0000, 0x10000},
1785 {"firmware", 0x200000, 0xe00000},
1786 {NULL, 0, 0}
1787 },
1788 .first_sysupgrade_partition = "os-image",
1789 .last_sysupgrade_partition = "file-system",
1790 },
1791
1792 /** Firmware layout for the EAP120 */
1793 {
1794 .id = "EAP120",
1795 .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1796 .support_list =
1797 "SupportList:\r\n"
1798 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1799 .part_trail = 0xff,
1800 .soft_ver = SOFT_VER_DEFAULT,
1801
1802 .partitions = {
1803 {"fs-uboot", 0x00000, 0x20000},
1804 {"partition-table", 0x20000, 0x02000},
1805 {"default-mac", 0x30000, 0x00020},
1806 {"support-list", 0x31000, 0x00100},
1807 {"product-info", 0x31100, 0x00100},
1808 {"soft-version", 0x32000, 0x00100},
1809 {"os-image", 0x40000, 0x180000},
1810 {"file-system", 0x1c0000, 0x600000},
1811 {"user-config", 0x7c0000, 0x10000},
1812 {"backup-config", 0x7d0000, 0x10000},
1813 {"log", 0x7e0000, 0x10000},
1814 {"radio", 0x7f0000, 0x10000},
1815 {NULL, 0, 0}
1816 },
1817
1818 .first_sysupgrade_partition = "os-image",
1819 .last_sysupgrade_partition = "file-system"
1820 },
1821
1822 /** Firmware layout for the EAP225-Outdoor v1 */
1823 {
1824 .id = "EAP225-OUTDOOR-V1",
1825 .support_list =
1826 "SupportList:\r\n"
1827 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1828 .part_trail = PART_TRAIL_NONE,
1829 .soft_ver = SOFT_VER_DEFAULT,
1830 .soft_ver_compat_level = 1,
1831
1832 .partitions = {
1833 {"fs-uboot", 0x00000, 0x20000},
1834 {"partition-table", 0x20000, 0x02000},
1835 {"default-mac", 0x30000, 0x01000},
1836 {"support-list", 0x31000, 0x00100},
1837 {"product-info", 0x31100, 0x00400},
1838 {"soft-version", 0x32000, 0x00100},
1839 {"firmware", 0x40000, 0xd80000},
1840 {"user-config", 0xdc0000, 0x30000},
1841 {"mutil-log", 0xf30000, 0x80000},
1842 {"oops", 0xfb0000, 0x40000},
1843 {"radio", 0xff0000, 0x10000},
1844 {NULL, 0, 0}
1845 },
1846
1847 .first_sysupgrade_partition = "os-image",
1848 .last_sysupgrade_partition = "file-system"
1849 },
1850
1851 /** Firmware layout for the EAP225 v1 */
1852 {
1853 .id = "EAP225-V1",
1854 .support_list =
1855 "SupportList:\r\n"
1856 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1857 .part_trail = PART_TRAIL_NONE,
1858 .soft_ver = SOFT_VER_DEFAULT,
1859
1860 .partitions = {
1861 {"fs-uboot", 0x00000, 0x20000},
1862 {"partition-table", 0x20000, 0x02000},
1863 {"default-mac", 0x30000, 0x01000},
1864 {"support-list", 0x31000, 0x00100},
1865 {"product-info", 0x31100, 0x00400},
1866 {"soft-version", 0x32000, 0x00100},
1867 {"firmware", 0x40000, 0xd80000},
1868 {"user-config", 0xdc0000, 0x30000},
1869 {"radio", 0xff0000, 0x10000},
1870 {NULL, 0, 0}
1871 },
1872
1873 .first_sysupgrade_partition = "os-image",
1874 .last_sysupgrade_partition = "file-system"
1875 },
1876
1877 /** Firmware layout for the EAP225 v3
1878 * Also compatible with:
1879 * - EAP225 v3.20
1880 * - EAP225 v4
1881 * - EAP225-Outdoor v1
1882 * - EAP225-Outdoor v3
1883 * */
1884 {
1885 .id = "EAP225-V3",
1886 .support_list =
1887 "SupportList:\r\n"
1888 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1889 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1890 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1891 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1892 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1893 .part_trail = PART_TRAIL_NONE,
1894 .soft_ver = SOFT_VER_DEFAULT,
1895 .soft_ver_compat_level = 1,
1896
1897 .partitions = {
1898 {"fs-uboot", 0x00000, 0x20000},
1899 {"partition-table", 0x20000, 0x02000},
1900 {"default-mac", 0x30000, 0x01000},
1901 {"support-list", 0x31000, 0x00100},
1902 {"product-info", 0x31100, 0x00400},
1903 {"soft-version", 0x32000, 0x00100},
1904 {"firmware", 0x40000, 0xd80000},
1905 {"user-config", 0xdc0000, 0x30000},
1906 {"mutil-log", 0xf30000, 0x80000},
1907 {"oops", 0xfb0000, 0x40000},
1908 {"radio", 0xff0000, 0x10000},
1909 {NULL, 0, 0}
1910 },
1911
1912 .first_sysupgrade_partition = "os-image",
1913 .last_sysupgrade_partition = "file-system"
1914 },
1915
1916 /** Firmware layout for the EAP225-Wall v2 */
1917 {
1918 .id = "EAP225-WALL-V2",
1919 .support_list =
1920 "SupportList:\r\n"
1921 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1922 .part_trail = PART_TRAIL_NONE,
1923 .soft_ver = SOFT_VER_DEFAULT,
1924 .soft_ver_compat_level = 1,
1925
1926 .partitions = {
1927 {"fs-uboot", 0x00000, 0x20000},
1928 {"partition-table", 0x20000, 0x02000},
1929 {"default-mac", 0x30000, 0x01000},
1930 {"support-list", 0x31000, 0x00100},
1931 {"product-info", 0x31100, 0x00400},
1932 {"soft-version", 0x32000, 0x00100},
1933 {"firmware", 0x40000, 0xd80000},
1934 {"user-config", 0xdc0000, 0x30000},
1935 {"mutil-log", 0xf30000, 0x80000},
1936 {"oops", 0xfb0000, 0x40000},
1937 {"radio", 0xff0000, 0x10000},
1938 {NULL, 0, 0}
1939 },
1940
1941 .first_sysupgrade_partition = "os-image",
1942 .last_sysupgrade_partition = "file-system"
1943 },
1944
1945 /** Firmware layout for the EAP235-Wall v1 */
1946 {
1947 .id = "EAP235-WALL-V1",
1948 .support_list =
1949 "SupportList:\r\n"
1950 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1951 .part_trail = PART_TRAIL_NONE,
1952 .soft_ver = SOFT_VER_NUMERIC(3, 0, 0),
1953 .soft_ver_compat_level = 1,
1954
1955 .partitions = {
1956 {"fs-uboot", 0x00000, 0x80000},
1957 {"partition-table", 0x80000, 0x02000},
1958 {"default-mac", 0x90000, 0x01000},
1959 {"support-list", 0x91000, 0x00100},
1960 {"product-info", 0x91100, 0x00400},
1961 {"soft-version", 0x92000, 0x00100},
1962 {"firmware", 0xa0000, 0xd20000},
1963 {"user-config", 0xdc0000, 0x30000},
1964 {"mutil-log", 0xf30000, 0x80000},
1965 {"oops", 0xfb0000, 0x40000},
1966 {"radio", 0xff0000, 0x10000},
1967 {NULL, 0, 0}
1968 },
1969
1970 .first_sysupgrade_partition = "os-image",
1971 .last_sysupgrade_partition = "file-system"
1972 },
1973
1974 /** Firmware layout for the EAP245 v1 */
1975 {
1976 .id = "EAP245-V1",
1977 .support_list =
1978 "SupportList:\r\n"
1979 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1980 .part_trail = PART_TRAIL_NONE,
1981 .soft_ver = SOFT_VER_DEFAULT,
1982
1983 .partitions = {
1984 {"fs-uboot", 0x00000, 0x20000},
1985 {"partition-table", 0x20000, 0x02000},
1986 {"default-mac", 0x30000, 0x01000},
1987 {"support-list", 0x31000, 0x00100},
1988 {"product-info", 0x31100, 0x00400},
1989 {"soft-version", 0x32000, 0x00100},
1990 {"firmware", 0x40000, 0xd80000},
1991 {"user-config", 0xdc0000, 0x30000},
1992 {"radio", 0xff0000, 0x10000},
1993 {NULL, 0, 0}
1994 },
1995
1996 .first_sysupgrade_partition = "os-image",
1997 .last_sysupgrade_partition = "file-system"
1998 },
1999
2000 /** Firmware layout for the EAP245 v3 */
2001 {
2002 .id = "EAP245-V3",
2003 .support_list =
2004 "SupportList:\r\n"
2005 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
2006 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
2007 .part_trail = PART_TRAIL_NONE,
2008 .soft_ver = SOFT_VER_DEFAULT,
2009 .soft_ver_compat_level = 1,
2010
2011 /** Firmware partition with dynamic kernel/rootfs split */
2012 .partitions = {
2013 {"factroy-boot", 0x00000, 0x40000},
2014 {"fs-uboot", 0x40000, 0x40000},
2015 {"partition-table", 0x80000, 0x10000},
2016 {"default-mac", 0x90000, 0x01000},
2017 {"support-list", 0x91000, 0x00100},
2018 {"product-info", 0x91100, 0x00400},
2019 {"soft-version", 0x92000, 0x00100},
2020 {"radio", 0xa0000, 0x10000},
2021 {"extra-para", 0xb0000, 0x10000},
2022 {"firmware", 0xc0000, 0xe40000},
2023 {"config", 0xf00000, 0x30000},
2024 {"mutil-log", 0xf30000, 0x80000},
2025 {"oops", 0xfb0000, 0x40000},
2026 {NULL, 0, 0}
2027 },
2028
2029 .first_sysupgrade_partition = "os-image",
2030 .last_sysupgrade_partition = "file-system"
2031 },
2032
2033 /** Firmware layout for the EAP615-Wall v1 */
2034 {
2035 .id = "EAP615-WALL-V1",
2036 .soft_ver = SOFT_VER_DEFAULT,
2037 .soft_ver_compat_level = 1,
2038 .support_list =
2039 "SupportList:\r\n"
2040 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
2041 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
2042 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
2043 .part_trail = PART_TRAIL_NONE,
2044
2045 .partitions = {
2046 {"fs-uboot", 0x00000, 0x80000},
2047 {"partition-table", 0x80000, 0x02000},
2048 {"default-mac", 0x90000, 0x01000},
2049 {"support-list", 0x91000, 0x00100},
2050 {"product-info", 0x91100, 0x00400},
2051 {"soft-version", 0x92000, 0x00100},
2052 {"firmware", 0xa0000, 0xcf0000},
2053 {"user-config", 0xd90000, 0x60000},
2054 {"mutil-log", 0xf30000, 0x80000},
2055 {"oops", 0xfb0000, 0x40000},
2056 {"radio", 0xff0000, 0x10000},
2057 {NULL, 0, 0}
2058 },
2059
2060 .first_sysupgrade_partition = "os-image",
2061 .last_sysupgrade_partition = "file-system"
2062 },
2063
2064 /** Firmware layout for the TL-WA1201 v2 */
2065 {
2066 .id = "TL-WA1201-V2",
2067 .vendor = "",
2068 .support_list =
2069 "SupportList:\n"
2070 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2071 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2072 .part_trail = 0x00,
2073 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2074
2075 .partitions = {
2076 {"fs-uboot", 0x00000, 0x20000},
2077 {"default-mac", 0x20000, 0x00200},
2078 {"pin", 0x20200, 0x00100},
2079 {"product-info", 0x20300, 0x00200},
2080 {"device-id", 0x20500, 0x0fb00},
2081 {"firmware", 0x30000, 0xce0000},
2082 {"portal-logo", 0xd10000, 0x20000},
2083 {"portal-back", 0xd30000, 0x200000},
2084 {"soft-version", 0xf30000, 0x00200},
2085 {"extra-para", 0xf30200, 0x00200},
2086 {"support-list", 0xf30400, 0x00200},
2087 {"profile", 0xf30600, 0x0fa00},
2088 {"apdef-config", 0xf40000, 0x10000},
2089 {"ap-config", 0xf50000, 0x10000},
2090 {"redef-config", 0xf60000, 0x10000},
2091 {"re-config", 0xf70000, 0x10000},
2092 {"multidef-config", 0xf80000, 0x10000},
2093 {"multi-config", 0xf90000, 0x10000},
2094 {"clientdef-config", 0xfa0000, 0x10000},
2095 {"client-config", 0xfb0000, 0x10000},
2096 {"partition-table", 0xfc0000, 0x10000},
2097 {"user-config", 0xfd0000, 0x10000},
2098 {"certificate", 0xfe0000, 0x10000},
2099 {"radio", 0xff0000, 0x10000},
2100 {NULL, 0, 0}
2101 },
2102 .first_sysupgrade_partition = "os-image",
2103 .last_sysupgrade_partition = "file-system",
2104 },
2105
2106 /** Firmware layout for the TL-WA850RE v2 */
2107 {
2108 .id = "TLWA850REV2",
2109 .vendor = "",
2110 .support_list =
2111 "SupportList:\n"
2112 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2113 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2114 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2115 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2116 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2117 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2118 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2119 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2120 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2121 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2122 .part_trail = 0x00,
2123 .soft_ver = SOFT_VER_DEFAULT,
2124
2125 /**
2126 576KB were moved from file-system to os-image
2127 in comparison to the stock image
2128 */
2129 .partitions = {
2130 {"fs-uboot", 0x00000, 0x20000},
2131 {"firmware", 0x20000, 0x390000},
2132 {"partition-table", 0x3b0000, 0x02000},
2133 {"default-mac", 0x3c0000, 0x00020},
2134 {"pin", 0x3c0100, 0x00020},
2135 {"product-info", 0x3c1000, 0x01000},
2136 {"soft-version", 0x3c2000, 0x00100},
2137 {"support-list", 0x3c3000, 0x01000},
2138 {"profile", 0x3c4000, 0x08000},
2139 {"user-config", 0x3d0000, 0x10000},
2140 {"default-config", 0x3e0000, 0x10000},
2141 {"radio", 0x3f0000, 0x10000},
2142 {NULL, 0, 0}
2143 },
2144
2145 .first_sysupgrade_partition = "os-image",
2146 .last_sysupgrade_partition = "file-system"
2147 },
2148
2149 /** Firmware layout for the TL-WA855RE v1 */
2150 {
2151 .id = "TLWA855REV1",
2152 .vendor = "",
2153 .support_list =
2154 "SupportList:\n"
2155 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2156 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2157 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2158 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2159 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2160 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2161 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2162 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2163 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2164 .part_trail = 0x00,
2165 .soft_ver = SOFT_VER_DEFAULT,
2166
2167 .partitions = {
2168 {"fs-uboot", 0x00000, 0x20000},
2169 {"os-image", 0x20000, 0x150000},
2170 {"file-system", 0x170000, 0x240000},
2171 {"partition-table", 0x3b0000, 0x02000},
2172 {"default-mac", 0x3c0000, 0x00020},
2173 {"pin", 0x3c0100, 0x00020},
2174 {"product-info", 0x3c1000, 0x01000},
2175 {"soft-version", 0x3c2000, 0x00100},
2176 {"support-list", 0x3c3000, 0x01000},
2177 {"profile", 0x3c4000, 0x08000},
2178 {"user-config", 0x3d0000, 0x10000},
2179 {"default-config", 0x3e0000, 0x10000},
2180 {"radio", 0x3f0000, 0x10000},
2181 {NULL, 0, 0}
2182 },
2183
2184 .first_sysupgrade_partition = "os-image",
2185 .last_sysupgrade_partition = "file-system"
2186 },
2187
2188 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2189 {
2190 .id = "TL-WPA8630P-V2.0-EU",
2191 .vendor = "",
2192 .support_list =
2193 "SupportList:\n"
2194 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2195 .part_trail = 0x00,
2196 .soft_ver = SOFT_VER_DEFAULT,
2197
2198 .partitions = {
2199 {"factory-uboot", 0x00000, 0x20000},
2200 {"fs-uboot", 0x20000, 0x20000},
2201 {"firmware", 0x40000, 0x5e0000},
2202 {"partition-table", 0x620000, 0x02000},
2203 {"default-mac", 0x630000, 0x00020},
2204 {"pin", 0x630100, 0x00020},
2205 {"device-id", 0x630200, 0x00030},
2206 {"product-info", 0x631100, 0x01000},
2207 {"extra-para", 0x632100, 0x01000},
2208 {"soft-version", 0x640000, 0x01000},
2209 {"support-list", 0x641000, 0x01000},
2210 {"profile", 0x642000, 0x08000},
2211 {"user-config", 0x650000, 0x10000},
2212 {"default-config", 0x660000, 0x10000},
2213 {"default-nvm", 0x670000, 0xc0000},
2214 {"default-pib", 0x730000, 0x40000},
2215 {"radio", 0x7f0000, 0x10000},
2216 {NULL, 0, 0}
2217 },
2218
2219 .first_sysupgrade_partition = "os-image",
2220 .last_sysupgrade_partition = "file-system"
2221 },
2222
2223 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2224 {
2225 .id = "TL-WPA8630P-V2-INT",
2226 .vendor = "",
2227 .support_list =
2228 "SupportList:\n"
2229 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2230 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2231 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2232 .part_trail = 0x00,
2233 .soft_ver = SOFT_VER_DEFAULT,
2234
2235 .partitions = {
2236 {"factory-uboot", 0x00000, 0x20000},
2237 {"fs-uboot", 0x20000, 0x20000},
2238 {"firmware", 0x40000, 0x5e0000},
2239 {"partition-table", 0x620000, 0x02000},
2240 {"extra-para", 0x632100, 0x01000},
2241 {"soft-version", 0x640000, 0x01000},
2242 {"support-list", 0x641000, 0x01000},
2243 {"profile", 0x642000, 0x08000},
2244 {"user-config", 0x650000, 0x10000},
2245 {"default-config", 0x660000, 0x10000},
2246 {"default-nvm", 0x670000, 0xc0000},
2247 {"default-pib", 0x730000, 0x40000},
2248 {"default-mac", 0x7e0000, 0x00020},
2249 {"pin", 0x7e0100, 0x00020},
2250 {"device-id", 0x7e0200, 0x00030},
2251 {"product-info", 0x7e1100, 0x01000},
2252 {"radio", 0x7f0000, 0x10000},
2253 {NULL, 0, 0}
2254 },
2255
2256 .first_sysupgrade_partition = "os-image",
2257 .last_sysupgrade_partition = "file-system"
2258 },
2259
2260 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2261 {
2262 .id = "TL-WPA8630P-V2.1-EU",
2263 .vendor = "",
2264 .support_list =
2265 "SupportList:\n"
2266 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2267 .part_trail = 0x00,
2268 .soft_ver = SOFT_VER_DEFAULT,
2269
2270 .partitions = {
2271 {"factory-uboot", 0x00000, 0x20000},
2272 {"fs-uboot", 0x20000, 0x20000},
2273 {"firmware", 0x40000, 0x5e0000},
2274 {"extra-para", 0x680000, 0x01000},
2275 {"product-info", 0x690000, 0x01000},
2276 {"partition-table", 0x6a0000, 0x02000},
2277 {"soft-version", 0x6b0000, 0x01000},
2278 {"support-list", 0x6b1000, 0x01000},
2279 {"profile", 0x6b2000, 0x08000},
2280 {"user-config", 0x6c0000, 0x10000},
2281 {"default-config", 0x6d0000, 0x10000},
2282 {"default-nvm", 0x6e0000, 0xc0000},
2283 {"default-pib", 0x7a0000, 0x40000},
2284 {"default-mac", 0x7e0000, 0x00020},
2285 {"pin", 0x7e0100, 0x00020},
2286 {"device-id", 0x7e0200, 0x00030},
2287 {"radio", 0x7f0000, 0x10000},
2288 {NULL, 0, 0}
2289 },
2290
2291 .first_sysupgrade_partition = "os-image",
2292 .last_sysupgrade_partition = "file-system"
2293 },
2294
2295 /** Firmware layout for the TL-WPA8631P v3 */
2296 {
2297 .id = "TL-WPA8631P-V3",
2298 .vendor = "",
2299 .support_list =
2300 "SupportList:\n"
2301 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2302 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2303 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2304 .part_trail = 0x00,
2305 .soft_ver = SOFT_VER_DEFAULT,
2306
2307 .partitions = {
2308 {"fs-uboot", 0x00000, 0x20000},
2309 {"firmware", 0x20000, 0x710000},
2310 {"partition-table", 0x730000, 0x02000},
2311 {"default-mac", 0x732000, 0x00020},
2312 {"pin", 0x732100, 0x00020},
2313 {"device-id", 0x732200, 0x00030},
2314 {"default-region", 0x732300, 0x00010},
2315 {"product-info", 0x732400, 0x00200},
2316 {"extra-para", 0x732600, 0x00200},
2317 {"soft-version", 0x732800, 0x00200},
2318 {"support-list", 0x732a00, 0x00100},
2319 {"profile", 0x732b00, 0x00100},
2320 {"default-config", 0x732c00, 0x00800},
2321 {"plc-type", 0x733400, 0x00020},
2322 {"default-pib", 0x733500, 0x06000},
2323 {"user-config", 0x740000, 0x10000},
2324 {"plc-pib", 0x750000, 0x10000},
2325 {"plc-nvm", 0x760000, 0x90000},
2326 {"radio", 0x7f0000, 0x10000},
2327 {NULL, 0, 0}
2328 },
2329
2330 .first_sysupgrade_partition = "os-image",
2331 .last_sysupgrade_partition = "file-system"
2332 },
2333
2334 /** Firmware layout for the TL-WR1043 v5 */
2335 {
2336 .id = "TLWR1043NV5",
2337 .vendor = "",
2338 .support_list =
2339 "SupportList:\n"
2340 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2341 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2342 .part_trail = 0x00,
2343 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2344 .partitions = {
2345 {"factory-boot", 0x00000, 0x20000},
2346 {"fs-uboot", 0x20000, 0x20000},
2347 {"firmware", 0x40000, 0xec0000},
2348 {"default-mac", 0xf00000, 0x00200},
2349 {"pin", 0xf00200, 0x00200},
2350 {"device-id", 0xf00400, 0x00100},
2351 {"product-info", 0xf00500, 0x0fb00},
2352 {"soft-version", 0xf10000, 0x01000},
2353 {"extra-para", 0xf11000, 0x01000},
2354 {"support-list", 0xf12000, 0x0a000},
2355 {"profile", 0xf1c000, 0x04000},
2356 {"default-config", 0xf20000, 0x10000},
2357 {"user-config", 0xf30000, 0x40000},
2358 {"qos-db", 0xf70000, 0x40000},
2359 {"certificate", 0xfb0000, 0x10000},
2360 {"partition-table", 0xfc0000, 0x10000},
2361 {"log", 0xfd0000, 0x20000},
2362 {"radio", 0xff0000, 0x10000},
2363 {NULL, 0, 0}
2364 },
2365 .first_sysupgrade_partition = "os-image",
2366 .last_sysupgrade_partition = "file-system"
2367 },
2368
2369 /** Firmware layout for the TL-WR1043 v4 */
2370 {
2371 .id = "TLWR1043NDV4",
2372 .vendor = "",
2373 .support_list =
2374 "SupportList:\n"
2375 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2376 .part_trail = 0x00,
2377 .soft_ver = SOFT_VER_DEFAULT,
2378
2379 /* We're using a dynamic kernel/rootfs split here */
2380 .partitions = {
2381 {"fs-uboot", 0x00000, 0x20000},
2382 {"firmware", 0x20000, 0xf30000},
2383 {"default-mac", 0xf50000, 0x00200},
2384 {"pin", 0xf50200, 0x00200},
2385 {"product-info", 0xf50400, 0x0fc00},
2386 {"soft-version", 0xf60000, 0x0b000},
2387 {"support-list", 0xf6b000, 0x04000},
2388 {"profile", 0xf70000, 0x04000},
2389 {"default-config", 0xf74000, 0x0b000},
2390 {"user-config", 0xf80000, 0x40000},
2391 {"partition-table", 0xfc0000, 0x10000},
2392 {"log", 0xfd0000, 0x20000},
2393 {"radio", 0xff0000, 0x10000},
2394 {NULL, 0, 0}
2395 },
2396
2397 .first_sysupgrade_partition = "os-image",
2398 .last_sysupgrade_partition = "file-system"
2399 },
2400
2401 /** Firmware layout for the TL-WR902AC v1 */
2402 {
2403 .id = "TL-WR902AC-V1",
2404 .vendor = "",
2405 .support_list =
2406 "SupportList:\n"
2407 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2408 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2409 .part_trail = 0x00,
2410 .soft_ver = SOFT_VER_DEFAULT,
2411
2412 /**
2413 384KB were moved from file-system to os-image
2414 in comparison to the stock image
2415 */
2416 .partitions = {
2417 {"fs-uboot", 0x00000, 0x20000},
2418 {"firmware", 0x20000, 0x730000},
2419 {"default-mac", 0x750000, 0x00200},
2420 {"pin", 0x750200, 0x00200},
2421 {"product-info", 0x750400, 0x0fc00},
2422 {"soft-version", 0x760000, 0x0b000},
2423 {"support-list", 0x76b000, 0x04000},
2424 {"profile", 0x770000, 0x04000},
2425 {"default-config", 0x774000, 0x0b000},
2426 {"user-config", 0x780000, 0x40000},
2427 {"partition-table", 0x7c0000, 0x10000},
2428 {"log", 0x7d0000, 0x20000},
2429 {"radio", 0x7f0000, 0x10000},
2430 {NULL, 0, 0}
2431 },
2432
2433 .first_sysupgrade_partition = "os-image",
2434 .last_sysupgrade_partition = "file-system",
2435 },
2436
2437 /** Firmware layout for the TL-WR941HP v1 */
2438 {
2439 .id = "TL-WR941HP-V1",
2440 .vendor = "",
2441 .support_list =
2442 "SupportList:\n"
2443 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2444 .part_trail = 0x00,
2445 .soft_ver = SOFT_VER_DEFAULT,
2446
2447 .partitions = {
2448 {"fs-uboot", 0x00000, 0x20000},
2449 {"firmware", 0x20000, 0x730000},
2450 {"default-mac", 0x750000, 0x00200},
2451 {"pin", 0x750200, 0x00200},
2452 {"product-info", 0x750400, 0x0fc00},
2453 {"soft-version", 0x760000, 0x0b000},
2454 {"support-list", 0x76b000, 0x04000},
2455 {"profile", 0x770000, 0x04000},
2456 {"default-config", 0x774000, 0x0b000},
2457 {"user-config", 0x780000, 0x40000},
2458 {"partition-table", 0x7c0000, 0x10000},
2459 {"log", 0x7d0000, 0x20000},
2460 {"radio", 0x7f0000, 0x10000},
2461 {NULL, 0, 0}
2462 },
2463
2464 .first_sysupgrade_partition = "os-image",
2465 .last_sysupgrade_partition = "file-system",
2466 },
2467
2468 /** Firmware layout for the TL-WR942N V1 */
2469 {
2470 .id = "TLWR942NV1",
2471 .vendor = "",
2472 .support_list =
2473 "SupportList:\r\n"
2474 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2475 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2476 .part_trail = 0x00,
2477 .soft_ver = SOFT_VER_DEFAULT,
2478
2479 .partitions = {
2480 {"fs-uboot", 0x00000, 0x20000},
2481 {"firmware", 0x20000, 0xe20000},
2482 {"default-mac", 0xe40000, 0x00200},
2483 {"pin", 0xe40200, 0x00200},
2484 {"product-info", 0xe40400, 0x0fc00},
2485 {"partition-table", 0xe50000, 0x10000},
2486 {"soft-version", 0xe60000, 0x10000},
2487 {"support-list", 0xe70000, 0x10000},
2488 {"profile", 0xe80000, 0x10000},
2489 {"default-config", 0xe90000, 0x10000},
2490 {"user-config", 0xea0000, 0x40000},
2491 {"qos-db", 0xee0000, 0x40000},
2492 {"certificate", 0xf20000, 0x10000},
2493 {"usb-config", 0xfb0000, 0x10000},
2494 {"log", 0xfc0000, 0x20000},
2495 {"radio-bk", 0xfe0000, 0x10000},
2496 {"radio", 0xff0000, 0x10000},
2497 {NULL, 0, 0}
2498 },
2499
2500 .first_sysupgrade_partition = "os-image",
2501 .last_sysupgrade_partition = "file-system",
2502 },
2503
2504 /** Firmware layout for the RE200 v2 */
2505 {
2506 .id = "RE200-V2",
2507 .vendor = "",
2508 .support_list =
2509 "SupportList:\n"
2510 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2511 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2512 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2513 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2514 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2515 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2516 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2517 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2518 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2519 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2520 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2521 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2522 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2523 .part_trail = 0x00,
2524 .soft_ver = SOFT_VER_DEFAULT,
2525
2526 .partitions = {
2527 {"fs-uboot", 0x00000, 0x20000},
2528 {"firmware", 0x20000, 0x7a0000},
2529 {"partition-table", 0x7c0000, 0x02000},
2530 {"default-mac", 0x7c2000, 0x00020},
2531 {"pin", 0x7c2100, 0x00020},
2532 {"product-info", 0x7c3100, 0x01000},
2533 {"soft-version", 0x7c4200, 0x01000},
2534 {"support-list", 0x7c5200, 0x01000},
2535 {"profile", 0x7c6200, 0x08000},
2536 {"config-info", 0x7ce200, 0x00400},
2537 {"user-config", 0x7d0000, 0x10000},
2538 {"default-config", 0x7e0000, 0x10000},
2539 {"radio", 0x7f0000, 0x10000},
2540 {NULL, 0, 0}
2541 },
2542
2543 .first_sysupgrade_partition = "os-image",
2544 .last_sysupgrade_partition = "file-system"
2545 },
2546
2547 /** Firmware layout for the RE200 v3 */
2548 {
2549 .id = "RE200-V3",
2550 .vendor = "",
2551 .support_list =
2552 "SupportList:\n"
2553 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2554 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2555 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2556 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2557 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2558 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2559 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2560 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2561 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2562 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2563 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2564 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2565 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2566 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2567 .part_trail = 0x00,
2568 .soft_ver = SOFT_VER_DEFAULT,
2569
2570 .partitions = {
2571 {"fs-uboot", 0x00000, 0x20000},
2572 {"firmware", 0x20000, 0x7a0000},
2573 {"partition-table", 0x7c0000, 0x02000},
2574 {"default-mac", 0x7c2000, 0x00020},
2575 {"pin", 0x7c2100, 0x00020},
2576 {"product-info", 0x7c3100, 0x01000},
2577 {"soft-version", 0x7c4200, 0x01000},
2578 {"support-list", 0x7c5200, 0x01000},
2579 {"profile", 0x7c6200, 0x08000},
2580 {"config-info", 0x7ce200, 0x00400},
2581 {"user-config", 0x7d0000, 0x10000},
2582 {"default-config", 0x7e0000, 0x10000},
2583 {"radio", 0x7f0000, 0x10000},
2584 {NULL, 0, 0}
2585 },
2586
2587 .first_sysupgrade_partition = "os-image",
2588 .last_sysupgrade_partition = "file-system"
2589 },
2590
2591 /** Firmware layout for the RE200 v4 */
2592 {
2593 .id = "RE200-V4",
2594 .vendor = "",
2595 .support_list =
2596 "SupportList:\n"
2597 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2598 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2599 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2600 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2601 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2602 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2603 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2604 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2605 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2606 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2607 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2608 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2609 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2610 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2611 .part_trail = 0x00,
2612 .soft_ver = SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2613
2614 .partitions = {
2615 {"fs-uboot", 0x00000, 0x20000},
2616 {"firmware", 0x20000, 0x7a0000},
2617 {"partition-table", 0x7c0000, 0x02000},
2618 {"default-mac", 0x7c2000, 0x00020},
2619 {"pin", 0x7c2100, 0x00020},
2620 {"product-info", 0x7c3100, 0x01000},
2621 {"soft-version", 0x7c4200, 0x01000},
2622 {"support-list", 0x7c5200, 0x01000},
2623 {"profile", 0x7c6200, 0x08000},
2624 {"config-info", 0x7ce200, 0x00400},
2625 {"user-config", 0x7d0000, 0x10000},
2626 {"default-config", 0x7e0000, 0x10000},
2627 {"radio", 0x7f0000, 0x10000},
2628 {NULL, 0, 0}
2629 },
2630
2631 .first_sysupgrade_partition = "os-image",
2632 .last_sysupgrade_partition = "file-system"
2633 },
2634
2635 /** Firmware layout for the RE220 v2 */
2636 {
2637 .id = "RE220-V2",
2638 .vendor = "",
2639 .support_list =
2640 "SupportList:\n"
2641 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2642 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2643 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2644 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2645 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2646 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2647 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2648 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2649 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2650 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2651 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2652 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2653 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2654 .part_trail = 0x00,
2655 .soft_ver = SOFT_VER_DEFAULT,
2656
2657 .partitions = {
2658 {"fs-uboot", 0x00000, 0x20000},
2659 {"firmware", 0x20000, 0x7a0000},
2660 {"partition-table", 0x7c0000, 0x02000},
2661 {"default-mac", 0x7c2000, 0x00020},
2662 {"pin", 0x7c2100, 0x00020},
2663 {"product-info", 0x7c3100, 0x01000},
2664 {"soft-version", 0x7c4200, 0x01000},
2665 {"support-list", 0x7c5200, 0x01000},
2666 {"profile", 0x7c6200, 0x08000},
2667 {"config-info", 0x7ce200, 0x00400},
2668 {"user-config", 0x7d0000, 0x10000},
2669 {"default-config", 0x7e0000, 0x10000},
2670 {"radio", 0x7f0000, 0x10000},
2671 {NULL, 0, 0}
2672 },
2673
2674 .first_sysupgrade_partition = "os-image",
2675 .last_sysupgrade_partition = "file-system"
2676 },
2677
2678 /** Firmware layout for the RE305 v1 */
2679 {
2680 .id = "RE305-V1",
2681 .vendor = "",
2682 .support_list =
2683 "SupportList:\n"
2684 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2685 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2686 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2687 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2688 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2689 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2690 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2691 .part_trail = 0x00,
2692 .soft_ver = SOFT_VER_DEFAULT,
2693
2694 .partitions = {
2695 {"fs-uboot", 0x00000, 0x20000},
2696 {"firmware", 0x20000, 0x5e0000},
2697 {"partition-table", 0x600000, 0x02000},
2698 {"default-mac", 0x610000, 0x00020},
2699 {"pin", 0x610100, 0x00020},
2700 {"product-info", 0x611100, 0x01000},
2701 {"soft-version", 0x620000, 0x01000},
2702 {"support-list", 0x621000, 0x01000},
2703 {"profile", 0x622000, 0x08000},
2704 {"user-config", 0x630000, 0x10000},
2705 {"default-config", 0x640000, 0x10000},
2706 {"radio", 0x7f0000, 0x10000},
2707 {NULL, 0, 0}
2708 },
2709
2710 .first_sysupgrade_partition = "os-image",
2711 .last_sysupgrade_partition = "file-system"
2712 },
2713
2714 /** Firmware layout for the RE305 v3 */
2715 {
2716 .id = "RE305-V3",
2717 .vendor = "",
2718 .support_list =
2719 "SupportList:\n"
2720 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2721 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2722 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2723 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2724 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2725 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2726 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2727 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2728 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2729 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2730 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2731 .part_trail = 0x00,
2732 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2733
2734 .partitions = {
2735 {"fs-uboot", 0x00000, 0x20000},
2736 {"firmware", 0x20000, 0x7a0000},
2737 {"partition-table", 0x7c0000, 0x02000},
2738 {"default-mac", 0x7c2000, 0x00020},
2739 {"pin", 0x7c2100, 0x00020},
2740 {"product-info", 0x7c3100, 0x01000},
2741 {"soft-version", 0x7c4200, 0x01000},
2742 {"support-list", 0x7c5200, 0x01000},
2743 {"profile", 0x7c6200, 0x08000},
2744 {"config-info", 0x7ce200, 0x00400},
2745 {"user-config", 0x7d0000, 0x10000},
2746 {"default-config", 0x7e0000, 0x10000},
2747 {"radio", 0x7f0000, 0x10000},
2748 {NULL, 0, 0}
2749 },
2750
2751 .first_sysupgrade_partition = "os-image",
2752 .last_sysupgrade_partition = "file-system"
2753 },
2754
2755 /** Firmware layout for the RE350 v1 */
2756 {
2757 .id = "RE350-V1",
2758 .vendor = "",
2759 .support_list =
2760 "SupportList:\n"
2761 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2762 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2763 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2764 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2765 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2766 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2767 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2768 .part_trail = 0x00,
2769 .soft_ver = SOFT_VER_DEFAULT,
2770
2771 /** We're using a dynamic kernel/rootfs split here */
2772 .partitions = {
2773 {"fs-uboot", 0x00000, 0x20000},
2774 {"firmware", 0x20000, 0x5e0000},
2775 {"partition-table", 0x600000, 0x02000},
2776 {"default-mac", 0x610000, 0x00020},
2777 {"pin", 0x610100, 0x00020},
2778 {"product-info", 0x611100, 0x01000},
2779 {"soft-version", 0x620000, 0x01000},
2780 {"support-list", 0x621000, 0x01000},
2781 {"profile", 0x622000, 0x08000},
2782 {"user-config", 0x630000, 0x10000},
2783 {"default-config", 0x640000, 0x10000},
2784 {"radio", 0x7f0000, 0x10000},
2785 {NULL, 0, 0}
2786 },
2787
2788 .first_sysupgrade_partition = "os-image",
2789 .last_sysupgrade_partition = "file-system"
2790 },
2791
2792 /** Firmware layout for the RE350K v1 */
2793 {
2794 .id = "RE350K-V1",
2795 .vendor = "",
2796 .support_list =
2797 "SupportList:\n"
2798 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2799 .part_trail = 0x00,
2800 .soft_ver = SOFT_VER_DEFAULT,
2801
2802 /** We're using a dynamic kernel/rootfs split here */
2803 .partitions = {
2804 {"fs-uboot", 0x00000, 0x20000},
2805 {"firmware", 0x20000, 0xd70000},
2806 {"partition-table", 0xd90000, 0x02000},
2807 {"default-mac", 0xda0000, 0x00020},
2808 {"pin", 0xda0100, 0x00020},
2809 {"product-info", 0xda1100, 0x01000},
2810 {"soft-version", 0xdb0000, 0x01000},
2811 {"support-list", 0xdb1000, 0x01000},
2812 {"profile", 0xdb2000, 0x08000},
2813 {"user-config", 0xdc0000, 0x10000},
2814 {"default-config", 0xdd0000, 0x10000},
2815 {"device-id", 0xde0000, 0x00108},
2816 {"radio", 0xff0000, 0x10000},
2817 {NULL, 0, 0}
2818 },
2819
2820 .first_sysupgrade_partition = "os-image",
2821 .last_sysupgrade_partition = "file-system"
2822 },
2823
2824 /** Firmware layout for the RE355 */
2825 {
2826 .id = "RE355",
2827 .vendor = "",
2828 .support_list =
2829 "SupportList:\r\n"
2830 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2831 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2832 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2833 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2834 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2835 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2836 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2837 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2838 .part_trail = 0x00,
2839 .soft_ver = SOFT_VER_DEFAULT,
2840
2841 /* We're using a dynamic kernel/rootfs split here */
2842 .partitions = {
2843 {"fs-uboot", 0x00000, 0x20000},
2844 {"firmware", 0x20000, 0x5e0000},
2845 {"partition-table", 0x600000, 0x02000},
2846 {"default-mac", 0x610000, 0x00020},
2847 {"pin", 0x610100, 0x00020},
2848 {"product-info", 0x611100, 0x01000},
2849 {"soft-version", 0x620000, 0x01000},
2850 {"support-list", 0x621000, 0x01000},
2851 {"profile", 0x622000, 0x08000},
2852 {"user-config", 0x630000, 0x10000},
2853 {"default-config", 0x640000, 0x10000},
2854 {"radio", 0x7f0000, 0x10000},
2855 {NULL, 0, 0}
2856 },
2857
2858 .first_sysupgrade_partition = "os-image",
2859 .last_sysupgrade_partition = "file-system"
2860 },
2861
2862 /** Firmware layout for the RE450 */
2863 {
2864 .id = "RE450",
2865 .vendor = "",
2866 .support_list =
2867 "SupportList:\r\n"
2868 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2869 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2870 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2871 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2872 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2873 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2874 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2875 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2876 .part_trail = 0x00,
2877 .soft_ver = SOFT_VER_DEFAULT,
2878
2879 /** We're using a dynamic kernel/rootfs split here */
2880 .partitions = {
2881 {"fs-uboot", 0x00000, 0x20000},
2882 {"firmware", 0x20000, 0x5e0000},
2883 {"partition-table", 0x600000, 0x02000},
2884 {"default-mac", 0x610000, 0x00020},
2885 {"pin", 0x610100, 0x00020},
2886 {"product-info", 0x611100, 0x01000},
2887 {"soft-version", 0x620000, 0x01000},
2888 {"support-list", 0x621000, 0x01000},
2889 {"profile", 0x622000, 0x08000},
2890 {"user-config", 0x630000, 0x10000},
2891 {"default-config", 0x640000, 0x10000},
2892 {"radio", 0x7f0000, 0x10000},
2893 {NULL, 0, 0}
2894 },
2895
2896 .first_sysupgrade_partition = "os-image",
2897 .last_sysupgrade_partition = "file-system"
2898 },
2899
2900 /** Firmware layout for the RE450 v2 */
2901 {
2902 .id = "RE450-V2",
2903 .vendor = "",
2904 .support_list =
2905 "SupportList:\r\n"
2906 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2907 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2908 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2909 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2910 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2911 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2912 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2913 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2914 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2915 .part_trail = 0x00,
2916 .soft_ver = SOFT_VER_DEFAULT,
2917
2918 /* We're using a dynamic kernel/rootfs split here */
2919 .partitions = {
2920 {"fs-uboot", 0x00000, 0x20000},
2921 {"firmware", 0x20000, 0x5e0000},
2922 {"partition-table", 0x600000, 0x02000},
2923 {"default-mac", 0x610000, 0x00020},
2924 {"pin", 0x610100, 0x00020},
2925 {"product-info", 0x611100, 0x01000},
2926 {"soft-version", 0x620000, 0x01000},
2927 {"support-list", 0x621000, 0x01000},
2928 {"profile", 0x622000, 0x08000},
2929 {"user-config", 0x630000, 0x10000},
2930 {"default-config", 0x640000, 0x10000},
2931 {"radio", 0x7f0000, 0x10000},
2932 {NULL, 0, 0}
2933 },
2934
2935 .first_sysupgrade_partition = "os-image",
2936 .last_sysupgrade_partition = "file-system"
2937 },
2938
2939 /** Firmware layout for the RE450 v3 */
2940 {
2941 .id = "RE450-V3",
2942 .vendor = "",
2943 .support_list =
2944 "SupportList:\r\n"
2945 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2946 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2947 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2948 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2949 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2950 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2951 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2952 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2953 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2954 .part_trail = 0x00,
2955 .soft_ver = SOFT_VER_DEFAULT,
2956
2957 /* We're using a dynamic kernel/rootfs split here */
2958 .partitions = {
2959 {"fs-uboot", 0x00000, 0x20000},
2960 {"default-mac", 0x20000, 0x00020},
2961 {"pin", 0x20020, 0x00020},
2962 {"product-info", 0x21000, 0x01000},
2963 {"partition-table", 0x22000, 0x02000},
2964 {"soft-version", 0x24000, 0x01000},
2965 {"support-list", 0x25000, 0x01000},
2966 {"profile", 0x26000, 0x08000},
2967 {"user-config", 0x2e000, 0x10000},
2968 {"default-config", 0x3e000, 0x10000},
2969 {"config-info", 0x4e000, 0x00400},
2970 {"firmware", 0x50000, 0x7a0000},
2971 {"radio", 0x7f0000, 0x10000},
2972 {NULL, 0, 0}
2973 },
2974
2975 .first_sysupgrade_partition = "os-image",
2976 .last_sysupgrade_partition = "file-system"
2977 },
2978
2979 /** Firmware layout for the RE455 v1 */
2980 {
2981 .id = "RE455-V1",
2982 .vendor = "",
2983 .support_list =
2984 "SupportList:\r\n"
2985 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2986 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2987 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2988 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2989 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2990 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
2991 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
2992 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
2993 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
2994 .part_trail = 0x00,
2995 .soft_ver = SOFT_VER_DEFAULT,
2996
2997 /* We're using a dynamic kernel/rootfs split here */
2998 .partitions = {
2999 {"fs-uboot", 0x00000, 0x20000},
3000 {"default-mac", 0x20000, 0x00020},
3001 {"pin", 0x20020, 0x00020},
3002 {"product-info", 0x21000, 0x01000},
3003 {"partition-table", 0x22000, 0x02000},
3004 {"soft-version", 0x24000, 0x01000},
3005 {"support-list", 0x25000, 0x01000},
3006 {"profile", 0x26000, 0x08000},
3007 {"user-config", 0x2e000, 0x10000},
3008 {"default-config", 0x3e000, 0x10000},
3009 {"config-info", 0x4e000, 0x00400},
3010 {"firmware", 0x50000, 0x7a0000},
3011 {"radio", 0x7f0000, 0x10000},
3012 {NULL, 0, 0}
3013 },
3014
3015 .first_sysupgrade_partition = "os-image",
3016 .last_sysupgrade_partition = "file-system"
3017 },
3018
3019 /** Firmware layout for the RE500 */
3020 {
3021 .id = "RE500-V1",
3022 .vendor = "",
3023 .support_list =
3024 "SupportList:\r\n"
3025 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
3026 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
3027 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
3028 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
3029 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
3030 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
3031 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
3032 .part_trail = 0x00,
3033 .soft_ver = SOFT_VER_DEFAULT,
3034
3035 /* We're using a dynamic kernel/rootfs split here */
3036 .partitions = {
3037 {"fs-uboot", 0x00000, 0x20000},
3038 {"firmware", 0x20000, 0xde0000},
3039 {"partition-table", 0xe00000, 0x02000},
3040 {"default-mac", 0xe10000, 0x00020},
3041 {"pin", 0xe10100, 0x00020},
3042 {"product-info", 0xe11100, 0x01000},
3043 {"soft-version", 0xe20000, 0x01000},
3044 {"support-list", 0xe21000, 0x01000},
3045 {"profile", 0xe22000, 0x08000},
3046 {"user-config", 0xe30000, 0x10000},
3047 {"default-config", 0xe40000, 0x10000},
3048 {"radio", 0xff0000, 0x10000},
3049 {NULL, 0, 0}
3050 },
3051
3052 .first_sysupgrade_partition = "os-image",
3053 .last_sysupgrade_partition = "file-system"
3054 },
3055
3056 /** Firmware layout for the RE650 */
3057 {
3058 .id = "RE650-V1",
3059 .vendor = "",
3060 .support_list =
3061 "SupportList:\r\n"
3062 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
3063 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
3064 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3065 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3066 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3067 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3068 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3069 .part_trail = 0x00,
3070 .soft_ver = SOFT_VER_DEFAULT,
3071
3072 /* We're using a dynamic kernel/rootfs split here */
3073 .partitions = {
3074 {"fs-uboot", 0x00000, 0x20000},
3075 {"firmware", 0x20000, 0xde0000},
3076 {"partition-table", 0xe00000, 0x02000},
3077 {"default-mac", 0xe10000, 0x00020},
3078 {"pin", 0xe10100, 0x00020},
3079 {"product-info", 0xe11100, 0x01000},
3080 {"soft-version", 0xe20000, 0x01000},
3081 {"support-list", 0xe21000, 0x01000},
3082 {"profile", 0xe22000, 0x08000},
3083 {"user-config", 0xe30000, 0x10000},
3084 {"default-config", 0xe40000, 0x10000},
3085 {"radio", 0xff0000, 0x10000},
3086 {NULL, 0, 0}
3087 },
3088
3089 .first_sysupgrade_partition = "os-image",
3090 .last_sysupgrade_partition = "file-system"
3091 },
3092 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3093 {
3094 .id = "RE650-V2",
3095 .vendor = "",
3096 .support_list =
3097 "SupportList:\n"
3098 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3099 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3100 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3101 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3102 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3103 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3104 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3105 .part_trail = 0x00,
3106 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3107 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3108
3109 /* We're using a dynamic kernel/rootfs split here */
3110 .partitions = {
3111 {"fs-uboot", 0x00000, 0x20000},
3112 {"firmware", 0x20000, 0x7a0000},
3113 {"partition-table", 0x7c0000, 0x02000},
3114 {"default-mac", 0x7c2000, 0x00020},
3115 {"pin", 0x7c2100, 0x00020},
3116 {"product-info", 0x7c3100, 0x01000},
3117 {"soft-version", 0x7c4200, 0x01000},
3118 {"support-list", 0x7c5200, 0x01000},
3119 {"profile", 0x7c6200, 0x08000},
3120 {"config-info", 0x7ce200, 0x00400},
3121 {"user-config", 0x7d0000, 0x10000},
3122 {"default-config", 0x7e0000, 0x10000},
3123 {"radio", 0x7f0000, 0x10000},
3124 {NULL, 0, 0}
3125 },
3126
3127 .first_sysupgrade_partition = "os-image",
3128 .last_sysupgrade_partition = "file-system"
3129 },
3130
3131 /** Firmware layout for the Mercusys MR70X */
3132 {
3133 .id = "MR70X",
3134 .vendor = "",
3135 .support_list =
3136 "SupportList:\n"
3137 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3138 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3139 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3140 .part_trail = 0x00,
3141 .soft_ver = SOFT_VER_DEFAULT,
3142
3143 .partitions = {
3144 {"fs-uboot", 0x00000, 0x40000},
3145 {"firmware", 0x40000, 0xf60000},
3146 {"default-mac", 0xfa0000, 0x00200},
3147 {"pin", 0xfa0200, 0x00100},
3148 {"device-id", 0xfa0300, 0x00100},
3149 {"product-info", 0xfa0400, 0x0fc00},
3150 {"default-config", 0xfb0000, 0x08000},
3151 {"ap-def-config", 0xfb8000, 0x08000},
3152 {"user-config", 0xfc0000, 0x0a000},
3153 {"ag-config", 0xfca000, 0x04000},
3154 {"certificate", 0xfce000, 0x02000},
3155 {"ap-config", 0xfd0000, 0x06000},
3156 {"router-config", 0xfd6000, 0x06000},
3157 {"favicon", 0xfdc000, 0x02000},
3158 {"logo", 0xfde000, 0x02000},
3159 {"partition-table", 0xfe0000, 0x00800},
3160 {"soft-version", 0xfe0800, 0x00100},
3161 {"support-list", 0xfe0900, 0x00200},
3162 {"profile", 0xfe0b00, 0x03000},
3163 {"extra-para", 0xfe3b00, 0x00100},
3164 {"radio", 0xff0000, 0x10000},
3165 {NULL, 0, 0}
3166 },
3167
3168 .first_sysupgrade_partition = "os-image",
3169 .last_sysupgrade_partition = "file-system"
3170 },
3171
3172 {}
3173 };
3174
3175 #define error(_ret, _errno, _str, ...) \
3176 do { \
3177 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3178 strerror(_errno)); \
3179 if (_ret) \
3180 exit(_ret); \
3181 } while (0)
3182
3183
3184 /** Stores a uint32 as big endian */
3185 static inline void put32(uint8_t *buf, uint32_t val) {
3186 buf[0] = val >> 24;
3187 buf[1] = val >> 16;
3188 buf[2] = val >> 8;
3189 buf[3] = val;
3190 }
3191
3192 static inline bool meta_partition_should_pad(enum partition_trail_value pv)
3193 {
3194 return (pv >= 0) && (pv <= PART_TRAIL_MAX);
3195 }
3196
3197 /** Allocate a padded meta partition with a correctly initialised header
3198 * If the `data` pointer is NULL, then the required space is only allocated,
3199 * otherwise `data_len` bytes will be copied from `data` into the partition
3200 * entry. */
3201 static struct image_partition_entry init_meta_partition_entry(
3202 const char *name, const void *data, uint32_t data_len,
3203 enum partition_trail_value pad_value)
3204 {
3205 uint32_t total_len = sizeof(struct meta_header) + data_len;
3206 if (meta_partition_should_pad(pad_value))
3207 total_len += 1;
3208
3209 struct image_partition_entry entry = {
3210 .name = name,
3211 .size = total_len,
3212 .data = malloc(total_len)
3213 };
3214 if (!entry.data)
3215 error(1, errno, "failed to allocate meta partition entry");
3216
3217 struct meta_header *header = (struct meta_header *)entry.data;
3218 header->length = htonl(data_len);
3219 header->zero = 0;
3220
3221 if (data)
3222 memcpy(entry.data+sizeof(*header), data, data_len);
3223
3224 if (meta_partition_should_pad(pad_value))
3225 entry.data[total_len - 1] = (uint8_t) pad_value;
3226
3227 return entry;
3228 }
3229
3230 /** Allocates a new image partition */
3231 static struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
3232 struct image_partition_entry entry = {name, len, malloc(len)};
3233 if (!entry.data)
3234 error(1, errno, "malloc");
3235
3236 return entry;
3237 }
3238
3239 /** Sets up default partition names whenever custom names aren't specified */
3240 static void set_partition_names(struct device_info *info)
3241 {
3242 if (!info->partition_names.partition_table)
3243 info->partition_names.partition_table = "partition-table";
3244 if (!info->partition_names.soft_ver)
3245 info->partition_names.soft_ver = "soft-version";
3246 if (!info->partition_names.os_image)
3247 info->partition_names.os_image = "os-image";
3248 if (!info->partition_names.support_list)
3249 info->partition_names.support_list = "support-list";
3250 if (!info->partition_names.file_system)
3251 info->partition_names.file_system = "file-system";
3252 if (!info->partition_names.extra_para)
3253 info->partition_names.extra_para = "extra-para";
3254 }
3255
3256 /** Frees an image partition */
3257 static void free_image_partition(struct image_partition_entry *entry)
3258 {
3259 void *data = entry->data;
3260
3261 entry->name = NULL;
3262 entry->size = 0;
3263 entry->data = NULL;
3264
3265 free(data);
3266 }
3267
3268 static time_t source_date_epoch = -1;
3269 static void set_source_date_epoch() {
3270 char *env = getenv("SOURCE_DATE_EPOCH");
3271 char *endptr = env;
3272 errno = 0;
3273 if (env && *env) {
3274 source_date_epoch = strtoull(env, &endptr, 10);
3275 if (errno || (endptr && *endptr != '\0')) {
3276 fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
3277 exit(1);
3278 }
3279 }
3280 }
3281
3282 /** Generates the partition-table partition */
3283 static struct image_partition_entry make_partition_table(const struct device_info *p)
3284 {
3285 struct image_partition_entry entry = alloc_image_partition(p->partition_names.partition_table, SAFELOADER_PAYLOAD_TABLE_SIZE);
3286
3287 char *s = (char *)entry.data, *end = (char *)(s+entry.size);
3288
3289 *(s++) = 0x00;
3290 *(s++) = 0x04;
3291 *(s++) = 0x00;
3292 *(s++) = 0x00;
3293
3294 size_t i;
3295 for (i = 0; p->partitions[i].name; i++) {
3296 size_t len = end-s;
3297 size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n",
3298 p->partitions[i].name, p->partitions[i].base, p->partitions[i].size);
3299
3300 if (w > len-1)
3301 error(1, 0, "flash partition table overflow?");
3302
3303 s += w;
3304 }
3305
3306 s++;
3307
3308 memset(s, 0xff, end-s);
3309
3310 return entry;
3311 }
3312
3313
3314 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3315 static inline uint8_t bcd(uint8_t v) {
3316 return 0x10 * (v/10) + v%10;
3317 }
3318
3319
3320 /** Generates the soft-version partition */
3321 static struct image_partition_entry make_soft_version(const struct device_info *info, uint32_t rev)
3322 {
3323 /** If an info string is provided, use this instead of
3324 * the structured data, and include the null-termination */
3325 if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) {
3326 uint32_t len = strlen(info->soft_ver.text) + 1;
3327 return init_meta_partition_entry(info->partition_names.soft_ver,
3328 info->soft_ver.text, len, info->part_trail);
3329 }
3330
3331 time_t t;
3332
3333 if (source_date_epoch != -1)
3334 t = source_date_epoch;
3335 else if (time(&t) == (time_t)(-1))
3336 error(1, errno, "time");
3337
3338 struct tm *tm = gmtime(&t);
3339
3340 struct soft_version s = {
3341 .pad1 = 0xff,
3342
3343 .version_major = info->soft_ver.num[0],
3344 .version_minor = info->soft_ver.num[1],
3345 .version_patch = info->soft_ver.num[2],
3346
3347 .year_hi = bcd((1900+tm->tm_year)/100),
3348 .year_lo = bcd(tm->tm_year%100),
3349 .month = bcd(tm->tm_mon+1),
3350 .day = bcd(tm->tm_mday),
3351 .rev = htonl(rev),
3352
3353 .compat_level = htonl(info->soft_ver_compat_level)
3354 };
3355
3356 if (info->soft_ver_compat_level == 0)
3357 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3358 (uint8_t *)(&s.compat_level) - (uint8_t *)(&s),
3359 info->part_trail);
3360 else
3361 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3362 sizeof(s), info->part_trail);
3363 }
3364
3365 /** Generates the support-list partition */
3366 static struct image_partition_entry make_support_list(
3367 const struct device_info *info)
3368 {
3369 uint32_t len = strlen(info->support_list);
3370 return init_meta_partition_entry(info->partition_names.support_list, info->support_list,
3371 len, info->part_trail);
3372 }
3373
3374 /** Partition with extra-para data */
3375 static struct image_partition_entry make_extra_para(
3376 const struct device_info *info, const uint8_t *extra_para, size_t len)
3377 {
3378 return init_meta_partition_entry(info->partition_names.extra_para, extra_para, len,
3379 info->part_trail);
3380 }
3381
3382 /** Creates a new image partition with an arbitrary name from a file */
3383 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) {
3384 struct stat statbuf;
3385
3386 if (stat(filename, &statbuf) < 0)
3387 error(1, errno, "unable to stat file `%s'", filename);
3388
3389 size_t len = statbuf.st_size;
3390
3391 if (add_jffs2_eof) {
3392 if (file_system_partition)
3393 len = ALIGN(len + file_system_partition->base, 0x10000) + sizeof(jffs2_eof_mark) - file_system_partition->base;
3394 else
3395 len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark);
3396 }
3397
3398 struct image_partition_entry entry = alloc_image_partition(part_name, len);
3399
3400 FILE *file = fopen(filename, "rb");
3401 if (!file)
3402 error(1, errno, "unable to open file `%s'", filename);
3403
3404 if (fread(entry.data, statbuf.st_size, 1, file) != 1)
3405 error(1, errno, "unable to read file `%s'", filename);
3406
3407 if (add_jffs2_eof) {
3408 uint8_t *eof = entry.data + statbuf.st_size, *end = entry.data+entry.size;
3409
3410 memset(eof, 0xff, end - eof - sizeof(jffs2_eof_mark));
3411 memcpy(end - sizeof(jffs2_eof_mark), jffs2_eof_mark, sizeof(jffs2_eof_mark));
3412 }
3413
3414 fclose(file);
3415
3416 return entry;
3417 }
3418
3419 /**
3420 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3421
3422 Example image partition table:
3423
3424 fwup-ptn partition-table base 0x00800 size 0x00800
3425 fwup-ptn os-image base 0x01000 size 0x113b45
3426 fwup-ptn file-system base 0x114b45 size 0x1d0004
3427 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3428
3429 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3430 the end of the partition table is marked with a zero byte.
3431
3432 The firmware image must contain at least the partition-table and support-list partitions
3433 to be accepted. There aren't any alignment constraints for the image partitions.
3434
3435 The partition-table partition contains the actual flash layout; partitions
3436 from the image partition table are mapped to the corresponding flash partitions during
3437 the firmware upgrade. The support-list partition contains a list of devices supported by
3438 the firmware image.
3439
3440 The base offsets in the firmware partition table are relative to the end
3441 of the vendor information block, so the partition-table partition will
3442 actually start at offset 0x1814 of the image.
3443
3444 I think partition-table must be the first partition in the firmware image.
3445 */
3446 static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) {
3447 size_t i, j;
3448 char *image_pt = (char *)buffer, *end = image_pt + SAFELOADER_PAYLOAD_TABLE_SIZE;
3449
3450 size_t base = SAFELOADER_PAYLOAD_TABLE_SIZE;
3451 for (i = 0; parts[i].name; i++) {
3452 for (j = 0; flash_parts[j].name; j++) {
3453 if (!strcmp(flash_parts[j].name, parts[i].name)) {
3454 if (parts[i].size > flash_parts[j].size)
3455 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts[j].name, (unsigned)flash_parts[j].size);
3456 break;
3457 }
3458 }
3459
3460 assert(flash_parts[j].name);
3461
3462 memcpy(buffer + base, parts[i].data, parts[i].size);
3463
3464 size_t len = end-image_pt;
3465 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);
3466
3467 if (w > len-1)
3468 error(1, 0, "image partition table overflow?");
3469
3470 image_pt += w;
3471
3472 base += parts[i].size;
3473 }
3474 }
3475
3476 /** Generates and writes the image MD5 checksum */
3477 static void put_md5(uint8_t *md5, uint8_t *buffer, unsigned int len) {
3478 MD5_CTX ctx;
3479
3480 MD5_Init(&ctx);
3481 MD5_Update(&ctx, md5_salt, (unsigned int)sizeof(md5_salt));
3482 MD5_Update(&ctx, buffer, len);
3483 MD5_Final(md5, &ctx);
3484 }
3485
3486
3487 /**
3488 Generates the firmware image in factory format
3489
3490 Image format:
3491
3492 Bytes (hex) Usage
3493 ----------- -----
3494 0000-0003 Image size (4 bytes, big endian)
3495 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3496 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3497 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3498 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3499 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3500 1814-xxxx Firmware partitions
3501 */
3502 static void * generate_factory_image(struct device_info *info, const struct image_partition_entry *parts, size_t *len) {
3503 *len = SAFELOADER_PAYLOAD_OFFSET + SAFELOADER_PAYLOAD_TABLE_SIZE;
3504
3505 size_t i;
3506 for (i = 0; parts[i].name; i++)
3507 *len += parts[i].size;
3508
3509 uint8_t *image = malloc(*len);
3510 if (!image)
3511 error(1, errno, "malloc");
3512
3513 memset(image, 0xff, *len);
3514 put32(image, *len);
3515
3516 if (info->vendor) {
3517 size_t vendor_len = strlen(info->vendor);
3518 put32(image + SAFELOADER_PREAMBLE_SIZE, vendor_len);
3519 memcpy(image + SAFELOADER_PREAMBLE_SIZE + 0x4, info->vendor, vendor_len);
3520 }
3521
3522 put_partitions(image + SAFELOADER_PAYLOAD_OFFSET, info->partitions, parts);
3523 put_md5(image + 0x04, image + SAFELOADER_PREAMBLE_SIZE, *len - SAFELOADER_PREAMBLE_SIZE);
3524
3525 return image;
3526 }
3527
3528 /**
3529 Generates the firmware image in sysupgrade format
3530
3531 This makes some assumptions about the provided flash and image partition tables and
3532 should be generalized when TP-LINK starts building its safeloader into hardware with
3533 different flash layouts.
3534 */
3535 static void * generate_sysupgrade_image(struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) {
3536 size_t i, j;
3537 size_t flash_first_partition_index = 0;
3538 size_t flash_last_partition_index = 0;
3539 const struct flash_partition_entry *flash_first_partition = NULL;
3540 const struct flash_partition_entry *flash_last_partition = NULL;
3541 const struct image_partition_entry *image_last_partition = NULL;
3542
3543 /** Find first and last partitions */
3544 for (i = 0; info->partitions[i].name; i++) {
3545 if (!strcmp(info->partitions[i].name, info->first_sysupgrade_partition)) {
3546 flash_first_partition = &info->partitions[i];
3547 flash_first_partition_index = i;
3548 } else if (!strcmp(info->partitions[i].name, info->last_sysupgrade_partition)) {
3549 flash_last_partition = &info->partitions[i];
3550 flash_last_partition_index = i;
3551 }
3552 }
3553
3554 assert(flash_first_partition && flash_last_partition);
3555 assert(flash_first_partition_index < flash_last_partition_index);
3556
3557 /** Find last partition from image to calculate needed size */
3558 for (i = 0; image_parts[i].name; i++) {
3559 if (!strcmp(image_parts[i].name, info->last_sysupgrade_partition)) {
3560 image_last_partition = &image_parts[i];
3561 break;
3562 }
3563 }
3564
3565 assert(image_last_partition);
3566
3567 *len = flash_last_partition->base - flash_first_partition->base + image_last_partition->size;
3568
3569 uint8_t *image = malloc(*len);
3570 if (!image)
3571 error(1, errno, "malloc");
3572
3573 memset(image, 0xff, *len);
3574
3575 for (i = flash_first_partition_index; i <= flash_last_partition_index; i++) {
3576 for (j = 0; image_parts[j].name; j++) {
3577 if (!strcmp(info->partitions[i].name, image_parts[j].name)) {
3578 if (image_parts[j].size > info->partitions[i].size)
3579 error(1, 0, "%s partition too big (more than %u bytes)", info->partitions[i].name, (unsigned)info->partitions[i].size);
3580 memcpy(image + info->partitions[i].base - flash_first_partition->base, image_parts[j].data, image_parts[j].size);
3581 break;
3582 }
3583
3584 assert(image_parts[j].name);
3585 }
3586 }
3587
3588 return image;
3589 }
3590
3591 /** Generates an image according to a given layout and writes it to a file */
3592 static void build_image(const char *output,
3593 const char *kernel_image,
3594 const char *rootfs_image,
3595 uint32_t rev,
3596 bool add_jffs2_eof,
3597 bool sysupgrade,
3598 struct device_info *info) {
3599
3600 size_t i;
3601
3602 struct image_partition_entry parts[7] = {};
3603
3604 struct flash_partition_entry *firmware_partition = NULL;
3605 struct flash_partition_entry *os_image_partition = NULL;
3606 struct flash_partition_entry *file_system_partition = NULL;
3607 size_t firmware_partition_index = 0;
3608
3609 set_partition_names(info);
3610
3611 for (i = 0; info->partitions[i].name; i++) {
3612 if (!strcmp(info->partitions[i].name, "firmware"))
3613 {
3614 firmware_partition = &info->partitions[i];
3615 firmware_partition_index = i;
3616 }
3617 }
3618
3619 if (firmware_partition)
3620 {
3621 os_image_partition = &info->partitions[firmware_partition_index];
3622 file_system_partition = &info->partitions[firmware_partition_index + 1];
3623
3624 struct stat kernel;
3625 if (stat(kernel_image, &kernel) < 0)
3626 error(1, errno, "unable to stat file `%s'", kernel_image);
3627
3628 if (kernel.st_size > firmware_partition->size)
3629 error(1, 0, "kernel overflowed firmware partition\n");
3630
3631 for (i = MAX_PARTITIONS-1; i >= firmware_partition_index + 1; i--)
3632 info->partitions[i+1] = info->partitions[i];
3633
3634 file_system_partition->name = info->partition_names.file_system;
3635
3636 file_system_partition->base = firmware_partition->base + kernel.st_size;
3637
3638 /* Align partition start to erase blocks for factory images only */
3639 if (!sysupgrade)
3640 file_system_partition->base = ALIGN(firmware_partition->base + kernel.st_size, 0x10000);
3641
3642 file_system_partition->size = firmware_partition->size - file_system_partition->base;
3643
3644 os_image_partition->name = info->partition_names.os_image;
3645
3646 os_image_partition->size = kernel.st_size;
3647 }
3648
3649 parts[0] = make_partition_table(info);
3650 parts[1] = make_soft_version(info, rev);
3651 parts[2] = make_support_list(info);
3652 parts[3] = read_file(info->partition_names.os_image, kernel_image, false, NULL);
3653 parts[4] = read_file(info->partition_names.file_system, rootfs_image, add_jffs2_eof, file_system_partition);
3654
3655
3656 /* Some devices need the extra-para partition to accept the firmware */
3657 if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||
3658 strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
3659 strcasecmp(info->id, "ARCHER-A9-V6") == 0 ||
3660 strcasecmp(info->id, "ARCHER-AX23-V1") == 0 ||
3661 strcasecmp(info->id, "ARCHER-C2-V3") == 0 ||
3662 strcasecmp(info->id, "ARCHER-C7-V4") == 0 ||
3663 strcasecmp(info->id, "ARCHER-C7-V5") == 0 ||
3664 strcasecmp(info->id, "ARCHER-C25-V1") == 0 ||
3665 strcasecmp(info->id, "ARCHER-C59-V2") == 0 ||
3666 strcasecmp(info->id, "ARCHER-C60-V2") == 0 ||
3667 strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
3668 strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
3669 strcasecmp(info->id, "ARCHER-C6-V3") == 0 ||
3670 strcasecmp(info->id, "DECO-M4R-V4") == 0 ||
3671 strcasecmp(info->id, "MR70X") == 0 ||
3672 strcasecmp(info->id, "TLWR1043NV5") == 0) {
3673 const uint8_t extra_para[2] = {0x01, 0x00};
3674 parts[5] = make_extra_para(info, extra_para,
3675 sizeof(extra_para));
3676 } else if (strcasecmp(info->id, "ARCHER-C6-V2") == 0 ||
3677 strcasecmp(info->id, "TL-WA1201-V2") == 0) {
3678 const uint8_t extra_para[2] = {0x00, 0x01};
3679 parts[5] = make_extra_para(info, extra_para,
3680 sizeof(extra_para));
3681 } else if (strcasecmp(info->id, "ARCHER-C6-V2-US") == 0 ||
3682 strcasecmp(info->id, "EAP245-V3") == 0) {
3683 const uint8_t extra_para[2] = {0x01, 0x01};
3684 parts[5] = make_extra_para(info, extra_para,
3685 sizeof(extra_para));
3686 }
3687
3688 size_t len;
3689 void *image;
3690 if (sysupgrade)
3691 image = generate_sysupgrade_image(info, parts, &len);
3692 else
3693 image = generate_factory_image(info, parts, &len);
3694
3695 FILE *file = fopen(output, "wb");
3696 if (!file)
3697 error(1, errno, "unable to open output file");
3698
3699 if (fwrite(image, len, 1, file) != 1)
3700 error(1, 0, "unable to write output file");
3701
3702 fclose(file);
3703
3704 free(image);
3705
3706 for (i = 0; parts[i].name; i++)
3707 free_image_partition(&parts[i]);
3708 }
3709
3710 /** Usage output */
3711 static void usage(const char *argv0) {
3712 fprintf(stderr,
3713 "Usage: %s [OPTIONS...]\n"
3714 "\n"
3715 "Options:\n"
3716 " -h show this help\n"
3717 "\n"
3718 "Info about an image:\n"
3719 " -i <file> input file to read from\n"
3720 "Create a new image:\n"
3721 " -B <board> create image for the board specified with <board>\n"
3722 " -k <file> read kernel image from the file <file>\n"
3723 " -r <file> read rootfs image from the file <file>\n"
3724 " -o <file> write output to the file <file>\n"
3725 " -V <rev> sets the revision number to <rev>\n"
3726 " -j add jffs2 end-of-filesystem markers\n"
3727 " -S create sysupgrade instead of factory image\n"
3728 "Extract an old image:\n"
3729 " -x <file> extract all oem firmware partition\n"
3730 " -d <dir> destination to extract the firmware partition\n"
3731 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3732 argv0
3733 );
3734 };
3735
3736
3737 static struct device_info *find_board(const char *id)
3738 {
3739 struct device_info *board = NULL;
3740
3741 for (board = boards; board->id != NULL; board++)
3742 if (strcasecmp(id, board->id) == 0)
3743 return board;
3744
3745 return NULL;
3746 }
3747
3748 static int add_flash_partition(
3749 struct flash_partition_entry *part_list,
3750 size_t max_entries,
3751 const char *name,
3752 unsigned long base,
3753 unsigned long size)
3754 {
3755 size_t ptr;
3756 /* check if the list has a free entry */
3757 for (ptr = 0; ptr < max_entries; ptr++, part_list++) {
3758 if (part_list->name == NULL &&
3759 part_list->base == 0 &&
3760 part_list->size == 0)
3761 break;
3762 }
3763
3764 if (ptr == max_entries) {
3765 error(1, 0, "No free flash part entry available.");
3766 }
3767
3768 part_list->name = calloc(1, strlen(name) + 1);
3769 if (!part_list->name) {
3770 error(1, 0, "Unable to allocate memory");
3771 }
3772
3773 memcpy((char *)part_list->name, name, strlen(name));
3774 part_list->base = base;
3775 part_list->size = size;
3776
3777 return 0;
3778 }
3779
3780 /** read the partition table into struct flash_partition_entry */
3781 enum PARTITION_TABLE_TYPE {
3782 PARTITION_TABLE_FWUP,
3783 PARTITION_TABLE_FLASH,
3784 };
3785
3786 static int read_partition_table(
3787 FILE *file, long offset,
3788 struct flash_partition_entry *entries, size_t max_entries,
3789 int type)
3790 {
3791 char buf[SAFELOADER_PAYLOAD_TABLE_SIZE];
3792 char *ptr, *end;
3793 const char *parthdr = NULL;
3794 const char *fwuphdr = "fwup-ptn";
3795 const char *flashhdr = "partition";
3796
3797 /* TODO: search for the partition table */
3798
3799 switch(type) {
3800 case PARTITION_TABLE_FWUP:
3801 parthdr = fwuphdr;
3802 break;
3803 case PARTITION_TABLE_FLASH:
3804 parthdr = flashhdr;
3805 break;
3806 default:
3807 error(1, 0, "Invalid partition table");
3808 }
3809
3810 if (fseek(file, offset, SEEK_SET) < 0)
3811 error(1, errno, "Can not seek in the firmware");
3812
3813 if (fread(buf, sizeof(buf), 1, file) != 1)
3814 error(1, errno, "Can not read fwup-ptn from the firmware");
3815
3816 buf[sizeof(buf) - 1] = '\0';
3817
3818 /* look for the partition header */
3819 if (memcmp(buf, parthdr, strlen(parthdr)) != 0) {
3820 fprintf(stderr, "DEBUG: can not find fwuphdr\n");
3821 return 1;
3822 }
3823
3824 ptr = buf;
3825 end = buf + sizeof(buf);
3826 while ((ptr + strlen(parthdr)) < end &&
3827 memcmp(ptr, parthdr, strlen(parthdr)) == 0) {
3828 char *end_part;
3829 char *end_element;
3830
3831 char name[32] = { 0 };
3832 int name_len = 0;
3833 unsigned long base = 0;
3834 unsigned long size = 0;
3835
3836 end_part = memchr(ptr, '\n', (end - ptr));
3837 if (end_part == NULL) {
3838 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3839 break;
3840 }
3841
3842 for (int i = 0; i <= 4; i++) {
3843 if (end_part <= ptr)
3844 break;
3845
3846 end_element = memchr(ptr, 0x20, (end_part - ptr));
3847 if (end_element == NULL) {
3848 error(1, errno, "Ignoring the rest of the partition entries.");
3849 break;
3850 }
3851
3852 switch (i) {
3853 /* partition header */
3854 case 0:
3855 ptr = end_element + 1;
3856 continue;
3857 /* name */
3858 case 1:
3859 name_len = (end_element - ptr) > 31 ? 31 : (end_element - ptr);
3860 strncpy(name, ptr, name_len);
3861 name[name_len] = '\0';
3862 ptr = end_element + 1;
3863 continue;
3864
3865 /* string "base" */
3866 case 2:
3867 ptr = end_element + 1;
3868 continue;
3869
3870 /* actual base */
3871 case 3:
3872 base = strtoul(ptr, NULL, 16);
3873 ptr = end_element + 1;
3874 continue;
3875
3876 /* string "size" */
3877 case 4:
3878 ptr = end_element + 1;
3879 /* actual size. The last element doesn't have a sepeartor */
3880 size = strtoul(ptr, NULL, 16);
3881 /* the part ends with 0x09, 0x0d, 0x0a */
3882 ptr = end_part + 1;
3883 add_flash_partition(entries, max_entries, name, base, size);
3884 continue;
3885 }
3886 }
3887 }
3888
3889 return 0;
3890 }
3891
3892 static void safeloader_read_partition(FILE *input_file, size_t payload_offset,
3893 struct flash_partition_entry *entry,
3894 struct image_partition_entry *part)
3895 {
3896 size_t part_size = entry->size;
3897 void *part_data = malloc(part_size);
3898
3899 if (fseek(input_file, payload_offset, SEEK_SET))
3900 error(1, errno, "Failed to seek to partition data");
3901
3902 if (!part_data)
3903 error(1, ENOMEM, "Failed to allocate partition data");
3904
3905 if (fread(part_data, 1, part_size, input_file) < part_size)
3906 error(1, errno, "Failed to read partition data");
3907
3908 part->data = part_data;
3909 part->size = part_size;
3910 part->name = entry->name;
3911 }
3912
3913 static void safeloader_parse_image(FILE *input_file, struct safeloader_image_info *image)
3914 {
3915 static const char *HEADER_ID_CLOUD = "fw-type:Cloud";
3916 static const char *HEADER_ID_QNEW = "?NEW";
3917
3918 char buf[64];
3919
3920 if (!input_file)
3921 return;
3922
3923 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
3924
3925 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3926 error(1, errno, "Can not read image header");
3927
3928 if (memcmp(HEADER_ID_QNEW, &buf[0], strlen(HEADER_ID_QNEW)) == 0)
3929 image->type = SAFELOADER_TYPE_QNEW;
3930 else if (memcmp(HEADER_ID_CLOUD, &buf[0], strlen(HEADER_ID_CLOUD)) == 0)
3931 image->type = SAFELOADER_TYPE_CLOUD;
3932 else if (ntohl(*((uint32_t *) &buf[0])) <= SAFELOADER_HEADER_SIZE)
3933 image->type = SAFELOADER_TYPE_VENDOR;
3934 else
3935 image->type = SAFELOADER_TYPE_DEFAULT;
3936
3937 switch (image->type) {
3938 case SAFELOADER_TYPE_DEFAULT:
3939 case SAFELOADER_TYPE_VENDOR:
3940 case SAFELOADER_TYPE_CLOUD:
3941 image->payload_offset = SAFELOADER_PAYLOAD_OFFSET;
3942 break;
3943 case SAFELOADER_TYPE_QNEW:
3944 image->payload_offset = SAFELOADER_QNEW_PAYLOAD_OFFSET;
3945 break;
3946 }
3947
3948 /* Parse image partition table */
3949 read_partition_table(input_file, image->payload_offset, &image->entries[0],
3950 MAX_PARTITIONS, PARTITION_TABLE_FWUP);
3951 }
3952
3953 static void write_partition(
3954 FILE *input_file,
3955 size_t firmware_offset,
3956 struct flash_partition_entry *entry,
3957 FILE *output_file)
3958 {
3959 char buf[4096];
3960 size_t offset;
3961
3962 fseek(input_file, entry->base + firmware_offset, SEEK_SET);
3963
3964 for (offset = 0; sizeof(buf) + offset <= entry->size; offset += sizeof(buf)) {
3965 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3966 error(1, errno, "Can not read partition from input_file");
3967
3968 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
3969 error(1, errno, "Can not write partition to output_file");
3970 }
3971 /* write last chunk smaller than buffer */
3972 if (offset < entry->size) {
3973 offset = entry->size - offset;
3974 if (fread(buf, offset, 1, input_file) != 1)
3975 error(1, errno, "Can not read partition from input_file");
3976 if (fwrite(buf, offset, 1, output_file) != 1)
3977 error(1, errno, "Can not write partition to output_file");
3978 }
3979 }
3980
3981 static int extract_firmware_partition(FILE *input_file, size_t firmware_offset, struct flash_partition_entry *entry, const char *output_directory)
3982 {
3983 FILE *output_file;
3984 char output[PATH_MAX];
3985
3986 snprintf(output, PATH_MAX, "%s/%s", output_directory, entry->name);
3987 output_file = fopen(output, "wb+");
3988 if (output_file == NULL) {
3989 error(1, errno, "Can not open output file %s", output);
3990 }
3991
3992 write_partition(input_file, firmware_offset, entry, output_file);
3993
3994 fclose(output_file);
3995
3996 return 0;
3997 }
3998
3999 /** extract all partitions from the firmware file */
4000 static int extract_firmware(const char *input, const char *output_directory)
4001 {
4002 struct safeloader_image_info info = {};
4003 struct stat statbuf;
4004 FILE *input_file;
4005
4006 /* check input file */
4007 if (stat(input, &statbuf)) {
4008 error(1, errno, "Can not read input firmware %s", input);
4009 }
4010
4011 /* check if output directory exists */
4012 if (stat(output_directory, &statbuf)) {
4013 error(1, errno, "Failed to stat output directory %s", output_directory);
4014 }
4015
4016 if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
4017 error(1, errno, "Given output directory is not a directory %s", output_directory);
4018 }
4019
4020 input_file = fopen(input, "rb");
4021 safeloader_parse_image(input_file, &info);
4022
4023 for (size_t i = 0; i < MAX_PARTITIONS && info.entries[i].name; i++)
4024 extract_firmware_partition(input_file, info.payload_offset, &info.entries[i], output_directory);
4025
4026 return 0;
4027 }
4028
4029 static struct flash_partition_entry *find_partition(
4030 struct flash_partition_entry *entries, size_t max_entries,
4031 const char *name, const char *error_msg)
4032 {
4033 for (size_t i = 0; i < max_entries; i++, entries++) {
4034 if (strcmp(entries->name, name) == 0)
4035 return entries;
4036 }
4037
4038 if (error_msg) {
4039 error(1, 0, "%s", error_msg);
4040 }
4041
4042 return NULL;
4043 }
4044
4045 static int firmware_info(const char *input)
4046 {
4047 struct safeloader_image_info info = {};
4048 struct image_partition_entry part = {};
4049 struct flash_partition_entry *e;
4050 FILE *input_file;
4051
4052 input_file = fopen(input, "rb");
4053
4054 safeloader_parse_image(input_file, &info);
4055
4056 if (info.type == SAFELOADER_TYPE_VENDOR) {
4057 char buf[SAFELOADER_HEADER_SIZE] = {};
4058 uint32_t vendor_size;
4059
4060 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
4061 fread(&vendor_size, sizeof(uint32_t), 1, input_file);
4062
4063 vendor_size = ntohl(vendor_size);
4064 fread(buf, vendor_size, 1, input_file);
4065
4066 printf("Firmware vendor string:\n");
4067 fwrite(buf, strnlen(buf, vendor_size), 1, stdout);
4068 printf("\n");
4069 }
4070
4071 printf("Firmware image partitions:\n");
4072 printf("%-8s %-8s %s\n", "base", "size", "name");
4073
4074 e = &info.entries[0];
4075 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4076 printf("%08x %08x %s\n", e->base, e->size, e->name);
4077
4078 e = find_partition(&info.entries[0], MAX_PARTITIONS, "soft-version", NULL);
4079 if (e) {
4080 struct soft_version *s;
4081 unsigned int ascii_len;
4082 const uint8_t *buf;
4083 size_t data_len;
4084 bool isstr;
4085
4086 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4087 data_len = ntohl(((struct meta_header *) part.data)->length);
4088 buf = part.data + sizeof(struct meta_header);
4089
4090 /* Check for (null-terminated) string */
4091 ascii_len = 0;
4092 while (ascii_len < data_len && isascii(buf[ascii_len]))
4093 ascii_len++;
4094
4095 isstr = ascii_len == data_len;
4096
4097 printf("\n[Software version]\n");
4098 if (isstr) {
4099 fwrite(buf, strnlen((const char *) buf, data_len), 1, stdout);
4100 putchar('\n');
4101 } else if (data_len >= offsetof(struct soft_version, rev)) {
4102 s = (struct soft_version *) buf;
4103
4104 printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch);
4105 printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day);
4106 printf("Revision: %d\n", ntohl(s->rev));
4107 } else {
4108 printf("Failed to parse data\n");
4109 }
4110
4111 free_image_partition(&part);
4112 }
4113
4114 e = find_partition(&info.entries[0], MAX_PARTITIONS, "support-list", NULL);
4115 if (e) {
4116 size_t data_len;
4117
4118 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4119 data_len = ntohl(((struct meta_header *) part.data)->length);
4120
4121 printf("\n[Support list]\n");
4122 fwrite(part.data + sizeof(struct meta_header), data_len, 1, stdout);
4123 printf("\n");
4124
4125 free_image_partition(&part);
4126 }
4127
4128 e = find_partition(&info.entries[0], MAX_PARTITIONS, "partition-table", NULL);
4129 if (e) {
4130 size_t flash_table_offset = info.payload_offset + e->base + 4;
4131 struct flash_partition_entry parts[MAX_PARTITIONS] = {};
4132
4133 if (read_partition_table(input_file, flash_table_offset, parts, MAX_PARTITIONS, PARTITION_TABLE_FLASH))
4134 error(1, 0, "Error can not read the partition table (partition)");
4135
4136 printf("\n[Partition table]\n");
4137 printf("%-8s %-8s %s\n", "base", "size", "name");
4138
4139 e = &parts[0];
4140 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4141 printf("%08x %08x %s\n", e->base, e->size, e->name);
4142 }
4143
4144 fclose(input_file);
4145
4146 return 0;
4147 }
4148
4149 static void write_ff(FILE *output_file, size_t size)
4150 {
4151 char buf[4096];
4152 size_t offset;
4153
4154 memset(buf, 0xff, sizeof(buf));
4155
4156 for (offset = 0; offset + sizeof(buf) < size ; offset += sizeof(buf)) {
4157 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
4158 error(1, errno, "Can not write 0xff to output_file");
4159 }
4160
4161 /* write last chunk smaller than buffer */
4162 if (offset < size) {
4163 offset = size - offset;
4164 if (fwrite(buf, offset, 1, output_file) != 1)
4165 error(1, errno, "Can not write partition to output_file");
4166 }
4167 }
4168
4169 static void convert_firmware(const char *input, const char *output)
4170 {
4171 struct flash_partition_entry flash[MAX_PARTITIONS] = {};
4172 struct flash_partition_entry *fwup_partition_table;
4173 struct flash_partition_entry *flash_file_system;
4174 struct flash_partition_entry *fwup_file_system;
4175 struct flash_partition_entry *flash_os_image;
4176 struct flash_partition_entry *fwup_os_image;
4177 struct safeloader_image_info info = {};
4178 size_t flash_table_offset;
4179 struct stat statbuf;
4180 FILE *output_file;
4181 FILE *input_file;
4182
4183 /* check input file */
4184 if (stat(input, &statbuf)) {
4185 error(1, errno, "Can not read input firmware %s", input);
4186 }
4187
4188 input_file = fopen(input, "rb");
4189 if (!input_file)
4190 error(1, 0, "Can not open input firmware %s", input);
4191
4192 output_file = fopen(output, "wb");
4193 if (!output_file)
4194 error(1, 0, "Can not open output firmware %s", output);
4195
4196 input_file = fopen(input, "rb");
4197 safeloader_parse_image(input_file, &info);
4198
4199 fwup_os_image = find_partition(info.entries, MAX_PARTITIONS,
4200 "os-image", "Error can not find os-image partition (fwup)");
4201 fwup_file_system = find_partition(info.entries, MAX_PARTITIONS,
4202 "file-system", "Error can not find file-system partition (fwup)");
4203 fwup_partition_table = find_partition(info.entries, MAX_PARTITIONS,
4204 "partition-table", "Error can not find partition-table partition");
4205
4206 /* the flash partition table has a 0x00000004 magic haeder */
4207 flash_table_offset = info.payload_offset + fwup_partition_table->base + 4;
4208 if (read_partition_table(input_file, flash_table_offset, flash, MAX_PARTITIONS, PARTITION_TABLE_FLASH) != 0)
4209 error(1, 0, "Error can not read the partition table (flash)");
4210
4211 flash_os_image = find_partition(flash, MAX_PARTITIONS,
4212 "os-image", "Error can not find os-image partition (flash)");
4213 flash_file_system = find_partition(flash, MAX_PARTITIONS,
4214 "file-system", "Error can not find file-system partition (flash)");
4215
4216 /* write os_image to 0x0 */
4217 write_partition(input_file, info.payload_offset, fwup_os_image, output_file);
4218 write_ff(output_file, flash_os_image->size - fwup_os_image->size);
4219
4220 /* write file-system behind os_image */
4221 fseek(output_file, flash_file_system->base - flash_os_image->base, SEEK_SET);
4222 write_partition(input_file, info.payload_offset, fwup_file_system, output_file);
4223
4224 fclose(output_file);
4225 fclose(input_file);
4226 }
4227
4228 int main(int argc, char *argv[]) {
4229 const char *info_image = NULL, *board = NULL, *kernel_image = NULL, *rootfs_image = NULL, *output = NULL;
4230 const char *extract_image = NULL, *output_directory = NULL, *convert_image = NULL;
4231 bool add_jffs2_eof = false, sysupgrade = false;
4232 unsigned rev = 0;
4233 struct device_info *info;
4234 set_source_date_epoch();
4235
4236 while (true) {
4237 int c;
4238
4239 c = getopt(argc, argv, "i:B:k:r:o:V:jSh:x:d:z:");
4240 if (c == -1)
4241 break;
4242
4243 switch (c) {
4244 case 'i':
4245 info_image = optarg;
4246 break;
4247
4248 case 'B':
4249 board = optarg;
4250 break;
4251
4252 case 'k':
4253 kernel_image = optarg;
4254 break;
4255
4256 case 'r':
4257 rootfs_image = optarg;
4258 break;
4259
4260 case 'o':
4261 output = optarg;
4262 break;
4263
4264 case 'V':
4265 sscanf(optarg, "r%u", &rev);
4266 break;
4267
4268 case 'j':
4269 add_jffs2_eof = true;
4270 break;
4271
4272 case 'S':
4273 sysupgrade = true;
4274 break;
4275
4276 case 'h':
4277 usage(argv[0]);
4278 return 0;
4279
4280 case 'd':
4281 output_directory = optarg;
4282 break;
4283
4284 case 'x':
4285 extract_image = optarg;
4286 break;
4287
4288 case 'z':
4289 convert_image = optarg;
4290 break;
4291
4292 default:
4293 usage(argv[0]);
4294 return 1;
4295 }
4296 }
4297
4298 if (info_image) {
4299 firmware_info(info_image);
4300 } else if (extract_image || output_directory) {
4301 if (!extract_image)
4302 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4303 if (!output_directory)
4304 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4305 extract_firmware(extract_image, output_directory);
4306 } else if (convert_image) {
4307 if (!output)
4308 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4309 convert_firmware(convert_image, output);
4310 } else {
4311 if (!board)
4312 error(1, 0, "no board has been specified");
4313 if (!kernel_image)
4314 error(1, 0, "no kernel image has been specified");
4315 if (!rootfs_image)
4316 error(1, 0, "no rootfs image has been specified");
4317 if (!output)
4318 error(1, 0, "no output filename has been specified");
4319
4320 info = find_board(board);
4321
4322 if (info == NULL)
4323 error(1, 0, "unsupported board %s", board);
4324
4325 build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, info);
4326 }
4327
4328 return 0;
4329 }