ath79: wrap ucidef_add_switch in 02_network
[openwrt/openwrt.git] / tools / firmware-utils / src / tplink-safeloader.c
1 /*
2 Copyright (c) 2014, Matthias Schiffer <mschiffer@universe-factory.net>
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26
27 /*
28 tplink-safeloader
29
30 Image generation tool for the TP-LINK SafeLoader as seen on
31 TP-LINK Pharos devices (CPE210/220/510/520)
32 */
33
34
35 #include <assert.h>
36 #include <errno.h>
37 #include <stdbool.h>
38 #include <stdio.h>
39 #include <stdint.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <time.h>
43 #include <unistd.h>
44
45 #include <arpa/inet.h>
46
47 #include <sys/types.h>
48 #include <sys/stat.h>
49 #include <limits.h>
50
51 #include "md5.h"
52
53
54 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
55
56
57 #define MAX_PARTITIONS 32
58
59 /** An image partition table entry */
60 struct image_partition_entry {
61 const char *name;
62 size_t size;
63 uint8_t *data;
64 };
65
66 /** A flash partition table entry */
67 struct flash_partition_entry {
68 char *name;
69 uint32_t base;
70 uint32_t size;
71 };
72
73 /** Partition trailing padding definitions
74 * Values 0x00 to 0xff are reserved to indicate the padding value
75 * Values from 0x100 are reserved to indicate other behaviour */
76 enum partition_trail_value {
77 PART_TRAIL_00 = 0x00,
78 PART_TRAIL_FF = 0xff,
79 PART_TRAIL_MAX = 0xff,
80 PART_TRAIL_NONE = 0x100
81 };
82
83 /** Firmware layout description */
84 struct device_info {
85 const char *id;
86 const char *vendor;
87 const char *support_list;
88 enum partition_trail_value part_trail;
89 const char *soft_ver;
90 uint32_t soft_ver_compat_level;
91 struct flash_partition_entry partitions[MAX_PARTITIONS+1];
92 const char *first_sysupgrade_partition;
93 const char *last_sysupgrade_partition;
94 };
95
96 struct __attribute__((__packed__)) meta_header {
97 uint32_t length;
98 uint32_t zero;
99 };
100
101 /** The content of the soft-version structure */
102 struct __attribute__((__packed__)) soft_version {
103 uint8_t pad1;
104 uint8_t version_major;
105 uint8_t version_minor;
106 uint8_t version_patch;
107 uint8_t year_hi;
108 uint8_t year_lo;
109 uint8_t month;
110 uint8_t day;
111 uint32_t rev;
112 uint32_t compat_level;
113 };
114
115
116 static const uint8_t jffs2_eof_mark[4] = {0xde, 0xad, 0xc0, 0xde};
117
118
119 /**
120 Salt for the MD5 hash
121
122 Fortunately, TP-LINK seems to use the same salt for most devices which use
123 the new image format.
124 */
125 static const uint8_t md5_salt[16] = {
126 0x7a, 0x2b, 0x15, 0xed,
127 0x9b, 0x98, 0x59, 0x6d,
128 0xe5, 0x04, 0xab, 0x44,
129 0xac, 0x2a, 0x9f, 0x4e,
130 };
131
132
133 /** Firmware layout table */
134 static struct device_info boards[] = {
135 /** Firmware layout for the CPE210/220 V1 */
136 {
137 .id = "CPE210",
138 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
139 .support_list =
140 "SupportList:\r\n"
141 "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
142 "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
143 "CPE210(TP-LINK|US|N300-2):1.1\r\n"
144 "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
145 "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
146 "CPE220(TP-LINK|US|N300-2):1.1\r\n"
147 "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
148 .part_trail = 0xff,
149 .soft_ver = NULL,
150
151 .partitions = {
152 {"fs-uboot", 0x00000, 0x20000},
153 {"partition-table", 0x20000, 0x02000},
154 {"default-mac", 0x30000, 0x00020},
155 {"product-info", 0x31100, 0x00100},
156 {"signature", 0x32000, 0x00400},
157 {"os-image", 0x40000, 0x300000},
158 {"file-system", 0x340000, 0x470000},
159 {"soft-version", 0x7b0000, 0x00100},
160 {"support-list", 0x7b1000, 0x00400},
161 {"user-config", 0x7c0000, 0x10000},
162 {"default-config", 0x7d0000, 0x10000},
163 {"log", 0x7e0000, 0x10000},
164 {"radio", 0x7f0000, 0x10000},
165 {NULL, 0, 0}
166 },
167
168 .first_sysupgrade_partition = "os-image",
169 .last_sysupgrade_partition = "support-list",
170 },
171
172 /** Firmware layout for the CPE210 V2 */
173 {
174 .id = "CPE210V2",
175 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n",
176 .support_list =
177 "SupportList:\r\n"
178 "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n"
179 "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n"
180 "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n"
181 "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
182 "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n"
183 "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n"
184 "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n"
185 "CPE210(TP-LINK|UN|N300-2):2.0\r\n"
186 "CPE210(TP-LINK|EU|N300-2):2.0\r\n"
187 "CPE210(TP-LINK|US|N300-2):2.0\r\n",
188 .part_trail = 0xff,
189 .soft_ver = NULL,
190
191 .partitions = {
192 {"fs-uboot", 0x00000, 0x20000},
193 {"partition-table", 0x20000, 0x02000},
194 {"default-mac", 0x30000, 0x00020},
195 {"product-info", 0x31100, 0x00100},
196 {"device-info", 0x31400, 0x00400},
197 {"signature", 0x32000, 0x00400},
198 {"device-id", 0x33000, 0x00100},
199 {"firmware", 0x40000, 0x770000},
200 {"soft-version", 0x7b0000, 0x00100},
201 {"support-list", 0x7b1000, 0x01000},
202 {"user-config", 0x7c0000, 0x10000},
203 {"default-config", 0x7d0000, 0x10000},
204 {"log", 0x7e0000, 0x10000},
205 {"radio", 0x7f0000, 0x10000},
206 {NULL, 0, 0}
207 },
208
209 .first_sysupgrade_partition = "os-image",
210 .last_sysupgrade_partition = "support-list",
211 },
212
213 /** Firmware layout for the CPE210 V3 */
214 {
215 .id = "CPE210V3",
216 .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
217 .support_list =
218 "SupportList:\r\n"
219 "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
220 "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
221 "CPE210(TP-LINK|US|N300-2|55530000):3.0\r\n"
222 "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
223 "CPE210(TP-LINK|EU|N300-2):3.0\r\n"
224 "CPE210(TP-LINK|EU|N300-2|45550000):3.1\r\n"
225 "CPE210(TP-LINK|UN|N300-2|00000000):3.1\r\n"
226 "CPE210(TP-LINK|US|N300-2|55530000):3.1\r\n"
227 "CPE210(TP-LINK|EU|N300-2|45550000):3.20\r\n"
228 "CPE210(TP-LINK|UN|N300-2|00000000):3.20\r\n"
229 "CPE210(TP-LINK|US|N300-2|55530000):3.20\r\n",
230 .part_trail = 0xff,
231 .soft_ver = NULL,
232
233 .partitions = {
234 {"fs-uboot", 0x00000, 0x20000},
235 {"partition-table", 0x20000, 0x01000},
236 {"default-mac", 0x30000, 0x00020},
237 {"product-info", 0x31100, 0x00100},
238 {"device-info", 0x31400, 0x00400},
239 {"signature", 0x32000, 0x00400},
240 {"device-id", 0x33000, 0x00100},
241 {"firmware", 0x40000, 0x770000},
242 {"soft-version", 0x7b0000, 0x00100},
243 {"support-list", 0x7b1000, 0x01000},
244 {"user-config", 0x7c0000, 0x10000},
245 {"default-config", 0x7d0000, 0x10000},
246 {"log", 0x7e0000, 0x10000},
247 {"radio", 0x7f0000, 0x10000},
248 {NULL, 0, 0}
249 },
250
251 .first_sysupgrade_partition = "os-image",
252 .last_sysupgrade_partition = "support-list",
253 },
254
255 /** Firmware layout for the CPE220 V2 */
256 {
257 .id = "CPE220V2",
258 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
259 .support_list =
260 "SupportList:\r\n"
261 "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n"
262 "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n"
263 "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n"
264 "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n"
265 "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n"
266 "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n"
267 "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n"
268 "CPE220(TP-LINK|UN|N300-2):2.0\r\n"
269 "CPE220(TP-LINK|EU|N300-2):2.0\r\n"
270 "CPE220(TP-LINK|US|N300-2):2.0\r\n",
271 .part_trail = 0xff,
272 .soft_ver = NULL,
273
274 .partitions = {
275 {"fs-uboot", 0x00000, 0x20000},
276 {"partition-table", 0x20000, 0x02000},
277 {"default-mac", 0x30000, 0x00020},
278 {"product-info", 0x31100, 0x00100},
279 {"signature", 0x32000, 0x00400},
280 {"os-image", 0x40000, 0x300000},
281 {"file-system", 0x340000, 0x470000},
282 {"soft-version", 0x7b0000, 0x00100},
283 {"support-list", 0x7b1000, 0x00400},
284 {"user-config", 0x7c0000, 0x10000},
285 {"default-config", 0x7d0000, 0x10000},
286 {"log", 0x7e0000, 0x10000},
287 {"radio", 0x7f0000, 0x10000},
288 {NULL, 0, 0}
289 },
290
291 .first_sysupgrade_partition = "os-image",
292 .last_sysupgrade_partition = "support-list",
293 },
294
295 /** Firmware layout for the CPE220 V3 */
296 {
297 .id = "CPE220V3",
298 .vendor = "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n",
299 .support_list =
300 "SupportList:\r\n"
301 "CPE220(TP-LINK|EU|N300-2|00000000):3.0\r\n"
302 "CPE220(TP-LINK|EU|N300-2|45550000):3.0\r\n"
303 "CPE220(TP-LINK|EU|N300-2|55530000):3.0\r\n"
304 "CPE220(TP-LINK|UN|N300-2|00000000):3.0\r\n"
305 "CPE220(TP-LINK|UN|N300-2|45550000):3.0\r\n"
306 "CPE220(TP-LINK|UN|N300-2|55530000):3.0\r\n"
307 "CPE220(TP-LINK|US|N300-2|55530000):3.0\r\n"
308 "CPE220(TP-LINK|UN|N300-2):3.0\r\n"
309 "CPE220(TP-LINK|EU|N300-2):3.0\r\n"
310 "CPE220(TP-LINK|US|N300-2):3.0\r\n",
311 .part_trail = 0xff,
312 .soft_ver = NULL,
313
314 .partitions = {
315 {"fs-uboot", 0x00000, 0x20000},
316 {"partition-table", 0x20000, 0x02000},
317 {"default-mac", 0x30000, 0x00020},
318 {"product-info", 0x31100, 0x00100},
319 {"device-info", 0x31400, 0x00400},
320 {"signature", 0x32000, 0x00400},
321 {"device-id", 0x33000, 0x00100},
322 {"firmware", 0x40000, 0x770000},
323 {"soft-version", 0x7b0000, 0x00100},
324 {"support-list", 0x7b1000, 0x01000},
325 {"user-config", 0x7c0000, 0x10000},
326 {"default-config", 0x7d0000, 0x10000},
327 {"log", 0x7e0000, 0x10000},
328 {"radio", 0x7f0000, 0x10000},
329 {NULL, 0, 0}
330 },
331
332 .first_sysupgrade_partition = "os-image",
333 .last_sysupgrade_partition = "support-list",
334 },
335
336 /** Firmware layout for the CPE510/520 V1 */
337 {
338 .id = "CPE510",
339 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
340 .support_list =
341 "SupportList:\r\n"
342 "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
343 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
344 "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
345 "CPE510(TP-LINK|US|N300-5):1.1\r\n"
346 "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
347 "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
348 "CPE520(TP-LINK|US|N300-5):1.1\r\n"
349 "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
350 .part_trail = 0xff,
351 .soft_ver = NULL,
352
353 .partitions = {
354 {"fs-uboot", 0x00000, 0x20000},
355 {"partition-table", 0x20000, 0x02000},
356 {"default-mac", 0x30000, 0x00020},
357 {"product-info", 0x31100, 0x00100},
358 {"signature", 0x32000, 0x00400},
359 {"os-image", 0x40000, 0x300000},
360 {"file-system", 0x340000, 0x470000},
361 {"soft-version", 0x7b0000, 0x00100},
362 {"support-list", 0x7b1000, 0x00400},
363 {"user-config", 0x7c0000, 0x10000},
364 {"default-config", 0x7d0000, 0x10000},
365 {"log", 0x7e0000, 0x10000},
366 {"radio", 0x7f0000, 0x10000},
367 {NULL, 0, 0}
368 },
369
370 .first_sysupgrade_partition = "os-image",
371 .last_sysupgrade_partition = "support-list",
372 },
373
374 /** Firmware layout for the CPE510 V2 */
375 {
376 .id = "CPE510V2",
377 .vendor = "CPE510(TP-LINK|UN|N300-5):2.0\r\n",
378 .support_list =
379 "SupportList:\r\n"
380 "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
381 "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
382 "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
383 "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
384 "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
385 "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
386 "CPE510(TP-LINK|US|N300-5|00000000):2.0\r\n"
387 "CPE510(TP-LINK|US|N300-5|45550000):2.0\r\n"
388 "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
389 "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
390 "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
391 "CPE510(TP-LINK|US|N300-5):2.0\r\n",
392 .part_trail = 0xff,
393 .soft_ver = NULL,
394
395 .partitions = {
396 {"fs-uboot", 0x00000, 0x20000},
397 {"partition-table", 0x20000, 0x02000},
398 {"default-mac", 0x30000, 0x00020},
399 {"product-info", 0x31100, 0x00100},
400 {"signature", 0x32000, 0x00400},
401 {"os-image", 0x40000, 0x300000},
402 {"file-system", 0x340000, 0x470000},
403 {"soft-version", 0x7b0000, 0x00100},
404 {"support-list", 0x7b1000, 0x00400},
405 {"user-config", 0x7c0000, 0x10000},
406 {"default-config", 0x7d0000, 0x10000},
407 {"log", 0x7e0000, 0x10000},
408 {"radio", 0x7f0000, 0x10000},
409 {NULL, 0, 0}
410 },
411
412 .first_sysupgrade_partition = "os-image",
413 .last_sysupgrade_partition = "support-list",
414 },
415
416 /** Firmware layout for the CPE510 V3 */
417 {
418 .id = "CPE510V3",
419 .vendor = "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
420 .support_list =
421 "SupportList:\r\n"
422 "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
423 "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
424 "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
425 "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
426 "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
427 "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
428 "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
429 "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
430 "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
431 "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
432 "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
433 "CPE510(TP-LINK|US|N300-5):3.0\r\n"
434 "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
435 "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
436 "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
437 .part_trail = 0xff,
438 .soft_ver = NULL,
439
440 .partitions = {
441 {"fs-uboot", 0x00000, 0x20000},
442 {"partition-table", 0x20000, 0x02000},
443 {"default-mac", 0x30000, 0x00020},
444 {"product-info", 0x31100, 0x00100},
445 {"signature", 0x32000, 0x00400},
446 {"os-image", 0x40000, 0x300000},
447 {"file-system", 0x340000, 0x470000},
448 {"soft-version", 0x7b0000, 0x00100},
449 {"support-list", 0x7b1000, 0x00400},
450 {"user-config", 0x7c0000, 0x10000},
451 {"default-config", 0x7d0000, 0x10000},
452 {"log", 0x7e0000, 0x10000},
453 {"radio", 0x7f0000, 0x10000},
454 {NULL, 0, 0}
455 },
456
457 .first_sysupgrade_partition = "os-image",
458 .last_sysupgrade_partition = "support-list",
459 },
460
461 /** Firmware layout for the CPE610V1 */
462 {
463 .id = "CPE610V1",
464 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n",
465 .support_list =
466 "SupportList:\r\n"
467 "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n"
468 "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n"
469 "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n"
470 "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n"
471 "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n"
472 "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n"
473 "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n"
474 "CPE610(TP-LINK|UN|N300-5):1.0\r\n"
475 "CPE610(TP-LINK|EU|N300-5):1.0\r\n"
476 "CPE610(TP-LINK|US|N300-5):1.0\r\n",
477 .part_trail = 0xff,
478 .soft_ver = NULL,
479
480 .partitions = {
481 {"fs-uboot", 0x00000, 0x20000},
482 {"partition-table", 0x20000, 0x02000},
483 {"default-mac", 0x30000, 0x00020},
484 {"product-info", 0x31100, 0x00100},
485 {"signature", 0x32000, 0x00400},
486 {"os-image", 0x40000, 0x300000},
487 {"file-system", 0x340000, 0x470000},
488 {"soft-version", 0x7b0000, 0x00100},
489 {"support-list", 0x7b1000, 0x00400},
490 {"user-config", 0x7c0000, 0x10000},
491 {"default-config", 0x7d0000, 0x10000},
492 {"log", 0x7e0000, 0x10000},
493 {"radio", 0x7f0000, 0x10000},
494 {NULL, 0, 0}
495 },
496
497 .first_sysupgrade_partition = "os-image",
498 .last_sysupgrade_partition = "support-list",
499 },
500
501 /** Firmware layout for the CPE610V2 */
502 {
503 .id = "CPE610V2",
504 .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n",
505 .support_list =
506 "SupportList:\r\n"
507 "CPE610(TP-LINK|EU|N300-5|00000000):2.0\r\n"
508 "CPE610(TP-LINK|EU|N300-5|45550000):2.0\r\n"
509 "CPE610(TP-LINK|EU|N300-5|55530000):2.0\r\n"
510 "CPE610(TP-LINK|UN|N300-5|00000000):2.0\r\n"
511 "CPE610(TP-LINK|UN|N300-5|45550000):2.0\r\n"
512 "CPE610(TP-LINK|UN|N300-5|55530000):2.0\r\n"
513 "CPE610(TP-LINK|US|N300-5|55530000):2.0\r\n"
514 "CPE610(TP-LINK|UN|N300-5):2.0\r\n"
515 "CPE610(TP-LINK|EU|N300-5):2.0\r\n"
516 "CPE610(TP-LINK|US|N300-5):2.0\r\n",
517 .part_trail = 0xff,
518 .soft_ver = NULL,
519
520 .partitions = {
521 {"fs-uboot", 0x00000, 0x20000},
522 {"partition-table", 0x20000, 0x02000},
523 {"default-mac", 0x30000, 0x00020},
524 {"product-info", 0x31100, 0x00100},
525 {"signature", 0x32000, 0x00400},
526 {"os-image", 0x40000, 0x300000},
527 {"file-system", 0x340000, 0x470000},
528 {"soft-version", 0x7b0000, 0x00100},
529 {"support-list", 0x7b1000, 0x00400},
530 {"user-config", 0x7c0000, 0x10000},
531 {"default-config", 0x7d0000, 0x10000},
532 {"log", 0x7e0000, 0x10000},
533 {"radio", 0x7f0000, 0x10000},
534 {NULL, 0, 0}
535 },
536
537 .first_sysupgrade_partition = "os-image",
538 .last_sysupgrade_partition = "support-list",
539 },
540
541 {
542 .id = "WBS210",
543 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
544 .support_list =
545 "SupportList:\r\n"
546 "WBS210(TP-LINK|UN|N300-2):1.20\r\n"
547 "WBS210(TP-LINK|US|N300-2):1.20\r\n"
548 "WBS210(TP-LINK|EU|N300-2):1.20\r\n",
549 .part_trail = 0xff,
550 .soft_ver = NULL,
551
552 .partitions = {
553 {"fs-uboot", 0x00000, 0x20000},
554 {"partition-table", 0x20000, 0x02000},
555 {"default-mac", 0x30000, 0x00020},
556 {"product-info", 0x31100, 0x00100},
557 {"signature", 0x32000, 0x00400},
558 {"os-image", 0x40000, 0x300000},
559 {"file-system", 0x340000, 0x470000},
560 {"soft-version", 0x7b0000, 0x00100},
561 {"support-list", 0x7b1000, 0x00400},
562 {"user-config", 0x7c0000, 0x10000},
563 {"default-config", 0x7d0000, 0x10000},
564 {"log", 0x7e0000, 0x10000},
565 {"radio", 0x7f0000, 0x10000},
566 {NULL, 0, 0}
567 },
568
569 .first_sysupgrade_partition = "os-image",
570 .last_sysupgrade_partition = "support-list",
571 },
572
573 {
574 .id = "WBS210V2",
575 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
576 .support_list =
577 "SupportList:\r\n"
578 "WBS210(TP-LINK|UN|N300-2|00000000):2.0\r\n"
579 "WBS210(TP-LINK|US|N300-2|55530000):2.0\r\n"
580 "WBS210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
581 .part_trail = 0xff,
582 .soft_ver = NULL,
583
584 .partitions = {
585 {"fs-uboot", 0x00000, 0x20000},
586 {"partition-table", 0x20000, 0x02000},
587 {"default-mac", 0x30000, 0x00020},
588 {"product-info", 0x31100, 0x00100},
589 {"signature", 0x32000, 0x00400},
590 {"os-image", 0x40000, 0x300000},
591 {"file-system", 0x340000, 0x470000},
592 {"soft-version", 0x7b0000, 0x00100},
593 {"support-list", 0x7b1000, 0x00400},
594 {"user-config", 0x7c0000, 0x10000},
595 {"default-config", 0x7d0000, 0x10000},
596 {"log", 0x7e0000, 0x10000},
597 {"radio", 0x7f0000, 0x10000},
598 {NULL, 0, 0}
599 },
600
601 .first_sysupgrade_partition = "os-image",
602 .last_sysupgrade_partition = "support-list",
603 },
604
605 {
606 .id = "WBS510",
607 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
608 .support_list =
609 "SupportList:\r\n"
610 "WBS510(TP-LINK|UN|N300-5):1.20\r\n"
611 "WBS510(TP-LINK|US|N300-5):1.20\r\n"
612 "WBS510(TP-LINK|EU|N300-5):1.20\r\n"
613 "WBS510(TP-LINK|CA|N300-5):1.20\r\n",
614 .part_trail = 0xff,
615 .soft_ver = NULL,
616
617 .partitions = {
618 {"fs-uboot", 0x00000, 0x20000},
619 {"partition-table", 0x20000, 0x02000},
620 {"default-mac", 0x30000, 0x00020},
621 {"product-info", 0x31100, 0x00100},
622 {"signature", 0x32000, 0x00400},
623 {"os-image", 0x40000, 0x300000},
624 {"file-system", 0x340000, 0x470000},
625 {"soft-version", 0x7b0000, 0x00100},
626 {"support-list", 0x7b1000, 0x00400},
627 {"user-config", 0x7c0000, 0x10000},
628 {"default-config", 0x7d0000, 0x10000},
629 {"log", 0x7e0000, 0x10000},
630 {"radio", 0x7f0000, 0x10000},
631 {NULL, 0, 0}
632 },
633
634 .first_sysupgrade_partition = "os-image",
635 .last_sysupgrade_partition = "support-list",
636 },
637
638 {
639 .id = "WBS510V2",
640 .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
641 .support_list =
642 "SupportList:\r\n"
643 "WBS510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
644 "WBS510(TP-LINK|US|N300-5|55530000):2.0\r\n"
645 "WBS510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
646 "WBS510(TP-LINK|CA|N300-5|43410000):2.0\r\n",
647 .part_trail = 0xff,
648 .soft_ver = NULL,
649
650 .partitions = {
651 {"fs-uboot", 0x00000, 0x20000},
652 {"partition-table", 0x20000, 0x02000},
653 {"default-mac", 0x30000, 0x00020},
654 {"product-info", 0x31100, 0x00100},
655 {"signature", 0x32000, 0x00400},
656 {"os-image", 0x40000, 0x300000},
657 {"file-system", 0x340000, 0x470000},
658 {"soft-version", 0x7b0000, 0x00100},
659 {"support-list", 0x7b1000, 0x00400},
660 {"user-config", 0x7c0000, 0x10000},
661 {"default-config", 0x7d0000, 0x10000},
662 {"log", 0x7e0000, 0x10000},
663 {"radio", 0x7f0000, 0x10000},
664 {NULL, 0, 0}
665 },
666
667 .first_sysupgrade_partition = "os-image",
668 .last_sysupgrade_partition = "support-list",
669 },
670
671 /** Firmware layout for the AD7200 */
672 {
673 .id = "AD7200",
674 .vendor = "",
675 .support_list =
676 "SupportList:\r\n"
677 "{product_name:Talon AD7200,product_ver:1.0.0,special_id:00000000}\r\n",
678 .part_trail = 0x00,
679 .soft_ver = NULL,
680
681 .partitions = {
682 {"SBL1", 0x00000, 0x20000},
683 {"MIBIB", 0x20000, 0x20000},
684 {"SBL2", 0x40000, 0x20000},
685 {"SBL3", 0x60000, 0x30000},
686 {"DDRCONFIG", 0x90000, 0x10000},
687 {"SSD", 0xa0000, 0x10000},
688 {"TZ", 0xb0000, 0x30000},
689 {"RPM", 0xe0000, 0x20000},
690 {"fs-uboot", 0x100000, 0x70000},
691 {"uboot-env", 0x170000, 0x40000},
692 {"radio", 0x1b0000, 0x40000},
693 {"os-image", 0x1f0000, 0x400000},
694 {"file-system", 0x5f0000, 0x1900000},
695 {"default-mac", 0x1ef0000, 0x00200},
696 {"pin", 0x1ef0200, 0x00200},
697 {"device-id", 0x1ef0400, 0x00200},
698 {"product-info", 0x1ef0600, 0x0fa00},
699 {"partition-table", 0x1f00000, 0x10000},
700 {"soft-version", 0x1f10000, 0x10000},
701 {"support-list", 0x1f20000, 0x10000},
702 {"profile", 0x1f30000, 0x10000},
703 {"default-config", 0x1f40000, 0x10000},
704 {"user-config", 0x1f50000, 0x40000},
705 {"qos-db", 0x1f90000, 0x40000},
706 {"usb-config", 0x1fd0000, 0x10000},
707 {"log", 0x1fe0000, 0x20000},
708 {NULL, 0, 0}
709 },
710
711 .first_sysupgrade_partition = "os-image",
712 .last_sysupgrade_partition = "file-system"
713 },
714
715 /** Firmware layout for the C2600 */
716 {
717 .id = "C2600",
718 .vendor = "",
719 .support_list =
720 "SupportList:\r\n"
721 "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
722 .part_trail = 0x00,
723 .soft_ver = NULL,
724
725 /**
726 We use a bigger os-image partition than the stock images (and thus
727 smaller file-system), as our kernel doesn't fit in the stock firmware's
728 2 MB os-image since kernel 4.14.
729 */
730 .partitions = {
731 {"SBL1", 0x00000, 0x20000},
732 {"MIBIB", 0x20000, 0x20000},
733 {"SBL2", 0x40000, 0x20000},
734 {"SBL3", 0x60000, 0x30000},
735 {"DDRCONFIG", 0x90000, 0x10000},
736 {"SSD", 0xa0000, 0x10000},
737 {"TZ", 0xb0000, 0x30000},
738 {"RPM", 0xe0000, 0x20000},
739 {"fs-uboot", 0x100000, 0x70000},
740 {"uboot-env", 0x170000, 0x40000},
741 {"radio", 0x1b0000, 0x40000},
742 {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */
743 {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */
744 {"default-mac", 0x1ef0000, 0x00200},
745 {"pin", 0x1ef0200, 0x00200},
746 {"product-info", 0x1ef0400, 0x0fc00},
747 {"partition-table", 0x1f00000, 0x10000},
748 {"soft-version", 0x1f10000, 0x10000},
749 {"support-list", 0x1f20000, 0x10000},
750 {"profile", 0x1f30000, 0x10000},
751 {"default-config", 0x1f40000, 0x10000},
752 {"user-config", 0x1f50000, 0x40000},
753 {"qos-db", 0x1f90000, 0x40000},
754 {"usb-config", 0x1fd0000, 0x10000},
755 {"log", 0x1fe0000, 0x20000},
756 {NULL, 0, 0}
757 },
758
759 .first_sysupgrade_partition = "os-image",
760 .last_sysupgrade_partition = "file-system"
761 },
762
763 /** Firmware layout for the A7-V5 */
764 {
765 .id = "ARCHER-A7-V5",
766 .support_list =
767 "SupportList:\n"
768 "{product_name:Archer A7,product_ver:5.0.0,special_id:45550000}\n"
769 "{product_name:Archer A7,product_ver:5.0.0,special_id:55530000}\n"
770 "{product_name:Archer A7,product_ver:5.0.0,special_id:43410000}\n"
771 "{product_name:Archer A7,product_ver:5.0.0,special_id:4A500000}\n"
772 "{product_name:Archer A7,product_ver:5.0.0,special_id:54570000}\n",
773 .part_trail = 0x00,
774 .soft_ver = "soft_ver:1.0.0\n",
775
776 /* We're using a dynamic kernel/rootfs split here */
777 .partitions = {
778 {"factory-boot", 0x00000, 0x20000},
779 {"fs-uboot", 0x20000, 0x20000},
780 {"firmware", 0x40000, 0xec0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
781 /* Stock: name file-system base 0x160000 size 0xda0000 */
782 {"default-mac", 0xf40000, 0x00200},
783 {"pin", 0xf40200, 0x00200},
784 {"device-id", 0xf40400, 0x00100},
785 {"product-info", 0xf40500, 0x0fb00},
786 {"soft-version", 0xf50000, 0x00100},
787 {"extra-para", 0xf51000, 0x01000},
788 {"support-list", 0xf52000, 0x0a000},
789 {"profile", 0xf5c000, 0x04000},
790 {"default-config", 0xf60000, 0x10000},
791 {"user-config", 0xf70000, 0x40000},
792 {"certificate", 0xfb0000, 0x10000},
793 {"partition-table", 0xfc0000, 0x10000},
794 {"log", 0xfd0000, 0x20000},
795 {"radio", 0xff0000, 0x10000},
796 {NULL, 0, 0}
797 },
798
799 .first_sysupgrade_partition = "os-image",
800 .last_sysupgrade_partition = "file-system",
801 },
802
803 /** Firmware layout for the C2v3 */
804 {
805 .id = "ARCHER-C2-V3",
806 .support_list =
807 "SupportList:\n"
808 "{product_name:ArcherC2,product_ver:3.0.0,special_id:00000000}\n"
809 "{product_name:ArcherC2,product_ver:3.0.0,special_id:55530000}\n"
810 "{product_name:ArcherC2,product_ver:3.0.0,special_id:45550000}\n",
811 .part_trail = 0x00,
812 .soft_ver = "soft_ver:3.0.1\n",
813
814 /** We're using a dynamic kernel/rootfs split here */
815
816 .partitions = {
817 {"factory-boot", 0x00000, 0x20000},
818 {"fs-uboot", 0x20000, 0x10000},
819 {"firmware", 0x30000, 0x7a0000},
820 {"user-config", 0x7d0000, 0x04000},
821 {"default-mac", 0x7e0000, 0x00100},
822 {"device-id", 0x7e0100, 0x00100},
823 {"extra-para", 0x7e0200, 0x00100},
824 {"pin", 0x7e0300, 0x00100},
825 {"support-list", 0x7e0400, 0x00400},
826 {"soft-version", 0x7e0800, 0x00400},
827 {"product-info", 0x7e0c00, 0x01400},
828 {"partition-table", 0x7e2000, 0x01000},
829 {"profile", 0x7e3000, 0x01000},
830 {"default-config", 0x7e4000, 0x04000},
831 {"merge-config", 0x7ec000, 0x02000},
832 {"qos-db", 0x7ee000, 0x02000},
833 {"radio", 0x7f0000, 0x10000},
834 {NULL, 0, 0}
835 },
836
837 .first_sysupgrade_partition = "os-image",
838 .last_sysupgrade_partition = "file-system",
839 },
840
841 /** Firmware layout for the C25v1 */
842 {
843 .id = "ARCHER-C25-V1",
844 .support_list =
845 "SupportList:\n"
846 "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
847 "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
848 "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
849 .part_trail = 0x00,
850 .soft_ver = "soft_ver:1.0.0\n",
851
852 /* We're using a dynamic kernel/rootfs split here */
853 .partitions = {
854 {"factory-boot", 0x00000, 0x20000},
855 {"fs-uboot", 0x20000, 0x10000},
856 {"firmware", 0x30000, 0x7a0000}, /* Stock: name os-image base 0x30000 size 0x100000 */
857 /* Stock: name file-system base 0x130000 size 0x6a0000 */
858 {"user-config", 0x7d0000, 0x04000},
859 {"default-mac", 0x7e0000, 0x00100},
860 {"device-id", 0x7e0100, 0x00100},
861 {"extra-para", 0x7e0200, 0x00100},
862 {"pin", 0x7e0300, 0x00100},
863 {"support-list", 0x7e0400, 0x00400},
864 {"soft-version", 0x7e0800, 0x00400},
865 {"product-info", 0x7e0c00, 0x01400},
866 {"partition-table", 0x7e2000, 0x01000},
867 {"profile", 0x7e3000, 0x01000},
868 {"default-config", 0x7e4000, 0x04000},
869 {"merge-config", 0x7ec000, 0x02000},
870 {"qos-db", 0x7ee000, 0x02000},
871 {"radio", 0x7f0000, 0x10000},
872 {NULL, 0, 0}
873 },
874
875 .first_sysupgrade_partition = "os-image",
876 .last_sysupgrade_partition = "file-system",
877 },
878
879 /** Firmware layout for the C58v1 */
880 {
881 .id = "ARCHER-C58-V1",
882 .vendor = "",
883 .support_list =
884 "SupportList:\r\n"
885 "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
886 "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
887 "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
888 .part_trail = 0x00,
889 .soft_ver = "soft_ver:1.0.0\n",
890
891 .partitions = {
892 {"fs-uboot", 0x00000, 0x10000},
893 {"default-mac", 0x10000, 0x00200},
894 {"pin", 0x10200, 0x00200},
895 {"product-info", 0x10400, 0x00100},
896 {"partition-table", 0x10500, 0x00800},
897 {"soft-version", 0x11300, 0x00200},
898 {"support-list", 0x11500, 0x00100},
899 {"device-id", 0x11600, 0x00100},
900 {"profile", 0x11700, 0x03900},
901 {"default-config", 0x15000, 0x04000},
902 {"user-config", 0x19000, 0x04000},
903 {"firmware", 0x20000, 0x7c8000},
904 {"certyficate", 0x7e8000, 0x08000},
905 {"radio", 0x7f0000, 0x10000},
906 {NULL, 0, 0}
907 },
908
909 .first_sysupgrade_partition = "os-image",
910 .last_sysupgrade_partition = "file-system",
911 },
912
913 /** Firmware layout for the C59v1 */
914 {
915 .id = "ARCHER-C59-V1",
916 .vendor = "",
917 .support_list =
918 "SupportList:\r\n"
919 "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
920 "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
921 "{product_name:Archer C59,product_ver:1.0.0,special_id:52550000}\r\n"
922 "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
923 .part_trail = 0x00,
924 .soft_ver = "soft_ver:1.0.0\n",
925
926 /* We're using a dynamic kernel/rootfs split here */
927 .partitions = {
928 {"fs-uboot", 0x00000, 0x10000},
929 {"default-mac", 0x10000, 0x00200},
930 {"pin", 0x10200, 0x00200},
931 {"device-id", 0x10400, 0x00100},
932 {"product-info", 0x10500, 0x0fb00},
933 {"firmware", 0x20000, 0xe30000},
934 {"partition-table", 0xe50000, 0x10000},
935 {"soft-version", 0xe60000, 0x10000},
936 {"support-list", 0xe70000, 0x10000},
937 {"profile", 0xe80000, 0x10000},
938 {"default-config", 0xe90000, 0x10000},
939 {"user-config", 0xea0000, 0x40000},
940 {"usb-config", 0xee0000, 0x10000},
941 {"certificate", 0xef0000, 0x10000},
942 {"qos-db", 0xf00000, 0x40000},
943 {"log", 0xfe0000, 0x10000},
944 {"radio", 0xff0000, 0x10000},
945 {NULL, 0, 0}
946 },
947
948 .first_sysupgrade_partition = "os-image",
949 .last_sysupgrade_partition = "file-system",
950 },
951
952 /** Firmware layout for the C59v2 */
953 {
954 .id = "ARCHER-C59-V2",
955 .vendor = "",
956 .support_list =
957 "SupportList:\r\n"
958 "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
959 "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
960 "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
961 .part_trail = 0x00,
962 .soft_ver = "soft_ver:2.0.0 Build 20161206 rel.7303\n",
963
964 /** We're using a dynamic kernel/rootfs split here */
965 .partitions = {
966 {"factory-boot", 0x00000, 0x20000},
967 {"fs-uboot", 0x20000, 0x10000},
968 {"default-mac", 0x30000, 0x00200},
969 {"pin", 0x30200, 0x00200},
970 {"device-id", 0x30400, 0x00100},
971 {"product-info", 0x30500, 0x0fb00},
972 {"firmware", 0x40000, 0xe10000},
973 {"partition-table", 0xe50000, 0x10000},
974 {"soft-version", 0xe60000, 0x10000},
975 {"support-list", 0xe70000, 0x10000},
976 {"profile", 0xe80000, 0x10000},
977 {"default-config", 0xe90000, 0x10000},
978 {"user-config", 0xea0000, 0x40000},
979 {"usb-config", 0xee0000, 0x10000},
980 {"certificate", 0xef0000, 0x10000},
981 {"extra-para", 0xf00000, 0x10000},
982 {"qos-db", 0xf10000, 0x30000},
983 {"log", 0xfe0000, 0x10000},
984 {"radio", 0xff0000, 0x10000},
985 {NULL, 0, 0}
986 },
987
988 .first_sysupgrade_partition = "os-image",
989 .last_sysupgrade_partition = "file-system",
990 },
991
992 /** Firmware layout for the Archer C6 v2 (EU/RU/JP) */
993 {
994 .id = "ARCHER-C6-V2",
995 .vendor = "",
996 .support_list =
997 "SupportList:\r\n"
998 "{product_name:Archer C6,product_ver:2.0.0,special_id:45550000}\r\n"
999 "{product_name:Archer C6,product_ver:2.0.0,special_id:52550000}\r\n"
1000 "{product_name:Archer C6,product_ver:2.0.0,special_id:4A500000}\r\n",
1001 .part_trail = 0x00,
1002 .soft_ver = "soft_ver:1.9.1\n",
1003
1004 .partitions = {
1005 {"fs-uboot", 0x00000, 0x20000},
1006 {"default-mac", 0x20000, 0x00200},
1007 {"pin", 0x20200, 0x00100},
1008 {"product-info", 0x20300, 0x00200},
1009 {"device-id", 0x20500, 0x0fb00},
1010 {"firmware", 0x30000, 0x7a9400},
1011 {"soft-version", 0x7d9400, 0x00100},
1012 {"extra-para", 0x7d9500, 0x00100},
1013 {"support-list", 0x7d9600, 0x00200},
1014 {"profile", 0x7d9800, 0x03000},
1015 {"default-config", 0x7dc800, 0x03000},
1016 {"partition-table", 0x7df800, 0x00800},
1017 {"user-config", 0x7e0000, 0x0c000},
1018 {"certificate", 0x7ec000, 0x04000},
1019 {"radio", 0x7f0000, 0x10000},
1020 {NULL, 0, 0}
1021 },
1022
1023 .first_sysupgrade_partition = "os-image",
1024 .last_sysupgrade_partition = "file-system",
1025 },
1026
1027 /** Firmware layout for the Archer C6 v2 (US) and A6 v2 (US/TW) */
1028 {
1029 .id = "ARCHER-C6-V2-US",
1030 .vendor = "",
1031 .support_list =
1032 "SupportList:\n"
1033 "{product_name:Archer A6,product_ver:2.0.0,special_id:55530000}\n"
1034 "{product_name:Archer A6,product_ver:2.0.0,special_id:54570000}\n"
1035 "{product_name:Archer C6,product_ver:2.0.0,special_id:55530000}\n",
1036 .part_trail = 0x00,
1037 .soft_ver = "soft_ver:1.9.1\n",
1038
1039 .partitions = {
1040 {"factory-boot", 0x00000, 0x20000},
1041 {"default-mac", 0x20000, 0x00200},
1042 {"pin", 0x20200, 0x00100},
1043 {"product-info", 0x20300, 0x00200},
1044 {"device-id", 0x20500, 0x0fb00},
1045 {"fs-uboot", 0x30000, 0x20000},
1046 {"firmware", 0x50000, 0xf89400},
1047 {"soft-version", 0xfd9400, 0x00100},
1048 {"extra-para", 0xfd9500, 0x00100},
1049 {"support-list", 0xfd9600, 0x00200},
1050 {"profile", 0xfd9800, 0x03000},
1051 {"default-config", 0xfdc800, 0x03000},
1052 {"partition-table", 0xfdf800, 0x00800},
1053 {"user-config", 0xfe0000, 0x0c000},
1054 {"certificate", 0xfec000, 0x04000},
1055 {"radio", 0xff0000, 0x10000},
1056 {NULL, 0, 0}
1057 },
1058 .first_sysupgrade_partition = "os-image",
1059 .last_sysupgrade_partition = "file-system",
1060 },
1061
1062 /** Firmware layout for the C60v1 */
1063 {
1064 .id = "ARCHER-C60-V1",
1065 .vendor = "",
1066 .support_list =
1067 "SupportList:\r\n"
1068 "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
1069 "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
1070 "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
1071 .part_trail = 0x00,
1072 .soft_ver = "soft_ver:1.0.0\n",
1073
1074 .partitions = {
1075 {"fs-uboot", 0x00000, 0x10000},
1076 {"default-mac", 0x10000, 0x00200},
1077 {"pin", 0x10200, 0x00200},
1078 {"product-info", 0x10400, 0x00100},
1079 {"partition-table", 0x10500, 0x00800},
1080 {"soft-version", 0x11300, 0x00200},
1081 {"support-list", 0x11500, 0x00100},
1082 {"device-id", 0x11600, 0x00100},
1083 {"profile", 0x11700, 0x03900},
1084 {"default-config", 0x15000, 0x04000},
1085 {"user-config", 0x19000, 0x04000},
1086 {"firmware", 0x20000, 0x7c8000},
1087 {"certyficate", 0x7e8000, 0x08000},
1088 {"radio", 0x7f0000, 0x10000},
1089 {NULL, 0, 0}
1090 },
1091
1092 .first_sysupgrade_partition = "os-image",
1093 .last_sysupgrade_partition = "file-system",
1094 },
1095
1096 /** Firmware layout for the C60v2 */
1097 {
1098 .id = "ARCHER-C60-V2",
1099 .vendor = "",
1100 .support_list =
1101 "SupportList:\r\n"
1102 "{product_name:Archer C60,product_ver:2.0.0,special_id:42520000}\r\n"
1103 "{product_name:Archer C60,product_ver:2.0.0,special_id:45550000}\r\n"
1104 "{product_name:Archer C60,product_ver:2.0.0,special_id:55530000}\r\n",
1105 .part_trail = 0x00,
1106 .soft_ver = "soft_ver:2.0.0\n",
1107
1108 .partitions = {
1109 {"factory-boot", 0x00000, 0x1fb00},
1110 {"default-mac", 0x1fb00, 0x00200},
1111 {"pin", 0x1fd00, 0x00100},
1112 {"product-info", 0x1fe00, 0x00100},
1113 {"device-id", 0x1ff00, 0x00100},
1114 {"fs-uboot", 0x20000, 0x10000},
1115 {"firmware", 0x30000, 0x7a0000},
1116 {"soft-version", 0x7d9500, 0x00100},
1117 {"support-list", 0x7d9600, 0x00100},
1118 {"extra-para", 0x7d9700, 0x00100},
1119 {"profile", 0x7d9800, 0x03000},
1120 {"default-config", 0x7dc800, 0x03000},
1121 {"partition-table", 0x7df800, 0x00800},
1122 {"user-config", 0x7e0000, 0x0c000},
1123 {"certificate", 0x7ec000, 0x04000},
1124 {"radio", 0x7f0000, 0x10000},
1125 {NULL, 0, 0}
1126 },
1127
1128 .first_sysupgrade_partition = "os-image",
1129 .last_sysupgrade_partition = "file-system",
1130 },
1131
1132 /** Firmware layout for the C60v3 */
1133 {
1134 .id = "ARCHER-C60-V3",
1135 .vendor = "",
1136 .support_list =
1137 "SupportList:\r\n"
1138 "{product_name:Archer C60,product_ver:3.0.0,special_id:42520000}\r\n"
1139 "{product_name:Archer C60,product_ver:3.0.0,special_id:45550000}\r\n"
1140 "{product_name:Archer C60,product_ver:3.0.0,special_id:55530000}\r\n",
1141 .part_trail = 0x00,
1142 .soft_ver = "soft_ver:3.0.0\n",
1143
1144 .partitions = {
1145 {"factory-boot", 0x00000, 0x1fb00},
1146 {"default-mac", 0x1fb00, 0x00200},
1147 {"pin", 0x1fd00, 0x00100},
1148 {"product-info", 0x1fe00, 0x00100},
1149 {"device-id", 0x1ff00, 0x00100},
1150 {"fs-uboot", 0x20000, 0x10000},
1151 {"firmware", 0x30000, 0x7a0000},
1152 {"soft-version", 0x7d9500, 0x00100},
1153 {"support-list", 0x7d9600, 0x00100},
1154 {"extra-para", 0x7d9700, 0x00100},
1155 {"profile", 0x7d9800, 0x03000},
1156 {"default-config", 0x7dc800, 0x03000},
1157 {"partition-table", 0x7df800, 0x00800},
1158 {"user-config", 0x7e0000, 0x0c000},
1159 {"certificate", 0x7ec000, 0x04000},
1160 {"radio", 0x7f0000, 0x10000},
1161 {NULL, 0, 0}
1162 },
1163
1164 .first_sysupgrade_partition = "os-image",
1165 .last_sysupgrade_partition = "file-system",
1166 },
1167
1168 /** Firmware layout for the C5 */
1169 {
1170 .id = "ARCHER-C5-V2",
1171 .vendor = "",
1172 .support_list =
1173 "SupportList:\r\n"
1174 "{product_name:ArcherC5,product_ver:2.0.0,special_id:00000000}\r\n"
1175 "{product_name:ArcherC5,product_ver:2.0.0,special_id:55530000}\r\n"
1176 "{product_name:ArcherC5,product_ver:2.0.0,special_id:4A500000}\r\n", /* JP version */
1177 .part_trail = 0x00,
1178 .soft_ver = NULL,
1179
1180 .partitions = {
1181 {"fs-uboot", 0x00000, 0x40000},
1182 {"os-image", 0x40000, 0x200000},
1183 {"file-system", 0x240000, 0xc00000},
1184 {"default-mac", 0xe40000, 0x00200},
1185 {"pin", 0xe40200, 0x00200},
1186 {"product-info", 0xe40400, 0x00200},
1187 {"partition-table", 0xe50000, 0x10000},
1188 {"soft-version", 0xe60000, 0x00200},
1189 {"support-list", 0xe61000, 0x0f000},
1190 {"profile", 0xe70000, 0x10000},
1191 {"default-config", 0xe80000, 0x10000},
1192 {"user-config", 0xe90000, 0x50000},
1193 {"log", 0xee0000, 0x100000},
1194 {"radio_bk", 0xfe0000, 0x10000},
1195 {"radio", 0xff0000, 0x10000},
1196 {NULL, 0, 0}
1197 },
1198
1199 .first_sysupgrade_partition = "os-image",
1200 .last_sysupgrade_partition = "file-system"
1201 },
1202
1203 /** Firmware layout for the C7 */
1204 {
1205 .id = "ARCHER-C7-V4",
1206 .support_list =
1207 "SupportList:\n"
1208 "{product_name:Archer C7,product_ver:4.0.0,special_id:00000000}\n"
1209 "{product_name:Archer C7,product_ver:4.0.0,special_id:41550000}\n"
1210 "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
1211 "{product_name:Archer C7,product_ver:4.0.0,special_id:4B520000}\n"
1212 "{product_name:Archer C7,product_ver:4.0.0,special_id:42520000}\n"
1213 "{product_name:Archer C7,product_ver:4.0.0,special_id:4A500000}\n"
1214 "{product_name:Archer C7,product_ver:4.0.0,special_id:52550000}\n"
1215 "{product_name:Archer C7,product_ver:4.0.0,special_id:54570000}\n"
1216 "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
1217 "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
1218 .part_trail = 0x00,
1219 .soft_ver = "soft_ver:1.0.0\n",
1220
1221 /* We're using a dynamic kernel/rootfs split here */
1222 .partitions = {
1223 {"factory-boot", 0x00000, 0x20000},
1224 {"fs-uboot", 0x20000, 0x20000},
1225 {"firmware", 0x40000, 0xEC0000}, /* Stock: name os-image base 0x40000 size 0x120000 */
1226 /* Stock: name file-system base 0x160000 size 0xda0000 */
1227 {"default-mac", 0xf00000, 0x00200},
1228 {"pin", 0xf00200, 0x00200},
1229 {"device-id", 0xf00400, 0x00100},
1230 {"product-info", 0xf00500, 0x0fb00},
1231 {"soft-version", 0xf10000, 0x00100},
1232 {"extra-para", 0xf11000, 0x01000},
1233 {"support-list", 0xf12000, 0x0a000},
1234 {"profile", 0xf1c000, 0x04000},
1235 {"default-config", 0xf20000, 0x10000},
1236 {"user-config", 0xf30000, 0x40000},
1237 {"qos-db", 0xf70000, 0x40000},
1238 {"certificate", 0xfb0000, 0x10000},
1239 {"partition-table", 0xfc0000, 0x10000},
1240 {"log", 0xfd0000, 0x20000},
1241 {"radio", 0xff0000, 0x10000},
1242 {NULL, 0, 0}
1243 },
1244
1245 .first_sysupgrade_partition = "os-image",
1246 .last_sysupgrade_partition = "file-system",
1247 },
1248
1249 /** Firmware layout for the C7 v5*/
1250 {
1251 .id = "ARCHER-C7-V5",
1252 .support_list =
1253 "SupportList:\n"
1254 "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n"
1255 "{product_name:Archer C7,product_ver:5.0.0,special_id:45550000}\n"
1256 "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n"
1257 "{product_name:Archer C7,product_ver:5.0.0,special_id:43410000}\n"
1258 "{product_name:Archer C7,product_ver:5.0.0,special_id:4A500000}\n"
1259 "{product_name:Archer C7,product_ver:5.0.0,special_id:54570000}\n"
1260 "{product_name:Archer C7,product_ver:5.0.0,special_id:52550000}\n"
1261 "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n",
1262
1263 .part_trail = 0x00,
1264 .soft_ver = "soft_ver:1.0.0\n",
1265
1266 /* We're using a dynamic kernel/rootfs split here */
1267 .partitions = {
1268 {"factory-boot", 0x00000, 0x20000},
1269 {"fs-uboot", 0x20000, 0x20000},
1270 {"partition-table", 0x40000, 0x10000},
1271 {"radio", 0x50000, 0x10000},
1272 {"default-mac", 0x60000, 0x00200},
1273 {"pin", 0x60200, 0x00200},
1274 {"device-id", 0x60400, 0x00100},
1275 {"product-info", 0x60500, 0x0fb00},
1276 {"soft-version", 0x70000, 0x01000},
1277 {"extra-para", 0x71000, 0x01000},
1278 {"support-list", 0x72000, 0x0a000},
1279 {"profile", 0x7c000, 0x04000},
1280 {"user-config", 0x80000, 0x40000},
1281
1282
1283 {"firmware", 0xc0000, 0xf00000}, /* Stock: name os-image base 0xc0000 size 0x120000 */
1284 /* Stock: name file-system base 0x1e0000 size 0xde0000 */
1285
1286 {"log", 0xfc0000, 0x20000},
1287 {"certificate", 0xfe0000, 0x10000},
1288 {"default-config", 0xff0000, 0x10000},
1289 {NULL, 0, 0}
1290
1291 },
1292
1293 .first_sysupgrade_partition = "os-image",
1294 .last_sysupgrade_partition = "file-system",
1295 },
1296
1297 /** Firmware layout for the C9 */
1298 {
1299 .id = "ARCHERC9",
1300 .vendor = "",
1301 .support_list =
1302 "SupportList:\n"
1303 "{product_name:ArcherC9,"
1304 "product_ver:1.0.0,"
1305 "special_id:00000000}\n",
1306 .part_trail = 0x00,
1307 .soft_ver = NULL,
1308
1309 .partitions = {
1310 {"fs-uboot", 0x00000, 0x40000},
1311 {"os-image", 0x40000, 0x200000},
1312 {"file-system", 0x240000, 0xc00000},
1313 {"default-mac", 0xe40000, 0x00200},
1314 {"pin", 0xe40200, 0x00200},
1315 {"product-info", 0xe40400, 0x00200},
1316 {"partition-table", 0xe50000, 0x10000},
1317 {"soft-version", 0xe60000, 0x00200},
1318 {"support-list", 0xe61000, 0x0f000},
1319 {"profile", 0xe70000, 0x10000},
1320 {"default-config", 0xe80000, 0x10000},
1321 {"user-config", 0xe90000, 0x50000},
1322 {"log", 0xee0000, 0x100000},
1323 {"radio_bk", 0xfe0000, 0x10000},
1324 {"radio", 0xff0000, 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 EAP120 */
1333 {
1334 .id = "EAP120",
1335 .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1336 .support_list =
1337 "SupportList:\r\n"
1338 "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
1339 .part_trail = 0xff,
1340 .soft_ver = NULL,
1341
1342 .partitions = {
1343 {"fs-uboot", 0x00000, 0x20000},
1344 {"partition-table", 0x20000, 0x02000},
1345 {"default-mac", 0x30000, 0x00020},
1346 {"support-list", 0x31000, 0x00100},
1347 {"product-info", 0x31100, 0x00100},
1348 {"soft-version", 0x32000, 0x00100},
1349 {"os-image", 0x40000, 0x180000},
1350 {"file-system", 0x1c0000, 0x600000},
1351 {"user-config", 0x7c0000, 0x10000},
1352 {"backup-config", 0x7d0000, 0x10000},
1353 {"log", 0x7e0000, 0x10000},
1354 {"radio", 0x7f0000, 0x10000},
1355 {NULL, 0, 0}
1356 },
1357
1358 .first_sysupgrade_partition = "os-image",
1359 .last_sysupgrade_partition = "file-system"
1360 },
1361
1362 /** Firmware layout for the EAP225-Outdoor v1 */
1363 {
1364 .id = "EAP225-OUTDOOR-V1",
1365 .support_list =
1366 "SupportList:\r\n"
1367 "EAP225-Outdoor(TP-Link|UN|AC1200-D):1.0\r\n",
1368 .part_trail = PART_TRAIL_NONE,
1369 .soft_ver = NULL,
1370 .soft_ver_compat_level = 1,
1371
1372 .partitions = {
1373 {"fs-uboot", 0x00000, 0x20000},
1374 {"partition-table", 0x20000, 0x02000},
1375 {"default-mac", 0x30000, 0x01000},
1376 {"support-list", 0x31000, 0x00100},
1377 {"product-info", 0x31100, 0x00400},
1378 {"soft-version", 0x32000, 0x00100},
1379 {"firmware", 0x40000, 0xd80000},
1380 {"user-config", 0xdc0000, 0x30000},
1381 {"mutil-log", 0xf30000, 0x80000},
1382 {"oops", 0xfb0000, 0x40000},
1383 {"radio", 0xff0000, 0x10000},
1384 {NULL, 0, 0}
1385 },
1386
1387 .first_sysupgrade_partition = "os-image",
1388 .last_sysupgrade_partition = "file-system"
1389 },
1390
1391 /** Firmware layout for the EAP225 v3 */
1392 {
1393 .id = "EAP225-V3",
1394 .support_list =
1395 "SupportList:\r\n"
1396 "EAP225(TP-Link|UN|AC1350-D):3.0\r\n",
1397 .part_trail = PART_TRAIL_NONE,
1398 .soft_ver = NULL,
1399 .soft_ver_compat_level = 1,
1400
1401 .partitions = {
1402 {"fs-uboot", 0x00000, 0x20000},
1403 {"partition-table", 0x20000, 0x02000},
1404 {"default-mac", 0x30000, 0x01000},
1405 {"support-list", 0x31000, 0x00100},
1406 {"product-info", 0x31100, 0x00400},
1407 {"soft-version", 0x32000, 0x00100},
1408 {"firmware", 0x40000, 0xd80000},
1409 {"user-config", 0xdc0000, 0x30000},
1410 {"mutil-log", 0xf30000, 0x80000},
1411 {"oops", 0xfb0000, 0x40000},
1412 {"radio", 0xff0000, 0x10000},
1413 {NULL, 0, 0}
1414 },
1415
1416 .first_sysupgrade_partition = "os-image",
1417 .last_sysupgrade_partition = "file-system"
1418 },
1419
1420 /** Firmware layout for the EAP225-Wall v2 */
1421 {
1422 .id = "EAP225-WALL-V2",
1423 .support_list =
1424 "SupportList:\r\n"
1425 "EAP225-Wall(TP-Link|UN|AC1200-D):2.0\r\n",
1426 .part_trail = PART_TRAIL_NONE,
1427 .soft_ver = NULL,
1428 .soft_ver_compat_level = 1,
1429
1430 .partitions = {
1431 {"fs-uboot", 0x00000, 0x20000},
1432 {"partition-table", 0x20000, 0x02000},
1433 {"default-mac", 0x30000, 0x01000},
1434 {"support-list", 0x31000, 0x00100},
1435 {"product-info", 0x31100, 0x00400},
1436 {"soft-version", 0x32000, 0x00100},
1437 {"firmware", 0x40000, 0xd80000},
1438 {"user-config", 0xdc0000, 0x30000},
1439 {"mutil-log", 0xf30000, 0x80000},
1440 {"oops", 0xfb0000, 0x40000},
1441 {"radio", 0xff0000, 0x10000},
1442 {NULL, 0, 0}
1443 },
1444
1445 .first_sysupgrade_partition = "os-image",
1446 .last_sysupgrade_partition = "file-system"
1447 },
1448
1449 /** Firmware layout for the EAP245 v1 */
1450 {
1451 .id = "EAP245-V1",
1452 .support_list =
1453 "SupportList:\r\n"
1454 "EAP245(TP-LINK|UN|AC1750-D):1.0\r\n",
1455 .part_trail = PART_TRAIL_NONE,
1456 .soft_ver = NULL,
1457
1458 .partitions = {
1459 {"fs-uboot", 0x00000, 0x20000},
1460 {"partition-table", 0x20000, 0x02000},
1461 {"default-mac", 0x30000, 0x01000},
1462 {"support-list", 0x31000, 0x00100},
1463 {"product-info", 0x31100, 0x00400},
1464 {"soft-version", 0x32000, 0x00100},
1465 {"firmware", 0x40000, 0xd80000},
1466 {"user-config", 0xdc0000, 0x30000},
1467 {"radio", 0xff0000, 0x10000},
1468 {NULL, 0, 0}
1469 },
1470
1471 .first_sysupgrade_partition = "os-image",
1472 .last_sysupgrade_partition = "file-system"
1473 },
1474
1475 /** Firmware layout for the EAP245 v3 */
1476 {
1477 .id = "EAP245-V3",
1478 .support_list =
1479 "SupportList:\r\n"
1480 "EAP245(TP-Link|UN|AC1750-D):3.0\r\n",
1481 .part_trail = PART_TRAIL_NONE,
1482 .soft_ver = NULL,
1483 .soft_ver_compat_level = 1,
1484
1485 /** Firmware partition with dynamic kernel/rootfs split */
1486 .partitions = {
1487 {"factroy-boot", 0x00000, 0x40000},
1488 {"fs-uboot", 0x40000, 0x40000},
1489 {"partition-table", 0x80000, 0x10000},
1490 {"default-mac", 0x90000, 0x01000},
1491 {"support-list", 0x91000, 0x00100},
1492 {"product-info", 0x91100, 0x00400},
1493 {"soft-version", 0x92000, 0x00100},
1494 {"radio", 0xa0000, 0x10000},
1495 {"extra-para", 0xb0000, 0x10000},
1496 {"firmware", 0xc0000, 0xe40000},
1497 {"config", 0xf00000, 0x30000},
1498 {"mutil-log", 0xf30000, 0x80000},
1499 {"oops", 0xfb0000, 0x40000},
1500 {NULL, 0, 0}
1501 },
1502
1503 .first_sysupgrade_partition = "os-image",
1504 .last_sysupgrade_partition = "file-system"
1505 },
1506
1507 /** Firmware layout for the TL-WA850RE v2 */
1508 {
1509 .id = "TLWA850REV2",
1510 .vendor = "",
1511 .support_list =
1512 "SupportList:\n"
1513 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
1514 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
1515 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
1516 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
1517 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
1518 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
1519 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
1520 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
1521 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
1522 "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
1523 .part_trail = 0x00,
1524 .soft_ver = NULL,
1525
1526 /**
1527 576KB were moved from file-system to os-image
1528 in comparison to the stock image
1529 */
1530 .partitions = {
1531 {"fs-uboot", 0x00000, 0x20000},
1532 {"firmware", 0x20000, 0x390000},
1533 {"partition-table", 0x3b0000, 0x02000},
1534 {"default-mac", 0x3c0000, 0x00020},
1535 {"pin", 0x3c0100, 0x00020},
1536 {"product-info", 0x3c1000, 0x01000},
1537 {"soft-version", 0x3c2000, 0x00100},
1538 {"support-list", 0x3c3000, 0x01000},
1539 {"profile", 0x3c4000, 0x08000},
1540 {"user-config", 0x3d0000, 0x10000},
1541 {"default-config", 0x3e0000, 0x10000},
1542 {"radio", 0x3f0000, 0x10000},
1543 {NULL, 0, 0}
1544 },
1545
1546 .first_sysupgrade_partition = "os-image",
1547 .last_sysupgrade_partition = "file-system"
1548 },
1549
1550 /** Firmware layout for the TL-WA855RE v1 */
1551 {
1552 .id = "TLWA855REV1",
1553 .vendor = "",
1554 .support_list =
1555 "SupportList:\n"
1556 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:00000000}\n"
1557 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:55530000}\n"
1558 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:45550000}\n"
1559 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4B520000}\n"
1560 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:42520000}\n"
1561 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:4A500000}\n"
1562 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:43410000}\n"
1563 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:41550000}\n"
1564 "{product_name:TL-WA855RE,product_ver:1.0.0,special_id:52550000}\n",
1565 .part_trail = 0x00,
1566 .soft_ver = NULL,
1567
1568 .partitions = {
1569 {"fs-uboot", 0x00000, 0x20000},
1570 {"os-image", 0x20000, 0x150000},
1571 {"file-system", 0x170000, 0x240000},
1572 {"partition-table", 0x3b0000, 0x02000},
1573 {"default-mac", 0x3c0000, 0x00020},
1574 {"pin", 0x3c0100, 0x00020},
1575 {"product-info", 0x3c1000, 0x01000},
1576 {"soft-version", 0x3c2000, 0x00100},
1577 {"support-list", 0x3c3000, 0x01000},
1578 {"profile", 0x3c4000, 0x08000},
1579 {"user-config", 0x3d0000, 0x10000},
1580 {"default-config", 0x3e0000, 0x10000},
1581 {"radio", 0x3f0000, 0x10000},
1582 {NULL, 0, 0}
1583 },
1584
1585 .first_sysupgrade_partition = "os-image",
1586 .last_sysupgrade_partition = "file-system"
1587 },
1588
1589 /** Firmware layout for the TL-WPA8630P v2 (EU)*/
1590 {
1591 .id = "TL-WPA8630P-V2.0-EU",
1592 .vendor = "",
1593 .support_list =
1594 "SupportList:\n"
1595 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
1596 .part_trail = 0x00,
1597 .soft_ver = NULL,
1598
1599 .partitions = {
1600 {"factory-uboot", 0x00000, 0x20000},
1601 {"fs-uboot", 0x20000, 0x20000},
1602 {"firmware", 0x40000, 0x5e0000},
1603 {"partition-table", 0x620000, 0x02000},
1604 {"default-mac", 0x630000, 0x00020},
1605 {"pin", 0x630100, 0x00020},
1606 {"device-id", 0x630200, 0x00030},
1607 {"product-info", 0x631100, 0x01000},
1608 {"extra-para", 0x632100, 0x01000},
1609 {"soft-version", 0x640000, 0x01000},
1610 {"support-list", 0x641000, 0x01000},
1611 {"profile", 0x642000, 0x08000},
1612 {"user-config", 0x650000, 0x10000},
1613 {"default-config", 0x660000, 0x10000},
1614 {"default-nvm", 0x670000, 0xc0000},
1615 {"default-pib", 0x730000, 0x40000},
1616 {"radio", 0x7f0000, 0x10000},
1617 {NULL, 0, 0}
1618 },
1619
1620 .first_sysupgrade_partition = "os-image",
1621 .last_sysupgrade_partition = "file-system"
1622 },
1623
1624 /** Firmware layout for the TL-WPA8630P v2 (INT)*/
1625 {
1626 .id = "TL-WPA8630P-V2-INT",
1627 .vendor = "",
1628 .support_list =
1629 "SupportList:\n"
1630 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
1631 "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
1632 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
1633 .part_trail = 0x00,
1634 .soft_ver = NULL,
1635
1636 .partitions = {
1637 {"factory-uboot", 0x00000, 0x20000},
1638 {"fs-uboot", 0x20000, 0x20000},
1639 {"firmware", 0x40000, 0x5e0000},
1640 {"partition-table", 0x620000, 0x02000},
1641 {"extra-para", 0x632100, 0x01000},
1642 {"soft-version", 0x640000, 0x01000},
1643 {"support-list", 0x641000, 0x01000},
1644 {"profile", 0x642000, 0x08000},
1645 {"user-config", 0x650000, 0x10000},
1646 {"default-config", 0x660000, 0x10000},
1647 {"default-nvm", 0x670000, 0xc0000},
1648 {"default-pib", 0x730000, 0x40000},
1649 {"default-mac", 0x7e0000, 0x00020},
1650 {"pin", 0x7e0100, 0x00020},
1651 {"device-id", 0x7e0200, 0x00030},
1652 {"product-info", 0x7e1100, 0x01000},
1653 {"radio", 0x7f0000, 0x10000},
1654 {NULL, 0, 0}
1655 },
1656
1657 .first_sysupgrade_partition = "os-image",
1658 .last_sysupgrade_partition = "file-system"
1659 },
1660
1661 /** Firmware layout for the TL-WPA8630P v2.1 (EU)*/
1662 {
1663 .id = "TL-WPA8630P-V2.1-EU",
1664 .vendor = "",
1665 .support_list =
1666 "SupportList:\n"
1667 "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:45550000}\n",
1668 .part_trail = 0x00,
1669 .soft_ver = NULL,
1670
1671 .partitions = {
1672 {"factory-uboot", 0x00000, 0x20000},
1673 {"fs-uboot", 0x20000, 0x20000},
1674 {"firmware", 0x40000, 0x5e0000},
1675 {"extra-para", 0x680000, 0x01000},
1676 {"product-info", 0x690000, 0x01000},
1677 {"partition-table", 0x6a0000, 0x02000},
1678 {"soft-version", 0x6b0000, 0x01000},
1679 {"support-list", 0x6b1000, 0x01000},
1680 {"profile", 0x6b2000, 0x08000},
1681 {"user-config", 0x6c0000, 0x10000},
1682 {"default-config", 0x6d0000, 0x10000},
1683 {"default-nvm", 0x6e0000, 0xc0000},
1684 {"default-pib", 0x7a0000, 0x40000},
1685 {"default-mac", 0x7e0000, 0x00020},
1686 {"pin", 0x7e0100, 0x00020},
1687 {"device-id", 0x7e0200, 0x00030},
1688 {"radio", 0x7f0000, 0x10000},
1689 {NULL, 0, 0}
1690 },
1691
1692 .first_sysupgrade_partition = "os-image",
1693 .last_sysupgrade_partition = "file-system"
1694 },
1695
1696 /** Firmware layout for the TL-WR1043 v5 */
1697 {
1698 .id = "TLWR1043NV5",
1699 .vendor = "",
1700 .support_list =
1701 "SupportList:\n"
1702 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
1703 "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
1704 .part_trail = 0x00,
1705 .soft_ver = "soft_ver:1.0.0\n",
1706 .partitions = {
1707 {"factory-boot", 0x00000, 0x20000},
1708 {"fs-uboot", 0x20000, 0x20000},
1709 {"firmware", 0x40000, 0xec0000},
1710 {"default-mac", 0xf00000, 0x00200},
1711 {"pin", 0xf00200, 0x00200},
1712 {"device-id", 0xf00400, 0x00100},
1713 {"product-info", 0xf00500, 0x0fb00},
1714 {"soft-version", 0xf10000, 0x01000},
1715 {"extra-para", 0xf11000, 0x01000},
1716 {"support-list", 0xf12000, 0x0a000},
1717 {"profile", 0xf1c000, 0x04000},
1718 {"default-config", 0xf20000, 0x10000},
1719 {"user-config", 0xf30000, 0x40000},
1720 {"qos-db", 0xf70000, 0x40000},
1721 {"certificate", 0xfb0000, 0x10000},
1722 {"partition-table", 0xfc0000, 0x10000},
1723 {"log", 0xfd0000, 0x20000},
1724 {"radio", 0xff0000, 0x10000},
1725 {NULL, 0, 0}
1726 },
1727 .first_sysupgrade_partition = "os-image",
1728 .last_sysupgrade_partition = "file-system"
1729 },
1730
1731 /** Firmware layout for the TL-WR1043 v4 */
1732 {
1733 .id = "TLWR1043NDV4",
1734 .vendor = "",
1735 .support_list =
1736 "SupportList:\n"
1737 "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
1738 .part_trail = 0x00,
1739 .soft_ver = NULL,
1740
1741 /* We're using a dynamic kernel/rootfs split here */
1742 .partitions = {
1743 {"fs-uboot", 0x00000, 0x20000},
1744 {"firmware", 0x20000, 0xf30000},
1745 {"default-mac", 0xf50000, 0x00200},
1746 {"pin", 0xf50200, 0x00200},
1747 {"product-info", 0xf50400, 0x0fc00},
1748 {"soft-version", 0xf60000, 0x0b000},
1749 {"support-list", 0xf6b000, 0x04000},
1750 {"profile", 0xf70000, 0x04000},
1751 {"default-config", 0xf74000, 0x0b000},
1752 {"user-config", 0xf80000, 0x40000},
1753 {"partition-table", 0xfc0000, 0x10000},
1754 {"log", 0xfd0000, 0x20000},
1755 {"radio", 0xff0000, 0x10000},
1756 {NULL, 0, 0}
1757 },
1758
1759 .first_sysupgrade_partition = "os-image",
1760 .last_sysupgrade_partition = "file-system"
1761 },
1762
1763 /** Firmware layout for the TL-WR902AC v1 */
1764 {
1765 .id = "TL-WR902AC-V1",
1766 .vendor = "",
1767 .support_list =
1768 "SupportList:\n"
1769 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:45550000}\n"
1770 "{product_name:TL-WR902AC,product_ver:1.0.0,special_id:55530000}\n",
1771 .part_trail = 0x00,
1772 .soft_ver = NULL,
1773
1774 /**
1775 384KB were moved from file-system to os-image
1776 in comparison to the stock image
1777 */
1778 .partitions = {
1779 {"fs-uboot", 0x00000, 0x20000},
1780 {"firmware", 0x20000, 0x730000},
1781 {"default-mac", 0x750000, 0x00200},
1782 {"pin", 0x750200, 0x00200},
1783 {"product-info", 0x750400, 0x0fc00},
1784 {"soft-version", 0x760000, 0x0b000},
1785 {"support-list", 0x76b000, 0x04000},
1786 {"profile", 0x770000, 0x04000},
1787 {"default-config", 0x774000, 0x0b000},
1788 {"user-config", 0x780000, 0x40000},
1789 {"partition-table", 0x7c0000, 0x10000},
1790 {"log", 0x7d0000, 0x20000},
1791 {"radio", 0x7f0000, 0x10000},
1792 {NULL, 0, 0}
1793 },
1794
1795 .first_sysupgrade_partition = "os-image",
1796 .last_sysupgrade_partition = "file-system",
1797 },
1798
1799 /** Firmware layout for the TL-WR942N V1 */
1800 {
1801 .id = "TLWR942NV1",
1802 .vendor = "",
1803 .support_list =
1804 "SupportList:\r\n"
1805 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
1806 "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
1807 .part_trail = 0x00,
1808 .soft_ver = NULL,
1809
1810 .partitions = {
1811 {"fs-uboot", 0x00000, 0x20000},
1812 {"firmware", 0x20000, 0xe20000},
1813 {"default-mac", 0xe40000, 0x00200},
1814 {"pin", 0xe40200, 0x00200},
1815 {"product-info", 0xe40400, 0x0fc00},
1816 {"partition-table", 0xe50000, 0x10000},
1817 {"soft-version", 0xe60000, 0x10000},
1818 {"support-list", 0xe70000, 0x10000},
1819 {"profile", 0xe80000, 0x10000},
1820 {"default-config", 0xe90000, 0x10000},
1821 {"user-config", 0xea0000, 0x40000},
1822 {"qos-db", 0xee0000, 0x40000},
1823 {"certificate", 0xf20000, 0x10000},
1824 {"usb-config", 0xfb0000, 0x10000},
1825 {"log", 0xfc0000, 0x20000},
1826 {"radio-bk", 0xfe0000, 0x10000},
1827 {"radio", 0xff0000, 0x10000},
1828 {NULL, 0, 0}
1829 },
1830
1831 .first_sysupgrade_partition = "os-image",
1832 .last_sysupgrade_partition = "file-system",
1833 },
1834
1835 /** Firmware layout for the RE200 v2 */
1836 {
1837 .id = "RE200-V2",
1838 .vendor = "",
1839 .support_list =
1840 "SupportList:\n"
1841 "{product_name:RE200,product_ver:2.0.0,special_id:00000000}\n"
1842 "{product_name:RE200,product_ver:2.0.0,special_id:41520000}\n"
1843 "{product_name:RE200,product_ver:2.0.0,special_id:41550000}\n"
1844 "{product_name:RE200,product_ver:2.0.0,special_id:42520000}\n"
1845 "{product_name:RE200,product_ver:2.0.0,special_id:43410000}\n"
1846 "{product_name:RE200,product_ver:2.0.0,special_id:45530000}\n"
1847 "{product_name:RE200,product_ver:2.0.0,special_id:45550000}\n"
1848 "{product_name:RE200,product_ver:2.0.0,special_id:49440000}\n"
1849 "{product_name:RE200,product_ver:2.0.0,special_id:4a500000}\n"
1850 "{product_name:RE200,product_ver:2.0.0,special_id:4b520000}\n"
1851 "{product_name:RE200,product_ver:2.0.0,special_id:52550000}\n"
1852 "{product_name:RE200,product_ver:2.0.0,special_id:54570000}\n"
1853 "{product_name:RE200,product_ver:2.0.0,special_id:55530000}\n",
1854 .part_trail = 0x00,
1855 .soft_ver = NULL,
1856
1857 .partitions = {
1858 {"fs-uboot", 0x00000, 0x20000},
1859 {"firmware", 0x20000, 0x7a0000},
1860 {"partition-table", 0x7c0000, 0x02000},
1861 {"default-mac", 0x7c2000, 0x00020},
1862 {"pin", 0x7c2100, 0x00020},
1863 {"product-info", 0x7c3100, 0x01000},
1864 {"soft-version", 0x7c4200, 0x01000},
1865 {"support-list", 0x7c5200, 0x01000},
1866 {"profile", 0x7c6200, 0x08000},
1867 {"config-info", 0x7ce200, 0x00400},
1868 {"user-config", 0x7d0000, 0x10000},
1869 {"default-config", 0x7e0000, 0x10000},
1870 {"radio", 0x7f0000, 0x10000},
1871 {NULL, 0, 0}
1872 },
1873
1874 .first_sysupgrade_partition = "os-image",
1875 .last_sysupgrade_partition = "file-system"
1876 },
1877
1878 /** Firmware layout for the RE200 v3 */
1879 {
1880 .id = "RE200-V3",
1881 .vendor = "",
1882 .support_list =
1883 "SupportList:\n"
1884 "{product_name:RE200,product_ver:3.0.0,special_id:00000000}\n"
1885 "{product_name:RE200,product_ver:3.0.0,special_id:41520000}\n"
1886 "{product_name:RE200,product_ver:3.0.0,special_id:41550000}\n"
1887 "{product_name:RE200,product_ver:3.0.0,special_id:42520000}\n"
1888 "{product_name:RE200,product_ver:3.0.0,special_id:43410000}\n"
1889 "{product_name:RE200,product_ver:3.0.0,special_id:45470000}\n"
1890 "{product_name:RE200,product_ver:3.0.0,special_id:45530000}\n"
1891 "{product_name:RE200,product_ver:3.0.0,special_id:45550000}\n"
1892 "{product_name:RE200,product_ver:3.0.0,special_id:49440000}\n"
1893 "{product_name:RE200,product_ver:3.0.0,special_id:4A500000}\n"
1894 "{product_name:RE200,product_ver:3.0.0,special_id:4B520000}\n"
1895 "{product_name:RE200,product_ver:3.0.0,special_id:52550000}\n"
1896 "{product_name:RE200,product_ver:3.0.0,special_id:54570000}\n"
1897 "{product_name:RE200,product_ver:3.0.0,special_id:55530000}\n",
1898 .part_trail = 0x00,
1899 .soft_ver = NULL,
1900
1901 .partitions = {
1902 {"fs-uboot", 0x00000, 0x20000},
1903 {"firmware", 0x20000, 0x7a0000},
1904 {"partition-table", 0x7c0000, 0x02000},
1905 {"default-mac", 0x7c2000, 0x00020},
1906 {"pin", 0x7c2100, 0x00020},
1907 {"product-info", 0x7c3100, 0x01000},
1908 {"soft-version", 0x7c4200, 0x01000},
1909 {"support-list", 0x7c5200, 0x01000},
1910 {"profile", 0x7c6200, 0x08000},
1911 {"config-info", 0x7ce200, 0x00400},
1912 {"user-config", 0x7d0000, 0x10000},
1913 {"default-config", 0x7e0000, 0x10000},
1914 {"radio", 0x7f0000, 0x10000},
1915 {NULL, 0, 0}
1916 },
1917
1918 .first_sysupgrade_partition = "os-image",
1919 .last_sysupgrade_partition = "file-system"
1920 },
1921
1922 /** Firmware layout for the RE200 v4 */
1923 {
1924 .id = "RE200-V4",
1925 .vendor = "",
1926 .support_list =
1927 "SupportList:\n"
1928 "{product_name:RE200,product_ver:4.0.0,special_id:00000000}\n"
1929 "{product_name:RE200,product_ver:4.0.0,special_id:45550000}\n"
1930 "{product_name:RE200,product_ver:4.0.0,special_id:4A500000}\n"
1931 "{product_name:RE200,product_ver:4.0.0,special_id:4B520000}\n"
1932 "{product_name:RE200,product_ver:4.0.0,special_id:43410000}\n"
1933 "{product_name:RE200,product_ver:4.0.0,special_id:41550000}\n"
1934 "{product_name:RE200,product_ver:4.0.0,special_id:42520000}\n"
1935 "{product_name:RE200,product_ver:4.0.0,special_id:55530000}\n"
1936 "{product_name:RE200,product_ver:4.0.0,special_id:41520000}\n"
1937 "{product_name:RE200,product_ver:4.0.0,special_id:52550000}\n"
1938 "{product_name:RE200,product_ver:4.0.0,special_id:54570000}\n"
1939 "{product_name:RE200,product_ver:4.0.0,special_id:45530000}\n"
1940 "{product_name:RE200,product_ver:4.0.0,special_id:49440000}\n"
1941 "{product_name:RE200,product_ver:4.0.0,special_id:45470000}\n",
1942 .part_trail = 0x00,
1943 .soft_ver = "soft_ver:1.1.0\n",
1944
1945 .partitions = {
1946 {"fs-uboot", 0x00000, 0x20000},
1947 {"firmware", 0x20000, 0x7a0000},
1948 {"partition-table", 0x7c0000, 0x02000},
1949 {"default-mac", 0x7c2000, 0x00020},
1950 {"pin", 0x7c2100, 0x00020},
1951 {"product-info", 0x7c3100, 0x01000},
1952 {"soft-version", 0x7c4200, 0x01000},
1953 {"support-list", 0x7c5200, 0x01000},
1954 {"profile", 0x7c6200, 0x08000},
1955 {"config-info", 0x7ce200, 0x00400},
1956 {"user-config", 0x7d0000, 0x10000},
1957 {"default-config", 0x7e0000, 0x10000},
1958 {"radio", 0x7f0000, 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 RE220 v2 */
1967 {
1968 .id = "RE220-V2",
1969 .vendor = "",
1970 .support_list =
1971 "SupportList:\n"
1972 "{product_name:RE220,product_ver:2.0.0,special_id:00000000}\n"
1973 "{product_name:RE220,product_ver:2.0.0,special_id:41520000}\n"
1974 "{product_name:RE220,product_ver:2.0.0,special_id:41550000}\n"
1975 "{product_name:RE220,product_ver:2.0.0,special_id:42520000}\n"
1976 "{product_name:RE220,product_ver:2.0.0,special_id:43410000}\n"
1977 "{product_name:RE220,product_ver:2.0.0,special_id:45530000}\n"
1978 "{product_name:RE220,product_ver:2.0.0,special_id:45550000}\n"
1979 "{product_name:RE220,product_ver:2.0.0,special_id:49440000}\n"
1980 "{product_name:RE220,product_ver:2.0.0,special_id:4a500000}\n"
1981 "{product_name:RE220,product_ver:2.0.0,special_id:4b520000}\n"
1982 "{product_name:RE220,product_ver:2.0.0,special_id:52550000}\n"
1983 "{product_name:RE220,product_ver:2.0.0,special_id:54570000}\n"
1984 "{product_name:RE220,product_ver:2.0.0,special_id:55530000}\n",
1985 .part_trail = 0x00,
1986 .soft_ver = NULL,
1987
1988 .partitions = {
1989 {"fs-uboot", 0x00000, 0x20000},
1990 {"firmware", 0x20000, 0x7a0000},
1991 {"partition-table", 0x7c0000, 0x02000},
1992 {"default-mac", 0x7c2000, 0x00020},
1993 {"pin", 0x7c2100, 0x00020},
1994 {"product-info", 0x7c3100, 0x01000},
1995 {"soft-version", 0x7c4200, 0x01000},
1996 {"support-list", 0x7c5200, 0x01000},
1997 {"profile", 0x7c6200, 0x08000},
1998 {"config-info", 0x7ce200, 0x00400},
1999 {"user-config", 0x7d0000, 0x10000},
2000 {"default-config", 0x7e0000, 0x10000},
2001 {"radio", 0x7f0000, 0x10000},
2002 {NULL, 0, 0}
2003 },
2004
2005 .first_sysupgrade_partition = "os-image",
2006 .last_sysupgrade_partition = "file-system"
2007 },
2008
2009 /** Firmware layout for the RE305 v1 */
2010 {
2011 .id = "RE305-V1",
2012 .vendor = "",
2013 .support_list =
2014 "SupportList:\n"
2015 "{product_name:RE305,product_ver:1.0.0,special_id:45550000}\n"
2016 "{product_name:RE305,product_ver:1.0.0,special_id:55530000}\n"
2017 "{product_name:RE305,product_ver:1.0.0,special_id:4a500000}\n"
2018 "{product_name:RE305,product_ver:1.0.0,special_id:42520000}\n"
2019 "{product_name:RE305,product_ver:1.0.0,special_id:4b520000}\n"
2020 "{product_name:RE305,product_ver:1.0.0,special_id:41550000}\n"
2021 "{product_name:RE305,product_ver:1.0.0,special_id:43410000}\n",
2022 .part_trail = 0x00,
2023 .soft_ver = NULL,
2024
2025 .partitions = {
2026 {"fs-uboot", 0x00000, 0x20000},
2027 {"firmware", 0x20000, 0x5e0000},
2028 {"partition-table", 0x600000, 0x02000},
2029 {"default-mac", 0x610000, 0x00020},
2030 {"pin", 0x610100, 0x00020},
2031 {"product-info", 0x611100, 0x01000},
2032 {"soft-version", 0x620000, 0x01000},
2033 {"support-list", 0x621000, 0x01000},
2034 {"profile", 0x622000, 0x08000},
2035 {"user-config", 0x630000, 0x10000},
2036 {"default-config", 0x640000, 0x10000},
2037 {"radio", 0x7f0000, 0x10000},
2038 {NULL, 0, 0}
2039 },
2040
2041 .first_sysupgrade_partition = "os-image",
2042 .last_sysupgrade_partition = "file-system"
2043 },
2044
2045 /** Firmware layout for the RE350 v1 */
2046 {
2047 .id = "RE350-V1",
2048 .vendor = "",
2049 .support_list =
2050 "SupportList:\n"
2051 "{product_name:RE350,product_ver:1.0.0,special_id:45550000}\n"
2052 "{product_name:RE350,product_ver:1.0.0,special_id:00000000}\n"
2053 "{product_name:RE350,product_ver:1.0.0,special_id:41550000}\n"
2054 "{product_name:RE350,product_ver:1.0.0,special_id:55530000}\n"
2055 "{product_name:RE350,product_ver:1.0.0,special_id:43410000}\n"
2056 "{product_name:RE350,product_ver:1.0.0,special_id:4b520000}\n"
2057 "{product_name:RE350,product_ver:1.0.0,special_id:4a500000}\n",
2058 .part_trail = 0x00,
2059 .soft_ver = NULL,
2060
2061 /** We're using a dynamic kernel/rootfs split here */
2062 .partitions = {
2063 {"fs-uboot", 0x00000, 0x20000},
2064 {"firmware", 0x20000, 0x5e0000},
2065 {"partition-table", 0x600000, 0x02000},
2066 {"default-mac", 0x610000, 0x00020},
2067 {"pin", 0x610100, 0x00020},
2068 {"product-info", 0x611100, 0x01000},
2069 {"soft-version", 0x620000, 0x01000},
2070 {"support-list", 0x621000, 0x01000},
2071 {"profile", 0x622000, 0x08000},
2072 {"user-config", 0x630000, 0x10000},
2073 {"default-config", 0x640000, 0x10000},
2074 {"radio", 0x7f0000, 0x10000},
2075 {NULL, 0, 0}
2076 },
2077
2078 .first_sysupgrade_partition = "os-image",
2079 .last_sysupgrade_partition = "file-system"
2080 },
2081
2082 /** Firmware layout for the RE350K v1 */
2083 {
2084 .id = "RE350K-V1",
2085 .vendor = "",
2086 .support_list =
2087 "SupportList:\n"
2088 "{product_name:RE350K,product_ver:1.0.0,special_id:00000000,product_region:US}\n",
2089 .part_trail = 0x00,
2090 .soft_ver = NULL,
2091
2092 /** We're using a dynamic kernel/rootfs split here */
2093 .partitions = {
2094 {"fs-uboot", 0x00000, 0x20000},
2095 {"firmware", 0x20000, 0xd70000},
2096 {"partition-table", 0xd90000, 0x02000},
2097 {"default-mac", 0xda0000, 0x00020},
2098 {"pin", 0xda0100, 0x00020},
2099 {"product-info", 0xda1100, 0x01000},
2100 {"soft-version", 0xdb0000, 0x01000},
2101 {"support-list", 0xdb1000, 0x01000},
2102 {"profile", 0xdb2000, 0x08000},
2103 {"user-config", 0xdc0000, 0x10000},
2104 {"default-config", 0xdd0000, 0x10000},
2105 {"device-id", 0xde0000, 0x00108},
2106 {"radio", 0xff0000, 0x10000},
2107 {NULL, 0, 0}
2108 },
2109
2110 .first_sysupgrade_partition = "os-image",
2111 .last_sysupgrade_partition = "file-system"
2112 },
2113
2114 /** Firmware layout for the RE355 */
2115 {
2116 .id = "RE355",
2117 .vendor = "",
2118 .support_list =
2119 "SupportList:\r\n"
2120 "{product_name:RE355,product_ver:1.0.0,special_id:00000000}\r\n"
2121 "{product_name:RE355,product_ver:1.0.0,special_id:55530000}\r\n"
2122 "{product_name:RE355,product_ver:1.0.0,special_id:45550000}\r\n"
2123 "{product_name:RE355,product_ver:1.0.0,special_id:4A500000}\r\n"
2124 "{product_name:RE355,product_ver:1.0.0,special_id:43410000}\r\n"
2125 "{product_name:RE355,product_ver:1.0.0,special_id:41550000}\r\n"
2126 "{product_name:RE355,product_ver:1.0.0,special_id:4B520000}\r\n"
2127 "{product_name:RE355,product_ver:1.0.0,special_id:55534100}\r\n",
2128 .part_trail = 0x00,
2129 .soft_ver = NULL,
2130
2131 /* We're using a dynamic kernel/rootfs split here */
2132 .partitions = {
2133 {"fs-uboot", 0x00000, 0x20000},
2134 {"firmware", 0x20000, 0x5e0000},
2135 {"partition-table", 0x600000, 0x02000},
2136 {"default-mac", 0x610000, 0x00020},
2137 {"pin", 0x610100, 0x00020},
2138 {"product-info", 0x611100, 0x01000},
2139 {"soft-version", 0x620000, 0x01000},
2140 {"support-list", 0x621000, 0x01000},
2141 {"profile", 0x622000, 0x08000},
2142 {"user-config", 0x630000, 0x10000},
2143 {"default-config", 0x640000, 0x10000},
2144 {"radio", 0x7f0000, 0x10000},
2145 {NULL, 0, 0}
2146 },
2147
2148 .first_sysupgrade_partition = "os-image",
2149 .last_sysupgrade_partition = "file-system"
2150 },
2151
2152 /** Firmware layout for the RE450 */
2153 {
2154 .id = "RE450",
2155 .vendor = "",
2156 .support_list =
2157 "SupportList:\r\n"
2158 "{product_name:RE450,product_ver:1.0.0,special_id:00000000}\r\n"
2159 "{product_name:RE450,product_ver:1.0.0,special_id:55530000}\r\n"
2160 "{product_name:RE450,product_ver:1.0.0,special_id:45550000}\r\n"
2161 "{product_name:RE450,product_ver:1.0.0,special_id:4A500000}\r\n"
2162 "{product_name:RE450,product_ver:1.0.0,special_id:43410000}\r\n"
2163 "{product_name:RE450,product_ver:1.0.0,special_id:41550000}\r\n"
2164 "{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
2165 "{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
2166 .part_trail = 0x00,
2167 .soft_ver = NULL,
2168
2169 /** We're using a dynamic kernel/rootfs split here */
2170 .partitions = {
2171 {"fs-uboot", 0x00000, 0x20000},
2172 {"firmware", 0x20000, 0x5e0000},
2173 {"partition-table", 0x600000, 0x02000},
2174 {"default-mac", 0x610000, 0x00020},
2175 {"pin", 0x610100, 0x00020},
2176 {"product-info", 0x611100, 0x01000},
2177 {"soft-version", 0x620000, 0x01000},
2178 {"support-list", 0x621000, 0x01000},
2179 {"profile", 0x622000, 0x08000},
2180 {"user-config", 0x630000, 0x10000},
2181 {"default-config", 0x640000, 0x10000},
2182 {"radio", 0x7f0000, 0x10000},
2183 {NULL, 0, 0}
2184 },
2185
2186 .first_sysupgrade_partition = "os-image",
2187 .last_sysupgrade_partition = "file-system"
2188 },
2189
2190 /** Firmware layout for the RE450 v2 */
2191 {
2192 .id = "RE450-V2",
2193 .vendor = "",
2194 .support_list =
2195 "SupportList:\r\n"
2196 "{product_name:RE450,product_ver:2.0.0,special_id:00000000}\r\n"
2197 "{product_name:RE450,product_ver:2.0.0,special_id:55530000}\r\n"
2198 "{product_name:RE450,product_ver:2.0.0,special_id:45550000}\r\n"
2199 "{product_name:RE450,product_ver:2.0.0,special_id:4A500000}\r\n"
2200 "{product_name:RE450,product_ver:2.0.0,special_id:43410000}\r\n"
2201 "{product_name:RE450,product_ver:2.0.0,special_id:41550000}\r\n"
2202 "{product_name:RE450,product_ver:2.0.0,special_id:41530000}\r\n"
2203 "{product_name:RE450,product_ver:2.0.0,special_id:4B520000}\r\n"
2204 "{product_name:RE450,product_ver:2.0.0,special_id:42520000}\r\n",
2205 .part_trail = 0x00,
2206 .soft_ver = NULL,
2207
2208 /* We're using a dynamic kernel/rootfs split here */
2209 .partitions = {
2210 {"fs-uboot", 0x00000, 0x20000},
2211 {"firmware", 0x20000, 0x5e0000},
2212 {"partition-table", 0x600000, 0x02000},
2213 {"default-mac", 0x610000, 0x00020},
2214 {"pin", 0x610100, 0x00020},
2215 {"product-info", 0x611100, 0x01000},
2216 {"soft-version", 0x620000, 0x01000},
2217 {"support-list", 0x621000, 0x01000},
2218 {"profile", 0x622000, 0x08000},
2219 {"user-config", 0x630000, 0x10000},
2220 {"default-config", 0x640000, 0x10000},
2221 {"radio", 0x7f0000, 0x10000},
2222 {NULL, 0, 0}
2223 },
2224
2225 .first_sysupgrade_partition = "os-image",
2226 .last_sysupgrade_partition = "file-system"
2227 },
2228
2229 /** Firmware layout for the RE450 v3 */
2230 {
2231 .id = "RE450-V3",
2232 .vendor = "",
2233 .support_list =
2234 "SupportList:\r\n"
2235 "{product_name:RE450,product_ver:3.0.0,special_id:00000000}\r\n"
2236 "{product_name:RE450,product_ver:3.0.0,special_id:55530000}\r\n"
2237 "{product_name:RE450,product_ver:3.0.0,special_id:45550000}\r\n"
2238 "{product_name:RE450,product_ver:3.0.0,special_id:4A500000}\r\n"
2239 "{product_name:RE450,product_ver:3.0.0,special_id:43410000}\r\n"
2240 "{product_name:RE450,product_ver:3.0.0,special_id:41550000}\r\n"
2241 "{product_name:RE450,product_ver:3.0.0,special_id:41530000}\r\n"
2242 "{product_name:RE450,product_ver:3.0.0,special_id:4B520000}\r\n"
2243 "{product_name:RE450,product_ver:3.0.0,special_id:42520000}\r\n",
2244 .part_trail = 0x00,
2245 .soft_ver = NULL,
2246
2247 /* We're using a dynamic kernel/rootfs split here */
2248 .partitions = {
2249 {"fs-uboot", 0x00000, 0x20000},
2250 {"default-mac", 0x20000, 0x00020},
2251 {"pin", 0x20020, 0x00020},
2252 {"product-info", 0x21000, 0x01000},
2253 {"partition-table", 0x22000, 0x02000},
2254 {"soft-version", 0x24000, 0x01000},
2255 {"support-list", 0x25000, 0x01000},
2256 {"profile", 0x26000, 0x08000},
2257 {"user-config", 0x2e000, 0x10000},
2258 {"default-config", 0x3e000, 0x10000},
2259 {"config-info", 0x4e000, 0x00400},
2260 {"firmware", 0x50000, 0x7a0000},
2261 {"radio", 0x7f0000, 0x10000},
2262 {NULL, 0, 0}
2263 },
2264
2265 .first_sysupgrade_partition = "os-image",
2266 .last_sysupgrade_partition = "file-system"
2267 },
2268
2269 /** Firmware layout for the RE500 */
2270 {
2271 .id = "RE500-V1",
2272 .vendor = "",
2273 .support_list =
2274 "SupportList:\r\n"
2275 "{product_name:RE500,product_ver:1.0.0,special_id:00000000}\r\n"
2276 "{product_name:RE500,product_ver:1.0.0,special_id:55530000}\r\n"
2277 "{product_name:RE500,product_ver:1.0.0,special_id:45550000}\r\n"
2278 "{product_name:RE500,product_ver:1.0.0,special_id:4A500000}\r\n"
2279 "{product_name:RE500,product_ver:1.0.0,special_id:43410000}\r\n"
2280 "{product_name:RE500,product_ver:1.0.0,special_id:41550000}\r\n"
2281 "{product_name:RE500,product_ver:1.0.0,special_id:41530000}\r\n",
2282 .part_trail = 0x00,
2283 .soft_ver = NULL,
2284
2285 /* We're using a dynamic kernel/rootfs split here */
2286 .partitions = {
2287 {"fs-uboot", 0x00000, 0x20000},
2288 {"firmware", 0x20000, 0xde0000},
2289 {"partition-table", 0xe00000, 0x02000},
2290 {"default-mac", 0xe10000, 0x00020},
2291 {"pin", 0xe10100, 0x00020},
2292 {"product-info", 0xe11100, 0x01000},
2293 {"soft-version", 0xe20000, 0x01000},
2294 {"support-list", 0xe21000, 0x01000},
2295 {"profile", 0xe22000, 0x08000},
2296 {"user-config", 0xe30000, 0x10000},
2297 {"default-config", 0xe40000, 0x10000},
2298 {"radio", 0xff0000, 0x10000},
2299 {NULL, 0, 0}
2300 },
2301
2302 .first_sysupgrade_partition = "os-image",
2303 .last_sysupgrade_partition = "file-system"
2304 },
2305
2306 /** Firmware layout for the RE650 */
2307 {
2308 .id = "RE650-V1",
2309 .vendor = "",
2310 .support_list =
2311 "SupportList:\r\n"
2312 "{product_name:RE650,product_ver:1.0.0,special_id:00000000}\r\n"
2313 "{product_name:RE650,product_ver:1.0.0,special_id:55530000}\r\n"
2314 "{product_name:RE650,product_ver:1.0.0,special_id:45550000}\r\n"
2315 "{product_name:RE650,product_ver:1.0.0,special_id:4A500000}\r\n"
2316 "{product_name:RE650,product_ver:1.0.0,special_id:43410000}\r\n"
2317 "{product_name:RE650,product_ver:1.0.0,special_id:41550000}\r\n"
2318 "{product_name:RE650,product_ver:1.0.0,special_id:41530000}\r\n",
2319 .part_trail = 0x00,
2320 .soft_ver = NULL,
2321
2322 /* We're using a dynamic kernel/rootfs split here */
2323 .partitions = {
2324 {"fs-uboot", 0x00000, 0x20000},
2325 {"firmware", 0x20000, 0xde0000},
2326 {"partition-table", 0xe00000, 0x02000},
2327 {"default-mac", 0xe10000, 0x00020},
2328 {"pin", 0xe10100, 0x00020},
2329 {"product-info", 0xe11100, 0x01000},
2330 {"soft-version", 0xe20000, 0x01000},
2331 {"support-list", 0xe21000, 0x01000},
2332 {"profile", 0xe22000, 0x08000},
2333 {"user-config", 0xe30000, 0x10000},
2334 {"default-config", 0xe40000, 0x10000},
2335 {"radio", 0xff0000, 0x10000},
2336 {NULL, 0, 0}
2337 },
2338
2339 .first_sysupgrade_partition = "os-image",
2340 .last_sysupgrade_partition = "file-system"
2341 },
2342
2343 {}
2344 };
2345
2346 #define error(_ret, _errno, _str, ...) \
2347 do { \
2348 fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
2349 strerror(_errno)); \
2350 if (_ret) \
2351 exit(_ret); \
2352 } while (0)
2353
2354
2355 /** Stores a uint32 as big endian */
2356 static inline void put32(uint8_t *buf, uint32_t val) {
2357 buf[0] = val >> 24;
2358 buf[1] = val >> 16;
2359 buf[2] = val >> 8;
2360 buf[3] = val;
2361 }
2362
2363 static inline bool meta_partition_should_pad(enum partition_trail_value pv)
2364 {
2365 return (pv >= 0) && (pv <= PART_TRAIL_MAX);
2366 }
2367
2368 /** Allocate a padded meta partition with a correctly initialised header
2369 * If the `data` pointer is NULL, then the required space is only allocated,
2370 * otherwise `data_len` bytes will be copied from `data` into the partition
2371 * entry. */
2372 static struct image_partition_entry init_meta_partition_entry(
2373 const char *name, const void *data, uint32_t data_len,
2374 enum partition_trail_value pad_value)
2375 {
2376 uint32_t total_len = sizeof(struct meta_header) + data_len;
2377 if (meta_partition_should_pad(pad_value))
2378 total_len += 1;
2379
2380 struct image_partition_entry entry = {
2381 .name = name,
2382 .size = total_len,
2383 .data = malloc(total_len)
2384 };
2385 if (!entry.data)
2386 error(1, errno, "failed to allocate meta partition entry");
2387
2388 struct meta_header *header = (struct meta_header *)entry.data;
2389 header->length = htonl(data_len);
2390 header->zero = 0;
2391
2392 if (data)
2393 memcpy(entry.data+sizeof(*header), data, data_len);
2394
2395 if (meta_partition_should_pad(pad_value))
2396 entry.data[total_len - 1] = (uint8_t) pad_value;
2397
2398 return entry;
2399 }
2400
2401 /** Allocates a new image partition */
2402 static struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
2403 struct image_partition_entry entry = {name, len, malloc(len)};
2404 if (!entry.data)
2405 error(1, errno, "malloc");
2406
2407 return entry;
2408 }
2409
2410 /** Frees an image partition */
2411 static void free_image_partition(struct image_partition_entry entry) {
2412 free(entry.data);
2413 }
2414
2415 static time_t source_date_epoch = -1;
2416 static void set_source_date_epoch() {
2417 char *env = getenv("SOURCE_DATE_EPOCH");
2418 char *endptr = env;
2419 errno = 0;
2420 if (env && *env) {
2421 source_date_epoch = strtoull(env, &endptr, 10);
2422 if (errno || (endptr && *endptr != '\0')) {
2423 fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
2424 exit(1);
2425 }
2426 }
2427 }
2428
2429 /** Generates the partition-table partition */
2430 static struct image_partition_entry make_partition_table(const struct flash_partition_entry *p) {
2431 struct image_partition_entry entry = alloc_image_partition("partition-table", 0x800);
2432
2433 char *s = (char *)entry.data, *end = (char *)(s+entry.size);
2434
2435 *(s++) = 0x00;
2436 *(s++) = 0x04;
2437 *(s++) = 0x00;
2438 *(s++) = 0x00;
2439
2440 size_t i;
2441 for (i = 0; p[i].name; i++) {
2442 size_t len = end-s;
2443 size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n", p[i].name, p[i].base, p[i].size);
2444
2445 if (w > len-1)
2446 error(1, 0, "flash partition table overflow?");
2447
2448 s += w;
2449 }
2450
2451 s++;
2452
2453 memset(s, 0xff, end-s);
2454
2455 return entry;
2456 }
2457
2458
2459 /** Generates a binary-coded decimal representation of an integer in the range [0, 99] */
2460 static inline uint8_t bcd(uint8_t v) {
2461 return 0x10 * (v/10) + v%10;
2462 }
2463
2464
2465 /** Generates the soft-version partition */
2466 static struct image_partition_entry make_soft_version(
2467 const struct device_info *info, uint32_t rev)
2468 {
2469 /** If an info string is provided, use this instead of
2470 * the structured data, and include the null-termination */
2471 if (info->soft_ver) {
2472 uint32_t len = strlen(info->soft_ver) + 1;
2473 return init_meta_partition_entry("soft-version",
2474 info->soft_ver, len, info->part_trail);
2475 }
2476
2477 time_t t;
2478
2479 if (source_date_epoch != -1)
2480 t = source_date_epoch;
2481 else if (time(&t) == (time_t)(-1))
2482 error(1, errno, "time");
2483
2484 struct tm *tm = gmtime(&t);
2485
2486 struct soft_version s = {
2487 .pad1 = 0xff,
2488
2489 .version_major = 0,
2490 .version_minor = 0,
2491 .version_patch = 0,
2492
2493 .year_hi = bcd((1900+tm->tm_year)/100),
2494 .year_lo = bcd(tm->tm_year%100),
2495 .month = bcd(tm->tm_mon+1),
2496 .day = bcd(tm->tm_mday),
2497
2498 .compat_level = htonl(info->soft_ver_compat_level)
2499 };
2500
2501 if (info->soft_ver_compat_level == 0)
2502 return init_meta_partition_entry("soft-version", &s,
2503 (uint8_t *)(&s.compat_level) - (uint8_t *)(&s),
2504 info->part_trail);
2505 else
2506 return init_meta_partition_entry("soft-version", &s,
2507 sizeof(s), info->part_trail);
2508 }
2509
2510 /** Generates the support-list partition */
2511 static struct image_partition_entry make_support_list(
2512 const struct device_info *info)
2513 {
2514 uint32_t len = strlen(info->support_list);
2515 return init_meta_partition_entry("support-list", info->support_list,
2516 len, info->part_trail);
2517 }
2518
2519 /** Partition with extra-para data */
2520 static struct image_partition_entry make_extra_para(
2521 const struct device_info *info, const uint8_t *extra_para, size_t len)
2522 {
2523 return init_meta_partition_entry("extra-para", extra_para, len,
2524 info->part_trail);
2525 }
2526
2527 /** Creates a new image partition with an arbitrary name from a file */
2528 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) {
2529 struct stat statbuf;
2530
2531 if (stat(filename, &statbuf) < 0)
2532 error(1, errno, "unable to stat file `%s'", filename);
2533
2534 size_t len = statbuf.st_size;
2535
2536 if (add_jffs2_eof) {
2537 if (file_system_partition)
2538 len = ALIGN(len + file_system_partition->base, 0x10000) + sizeof(jffs2_eof_mark) - file_system_partition->base;
2539 else
2540 len = ALIGN(len, 0x10000) + sizeof(jffs2_eof_mark);
2541 }
2542
2543 struct image_partition_entry entry = alloc_image_partition(part_name, len);
2544
2545 FILE *file = fopen(filename, "rb");
2546 if (!file)
2547 error(1, errno, "unable to open file `%s'", filename);
2548
2549 if (fread(entry.data, statbuf.st_size, 1, file) != 1)
2550 error(1, errno, "unable to read file `%s'", filename);
2551
2552 if (add_jffs2_eof) {
2553 uint8_t *eof = entry.data + statbuf.st_size, *end = entry.data+entry.size;
2554
2555 memset(eof, 0xff, end - eof - sizeof(jffs2_eof_mark));
2556 memcpy(end - sizeof(jffs2_eof_mark), jffs2_eof_mark, sizeof(jffs2_eof_mark));
2557 }
2558
2559 fclose(file);
2560
2561 return entry;
2562 }
2563
2564 /**
2565 Copies a list of image partitions into an image buffer and generates the image partition table while doing so
2566
2567 Example image partition table:
2568
2569 fwup-ptn partition-table base 0x00800 size 0x00800
2570 fwup-ptn os-image base 0x01000 size 0x113b45
2571 fwup-ptn file-system base 0x114b45 size 0x1d0004
2572 fwup-ptn support-list base 0x2e4b49 size 0x000d1
2573
2574 Each line of the partition table is terminated with the bytes 09 0d 0a ("\t\r\n"),
2575 the end of the partition table is marked with a zero byte.
2576
2577 The firmware image must contain at least the partition-table and support-list partitions
2578 to be accepted. There aren't any alignment constraints for the image partitions.
2579
2580 The partition-table partition contains the actual flash layout; partitions
2581 from the image partition table are mapped to the corresponding flash partitions during
2582 the firmware upgrade. The support-list partition contains a list of devices supported by
2583 the firmware image.
2584
2585 The base offsets in the firmware partition table are relative to the end
2586 of the vendor information block, so the partition-table partition will
2587 actually start at offset 0x1814 of the image.
2588
2589 I think partition-table must be the first partition in the firmware image.
2590 */
2591 static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) {
2592 size_t i, j;
2593 char *image_pt = (char *)buffer, *end = image_pt + 0x800;
2594
2595 size_t base = 0x800;
2596 for (i = 0; parts[i].name