ar71xx: use 4k image only for the AP121 board
[openwrt.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 define imgname
11 $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
12 endef
13
14 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
15 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
16 fs_squash:=squashfs-only
17 fs_all:=all
18 fs_4k:=4k
19 fs_64k:=64k
20 fs_128k:=128k
21 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
22         fs_squash:=initramfs
23         fs_all:=initramfs
24         fs_4k:=initramfs
25         fs_64k:=initramfs
26         fs_128k:=initramfs
27         VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
28         UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
29 endif
30
31 define CompressLzma
32   $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
33 endef
34
35 define PatchKernelLzma
36         cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
37         $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
38         $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).bin.lzma)
39 endef
40
41 define PatchKernelGzip
42         cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
43         $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
44         gzip -9 -c $(KDIR)/vmlinux-$(1) > $(KDIR)/vmlinux-$(1).bin.gz
45 endef
46
47 define MkImageLzma
48         mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma \
49                 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
50                 -d $(1) $(2)
51 endef
52
53 define MkImageGzip
54         mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip \
55                 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
56                 -d $(1) $(2)
57 endef
58
59 define Image/BuildKernel
60         cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
61         cp $(KDIR)/vmlinux $(VMLINUX).bin
62         gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
63         $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
64         dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
65         dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
66         $(call MkImageGzip,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
67         $(call MkImageLzma,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
68         $(call Image/Build/Initramfs)
69 endef
70
71 define Image/Build/WRT400N
72         $(call PatchKernelLzma,$(2),$(3))
73         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1310720 ]; then \
74                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
75         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6488064 ]; then \
76                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
77         else \
78                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
79                         0x80060000 \
80                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
81                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
82                 ( \
83                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1280k conv=sync; \
84                         dd if=$(KDIR)/root.$(1) \
85                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
86                 wrt400n $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call imgname,$(1),$(2))-factory.bin; \
87         fi; fi
88 endef
89
90 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
91 define Image/Build/DIR825B1
92         $(call PatchKernelLzma,$(2),$(3) $(dir825b1_mtdlayout))
93         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
94                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
95         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 5308416 ]; then \
96                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
97         else \
98                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
99                         0x80060000 \
100                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
101                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
102                 ( \
103                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync; \
104                         dd if=$(KDIR)/root.$(1) \
105                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
106                 ( \
107                         dd if=$(call imgname,$(1),$(2))-sysupgrade.bin; \
108                         echo -n "01AP94-AR7161-RT-080619-00"; \
109                 ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
110                 if [ `stat -c%s $(call imgname,$(1),$(2))-sysupgrade.bin` -gt 4194304 ]; then \
111                         echo "Warning: $(call imgname,$(1),$(2))-sysupgrade.bin is too big"; \
112                 else \
113                         ( \
114                                 dd if=$(call imgname,$(1),$(2))-sysupgrade.bin bs=4096k conv=sync; \
115                                 echo -n "00AP94-AR7161-RT-080619-00"; \
116                         ) > $(call imgname,$(1),$(2))-factory.bin; \
117                 fi; \
118         fi; fi
119 endef
120
121 define Image/Build/WZRHPG30XNH
122         $(call PatchKernelLzma,$(2),$(3))
123         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
124                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
125         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 31850496 ]; then \
126                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
127         else \
128                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
129                         0x80060000 \
130                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
131                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
132                 ( \
133                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync; \
134                         dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
135                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
136                 ( \
137                         echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
138                         dd if=$(call imgname,$(1),$(2))-sysupgrade.bin; \
139                 ) > $(call imgname,$(1),$(2))-tftp.bin; \
140                 buffalo-enc -p $(4) -v 1.76 \
141                         -i $(call imgname,$(1),$(2))-sysupgrade.bin \
142                         -o $(KDIR)/$(2).enc; \
143                 buffalo-tag -b $(4) -p $(4) -a ath -v 1.76 -m 1.01 -l mlang8 \
144                         -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
145                         -i $(KDIR)/$(2).enc \
146                         -o $(call imgname,$(1),$(2))-factory.bin; \
147         fi; fi
148 endef
149
150 cameo_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,896k(kernel),2944k(rootfs),64k(art)ro,3840k@0x30000(firmware)
151 define Image/Build/Cameo
152         $(call PatchKernelLzma,$(2),$(3) $(cameo_mtdlayout))
153         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
154                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
155         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2949120 ]; then \
156                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
157         else \
158                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
159                         0x80060000 \
160                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
161                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
162                 ( \
163                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
164                         dd if=$(KDIR)/root.$(1) \
165                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
166                 ( \
167                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
168                         dd if=$(KDIR)/root.$(1) bs=2880k conv=sync; \
169                         echo -n $(4); \
170                 ) > $(call imgname,$(1),$(2))-factory.bin; \
171         fi; fi
172 endef
173
174 cameo7240_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,896k(kernel),2816k(rootfs),64k(mac)ro,64k(art)ro,3712k@0x40000(firmware)
175 define Image/Build/Cameo7240
176         $(call PatchKernelLzma,$(2),$(3) $(cameo7240_mtdlayout))
177         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
178                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
179         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
180                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
181         else \
182                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
183                         0x80060000 \
184                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
185                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
186                 ( \
187                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
188                         dd if=$(KDIR)/root.$(1) \
189                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
190                 ( \
191                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
192                         dd if=$(KDIR)/root.$(1) bs=2752k conv=sync; \
193                         echo -n $(4); \
194                 ) > $(call imgname,$(1),$(2))-factory.bin; \
195         fi; fi
196 endef
197
198 define Image/Build/AP83
199         $(call PatchKernelGzip,$(2),$(3))
200         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1310720 ]; then \
201                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
202         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6619136 ]; then \
203                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
204         else \
205                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
206                         0x80060000 \
207                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
208                         -d $(KDIR)/vmlinux-$(2).bin.gz \
209                         $(KDIR)/vmlinux-$(2).uImage; \
210                 dd if=$(KDIR)/vmlinux-$(2).uImage \
211                         of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
212                 dd if=$(KDIR)/root.$(1) \
213                         of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
214                 ( \
215                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1280k conv=sync; \
216                         dd if=$(KDIR)/root.$(1); \
217                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
218         fi; fi
219 endef
220
221 define Image/Build/PB92
222         $(call PatchKernelLzma,$(2),$(3))
223         if [ `stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma` -gt 917504 ]; then \
224                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
225         elif [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
226                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
227         else \
228                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
229                         0x80060000 \
230                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
231                         -d $(KDIR)/vmlinux-$(2).bin.lzma \
232                         $(KDIR)/vmlinux-$(2).uImage; \
233                 dd if=$(KDIR)/vmlinux-$(2).uImage \
234                         of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
235                 dd if=$(KDIR)/root.$(1) \
236                         of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
237                 ( \
238                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
239                         dd if=$(KDIR)/root.$(1); \
240                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
241         fi
242 endef
243
244 define Image/Build/PB4X
245         $(call PatchKernelLzma,$(2),$(3))
246         dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
247            of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
248         dd if=$(KDIR)/root.$(1) \
249            of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
250         -sh $(TOPDIR)/scripts/combined-image.sh \
251                 "$(call imgname,kernel,$(2)).bin" \
252                 "$(call imgname,$(1),$(2)-rootfs).bin" \
253                 $(call imgname,$(1),$(2))-sysupgrade.bin
254 endef
255
256 define Image/Build/DB120
257         $(call PatchKernelLzma,$(2),$(3))
258         if [ `stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma` -gt 1441792 ]; then \
259                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
260         elif [ `stat -c%s $(KDIR)/root.$(1)` -gt 6488064 ]; then \
261                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
262         else \
263                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
264                         0x80060000 \
265                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
266                         -d $(KDIR)/vmlinux-$(2).bin.lzma \
267                         $(KDIR)/vmlinux-$(2).uImage; \
268                 dd if=$(KDIR)/vmlinux-$(2).uImage \
269                         of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
270                 dd if=$(KDIR)/root.$(1) \
271                         of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
272                 ( \
273                         dd if=$(KDIR)/root.$(1); \
274                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1408k conv=sync; \
275                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
276         fi
277 endef
278
279 define Image/Build/AP121
280         $(call PatchKernelLzma,$(2),$(3) $($(4)))
281         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
282         if [ `stat -c%s $(KDIR)/vmlinux-$(2).uImage` -gt $(5) ]; then \
283                 echo "Warning: $(KDIR)/vmlinux-$(2).uImage is too big"; \
284         elif [ `stat -c%s $(BIN_DIR)/$(IMG_PREFIX)-root.$(1)` -gt $(6) ]; then \
285                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
286         else \
287                 cp $(KDIR)/vmlinux-$(2).uImage $(call imgname,kernel,$(2)).bin; \
288                 cp $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) $(call imgname,$(1),$(2)-rootfs).bin; \
289                 ( \
290                         dd if=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=$(6) conv=sync; \
291                         dd if=$(KDIR)/vmlinux-$(2).uImage; \
292                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
293         fi
294 endef
295
296 define Image/Build/AP121/initramfs
297         $(call PatchKernelLzma,$(2),$(3) $($(4)))
298         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(call imgname,$(1),$(2))-uImage.bin)
299 endef
300
301 define Image/Build/MyLoader
302         -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(3) \
303                 -p0x030000:0xe0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
304                 -p0x110000:0:::rootfs:$(KDIR)/root.$(1) \
305                 $(call imgname,$(1),$(2))-$(4)-factory.img
306 endef
307
308 ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6528k(rootfs),256k(cfg)ro,64k(EEPROM)ro,7552k@0x50000(firmware)
309 define Image/Build/UBNTXM
310         $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout))
311         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage.bin)
312         dd if=$(KDIR)/vmlinux-$(2).uImage.bin of=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync
313         -$(STAGING_DIR_HOST)/bin/mkfwimage \
314                 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
315                 -k $(KDIR)/vmlinux-$(2).uImage \
316                 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
317                 -o $(call imgname,$(1),$(2))-factory.bin
318         ( \
319                 dd if=$(KDIR)/vmlinux-$(2).uImage; \
320                 dd if=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1); \
321         ) > $(call imgname,$(1),$(2))-sysupgrade.bin
322 endef
323
324 define Image/Build/UBNT
325         $(call PatchKernelLzma,$(2),$(3))
326         dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).lzma bs=64k conv=sync
327         -$(STAGING_DIR_HOST)/bin/mkfwimage \
328                 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
329                 -k $(KDIR)/vmlinux-$(2).lzma \
330                 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
331                 -o $(call imgname,$(1),$(2))-factory.bin
332         -sh $(TOPDIR)/scripts/combined-image.sh \
333                 "$(KDIR)/vmlinux-$(2).lzma" \
334                 "$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)" \
335                 $(call imgname,$(1),$(2))-sysupgrade.bin
336 endef
337
338 define Image/Build/Planex
339         $(call PatchKernelGzip,$(2),$(3))
340         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1441792 ]; then \
341                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
342         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6356992 ]; then \
343                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
344         else \
345                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
346                         0x80060000 \
347                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
348                         -d $(KDIR)/vmlinux-$(2).bin.gz $(KDIR)/vmlinux-$(2).uImage; \
349                 ( \
350                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1408k conv=sync; \
351                         dd if=$(KDIR)/root.$(1); \
352                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
353                 $(STAGING_DIR_HOST)/bin/mkplanexfw \
354                         -B $(2) \
355                         -v 2.00.00 \
356                         -i $(call imgname,$(1),$(2))-sysupgrade.bin \
357                         -o $(call imgname,$(1),$(2))-factory.bin; \
358         fi; fi
359 endef
360
361 define Image/Build/TPLINK
362         $(call PatchKernelGzip,$(2),$(3))
363         -$(STAGING_DIR_HOST)/bin/mktplinkfw \
364                 -B $(4) -N OpenWrt -V $(REVISION)\
365                 -k $(KDIR)/vmlinux-$(2).bin.gz \
366                 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
367                 -o $(call imgname,$(1),$(2))-factory.bin
368         -$(STAGING_DIR_HOST)/bin/mktplinkfw \
369                 -B $(4) -N OpenWrt -V $(REVISION) -s \
370                 -k $(KDIR)/vmlinux-$(2).bin.gz \
371                 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
372                 -o $(call imgname,$(1),$(2))-sysupgrade.bin
373 endef
374
375 define Image/Build/TPLINK/initramfs
376         $(call PatchKernelGzip,$(2),$(3))
377         -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
378                 -B $(4) -N OpenWrt -V $(REVISION) -s \
379                 -k $(KDIR)/vmlinux-$(2).bin.gz \
380                 -o $(call imgname,$(1),$(2))-uImage.bin
381 endef
382
383 define Image/Build/CyberTAN
384         $(call PatchKernelGzip,$(2),$(3))
385         $(call MkImageGzip,$(KDIR)/vmlinux-$(2).bin.gz,$(KDIR)/vmlinux-$(2).uImage)
386         $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR)/vmlinux-$(2).uImage \
387                 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
388         -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) \
389                 -i $(KDIR)/image.tmp \
390                 -o $(call imgname,$(1),$(2))-sysupgrade.bin
391         -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
392                 -i $(KDIR)/image.tmp \
393                 -o $(call imgname,$(1),$(2))-factory.bin
394         rm $(KDIR)/image.tmp
395 endef
396
397 define Image/Build/Netgear
398         $(call PatchKernelLzma,$(2),$(3) $($(4)))
399         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
400         mkdir -p $(KDIR)/wndr3700/image
401         $(STAGING_DIR_HOST)/bin/wndr3700 \
402                 $(KDIR)/vmlinux-$(2).uImage \
403                 $(KDIR)/wndr3700/image/uImage \
404                 $(5)
405         $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
406                 $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
407                 -nopad -noappend -root-owned -be
408         -rm -rf $(KDIR)/wndr3700
409         mkimage -A mips -O linux -T filesystem -C none \
410                 -a 0xbf070000 -e 0xbf070000 \
411                 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
412                 -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
413                 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
414         $(STAGING_DIR_HOST)/bin/wndr3700 \
415                 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
416                 $(KDIR)/vmlinux-$(2).uImage.squashfs \
417                 $(5)
418         -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
419         ( \
420                 dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
421                 dd if=$(KDIR)/root.$(1) bs=64k; \
422         ) > $(call imgname,$(1),$(2))-sysupgrade.bin
423         for r in $(7) ; do \
424                 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
425                 $(STAGING_DIR_HOST)/bin/mkdniimg \
426                         -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
427                         -i $(call imgname,$(1),$(2))-sysupgrade.bin \
428                         -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
429         done
430 endef
431
432 define Image/Build/Netgear/initramfs
433         $(call PatchKernelLzma,$(2),$(3) $($(4)))
434         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
435         $(STAGING_DIR_HOST)/bin/wndr3700 \
436                 $(KDIR)/vmlinux-$(2).uImage \
437                 $(call imgname,$(1),$(2))-uImage.bin \
438                 $(5)
439 endef
440
441 ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
442   define Image/Build/ZyXEL
443         $(call PatchKernelLzma,$(2),$(3))
444         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
445                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
446         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2752512 ]; then \
447                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
448         else if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
449                 echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found"; \
450         else \
451                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
452                         0x80060000 \
453                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
454                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
455                 ( \
456                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
457                         dd if=$(KDIR)/root.$(1); \
458                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
459                 $(STAGING_DIR_HOST)/bin/mkzynfw \
460                         -B $(4) \
461                         -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
462                         -r $(call imgname,$(1),$(2))-sysupgrade.bin:0x10000 \
463                         -o $(call imgname,$(1),$(2))-factory.bin; \
464         fi; fi; fi
465   endef
466 endif
467
468 define Image/Build/Zcomax
469         $(call PatchKernelLzma,$(2),$(3))
470         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage.bin)
471         -$(STAGING_DIR_HOST)/bin/mkzcfw \
472                 -B $(2) \
473                 -k $(KDIR)/vmlinux-$(2).uImage.bin \
474                 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
475                 -o $(call imgname,$(1),$(2))-factory.img
476         ( \
477                 dd if=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=6208k count=1 conv=sync; \
478                 dd if=$(KDIR)/vmlinux-$(2).uImage.bin bs=1472k count=1; \
479         ) > $(call imgname,$(1),$(2))-sysupgrade.bin
480 endef
481
482 define Image/Build/Template/initramfs/initramfs
483         $(call Image/Build/$(1)/initramfs,initramfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
484 endef
485
486 define Image/Build/Template/all/squashfs
487         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
488 endef
489
490 define Image/Build/Template/all/jffs2-64k
491         $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
492 endef
493
494 define Image/Build/Template/all/jffs2-128k
495         $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
496 endef
497
498 define Image/Build/Template/squashfs-only/squashfs
499         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
500 endef
501
502 define Image/Build/Template/4k/squashfs
503         $(call Image/Build/$(1),squashfs-4k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
504 endef
505
506 define Image/Build/Template/64k/squashfs
507         $(call Image/Build/$(1),squashfs-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
508 endef
509
510 define Image/Build/Template/64k/jffs2-64k
511         $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
512 endef
513
514 define Image/Build/Template/128k/squashfs
515         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
516 endef
517
518 define Image/Build/Template/128k/jffs2-128k
519         $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
520 endef
521
522 ap121_cmdline=board=AP121 console=ttyATH0,115200
523 ap121_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
524 define Image/Build/Profile/AP121
525         $(call Image/Build/Template/$(fs_4k)/$(1),AP121,ap121,$(ap121_cmdline),ap121_mtdlayout,720896,1245184)
526 endef
527
528 ap121_mini_cmdline=board=AP121-MINI console=ttyATH0,115200
529 ap121_mini_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)
530 define Image/Build/Profile/AP121MINI
531         $(call Image/Build/Template/$(fs_64k)/$(1),AP121,ap121-mini,$(ap121_mini_cmdline),ap121_mini_mtdlayout,917504,2818048)
532 endef
533
534 ap81_cmdline=board=AP81 console=ttyS0,115200
535 define Image/Build/Profile/AP81
536         $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap81,$(ap81_cmdline))
537 endef
538
539 ap83_cmdline=board=AP83 console=ttyS0,115200
540 define Image/Build/Profile/AP83
541         $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap83,$(ap83_cmdline))
542 endef
543
544 db120_cmdline=board=DB120 console=ttyS0,115200
545 define Image/Build/Profile/DB120
546         $(call Image/Build/Template/$(fs_64k)/$(1),DB120,db120,$(db120_cmdline))
547 endef
548
549 pb42_cmdline=board=PB42 console=ttyS0,115200
550 define Image/Build/Profile/PB42
551         $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,pb42,$(pb42_cmdline))
552 endef
553
554 pb44_cmdline=board=PB44 console=ttyS0,115200
555 define Image/Build/Profile/PB44
556         $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,pb44,$(pb44_cmdline))
557 endef
558
559 pb92_cmdline=board=PB92 console=ttyS0,115200
560 define Image/Build/Profile/PB92
561         $(call Image/Build/Template/$(fs_64k)/$(1),PB92,pb92,$(pb92_cmdline))
562 endef
563
564 define Image/Build/Profile/WP543
565         $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x200000,2M)
566         $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x400000,4M)
567         $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x800000,8M)
568         $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x1000000,16M)
569 endef
570
571 dir600a1_cmdline=board=DIR-600-A1 console=ttyS0,115200
572 define Image/Build/Profile/DIR600A1
573         $(call Image/Build/Template/$(fs_64k)/$(1),Cameo7240,dir-600-a1,$(dir600a1_cmdline),"AP91-AR7240-RT-090223-00")
574 endef
575
576 eap7660d_cmdline=board=EAP7660D console=ttyS0,115200
577 define Image/Build/Profile/EAP7660D
578         $(call Image/Build/Template/$(fs_128k)/$(1),PB4X,eap7660d,$(eap7660d_cmdline))
579 endef
580
581 ja76pf_cmdline=board=JA76PF console=ttyS0,115200
582 define Image/Build/Profile/JA76PF
583         $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,ja76pf,$(ja76pf_cmdline))
584 endef
585
586 jwap003_cmdline=board=JWAP003 console=ttyS0,115200
587 define Image/Build/Profile/JWAP003
588         $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,jwap003,$(jwap003_cmdline))
589 endef
590
591 fr54rtr_cmdline=board=DIR-600-A1 console=ttyS0,115200
592 define Image/Build/Profile/FR54RTR
593         $(call Image/Build/Template/$(fs_64k)/$(1),Cameo7240,fr-54rtr,$(fr54rtr_cmdline),"AP91-AR7240-RT-090223-01")
594 endef
595
596 dir615c1_cmdline=board=DIR-615-C1 console=ttyS0,115200
597 define Image/Build/Profile/DIR615C1
598         $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,dir-615-c1,$(dir615c1_cmdline),"AP81-AR9130-RT-070614-02")
599 endef
600
601 tew632brp_cmdline=board=TEW-632BRP console=ttyS0,115200
602 define Image/Build/Profile/TEW632BRP
603         $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,tew-632brp,$(tew632brp_cmdline),"AP81-AR9130-RT-070614-00")
604 endef
605
606 tew652brp_cmdline=board=TEW-632BRP console=ttyS0,115200
607 define Image/Build/Profile/TEW652BRP
608         $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,tew-652brp,$(tew652brp_cmdline),"AP81-AR9130-RT-080609-05")
609         $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,tew-652brp-recovery,$(tew652brp_cmdline),"AP81-AR9130-RT-070614-02")
610 endef
611
612 a05rbw300n_cmdline=board=TEW-632BRP console=ttyS0,115200
613 define Image/Build/Profile/A02RBW300N
614         $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,a02-rb-w300n,$(a05rbw300n_cmdline),"AP81-AR9130-RT-070614-03")
615 endef
616
617 ubntrs_cmdline=board=UBNT-RS console=ttyS0,115200
618 define Image/Build/Profile/UBNTRS
619         $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-rs,$(ubntrs_cmdline),RS,RSx,ar7100)
620 endef
621
622 ubntrspro_cmdline=board=UBNT-RSPRO console=ttyS0,115200
623 define Image/Build/Profile/UBNTRSPRO
624         $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-rspro,$(ubntrspro_cmdline),RSPRO,RSPRO,ar7100pro)
625 endef
626
627 ubntlssr71_cmdline=board=UBNT-LS-SR71 console=ttyS0,115200
628 define Image/Build/Profile/UBNTLSSR71
629         $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-ls-sr71,$(ubntlssr71_cmdline),LS-SR71,LS-SR71,ar7100)
630 endef
631
632 ubntbulletm_cmdline=board=UBNT-BM console=ttyS0,115200
633 define Image/Build/Profile/UBNTBULLETM
634         $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-bullet-m,$(ubntbulletm_cmdline),XM,UBNTXM,ar7240)
635 endef
636
637 ubntrocketm_cmdline=board=UBNT-RM console=ttyS0,115200
638 define Image/Build/Profile/UBNTROCKETM
639         $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-rocket-m,$(ubntrocketm_cmdline),XM,UBNTXM,ar7240)
640 endef
641
642 ubntnanom_cmdline=board=UBNT-NM console=ttyS0,115200
643 define Image/Build/Profile/UBNTNANOM
644         $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-nano-m,$(ubntnanom_cmdline),XM,UBNTXM,ar7240)
645 endef
646
647 ubntunifi_cmdline=board=UBNT-XM console=ttyS0,115200
648 define Image/Build/Profile/UBNTUNIFI
649         $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-unifi,$(ubntunifi_cmdline),XM,UBNTXM,ar7240)
650 endef
651
652 define Image/Build/Profile/UBNT
653         $(call Image/Build/Profile/UBNTRS,$(1))
654         $(call Image/Build/Profile/UBNTRSPRO,$(1))
655         $(call Image/Build/Profile/UBNTLSSR71,$(1))
656         $(call Image/Build/Profile/UBNTBULLETM,$(1))
657         $(call Image/Build/Profile/UBNTROCKETM,$(1))
658         $(call Image/Build/Profile/UBNTNANOM,$(1))
659         $(call Image/Build/Profile/UBNTUNIFI,$(1))
660 endef
661
662 mzkw04nu_cmdline=board=MZK-W04NU console=ttyS0,115200
663 define Image/Build/Profile/MZKW04NU
664         $(call Image/Build/Template/$(fs_64k)/$(1),Planex,mzk-w04nu,$(mzkw04nu_cmdline))
665 endef
666
667 mzkw300nh_cmdline=board=MZK-W300NH console=ttyS0,115200
668 define Image/Build/Profile/MZKW300NH
669         $(call Image/Build/Template/$(fs_64k)/$(1),Planex,mzk-w300nh,$(mzkw300nh_cmdline))
670 endef
671
672 nbg460n_cmdline=board=NBG460N console=ttyS0,115200
673 define Image/Build/Profile/NBG_460N_550N_550NH
674         $(call Image/Build/Template/$(fs_64k)/$(1),ZyXEL,nbg460n_550n_550nh,$(nbg460n_cmdline),NBG-460N)
675 endef
676
677 tlmr3220_cmdline=board=TL-MR3220 console=ttyS0,115200
678 define Image/Build/Profile/TLMR3220V1
679         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-mr3220-v1,$(tlmr3220_cmdline),TL-MR3220v1)
680 endef
681
682 tlmr3420_cmdline=board=TL-MR3420 console=ttyS0,115200
683 define Image/Build/Profile/TLMR3420V1
684         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-mr3420-v1,$(tlmr3420_cmdline),TL-MR3420v1)
685 endef
686
687 tlwa901nd_cmdline=board=TL-WA901ND console=ttyS0,115200
688 define Image/Build/Profile/TLWA901NDV1
689         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wa901nd-v1,$(tlwa901nd_cmdline),TL-WA901NDv1)
690 endef
691
692 tlwa901ndv2_cmdline=board=TL-WA901ND-v2 console=ttyS0,115200
693 define Image/Build/Profile/TLWA901NDV2
694         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wa901nd-v2,$(tlwa901ndv2_cmdline),TL-WA901NDv2)
695 endef
696
697 tlwe741ndv1_cmdline=board=TL-WR741ND console=ttyS0,115200
698 define Image/Build/Profile/TLWR741NDV1
699         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wr741nd-v1,$(tlwe741ndv1_cmdline),TL-WR741NDv1)
700 endef
701
702 tlwe740nv1_cmdline=board=TL-WR741ND console=ttyS0,115200
703 define Image/Build/Profile/TLWR740NV1
704         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wr740n-v1,$(tlwe740nv1_cmdline),TL-WR740Nv1)
705 endef
706
707 tlwr841nv15_cmdline=board=TL-WR841N-v1.5 console=ttyS0,115200
708 define Image/Build/Profile/TLWR841NV15
709         $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr841n-v1.5,$(tlwr841nv15_cmdline),TL-WR841Nv1.5)
710 endef
711
712 tlwr841ndv3_cmdline=board=TL-WR941ND console=ttyS0,115200
713 define Image/Build/Profile/TLWR841NDV3
714         $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr841nd-v3,$(tlwr841ndv3_cmdline),TL-WR841NDv3)
715 endef
716
717 tlwr841ndv5_cmdline=board=TL-WR741ND console=ttyS0,115200
718 define Image/Build/Profile/TLWR841NDV5
719         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wr841nd-v5,$(tlwr841ndv5_cmdline),TL-WR841NDv5)
720 endef
721
722 tlwr841ndv7_cmdline=board=TL-WR741ND console=ttyS0,115200
723 define Image/Build/Profile/TLWR841NDV7
724         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wr841nd-v7,$(tlwr841ndv7_cmdline),TL-WR841NDv7)
725 endef
726
727 tlwr941ndv2_cmdline=board=TL-WR941ND console=ttyS0,115200
728 define Image/Build/Profile/TLWR941NDV2
729         $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr941nd-v2,$(tlwr941ndv2_cmdline),TL-WR941NDv2)
730 endef
731
732 tlwr941ndv3_cmdline=board=TL-WR941ND console=ttyS0,115200
733 define Image/Build/Profile/TLWR941NDV3
734         $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr941nd-v3,$(tlwr941ndv3_cmdline),TL-WR941NDv2)
735 endef
736
737 tlwr941ndv4_cmdline=board=TL-WR741ND console=ttyS0,115200
738 define Image/Build/Profile/TLWR941NDV4
739         $(call Image/Build/Template/$(fs_64k)/$(1),TPLINK,tl-wr941nd-v4,$(tlwr941ndv4_cmdline),TL-WR941NDv4)
740 endef
741
742 tlwr1043nd_cmdline=board=TL-WR1043ND console=ttyS0,115200
743 define Image/Build/Profile/TLWR1043NDV1
744         $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr1043nd-v1,$(tlwr1043nd_cmdline),TL-WR1043NDv1)
745 endef
746
747 wndr3700_cmdline=board=WNDR3700 console=ttyS0,115200
748 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
749 wndr3700v2_cmdline=board=WNDR3700v2 console=ttyS0,115200
750 wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),14848k(rootfs),64k(art)ro,15872k@0x70000(firmware)
751 define Image/Build/Profile/WNDR3700
752         $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700,$(wndr3700_cmdline),wndr3700_mtdlayout,3700,WNDR3700,"" NA,)
753         $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700v2,$(wndr3700v2_cmdline),wndr3700v2_mtdlayout,3701,WNDR3700v2,"",-H 29763654+16+64)
754 endef
755
756 ap96_cmdline=board=AP96 console=ttyS0,115200
757 define Image/Build/Profile/AP96
758         $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap96,$(ap96_cmdline))
759 endef
760
761 wr400n_cmdline=board=WRT400N console=ttyS0,115200
762 define Image/Build/Profile/WRT400N
763         $(call Image/Build/Template/$(fs_64k)/$(1),WRT400N,wrt400n,$(wr400n_cmdline))
764 endef
765
766 dir825b1_cmdline=board=DIR-825-B1 console=ttyS0,115200
767 define Image/Build/Profile/DIR825B1
768         $(call Image/Build/Template/$(fs_64k)/$(1),DIR825B1,dir-825-b1,$(dir825b1_cmdline))
769 endef
770
771 wrt160nl_cmdline=board=WRT160NL console=ttyS0,115200
772 define Image/Build/Profile/WRT160NL
773         $(call Image/Build/Template/$(fs_64k)/$(1),CyberTAN,wrt160nl,$(wrt160nl_cmdline),1.00.01)
774 endef
775
776 wzrhpg300nh_cmdline=board=WZR-HP-G300NH console=ttyS0,115200
777 wzrhpg301nh_cmdline=board=WZR-HP-G301NH console=ttyS0,115200
778 define Image/Build/Profile/WZRHPG30XNH
779         $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g300nh,$(wzrhpg300nh_cmdline),WZR-HP-G300NH)
780         $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-g301nh,$(wzrhpg301nh_cmdline),WZR-HP-G301NH)
781 endef
782
783 wzrhpag300h_cmdline=board=WZR-HP-AG300H console=ttyS0,115200
784 define Image/Build/Profile/WZRHPAG300H
785         $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG30XNH,wzr-hp-ag300h,$(wzrhpag300h_cmdline),WZR-HP-AG300H)
786 endef
787
788 zcn1523h28_cmdline=board=ZCN-1523H-2 console=ttyS0,115200
789 define Image/Build/Profile/ZCN1523H28
790         $(call Image/Build/Template/$(fs_64k)/$(1),Zcomax,zcn-1523h-2-8,$(zcn1523h28_cmdline))
791 endef
792
793 zcn1523h516_cmdline=board=ZCN-1523H-5 console=ttyS0,115200
794 define Image/Build/Profile/ZCN1523H516
795         $(call Image/Build/Template/$(fs_64k)/$(1),Zcomax,zcn-1523h-5-16,$(zcn1523h516_cmdline))
796 endef
797
798 define Image/Build/Profile/Default
799         $(call Image/Build/Profile/AP121,$(1))
800         $(call Image/Build/Profile/AP121MINI,$(1))
801         $(call Image/Build/Profile/AP81,$(1))
802         $(call Image/Build/Profile/AP83,$(1))
803         $(call Image/Build/Profile/A02RBW300N,$(1))
804         $(call Image/Build/Profile/DB120,$(1))
805         $(call Image/Build/Profile/DIR600A1,$(1))
806         $(call Image/Build/Profile/DIR615C1,$(1))
807         $(call Image/Build/Profile/DIR825B1,$(1))
808         $(call Image/Build/Profile/EAP7660D,$(1))
809         $(call Image/Build/Profile/FR54RTR,$(1))
810         $(call Image/Build/Profile/JA76PF,$(1))
811         $(call Image/Build/Profile/JWAP003,$(1))
812         $(call Image/Build/Profile/MZKW04NU,$(1))
813         $(call Image/Build/Profile/MZKW300NH,$(1))
814         $(call Image/Build/Profile/NBG_460N_550N_550NH,$(1))
815         $(call Image/Build/Profile/PB42,$(1))
816         $(call Image/Build/Profile/PB44,$(1))
817         $(call Image/Build/Profile/PB92,$(1))
818         $(call Image/Build/Profile/TEW632BRP,$(1))
819         $(call Image/Build/Profile/TEW652BRP,$(1))
820         $(call Image/Build/Profile/TLMR3220V1,$(1))
821         $(call Image/Build/Profile/TLMR3420V1,$(1))
822         $(call Image/Build/Profile/TLWA901NDV1,$(1))
823         $(call Image/Build/Profile/TLWA901NDV2,$(1))
824         $(call Image/Build/Profile/TLWR741NDV1,$(1))
825         $(call Image/Build/Profile/TLWR740NV1,$(1))
826         $(call Image/Build/Profile/TLWR841NV15,$(1))
827         $(call Image/Build/Profile/TLWR841NDV3,$(1))
828         $(call Image/Build/Profile/TLWR841NDV5,$(1))
829         $(call Image/Build/Profile/TLWR841NDV7,$(1))
830         $(call Image/Build/Profile/TLWR941NDV2,$(1))
831         $(call Image/Build/Profile/TLWR941NDV3,$(1))
832         $(call Image/Build/Profile/TLWR941NDV4,$(1))
833         $(call Image/Build/Profile/TLWR1043NDV1,$(1))
834         $(call Image/Build/Profile/UBNT,$(1))
835         $(call Image/Build/Profile/WP543,$(1))
836         $(call Image/Build/Profile/WNDR3700,$(1))
837         $(call Image/Build/Profile/AP96,$(1))
838         $(call Image/Build/Profile/WRT400N,$(1))
839         $(call Image/Build/Profile/WRT160NL,$(1))
840         $(call Image/Build/Profile/WZRHPG30XNH,$(1))
841         $(call Image/Build/Profile/WZRHPAG300H,$(1))
842         $(call Image/Build/Profile/ZCN1523H28,$(1))
843         $(call Image/Build/Profile/ZCN1523H516,$(1))
844 endef
845
846 define Image/Build/Profile/Minimal
847         $(call Image/Build/Profile/Default,$(1))
848 endef
849
850 define Image/Build/Profile/Madwifi
851         $(call Image/Build/Profile/EAP7660D,$(1))
852         $(call Image/Build/Profile/UBNTRS,$(1))
853         $(call Image/Build/Profile/UBNTRSPRO,$(1))
854         $(call Image/Build/Profile/UBNTLSSR71,$(1))
855         $(call Image/Build/Profile/WP543,$(1))
856 endef
857
858 define Image/Build/squashfs
859         cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-4k
860         $(STAGING_DIR_HOST)/bin/padjffs2 $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-4k 4
861         cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
862         $(STAGING_DIR_HOST)/bin/padjffs2 $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k 4 8 64
863         $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
864 endef
865
866 define Image/Build/Initramfs
867         $(call Image/Build/Profile/$(PROFILE),initramfs)
868 endef
869
870 define Image/Build
871         $(call Image/Build/$(1))
872         dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
873
874         $(call Image/Build/Profile/$(PROFILE),$(1))
875 endef
876
877 $(eval $(call BuildImage))