ath79: add support for Ubiquiti NanoBeam M5
[openwrt/staging/wigyori.git] / target / linux / ath79 / image / generic-ubnt.mk
1 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION
2
3 # On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like
4 # VERSION_DIST being on the place of major(?) version number, so we need to
5 # use some number.
6 UBNT_REVISION := $(VERSION_DIST)-$(REVISION)
7
8 # mkubntimage is using the kernel image direct
9 # routerboard creates partitions out of the ubnt header
10 define Build/mkubntimage
11 -$(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
12 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
13 -k $(IMAGE_KERNEL) -r $@ -o $@
14 endef
15
16 define Build/mkubntimage2
17 -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
18 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
19 -p jffs2:0x50000:0xf60000:0:0:$@ \
20 -o $@.new
21 @mv $@.new $@
22 endef
23
24 # all UBNT XM/WA devices expect the kernel image to have 1024k while flash, when
25 # booting the image, the size doesn't matter.
26 define Build/mkubntimage-split
27 -[ -f $@ ] && ( \
28 dd if=$@ of=$@.old1 bs=1024k count=1; \
29 dd if=$@ of=$@.old2 bs=1024k skip=1; \
30 $(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
31 -v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \
32 -k $@.old1 -r $@.old2 -o $@; \
33 rm $@.old1 $@.old2 )
34 endef
35
36 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
37 # UBNT_TYPE e.g. one of (BZ, XM, XW)
38 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
39 # UBNT_VERSION e.g. one of (6.0.0, 8.5.3)
40 define Device/ubnt
41 DEVICE_VENDOR := Ubiquiti
42 DEVICE_PACKAGES := kmod-usb2
43 IMAGES += factory.bin
44 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
45 append-rootfs | pad-rootfs | check-size | mkubntimage-split
46 endef
47
48 define Device/ubnt-bz
49 $(Device/ubnt)
50 SOC := ar7241
51 IMAGE_SIZE := 7448k
52 UBNT_BOARD := XM
53 UBNT_CHIP := ar7240
54 UBNT_TYPE := BZ
55 UBNT_VERSION := 6.0.0
56 endef
57
58 define Device/ubnt-sw
59 $(Device/ubnt)
60 SOC := ar7242
61 DEVICE_PACKAGES += kmod-usb-ohci
62 IMAGE_SIZE := 7552k
63 UBNT_BOARD := SW
64 UBNT_CHIP := ar7240
65 UBNT_TYPE := SW
66 UBNT_VERSION := 1.4.1
67 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
68 endef
69
70 define Device/ubnt-2wa
71 $(Device/ubnt)
72 SOC := ar9342
73 IMAGE_SIZE := 15744k
74 UBNT_BOARD := WA
75 UBNT_CHIP := ar934x
76 UBNT_TYPE := 2WA
77 UBNT_VERSION := 8.5.3
78 endef
79
80 define Device/ubnt-wa
81 $(Device/ubnt)
82 SOC := ar9342
83 IMAGE_SIZE := 15744k
84 UBNT_BOARD := WA
85 UBNT_CHIP := ar934x
86 UBNT_TYPE := WA
87 UBNT_VERSION := 8.5.3
88 endef
89
90 define Device/ubnt-xc
91 $(Device/ubnt)
92 IMAGE_SIZE := 15744k
93 UBNT_BOARD := XC
94 UBNT_CHIP := qca955x
95 UBNT_TYPE := XC
96 UBNT_VERSION := 8.5.3
97 endef
98
99 define Device/ubnt-xm
100 $(Device/ubnt)
101 DEVICE_VARIANT := XM
102 DEVICE_PACKAGES += kmod-usb-ohci
103 IMAGE_SIZE := 7448k
104 UBNT_BOARD := XM
105 UBNT_CHIP := ar7240
106 UBNT_REVISION := 42.$(UBNT_REVISION)
107 UBNT_TYPE := XM
108 UBNT_VERSION := 6.0.0
109 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
110 endef
111
112 define Device/ubnt-xw
113 $(Device/ubnt)
114 SOC := ar9342
115 DEVICE_VARIANT := XW
116 IMAGE_SIZE := 7552k
117 UBNT_BOARD := XM
118 UBNT_CHIP := ar934x
119 UBNT_REVISION := 42.$(UBNT_REVISION)
120 UBNT_TYPE := XW
121 UBNT_VERSION := 6.0.4
122 endef
123
124 define Device/ubnt-unifi-jffs2
125 $(Device/ubnt)
126 KERNEL_SIZE := 3072k
127 IMAGE_SIZE := 15744k
128 UBNT_TYPE := BZ
129 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0
130 IMAGES := sysupgrade.bin factory.bin
131 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\
132 pad-rootfs | check-size | append-metadata
133 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
134 endef
135
136 define Device/ubnt-acb
137 $(Device/ubnt)
138 IMAGE_SIZE := 15744k
139 UBNT_BOARD := ACB
140 UBNT_TYPE := ACB
141 UBNT_VERSION := 2.5.0
142 endef
143
144 define Device/ubnt_aircube-ac
145 $(Device/ubnt-acb)
146 SOC := ar9342
147 DEVICE_MODEL := airCube AC
148 UBNT_CHIP := ar9342
149 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
150 endef
151 TARGET_DEVICES += ubnt_aircube-ac
152
153 define Device/ubnt_aircube-isp
154 $(Device/ubnt-acb)
155 SOC := qca9533
156 DEVICE_MODEL := airCube ISP
157 UBNT_CHIP := qca9533
158 SUPPORTED_DEVICES += ubnt,acb-isp
159 endef
160 TARGET_DEVICES += ubnt_aircube-isp
161
162 define Device/ubnt_airrouter
163 $(Device/ubnt-xm)
164 SOC := ar7241
165 DEVICE_MODEL := AirRouter
166 SUPPORTED_DEVICES += airrouter
167 endef
168 TARGET_DEVICES += ubnt_airrouter
169
170 define Device/ubnt_bullet-ac
171 $(Device/ubnt-2wa)
172 DEVICE_MODEL := Bullet AC
173 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
174 endef
175 TARGET_DEVICES += ubnt_bullet-ac
176
177 define Device/ubnt_bullet-m-ar7240
178 $(Device/ubnt-xm)
179 SOC := ar7240
180 DEVICE_MODEL := Bullet M
181 DEVICE_VARIANT := XM (AR7240)
182 DEVICE_PACKAGES += rssileds
183 SUPPORTED_DEVICES += bullet-m
184 endef
185 TARGET_DEVICES += ubnt_bullet-m-ar7240
186
187 define Device/ubnt_bullet-m-ar7241
188 $(Device/ubnt-xm)
189 SOC := ar7241
190 DEVICE_MODEL := Bullet M
191 DEVICE_VARIANT := XM (AR7241)
192 DEVICE_PACKAGES += rssileds
193 SUPPORTED_DEVICES += bullet-m ubnt,bullet-m
194 endef
195 TARGET_DEVICES += ubnt_bullet-m-ar7241
196
197 define Device/ubnt_bullet-m-xw
198 $(Device/ubnt-xw)
199 DEVICE_MODEL := Bullet M
200 DEVICE_PACKAGES += rssileds
201 SUPPORTED_DEVICES += bullet-m-xw
202 endef
203 TARGET_DEVICES += ubnt_bullet-m-xw
204
205 define Device/ubnt_edgeswitch-5xp
206 $(Device/ubnt-sw)
207 DEVICE_MODEL := EdgeSwitch 5XP
208 endef
209 TARGET_DEVICES += ubnt_edgeswitch-5xp
210
211 define Device/ubnt_edgeswitch-8xp
212 $(Device/ubnt-sw)
213 DEVICE_MODEL := EdgeSwitch 8XP
214 DEVICE_PACKAGES += kmod-switch-bcm53xx-mdio
215 endef
216 TARGET_DEVICES += ubnt_edgeswitch-8xp
217
218 define Device/ubnt_lap-120
219 $(Device/ubnt-wa)
220 DEVICE_MODEL := LiteAP ac (LAP-120)
221 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
222 endef
223 TARGET_DEVICES += ubnt_lap-120
224
225 define Device/ubnt_litebeam-ac-gen2
226 $(Device/ubnt-wa)
227 DEVICE_MODEL := LiteBeam AC
228 DEVICE_VARIANT := Gen2
229 DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
230 endef
231 TARGET_DEVICES += ubnt_litebeam-ac-gen2
232
233 define Device/ubnt_nanobeam-ac
234 $(Device/ubnt-wa)
235 DEVICE_MODEL := NanoBeam AC
236 DEVICE_VARIANT := Gen1
237 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
238 endef
239 TARGET_DEVICES += ubnt_nanobeam-ac
240
241 define Device/ubnt_nanobeam-ac-gen2
242 $(Device/ubnt-wa)
243 DEVICE_MODEL := NanoBeam AC
244 DEVICE_VARIANT := Gen2
245 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
246 endef
247 TARGET_DEVICES += ubnt_nanobeam-ac-gen2
248
249 define Device/ubnt_nanobeam-ac-xc
250 $(Device/ubnt-xc)
251 SOC := qca9558
252 DEVICE_MODEL := NanoBeam AC
253 DEVICE_VARIANT := Gen1 (XC)
254 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct rssileds
255 endef
256 TARGET_DEVICES += ubnt_nanobeam-ac-xc
257
258 define Device/ubnt_nanobeam-m5
259 $(Device/ubnt-xw)
260 DEVICE_MODEL := NanoBeam M5
261 DEVICE_PACKAGES += rssileds
262 SUPPORTED_DEVICES += loco-m-xw
263 endef
264 TARGET_DEVICES += ubnt_nanobeam-m5
265
266 define Device/ubnt_nanobridge-m
267 $(Device/ubnt-xm)
268 SOC := ar7241
269 DEVICE_MODEL := NanoBridge M
270 DEVICE_PACKAGES += rssileds
271 SUPPORTED_DEVICES += bullet-m
272 endef
273 TARGET_DEVICES += ubnt_nanobridge-m
274
275 define Device/ubnt_nanostation-ac
276 $(Device/ubnt-wa)
277 DEVICE_MODEL := Nanostation AC
278 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
279 endef
280 TARGET_DEVICES += ubnt_nanostation-ac
281
282 define Device/ubnt_nanostation-ac-loco
283 $(Device/ubnt-wa)
284 DEVICE_MODEL := Nanostation AC loco
285 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
286 endef
287 TARGET_DEVICES += ubnt_nanostation-ac-loco
288
289 define Device/ubnt_nanostation-loco-m
290 $(Device/ubnt-xm)
291 SOC := ar7241
292 DEVICE_MODEL := Nanostation Loco M
293 DEVICE_PACKAGES += rssileds
294 SUPPORTED_DEVICES += bullet-m
295 endef
296 TARGET_DEVICES += ubnt_nanostation-loco-m
297
298 define Device/ubnt_nanostation-loco-m-xw
299 $(Device/ubnt-xw)
300 DEVICE_MODEL := Nanostation Loco M
301 DEVICE_PACKAGES += rssileds
302 SUPPORTED_DEVICES += loco-m-xw
303 endef
304 TARGET_DEVICES += ubnt_nanostation-loco-m-xw
305
306 define Device/ubnt_nanostation-m
307 $(Device/ubnt-xm)
308 SOC := ar7241
309 DEVICE_MODEL := Nanostation M
310 DEVICE_PACKAGES += rssileds
311 SUPPORTED_DEVICES += nanostation-m
312 endef
313 TARGET_DEVICES += ubnt_nanostation-m
314
315 define Device/ubnt_nanostation-m-xw
316 $(Device/ubnt-xw)
317 DEVICE_MODEL := Nanostation M
318 DEVICE_PACKAGES += rssileds
319 SUPPORTED_DEVICES += nanostation-m-xw
320 endef
321 TARGET_DEVICES += ubnt_nanostation-m-xw
322
323 define Device/ubnt_picostation-m
324 $(Device/ubnt-xm)
325 SOC := ar7241
326 DEVICE_MODEL := Picostation M
327 DEVICE_PACKAGES += rssileds
328 SUPPORTED_DEVICES += bullet-m
329 endef
330 TARGET_DEVICES += ubnt_picostation-m
331
332 define Device/ubnt_powerbeam-5ac-500
333 $(Device/ubnt-xc)
334 SOC := qca9558
335 DEVICE_MODEL := PowerBeam 5AC
336 DEVICE_VARIANT := 500
337 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
338 endef
339 TARGET_DEVICES += ubnt_powerbeam-5ac-500
340
341 define Device/ubnt_powerbeam-5ac-gen2
342 $(Device/ubnt-wa)
343 DEVICE_MODEL := PowerBeam 5AC
344 DEVICE_VARIANT := Gen2
345 DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
346 endef
347 TARGET_DEVICES += ubnt_powerbeam-5ac-gen2
348
349 define Device/ubnt_powerbeam-m2-xw
350 $(Device/ubnt-xw)
351 DEVICE_MODEL := PowerBeam M2
352 DEVICE_PACKAGES += rssileds
353 SUPPORTED_DEVICES += loco-m-xw
354 endef
355 TARGET_DEVICES += ubnt_powerbeam-m2-xw
356
357 define Device/ubnt_powerbeam-m5-xw
358 $(Device/ubnt-xw)
359 DEVICE_MODEL := PowerBeam M5
360 DEVICE_PACKAGES += rssileds
361 SUPPORTED_DEVICES += loco-m-xw
362 endef
363 TARGET_DEVICES += ubnt_powerbeam-m5-xw
364
365 define Device/ubnt_powerbridge-m
366 $(Device/ubnt-xm)
367 SOC := ar7241
368 DEVICE_MODEL := PowerBridge M
369 DEVICE_PACKAGES += rssileds
370 SUPPORTED_DEVICES += bullet-m
371 endef
372 TARGET_DEVICES += ubnt_powerbridge-m
373
374 define Device/ubnt_rocket-5ac-lite
375 $(Device/ubnt-xc)
376 SOC := qca9558
377 DEVICE_MODEL := Rocket 5AC
378 DEVICE_VARIANT := Lite
379 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
380 endef
381 TARGET_DEVICES += ubnt_rocket-5ac-lite
382
383 define Device/ubnt_rocket-m
384 $(Device/ubnt-xm)
385 SOC := ar7241
386 DEVICE_MODEL := Rocket M
387 DEVICE_PACKAGES += rssileds
388 SUPPORTED_DEVICES += rocket-m
389 endef
390 TARGET_DEVICES += ubnt_rocket-m
391
392 define Device/ubnt_routerstation_common
393 DEVICE_PACKAGES := -kmod-ath9k -wpad-basic-wolfssl -uboot-envtools kmod-usb-ohci \
394 kmod-usb2 fconfig
395 DEVICE_VENDOR := Ubiquiti
396 SOC := ar7161
397 IMAGE_SIZE := 16128k
398 IMAGES += factory.bin
399 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \
400 check-size
401 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \
402 check-size | append-metadata
403 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
404 KERNEL_INITRAMFS := kernel-bin | append-dtb
405 endef
406
407 define Device/ubnt_routerstation
408 $(Device/ubnt_routerstation_common)
409 DEVICE_MODEL := RouterStation
410 UBNT_BOARD := RS
411 UBNT_TYPE := RSx
412 UBNT_CHIP := ar7100
413 DEVICE_PACKAGES += -swconfig
414 SUPPORTED_DEVICES += routerstation
415 endef
416 TARGET_DEVICES += ubnt_routerstation
417
418 define Device/ubnt_routerstation-pro
419 $(Device/ubnt_routerstation_common)
420 DEVICE_MODEL := RouterStation Pro
421 UBNT_BOARD := RSPRO
422 UBNT_TYPE := RSPRO
423 UBNT_CHIP := ar7100pro
424 SUPPORTED_DEVICES += routerstation-pro
425 endef
426 TARGET_DEVICES += ubnt_routerstation-pro
427
428 define Device/ubnt_unifi
429 $(Device/ubnt-bz)
430 DEVICE_MODEL := UniFi AP
431 SUPPORTED_DEVICES += unifi
432 endef
433 TARGET_DEVICES += ubnt_unifi
434
435 define Device/ubnt_unifiac
436 DEVICE_VENDOR := Ubiquiti
437 SOC := qca9563
438 IMAGE_SIZE := 7744k
439 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
440 endef
441
442 define Device/ubnt_unifiac-lite
443 $(Device/ubnt_unifiac)
444 DEVICE_MODEL := UniFi AC Lite
445 DEVICE_PACKAGES += -swconfig
446 SUPPORTED_DEVICES += unifiac-lite
447 endef
448 TARGET_DEVICES += ubnt_unifiac-lite
449
450 define Device/ubnt_unifiac-lr
451 $(Device/ubnt_unifiac)
452 DEVICE_MODEL := UniFi AC LR
453 DEVICE_PACKAGES += -swconfig
454 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
455 endef
456 TARGET_DEVICES += ubnt_unifiac-lr
457
458 define Device/ubnt_unifiac-mesh
459 $(Device/ubnt_unifiac)
460 DEVICE_MODEL := UniFi AC Mesh
461 DEVICE_PACKAGES += -swconfig
462 SUPPORTED_DEVICES += unifiac-lite
463 endef
464 TARGET_DEVICES += ubnt_unifiac-mesh
465
466 define Device/ubnt_unifiac-mesh-pro
467 $(Device/ubnt_unifiac)
468 DEVICE_MODEL := UniFi AC Mesh Pro
469 SUPPORTED_DEVICES += unifiac-pro
470 endef
471 TARGET_DEVICES += ubnt_unifiac-mesh-pro
472
473 define Device/ubnt_unifiac-pro
474 $(Device/ubnt_unifiac)
475 DEVICE_MODEL := UniFi AC Pro
476 DEVICE_PACKAGES += kmod-usb2
477 SUPPORTED_DEVICES += unifiac-pro
478 endef
479 TARGET_DEVICES += ubnt_unifiac-pro
480
481 define Device/ubnt_unifi-ap-outdoor-plus
482 $(Device/ubnt-bz)
483 $(Device/ubnt-unifi-jffs2)
484 DEVICE_MODEL := UniFi AP Outdoor+
485 SUPPORTED_DEVICES += unifi-outdoor-plus
486 endef
487 TARGET_DEVICES += ubnt_unifi-ap-outdoor-plus
488
489 define Device/ubnt_unifi-ap-pro
490 $(Device/ubnt-unifi-jffs2)
491 SOC := ar9344
492 DEVICE_MODEL := UniFi AP Pro
493 UBNT_CHIP := ar934x
494 SUPPORTED_DEVICES += uap-pro
495 endef
496 TARGET_DEVICES += ubnt_unifi-ap-pro