5 # sign an image to make it work with edimax tftp recovery
6 define BuildFirmware/Edimax/squashfs
7 $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
8 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
9 mkedimaximg -i $(call sysupname,$(1),$(2)) \
10 -o $(call imgname,$(1),$(2))-factory.bin \
11 -s $(5) -m $(6) -f $(7) -S $(8); \
14 BuildFirmware/Edimax/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
17 define BuildFirmware/Poray4M/squashfs
18 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
19 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
20 mkporayfw -B $(3) -F 4M \
21 -f $(call sysupname,$(1),$(2)) \
22 -o $(call imgname,$(1),$(2))-factory.bin; \
25 BuildFirmware/Poray4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
27 define BuildFirmware/Poray8M/squashfs
28 $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
29 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
30 mkporayfw -B $(3) -F 8M \
31 -f $(call sysupname,$(1),$(2)) \
32 -o $(call imgname,$(1),$(2))-factory.bin; \
35 BuildFirmware/Poray8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
37 define BuildFirmware/JCG/squashfs
38 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
39 -jcgimage -o $(call imgname,$(1),$(2))-factory.bin \
40 -u $(call sysupname,$(1),$(2)) -v $(4)
43 define BuildFirmware/DIR300B1/squashfs
44 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
45 -mkwrgimg -s $(4) -d /dev/mtdblock/2 \
46 -i $(call sysupname,$(1),$(2)) \
47 -o $(call imgname,$(1),$(2))-factory.bin
49 BuildFirmware/DIR300B1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
51 # sign dap 1350 based images
52 dap1350_mtd_size=7667712
53 define BuildFirmware/dap1350/squashfs
54 $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(dap1350_mtd_size))
56 -i $(call sysupname,$(1),$(2)) \
57 -o $(call imgname,$(1),$(2))-factory.bin
59 BuildFirmware/dap1350/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
61 define BuildFirmware/DCS930/squashfs
62 $(call BuildFirmware/Default4M/squashfs,squashfs,$(2),$(3))
63 dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/image.$(2).combined bs=1048512 count=1 conv=sync
64 cat $(KDIR)/root.squashfs >> $(KDIR)/image.$(2).combined
65 $(call MkImage,lzma,$(KDIR)/image.$(2).combined,$(KDIR)/image.$(2))
66 $(call prepare_generic_squashfs,$(KDIR)/image.$(2))
67 if [ `stat -c%s "$(KDIR)/image.$(2)"` -gt $(ralink_default_fw_size_4M) ]; then \
68 echo "Warning: $(KDIR)/image.$(2) is too big" >&2; \
70 dd if=$(KDIR)/image.$(2) of=$(KDIR)/dcs.tmp bs=64K count=5 conv=sync ;\
71 cat $(KDIR)/image.$(2) >> $(KDIR)/dcs.tmp ; \
72 dd if=$(KDIR)/dcs.tmp of=$(call imgname,$(1),$(2))-factory.bin bs=4096k count=1 conv=sync ;\
73 $(STAGING_DIR_HOST)/bin/mkdcs932 $(call imgname,$(1),$(2))-factory.bin ; \
76 BuildFirmware/DCS930/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
78 BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))
79 define BuildFirmware/HLKRM04/initramfs
80 $(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
81 mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
85 define BuildFirmware/Buffalo
86 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
87 buffalo-enc -p $(3) -v 1.76 \
88 -i $(KDIR)/vmlinux-$(2).uImage \
89 -o $(KDIR)/vmlinux-$(2).uImage.enc; \
90 buffalo-enc -p $(3) -v 1.76 \
91 -i $(KDIR)/root.$(1) \
92 -o $(KDIR)/root.$(2).enc; \
93 buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \
94 -l mlang8 -f 1 -r EU \
95 -i $(KDIR)/vmlinux-$(2).uImage.enc \
96 -i $(KDIR)/root.$(2).enc \
97 -o $(call imgname,$(1),$(2))-factory-EU.bin; \
101 # FIXME: this looks broken
102 buffalo_whrg300n_mtd_size=3801088
103 define BuildFirmware/WHRG300N/squashfs
104 $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
105 # the following line has a bad argument 3 ... the old Makefile was already broken
106 $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
107 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
109 echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
110 dd bs=512 count=1 conv=sync; \
111 dd if=$(call sysupname,$(1),whr-g300n); \
112 ) > $(KDIR)/whr-g300n-tftp.tmp && \
113 buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
114 -o $(call imgname,$(1),whr-g300n)-tftp.bin; \
117 BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
119 kernel_size_wl341v3=917504
120 rootfs_size_wl341v3=2949120
121 define BuildFirmware/WL-341V3/squashfs
122 $(call BuildFirmware/Default4M/$(1),$(1),wl-341v3,WL-341V3)
123 # This code looks broken and really needs to be converted to C
124 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
126 dd if=/dev/zero bs=195936 count=1; \
128 dd if=/dev/zero bs=581 count=1; \
129 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"; \
130 dd if=/dev/zero bs=65552 count=1; \
131 dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \
132 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
133 dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
134 echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
135 ) > $(call imgname,$(1),$(2))-factory.bin; \
138 BuildFirmware/WL-341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl-341v3,WL-341V3)
140 define BuildFirmware/WNCE2001/squashfs
141 $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
142 -mkdapimg -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 \
143 -i $(call sysupname,$(1),$(2)) \
144 -o $(call imgname,$(1),$(2))-factory-worldwide.bin
145 -mkdapimg -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 \
146 -i $(call sysupname,$(1),$(2)) \
147 -o $(call imgname,$(1),$(2))-factory-northamerica.bin
149 BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
153 define BuildFirmware/UIMAGE_8M
154 $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7))
156 define Image/Build/Profile/ALL02393G
157 $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys)
160 Image/Build/Profile/DIR610A1=$(call BuildFirmware/Seama/$(1),$(1),dir-610-a1,DIR-610-A1,wrgn59_dlob.hans_dir610,$(ralink_default_fw_size_4M))
161 edimax_3g6200n_mtd_size=3735552
162 Image/Build/Profile/3G6200N=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200n,3G-6200N,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
163 Image/Build/Profile/3G6200NL=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200nl,3G-6200NL,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
164 Image/Build/Profile/3G300M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),3g300m,3G300M,$(ralink_default_fw_size_4M),3G150M_SPI Kernel Image,factory)
165 Image/Build/Profile/A5-V11=$(call BuildFirmware/Poray4M/$(1),$(1),a5-v11,A5-V11)
166 Image/Build/Profile/ALL0256N=$(call BuildFirmware/DefaultDualSize/$(1),$(1),all0256n,ALL0256N)
167 Image/Build/Profile/AWM002EVB=$(call BuildFirmware/DefaultDualSize/$(1),$(1),awm002-evb,AWM002-EVB)
168 broadway_mtd_size=7929856
169 Image/Build/Profile/BROADWAY=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),broadway,BROADWAY,$(broadway_mtd_size),Broadway Kernel Image,factory)
170 Image/Build/Profile/JHR-N805R=$(call BuildFirmware/JCG/$(1),$(1),jhr-n805r,JHR-N805R,29.24)
171 Image/Build/Profile/JHR-N825R=$(call BuildFirmware/JCG/$(1),$(1),jhr-n825r,JHR-N825R,23.24)
172 Image/Build/Profile/JHR-N926R=$(call BuildFirmware/JCG/$(1),$(1),jhr-n926r,JHR-N926R,25.24)
173 Image/Build/Profile/DIR-300-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b)
174 Image/Build/Profile/DIR-600-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b)
175 Image/Build/Profile/DIR-600-B2=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b2,DIR-600-B2,wrgn23_dlwbr_dir600b)
176 Image/Build/Profile/DIR-615-D=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-615-d,DIR-615-D,wrgn23_dlwbr_dir615d)
177 Image/Build/Profile/DAP1350=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350,DAP-1350,RT3052-AP-DAP1350-3)
178 Image/Build/Profile/DAP1350WW=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350WW,DAP-1350,RT3052-AP-DAP1350WW-3)
179 Image/Build/Profile/DCS930=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930,DCS-930)
180 Image/Build/Profile/DCS930LB1=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930l-b1,DCS-930L-B1)
181 Image/Build/Profile/FONERA20N=$(call BuildFirmware/Edimax/$(1),$(1),fonera20n,FONERA20N,$(ralink_default_fw_size_8M),RSDK,NL1T,0x50000,0xc0000)
182 Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM04)
183 Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
184 Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
185 Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2,MZK-W300NH2,$(mzkw300nh2_mtd_size),CSYS,RN52,0x50000,0xc0000)
186 nw718_mtd_size=3801088
187 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
188 Image/Build/Profile/PX-4885=$(call BuildFirmware/DefaultDualSize/$(1),$(1),px-4885,PX-4885)
189 Image/Build/Profile/W150M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w150m,W150M,$(ralink_default_fw_size_4M),W150M Kernel Image,factory)
190 Image/Build/Profile/W306R_V20=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w306r-v20,W306R_V20,$(ralink_default_fw_size_4M),linkn Kernel Image,factory)
191 Image/Build/Profile/WL-341V3=$(call BuildFirmware/WL-341V3/$(1),$(1))
192 Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001)
193 Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN)
194 Image/Build/Profile/WT1520=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt1520,WT1520)
195 Image/Build/Profile/X5=$(call BuildFirmware/Poray8M/$(1),$(1),x5,X5)
196 Image/Build/Profile/X8=$(call BuildFirmware/Poray8M/$(1),$(1),x8,X8)
197 Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
199 define LegacyDevice/ALL02393G
200 DEVICE_TITLE := Allnet ALL0239-3G
201 DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-ledtrig-usbdev
203 LEGACY_DEVICES += ALL02393G
206 define LegacyDevice/DIR610A1
207 DEVICE_TITLE := D-Link DIR-610 A1
208 DEVICE_PACKAGES := kmod-ledtrig-netdev kmod-ledtrig-timer
210 LEGACY_DEVICES += DIR610A1
213 define LegacyDevice/3G6200N
214 DEVICE_TITLE := Edimax 3g-6200n
216 LEGACY_DEVICES += 3G6200N
219 define LegacyDevice/3G6200NL
220 DEVICE_TITLE := Edimax 3g-6200nl
222 LEGACY_DEVICES += 3G6200NL
225 define LegacyDevice/3G300M
226 DEVICE_TITLE := Tenda 3G300M
227 DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-ledtrig-usbdev
229 LEGACY_DEVICES += 3G300M
232 define LegacyDevice/A5-V11
233 DEVICE_TITLE := A5-V11
234 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
236 LEGACY_DEVICES += A5-V11
239 define LegacyDevice/ALL0256N
240 DEVICE_TITLE := Allnet ALL0256N
241 DEVICE_PACKAGES := rssileds
243 LEGACY_DEVICES += ALL0256N
246 define LegacyDevice/AWM002EVB
247 DEVICE_TITLE := AsiaRF AWM002-EVB
248 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev \
249 kmod-i2c-core kmod-i2c-gpio
251 LEGACY_DEVICES += AWM002EVB
254 define LegacyDevice/BROADWAY
255 DEVICE_TITLE := Hauppauge Broadway
256 DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-ledtrig-usbdev
258 LEGACY_DEVICES += BROADWAY
261 define LegacyDevice/JHR-N805R
262 DEVICE_TITLE := JCG JHR-N805R
264 LEGACY_DEVICES += JHR-N805R
267 define LegacyDevice/JHR-N825R
268 DEVICE_TITLE := JCG JHR-N825R
270 LEGACY_DEVICES += JHR-N825R
273 define LegacyDevice/JHR-N926R
274 DEVICE_TITLE := JCG JHR-N926R
276 LEGACY_DEVICES += JHR-N926R
279 define LegacyDevice/DIR-300-B1
280 DEVICE_TITLE := D-Link DIR-300 B1
282 LEGACY_DEVICES += DIR-300-B1
285 define LegacyDevice/DIR-600-B1
286 DEVICE_TITLE := D-Link DIR-600 B1
288 LEGACY_DEVICES += DIR-600-B1
291 define LegacyDevice/DIR-600-B2
292 DEVICE_TITLE := D-Link DIR-600 B2
294 LEGACY_DEVICES += DIR-600-B2
297 define LegacyDevice/DIR-615-D
298 DEVICE_TITLE := D-Link DIR-615 D
300 LEGACY_DEVICES += DIR-615-D
303 define Device/dir-615-h1
306 IMAGES += factory.bin
307 IMAGE_SIZE := $(ralink_default_fw_size_4M)
308 IMAGE/factory.bin := \
309 $$(IMAGE/sysupgrade.bin) | senao-header -r 0x218 -p 0x30 -t 3
310 DEVICE_TITLE := D-Link DIR-615 H1
312 TARGET_DEVICES += dir-615-h1
315 define LegacyDevice/DAP1350
316 DEVICE_TITLE := D-Link DAP-1350
318 LEGACY_DEVICES += DAP1350
321 define LegacyDevice/DAP1350WW
322 DEVICE_TITLE := D-Link DAP-1350HW
324 LEGACY_DEVICES += DAP1350WW
327 define LegacyDevice/DCS930
328 DEVICE_TITLE := D-Link DCS-930
329 DEVICE_PACKAGES := kmod-video-core kmod-video-uvc kmod-sound-core kmod-usb-audio kmod-usb-core kmod-usb-dwc2
331 LEGACY_DEVICES += DCS930
334 define LegacyDevice/DCS930LB1
335 DEVICE_TITLE := D-Link DCS-930L B1
336 DEVICE_PACKAGES := kmod-video-core kmod-video-uvc kmod-sound-core kmod-usb-audio kmod-usb-core kmod-usb-ohci kmod-usb2
338 LEGACY_DEVICES += DCS930LB1
341 define LegacyDevice/FONERA20N
342 DEVICE_TITLE := Fonera 2.0N
343 DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-ledtrig-usbdev
345 LEGACY_DEVICES += FONERA20N
348 define LegacyDevice/HLKRM04
349 DEVICE_TITLE := HILINK HLK-RM04
351 LEGACY_DEVICES += HLKRM04
354 define LegacyDevice/M3
355 DEVICE_TITLE := Poray M3
356 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
361 define LegacyDevice/M4
362 DEVICE_TITLE := Poray M4
363 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
368 define LegacyDevice/MZKW300NH2
369 DEVICE_TITLE := Planex MZK-W300NH2
371 LEGACY_DEVICES += MZKW300NH2
374 define LegacyDevice/NW718
375 DEVICE_TITLE := Netcore NW718
377 LEGACY_DEVICES += NW718
380 define LegacyDevice/PX-4885
381 DEVICE_TITLE := 7Links PX-4885
382 DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-ohci kmod-ledtrig-usbdev kmod-leds-gpio
384 LEGACY_DEVICES += PX-4885
387 define LegacyDevice/W150M
388 DEVICE_TITLE := Tenda W150M
390 LEGACY_DEVICES += W150M
393 define LegacyDevice/W306R_V20
394 DEVICE_TITLE := Tenda W306R V2.0
396 LEGACY_DEVICES += W306R_V20
399 define LegacyDevice/WL-341V3
400 DEVICE_TITLE := Sitecom WL-341 v3
402 LEGACY_DEVICES += WL-341V3
405 define LegacyDevice/WNCE2001
406 DEVICE_TITLE := Netgear WNCE2001
408 LEGACY_DEVICES += WNCE2001
411 define LegacyDevice/WR512-3GN
412 DEVICE_TITLE := WR512-3GN-like router
414 LEGACY_DEVICES += WR512-3GN
417 define LegacyDevice/WT1520
418 DEVICE_TITLE := Nexx WT1520
420 LEGACY_DEVICES += WT1520
423 define LegacyDevice/X5
424 DEVICE_TITLE := Poray X5/X6
425 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
430 define LegacyDevice/X8
431 DEVICE_TITLE := Poray X8
432 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
437 define LegacyDevice/WHRG300N
438 DEVICE_TITLE := Buffalo WHR-G300N
440 LEGACY_DEVICES += WHRG300N