fdc0d280337d891257ed9666936ff80460d3384a
[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 rssileds
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 SUPPORTED_DEVICES += bullet-m
92 endef
93 TARGET_DEVICES += ubnt_bullet-m
94
95 define Device/ubnt_bullet-m-xw
96 $(Device/ubnt-xw)
97 DEVICE_TITLE := Ubiquiti Bullet-M (XW)
98 SUPPORTED_DEVICES += bullet-m-xw
99 endef
100 TARGET_DEVICES += ubnt_bullet-m-xw
101
102 define Device/ubnt_rocket-m
103 $(Device/ubnt-xm)
104 DEVICE_TITLE := Ubiquiti Rocket-M
105 SUPPORTED_DEVICES += rocket-m
106 endef
107 TARGET_DEVICES += ubnt_rocket-m
108
109 define Device/ubnt_nanostation-m
110 $(Device/ubnt-xm)
111 DEVICE_TITLE := Ubiquiti Nanostation M
112 SUPPORTED_DEVICES += nanostation-m
113 endef
114 TARGET_DEVICES += ubnt_nanostation-m
115
116 define Device/ubnt_nanostation-m-xw
117 $(Device/ubnt-xw)
118 DEVICE_TITLE := Ubiquiti Nanostation M (XW)
119 SUPPORTED_DEVICES += nanostation-m-xw
120 endef
121 TARGET_DEVICES += ubnt_nanostation-m-xw
122
123 define Device/ubnt_lap-120
124 $(Device/ubnt-wa)
125 DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)
126 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
127 IMAGE_SIZE := 15744k
128 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
129 endef
130 TARGET_DEVICES += ubnt_lap-120
131
132 define Device/ubnt_nanobeam-ac
133 $(Device/ubnt-wa)
134 DEVICE_TITLE := Ubiquiti NanoBeam AC
135 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
136 IMAGE_SIZE := 15744k
137 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
138 endef
139 TARGET_DEVICES += ubnt_nanobeam-ac
140
141 define Device/ubnt_nanostation-ac
142 $(Device/ubnt-wa)
143 DEVICE_TITLE := Ubiquiti Nanostation AC
144 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
145 IMAGE_SIZE := 15744k
146 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
147 endef
148 TARGET_DEVICES += ubnt_nanostation-ac
149
150 define Device/ubnt_nanostation-ac-loco
151 $(Device/ubnt-wa)
152 DEVICE_TITLE := Ubiquiti Nanostation AC loco
153 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
154 IMAGE_SIZE := 15744k
155 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
156 endef
157 TARGET_DEVICES += ubnt_nanostation-ac-loco
158
159 define Device/ubnt_unifi
160 $(Device/ubnt-bz)
161 DEVICE_TITLE := Ubiquiti UniFi
162 SUPPORTED_DEVICES += unifi
163 endef
164 TARGET_DEVICES += ubnt_unifi
165
166 define Device/ubnt_unifiac
167 ATH_SOC := qca9563
168 IMAGE_SIZE := 7744k
169 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
170 endef
171
172
173 define Device/ubnt_unifiac-lite
174 $(Device/ubnt_unifiac)
175 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
176 SUPPORTED_DEVICES += unifiac-lite
177 endef
178 TARGET_DEVICES += ubnt_unifiac-lite
179
180 define Device/ubnt_unifiac-lr
181 $(Device/ubnt_unifiac)
182 DEVICE_TITLE := Ubiquiti UniFi AC-LR
183 SUPPORTED_DEVICES += unifiac-lite ubnt,unifiac-lite
184 endef
185 TARGET_DEVICES += ubnt_unifiac-lr
186
187 define Device/ubnt_unifiac-mesh
188 $(Device/ubnt_unifiac)
189 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
190 SUPPORTED_DEVICES += ubnt-unifiac-mesh
191 endef
192 TARGET_DEVICES += ubnt_unifiac-mesh
193
194 define Device/ubnt_unifiac-mesh-pro
195 $(Device/ubnt_unifiac)
196 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh Pro
197 SUPPORTED_DEVICES += ubnt-unifiac-mesh-pro
198 endef
199 TARGET_DEVICES += ubnt_unifiac-mesh-pro
200
201 define Device/ubnt_unifiac-pro
202 $(Device/ubnt_unifiac)
203 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
204 DEVICE_PACKAGES += kmod-usb-core kmod-usb2
205 SUPPORTED_DEVICES += ubnt-unifiac-pro
206 endef
207 TARGET_DEVICES += ubnt_unifiac-pro
208
209 define Device/ubnt_routerstation_common
210 DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig
211 ATH_SOC := ar7161
212 IMAGE_SIZE := 16128k
213 IMAGES += factory.bin
214 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE)
215 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | append-metadata | check-size $$$$(IMAGE_SIZE)
216 # IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
217 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
218 KERNEL_INITRAMFS := kernel-bin | append-dtb
219 endef
220
221 define Device/ubnt_routerstation
222 $(Device/ubnt_routerstation_common)
223 DEVICE_TITLE := Ubiquiti RouterStation
224 UBNT_BOARD := RS
225 UBNT_TYPE := RSx
226 UBNT_CHIP := ar7100
227 DEVICE_PACKAGES += -swconfig
228 SUPPORTED_DEVICES += routerstation
229 endef
230 TARGET_DEVICES += ubnt_routerstation
231
232 define Device/ubnt_routerstation-pro
233 $(Device/ubnt_routerstation_common)
234 DEVICE_TITLE := Ubiquiti RouterStation Pro
235 UBNT_BOARD := RSPRO
236 UBNT_TYPE := RSPRO
237 UBNT_CHIP := ar7100pro
238 SUPPORTED_DEVICES += routerstation-pro
239 endef
240 TARGET_DEVICES += ubnt_routerstation-pro
241
242 define Device/ubnt_acb-isp
243 $(Device/ubnt)
244 ATH_SOC := qca9533
245 IMAGE_SIZE := 15744k
246 DEVICE_TITLE := Ubiquiti airCube ISP
247 UBNT_BOARD := ACB-ISP
248 UBNT_TYPE := ACB
249 UBNT_CHIP := qca9533
250 IMAGES := sysupgrade.bin
251 endef
252 TARGET_DEVICES += ubnt_acb-isp