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