1ae16554bc3f95580cbc8aea5d732c97a1a036ed
[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-m
129 $(Device/ubnt-xm)
130 DEVICE_TITLE := Ubiquiti Nanostation M
131 DEVICE_PACKAGES += rssileds
132 SUPPORTED_DEVICES += nanostation-m
133 endef
134 TARGET_DEVICES += ubnt_nanostation-m
135
136 define Device/ubnt_nanostation-m-xw
137 $(Device/ubnt-xw)
138 DEVICE_TITLE := Ubiquiti Nanostation M (XW)
139 DEVICE_PACKAGES += rssileds
140 SUPPORTED_DEVICES += nanostation-m-xw
141 endef
142 TARGET_DEVICES += ubnt_nanostation-m-xw
143
144 define Device/ubnt_lap-120
145 $(Device/ubnt-wa)
146 DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)
147 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
148 IMAGE_SIZE := 15744k
149 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
150 endef
151 TARGET_DEVICES += ubnt_lap-120
152
153 define Device/ubnt_nanobeam-ac
154 $(Device/ubnt-wa)
155 DEVICE_TITLE := Ubiquiti NanoBeam AC
156 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
157 IMAGE_SIZE := 15744k
158 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
159 endef
160 TARGET_DEVICES += ubnt_nanobeam-ac
161
162 define Device/ubnt_nanostation-ac
163 $(Device/ubnt-wa)
164 DEVICE_TITLE := Ubiquiti Nanostation AC
165 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct rssileds
166 IMAGE_SIZE := 15744k
167 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
168 endef
169 TARGET_DEVICES += ubnt_nanostation-ac
170
171 define Device/ubnt_nanostation-ac-loco
172 $(Device/ubnt-wa)
173 DEVICE_TITLE := Ubiquiti Nanostation AC loco
174 DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
175 IMAGE_SIZE := 15744k
176 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
177 endef
178 TARGET_DEVICES += ubnt_nanostation-ac-loco
179
180 define Device/ubnt_unifi
181 $(Device/ubnt-bz)
182 DEVICE_TITLE := Ubiquiti UniFi
183 SUPPORTED_DEVICES += unifi
184 endef
185 TARGET_DEVICES += ubnt_unifi
186
187 define Device/ubnt_unifiac
188 ATH_SOC := qca9563
189 IMAGE_SIZE := 7744k
190 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
191 endef
192
193
194 define Device/ubnt_unifiac-lite
195 $(Device/ubnt_unifiac)
196 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
197 SUPPORTED_DEVICES += unifiac-lite
198 endef
199 TARGET_DEVICES += ubnt_unifiac-lite
200
201 define Device/ubnt_unifiac-lr
202 $(Device/ubnt_unifiac)
203 DEVICE_TITLE := Ubiquiti UniFi AC-LR
204 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
205 endef
206 TARGET_DEVICES += ubnt_unifiac-lr
207
208 define Device/ubnt_unifiac-mesh
209 $(Device/ubnt_unifiac)
210 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
211 SUPPORTED_DEVICES += unifiac-lite
212 endef
213 TARGET_DEVICES += ubnt_unifiac-mesh
214
215 define Device/ubnt_unifiac-mesh-pro
216 $(Device/ubnt_unifiac)
217 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh Pro
218 SUPPORTED_DEVICES += unifiac-pro
219 endef
220 TARGET_DEVICES += ubnt_unifiac-mesh-pro
221
222 define Device/ubnt_unifiac-pro
223 $(Device/ubnt_unifiac)
224 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
225 DEVICE_PACKAGES += kmod-usb-core kmod-usb2
226 SUPPORTED_DEVICES += unifiac-pro
227 endef
228 TARGET_DEVICES += ubnt_unifiac-pro
229
230 define Device/ubnt_routerstation_common
231 DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig
232 ATH_SOC := ar7161
233 IMAGE_SIZE := 16128k
234 IMAGES += factory.bin
235 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE)
236 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | append-metadata | check-size $$$$(IMAGE_SIZE)
237 # IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
238 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
239 KERNEL_INITRAMFS := kernel-bin | append-dtb
240 endef
241
242 define Device/ubnt_routerstation
243 $(Device/ubnt_routerstation_common)
244 DEVICE_TITLE := Ubiquiti RouterStation
245 UBNT_BOARD := RS
246 UBNT_TYPE := RSx
247 UBNT_CHIP := ar7100
248 DEVICE_PACKAGES += -swconfig
249 SUPPORTED_DEVICES += routerstation
250 endef
251 TARGET_DEVICES += ubnt_routerstation
252
253 define Device/ubnt_routerstation-pro
254 $(Device/ubnt_routerstation_common)
255 DEVICE_TITLE := Ubiquiti RouterStation Pro
256 UBNT_BOARD := RSPRO
257 UBNT_TYPE := RSPRO
258 UBNT_CHIP := ar7100pro
259 SUPPORTED_DEVICES += routerstation-pro
260 endef
261 TARGET_DEVICES += ubnt_routerstation-pro
262
263 define Device/ubnt_acb-isp
264 $(Device/ubnt)
265 ATH_SOC := qca9533
266 IMAGE_SIZE := 15744k
267 DEVICE_TITLE := Ubiquiti airCube ISP
268 UBNT_BOARD := ACB-ISP
269 UBNT_TYPE := ACB
270 UBNT_CHIP := qca9533
271 IMAGES := sysupgrade.bin
272 endef
273 TARGET_DEVICES += ubnt_acb-isp