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