ar71xx: create separate 'factory' and 'sysupgrade' images for the WRT160NL
[openwrt/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) bs=6336k conv=sync; \
85 echo -n $(4); \
86 ) > $(call imgname,$(1),$(2)).bin; \
87 wrt400n $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call imgname,$(1),$(2)).webui; \
88 fi; fi
89 endef
90
91 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
92 define Image/Build/DIR825B1
93 $(call PatchKernelLzma,$(2),$(3) $(dir825b1_mtdlayout))
94 $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(call imgname,$(1),$(2)).bin)
95 if [ `stat -c%s "$(call imgname,$(1),$(2)).bin"` -gt 1048576 ]; then \
96 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
97 rm -f $(call imgname,$(1),$(2)).bin; \
98 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 5308416 ]; then \
99 echo "Warning: $(KDIR)/root.$(1) is too big"; \
100 rm -f $(call imgname,$(1),$(2)).bin; \
101 else \
102 dd if=$(KDIR)/root.$(1) of=$(call imgname,$(1),$(2)).bin bs=1k seek=1024; \
103 cp $(call imgname,$(1),$(2)).bin $(call imgname,$(1),$(2))-backup-loader.bin; \
104 echo -n "01AP94-AR7161-RT-080619-00" >> $(call imgname,$(1),$(2))-backup-loader.bin; \
105 fi; fi
106 endef
107
108 define Image/Build/WZRHPG300NH
109 $(call PatchKernelLzma,$(2),$(3))
110 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
111 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
112 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 31850496 ]; then \
113 echo "Warning: $(KDIR)/root.$(1) is too big"; \
114 else \
115 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
116 0x80060000 \
117 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
118 -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
119 ( \
120 dd if=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync; \
121 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
122 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
123 ( \
124 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
125 dd if=$(call imgname,$(1),$(2))-sysupgrade.bin; \
126 ) > $(call imgname,$(1),$(2))-tftp.bin; \
127 fi; fi
128 endef
129
130 cameo_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,896k(kernel),2944k(rootfs),64k(art)ro,3840k@0x30000(firmware)
131 define Image/Build/Cameo
132 $(call PatchKernelLzma,$(2),$(3) $(cameo_mtdlayout))
133 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
134 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
135 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2949120 ]; then \
136 echo "Warning: $(KDIR)/root.$(1) is too big"; \
137 else \
138 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
139 0x80060000 \
140 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
141 -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
142 ( \
143 dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
144 dd if=$(KDIR)/root.$(1) \
145 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
146 ( \
147 dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
148 dd if=$(KDIR)/root.$(1) bs=2880k conv=sync; \
149 echo -n $(4); \
150 ) > $(call imgname,$(1),$(2))-factory.bin; \
151 fi; fi
152 endef
153
154 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)
155 define Image/Build/Cameo7240
156 $(call PatchKernelLzma,$(2),$(3) $(cameo7240_mtdlayout))
157 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
158 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
159 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
160 echo "Warning: $(KDIR)/root.$(1) is too big"; \
161 else \
162 mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
163 0x80060000 \
164 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
165 -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
166 ( \
167 dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
168 dd if=$(KDIR)/root.$(1) \
169 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
170 ( \
171 dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
172 dd if=$(KDIR)/root.$(1) bs=2752k conv=sync; \
173 echo -n $(4); \
174 ) > $(call imgname,$(1),$(2))-factory.bin; \
175 fi; fi
176 endef
177
178 define Image/Build/AP83
179 $(call PatchKernelGzip,$(2),$(3))
180 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1310720 ]; then \
181 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
182 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6619136 ]; then \
183 echo "Warning: $(KDIR)/root.$(1) is too big"; \
184 else \
185 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
186 0x80060000 \
187 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
188 -d $(KDIR)/vmlinux-$(2).bin.gz \
189 $(KDIR)/vmlinux-$(2).uImage; \
190 dd if=$(KDIR)/vmlinux-$(2).uImage \
191 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
192 dd if=$(KDIR)/root.$(1) \
193 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
194 ( \
195 dd if=$(KDIR)/vmlinux-$(2).uImage bs=1280k conv=sync; \
196 dd if=$(KDIR)/root.$(1); \
197 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
198 fi; fi
199 endef
200
201 define Image/Build/PB92
202 $(call PatchKernelGzip,$(2),$(3))
203 if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
204 echo "Warning: $(KDIR)/root.$(1) is too big"; \
205 else \
206 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
207 0x80060000 \
208 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
209 -d $(KDIR)/vmlinux-$(2).bin.gz \
210 $(KDIR)/vmlinux-$(2).uImage; \
211 dd if=$(KDIR)/vmlinux-$(2).uImage \
212 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
213 dd if=$(KDIR)/root.$(1) \
214 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
215 ( \
216 dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
217 dd if=$(KDIR)/root.$(1); \
218 ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
219 fi
220 endef
221
222 define Image/Build/PB4X
223 $(call PatchKernelLzma,$(2),$(3))
224 dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
225 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
226 dd if=$(KDIR)/root.$(1) \
227 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
228 -sh $(TOPDIR)/scripts/combined-image.sh \
229 "$(call imgname,kernel,$(2)).bin" \
230 "$(call imgname,$(1),$(2)-rootfs).bin" \
231 $(call imgname,$(1),$(2))-sysupgrade.bin
232 endef
233
234 define Image/Build/MyLoader
235 -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(3) \
236 -p0x030000:0xe0000:al:0x80060000:kernel:$(KDIR)/vmlinux.bin.lzma \
237 -p0x110000:0:::rootfs:$(KDIR)/root.$(1) \
238 $(call imgname,$(1),$(2))-$(4)-factory.img
239 endef
240
241 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)
242 define Image/Build/UBNTXM
243 $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout))
244 $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage.bin)
245 dd if=$(KDIR)/vmlinux-$(2).uImage.bin of=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync
246 -$(STAGING_DIR_HOST)/bin/mkfwimage \
247 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
248 -k $(KDIR)/vmlinux-$(2).uImage \
249 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
250 -o $(call imgname,$(1),$(2))-factory.bin
251 ( \
252 dd if=$(KDIR)/vmlinux-$(2).uImage; \
253 dd if=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1); \
254 ) > $(call imgname,$(1),$(2))-sysupgrade.bin
255 endef
256
257 define Image/Build/UBNT
258 $(call PatchKernelLzma,$(2),$(3))
259 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).lzma bs=64k conv=sync
260 -$(STAGING_DIR_HOST)/bin/mkfwimage \
261 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
262 -k $(KDIR)/vmlinux-$(2).lzma \
263 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
264 -o $(call imgname,$(1),$(2))-factory.bin
265 -sh $(TOPDIR)/scripts/combined-image.sh \
266 "$(KDIR)/vmlinux-$(2).lzma" \
267 "$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)" \
268 $(call imgname,$(1),$(2))-sysupgrade.bin
269 endef
270
271 define Image/Build/Planex
272 $(call PatchKernelGzip,$(2),$(3))
273 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1441792 ]; then \
274 echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \
275 else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6356992 ]; then \
276 echo "Warning: $(KDIR)/root.$(1) is too big"; \
277 else \
278 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
279 0x80060000 \
280 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
281 -d $(KDIR)/vmlinux-$(2).bin.gz $(KDIR)/vmlinux-$(2).uImage; \
282 ( \
283 dd if=$(KDIR)/vmlinux-$(2).uImage bs=1408k conv=sync; \
284 dd if=$(KDIR)/root.$(1) bs=6208k conv=sync; \
285 ) > $(call imgname,$(1),$(2)).bin; \
286 $(STAGING_DIR_HOST)/bin/mkplanexfw \
287 -B $(2) \
288 -v 2.00.00 \
289 -i $(call imgname,$(1),$(2)).bin \
290 -o $(call imgname,$(1),$(2)).webui; \
291 fi; fi
292 endef
293
294 define Image/Build/TPLINK
295 $(call PatchKernelGzip,$(2),$(3))
296 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
297 -B $(4) -N OpenWrt -V $(REVISION)\
298 -k $(KDIR)/vmlinux-$(2).bin.gz \
299 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
300 -o $(call imgname,$(1),$(2))-factory.bin
301 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
302 -B $(4) -N OpenWrt -V $(REVISION) -s \
303 -k $(KDIR)/vmlinux-$(2).bin.gz \
304 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
305 -o $(call imgname,$(1),$(2))-sysupgrade.bin
306 endef
307
308 define Image/Build/TPLINK/initramfs
309 $(call PatchKernelGzip,$(2),$(3))
310 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
311 -B $(4) -N OpenWrt -V $(REVISION) -s \
312 -k $(KDIR)/vmlinux-$(2).bin.gz \
313 -o $(call imgname,$(1),$(2))-uImage.bin
314 endef
315
316 define Image/Build/CyberTAN
317 $(call PatchKernelGzip,$(2),$(3))
318 $(call MkImageGzip,$(KDIR)/vmlinux-$(2).bin.gz,$(KDIR)/vmlinux-$(2).uImage)
319 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR)/vmlinux-$(2).uImage \
320 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
321 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) \
322 -i $(KDIR)/image.tmp \
323 -o $(call imgname,$(1),$(2))-sysupgrade.bin
324 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
325 -i $(KDIR)/image.tmp \
326 -o $(call imgname,$(1),$(2))-factory.bin
327 rm $(KDIR)/image.tmp
328 endef
329
330 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
331 define Image/Build/WNDR3700
332 $(call PatchKernelLzma,$(2),$(3) $(wndr3700_mtdlayout))
333 $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
334 mkdir -p $(KDIR)/wndr3700/image
335 $(STAGING_DIR_HOST)/bin/wndr3700 \
336 $(KDIR)/vmlinux-$(2).uImage \
337 $(KDIR)/wndr3700/image/uImage
338 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
339 $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
340 -nopad -noappend -root-owned -be
341 -rm -rf $(KDIR)/wndr3700
342 mkimage -A mips -O linux -T filesystem -C none \
343 -a 0xbf070000 -e 0xbf070000 \
344 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
345 -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
346 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
347 $(STAGING_DIR_HOST)/bin/wndr3700 \
348 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
349 $(KDIR)/vmlinux-$(2).uImage.squashfs
350 -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
351 ( \
352 dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
353 dd if=$(KDIR)/root.$(1) bs=64k; \
354 ) > $(call imgname,$(1),$(2))-sysupgrade.bin
355 $(STAGING_DIR_HOST)/bin/mkdniimg \
356 -B WNDR3700 -v OpenWrt.$(REVISION) \
357 -i $(call imgname,$(1),$(2))-sysupgrade.bin \
358 -o $(call imgname,$(1),$(2))-factory.img
359 endef
360
361 define Image/Build/WNDR3700/initramfs
362 $(call PatchKernelLzma,$(2),$(3) $(wndr3700_mtdlayout))
363 $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
364 $(STAGING_DIR_HOST)/bin/wndr3700 \
365 $(KDIR)/vmlinux-$(2).uImage \
366 $(call imgname,$(1),$(2))-uImage.bin
367 endef
368
369 define Image/Build/Template/initramfs/initramfs
370 $(call Image/Build/$(1)/initramfs,initramfs,$(2),$(3),$(4),$(5),$(6),$(7))
371 endef
372
373 define Image/Build/Template/all/squashfs
374 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
375 endef
376
377 define Image/Build/Template/all/jffs2-64k
378 $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7))
379 endef
380
381 define Image/Build/Template/all/jffs2-128k
382 $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7))
383 endef
384
385 define Image/Build/Template/squashfs-only/squashfs
386 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
387 endef
388
389 define Image/Build/Template/4k/squashfs
390 $(call Image/Build/$(1),squashfs-4k,$(2),$(3),$(4),$(5),$(6),$(7))
391 endef
392
393 define Image/Build/Template/64k/squashfs
394 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
395 endef
396
397 define Image/Build/Template/64k/jffs2-64k
398 $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7))
399 endef
400
401 define Image/Build/Template/128k/squashfs
402 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7))
403 endef
404
405 define Image/Build/Template/128k/jffs2-128k
406 $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7))
407 endef
408
409 define Image/Build/Profile/AP81
410 $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap81,board=AP81)
411 endef
412
413 define Image/Build/Profile/AP83
414 $(call Image/Build/Template/$(fs_64k)/$(1),AP83,ap83,board=AP83)
415 endef
416
417 define Image/Build/Profile/PB42
418 $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,pb42,board=PB42)
419 endef
420
421 define Image/Build/Profile/PB44
422 $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,pb44,board=PB44)
423 endef
424
425 define Image/Build/Profile/PB92
426 $(call Image/Build/Template/$(fs_64k)/$(1),PB92,pb92,board=PB92)
427 endef
428
429 define Image/Build/Profile/WP543
430 $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x200000,2M)
431 $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x400000,4M)
432 $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x800000,8M)
433 $(call Image/Build/Template/$(fs_64k)/$(1),MyLoader,wp543,0x1000000,16M)
434 endef
435
436 define Image/Build/Profile/DIR600A1
437 $(call Image/Build/Template/$(fs_64k)/$(1),Cameo7240,dir-600-a1,board=DIR-600-A1,"AP91-AR7240-RT-090223-00")
438 endef
439
440 define Image/Build/Profile/FR54RTR
441 $(call Image/Build/Template/$(fs_64k)/$(1),Cameo7240,fr-54rtr,board=DIR-600-A1,"AP91-AR7240-RT-090223-01")
442 endef
443
444 define Image/Build/Profile/DIR615C1
445 $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,dir-615-c1,board=DIR-615-C1,"AP81-AR9130-RT-070614-02")
446 endef
447
448 define Image/Build/Profile/TEW632BRP
449 $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,tew-632brp,board=TEW-632BRP,"AP81-AR9130-RT-070614-00")
450 endef
451
452 define Image/Build/Profile/TEW652BRP
453 $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,tew-652brp,board=TEW-632BRP,"AP81-AR9130-RT-080609-05")
454 endef
455
456 define Image/Build/Profile/A02RBW300N
457 $(call Image/Build/Template/$(fs_squash)/$(1),Cameo,a02-rb-w300n,board=TEW-632BRP,"AP81-AR9130-RT-070614-03")
458 endef
459
460 define Image/Build/Profile/UBNTRS
461 $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-rs,board=UBNT-RS,RS,RSx,ar7100)
462 endef
463
464 define Image/Build/Profile/UBNTRSPRO
465 $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-rspro,board=UBNT-RSPRO,RSPRO,RSPRO,ar7100pro)
466 endef
467
468 define Image/Build/Profile/UBNTLSSR71
469 $(call Image/Build/Template/$(fs_64k)/$(1),UBNT,ubnt-ls-sr71,board=UBNT-LS-SR71,LS-SR71,LS-SR71,ar7100)
470 endef
471
472 define Image/Build/Profile/UBNTBULLETM
473 $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-bullet-m,board=UBNT-BM,XM,UBNTXM,ar7240)
474 endef
475
476 define Image/Build/Profile/UBNTROCKETM
477 $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-rocket-m,board=UBNT-RM,XM,UBNTXM,ar7240)
478 endef
479
480 define Image/Build/Profile/UBNTNANOM
481 $(call Image/Build/Template/$(fs_64k)/$(1),UBNTXM,ubnt-nano-m,board=UBNT-NM,XM,UBNTXM,ar7240)
482 endef
483
484 define Image/Build/Profile/UBNT
485 $(call Image/Build/Profile/UBNTRS,$(1))
486 $(call Image/Build/Profile/UBNTRSPRO,$(1))
487 $(call Image/Build/Profile/UBNTLSSR71,$(1))
488 $(call Image/Build/Profile/UBNTBULLETM,$(1))
489 $(call Image/Build/Profile/UBNTROCKETM,$(1))
490 $(call Image/Build/Profile/UBNTNANOM,$(1))
491 endef
492
493 define Image/Build/Profile/MZKW04NU
494 $(call Image/Build/Template/$(fs_64k)/$(1),Planex,mzk-w04nu,board=MZK-W04NU)
495 endef
496
497 define Image/Build/Profile/MZKW300NH
498 $(call Image/Build/Template/$(fs_64k)/$(1),Planex,mzk-w300nh,board=MZK-W300NH)
499 endef
500
501 define Image/Build/Profile/TLWR741NDV1
502 $(call Image/Build/Template/$(fs_4k)/$(1),TPLINK,tl-wr741nd-v1,board=TL-WR741ND,TL-WR741NDv1)
503 endef
504
505 define Image/Build/Profile/TLWR841NV15
506 $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr841n-v1.5,board=TL-WR841N-v1.5,TL-WR841Nv1.5)
507 endef
508
509 define Image/Build/Profile/TLWR841NDV3
510 $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr841nd-v3,board=TL-WR941ND,TL-WR841NDv3)
511 endef
512
513 define Image/Build/Profile/TLWR841NDV5
514 $(call Image/Build/Template/$(fs_4k)/$(1),TPLINK,tl-wr841nd-v5,board=TL-WR741ND,TL-WR841NDv5)
515 endef
516
517 define Image/Build/Profile/TLWR941NDV2
518 $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr941nd-v2,board=TL-WR941ND,TL-WR941NDv2)
519 endef
520
521 define Image/Build/Profile/TLWR941NDV4
522 $(call Image/Build/Template/$(fs_4k)/$(1),TPLINK,tl-wr941nd-v4,board=TL-WR741ND,TL-WR941NDv4)
523 endef
524
525 define Image/Build/Profile/TLWR1043NDV1
526 $(call Image/Build/Template/$(fs_squash)/$(1),TPLINK,tl-wr1043nd-v1,board=TL-WR1043ND,TL-WR1043NDv1)
527 endef
528
529 define Image/Build/Profile/WNDR3700
530 $(call Image/Build/Template/$(fs_64k)/$(1),WNDR3700,wndr3700,board=WNDR3700)
531 endef
532
533 define Image/Build/Profile/WRT400N
534 $(call Image/Build/Template/$(fs_64k)/$(1),WRT400N,wrt400n,board=WRT400N)
535 endef
536
537 define Image/Build/Profile/DIR825B1
538 $(call Image/Build/Template/$(fs_64k)/$(1),DIR825B1,dir-825-b1,board=DIR-825-B1)
539 endef
540
541 define Image/Build/Profile/WRT160NL
542 $(call Image/Build/Template/$(fs_64k)/$(1),CyberTAN,wrt160nl,board=WRT160NL,1.00.01)
543 endef
544
545 define Image/Build/Profile/WZRHPG300NH
546 $(call Image/Build/Template/$(fs_128k)/$(1),WZRHPG300NH,wzr-hp-g300nh,board=WZR-HP-G300NH)
547 endef
548
549 define Image/Build/Profile/Default
550 $(call Image/Build/Profile/AP81,$(1))
551 $(call Image/Build/Profile/AP83,$(1))
552 $(call Image/Build/Profile/A02RBW300N,$(1))
553 $(call Image/Build/Profile/DIR600A1,$(1))
554 $(call Image/Build/Profile/DIR615C1,$(1))
555 $(call Image/Build/Profile/DIR825B1,$(1))
556 $(call Image/Build/Profile/FR54RTR,$(1))
557 $(call Image/Build/Profile/MZKW04NU,$(1))
558 $(call Image/Build/Profile/MZKW300NH,$(1))
559 $(call Image/Build/Profile/PB42,$(1))
560 $(call Image/Build/Profile/PB44,$(1))
561 $(call Image/Build/Profile/PB92,$(1))
562 $(call Image/Build/Profile/TEW632BRP,$(1))
563 $(call Image/Build/Profile/TEW652BRP,$(1))
564 $(call Image/Build/Profile/TLWR741NDV1,$(1))
565 $(call Image/Build/Profile/TLWR841NV15,$(1))
566 $(call Image/Build/Profile/TLWR841NDV3,$(1))
567 $(call Image/Build/Profile/TLWR841NDV5,$(1))
568 $(call Image/Build/Profile/TLWR941NDV2,$(1))
569 $(call Image/Build/Profile/TLWR941NDV4,$(1))
570 $(call Image/Build/Profile/TLWR1043NDV1,$(1))
571 $(call Image/Build/Profile/UBNT,$(1))
572 $(call Image/Build/Profile/WP543,$(1))
573 $(call Image/Build/Profile/WNDR3700,$(1))
574 $(call Image/Build/Profile/WRT400N,$(1))
575 $(call Image/Build/Profile/WRT160NL,$(1))
576 $(call Image/Build/Profile/WZRHPG300NH,$(1))
577 endef
578
579 define Image/Build/Profile/Madwifi
580 $(call Image/Build/Profile/UBNTRS,$(1))
581 $(call Image/Build/Profile/UBNTRSPRO,$(1))
582 $(call Image/Build/Profile/UBNTLSSR71,$(1))
583 $(call Image/Build/Profile/WP543,$(1))
584 endef
585
586 define Image/Build/squashfs
587 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
588 dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.squashfs-4k.tmp0 bs=4k conv=sync
589 $(call add_jffs2_mark,$(KDIR)/root.squashfs-4k.tmp0)
590 dd if=$(KDIR)/root.squashfs-4k.tmp0 of=$(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-4k bs=4k conv=sync
591 $(call add_jffs2_mark,$(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-4k)
592 rm -f $(KDIR)/root.squashfs-4k.tmp0
593 endef
594
595 define Image/Build/Initramfs
596 $(call Image/Build/Profile/$(PROFILE),initramfs)
597 endef
598
599 define Image/Build
600 $(call Image/Build/$(1))
601 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
602
603 $(call Image/Build/Profile/$(PROFILE),$(1))
604 endef
605
606 $(eval $(call BuildImage))