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