29e5064909e6282b28eaf4c5b518e8c01fe5634b
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 JFFS2_BLOCKSIZE = 64k 128k 256k
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
12
13 IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
14
15 KERNEL_LOADADDR = 0x80060000
16
17 DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS
18
19 define Build/netgear-squashfs
20 rm -rf $@.fs $@.squashfs
21 mkdir -p $@.fs/image
22 cp $@ $@.fs/image/uImage
23 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
24 $@.fs $@.squashfs \
25 -noappend -root-owned -be -b 65536
26 dd if=/dev/zero bs=1k count=1 >> $@.squashfs
27 mkimage \
28 -A mips -O linux -T filesystem -C none \
29 -M $(NETGEAR_KERNEL_MAGIC) \
30 -a 0xbf070000 -e 0xbf070000 \
31 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
32 -d $@.squashfs $@
33 rm -rf $@.squashfs $@.fs
34 endef
35
36 define Build/netgear-uImage
37 $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
38 endef
39
40 # combine kernel and rootfs into one image
41 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
42 # <type> is "sysupgrade" or "factory"
43 #
44 # -a align the rootfs start on an <align> bytes boundary
45 # -j add jffs2 end-of-filesystem markers
46 # -s strip padding from end of the image
47 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
48 define Build/mktplinkfw
49 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
50 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $2 \
51 -m $(TPLINK_HEADER_VERSION) \
52 -k $(word 1,$^) \
53 -r $@ \
54 -o $@.new \
55 -j -X 0x40000 \
56 -a $(call rootfs_align,$(FILESYSTEM)) \
57 $(if $(findstring sysupgrade,$1),-s) && mv $@.new $@ || rm -f $@
58 endef
59
60 # mktplinkfw-initramfs <optional extra arguments to mktplinkfw binary>
61 #
62 # -c combined image
63 define Build/mktplinkfw-initramfs
64 $(STAGING_DIR_HOST)/bin/mktplinkfw \
65 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $2 \
66 -m $(TPLINK_HEADER_VERSION) \
67 -k $@ \
68 -o $@.new \
69 -s -S \
70 -c
71 @mv $@.new $@
72 endef
73
74 define Build/loader-common
75 rm -rf $@.src
76 $(MAKE) -C lzma-loader \
77 PKG_BUILD_DIR="$@.src" \
78 TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
79 KERNEL_CMDLINE="$(CMDLINE)" BOARD="$(BOARDNAME)" \
80 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
81 $(1) compile loader.gz
82 mv "$@.gz" "$@"
83 rm -rf $@.src
84 endef
85
86 define Build/loader-okli-compile
87 $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
88 endef
89
90 define Build/loader-kernel
91 $(call Build/loader-common,LOADER_DATA="$@")
92 endef
93
94 define Build/loader-okli
95 dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
96 cat "$@" >> "$@.new"
97 mv "$@.new" "$@"
98 endef
99
100 define Build/copy-file
101 cat "$(1)" > "$@"
102 endef
103
104 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION
105
106 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
107 # UBNT_TYPE e.g. one of (BZ, XM, XW)
108 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
109
110 # mkubntimage is using the kernel image direct
111 # routerboard creates partitions out of the ubnt header
112 define Build/mkubntimage
113 $(STAGING_DIR_HOST)/bin/mkfwimage \
114 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
115 -k $(word 1,$^) \
116 -r $@ \
117 -o $@
118 endef
119
120 # all UBNT XM device expect the kernel image to have 1024k while flash, when
121 # booting the image, the size doesn't matter.
122 define Build/mkubntimage-split
123 dd if=$@ of=$@.old1 bs=1024k count=1
124 dd if=$@ of=$@.old2 bs=1024k skip=1
125 $(STAGING_DIR_HOST)/bin/mkfwimage \
126 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
127 -k $@.old1 \
128 -r $@.old2 \
129 -o $@
130 rm $@.old1 $@.old2
131 endef
132
133 define Build/mkubntimage2
134 $(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
135 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
136 -p jffs2:0x50000:0xf60000:0:0:$@ \
137 -o $@.new
138 @mv $@.new $@
139 endef
140
141 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
142
143 define Device/Default
144 BOARDNAME :=
145 DEVICE_PROFILE = $$(BOARDNAME)
146 PROFILES = Default Minimal $$(DEVICE_PROFILE)
147 MTDPARTS :=
148 IMAGES := sysupgrade.bin
149 BLOCKSIZE := 64k
150 FILESYSTEMS = $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-$$(BLOCKSIZE)
151 CONSOLE = ttyS0,115200
152 CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
153 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
154 COMPILE :=
155 IMAGES := sysupgrade.bin
156 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
157 endef
158
159 define Device/bsb
160 BOARDNAME = BSB
161 IMAGE_SIZE = 16000k
162 CONSOLE = ttyATH0,115200
163 MTDPARTS = spi0.0:128k(u-boot)ro,64k(u-boot-env)ro,16128k(firmware),64k(art)ro
164 endef
165 TARGET_DEVICES += bsb
166
167 define Device/carambola2
168 BOARDNAME = CARAMBOLA2
169 IMAGE_SIZE = 16000k
170 CONSOLE = ttyATH0,115200
171 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
172 endef
173 TARGET_DEVICES += carambola2
174
175 define Device/cf-e316n-v2
176 BOARDNAME = CF-E316N-V2
177 IMAGE_SIZE = 16192k
178 CONSOLE = ttyS0,115200
179 MTDPARTS = spi0.0:64k(u-boot)ro,64k(art)ro,16192k(firmware),64k(nvram)ro
180 endef
181 TARGET_DEVICES += cf-e316n-v2
182
183 define Device/weio
184 BOARDNAME = WEIO
185 IMAGE_SIZE = 16000k
186 CONSOLE = ttyATH0,115200
187 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
188 endef
189 TARGET_DEVICES += weio
190
191 define Device/wndr3700
192 BOARDNAME = WNDR3700
193 NETGEAR_KERNEL_MAGIC = 0x33373030
194 NETGEAR_BOARD_ID = WNDR3700
195 IMAGE_SIZE = 7680k
196 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro
197 IMAGES := sysupgrade.bin factory.img factory-NA.img
198 KERNEL := kernel-bin | patch-cmdline | lzma -d20 | netgear-uImage lzma
199 IMAGE/default = append-kernel $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
200 IMAGE/sysupgrade.bin = $$(IMAGE/default) | check-size $$$$(IMAGE_SIZE)
201 IMAGE/factory.img = $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE)
202 IMAGE/factory-NA.img = $$(IMAGE/default) | netgear-dni NA | check-size $$$$(IMAGE_SIZE)
203 endef
204
205 define Device/wndr3700v2
206 $(Device/wndr3700)
207 NETGEAR_BOARD_ID = WNDR3700v2
208 NETGEAR_KERNEL_MAGIC = 0x33373031
209 NETGEAR_HW_ID = 29763654+16+64
210 IMAGE_SIZE = 15872k
211 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro
212 IMAGES := sysupgrade.bin factory.img
213 endef
214
215 define Device/wndr3800
216 $(Device/wndr3700v2)
217 NETGEAR_BOARD_ID = WNDR3800
218 NETGEAR_HW_ID = 29763654+16+128
219 endef
220
221 define Device/wndr3800ch
222 $(Device/wndr3800)
223 NETGEAR_BOARD_ID = WNDR3800CH
224 endef
225
226 define Device/wndrmac
227 $(Device/wndr3700v2)
228 NETGEAR_BOARD_ID = WNDRMAC
229 endef
230
231 define Device/wndrmacv2
232 $(Device/wndr3800)
233 NETGEAR_BOARD_ID = WNDRMACv2
234 endef
235
236 TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
237
238 define Device/tplink
239 TPLINK_HWREV := 0x1
240 TPLINK_HEADER_VERSION := 1
241 KERNEL := kernel-bin | patch-cmdline | lzma
242 KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-initramfs
243 IMAGES := sysupgrade.bin factory.bin
244 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
245 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
246 endef
247
248 define Device/tplink-nolzma
249 $(Device/tplink)
250 LOADER_FLASH_OFFS := 0x22000
251 COMPILE := loader-$(1).gz
252 COMPILE/loader-$(1).gz := loader-okli-compile
253 KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
254 KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel | mktplinkfw-initramfs
255 endef
256
257 define Device/tplink-4m
258 $(Device/tplink-nolzma)
259 TPLINK_FLASHLAYOUT := 4M
260 IMAGE_SIZE := 3904k
261 endef
262
263 define Device/tplink-8m
264 $(Device/tplink-nolzma)
265 TPLINK_FLASHLAYOUT := 8M
266 IMAGE_SIZE := 7936k
267 endef
268
269 define Device/tplink-4mlzma
270 $(Device/tplink)
271 TPLINK_FLASHLAYOUT := 4Mlzma
272 IMAGE_SIZE := 3904k
273 endef
274
275 define Device/tplink-8mlzma
276 $(Device/tplink)
277 TPLINK_FLASHLAYOUT := 8Mlzma
278 IMAGE_SIZE := 7936k
279 endef
280
281 define Device/tplink-16mlzma
282 $(Device/tplink)
283 TPLINK_FLASHLAYOUT := 16Mlzma
284 IMAGE_SIZE := 15872k
285 endef
286
287 define Device/tl-wdr4300-v1
288 $(Device/tplink-8mlzma)
289 BOARDNAME = TL-WDR4300
290 DEVICE_PROFILE = TLWDR4300
291 TPLINK_HWID := 0x43000001
292 endef
293
294 define Device/tl-wdr3500-v1
295 $(Device/tl-wdr4300-v1)
296 BOARDNAME = TL-WDR3500
297 TPLINK_HWID := 0x35000001
298 endef
299
300 define Device/tl-wdr3600-v1
301 $(Device/tl-wdr4300-v1)
302 TPLINK_HWID := 0x36000001
303 endef
304
305 define Device/tl-wdr4300-v1-il
306 $(Device/tl-wdr4300-v1)
307 TPLINK_HWID := 0x43008001
308 endef
309
310 define Device/tl-wdr4310-v1
311 $(Device/tl-wdr4300-v1)
312 TPLINK_HWID := 0x43100001
313 endef
314
315 define Device/mw4530r-v1
316 $(Device/tl-wdr4300-v1)
317 TPLINK_HWID := 0x45300001
318 endef
319 TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1
320
321 define Device/tl-wdr6500-v2
322 $(Device/tplink-8mlzma)
323 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
324 KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | mktplinkfw-initramfs
325 BOARDNAME = TL-WDR6500-v2
326 DEVICE_PROFILE = TLWDR6500V2
327 TPLINK_HWID := 0x65000002
328 TPLINK_HEADER_VERSION := 2
329 endef
330 TARGET_DEVICES += tl-wdr6500-v2
331
332 define Device/tl-wdr3320-v2
333 $(Device/tplink-4mlzma)
334 BOARDNAME = TL-WDR3320-v2
335 DEVICE_PROFILE = TLWDR3320V2
336 TPLINK_HWID := 0x33200002
337 TPLINK_HEADER_VERSION := 2
338 endef
339 TARGET_DEVICES += tl-wdr3320-v2
340
341 define Device/archer-c5-v1
342 $(Device/tplink-16mlzma)
343 BOARDNAME := ARCHER-C5
344 DEVICE_PROFILE := ARCHERC7
345 TPLINK_HWID := 0xc5000001
346 endef
347
348 define Device/archer-c7-v1
349 $(Device/tplink-8mlzma)
350 BOARDNAME := ARCHER-C7
351 DEVICE_PROFILE := ARCHERC7
352 TPLINK_HWID := 0x75000001
353 endef
354
355 define Device/archer-c7-v2
356 $(Device/tplink-16mlzma)
357 BOARDNAME := ARCHER-C7
358 DEVICE_PROFILE := ARCHERC7
359 TPLINK_HWID := 0xc7000002
360 endef
361
362 define Device/tl-wdr7500-v3
363 $(Device/tplink-8mlzma)
364 BOARDNAME := ARCHER-C7
365 DEVICE_PROFILE := ARCHERC7
366 TPLINK_HWID := 0x75000003
367 endef
368 TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 tl-wdr7500-v3
369
370 define Device/antminer-s1
371 $(Device/tplink-8mlzma)
372 BOARDNAME := ANTMINER-S1
373 DEVICE_PROFILE := ANTMINERS1
374 TPLINK_HWID := 0x04440101
375 CONSOLE := ttyATH0,115200
376 endef
377
378 define Device/antminer-s3
379 $(Device/tplink-8mlzma)
380 BOARDNAME := ANTMINER-S3
381 DEVICE_PROFILE := ANTMINERS3
382 TPLINK_HWID := 0x04440301
383 CONSOLE := ttyATH0,115200
384 endef
385
386 define Device/el-m150
387 $(Device/tplink-8mlzma)
388 BOARDNAME := EL-M150
389 DEVICE_PROFILE := ELM150
390 TPLINK_HWID := 0x01500101
391 CONSOLE := ttyATH0,115200
392 endef
393
394 define Device/el-mini
395 $(Device/tplink-8mlzma)
396 BOARDNAME := EL-MINI
397 DEVICE_PROFILE := ELMINI
398 TPLINK_HWID := 0x01530001
399 CONSOLE := ttyATH0,115200
400 endef
401 TARGET_DEVICES += antminer-s1 antminer-s3 el-m150 el-mini
402
403 define Device/gl-inet-6408A-v1
404 $(Device/tplink-8mlzma)
405 BOARDNAME := GL-INET
406 DEVICE_PROFILE := GLINET
407 TPLINK_HWID := 0x08000001
408 CONSOLE := ttyATH0,115200
409 endef
410
411 define Device/gl-inet-6416A-v1
412 $(Device/tplink-16mlzma)
413 BOARDNAME := GL-INET
414 DEVICE_PROFILE := GLINET
415 TPLINK_HWID := 0x08000001
416 CONSOLE := ttyATH0,115200
417 endef
418 TARGET_DEVICES += gl-inet-6408A-v1 gl-inet-6416A-v1
419
420 define Device/rnx-n360rt
421 $(Device/tplink-4m)
422 BOARDNAME := TL-WR941ND
423 DEVICE_PROFILE := RNXN360RT
424 TPLINK_HWID := 0x09410002
425 TPLINK_HWREV := 0x00420001
426 endef
427 TARGET_DEVICES += rnx-n360rt
428
429 define Device/mc-mac1200r
430 $(Device/tplink-8mlzma)
431 BOARDNAME := MC-MAC1200R
432 DEVICE_PROFILE := MAC1200R
433 TPLINK_HWID := 0x12000001
434 endef
435 TARGET_DEVICES += mc-mac1200r
436
437 define Device/minibox-v1
438 $(Device/tplink-16mlzma)
439 BOARDNAME := MINIBOX-V1
440 DEVICE_PROFILE := MINIBOXV1
441 TPLINK_HWID := 0x3C000201
442 CONSOLE := ttyATH0,115200
443 endef
444 TARGET_DEVICES += minibox-v1
445
446 define Device/onion-omega
447 $(Device/tplink-16mlzma)
448 BOARDNAME := ONION-OMEGA
449 DEVICE_PROFILE := OMEGA
450 TPLINK_HWID := 0x04700001
451 CONSOLE := ttyATH0,115200
452 endef
453 TARGET_DEVICES += onion-omega
454
455 define Device/tl-mr10u-v1
456 $(Device/tplink-4mlzma)
457 BOARDNAME := TL-MR10U
458 DEVICE_PROFILE := TLMR10U
459 TPLINK_HWID := 0x00100101
460 CONSOLE := ttyATH0,115200
461 endef
462
463 define Device/tl-mr11u-v1
464 $(Device/tplink-4mlzma)
465 BOARDNAME := TL-MR11U
466 DEVICE_PROFILE := TLMR11U
467 TPLINK_HWID := 0x00110101
468 CONSOLE := ttyATH0,115200
469 endef
470
471 define Device/tl-mr11u-v2
472 $(Device/tplink-4mlzma)
473 BOARDNAME := TL-MR11U
474 DEVICE_PROFILE := TLMR11U
475 TPLINK_HWID := 0x00110102
476 CONSOLE := ttyATH0,115200
477 endef
478
479 define Device/tl-mr12u-v1
480 $(Device/tplink-4mlzma)
481 BOARDNAME := TL-MR13U
482 DEVICE_PROFILE := TLMR12U
483 TPLINK_HWID := 0x00120101
484 CONSOLE := ttyATH0,115200
485 endef
486
487 define Device/tl-mr13u-v1
488 $(Device/tplink-4mlzma)
489 BOARDNAME := TL-MR13U
490 DEVICE_PROFILE := TLMR13U
491 TPLINK_HWID := 0x00130101
492 CONSOLE := ttyATH0,115200
493 endef
494 TARGET_DEVICES += tl-mr10u-v1 tl-mr11u-v1 tl-mr11u-v2 tl-mr12u-v1 tl-mr13u-v1
495
496 define Device/tl-mr3020-v1
497 $(Device/tplink-4mlzma)
498 BOARDNAME := TL-MR3020
499 DEVICE_PROFILE := TLMR3020
500 TPLINK_HWID := 0x30200001
501 CONSOLE := ttyATH0,115200
502 endef
503
504 define Device/tl-mr3040-v1
505 $(Device/tplink-4mlzma)
506 BOARDNAME := TL-MR3040
507 DEVICE_PROFILE := TLMR3040
508 TPLINK_HWID := 0x30400001
509 CONSOLE := ttyATH0,115200
510 endef
511
512 define Device/tl-mr3040-v2
513 $(Device/tplink-4mlzma)
514 BOARDNAME := TL-MR3040-v2
515 DEVICE_PROFILE := TLMR3040
516 TPLINK_HWID := 0x30400002
517 CONSOLE := ttyATH0,115200
518 endef
519
520 define Device/tl-mr3220-v1
521 $(Device/tplink-4m)
522 BOARDNAME := TL-MR3220
523 DEVICE_PROFILE := TLMR3220
524 TPLINK_HWID := 0x32200001
525 endef
526
527 define Device/tl-mr3220-v2
528 $(Device/tplink-4mlzma)
529 BOARDNAME := TL-MR3220-v2
530 DEVICE_PROFILE := TLMR3220
531 TPLINK_HWID := 0x32200002
532 CONSOLE := ttyATH0,115200
533 endef
534
535 define Device/tl-mr3420-v1
536 $(Device/tplink-4m)
537 BOARDNAME := TL-MR3420
538 DEVICE_PROFILE := TLMR3420
539 TPLINK_HWID := 0x34200001
540 endef
541
542 define Device/tl-mr3420-v2
543 $(Device/tplink-4mlzma)
544 BOARDNAME := TL-MR3420-v2
545 DEVICE_PROFILE := TLMR3420
546 TPLINK_HWID := 0x34200002
547 endef
548 TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v1 tl-mr3220-v2 tl-mr3420-v1 tl-mr3420-v2
549
550 define Device/tl-wr703n-v1
551 $(Device/tplink-4mlzma)
552 BOARDNAME := TL-WR703N
553 DEVICE_PROFILE := TLWR703
554 TPLINK_HWID := 0x07030101
555 CONSOLE := ttyATH0,115200
556 endef
557
558 define Device/tl-wr710n-v1
559 $(Device/tplink-8mlzma)
560 BOARDNAME := TL-WR710N
561 DEVICE_PROFILE := TLWR710
562 TPLINK_HWID := 0x07100001
563 CONSOLE := ttyATH0,115200
564 endef
565
566 define Device/tl-wr710n-v2
567 $(Device/tplink-4mlzma)
568 BOARDNAME := TL-WR710N
569 DEVICE_PROFILE := TLWR710
570 TPLINK_HWID := 0x07100002
571 CONSOLE := ttyATH0,115200
572 endef
573
574 define Device/tl-wr720n-v3
575 $(Device/tplink-4mlzma)
576 BOARDNAME := TL-WR720N-v3
577 DEVICE_PROFILE := TLWR720
578 TPLINK_HWID := 0x07200103
579 CONSOLE := ttyATH0,115200
580 endef
581
582 define Device/tl-wr720n-v4
583 $(Device/tplink-4mlzma)
584 BOARDNAME := TL-WR720N-v3
585 DEVICE_PROFILE := TLWR720
586 TPLINK_HWID := 0x07200104
587 CONSOLE := ttyATH0,115200
588 endef
589 TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3 tl-wr720n-v4
590
591 define Device/tl-wr740n-v1
592 $(Device/tplink-4m)
593 BOARDNAME := TL-WR741ND
594 DEVICE_PROFILE := TLWR740
595 TPLINK_HWID := 0x07400001
596 endef
597
598 define Device/tl-wr740n-v3
599 $(Device/tplink-4m)
600 BOARDNAME := TL-WR741ND
601 DEVICE_PROFILE := TLWR740
602 TPLINK_HWID := 0x07400003
603 endef
604
605 define Device/tl-wr740n-v4
606 $(Device/tplink-4mlzma)
607 BOARDNAME := TL-WR741ND-v4
608 DEVICE_PROFILE := TLWR740
609 TPLINK_HWID := 0x07400004
610 CONSOLE := ttyATH0,115200
611 endef
612
613 define Device/tl-wr740n-v5
614 $(Device/tplink-4mlzma)
615 BOARDNAME := TL-WR741ND-v4
616 DEVICE_PROFILE := TLWR740
617 TPLINK_HWID := 0x07400005
618 CONSOLE := ttyATH0,115200
619 endef
620
621 define Device/tl-wr741nd-v1
622 $(Device/tplink-4m)
623 BOARDNAME := TL-WR741ND
624 DEVICE_PROFILE := TLWR741
625 TPLINK_HWID := 0x07410001
626 endef
627
628 define Device/tl-wr741nd-v2
629 $(Device/tplink-4m)
630 BOARDNAME := TL-WR741ND
631 DEVICE_PROFILE := TLWR741
632 TPLINK_HWID := 0x07410001
633 endef
634
635 define Device/tl-wr741nd-v4
636 $(Device/tplink-4mlzma)
637 BOARDNAME := TL-WR741ND-v4
638 DEVICE_PROFILE := TLWR741
639 TPLINK_HWID := 0x07410004
640 CONSOLE := ttyATH0,115200
641 endef
642
643 define Device/tl-wr741nd-v5
644 $(Device/tplink-4mlzma)
645 BOARDNAME := TL-WR741ND-v4
646 DEVICE_PROFILE := TLWR741
647 TPLINK_HWID := 0x07400005
648 CONSOLE := ttyATH0,115200
649 endef
650
651 define Device/tl-wr743nd-v1
652 $(Device/tplink-4m)
653 BOARDNAME := TL-WR741ND
654 DEVICE_PROFILE := TLWR743
655 TPLINK_HWID := 0x07430001
656 endef
657
658 define Device/tl-wr743nd-v2
659 $(Device/tplink-4mlzma)
660 BOARDNAME := TL-WR741ND-v4
661 DEVICE_PROFILE := TLWR743
662 TPLINK_HWID := 0x07430002
663 CONSOLE := ttyATH0,115200
664 endef
665 TARGET_DEVICES += tl-wr740n-v1 tl-wr740n-v3 tl-wr740n-v4 tl-wr740n-v5 tl-wr741nd-v1 tl-wr741nd-v2 tl-wr741nd-v4 tl-wr741nd-v5 tl-wr743nd-v1 tl-wr743nd-v2
666
667 define Device/tl-wr841nd-v1.5
668 $(Device/tplink-4m)
669 BOARDNAME := TL-WR841N-v1.5
670 DEVICE_PROFILE := TLWR841
671 TPLINK_HWID := 0x08410002
672 TPLINK_HWREV := 2
673 endef
674
675 define Device/tl-wr841nd-v3
676 $(Device/tplink-4m)
677 BOARDNAME := TL-WR941ND
678 DEVICE_PROFILE := TLWR841
679 TPLINK_HWID := 0x08410003
680 TPLINK_HWREV := 3
681 endef
682
683 define Device/tl-wr841nd-v5
684 $(Device/tplink-4m)
685 BOARDNAME := TL-WR741ND
686 DEVICE_PROFILE := TLWR841
687 TPLINK_HWID := 0x08410005
688 endef
689
690 define Device/tl-wr841nd-v7
691 $(Device/tplink-4m)
692 BOARDNAME := TL-WR841N-v7
693 DEVICE_PROFILE := TLWR841
694 TPLINK_HWID := 0x08410007
695 endef
696
697 define Device/tl-wr841n-v8
698 $(Device/tplink-4mlzma)
699 BOARDNAME := TL-WR841N-v8
700 DEVICE_PROFILE := TLWR841
701 TPLINK_HWID := 0x08410008
702 endef
703
704 define Device/tl-wr841n-v9
705 $(Device/tplink-4mlzma)
706 BOARDNAME := TL-WR841N-v9
707 DEVICE_PROFILE := TLWR841
708 TPLINK_HWID := 0x08410009
709 endef
710
711 define Device/tl-wr841n-v10
712 $(Device/tplink-4mlzma)
713 BOARDNAME := TL-WR841N-v9
714 DEVICE_PROFILE := TLWR841
715 TPLINK_HWID := 0x08410010
716 endef
717
718 define Device/tl-wr842n-v1
719 $(Device/tplink-8m)
720 BOARDNAME := TL-MR3420
721 DEVICE_PROFILE := TLWR842
722 TPLINK_HWID := 0x08420001
723 endef
724
725 define Device/tl-wr842n-v2
726 $(Device/tplink-8mlzma)
727 BOARDNAME := TL-WR842N-v2
728 DEVICE_PROFILE := TLWR842
729 TPLINK_HWID := 0x8420002
730 endef
731
732 define Device/tl-wr843nd-v1
733 $(Device/tplink-4mlzma)
734 BOARDNAME := TL-WR841N-v8
735 DEVICE_PROFILE := TLWR843
736 TPLINK_HWID := 0x08430001
737 endef
738
739 define Device/tl-wr847n-v8
740 $(Device/tplink-4mlzma)
741 BOARDNAME := TL-WR841N-v8
742 DEVICE_PROFILE := TLWR841
743 TPLINK_HWID := 0x08470008
744 endef
745 TARGET_DEVICES += tl-wr841nd-v1.5 tl-wr841nd-v3 tl-wr841nd-v5 tl-wr841nd-v7 tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr842n-v1 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
746
747 define Device/tl-wr941nd-v2
748 $(Device/tplink-4m)
749 BOARDNAME := TL-WR941ND
750 DEVICE_PROFILE := TLWR941
751 TPLINK_HWID := 0x09410002
752 TPLINK_HWREV := 2
753 endef
754
755 define Device/tl-wr941nd-v3
756 $(Device/tplink-4m)
757 BOARDNAME := TL-WR941ND
758 DEVICE_PROFILE := TLWR941
759 TPLINK_HWID := 0x09410002
760 TPLINK_HWREV := 2
761 endef
762
763 define Device/tl-wr941nd-v4
764 $(Device/tplink-4m)
765 BOARDNAME := TL-WR741ND
766 DEVICE_PROFILE := TLWR941
767 TPLINK_HWID := 0x09410004
768 endef
769
770 define Device/tl-wr941nd-v5
771 $(Device/tplink-4mlzma)
772 BOARDNAME := TL-WR941ND-v5
773 DEVICE_PROFILE := TLWR941
774 TPLINK_HWID := 0x09410005
775 endef
776
777 # Chinese version (unlike European) is similar to the TL-WDR3500
778 define Device/tl-wr941nd-v6-cn
779 $(Device/tplink-4mlzma)
780 BOARDNAME := TL-WDR3500
781 DEVICE_PROFILE := TLWR941
782 TPLINK_HWID := 0x09410006
783 endef
784 TARGET_DEVICES += tl-wr941nd-v2 tl-wr941nd-v3 tl-wr941nd-v4 tl-wr941nd-v5 tl-wr941nd-v6-cn
785
786 define Device/tl-wr1041n-v2
787 $(Device/tplink-4mlzma)
788 BOARDNAME := TL-WR1041N-v2
789 DEVICE_PROFILE := TLWR1041
790 TPLINK_HWID := 0x10410002
791 endef
792 TARGET_DEVICES += tl-wr1041n-v2
793
794 define Device/tl-wr1043nd-v1
795 $(Device/tplink-8m)
796 BOARDNAME := TL-WR1043ND
797 DEVICE_PROFILE := TLWR1043
798 TPLINK_HWID := 0x10430001
799 endef
800
801 define Device/tl-wr1043nd-v2
802 $(Device/tplink-8mlzma)
803 BOARDNAME := TL-WR1043ND-v2
804 DEVICE_PROFILE := TLWR1043
805 TPLINK_HWID := 0x10430002
806 endef
807 TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2
808
809 define Device/tl-wr2543-v1
810 $(Device/tplink-8mlzma)
811 BOARDNAME := TL-WR2543N
812 DEVICE_PROFILE := TLWR2543
813 TPLINK_HWID := 0x25430001
814 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade "-v 3.13.99"
815 IMAGE/factory.bin := append-rootfs | mktplinkfw factory "-v 3.13.99"
816 endef
817 TARGET_DEVICES += tl-wr2543-v1
818
819 define Device/tl-wdr4900-v2
820 $(Device/tplink-8mlzma)
821 BOARDNAME := TL-WDR4900-v2
822 DEVICE_PROFILE := TLWDR4900V2
823 TPLINK_HWID := 0x49000002
824 endef
825 TARGET_DEVICES += tl-wdr4900-v2
826
827 define Device/tl-wa701n-v1
828 $(Device/tplink-4m)
829 BOARDNAME := TL-WA901ND
830 DEVICE_PROFILE := TLWA701
831 TPLINK_HWID := 0x07010001
832 endef
833
834 define Device/tl-wa701nd-v2
835 $(Device/tplink-4mlzma)
836 BOARDNAME := TL-WA701ND-v2
837 DEVICE_PROFILE := TLWA701
838 TPLINK_HWID := 0x07010002
839 CONSOLE := ttyATH0,115200
840 endef
841
842 define Device/tl-wa730rev1
843 $(Device/tplink-4m)
844 BOARDNAME := TL-WA901ND
845 DEVICE_PROFILE := TLWA730RE
846 TPLINK_HWID := 0x07300001
847 endef
848
849 define Device/tl-wa750re-v1
850 $(Device/tplink-4mlzma)
851 BOARDNAME := TL-WA750RE
852 DEVICE_PROFILE := TLWA750
853 TPLINK_HWID := 0x07500001
854 endef
855
856 define Device/tl-wa7510n
857 $(Device/tplink-4m)
858 BOARDNAME := TL-WA7510N
859 DEVICE_PROFILE := TLWA7510
860 TPLINK_HWID := 0x75100001
861 endef
862 TARGET_DEVICES += tl-wa701n-v1 tl-wa701nd-v2 tl-wa730rev1 tl-wa750re-v1 tl-wa7510n
863
864 define Device/tl-wa801nd-v1
865 $(Device/tplink-4m)
866 BOARDNAME := TL-WA901ND
867 DEVICE_PROFILE := TLWA801
868 TPLINK_HWID := 0x08010001
869 endef
870
871 define Device/tl-wa801nd-v2
872 $(Device/tplink-4mlzma)
873 BOARDNAME := TL-WA801ND-v2
874 DEVICE_PROFILE := TLWA801
875 TPLINK_HWID := 0x08010002
876 endef
877
878 define Device/tl-wa830re-v1
879 $(Device/tplink-4m)
880 BOARDNAME := TL-WA901ND
881 DEVICE_PROFILE := TLWA830
882 TPLINK_HWID := 0x08300010
883 endef
884
885 define Device/tl-wa830re-v2
886 $(Device/tplink-4mlzma)
887 BOARDNAME := TL-WA830RE-v2
888 DEVICE_PROFILE := TLWA830
889 TPLINK_HWID := 0x08300002
890 endef
891
892 define Device/tl-wa850re-v1
893 $(Device/tplink-4mlzma)
894 BOARDNAME := TL-WA850RE
895 DEVICE_PROFILE := TLWA850
896 TPLINK_HWID := 0x08500001
897 endef
898
899 define Device/tl-wa860re-v1
900 $(Device/tplink-4mlzma)
901 BOARDNAME := TL-WA860RE
902 DEVICE_PROFILE := TLWA860
903 TPLINK_HWID := 0x08600001
904 endef
905 TARGET_DEVICES += tl-wa801nd-v1 tl-wa801nd-v2 tl-wa830re-v1 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
906
907 define Device/tl-wa901nd-v1
908 $(Device/tplink-4m)
909 BOARDNAME := TL-WA901ND
910 DEVICE_PROFILE := TLWA901
911 TPLINK_HWID := 0x09010001
912 endef
913
914 define Device/tl-wa901nd-v2
915 $(Device/tplink-4m)
916 BOARDNAME := TL-WA901ND-v2
917 DEVICE_PROFILE := TLWA901
918 TPLINK_HWID := 0x09010002
919 endef
920
921 define Device/tl-wa901nd-v3
922 $(Device/tplink-4mlzma)
923 BOARDNAME := TL-WA901ND-v3
924 DEVICE_PROFILE := TLWA901
925 TPLINK_HWID := 0x09010003
926 endef
927 TARGET_DEVICES += tl-wa901nd-v1 tl-wa901nd-v2 tl-wa901nd-v3
928
929 define Device/tl-wa7210n-v2
930 $(Device/tplink-4mlzma)
931 BOARDNAME := TL-WA7210N-v2
932 DEVICE_PROFILE := TLWA7210
933 TPLINK_HWID := 0x72100002
934 CONSOLE := ttyATH0,115200
935 endef
936 TARGET_DEVICES += tl-wa7210n-v2
937
938 define Device/smart-300
939 $(Device/tplink-8mlzma)
940 BOARDNAME := SMART-300
941 DEVICE_PROFILE := SMART-300
942 TPLINK_HWID := 0x93410001
943 endef
944 TARGET_DEVICES += smart-300
945
946 define Device/oolite
947 $(Device/tplink-16mlzma)
948 BOARDNAME := GS-OOLITE
949 DEVICE_PROFILE := OOLITE
950 TPLINK_HWID := 0x3C000101
951 CONSOLE := ttyATH0,115200
952 endef
953 TARGET_DEVICES += oolite
954
955 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
956 # UBNT_TYPE e.g. one of (BZ, XM, XW)
957 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
958 define Device/ubnt-xm
959 DEVICE_PROFILE := UBNT
960 IMAGE_SIZE := 7552k
961 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
962 UBNT_TYPE := XM
963 UBNT_BOARD := XM
964 UBNT_CHIP := ar7240
965 IMAGES := sysupgrade.bin factory.bin
966 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
967 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
968 endef
969
970 define Device/ubnt-xw
971 DEVICE_PROFILE := UBNT
972 IMAGE_SIZE := 7552k
973 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
974 UBNT_TYPE := XW
975 UBNT_BOARD := XM
976 UBNT_CHIP := ar934x
977 IMAGES := sysupgrade.bin factory.bin
978 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
979 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
980 endef
981
982 define Device/ubnt-bz
983 DEVICE_PROFILE := UBNT
984 IMAGE_SIZE := 7552k
985 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
986 UBNT_TYPE := BZ
987 UBNT_BOARD := XM
988 UBNT_CHIP := ar934x
989 IMAGES := sysupgrade.bin factory.bin
990 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
991 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
992 endef
993
994 define Device/rw2458n
995 $(Device/ubnt-xm)
996 BOARDNAME := RW2458N
997 endef
998
999 define Device/ubnt-airrouter
1000 $(Device/ubnt-xm)
1001 BOARDNAME := UBNT-AR
1002 endef
1003
1004 define Device/ubnt-bullet-m
1005 $(Device/ubnt-xm)
1006 BOARDNAME := UBNT-BM
1007 endef
1008
1009 define Device/ubnt-rocket-m
1010 $(Device/ubnt-xm)
1011 BOARDNAME := UBNT-RM
1012 endef
1013
1014 define Device/ubnt-nano-m
1015 $(Device/ubnt-xm)
1016 BOARDNAME := UBNT-NM
1017 endef
1018 TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
1019
1020 define Device/ubnt-unifi
1021 $(Device/ubnt-bz)
1022 BOARDNAME := UBNT-UF
1023 DEVICE_PROFILE := UBNT UBNTUNIFI
1024 endef
1025
1026 define Device/ubnt-unifi-outdoor
1027 $(Device/ubnt-bz)
1028 BOARDNAME := UBNT-U20
1029 DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
1030 endef
1031 TARGET_DEVICES += ubnt-unifi ubnt-unifi-outdoor
1032
1033 define Device/ubnt-nano-m-xw
1034 $(Device/ubnt-xw)
1035 BOARDNAME := UBNT-NM-XW
1036 endef
1037
1038 define Device/ubnt-loco-m-xw
1039 $(Device/ubnt-xw)
1040 BOARDNAME := UBNT-LOCO-XW
1041 endef
1042
1043 define Device/ubnt-rocket-m-xw
1044 $(Device/ubnt-xw)
1045 BOARDNAME := UBNT-RM-XW
1046 endef
1047
1048 define Device/ubnt-rocket-m-ti
1049 $(Device/ubnt-xw)
1050 BOARDNAME := UBNT-RM-TI
1051 UBNT_TYPE := TI
1052 UBNT_BOARD := XM
1053 endef
1054 TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
1055
1056 define Device/ubnt-air-gateway
1057 $(Device/ubnt-xm)
1058 BOARDNAME := UBNT-AGW
1059 UBNT_BOARD := XM
1060 UBNT_TYPE := AirGW
1061 UBNT_CHIP := ar933x
1062 CONSOLE = ttyATH0,115200
1063 endef
1064 TARGET_DEVICES += ubnt-air-gateway
1065
1066 define Device/ubnt-air-gateway-pro
1067 $(Device/ubnt-xm)
1068 BOARDNAME := UBNT-AGWP
1069 UBNT_TYPE := AirGWP
1070 UBNT_CHIP := ar934x
1071 CONSOLE = ttyS0,115200
1072 endef
1073 TARGET_DEVICES += ubnt-air-gateway-pro
1074
1075 define Device/ubdev01
1076 $(Device/ubnt-xm)
1077 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
1078 BOARDNAME := UBNT-UF
1079 UBNT_BOARD := XM
1080 UBNT_TYPE := XM
1081 UBNT_CHIP := ar7240
1082 endef
1083
1084 TARGET_DEVICES += ubdev01
1085
1086 define Device/ubnt-routerstation
1087 IMAGE_SIZE := 16128k
1088 IMAGES := sysupgrade.bin factory.bin
1089 IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
1090 IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
1091 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
1092 endef
1093
1094 define Device/ubnt-rs
1095 $(Device/ubnt-routerstation)
1096 BOARDNAME := UBNT-RS
1097 DEVICE_PROFILE := Madwifi UBNT UBNTRS
1098 UBNT_BOARD := RS
1099 UBNT_TYPE := RSx
1100 UBNT_CHIP := ar7100
1101 endef
1102
1103 define Device/ubnt-rspro
1104 $(Device/ubnt-routerstation)
1105 BOARDNAME := UBNT-RSPRO
1106 DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
1107 UBNT_BOARD := RSPRO
1108 UBNT_TYPE := RSPRO
1109 UBNT_CHIP := ar7100pro
1110 endef
1111
1112 define Device/ubnt-ls-sr71
1113 $(Device/ubnt-routerstation)
1114 BOARDNAME := UBNT-LS-SR71
1115 DEVICE_PROFILE := Madwifi UBNT
1116 UBNT_BOARD := LS-SR71
1117 UBNT_TYPE := LS-SR71
1118 UBNT_CHIP := ar7100
1119 endef
1120
1121 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
1122
1123 define Device/ubnt-uap-pro
1124 KERNEL_SIZE := 1536k
1125 IMAGE_SIZE := 15744k
1126 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
1127 UBNT_TYPE := BZ
1128 UBNT_CHIP := ar934x
1129 BOARDNAME := UAP-PRO
1130 DEVICE_PROFILE := UBNT UAPPRO
1131 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
1132 IMAGES := sysupgrade.bin factory.bin
1133 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
1134 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
1135 endef
1136
1137 define Device/ubnt-unifi-outdoor-plus
1138 $(Device/ubnt-uap-pro)
1139 UBNT_CHIP := ar7240
1140 BOARDNAME := UBNT-UOP
1141 DEVICE_PROFILE := UBNT
1142 endef
1143
1144 TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus
1145
1146 rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
1147
1148 # $(1): rootfs type.
1149 # $(2): board name.
1150 define imgname
1151 $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(call rootfs_type,$(1))
1152 endef
1153
1154 define rootfs_align
1155 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
1156 endef
1157
1158 define sysupname
1159 $(call imgname,$(1),$(2))-sysupgrade.bin
1160 endef
1161
1162 define factoryname
1163 $(call imgname,$(1),$(2))-factory.bin
1164 endef
1165
1166 COMMA:=,
1167
1168 define mkcmdline
1169 $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
1170 endef
1171
1172 define mtdpartsize
1173 $(shell sz=`echo '$(2)' | sed -ne 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/p'`; [ -n "$$sz" ] && echo $$(($$sz * 1024)))
1174 endef
1175
1176 SINGLE_PROFILES:=
1177
1178 # $(1) : name of image build method to be used, e.g., AthLzma.
1179 # $(2) : name of the build template to be used, e.g. 64k, 64kraw, 128k, etc.
1180 # $(3) : name of the profile to be defined.
1181 # $(4) : board name.
1182 # $(5)~$(7) : arguments for $(mkcmdline)
1183 # board=$(1) console=$(2),$(3)
1184 # $(8)~$(14): extra arguments.
1185 define SingleProfile
1186 # $(1): action name, e.g. loader, buildkernel, squashfs, etc.
1187 define Image/Build/Profile/$(3)
1188 $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12),$(13),$(14))
1189 endef
1190 SINGLE_PROFILES += $(3)
1191 endef
1192
1193 # $(1), name of the MultiProfile to be added.
1194 # $(2), name of Profiles to be included in the MultiProfile.
1195 define MultiProfile
1196 define Image/Build/Profile/$(1)
1197 $(foreach p,$(2),
1198 $$(call Image/Build/Profile/$p,$$(1))
1199 )
1200 endef
1201 endef
1202
1203 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
1204
1205 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
1206 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
1207
1208 # $(1): input file.
1209 # $(2): output file.
1210 # $(3): extra arguments for lzma.
1211 define CompressLzma
1212 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(3) $(2)
1213 endef
1214
1215 define PatchKernel
1216 cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
1217 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
1218 endef
1219
1220 define PatchKernel/initramfs
1221 $(call PatchKernel,$(1),$(2),-initramfs)
1222 cp $(KDIR_TMP)/vmlinux-initramfs-$(1) $(call imgname,initramfs,$(1)).bin
1223 endef
1224
1225 # $(1): board name.
1226 # $(2): kernel command line.
1227 # $(3): extra argumetns for lzma.
1228 # $(4): name suffix, e.g. "-initramfs".
1229 define PatchKernelLzma
1230 cp $(KDIR)/vmlinux$(4) $(KDIR_TMP)/vmlinux$(4)-$(1)
1231 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(4)-$(1) "$(strip $(2))"
1232 $(call CompressLzma,$(KDIR_TMP)/vmlinux$(4)-$(1),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(3))
1233 endef
1234
1235 define PatchKernelGzip
1236 cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
1237 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
1238 gzip -9n -c $(KDIR_TMP)/vmlinux$(3)-$(1) > $(KDIR_TMP)/vmlinux$(3)-$(1).bin.gz
1239 endef
1240
1241 ifneq ($(SUBTARGET),mikrotik)
1242 # $(1): compression method of the data.
1243 # $(2): extra arguments.
1244 # $(3): input data file.
1245 # $(4): output file.
1246 define MkuImage
1247 mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
1248 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
1249 -d $(3) $(4)
1250 endef
1251
1252 # $(1): board name.
1253 # $(2): kernel command line.
1254 # $(3): extra arguments for lzma.
1255 # $(4): name suffix, e.g. "-initramfs".
1256 # $(5): extra arguments for mkimage.
1257 define MkuImageLzma
1258 $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
1259 $(call MkuImage,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
1260 endef
1261
1262 define MkuImageLzma/initramfs
1263 $(call PatchKernelLzma,$(1),$(2),$(3),-initramfs)
1264 $(call MkuImage,lzma,$(4),$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.lzma,$(call imgname,initramfs,$(1))-uImage.bin)
1265 endef
1266
1267 define MkuImageGzip
1268 $(call PatchKernelGzip,$(1),$(2))
1269 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(KDIR_TMP)/vmlinux-$(1).uImage)
1270 endef
1271
1272 define MkuImageGzip/initramfs
1273 $(call PatchKernelGzip,$(1),$(2),-initramfs)
1274 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.gz,$(call imgname,initramfs,$(1))-uImage.bin)
1275 endef
1276
1277 define MkuImageOKLI
1278 $(call MkuImage,lzma,-M 0x4f4b4c49,$(KDIR)/vmlinux.bin.lzma,$(KDIR_TMP)/vmlinux-$(1).okli)
1279 endef
1280 endif
1281
1282 # $(1): name of the 1st file.
1283 # $(2): size limit of the 1st file if it is greater than 262144, or
1284 # the erase size of the flash if it is greater than zero and less
1285 # than 262144
1286 # $(3): name of the 2nd file.
1287 # $(4): size limit of the 2nd file if $(2) is greater than 262144, otherwise
1288 # it is the size limit of the output file
1289 # $(5): name of the output file.
1290 # $(6): padding size.
1291 define CatFiles
1292 if [ $(2) -eq 0 ]; then \
1293 filename="$(3)"; fstype=$$$${filename##*\.}; \
1294 case "$$$${fstype}" in \
1295 "jffs2-64k") bs=65536;; \
1296 "jffs2-128k") bs=131072;; \
1297 "jffs2-256k") bs=262144;; \
1298 *) bs=`stat -c%s $(1)`;; \
1299 esac; \
1300 ( dd if=$(1) bs=$$$${bs} conv=sync; cat $(3) ) > $(5); \
1301 if [ -n "$(6)" ]; then \
1302 case "$$$${fstype}" in \
1303 squashfs*) \
1304 padjffs2 $(5) $(6); \
1305 ;; \
1306 esac; \
1307 fi; \
1308 if [ `stat -c%s $(5)` -gt $(4) ]; then \
1309 echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
1310 rm -f $(5); \
1311 fi; \
1312 else if [ $(2) -gt 262144 ]; then \
1313 if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
1314 echo "Warning: $(1) is too big (> $(2) bytes)" >&2; \
1315 else if [ `stat -c%s $(3)` -gt $(4) ]; then \
1316 echo "Warning: $(3) is too big (> $(4) bytes)" >&2; \
1317 else \
1318 ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
1319 fi; fi; \
1320 else \
1321 ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
1322 if [ `stat -c%s $(5)` -gt $(4) ]; then \
1323 echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
1324 rm -f $(5); \
1325 fi; \
1326 fi; fi
1327 endef
1328
1329 # $(1): rootfs type.
1330 # $(2): board name.
1331 # $(3): kernel image size limit.
1332 # $(4): rootfs image size limit.
1333 # $(5): padding argument for padjffs2.
1334 Sysupgrade/KR=$(call CatFiles,$(2),$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(5)))
1335 Sysupgrade/KRuImage=$(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)),$(5))
1336 Sysupgrade/RKuImage=$(call CatFiles,$(KDIR)/root.$(1),$(4),$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(call sysupname,$(1),$(2)))
1337
1338 # $(1): ubinize ini file
1339 # $(2): working directory
1340 # $(3): output file
1341 # $(4): physical erase block size
1342 # $(5): minimum I/O unit size
1343 # $(6): custom options
1344 define ubinize
1345 $(CP) $(1) $(2)
1346 ( cd $(2); $(STAGING_DIR_HOST)/bin/ubinize -o $(3) -p $(4) -m $(5) $(6) $(1))
1347 endef
1348
1349 #
1350 # Embed lzma-compressed kernel inside lzma-loader.
1351 #
1352 # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
1353 # $(2), suffix of target file to build, e.g. bin, gz, elf
1354 # $(3), kernel command line to pass from lzma-loader to kernel
1355 # $(4), unused here
1356 # $(5), suffix of kernel filename, e.g. -initramfs, or empty
1357 define Image/BuildLoader
1358 -rm -rf $(KDIR)/lzma-loader
1359 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)"\
1360 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1361 LOADER_DATA="$(KDIR)/vmlinux$(5).bin.lzma" BOARD="$(1)" \
1362 compile loader.$(2)
1363 -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
1364 endef
1365
1366 #
1367 # Embed patched lzma-compressed kernel inside lzma-loader.
1368 #
1369 # Specifying the command line via the lzma-loader doesn't work with some
1370 # models (like the TP-LINK CPE series), so this version first patches the
1371 # command line in the image and then builds the loader around it.
1372 #
1373 # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
1374 # $(2), suffix of target file to build, e.g. bin, gz, elf
1375 # $(3), kernel command line to pass from lzma-loader to kernel
1376 # $(4), unused here
1377 # $(5), suffix of kernel filename, e.g. -initramfs, or empty
1378 define Image/BuildLoaderPatched
1379 $(call PatchKernelLzma,$(1),$(3))
1380 -rm -rf $(KDIR)/lzma-loader
1381 $(LOADER_MAKE) LOADER=loader-$(1).$(2) \
1382 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1383 LOADER_DATA="$(KDIR_TMP)/vmlinux-$(1)$(5).bin.lzma" BOARD="$(1)" \
1384 compile loader.$(2)
1385 -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
1386 endef
1387
1388 #
1389 # Build lzma-loader alone which will search for lzma-compressed kernel identified by
1390 # uImage header with magic "OKLI" at boot time.
1391 #
1392 # $(4), offset into the flash space to start searching uImage magic "OKLI".
1393 # $(5), size of search range starting at $(4). With 0 as the value, uImage
1394 # header is expected to be at precisely $(4)
1395 define Image/BuildLoaderAlone
1396 -rm -rf $(KDIR)/lzma-loader
1397 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)" \
1398 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1399 BOARD="$(1)" FLASH_OFFS=$(4) FLASH_MAX=$(5) \
1400 compile loader.$(2)
1401 endef
1402
1403 define Build/Clean
1404 $(LOADER_MAKE) clean
1405 endef
1406
1407
1408 alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
1409 alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
1410 alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro
1411 all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)
1412 all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro
1413 ap81_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,5120k(rootfs),2688k(kernel),64k(art)ro,7808k@0x50000(firmware)
1414 ap83_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,4096k(rootfs),3648k(kernel),64k(art)ro,7744k@0x60000(firmware)
1415 ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
1416 ap113_mtd_layout=mtdparts=spi0.0:64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware)
1417 ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
1418 ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2448k(rootfs),1200k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
1419 ap121_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
1420 ap132_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),6400k(rootfs),64k(art),7808k@0x50000(firmware)
1421 ap135_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
1422 ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k@0x50000(firmware)
1423 ap143_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1472k(kernel),64k(art)ro,7744k@0x50000(firmware)
1424 ap143_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
1425 ap147_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art),16000k@0x50000(firmware)
1426 ap152_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
1427 bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro
1428 cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro
1429 cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro
1430 cameo_ap99_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3520k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro
1431 cameo_ap121_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,3648k(firmware)
1432 cameo_ap121_mtdlayout_8M=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)ro,7680k@0x80000(firmware)
1433 cameo_ap123_mtdlayout_4M=mtdparts=spi0.0:64k(u-boot)ro,64k(nvram)ro,3712k(firmware),192k(lang)ro,64k(art)ro
1434 cameo_db120_mtdlayout=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,15936k(firmware),192k(lang)ro,64k(mac)ro,64k(art)ro
1435 cameo_db120_mtdlayout_8M=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,7872k(firmware),128k(lang)ro,64k(art)ro
1436 cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,1536k(kernel),12096k(rootfs),2048k(failsafe),64k(art),13632k@0xa0000(firmware)
1437 cpe510_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware)
1438 eap300v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),320k(custom),13632k(firmware),2048k(failsafe),64k(art)ro
1439 db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
1440 dgl_5500_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,15296k(firmware),192k(lang)ro,512k(my-dlink)ro,64k(mac)ro,64k(art)ro
1441 dlan_pro_500_wp_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,7680k@0x70000(firmware),64k(art)ro
1442 dlan_pro_1200_ac_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,15872k@0x70000(firmware),64k(art)ro
1443 cameo_ap94_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,1600k(unknown)ro,64k@0x7f0000(caldata_copy)
1444 cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmware),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
1445 esr900_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
1446 esr1750_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
1447 epg5000_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
1448 ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art)
1449 ew-dorin_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
1450 f9k1115v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14464k(rootfs),1408k(kernel),64k(nvram)ro,64k(envram)ro,64k(art)ro,15872k@0x50000(firmware)
1451 dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k@0x7f0000(caldata_copy)
1452 dlrtdev_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7168k(firmware),640k(certs),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
1453 dragino2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,16000k(firmware),64k(config)ro,64k(art)ro
1454 hiwifi_hc6361_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(bdinfo)ro,1280k(kernel),14848k(rootfs),64k(backup)ro,64k(art)ro,16128k@0x20000(firmware)
1455 mr12_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
1456 mr16_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
1457 pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
1458 planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),128k(art)ro
1459 ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
1460 uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
1461 ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
1462 whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
1463 wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x40000(firmware)
1464 wpj344_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
1465 wpj531_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
1466 wpj558_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
1467 wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware)
1468 wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
1469 wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro
1470 wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro
1471 r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter)
1472 wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
1473 zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
1474 mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
1475 mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
1476 zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
1477 qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
1478
1479
1480 define Image/BuildKernel
1481 cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
1482 cp $(KDIR)/vmlinux $(VMLINUX).bin
1483 dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
1484 dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
1485 $(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
1486 $(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
1487 cp $(KDIR)/loader-generic.elf $(VMLINUX)-lzma.elf
1488 -mkdir -p $(KDIR_TMP)
1489 $(call Image/Build/Profile/$(IMAGE_PROFILE),buildkernel)
1490 endef
1491
1492 define Image/BuildKernel/Initramfs
1493 cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
1494 cp $(KDIR)/vmlinux-initramfs $(VMLINUX)-initramfs.bin
1495 dd if=$(KDIR)/vmlinux-initramfs.bin.lzma of=$(VMLINUX)-initramfs.lzma bs=65536 conv=sync
1496 dd if=$(KDIR)/vmlinux-initramfs.bin.gz of=$(VMLINUX)-initramfs.gz bs=65536 conv=sync
1497 $(call MkuImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(UIMAGE)-initramfs-gzip.bin)
1498 $(call MkuImage,lzma,,$(KDIR)/vmlinux-initramfs.bin.lzma,$(UIMAGE)-initramfs-lzma.bin)
1499 cp $(KDIR)/loader-generic-initramfs.elf $(VMLINUX)-initramfs-lzma.elf
1500 $(call Image/Build/Initramfs)
1501 endef
1502
1503 Image/Build/WRT400N/buildkernel=$(call MkuImageLzma,$(2),$(3))
1504
1505 define Image/Build/WRT400N
1506 $(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
1507 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1508 wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
1509 fi
1510 endef
1511
1512
1513 define Image/Build/CameoAP94/buildkernel
1514 $(call MkuImageLzma,$(2),$(3) $(4))
1515 $(call MkuImageLzma,$(2)-fat,$(3) $(5))
1516 endef
1517
1518 define Image/Build/CameoAP94
1519 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1520 $(eval fwsize_fat=$(call mtdpartsize,firmware,$(5)))
1521 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1522 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1523 ( \
1524 dd if=$(call sysupname,$(1),$(2)); \
1525 echo -n "$(6)"; \
1526 ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
1527 if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
1528 echo "Warning: $(call sysupname,$(1),$(2)) is too big" >&2; \
1529 else \
1530 ( \
1531 dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
1532 echo -n "$(7)"; \
1533 ) > $(call factoryname,$(1),$(2)); \
1534 fi; \
1535 fi
1536 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,0,$(KDIR)/root.$(1),$$$$(($(fwsize_fat)-4*64*1024)),$(KDIR_TMP)/$(2)-fat.bin,64)
1537 if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
1538 echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
1539 sh $(TOPDIR)/scripts/combined-image.sh \
1540 "$(KDIR_TMP)/$(2)-fat.bin" \
1541 "$(KDIR_TMP)/$(2)-fat.dummy" \
1542 $(call sysupname,$(1),$(2)-fat); \
1543 fi
1544 endef
1545
1546 define Image/Build/WZRHP
1547 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(3)-4*$(4)*1024)),$(4))
1548 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1549 ( \
1550 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
1551 dd if=$(call sysupname,$(1),$(2)); \
1552 ) > $(call imgname,$(1),$(2))-tftp.bin; \
1553 buffalo-enc -p $(5) -v 1.99 \
1554 -i $(call sysupname,$(1),$(2)) \
1555 -o $(KDIR_TMP)/$(2).enc; \
1556 buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
1557 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
1558 -i $(KDIR_TMP)/$(2).enc \
1559 -o $(call factoryname,$(1),$(2)); \
1560 fi
1561 endef
1562
1563 Image/Build/WZRHP64K/buildkernel=$(call MkuImageLzma,$(2),$(3))
1564 Image/Build/WZRHP64K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1565 Image/Build/WZRHP64K=$(call Image/Build/WZRHP,$(1),$(2),33095680,64,$(4))
1566
1567 Image/Build/WZRHP128K/buildkernel=$(call MkuImageLzma,$(2),$(3))
1568 Image/Build/WZRHP128K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1569 Image/Build/WZRHP128K=$(call Image/Build/WZRHP,$(1),$(2),33030144,128,$(4))
1570
1571
1572 Image/Build/WHRHPG300N/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1573 Image/Build/WHRHPG300N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1574
1575 define Image/Build/WHRHPG300N
1576 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1577 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1578 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1579 ( \
1580 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
1581 dd if=$(call sysupname,$(1),$(2)); \
1582 ) > $(call imgname,$(1),$(2))-tftp.bin; \
1583 buffalo-enc -p $(5) -v 1.99 \
1584 -i $(call sysupname,$(1),$(2)) \
1585 -o $(KDIR_TMP)/$(2).enc; \
1586 buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
1587 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
1588 -i $(KDIR_TMP)/$(2).enc \
1589 -o $(call factoryname,$(1),$(2)); \
1590 fi
1591 endef
1592
1593
1594 define Image/Build/Cameo
1595 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1596 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1597 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1598 factory_size=$$$$(($(fwsize) - $(6))); \
1599 ( \
1600 dd if=$(call sysupname,$(1),$(2)) bs=$$$${factory_size} conv=sync; \
1601 echo -n $(5); \
1602 ) > $(call factoryname,$(1),$(2)); \
1603 fi
1604 endef
1605
1606 Image/Build/CameoAP81/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap81_mtdlayout))
1607 Image/Build/CameoAP81=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap81_mtdlayout),$(4),65536)
1608 Image/Build/CameoAP81/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap81_mtdlayout))
1609
1610 Image/Build/CameoAP91/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap91_mtdlayout))
1611 Image/Build/CameoAP91=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap91_mtdlayout),$(4),65536)
1612 Image/Build/CameoAP91/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap91_mtdlayout))
1613
1614 Image/Build/CameoAP99/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap99_mtdlayout))
1615 Image/Build/CameoAP99=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap99_mtdlayout),$(4),65536)
1616 Image/Build/CameoAP99/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap99_mtdlayout))
1617
1618 Image/Build/CameoAP123_4M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap123_mtdlayout_4M))
1619 Image/Build/CameoAP123_4M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap123_mtdlayout_4M),$(4),26)
1620 Image/Build/CameoAP123_4M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap123_mtdlayout_4M))
1621
1622 Image/Build/CameoAP135/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1623 Image/Build/CameoAP135=$(call Image/Build/Cameo,$(1),$(2),$(3),$(4),$(5),26)
1624 Image/Build/CameoAP135/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1625
1626 Image/Build/CameoDB120/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout))
1627 Image/Build/CameoDB120=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout),$(4),26)
1628 Image/Build/CameoDB120/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout))
1629
1630 Image/Build/CameoDB120_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout_8M))
1631 Image/Build/CameoDB120_8M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout_8M),$(4),26)
1632 Image/Build/CameoDB120_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout_8M))
1633
1634 define Image/Build/CameoHornet
1635 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1636 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1637 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1638 for r in $(7); do \
1639 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr=; \
1640 [ -z "$$$$r" ] && r="DEF"; \
1641 mkcameofw -M HORNET -R "$$$$r" -S $(5) -V $(6) -c \
1642 -K $(8) -I $(fwsize) \
1643 -k "$(call sysupname,$(1),$(2))" \
1644 -o $(call imgname,$(1),$(2))-factory$$$$dashr.bin; \
1645 true; \
1646 done; \
1647 fi
1648 endef
1649
1650 Image/Build/CameoAP121/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout))
1651 Image/Build/CameoAP121=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout),$(4),$(5),$(6),0xe0000)
1652 Image/Build/CameoAP121/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout))
1653
1654 Image/Build/CameoAP121_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
1655 Image/Build/CameoAP121_8M=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout_8M),$(4),$(5),$(6),0x100000)
1656 Image/Build/CameoAP121_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
1657
1658 define Image/Build/dLAN
1659 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1660 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1661 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1662 $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
1663 if [ -e "$(call factoryname,$(1),$(2))" ]; then \
1664 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1665 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
1666 dd if=$(KDIR)/root.$(1) \
1667 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
1668 fi
1669 endef
1670
1671 Image/Build/dLANLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1672 Image/Build/dLANLzma=$(call Image/Build/dLAN,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1673 Image/Build/dLANLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1674
1675 define Image/Build/Ath
1676 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1677 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1678 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1679 $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
1680 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1681 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1682 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
1683 dd if=$(KDIR)/root.$(1) \
1684 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
1685 fi
1686 endef
1687
1688 Image/Build/AthGzip/buildkernel=$(call MkuImageGzip,$(2),$(3) $(4))
1689 Image/Build/AthGzip=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1690 Image/Build/AthGzip/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(4))
1691
1692 Image/Build/AthLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1693 Image/Build/AthLzma=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1694 Image/Build/AthLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1695
1696
1697 Image/Build/Belkin/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1698 Image/Build/Belkin/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1699
1700 define Image/Build/Belkin
1701 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1702 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1703 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1704 $(call Sysupgrade/RKuImage,$(1),$(2),$(kernsize),$(rootsize))
1705 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1706 edimax_fw_header -m $(5) -v "OpenWrt$(REVISION)" \
1707 -n "uImage" \
1708 -i $(KDIR_TMP)/vmlinux-$(2).uImage \
1709 -o $(KDIR_TMP)/$(2)-uImage; \
1710 edimax_fw_header -m $(5) -v "OpenWrt$(REVISION)" \
1711 -n "rootfs" \
1712 -i $(KDIR)/root.$(1) \
1713 -o $(KDIR_TMP)/$(2)-rootfs; \
1714 ( \
1715 dd if=$(KDIR_TMP)/$(2)-rootfs; \
1716 dd if=$(KDIR_TMP)/$(2)-uImage; \
1717 ) > "$(call factoryname,$(1),$(2))"; \
1718 fi
1719 endef
1720
1721 define Image/Build/EnGenius
1722 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1723 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1724 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1725 $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
1726 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1727 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1728 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
1729 dd if=$(KDIR)/root.$(1) \
1730 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
1731 mksenaofw -e $(call sysupname,$(1),$(2)) \
1732 -o $(call imgname,$(1),$(2))-factory.dlf \
1733 -r 0x101 -p $(7) -t 2; \
1734 fi
1735 endef
1736
1737 Image/Build/EnGenius/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1738 Image/Build/EnGenius/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1739
1740
1741 define MkuImageHiWiFi
1742 # Field ih_name needs to start with "tw150v1"
1743 mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
1744 -e 0x80060000 -n 'tw150v1 MIPS OpenWrt Linux-$(LINUX_VERSION)' \
1745 -d $(3) $(4)
1746 endef
1747
1748 define MkuImageLzmaHiWiFi
1749 $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
1750 $(call MkuImageHiWiFi,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
1751 endef
1752
1753 Image/Build/HiWiFi/buildkernel=$(call MkuImageLzmaHiWiFi,$(2),$(3) $(4))
1754 Image/Build/HiWiFi=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1755 Image/Build/HiWiFi/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1756
1757 Image/Build/PB4X/buildkernel=$(call PatchKernelLzma,$(2),$(3))
1758
1759 define Image/Build/PB4X
1760 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1761 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
1762 dd if=$(KDIR)/root.$(1) \
1763 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
1764 -sh $(TOPDIR)/scripts/combined-image.sh \
1765 "$(call imgname,kernel,$(2)).bin" \
1766 "$(call imgname,$(1),$(2)-rootfs).bin" \
1767 $(call sysupname,$(1),$(2))
1768 endef
1769
1770
1771 Image/Build/MyLoader/buildkernel=$(call PatchKernelLzma,$(2),$(3))
1772 Image/Build/MyLoader/initramfs=$(call PatchKernel/initramfs,$(2),$(3))
1773
1774 define Image/Build/MyLoader
1775 $(eval fwsize=$(shell echo $$(($(4)-0x30000-4*64*1024))))
1776 $(eval fwimage=$(KDIR_TMP)/$(2)-$(5)-firmware.bin)
1777 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).bin.lzma,65536,$(KDIR)/root.$(1),$(fwsize),$(fwimage))
1778 if [ -e "$(fwimage)" ]; then \
1779 $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) -v \
1780 -p0x00030000:0:al:0x80060000:firmware:$(fwimage) \
1781 $(call imgname,$(1),$(2))-$(5)-factory.img; \
1782 echo -n "" > $(KDIR_TMP)/empty.bin; \
1783 sh $(TOPDIR)/scripts/combined-image.sh \
1784 $(fwimage) $(KDIR_TMP)/empty.bin \
1785 $(call imgname,$(1),$(2))-$(5)-sysupgrade.bin; \
1786 fi
1787 endef
1788
1789 Image/Build/Planex/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(planex_mtdlayout))
1790 Image/Build/Planex/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2) $(planex_mtdlayout),0x52000,0)
1791
1792 define Image/Build/Planex/buildkernel
1793 [ -e "$(KDIR)/loader-$(2).gz" ]
1794 $(call MkuImageOKLI,$(2))
1795 ( \
1796 dd if=$(KDIR)/loader-$(2).gz bs=8128 count=1 conv=sync; \
1797 dd if=$(KDIR_TMP)/vmlinux-$(2).okli; \
1798 ) > $(KDIR_TMP)/kernel-$(2).bin
1799 $(call MkuImage,gzip,,$(KDIR_TMP)/kernel-$(2).bin,$(KDIR_TMP)/vmlinux-$(2).uImage)
1800 endef
1801
1802 define Image/Build/Planex
1803 $(eval fwsize=$(call mtdpartsize,firmware,$(planex_mtdlayout)))
1804 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1805 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1806 $(STAGING_DIR_HOST)/bin/mkplanexfw \
1807 -B $(2) \
1808 -v 2.00.00 \
1809 -i $(call sysupname,$(1),$(2)) \
1810 -o $(call factoryname,$(1),$(2)); \
1811 fi
1812 endef
1813
1814
1815 Image/Build/ALFA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1816 Image/Build/ALFA/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1817
1818 define Image/Build/ALFA
1819 $(call Sysupgrade/RKuImage,$(1),$(2),$(5),$(6))
1820 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1821 rm -rf $(KDIR)/$(1); \
1822 mkdir -p $(KDIR)/$(1); \
1823 cd $(KDIR)/$(1); \
1824 cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(7); \
1825 cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(8); \
1826 $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(7) $(8); \
1827 ( \
1828 echo WRM7222C | dd bs=32 count=1 conv=sync; \
1829 echo -ne '\xfe'; \
1830 ) >> $(call factoryname,$(1),$(2)); \
1831 fi
1832 endef
1833
1834
1835 Image/Build/Seama/loader=$(call Image/BuildLoader,$(1),bin,$(2) $(3),0x80060000)
1836
1837 define Image/Build/Seama
1838 [ -e "$(KDIR)/loader-$(2).bin" ]
1839 $(call CompressLzma,$(KDIR)/loader-$(2).bin,$(KDIR_TMP)/loader-$(2).bin.lzma)
1840 -rm -f $(KDIR_TMP)/image-$(2).tmp
1841 $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
1842 [ -e "$(KDIR_TMP)/image-$(2).tmp" ] && { \
1843 head -c -4 "$(KDIR_TMP)/image-$(2).tmp" > "$(KDIR_TMP)/image-$(2).no-jffs2mark.tmp"; \
1844 $(STAGING_DIR_HOST)/bin/seama \
1845 -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp \
1846 -m "dev=/dev/mtdblock/1" -m "type=firmware"; \
1847 $(STAGING_DIR_HOST)/bin/seama \
1848 -s $(call imgname,$(1),$(2))-factory.bin \
1849 -m "signature=$(5)" \
1850 -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp.seama; \
1851 tail -c 4 "$(KDIR_TMP)/image-$(2).tmp" >> $(call imgname,$(1),$(2))-factory.bin; \
1852 }
1853 cat $(KDIR_TMP)/loader-$(2).bin.lzma > $(KDIR_TMP)/image-$(2)-sysupgrade.tmp
1854 $(STAGING_DIR_HOST)/bin/seama \
1855 -i $(KDIR_TMP)/image-$(2)-sysupgrade.tmp \
1856 -m "dev=/dev/mtdblock/1" -m "type=firmware"
1857 $(call CatFiles,$(KDIR_TMP)/image-$(2)-sysupgrade.tmp.seama,$(6),$(KDIR)/root.$(1),$(7),$(call sysupname,$(1),$(2)))
1858 endef
1859
1860 define Image/Build/Seama/initramfs
1861 $(call PatchKernelLzma,$(2),$(3) $(4),,-initramfs)
1862 $(STAGING_DIR_HOST)/bin/seama \
1863 -i $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
1864 -m "dev=/dev/mtdblock/1" -m "type=firmware"
1865 cat $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma.seama > $(call imgname,initramfs,$(2))-seama.bin
1866 endef
1867
1868 Image/Build/Senao/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1869 Image/Build/Senao/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1870
1871 define Image/Build/Senao
1872 mkdir -p $(KDIR_TMP)/$(2)/
1873 touch $(KDIR_TMP)/$(2)/FWINFO-OpenWrt-$(REVISION)-$(2)
1874 -$(CP) ./$(2)/* $(KDIR_TMP)/$(2)/
1875 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1876 of=$(KDIR_TMP)/$(2)/openwrt-senao-$(2)-uImage-lzma.bin bs=64k conv=sync
1877 dd if=$(KDIR)/root.$(1) \
1878 of=$(KDIR_TMP)/$(2)/openwrt-senao-$(2)-root.$(1) bs=64k conv=sync
1879 ( \
1880 cd $(KDIR_TMP)/$(2)/; \
1881 $(TAR) -cz -f $(call factoryname,$(1),$(2)) * \
1882 )
1883 -rm -rf $(KDIR_TMP)/$(2)/
1884 -sh $(TOPDIR)/scripts/combined-image.sh \
1885 $(KDIR_TMP)/vmlinux-$(2).uImage \
1886 $(KDIR)/root.$(1) \
1887 $(call sysupname,$(1),$(2))
1888 endef
1889
1890 Image/Build/TPLINK-SAFELOADER/loader = $(call Image/BuildLoaderPatched,$(1),elf,$(2) $(3))
1891
1892 define Image/Build/TPLINK-SAFELOADER
1893 [ -e "$(KDIR)/loader-$(2).elf" ]
1894
1895 -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
1896 -B $(5) \
1897 -k $(KDIR)/loader-$(2).elf \
1898 -r $(KDIR)/root.$(1) \
1899 -V $(REVISION) \
1900 -j \
1901 -o $(call factoryname,$(1),$(2))
1902 -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
1903 -B $(5) \
1904 -k $(KDIR)/loader-$(2).elf \
1905 -r $(KDIR)/root.$(1) \
1906 -V $(REVISION) \
1907 -j -S \
1908 -o $(call sysupname,$(1),$(2))
1909 endef
1910
1911
1912 define Image/Build/CyberTAN
1913 echo -n '' > $(KDIR_TMP)/empty.bin
1914 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp \
1915 -f $(KDIR_TMP)/vmlinux-$(2).uImage -F $(KDIR_TMP)/empty.bin \
1916 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
1917 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) \
1918 -i $(KDIR)/image.tmp \
1919 -o $(call sysupname,$(1),$(2))
1920 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR_TMP)/vmlinux-$(2).uImage \
1921 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
1922 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) -g \
1923 -i $(KDIR)/image.tmp \
1924 -o $(call factoryname,$(1),$(2))
1925 rm $(KDIR)/image.tmp
1926 endef
1927
1928 Image/Build/CyberTANGZIP/loader=$(call Image/BuildLoader,$(1),gz,$(2),0x80060000)
1929 Image/Build/CyberTANGZIP/buildkernel=$(call MkuImage,gzip,,$(KDIR)/loader-$(2).gz,$(KDIR_TMP)/vmlinux-$(2).uImage)
1930 Image/Build/CyberTANGZIP=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
1931
1932 Image/Build/CyberTANLZMA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1933 Image/Build/CyberTANLZMA=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
1934
1935
1936 Image/Build/Netgear/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1937
1938 define Image/Build/Netgear/buildkernel
1939 $(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
1940 -rm -rf $(KDIR_TMP)/$(2)
1941 mkdir -p $(KDIR_TMP)/$(2)/image
1942 cat $(KDIR_TMP)/vmlinux-$(2).uImage > $(KDIR_TMP)/$(2)/image/uImage
1943 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
1944 $(KDIR_TMP)/$(2) $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1 \
1945 -noappend -root-owned -be -b 65536
1946 ( \
1947 cat $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1; \
1948 dd if=/dev/zero bs=1k count=1 \
1949 ) > $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2
1950 mkimage -A mips -O linux -T filesystem -C none -M $(5) \
1951 -a 0xbf070000 -e 0xbf070000 \
1952 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
1953 -d $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2 \
1954 $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs
1955 endef
1956
1957 define Image/Build/Netgear
1958 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1959 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
1960 if [ -e $(call sysupname,$(1),$(2)) ]; then \
1961 for r in $(7) ; do \
1962 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
1963 $(STAGING_DIR_HOST)/bin/mkdniimg \
1964 -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
1965 -i $(call sysupname,$(1),$(2)) \
1966 -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
1967 done; \
1968 fi
1969 endef
1970
1971
1972 Image/Build/NetgearLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1973 Image/Build/NetgearLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
1974
1975 define Image/Build/NetgearLzma
1976 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1977 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
1978 endef
1979
1980
1981 Image/Build/NetgearNAND/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1982
1983 # $(1): (empty)
1984 # $(2): Board name (small caps)
1985 # $(3): Kernel board specific cmdline
1986 # $(4): Kernel mtdparts definition
1987 # $(5): U-Boot magic
1988 define Image/Build/NetgearNAND/buildkernel
1989 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
1990 $(call PatchKernelLzma,$(2),$(3) $(4),-d20)
1991 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1992 of=$(KDIR_TMP)/vmlinux-$(2).bin.tmp \
1993 bs=$$$$(($(kernelsize)-131072-2*64-1)) \
1994 count=1 conv=sync
1995 $(call MkuImage,lzma,-M $(5),$(KDIR_TMP)/vmlinux-$(2).bin.tmp,$(KDIR_TMP)/vmlinux-$(2).uImage)
1996 echo -ne '\xff' >> $(KDIR_TMP)/vmlinux-$(2).uImage
1997 # create a fake rootfs image
1998 dd if=/dev/zero of=$(KDIR_TMP)/fakeroot-$(2) bs=131072 count=1
1999 mkimage -A mips -O linux -T filesystem -C none \
2000 -a 0xbf070000 -e 0xbf070000 \
2001 -n 'MIPS OpenWrt fakeroot' \
2002 -d $(KDIR_TMP)/fakeroot-$(2) \
2003 -M $(5) \
2004 $(KDIR_TMP)/fakeroot-$(2).uImage
2005 # append the fake rootfs image to the kernel, it will reside in the last
2006 # erase block of the kernel partition
2007 cat $(KDIR_TMP)/fakeroot-$(2).uImage >> $(KDIR_TMP)/vmlinux-$(2).uImage
2008 endef
2009
2010
2011 # $(1): rootfs image suffix
2012 # $(2): Board name (small caps)
2013 # $(3): Kernel board specific cmdline
2014 # $(4): Kernel mtdparts definition
2015 # $(5): U-Boot magic
2016 # $(6): Board name (upper caps)
2017 # $(7): firmware region code (not used yet)
2018 # $(8): DNI Hardware version
2019 # $(9): suffix of the configuration file for ubinize
2020 define Image/Build/NetgearNAND
2021 $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
2022 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
2023 $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
2024 $(CP) $(KDIR)/root.squashfs-raw $(KDIR_TMP)/root.squashfs
2025 echo -ne '\xde\xad\xc0\xde' > $(KDIR_TMP)/jffs2.eof
2026 $(call ubinize,ubinize-$(9).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
2027 ( \
2028 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage; \
2029 dd if=$(KDIR_TMP)/$(2)-root.ubi \
2030 ) > $(imageraw)
2031 $(STAGING_DIR_HOST)/bin/mkdniimg \
2032 -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
2033 -i $(imageraw) \
2034 -o $(call imgname,ubi,$(2))-factory.img
2035
2036 $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/vmlinux-$(2).uImage)
2037 endef
2038
2039
2040 ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
2041 Image/Build/ZyXEL/buildkernel=$(call MkuImageLzma,$(2),$(3))
2042
2043 define Image/Build/ZyXEL
2044 $(call Sysupgrade/KRuImage,$(1),$(2),917504,2752512)
2045 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
2046 if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
2047 echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found" >&2; \
2048 else \
2049 $(STAGING_DIR_HOST)/bin/mkzynfw \
2050 -B $(4) \
2051 -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
2052 -r $(call sysupname,$(1),$(2)):0x10000 \
2053 -o $(call factoryname,$(1),$(2)); \
2054 fi; fi
2055 endef
2056 endif
2057
2058 define Device/NBG6616
2059 BOARDNAME = NBG6616
2060 KERNEL_SIZE = 2048k
2061 IMAGE_SIZE = 15323k
2062 MTDPARTS = spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
2063 CMDLINE += mem=128M
2064 IMAGES := sysupgrade.bin
2065 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage
2066 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
2067 # We cannot currently build a factory image. It is the sysupgrade image
2068 # prefixed with a header (which is actually written into the MTD device).
2069 # The header is 2kiB and is filled with 0xff. The format seems to be:
2070 # 2 bytes: 0x0000
2071 # 2 bytes: checksum of the data partition (big endian)
2072 # 4 bytes: length of the contained image file (big endian)
2073 # 32 bytes: Firmware Version string (NUL terminated, 0xff padded)
2074 # 2 bytes: 0x0000
2075 # 2 bytes: checksum over the header partition (big endian)
2076 # 32 bytes: Model (e.g. "NBG6616", NUL termiated, 0xff padded)
2077 # rest: 0xff padding
2078 #
2079 # The checksums are calculated by adding up all bytes and if a 16bit
2080 # overflow occurs, one is added and the sum is masked to 16 bit:
2081 # csum = csum + databyte; if (csum > 0xffff) { csum += 1; csum &= 0xffff };
2082 # Should the file have an odd number of bytes then the byte len-0x800 is
2083 # used additionally.
2084 # The checksum for the header is calcualted over the first 2048 bytes with
2085 # the firmware checksum as the placeholder during calculation.
2086 #
2087 # The header is padded with 0xff to the erase block size of the device.
2088 endef
2089
2090 TARGET_DEVICES += NBG6616
2091
2092 define Image/Build/ZyXELNAND/buildkernel
2093 $(eval kernelsize=$(call mtdpartsize,kernel,$(5)))
2094 $(call MkuImageLzma,$(2),$(3) $(5) $(6))
2095 mkdir -p $(KDIR_TMP)/$(2)/image/boot
2096 cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/boot/vmlinux.lzma.uImage
2097 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
2098 --pad=$(kernelsize) --big-endian --squash-uids -v -e 128KiB \
2099 -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
2100 -d $(KDIR_TMP)/$(2)/image \
2101 2>&1 1>/dev/null | awk '/^.+$$$$/'
2102 -rm -rf $(KDIR_TMP)/$(2)
2103 endef
2104
2105 define Image/Build/ZyXELNAND
2106 if [ "$(1)" != "squashfs" ]; then \
2107 echo Only squashfs is supported; \
2108 return 0; \
2109 fi
2110 $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
2111 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
2112 $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
2113 $(CP) $(KDIR)/root.$(1) $(KDIR_TMP)/ubi_root.img
2114 $(call ubinize,ubinize-$(2).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
2115 ( \
2116 dd if=$(KDIR_TMP)/$(2)-kernel.jffs2; \
2117 dd if=$(KDIR_TMP)/$(2)-root.ubi \
2118 ) > $(imageraw)
2119 dd if=$(imageraw) of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.bin \
2120 bs=128k conv=sync
2121 $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/$(2)-kernel.jffs2)
2122 endef
2123
2124
2125 Image/Build/OpenMesh/buildkernel=$(call MkuImageLzma,$(2))
2126
2127 define Image/Build/OpenMesh
2128 -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
2129 "$(4)" \
2130 "$(BUILD_DIR)/fwupgrade.cfg-$(4)" \
2131 "$(KDIR_TMP)/vmlinux-$(2).uImage" \
2132 "$(KDIR)/root.$(1)"
2133 -sh $(TOPDIR)/scripts/combined-ext-image.sh \
2134 "$(4)" "$(call factoryname,$(1),$(2))" \
2135 "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
2136 "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
2137 "$(KDIR)/root.$(1)" "rootfs"
2138 endef
2139
2140
2141 Image/Build/Zcomax/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
2142 Image/Build/Zcomax/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
2143
2144 define Image/Build/Zcomax
2145 $(call Sysupgrade/RKuImage,$(1),$(2),1507328,6356992)
2146 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
2147 $(STAGING_DIR_HOST)/bin/mkzcfw \
2148 -B $(2) \
2149 -k $(KDIR_TMP)/vmlinux-$(2).uImage \
2150 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
2151 -o $(call imgname,$(1),$(2))-factory.img; \
2152 fi
2153 endef
2154
2155
2156 # $(1): template name to be defined, etc. squashfs-only, 64k, 64kraw, etc.
2157 # $(2): jffs2 blocksize.
2158 define Jffs2Template
2159 define Image/Build/Template/$(1)/jffs2-$(2)
2160 $$(call Image/Build/$$(1),jffs2-$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
2161 endef
2162 endef
2163
2164 # $(1): template name to be defined.
2165 # $(2): squashfs suffix to be used.
2166 # $(3): jffs2 suffix to be used.
2167 define BuildTemplate
2168 # $(1) : name of build method.
2169 # $(2) : board name.
2170 # $(3) : kernel command line.
2171 # $(4)~$(8): extra arguments.
2172 define Image/Build/Template/$(1)/initramfs
2173 $$(call Image/Build/$$(1)/initramfs,initramfs,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
2174 endef
2175 define Image/Build/Template/$(1)/loader
2176 $$(call Image/Build/$$(1)/loader,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
2177 endef
2178 define Image/Build/Template/$(1)/buildkernel
2179 $$(call Image/Build/$$(1)/buildkernel,,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
2180 endef
2181 define Image/Build/Template/$(1)/squashfs
2182 $$(call Image/Build/$$(1),squashfs$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
2183 endef
2184 $(if $(3),$(foreach bs,$(3),$(eval $(call Jffs2Template,$(1),$(bs)))))
2185 endef
2186
2187 $(eval $(call BuildTemplate,squashfs-only))
2188 $(eval $(call BuildTemplate,64k,-64k,64k))
2189 $(eval $(call BuildTemplate,64kraw,-raw,64k))
2190 $(eval $(call BuildTemplate,64kraw-nojffs,-raw))
2191 $(eval $(call BuildTemplate,128k,,128k))
2192 $(eval $(call BuildTemplate,128kraw,-raw,128k))
2193 $(eval $(call BuildTemplate,256k,,256k))
2194 $(eval $(call BuildTemplate,all,,64k 128k 256k))
2195
2196 ifeq ($(SUBTARGET),generic)
2197 $(eval $(call SingleProfile,ALFA,64k,ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,vmlinux.gz.uImage,pb9x-2.6.31-jffs2))
2198 $(eval $(call SingleProfile,ALFA,64k,HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image))
2199 $(eval $(call SingleProfile,ALFA,64k,TUBE2H8M,tube2h-8M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel.image,rootfs.image))
2200
2201 $(eval $(call SingleProfile,AthGzip,64k,AP81,ap81,AP81,ttyS0,115200,$$(ap81_mtdlayout),RKuImage))
2202 $(eval $(call SingleProfile,AthGzip,64k,AP83,ap83,AP83,ttyS0,115200,$$(ap83_mtdlayout),RKuImage))
2203 $(eval $(call SingleProfile,AthGzip,64k,AP96,ap96,AP96,ttyS0,115200,$$(ap96_mtdlayout),RKuImage))
2204 $(eval $(call SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),KRuImage))
2205
2206 $(eval $(call SingleProfile,AthLzma,64k,ALFAAP96,alfa-ap96,ALFA-AP96,ttyS0,115200,$$(alfa_ap96_mtdlayout),RKuImage))
2207 $(eval $(call SingleProfile,AthLzma,64k,ALL0258N,all0258n,ALL0258N,ttyS0,115200,$$(all0258n_mtdlayout),KRuImage,65536))
2208 $(eval $(call SingleProfile,AthLzma,256k,ALL0315N,all0315n,ALL0315N,ttyS0,115200,$$(all0315n_mtdlayout),KRuImage,262144))
2209 $(eval $(call SingleProfile,AthLzma,64k,AP113,ap113,AP113,ttyS0,115200,$$(ap113_mtd_layout),RK))
2210 $(eval $(call SingleProfile,AthLzma,64k,AP121_2M,ap121-2M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_2M),RKuImage))
2211 $(eval $(call SingleProfile,AthLzma,64k,AP121_4M,ap121-4M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
2212 $(eval $(call SingleProfile,AthLzma,64k,AP121_8M,ap121-8M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_8M),RKuImage))
2213 $(eval $(call SingleProfile,AthLzma,64k,AP121MINI,ap121-mini,AP121-MINI,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
2214 $(eval $(call SingleProfile,AthLzma,64k,AP132,ap132,AP132,ttyS0,115200,$$(ap132_mtdlayout),KRuImage))
2215 $(eval $(call SingleProfile,AthLzma,64k,AP135,ap135-020,AP135-020,ttyS0,115200,$$(ap135_mtdlayout),RKuImage))
2216 $(eval $(call SingleProfile,AthLzma,64k,AP136_010,ap136-010,AP136-010,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
2217 $(eval $(call SingleProfile,AthLzma,64k,AP136_020,ap136-020,AP136-020,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
2218 $(eval $(call SingleProfile,AthLzma,64k,AP143_8M,ap143-8M,AP143,ttyS0,115200,$$(ap143_mtdlayout_8M),RKuImage))
2219 $(eval $(call SingleProfile,AthLzma,64k,AP143_16M,ap143-16M,AP143,ttyS0,115200,$$(ap143_mtdlayout_16M),RKuImage))
2220 $(eval $(call SingleProfile,AthLzma,64k,AP147_010,ap147-010,AP147-010,ttyS0,115200,$$(ap147_mtdlayout),RKuImage))
2221 $(eval $(call SingleProfile,AthLzma,64k,AP152_16M,ap152-16M,AP152,ttyS0,115200,$$(ap152_mtdlayout_16M),RKuImage))
2222 $(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
2223 $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
2224 $(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
2225 $(eval $(call SingleProfile,AthLzma,64k,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),KRuImage,65536))
2226 $(eval $(call SingleProfile,AthLzma,64k,EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
2227 $(eval $(call SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
2228 $(eval $(call SingleProfile,AthLzma,64k,EWDORIN16M,ew-dorin-16M,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_16M),KRuImage,65536))
2229 $(eval $(call SingleProfile,AthLzma,64k,HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
2230 $(eval $(call SingleProfile,AthLzma,64k,MR12,mr12,MR12,ttyS0,115200,$$(mr12_mtdlayout),RKuImage))
2231 $(eval $(call SingleProfile,AthLzma,64k,MR16,mr16,MR16,ttyS0,115200,$$(mr16_mtdlayout),RKuImage))
2232 $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),KRuImage))
2233 $(eval $(call SingleProfile,AthLzma,64k,TUBE2H16M,tube2h-16M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
2234 $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(wlr8100_mtdlayout),KRuImage))
2235 $(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
2236 $(eval $(call SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
2237 $(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
2238
2239 $(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
2240
2241 $(eval $(call SingleProfile,CameoAP91,64kraw,DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00"))
2242 $(eval $(call SingleProfile,CameoAP91,64kraw,DIR601A1,dir-601-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-02"))
2243 $(eval $(call SingleProfile,CameoAP91,64kraw,FR54RTR,fr-54rtr,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-01"))
2244
2245 $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E1,dir-615-e1,DIR-615-E1,ttyS0,115200,"AP93-AR7240-RT-081028-00"))
2246 $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E4,dir-615-e4,DIR-615-E4,ttyS0,115200,"AP99-AR7240-RT-091105-05"))
2247
2248 $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I1,dir-615-i1,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-1012I1-00"))
2249 $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I3,dir-615-i3,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-101214-00"))
2250
2251 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,A02RBW300N,a02-rb-w300n,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-03"))
2252 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,DIR615C1,dir-615-c1,DIR-615-C1,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
2253 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW632BRP,tew-632brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-00"))
2254 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_FW,tew-652brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-080609-05"))
2255 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_RECOVERY,tew-652brp-recovery,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
2256
2257 $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,TEW712BR,tew-712br,TEW-712BR,ttyATH0,115200,"HORNET-RT-TEW712BR-3",1.99,""))
2258 $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,DIR601B1,dir-601-b1,TEW-712BR,ttyATH0,115200,"HORNET-RT-DIR601B1-3",2.99.99,"" "NA"))
2259 $(eval $(call SingleProfile,CameoAP121_8M,64kraw-nojffs,DIR505A1,dir-505-a1,DIR-505-A1,ttyATH0,115200,"HORNET-PACKET-DIR505A1-3",1.99.99,""))
2260
2261 $(eval $(call SingleProfile,CameoAP135,64kraw,DGL5500A1,dgl-5500-a1,DGL-5500-A1,ttyS0,115200,$$(dgl_5500_mtdlayout),"00AP135AR9558-RT-130508-00"))
2262
2263 $(eval $(call SingleProfile,CameoDB120,64kraw,DHP1565A1,dhp-1565-a1,DHP-1565-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
2264 $(eval $(call SingleProfile,CameoDB120,64kraw,DIR825C1,dir-825-c1,DIR-825-C1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
2265 $(eval $(call SingleProfile,CameoDB120,64kraw,DIR835A1,dir-835-a1,DIR-835-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
2266
2267 $(eval $(call SingleProfile,CameoDB120_8M,64kraw,TEW732BR,tew-732br,TEW-732BR,ttyS0,115200,"00DB120AR9341-RT-120906-NA"))
2268
2269 $(eval $(call SingleProfile,CyberTANGZIP,64k,WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,,1.00.01))
2270
2271 $(eval $(call SingleProfile,CyberTANLZMA,64k,MYNETREXT,mynet-rext,MYNET-REXT,ttyS0,115200,$$(mynet_rext_mtdlayout) root=31:2,1.00.01))
2272
2273 $(eval $(call SingleProfile,CameoAP94,64kraw,DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
2274 $(eval $(call SingleProfile,CameoAP94,64kraw,TEW673GRU,tew-673gru,TEW-673GRU,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
2275 $(eval $(call SingleProfile,CameoAP94,64kraw,DLRTDEV01,dlrtdev01,DIR-825-B1,ttyS0,115200,$$(dlrtdev_mtdlayout),$$(dlrtdev_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
2276
2277 $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_500_wp,dlan-pro-500-wp,dLAN-pro-500-wp,ttyS0,115200,$$(dlan_pro_500_wp_mtdlayout) mem=128M,KRuImage,64k))
2278 $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_1200_ac,dlan-pro-1200-ac,dLAN-pro-1200-ac,ttyS0,115200,$$(dlan_pro_1200_ac_mtdlayout) mem=128M,KRuImage,64k))
2279
2280 $(eval $(call SingleProfile,EnGenius,64k,ESR900,esr900,ESR900,ttyS0,115200,$$(esr900_mtdlayout),KRuImage,,0x4e))
2281 $(eval $(call SingleProfile,EnGenius,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage,,0x61))
2282 $(eval $(call SingleProfile,EnGenius,64k,EPG5000,epg5000,EPG5000,ttyS0,115200,$$(epg5000_mtdlayout),KRuImage,,0x71))
2283
2284 $(eval $(call SingleProfile,HiWiFi,64k,HIWIFI_HC6361,hiwifi-hc6361,HiWiFi-HC6361,ttyATH0,115200,$$(hiwifi_hc6361_mtdlayout),KRuImage))
2285
2286 $(eval $(call SingleProfile,MyLoader,64k,WP543_2M,wp543,,ttyS0,115200,0x200000,2M))
2287 $(eval $(call SingleProfile,MyLoader,64k,WP543_4M,wp543,,ttyS0,115200,0x400000,4M))
2288 $(eval $(call SingleProfile,MyLoader,64k,WP543_8M,wp543,,ttyS0,115200,0x800000,8M))
2289 $(eval $(call SingleProfile,MyLoader,64k,WP543_16M,wp543,,ttyS0,115200,0x1000000,16M))
2290 $(eval $(call SingleProfile,MyLoader,64k,WPE72_4M,wpe72,,ttyS0,115200,0x400000,4M))
2291 $(eval $(call SingleProfile,MyLoader,64k,WPE72_8M,wpe72,,ttyS0,115200,0x800000,8M))
2292 $(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M))
2293
2294 $(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,-H 29763551+04+32))
2295 $(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,))
2296 $(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,"" NA,))
2297 $(eval $(call SingleProfile,Netgear,64kraw,REALWNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",))
2298 $(eval $(call SingleProfile,Netgear,64kraw,N150R,n150r,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,N150R,"",))
2299 $(eval $(call SingleProfile,Netgear,64kraw,REALWNR1000V2,wnr1000v2,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303031,WNR1000V2,"",))
2300 $(eval $(call SingleProfile,Netgear,64kraw,WNR1000V2_VC,wnr1000v2-vc,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303030,WNR1000V2-VC,"",))
2301
2302 $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P))
2303 $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P))
2304 $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600))
2305 $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900))
2306 $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR1750,mr1750,,,,MR1750))
2307
2308 $(eval $(call SingleProfile,PB4X,128k,ALL0305,all0305,ALL0305,ttyS0,115200))
2309 $(eval $(call SingleProfile,PB4X,128k,EAP7660D,eap7660d,EAP7660D,ttyS0,115200))
2310 $(eval $(call SingleProfile,PB4X,64k,JA76PF,ja76pf,JA76PF,ttyS0,115200))
2311 $(eval $(call SingleProfile,PB4X,64k,JA76PF2,ja76pf2,JA76PF2,ttyS0,115200))
2312 $(eval $(call SingleProfile,PB4X,64k,JWAP003,jwap003,JWAP003,ttyS0,115200))
2313 $(eval $(call SingleProfile,PB4X,64k,PB42,pb42,PB42,ttyS0,115200))
2314 $(eval $(call SingleProfile,PB4X,64k,PB44,pb44,PB44,ttyS0,115200))
2315
2316 $(eval $(call SingleProfile,Planex,64kraw,MZKW04NU,mzk-w04nu,MZK-W04NU,ttyS0,115200))
2317 $(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,115200))
2318
2319 $(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,65536,16187392))
2320 $(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,65536,16187392))
2321
2322 $(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,65536,16121856))
2323
2324 $(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))
2325
2326 $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
2327
2328 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
2329 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
2330 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPGN,whr-hp-gn,WHR-HP-GN,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-GN))
2331 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WLAEAG300N,wlae-ag300n,WLAE-AG300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WLAE-AG300N))
2332
2333 $(eval $(call SingleProfile,WRT400N,64k,WRT400N,wrt400n,WRT400N,ttyS0,115200))
2334
2335 $(eval $(call SingleProfile,WZRHP128K,128kraw,WZRHPG300NH,wzr-hp-g300nh,WZR-HP-G300NH,ttyS0,115200,WZR-HP-G300NH))
2336 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG300NH2,wzr-hp-g300nh2,WZR-HP-G300NH2,ttyS0,115200,WZR-HP-G300NH2))
2337 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPAG300H,wzr-hp-ag300h,WZR-HP-AG300H,ttyS0,115200,WZR-HP-AG300H))
2338 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG450H,wzr-hp-g450h,WZR-HP-G450H,ttyS0,115200,WZR-HP-AG450H))
2339 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR600DHP,wzr-600dhp,WZR-HP-AG300H,ttyS0,115200,WZR-600DHP))
2340 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR450HP2,wzr-450hp2,WZR-450HP2,ttyS0,115200,WZR-450HP2))
2341
2342 $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H28,zcn-1523h-2-8,ZCN-1523H-2,ttyS0,115200,$$(zcn1523h_mtdlayout)))
2343 $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H516,zcn-1523h-5-16,ZCN-1523H-5,ttyS0,115200,$$(zcn1523h_mtdlayout)))
2344
2345 $(eval $(call SingleProfile,ZyXEL,64k,NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N))
2346
2347 $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M AP121_8M))
2348 $(eval $(call MultiProfile,AP136,AP136_010 AP136_020))
2349 $(eval $(call MultiProfile,AP143,AP143_8M AP143_16M))
2350 $(eval $(call MultiProfile,AP147,AP147_010))
2351 $(eval $(call MultiProfile,AP152,AP152_16M))
2352 $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3))
2353 $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M))
2354 $(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750))
2355 $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
2356 $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
2357 $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
2358 $(eval $(call MultiProfile,WNR1000V2,REALWNR1000V2 WNR1000V2_VC))
2359 $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M))
2360 $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M WPE72_16M))
2361 $(eval $(call MultiProfile,WPJ344,WPJ344_16M))
2362 $(eval $(call MultiProfile,WPJ531,WPJ531_16M))
2363 $(eval $(call MultiProfile,WPJ558,WPJ558_16M))
2364
2365 $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
2366 $(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
2367 endif # ifeq ($(SUBTARGET),generic)
2368
2369 ifeq ($(SUBTARGET),nand)
2370 $(eval $(call SingleProfile,NetgearNAND,64k,WNDR3700V4,wndr3700v4,WNDR3700_V4,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR3700v4,"",-H 29763948+128+128,wndr4300))
2371 $(eval $(call SingleProfile,NetgearNAND,64k,WNDR4300V1,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR4300,"",-H 29763948+0+128+128+2x2+3x3,wndr4300))
2372 $(eval $(call SingleProfile,NetgearNAND,64k,R6100,r6100,R6100,ttyS0,115200,$$(r6100_mtdlayout),0x36303030,R6100,"",-H 29764434+0+128+128+2x2+2x2,wndr4300))
2373
2374 $(eval $(call SingleProfile,ZyXELNAND,128k,NBG6716,nbg6716,NBG6716,ttyS0,115200,NBG6716,$$(zyx_nbg6716_mtdlayout),mem=256M))
2375
2376 $(eval $(call MultiProfile,WNDR4300,WNDR3700V4 WNDR4300V1))
2377 endif # ifeq ($(SUBTARGET),nand)
2378
2379
2380 $(eval $(call MultiProfile,Default,$(SINGLE_PROFILES)))
2381
2382 define Image/Build/squashfs
2383 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
2384 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-64k
2385 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs-64k 64
2386 cp $(KDIR)/root.squashfs-64k $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
2387 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
2388 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
2389 endef
2390
2391 define Image/Build/jffs2
2392 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
2393 endef
2394
2395 define Image/Build/Initramfs
2396 $(call Image/Build/Profile/$(IMAGE_PROFILE),initramfs)
2397 endef
2398
2399 define Image/Prepare
2400 gzip -9n -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
2401 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
2402 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
2403 gzip -9n -c $(KDIR)/vmlinux-initramfs > $(KDIR)/vmlinux-initramfs.bin.gz
2404 $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
2405 $(call Image/BuildLoader,generic,elf,,,-initramfs)
2406 endif
2407 $(call Image/BuildLoader,generic,elf)
2408 $(call Image/Build/Profile/$(if $(CONFIG_IB),Default,$(IMAGE_PROFILE)),loader)
2409 endef
2410
2411 # $(1): filesystem type.
2412 define Image/Build
2413 $(call Image/Build/$(call rootfs_type,$(1)),$(1))
2414 $(call Image/Build/Profile/$(IMAGE_PROFILE),$(1))
2415 endef
2416
2417 $(eval $(call BuildImage))