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