58b3173de40e47da5b75df9cb48b85f9ace87b37
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008-2011 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 define rootfs_align
15 $(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs-%,0x4,$(1))))
16 endef
17
18 define sysupname
19 $(call imgname,$(1),$(2))-sysupgrade.bin
20 endef
21
22 define factoryname
23 $(call imgname,$(1),$(2))-factory.bin
24 endef
25
26 COMMA:=,
27
28 define mkcmdline
29 $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
30 endef
31
32 SINGLE_PROFILES:=
33
34 define SingleProfile
35 define Image/Build/Profile/$(3)
36 $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12))
37 endef
38 SINGLE_PROFILES += $(3)
39 endef
40
41 define MultiProfile
42 define Image/Build/Profile/$(1)
43 $(foreach p,$(2),
44 $$(call Image/Build/Profile/$p,$$(1))
45 )
46 endef
47 endef
48
49 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
50
51 KDIR_TMP:=$(KDIR)/tmp
52 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
53 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
54 fs_squash:=squashfs-only
55 fs_64k:=64k
56 fs_64kraw:=64kraw
57 fs_128k:=128k
58 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
59 fs_squash:=initramfs
60 fs_64k:=initramfs
61 fs_64kraw:=initramfs
62 fs_128k:=initramfs
63 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
64 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
65 endif
66
67 define CompressLzma
68 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
69 endef
70
71 define PatchKernelLzma
72 cp $(KDIR)/vmlinux $(KDIR_TMP)/vmlinux-$(1)
73 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux-$(1) "$(strip $(2))"
74 $(call CompressLzma,$(KDIR_TMP)/vmlinux-$(1),$(KDIR_TMP)/vmlinux-$(1).bin.lzma)
75 endef
76
77 define PatchKernelGzip
78 cp $(KDIR)/vmlinux $(KDIR_TMP)/vmlinux-$(1)
79 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux-$(1) "$(strip $(2))"
80 gzip -9 -c $(KDIR_TMP)/vmlinux-$(1) > $(KDIR_TMP)/vmlinux-$(1).bin.gz
81 endef
82
83 define MkuImage
84 mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
85 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
86 -d $(3) $(4)
87 endef
88
89 define MkuImageLzma
90 $(call PatchKernelLzma,$(1),$(2))
91 $(call MkuImage,lzma,,$(KDIR_TMP)/vmlinux-$(1).bin.lzma,$(KDIR_TMP)/vmlinux-$(1).uImage)
92 endef
93
94 define MkuImageLzma/initramfs
95 $(call PatchKernelLzma,$(1),$(2))
96 $(call MkuImage,lzma,,$(KDIR_TMP)/vmlinux-$(1).bin.lzma,$(call imgname,initramfs,$(1))-uImage.bin)
97 endef
98
99 define MkuImageGzip
100 $(call PatchKernelGzip,$(1),$(2))
101 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(KDIR_TMP)/vmlinux-$(1).uImage)
102 endef
103
104 define MkuImageGzip/initramfs
105 $(call PatchKernelGzip,$(1),$(2))
106 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(call imgname,initramfs,$(1))-uImage.bin)
107 endef
108
109 define MkuImageOKLI
110 $(call MkuImage,lzma,-M 0x4f4b4c49,$(KDIR)/vmlinux.bin.lzma,$(KDIR_TMP)/vmlinux-$(1).okli)
111 endef
112
113 define CatFiles
114 if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
115 echo "Warning: $(1) is too big"; \
116 else if [ `stat -c%s $(3)` -gt $(4) ]; then \
117 echo "Warning: $(3) is too big"; \
118 else \
119 ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
120 fi; fi
121 endef
122
123 define Sysupgrade/KR
124 $(call CatFiles,$(2),$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(5)))
125 endef
126
127 define Sysupgrade/KRuImage
128 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)))
129 endef
130
131 define Sysupgrade/RKuImage
132 $(call CatFiles,$(KDIR)/root.$(1),$(4),$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(call sysupname,$(1),$(2)))
133 endef
134
135 define Image/BuildLoader
136 -rm -rf $(KDIR)/lzma-loader
137 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)"\
138 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
139 LOADER_DATA="$(KDIR)/vmlinux.bin.lzma" BOARD="$(1)" \
140 compile loader.$(2)
141 endef
142
143 define Image/BuildLoaderAlone
144 -rm -rf $(KDIR)/lzma-loader
145 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)" \
146 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
147 BOARD="$(1)" FLASH_OFFS=$(4) FLASH_MAX=$(5) \
148 compile loader.$(2)
149 endef
150
151 define Build/Clean
152 $(LOADER_MAKE) clean
153 endef
154
155 define Image/BuildKernel
156 cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
157 cp $(KDIR)/vmlinux $(VMLINUX).bin
158 dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
159 dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
160 $(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
161 $(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
162 -mkdir -p $(KDIR_TMP)
163 $(call Image/Build/Initramfs)
164 endef
165
166 define Image/Build/WRT400N
167 $(call MkuImageLzma,$(2),$(3))
168 $(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
169 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
170 wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
171 fi
172 endef
173
174 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
175 define Image/Build/DIR825B1
176 $(call MkuImageLzma,$(2),$(3) $(dir825b1_mtdlayout))
177 $(call Sysupgrade/KRuImage,$(1),$(2),1048576,5308416)
178 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
179 ( \
180 dd if=$(call sysupname,$(1),$(2)); \
181 echo -n "$(4)"; \
182 ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
183 if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
184 echo "Warning: $(call sysupname,$(1),$(2)) is too big"; \
185 else \
186 ( \
187 dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
188 echo -n "$(5)"; \
189 ) > $(call factoryname,$(1),$(2)); \
190 fi; \
191 fi
192 endef
193
194 define Image/Build/WZRHPG30XNH
195 $(call MkuImageLzma,$(2),$(3))
196 $(call Sysupgrade/KRuImage,$(1),$(2),1048576,31850496)
197 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
198 ( \
199 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
200 dd if=$(call sysupname,$(1),$(2)); \
201 ) > $(call imgname,$(1),$(2))-tftp.bin; \
202 buffalo-enc -p $(4) -v 1.99 \
203 -i $(call sysupname,$(1),$(2)) \
204 -o $(KDIR_TMP)/$(2).enc; \
205 buffalo-tag -b $(4) -p $(4) -a ath -v 1.99 -m 1.01 -l mlang8 \
206 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
207 -i $(KDIR_TMP)/$(2).enc \
208 -o $(call factoryname,$(1),$(2)); \
209 fi
210 endef
211
212 define Image/Build/WHRHPG300N
213 $(call MkuImageLzma,$(2),$(3) $(4))
214 $(call Sysupgrade/KRuImage,$(1),$(2),983040,2883584)
215 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
216 ( \
217 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
218 dd if=$(call sysupname,$(1),$(2)); \
219 ) > $(call imgname,$(1),$(2))-tftp.bin; \
220 buffalo-enc -p $(5) -v 1.99 \
221 -i $(call sysupname,$(1),$(2)) \
222 -o $(KDIR_TMP)/$(2).enc; \
223 buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
224 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
225 -i $(KDIR_TMP)/$(2).enc \
226 -o $(call factoryname,$(1),$(2)); \
227 fi
228 endef
229
230 define Image/Build/WHRHPG300N/initramfs
231 $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
232 endef
233
234 define Image/Build/Cameo
235 $(call MkuImageLzma,$(2),$(3) $(4))
236 $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
237 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
238 ( \
239 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage bs=$(5) conv=sync; \
240 dd if=$(KDIR)/root.$(1) bs=$(6) conv=sync; \
241 echo -n $(7); \
242 ) > $(call factoryname,$(1),$(2)); \
243 fi
244 endef
245
246 define Image/Build/CameoHornet
247 $(call MkuImageLzma,$(2),$(3) $(4))
248 $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
249 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
250 mkcameofw -M HORNET -R "DEF" -S $(7) -V "1.99" \
251 -K $(5) -I $$$$(($(5)+$(6))) \
252 -k $(KDIR_TMP)/vmlinux-$(2).uImage \
253 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
254 -o $(call factoryname,$(1),$(2)); \
255 fi
256 endef
257
258 cameo913x_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,960k(kernel),2880k(rootfs),64k(art)ro,3840k@0x30000(firmware)
259 define Image/Build/Cameo913x
260 $(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo913x_mtdlayout),983040,2949120,$(4))
261 endef
262
263 define Image/Build/Cameo913x/initramfs
264 $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo913x_mtdlayout))
265 endef
266
267 cameo7240_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,960k(kernel),2752k(rootfs),64k(mac)ro,64k(art)ro,3712k@0x40000(firmware)
268 define Image/Build/Cameo7240
269 $(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo7240_mtdlayout),983040,2818048,$(4))
270 endef
271
272 define Image/Build/Cameo7240/initramfs
273 $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo7240_mtdlayout))
274 endef
275
276 cameo933x_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,896k(kernel),2752k(rootfs),3648k@0x70000(firmware)
277 define Image/Build/Cameo933x
278 $(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo933x_mtdlayout),917504,2818048,$(4))
279 endef
280
281 define Image/Build/Cameo933x/initramfs
282 $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo933x_mtdlayout))
283 endef
284
285 define Image/Build/Ath
286 $(call Sysupgrade/$(7),$(1),$(2),$(5),$(6))
287 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
288 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
289 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
290 dd if=$(KDIR)/root.$(1) \
291 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
292 fi
293 endef
294
295 define Image/Build/AthGzip
296 $(call MkuImageGzip,$(2),$(3) $(4))
297 $(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
298 endef
299
300 define Image/Build/AthGzip/initramfs
301 $(call MkuImageGzip/initramfs,$(2),$(3) $(4))
302 endef
303
304 define Image/Build/AthLzma
305 $(call MkuImageLzma,$(2),$(3) $(4))
306 $(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
307 endef
308
309 define Image/Build/AthLzma/initramfs
310 $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
311 endef
312
313 define Image/Build/PB4X
314 $(call PatchKernelLzma,$(2),$(3))
315 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
316 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
317 dd if=$(KDIR)/root.$(1) \
318 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
319 -sh $(TOPDIR)/scripts/combined-image.sh \
320 "$(call imgname,kernel,$(2)).bin" \
321 "$(call imgname,$(1),$(2)-rootfs).bin" \
322 $(call sysupname,$(1),$(2))
323 endef
324
325
326 define Image/Build/MyLoader
327 $(call PatchKernelLzma,$(2),$(3))
328 -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) \
329 -p0x030000:0xe0000:al:0x80060000:kernel:$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
330 -p0x110000:0:::rootfs:$(KDIR)/root.$(1) \
331 $(call imgname,$(1),$(2))-$(5)-factory.img
332 endef
333
334 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)
335 define Image/Build/UBNTXM
336 $(call MkuImageLzma,$(2),$(3) $(ubntxm_mtdlayout))
337 $(call Sysupgrade/KRuImage,$(1),$(2),1048576,6684672)
338 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage of=$(KDIR_TMP)/vmlinux-$(2).uImage.bin bs=1024k conv=sync
339 -$(STAGING_DIR_HOST)/bin/mkfwimage \
340 -B $(4) -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
341 -k $(KDIR_TMP)/vmlinux-$(2).uImage.bin \
342 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
343 -o $(call factoryname,$(1),$(2))
344 endef
345
346 define Image/Build/UBNT
347 $(call PatchKernelLzma,$(2),$(3))
348 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma of=$(KDIR_TMP)/vmlinux-$(2).lzma bs=64k conv=sync
349 -$(STAGING_DIR_HOST)/bin/mkfwimage \
350 -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
351 -k $(KDIR_TMP)/vmlinux-$(2).lzma \
352 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
353 -o $(call factoryname,$(1),$(2))
354 -sh $(TOPDIR)/scripts/combined-image.sh \
355 "$(KDIR_TMP)/vmlinux-$(2).lzma" \
356 "$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)" \
357 $(call sysupname,$(1),$(2))
358 endef
359
360 planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,960k(kernel),6784k(rootfs),128k(art)ro,7744k@0x50000(firmware)
361 define Image/Build/Planex/loader
362 $(call Image/BuildLoaderAlone,$(1),gz,$(2) $(planex_mtdlayout),0x52000,0)
363 endef
364
365 define Image/Build/Planex
366 [ -e "$(KDIR)/loader-$(2).gz" ]
367 $(call MkuImage,gzip,,$(KDIR)/loader-$(2).gz,$(KDIR_TMP)/vmlinux-$(2).uImage)
368 $(call MkuImageOKLI,$(2))
369 ( \
370 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage bs=8k count=1 conv=sync; \
371 dd if=$(KDIR_TMP)/vmlinux-$(2).okli; \
372 ) > $(KDIR_TMP)/kernel-$(2).bin
373 $(call Sysupgrade/KR,$(1),$(KDIR_TMP)/kernel-$(2).bin,983040,6815744,$(2))
374 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
375 $(STAGING_DIR_HOST)/bin/mkplanexfw \
376 -B $(2) \
377 -v 2.00.00 \
378 -i $(call sysupname,$(1),$(2)) \
379 -o $(call factoryname,$(1),$(2)); \
380 fi
381 endef
382
383 alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
384 define Image/Build/ALFA
385 $(call MkuImageLzma,$(2),$(3) $(4))
386 $(call Sysupgrade/RKuImage,$(1),$(2),$(5),$(6))
387 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
388 rm -rf $(KDIR)/$(1); \
389 mkdir -p $(KDIR)/$(1); \
390 cd $(KDIR)/$(1); \
391 cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(7); \
392 cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(8); \
393 $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(7) $(8); \
394 ( \
395 echo WRM7222C | dd bs=32 count=1 conv=sync; \
396 echo -ne '\xfe'; \
397 ) >> $(call factoryname,$(1),$(2)); \
398 fi
399 endef
400
401 define Image/Build/ALFA/initramfs
402 $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
403 endef
404
405 define Image/Build/TPLINKOLD/loader
406 $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
407 endef
408
409 define Image/Build/TPLINKOLD
410 [ -e "$(KDIR)/loader-$(2).gz" ]
411 $(call MkuImageOKLI,$(2))
412 ( \
413 dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
414 dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
415 ) > $(KDIR_TMP)/kernel-$(2).bin
416 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
417 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
418 -k $(KDIR_TMP)/kernel-$(2).bin \
419 -r $(KDIR)/root.$(1) \
420 -o $(call factoryname,$(1),$(2))
421 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
422 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
423 -k $(KDIR_TMP)/kernel-$(2).bin \
424 -r $(KDIR)/root.$(1) \
425 -o $(call sysupname,$(1),$(2))
426 endef
427
428 define Image/Build/TPLINKOLD/initramfs
429 $(call Image/BuildLoader,$(2),gz,$(3),0x80060000)
430 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
431 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
432 -k $(KDIR)/loader-$(2).gz \
433 -o $(call imgname,$(1),$(2))-uImage.bin
434 endef
435
436 define Image/Build/TPLINK/loader
437 $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
438 endef
439
440 define Image/Build/TPLINK
441 [ -e "$(KDIR)/loader-$(2).gz" ]
442 $(call MkuImageOKLI,$(2))
443 ( \
444 dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
445 dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
446 ) > $(KDIR_TMP)/kernel-$(2).bin
447 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
448 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
449 -k $(KDIR_TMP)/kernel-$(2).bin \
450 -r $(KDIR)/root.$(1) \
451 -a $(call rootfs_align,$(1)) -j \
452 -o $(call factoryname,$(1),$(2))
453 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
454 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
455 -k $(KDIR_TMP)/kernel-$(2).bin \
456 -r $(KDIR)/root.$(1) \
457 -a $(call rootfs_align,$(1)) -j \
458 -o $(call sysupname,$(1),$(2))
459 endef
460
461 define Image/Build/TPLINK/initramfs
462 $(call Image/BuildLoader,$(2),gz,$(3),0x80060000)
463 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
464 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
465 -k $(KDIR)/loader-$(2).gz \
466 -o $(call imgname,$(1),$(2))-uImage.bin
467 endef
468
469 define Image/Build/TPLINK-LZMA
470 $(call PatchKernelLzma,$(2),$(3))
471 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
472 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
473 -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
474 -r $(KDIR)/root.$(1) \
475 -a $(call rootfs_align,$(1)) -j \
476 -o $(call factoryname,$(1),$(2))
477 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
478 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
479 -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
480 -r $(KDIR)/root.$(1) \
481 -a $(call rootfs_align,$(1)) -j \
482 -o $(call sysupname,$(1),$(2))
483 endef
484
485 define Image/Build/TPLINK-LZMA/initramfs
486 $(call PatchKernelLzma,$(2),$(3))
487 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
488 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
489 -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
490 -o $(call imgname,$(1),$(2))-uImage.bin
491 endef
492
493 define Image/Build/CyberTAN
494 $(call MkuImageGzip,$(2),$(3))
495 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR_TMP)/vmlinux-$(2).uImage \
496 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
497 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) \
498 -i $(KDIR)/image.tmp \
499 -o $(call sysupname,$(1),$(2))
500 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
501 -i $(KDIR)/image.tmp \
502 -o $(call factoryname,$(1),$(2))
503 rm $(KDIR)/image.tmp
504 endef
505
506 define Image/Build/Netgear/Build_uImage
507 $(call MkuImageLzma,$(1),$(2) $(3))
508 -rm -rf $(KDIR)/$(1)
509 mkdir -p $(KDIR)/$(1)/image
510 $(STAGING_DIR_HOST)/bin/wndr3700 \
511 $(KDIR_TMP)/vmlinux-$(1).uImage \
512 $(KDIR)/$(1)/image/uImage \
513 $(4)
514 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
515 $(KDIR)/$(1) $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \
516 -nopad -noappend -root-owned -be
517 -rm -rf $(KDIR)/$(1)
518 mkimage -A mips -O linux -T filesystem -C none \
519 -a 0xbf070000 -e 0xbf070000 \
520 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
521 -d $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \
522 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2
523 $(STAGING_DIR_HOST)/bin/wndr3700 \
524 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2 \
525 $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs \
526 $(4)
527 -rm -f $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp*
528 endef
529
530 define Image/Build/Netgear/Estimate_uImage
531 $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4))
532 ( \
533 set -e; \
534 kk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(kernel).*/\1/'`; \
535 rk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(rootfs).*/\1/'`; \
536 let 'tk = kk + rk'; \
537 s=`stat -c'%s' '$(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs'`; \
538 c=`echo '$(3)' | wc -c`; \
539 let 'kk = (((s + c) / (64 * 1024) + 1) * 64)'; \
540 let 'rk = tk - kk'; \
541 echo '$(3)' | sed -e "s/[0-9]*k(kernel)/$$$${kk}k(kernel)/" \
542 -e "s/[0-9]*k(rootfs)/$$$${rk}k(rootfs)/" > \
543 '$(KDIR_TMP)/$(1)_mtdparts'; \
544 let 'k = kk * 1024'; \
545 echo "$$$${k}" > '$(KDIR_TMP)/$(1)_kernel_maxsize'; \
546 let 'r = rk * 1024'; \
547 echo "$$$${r}" > '$(KDIR_TMP)/$(1)_rootfs_maxsize'; \
548 )
549 -rm -f $(KDIR_TMP)/vmlinux-$(1)_est \
550 $(KDIR_TMP)/vmlinux-$(1)_est.bin.lzma \
551 $(KDIR_TMP)/vmlinux-$(1)_est.uImage \
552 $(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs
553 endef
554
555 define Image/Build/Netgear
556 $(call Image/Build/Netgear/Estimate_uImage,$(2),$(3),$(4),$(5))
557 $(call Image/Build/Netgear/Build_uImage,$(2),$(3),`cat $(KDIR_TMP)/$(2)_mtdparts`,$(5))
558 if [ `stat -c%s '$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs'` -gt \
559 `cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` ]; then \
560 echo "$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs is too big" >& 2; \
561 else if [ `stat -c%s '$(KDIR)/root.$(1)'` -gt \
562 `cat '$(KDIR_TMP)/$(2)_rootfs_maxsize'` ]; then \
563 echo "$(KDIR)/root.$(1) is too big" >& 2; \
564 else \
565 ( \
566 set -e; \
567 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs \
568 bs=`cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` conv=sync; \
569 dd if=$(KDIR)/root.$(1) bs=64k; \
570 ) > $(call sysupname,$(1),$(2)); \
571 for r in $(7) ; do \
572 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
573 $(STAGING_DIR_HOST)/bin/mkdniimg \
574 -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
575 -i $(call sysupname,$(1),$(2)) \
576 -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
577 done; \
578 fi; fi
579 endef
580
581 define Image/Build/Netgear/initramfs
582 $(call MkuImageLzma,$(2),$(3) $(4))
583 $(STAGING_DIR_HOST)/bin/wndr3700 \
584 $(KDIR_TMP)/vmlinux-$(2).uImage \
585 $(call imgname,$(1),$(2))-uImage.bin \
586 $(5)
587 endef
588
589 ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
590 define Image/Build/ZyXEL
591 $(call MkuImageLzma,$(2),$(3))
592 $(call Sysupgrade/KRuImage,$(1),$(2),917504,2752512)
593 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
594 if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
595 echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found"; \
596 else \
597 $(STAGING_DIR_HOST)/bin/mkzynfw \
598 -B $(4) \
599 -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
600 -r $(call sysupname,$(1),$(2)):0x10000 \
601 -o $(call factoryname,$(1),$(2)); \
602 fi; fi
603 endef
604 endif
605
606 define Image/Build/OpenMesh
607 $(call MkuImageLzma,$(2))
608 -sh $(TOPDIR)/scripts/om2p-fwupgradecfg-gen.sh \
609 "$(BUILD_DIR)/om2p-fwupgrade.cfg" \
610 "$(KDIR_TMP)/vmlinux-$(2).uImage" \
611 "$(KDIR)/root.$(1)"
612 -sh $(TOPDIR)/scripts/combined-ext-image.sh \
613 "$(3)" "$(call factoryname,$(1),$(2))" \
614 "$(BUILD_DIR)/om2p-fwupgrade.cfg" "fwupgrade.cfg" \
615 "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
616 "$(KDIR)/root.$(1)" "rootfs"
617 endef
618
619 define Image/Build/Zcomax
620 $(call MkuImageLzma,$(2),$(3))
621 $(call Sysupgrade/RKuImage,$(1),$(2),1507328,6356992)
622 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
623 $(STAGING_DIR_HOST)/bin/mkzcfw \
624 -B $(2) \
625 -k $(KDIR_TMP)/vmlinux-$(2).uImage \
626 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
627 -o $(call imgname,$(1),$(2))-factory.img; \
628 fi
629 endef
630
631 define Image/Build/Zcomax/initramfs
632 $(call MkuImageLzma/initramfs,$(2),$(3))
633 endef
634
635 define Image/Build/Template/initramfs/initramfs
636 $(call Image/Build/$(1)/initramfs,initramfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
637 endef
638
639 define Image/Build/Template/all/squashfs
640 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
641 endef
642
643 define Image/Build/Template/all/jffs2-64k
644 $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
645 endef
646
647 define Image/Build/Template/all/jffs2-128k
648 $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
649 endef
650
651 define Image/Build/Template/squashfs-only/loader
652 $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
653 endef
654
655 define Image/Build/Template/squashfs-only/squashfs
656 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
657 endef
658
659 define Image/Build/Template/64k/loader
660 $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
661 endef
662
663 define Image/Build/Template/64k/squashfs
664 $(call Image/Build/$(1),squashfs-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
665 endef
666
667 define Image/Build/Template/64k/jffs2-64k
668 $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
669 endef
670
671 define Image/Build/Template/64kraw/loader
672 $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
673 endef
674
675 define Image/Build/Template/64kraw/squashfs
676 $(call Image/Build/$(1),squashfs-raw,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
677 endef
678
679 define Image/Build/Template/64kraw/jffs2-64k
680 $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
681 endef
682
683 define Image/Build/Template/128k/squashfs
684 $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
685 endef
686
687 define Image/Build/Template/128k/jffs2-128k
688 $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
689 endef
690
691 $(eval $(call SingleProfile,ALFA,$(fs_64k),ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,vmlinux.gz.uImage,pb9x-2.6.31-jffs2))
692
693 alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
694 $(eval $(call SingleProfile,AthLzma,$(fs_64k),ALFAAP96,alfa-ap96,ALFA-AP96,ttyS0,115200,$$(alfa_ap96_mtdlayout),2097152,13631488,RKuImage))
695
696 all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),1024k(kernel),5248k(rootfs),1536k(failsafe),64k(art),6272k@0x50000(firmware)
697 $(eval $(call SingleProfile,AthLzma,$(fs_64k),ALL0258N,all0258n,ALL0258N,ttyS0,115200,$$(all0258n_mtdlayout),1048576,5373952,KRuImage))
698
699 $(eval $(call SingleProfile,PB4X,$(fs_128k),ALL0305,all0305,ALL0305,ttyS0,115200))
700
701 ap113_mtd_layout=mtdparts=spi0.0:64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware)
702 $(eval $(call SingleProfile,AthLzma,$(fs_64k),AP113,ap113,AP113,ttyS0,115200,$$(ap113_mtd_layout),917504,3080192,RK))
703
704 ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
705 ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
706 $(eval $(call SingleProfile,AthLzma,$(fs_64k),AP121_2M,ap121-2M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_2M),720896,1245184,RKuImage))
707 $(eval $(call SingleProfile,AthLzma,$(fs_64k),AP121_4M,ap121-4M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_4M),917504,2818048,RKuImage))
708
709 $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M))
710
711 $(eval $(call SingleProfile,AthLzma,$(fs_64k),AP121MINI,ap121-mini,AP121-MINI,ttyATH0,115200,$$(ap121_mtdlayout_4M),917504,2818048,RKuImage))
712
713 ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1024k(kernel),2688k(rootfs),64k(art),3712k@0x50000(firmware)
714 $(eval $(call SingleProfile,AthLzma,$(fs_64k),EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),1048576,2752512,KRuImage))
715 $(eval $(call SingleProfile,AthLzma,$(fs_64k),EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),1048576,2752512,KRuImage))
716
717 $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT))
718
719 $(eval $(call SingleProfile,AthGzip,$(fs_64k),AP81,ap81,AP81,ttyS0,115200,,1310720,6619136,KRuImage))
720 $(eval $(call SingleProfile,AthGzip,$(fs_64k),AP83,ap83,AP83,ttyS0,115200,,1310720,6619136,KRuImage))
721
722 ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
723 $(eval $(call SingleProfile,AthGzip,$(fs_64k),AP96,ap96,AP96,ttyS0,115200,$$(ap96_mtdlayout),1769472,6291456,RKuImage))
724
725 db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
726 $(eval $(call SingleProfile,AthLzma,$(fs_64k),DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),1441792,6488064,RKuImage))
727
728 ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k@0x50000(firmware)
729 $(eval $(call SingleProfile,AthLzma,$(fs_64k),AP136,ap136,AP136,ttyS0,115200,$$(ap136_mtdlayout),1441792,6488064,RKuImage))
730
731 $(eval $(call SingleProfile,PB4X,$(fs_64k),PB42,pb42,PB42,ttyS0,115200))
732 $(eval $(call SingleProfile,PB4X,$(fs_64k),PB44,pb44,PB44,ttyS0,115200))
733
734 pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
735 $(eval $(call SingleProfile,AthLzma,$(fs_64k),PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),917504,2818048,KRuImage))
736
737 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WP543_2M,wp543,,ttyS0,115200,0x200000,2M))
738 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WP543_4M,wp543,,ttyS0,115200,0x400000,4M))
739 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WP543_8M,wp543,,ttyS0,115200,0x800000,8M))
740 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WP543_16M,wp543,,ttyS0,115200,0x1000000,16M))
741 $(eval $(call MultiProfile,WPE543,WPE543_2M WPE543_4M WPE543_8M WPE543_16M))
742
743 $(eval $(call SingleProfile,MyLoader,$(fs_64k),WPE72,wpe72,,ttyS0,115200,0x800000,8M))
744
745 $(eval $(call SingleProfile,Cameo7240,$(fs_64k),DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00"))
746 $(eval $(call SingleProfile,Cameo7240,$(fs_64k),DIR601A1,dir-601-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-02"))
747 $(eval $(call SingleProfile,Cameo7240,$(fs_64k),DIR615E4,dir-615-e4,DIR-615-E4,ttyS0,115200,"AP99-AR7240-RT-091105-05"))
748
749 $(eval $(call SingleProfile,PB4X,$(fs_128k),EAP7660D,eap7660d,EAP7660D,ttyS0,115200))
750
751 $(eval $(call SingleProfile,ALFA,$(fs_64k),HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image))
752
753 $(eval $(call SingleProfile,PB4X,$(fs_64k),JA76PF,ja76pf,JA76PF,ttyS0,115200))
754 $(eval $(call SingleProfile,PB4X,$(fs_64k),JA76PF2,ja76pf2,JA76PF2,ttyS0,115200))
755 $(eval $(call SingleProfile,PB4X,$(fs_64k),JWAP003,jwap003,JWAP003,ttyS0,115200))
756
757 $(eval $(call SingleProfile,Cameo7240,$(fs_64k),FR54RTR,fr-54rtr,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-01"))
758
759 $(eval $(call SingleProfile,Cameo913x,$(fs_squash),DIR615C1,dir-615-c1,DIR-615-C1,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
760
761 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),RW2458N,rw2458n,RW2458N,ttyS0,115200,XM,XM,ar7240))
762
763 $(eval $(call SingleProfile,Cameo913x,$(fs_squash),TEW632BRP,tew-632brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-00"))
764
765 $(eval $(call SingleProfile,Cameo913x,$(fs_squash),TEW652BRP_FW,tew-652brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-080609-05"))
766 $(eval $(call SingleProfile,Cameo913x,$(fs_squash),TEW652BRP_RECOVERY,tew-652brp-recovery,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
767 $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
768
769 $(eval $(call SingleProfile,Cameo933x,$(fs_squash),TEW712BR,tew-712br,TEW-712BR,ttyATH0,115200,"HORNET-RT-TEW712BR-3"))
770
771 $(eval $(call SingleProfile,Cameo913x,$(fs_squash),A02RBW300N,a02-rb-w300n,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-03"))
772
773 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),UBNTAIRROUTER,ubnt-airrouter,UBNT-AR,ttyS0,115200,XM,XM,ar7240))
774
775 $(eval $(call SingleProfile,UBNT,$(fs_64k),UBNTRS,ubnt-rs,UBNT-RS,ttyS0,115200,RS,RSx,ar7100))
776
777 $(eval $(call SingleProfile,UBNT,$(fs_64k),UBNTRSPRO,ubnt-rspro,UBNT-RSPRO,ttyS0,115200,RSPRO,RSPRO,ar7100pro))
778
779 $(eval $(call SingleProfile,UBNT,$(fs_64k),UBNTLSSR71,ubnt-ls-sr71,UBNT-LS-SR71,ttyS0,115200,LS-SR71,LS-SR71,ar7100))
780
781 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),UBNTBULLETM,ubnt-bullet-m,UBNT-BM,ttyS0,115200,XM,XM,ar7240))
782
783 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),UBNTROCKETM,ubnt-rocket-m,UBNT-RM,ttyS0,115200,XM,XM,ar7240))
784
785 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),UBNTNANOM,ubnt-nano-m,UBNT-NM,ttyS0,115200,XM,XM,ar7240))
786
787 $(eval $(call SingleProfile,UBNTXM,$(fs_64k),UBNTUNIFI,ubnt-unifi,UBNT-UF,ttyS0,115200,XM,XM,ar7240))
788
789 $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTUNIFI))
790
791 $(eval $(call SingleProfile,Planex,$(fs_64k),MZKW04NU,mzk-w04nu,MZK-W04NU,ttyS0,115200))
792 $(eval $(call SingleProfile,Planex,$(fs_64k),MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,115200))
793
794 $(eval $(call SingleProfile,ZyXEL,$(fs_64k),NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N))
795
796 $(eval $(call SingleProfile,OpenMesh,$(fs_squash),OM2P,om2p,OM2P))
797
798 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR11U,tl-mr11u-v1,TL-MR11U,ttyATH0,115200,0x00110101,1,4Mlzma))
799
800 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3020,tl-mr3020-v1,TL-MR3020,ttyATH0,115200,0x30200001,1,4Mlzma))
801
802 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3040,tl-mr3040-v1,TL-MR11U,ttyATH0,115200,0x30400001,1,4Mlzma))
803
804 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3220,tl-mr3220-v1,TL-MR3220,ttyS0,115200,0x32200001,1,4M))
805
806 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3420,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,4M))
807
808 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA701NV1,tl-wa701n-v1,TL-WA901ND,ttyS0,115200,0x07010001,1,4M))
809
810 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA901NV1,tl-wa901nd-v1,TL-WA901ND,ttyS0,115200,0x09010001,1,4M))
811 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA901NV2,tl-wa901nd-v2,TL-WA901ND-v2,ttyS0,115200,0x09010002,1,4M))
812 $(eval $(call MultiProfile,TLWA901,TLWA901NV1 TLWA901NV2))
813
814 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,4Mlzma))
815
816 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR740NV4,tl-wr740n-v4,TL-WR741ND-v4,ttyATH0,115200,0x07400004,1,4Mlzma))
817 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR740NV1,tl-wr740n-v1,TL-WR741ND,ttyS0,115200,0x07400001,1,4M))
818 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR740NV3,tl-wr740n-v3,TL-WR741ND,ttyS0,115200,0x07400003,1,4M))
819 $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3 TLWR740NV4))
820
821 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR741NV4,tl-wr741nd-v4,TL-WR741ND-v4,ttyATH0,115200,0x07410004,1,4Mlzma))
822 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR741NV1,tl-wr741nd-v1,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
823 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR741NV2,tl-wr741nd-v2,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
824 $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4))
825
826 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR743,tl-wr743nd-v1,TL-WR741ND,ttyS0,115200,0x07430001,1,4M))
827
828 $(eval $(call SingleProfile,TPLINKOLD,$(fs_squash),TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M))
829
830 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,4M))
831 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))
832 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV7,tl-wr841nd-v7,TL-WR841N-v7,ttyS0,115200,0x08410007,1,4M))
833 $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7))
834
835 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR842,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,8M))
836
837 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV2,tl-wr941nd-v2,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
838 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV3,tl-wr941nd-v3,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
839 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,ttyS0,115200,0x09410004,1,4M))
840 $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
841
842 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR1041,tl-wr1041n-v1,TL-WR1041,ttyS0,115200,0x10410002,1,4Mlzma))
843
844 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR1043,tl-wr1043nd-v1,TL-WR1043,ttyS0,115200,0x10430001,1,8M))
845
846 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR2543,tl-wr2543-v1,TL-WR2543,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
847
848 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR3600V1,tl-wdr3600-v1,TL-WDR4300,ttyS0,115200,0x36000001,1,8Mlzma))
849 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR4300V1,tl-wdr4300-v1,TL-WDR4300,ttyS0,115200,0x43000001,1,8Mlzma))
850 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR4310V1,tl-wdr4310-v1,TL-WDR4300,ttyS0,115200,0x43100001,1,8Mlzma))
851 $(eval $(call MultiProfile,TLWDR4300,TLWDR3600V1 TLWDR4300V1 TLWDR4310V1))
852
853 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
854 wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),14848k(rootfs),64k(art)ro,15872k@0x70000(firmware)
855 $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3700V1,wndr3700,WNDR3700,ttyS0,115200,$$(wndr3700_mtdlayout),3700,WNDR3700,"" NA,))
856 $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3700V2,wndr3700v2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3700v2,"",-H 29763654+16+64))
857 $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDR3800,wndr3800,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDR3800,"",-H 29763654+16+128))
858 $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDRMAC,wndrmac,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMAC,"",-H 29763654+16+64))
859 $(eval $(call SingleProfile,Netgear,$(fs_64k),WNDRMACV2,wndrmacv2,WNDR3700,ttyS0,115200,$$(wndr3700v2_mtdlayout),3701,WNDRMACv2,"",-H 29763654+16+128))
860 $(eval $(call MultiProfile,WNDR3700,WNDR3700V1 WNDR3700V2 WNDR3800 WNDRMAC WNDRMACV2))
861
862 $(eval $(call SingleProfile,WRT400N,$(fs_64k),WRT400N,wrt400n,WRT400N,ttyS0,115200))
863
864 $(eval $(call SingleProfile,DIR825B1,$(fs_64k),DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
865 $(eval $(call SingleProfile,DIR825B1,$(fs_64k),TEW673GRU,tew-637gru,TEW-673GRU,ttyS0,115200,01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
866
867 $(eval $(call SingleProfile,CyberTAN,$(fs_64k),WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,1.00.01))
868
869 whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,960k(kernel),2816k(rootfs),64k(art)ro,3712k@0x40000(firmware)
870 $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
871 $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
872 $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WHRHPGN,whr-hp-gn,WHR-HP-GN,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-GN))
873 $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WLAEAG300N,wlae-ag300n,WLAE-AG300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WLAE-AG300N))
874
875 $(eval $(call SingleProfile,WZRHPG30XNH,$(fs_128k),WZRHPG300NH,wzr-hp-g300nh,WZR-HP-G300NH,ttyS0,115200,WZR-HP-G300NH))
876
877 $(eval $(call SingleProfile,WZRHPG30XNH,$(fs_64k),WZRHPG300NH2,wzr-hp-g300nh2,WZR-HP-G300NH2,ttyS0,115200,WZR-HP-G300NH2))
878
879 $(eval $(call SingleProfile,WZRHPG30XNH,$(fs_64k),WZRHPAG300H,wzr-hp-ag300h,WZR-HP-AG300H,ttyS0,115200,WZR-HP-AG300H))
880
881 $(eval $(call SingleProfile,WZRHPG30XNH,$(fs_64k),WZRHPG450H,wzr-hp-g450h,WZR-HP-G450H,ttyS0,115200,WZR-HP-AG450H))
882
883 zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
884 $(eval $(call SingleProfile,Zcomax,$(fs_64k),ZCN1523H28,zcn-1523h-2-8,ZCN-1523H-2,ttyS0,115200,$$(zcn1523h_mtdlayout)))
885 $(eval $(call SingleProfile,Zcomax,$(fs_64k),ZCN1523H516,zcn-1523h-5-16,ZCN-1523H-5,ttyS0,115200,$$(zcn1523h_mtdlayout)))
886
887
888 $(eval $(call MultiProfile,Default,$(SINGLE_PROFILES)))
889 $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
890
891 define Image/Build/Profile/Madwifi
892 $(call Image/Build/Profile/EAP7660D,$(1))
893 $(call Image/Build/Profile/UBNTRS,$(1))
894 $(call Image/Build/Profile/UBNTRSPRO,$(1))
895 $(call Image/Build/Profile/UBNTLSSR71,$(1))
896 $(call Image/Build/Profile/WP543,$(1))
897 endef
898
899 define Image/Build/squashfs
900 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
901 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-64k
902 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs-64k 64
903 cp $(KDIR)/root.squashfs-64k $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
904 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
905 endef
906
907 define Image/Build/Initramfs
908 $(call Image/Build/Profile/$(PROFILE),initramfs)
909 endef
910
911 define Image/Prepare
912 gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
913 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
914 $(call Image/Build/Profile/$(if $(CONFIG_IB),Default,$(PROFILE)),loader)
915 endef
916
917 define Image/Build
918 $(call Image/Build/$(1))
919 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
920 $(call Image/Build/Profile/$(PROFILE),$(1))
921 endef
922
923 $(eval $(call BuildImage))