ath79: add support for Ubiquiti airCube AC
[openwrt/openwrt.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-wa
71 $(Device/ubnt)
72 SOC := ar9342
73 IMAGE_SIZE := 15744k
74 UBNT_BOARD := WA
75 UBNT_CHIP := ar934x
76 UBNT_TYPE := WA
77 UBNT_VERSION := 8.5.3
78 endef
79
80 define Device/ubnt-xc
81 $(Device/ubnt)
82 IMAGE_SIZE := 15744k
83 UBNT_BOARD := XC
84 UBNT_CHIP := qca955x
85 UBNT_TYPE := XC
86 UBNT_VERSION := 8.5.3
87 endef
88
89 define Device/ubnt-xm
90 $(Device/ubnt)
91 DEVICE_VARIANT := XM
92 DEVICE_PACKAGES += kmod-usb-ohci
93 IMAGE_SIZE := 7448k
94 UBNT_BOARD := XM
95 UBNT_CHIP := ar7240
96 UBNT_TYPE := XM
97 UBNT_VERSION := 6.0.0
98 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
99 endef
100
101 define Device/ubnt-xw
102 $(Device/ubnt)
103 SOC := ar9342
104 DEVICE_VARIANT := XW
105 IMAGE_SIZE := 7552k
106 UBNT_BOARD := XM
107 UBNT_CHIP := ar934x
108 UBNT_REVISION := 42.$(UBNT_REVISION)
109 UBNT_TYPE := XW
110 UBNT_VERSION := 6.0.4
111 endef
112
113 define Device/ubnt-acb
114 $(Device/ubnt)
115 IMAGE_SIZE := 15744k
116 UBNT_BOARD := ACB
117 UBNT_TYPE := ACB
118 UBNT_VERSION := 2.5.0
119 endef
120
121 define Device/ubnt_aircube-ac
122 $(Device/ubnt-acb)
123 SOC := ar9342
124 DEVICE_MODEL := airCube AC
125 UBNT_CHIP := ar9342
126 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
127 endef
128 TARGET_DEVICES += ubnt_aircube-ac
129
130 define Device/ubnt_aircube-isp
131 $(Device/ubnt-acb)
132 SOC := qca9533
133 DEVICE_MODEL := airCube ISP
134 UBNT_CHIP := qca9533
135 SUPPORTED_DEVICES += ubnt,acb-isp
136 endef
137 TARGET_DEVICES += ubnt_aircube-isp
138
139 define Device/ubnt_airrouter
140 $(Device/ubnt-xm)
141 SOC := ar7241
142 DEVICE_MODEL := AirRouter
143 SUPPORTED_DEVICES += airrouter
144 endef
145 TARGET_DEVICES += ubnt_airrouter
146
147 define Device/ubnt_bullet-m-ar7240
148 $(Device/ubnt-xm)
149 SOC := ar7240
150 DEVICE_MODEL := Bullet M
151 DEVICE_VARIANT := XM (AR7240)
152 DEVICE_PACKAGES += rssileds
153 SUPPORTED_DEVICES += bullet-m
154 endef
155 TARGET_DEVICES += ubnt_bullet-m-ar7240
156
157 define Device/ubnt_bullet-m-ar7241
158 $(Device/ubnt-xm)
159 SOC := ar7241
160 DEVICE_MODEL := Bullet M
161 DEVICE_VARIANT := XM (AR7241)
162 DEVICE_PACKAGES += rssileds
163 SUPPORTED_DEVICES += bullet-m ubnt,bullet-m
164 endef
165 TARGET_DEVICES += ubnt_bullet-m-ar7241
166
167 define Device/ubnt_bullet-m-xw
168 $(Device/ubnt-xw)
169 DEVICE_MODEL := Bullet M
170 DEVICE_PACKAGES += rssileds
171 SUPPORTED_DEVICES += bullet-m-xw
172 endef
173 TARGET_DEVICES += ubnt_bullet-m-xw
174
175 define Device/ubnt_edgeswitch-5xp
176 $(Device/ubnt-sw)
177 DEVICE_MODEL := EdgeSwitch 5XP
178 endef
179 TARGET_DEVICES += ubnt_edgeswitch-5xp
180
181 define Device/ubnt_edgeswitch-8xp
182 $(Device/ubnt-sw)
183 DEVICE_MODEL := EdgeSwitch 8XP
184 DEVICE_PACKAGES += kmod-switch-bcm53xx-mdio
185 endef
186 TARGET_DEVICES += ubnt_edgeswitch-8xp
187
188 define Device/ubnt_lap-120
189 $(Device/ubnt-wa)
190 DEVICE_MODEL := LiteAP ac (LAP-120)
191 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
192 endef
193 TARGET_DEVICES += ubnt_lap-120
194
195 define Device/ubnt_litebeam-ac-gen2
196 $(Device/ubnt-wa)
197 DEVICE_MODEL := LiteBeam AC
198 DEVICE_VARIANT := Gen2
199 DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
200 endef
201 TARGET_DEVICES += ubnt_litebeam-ac-gen2
202
203 define Device/ubnt_nanobeam-ac
204 $(Device/ubnt-wa)
205 DEVICE_MODEL := NanoBeam AC
206 DEVICE_VARIANT := Gen1
207 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
208 endef
209 TARGET_DEVICES += ubnt_nanobeam-ac
210
211 define Device/ubnt_nanobeam-ac-gen2
212 $(Device/ubnt-wa)
213 DEVICE_MODEL := NanoBeam AC
214 DEVICE_VARIANT := Gen2
215 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
216 endef
217 TARGET_DEVICES += ubnt_nanobeam-ac-gen2
218
219 define Device/ubnt_nanobridge-m
220 $(Device/ubnt-xm)
221 SOC := ar7241
222 DEVICE_MODEL := NanoBridge M
223 DEVICE_PACKAGES += rssileds
224 SUPPORTED_DEVICES += bullet-m
225 endef
226 TARGET_DEVICES += ubnt_nanobridge-m
227
228 define Device/ubnt_nanostation-ac
229 $(Device/ubnt-wa)
230 DEVICE_MODEL := Nanostation AC
231 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
232 endef
233 TARGET_DEVICES += ubnt_nanostation-ac
234
235 define Device/ubnt_nanostation-ac-loco
236 $(Device/ubnt-wa)
237 DEVICE_MODEL := Nanostation AC loco
238 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
239 endef
240 TARGET_DEVICES += ubnt_nanostation-ac-loco
241
242 define Device/ubnt_nanostation-loco-m
243 $(Device/ubnt-xm)
244 SOC := ar7241
245 DEVICE_MODEL := Nanostation Loco M
246 DEVICE_PACKAGES += rssileds
247 SUPPORTED_DEVICES += bullet-m
248 endef
249 TARGET_DEVICES += ubnt_nanostation-loco-m
250
251 define Device/ubnt_nanostation-loco-m-xw
252 $(Device/ubnt-xw)
253 DEVICE_MODEL := Nanostation Loco M
254 DEVICE_PACKAGES += rssileds
255 SUPPORTED_DEVICES += loco-m-xw
256 endef
257 TARGET_DEVICES += ubnt_nanostation-loco-m-xw
258
259 define Device/ubnt_nanostation-m
260 $(Device/ubnt-xm)
261 SOC := ar7241
262 DEVICE_MODEL := Nanostation M
263 DEVICE_PACKAGES += rssileds
264 SUPPORTED_DEVICES += nanostation-m
265 endef
266 TARGET_DEVICES += ubnt_nanostation-m
267
268 define Device/ubnt_nanostation-m-xw
269 $(Device/ubnt-xw)
270 DEVICE_MODEL := Nanostation M
271 DEVICE_PACKAGES += rssileds
272 SUPPORTED_DEVICES += nanostation-m-xw
273 endef
274 TARGET_DEVICES += ubnt_nanostation-m-xw
275
276 define Device/ubnt_picostation-m
277 $(Device/ubnt-xm)
278 SOC := ar7241
279 DEVICE_MODEL := Picostation M
280 DEVICE_PACKAGES += rssileds
281 SUPPORTED_DEVICES += bullet-m
282 endef
283 TARGET_DEVICES += ubnt_picostation-m
284
285 define Device/ubnt_powerbeam-5ac-500
286 $(Device/ubnt-xc)
287 SOC := qca9558
288 DEVICE_MODEL := PowerBeam 5AC
289 DEVICE_VARIANT := 500
290 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
291 endef
292 TARGET_DEVICES += ubnt_powerbeam-5ac-500
293
294 define Device/ubnt_powerbeam-5ac-gen2
295 $(Device/ubnt-wa)
296 DEVICE_MODEL := PowerBeam 5AC
297 DEVICE_VARIANT := Gen2
298 DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
299 endef
300 TARGET_DEVICES += ubnt_powerbeam-5ac-gen2
301
302 define Device/ubnt_powerbridge-m
303 $(Device/ubnt-xm)
304 SOC := ar7241
305 DEVICE_MODEL := PowerBridge M
306 DEVICE_PACKAGES += rssileds
307 SUPPORTED_DEVICES += bullet-m
308 endef
309 TARGET_DEVICES += ubnt_powerbridge-m
310
311 define Device/ubnt_rocket-m
312 $(Device/ubnt-xm)
313 SOC := ar7241
314 DEVICE_MODEL := Rocket M
315 DEVICE_PACKAGES += rssileds
316 SUPPORTED_DEVICES += rocket-m
317 endef
318 TARGET_DEVICES += ubnt_rocket-m
319
320 define Device/ubnt_routerstation_common
321 DEVICE_PACKAGES := -kmod-ath9k -wpad-basic-wolfssl -uboot-envtools kmod-usb-ohci \
322 kmod-usb2 fconfig
323 DEVICE_VENDOR := Ubiquiti
324 SOC := ar7161
325 IMAGE_SIZE := 16128k
326 IMAGES += factory.bin
327 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \
328 check-size
329 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \
330 append-metadata | check-size
331 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
332 KERNEL_INITRAMFS := kernel-bin | append-dtb
333 endef
334
335 define Device/ubnt_routerstation
336 $(Device/ubnt_routerstation_common)
337 DEVICE_MODEL := RouterStation
338 UBNT_BOARD := RS
339 UBNT_TYPE := RSx
340 UBNT_CHIP := ar7100
341 DEVICE_PACKAGES += -swconfig
342 SUPPORTED_DEVICES += routerstation
343 endef
344 TARGET_DEVICES += ubnt_routerstation
345
346 define Device/ubnt_routerstation-pro
347 $(Device/ubnt_routerstation_common)
348 DEVICE_MODEL := RouterStation Pro
349 UBNT_BOARD := RSPRO
350 UBNT_TYPE := RSPRO
351 UBNT_CHIP := ar7100pro
352 SUPPORTED_DEVICES += routerstation-pro
353 endef
354 TARGET_DEVICES += ubnt_routerstation-pro
355
356 define Device/ubnt_unifi
357 $(Device/ubnt-bz)
358 DEVICE_MODEL := UniFi
359 SUPPORTED_DEVICES += unifi
360 endef
361 TARGET_DEVICES += ubnt_unifi
362
363 define Device/ubnt_unifiac
364 DEVICE_VENDOR := Ubiquiti
365 SOC := qca9563
366 IMAGE_SIZE := 7744k
367 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
368 endef
369
370 define Device/ubnt_unifiac-lite
371 $(Device/ubnt_unifiac)
372 DEVICE_MODEL := UniFi AC Lite
373 SUPPORTED_DEVICES += unifiac-lite
374 endef
375 TARGET_DEVICES += ubnt_unifiac-lite
376
377 define Device/ubnt_unifiac-lr
378 $(Device/ubnt_unifiac)
379 DEVICE_MODEL := UniFi AC LR
380 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
381 endef
382 TARGET_DEVICES += ubnt_unifiac-lr
383
384 define Device/ubnt_unifiac-mesh
385 $(Device/ubnt_unifiac)
386 DEVICE_MODEL := UniFi AC Mesh
387 SUPPORTED_DEVICES += unifiac-lite
388 endef
389 TARGET_DEVICES += ubnt_unifiac-mesh
390
391 define Device/ubnt_unifiac-mesh-pro
392 $(Device/ubnt_unifiac)
393 DEVICE_MODEL := UniFi AC Mesh Pro
394 SUPPORTED_DEVICES += unifiac-pro
395 endef
396 TARGET_DEVICES += ubnt_unifiac-mesh-pro
397
398 define Device/ubnt_unifiac-pro
399 $(Device/ubnt_unifiac)
400 DEVICE_MODEL := UniFi AC Pro
401 DEVICE_PACKAGES += kmod-usb2
402 SUPPORTED_DEVICES += unifiac-pro
403 endef
404 TARGET_DEVICES += ubnt_unifiac-pro
405
406 define Device/ubnt_unifi-ap-pro
407 SOC := ar9344
408 DEVICE_VENDOR := Ubiquiti
409 DEVICE_MODEL := UniFi AP Pro
410 UBNT_TYPE := BZ
411 UBNT_CHIP := ar934x
412 KERNEL_SIZE := 3072k
413 IMAGE_SIZE := 15744k
414 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0
415 IMAGES := sysupgrade.bin factory.bin
416 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\
417 pad-rootfs | append-metadata | check-size
418 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
419 SUPPORTED_DEVICES += uap-pro
420 endef
421 TARGET_DEVICES += ubnt_unifi-ap-pro