ath79: fix GL.iNet GL-AR300M sysupgrade
[openwrt/staging/mkresin.git] / target / linux / ath79 / image / generic.mk
1 include ./common-buffalo.mk
2 include ./common-netgear.mk
3
4 DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
5
6 define Build/cybertan-trx
7 @echo -n '' > $@-empty.bin
8 -$(STAGING_DIR_HOST)/bin/trx -o $@.new \
9 -f $(IMAGE_KERNEL) -F $@-empty.bin \
10 -x 32 -a 0x10000 -x -32 -f $@
11 -mv "$@.new" "$@"
12 -rm $@-empty.bin
13 endef
14
15 define Build/addpattern
16 -$(STAGING_DIR_HOST)/bin/addpattern -B $(ADDPATTERN_ID) \
17 -v v$(ADDPATTERN_VERSION) -i $@ -o $@.new
18 -mv "$@.new" "$@"
19 endef
20
21 define Build/elecom-header
22 $(eval fw_size=$(word 1,$(1)))
23 $(eval edimax_model=$(word 2,$(1)))
24 $(eval product=$(word 3,$(1)))
25 $(eval factory_bin=$(word 4,$(1)))
26 if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \
27 $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \
28 $(STAGING_DIR_HOST)/bin/mkedimaximg \
29 -b -s CSYS -m $(edimax_model) \
30 -f 0x70000 -S 0x01100000 \
31 -i $(factory_bin) -o $(factory_bin).new; \
32 mv $(factory_bin).new $(factory_bin); \
33 ( \
34 echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
35 echo -n "0.00" | dd bs=16 count=1 conv=sync; \
36 dd if=$(factory_bin); \
37 ) > $(factory_bin).new; \
38 mv $(factory_bin).new $(factory_bin); \
39 $(CP) $(factory_bin) $(BIN_DIR)/; \
40 else \
41 echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \
42 fi
43
44 endef
45
46 define Device/avm_fritz300e
47 ATH_SOC := ar7242
48 DEVICE_TITLE := AVM FRITZ!WLAN Repeater 300E
49 KERNEL := kernel-bin | append-dtb | lzma | eva-image
50 KERNEL_INITRAMFS := $$(KERNEL)
51 IMAGE_SIZE := 15232k
52 IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
53 append-squashfs-fakeroot-be | pad-to 256 | \
54 append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
55 DEVICE_PACKAGES := fritz-tffs rssileds -swconfig
56 endef
57 TARGET_DEVICES += avm_fritz300e
58
59 define Device/avm_fritz4020
60 ATH_SOC := qca9561
61 DEVICE_TITLE := AVM FRITZ!Box 4020
62 IMAGE_SIZE := 15232k
63 KERNEL := kernel-bin | append-dtb | lzma | eva-image
64 KERNEL_INITRAMFS := $$(KERNEL)
65 IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
66 append-squashfs-fakeroot-be | pad-to 256 | \
67 append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
68 DEVICE_PACKAGES := fritz-tffs
69 endef
70 TARGET_DEVICES += avm_fritz4020
71
72 define Device/buffalo_bhr-4grv
73 ATH_SOC := ar7242
74 DEVICE_TITLE := Buffalo BHR-4GRV
75 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
76 IMAGE_SIZE := 32256k
77 IMAGES += factory.bin tftp.bin
78 IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
79 IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc BHR-4GRV 1.99 | buffalo-tag BHR-4GRV 3
80 IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
81 SUPPORTED_DEVICES += wzr-hp-g450h
82 endef
83 TARGET_DEVICES += buffalo_bhr-4grv
84
85 define Device/buffalo_bhr-4grv2
86 ATH_SOC := qca9557
87 DEVICE_TITLE := Buffalo BHR-4GRV2
88 IMAGE_SIZE := 16000k
89 endef
90 TARGET_DEVICES += buffalo_bhr-4grv2
91
92 define Device/buffalo_wzr-hp-ag300h
93 ATH_SOC := ar7161
94 DEVICE_TITLE := Buffalo WZR-HP-AG300H
95 IMAGE_SIZE := 32256k
96 IMAGES += factory.bin tftp.bin
97 IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
98 IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-AG300H 1.99 | buffalo-tag WZR-HP-AG300H 3
99 IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
100 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader
101 SUPPORTED_DEVICES += wzr-hp-ag300h
102 endef
103 TARGET_DEVICES += buffalo_wzr-hp-ag300h
104
105 define Device/buffalo_wzr-hp-g302h-a1a0
106 ATH_SOC := ar7242
107 DEVICE_TITLE := Buffalo WZR-HP-G302H A1A0
108 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
109 IMAGE_SIZE := 32128k
110 IMAGES += factory.bin tftp.bin
111 IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
112 IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G302H 1.99 | buffalo-tag WZR-HP-G302H 4
113 IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
114 SUPPORTED_DEVICES += wzr-hp-g300nh2
115 endef
116 TARGET_DEVICES += buffalo_wzr-hp-g302h-a1a0
117
118 define Device/buffalo_wzr-hp-g450h
119 ATH_SOC := ar7242
120 DEVICE_TITLE := Buffalo WZR-HP-G450H/WZR-450HP
121 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
122 IMAGE_SIZE := 32256k
123 IMAGES += factory.bin tftp.bin
124 IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
125 IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G450H 1.99 | buffalo-tag WZR-HP-G450H 3
126 IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
127 SUPPORTED_DEVICES += wzr-hp-g450h
128 endef
129 TARGET_DEVICES += buffalo_wzr-hp-g450h
130
131 define Device/dlink_dir-825-b1
132 ATH_SOC := ar7161
133 DEVICE_TITLE := D-LINK DIR-825 B1
134 IMAGE_SIZE := 6208k
135 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
136 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader
137 SUPPORTED_DEVICES += dir-825-b1
138 endef
139 TARGET_DEVICES += dlink_dir-825-b1
140
141 define Device/elecom_wrc-300ghbk2-i
142 ATH_SOC := qca9563
143 DEVICE_TITLE := ELECOM WRC-300GHBK2-I
144 IMAGE_SIZE := 7616k
145 KERNEL_INITRAMFS := $$(KERNEL) | pad-to 2 | \
146 elecom-header 7798706 RN51 WRC-300GHBK2-I \
147 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin
148 endef
149 TARGET_DEVICES += elecom_wrc-300ghbk2-i
150
151 define Device/embeddedwireless_dorin
152 ATH_SOC := ar9331
153 DEVICE_TITLE := Embedded Wireless Dorin
154 DEVICE_PACKAGES := kmod-usb-chipidea2
155 IMAGE_SIZE := 16000k
156 endef
157 TARGET_DEVICES += embeddedwireless_dorin
158
159 define Device/etactica_eg200
160 ATH_SOC := ar9331
161 DEVICE_TITLE := eTactica EG200
162 DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-ledtrig-oneshot \
163 kmod-usb-serial kmod-usb-serial-ftdi kmod-usb-storage kmod-fs-ext4
164 SUPPORTED_DEVICES += rme-eg200
165 endef
166 TARGET_DEVICES += etactica_eg200
167
168 define Device/glinet_ar150
169 ATH_SOC := ar9330
170 DEVICE_TITLE := GL.iNet GL-AR150
171 DEVICE_PACKAGES := kmod-usb-chipidea2
172 IMAGE_SIZE := 16000k
173 SUPPORTED_DEVICES += gl-ar150
174 endef
175 TARGET_DEVICES += glinet_ar150
176
177 define Device/glinet_ar300m-nor
178 ATH_SOC := qca9531
179 DEVICE_TITLE := GL.iNet GL-AR300M
180 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
181 IMAGE_SIZE := 16000k
182 SUPPORTED_DEVICES += gl-ar300m
183 endef
184 TARGET_DEVICES += glinet_ar300m-nor
185
186 define Device/glinet_gl-x750
187 ATH_SOC := qca9531
188 DEVICE_TITLE := GL.iNet GL-X750
189 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca9887
190 IMAGE_SIZE := 16000k
191 endef
192 TARGET_DEVICES += glinet_gl-x750
193
194 define Device/iodata_etg3-r
195 ATH_SOC := ar9342
196 DEVICE_TITLE := I-O DATA ETG3-R
197 IMAGE_SIZE := 7680k
198 endef
199 TARGET_DEVICES += iodata_etg3-r
200
201 define Device/iodata_wn-ac1167dgr
202 ATH_SOC := qca9557
203 DEVICE_TITLE := I-O DATA WN-AC1167DGR
204 IMAGE_SIZE := 14656k
205 IMAGES += factory.bin
206 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
207 append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
208 senao-header -r 0x30a -p 0x61 -t 2
209 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
210 endef
211 TARGET_DEVICES += iodata_wn-ac1167dgr
212
213 define Device/iodata_wn-ac1600dgr2
214 ATH_SOC := qca9557
215 DEVICE_TITLE := I-O DATA WN-AC1600DGR2
216 IMAGE_SIZE := 14656k
217 IMAGES += factory.bin
218 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
219 append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
220 senao-header -r 0x30a -p 0x60 -t 2 -v 200
221 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
222 endef
223 TARGET_DEVICES += iodata_wn-ac1600dgr2
224
225 define Device/ocedo_koala
226 ATH_SOC := qca9558
227 DEVICE_TITLE := OCEDO Koala
228 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
229 SUPPORTED_DEVICES += koala
230 IMAGE_SIZE := 7424k
231 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
232 endef
233 TARGET_DEVICES += ocedo_koala
234
235 define Device/ocedo_raccoon
236 ATH_SOC := ar9344
237 DEVICE_TITLE := OCEDO Raccoon
238 IMAGE_SIZE := 7424k
239 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
240 endef
241 TARGET_DEVICES += ocedo_raccoon
242
243 define Device/openmesh_om5p-ac-v2
244 ATH_SOC := qca9558
245 DEVICE_TITLE := OpenMesh OM5P-AC v2
246 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct om-watchdog
247 IMAGE_SIZE := 7808k
248 SUPPORTED_DEVICES += om5p-acv2
249 endef
250 TARGET_DEVICES += openmesh_om5p-ac-v2
251
252 define Device/pcs_cap324
253 ATH_SOC := ar9344
254 DEVICE_TITLE := PowerCloud Systems CAP324
255 IMAGE_SIZE := 16000k
256 IMAGES := sysupgrade.bin
257 SUPPORTED_DEVICES += cap324
258 endef
259 TARGET_DEVICES += pcs_cap324
260
261 define Device/pcs_cr3000
262 ATH_SOC := ar9341
263 DEVICE_TITLE := PowerCloud Systems CR3000
264 IMAGE_SIZE := 7808k
265 IMAGES := sysupgrade.bin
266 SUPPORTED_DEVICES += cr3000
267 endef
268 TARGET_DEVICES += pcs_cr3000
269
270 define Device/pcs_cr5000
271 ATH_SOC := ar9344
272 DEVICE_TITLE := PowerCloud Systems CR5000
273 DEVICE_PACKAGES := kmod-usb2 kmod-usb-core
274 IMAGE_SIZE := 7808k
275 IMAGES := sysupgrade.bin
276 SUPPORTED_DEVICES += cr5000
277 endef
278 TARGET_DEVICES += pcs_cr5000
279
280 define Device/netgear_wndr3x00
281 ATH_SOC := ar7161
282 KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
283 IMAGES := sysupgrade.bin factory.img
284 IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
285 IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
286 IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE)
287 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader
288 endef
289
290 define Device/netgear_wndr3700
291 $(Device/netgear_wndr3x00)
292 DEVICE_TITLE := NETGEAR WNDR3700
293 NETGEAR_KERNEL_MAGIC := 0x33373030
294 NETGEAR_BOARD_ID := WNDR3700
295 IMAGE_SIZE := 7680k
296 IMAGES += factory-NA.img
297 IMAGE/factory-NA.img := $$(IMAGE/default) | netgear-dni NA | check-size $$$$(IMAGE_SIZE)
298 SUPPORTED_DEVICES += wndr3700
299 endef
300 TARGET_DEVICES += netgear_wndr3700
301
302 define Device/netgear_wndr3700v2
303 $(Device/netgear_wndr3x00)
304 DEVICE_TITLE := NETGEAR WNDR3700v2
305 NETGEAR_KERNEL_MAGIC := 0x33373031
306 NETGEAR_BOARD_ID := WNDR3700v2
307 NETGEAR_HW_ID := 29763654+16+64
308 IMAGE_SIZE := 15872k
309 SUPPORTED_DEVICES += wndr3700v2
310 endef
311 TARGET_DEVICES += netgear_wndr3700v2
312
313 define Device/pisen_wmm003n
314 $(Device/tplink-8mlzma)
315 ATH_SOC := ar9331
316 DEVICE_TITLE := Pisen WMM003N (Cloud Easy Power)
317 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-chipidea2
318 TPLINK_HWID := 0x07030101
319 IMAGES := sysupgrade.bin
320 endef
321 TARGET_DEVICES += pisen_wmm003n
322
323 define Device/netgear_wndr3800
324 $(Device/netgear_wndr3x00)
325 DEVICE_TITLE := NETGEAR WNDR3800
326 NETGEAR_KERNEL_MAGIC := 0x33373031
327 NETGEAR_BOARD_ID := WNDR3800
328 NETGEAR_HW_ID := 29763654+16+128
329 IMAGE_SIZE := 15872k
330 SUPPORTED_DEVICES += wndr3800
331 endef
332 TARGET_DEVICES += netgear_wndr3800
333
334 define Device/phicomm_k2t
335 ATH_SOC := qca9563
336 DEVICE_TITLE := Phicomm K2T
337 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
338 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
339 IMAGE_SIZE := 15744k
340 IMAGES := sysupgrade.bin
341 IMAGE/default := append-kernel | append-rootfs | pad-rootfs
342 IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
343 DEVICE_PACKAGES := kmod-leds-reset kmod-ath10k-ct ath10k-firmware-qca9888-ct
344 endef
345 TARGET_DEVICES += phicomm_k2t
346
347 define Device/rosinson_wr818
348 ATH_SOC := qca9563
349 DEVICE_TITLE := ROSINSON WR818
350 IMAGE_SIZE := 15872k
351 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
352 endef
353 TARGET_DEVICES += rosinson_wr818
354
355 define Device/wd_mynet-wifi-rangeextender
356 ATH_SOC := ar9344
357 DEVICE_TITLE := Western Digital My Net Wi-Fi Range Extender
358 DEVICE_PACKAGES := rssileds nvram -swconfig
359 IMAGE_SIZE := 7808k
360 ADDPATTERN_ID := mynet-rext
361 ADDPATTERN_VERSION := 1.00.01
362 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | cybertan-trx | \
363 addpattern | append-metadata
364 SUPPORTED_DEVICES += mynet-rext
365 endef
366 TARGET_DEVICES += wd_mynet-wifi-rangeextender