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