ar71xx: rename initramfs u-boot images
[openwrt.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008-2009 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 IMGNAME:=$(BIN_DIR)/openwrt-$(BOARD)
11
12 define imgname
13 $(IMGNAME)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
14 endef
15
16 VMLINUX:=$(IMGNAME)-vmlinux
17 UIMAGE:=$(IMGNAME)-uImage
18 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
19         VMLINUX:=$(IMGNAME)-vmlinux-initramfs
20         UIMAGE:=$(IMGNAME)-uImage-initramfs
21 endif
22
23 define CompressLzma
24   $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
25 endef
26
27 define PatchKernelLzma
28         cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
29         $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
30         $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).bin.lzma)
31 endef
32
33 define PatchKernelGzip
34         cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
35         $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
36         gzip -9 -c $(KDIR)/vmlinux-$(1) > $(KDIR)/vmlinux-$(1).bin.gz
37 endef
38
39 define MkImageLzma
40         mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma \
41                 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
42                 -d $(1) $(2)
43 endef
44
45 define MkImageGzip
46         mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip \
47                 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
48                 -d $(1) $(2)
49 endef
50
51 define Image/BuildKernel
52         cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
53         cp $(KDIR)/vmlinux $(VMLINUX).bin
54         gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
55         $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
56         dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
57         dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
58         $(call MkImageGzip,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
59         $(call MkImageLzma,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
60 endef
61
62 define Image/Build/WRT400N
63         $(call PatchKernelLzma,$(2),$(3))
64         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1310720 ]; then \
65                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
66         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6488064 ]; then \
67                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
68         else \
69                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
70                         0x80060000 \
71                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
72                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
73                 ( \
74                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1280k conv=sync; \
75                         dd if=$(KDIR)/root.$(1) bs=6336k conv=sync; \
76                         echo -n $(4); \
77                 ) > $(call imgname,$(1),$(2)).bin; \
78                 wrt400n $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call imgname,$(1),$(2)).webui; \
79         fi; fi
80 endef
81
82 dir600a1_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,896k(kernel),2816k(rootfs),64k(mac)ro,64k(art)ro,3712k@0x40000(firmware)
83 define Image/Build/DIR600A1
84         $(call PatchKernelLzma,$(2),$(3) $(dir600a1_mtdlayout))
85         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
86                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
87         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
88                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
89         else \
90                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
91                         0x80060000 \
92                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
93                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
94                 ( \
95                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
96                         dd if=$(KDIR)/root.$(1) bs=2752k conv=sync; \
97                         echo -n "AP91-AR7240-RT-090223-00"; \
98                 ) > $(call imgname,$(1),$(2))-universal.bin; \
99         fi; fi
100 endef
101
102 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
103 define Image/Build/DIR825B1
104         $(call PatchKernelLzma,$(2),$(3) $(dir825b1_mtdlayout))
105         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(call imgname,$(1),$(2)).bin)
106         if [ `stat -c%s "$(call imgname,$(1),$(2)).bin"` -gt 1048576 ]; then \
107                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
108                 rm -f $(call imgname,$(1),$(2)).bin; \
109         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 5308416 ]; then \
110                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
111                 rm -f $(call imgname,$(1),$(2)).bin; \
112         else \
113                 dd if=$(KDIR)/root.$(1) of=$(call imgname,$(1),$(2)).bin bs=1k seek=1024; \
114                 cp $(call imgname,$(1),$(2)).bin $(call imgname,$(1),$(2))-backup-loader.bin; \
115                 echo -n "01AP94-AR7161-RT-080619-00" >> $(call imgname,$(1),$(2))-backup-loader.bin; \
116         fi; fi
117 endef
118
119 define Image/Build/WZRHPG300NH
120         $(call PatchKernelLzma,$(2),$(3))
121         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
122                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
123         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 31850496 ]; then \
124                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
125         else \
126                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
127                         0x80060000 \
128                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
129                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
130                 ( \
131                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync; \
132                         dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
133                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
134                 ( \
135                         echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
136                         dd if=$(call imgname,$(1),$(2))-sysupgrade.bin; \
137                 ) > $(call imgname,$(1),$(2))-tftp.bin; \
138         fi; fi
139 endef
140
141 cameo_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,896k(kernel),2880k(rootfs),64k(art)ro,3776k@0x30000(firmware)
142 define Image/Build/Cameo
143         $(call PatchKernelLzma,$(2),$(3) $(cameo_mtdlayout))
144         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
145                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
146         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2949120 ]; then \
147                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
148         else \
149                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
150                         0x80060000 \
151                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
152                         -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
153                 ( \
154                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
155                         dd if=$(KDIR)/root.$(1) bs=2880k conv=sync; \
156                         echo -n $(4); \
157                 ) > $(call imgname,$(1),$(2)).uni; \
158         fi; fi
159 endef
160
161 define Image/Build/AP83
162         $(call PatchKernelGzip,$(2),$(3))
163         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1310720 ]; then \
164                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
165         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6619136 ]; then \
166                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
167         else \
168                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
169                         0x80060000 \
170                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
171                         -d $(KDIR)/vmlinux-$(2).bin.gz \
172                         $(KDIR)/vmlinux-$(2).uImage; \
173                 dd if=$(KDIR)/vmlinux-$(2).uImage \
174                         of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
175                 dd if=$(KDIR)/root.$(1) \
176                         of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
177                 ( \
178                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1280k conv=sync; \
179                         dd if=$(KDIR)/root.$(1); \
180                 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
181         fi; fi
182 endef
183
184 define Image/Build/PB4X
185         $(call PatchKernelLzma,$(2),$(3))
186         dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
187            of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
188         dd if=$(KDIR)/root.$(1) \
189            of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
190         -sh $(TOPDIR)/scripts/combined-image.sh \
191                 "$(call imgname,kernel,$(2)).bin" \
192                 "$(call imgname,$(1),$(2)-rootfs).bin" \
193                 $(call imgname,$(1),$(2))-sysupgrade.bin
194 endef
195
196 define Image/Build/MyLoader
197         -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) \
198                 -p0x030000:0xd0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
199                 -p0x100000:0:::rootfs:$(KDIR)/root.$(1) \
200                 $(call imgname,$(1),$(2))-2M.img
201         -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s 0x400000 \
202                 -p0x030000:0xd0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
203                 -p0x100000:0:::rootfs:$(KDIR)/root.$(1) \
204                 $(call imgname,$(1),$(2))-4M.img
205         -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s 0x800000 \
206                 -p0x030000:0xd0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
207                 -p0x100000:0:::rootfs:$(KDIR)/root.$(1) \
208                 $(call imgname,$(1),$(2))-8M.img
209         -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s 0x1000000 \
210                 -p0x030000:0xd0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
211                 -p0x100000:0:::rootfs:$(KDIR)/root.$(1) \
212                 $(call imgname,$(1),$(2))-16M.img
213 endef
214
215 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)
216 define Image/Build/UBNTXM
217         $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout))
218         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage.bin)
219         dd if=$(KDIR)/vmlinux-$(2).uImage.bin of=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync
220         -$(STAGING_DIR_HOST)/bin/mkfwimage \
221                 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
222                 -k $(KDIR)/vmlinux-$(2).uImage \
223                 -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \
224                 -o $(call imgname,$(1),$(2))-factory.bin
225         ( \
226                 dd if=$(KDIR)/vmlinux-$(2).uImage; \
227                 dd if=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1); \
228         ) > $(call imgname,$(1),$(2))-sysupgrade.bin
229 endef
230
231 define Image/Build/UBNT
232         $(call PatchKernelLzma,$(2),$(3))
233         dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).lzma bs=64k conv=sync
234         -$(STAGING_DIR_HOST)/bin/mkfwimage \
235                 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
236                 -k $(KDIR)/vmlinux-$(2).lzma \
237                 -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \
238                 -o $(call imgname,$(1),$(2))-factory.bin
239         -sh $(TOPDIR)/scripts/combined-image.sh \
240                 "$(KDIR)/vmlinux-$(2).lzma" \
241                 "$(BIN_DIR)/openwrt-$(BOARD)-root.$(1)" \
242                 $(call imgname,$(1),$(2))-sysupgrade.bin
243 endef
244
245 define Image/Build/Planex
246         $(call PatchKernelGzip,$(2),$(3))
247         if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1441792 ]; then \
248                 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
249         else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6356992 ]; then \
250                 echo "Warning: $(KDIR)/root.$(1) is too big"; \
251         else \
252                 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
253                         0x80060000 \
254                         -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
255                         -d $(KDIR)/vmlinux-$(2).bin.gz $(KDIR)/vmlinux-$(2).uImage; \
256                 ( \
257                         dd if=$(KDIR)/vmlinux-$(2).uImage bs=1408k conv=sync; \
258                         dd if=$(KDIR)/root.$(1) bs=6208k conv=sync; \
259                 ) > $(call imgname,$(1),$(2)).bin; \
260                 $(STAGING_DIR_HOST)/bin/mkplanexfw \
261                         -B $(2) \
262                         -v 2.00.00 \
263                         -i $(call imgname,$(1),$(2)).bin \
264                         -o $(call imgname,$(1),$(2)).webui; \
265         fi; fi
266 endef
267
268 define Image/Build/TPLINK
269         $(call PatchKernelGzip,$(2),$(3))
270         -$(STAGING_DIR_HOST)/bin/mktplinkfw \
271                 -B $(4) -N OpenWrt -V $(REVISION)\
272                 -k $(KDIR)/vmlinux-$(2).bin.gz \
273                 -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \
274                 -o $(call imgname,$(1),$(2))-universal.bin
275 endef
276
277 define Image/Build/CyberTAN
278         $(call PatchKernelGzip,$(2),$(3))
279         $(call MkImageGzip,$(KDIR)/vmlinux-$(2).bin.gz,$(KDIR)/vmlinux-$(2).uImage)
280         ( \
281                 dd if=$(KDIR)/vmlinux-$(2).uImage bs=64k conv=sync; \
282                 dd if=/dev/zero bs=1 count=65476; \
283                 dd if=$(KDIR)/root.$(1) bs=64k; \
284         ) > $(KDIR)/vmlinux-$(2).image
285         $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/vmlinux-$(2).trx \
286                 -f $(KDIR)/vmlinux-$(2).image
287         -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
288                 -i $(KDIR)/vmlinux-$(2).trx \
289                 -o $(call imgname,$(1),$(2)).bin
290 endef
291
292 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
293 define Image/Build/WNDR3700
294         $(call PatchKernelLzma,$(2),$(3) $(wndr3700_mtdlayout))
295         $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
296         mkdir -p $(KDIR)/wndr3700/image
297         $(STAGING_DIR_HOST)/bin/wndr3700 \
298                 $(KDIR)/vmlinux-$(2).uImage \
299                 $(KDIR)/wndr3700/image/uImage
300         $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
301                 $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
302                 -nopad -noappend -root-owned -be
303         -rm -rf $(KDIR)/wndr3700
304         mkimage -A mips -O linux -T filesystem -C none \
305                 -a 0xbf070000 -e 0xbf070000 \
306                 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
307                 -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
308                 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
309         $(STAGING_DIR_HOST)/bin/wndr3700 \
310                 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
311                 $(KDIR)/vmlinux-$(2).uImage.squashfs
312         -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
313         ( \
314                 dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
315                 dd if=$(KDIR)/root.$(1) bs=64k; \
316         ) > $(call imgname,$(1),$(2))-sysupgrade.bin
317         $(STAGING_DIR_HOST)/bin/mkdniimg \
318                 -B WNDR3700 -v OpenWrt.$(REVISION) \
319                 -i $(call imgname,$(1),$(2))-sysupgrade.bin \
320                 -o $(call imgname,$(1),$(2))-factory.img
321 endef
322
323 define Image/Build/Template/all/squashfs
324         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
325 endef
326
327 define Image/Build/Template/all/jffs2-64k
328         $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7))
329 endef
330
331 define Image/Build/Template/all/jffs2-128k
332         $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7))
333 endef
334
335 define Image/Build/Template/squashfs-only/squashfs
336         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
337 endef
338
339 define Image/Build/Template/4k/squashfs
340         $(call Image/Build/$(1),squashfs-4k,$(2),$(3),$(4),$(5),$(6),$(7))
341 endef
342
343 define Image/Build/Template/64k/squashfs
344         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
345 endef
346
347 define Image/Build/Template/64k/jffs2-64k
348         $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7))
349 endef
350
351 define Image/Build/Template/128k/squashfs
352         $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
353 endef
354
355 define Image/Build/Template/128k/jffs2-128k
356         $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7))
357 endef
358
359 define Image/Build/Profile/AP81
360         $(call Image/Build/Template/64k/$(1),AP83,ap81,board=AP81)
361 endef
362
363 define Image/Build/Profile/AP83
364         $(call Image/Build/Template/64k/$(1),AP83,ap83,board=AP83)
365 endef
366
367 define Image/Build/Profile/PB42
368         $(call Image/Build/Template/64k/$(1),PB4X,pb42,board=PB42)
369 endef
370
371 define Image/Build/Profile/PB44
372         $(call Image/Build/Template/64k/$(1),PB4X,pb44,board=PB44)
373 endef
374
375 define Image/Build/Profile/WP543
376         $(call Image/Build/Template/64k/$(1),MyLoader,wp543)
377 endef
378
379 define Image/Build/Profile/DIR600A1
380         $(call Image/Build/Template/64k/$(1),DIR600A1,dir-600-a1,board=DIR-600-A1)
381 endef
382
383 define Image/Build/Profile/DIR615C1
384         $(call Image/Build/Template/squashfs-only/$(1),Cameo,dir-615-c1,board=DIR-615-C1,"AP81-AR9130-RT-070614-02")
385 endef
386
387 define Image/Build/Profile/TEW632BRP
388         $(call Image/Build/Template/squashfs-only/$(1),Cameo,tew-632brp,board=TEW-632BRP,"AP81-AR9130-RT-070614-00")
389 endef
390
391 define Image/Build/Profile/TEW652BRP
392         $(call Image/Build/Template/squashfs-only/$(1),Cameo,tew-652brp,board=TEW-632BRP,"AP81-AR9130-RT-080609-05")
393 endef
394
395 define Image/Build/Profile/A02RBW300N
396         $(call Image/Build/Template/squashfs-only/$(1),Cameo,a02-rb-w300n,board=TEW-632BRP,"AP81-AR9130-RT-070614-03")
397 endef
398
399 define Image/Build/Profile/UBNTRS
400         $(call Image/Build/Template/64k/$(1),UBNT,ubnt-rs,board=UBNT-RS,RS,RSx,ar7100)
401 endef
402
403 define Image/Build/Profile/UBNTRSPRO
404         $(call Image/Build/Template/64k/$(1),UBNT,ubnt-rspro,board=UBNT-RSPRO,RSPRO,RSPRO,ar7100pro)
405 endef
406
407 define Image/Build/Profile/UBNTLSSR71
408         $(call Image/Build/Template/64k/$(1),UBNT,ubnt-ls-sr71,board=UBNT-LS-SR71,LS-SR71,LS-SR71,ar7100)
409 endef
410
411 define Image/Build/Profile/UBNTBULLETM
412         $(call Image/Build/Template/64k/$(1),UBNTXM,ubnt-bullet-m,board=UBNT-BM,XM,UBNTXM,ar7240)
413 endef
414
415 define Image/Build/Profile/UBNTROCKETM
416         $(call Image/Build/Template/64k/$(1),UBNTXM,ubnt-rocket-m,board=UBNT-RM,XM,UBNTXM,ar7240)
417 endef
418
419 define Image/Build/Profile/UBNTNANOM
420         $(call Image/Build/Template/64k/$(1),UBNTXM,ubnt-nano-m,board=UBNT-NM,XM,UBNTXM,ar7240)
421 endef
422
423 define Image/Build/Profile/UBNT
424         $(call Image/Build/Profile/UBNTRS,$(1))
425         $(call Image/Build/Profile/UBNTRSPRO,$(1))
426         $(call Image/Build/Profile/UBNTLSSR71,$(1))
427         $(call Image/Build/Profile/UBNTBULLETM,$(1))
428         $(call Image/Build/Profile/UBNTROCKETM,$(1))
429         $(call Image/Build/Profile/UBNTNANOM,$(1))
430 endef
431
432 define Image/Build/Profile/MZKW04NU
433         $(call Image/Build/Template/64k/$(1),Planex,mzk-w04nu,board=MZK-W04NU)
434 endef
435
436 define Image/Build/Profile/MZKW300NH
437         $(call Image/Build/Template/64k/$(1),Planex,mzk-w300nh,board=MZK-W300NH)
438 endef
439
440 define Image/Build/Profile/TLWR741NDV1
441         $(call Image/Build/Template/4k/$(1),TPLINK,tl-wr741nd-v1,board=TL-WR741ND,TL-WR741NDv1)
442 endef
443
444 define Image/Build/Profile/TLWR841NV15
445         $(call Image/Build/Template/squashfs-only/$(1),TPLINK,tl-wr841n-v1.5,board=TL-WR841N-v1.5,TL-WR841Nv1.5)
446 endef
447
448 define Image/Build/Profile/TLWR841NDV3
449         $(call Image/Build/Template/squashfs-only/$(1),TPLINK,tl-wr841nd-v3,board=TL-WR941ND,TL-WR841NDv3)
450 endef
451
452 define Image/Build/Profile/TLWR841NDV5
453         $(call Image/Build/Template/4k/$(1),TPLINK,tl-wr841nd-v5,board=TL-WR741ND,TL-WR841NDv5)
454 endef
455
456 define Image/Build/Profile/TLWR941NDV2
457         $(call Image/Build/Template/squashfs-only/$(1),TPLINK,tl-wr941nd-v2,board=TL-WR941ND,TL-WR941NDv2)
458 endef
459
460 define Image/Build/Profile/TLWR1043NDV1
461         $(call Image/Build/Template/squashfs-only/$(1),TPLINK,tl-wr1043nd-v1,board=TL-WR1043ND,TL-WR1043NDv1)
462 endef
463
464 define Image/Build/Profile/WNDR3700
465         $(call Image/Build/Template/64k/$(1),WNDR3700,wndr3700,board=WNDR3700)
466 endef
467
468 define Image/Build/Profile/WRT400N
469         $(call Image/Build/Template/64k/$(1),WRT400N,wrt400n,board=WRT400N)
470 endef
471
472 define Image/Build/Profile/DIR825B1
473         $(call Image/Build/Template/64k/$(1),DIR825B1,dir-825-b1,board=DIR-825-B1)
474 endef
475
476 define Image/Build/Profile/WRT160NL
477         $(call Image/Build/Template/64k/$(1),CyberTAN,wrt160nl,board=WRT160NL,1.00.01)
478 endef
479
480 define Image/Build/Profile/WZRHPG300NH
481         $(call Image/Build/Template/128k/$(1),WZRHPG300NH,wzr-hp-g300nh,board=WZR-HP-G300NH)
482 endef
483
484 define Image/Build/Profile/Default
485         $(call Image/Build/Profile/AP81,$(1))
486         $(call Image/Build/Profile/AP83,$(1))
487         $(call Image/Build/Profile/A02RBW300N,$(1))
488         $(call Image/Build/Profile/DIR600A1,$(1))
489         $(call Image/Build/Profile/DIR615C1,$(1))
490         $(call Image/Build/Profile/DIR825B1,$(1))
491         $(call Image/Build/Profile/MZKW04NU,$(1))
492         $(call Image/Build/Profile/MZKW300NH,$(1))
493         $(call Image/Build/Profile/PB42,$(1))
494         $(call Image/Build/Profile/PB44,$(1))
495         $(call Image/Build/Profile/TEW632BRP,$(1))
496         $(call Image/Build/Profile/TEW652BRP,$(1))
497         $(call Image/Build/Profile/TLWR741NDV1,$(1))
498         $(call Image/Build/Profile/TLWR841NV15,$(1))
499         $(call Image/Build/Profile/TLWR841NDV3,$(1))
500         $(call Image/Build/Profile/TLWR841NDV5,$(1))
501         $(call Image/Build/Profile/TLWR941NDV2,$(1))
502         $(call Image/Build/Profile/TLWR1043NDV1,$(1))
503         $(call Image/Build/Profile/UBNT,$(1))
504         $(call Image/Build/Profile/WP543,$(1))
505         $(call Image/Build/Profile/WNDR3700,$(1))
506         $(call Image/Build/Profile/WRT400N,$(1))
507         $(call Image/Build/Profile/WRT160NL,$(1))
508         $(call Image/Build/Profile/WZRHPG300NH,$(1))
509 endef
510
511 define Image/Build/Profile/Madwifi
512         $(call Image/Build/Profile/UBNTRS,$(1))
513         $(call Image/Build/Profile/UBNTRSPRO,$(1))
514         $(call Image/Build/Profile/UBNTLSSR71,$(1))
515         $(call Image/Build/Profile/WP543,$(1))
516 endef
517
518 define Image/Build/squashfs
519         $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
520         dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.squashfs-4k.tmp0 bs=4k conv=sync
521         $(call add_jffs2_mark,$(KDIR)/root.squashfs-4k.tmp0)
522         dd if=$(KDIR)/root.squashfs-4k.tmp0 of=$(IMGNAME)-root.squashfs-4k bs=4k conv=sync
523         $(call add_jffs2_mark,$(IMGNAME)-root.squashfs-4k)
524         rm -f $(KDIR)/root.squashfs-4k.tmp0
525 endef
526
527 define Image/Build
528         $(call Image/Build/$(1))
529         dd if=$(KDIR)/root.$(1) of=$(IMGNAME)-root.$(1) bs=128k conv=sync
530
531         $(call Image/Build/Profile/$(PROFILE),$(1))
532 endef
533
534 $(eval $(call BuildImage))