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