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