82cadd742b725fc03e4e76d0cd510cb657bf5ea1
[openwrt/svn-archive/archive.git] / target / linux / ramips / 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)-$(1)
12 endef
13
14 define sysupname
15 $(call imgname,$(1),$(2))-sysupgrade.bin
16 endef
17
18 VMLINUX:=$(IMG_PREFIX)-vmlinux
19 UIMAGE:=$(IMG_PREFIX)-uImage
20
21 define Image/Build/Initramfs
22 $(call Image/Build/Profile/$(PROFILE),initramfs)
23 endef
24
25 DEVICE_VARS += DTS
26
27 loadaddr-y := 0x80000000
28 loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
29 loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
30
31 KERNEL_LOADADDR := $(loadaddr-y)
32
33 KERNEL_DTB = kernel-bin | patch-dtb | lzma
34 define Device/Default
35 KERNEL := $(KERNEL_DTB) | uImage lzma
36 IMAGES := sysupgrade.bin
37 IMAGE_SIZE := $(ralink_default_fw_size_8M)
38 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | check-size $$$$(IMAGE_SIZE) | pad-rootfs
39 endef
40
41 define Build/patch-dtb
42 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $@.dtb ../dts/$(DTS).dts
43 $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
44 endef
45
46 define Build/trx
47 $(STAGING_DIR_HOST)/bin/trx \
48 -o $@ \
49 -m $(IMAGE_SIZE) \
50 -f $(word 1,$^) \
51 -a 4 -f $(word 2,$^)
52 endef
53
54 define MkCombineduImage
55 $(call PatchKernelLzma,$(2),$(3))
56 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
57 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \
58 else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
59 echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
60 else \
61 ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 64` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined ; \
62 fi ; fi
63 $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(call sysupname,$(1),$(2)),$(6))
64 endef
65
66
67 #
68 # The real magic happens inside these templates
69 #
70 # $(1), compression method
71 # $(2), filename of image data
72 # $(3), output filename
73 define MkImage
74 $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION)))
75 -mkimage -A mips -O linux -T kernel -C $(1) -a $(loadaddr-y) -e $(loadaddr-y) \
76 -n "$(imagename)" \
77 -d $(2) $(3)
78 endef
79
80 define CompressLzma
81 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
82 endef
83
84 define MkImageSysupgrade/squashfs
85 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
86 cat $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) > $(KDIR)/$(output_name)
87 $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
88 if [ `stat -c%s "$(KDIR)/$(output_name)"` -gt $(3) ]; then \
89 echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
90 else \
91 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
92 fi
93 endef
94
95 define MkImageTpl/squashfs
96 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
97 $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
98 -o $(KDIR)/$(output_name) \
99 -k $(KDIR)/vmlinux-$(1)$(4).bin.lzma \
100 -r $(KDIR)/root.$(1)
101 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
102 endef
103
104 define MkImageTpl/initramfs
105 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1).bin)
106 $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -c \
107 -o $(KDIR)/$(output_name) \
108 -k $(KDIR)/vmlinux-$(1).bin.lzma
109 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
110 endef
111
112 # $(1), lowercase board name like "mt7620a_v22sg"
113 # $(2), DTS filename without .dts extension
114 # $(3), optional filename suffix, e.g. "-initramfs"
115 define PatchKernelLzmaDtb
116 cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
117 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
118 $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
119 $(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
120 endef
121
122 # $(1), lowercase board name
123 # $(2), DTS filename without .dts extension
124 # $(3), ih_name field of uImage header
125 # $(4), optional filename suffix, e.g. "-initramfs"
126 define MkImageLzmaDtb
127 $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
128 $(call MkImage,lzma,$(KDIR)/vmlinux-$(1)$(4).bin.lzma,$(KDIR)/vmlinux-$(1)$(4).uImage,$(3))
129 endef
130
131 # $(1), Rootfs type, e.g. squashfs
132 # $(2), lowercase board name
133 # $(3), DTS filename without .dts extension
134 # $(4), maximum size of sysupgrade image
135 # $(5), uImage header's ih_name field
136 define BuildFirmware/OF
137 $(call MkImageLzmaDtb,$(2),$(3),$(5))
138 $(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6))
139 endef
140
141 define BuildFirmware/OF/tplink
142 $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
143 $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
144 endef
145
146 define BuildFirmware/OF/tplink/initramfs
147 $(call PatchKernelLzmaDtb,$(2),$(3),-initramfs)
148 $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
149 endef
150
151 # $(1), squashfs/initramfs
152 # $(2), lowercase board name
153 # $(3), DTS filename without .dts extension
154 # $(4), ih_name field of uImage header
155 define BuildFirmware/OF/initramfs
156 $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs)
157 $(CP) $(KDIR)/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin
158 endef
159
160
161 # Build images for default ralink layout for 4MB flash
162 # kernel + roots = 0x3b0000
163 # $(1) = squashfs/initramfs
164 # $(2) = lowercase board name
165 # $(3) = dts file
166 ralink_default_fw_size_4M=3866624
167 BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4))
168 BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
169
170 # Build images for default ralink layout for 8MB flash
171 # kernel + roots = 0x7b0000
172 # $(1) = squashfs/initramfs
173 # $(2) = lowercase board name
174 # $(3) = dts file
175 # $(4) = uImage header name field
176 ralink_default_fw_size_8M=8060928
177 BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
178 BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
179 BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4))
180 BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4))
181
182 ralink_default_fw_size_16M=16121856
183 BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
184 BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
185
186 # Build images for a custom sized flash layout
187 # $(1) = squashfs/initramfs
188 # $(2) = lowercase board name
189 # $(3) = dts file
190 # $(4) = kernel + rootfs size
191 BuildFirmware/CustomFlash/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(4),$(5),$(6))
192 BuildFirmware/CustomFlash/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
193
194 # wrappers for boards that have 4MB and 8MB versions
195 define BuildFirmware/DefaultDualSize/squashfs
196 $(call BuildFirmware/Default4M/$(1),$(1),$(2)-4M,$(3)-4M)
197 $(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
198 endef
199 define BuildFirmware/DefaultDualSize/initramfs
200 $(call BuildFirmware/OF/initramfs,$(1),$(2)-4M,$(3)-4M)
201 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
202 endef
203
204 # Some boards need a special header inside the uImage to make them bootable
205 define BuildFirmware/CustomFlashFactory/squashfs
206 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4))
207 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4),$(5),$(6))
208 endef
209 BuildFirmware/CustomFlashFactory/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
210
211 # sign an image to make it work with edimax tftp recovery
212 define BuildFirmware/Edimax/squashfs
213 $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
214 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
215 mkedimaximg -i $(call sysupname,$(1),$(2)) \
216 -o $(call imgname,$(1),$(2))-factory.bin \
217 -s $(5) -m $(6) -f $(7) -S $(8); \
218 fi
219 endef
220 BuildFirmware/Edimax/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
221
222 # build Seama header images
223 define BuildFirmware/Seama/squashfs
224 $(call MkImageLzmaDtb,$(2),$(3),$(5))
225 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.bin)
226 cat $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/root.$(1) > $(KDIR)/img_$(2).$(1).tmp
227 if [ `stat -c%s "$(KDIR)/img_$(2).$(1).tmp"` -gt $$$$(($(5) - 64)) ]; then \
228 echo "Warning: $(KDIR)/img_$(2).$(1).tmp is too big" >&2; \
229 else \
230 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=64k conv=sync; \
231 ( \
232 dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64`; \
233 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
234 ) > $(KDIR)/vmlinux-$(2).tmp; \
235 $(STAGING_DIR_HOST)/bin/seama \
236 -i $(KDIR)/vmlinux-$(2).tmp \
237 -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
238 $(STAGING_DIR_HOST)/bin/seama \
239 -s $(call imgname,$(1),$(2))-factory.bin \
240 -m "signature=$(4)" \
241 -i $(KDIR)/vmlinux-$(2).tmp.seama; \
242 dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64` of=$(KDIR)/vmlinux-$(2)-sysupgrade.tmp; \
243 $(STAGING_DIR_HOST)/bin/seama \
244 -i $(KDIR)/vmlinux-$(2)-sysupgrade.tmp \
245 -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
246 ( \
247 dd if=$(KDIR)/vmlinux-$(2)-sysupgrade.tmp.seama; \
248 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
249 ) > $(BIN_DIR)/$(output_name); \
250 fi
251 endef
252 BuildFirmware/Seama/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
253
254 # sign Buffalo images
255 define BuildFirmware/Buffalo
256 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
257 buffalo-enc -p $(3) -v 1.76 \
258 -i $(KDIR)/vmlinux-$(2).uImage \
259 -o $(KDIR)/vmlinux-$(2).uImage.enc; \
260 buffalo-enc -p $(3) -v 1.76 \
261 -i $(KDIR)/root.$(1) \
262 -o $(KDIR)/root.$(2).enc; \
263 buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \
264 -l mlang8 -f 1 -r EU \
265 -i $(KDIR)/vmlinux-$(2).uImage.enc \
266 -i $(KDIR)/root.$(2).enc \
267 -o $(call imgname,$(1),$(2))-factory-EU.bin; \
268 fi
269 endef
270
271 # sign trednet / UMedia images
272 define BuildFirmware/UMedia/squashfs
273 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
274 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
275 fix-u-media-header -T 0x46 -B $(4) \
276 -i $(call sysupname,$(1),$(2)) \
277 -o $(call imgname,$(1),$(2))-factory.bin; \
278 fi
279 endef
280 BuildFirmware/UMedia/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
281
282 # sign dap 1350 based images
283 dap1350_mtd_size=7667712
284 define BuildFirmware/dap1350/squashfs
285 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(dap1350_mtd_size))
286 -mkdapimg -s $(4) \
287 -i $(call sysupname,$(1),$(2)) \
288 -o $(call imgname,$(1),$(2))-factory.bin
289 endef
290 BuildFirmware/dap1350/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
291
292 # Sign Poray images
293 define BuildFirmware/Poray4M/squashfs
294 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
295 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
296 mkporayfw -B $(3) -F 4M \
297 -f $(call sysupname,$(1),$(2)) \
298 -o $(call imgname,$(1),$(2))-factory.bin; \
299 fi
300 endef
301 BuildFirmware/Poray4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
302
303 define BuildFirmware/Poray8M/squashfs
304 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
305 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
306 mkporayfw -B $(3) -F 8M \
307 -f $(call sysupname,$(1),$(2)) \
308 -o $(call imgname,$(1),$(2))-factory.bin; \
309 fi
310 endef
311 BuildFirmware/Poray8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
312
313 define BuildFirmware/PorayDualSize/squashfs
314 $(call BuildFirmware/DefaultDualSize/$(1),$(1),$(2),$(3))
315 if [ -e "$(call sysupname,$(1),$(2)-4M)" ]; then \
316 mkporayfw -B $(3) -F 4M \
317 -f $(call sysupname,$(1),$(2)-4M) \
318 -o $(call imgname,$(1),$(2)-4M)-factory.bin; \
319 fi
320 if [ -e "$(call sysupname,$(1),$(2)-8M)" ]; then \
321 mkporayfw -B $(3) -F 8M \
322 -f $(call sysupname,$(1),$(2)-8M) \
323 -o $(call imgname,$(1),$(2)-8M)-factory.bin; \
324 fi
325 endef
326 BuildFirmware/PorayDualSize/initramfs=$(call BuildFirmware/DefaultDualSize/initramfs,$(1),$(2),$(3))
327
328 define BuildFirmware/Gemtek/squashfs
329 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
330 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
331 mkheader_gemtek "$(call sysupname,$(1),$(2))" \
332 "$(call imgname,$(1),$(2))-factory.bin" $(2) || \
333 rm -f "$(call imgname,$(1),$(2))-factory.bin"; \
334 fi
335 endef
336 BuildFirmware/Gemtek/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
337
338 # Airlink101 AR670W -- LZMA without uImage header
339 define BuildFirmware/AR670W/squashfs
340 $(call PatchKernelLzmaDtb,$(2),$(3),$(5))
341
342 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
343 $(eval factory_name=$(IMG_PREFIX)-$(2)-$(1)-factory.bin)
344
345 ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=65536 \
346 conv=sync; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/$(output_name)
347
348 $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
349
350 if [ `stat -c%s "$(KDIR)/$(output_name)"` \
351 -gt $(ralink_default_fw_size_4M) ]; then \
352 echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
353 else \
354 mkwrgimg -i $(KDIR)/$(output_name) \
355 -d "/dev/mtdblock/2" \
356 -s "wrgn16a_airlink_ar670w" \
357 -o $(BIN_DIR)/$(factory_name); \
358 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
359 fi
360 endef
361
362 #
363 # RT288X Profiles
364 #
365
366 Image/Build/Profile/AR670W=$(call BuildFirmware/AR670W/$(1),$(1),ar670w,AR670W)
367
368 Image/Build/Profile/AR725W=$(call BuildFirmware/Gemtek/$(1),$(1),ar725w,AR725W)
369
370 # 0x790000
371 belkin_f5d8235v1_mtd_size=7929856
372 Image/Build/Profile/F5D8235V1=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v1,F5D8235_V1,$(belkin_f5d8235v1_mtd_size))
373
374 Image/Build/Profile/RTN15=$(call BuildFirmware/Default4M/$(1),$(1),rt-n15,RT-N15)
375
376 Image/Build/Profile/V11STFE=$(call BuildFirmware/Default4M/$(1),$(1),v11st-fe,V11STFE)
377
378 Image/Build/Profile/WLITX4AG300N=$(call BuildFirmware/Default4M/$(1),$(1),wli-tx4-ag300n,WLI-TX4-AG300N)
379
380 ifeq ($(SUBTARGET),rt288x)
381 define Image/Build/Profile/Default
382 $(call Image/Build/Profile/AR670W,$(1))
383 $(call Image/Build/Profile/AR725W,$(1))
384 $(call Image/Build/Profile/F5D8235V1,$(1))
385 $(call Image/Build/Profile/RTN15,$(1))
386 $(call Image/Build/Profile/V11STFE,$(1))
387 $(call Image/Build/Profile/WLITX4AG300N,$(1))
388 endef
389 endif
390
391
392
393 #
394 # RT305X Profiles
395 #
396
397 Image/Build/Profile/DIR610A1=$(call BuildFirmware/Seama/$(1),$(1),dir-610-a1,DIR-610-A1,wrgn59_dlob.hans_dir610,$(ralink_default_fw_size_4M))
398
399 edimax_3g6200n_mtd_size=3735552
400 Image/Build/Profile/3G6200N=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200n,3G-6200N,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
401
402 Image/Build/Profile/3G6200NL=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200nl,3G-6200NL,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
403
404 Image/Build/Profile/3G300M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),3g300m,3G300M,$(ralink_default_fw_size_4M),3G150M_SPI Kernel Image,factory)
405
406 Image/Build/Profile/A5-V11=$(call BuildFirmware/Poray4M/$(1),$(1),a5-v11,A5-V11)
407
408 Image/Build/Profile/AIR3GII=$(call BuildFirmware/Default4M/$(1),$(1),air3gii,AIR3GII)
409
410 define BuildFirmware/UIMAGE_8M
411 $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7))
412 endef
413 define Image/Build/Profile/ALL02393G
414 $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys)
415 endef
416
417 Image/Build/Profile/ALL0256N=$(call BuildFirmware/DefaultDualSize/$(1),$(1),all0256n,ALL0256N)
418
419 allnet_all5002_mtd_size=33226752
420 Image/Build/Profile/ALL5002=$(call BuildFirmware/CustomFlash/$(1),$(1),all5002,ALL5002,$(allnet_all5002_mtd_size))
421 Image/Build/Profile/ALL5003=$(call BuildFirmware/CustomFlash/$(1),$(1),all5003,ALL5003,$(allnet_all5002_mtd_size))
422
423 argus_atp52b_mtd_size=7995392
424 Image/Build/Profile/ARGUS_ATP52B=$(call BuildFirmware/CustomFlash/$(1),$(1),argus_atp52b,ARGUS_ATP52B,$(argus_atp52b_mtd_size))
425
426 asl26555_8mb_mtd_size=7929856
427 asl26555_16mb_mtd_size=16252928
428 define BuildFirmware/ASL26555/squashfs
429 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-8M,$(3)-8M,$(asl26555_8mb_mtd_size))
430 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-16M,$(3)-16M,$(asl26555_16mb_mtd_size))
431 endef
432 define BuildFirmware/ASL26555/initramfs
433 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
434 $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
435 endef
436 Image/Build/Profile/ASL26555=$(call BuildFirmware/ASL26555/$(1),$(1),asl26555,ASL26555)
437
438 Image/Build/Profile/AWM002EVB=$(call BuildFirmware/DefaultDualSize/$(1),$(1),awm002-evb,AWM002-EVB)
439 Image/Build/Profile/AWM003EVB=$(call BuildFirmware/Default8M/$(1),$(1),awm003-evb,AWM003-EVB)
440 Image/Build/Profile/AWAPN2403=$(call BuildFirmware/Default4M/$(1),$(1),awmapn2403,AWAPN2403)
441
442 Image/Build/Profile/BC2=$(call BuildFirmware/Default8M/$(1),$(1),bc2,BC2)
443
444 broadway_mtd_size=7929856
445 Image/Build/Profile/BROADWAY=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),broadway,BROADWAY,$(broadway_mtd_size),Broadway Kernel Image,factory)
446
447 Image/Build/Profile/CARAMBOLA=$(call BuildFirmware/Default8M/$(1),$(1),carambola,CARAMBOLA)
448
449 Image/Build/Profile/D105=$(call BuildFirmware/Default4M/$(1),$(1),d105,D105)
450
451 define BuildFirmware/DIR300B1/squashfs
452 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
453 -mkwrgimg -s $(4) -d /dev/mtdblock/2 \
454 -i $(call sysupname,$(1),$(2)) \
455 -o $(call imgname,$(1),$(2))-factory.bin
456 endef
457 BuildFirmware/DIR300B1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
458 Image/Build/Profile/DIR-300-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b)
459 Image/Build/Profile/DIR-600-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b)
460 Image/Build/Profile/DIR-600-B2=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b2,DIR-600-B2,wrgn23_dlwbr_dir600b)
461 Image/Build/Profile/DIR-615-D=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-615-d,DIR-615-D,wrgn23_dlwbr_dir615d)
462
463 Image/Build/Profile/DIR-620-A1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-a1,DIR-620-A1)
464 Image/Build/Profile/DIR-620-D1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-d1,DIR-620-D1)
465
466 define BuildFirmware/DIR615H1/squashfs
467 $(call BuildFirmware/Default4M/$(1),$(1),dir-615-h1,DIR-615-H1)
468 -mksenaofw -e $(call sysupname,$(1),dir-615-h1) \
469 -o $(call imgname,$(1),dir-615-h1)-factory.bin \
470 -r 0x218 -p 0x30 -t 3
471 endef
472 BuildFirmware/DIR615H1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),dir-615-h1,DIR-615-H1)
473 Image/Build/Profile/DIR615H1=$(call BuildFirmware/DIR615H1/$(1),$(1))
474
475 Image/Build/Profile/DAP1350=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350,DAP-1350,RT3052-AP-DAP1350-3)
476
477 Image/Build/Profile/DAP1350WW=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350WW,DAP-1350,RT3052-AP-DAP1350WW-3)
478
479 define BuildFirmware/DCS930/squashfs
480 $(call BuildFirmware/Default4M/squashfs,squashfs,$(2),$(3))
481 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/image.$(2).combined bs=1048512 count=1 conv=sync
482 cat $(KDIR)/root.squashfs >> $(KDIR)/image.$(2).combined
483 $(call MkImage,lzma,$(KDIR)/image.$(2).combined,$(KDIR)/image.$(2))
484 $(call prepare_generic_squashfs,$(KDIR)/image.$(2))
485 if [ `stat -c%s "$(KDIR)/image.$(2)"` -gt $(ralink_default_fw_size_4M) ]; then \
486 echo "Warning: $(KDIR)/image.$(2) is too big" >&2; \
487 else \
488 dd if=$(KDIR)/image.$(2) of=$(KDIR)/dcs.tmp bs=64K count=5 conv=sync ;\
489 cat $(KDIR)/image.$(2) >> $(KDIR)/dcs.tmp ; \
490 dd if=$(KDIR)/dcs.tmp of=$(call imgname,$(1),$(2))-factory.bin bs=4096k count=1 conv=sync ;\
491 $(STAGING_DIR_HOST)/bin/mkdcs932 $(call imgname,$(1),$(2))-factory.bin ; \
492 fi
493 endef
494 BuildFirmware/DCS930/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
495 Image/Build/Profile/DCS930=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930,DCS-930)
496
497 Image/Build/Profile/ESR-9753=$(call BuildFirmware/Default4M/$(1),$(1),esr-9753,ESR-9753)
498
499 Image/Build/Profile/HW550-3G=$(call BuildFirmware/Default8M/$(1),$(1),hw550-3g,HW550-3G)
500
501 belkin_f5d8235v2_mtd_size=7929856
502 Image/Build/Profile/F5D8235V2=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v2,F5D8235_V2,$(belkin_f5d8235v2_mtd_size))
503
504 # 0x770000
505 belkin_f7c027_mtd_size=7798784
506 Image/Build/Profile/F7C027=$(call BuildFirmware/CustomFlash/$(1),$(1),belkinf7c027,F7C027,$(belkin_f7c027_mtd_size))
507
508 Image/Build/Profile/FONERA20N=$(call BuildFirmware/Edimax/$(1),$(1),fonera20n,FONERA20N,$(ralink_default_fw_size_8M),RSDK,NL1T,0x50000,0xc0000)
509
510 Image/Build/Profile/RT-N13U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n13u,RT-N13U)
511
512 #Image/Build/Profile/HG255D=$(call BuildFirmware/Default16M/$(1),$(1),hg255d,HG255D)
513
514 Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freestation5,FREESTATION5)
515
516 Image/Build/Profile/IP2202=$(call BuildFirmware/Default8M/$(1),$(1),ip2202,IP2202)
517
518 BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))
519 define BuildFirmware/HLKRM04/initramfs
520 $(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
521 mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
522 endef
523 Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)
524
525 Image/Build/Profile/HT-TM02=$(call BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
526
527 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
528
529 Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
530
531 Image/Build/Profile/MOFI3500-3GN=$(call BuildFirmware/Default8M/$(1),$(1),mofi3500-3gn,MOFI3500-3GN)
532
533 # Kernel name should be "Linux Kernel Image" to make the OpenWrt image installable from factory Web UI
534 Image/Build/Profile/MPRA1=$(call BuildFirmware/Default4M/$(1),$(1),mpr-a1,MPRA1,Linux Kernel Image)
535 Image/Build/Profile/MPRA2=$(call BuildFirmware/Default8M/$(1),$(1),mpr-a2,MPRA2,Linux Kernel Image)
536
537 Image/Build/Profile/DIR-300-B7=$(call BuildFirmware/Default4M/$(1),$(1),dir-300-b7,DIR-300-B7)
538 Image/Build/Profile/DIR-320-B1=$(call BuildFirmware/Default8M/$(1),$(1),dir-320-b1,DIR-320-B1)
539
540 Image/Build/Profile/NBG-419N=$(call BuildFirmware/Default4M/$(1),$(1),nbg-419n,NBG-419N)
541
542 Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2,MZK-W300NH2,$(mzkw300nh2_mtd_size),CSYS,RN52,0x50000,0xc0000)
543
544 Image/Build/Profile/NCS601W=$(call BuildFirmware/Default8M/$(1),$(1),ncs601W,NCS601W)
545
546 nw718_mtd_size=3801088
547 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
548
549 Image/Build/Profile/OMNI-EMB=$(call BuildFirmware/Default8M/$(1),$(1),omni-emb,OMNI-EMB)
550
551 Image/Build/Profile/OMNI-PLUG=$(call BuildFirmware/Default8M/$(1),$(1),omni-plug,OMNI-PLUG)
552
553 Image/Build/Profile/PSR-680W=$(call BuildFirmware/Default4M/$(1),$(1),psr-680w,PSR-680W)
554
555 Image/Build/Profile/PWH2004=$(call BuildFirmware/Default8M/$(1),$(1),pwh2004,PWH2004)
556
557 Image/Build/Profile/PX4885=$(call BuildFirmware/DefaultDualSize/$(1),$(1),px4885,PX4885)
558
559 Image/Build/Profile/RTG32B1=$(call BuildFirmware/Default4M/$(1),$(1),rt-g32-b1,RT-G32-B1)
560
561 Image/Build/Profile/RTN10PLUS=$(call BuildFirmware/Default4M/$(1),$(1),rt-n10-plus,RT-N10-PLUS)
562
563 Image/Build/Profile/RUT5XX=$(call BuildFirmware/Default8M/$(1),$(1),rut5xx,RUT5XX)
564
565 Image/Build/Profile/SL-R7205=$(call BuildFirmware/Default4M/$(1),$(1),sl-r7205,SL-R7205)
566
567 Image/Build/Profile/V22RW-2X2=$(call BuildFirmware/Default4M/$(1),$(1),v22rw-2x2,V22RW-2X2)
568
569 Image/Build/Profile/VOCORE=$(call BuildFirmware/Default8M/$(1),$(1),vocore,VOCORE)
570
571 Image/Build/Profile/W150M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w150m,W150M,$(ralink_default_fw_size_4M),W150M Kernel Image,factory)
572
573 Image/Build/Profile/W306R_V20=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w306r-v20,W306R_V20,$(ralink_default_fw_size_4M),linkn Kernel Image,factory)
574
575 Image/Build/Profile/W502U=$(call BuildFirmware/Default8M/$(1),$(1),w502u,W502U)
576
577 Image/Build/Profile/WCR150GN=$(call BuildFirmware/Default4M/$(1),$(1),wcr150gn,WCR150GN)
578
579 buffalo_whrg300n_mtd_size=3801088
580 define BuildFirmware/WHRG300N/squashfs
581 $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
582 # the following line has a bad argument 3 ... the old Makefile was already broken
583 $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
584 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
585 ( \
586 echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
587 dd bs=512 count=1 conv=sync; \
588 dd if=$(call sysupname,$(1),whr-g300n); \
589 ) > $(KDIR)/whr-g300n-tftp.tmp && \
590 buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
591 -o $(call imgname,$(1),whr-g300n)-tftp.bin; \
592 fi
593 endef
594 BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
595 Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
596
597 Image/Build/Profile/WIZARD8800=$(call BuildFirmware/Default8M/$(1),$(1),wizard-8800,WIZARD8800,Linux Kernel Image)
598
599 Image/Build/Profile/WL_330N=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n,WL_330N)
600
601 Image/Build/Profile/WL_330N3G=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n3g,WL_330N3G)
602
603 kernel_size_wl341v3=917504
604 rootfs_size_wl341v3=2949120
605 define BuildFirmware/WL341V3/squashfs
606 $(call BuildFirmware/Default4M/$(1),$(1),wl341v3,WL341V3)
607 # This code looks broken and really needs to be converted to C
608 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
609 ( \
610 dd if=/dev/zero bs=195936 count=1; \
611 echo "1.01"; \
612 dd if=/dev/zero bs=581 count=1; \
613 echo -n -e "\x73\x45\x72\x43\x6F\x4D\x6D\x00\x01\x00\x00\x59\x4E\x37\x95\x58\x10\x00\x20\x00\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x03\x00\x00\x80\x00\x00\x00\x00\x03\x00\x00\x10\x12\x00\x00\x00\x10\x73\x45\x72\x43\x6F\x4D\x6D"; \
614 dd if=/dev/zero bs=65552 count=1; \
615 dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \
616 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
617 dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
618 echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
619 ) > $(call imgname,$(1),$(2))-factory.bin; \
620 fi
621 endef
622 BuildFirmware/WL341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl341v3,WL341V3)
623 Image/Build/Profile/WL341V3=$(call BuildFirmware/WL341V3/$(1),$(1))
624
625 Image/Build/Profile/WL-351=$(call BuildFirmware/Default4M/$(1),$(1),wl-351,WL-351)
626
627 define BuildFirmware/WNCE2001/squashfs
628 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
629 -mkdapimg -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 \
630 -i $(call sysupname,$(1),$(2)) \
631 -o $(call imgname,$(1),$(2))-factory-worldwide.bin
632 -mkdapimg -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 \
633 -i $(call sysupname,$(1),$(2)) \
634 -o $(call imgname,$(1),$(2))-factory-northamerica.bin
635 endef
636 BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
637 Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001)
638
639 Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN)
640
641 Image/Build/Profile/WT1520=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt1520,WT1520)
642
643 Image/Build/Profile/UR-326N4G=$(call BuildFirmware/Default4M/$(1),$(1),ur-326n4g,UR-326N4G)
644
645 Image/Build/Profile/UR-336UN=$(call BuildFirmware/Default8M/$(1),$(1),ur-336un,UR-336UN)
646
647 Image/Build/Profile/WR6202=$(call BuildFirmware/Default8M/$(1),$(1),wr6202,WR6202)
648
649 Image/Build/Profile/X5=$(call BuildFirmware/Poray8M/$(1),$(1),x5,X5)
650
651 Image/Build/Profile/X8=$(call BuildFirmware/Poray8M/$(1),$(1),x8,X8)
652
653 Image/Build/Profile/XDXRN502J=$(call BuildFirmware/Default4M/$(1),$(1),xdxrn502j,XDXRN502J)
654
655 ifeq ($(SUBTARGET),rt305x)
656 define Image/Build/Profile/Default
657 $(call Image/Build/Profile/3G6200N,$(1))
658 $(call Image/Build/Profile/3G6200NL,$(1))
659 $(call Image/Build/Profile/3G300M,$(1))
660 $(call Image/Build/Profile/A5-11,$(1))
661 $(call Image/Build/Profile/AIR3GII,$(1))
662 $(call Image/Build/Profile/ALL02393G,$(1))
663 $(call Image/Build/Profile/ALL0256N,$(1))
664 $(call Image/Build/Profile/ALL5002,$(1))
665 $(call Image/Build/Profile/ALL5003,$(1))
666 $(call Image/Build/Profile/ARGUS_ATP52B,$(1))
667 $(call Image/Build/Profile/ASL26555,$(1))
668 $(call Image/Build/Profile/AWM002EVB,$(1))
669 $(call Image/Build/Profile/AWAPN2403,$(1))
670 $(call Image/Build/Profile/BC2,$(1))
671 $(call Image/Build/Profile/BROADWAY,$(1))
672 $(call Image/Build/Profile/CARAMBOLA,$(1))
673 $(call Image/Build/Profile/D105,$(1))
674 $(call Image/Build/Profile/DIR-300-B1,$(1))
675 $(call Image/Build/Profile/DIR-600-B1,$(1))
676 $(call Image/Build/Profile/DIR-300-B7,$(1))
677 $(call Image/Build/Profile/DIR-320-B1,$(1))
678 $(call Image/Build/Profile/DIR-600-B2,$(1))
679 $(call Image/Build/Profile/DIR610A1,$(1))
680 $(call Image/Build/Profile/DIR-615-D,$(1))
681 $(call Image/Build/Profile/DIR-620-A1,$(1))
682 $(call Image/Build/Profile/DIR-620-D1,$(1))
683 $(call Image/Build/Profile/DIR615H1,$(1))
684 $(call Image/Build/Profile/DAP1350,$(1))
685 $(call Image/Build/Profile/DAP1350WW,$(1))
686 $(call Image/Build/Profile/DCS930,$(1))
687 $(call Image/Build/Profile/ESR-9753,$(1))
688 $(call Image/Build/Profile/F7C027,$(1))
689 $(call Image/Build/Profile/F5D8235V2,$(1))
690 $(call Image/Build/Profile/FONERA20N,$(1))
691 $(call Image/Build/Profile/FREESTATION5,$(1))
692 # $(call Image/Build/Profile/HG255D,$(1))
693 $(call Image/Build/Profile/HLKRM04,$(1))
694 $(call Image/Build/Profile/HT-TM02,$(1))
695 $(call Image/Build/Profile/HW550-3G,$(1))
696 $(call Image/Build/Profile/IP2202,$(1))
697 $(call Image/Build/Profile/M3,$(1))
698 $(call Image/Build/Profile/M4,$(1))
699 $(call Image/Build/Profile/MOFI3500-3GN,$(1))
700 $(call Image/Build/Profile/MPRA1,$(1))
701 $(call Image/Build/Profile/MPRA2,$(1))
702 $(call Image/Build/Profile/MZKW300NH2,$(1))
703 $(call Image/Build/Profile/NBG-419N,$(1))
704 $(call Image/Build/Profile/NCS601W,$(1))
705 $(call Image/Build/Profile/NW718,$(1))
706 $(call Image/Build/Profile/OMNI-EMB,$(1))
707 $(call Image/Build/Profile/OMNI-PLUG,$(1))
708 $(call Image/Build/Profile/PSR-680W,$(1))
709 $(call Image/Build/Profile/PWH2004,$(1))
710 $(call Image/Build/Profile/PX4885,$(1))
711 $(call Image/Build/Profile/RTG32B1,$(1))
712 $(call Image/Build/Profile/RTN10PLUS,$(1))
713 $(call Image/Build/Profile/RT-N13U,$(1))
714 $(call Image/Build/Profile/RUT5XX,$(1))
715 $(call Image/Build/Profile/SL-R7205,$(1))
716 $(call Image/Build/Profile/UR-326N4G,$(1))
717 $(call Image/Build/Profile/V22RW-2X2,$(1))
718 $(call Image/Build/Profile/VOCORE,$(1))
719 $(call Image/Build/Profile/W150M,$(1))
720 $(call Image/Build/Profile/W306R_V20,$(1))
721 $(call Image/Build/Profile/W502U,$(1))
722 $(call Image/Build/Profile/WCR150GN,$(1))
723 $(call Image/Build/Profile/WHRG300N,$(1))
724 $(call Image/Build/Profile/WIZARD8800,$(1))
725 $(call Image/Build/Profile/WL_330N,$(1))
726 $(call Image/Build/Profile/WL_330N3G,$(1))
727 $(call Image/Build/Profile/WL341V3,$(1))
728 $(call Image/Build/Profile/WL-351,$(1))
729 $(call Image/Build/Profile/WNCE2001,$(1))
730 $(call Image/Build/Profile/WR512-3GN,$(1))
731 $(call Image/Build/Profile/WR6202,$(1))
732 $(call Image/Build/Profile/WT1520,$(1))
733 $(call Image/Build/Profile/X5,$(1))
734 $(call Image/Build/Profile/X8,$(1))
735 $(call Image/Build/Profile/XDXRN502J,$(1))
736 endef
737 endif
738
739
740
741 #
742 # RT3662/RT3883 Profiles
743 #
744
745 # $(1) = squashfs/initramfs
746 # $(2) = lowercase board name
747 # $(3) = dts file
748 # $(4) = kernel size
749 # $(5) = rootfs size
750 # $(6) = signature
751 # $(7) = model
752 # $(8) = flash address
753 # $(9) = start address
754 define BuildFirmware/EdimaxCombined/squashfs
755 $(call PatchKernelLzmaDtb,$(2),$(3))
756 $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).bin.uImage)
757 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.uImage"` -gt `expr $(4) - 20` ]; then \
758 echo "Warning: $(KDIR)/vmlinux-$(2).bin.uImage is too big" >&2; \
759 exit 1; \
760 else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
761 echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
762 exit 1; \
763 else \
764 ( dd if=$(KDIR)/vmlinux-$(2).bin.uImage bs=`expr $(4) - 20` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.uImage.combined ; \
765 fi ; fi
766 mkedimaximg -i "$(KDIR)/vmlinux-$(2).bin.uImage.combined" \
767 -o $(call imgname,$(1),$(2)).bin \
768 -s $(6) -m $(7) -f $(8) -S $(9)
769 endef
770
771 Image/Build/Profile/CYSWR1100=$(call BuildFirmware/Seama/$(1),$(1),cy-swr1100,CY-SWR1100,wrgnd10_samsung_ss815,$(ralink_default_fw_size_8M))
772
773 Image/Build/Profile/DIR645=$(call BuildFirmware/Seama/$(1),$(1),dir-645,DIR-645,wrgn39_dlob.hans_dir645,$(ralink_default_fw_size_8M))
774
775 omniembhpm_mtd_size=16449536
776 Image/Build/Profile/OMNIEMBHPM=$(call BuildFirmware/CustomFlash/$(1),$(1),omni-emb-hpm,OMNI-EMB-HPM,$(omniembhpm_mtd_size))
777
778 define BuildFirmware/RTN56U/squashfs
779 $(call BuildFirmware/Default8M/$(1),$(1),rt-n56u,RTN56U)
780 -mkrtn56uimg -s $(call sysupname,$(1),rt-n56u)
781 -cp $(call sysupname,$(1),rt-n56u) $(call imgname,$(1),rt-n56u)-factory.bin
782 -mkrtn56uimg -f $(call imgname,$(1),rt-n56u)-factory.bin
783 endef
784 Image/Build/Profile/RTN56U=$(call BuildFirmware/RTN56U/$(1),$(1),rt-n56u,RTN56U)
785
786 Image/Build/Profile/TEW691GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-691gr,TEW-691GR,0x026910)
787
788 Image/Build/Profile/TEW692GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-692gr,TEW-692GR,0x026920)
789
790 kernel_size_BR6475ND:=2097152
791 rootfs_size_BR6475ND:=5832704
792 Image/Build/Profile/BR6475ND=$(call BuildFirmware/EdimaxCombined/$(1),$(1),br-6475nd,BR-6475ND,$(kernel_size_BR6475ND),$(rootfs_size_BR6475ND),CSYS,RN54,0x70000,0x01100000)
793
794 ifeq ($(SUBTARGET),rt3883)
795 define Image/Build/Profile/Default
796 $(call Image/Build/Profile/CYSWR1100,$(1))
797 $(call Image/Build/Profile/DIR645,$(1))
798 $(call Image/Build/Profile/OMNIEMBHPM,$(1))
799 $(call Image/Build/Profile/RTN56U,$(1))
800 $(call Image/Build/Profile/BR6475ND,$(1))
801 $(call Image/Build/Profile/TEW691GR,$(1))
802 $(call Image/Build/Profile/TEW692GR,$(1))
803 endef
804 endif
805
806 #
807 # MT7620A Profiles
808 #
809
810 Image/Build/Profile/E1700=$(call BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
811 Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
812 Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
813 Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
814 Image/Build/Profile/MT7620a_V22SG=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_v22sg,MT7620a_V22SG)
815 br100_mtd_size=8126464
816 Image/Build/Profile/AIBR100=$(call BuildFirmware/CustomFlash/$(1),$(1),ai-br100,AIBR100,$(br100_mtd_size),Ai-BR)
817 Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp_n53,RP-N53)
818 whr_300hp2_mtd_size=7012352
819 Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300hp2,WHR-300HP2,$(whr_300hp2_mtd_size))
820 Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
821 whr_1166d_mtd_size=15400960
822 Image/Build/Profile/WHR1166D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-1166d,WHR-1166D,$(whr_1166hd_mtd_size))
823 dlink810l_mtd_size=6881280
824 Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
825 na930_mtd_size=20971520
826 Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
827 Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
828 Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1)
829 Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S)
830 Image/Build/Profile/MLW221=$(call BuildFirmware/Default16M/$(1),$(1),mlw221,MLW221)
831 Image/Build/Profile/WMR300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR300)
832 Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
833 Image/Build/Profile/WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),wr8305rt,WR8305RT)
834 Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
835 Image/Build/Profile/WT3020=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020)
836 Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05)
837 Image/Build/Profile/ArcherC20i=$(call BuildFirmware/Tplink/$(1),$(1),ArcherC20i,ArcherC20i)
838
839
840 ifeq ($(SUBTARGET),mt7620)
841 define Image/Build/Profile/Default
842 $(call Image/Build/Profile/E1700,$(1))
843 $(call Image/Build/Profile/MT7620a,$(1))
844 $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
845 $(call Image/Build/Profile/MT7620a_MT7530,$(1))
846 $(call Image/Build/Profile/MT7620a_V22SG,$(1))
847 $(call Image/Build/Profile/AIBR100,$(1))
848 $(call Image/Build/Profile/RP-N53,$(1))
849 $(call Image/Build/Profile/DIR-810L,$(1))
850 $(call Image/Build/Profile/WHR300HP2,$(1))
851 $(call Image/Build/Profile/WHR600D,$(1))
852 $(call Image/Build/Profile/WHR1166D,$(1))
853 $(call Image/Build/Profile/MZK-750DHP,$(1))
854 $(call Image/Build/Profile/NA930,$(1))
855 $(call Image/Build/Profile/Y1,$(1))
856 $(call Image/Build/Profile/Y1S,$(1))
857 $(call Image/Build/Profile/MLW221,$(1))
858 $(call Image/Build/Profile/WMR300,$(1))
859 $(call Image/Build/Profile/RT-N14U,$(1))
860 $(call Image/Build/Profile/WR8305RT,$(1))
861 $(call Image/Build/Profile/WRTNODE,$(1))
862 $(call Image/Build/Profile/WT3020,$(1))
863 $(call Image/Build/Profile/ZBT-WA05,$(1))
864 $(call Image/Build/Profile/ArcherC20i,$(1))
865 endef
866 endif
867
868 #
869 # MT7621 Profiles
870 #
871
872 ifeq ($(SUBTARGET),mt7621)
873 TARGET_DEVICES += mt7621 wsr-600 wsr-1166
874 endif
875
876 define Device/mt7621
877 DTS := MT7621
878 IMAGE_SIZE := $(ralink_default_fw_size_4M)
879 endef
880
881 define Device/wsr-600
882 DTS := WSR-600
883 endef
884
885 define Device/wsr-1166
886 DTS := WSR-1166
887 IMAGE/sysupgrade.bin := trx | pad-rootfs
888 endef
889
890 #
891 # MT7628 Profiles
892 #
893
894 Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
895
896 ifeq ($(SUBTARGET),mt7628)
897 define Image/Build/Profile/Default
898 $(call Image/Build/Profile/MT7628,$(1))
899 endef
900 endif
901
902 ifndef TARGET_DEVICES
903 #
904 # Generic Targets - only needed for legacy image building code
905 #
906 define Image/BuildKernel
907 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
908 cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
909 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
910 $(call MkImage,lzma,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
911 cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(UIMAGE).bin
912 endef
913
914 define Image/BuildKernel/Initramfs
915 cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(VMLINUX)-initramfs.elf
916 cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(VMLINUX)-initramfs.bin
917 $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
918 $(call MkImage,lzma,$(KDIR)/vmlinux-initramfs.bin.lzma,$(KDIR)/uImage-initramfs.lzma)
919 cp $(KDIR)/uImage-initramfs.lzma $(BIN_DIR)/$(UIMAGE)-initramfs.bin
920 $(call Image/Build/Initramfs)
921 endef
922
923 define Image/Build
924 $(call Image/Build/$(1))
925 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
926 $(call Image/Build/Profile/$(PROFILE),$(1))
927 endef
928 endif
929
930 $(eval $(call BuildImage))