ramips: add support for dir810l and asus rp-n53
[openwrt/staging/chunkeey.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 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
22 define Image/Build/Initramfs
23 $(call Image/Build/Profile/$(PROFILE),initramfs)
24 endef
25 endif
26
27 ifeq ($(CONFIG_SOC_RT288X),y)
28 define kernel_entry
29 -a 0x88000000 -e 0x88000000
30 endef
31 else
32 define kernel_entry
33 -a 0x80000000 -e 0x80000000
34 endef
35 endif
36
37 define MkCombineduImage
38 $(call PatchKernelLzma,$(2),$(3))
39 if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
40 echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \
41 else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
42 echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
43 else \
44 ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 64` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined ; \
45 fi ; fi
46 $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(call sysupname,$(1),$(2)),$(6))
47 endef
48
49
50 #
51 # The real magic happens inside these templates
52 #
53
54 define MkImage
55 $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION)))
56 -mkimage -A mips -O linux -T kernel -C $(1) $(call kernel_entry)\
57 -n "$(imagename)" \
58 -d $(2) $(3)
59 endef
60
61 define CompressLzma
62 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
63 endef
64
65 define MkImageSysupgrade/squashfs
66 $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
67 cat $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) > $(KDIR)/$(output_name)
68 $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
69 if [ `stat -c%s "$(KDIR)/$(output_name)"` -gt $(3) ]; then \
70 echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
71 else \
72 $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
73 fi
74 endef
75
76 define PatchKernelLzmaDtb
77 cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
78 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
79 $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
80 $(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
81 endef
82
83 define MkImageLzmaDtb
84 $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
85 $(call MkImage,lzma,$(KDIR)/vmlinux-$(1)$(4).bin.lzma,$(KDIR)/vmlinux-$(1)$(4).uImage,$(3))
86 endef
87
88 define BuildFirmware/OF
89 $(call MkImageLzmaDtb,$(2),$(3),$(5))
90 $(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6))
91 endef
92
93 define BuildFirmware/OF/initramfs
94 $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs)
95 $(CP) $(KDIR)/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin
96 endef
97
98
99 # Build images for default ralink layout for 4MB flash
100 # kernel + roots = 0x3b0000
101 # $(1) = squashfs/initramfs
102 # $(2) = lowercase board name
103 # $(3) = dts file
104 ralink_default_fw_size_4M=3866624
105 BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M))
106 BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
107
108 # Build images for default ralink layout for 8MB flash
109 # kernel + roots = 0x7b0000
110 # $(1) = squashfs/initramfs
111 # $(2) = lowercase board name
112 # $(3) = dts file
113 ralink_default_fw_size_8M=8060928
114 BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
115 BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
116
117 ralink_default_fw_size_16M=16121856
118 BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
119 BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
120
121 # Build images for a custom sized flash layout
122 # $(1) = squashfs/initramfs
123 # $(2) = lowercase board name
124 # $(3) = dts file
125 # $(4) = kernel + rootfs size
126 BuildFirmware/CustomFlash/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(4),$(5),$(6))
127 BuildFirmware/CustomFlash/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
128
129 # wrappers for boards that have 4MB and 8MB versions
130 define BuildFirmware/DefaultDualSize/squashfs
131 $(call BuildFirmware/Default4M/$(1),$(1),$(2)-4M,$(3)-4M)
132 $(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
133 endef
134 define BuildFirmware/DefaultDualSize/initramfs
135 $(call BuildFirmware/OF/initramfs,$(1),$(2)-4M,$(3)-4M)
136 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
137 endef
138
139 # Some boards need a special header inside the uImage to make them bootable
140 define BuildFirmware/CustomFlashFactory/squashfs
141 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4))
142 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4),$(5),$(6))
143 endef
144 BuildFirmware/CustomFlashFactory/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
145
146 # sign an image to make it work with edimax tftp recovery
147 define BuildFirmware/Edimax/squashfs
148 $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
149 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
150 mkedimaximg -i $(call sysupname,$(1),$(2)) \
151 -o $(call imgname,$(1),$(2))-factory.bin \
152 -s $(5) -m $(6) -f $(7) -S $(8); \
153 fi
154 endef
155 BuildFirmware/Edimax/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
156
157 # build Seama header images
158 define BuildFirmware/Seama/squashfs
159 $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
160 cat $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/root.$(1) > $(KDIR)/img_$(2).$(1).tmp
161 if [ `stat -c%s "$(KDIR)/img_$(2).$(1).tmp"` -gt $$$$(($(4) - 64)) ]; then \
162 echo "Warning: $(KDIR)/img_$(2).$(1).tmp is too big" >&2; \
163 else \
164 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=64k conv=sync; \
165 ( \
166 dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64`; \
167 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
168 ) > $(KDIR)/vmlinux-$(2).tmp; \
169 $(STAGING_DIR_HOST)/bin/seama \
170 -i $(KDIR)/vmlinux-$(2).tmp \
171 -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
172 $(STAGING_DIR_HOST)/bin/seama \
173 -s $(call imgname,$(1),$(2))-factory.bin \
174 -m "signature=$(4)" \
175 -i $(KDIR)/vmlinux-$(2).tmp.seama; \
176 fi
177 endef
178 BuildFirmware/Seama/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
179
180 # sign Buffalo images
181 define BuildFirmware/Buffalo
182 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
183 buffalo-enc -p $(3) -v 1.76 \
184 -i $(KDIR)/vmlinux-$(2).uImage \
185 -o $(KDIR)/vmlinux-$(2).uImage.enc; \
186 buffalo-enc -p $(3) -v 1.76 \
187 -i $(KDIR)/root.$(1) \
188 -o $(KDIR)/root.$(2).enc; \
189 buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \
190 -l mlang8 -f 1 -r EU \
191 -i $(KDIR)/vmlinux-$(2).uImage.enc \
192 -i $(KDIR)/root.$(2).enc \
193 -o $(call imgname,$(1),$(2))-factory-EU.bin; \
194 fi
195 endef
196
197 # sign trednet / UMedia images
198 define BuildFirmware/UMedia/squashfs
199 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
200 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
201 fix-u-media-header -T 0x46 -B $(4) \
202 -i $(call sysupname,$(1),$(2)) \
203 -o $(call imgname,$(1),$(2))-factory.bin; \
204 fi
205 endef
206 BuildFirmware/UMedia/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
207
208 # sign dap 1350 based images
209 dap1350_mtd_size=7667712
210 define BuildFirmware/dap1350/squashfs
211 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(dap1350_mtd_size))
212 -mkdapimg -s $(4) \
213 -i $(call sysupname,$(1),$(2)) \
214 -o $(call imgname,$(1),$(2))-factory.bin
215 endef
216 BuildFirmware/dap1350/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
217
218 # Sign Poray images
219 define BuildFirmware/Poray4M/squashfs
220 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
221 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
222 mkporayfw -B $(3) -F 4M \
223 -f $(call sysupname,$(1),$(2)) \
224 -o $(call imgname,$(1),$(2))-factory.bin; \
225 fi
226 endef
227 BuildFirmware/Poray4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
228
229 define BuildFirmware/Poray8M/squashfs
230 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
231 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
232 mkporayfw -B $(3) -F 8M \
233 -f $(call sysupname,$(1),$(2)) \
234 -o $(call imgname,$(1),$(2))-factory.bin; \
235 fi
236 endef
237 BuildFirmware/Poray8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
238
239 define BuildFirmware/PorayDualSize/squashfs
240 $(call BuildFirmware/DefaultDualSize/$(1),$(1),$(2),$(3))
241 if [ -e "$(call sysupname,$(1),$(2)-4M)" ]; then \
242 mkporayfw -B $(3) -F 4M \
243 -f $(call sysupname,$(1),$(2)-4M) \
244 -o $(call imgname,$(1),$(2))-4M-factory.bin; \
245 fi
246 if [ -e "$(call sysupname,$(1),$(2)-8M)" ]; then \
247 mkporayfw -B $(3) -F 8M \
248 -f $(call sysupname,$(1),$(2)-8M) \
249 -o $(call imgname,$(1),$(2))-8M-factory.bin; \
250 fi
251 endef
252 BuildFirmware/PorayDualSize/initramfs=$(call BuildFirmware/DefaultDualSize/initramfs,$(1),$(2),$(3))
253
254 #
255 # RT288X Profiles
256 #
257
258 # 0x790000
259 belkin_f5d8235v1_mtd_size=7929856
260 Image/Build/Profile/F5D8235V1=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v1,F5D8235_V1,$(belkin_f5d8235v1_mtd_size))
261
262 Image/Build/Profile/RTN15=$(call BuildFirmware/Default4M/$(1),$(1),rt-n15,RT-N15)
263
264 Image/Build/Profile/V11STFE=$(call BuildFirmware/Default4M/$(1),$(1),v11st-fe,V11STFE)
265
266 Image/Build/Profile/WLITX4AG300N=$(call BuildFirmware/Default4M/$(1),$(1),wli-tx4-ag300n,WLI-TX4-AG300N)
267
268 ifeq ($(SUBTARGET),rt288x)
269 define Image/Build/Profile/Default
270 $(call Image/Build/Profile/F5D8235V1,$(1))
271 $(call Image/Build/Profile/RTN15,$(1))
272 $(call Image/Build/Profile/V11STFE,$(1))
273 $(call Image/Build/Profile/WLITX4AG300N,$(1))
274 endef
275 endif
276
277
278
279 #
280 # RT305X Profiles
281 #
282
283 edimax_3g6200n_mtd_size=3735552
284 Image/Build/Profile/3G6200N=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200n,3G-6200N,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
285
286 Image/Build/Profile/3G6200NL=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200nl,3G-6200NL,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
287
288 Image/Build/Profile/3G300M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),3g300m,3G300M,$(ralink_default_fw_size_4M),3G150M_SPI Kernel Image,factory)
289
290 Image/Build/Profile/AIR3GII=$(call BuildFirmware/Default4M/$(1),$(1),air3gii,AIR3GII)
291
292 define BuildFirmware/UIMAGE_8M
293 $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7))
294 endef
295 define Image/Build/Profile/ALL02393G
296 $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys)
297 endef
298
299 Image/Build/Profile/ALL0256N=$(call BuildFirmware/DefaultDualSize/$(1),$(1),all0256n,ALL0256N)
300
301 allnet_all5002_mtd_size=33226752
302 Image/Build/Profile/ALL5002=$(call BuildFirmware/CustomFlash/$(1),$(1),all5002,ALL5002,$(allnet_all5002_mtd_size))
303 Image/Build/Profile/ALL5003=$(call BuildFirmware/CustomFlash/$(1),$(1),all5003,ALL5003,$(allnet_all5002_mtd_size))
304
305 argus_atp52b_mtd_size=7995392
306 Image/Build/Profile/ARGUS_ATP52B=$(call BuildFirmware/CustomFlash/$(1),$(1),argus_atp52b,ARGUS_ATP52B,$(argus_atp52b_mtd_size))
307
308 asl26555_8mb_mtd_size=7929856
309 asl26555_16mb_mtd_size=16252928
310 define BuildFirmware/ASL26555/squashfs
311 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-8M,$(3)-8M,$(asl26555_8mb_mtd_size))
312 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-16M,$(3)-16M,$(asl26555_16mb_mtd_size))
313 endef
314 define BuildFirmware/ASL26555/initramfs
315 $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
316 $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
317 endef
318 Image/Build/Profile/ASL26555=$(call BuildFirmware/ASL26555/$(1),$(1),asl26555,ASL26555)
319
320 Image/Build/Profile/AWM002-EVB=$(call BuildFirmware/DefaultDualSize/$(1),$(1),awm002-evb,AWM002-EVB)
321
322 Image/Build/Profile/BC2=$(call BuildFirmware/Default8M/$(1),$(1),bc2,BC2)
323
324 broadway_mtd_size=7929856
325 Image/Build/Profile/BROADWAY=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),broadway,BROADWAY,$(broadway_mtd_size),Broadway Kernel Image,factory)
326
327 Image/Build/Profile/CARAMBOLA=$(call BuildFirmware/Default8M/$(1),$(1),carambola,CARAMBOLA)
328
329 Image/Build/Profile/D105=$(call BuildFirmware/Default4M/$(1),$(1),d105,D105)
330
331 define BuildFirmware/DIR300B1/squashfs
332 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
333 -mkwrgimg -s $(4) -d /dev/mtdblock/2 \
334 -i $(call sysupname,$(1),$(2)) \
335 -o $(call imgname,$(1),$(2))-factory.bin
336 endef
337 BuildFirmware/DIR300B1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
338 Image/Build/Profile/DIR-300-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b)
339 Image/Build/Profile/DIR-600-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b)
340 Image/Build/Profile/DIR-600-B2=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b2,DIR-600-B2,wrgn23_dlwbr_dir600b)
341 Image/Build/Profile/DIR-615-D=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-615-d,DIR-615-D,wrgn23_dlwbr_dir615d)
342
343 Image/Build/Profile/DIR-620-A1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-a1,DIR-620-A1)
344 Image/Build/Profile/DIR-620-D1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-d1,DIR-620-D1)
345
346 define BuildFirmware/DIR615H1/squashfs
347 $(call BuildFirmware/Default4M/$(1),$(1),dir-615-h1,DIR-615-H1)
348 -mkdir615h1 -e $(call sysupname,$(1),dir-615-h1) \
349 -o $(call imgname,$(1),dir-615-h1)-factory.bin
350 endef
351 BuildFirmware/DIR615H1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),dir-615-h1,DIR-615-H1)
352 Image/Build/Profile/DIR615H1=$(call BuildFirmware/DIR615H1/$(1),$(1))
353
354 Image/Build/Profile/DAP1350=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350,DAP-1350,RT3052-AP-DAP1350-3)
355
356 Image/Build/Profile/DAP1350WW=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350WW,DAP-1350,RT3052-AP-DAP1350WW-3)
357
358 Image/Build/Profile/ESR-9753=$(call BuildFirmware/Default4M/$(1),$(1),esr-9753,ESR-9753)
359
360 Image/Build/Profile/HW550-3G=$(call BuildFirmware/Default8M/$(1),$(1),hw550-3g,HW550-3G)
361
362 belkin_f5d8235v2_mtd_size=7929856
363 Image/Build/Profile/F5D8235V2=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v2,F5D8235_V2,$(belkin_f5d8235v2_mtd_size))
364
365 # 0x770000
366 belkin_f7c027_mtd_size=7798784
367 Image/Build/Profile/F7C027=$(call BuildFirmware/CustomFlash/$(1),$(1),belkinf7c027,F7C027,$(belkin_f7c027_mtd_size))
368
369 Image/Build/Profile/FONERA20N=$(call BuildFirmware/Edimax/$(1),$(1),fonera20n,FONERA20N,$(ralink_default_fw_size_8M),RSDK,NL1T,0x50000,0xc0000)
370
371 Image/Build/Profile/RT-N13U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n13u,RT-N13U)
372
373 #Image/Build/Profile/HG255D=$(call BuildFirmware/Default16M/$(1),$(1),hg255d,HG255D)
374
375 Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freestation5,FREESTATION5)
376
377 Image/Build/Profile/IP2202=$(call BuildFirmware/Default8M/$(1),$(1),ip2202,IP2202)
378
379 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
380
381 Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
382
383 Image/Build/Profile/MOFI3500-3GN=$(call BuildFirmware/Default8M/$(1),$(1),mofi3500-3gn,MOFI3500-3GN)
384
385 # Kernel name should be "Linux Kernel Image" to make the OpenWrt image installable from factory Web UI
386 Image/Build/Profile/MPRA1=$(call BuildFirmware/Default4M/$(1),$(1),mpr-a1,MPRA1,Linux Kernel Image)
387 Image/Build/Profile/MPRA2=$(call BuildFirmware/Default8M/$(1),$(1),mpr-a2,MPRA2,Linux Kernel Image)
388
389 Image/Build/Profile/NBG-419N=$(call BuildFirmware/Default4M/$(1),$(1),nbg-419n,NBG-419N)
390
391 Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2,MZK-W300NH2,$(mzkw300nh2_mtd_size),CSYS,RN52,0x50000,0xc0000)
392
393 nw718_mtd_size=3801088
394 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
395
396 Image/Build/Profile/OMNI-EMB=$(call BuildFirmware/Default8M/$(1),$(1),omni-emb,OMNI-EMB)
397
398 Image/Build/Profile/PSR-680W=$(call BuildFirmware/Default4M/$(1),$(1),psr-680w,PSR-680W)
399
400 Image/Build/Profile/PWH2004=$(call BuildFirmware/Default8M/$(1),$(1),pwh2004,PWH2004)
401
402 Image/Build/Profile/RTG32B1=$(call BuildFirmware/Default4M/$(1),$(1),rt-g32-b1,RT-G32-B1)
403
404 Image/Build/Profile/RTN10PLUS=$(call BuildFirmware/Default4M/$(1),$(1),rt-n10-plus,RT-N10-PLUS)
405
406 Image/Build/Profile/SL-R7205=$(call BuildFirmware/Default4M/$(1),$(1),sl-r7205,SL-R7205)
407
408 Image/Build/Profile/V22RW-2X2=$(call BuildFirmware/Default4M/$(1),$(1),v22rw-2x2,V22RW-2X2)
409
410 Image/Build/Profile/W150M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w150m,W150M,$(ralink_default_fw_size_4M),W150M Kernel Image,factory)
411
412 Image/Build/Profile/W306R_V20=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w306r-v20,W306R_V20,$(ralink_default_fw_size_4M),linkn Kernel Image,factory)
413
414 Image/Build/Profile/W502U=$(call BuildFirmware/Default8M/$(1),$(1),w502u,W502U)
415
416 Image/Build/Profile/WCR150GN=$(call BuildFirmware/Default4M/$(1),$(1),wcr150gn,WCR150GN)
417
418 buffalo_whrg300n_mtd_size=3801088
419 define BuildFirmware/WHRG300N/squashfs
420 $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
421 # the following line has a bad argument 3 ... the old Makefile was already broken
422 $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
423 ( \
424 echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
425 dd bs=512 count=1 conv=sync; \
426 dd if=$(call sysupname,$(1),whr-g300n); \
427 ) > $(KDIR)/whr-g300n-tftp.tmp
428 buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
429 -o $(call imgname,$(1),whr-g300n)-tftp.bin
430 endef
431 BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
432 Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
433
434 Image/Build/Profile/WL_330N=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n,WL_330N)
435
436 Image/Build/Profile/WL_330N3G=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n3g,WL_330N3G)
437
438 kernel_size_wl341v3=917504
439 rootfs_size_wl341v3=2949120
440 define BuildFirmware/WL341V3/squashfs
441 $(call BuildFirmware/Default4M/$(1),$(1),wl341v3,WL341V3)
442 # This code looks broken and really needs to be converted to C
443 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
444 ( \
445 dd if=/dev/zero bs=195936 count=1; \
446 echo "1.01"; \
447 dd if=/dev/zero bs=581 count=1; \
448 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"; \
449 dd if=/dev/zero bs=65552 count=1; \
450 dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \
451 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
452 dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
453 echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
454 ) > $(call imgname,$(1),$(2))-factory.bin; \
455 fi
456 endef
457 BuildFirmware/WL341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl341v3,WL341V3)
458 Image/Build/Profile/WL341V3=$(call BuildFirmware/WL341V3/$(1),$(1))
459
460 Image/Build/Profile/WL-351=$(call BuildFirmware/Default4M/$(1),$(1),wl-351,WL-351)
461
462 define BuildFirmware/WNCE2001/squashfs
463 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
464 -mkdapimg -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 \
465 -i $(call sysupname,$(1),$(2)) \
466 -o $(call imgname,$(1),$(2))-factory-worldwide.bin
467 -mkdapimg -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 \
468 -i $(call sysupname,$(1),$(2)) \
469 -o $(call imgname,$(1),$(2))-factory-northamerica.bin
470 endef
471 BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
472 Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001)
473
474 Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN)
475
476 Image/Build/Profile/UR-326N4G=$(call BuildFirmware/Default4M/$(1),$(1),ur-326n4g,UR-326N4G)
477
478 Image/Build/Profile/UR-336UN=$(call BuildFirmware/Default8M/$(1),$(1),ur-336un,UR-336UN)
479
480 Image/Build/Profile/WR6202=$(call BuildFirmware/Default8M/$(1),$(1),wr6202,WR6202)
481
482 Image/Build/Profile/X5=$(call BuildFirmware/Poray8M/$(1),$(1),x5,X5)
483
484 Image/Build/Profile/X8=$(call BuildFirmware/Poray8M/$(1),$(1),x8,X8)
485
486 Image/Build/Profile/XDXRN502J=$(call BuildFirmware/Default4M/$(1),$(1),xdxrn502j,XDXRN502J)
487
488 ifeq ($(SUBTARGET),rt305x)
489 define Image/Build/Profile/Default
490 $(call Image/Build/Profile/3G6200N,$(1))
491 $(call Image/Build/Profile/3G6200NL,$(1))
492 $(call Image/Build/Profile/3G300M,$(1))
493 $(call Image/Build/Profile/AIR3GII,$(1))
494 $(call Image/Build/Profile/ALL02393G,$(1))
495 $(call Image/Build/Profile/ALL0256N,$(1))
496 $(call Image/Build/Profile/ALL5002,$(1))
497 $(call Image/Build/Profile/ALL5003,$(1))
498 $(call Image/Build/Profile/ARGUS_ATP52B,$(1))
499 $(call Image/Build/Profile/ASL26555,$(1))
500 $(call Image/Build/Profile/AWM002-EVB,$(1))
501 $(call Image/Build/Profile/BC2,$(1))
502 $(call Image/Build/Profile/BROADWAY,$(1))
503 $(call Image/Build/Profile/CARAMBOLA,$(1))
504 $(call Image/Build/Profile/D105,$(1))
505 $(call Image/Build/Profile/DIR-300-B1,$(1))
506 $(call Image/Build/Profile/DIR-600-B1,$(1))
507 $(call Image/Build/Profile/DIR-600-B2,$(1))
508 $(call Image/Build/Profile/DIR-615-D,$(1))
509 $(call Image/Build/Profile/DIR-620-A1,$(1))
510 $(call Image/Build/Profile/DIR-620-D1,$(1))
511 $(call Image/Build/Profile/DIR615H1,$(1))
512 $(call Image/Build/Profile/DAP1350,$(1))
513 $(call Image/Build/Profile/DAP1350WW,$(1))
514 $(call Image/Build/Profile/ESR-9753,$(1))
515 $(call Image/Build/Profile/F7C027,$(1))
516 $(call Image/Build/Profile/F5D8235V2,$(1))
517 $(call Image/Build/Profile/FONERA20N,$(1))
518 $(call Image/Build/Profile/FREESTATION5,$(1))
519 # $(call Image/Build/Profile/HG255D,$(1))
520 $(call Image/Build/Profile/HW550-3G,$(1))
521 $(call Image/Build/Profile/IP2202,$(1))
522 $(call Image/Build/Profile/M3,$(1))
523 $(call Image/Build/Profile/M4,$(1))
524 $(call Image/Build/Profile/MOFI3500-3GN,$(1))
525 $(call Image/Build/Profile/MPRA2,$(1))
526 $(call Image/Build/Profile/MZKW300NH2,$(1))
527 $(call Image/Build/Profile/NBG-419N,$(1))
528 $(call Image/Build/Profile/NW718,$(1))
529 $(call Image/Build/Profile/OMNI-EMB,$(1))
530 $(call Image/Build/Profile/PSR-680W,$(1))
531 $(call Image/Build/Profile/PWH2004,$(1))
532 $(call Image/Build/Profile/RTG32B1,$(1))
533 $(call Image/Build/Profile/RTN10PLUS,$(1))
534 $(call Image/Build/Profile/RT-N13U,$(1))
535 $(call Image/Build/Profile/SL-R7205,$(1))
536 $(call Image/Build/Profile/UR-326N4G,$(1))
537 $(call Image/Build/Profile/V22RW-2X2,$(1))
538 $(call Image/Build/Profile/W150M,$(1))
539 $(call Image/Build/Profile/W306R_V20,$(1))
540 $(call Image/Build/Profile/W502U,$(1))
541 $(call Image/Build/Profile/WCR150GN,$(1))
542 $(call Image/Build/Profile/WHRG300N,$(1))
543 $(call Image/Build/Profile/WL_330N,$(1))
544 $(call Image/Build/Profile/WL_330N3G,$(1))
545 $(call Image/Build/Profile/WL341V3,$(1))
546 $(call Image/Build/Profile/WL-351,$(1))
547 $(call Image/Build/Profile/WNCE2001,$(1))
548 $(call Image/Build/Profile/WR512-3GN,$(1))
549 $(call Image/Build/Profile/WR6202,$(1))
550 $(call Image/Build/Profile/X5,$(1))
551 $(call Image/Build/Profile/X8,$(1))
552 $(call Image/Build/Profile/XDXRN502J,$(1))
553 endef
554 endif
555
556
557
558 #
559 # RT3662/RT3883 Profiles
560 #
561 Image/Build/Profile/DIR645=$(call BuildFirmware/Seama/$(1),$(1),dir-645,DIR-645,wrgn39_dlob.hans_dir645,$(ralink_default_fw_size_8M))
562
563 omniembhpm_mtd_size=16449536
564 Image/Build/Profile/OMNIEMBHPM=$(call BuildFirmware/CustomFlash/$(1),$(1),omni-emb-hpm,OMNI-EMB-HPM,$(omniembhpm_mtd_size))
565
566 Image/Build/Profile/RTN56U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n56u,RTN56U)
567
568 Image/Build/Profile/TEW691GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-691gr,TEW-691GR,0x026910)
569
570 #Image/Build/Profile/TEW692GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-692gr,TEW-692GR,0x026920)
571
572 ifeq ($(SUBTARGET),rt3883)
573 define Image/Build/Profile/Default
574 $(call Image/Build/Profile/DIR645,$(1))
575 $(call Image/Build/Profile/OMNIEMBHPM,$(1))
576 $(call Image/Build/Profile/RTN56U,$(1))
577 $(call Image/Build/Profile/TEW691GR,$(1))
578 $(call Image/Build/Profile/TEW692GR,$(1))
579 endef
580 endif
581
582 #
583 # MT7620A Profiles
584 #
585
586 Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
587 Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
588 Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp_n53,RP-N53)
589 dlink810l_mtd_size=6881280
590 Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
591
592 ifeq ($(SUBTARGET),mt7620a)
593 define Image/Build/Profile/Default
594 $(call Image/Build/Profile/MT7620a,$(1))
595 $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
596 $(call Image/Build/Profile/RP-N53,$(1))
597 $(call Image/Build/Profile/DIR-810L,$(1))
598 endef
599 endif
600
601
602 #
603 # Generic Targets
604 #
605 define Image/BuildKernel
606 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
607 cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
608 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
609 $(call MkImage,lzma,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
610 cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(UIMAGE).bin
611 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
612 cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(VMLINUX)-initramfs.elf
613 cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(VMLINUX)-initramfs.bin
614 $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
615 $(call MkImage,lzma,$(KDIR)/vmlinux-initramfs.bin.lzma,$(KDIR)/uImage-initramfs.lzma)
616 cp $(KDIR)/uImage-initramfs.lzma $(BIN_DIR)/$(UIMAGE)-initramfs.bin
617 endif
618 $(call Image/Build/Initramfs)
619 endef
620
621 define Image/Build
622 $(call Image/Build/$(1))
623 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
624 $(call Image/Build/Profile/$(PROFILE),$(1))
625 endef
626
627 $(eval $(call BuildImage))