ramips: add support for Ubiquiti EdgeRouter X (UBNT-ERX)
[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 | pad-rootfs | check-size $$$$(IMAGE_SIZE)
39 endef
40
41 define Build/patch-dtb
42 $(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
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 Build/seama
55 $(STAGING_DIR_HOST)/bin/seama -i $@ $(1)
56 mv $@.seama $@
57 endef
58
59 define Build/seama-seal
60 $(call Build/seama,-s $@.seama $(1))
61 endef
62
63 define Build/relocate-kernel
64 ( \
65 dd if=$(KDIR)/loader.bin bs=32 conv=sync && \
66 perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
67 cat $@ \
68 ) > $@.new
69 mv $@.new $@
70 endef
71
72 define Build/ubnt-erx-factory-compat
73 echo '21001:6' > $@.compat
74 $(TAR) -cf $@ --transform='s/^.*/compat/' $@.compat
75 $(RM) $@.compat
76 endef
77
78 define Build/ubnt-erx-factory-kernel
79 if [ -e $(BIN_DIR)/$(KERNEL_INITRAMFS_IMAGE) ]; then \
80 $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' $(BIN_DIR)/$(KERNEL_INITRAMFS_IMAGE); \
81 \
82 md5sum --binary $(BIN_DIR)/$(KERNEL_INITRAMFS_IMAGE) | awk '{print $$1}'> $@.md5; \
83 $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp.md5/' $@.md5; \
84 $(RM) $@.md5; \
85 fi
86 endef
87
88 define Build/ubnt-erx-factory-rootfs
89 echo "dummy" > $@.rootfs
90 $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp/' $@.rootfs
91
92 md5sum --binary $@.rootfs | awk '{print $$1}'> $@.md5
93 $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp.md5/' $@.md5
94 $(RM) $@.md5
95 $(RM) $@.rootfs
96 endef
97
98 define Build/ubnt-erx-factory-version
99 echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $@.version
100 $(TAR) -rf $@ --transform='s/^.*/version.tmp/' $@.version
101 $(RM) $@.version
102 endef
103
104 #We need kernel+initrams fit into kernel partition
105 define Build/ubnt-erx-factory-check-size
106 @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" ] || { \
107 echo "WARNING: Initramfs kernel for image $@ is too big (kernel size: $$($(TAR) -xf $@ vmlinux.tmp -O | wc -c), max size $(1))" >&2; \
108 $(RM) -f $@; \
109 }
110
111 @[ "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" -gt 0 ] || { \
112 echo "WARNING: Kernel for image $@ not found" >&2; \
113 $(RM) -f $@; \
114 }
115 endef
116
117 define MkCombineduImage
118 $(call PatchKernelLzma,$(2),$(3))
119 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
120 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \
121 else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
122 echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
123 else \
124 ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 64` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined ; \
125 fi ; fi
126 $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(call sysupname,$(1),$(2)),$(6))
127 endef
128
129
130 #
131 # The real magic happens inside these templates
132 #
133 # $(1), compression method
134 # $(2), filename of image data
135 # $(3), output filename
136 define MkImage
137 $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION)))
138 -mkimage -A mips -O linux -T kernel -C $(1) -a $(loadaddr-y) -e $(loadaddr-y) \
139 -n "$(imagename)" \
140 -d $(2) $(3)
141 endef
142
143 define CompressLzma
144 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
145 endef
146
147 define MkImageSysupgrade/squashfs
148 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
149 cat $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) > $(KDIR)/$(output_name)
150 $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
151 if [ `stat -c%s "$(KDIR)/$(output_name)"` -gt $(3) ]; then \
152 echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
153 else \
154 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
155 fi
156 endef
157
158 define MkImageTpl/squashfs
159 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
160 $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
161 -o $(KDIR)/$(output_name) \
162 -k $(KDIR)/vmlinux-$(1)$(4).bin.lzma \
163 -r $(KDIR)/root.$(1)
164 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
165 endef
166
167 define MkImageTpl/initramfs
168 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1).bin)
169 $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -c \
170 -o $(KDIR)/$(output_name) \
171 -k $(KDIR)/vmlinux-$(1).bin.lzma
172 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
173 endef
174
175 # $(1), lowercase board name like "mt7620a_v22sg"
176 # $(2), DTS filename without .dts extension
177 # $(3), optional filename suffix, e.g. "-initramfs"
178 define PatchKernelLzmaDtb
179 cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
180 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
181 $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
182 $(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
183 endef
184
185 # $(1), lowercase board name
186 # $(2), DTS filename without .dts extension
187 # $(3), ih_name field of uImage header
188 # $(4), optional filename suffix, e.g. "-initramfs"
189 define MkImageLzmaDtb
190 $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
191 $(call MkImage,lzma,$(KDIR)/vmlinux-$(1)$(4).bin.lzma,$(KDIR)/vmlinux-$(1)$(4).uImage,$(3))
192 endef
193
194 # $(1), Rootfs type, e.g. squashfs
195 # $(2), lowercase board name
196 # $(3), DTS filename without .dts extension
197 # $(4), maximum size of sysupgrade image
198 # $(5), uImage header's ih_name field
199 define BuildFirmware/OF
200 $(call MkImageLzmaDtb,$(2),$(3),$(5))
201 $(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6))
202 endef
203
204 define BuildFirmware/OF/tplink
205 $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
206 $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
207 endef
208
209 define BuildFirmware/OF/tplink/initramfs
210 $(call PatchKernelLzmaDtb,$(2),$(3),-initramfs)
211 $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
212 endef
213
214 # $(1), squashfs/initramfs
215 # $(2), lowercase board name
216 # $(3), DTS filename without .dts extension
217 # $(4), ih_name field of uImage header
218 define BuildFirmware/OF/initramfs
219 $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs)
220 $(CP) $(KDIR)/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin
221 endef
222
223
224 # Build images for default ralink layout for 4MB flash
225 # kernel + roots = 0x3b0000
226 # $(1) = squashfs/initramfs
227 # $(2) = lowercase board name
228 # $(3) = dts file
229 ralink_default_fw_size_4M=3866624
230 BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4))
231 BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
232
233 # Build images for default ralink layout for 8MB flash
234 # kernel + roots = 0x7b0000
235 # $(1) = squashfs/initramfs
236 # $(2) = lowercase board name
237 # $(3) = dts file
238 # $(4) = uImage header name field
239 ralink_default_fw_size_8M=8060928
240 BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
241 BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
242 BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4))
243 BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4))
244
245 ralink_default_fw_size_16M=16121856
246 BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
247 BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
248
249 ralink_default_fw_size_32M=33226752
250 BuildFirmware/Default32M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_32M),$(4))
251 BuildFirmware/Default32M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
252
253 # Build images for a custom sized flash layout
254 # $(1) = squashfs/initramfs
255 # $(2) = lowercase board name
256 # $(3) = dts file
257 # $(4) = kernel + rootfs size
258 BuildFirmware/CustomFlash/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(4),$(5),$(6))
259 BuildFirmware/CustomFlash/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
260
261 # wrappers for boards that have 4MB and 8MB versions
262 define BuildFirmware/DefaultDualSize/squashfs
263 $(call BuildFirmware/Default4M/$(1),$(1),$(2)-4M,$(3)-4M)
264 $(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
265 endef
266 define BuildFirmware/DefaultDualSize/initramfs
267 $(call BuildFirmware/OF/initramfs,$(1),$(2)-4M,$(3)-4M)
268 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
269 endef
270
271 # Some boards need a special header inside the uImage to make them bootable
272 define BuildFirmware/CustomFlashFactory/squashfs
273 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4))
274 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4),$(5),$(6))
275 endef
276 BuildFirmware/CustomFlashFactory/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
277
278 # sign an image to make it work with edimax tftp recovery
279 define BuildFirmware/Edimax/squashfs
280 $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
281 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
282 mkedimaximg -i $(call sysupname,$(1),$(2)) \
283 -o $(call imgname,$(1),$(2))-factory.bin \
284 -s $(5) -m $(6) -f $(7) -S $(8); \
285 fi
286 endef
287 BuildFirmware/Edimax/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
288
289 # build Seama header images
290 define BuildFirmware/Seama/squashfs
291 $(call MkImageLzmaDtb,$(2),$(3),$(5))
292 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.bin)
293 cat $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/root.$(1) > $(KDIR)/img_$(2).$(1).tmp
294 if [ `stat -c%s "$(KDIR)/img_$(2).$(1).tmp"` -gt $$$$(($(5) - 64)) ]; then \
295 echo "Warning: $(KDIR)/img_$(2).$(1).tmp is too big" >&2; \
296 else \
297 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=64k conv=sync; \
298 ( \
299 dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64`; \
300 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
301 ) > $(KDIR)/vmlinux-$(2).tmp; \
302 $(STAGING_DIR_HOST)/bin/seama \
303 -i $(KDIR)/vmlinux-$(2).tmp \
304 -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
305 $(STAGING_DIR_HOST)/bin/seama \
306 -s $(call imgname,$(1),$(2))-factory.bin \
307 -m "signature=$(4)" \
308 -i $(KDIR)/vmlinux-$(2).tmp.seama; \
309 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; \
310 $(STAGING_DIR_HOST)/bin/seama \
311 -i $(KDIR)/vmlinux-$(2)-sysupgrade.tmp \
312 -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
313 ( \
314 dd if=$(KDIR)/vmlinux-$(2)-sysupgrade.tmp.seama; \
315 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
316 ) > $(BIN_DIR)/$(output_name); \
317 fi
318 endef
319 BuildFirmware/Seama/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
320
321 # sign Buffalo images
322 define BuildFirmware/Buffalo
323 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
324 buffalo-enc -p $(3) -v 1.76 \
325 -i $(KDIR)/vmlinux-$(2).uImage \
326 -o $(KDIR)/vmlinux-$(2).uImage.enc; \
327 buffalo-enc -p $(3) -v 1.76 \
328 -i $(KDIR)/root.$(1) \
329 -o $(KDIR)/root.$(2).enc; \
330 buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \
331 -l mlang8 -f 1 -r EU \
332 -i $(KDIR)/vmlinux-$(2).uImage.enc \
333 -i $(KDIR)/root.$(2).enc \
334 -o $(call imgname,$(1),$(2))-factory-EU.bin; \
335 fi
336 endef
337
338 # sign trednet / UMedia images
339 define BuildFirmware/UMedia/squashfs
340 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
341 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
342 fix-u-media-header -T 0x46 -B $(4) \
343 -i $(call sysupname,$(1),$(2)) \
344 -o $(call imgname,$(1),$(2))-factory.bin; \
345 fi
346 endef
347 BuildFirmware/UMedia/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
348
349 # sign dap 1350 based images
350 dap1350_mtd_size=7667712
351 define BuildFirmware/dap1350/squashfs
352 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(dap1350_mtd_size))
353 -mkdapimg -s $(4) \
354 -i $(call sysupname,$(1),$(2)) \
355 -o $(call imgname,$(1),$(2))-factory.bin
356 endef
357 BuildFirmware/dap1350/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
358
359 # Sign Poray images
360 define BuildFirmware/Poray4M/squashfs
361 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
362 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
363 mkporayfw -B $(3) -F 4M \
364 -f $(call sysupname,$(1),$(2)) \
365 -o $(call imgname,$(1),$(2))-factory.bin; \
366 fi
367 endef
368 BuildFirmware/Poray4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
369
370 define BuildFirmware/Poray8M/squashfs
371 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
372 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
373 mkporayfw -B $(3) -F 8M \
374 -f $(call sysupname,$(1),$(2)) \
375 -o $(call imgname,$(1),$(2))-factory.bin; \
376 fi
377 endef
378 BuildFirmware/Poray8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
379
380 define BuildFirmware/PorayDualSize/squashfs
381 $(call BuildFirmware/DefaultDualSize/$(1),$(1),$(2),$(3))
382 if [ -e "$(call sysupname,$(1),$(2)-4M)" ]; then \
383 mkporayfw -B $(3) -F 4M \
384 -f $(call sysupname,$(1),$(2)-4M) \
385 -o $(call imgname,$(1),$(2)-4M)-factory.bin; \
386 fi
387 if [ -e "$(call sysupname,$(1),$(2)-8M)" ]; then \
388 mkporayfw -B $(3) -F 8M \
389 -f $(call sysupname,$(1),$(2)-8M) \
390 -o $(call imgname,$(1),$(2)-8M)-factory.bin; \
391 fi
392 endef
393 BuildFirmware/PorayDualSize/initramfs=$(call BuildFirmware/DefaultDualSize/initramfs,$(1),$(2),$(3))
394
395 define BuildFirmware/Gemtek/squashfs
396 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
397 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
398 mkheader_gemtek "$(call sysupname,$(1),$(2))" \
399 "$(call imgname,$(1),$(2))-factory.bin" $(2) || \
400 rm -f "$(call imgname,$(1),$(2))-factory.bin"; \
401 fi
402 endef
403 BuildFirmware/Gemtek/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
404
405 # Airlink101 AR670W -- LZMA without uImage header
406 define BuildFirmware/AR670W/squashfs
407 $(call PatchKernelLzmaDtb,$(2),$(3),$(5))
408
409 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
410 $(eval factory_name=$(IMG_PREFIX)-$(2)-$(1)-factory.bin)
411
412 ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=65536 \
413 conv=sync; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/$(output_name)
414
415 $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
416
417 if [ `stat -c%s "$(KDIR)/$(output_name)"` \
418 -gt $(ralink_default_fw_size_4M) ]; then \
419 echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
420 else \
421 mkwrgimg -i $(KDIR)/$(output_name) \
422 -d "/dev/mtdblock/2" \
423 -s "wrgn16a_airlink_ar670w" \
424 -o $(BIN_DIR)/$(factory_name); \
425 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
426 fi
427 endef
428
429 #
430 # RT288X Profiles
431 #
432
433 Image/Build/Profile/AR670W=$(call BuildFirmware/AR670W/$(1),$(1),ar670w,AR670W)
434
435 Image/Build/Profile/AR725W=$(call BuildFirmware/Gemtek/$(1),$(1),ar725w,AR725W)
436
437 # 0x790000
438 belkin_f5d8235v1_mtd_size=7929856
439 Image/Build/Profile/F5D8235V1=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v1,F5D8235_V1,$(belkin_f5d8235v1_mtd_size))
440
441 Image/Build/Profile/RTN15=$(call BuildFirmware/Default4M/$(1),$(1),rt-n15,RT-N15)
442
443 Image/Build/Profile/V11STFE=$(call BuildFirmware/Default4M/$(1),$(1),v11st-fe,V11STFE)
444
445 Image/Build/Profile/WLITX4AG300N=$(call BuildFirmware/Default4M/$(1),$(1),wli-tx4-ag300n,WLI-TX4-AG300N)
446
447 Image/Build/Profile/WZRAGL300NH=$(call BuildFirmware/Default4M/$(1),$(1),wzr-agl300nh,WZR-AGL300NH)
448
449 ifeq ($(SUBTARGET),rt288x)
450 define Image/Build/Profile/Default
451 $(call Image/Build/Profile/AR670W,$(1))
452 $(call Image/Build/Profile/AR725W,$(1))
453 $(call Image/Build/Profile/F5D8235V1,$(1))
454 $(call Image/Build/Profile/RTN15,$(1))
455 $(call Image/Build/Profile/V11STFE,$(1))
456 $(call Image/Build/Profile/WLITX4AG300N,$(1))
457 $(call Image/Build/Profile/WZRAGL300NH,$(1))
458 endef
459 endif
460
461
462
463 #
464 # RT305X Profiles
465 #
466
467 Image/Build/Profile/DIR610A1=$(call BuildFirmware/Seama/$(1),$(1),dir-610-a1,DIR-610-A1,wrgn59_dlob.hans_dir610,$(ralink_default_fw_size_4M))
468
469 edimax_3g6200n_mtd_size=3735552
470 Image/Build/Profile/3G6200N=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200n,3G-6200N,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
471
472 Image/Build/Profile/3G6200NL=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200nl,3G-6200NL,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
473
474 Image/Build/Profile/3G300M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),3g300m,3G300M,$(ralink_default_fw_size_4M),3G150M_SPI Kernel Image,factory)
475
476 Image/Build/Profile/A5-V11=$(call BuildFirmware/Poray4M/$(1),$(1),a5-v11,A5-V11)
477
478 Image/Build/Profile/AIR3GII=$(call BuildFirmware/Default4M/$(1),$(1),air3gii,AIR3GII)
479
480 define BuildFirmware/UIMAGE_8M
481 $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7))
482 endef
483 define Image/Build/Profile/ALL02393G
484 $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys)
485 endef
486
487 Image/Build/Profile/ALL0256N=$(call BuildFirmware/DefaultDualSize/$(1),$(1),all0256n,ALL0256N)
488
489 allnet_all5002_mtd_size=33226752
490 Image/Build/Profile/ALL5002=$(call BuildFirmware/CustomFlash/$(1),$(1),all5002,ALL5002,$(allnet_all5002_mtd_size))
491 Image/Build/Profile/ALL5003=$(call BuildFirmware/CustomFlash/$(1),$(1),all5003,ALL5003,$(allnet_all5002_mtd_size))
492
493 argus_atp52b_mtd_size=7995392
494 Image/Build/Profile/ATP-52B=$(call BuildFirmware/CustomFlash/$(1),$(1),atp-52b,ATP-52B,$(argus_atp52b_mtd_size))
495
496 asl26555_8mb_mtd_size=7929856
497 asl26555_16mb_mtd_size=16252928
498 define BuildFirmware/ASL26555/squashfs
499 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-8M,$(3)-8M,$(asl26555_8mb_mtd_size))
500 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-16M,$(3)-16M,$(asl26555_16mb_mtd_size))
501 endef
502 define BuildFirmware/ASL26555/initramfs
503 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
504 $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
505 endef
506 Image/Build/Profile/ASL26555=$(call BuildFirmware/ASL26555/$(1),$(1),asl26555,ASL26555)
507
508 Image/Build/Profile/AWM002EVB=$(call BuildFirmware/DefaultDualSize/$(1),$(1),awm002-evb,AWM002-EVB)
509 Image/Build/Profile/AWM003EVB=$(call BuildFirmware/Default8M/$(1),$(1),awm003-evb,AWM003-EVB)
510 Image/Build/Profile/AWAPN2403=$(call BuildFirmware/Default4M/$(1),$(1),awmapn2403,AWAPN2403)
511
512 Image/Build/Profile/BC2=$(call BuildFirmware/Default8M/$(1),$(1),bc2,BC2)
513
514 broadway_mtd_size=7929856
515 Image/Build/Profile/BROADWAY=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),broadway,BROADWAY,$(broadway_mtd_size),Broadway Kernel Image,factory)
516
517 Image/Build/Profile/CARAMBOLA=$(call BuildFirmware/Default8M/$(1),$(1),carambola,CARAMBOLA)
518
519 Image/Build/Profile/D105=$(call BuildFirmware/Default4M/$(1),$(1),d105,D105)
520
521 define BuildFirmware/DIR300B1/squashfs
522 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
523 -mkwrgimg -s $(4) -d /dev/mtdblock/2 \
524 -i $(call sysupname,$(1),$(2)) \
525 -o $(call imgname,$(1),$(2))-factory.bin
526 endef
527 BuildFirmware/DIR300B1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
528 Image/Build/Profile/DIR-300-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b)
529 Image/Build/Profile/DIR-600-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b)
530 Image/Build/Profile/DIR-600-B2=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b2,DIR-600-B2,wrgn23_dlwbr_dir600b)
531 Image/Build/Profile/DIR-615-D=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-615-d,DIR-615-D,wrgn23_dlwbr_dir615d)
532
533 Image/Build/Profile/DIR-620-A1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-a1,DIR-620-A1)
534 Image/Build/Profile/DIR-620-D1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-d1,DIR-620-D1)
535
536 define BuildFirmware/DIR615H1/squashfs
537 $(call BuildFirmware/Default4M/$(1),$(1),dir-615-h1,DIR-615-H1)
538 -mksenaofw -e $(call sysupname,$(1),dir-615-h1) \
539 -o $(call imgname,$(1),dir-615-h1)-factory.bin \
540 -r 0x218 -p 0x30 -t 3
541 endef
542 BuildFirmware/DIR615H1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),dir-615-h1,DIR-615-H1)
543 Image/Build/Profile/DIR615H1=$(call BuildFirmware/DIR615H1/$(1),$(1))
544
545 Image/Build/Profile/DAP1350=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350,DAP-1350,RT3052-AP-DAP1350-3)
546
547 Image/Build/Profile/DAP1350WW=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350WW,DAP-1350,RT3052-AP-DAP1350WW-3)
548
549 define BuildFirmware/DCS930/squashfs
550 $(call BuildFirmware/Default4M/squashfs,squashfs,$(2),$(3))
551 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/image.$(2).combined bs=1048512 count=1 conv=sync
552 cat $(KDIR)/root.squashfs >> $(KDIR)/image.$(2).combined
553 $(call MkImage,lzma,$(KDIR)/image.$(2).combined,$(KDIR)/image.$(2))
554 $(call prepare_generic_squashfs,$(KDIR)/image.$(2))
555 if [ `stat -c%s "$(KDIR)/image.$(2)"` -gt $(ralink_default_fw_size_4M) ]; then \
556 echo "Warning: $(KDIR)/image.$(2) is too big" >&2; \
557 else \
558 dd if=$(KDIR)/image.$(2) of=$(KDIR)/dcs.tmp bs=64K count=5 conv=sync ;\
559 cat $(KDIR)/image.$(2) >> $(KDIR)/dcs.tmp ; \
560 dd if=$(KDIR)/dcs.tmp of=$(call imgname,$(1),$(2))-factory.bin bs=4096k count=1 conv=sync ;\
561 $(STAGING_DIR_HOST)/bin/mkdcs932 $(call imgname,$(1),$(2))-factory.bin ; \
562 fi
563 endef
564 BuildFirmware/DCS930/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
565 Image/Build/Profile/DCS930=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930,DCS-930)
566 Image/Build/Profile/DCS930LB1=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930l-b1,DCS-930L-B1)
567
568 Image/Build/Profile/ESR-9753=$(call BuildFirmware/Default4M/$(1),$(1),esr-9753,ESR-9753)
569
570 Image/Build/Profile/HW550-3G=$(call BuildFirmware/Default8M/$(1),$(1),hw550-3g,HW550-3G)
571
572 belkin_f5d8235v2_mtd_size=7929856
573 Image/Build/Profile/F5D8235V2=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v2,F5D8235_V2,$(belkin_f5d8235v2_mtd_size))
574
575 # 0x770000
576 belkin_f7c027_mtd_size=7798784
577 Image/Build/Profile/F7C027=$(call BuildFirmware/CustomFlash/$(1),$(1),f7c027,F7C027,$(belkin_f7c027_mtd_size))
578
579 Image/Build/Profile/FONERA20N=$(call BuildFirmware/Edimax/$(1),$(1),fonera20n,FONERA20N,$(ralink_default_fw_size_8M),RSDK,NL1T,0x50000,0xc0000)
580
581 Image/Build/Profile/RT-N13U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n13u,RT-N13U)
582
583 #Image/Build/Profile/HG255D=$(call BuildFirmware/Default16M/$(1),$(1),hg255d,HG255D)
584
585 Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freestation5,FREESTATION5)
586
587 Image/Build/Profile/IP2202=$(call BuildFirmware/Default8M/$(1),$(1),ip2202,IP2202)
588
589 BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))
590 define BuildFirmware/HLKRM04/initramfs
591 $(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
592 mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
593 endef
594 Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)
595
596 Image/Build/Profile/HT-TM02=$(call BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
597
598 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
599
600 Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
601
602 Image/Build/Profile/MOFI3500-3GN=$(call BuildFirmware/Default8M/$(1),$(1),mofi3500-3gn,MOFI3500-3GN)
603
604 # Kernel name should be "Linux Kernel Image" to make the OpenWrt image installable from factory Web UI
605 Image/Build/Profile/3G150B=$(call BuildFirmware/Default4M/$(1),$(1),3g150b,3G150B,Linux Kernel Image)
606
607 Image/Build/Profile/MR102N=$(call BuildFirmware/Default8M/$(1),$(1),mr-102n,MR-102N)
608
609 Image/Build/Profile/MPRA1=$(call BuildFirmware/Default4M/$(1),$(1),mpr-a1,MPRA1,Linux Kernel Image)
610 Image/Build/Profile/MPRA2=$(call BuildFirmware/Default8M/$(1),$(1),mpr-a2,MPRA2,Linux Kernel Image)
611
612 Image/Build/Profile/DIR-300-B7=$(call BuildFirmware/Default4M/$(1),$(1),dir-300-b7,DIR-300-B7)
613 Image/Build/Profile/DIR-320-B1=$(call BuildFirmware/Default8M/$(1),$(1),dir-320-b1,DIR-320-B1)
614
615 Image/Build/Profile/NBG-419N=$(call BuildFirmware/Default4M/$(1),$(1),nbg-419n,NBG-419N)
616
617 Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2,MZK-W300NH2,$(mzkw300nh2_mtd_size),CSYS,RN52,0x50000,0xc0000)
618
619 Image/Build/Profile/NCS601W=$(call BuildFirmware/Default8M/$(1),$(1),ncs601W,NCS601W)
620
621 nw718_mtd_size=3801088
622 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
623
624 Image/Build/Profile/M2M=$(call BuildFirmware/Default8M/$(1),$(1),m2m,M2M,Linux Kernel Image)
625
626 Image/Build/Profile/MINIEMBPLUG=$(call BuildFirmware/Default8M/$(1),$(1),miniembplug,MINIEMBPLUG)
627
628 Image/Build/Profile/MINIEMBWIFI=$(call BuildFirmware/Default8M/$(1),$(1),miniembwifi,MINIEMBWIFI)
629
630 Image/Build/Profile/PSR-680W=$(call BuildFirmware/Default4M/$(1),$(1),psr-680w,PSR-680W)
631
632 Image/Build/Profile/PWH2004=$(call BuildFirmware/Default8M/$(1),$(1),pwh2004,PWH2004)
633
634 Image/Build/Profile/PX-4885=$(call BuildFirmware/DefaultDualSize/$(1),$(1),px-4885,PX-4885)
635
636 Image/Build/Profile/RT5350F-OLINUXINO=$(call BuildFirmware/Default8M/$(1),$(1),rt5350f-olinuxino,RT5350F-OLINUXINO)
637
638 Image/Build/Profile/RT5350F-OLINUXINO-EVB=$(call BuildFirmware/Default8M/$(1),$(1),rt5350f-olinuxino-evb,RT5350F-OLINUXINO-EVB)
639
640 Image/Build/Profile/RTG32B1=$(call BuildFirmware/Default4M/$(1),$(1),rt-g32-b1,RT-G32-B1)
641
642 Image/Build/Profile/RTN10PLUS=$(call BuildFirmware/Default4M/$(1),$(1),rt-n10-plus,RT-N10-PLUS)
643
644 Image/Build/Profile/RUT5XX=$(call BuildFirmware/Default8M/$(1),$(1),rut5xx,RUT5XX)
645
646 Image/Build/Profile/SL-R7205=$(call BuildFirmware/Default4M/$(1),$(1),sl-r7205,SL-R7205)
647
648 Image/Build/Profile/V22RW-2X2=$(call BuildFirmware/Default4M/$(1),$(1),v22rw-2x2,V22RW-2X2)
649
650 vocore_8mb_mtd_size=8060928
651 vocore_16mb_mtd_size=16449536
652 define BuildFirmware/VOCORE/squashfs
653 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-8M,$(3)-8M,$(vocore_8mb_mtd_size))
654 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-16M,$(3)-16M,$(vocore_16mb_mtd_size))
655 endef
656 define BuildFirmware/VOCORE/initramfs
657 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
658 $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
659 endef
660 Image/Build/Profile/VOCORE=$(call BuildFirmware/VOCORE/$(1),$(1),vocore,VOCORE)
661
662 Image/Build/Profile/W150M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w150m,W150M,$(ralink_default_fw_size_4M),W150M Kernel Image,factory)
663
664 Image/Build/Profile/W306R_V20=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w306r-v20,W306R_V20,$(ralink_default_fw_size_4M),linkn Kernel Image,factory)
665
666 Image/Build/Profile/W502U=$(call BuildFirmware/Default8M/$(1),$(1),w502u,W502U)
667
668 Image/Build/Profile/WCR150GN=$(call BuildFirmware/Default4M/$(1),$(1),wcr150gn,WCR150GN)
669
670 Image/Build/Profile/MZK-DP150N=$(call BuildFirmware/Default4M/$(1),$(1),mzk-dp150n,MZK-DP150N)
671
672 buffalo_whrg300n_mtd_size=3801088
673 define BuildFirmware/WHRG300N/squashfs
674 $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
675 # the following line has a bad argument 3 ... the old Makefile was already broken
676 $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
677 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
678 ( \
679 echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
680 dd bs=512 count=1 conv=sync; \
681 dd if=$(call sysupname,$(1),whr-g300n); \
682 ) > $(KDIR)/whr-g300n-tftp.tmp && \
683 buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
684 -o $(call imgname,$(1),whr-g300n)-tftp.bin; \
685 fi
686 endef
687 BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
688 Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
689
690 Image/Build/Profile/WIZARD8800=$(call BuildFirmware/Default8M/$(1),$(1),wizard-8800,WIZARD8800,Linux Kernel Image)
691
692 Image/Build/Profile/WIZFI630A=$(call BuildFirmware/Default16M/$(1),$(1),wizfi630a,WIZFI630A)
693
694 Image/Build/Profile/WL-330N=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n,WL-330N)
695
696 Image/Build/Profile/WL-330N3G=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n3g,WL-330N3G)
697
698 kernel_size_wl341v3=917504
699 rootfs_size_wl341v3=2949120
700 define BuildFirmware/WL-341V3/squashfs
701 $(call BuildFirmware/Default4M/$(1),$(1),wl-341v3,WL-341V3)
702 # This code looks broken and really needs to be converted to C
703 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
704 ( \
705 dd if=/dev/zero bs=195936 count=1; \
706 echo "1.01"; \
707 dd if=/dev/zero bs=581 count=1; \
708 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"; \
709 dd if=/dev/zero bs=65552 count=1; \
710 dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \
711 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
712 dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
713 echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
714 ) > $(call imgname,$(1),$(2))-factory.bin; \
715 fi
716 endef
717 BuildFirmware/WL-341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl-341v3,WL-341V3)
718 Image/Build/Profile/WL-341V3=$(call BuildFirmware/WL-341V3/$(1),$(1))
719
720 Image/Build/Profile/WL-351=$(call BuildFirmware/Default4M/$(1),$(1),wl-351,WL-351)
721
722 define BuildFirmware/WNCE2001/squashfs
723 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
724 -mkdapimg -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 \
725 -i $(call sysupname,$(1),$(2)) \
726 -o $(call imgname,$(1),$(2))-factory-worldwide.bin
727 -mkdapimg -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 \
728 -i $(call sysupname,$(1),$(2)) \
729 -o $(call imgname,$(1),$(2))-factory-northamerica.bin
730 endef
731 BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
732 Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001)
733
734 Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN)
735
736 Image/Build/Profile/WT1520=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt1520,WT1520)
737
738 Image/Build/Profile/UR-326N4G=$(call BuildFirmware/Default4M/$(1),$(1),ur-326n4g,UR-326N4G)
739
740 Image/Build/Profile/UR-336UN=$(call BuildFirmware/Default8M/$(1),$(1),ur-336un,UR-336UN)
741
742 Image/Build/Profile/WR6202=$(call BuildFirmware/Default8M/$(1),$(1),wr6202,WR6202)
743
744 Image/Build/Profile/X5=$(call BuildFirmware/Poray8M/$(1),$(1),x5,X5)
745
746 Image/Build/Profile/X8=$(call BuildFirmware/Poray8M/$(1),$(1),x8,X8)
747
748 Image/Build/Profile/XDXRN502J=$(call BuildFirmware/Default4M/$(1),$(1),xdxrn502j,XDXRN502J)
749
750 ifeq ($(SUBTARGET),rt305x)
751 define Image/Build/Profile/Default
752 $(call Image/Build/Profile/3G6200N,$(1))
753 $(call Image/Build/Profile/3G6200NL,$(1))
754 $(call Image/Build/Profile/3G150B,$(1))
755 $(call Image/Build/Profile/3G300M,$(1))
756 $(call Image/Build/Profile/A5-V11,$(1))
757 $(call Image/Build/Profile/AIR3GII,$(1))
758 $(call Image/Build/Profile/ALL02393G,$(1))
759 $(call Image/Build/Profile/ALL0256N,$(1))
760 $(call Image/Build/Profile/ALL5002,$(1))
761 $(call Image/Build/Profile/ALL5003,$(1))
762 $(call Image/Build/Profile/ASL26555,$(1))
763 $(call Image/Build/Profile/ATP-52B,$(1))
764 $(call Image/Build/Profile/AWM002EVB,$(1))
765 $(call Image/Build/Profile/AWAPN2403,$(1))
766 $(call Image/Build/Profile/BC2,$(1))
767 $(call Image/Build/Profile/BROADWAY,$(1))
768 $(call Image/Build/Profile/CARAMBOLA,$(1))
769 $(call Image/Build/Profile/D105,$(1))
770 $(call Image/Build/Profile/DIR-300-B1,$(1))
771 $(call Image/Build/Profile/DIR-600-B1,$(1))
772 $(call Image/Build/Profile/DIR-300-B7,$(1))
773 $(call Image/Build/Profile/DIR-320-B1,$(1))
774 $(call Image/Build/Profile/DIR-600-B2,$(1))
775 $(call Image/Build/Profile/DIR610A1,$(1))
776 $(call Image/Build/Profile/DIR-615-D,$(1))
777 $(call Image/Build/Profile/DIR-620-A1,$(1))
778 $(call Image/Build/Profile/DIR-620-D1,$(1))
779 $(call Image/Build/Profile/DIR615H1,$(1))
780 $(call Image/Build/Profile/DAP1350,$(1))
781 $(call Image/Build/Profile/DAP1350WW,$(1))
782 $(call Image/Build/Profile/DCS930,$(1))
783 $(call Image/Build/Profile/DCS930LB1,$(1))
784 $(call Image/Build/Profile/ESR-9753,$(1))
785 $(call Image/Build/Profile/F7C027,$(1))
786 $(call Image/Build/Profile/F5D8235V2,$(1))
787 $(call Image/Build/Profile/FONERA20N,$(1))
788 $(call Image/Build/Profile/FREESTATION5,$(1))
789 # $(call Image/Build/Profile/HG255D,$(1))
790 $(call Image/Build/Profile/HLKRM04,$(1))
791 $(call Image/Build/Profile/HT-TM02,$(1))
792 $(call Image/Build/Profile/HW550-3G,$(1))
793 $(call Image/Build/Profile/IP2202,$(1))
794 $(call Image/Build/Profile/M2M,$(1))
795 $(call Image/Build/Profile/M3,$(1))
796 $(call Image/Build/Profile/M4,$(1))
797 $(call Image/Build/Profile/MOFI3500-3GN,$(1))
798 $(call Image/Build/Profile/MR102N,$(1))
799 $(call Image/Build/Profile/MPRA1,$(1))
800 $(call Image/Build/Profile/MPRA2,$(1))
801 $(call Image/Build/Profile/MZKW300NH2,$(1))
802 $(call Image/Build/Profile/NBG-419N,$(1))
803 $(call Image/Build/Profile/NCS601W,$(1))
804 $(call Image/Build/Profile/NW718,$(1))
805 $(call Image/Build/Profile/MINIEMBWIFI,$(1))
806 $(call Image/Build/Profile/MINIEMBPLUG,$(1))
807 $(call Image/Build/Profile/PSR-680W,$(1))
808 $(call Image/Build/Profile/PWH2004,$(1))
809 $(call Image/Build/Profile/PX-4885,$(1))
810 $(call Image/Build/Profile/RT5350F-OLINUXINO,$(1))
811 $(call Image/Build/Profile/RT5350F-OLINUXINO-EVB,$(1))
812 $(call Image/Build/Profile/RTG32B1,$(1))
813 $(call Image/Build/Profile/RTN10PLUS,$(1))
814 $(call Image/Build/Profile/RT-N13U,$(1))
815 $(call Image/Build/Profile/RUT5XX,$(1))
816 $(call Image/Build/Profile/SL-R7205,$(1))
817 $(call Image/Build/Profile/UR-326N4G,$(1))
818 $(call Image/Build/Profile/V22RW-2X2,$(1))
819 $(call Image/Build/Profile/VOCORE,$(1))
820 $(call Image/Build/Profile/W150M,$(1))
821 $(call Image/Build/Profile/W306R_V20,$(1))
822 $(call Image/Build/Profile/W502U,$(1))
823 $(call Image/Build/Profile/WCR150GN,$(1))
824 $(call Image/Build/Profile/WHRG300N,$(1))
825 $(call Image/Build/Profile/WIZARD8800,$(1))
826 $(call Image/Build/Profile/WIZFI630A,$(1))
827 $(call Image/Build/Profile/WL-330N,$(1))
828 $(call Image/Build/Profile/WL-330N3G,$(1))
829 $(call Image/Build/Profile/WL-341V3,$(1))
830 $(call Image/Build/Profile/WL-351,$(1))
831 $(call Image/Build/Profile/WNCE2001,$(1))
832 $(call Image/Build/Profile/WR512-3GN,$(1))
833 $(call Image/Build/Profile/WR6202,$(1))
834 $(call Image/Build/Profile/WT1520,$(1))
835 $(call Image/Build/Profile/X5,$(1))
836 $(call Image/Build/Profile/X8,$(1))
837 $(call Image/Build/Profile/XDXRN502J,$(1))
838 $(call Image/Build/Profile/MZK-DP150N,$(1))
839
840 endef
841 endif
842
843
844
845 #
846 # RT3662/RT3883 Profiles
847 #
848
849 # $(1) = squashfs/initramfs
850 # $(2) = lowercase board name
851 # $(3) = dts file
852 # $(4) = kernel size
853 # $(5) = rootfs size
854 # $(6) = signature
855 # $(7) = model
856 # $(8) = flash address
857 # $(9) = start address
858 define BuildFirmware/EdimaxCombined/squashfs
859 $(call PatchKernelLzmaDtb,$(2),$(3))
860 $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).bin.uImage)
861 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.uImage"` -gt `expr $(4) - 20` ]; then \
862 echo "Warning: $(KDIR)/vmlinux-$(2).bin.uImage is too big" >&2; \
863 exit 1; \
864 else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
865 echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
866 exit 1; \
867 else \
868 ( dd if=$(KDIR)/vmlinux-$(2).bin.uImage bs=`expr $(4) - 20` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.uImage.combined ; \
869 fi ; fi
870 mkedimaximg -i "$(KDIR)/vmlinux-$(2).bin.uImage.combined" \
871 -o $(call imgname,$(1),$(2)).bin \
872 -s $(6) -m $(7) -f $(8) -S $(9)
873 endef
874
875 Image/Build/Profile/CYSWR1100=$(call BuildFirmware/Seama/$(1),$(1),cy-swr1100,CY-SWR1100,wrgnd10_samsung_ss815,$(ralink_default_fw_size_8M))
876
877 Image/Build/Profile/DIR645=$(call BuildFirmware/Seama/$(1),$(1),dir-645,DIR-645,wrgn39_dlob.hans_dir645,$(ralink_default_fw_size_8M))
878
879 hpm_mtd_size=16449536
880 Image/Build/Profile/HPM=$(call BuildFirmware/CustomFlash/$(1),$(1),hpm,HPM,$(hpm_mtd_size))
881
882 define BuildFirmware/RTN56U/squashfs
883 $(call BuildFirmware/Default8M/$(1),$(1),rt-n56u,RT-N56U)
884 -mkrtn56uimg -s $(call sysupname,$(1),rt-n56u)
885 -cp $(call sysupname,$(1),rt-n56u) $(call imgname,$(1),rt-n56u)-factory.bin
886 -mkrtn56uimg -f $(call imgname,$(1),rt-n56u)-factory.bin
887 endef
888 Image/Build/Profile/RTN56U=$(call BuildFirmware/RTN56U/$(1),$(1),rt-n56u,RT-N56U)
889
890 Image/Build/Profile/TEW691GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-691gr,TEW-691GR,0x026910)
891
892 Image/Build/Profile/TEW692GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-692gr,TEW-692GR,0x026920)
893
894 kernel_size_BR6475ND:=2097152
895 rootfs_size_BR6475ND:=5832704
896 Image/Build/Profile/BR6475ND=$(call BuildFirmware/EdimaxCombined/$(1),$(1),br-6475nd,BR-6475ND,$(kernel_size_BR6475ND),$(rootfs_size_BR6475ND),CSYS,RN54,0x70000,0x01100000)
897
898 ifeq ($(SUBTARGET),rt3883)
899 define Image/Build/Profile/Default
900 $(call Image/Build/Profile/CYSWR1100,$(1))
901 $(call Image/Build/Profile/DIR645,$(1))
902 $(call Image/Build/Profile/HPM,$(1))
903 $(call Image/Build/Profile/RTN56U,$(1))
904 $(call Image/Build/Profile/BR6475ND,$(1))
905 $(call Image/Build/Profile/TEW691GR,$(1))
906 $(call Image/Build/Profile/TEW692GR,$(1))
907 endef
908 endif
909
910 #
911 # MT7620A Profiles
912 #
913
914 Image/Build/Profile/E1700=$(call BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
915 Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
916 Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
917 Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
918 Image/Build/Profile/MT7620a_V22SG=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_v22sg,MT7620a_V22SG)
919 br100_mtd_size=8126464
920 Image/Build/Profile/AI-BR100=$(call BuildFirmware/CustomFlash/$(1),$(1),ai-br100,AI-BR100,$(br100_mtd_size),Ai-BR)
921 Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp-n53,RP-N53)
922 whr_300hp2_mtd_size=7012352
923 Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300hp2,WHR-300HP2,$(whr_300hp2_mtd_size))
924 Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
925 whr_1166d_mtd_size=15400960
926 Image/Build/Profile/WHR1166D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-1166d,WHR-1166D,$(whr_1166d_mtd_size))
927 dlink810l_mtd_size=6881280
928 Image/Build/Profile/CF-WR800N=$(call BuildFirmware/Default8M/$(1),$(1),cf-wr800n,CF-WR800N)
929 Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
930 na930_mtd_size=20971520
931 Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
932 Image/Build/Profile/DB-WRT01=$(call BuildFirmware/Default8M/$(1),$(1),db-wrt01,DB-WRT01)
933 Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
934 Image/Build/Profile/HC5661=$(call BuildFirmware/Default16M/$(1),$(1),hc5661,HC5661)
935 Image/Build/Profile/HC5761=$(call BuildFirmware/Default16M/$(1),$(1),hc5761,HC5761)
936 Image/Build/Profile/HC5861=$(call BuildFirmware/Default16M/$(1),$(1),hc5861,HC5861)
937 Image/Build/Profile/OY-0001=$(call BuildFirmware/Default16M/$(1),$(1),oy-0001,OY-0001)
938 Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),y1,Y1)
939 Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),y1s,Y1S)
940 Image/Build/Profile/MLW221=$(call BuildFirmware/Default16M/$(1),$(1),mlw221,MLW221)
941 Image/Build/Profile/MLWG2=$(call BuildFirmware/Default16M/$(1),$(1),mlwg2,MLWG2)
942 Image/Build/Profile/WMR-300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR-300)
943 Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
944 Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
945 Image/Build/Profile/WT3020=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020)
946 Image/Build/Profile/MIWIFI-MINI=$(call BuildFirmware/Default16M/$(1),$(1),miwifi-mini,MIWIFI-MINI)
947 Image/Build/Profile/ZTE-Q7=$(call BuildFirmware/Default8M/$(1),$(1),zte-q7,ZTE-Q7)
948 Image/Build/Profile/YOUKU-YK1=$(call BuildFirmware/Default16M/$(1),$(1),youku-yk1,YOUKU-YK1)
949 Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05)
950 Image/Build/Profile/ZBT-WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wr8305rt,ZBT-WR8305RT)
951 Image/Build/Profile/ArcherC20i=$(call BuildFirmware/Tplink/$(1),$(1),ArcherC20i,ArcherC20i)
952 microwrt_mtd_size=16515072
953 Image/Build/Profile/MicroWRT=$(call BuildFirmware/CustomFlash/$(1),$(1),microwrt,MicroWRT,$(microwrt_mtd_size))
954 Image/Build/Profile/TINY-AC=$(call BuildFirmware/Default8M/$(1),$(1),tiny-ac,TINY-AC)
955
956
957 ifeq ($(SUBTARGET),mt7620)
958 define Image/Build/Profile/Default
959 $(call Image/Build/Profile/E1700,$(1))
960 $(call Image/Build/Profile/MT7620a,$(1))
961 $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
962 $(call Image/Build/Profile/MT7620a_MT7530,$(1))
963 $(call Image/Build/Profile/MT7620a_V22SG,$(1))
964 $(call Image/Build/Profile/AI-BR100,$(1))
965 $(call Image/Build/Profile/CF-WR800N,$(1))
966 $(call Image/Build/Profile/RP-N53,$(1))
967 $(call Image/Build/Profile/DIR-810L,$(1))
968 $(call Image/Build/Profile/WHR300HP2,$(1))
969 $(call Image/Build/Profile/WHR600D,$(1))
970 $(call Image/Build/Profile/WHR1166D,$(1))
971 $(call Image/Build/Profile/DB-WRT01,$(1))
972 $(call Image/Build/Profile/MZK-750DHP,$(1))
973 $(call Image/Build/Profile/NA930,$(1))
974 $(call Image/Build/Profile/HC5661,$(1))
975 $(call Image/Build/Profile/HC5761,$(1))
976 $(call Image/Build/Profile/HC5861,$(1))
977 $(call Image/Build/Profile/OY-0001,$(1))
978 $(call Image/Build/Profile/Y1,$(1))
979 $(call Image/Build/Profile/Y1S,$(1))
980 $(call Image/Build/Profile/MLW221,$(1))
981 $(call Image/Build/Profile/MLWG2,$(1))
982 $(call Image/Build/Profile/WMR-300,$(1))
983 $(call Image/Build/Profile/RT-N14U,$(1))
984 $(call Image/Build/Profile/WRTNODE,$(1))
985 $(call Image/Build/Profile/WT3020,$(1))
986 $(call Image/Build/Profile/MIWIFI-MINI,$(1))
987 $(call Image/Build/Profile/ZTE-Q7,$(1))
988 $(call Image/Build/Profile/YOUKU-YK1,$(1))
989 $(call Image/Build/Profile/ZBT-WA05,$(1))
990 $(call Image/Build/Profile/ZBT-WR8305RT,$(1))
991 $(call Image/Build/Profile/ArcherC20i,$(1))
992 $(call Image/Build/Profile/MicroWRT,$(1))
993 $(call Image/Build/Profile/TINY-AC,$(1))
994 endef
995 endif
996
997 #
998 # MT7621 Profiles
999 #
1000
1001 ifeq ($(SUBTARGET),mt7621)
1002 TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 ubnt-erx witi wf-2881 zbt-wg2626
1003 endif
1004
1005 define Device/mt7621
1006 DTS := MT7621
1007 IMAGE_SIZE := $(ralink_default_fw_size_4M)
1008 endef
1009
1010 define Device/wsr-600
1011 DTS := WSR-600
1012 endef
1013
1014 define Device/re6500
1015 DTS := RE6500
1016 endef
1017
1018 define Device/wsr-1166
1019 DTS := WSR-1166
1020 IMAGE/sysupgrade.bin := trx | pad-rootfs
1021 endef
1022
1023 define Device/dir-860l-b1
1024 DTS := DIR-860L-B1
1025 IMAGES += factory.bin
1026 KERNEL := kernel-bin | patch-dtb | relocate-kernel | lzma | uImage lzma
1027 IMAGE/sysupgrade.bin := \
1028 append-kernel | pad-offset 65536 64 | append-rootfs | \
1029 seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
1030 pad-rootfs | check-size $$$$(IMAGE_SIZE)
1031 IMAGE/factory.bin := \
1032 append-kernel | pad-offset 65536 64 | append-rootfs | pad-rootfs -x 64 | \
1033 seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
1034 check-size $$$$(IMAGE_SIZE) | \
1035 seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb"
1036 endef
1037
1038 define Device/firewrt
1039 DTS := FIREWRT
1040 IMAGE_SIZE := $(ralink_default_fw_size_16M)
1041 endef
1042
1043 define Device/pbr-m1
1044 DTS := PBR-M1
1045 IMAGE_SIZE := $(ralink_default_fw_size_16M)
1046 endef
1047
1048 define Device/sap-g3200u3
1049 DTS := SAP-G3200U3
1050 endef
1051
1052 define Device/witi
1053 DTS := WITI
1054 IMAGE_SIZE := $(ralink_default_fw_size_16M)
1055 endef
1056
1057 define Device/zbt-wg2626
1058 DTS := ZBT-WG2626
1059 IMAGE_SIZE := $(ralink_default_fw_size_16M)
1060 endef
1061
1062 define Device/wf-2881
1063 DTS := WF-2881
1064 BLOCKSIZE := 128KiB
1065 PAGESIZE := 2048
1066 KERNEL_SIZE := 2097152
1067 FILESYSTEMS := squashfs
1068 IMAGE/sysupgrade.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
1069 endef
1070
1071 define Device/ubnt-erx
1072 DTS := UBNT-ERX
1073 FILESYSTEMS := squashfs
1074 KERNEL_SIZE := 3145728
1075 KERNEL := $(KERNEL_DTB) | uImage lzma
1076 IMAGES := sysupgrade.tar factory-initramfs.tar
1077 IMAGE/factory-initramfs.tar := ubnt-erx-factory-compat | \
1078 ubnt-erx-factory-kernel | \
1079 ubnt-erx-factory-rootfs | \
1080 ubnt-erx-factory-version | \
1081 ubnt-erx-factory-check-size $$$$(KERNEL_SIZE)
1082 IMAGE/sysupgrade.tar := sysupgrade-nand
1083 endef
1084
1085 #
1086 # MT7628 Profiles
1087 #
1088
1089 Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
1090
1091 ifeq ($(SUBTARGET),mt7628)
1092 define Image/Build/Profile/Default
1093 $(call Image/Build/Profile/MT7628,$(1))
1094 endef
1095 endif
1096
1097
1098 #
1099 # MT7688 Profiles
1100 #
1101
1102 Image/Build/Profile/mt7688=$(call BuildFirmware/Default16M/$(1),$(1),mt7688,MT7688)
1103 Image/Build/Profile/LinkIt7688=$(call BuildFirmware/Default32M/$(1),$(1),LinkIt7688,LINKIT7688)
1104
1105 ifeq ($(SUBTARGET),mt7688)
1106 define Image/Build/Profile/Default
1107 $(call Image/Build/Profile/mt7688,$(1))
1108 $(call Image/Build/Profile/LinkIt7688,$(1))
1109 endef
1110 endif
1111
1112
1113 ifndef TARGET_DEVICES
1114 #
1115 # Generic Targets - only needed for legacy image building code
1116 #
1117 define Image/BuildKernel
1118 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
1119 cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
1120 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
1121 $(call MkImage,lzma,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
1122 cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(UIMAGE).bin
1123 endef
1124
1125 define Image/BuildKernel/Initramfs
1126 cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(VMLINUX)-initramfs.elf
1127 cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(VMLINUX)-initramfs.bin
1128 $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
1129 $(call MkImage,lzma,$(KDIR)/vmlinux-initramfs.bin.lzma,$(KDIR)/uImage-initramfs.lzma)
1130 cp $(KDIR)/uImage-initramfs.lzma $(BIN_DIR)/$(UIMAGE)-initramfs.bin
1131 $(call Image/Build/Initramfs)
1132 endef
1133
1134 define Image/Build
1135 $(call Image/Build/$(1))
1136 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
1137 $(call Image/Build/Profile/$(PROFILE),$(1))
1138 endef
1139 endif
1140
1141 ifeq ($(SUBTARGET),mt7621)
1142 define Image/Prepare
1143 #define Build/Compile
1144 rm -rf $(KDIR)/relocate
1145 $(CP) ../../generic/image/relocate $(KDIR)
1146 $(MAKE) -C $(KDIR)/relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
1147 $(CP) $(KDIR)/relocate/loader.bin $(KDIR)/loader.bin
1148 endef
1149 endif
1150
1151 $(eval $(call BuildImage))