tplink-safeloader: Add TP-Link Archer A6 V3.20
[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.0,special_id:4A500000}\n"
982 "{product_name:Archer AX23,product_ver:1.0,special_id:4B520000}\n"
983 "{product_name:Archer AX23,product_ver:1.0,special_id:52550000}\n"
984 "{product_name:Archer AX23,product_ver:1.0.0,special_id:43410000}\n"
985 "{product_name:Archer AX23,product_ver:1.0.0,special_id:54570000}\n"
986 "{product_name:Archer AX23,product_ver:1.0.0,special_id:55530000}\n"
987 "{product_name:Archer AX23,product_ver:1.20,special_id:45550000}\n"
988 "{product_name:Archer AX23,product_ver:1.20,special_id:4A500000}\n"
989 "{product_name:Archer AX23,product_ver:1.20,special_id:52550000}\n"
990 "{product_name:Archer AX23,product_ver:1.20,special_id:55530000}\n"
991 "{product_name:Archer AX1800,product_ver:1.20,special_id:45550000}\n"
992 "{product_name:Archer AX1800,product_ver:1.20,special_id:52550000}\n",
993 .part_trail = 0x00,
994 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.3\n"),
995
996 .partitions = {
997 {"fs-uboot", 0x00000, 0x40000},
998 {"firmware", 0x40000, 0xf60000},
999 {"default-mac", 0xfa0000, 0x00200},
1000 {"pin", 0xfa0200, 0x00100},
1001 {"device-id", 0xfa0300, 0x00100},
1002 {"product-info", 0xfa0400, 0x0fc00},
1003 {"default-config", 0xfb0000, 0x08000},
1004 {"ap-def-config", 0xfb8000, 0x08000},
1005 {"user-config", 0xfc0000, 0x0a000},
1006 {"ag-config", 0xfca000, 0x04000},
1007 {"certificate", 0xfce000, 0x02000},
1008 {"ap-config", 0xfd0000, 0x06000},
1009 {"router-config", 0xfd6000, 0x06000},
1010 {"favicon", 0xfdc000, 0x02000},
1011 {"logo", 0xfde000, 0x02000},
1012 {"partition-table", 0xfe0000, 0x00800},
1013 {"soft-version", 0xfe0800, 0x00100},
1014 {"support-list", 0xfe0900, 0x00400},
1015 {"profile", 0xfe0d00, 0x03000},
1016 {"extra-para", 0xfe3d00, 0x00100},
1017 {"radio", 0xff0000, 0x10000},
1018 {NULL, 0, 0}
1019 },
1020 .first_sysupgrade_partition = "os-image",
1021 .last_sysupgrade_partition = "file-system",
1022 },
1023 /** Firmware layout for the C2v3 */
1024 {
1025 .id = "ARCHER-C2-V3",
1026 .support_list =
1027 "SupportList:\n"
1028 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
1029 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
1030 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
1031 .part_trail = 0x00,
1032 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.1\n"),
1033
1034 /** We're using a dynamic kernel/rootfs split here */
1035
1036 .partitions = {
1037 {"factory-boot", 0x00000, 0x20000},
1038 {"fs-uboot", 0x20000, 0x10000},
1039 {"firmware", 0x30000, 0x7a0000},
1040 {"user-config", 0x7d0000, 0x04000},
1041 {"default-mac", 0x7e0000, 0x00100},
1042 {"device-id", 0x7e0100, 0x00100},
1043 {"extra-para", 0x7e0200, 0x00100},
1044 {"pin", 0x7e0300, 0x00100},
1045 {"support-list", 0x7e0400, 0x00400},
1046 {"soft-version", 0x7e0800, 0x00400},
1047 {"product-info", 0x7e0c00, 0x01400},
1048 {"partition-table", 0x7e2000, 0x01000},
1049 {"profile", 0x7e3000, 0x01000},
1050 {"default-config", 0x7e4000, 0x04000},
1051 {"merge-config", 0x7ec000, 0x02000},
1052 {"qos-db", 0x7ee000, 0x02000},
1053 {"radio", 0x7f0000, 0x10000},
1054 {NULL, 0, 0}
1055 },
1056
1057 .first_sysupgrade_partition = "os-image",
1058 .last_sysupgrade_partition = "file-system",
1059 },
1060
1061 /** Firmware layout for the C25v1 */
1062 {
1063 .id = "ARCHER-C25-V1",
1064 .support_list =
1065 "SupportList:\n"
1066 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
1067 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
1068 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
1069 .part_trail = 0x00,
1070 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1071
1072 /* We're using a dynamic kernel/rootfs split here */
1073 .partitions = {
1074 {"factory-boot", 0x00000, 0x20000},
1075 {"fs-uboot", 0x20000, 0x10000},
1076 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
1077 /* Stock: name file-system base 0x130000 size 0x6a0000 */
1078 {"user-config", 0x7d0000, 0x04000},
1079 {"default-mac", 0x7e0000, 0x00100},
1080 {"device-id", 0x7e0100, 0x00100},
1081 {"extra-para", 0x7e0200, 0x00100},
1082 {"pin", 0x7e0300, 0x00100},
1083 {"support-list", 0x7e0400, 0x00400},
1084 {"soft-version", 0x7e0800, 0x00400},
1085 {"product-info", 0x7e0c00, 0x01400},
1086 {"partition-table", 0x7e2000, 0x01000},
1087 {"profile", 0x7e3000, 0x01000},
1088 {"default-config", 0x7e4000, 0x04000},
1089 {"merge-config", 0x7ec000, 0x02000},
1090 {"qos-db", 0x7ee000, 0x02000},
1091 {"radio", 0x7f0000, 0x10000},
1092 {NULL, 0, 0}
1093 },
1094
1095 .first_sysupgrade_partition = "os-image",
1096 .last_sysupgrade_partition = "file-system",
1097 },
1098
1099 /** Firmware layout for the C58v1 */
1100 {
1101 .id = "ARCHER-C58-V1",
1102 .vendor = "",
1103 .support_list =
1104 "SupportList:\r\n"
1105 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
1106 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
1107 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
1108 .part_trail = 0x00,
1109 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1110
1111 .partitions = {
1112 {"fs-uboot", 0x00000, 0x10000},
1113 {"default-mac", 0x10000, 0x00200},
1114 {"pin", 0x10200, 0x00200},
1115 {"product-info", 0x10400, 0x00100},
1116 {"partition-table", 0x10500, 0x00800},
1117 {"soft-version", 0x11300, 0x00200},
1118 {"support-list", 0x11500, 0x00100},
1119 {"device-id", 0x11600, 0x00100},
1120 {"profile", 0x11700, 0x03900},
1121 {"default-config", 0x15000, 0x04000},
1122 {"user-config", 0x19000, 0x04000},
1123 {"firmware", 0x20000, 0x7c8000},
1124 {"certyficate", 0x7e8000, 0x08000},
1125 {"radio", 0x7f0000, 0x10000},
1126 {NULL, 0, 0}
1127 },
1128
1129 .first_sysupgrade_partition = "os-image",
1130 .last_sysupgrade_partition = "file-system",
1131 },
1132
1133 /** Firmware layout for the C59v1 */
1134 {
1135 .id = "ARCHER-C59-V1",
1136 .vendor = "",
1137 .support_list =
1138 "SupportList:\r\n"
1139 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
1140 "{product_name:Archer C59,product_ver:1.0.0,special_id:43410000}\r\n"
1141 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
1142 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
1143 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
1144 .part_trail = 0x00,
1145 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1146
1147 /* We're using a dynamic kernel/rootfs split here */
1148 .partitions = {
1149 {"fs-uboot", 0x00000, 0x10000},
1150 {"default-mac", 0x10000, 0x00200},
1151 {"pin", 0x10200, 0x00200},
1152 {"device-id", 0x10400, 0x00100},
1153 {"product-info", 0x10500, 0x0fb00},
1154 {"firmware", 0x20000, 0xe30000},
1155 {"partition-table", 0xe50000, 0x10000},
1156 {"soft-version", 0xe60000, 0x10000},
1157 {"support-list", 0xe70000, 0x10000},
1158 {"profile", 0xe80000, 0x10000},
1159 {"default-config", 0xe90000, 0x10000},
1160 {"user-config", 0xea0000, 0x40000},
1161 {"usb-config", 0xee0000, 0x10000},
1162 {"certificate", 0xef0000, 0x10000},
1163 {"qos-db", 0xf00000, 0x40000},
1164 {"log", 0xfe0000, 0x10000},
1165 {"radio", 0xff0000, 0x10000},
1166 {NULL, 0, 0}
1167 },
1168
1169 .first_sysupgrade_partition = "os-image",
1170 .last_sysupgrade_partition = "file-system",
1171 },
1172
1173 /** Firmware layout for the C59v2 */
1174 {
1175 .id = "ARCHER-C59-V2",
1176 .vendor = "",
1177 .support_list =
1178 "SupportList:\r\n"
1179 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
1180 "{product_name:Archer C59,product_ver:2.0.0,special_id:43410000}\r\n"
1181 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
1182 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
1183 .part_trail = 0x00,
1184 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0 Build 20161206 rel.7303\n"),
1185
1186 /** We're using a dynamic kernel/rootfs split here */
1187 .partitions = {
1188 {"factory-boot", 0x00000, 0x20000},
1189 {"fs-uboot", 0x20000, 0x10000},
1190 {"default-mac", 0x30000, 0x00200},
1191 {"pin", 0x30200, 0x00200},
1192 {"device-id", 0x30400, 0x00100},
1193 {"product-info", 0x30500, 0x0fb00},
1194 {"firmware", 0x40000, 0xe10000},
1195 {"partition-table", 0xe50000, 0x10000},
1196 {"soft-version", 0xe60000, 0x10000},
1197 {"support-list", 0xe70000, 0x10000},
1198 {"profile", 0xe80000, 0x10000},
1199 {"default-config", 0xe90000, 0x10000},
1200 {"user-config", 0xea0000, 0x40000},
1201 {"usb-config", 0xee0000, 0x10000},
1202 {"certificate", 0xef0000, 0x10000},
1203 {"extra-para", 0xf00000, 0x10000},
1204 {"qos-db", 0xf10000, 0x30000},
1205 {"log", 0xfe0000, 0x10000},
1206 {"radio", 0xff0000, 0x10000},
1207 {NULL, 0, 0}
1208 },
1209
1210 .first_sysupgrade_partition = "os-image",
1211 .last_sysupgrade_partition = "file-system",
1212 },
1213
1214 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
1215 {
1216 .id = "ARCHER-C6-V2",
1217 .vendor = "",
1218 .support_list =
1219 "SupportList:\r\n"
1220 "{product_name:Archer A6,product_ver:2.0.0,special_id:45550000}\r\n"
1221 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
1222 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1223 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1224 .part_trail = 0x00,
1225 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1226
1227 .partitions = {
1228 {"fs-uboot", 0x00000, 0x20000},
1229 {"default-mac", 0x20000, 0x00200},
1230 {"pin", 0x20200, 0x00100},
1231 {"product-info", 0x20300, 0x00200},
1232 {"device-id", 0x20500, 0x0fb00},
1233 {"firmware", 0x30000, 0x7a9400},
1234 {"soft-version", 0x7d9400, 0x00100},
1235 {"extra-para", 0x7d9500, 0x00100},
1236 {"support-list", 0x7d9600, 0x00200},
1237 {"profile", 0x7d9800, 0x03000},
1238 {"default-config", 0x7dc800, 0x03000},
1239 {"partition-table", 0x7df800, 0x00800},
1240 {"user-config", 0x7e0000, 0x0c000},
1241 {"certificate", 0x7ec000, 0x04000},
1242 {"radio", 0x7f0000, 0x10000},
1243 {NULL, 0, 0}
1244 },
1245
1246 .first_sysupgrade_partition = "os-image",
1247 .last_sysupgrade_partition = "file-system",
1248 },
1249
1250 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1251 {
1252 .id = "ARCHER-C6-V2-US",
1253 .vendor = "",
1254 .support_list =
1255 "SupportList:\n"
1256 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1257 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1258 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1259 .part_trail = 0x00,
1260 .soft_ver = SOFT_VER_TEXT("soft_ver:1.9.1\n"),
1261
1262 .partitions = {
1263 {"factory-boot", 0x00000, 0x20000},
1264 {"default-mac", 0x20000, 0x00200},
1265 {"pin", 0x20200, 0x00100},
1266 {"product-info", 0x20300, 0x00200},
1267 {"device-id", 0x20500, 0x0fb00},
1268 {"fs-uboot", 0x30000, 0x20000},
1269 {"firmware", 0x50000, 0xf89400},
1270 {"soft-version", 0xfd9400, 0x00100},
1271 {"extra-para", 0xfd9500, 0x00100},
1272 {"support-list", 0xfd9600, 0x00200},
1273 {"profile", 0xfd9800, 0x03000},
1274 {"default-config", 0xfdc800, 0x03000},
1275 {"partition-table", 0xfdf800, 0x00800},
1276 {"user-config", 0xfe0000, 0x0c000},
1277 {"certificate", 0xfec000, 0x04000},
1278 {"radio", 0xff0000, 0x10000},
1279 {NULL, 0, 0}
1280 },
1281 .first_sysupgrade_partition = "os-image",
1282 .last_sysupgrade_partition = "file-system",
1283 },
1284 /** Firmware layout for the Archer C6 v3 */
1285 {
1286 .id = "ARCHER-C6-V3",
1287 .vendor = "",
1288 .support_list =
1289 "SupportList:\n"
1290 "{product_name:Archer C6,product_ver:3.20,special_id:55530000}"
1291 "{product_name:Archer C6,product_ver:3.20,special_id:45550000}"
1292 "{product_name:Archer C6,product_ver:3.20,special_id:52550000}"
1293 "{product_name:Archer C6,product_ver:3.20,special_id:4A500000}"
1294 "{product_name:Archer C6,product_ver:3.20,special_id:4B520000}"
1295 "{product_name:Archer C6,product_ver:3.0.0,special_id:42520000}",
1296 .part_trail = 0x00,
1297 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.9\n"),
1298
1299 .partitions = {
1300 {"fs-uboot", 0x00000, 0x40000},
1301 {"firmware", 0x40000, 0xf60000},
1302 {"default-mac", 0xfa0000, 0x00200},
1303 {"pin", 0xfa0200, 0x00100},
1304 {"device-id", 0xfa0300, 0x00100},
1305 {"product-info", 0xfa0400, 0x0fc00},
1306 {"default-config", 0xfb0000, 0x08000},
1307 {"ap-def-config", 0xfb8000, 0x08000},
1308 {"user-config", 0xfc0000, 0x0a000},
1309 {"ag-config", 0xfca000, 0x04000},
1310 {"certificate", 0xfce000, 0x02000},
1311 {"ap-config", 0xfd0000, 0x06000},
1312 {"router-config", 0xfd6000, 0x06000},
1313 {"favicon", 0xfdc000, 0x02000},
1314 {"logo", 0xfde000, 0x02000},
1315 {"partition-table", 0xfe0000, 0x00800},
1316 {"soft-version", 0xfe0800, 0x00100},
1317 {"support-list", 0xfe0900, 0x00200},
1318 {"profile", 0xfe0b00, 0x03000},
1319 {"extra-para", 0xfe3b00, 0x00100},
1320 {"radio", 0xff0000, 0x10000},
1321 {NULL, 0, 0}
1322 },
1323 .first_sysupgrade_partition = "os-image",
1324 .last_sysupgrade_partition = "file-system",
1325 },
1326 /** Firmware layout for the Archer A6 v3 */
1327 {
1328 .id = "ARCHER-A6-V3",
1329 .vendor = "",
1330 .support_list =
1331 "SupportList:\n"
1332 "{product_name:Archer A6,product_ver:3.0.0,special_id:43410000}\n"
1333 "{product_name:Archer A6,product_ver:3.0.0,special_id:55530000}\n"
1334 "{product_name:Archer A6,product_ver:3.0.0,special_id:54570000}\n"
1335 "{product_name:Archer A6,product_ver:3.0.0,special_id:4A500000}\n"
1336 "{product_name:Archer A6,product_ver:3.20,special_id:45550000}\n"
1337 "{product_name:Archer A6,product_ver:3.20,special_id:52550000}\n",
1338 .part_trail = 0x00,
1339 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.5\n"),
1340
1341 .partitions = {
1342 {"fs-uboot", 0x00000, 0x40000},
1343 {"firmware", 0x40000, 0xf60000},
1344 {"default-mac", 0xfa0000, 0x00200},
1345 {"pin", 0xfa0200, 0x00100},
1346 {"device-id", 0xfa0300, 0x00100},
1347 {"product-info", 0xfa0400, 0x0fc00},
1348 {"default-config", 0xfb0000, 0x08000},
1349 {"ap-def-config", 0xfb8000, 0x08000},
1350 {"user-config", 0xfc0000, 0x0a000},
1351 {"ag-config", 0xfca000, 0x04000},
1352 {"certificate", 0xfce000, 0x02000},
1353 {"ap-config", 0xfd0000, 0x06000},
1354 {"router-config", 0xfd6000, 0x06000},
1355 {"favicon", 0xfdc000, 0x02000},
1356 {"logo", 0xfde000, 0x02000},
1357 {"partition-table", 0xfe0000, 0x00800},
1358 {"soft-version", 0xfe0800, 0x00100},
1359 {"support-list", 0xfe0900, 0x00200},
1360 {"profile", 0xfe0b00, 0x03000},
1361 {"extra-para", 0xfe3b00, 0x00100},
1362 {"radio", 0xff0000, 0x10000},
1363 {NULL, 0, 0}
1364 },
1365 .first_sysupgrade_partition = "os-image",
1366 .last_sysupgrade_partition = "file-system",
1367 },
1368 /** Firmware layout for the Archer C6U v1 */
1369 {
1370 .id = "ARCHER-C6U-V1",
1371 .vendor = "",
1372 .support_list =
1373 "SupportList:\n"
1374 "{product_name:Archer C6U,product_ver:1.0.0,special_id:45550000}\n",
1375 .part_trail = 0x00,
1376 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.2\n"),
1377
1378 .partitions = {
1379 {"fs-uboot", 0x00000, 0x40000},
1380 {"firmware", 0x40000, 0xf60000},
1381 {"default-mac", 0xfa0000, 0x00200},
1382 {"pin", 0xfa0200, 0x00100},
1383 {"device-id", 0xfa0300, 0x00100},
1384 {"product-info", 0xfa0400, 0x0fc00},
1385 {"default-config", 0xfb0000, 0x08000},
1386 {"ap-def-config", 0xfb8000, 0x08000},
1387 {"user-config", 0xfc0000, 0x0c000},
1388 {"certificate", 0xfcc000, 0x04000},
1389 {"ap-config", 0xfd0000, 0x08000},
1390 {"router-config", 0xfd8000, 0x08000},
1391 {"partition-table", 0xfe0000, 0x00800},
1392 {"soft-version", 0xfe0800, 0x00100},
1393 {"support-list", 0xfe0900, 0x00200},
1394 {"profile", 0xfe0b00, 0x03000},
1395 {"extra-para", 0xfe3b00, 0x00100},
1396 {"radio", 0xff0000, 0x10000},
1397 {NULL, 0, 0}
1398 },
1399 .first_sysupgrade_partition = "os-image",
1400 .last_sysupgrade_partition = "file-system",
1401 },
1402 /** Firmware layout for the C60v1 */
1403 {
1404 .id = "ARCHER-C60-V1",
1405 .vendor = "",
1406 .support_list =
1407 "SupportList:\r\n"
1408 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1409 "{product_name:Archer C60,product_ver:1.0.0,special_id:43410000}\r\n"
1410 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1411 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1412 .part_trail = 0x00,
1413 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1414
1415 .partitions = {
1416 {"fs-uboot", 0x00000, 0x10000},
1417 {"default-mac", 0x10000, 0x00200},
1418 {"pin", 0x10200, 0x00200},
1419 {"product-info", 0x10400, 0x00100},
1420 {"partition-table", 0x10500, 0x00800},
1421 {"soft-version", 0x11300, 0x00200},
1422 {"support-list", 0x11500, 0x00100},
1423 {"device-id", 0x11600, 0x00100},
1424 {"profile", 0x11700, 0x03900},
1425 {"default-config", 0x15000, 0x04000},
1426 {"user-config", 0x19000, 0x04000},
1427 {"firmware", 0x20000, 0x7c8000},
1428 {"certyficate", 0x7e8000, 0x08000},
1429 {"radio", 0x7f0000, 0x10000},
1430 {NULL, 0, 0}
1431 },
1432
1433 .first_sysupgrade_partition = "os-image",
1434 .last_sysupgrade_partition = "file-system",
1435 },
1436
1437 /** Firmware layout for the C60v2 */
1438 {
1439 .id = "ARCHER-C60-V2",
1440 .vendor = "",
1441 .support_list =
1442 "SupportList:\r\n"
1443 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1444 "{product_name:Archer C60,product_ver:2.0.0,special_id:43410000}\r\n"
1445 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1446 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1447 .part_trail = 0x00,
1448 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
1449
1450 .partitions = {
1451 {"factory-boot", 0x00000, 0x1fb00},
1452 {"default-mac", 0x1fb00, 0x00200},
1453 {"pin", 0x1fd00, 0x00100},
1454 {"product-info", 0x1fe00, 0x00100},
1455 {"device-id", 0x1ff00, 0x00100},
1456 {"fs-uboot", 0x20000, 0x10000},
1457 {"firmware", 0x30000, 0x7a0000},
1458 {"soft-version", 0x7d9500, 0x00100},
1459 {"support-list", 0x7d9600, 0x00100},
1460 {"extra-para", 0x7d9700, 0x00100},
1461 {"profile", 0x7d9800, 0x03000},
1462 {"default-config", 0x7dc800, 0x03000},
1463 {"partition-table", 0x7df800, 0x00800},
1464 {"user-config", 0x7e0000, 0x0c000},
1465 {"certificate", 0x7ec000, 0x04000},
1466 {"radio", 0x7f0000, 0x10000},
1467 {NULL, 0, 0}
1468 },
1469
1470 .first_sysupgrade_partition = "os-image",
1471 .last_sysupgrade_partition = "file-system",
1472 },
1473
1474 /** Firmware layout for the C60v3 */
1475 {
1476 .id = "ARCHER-C60-V3",
1477 .vendor = "",
1478 .support_list =
1479 "SupportList:\r\n"
1480 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1481 "{product_name:Archer C60,product_ver:3.0.0,special_id:43410000}\r\n"
1482 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1483 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1484 .part_trail = 0x00,
1485 .soft_ver = SOFT_VER_TEXT("soft_ver:3.0.0\n"),
1486
1487 .partitions = {
1488 {"factory-boot", 0x00000, 0x1fb00},
1489 {"default-mac", 0x1fb00, 0x00200},
1490 {"pin", 0x1fd00, 0x00100},
1491 {"product-info", 0x1fe00, 0x00100},
1492 {"device-id", 0x1ff00, 0x00100},
1493 {"fs-uboot", 0x20000, 0x10000},
1494 {"firmware", 0x30000, 0x7a0000},
1495 {"soft-version", 0x7d9500, 0x00100},
1496 {"support-list", 0x7d9600, 0x00100},
1497 {"extra-para", 0x7d9700, 0x00100},
1498 {"profile", 0x7d9800, 0x03000},
1499 {"default-config", 0x7dc800, 0x03000},
1500 {"partition-table", 0x7df800, 0x00800},
1501 {"user-config", 0x7e0000, 0x0c000},
1502 {"certificate", 0x7ec000, 0x04000},
1503 {"radio", 0x7f0000, 0x10000},
1504 {NULL, 0, 0}
1505 },
1506
1507 .first_sysupgrade_partition = "os-image",
1508 .last_sysupgrade_partition = "file-system",
1509 },
1510
1511 /** Firmware layout for the C5 */
1512 {
1513 .id = "ARCHER-C5-V2",
1514 .vendor = "",
1515 .support_list =
1516 "SupportList:\r\n"
1517 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1518 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1519 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1520 .part_trail = 0x00,
1521 .soft_ver = SOFT_VER_DEFAULT,
1522
1523 .partitions = {
1524 {"fs-uboot", 0x00000, 0x40000},
1525 {"os-image", 0x40000, 0x200000},
1526 {"file-system", 0x240000, 0xc00000},
1527 {"default-mac", 0xe40000, 0x00200},
1528 {"pin", 0xe40200, 0x00200},
1529 {"product-info", 0xe40400, 0x00200},
1530 {"partition-table", 0xe50000, 0x10000},
1531 {"soft-version", 0xe60000, 0x00200},
1532 {"support-list", 0xe61000, 0x0f000},
1533 {"profile", 0xe70000, 0x10000},
1534 {"default-config", 0xe80000, 0x10000},
1535 {"user-config", 0xe90000, 0x50000},
1536 {"log", 0xee0000, 0x100000},
1537 {"radio_bk", 0xfe0000, 0x10000},
1538 {"radio", 0xff0000, 0x10000},
1539 {NULL, 0, 0}
1540 },
1541
1542 .first_sysupgrade_partition = "os-image",
1543 .last_sysupgrade_partition = "file-system"
1544 },
1545
1546 /** Firmware layout for the C7 */
1547 {
1548 .id = "ARCHER-C7-V4",
1549 .support_list =
1550 "SupportList:\n"
1551 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1552 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1553 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1554 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1555 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1556 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1557 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1558 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1559 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1560 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1561 .part_trail = 0x00,
1562 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1563
1564 /* We're using a dynamic kernel/rootfs split here */
1565 .partitions = {
1566 {"factory-boot", 0x00000, 0x20000},
1567 {"fs-uboot", 0x20000, 0x20000},
1568 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1569 /* Stock: name file-system base 0x160000 size 0xda0000 */
1570 {"default-mac", 0xf00000, 0x00200},
1571 {"pin", 0xf00200, 0x00200},
1572 {"device-id", 0xf00400, 0x00100},
1573 {"product-info", 0xf00500, 0x0fb00},
1574 {"soft-version", 0xf10000, 0x00100},
1575 {"extra-para", 0xf11000, 0x01000},
1576 {"support-list", 0xf12000, 0x0a000},
1577 {"profile", 0xf1c000, 0x04000},
1578 {"default-config", 0xf20000, 0x10000},
1579 {"user-config", 0xf30000, 0x40000},
1580 {"qos-db", 0xf70000, 0x40000},
1581 {"certificate", 0xfb0000, 0x10000},
1582 {"partition-table", 0xfc0000, 0x10000},
1583 {"log", 0xfd0000, 0x20000},
1584 {"radio", 0xff0000, 0x10000},
1585 {NULL, 0, 0}
1586 },
1587
1588 .first_sysupgrade_partition = "os-image",
1589 .last_sysupgrade_partition = "file-system",
1590 },
1591
1592 /** Firmware layout for the C7 v5*/
1593 {
1594 .id = "ARCHER-C7-V5",
1595 .support_list =
1596 "SupportList:\n"
1597 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1598 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1599 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1600 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1601 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1602 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1603 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1604 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1605
1606 .part_trail = 0x00,
1607 .soft_ver = SOFT_VER_TEXT("soft_ver:7.0.0\n"),
1608
1609 /* We're using a dynamic kernel/rootfs split here */
1610 .partitions = {
1611 {"factory-boot", 0x00000, 0x20000},
1612 {"fs-uboot", 0x20000, 0x20000},
1613 {"partition-table", 0x40000, 0x10000},
1614 {"radio", 0x50000, 0x10000},
1615 {"default-mac", 0x60000, 0x00200},
1616 {"pin", 0x60200, 0x00200},
1617 {"device-id", 0x60400, 0x00100},
1618 {"product-info", 0x60500, 0x0fb00},
1619 {"soft-version", 0x70000, 0x01000},
1620 {"extra-para", 0x71000, 0x01000},
1621 {"support-list", 0x72000, 0x0a000},
1622 {"profile", 0x7c000, 0x04000},
1623 {"user-config", 0x80000, 0x40000},
1624
1625
1626 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1627 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1628
1629 {"log", 0xfc0000, 0x20000},
1630 {"certificate", 0xfe0000, 0x10000},
1631 {"default-config", 0xff0000, 0x10000},
1632 {NULL, 0, 0}
1633
1634 },
1635
1636 .first_sysupgrade_partition = "os-image",
1637 .last_sysupgrade_partition = "file-system",
1638 },
1639
1640 /** Firmware layout for the C9 */
1641 {
1642 .id = "ARCHERC9",
1643 .vendor = "",
1644 .support_list =
1645 "SupportList:\n"
1646 "{product_name:ArcherC9,"
1647 "product_ver:1.0.0,"
1648 "special_id:00000000}\n",
1649 .part_trail = 0x00,
1650 .soft_ver = SOFT_VER_DEFAULT,
1651
1652 .partitions = {
1653 {"fs-uboot", 0x00000, 0x40000},
1654 {"os-image", 0x40000, 0x200000},
1655 {"file-system", 0x240000, 0xc00000},
1656 {"default-mac", 0xe40000, 0x00200},
1657 {"pin", 0xe40200, 0x00200},
1658 {"product-info", 0xe40400, 0x00200},
1659 {"partition-table", 0xe50000, 0x10000},
1660 {"soft-version", 0xe60000, 0x00200},
1661 {"support-list", 0xe61000, 0x0f000},
1662 {"profile", 0xe70000, 0x10000},
1663 {"default-config", 0xe80000, 0x10000},
1664 {"user-config", 0xe90000, 0x50000},
1665 {"log", 0xee0000, 0x100000},
1666 {"radio_bk", 0xfe0000, 0x10000},
1667 {"radio", 0xff0000, 0x10000},
1668 {NULL, 0, 0}
1669 },
1670
1671 .first_sysupgrade_partition = "os-image",
1672 .last_sysupgrade_partition = "file-system"
1673 },
1674
1675 /** Firmware layout for the Deco M4R v1 and v2 */
1676 {
1677 .id = "DECO-M4R-V1",
1678 .vendor = "",
1679 .support_list =
1680 "SupportList:\n"
1681 "{product_name:M4R,product_ver:1.0.0,special_id:55530000}\n"
1682 "{product_name:M4R,product_ver:1.0.0,special_id:45550000}\n"
1683 "{product_name:M4R,product_ver:1.0.0,special_id:43410000}\n"
1684 "{product_name:M4R,product_ver:1.0.0,special_id:4A500000}\n"
1685 "{product_name:M4R,product_ver:1.0.0,special_id:41550000}\n"
1686 "{product_name:M4R,product_ver:1.0.0,special_id:4B520000}\n"
1687 "{product_name:M4R,product_ver:1.0.0,special_id:49440000}\n"
1688 "{product_name:M4R,product_ver:2.0.0,special_id:55530000}\n"
1689 "{product_name:M4R,product_ver:2.0.0,special_id:45550000}\n"
1690 "{product_name:M4R,product_ver:2.0.0,special_id:43410000}\n"
1691 "{product_name:M4R,product_ver:2.0.0,special_id:4A500000}\n"
1692 "{product_name:M4R,product_ver:2.0.0,special_id:41550000}\n"
1693 "{product_name:M4R,product_ver:2.0.0,special_id:4B520000}\n"
1694 "{product_name:M4R,product_ver:2.0.0,special_id:54570000}\n"
1695 "{product_name:M4R,product_ver:2.0.0,special_id:42340000}\n"
1696 "{product_name:M4R,product_ver:2.0.0,special_id:49440000}\n",
1697 .part_trail = 0x00,
1698 .soft_ver = SOFT_VER_DEFAULT,
1699
1700 .partitions = {
1701 {"fs-uboot", 0x00000, 0x80000},
1702 {"firmware", 0x80000, 0xe00000},
1703 {"product-info", 0xe80000, 0x05000},
1704 {"default-mac", 0xe85000, 0x01000},
1705 {"device-id", 0xe86000, 0x01000},
1706 {"support-list", 0xe87000, 0x10000},
1707 {"user-config", 0xea7000, 0x10000},
1708 {"device-config", 0xeb7000, 0x10000},
1709 {"group-info", 0xec7000, 0x10000},
1710 {"partition-table", 0xed7000, 0x02000},
1711 {"soft-version", 0xed9000, 0x10000},
1712 {"profile", 0xee9000, 0x10000},
1713 {"default-config", 0xef9000, 0x10000},
1714 {"url-sig", 0xfe0000, 0x10000},
1715 {"radio", 0xff0000, 0x10000},
1716 {NULL, 0, 0}
1717 },
1718 .first_sysupgrade_partition = "os-image",
1719 .last_sysupgrade_partition = "file-system",
1720 },
1721
1722 /** Firmware layout for the Deco M4R v4 */
1723 {
1724 .id = "DECO-M4R-V4",
1725 .vendor = "",
1726 .support_list =
1727 "SupportList:\n"
1728 "{product_name:M4R,product_ver:4.0.0,special_id:55530000}\n"
1729 "{product_name:M4R,product_ver:4.0.0,special_id:45550000}\n"
1730 "{product_name:M4R,product_ver:4.0.0,special_id:4A500000}\n"
1731 "{product_name:M4R,product_ver:4.0.0,special_id:42340000}\n"
1732 "{product_name:M4R,product_ver:4.0.0,special_id:5A470000}\n",
1733 .part_trail = 0x00,
1734 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
1735
1736 .partitions = {
1737 {"fs-uboot", 0x00000, 0x40000},
1738 {"firmware", 0x40000, 0xf60000},
1739 {"default-mac", 0xfa0000, 0x00300},
1740 {"device-id", 0xfa0300, 0x00100},
1741 {"product-info", 0xfa0400, 0x0fc00},
1742 {"group-info", 0xfb0000, 0x04000},
1743 {"user-config", 0xfb4000, 0x0c000},
1744 {"device-config", 0xfc0000, 0x10000},
1745 {"default-config", 0xfd0000, 0x10000},
1746 {"partition-table", 0xfe0000, 0x00800},
1747 {"soft-version", 0xfe0800, 0x00100},
1748 {"support-list", 0xfe0900, 0x00200},
1749 {"profile", 0xfe0b00, 0x03000},
1750 {"extra-para", 0xfe3b00, 0x00100},
1751 {"radio", 0xff0000, 0x10000},
1752 {NULL, 0, 0}
1753 },
1754 .first_sysupgrade_partition = "os-image",
1755 .last_sysupgrade_partition = "file-system",
1756 },
1757
1758 /** Firmware layout for the Deco S4 v2 */
1759 {
1760 .id = "DECO-S4-V2",
1761 .vendor = "",
1762 .support_list =
1763 "SupportList:\n"
1764 "{product_name:S4,product_ver:1.0.0,special_id:55530000}\n"
1765 "{product_name:S4,product_ver:1.0.0,special_id:45550000}\n"
1766 "{product_name:S4,product_ver:1.0.0,special_id:43410000}\n"
1767 "{product_name:S4,product_ver:1.0.0,special_id:4A500000}\n"
1768 "{product_name:S4,product_ver:1.0.0,special_id:41550000}\n"
1769 "{product_name:S4,product_ver:1.0.0,special_id:4B520000}\n"
1770 "{product_name:S4,product_ver:2.0.0,special_id:55530000}\n"
1771 "{product_name:S4,product_ver:2.0.0,special_id:45550000}\n"
1772 "{product_name:S4,product_ver:2.0.0,special_id:43410000}\n"
1773 "{product_name:S4,product_ver:2.0.0,special_id:4A500000}\n"
1774 "{product_name:S4,product_ver:2.0.0,special_id:41550000}\n"
1775 "{product_name:S4,product_ver:2.0.0,special_id:4B520000}\n",
1776 .part_trail = 0x00,
1777 .soft_ver = SOFT_VER_DEFAULT,
1778
1779 .partitions = {
1780 {"fs-uboot", 0x00000, 0x80000},
1781 {"product-info", 0x80000, 0x05000},
1782 {"default-mac", 0x85000, 0x01000},
1783 {"device-id", 0x86000, 0x01000},
1784 {"support-list", 0x87000, 0x10000},
1785 {"user-config", 0xa7000, 0x10000},
1786 {"device-config", 0xb7000, 0x10000},
1787 {"group-info", 0xc7000, 0x10000},
1788 {"partition-table", 0xd7000, 0x02000},
1789 {"soft-version", 0xd9000, 0x10000},
1790 {"profile", 0xe9000, 0x10000},
1791 {"default-config", 0xf9000, 0x10000},
1792 {"url-sig", 0x1e0000, 0x10000},
1793 {"radio", 0x1f0000, 0x10000},
1794 {"firmware", 0x200000, 0xe00000},
1795 {NULL, 0, 0}
1796 },
1797 .first_sysupgrade_partition = "os-image",
1798 .last_sysupgrade_partition = "file-system",
1799 },
1800
1801 /** Firmware layout for the EAP120 */
1802 {
1803 .id = "EAP120",
1804 .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1805 .support_list =
1806 "SupportList:\r\n"
1807 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1808 .part_trail = 0xff,
1809 .soft_ver = SOFT_VER_DEFAULT,
1810
1811 .partitions = {
1812 {"fs-uboot", 0x00000, 0x20000},
1813 {"partition-table", 0x20000, 0x02000},
1814 {"default-mac", 0x30000, 0x00020},
1815 {"support-list", 0x31000, 0x00100},
1816 {"product-info", 0x31100, 0x00100},
1817 {"soft-version", 0x32000, 0x00100},
1818 {"os-image", 0x40000, 0x180000},
1819 {"file-system", 0x1c0000, 0x600000},
1820 {"user-config", 0x7c0000, 0x10000},
1821 {"backup-config", 0x7d0000, 0x10000},
1822 {"log", 0x7e0000, 0x10000},
1823 {"radio", 0x7f0000, 0x10000},
1824 {NULL, 0, 0}
1825 },
1826
1827 .first_sysupgrade_partition = "os-image",
1828 .last_sysupgrade_partition = "file-system"
1829 },
1830
1831 /** Firmware layout for the EAP225-Outdoor v1 */
1832 {
1833 .id = "EAP225-OUTDOOR-V1",
1834 .support_list =
1835 "SupportList:\r\n"
1836 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1837 .part_trail = PART_TRAIL_NONE,
1838 .soft_ver = SOFT_VER_DEFAULT,
1839 .soft_ver_compat_level = 1,
1840
1841 .partitions = {
1842 {"fs-uboot", 0x00000, 0x20000},
1843 {"partition-table", 0x20000, 0x02000},
1844 {"default-mac", 0x30000, 0x01000},
1845 {"support-list", 0x31000, 0x00100},
1846 {"product-info", 0x31100, 0x00400},
1847 {"soft-version", 0x32000, 0x00100},
1848 {"firmware", 0x40000, 0xd80000},
1849 {"user-config", 0xdc0000, 0x30000},
1850 {"mutil-log", 0xf30000, 0x80000},
1851 {"oops", 0xfb0000, 0x40000},
1852 {"radio", 0xff0000, 0x10000},
1853 {NULL, 0, 0}
1854 },
1855
1856 .first_sysupgrade_partition = "os-image",
1857 .last_sysupgrade_partition = "file-system"
1858 },
1859
1860 /** Firmware layout for the EAP225 v1 */
1861 {
1862 .id = "EAP225-V1",
1863 .support_list =
1864 "SupportList:\r\n"
1865 "EAP225(TP-LINK|UN|AC1200-D):1.0\r\n",
1866 .part_trail = PART_TRAIL_NONE,
1867 .soft_ver = SOFT_VER_DEFAULT,
1868
1869 .partitions = {
1870 {"fs-uboot", 0x00000, 0x20000},
1871 {"partition-table", 0x20000, 0x02000},
1872 {"default-mac", 0x30000, 0x01000},
1873 {"support-list", 0x31000, 0x00100},
1874 {"product-info", 0x31100, 0x00400},
1875 {"soft-version", 0x32000, 0x00100},
1876 {"firmware", 0x40000, 0xd80000},
1877 {"user-config", 0xdc0000, 0x30000},
1878 {"radio", 0xff0000, 0x10000},
1879 {NULL, 0, 0}
1880 },
1881
1882 .first_sysupgrade_partition = "os-image",
1883 .last_sysupgrade_partition = "file-system"
1884 },
1885
1886 /** Firmware layout for the EAP225 v3
1887 * Also compatible with:
1888 * - EAP225 v3.20
1889 * - EAP225 v4
1890 * - EAP225-Outdoor v1
1891 * - EAP225-Outdoor v3
1892 * */
1893 {
1894 .id = "EAP225-V3",
1895 .support_list =
1896 "SupportList:\r\n"
1897 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n"
1898 "EAP225(TP-Link|UN|AC1350-D):3.20\r\n"
1899 "EAP225(TP-Link|UN|AC1350-D):4.0 CA\r\n"
1900 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n"
1901 "EAP225-Outdoor(TP-Link|UN|AC1200-D):3.0 CA,JP\r\n",
1902 .part_trail = PART_TRAIL_NONE,
1903 .soft_ver = SOFT_VER_DEFAULT,
1904 .soft_ver_compat_level = 1,
1905
1906 .partitions = {
1907 {"fs-uboot", 0x00000, 0x20000},
1908 {"partition-table", 0x20000, 0x02000},
1909 {"default-mac", 0x30000, 0x01000},
1910 {"support-list", 0x31000, 0x00100},
1911 {"product-info", 0x31100, 0x00400},
1912 {"soft-version", 0x32000, 0x00100},
1913 {"firmware", 0x40000, 0xd80000},
1914 {"user-config", 0xdc0000, 0x30000},
1915 {"mutil-log", 0xf30000, 0x80000},
1916 {"oops", 0xfb0000, 0x40000},
1917 {"radio", 0xff0000, 0x10000},
1918 {NULL, 0, 0}
1919 },
1920
1921 .first_sysupgrade_partition = "os-image",
1922 .last_sysupgrade_partition = "file-system"
1923 },
1924
1925 /** Firmware layout for the EAP225-Wall v2 */
1926 {
1927 .id = "EAP225-WALL-V2",
1928 .support_list =
1929 "SupportList:\r\n"
1930 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1931 .part_trail = PART_TRAIL_NONE,
1932 .soft_ver = SOFT_VER_DEFAULT,
1933 .soft_ver_compat_level = 1,
1934
1935 .partitions = {
1936 {"fs-uboot", 0x00000, 0x20000},
1937 {"partition-table", 0x20000, 0x02000},
1938 {"default-mac", 0x30000, 0x01000},
1939 {"support-list", 0x31000, 0x00100},
1940 {"product-info", 0x31100, 0x00400},
1941 {"soft-version", 0x32000, 0x00100},
1942 {"firmware", 0x40000, 0xd80000},
1943 {"user-config", 0xdc0000, 0x30000},
1944 {"mutil-log", 0xf30000, 0x80000},
1945 {"oops", 0xfb0000, 0x40000},
1946 {"radio", 0xff0000, 0x10000},
1947 {NULL, 0, 0}
1948 },
1949
1950 .first_sysupgrade_partition = "os-image",
1951 .last_sysupgrade_partition = "file-system"
1952 },
1953
1954 /** Firmware layout for the EAP235-Wall v1 */
1955 {
1956 .id = "EAP235-WALL-V1",
1957 .support_list =
1958 "SupportList:\r\n"
1959 "EAP235-Wall(TP-Link|UN|AC1200-D):1.0\r\n",
1960 .part_trail = PART_TRAIL_NONE,
1961 .soft_ver = SOFT_VER_NUMERIC(3, 0, 0),
1962 .soft_ver_compat_level = 1,
1963
1964 .partitions = {
1965 {"fs-uboot", 0x00000, 0x80000},
1966 {"partition-table", 0x80000, 0x02000},
1967 {"default-mac", 0x90000, 0x01000},
1968 {"support-list", 0x91000, 0x00100},
1969 {"product-info", 0x91100, 0x00400},
1970 {"soft-version", 0x92000, 0x00100},
1971 {"firmware", 0xa0000, 0xd20000},
1972 {"user-config", 0xdc0000, 0x30000},
1973 {"mutil-log", 0xf30000, 0x80000},
1974 {"oops", 0xfb0000, 0x40000},
1975 {"radio", 0xff0000, 0x10000},
1976 {NULL, 0, 0}
1977 },
1978
1979 .first_sysupgrade_partition = "os-image",
1980 .last_sysupgrade_partition = "file-system"
1981 },
1982
1983 /** Firmware layout for the EAP245 v1 */
1984 {
1985 .id = "EAP245-V1",
1986 .support_list =
1987 "SupportList:\r\n"
1988 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1989 .part_trail = PART_TRAIL_NONE,
1990 .soft_ver = SOFT_VER_DEFAULT,
1991
1992 .partitions = {
1993 {"fs-uboot", 0x00000, 0x20000},
1994 {"partition-table", 0x20000, 0x02000},
1995 {"default-mac", 0x30000, 0x01000},
1996 {"support-list", 0x31000, 0x00100},
1997 {"product-info", 0x31100, 0x00400},
1998 {"soft-version", 0x32000, 0x00100},
1999 {"firmware", 0x40000, 0xd80000},
2000 {"user-config", 0xdc0000, 0x30000},
2001 {"radio", 0xff0000, 0x10000},
2002 {NULL, 0, 0}
2003 },
2004
2005 .first_sysupgrade_partition = "os-image",
2006 .last_sysupgrade_partition = "file-system"
2007 },
2008
2009 /** Firmware layout for the EAP245 v3 */
2010 {
2011 .id = "EAP245-V3",
2012 .support_list =
2013 "SupportList:\r\n"
2014 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n"
2015 "EAP265 HD(TP-Link|UN|AC1750-D):1.0",
2016 .part_trail = PART_TRAIL_NONE,
2017 .soft_ver = SOFT_VER_DEFAULT,
2018 .soft_ver_compat_level = 1,
2019
2020 /** Firmware partition with dynamic kernel/rootfs split */
2021 .partitions = {
2022 {"factroy-boot", 0x00000, 0x40000},
2023 {"fs-uboot", 0x40000, 0x40000},
2024 {"partition-table", 0x80000, 0x10000},
2025 {"default-mac", 0x90000, 0x01000},
2026 {"support-list", 0x91000, 0x00100},
2027 {"product-info", 0x91100, 0x00400},
2028 {"soft-version", 0x92000, 0x00100},
2029 {"radio", 0xa0000, 0x10000},
2030 {"extra-para", 0xb0000, 0x10000},
2031 {"firmware", 0xc0000, 0xe40000},
2032 {"config", 0xf00000, 0x30000},
2033 {"mutil-log", 0xf30000, 0x80000},
2034 {"oops", 0xfb0000, 0x40000},
2035 {NULL, 0, 0}
2036 },
2037
2038 .first_sysupgrade_partition = "os-image",
2039 .last_sysupgrade_partition = "file-system"
2040 },
2041
2042 /** Firmware layout for the EAP615-Wall v1 */
2043 {
2044 .id = "EAP615-WALL-V1",
2045 .soft_ver = SOFT_VER_DEFAULT,
2046 .soft_ver_compat_level = 1,
2047 .support_list =
2048 "SupportList:\r\n"
2049 "EAP615-Wall(TP-Link|UN|AX1800-D):1.0\r\n"
2050 "EAP615-Wall(TP-Link|CA|AX1800-D):1.0\r\n"
2051 "EAP615-Wall(TP-Link|JP|AX1800-D):1.0\r\n",
2052 .part_trail = PART_TRAIL_NONE,
2053
2054 .partitions = {
2055 {"fs-uboot", 0x00000, 0x80000},
2056 {"partition-table", 0x80000, 0x02000},
2057 {"default-mac", 0x90000, 0x01000},
2058 {"support-list", 0x91000, 0x00100},
2059 {"product-info", 0x91100, 0x00400},
2060 {"soft-version", 0x92000, 0x00100},
2061 {"firmware", 0xa0000, 0xcf0000},
2062 {"user-config", 0xd90000, 0x60000},
2063 {"mutil-log", 0xf30000, 0x80000},
2064 {"oops", 0xfb0000, 0x40000},
2065 {"radio", 0xff0000, 0x10000},
2066 {NULL, 0, 0}
2067 },
2068
2069 .first_sysupgrade_partition = "os-image",
2070 .last_sysupgrade_partition = "file-system"
2071 },
2072
2073 /** Firmware layout for the TL-WA1201 v2 */
2074 {
2075 .id = "TL-WA1201-V2",
2076 .vendor = "",
2077 .support_list =
2078 "SupportList:\n"
2079 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:45550000}\n"
2080 "{product_name:TL-WA1201,product_ver:2.0.0,special_id:55530000}\n",
2081 .part_trail = 0x00,
2082 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.1 Build 20200709 rel.66244\n"),
2083
2084 .partitions = {
2085 {"fs-uboot", 0x00000, 0x20000},
2086 {"default-mac", 0x20000, 0x00200},
2087 {"pin", 0x20200, 0x00100},
2088 {"product-info", 0x20300, 0x00200},
2089 {"device-id", 0x20500, 0x0fb00},
2090 {"firmware", 0x30000, 0xce0000},
2091 {"portal-logo", 0xd10000, 0x20000},
2092 {"portal-back", 0xd30000, 0x200000},
2093 {"soft-version", 0xf30000, 0x00200},
2094 {"extra-para", 0xf30200, 0x00200},
2095 {"support-list", 0xf30400, 0x00200},
2096 {"profile", 0xf30600, 0x0fa00},
2097 {"apdef-config", 0xf40000, 0x10000},
2098 {"ap-config", 0xf50000, 0x10000},
2099 {"redef-config", 0xf60000, 0x10000},
2100 {"re-config", 0xf70000, 0x10000},
2101 {"multidef-config", 0xf80000, 0x10000},
2102 {"multi-config", 0xf90000, 0x10000},
2103 {"clientdef-config", 0xfa0000, 0x10000},
2104 {"client-config", 0xfb0000, 0x10000},
2105 {"partition-table", 0xfc0000, 0x10000},
2106 {"user-config", 0xfd0000, 0x10000},
2107 {"certificate", 0xfe0000, 0x10000},
2108 {"radio", 0xff0000, 0x10000},
2109 {NULL, 0, 0}
2110 },
2111 .first_sysupgrade_partition = "os-image",
2112 .last_sysupgrade_partition = "file-system",
2113 },
2114
2115 /** Firmware layout for the TL-WA850RE v2 */
2116 {
2117 .id = "TLWA850REV2",
2118 .vendor = "",
2119 .support_list =
2120 "SupportList:\n"
2121 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
2122 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
2123 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
2124 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
2125 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
2126 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
2127 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
2128 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
2129 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
2130 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
2131 .part_trail = 0x00,
2132 .soft_ver = SOFT_VER_DEFAULT,
2133
2134 /**
2135 576KB were moved from file-system to os-image
2136 in comparison to the stock image
2137 */
2138 .partitions = {
2139 {"fs-uboot", 0x00000, 0x20000},
2140 {"firmware", 0x20000, 0x390000},
2141 {"partition-table", 0x3b0000, 0x02000},
2142 {"default-mac", 0x3c0000, 0x00020},
2143 {"pin", 0x3c0100, 0x00020},
2144 {"product-info", 0x3c1000, 0x01000},
2145 {"soft-version", 0x3c2000, 0x00100},
2146 {"support-list", 0x3c3000, 0x01000},
2147 {"profile", 0x3c4000, 0x08000},
2148 {"user-config", 0x3d0000, 0x10000},
2149 {"default-config", 0x3e0000, 0x10000},
2150 {"radio", 0x3f0000, 0x10000},
2151 {NULL, 0, 0}
2152 },
2153
2154 .first_sysupgrade_partition = "os-image",
2155 .last_sysupgrade_partition = "file-system"
2156 },
2157
2158 /** Firmware layout for the TL-WA855RE v1 */
2159 {
2160 .id = "TLWA855REV1",
2161 .vendor = "",
2162 .support_list =
2163 "SupportList:\n"
2164 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
2165 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
2166 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
2167 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
2168 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
2169 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
2170 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
2171 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
2172 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
2173 .part_trail = 0x00,
2174 .soft_ver = SOFT_VER_DEFAULT,
2175
2176 .partitions = {
2177 {"fs-uboot", 0x00000, 0x20000},
2178 {"os-image", 0x20000, 0x150000},
2179 {"file-system", 0x170000, 0x240000},
2180 {"partition-table", 0x3b0000, 0x02000},
2181 {"default-mac", 0x3c0000, 0x00020},
2182 {"pin", 0x3c0100, 0x00020},
2183 {"product-info", 0x3c1000, 0x01000},
2184 {"soft-version", 0x3c2000, 0x00100},
2185 {"support-list", 0x3c3000, 0x01000},
2186 {"profile", 0x3c4000, 0x08000},
2187 {"user-config", 0x3d0000, 0x10000},
2188 {"default-config", 0x3e0000, 0x10000},
2189 {"radio", 0x3f0000, 0x10000},
2190 {NULL, 0, 0}
2191 },
2192
2193 .first_sysupgrade_partition = "os-image",
2194 .last_sysupgrade_partition = "file-system"
2195 },
2196
2197 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
2198 {
2199 .id = "TL-WPA8630P-V2.0-EU",
2200 .vendor = "",
2201 .support_list =
2202 "SupportList:\n"
2203 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
2204 .part_trail = 0x00,
2205 .soft_ver = SOFT_VER_DEFAULT,
2206
2207 .partitions = {
2208 {"factory-uboot", 0x00000, 0x20000},
2209 {"fs-uboot", 0x20000, 0x20000},
2210 {"firmware", 0x40000, 0x5e0000},
2211 {"partition-table", 0x620000, 0x02000},
2212 {"default-mac", 0x630000, 0x00020},
2213 {"pin", 0x630100, 0x00020},
2214 {"device-id", 0x630200, 0x00030},
2215 {"product-info", 0x631100, 0x01000},
2216 {"extra-para", 0x632100, 0x01000},
2217 {"soft-version", 0x640000, 0x01000},
2218 {"support-list", 0x641000, 0x01000},
2219 {"profile", 0x642000, 0x08000},
2220 {"user-config", 0x650000, 0x10000},
2221 {"default-config", 0x660000, 0x10000},
2222 {"default-nvm", 0x670000, 0xc0000},
2223 {"default-pib", 0x730000, 0x40000},
2224 {"radio", 0x7f0000, 0x10000},
2225 {NULL, 0, 0}
2226 },
2227
2228 .first_sysupgrade_partition = "os-image",
2229 .last_sysupgrade_partition = "file-system"
2230 },
2231
2232 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
2233 {
2234 .id = "TL-WPA8630P-V2-INT",
2235 .vendor = "",
2236 .support_list =
2237 "SupportList:\n"
2238 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
2239 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
2240 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
2241 .part_trail = 0x00,
2242 .soft_ver = SOFT_VER_DEFAULT,
2243
2244 .partitions = {
2245 {"factory-uboot", 0x00000, 0x20000},
2246 {"fs-uboot", 0x20000, 0x20000},
2247 {"firmware", 0x40000, 0x5e0000},
2248 {"partition-table", 0x620000, 0x02000},
2249 {"extra-para", 0x632100, 0x01000},
2250 {"soft-version", 0x640000, 0x01000},
2251 {"support-list", 0x641000, 0x01000},
2252 {"profile", 0x642000, 0x08000},
2253 {"user-config", 0x650000, 0x10000},
2254 {"default-config", 0x660000, 0x10000},
2255 {"default-nvm", 0x670000, 0xc0000},
2256 {"default-pib", 0x730000, 0x40000},
2257 {"default-mac", 0x7e0000, 0x00020},
2258 {"pin", 0x7e0100, 0x00020},
2259 {"device-id", 0x7e0200, 0x00030},
2260 {"product-info", 0x7e1100, 0x01000},
2261 {"radio", 0x7f0000, 0x10000},
2262 {NULL, 0, 0}
2263 },
2264
2265 .first_sysupgrade_partition = "os-image",
2266 .last_sysupgrade_partition = "file-system"
2267 },
2268
2269 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
2270 {
2271 .id = "TL-WPA8630P-V2.1-EU",
2272 .vendor = "",
2273 .support_list =
2274 "SupportList:\n"
2275 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
2276 .part_trail = 0x00,
2277 .soft_ver = SOFT_VER_DEFAULT,
2278
2279 .partitions = {
2280 {"factory-uboot", 0x00000, 0x20000},
2281 {"fs-uboot", 0x20000, 0x20000},
2282 {"firmware", 0x40000, 0x5e0000},
2283 {"extra-para", 0x680000, 0x01000},
2284 {"product-info", 0x690000, 0x01000},
2285 {"partition-table", 0x6a0000, 0x02000},
2286 {"soft-version", 0x6b0000, 0x01000},
2287 {"support-list", 0x6b1000, 0x01000},
2288 {"profile", 0x6b2000, 0x08000},
2289 {"user-config", 0x6c0000, 0x10000},
2290 {"default-config", 0x6d0000, 0x10000},
2291 {"default-nvm", 0x6e0000, 0xc0000},
2292 {"default-pib", 0x7a0000, 0x40000},
2293 {"default-mac", 0x7e0000, 0x00020},
2294 {"pin", 0x7e0100, 0x00020},
2295 {"device-id", 0x7e0200, 0x00030},
2296 {"radio", 0x7f0000, 0x10000},
2297 {NULL, 0, 0}
2298 },
2299
2300 .first_sysupgrade_partition = "os-image",
2301 .last_sysupgrade_partition = "file-system"
2302 },
2303
2304 /** Firmware layout for the TL-WPA8631P v3 */
2305 {
2306 .id = "TL-WPA8631P-V3",
2307 .vendor = "",
2308 .support_list =
2309 "SupportList:\n"
2310 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:41550000}\n"
2311 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:45550000}\n"
2312 "{product_name:TL-WPA8631P,product_ver:3.0.0,special_id:55530000}\n",
2313 .part_trail = 0x00,
2314 .soft_ver = SOFT_VER_DEFAULT,
2315
2316 .partitions = {
2317 {"fs-uboot", 0x00000, 0x20000},
2318 {"firmware", 0x20000, 0x710000},
2319 {"partition-table", 0x730000, 0x02000},
2320 {"default-mac", 0x732000, 0x00020},
2321 {"pin", 0x732100, 0x00020},
2322 {"device-id", 0x732200, 0x00030},
2323 {"default-region", 0x732300, 0x00010},
2324 {"product-info", 0x732400, 0x00200},
2325 {"extra-para", 0x732600, 0x00200},
2326 {"soft-version", 0x732800, 0x00200},
2327 {"support-list", 0x732a00, 0x00100},
2328 {"profile", 0x732b00, 0x00100},
2329 {"default-config", 0x732c00, 0x00800},
2330 {"plc-type", 0x733400, 0x00020},
2331 {"default-pib", 0x733500, 0x06000},
2332 {"user-config", 0x740000, 0x10000},
2333 {"plc-pib", 0x750000, 0x10000},
2334 {"plc-nvm", 0x760000, 0x90000},
2335 {"radio", 0x7f0000, 0x10000},
2336 {NULL, 0, 0}
2337 },
2338
2339 .first_sysupgrade_partition = "os-image",
2340 .last_sysupgrade_partition = "file-system"
2341 },
2342
2343 /** Firmware layout for the TL-WR1043 v5 */
2344 {
2345 .id = "TLWR1043NV5",
2346 .vendor = "",
2347 .support_list =
2348 "SupportList:\n"
2349 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
2350 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
2351 .part_trail = 0x00,
2352 .soft_ver = SOFT_VER_TEXT("soft_ver:1.0.0\n"),
2353 .partitions = {
2354 {"factory-boot", 0x00000, 0x20000},
2355 {"fs-uboot", 0x20000, 0x20000},
2356 {"firmware", 0x40000, 0xec0000},
2357 {"default-mac", 0xf00000, 0x00200},
2358 {"pin", 0xf00200, 0x00200},
2359 {"device-id", 0xf00400, 0x00100},
2360 {"product-info", 0xf00500, 0x0fb00},
2361 {"soft-version", 0xf10000, 0x01000},
2362 {"extra-para", 0xf11000, 0x01000},
2363 {"support-list", 0xf12000, 0x0a000},
2364 {"profile", 0xf1c000, 0x04000},
2365 {"default-config", 0xf20000, 0x10000},
2366 {"user-config", 0xf30000, 0x40000},
2367 {"qos-db", 0xf70000, 0x40000},
2368 {"certificate", 0xfb0000, 0x10000},
2369 {"partition-table", 0xfc0000, 0x10000},
2370 {"log", 0xfd0000, 0x20000},
2371 {"radio", 0xff0000, 0x10000},
2372 {NULL, 0, 0}
2373 },
2374 .first_sysupgrade_partition = "os-image",
2375 .last_sysupgrade_partition = "file-system"
2376 },
2377
2378 /** Firmware layout for the TL-WR1043 v4 */
2379 {
2380 .id = "TLWR1043NDV4",
2381 .vendor = "",
2382 .support_list =
2383 "SupportList:\n"
2384 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
2385 .part_trail = 0x00,
2386 .soft_ver = SOFT_VER_DEFAULT,
2387
2388 /* We're using a dynamic kernel/rootfs split here */
2389 .partitions = {
2390 {"fs-uboot", 0x00000, 0x20000},
2391 {"firmware", 0x20000, 0xf30000},
2392 {"default-mac", 0xf50000, 0x00200},
2393 {"pin", 0xf50200, 0x00200},
2394 {"product-info", 0xf50400, 0x0fc00},
2395 {"soft-version", 0xf60000, 0x0b000},
2396 {"support-list", 0xf6b000, 0x04000},
2397 {"profile", 0xf70000, 0x04000},
2398 {"default-config", 0xf74000, 0x0b000},
2399 {"user-config", 0xf80000, 0x40000},
2400 {"partition-table", 0xfc0000, 0x10000},
2401 {"log", 0xfd0000, 0x20000},
2402 {"radio", 0xff0000, 0x10000},
2403 {NULL, 0, 0}
2404 },
2405
2406 .first_sysupgrade_partition = "os-image",
2407 .last_sysupgrade_partition = "file-system"
2408 },
2409
2410 /** Firmware layout for the TL-WR902AC v1 */
2411 {
2412 .id = "TL-WR902AC-V1",
2413 .vendor = "",
2414 .support_list =
2415 "SupportList:\n"
2416 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
2417 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
2418 .part_trail = 0x00,
2419 .soft_ver = SOFT_VER_DEFAULT,
2420
2421 /**
2422 384KB were moved from file-system to os-image
2423 in comparison to the stock image
2424 */
2425 .partitions = {
2426 {"fs-uboot", 0x00000, 0x20000},
2427 {"firmware", 0x20000, 0x730000},
2428 {"default-mac", 0x750000, 0x00200},
2429 {"pin", 0x750200, 0x00200},
2430 {"product-info", 0x750400, 0x0fc00},
2431 {"soft-version", 0x760000, 0x0b000},
2432 {"support-list", 0x76b000, 0x04000},
2433 {"profile", 0x770000, 0x04000},
2434 {"default-config", 0x774000, 0x0b000},
2435 {"user-config", 0x780000, 0x40000},
2436 {"partition-table", 0x7c0000, 0x10000},
2437 {"log", 0x7d0000, 0x20000},
2438 {"radio", 0x7f0000, 0x10000},
2439 {NULL, 0, 0}
2440 },
2441
2442 .first_sysupgrade_partition = "os-image",
2443 .last_sysupgrade_partition = "file-system",
2444 },
2445
2446 /** Firmware layout for the TL-WR941HP v1 */
2447 {
2448 .id = "TL-WR941HP-V1",
2449 .vendor = "",
2450 .support_list =
2451 "SupportList:\n"
2452 "{product_name:TL-WR941HP,product_ver:1.0.0,special_id:00000000}\n",
2453 .part_trail = 0x00,
2454 .soft_ver = SOFT_VER_DEFAULT,
2455
2456 .partitions = {
2457 {"fs-uboot", 0x00000, 0x20000},
2458 {"firmware", 0x20000, 0x730000},
2459 {"default-mac", 0x750000, 0x00200},
2460 {"pin", 0x750200, 0x00200},
2461 {"product-info", 0x750400, 0x0fc00},
2462 {"soft-version", 0x760000, 0x0b000},
2463 {"support-list", 0x76b000, 0x04000},
2464 {"profile", 0x770000, 0x04000},
2465 {"default-config", 0x774000, 0x0b000},
2466 {"user-config", 0x780000, 0x40000},
2467 {"partition-table", 0x7c0000, 0x10000},
2468 {"log", 0x7d0000, 0x20000},
2469 {"radio", 0x7f0000, 0x10000},
2470 {NULL, 0, 0}
2471 },
2472
2473 .first_sysupgrade_partition = "os-image",
2474 .last_sysupgrade_partition = "file-system",
2475 },
2476
2477 /** Firmware layout for the TL-WR942N V1 */
2478 {
2479 .id = "TLWR942NV1",
2480 .vendor = "",
2481 .support_list =
2482 "SupportList:\r\n"
2483 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
2484 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
2485 .part_trail = 0x00,
2486 .soft_ver = SOFT_VER_DEFAULT,
2487
2488 .partitions = {
2489 {"fs-uboot", 0x00000, 0x20000},
2490 {"firmware", 0x20000, 0xe20000},
2491 {"default-mac", 0xe40000, 0x00200},
2492 {"pin", 0xe40200, 0x00200},
2493 {"product-info", 0xe40400, 0x0fc00},
2494 {"partition-table", 0xe50000, 0x10000},
2495 {"soft-version", 0xe60000, 0x10000},
2496 {"support-list", 0xe70000, 0x10000},
2497 {"profile", 0xe80000, 0x10000},
2498 {"default-config", 0xe90000, 0x10000},
2499 {"user-config", 0xea0000, 0x40000},
2500 {"qos-db", 0xee0000, 0x40000},
2501 {"certificate", 0xf20000, 0x10000},
2502 {"usb-config", 0xfb0000, 0x10000},
2503 {"log", 0xfc0000, 0x20000},
2504 {"radio-bk", 0xfe0000, 0x10000},
2505 {"radio", 0xff0000, 0x10000},
2506 {NULL, 0, 0}
2507 },
2508
2509 .first_sysupgrade_partition = "os-image",
2510 .last_sysupgrade_partition = "file-system",
2511 },
2512
2513 /** Firmware layout for the RE200 v2 */
2514 {
2515 .id = "RE200-V2",
2516 .vendor = "",
2517 .support_list =
2518 "SupportList:\n"
2519 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
2520 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
2521 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
2522 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
2523 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
2524 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
2525 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
2526 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
2527 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
2528 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
2529 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
2530 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
2531 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
2532 .part_trail = 0x00,
2533 .soft_ver = SOFT_VER_DEFAULT,
2534
2535 .partitions = {
2536 {"fs-uboot", 0x00000, 0x20000},
2537 {"firmware", 0x20000, 0x7a0000},
2538 {"partition-table", 0x7c0000, 0x02000},
2539 {"default-mac", 0x7c2000, 0x00020},
2540 {"pin", 0x7c2100, 0x00020},
2541 {"product-info", 0x7c3100, 0x01000},
2542 {"soft-version", 0x7c4200, 0x01000},
2543 {"support-list", 0x7c5200, 0x01000},
2544 {"profile", 0x7c6200, 0x08000},
2545 {"config-info", 0x7ce200, 0x00400},
2546 {"user-config", 0x7d0000, 0x10000},
2547 {"default-config", 0x7e0000, 0x10000},
2548 {"radio", 0x7f0000, 0x10000},
2549 {NULL, 0, 0}
2550 },
2551
2552 .first_sysupgrade_partition = "os-image",
2553 .last_sysupgrade_partition = "file-system"
2554 },
2555
2556 /** Firmware layout for the RE200 v3 */
2557 {
2558 .id = "RE200-V3",
2559 .vendor = "",
2560 .support_list =
2561 "SupportList:\n"
2562 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
2563 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
2564 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
2565 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
2566 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
2567 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
2568 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
2569 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
2570 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
2571 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
2572 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
2573 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
2574 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
2575 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
2576 .part_trail = 0x00,
2577 .soft_ver = SOFT_VER_DEFAULT,
2578
2579 .partitions = {
2580 {"fs-uboot", 0x00000, 0x20000},
2581 {"firmware", 0x20000, 0x7a0000},
2582 {"partition-table", 0x7c0000, 0x02000},
2583 {"default-mac", 0x7c2000, 0x00020},
2584 {"pin", 0x7c2100, 0x00020},
2585 {"product-info", 0x7c3100, 0x01000},
2586 {"soft-version", 0x7c4200, 0x01000},
2587 {"support-list", 0x7c5200, 0x01000},
2588 {"profile", 0x7c6200, 0x08000},
2589 {"config-info", 0x7ce200, 0x00400},
2590 {"user-config", 0x7d0000, 0x10000},
2591 {"default-config", 0x7e0000, 0x10000},
2592 {"radio", 0x7f0000, 0x10000},
2593 {NULL, 0, 0}
2594 },
2595
2596 .first_sysupgrade_partition = "os-image",
2597 .last_sysupgrade_partition = "file-system"
2598 },
2599
2600 /** Firmware layout for the RE200 v4 */
2601 {
2602 .id = "RE200-V4",
2603 .vendor = "",
2604 .support_list =
2605 "SupportList:\n"
2606 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
2607 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
2608 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
2609 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
2610 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
2611 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
2612 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
2613 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
2614 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
2615 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
2616 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
2617 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
2618 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
2619 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
2620 .part_trail = 0x00,
2621 .soft_ver = SOFT_VER_TEXT("soft_ver:1.1.0\n"),
2622
2623 .partitions = {
2624 {"fs-uboot", 0x00000, 0x20000},
2625 {"firmware", 0x20000, 0x7a0000},
2626 {"partition-table", 0x7c0000, 0x02000},
2627 {"default-mac", 0x7c2000, 0x00020},
2628 {"pin", 0x7c2100, 0x00020},
2629 {"product-info", 0x7c3100, 0x01000},
2630 {"soft-version", 0x7c4200, 0x01000},
2631 {"support-list", 0x7c5200, 0x01000},
2632 {"profile", 0x7c6200, 0x08000},
2633 {"config-info", 0x7ce200, 0x00400},
2634 {"user-config", 0x7d0000, 0x10000},
2635 {"default-config", 0x7e0000, 0x10000},
2636 {"radio", 0x7f0000, 0x10000},
2637 {NULL, 0, 0}
2638 },
2639
2640 .first_sysupgrade_partition = "os-image",
2641 .last_sysupgrade_partition = "file-system"
2642 },
2643
2644 /** Firmware layout for the RE220 v2 */
2645 {
2646 .id = "RE220-V2",
2647 .vendor = "",
2648 .support_list =
2649 "SupportList:\n"
2650 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
2651 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
2652 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
2653 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
2654 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
2655 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
2656 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
2657 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
2658 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
2659 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
2660 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
2661 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
2662 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
2663 .part_trail = 0x00,
2664 .soft_ver = SOFT_VER_DEFAULT,
2665
2666 .partitions = {
2667 {"fs-uboot", 0x00000, 0x20000},
2668 {"firmware", 0x20000, 0x7a0000},
2669 {"partition-table", 0x7c0000, 0x02000},
2670 {"default-mac", 0x7c2000, 0x00020},
2671 {"pin", 0x7c2100, 0x00020},
2672 {"product-info", 0x7c3100, 0x01000},
2673 {"soft-version", 0x7c4200, 0x01000},
2674 {"support-list", 0x7c5200, 0x01000},
2675 {"profile", 0x7c6200, 0x08000},
2676 {"config-info", 0x7ce200, 0x00400},
2677 {"user-config", 0x7d0000, 0x10000},
2678 {"default-config", 0x7e0000, 0x10000},
2679 {"radio", 0x7f0000, 0x10000},
2680 {NULL, 0, 0}
2681 },
2682
2683 .first_sysupgrade_partition = "os-image",
2684 .last_sysupgrade_partition = "file-system"
2685 },
2686
2687 /** Firmware layout for the RE305 v1 */
2688 {
2689 .id = "RE305-V1",
2690 .vendor = "",
2691 .support_list =
2692 "SupportList:\n"
2693 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2694 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2695 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2696 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2697 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2698 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2699 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2700 .part_trail = 0x00,
2701 .soft_ver = SOFT_VER_DEFAULT,
2702
2703 .partitions = {
2704 {"fs-uboot", 0x00000, 0x20000},
2705 {"firmware", 0x20000, 0x5e0000},
2706 {"partition-table", 0x600000, 0x02000},
2707 {"default-mac", 0x610000, 0x00020},
2708 {"pin", 0x610100, 0x00020},
2709 {"product-info", 0x611100, 0x01000},
2710 {"soft-version", 0x620000, 0x01000},
2711 {"support-list", 0x621000, 0x01000},
2712 {"profile", 0x622000, 0x08000},
2713 {"user-config", 0x630000, 0x10000},
2714 {"default-config", 0x640000, 0x10000},
2715 {"radio", 0x7f0000, 0x10000},
2716 {NULL, 0, 0}
2717 },
2718
2719 .first_sysupgrade_partition = "os-image",
2720 .last_sysupgrade_partition = "file-system"
2721 },
2722
2723 /** Firmware layout for the RE305 v3 */
2724 {
2725 .id = "RE305-V3",
2726 .vendor = "",
2727 .support_list =
2728 "SupportList:\n"
2729 "{product_name:RE305,product_ver:3.0.0,special_id:00000000}\n"
2730 "{product_name:RE305,product_ver:3.0.0,special_id:45550000}\n"
2731 "{product_name:RE305,product_ver:3.0.0,special_id:4A500000}\n"
2732 "{product_name:RE305,product_ver:3.0.0,special_id:4B520000}\n"
2733 "{product_name:RE305,product_ver:3.0.0,special_id:41550000}\n"
2734 "{product_name:RE305,product_ver:3.0.0,special_id:42520000}\n"
2735 "{product_name:RE305,product_ver:3.0.0,special_id:55530000}\n"
2736 "{product_name:RE305,product_ver:3.0.0,special_id:45530000}\n"
2737 "{product_name:RE305,product_ver:3.0.0,special_id:41530000}\n"
2738 "{product_name:RE305,product_ver:3.0.0,special_id:43410000}\n"
2739 "{product_name:RE305,product_ver:3.0.0,special_id:52550000}\n",
2740 .part_trail = 0x00,
2741 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
2742
2743 .partitions = {
2744 {"fs-uboot", 0x00000, 0x20000},
2745 {"firmware", 0x20000, 0x7a0000},
2746 {"partition-table", 0x7c0000, 0x02000},
2747 {"default-mac", 0x7c2000, 0x00020},
2748 {"pin", 0x7c2100, 0x00020},
2749 {"product-info", 0x7c3100, 0x01000},
2750 {"soft-version", 0x7c4200, 0x01000},
2751 {"support-list", 0x7c5200, 0x01000},
2752 {"profile", 0x7c6200, 0x08000},
2753 {"config-info", 0x7ce200, 0x00400},
2754 {"user-config", 0x7d0000, 0x10000},
2755 {"default-config", 0x7e0000, 0x10000},
2756 {"radio", 0x7f0000, 0x10000},
2757 {NULL, 0, 0}
2758 },
2759
2760 .first_sysupgrade_partition = "os-image",
2761 .last_sysupgrade_partition = "file-system"
2762 },
2763
2764 /** Firmware layout for the RE350 v1 */
2765 {
2766 .id = "RE350-V1",
2767 .vendor = "",
2768 .support_list =
2769 "SupportList:\n"
2770 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2771 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2772 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2773 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2774 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2775 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2776 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2777 .part_trail = 0x00,
2778 .soft_ver = SOFT_VER_DEFAULT,
2779
2780 /** We're using a dynamic kernel/rootfs split here */
2781 .partitions = {
2782 {"fs-uboot", 0x00000, 0x20000},
2783 {"firmware", 0x20000, 0x5e0000},
2784 {"partition-table", 0x600000, 0x02000},
2785 {"default-mac", 0x610000, 0x00020},
2786 {"pin", 0x610100, 0x00020},
2787 {"product-info", 0x611100, 0x01000},
2788 {"soft-version", 0x620000, 0x01000},
2789 {"support-list", 0x621000, 0x01000},
2790 {"profile", 0x622000, 0x08000},
2791 {"user-config", 0x630000, 0x10000},
2792 {"default-config", 0x640000, 0x10000},
2793 {"radio", 0x7f0000, 0x10000},
2794 {NULL, 0, 0}
2795 },
2796
2797 .first_sysupgrade_partition = "os-image",
2798 .last_sysupgrade_partition = "file-system"
2799 },
2800
2801 /** Firmware layout for the RE350K v1 */
2802 {
2803 .id = "RE350K-V1",
2804 .vendor = "",
2805 .support_list =
2806 "SupportList:\n"
2807 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2808 .part_trail = 0x00,
2809 .soft_ver = SOFT_VER_DEFAULT,
2810
2811 /** We're using a dynamic kernel/rootfs split here */
2812 .partitions = {
2813 {"fs-uboot", 0x00000, 0x20000},
2814 {"firmware", 0x20000, 0xd70000},
2815 {"partition-table", 0xd90000, 0x02000},
2816 {"default-mac", 0xda0000, 0x00020},
2817 {"pin", 0xda0100, 0x00020},
2818 {"product-info", 0xda1100, 0x01000},
2819 {"soft-version", 0xdb0000, 0x01000},
2820 {"support-list", 0xdb1000, 0x01000},
2821 {"profile", 0xdb2000, 0x08000},
2822 {"user-config", 0xdc0000, 0x10000},
2823 {"default-config", 0xdd0000, 0x10000},
2824 {"device-id", 0xde0000, 0x00108},
2825 {"radio", 0xff0000, 0x10000},
2826 {NULL, 0, 0}
2827 },
2828
2829 .first_sysupgrade_partition = "os-image",
2830 .last_sysupgrade_partition = "file-system"
2831 },
2832
2833 /** Firmware layout for the RE355 */
2834 {
2835 .id = "RE355",
2836 .vendor = "",
2837 .support_list =
2838 "SupportList:\r\n"
2839 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2840 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2841 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2842 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2843 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2844 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2845 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2846 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2847 .part_trail = 0x00,
2848 .soft_ver = SOFT_VER_DEFAULT,
2849
2850 /* We're using a dynamic kernel/rootfs split here */
2851 .partitions = {
2852 {"fs-uboot", 0x00000, 0x20000},
2853 {"firmware", 0x20000, 0x5e0000},
2854 {"partition-table", 0x600000, 0x02000},
2855 {"default-mac", 0x610000, 0x00020},
2856 {"pin", 0x610100, 0x00020},
2857 {"product-info", 0x611100, 0x01000},
2858 {"soft-version", 0x620000, 0x01000},
2859 {"support-list", 0x621000, 0x01000},
2860 {"profile", 0x622000, 0x08000},
2861 {"user-config", 0x630000, 0x10000},
2862 {"default-config", 0x640000, 0x10000},
2863 {"radio", 0x7f0000, 0x10000},
2864 {NULL, 0, 0}
2865 },
2866
2867 .first_sysupgrade_partition = "os-image",
2868 .last_sysupgrade_partition = "file-system"
2869 },
2870
2871 /** Firmware layout for the RE450 */
2872 {
2873 .id = "RE450",
2874 .vendor = "",
2875 .support_list =
2876 "SupportList:\r\n"
2877 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2878 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2879 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2880 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2881 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2882 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2883 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2884 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2885 .part_trail = 0x00,
2886 .soft_ver = SOFT_VER_DEFAULT,
2887
2888 /** We're using a dynamic kernel/rootfs split here */
2889 .partitions = {
2890 {"fs-uboot", 0x00000, 0x20000},
2891 {"firmware", 0x20000, 0x5e0000},
2892 {"partition-table", 0x600000, 0x02000},
2893 {"default-mac", 0x610000, 0x00020},
2894 {"pin", 0x610100, 0x00020},
2895 {"product-info", 0x611100, 0x01000},
2896 {"soft-version", 0x620000, 0x01000},
2897 {"support-list", 0x621000, 0x01000},
2898 {"profile", 0x622000, 0x08000},
2899 {"user-config", 0x630000, 0x10000},
2900 {"default-config", 0x640000, 0x10000},
2901 {"radio", 0x7f0000, 0x10000},
2902 {NULL, 0, 0}
2903 },
2904
2905 .first_sysupgrade_partition = "os-image",
2906 .last_sysupgrade_partition = "file-system"
2907 },
2908
2909 /** Firmware layout for the RE450 v2 */
2910 {
2911 .id = "RE450-V2",
2912 .vendor = "",
2913 .support_list =
2914 "SupportList:\r\n"
2915 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2916 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2917 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2918 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2919 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2920 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2921 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2922 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2923 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2924 .part_trail = 0x00,
2925 .soft_ver = SOFT_VER_DEFAULT,
2926
2927 /* We're using a dynamic kernel/rootfs split here */
2928 .partitions = {
2929 {"fs-uboot", 0x00000, 0x20000},
2930 {"firmware", 0x20000, 0x5e0000},
2931 {"partition-table", 0x600000, 0x02000},
2932 {"default-mac", 0x610000, 0x00020},
2933 {"pin", 0x610100, 0x00020},
2934 {"product-info", 0x611100, 0x01000},
2935 {"soft-version", 0x620000, 0x01000},
2936 {"support-list", 0x621000, 0x01000},
2937 {"profile", 0x622000, 0x08000},
2938 {"user-config", 0x630000, 0x10000},
2939 {"default-config", 0x640000, 0x10000},
2940 {"radio", 0x7f0000, 0x10000},
2941 {NULL, 0, 0}
2942 },
2943
2944 .first_sysupgrade_partition = "os-image",
2945 .last_sysupgrade_partition = "file-system"
2946 },
2947
2948 /** Firmware layout for the RE450 v3 */
2949 {
2950 .id = "RE450-V3",
2951 .vendor = "",
2952 .support_list =
2953 "SupportList:\r\n"
2954 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2955 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2956 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2957 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2958 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2959 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2960 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2961 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2962 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2963 .part_trail = 0x00,
2964 .soft_ver = SOFT_VER_DEFAULT,
2965
2966 /* We're using a dynamic kernel/rootfs split here */
2967 .partitions = {
2968 {"fs-uboot", 0x00000, 0x20000},
2969 {"default-mac", 0x20000, 0x00020},
2970 {"pin", 0x20020, 0x00020},
2971 {"product-info", 0x21000, 0x01000},
2972 {"partition-table", 0x22000, 0x02000},
2973 {"soft-version", 0x24000, 0x01000},
2974 {"support-list", 0x25000, 0x01000},
2975 {"profile", 0x26000, 0x08000},
2976 {"user-config", 0x2e000, 0x10000},
2977 {"default-config", 0x3e000, 0x10000},
2978 {"config-info", 0x4e000, 0x00400},
2979 {"firmware", 0x50000, 0x7a0000},
2980 {"radio", 0x7f0000, 0x10000},
2981 {NULL, 0, 0}
2982 },
2983
2984 .first_sysupgrade_partition = "os-image",
2985 .last_sysupgrade_partition = "file-system"
2986 },
2987
2988 /** Firmware layout for the RE455 v1 */
2989 {
2990 .id = "RE455-V1",
2991 .vendor = "",
2992 .support_list =
2993 "SupportList:\r\n"
2994 "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n"
2995 "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n"
2996 "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n"
2997 "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n"
2998 "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n"
2999 "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n"
3000 "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n"
3001 "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n"
3002 "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n",
3003 .part_trail = 0x00,
3004 .soft_ver = SOFT_VER_DEFAULT,
3005
3006 /* We're using a dynamic kernel/rootfs split here */
3007 .partitions = {
3008 {"fs-uboot", 0x00000, 0x20000},
3009 {"default-mac", 0x20000, 0x00020},
3010 {"pin", 0x20020, 0x00020},
3011 {"product-info", 0x21000, 0x01000},
3012 {"partition-table", 0x22000, 0x02000},
3013 {"soft-version", 0x24000, 0x01000},
3014 {"support-list", 0x25000, 0x01000},
3015 {"profile", 0x26000, 0x08000},
3016 {"user-config", 0x2e000, 0x10000},
3017 {"default-config", 0x3e000, 0x10000},
3018 {"config-info", 0x4e000, 0x00400},
3019 {"firmware", 0x50000, 0x7a0000},
3020 {"radio", 0x7f0000, 0x10000},
3021 {NULL, 0, 0}
3022 },
3023
3024 .first_sysupgrade_partition = "os-image",
3025 .last_sysupgrade_partition = "file-system"
3026 },
3027
3028 /** Firmware layout for the RE500 */
3029 {
3030 .id = "RE500-V1",
3031 .vendor = "",
3032 .support_list =
3033 "SupportList:\r\n"
3034 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
3035 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
3036 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
3037 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
3038 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
3039 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
3040 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
3041 .part_trail = 0x00,
3042 .soft_ver = SOFT_VER_DEFAULT,
3043
3044 /* We're using a dynamic kernel/rootfs split here */
3045 .partitions = {
3046 {"fs-uboot", 0x00000, 0x20000},
3047 {"firmware", 0x20000, 0xde0000},
3048 {"partition-table", 0xe00000, 0x02000},
3049 {"default-mac", 0xe10000, 0x00020},
3050 {"pin", 0xe10100, 0x00020},
3051 {"product-info", 0xe11100, 0x01000},
3052 {"soft-version", 0xe20000, 0x01000},
3053 {"support-list", 0xe21000, 0x01000},
3054 {"profile", 0xe22000, 0x08000},
3055 {"user-config", 0xe30000, 0x10000},
3056 {"default-config", 0xe40000, 0x10000},
3057 {"radio", 0xff0000, 0x10000},
3058 {NULL, 0, 0}
3059 },
3060
3061 .first_sysupgrade_partition = "os-image",
3062 .last_sysupgrade_partition = "file-system"
3063 },
3064
3065 /** Firmware layout for the RE650 */
3066 {
3067 .id = "RE650-V1",
3068 .vendor = "",
3069 .support_list =
3070 "SupportList:\r\n"
3071 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
3072 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
3073 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
3074 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
3075 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
3076 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
3077 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
3078 .part_trail = 0x00,
3079 .soft_ver = SOFT_VER_DEFAULT,
3080
3081 /* We're using a dynamic kernel/rootfs split here */
3082 .partitions = {
3083 {"fs-uboot", 0x00000, 0x20000},
3084 {"firmware", 0x20000, 0xde0000},
3085 {"partition-table", 0xe00000, 0x02000},
3086 {"default-mac", 0xe10000, 0x00020},
3087 {"pin", 0xe10100, 0x00020},
3088 {"product-info", 0xe11100, 0x01000},
3089 {"soft-version", 0xe20000, 0x01000},
3090 {"support-list", 0xe21000, 0x01000},
3091 {"profile", 0xe22000, 0x08000},
3092 {"user-config", 0xe30000, 0x10000},
3093 {"default-config", 0xe40000, 0x10000},
3094 {"radio", 0xff0000, 0x10000},
3095 {NULL, 0, 0}
3096 },
3097
3098 .first_sysupgrade_partition = "os-image",
3099 .last_sysupgrade_partition = "file-system"
3100 },
3101 /** Firmware layout for the RE650 V2 (8MB Flash)*/
3102 {
3103 .id = "RE650-V2",
3104 .vendor = "",
3105 .support_list =
3106 "SupportList:\n"
3107 "{product_name:RE650,product_ver:2.0.0,special_id:00000000}\n"
3108 "{product_name:RE650,product_ver:2.0.0,special_id:45550000}\n"
3109 "{product_name:RE650,product_ver:2.0.0,special_id:4A500000}\n"
3110 "{product_name:RE650,product_ver:2.0.0,special_id:41550000}\n"
3111 "{product_name:RE650,product_ver:2.0.0,special_id:43410000}\n"
3112 "{product_name:RE650,product_ver:2.0.0,special_id:41530000}\n"
3113 "{product_name:RE650,product_ver:2.0.0,special_id:55530000}\n",
3114 .part_trail = 0x00,
3115 /* For RE650 v2, soft ver is required, otherwise OEM install doesn't work */
3116 .soft_ver = SOFT_VER_TEXT("soft_ver:2.0.0\n"),
3117
3118 /* We're using a dynamic kernel/rootfs split here */
3119 .partitions = {
3120 {"fs-uboot", 0x00000, 0x20000},
3121 {"firmware", 0x20000, 0x7a0000},
3122 {"partition-table", 0x7c0000, 0x02000},
3123 {"default-mac", 0x7c2000, 0x00020},
3124 {"pin", 0x7c2100, 0x00020},
3125 {"product-info", 0x7c3100, 0x01000},
3126 {"soft-version", 0x7c4200, 0x01000},
3127 {"support-list", 0x7c5200, 0x01000},
3128 {"profile", 0x7c6200, 0x08000},
3129 {"config-info", 0x7ce200, 0x00400},
3130 {"user-config", 0x7d0000, 0x10000},
3131 {"default-config", 0x7e0000, 0x10000},
3132 {"radio", 0x7f0000, 0x10000},
3133 {NULL, 0, 0}
3134 },
3135
3136 .first_sysupgrade_partition = "os-image",
3137 .last_sysupgrade_partition = "file-system"
3138 },
3139
3140 /** Firmware layout for the Mercusys MR70X */
3141 {
3142 .id = "MR70X",
3143 .vendor = "",
3144 .support_list =
3145 "SupportList:\n"
3146 "{product_name:MR70X,product_ver:1.0.0,special_id:45550000}\n"
3147 "{product_name:MR70X,product_ver:1.0.0,special_id:4A500000}\n"
3148 "{product_name:MR70X,product_ver:1.0.0,special_id:55530000}\n",
3149 .part_trail = 0x00,
3150 .soft_ver = SOFT_VER_DEFAULT,
3151
3152 .partitions = {
3153 {"fs-uboot", 0x00000, 0x40000},
3154 {"firmware", 0x40000, 0xf60000},
3155 {"default-mac", 0xfa0000, 0x00200},
3156 {"pin", 0xfa0200, 0x00100},
3157 {"device-id", 0xfa0300, 0x00100},
3158 {"product-info", 0xfa0400, 0x0fc00},
3159 {"default-config", 0xfb0000, 0x08000},
3160 {"ap-def-config", 0xfb8000, 0x08000},
3161 {"user-config", 0xfc0000, 0x0a000},
3162 {"ag-config", 0xfca000, 0x04000},
3163 {"certificate", 0xfce000, 0x02000},
3164 {"ap-config", 0xfd0000, 0x06000},
3165 {"router-config", 0xfd6000, 0x06000},
3166 {"favicon", 0xfdc000, 0x02000},
3167 {"logo", 0xfde000, 0x02000},
3168 {"partition-table", 0xfe0000, 0x00800},
3169 {"soft-version", 0xfe0800, 0x00100},
3170 {"support-list", 0xfe0900, 0x00200},
3171 {"profile", 0xfe0b00, 0x03000},
3172 {"extra-para", 0xfe3b00, 0x00100},
3173 {"radio", 0xff0000, 0x10000},
3174 {NULL, 0, 0}
3175 },
3176
3177 .first_sysupgrade_partition = "os-image",
3178 .last_sysupgrade_partition = "file-system"
3179 },
3180
3181 {}
3182 };
3183
3184 #define error(_ret, _errno, _str, ...) \
3185 do { \
3186 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
3187 strerror(_errno)); \
3188 if (_ret) \
3189 exit(_ret); \
3190 } while (0)
3191
3192
3193 /** Stores a uint32 as big endian */
3194 static inline void put32(uint8_t *buf, uint32_t val) {
3195 buf[0] = val >> 24;
3196 buf[1] = val >> 16;
3197 buf[2] = val >> 8;
3198 buf[3] = val;
3199 }
3200
3201 static inline bool meta_partition_should_pad(enum partition_trail_value pv)
3202 {
3203 return (pv >= 0) && (pv <= PART_TRAIL_MAX);
3204 }
3205
3206 /** Allocate a padded meta partition with a correctly initialised header
3207 * If the `data` pointer is NULL, then the required space is only allocated,
3208 * otherwise `data_len` bytes will be copied from `data` into the partition
3209 * entry. */
3210 static struct image_partition_entry init_meta_partition_entry(
3211 const char *name, const void *data, uint32_t data_len,
3212 enum partition_trail_value pad_value)
3213 {
3214 uint32_t total_len = sizeof(struct meta_header) + data_len;
3215 if (meta_partition_should_pad(pad_value))
3216 total_len += 1;
3217
3218 struct image_partition_entry entry = {
3219 .name = name,
3220 .size = total_len,
3221 .data = malloc(total_len)
3222 };
3223 if (!entry.data)
3224 error(1, errno, "failed to allocate meta partition entry");
3225
3226 struct meta_header *header = (struct meta_header *)entry.data;
3227 header->length = htonl(data_len);
3228 header->zero = 0;
3229
3230 if (data)
3231 memcpy(entry.data+sizeof(*header), data, data_len);
3232
3233 if (meta_partition_should_pad(pad_value))
3234 entry.data[total_len - 1] = (uint8_t) pad_value;
3235
3236 return entry;
3237 }
3238
3239 /** Allocates a new image partition */
3240 static struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
3241 struct image_partition_entry entry = {name, len, malloc(len)};
3242 if (!entry.data)
3243 error(1, errno, "malloc");
3244
3245 return entry;
3246 }
3247
3248 /** Sets up default partition names whenever custom names aren't specified */
3249 static void set_partition_names(struct device_info *info)
3250 {
3251 if (!info->partition_names.partition_table)
3252 info->partition_names.partition_table = "partition-table";
3253 if (!info->partition_names.soft_ver)
3254 info->partition_names.soft_ver = "soft-version";
3255 if (!info->partition_names.os_image)
3256 info->partition_names.os_image = "os-image";
3257 if (!info->partition_names.support_list)
3258 info->partition_names.support_list = "support-list";
3259 if (!info->partition_names.file_system)
3260 info->partition_names.file_system = "file-system";
3261 if (!info->partition_names.extra_para)
3262 info->partition_names.extra_para = "extra-para";
3263 }
3264
3265 /** Frees an image partition */
3266 static void free_image_partition(struct image_partition_entry *entry)
3267 {
3268 void *data = entry->data;
3269
3270 entry->name = NULL;
3271 entry->size = 0;
3272 entry->data = NULL;
3273
3274 free(data);
3275 }
3276
3277 static time_t source_date_epoch = -1;
3278 static void set_source_date_epoch() {
3279 char *env = getenv("SOURCE_DATE_EPOCH");
3280 char *endptr = env;
3281 errno = 0;
3282 if (env && *env) {
3283 source_date_epoch = strtoull(env, &endptr, 10);
3284 if (errno || (endptr && *endptr != '\0')) {
3285 fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
3286 exit(1);
3287 }
3288 }
3289 }
3290
3291 /** Generates the partition-table partition */
3292 static struct image_partition_entry make_partition_table(const struct device_info *p)
3293 {
3294 struct image_partition_entry entry = alloc_image_partition(p->partition_names.partition_table, SAFELOADER_PAYLOAD_TABLE_SIZE);
3295
3296 char *s = (char *)entry.data, *end = (char *)(s+entry.size);
3297
3298 *(s++) = 0x00;
3299 *(s++) = 0x04;
3300 *(s++) = 0x00;
3301 *(s++) = 0x00;
3302
3303 size_t i;
3304 for (i = 0; p->partitions[i].name; i++) {
3305 size_t len = end-s;
3306 size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n",
3307 p->partitions[i].name, p->partitions[i].base, p->partitions[i].size);
3308
3309 if (w > len-1)
3310 error(1, 0, "flash partition table overflow?");
3311
3312 s += w;
3313 }
3314
3315 s++;
3316
3317 memset(s, 0xff, end-s);
3318
3319 return entry;
3320 }
3321
3322
3323 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
3324 static inline uint8_t bcd(uint8_t v) {
3325 return 0x10 * (v/10) + v%10;
3326 }
3327
3328
3329 /** Generates the soft-version partition */
3330 static struct image_partition_entry make_soft_version(const struct device_info *info, uint32_t rev)
3331 {
3332 /** If an info string is provided, use this instead of
3333 * the structured data, and include the null-termination */
3334 if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) {
3335 uint32_t len = strlen(info->soft_ver.text) + 1;
3336 return init_meta_partition_entry(info->partition_names.soft_ver,
3337 info->soft_ver.text, len, info->part_trail);
3338 }
3339
3340 time_t t;
3341
3342 if (source_date_epoch != -1)
3343 t = source_date_epoch;
3344 else if (time(&t) == (time_t)(-1))
3345 error(1, errno, "time");
3346
3347 struct tm *tm = gmtime(&t);
3348
3349 struct soft_version s = {
3350 .pad1 = 0xff,
3351
3352 .version_major = info->soft_ver.num[0],
3353 .version_minor = info->soft_ver.num[1],
3354 .version_patch = info->soft_ver.num[2],
3355
3356 .year_hi = bcd((1900+tm->tm_year)/100),
3357 .year_lo = bcd(tm->tm_year%100),
3358 .month = bcd(tm->tm_mon+1),
3359 .day = bcd(tm->tm_mday),
3360 .rev = htonl(rev),
3361
3362 .compat_level = htonl(info->soft_ver_compat_level)
3363 };
3364
3365 if (info->soft_ver_compat_level == 0)
3366 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3367 (uint8_t *)(&s.compat_level) - (uint8_t *)(&s),
3368 info->part_trail);
3369 else
3370 return init_meta_partition_entry(info->partition_names.soft_ver, &s,
3371 sizeof(s), info->part_trail);
3372 }
3373
3374 /** Generates the support-list partition */
3375 static struct image_partition_entry make_support_list(
3376 const struct device_info *info)
3377 {
3378 uint32_t len = strlen(info->support_list);
3379 return init_meta_partition_entry(info->partition_names.support_list, info->support_list,
3380 len, info->part_trail);
3381 }
3382
3383 /** Partition with extra-para data */
3384 static struct image_partition_entry make_extra_para(
3385 const struct device_info *info, const uint8_t *extra_para, size_t len)
3386 {
3387 return init_meta_partition_entry(info->partition_names.extra_para, extra_para, len,
3388 info->part_trail);
3389 }
3390
3391 /** Creates a new image partition with an arbitrary name from a file */
3392 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) {
3393 struct stat statbuf;
3394
3395 if (stat(filename, &statbuf) < 0)
3396 error(1, errno, "unable to stat file `%s'", filename);
3397
3398 size_t len = statbuf.st_size;
3399
3400 if (add_jffs2_eof) {
3401 if (file_system_partition)
3402 len = ALIGN(len + file_system_partition->base, 0x10000) + sizeof(jffs2_eof_mark) - file_system_partition->base;
3403 else
3404 len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark);
3405 }
3406
3407 struct image_partition_entry entry = alloc_image_partition(part_name, len);
3408
3409 FILE *file = fopen(filename, "rb");
3410 if (!file)
3411 error(1, errno, "unable to open file `%s'", filename);
3412
3413 if (fread(entry.data, statbuf.st_size, 1, file) != 1)
3414 error(1, errno, "unable to read file `%s'", filename);
3415
3416 if (add_jffs2_eof) {
3417 uint8_t *eof = entry.data + statbuf.st_size, *end = entry.data+entry.size;
3418
3419 memset(eof, 0xff, end - eof - sizeof(jffs2_eof_mark));
3420 memcpy(end - sizeof(jffs2_eof_mark), jffs2_eof_mark, sizeof(jffs2_eof_mark));
3421 }
3422
3423 fclose(file);
3424
3425 return entry;
3426 }
3427
3428 /**
3429 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
3430
3431 Example image partition table:
3432
3433 fwup-ptn partition-table base 0x00800 size 0x00800
3434 fwup-ptn os-image base 0x01000 size 0x113b45
3435 fwup-ptn file-system base 0x114b45 size 0x1d0004
3436 fwup-ptn support-list base 0x2e4b49 size 0x000d1
3437
3438 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
3439 the end of the partition table is marked with a zero byte.
3440
3441 The firmware image must contain at least the partition-table and support-list partitions
3442 to be accepted. There aren't any alignment constraints for the image partitions.
3443
3444 The partition-table partition contains the actual flash layout; partitions
3445 from the image partition table are mapped to the corresponding flash partitions during
3446 the firmware upgrade. The support-list partition contains a list of devices supported by
3447 the firmware image.
3448
3449 The base offsets in the firmware partition table are relative to the end
3450 of the vendor information block, so the partition-table partition will
3451 actually start at offset 0x1814 of the image.
3452
3453 I think partition-table must be the first partition in the firmware image.
3454 */
3455 static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) {
3456 size_t i, j;
3457 char *image_pt = (char *)buffer, *end = image_pt + SAFELOADER_PAYLOAD_TABLE_SIZE;
3458
3459 size_t base = SAFELOADER_PAYLOAD_TABLE_SIZE;
3460 for (i = 0; parts[i].name; i++) {
3461 for (j = 0; flash_parts[j].name; j++) {
3462 if (!strcmp(flash_parts[j].name, parts[i].name)) {
3463 if (parts[i].size > flash_parts[j].size)
3464 error(1, 0, "%s partition too big (more than %u bytes)", flash_parts[j].name, (unsigned)flash_parts[j].size);
3465 break;
3466 }
3467 }
3468
3469 assert(flash_parts[j].name);
3470
3471 memcpy(buffer + base, parts[i].data, parts[i].size);
3472
3473 size_t len = end-image_pt;
3474 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);
3475
3476 if (w > len-1)
3477 error(1, 0, "image partition table overflow?");
3478
3479 image_pt += w;
3480
3481 base += parts[i].size;
3482 }
3483 }
3484
3485 /** Generates and writes the image MD5 checksum */
3486 static void put_md5(uint8_t *md5, uint8_t *buffer, unsigned int len) {
3487 MD5_CTX ctx;
3488
3489 MD5_Init(&ctx);
3490 MD5_Update(&ctx, md5_salt, (unsigned int)sizeof(md5_salt));
3491 MD5_Update(&ctx, buffer, len);
3492 MD5_Final(md5, &ctx);
3493 }
3494
3495
3496 /**
3497 Generates the firmware image in factory format
3498
3499 Image format:
3500
3501 Bytes (hex) Usage
3502 ----------- -----
3503 0000-0003 Image size (4 bytes, big endian)
3504 0004-0013 MD5 hash (hash of a 16 byte salt and the image data starting with byte 0x14)
3505 0014-0017 Vendor information length (without padding) (4 bytes, big endian)
3506 0018-1013 Vendor information (4092 bytes, padded with 0xff; there seem to be older
3507 (VxWorks-based) TP-LINK devices which use a smaller vendor information block)
3508 1014-1813 Image partition table (2048 bytes, padded with 0xff)
3509 1814-xxxx Firmware partitions
3510 */
3511 static void * generate_factory_image(struct device_info *info, const struct image_partition_entry *parts, size_t *len) {
3512 *len = SAFELOADER_PAYLOAD_OFFSET + SAFELOADER_PAYLOAD_TABLE_SIZE;
3513
3514 size_t i;
3515 for (i = 0; parts[i].name; i++)
3516 *len += parts[i].size;
3517
3518 uint8_t *image = malloc(*len);
3519 if (!image)
3520 error(1, errno, "malloc");
3521
3522 memset(image, 0xff, *len);
3523 put32(image, *len);
3524
3525 if (info->vendor) {
3526 size_t vendor_len = strlen(info->vendor);
3527 put32(image + SAFELOADER_PREAMBLE_SIZE, vendor_len);
3528 memcpy(image + SAFELOADER_PREAMBLE_SIZE + 0x4, info->vendor, vendor_len);
3529 }
3530
3531 put_partitions(image + SAFELOADER_PAYLOAD_OFFSET, info->partitions, parts);
3532 put_md5(image + 0x04, image + SAFELOADER_PREAMBLE_SIZE, *len - SAFELOADER_PREAMBLE_SIZE);
3533
3534 return image;
3535 }
3536
3537 /**
3538 Generates the firmware image in sysupgrade format
3539
3540 This makes some assumptions about the provided flash and image partition tables and
3541 should be generalized when TP-LINK starts building its safeloader into hardware with
3542 different flash layouts.
3543 */
3544 static void * generate_sysupgrade_image(struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) {
3545 size_t i, j;
3546 size_t flash_first_partition_index = 0;
3547 size_t flash_last_partition_index = 0;
3548 const struct flash_partition_entry *flash_first_partition = NULL;
3549 const struct flash_partition_entry *flash_last_partition = NULL;
3550 const struct image_partition_entry *image_last_partition = NULL;
3551
3552 /** Find first and last partitions */
3553 for (i = 0; info->partitions[i].name; i++) {
3554 if (!strcmp(info->partitions[i].name, info->first_sysupgrade_partition)) {
3555 flash_first_partition = &info->partitions[i];
3556 flash_first_partition_index = i;
3557 } else if (!strcmp(info->partitions[i].name, info->last_sysupgrade_partition)) {
3558 flash_last_partition = &info->partitions[i];
3559 flash_last_partition_index = i;
3560 }
3561 }
3562
3563 assert(flash_first_partition && flash_last_partition);
3564 assert(flash_first_partition_index < flash_last_partition_index);
3565
3566 /** Find last partition from image to calculate needed size */
3567 for (i = 0; image_parts[i].name; i++) {
3568 if (!strcmp(image_parts[i].name, info->last_sysupgrade_partition)) {
3569 image_last_partition = &image_parts[i];
3570 break;
3571 }
3572 }
3573
3574 assert(image_last_partition);
3575
3576 *len = flash_last_partition->base - flash_first_partition->base + image_last_partition->size;
3577
3578 uint8_t *image = malloc(*len);
3579 if (!image)
3580 error(1, errno, "malloc");
3581
3582 memset(image, 0xff, *len);
3583
3584 for (i = flash_first_partition_index; i <= flash_last_partition_index; i++) {
3585 for (j = 0; image_parts[j].name; j++) {
3586 if (!strcmp(info->partitions[i].name, image_parts[j].name)) {
3587 if (image_parts[j].size > info->partitions[i].size)
3588 error(1, 0, "%s partition too big (more than %u bytes)", info->partitions[i].name, (unsigned)info->partitions[i].size);
3589 memcpy(image + info->partitions[i].base - flash_first_partition->base, image_parts[j].data, image_parts[j].size);
3590 break;
3591 }
3592
3593 assert(image_parts[j].name);
3594 }
3595 }
3596
3597 return image;
3598 }
3599
3600 /** Generates an image according to a given layout and writes it to a file */
3601 static void build_image(const char *output,
3602 const char *kernel_image,
3603 const char *rootfs_image,
3604 uint32_t rev,
3605 bool add_jffs2_eof,
3606 bool sysupgrade,
3607 struct device_info *info) {
3608
3609 size_t i;
3610
3611 struct image_partition_entry parts[7] = {};
3612
3613 struct flash_partition_entry *firmware_partition = NULL;
3614 struct flash_partition_entry *os_image_partition = NULL;
3615 struct flash_partition_entry *file_system_partition = NULL;
3616 size_t firmware_partition_index = 0;
3617
3618 set_partition_names(info);
3619
3620 for (i = 0; info->partitions[i].name; i++) {
3621 if (!strcmp(info->partitions[i].name, "firmware"))
3622 {
3623 firmware_partition = &info->partitions[i];
3624 firmware_partition_index = i;
3625 }
3626 }
3627
3628 if (firmware_partition)
3629 {
3630 os_image_partition = &info->partitions[firmware_partition_index];
3631 file_system_partition = &info->partitions[firmware_partition_index + 1];
3632
3633 struct stat kernel;
3634 if (stat(kernel_image, &kernel) < 0)
3635 error(1, errno, "unable to stat file `%s'", kernel_image);
3636
3637 if (kernel.st_size > firmware_partition->size)
3638 error(1, 0, "kernel overflowed firmware partition\n");
3639
3640 for (i = MAX_PARTITIONS-1; i >= firmware_partition_index + 1; i--)
3641 info->partitions[i+1] = info->partitions[i];
3642
3643 file_system_partition->name = info->partition_names.file_system;
3644
3645 file_system_partition->base = firmware_partition->base + kernel.st_size;
3646
3647 /* Align partition start to erase blocks for factory images only */
3648 if (!sysupgrade)
3649 file_system_partition->base = ALIGN(firmware_partition->base + kernel.st_size, 0x10000);
3650
3651 file_system_partition->size = firmware_partition->size - file_system_partition->base;
3652
3653 os_image_partition->name = info->partition_names.os_image;
3654
3655 os_image_partition->size = kernel.st_size;
3656 }
3657
3658 parts[0] = make_partition_table(info);
3659 parts[1] = make_soft_version(info, rev);
3660 parts[2] = make_support_list(info);
3661 parts[3] = read_file(info->partition_names.os_image, kernel_image, false, NULL);
3662 parts[4] = read_file(info->partition_names.file_system, rootfs_image, add_jffs2_eof, file_system_partition);
3663
3664
3665 /* Some devices need the extra-para partition to accept the firmware */
3666 if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||
3667 strcasecmp(info->id, "ARCHER-A7-V5") == 0 ||
3668 strcasecmp(info->id, "ARCHER-A9-V6") == 0 ||
3669 strcasecmp(info->id, "ARCHER-AX23-V1") == 0 ||
3670 strcasecmp(info->id, "ARCHER-C2-V3") == 0 ||
3671 strcasecmp(info->id, "ARCHER-C7-V4") == 0 ||
3672 strcasecmp(info->id, "ARCHER-C7-V5") == 0 ||
3673 strcasecmp(info->id, "ARCHER-C25-V1") == 0 ||
3674 strcasecmp(info->id, "ARCHER-C59-V2") == 0 ||
3675 strcasecmp(info->id, "ARCHER-C60-V2") == 0 ||
3676 strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
3677 strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
3678 strcasecmp(info->id, "ARCHER-C6-V3") == 0 ||
3679 strcasecmp(info->id, "DECO-M4R-V4") == 0 ||
3680 strcasecmp(info->id, "MR70X") == 0 ||
3681 strcasecmp(info->id, "TLWR1043NV5") == 0) {
3682 const uint8_t extra_para[2] = {0x01, 0x00};
3683 parts[5] = make_extra_para(info, extra_para,
3684 sizeof(extra_para));
3685 } else if (strcasecmp(info->id, "ARCHER-C6-V2") == 0 ||
3686 strcasecmp(info->id, "TL-WA1201-V2") == 0) {
3687 const uint8_t extra_para[2] = {0x00, 0x01};
3688 parts[5] = make_extra_para(info, extra_para,
3689 sizeof(extra_para));
3690 } else if (strcasecmp(info->id, "ARCHER-C6-V2-US") == 0 ||
3691 strcasecmp(info->id, "EAP245-V3") == 0) {
3692 const uint8_t extra_para[2] = {0x01, 0x01};
3693 parts[5] = make_extra_para(info, extra_para,
3694 sizeof(extra_para));
3695 }
3696
3697 size_t len;
3698 void *image;
3699 if (sysupgrade)
3700 image = generate_sysupgrade_image(info, parts, &len);
3701 else
3702 image = generate_factory_image(info, parts, &len);
3703
3704 FILE *file = fopen(output, "wb");
3705 if (!file)
3706 error(1, errno, "unable to open output file");
3707
3708 if (fwrite(image, len, 1, file) != 1)
3709 error(1, 0, "unable to write output file");
3710
3711 fclose(file);
3712
3713 free(image);
3714
3715 for (i = 0; parts[i].name; i++)
3716 free_image_partition(&parts[i]);
3717 }
3718
3719 /** Usage output */
3720 static void usage(const char *argv0) {
3721 fprintf(stderr,
3722 "Usage: %s [OPTIONS...]\n"
3723 "\n"
3724 "Options:\n"
3725 " -h show this help\n"
3726 "\n"
3727 "Info about an image:\n"
3728 " -i <file> input file to read from\n"
3729 "Create a new image:\n"
3730 " -B <board> create image for the board specified with <board>\n"
3731 " -k <file> read kernel image from the file <file>\n"
3732 " -r <file> read rootfs image from the file <file>\n"
3733 " -o <file> write output to the file <file>\n"
3734 " -V <rev> sets the revision number to <rev>\n"
3735 " -j add jffs2 end-of-filesystem markers\n"
3736 " -S create sysupgrade instead of factory image\n"
3737 "Extract an old image:\n"
3738 " -x <file> extract all oem firmware partition\n"
3739 " -d <dir> destination to extract the firmware partition\n"
3740 " -z <file> convert an oem firmware into a sysupgade file. Use -o for output file\n",
3741 argv0
3742 );
3743 };
3744
3745
3746 static struct device_info *find_board(const char *id)
3747 {
3748 struct device_info *board = NULL;
3749
3750 for (board = boards; board->id != NULL; board++)
3751 if (strcasecmp(id, board->id) == 0)
3752 return board;
3753
3754 return NULL;
3755 }
3756
3757 static int add_flash_partition(
3758 struct flash_partition_entry *part_list,
3759 size_t max_entries,
3760 const char *name,
3761 unsigned long base,
3762 unsigned long size)
3763 {
3764 size_t ptr;
3765 /* check if the list has a free entry */
3766 for (ptr = 0; ptr < max_entries; ptr++, part_list++) {
3767 if (part_list->name == NULL &&
3768 part_list->base == 0 &&
3769 part_list->size == 0)
3770 break;
3771 }
3772
3773 if (ptr == max_entries) {
3774 error(1, 0, "No free flash part entry available.");
3775 }
3776
3777 part_list->name = calloc(1, strlen(name) + 1);
3778 if (!part_list->name) {
3779 error(1, 0, "Unable to allocate memory");
3780 }
3781
3782 memcpy((char *)part_list->name, name, strlen(name));
3783 part_list->base = base;
3784 part_list->size = size;
3785
3786 return 0;
3787 }
3788
3789 /** read the partition table into struct flash_partition_entry */
3790 enum PARTITION_TABLE_TYPE {
3791 PARTITION_TABLE_FWUP,
3792 PARTITION_TABLE_FLASH,
3793 };
3794
3795 static int read_partition_table(
3796 FILE *file, long offset,
3797 struct flash_partition_entry *entries, size_t max_entries,
3798 int type)
3799 {
3800 char buf[SAFELOADER_PAYLOAD_TABLE_SIZE];
3801 char *ptr, *end;
3802 const char *parthdr = NULL;
3803 const char *fwuphdr = "fwup-ptn";
3804 const char *flashhdr = "partition";
3805
3806 /* TODO: search for the partition table */
3807
3808 switch(type) {
3809 case PARTITION_TABLE_FWUP:
3810 parthdr = fwuphdr;
3811 break;
3812 case PARTITION_TABLE_FLASH:
3813 parthdr = flashhdr;
3814 break;
3815 default:
3816 error(1, 0, "Invalid partition table");
3817 }
3818
3819 if (fseek(file, offset, SEEK_SET) < 0)
3820 error(1, errno, "Can not seek in the firmware");
3821
3822 if (fread(buf, sizeof(buf), 1, file) != 1)
3823 error(1, errno, "Can not read fwup-ptn from the firmware");
3824
3825 buf[sizeof(buf) - 1] = '\0';
3826
3827 /* look for the partition header */
3828 if (memcmp(buf, parthdr, strlen(parthdr)) != 0) {
3829 fprintf(stderr, "DEBUG: can not find fwuphdr\n");
3830 return 1;
3831 }
3832
3833 ptr = buf;
3834 end = buf + sizeof(buf);
3835 while ((ptr + strlen(parthdr)) < end &&
3836 memcmp(ptr, parthdr, strlen(parthdr)) == 0) {
3837 char *end_part;
3838 char *end_element;
3839
3840 char name[32] = { 0 };
3841 int name_len = 0;
3842 unsigned long base = 0;
3843 unsigned long size = 0;
3844
3845 end_part = memchr(ptr, '\n', (end - ptr));
3846 if (end_part == NULL) {
3847 /* in theory this should never happen, because a partition always ends with 0x09, 0x0D, 0x0A */
3848 break;
3849 }
3850
3851 for (int i = 0; i <= 4; i++) {
3852 if (end_part <= ptr)
3853 break;
3854
3855 end_element = memchr(ptr, 0x20, (end_part - ptr));
3856 if (end_element == NULL) {
3857 error(1, errno, "Ignoring the rest of the partition entries.");
3858 break;
3859 }
3860
3861 switch (i) {
3862 /* partition header */
3863 case 0:
3864 ptr = end_element + 1;
3865 continue;
3866 /* name */
3867 case 1:
3868 name_len = (end_element - ptr) > 31 ? 31 : (end_element - ptr);
3869 strncpy(name, ptr, name_len);
3870 name[name_len] = '\0';
3871 ptr = end_element + 1;
3872 continue;
3873
3874 /* string "base" */
3875 case 2:
3876 ptr = end_element + 1;
3877 continue;
3878
3879 /* actual base */
3880 case 3:
3881 base = strtoul(ptr, NULL, 16);
3882 ptr = end_element + 1;
3883 continue;
3884
3885 /* string "size" */
3886 case 4:
3887 ptr = end_element + 1;
3888 /* actual size. The last element doesn't have a sepeartor */
3889 size = strtoul(ptr, NULL, 16);
3890 /* the part ends with 0x09, 0x0d, 0x0a */
3891 ptr = end_part + 1;
3892 add_flash_partition(entries, max_entries, name, base, size);
3893 continue;
3894 }
3895 }
3896 }
3897
3898 return 0;
3899 }
3900
3901 static void safeloader_read_partition(FILE *input_file, size_t payload_offset,
3902 struct flash_partition_entry *entry,
3903 struct image_partition_entry *part)
3904 {
3905 size_t part_size = entry->size;
3906 void *part_data = malloc(part_size);
3907
3908 if (fseek(input_file, payload_offset, SEEK_SET))
3909 error(1, errno, "Failed to seek to partition data");
3910
3911 if (!part_data)
3912 error(1, ENOMEM, "Failed to allocate partition data");
3913
3914 if (fread(part_data, 1, part_size, input_file) < part_size)
3915 error(1, errno, "Failed to read partition data");
3916
3917 part->data = part_data;
3918 part->size = part_size;
3919 part->name = entry->name;
3920 }
3921
3922 static void safeloader_parse_image(FILE *input_file, struct safeloader_image_info *image)
3923 {
3924 static const char *HEADER_ID_CLOUD = "fw-type:Cloud";
3925 static const char *HEADER_ID_QNEW = "?NEW";
3926
3927 char buf[64];
3928
3929 if (!input_file)
3930 return;
3931
3932 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
3933
3934 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3935 error(1, errno, "Can not read image header");
3936
3937 if (memcmp(HEADER_ID_QNEW, &buf[0], strlen(HEADER_ID_QNEW)) == 0)
3938 image->type = SAFELOADER_TYPE_QNEW;
3939 else if (memcmp(HEADER_ID_CLOUD, &buf[0], strlen(HEADER_ID_CLOUD)) == 0)
3940 image->type = SAFELOADER_TYPE_CLOUD;
3941 else if (ntohl(*((uint32_t *) &buf[0])) <= SAFELOADER_HEADER_SIZE)
3942 image->type = SAFELOADER_TYPE_VENDOR;
3943 else
3944 image->type = SAFELOADER_TYPE_DEFAULT;
3945
3946 switch (image->type) {
3947 case SAFELOADER_TYPE_DEFAULT:
3948 case SAFELOADER_TYPE_VENDOR:
3949 case SAFELOADER_TYPE_CLOUD:
3950 image->payload_offset = SAFELOADER_PAYLOAD_OFFSET;
3951 break;
3952 case SAFELOADER_TYPE_QNEW:
3953 image->payload_offset = SAFELOADER_QNEW_PAYLOAD_OFFSET;
3954 break;
3955 }
3956
3957 /* Parse image partition table */
3958 read_partition_table(input_file, image->payload_offset, &image->entries[0],
3959 MAX_PARTITIONS, PARTITION_TABLE_FWUP);
3960 }
3961
3962 static void write_partition(
3963 FILE *input_file,
3964 size_t firmware_offset,
3965 struct flash_partition_entry *entry,
3966 FILE *output_file)
3967 {
3968 char buf[4096];
3969 size_t offset;
3970
3971 fseek(input_file, entry->base + firmware_offset, SEEK_SET);
3972
3973 for (offset = 0; sizeof(buf) + offset <= entry->size; offset += sizeof(buf)) {
3974 if (fread(buf, sizeof(buf), 1, input_file) != 1)
3975 error(1, errno, "Can not read partition from input_file");
3976
3977 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
3978 error(1, errno, "Can not write partition to output_file");
3979 }
3980 /* write last chunk smaller than buffer */
3981 if (offset < entry->size) {
3982 offset = entry->size - offset;
3983 if (fread(buf, offset, 1, input_file) != 1)
3984 error(1, errno, "Can not read partition from input_file");
3985 if (fwrite(buf, offset, 1, output_file) != 1)
3986 error(1, errno, "Can not write partition to output_file");
3987 }
3988 }
3989
3990 static int extract_firmware_partition(FILE *input_file, size_t firmware_offset, struct flash_partition_entry *entry, const char *output_directory)
3991 {
3992 FILE *output_file;
3993 char output[PATH_MAX];
3994
3995 snprintf(output, PATH_MAX, "%s/%s", output_directory, entry->name);
3996 output_file = fopen(output, "wb+");
3997 if (output_file == NULL) {
3998 error(1, errno, "Can not open output file %s", output);
3999 }
4000
4001 write_partition(input_file, firmware_offset, entry, output_file);
4002
4003 fclose(output_file);
4004
4005 return 0;
4006 }
4007
4008 /** extract all partitions from the firmware file */
4009 static int extract_firmware(const char *input, const char *output_directory)
4010 {
4011 struct safeloader_image_info info = {};
4012 struct stat statbuf;
4013 FILE *input_file;
4014
4015 /* check input file */
4016 if (stat(input, &statbuf)) {
4017 error(1, errno, "Can not read input firmware %s", input);
4018 }
4019
4020 /* check if output directory exists */
4021 if (stat(output_directory, &statbuf)) {
4022 error(1, errno, "Failed to stat output directory %s", output_directory);
4023 }
4024
4025 if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
4026 error(1, errno, "Given output directory is not a directory %s", output_directory);
4027 }
4028
4029 input_file = fopen(input, "rb");
4030 safeloader_parse_image(input_file, &info);
4031
4032 for (size_t i = 0; i < MAX_PARTITIONS && info.entries[i].name; i++)
4033 extract_firmware_partition(input_file, info.payload_offset, &info.entries[i], output_directory);
4034
4035 return 0;
4036 }
4037
4038 static struct flash_partition_entry *find_partition(
4039 struct flash_partition_entry *entries, size_t max_entries,
4040 const char *name, const char *error_msg)
4041 {
4042 for (size_t i = 0; i < max_entries; i++, entries++) {
4043 if (strcmp(entries->name, name) == 0)
4044 return entries;
4045 }
4046
4047 if (error_msg) {
4048 error(1, 0, "%s", error_msg);
4049 }
4050
4051 return NULL;
4052 }
4053
4054 static int firmware_info(const char *input)
4055 {
4056 struct safeloader_image_info info = {};
4057 struct image_partition_entry part = {};
4058 struct flash_partition_entry *e;
4059 FILE *input_file;
4060
4061 input_file = fopen(input, "rb");
4062
4063 safeloader_parse_image(input_file, &info);
4064
4065 if (info.type == SAFELOADER_TYPE_VENDOR) {
4066 char buf[SAFELOADER_HEADER_SIZE] = {};
4067 uint32_t vendor_size;
4068
4069 fseek(input_file, SAFELOADER_PREAMBLE_SIZE, SEEK_SET);
4070 fread(&vendor_size, sizeof(uint32_t), 1, input_file);
4071
4072 vendor_size = ntohl(vendor_size);
4073 fread(buf, vendor_size, 1, input_file);
4074
4075 printf("Firmware vendor string:\n");
4076 fwrite(buf, strnlen(buf, vendor_size), 1, stdout);
4077 printf("\n");
4078 }
4079
4080 printf("Firmware image partitions:\n");
4081 printf("%-8s %-8s %s\n", "base", "size", "name");
4082
4083 e = &info.entries[0];
4084 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4085 printf("%08x %08x %s\n", e->base, e->size, e->name);
4086
4087 e = find_partition(&info.entries[0], MAX_PARTITIONS, "soft-version", NULL);
4088 if (e) {
4089 struct soft_version *s;
4090 unsigned int ascii_len;
4091 const uint8_t *buf;
4092 size_t data_len;
4093 bool isstr;
4094
4095 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4096 data_len = ntohl(((struct meta_header *) part.data)->length);
4097 buf = part.data + sizeof(struct meta_header);
4098
4099 /* Check for (null-terminated) string */
4100 ascii_len = 0;
4101 while (ascii_len < data_len && isascii(buf[ascii_len]))
4102 ascii_len++;
4103
4104 isstr = ascii_len == data_len;
4105
4106 printf("\n[Software version]\n");
4107 if (isstr) {
4108 fwrite(buf, strnlen((const char *) buf, data_len), 1, stdout);
4109 putchar('\n');
4110 } else if (data_len >= offsetof(struct soft_version, rev)) {
4111 s = (struct soft_version *) buf;
4112
4113 printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch);
4114 printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day);
4115 printf("Revision: %d\n", ntohl(s->rev));
4116 } else {
4117 printf("Failed to parse data\n");
4118 }
4119
4120 free_image_partition(&part);
4121 }
4122
4123 e = find_partition(&info.entries[0], MAX_PARTITIONS, "support-list", NULL);
4124 if (e) {
4125 size_t data_len;
4126
4127 safeloader_read_partition(input_file, info.payload_offset + e->base, e, &part);
4128 data_len = ntohl(((struct meta_header *) part.data)->length);
4129
4130 printf("\n[Support list]\n");
4131 fwrite(part.data + sizeof(struct meta_header), data_len, 1, stdout);
4132 printf("\n");
4133
4134 free_image_partition(&part);
4135 }
4136
4137 e = find_partition(&info.entries[0], MAX_PARTITIONS, "partition-table", NULL);
4138 if (e) {
4139 size_t flash_table_offset = info.payload_offset + e->base + 4;
4140 struct flash_partition_entry parts[MAX_PARTITIONS] = {};
4141
4142 if (read_partition_table(input_file, flash_table_offset, parts, MAX_PARTITIONS, PARTITION_TABLE_FLASH))
4143 error(1, 0, "Error can not read the partition table (partition)");
4144
4145 printf("\n[Partition table]\n");
4146 printf("%-8s %-8s %s\n", "base", "size", "name");
4147
4148 e = &parts[0];
4149 for (unsigned int i = 0; i < MAX_PARTITIONS && e->name; i++, e++)
4150 printf("%08x %08x %s\n", e->base, e->size, e->name);
4151 }
4152
4153 fclose(input_file);
4154
4155 return 0;
4156 }
4157
4158 static void write_ff(FILE *output_file, size_t size)
4159 {
4160 char buf[4096];
4161 size_t offset;
4162
4163 memset(buf, 0xff, sizeof(buf));
4164
4165 for (offset = 0; offset + sizeof(buf) < size ; offset += sizeof(buf)) {
4166 if (fwrite(buf, sizeof(buf), 1, output_file) != 1)
4167 error(1, errno, "Can not write 0xff to output_file");
4168 }
4169
4170 /* write last chunk smaller than buffer */
4171 if (offset < size) {
4172 offset = size - offset;
4173 if (fwrite(buf, offset, 1, output_file) != 1)
4174 error(1, errno, "Can not write partition to output_file");
4175 }
4176 }
4177
4178 static void convert_firmware(const char *input, const char *output)
4179 {
4180 struct flash_partition_entry flash[MAX_PARTITIONS] = {};
4181 struct flash_partition_entry *fwup_partition_table;
4182 struct flash_partition_entry *flash_file_system;
4183 struct flash_partition_entry *fwup_file_system;
4184 struct flash_partition_entry *flash_os_image;
4185 struct flash_partition_entry *fwup_os_image;
4186 struct safeloader_image_info info = {};
4187 size_t flash_table_offset;
4188 struct stat statbuf;
4189 FILE *output_file;
4190 FILE *input_file;
4191
4192 /* check input file */
4193 if (stat(input, &statbuf)) {
4194 error(1, errno, "Can not read input firmware %s", input);
4195 }
4196
4197 input_file = fopen(input, "rb");
4198 if (!input_file)
4199 error(1, 0, "Can not open input firmware %s", input);
4200
4201 output_file = fopen(output, "wb");
4202 if (!output_file)
4203 error(1, 0, "Can not open output firmware %s", output);
4204
4205 input_file = fopen(input, "rb");
4206 safeloader_parse_image(input_file, &info);
4207
4208 fwup_os_image = find_partition(info.entries, MAX_PARTITIONS,
4209 "os-image", "Error can not find os-image partition (fwup)");
4210 fwup_file_system = find_partition(info.entries, MAX_PARTITIONS,
4211 "file-system", "Error can not find file-system partition (fwup)");
4212 fwup_partition_table = find_partition(info.entries, MAX_PARTITIONS,
4213 "partition-table", "Error can not find partition-table partition");
4214
4215 /* the flash partition table has a 0x00000004 magic haeder */
4216 flash_table_offset = info.payload_offset + fwup_partition_table->base + 4;
4217 if (read_partition_table(input_file, flash_table_offset, flash, MAX_PARTITIONS, PARTITION_TABLE_FLASH) != 0)
4218 error(1, 0, "Error can not read the partition table (flash)");
4219
4220 flash_os_image = find_partition(flash, MAX_PARTITIONS,
4221 "os-image", "Error can not find os-image partition (flash)");
4222 flash_file_system = find_partition(flash, MAX_PARTITIONS,
4223 "file-system", "Error can not find file-system partition (flash)");
4224
4225 /* write os_image to 0x0 */
4226 write_partition(input_file, info.payload_offset, fwup_os_image, output_file);
4227 write_ff(output_file, flash_os_image->size - fwup_os_image->size);
4228
4229 /* write file-system behind os_image */
4230 fseek(output_file, flash_file_system->base - flash_os_image->base, SEEK_SET);
4231 write_partition(input_file, info.payload_offset, fwup_file_system, output_file);
4232
4233 fclose(output_file);
4234 fclose(input_file);
4235 }
4236
4237 int main(int argc, char *argv[]) {
4238 const char *info_image = NULL, *board = NULL, *kernel_image = NULL, *rootfs_image = NULL, *output = NULL;
4239 const char *extract_image = NULL, *output_directory = NULL, *convert_image = NULL;
4240 bool add_jffs2_eof = false, sysupgrade = false;
4241 unsigned rev = 0;
4242 struct device_info *info;
4243 set_source_date_epoch();
4244
4245 while (true) {
4246 int c;
4247
4248 c = getopt(argc, argv, "i:B:k:r:o:V:jSh:x:d:z:");
4249 if (c == -1)
4250 break;
4251
4252 switch (c) {
4253 case 'i':
4254 info_image = optarg;
4255 break;
4256
4257 case 'B':
4258 board = optarg;
4259 break;
4260
4261 case 'k':
4262 kernel_image = optarg;
4263 break;
4264
4265 case 'r':
4266 rootfs_image = optarg;
4267 break;
4268
4269 case 'o':
4270 output = optarg;
4271 break;
4272
4273 case 'V':
4274 sscanf(optarg, "r%u", &rev);
4275 break;
4276
4277 case 'j':
4278 add_jffs2_eof = true;
4279 break;
4280
4281 case 'S':
4282 sysupgrade = true;
4283 break;
4284
4285 case 'h':
4286 usage(argv[0]);
4287 return 0;
4288
4289 case 'd':
4290 output_directory = optarg;
4291 break;
4292
4293 case 'x':
4294 extract_image = optarg;
4295 break;
4296
4297 case 'z':
4298 convert_image = optarg;
4299 break;
4300
4301 default:
4302 usage(argv[0]);
4303 return 1;
4304 }
4305 }
4306
4307 if (info_image) {
4308 firmware_info(info_image);
4309 } else if (extract_image || output_directory) {
4310 if (!extract_image)
4311 error(1, 0, "No factory/oem image given via -x <file>. Output directory is only valid with -x");
4312 if (!output_directory)
4313 error(1, 0, "Can not extract an image without output directory. Use -d <dir>");
4314 extract_firmware(extract_image, output_directory);
4315 } else if (convert_image) {
4316 if (!output)
4317 error(1, 0, "Can not convert a factory/oem image into sysupgrade image without output file. Use -o <file>");
4318 convert_firmware(convert_image, output);
4319 } else {
4320 if (!board)
4321 error(1, 0, "no board has been specified");
4322 if (!kernel_image)
4323 error(1, 0, "no kernel image has been specified");
4324 if (!rootfs_image)
4325 error(1, 0, "no rootfs image has been specified");
4326 if (!output)
4327 error(1, 0, "no output filename has been specified");
4328
4329 info = find_board(board);
4330
4331 if (info == NULL)
4332 error(1, 0, "unsupported board %s", board);
4333
4334 build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, info);
4335 }
4336
4337 return 0;
4338 }