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