153b73abb0ef57421a6360c56858dfdd29fae6fb
[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_nanobridge-m
259 $(Device/ubnt-xm)
260 SOC := ar7241
261 DEVICE_MODEL := NanoBridge M
262 DEVICE_PACKAGES += rssileds
263 SUPPORTED_DEVICES += bullet-m
264 endef
265 TARGET_DEVICES += ubnt_nanobridge-m
266
267 define Device/ubnt_nanostation-ac
268 $(Device/ubnt-wa)
269 DEVICE_MODEL := Nanostation AC
270 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
271 endef
272 TARGET_DEVICES += ubnt_nanostation-ac
273
274 define Device/ubnt_nanostation-ac-loco
275 $(Device/ubnt-wa)
276 DEVICE_MODEL := Nanostation AC loco
277 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
278 endef
279 TARGET_DEVICES += ubnt_nanostation-ac-loco
280
281 define Device/ubnt_nanostation-loco-m
282 $(Device/ubnt-xm)
283 SOC := ar7241
284 DEVICE_MODEL := Nanostation Loco M
285 DEVICE_PACKAGES += rssileds
286 SUPPORTED_DEVICES += bullet-m
287 endef
288 TARGET_DEVICES += ubnt_nanostation-loco-m
289
290 define Device/ubnt_nanostation-loco-m-xw
291 $(Device/ubnt-xw)
292 DEVICE_MODEL := Nanostation Loco M
293 DEVICE_PACKAGES += rssileds
294 SUPPORTED_DEVICES += loco-m-xw
295 endef
296 TARGET_DEVICES += ubnt_nanostation-loco-m-xw
297
298 define Device/ubnt_nanostation-m
299 $(Device/ubnt-xm)
300 SOC := ar7241
301 DEVICE_MODEL := Nanostation M
302 DEVICE_PACKAGES += rssileds
303 SUPPORTED_DEVICES += nanostation-m
304 endef
305 TARGET_DEVICES += ubnt_nanostation-m
306
307 define Device/ubnt_nanostation-m-xw
308 $(Device/ubnt-xw)
309 DEVICE_MODEL := Nanostation M
310 DEVICE_PACKAGES += rssileds
311 SUPPORTED_DEVICES += nanostation-m-xw
312 endef
313 TARGET_DEVICES += ubnt_nanostation-m-xw
314
315 define Device/ubnt_picostation-m
316 $(Device/ubnt-xm)
317 SOC := ar7241
318 DEVICE_MODEL := Picostation M
319 DEVICE_PACKAGES += rssileds
320 SUPPORTED_DEVICES += bullet-m
321 endef
322 TARGET_DEVICES += ubnt_picostation-m
323
324 define Device/ubnt_powerbeam-5ac-500
325 $(Device/ubnt-xc)
326 SOC := qca9558
327 DEVICE_MODEL := PowerBeam 5AC
328 DEVICE_VARIANT := 500
329 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
330 endef
331 TARGET_DEVICES += ubnt_powerbeam-5ac-500
332
333 define Device/ubnt_powerbeam-5ac-gen2
334 $(Device/ubnt-wa)
335 DEVICE_MODEL := PowerBeam 5AC
336 DEVICE_VARIANT := Gen2
337 DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
338 endef
339 TARGET_DEVICES += ubnt_powerbeam-5ac-gen2
340
341 define Device/ubnt_powerbeam-m2-xw
342 $(Device/ubnt-xw)
343 DEVICE_MODEL := PowerBeam M2
344 DEVICE_PACKAGES += rssileds
345 SUPPORTED_DEVICES += loco-m-xw
346 endef
347 TARGET_DEVICES += ubnt_powerbeam-m2-xw
348
349 define Device/ubnt_powerbeam-m5-xw
350 $(Device/ubnt-xw)
351 DEVICE_MODEL := PowerBeam M5
352 DEVICE_PACKAGES += rssileds
353 SUPPORTED_DEVICES += loco-m-xw
354 endef
355 TARGET_DEVICES += ubnt_powerbeam-m5-xw
356
357 define Device/ubnt_powerbridge-m
358 $(Device/ubnt-xm)
359 SOC := ar7241
360 DEVICE_MODEL := PowerBridge M
361 DEVICE_PACKAGES += rssileds
362 SUPPORTED_DEVICES += bullet-m
363 endef
364 TARGET_DEVICES += ubnt_powerbridge-m
365
366 define Device/ubnt_rocket-5ac-lite
367 $(Device/ubnt-xc)
368 SOC := qca9558
369 DEVICE_MODEL := Rocket 5AC
370 DEVICE_VARIANT := Lite
371 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
372 endef
373 TARGET_DEVICES += ubnt_rocket-5ac-lite
374
375 define Device/ubnt_rocket-m
376 $(Device/ubnt-xm)
377 SOC := ar7241
378 DEVICE_MODEL := Rocket M
379 DEVICE_PACKAGES += rssileds
380 SUPPORTED_DEVICES += rocket-m
381 endef
382 TARGET_DEVICES += ubnt_rocket-m
383
384 define Device/ubnt_routerstation_common
385 DEVICE_PACKAGES := -kmod-ath9k -wpad-basic-wolfssl -uboot-envtools kmod-usb-ohci \
386 kmod-usb2 fconfig
387 DEVICE_VENDOR := Ubiquiti
388 SOC := ar7161
389 IMAGE_SIZE := 16128k
390 IMAGES += factory.bin
391 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \
392 check-size
393 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \
394 check-size | append-metadata
395 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
396 KERNEL_INITRAMFS := kernel-bin | append-dtb
397 endef
398
399 define Device/ubnt_routerstation
400 $(Device/ubnt_routerstation_common)
401 DEVICE_MODEL := RouterStation
402 UBNT_BOARD := RS
403 UBNT_TYPE := RSx
404 UBNT_CHIP := ar7100
405 DEVICE_PACKAGES += -swconfig
406 SUPPORTED_DEVICES += routerstation
407 endef
408 TARGET_DEVICES += ubnt_routerstation
409
410 define Device/ubnt_routerstation-pro
411 $(Device/ubnt_routerstation_common)
412 DEVICE_MODEL := RouterStation Pro
413 UBNT_BOARD := RSPRO
414 UBNT_TYPE := RSPRO
415 UBNT_CHIP := ar7100pro
416 SUPPORTED_DEVICES += routerstation-pro
417 endef
418 TARGET_DEVICES += ubnt_routerstation-pro
419
420 define Device/ubnt_unifi
421 $(Device/ubnt-bz)
422 DEVICE_MODEL := UniFi AP
423 SUPPORTED_DEVICES += unifi
424 endef
425 TARGET_DEVICES += ubnt_unifi
426
427 define Device/ubnt_unifiac
428 DEVICE_VENDOR := Ubiquiti
429 SOC := qca9563
430 IMAGE_SIZE := 7744k
431 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
432 endef
433
434 define Device/ubnt_unifiac-lite
435 $(Device/ubnt_unifiac)
436 DEVICE_MODEL := UniFi AC Lite
437 DEVICE_PACKAGES += -swconfig
438 SUPPORTED_DEVICES += unifiac-lite
439 endef
440 TARGET_DEVICES += ubnt_unifiac-lite
441
442 define Device/ubnt_unifiac-lr
443 $(Device/ubnt_unifiac)
444 DEVICE_MODEL := UniFi AC LR
445 DEVICE_PACKAGES += -swconfig
446 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
447 endef
448 TARGET_DEVICES += ubnt_unifiac-lr
449
450 define Device/ubnt_unifiac-mesh
451 $(Device/ubnt_unifiac)
452 DEVICE_MODEL := UniFi AC Mesh
453 DEVICE_PACKAGES += -swconfig
454 SUPPORTED_DEVICES += unifiac-lite
455 endef
456 TARGET_DEVICES += ubnt_unifiac-mesh
457
458 define Device/ubnt_unifiac-mesh-pro
459 $(Device/ubnt_unifiac)
460 DEVICE_MODEL := UniFi AC Mesh Pro
461 SUPPORTED_DEVICES += unifiac-pro
462 endef
463 TARGET_DEVICES += ubnt_unifiac-mesh-pro
464
465 define Device/ubnt_unifiac-pro
466 $(Device/ubnt_unifiac)
467 DEVICE_MODEL := UniFi AC Pro
468 DEVICE_PACKAGES += kmod-usb2
469 SUPPORTED_DEVICES += unifiac-pro
470 endef
471 TARGET_DEVICES += ubnt_unifiac-pro
472
473 define Device/ubnt_unifi-ap-outdoor-plus
474 $(Device/ubnt-bz)
475 $(Device/ubnt-unifi-jffs2)
476 DEVICE_MODEL := UniFi AP Outdoor+
477 SUPPORTED_DEVICES += unifi-outdoor-plus
478 endef
479 TARGET_DEVICES += ubnt_unifi-ap-outdoor-plus
480
481 define Device/ubnt_unifi-ap-pro
482 $(Device/ubnt-unifi-jffs2)
483 SOC := ar9344
484 DEVICE_MODEL := UniFi AP Pro
485 UBNT_CHIP := ar934x
486 SUPPORTED_DEVICES += uap-pro
487 endef
488 TARGET_DEVICES += ubnt_unifi-ap-pro