ath79: add support for Ubiquiti NanoStation Loco M (XW)
[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 \
12 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
13 -k $(IMAGE_KERNEL) \
14 -r $@ \
15 -o $@
16 endef
17
18 # all UBNT XM/WA devices expect the kernel image to have 1024k while flash, when
19 # booting the image, the size doesn't matter.
20 define Build/mkubntimage-split
21 -[ -f $@ ] && ( \
22 dd if=$@ of=$@.old1 bs=1024k count=1; \
23 dd if=$@ of=$@.old2 bs=1024k skip=1; \
24 $(STAGING_DIR_HOST)/bin/mkfwimage \
25 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \
26 -k $@.old1 \
27 -r $@.old2 \
28 -o $@; \
29 rm $@.old1 $@.old2 )
30 endef
31
32 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
33 # UBNT_TYPE e.g. one of (BZ, XM, XW)
34 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
35 # UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
36 define Device/ubnt
37 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
38 IMAGE_SIZE := 7552k
39 UBNT_BOARD := XM
40 UBNT_VERSION := 6.0.0
41 IMAGES += factory.bin
42 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
43 append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split
44 endef
45
46 define Device/ubnt-xm
47 $(Device/ubnt)
48 DEVICE_PACKAGES += kmod-usb-ohci
49 UBNT_TYPE := XM
50 UBNT_CHIP := ar7240
51 ATH_SOC := ar7241
52 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
53 endef
54
55 define Device/ubnt-bz
56 $(Device/ubnt)
57 UBNT_TYPE := BZ
58 UBNT_CHIP := ar7240
59 ATH_SOC := ar7241
60 endef
61
62 define Device/ubnt-wa
63 $(Device/ubnt)
64 UBNT_TYPE := WA
65 UBNT_CHIP := ar934x
66 UBNT_BOARD := WA
67 UBNT_VERSION := 8.5.0
68 ATH_SOC := ar9342
69 endef
70
71 define Device/ubnt-xw
72 $(Device/ubnt)
73 UBNT_TYPE := XW
74 UBNT_CHIP := ar934x
75 UBNT_BOARD := XM
76 UBNT_VERSION := 6.0.4
77 UBNT_REVISION := 42.$(UBNT_REVISION)
78 ATH_SOC := ar9342
79 endef
80
81 define Device/ubnt_airrouter
82 $(Device/ubnt-xm)
83 DEVICE_TITLE := Ubiquiti AirRouter
84 SUPPORTED_DEVICES += airrouter
85 endef
86 TARGET_DEVICES += ubnt_airrouter
87
88 define Device/ubnt_bullet-m
89 $(Device/ubnt-xm)
90 DEVICE_TITLE := Ubiquiti Bullet-M
91 DEVICE_PACKAGES += rssileds
92 SUPPORTED_DEVICES += bullet-m
93 endef
94 TARGET_DEVICES += ubnt_bullet-m
95
96 define Device/ubnt_bullet-m-xw
97 $(Device/ubnt-xw)
98 DEVICE_TITLE := Ubiquiti Bullet-M (XW)
99 DEVICE_PACKAGES += rssileds
100 SUPPORTED_DEVICES += bullet-m-xw
101 endef
102 TARGET_DEVICES += ubnt_bullet-m-xw
103
104 define Device/ubnt_picostation-m
105 $(Device/ubnt-xm)
106 DEVICE_TITLE := Ubiquiti Picostation M
107 DEVICE_PACKAGES += rssileds
108 SUPPORTED_DEVICES += bullet-m
109 endef
110 TARGET_DEVICES += ubnt_picostation-m
111
112 define Device/ubnt_rocket-m
113 $(Device/ubnt-xm)
114 DEVICE_TITLE := Ubiquiti Rocket-M
115 DEVICE_PACKAGES += rssileds
116 SUPPORTED_DEVICES += rocket-m
117 endef
118 TARGET_DEVICES += ubnt_rocket-m
119
120 define Device/ubnt_nanostation-loco-m
121 $(Device/ubnt-xm)
122 DEVICE_TITLE := Ubiquiti Nanostation Loco M
123 DEVICE_PACKAGES += rssileds
124 SUPPORTED_DEVICES += bullet-m
125 endef
126 TARGET_DEVICES += ubnt_nanostation-loco-m
127
128 define Device/ubnt_nanostation-loco-m-xw
129 $(Device/ubnt-xw)
130 DEVICE_TITLE := Ubiquiti Nanostation Loco M (XW)
131 DEVICE_PACKAGES += rssileds
132 SUPPORTED_DEVICES += loco-m-xw
133 endef
134 TARGET_DEVICES += ubnt_nanostation-loco-m-xw
135
136 define Device/ubnt_nanostation-m
137 $(Device/ubnt-xm)
138 DEVICE_TITLE := Ubiquiti Nanostation M
139 DEVICE_PACKAGES += rssileds
140 SUPPORTED_DEVICES += nanostation-m
141 endef
142 TARGET_DEVICES += ubnt_nanostation-m
143
144 define Device/ubnt_nanostation-m-xw
145 $(Device/ubnt-xw)
146 DEVICE_TITLE := Ubiquiti Nanostation M (XW)
147 DEVICE_PACKAGES += rssileds
148 SUPPORTED_DEVICES += nanostation-m-xw
149 endef
150 TARGET_DEVICES += ubnt_nanostation-m-xw
151
152 define Device/ubnt_lap-120
153 $(Device/ubnt-wa)
154 DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)
155 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
156 IMAGE_SIZE := 15744k
157 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
158 endef
159 TARGET_DEVICES += ubnt_lap-120
160
161 define Device/ubnt_nanobeam-ac
162 $(Device/ubnt-wa)
163 DEVICE_TITLE := Ubiquiti NanoBeam AC
164 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
165 IMAGE_SIZE := 15744k
166 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
167 endef
168 TARGET_DEVICES += ubnt_nanobeam-ac
169
170 define Device/ubnt_nanostation-ac
171 $(Device/ubnt-wa)
172 DEVICE_TITLE := Ubiquiti Nanostation AC
173 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
174 IMAGE_SIZE := 15744k
175 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
176 endef
177 TARGET_DEVICES += ubnt_nanostation-ac
178
179 define Device/ubnt_nanostation-ac-loco
180 $(Device/ubnt-wa)
181 DEVICE_TITLE := Ubiquiti Nanostation AC loco
182 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
183 IMAGE_SIZE := 15744k
184 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
185 endef
186 TARGET_DEVICES += ubnt_nanostation-ac-loco
187
188 define Device/ubnt_unifi
189 $(Device/ubnt-bz)
190 DEVICE_TITLE := Ubiquiti UniFi
191 SUPPORTED_DEVICES += unifi
192 endef
193 TARGET_DEVICES += ubnt_unifi
194
195 define Device/ubnt_unifiac
196 ATH_SOC := qca9563
197 IMAGE_SIZE := 7744k
198 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
199 endef
200
201
202 define Device/ubnt_unifiac-lite
203 $(Device/ubnt_unifiac)
204 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
205 SUPPORTED_DEVICES += unifiac-lite
206 endef
207 TARGET_DEVICES += ubnt_unifiac-lite
208
209 define Device/ubnt_unifiac-lr
210 $(Device/ubnt_unifiac)
211 DEVICE_TITLE := Ubiquiti UniFi AC-LR
212 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
213 endef
214 TARGET_DEVICES += ubnt_unifiac-lr
215
216 define Device/ubnt_unifiac-mesh
217 $(Device/ubnt_unifiac)
218 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
219 SUPPORTED_DEVICES += unifiac-lite
220 endef
221 TARGET_DEVICES += ubnt_unifiac-mesh
222
223 define Device/ubnt_unifiac-mesh-pro
224 $(Device/ubnt_unifiac)
225 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh Pro
226 SUPPORTED_DEVICES += unifiac-pro
227 endef
228 TARGET_DEVICES += ubnt_unifiac-mesh-pro
229
230 define Device/ubnt_unifiac-pro
231 $(Device/ubnt_unifiac)
232 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
233 DEVICE_PACKAGES += kmod-usb-core kmod-usb2
234 SUPPORTED_DEVICES += unifiac-pro
235 endef
236 TARGET_DEVICES += ubnt_unifiac-pro
237
238 define Device/ubnt_routerstation_common
239 DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig
240 ATH_SOC := ar7161
241 IMAGE_SIZE := 16128k
242 IMAGES += factory.bin
243 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE)
244 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | append-metadata | check-size $$$$(IMAGE_SIZE)
245 # IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
246 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
247 KERNEL_INITRAMFS := kernel-bin | append-dtb
248 endef
249
250 define Device/ubnt_routerstation
251 $(Device/ubnt_routerstation_common)
252 DEVICE_TITLE := Ubiquiti RouterStation
253 UBNT_BOARD := RS
254 UBNT_TYPE := RSx
255 UBNT_CHIP := ar7100
256 DEVICE_PACKAGES += -swconfig
257 SUPPORTED_DEVICES += routerstation
258 endef
259 TARGET_DEVICES += ubnt_routerstation
260
261 define Device/ubnt_routerstation-pro
262 $(Device/ubnt_routerstation_common)
263 DEVICE_TITLE := Ubiquiti RouterStation Pro
264 UBNT_BOARD := RSPRO
265 UBNT_TYPE := RSPRO
266 UBNT_CHIP := ar7100pro
267 SUPPORTED_DEVICES += routerstation-pro
268 endef
269 TARGET_DEVICES += ubnt_routerstation-pro
270
271 define Device/ubnt_acb-isp
272 $(Device/ubnt)
273 ATH_SOC := qca9533
274 IMAGE_SIZE := 15744k
275 DEVICE_TITLE := Ubiquiti airCube ISP
276 UBNT_BOARD := ACB-ISP
277 UBNT_TYPE := ACB
278 UBNT_CHIP := qca9533
279 IMAGES := sysupgrade.bin
280 endef
281 TARGET_DEVICES += ubnt_acb-isp