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