source: trunk/target/linux/ar71xx/image/Makefile @ 29473

Last change on this file since 29473 was 29473, checked in by juhosg, 4 years ago

ar71xx: fix WNDR3x00 factory image generation

Factory images for WNDR3700v2 and WNDR3800 should contain these model IDs
for the device: field in their DNI tags, not WNDR3700.

This regressed in r29434, which redid WNDR3x00 model detection. The sixth
parameter to Image/Build/Netgear is only used as the -B argument to
mkdniimg, which is used to set the device: field. In r29434, this was
erroneously changed to be WNDR3700 for all models. The tools to flash
factory images (U-Boot's TFTP server and the factory software's upgrade
utility) may refuse to honor images with incorrect device: fields in their
DNI tags.

Signed-off-by: Mark Mentovai <mark@…>

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