ath79: redistribute UBNT variables in Ubiquiti image Makefile
[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_VENDOR := Ubiquiti
38 DEVICE_PACKAGES := kmod-usb2
39 IMAGES += factory.bin
40 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
41 append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split
42 endef
43
44 define Device/ubnt-bz
45 $(Device/ubnt)
46 ATH_SOC := ar7241
47 IMAGE_SIZE := 7448k
48 UBNT_BOARD := XM
49 UBNT_CHIP := ar7240
50 UBNT_TYPE := BZ
51 UBNT_VERSION := 6.0.0
52 endef
53
54 define Device/ubnt-wa
55 $(Device/ubnt)
56 ATH_SOC := ar9342
57 IMAGE_SIZE := 15744k
58 UBNT_BOARD := WA
59 UBNT_CHIP := ar934x
60 UBNT_TYPE := WA
61 UBNT_VERSION := 8.5.0
62 endef
63
64 define Device/ubnt-xm
65 $(Device/ubnt)
66 ATH_SOC := ar7241
67 DEVICE_VARIANT := XM
68 DEVICE_PACKAGES += kmod-usb-ohci
69 IMAGE_SIZE := 7448k
70 UBNT_BOARD := XM
71 UBNT_CHIP := ar7240
72 UBNT_TYPE := XM
73 UBNT_VERSION := 6.0.0
74 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
75 endef
76
77 define Device/ubnt-xw
78 $(Device/ubnt)
79 ATH_SOC := ar9342
80 DEVICE_VARIANT := XW
81 IMAGE_SIZE := 7552k
82 UBNT_BOARD := XM
83 UBNT_CHIP := ar934x
84 UBNT_REVISION := 42.$(UBNT_REVISION)
85 UBNT_TYPE := XW
86 UBNT_VERSION := 6.0.4
87 endef
88
89 define Device/ubnt_acb-isp
90 $(Device/ubnt)
91 ATH_SOC := qca9533
92 DEVICE_MODEL := airCube ISP
93 IMAGE_SIZE := 15744k
94 UBNT_BOARD := ACB-ISP
95 UBNT_CHIP := qca9533
96 UBNT_TYPE := ACB
97 UBNT_VERSION := 6.0.0
98 IMAGES := sysupgrade.bin
99 endef
100 TARGET_DEVICES += ubnt_acb-isp
101
102 define Device/ubnt_airrouter
103 $(Device/ubnt-xm)
104 DEVICE_MODEL := AirRouter
105 SUPPORTED_DEVICES += airrouter
106 endef
107 TARGET_DEVICES += ubnt_airrouter
108
109 define Device/ubnt_bullet-m
110 $(Device/ubnt-xm)
111 DEVICE_MODEL := Bullet-M
112 DEVICE_PACKAGES += rssileds
113 SUPPORTED_DEVICES += bullet-m
114 endef
115 TARGET_DEVICES += ubnt_bullet-m
116
117 define Device/ubnt_bullet-m-xw
118 $(Device/ubnt-xw)
119 DEVICE_MODEL := Bullet-M
120 DEVICE_PACKAGES += rssileds
121 SUPPORTED_DEVICES += bullet-m-xw
122 endef
123 TARGET_DEVICES += ubnt_bullet-m-xw
124
125 define Device/ubnt_lap-120
126 $(Device/ubnt-wa)
127 DEVICE_MODEL := LiteAP ac
128 DEVICE_VARIANT := LAP-120
129 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
130 endef
131 TARGET_DEVICES += ubnt_lap-120
132
133 define Device/ubnt_litebeam-ac-gen2
134 $(Device/ubnt-wa)
135 DEVICE_MODEL := LiteBeam AC
136 DEVICE_VARIANT := Gen2
137 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
138 endef
139 TARGET_DEVICES += ubnt_litebeam-ac-gen2
140
141 define Device/ubnt_nanobeam-ac
142 $(Device/ubnt-wa)
143 DEVICE_MODEL := NanoBeam AC
144 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct rssileds
145 endef
146 TARGET_DEVICES += ubnt_nanobeam-ac
147
148 define Device/ubnt_nanostation-ac
149 $(Device/ubnt-wa)
150 DEVICE_MODEL := Nanostation AC
151 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct rssileds
152 endef
153 TARGET_DEVICES += ubnt_nanostation-ac
154
155 define Device/ubnt_nanostation-ac-loco
156 $(Device/ubnt-wa)
157 DEVICE_MODEL := Nanostation AC loco
158 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
159 endef
160 TARGET_DEVICES += ubnt_nanostation-ac-loco
161
162 define Device/ubnt_nanostation-m
163 $(Device/ubnt-xm)
164 DEVICE_MODEL := Nanostation M
165 DEVICE_PACKAGES += rssileds
166 SUPPORTED_DEVICES += nanostation-m
167 endef
168 TARGET_DEVICES += ubnt_nanostation-m
169
170 define Device/ubnt_nanostation-m-xw
171 $(Device/ubnt-xw)
172 DEVICE_MODEL := Nanostation M
173 DEVICE_PACKAGES += rssileds
174 SUPPORTED_DEVICES += nanostation-m-xw
175 endef
176 TARGET_DEVICES += ubnt_nanostation-m-xw
177
178 define Device/ubnt_rocket-m
179 $(Device/ubnt-xm)
180 DEVICE_MODEL := Rocket-M
181 DEVICE_PACKAGES += rssileds
182 SUPPORTED_DEVICES += rocket-m
183 endef
184 TARGET_DEVICES += ubnt_rocket-m
185
186 define Device/ubnt_routerstation_common
187 DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig
188 DEVICE_VENDOR := Ubiquiti
189 ATH_SOC := ar7161
190 IMAGE_SIZE := 16128k
191 IMAGES := factory.bin
192 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE)
193 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
194 KERNEL_INITRAMFS := kernel-bin | append-dtb
195 endef
196
197 define Device/ubnt_routerstation
198 $(Device/ubnt_routerstation_common)
199 DEVICE_MODEL := RouterStation
200 UBNT_BOARD := RS
201 UBNT_TYPE := RSx
202 UBNT_CHIP := ar7100
203 DEVICE_PACKAGES += -swconfig
204 SUPPORTED_DEVICES += routerstation
205 endef
206 TARGET_DEVICES += ubnt_routerstation
207
208 define Device/ubnt_routerstation-pro
209 $(Device/ubnt_routerstation_common)
210 DEVICE_MODEL := RouterStation Pro
211 UBNT_BOARD := RSPRO
212 UBNT_TYPE := RSPRO
213 UBNT_CHIP := ar7100pro
214 SUPPORTED_DEVICES += routerstation-pro
215 endef
216 TARGET_DEVICES += ubnt_routerstation-pro
217
218 define Device/ubnt_unifi
219 $(Device/ubnt-bz)
220 DEVICE_MODEL := UniFi
221 SUPPORTED_DEVICES += unifi
222 endef
223 TARGET_DEVICES += ubnt_unifi
224
225 define Device/ubnt_unifiac
226 DEVICE_VENDOR := Ubiquiti
227 ATH_SOC := qca9563
228 IMAGE_SIZE := 7744k
229 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
230 endef
231
232 define Device/ubnt_unifiac-lite
233 $(Device/ubnt_unifiac)
234 DEVICE_MODEL := UniFi AC-Lite
235 SUPPORTED_DEVICES += unifiac-lite
236 endef
237 TARGET_DEVICES += ubnt_unifiac-lite
238
239 define Device/ubnt_unifiac-lr
240 $(Device/ubnt_unifiac)
241 DEVICE_MODEL := UniFi AC-LR
242 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
243 endef
244 TARGET_DEVICES += ubnt_unifiac-lr
245
246 define Device/ubnt_unifiac-mesh
247 $(Device/ubnt_unifiac)
248 DEVICE_MODEL := UniFi AC-Mesh
249 SUPPORTED_DEVICES += ubnt-unifiac-mesh
250 endef
251 TARGET_DEVICES += ubnt_unifiac-mesh
252
253 define Device/ubnt_unifiac-mesh-pro
254 $(Device/ubnt_unifiac)
255 DEVICE_MODEL := UniFi AC-Mesh Pro
256 SUPPORTED_DEVICES += ubnt-unifiac-mesh-pro
257 endef
258 TARGET_DEVICES += ubnt_unifiac-mesh-pro
259
260 define Device/ubnt_unifiac-pro
261 $(Device/ubnt_unifiac)
262 DEVICE_MODEL := UniFi AC-Pro
263 DEVICE_PACKAGES += kmod-usb2
264 SUPPORTED_DEVICES += ubnt-unifiac-pro
265 endef
266 TARGET_DEVICES += ubnt_unifiac-pro