7d78e330e37edc130c82e9fa3699659be2326b18
[openwrt/openwrt.git] / target / linux / ar71xx / 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 device 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 define Build/mkubntimage2
33 -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
34 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
35 -p jffs2:0x50000:0xf60000:0:0:$@ \
36 -o $@.new
37 @mv $@.new $@
38 endef
39
40
41 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
42 # UBNT_TYPE e.g. one of (BZ, XM, XW)
43 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
44 # UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
45 define Device/ubnt
46 DEVICE_PACKAGES := kmod-usb2
47 DEVICE_PROFILE := UBNT
48 IMAGE_SIZE := 7552k
49 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
50 UBNT_BOARD := XM
51 UBNT_VERSION := 6.0.0
52 IMAGES := sysupgrade.bin factory.bin
53 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
54 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
55 endef
56
57 define Device/ubnt-xm
58 $(Device/ubnt)
59 DEVICE_PACKAGES += kmod-usb-ohci
60 UBNT_TYPE := XM
61 UBNT_CHIP := ar7240
62 KERNEL := kernel-bin | patch-cmdline | relocate-kernel | lzma | uImage lzma
63 endef
64
65 define Device/ubnt-xw
66 $(Device/ubnt)
67 UBNT_TYPE := XW
68 UBNT_CHIP := ar934x
69 UBNT_VERSION := 6.0.4
70 UBNT_REVISION := 42.$(UBNT_REVISION)
71 endef
72
73 define Device/ubnt-bz
74 $(Device/ubnt)
75 UBNT_TYPE := BZ
76 UBNT_CHIP := ar7240
77 endef
78
79 define Device/rw2458n
80 $(Device/ubnt-xm)
81 DEVICE_TITLE := Ubiquiti RW2458N
82 BOARDNAME := RW2458N
83 endef
84 TARGET_DEVICES += rw2458n
85
86 define Device/ubnt-airrouter
87 $(Device/ubnt-xm)
88 DEVICE_TITLE := Ubiquiti AirRouter
89 BOARDNAME := UBNT-AR
90 endef
91 TARGET_DEVICES += ubnt-airrouter
92
93 define Device/ubnt-bullet-m
94 $(Device/ubnt-xm)
95 DEVICE_TITLE := Ubiquiti Bullet-M
96 DEVICE_PACKAGES += rssileds
97 BOARDNAME := UBNT-BM
98 endef
99 TARGET_DEVICES += ubnt-bullet-m
100
101 define Device/ubnt-rocket-m
102 $(Device/ubnt-xm)
103 DEVICE_TITLE := Ubiquiti Rocket-M
104 DEVICE_PACKAGES += rssileds
105 BOARDNAME := UBNT-RM
106 endef
107 TARGET_DEVICES += ubnt-rocket-m
108
109 define Device/ubnt-nano-m
110 $(Device/ubnt-xm)
111 DEVICE_TITLE := Ubiquiti Nano-M
112 DEVICE_PACKAGES += rssileds
113 BOARDNAME := UBNT-NM
114 endef
115 TARGET_DEVICES += ubnt-nano-m
116
117 define Device/ubnt-unifi
118 $(Device/ubnt-bz)
119 DEVICE_TITLE := Ubiquiti UniFi
120 BOARDNAME := UBNT-UF
121 DEVICE_PROFILE += UBNTUNIFI
122 endef
123 TARGET_DEVICES += ubnt-unifi
124
125 define Device/ubnt-unifiac
126 DEVICE_PACKAGES := kmod-usb2
127 DEVICE_PROFILE := UBNT
128 IMAGE_SIZE := 7744k
129 MTDPARTS := spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs),256k(cfg)ro,64k(EEPROM)ro
130 IMAGES := sysupgrade.bin
131 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
132 endef
133
134 define Device/ubnt-unifiac-lite
135 $(Device/ubnt-unifiac)
136 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
137 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
138 DEVICE_PROFILE += UBNTUNIFIACLITE
139 BOARDNAME := UBNT-UF-AC-LITE
140 endef
141 TARGET_DEVICES += ubnt-unifiac-lite
142
143 define Device/ubnt-unifiac-lr
144 $(Device/ubnt-unifiac-lite)
145 DEVICE_TITLE := Ubiquiti UniFi AC-LR
146 endef
147 TARGET_DEVICES += ubnt-unifiac-lr
148
149 define Device/ubnt-unifiac-mesh
150 $(Device/ubnt-unifiac-lite)
151 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
152 endef
153 TARGET_DEVICES += ubnt-unifiac-mesh
154
155 define Device/ubnt-unifiac-pro
156 $(Device/ubnt-unifiac)
157 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
158 DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
159 DEVICE_PROFILE += UBNTUNIFIACPRO
160 BOARDNAME := UBNT-UF-AC-PRO
161 endef
162 TARGET_DEVICES += ubnt-unifiac-pro
163
164 define Device/ubnt-unifiac-mesh-pro
165 $(Device/ubnt-unifiac-pro)
166 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh-Pro
167 endef
168 TARGET_DEVICES += ubnt-unifiac-mesh-pro
169
170 define Device/ubnt-unifi-outdoor
171 $(Device/ubnt-bz)
172 DEVICE_TITLE := Ubiquiti UniFi Outdoor
173 BOARDNAME := UBNT-U20
174 DEVICE_PROFILE += UBNTUNIFIOUTDOOR
175 endef
176 TARGET_DEVICES += ubnt-unifi-outdoor
177
178 define Device/ubnt-nano-m-xw
179 $(Device/ubnt-xw)
180 DEVICE_TITLE := Ubiquiti Nano M XW
181 DEVICE_PACKAGES += rssileds
182 BOARDNAME := UBNT-NM-XW
183 endef
184 TARGET_DEVICES += ubnt-nano-m-xw
185
186 define Device/ubnt-lbe-m5
187 $(Device/ubnt-xw)
188 DEVICE_TITLE := Ubiquiti Litebeam M5
189 BOARDNAME := UBNT-LBE-M5
190 endef
191 TARGET_DEVICES += ubnt-lbe-m5
192
193 define Device/ubnt-loco-m-xw
194 $(Device/ubnt-xw)
195 DEVICE_TITLE := Ubiquiti Loco XW
196 DEVICE_PACKAGES += rssileds
197 BOARDNAME := UBNT-LOCO-XW
198 endef
199 TARGET_DEVICES += ubnt-loco-m-xw
200
201 define Device/ubnt-bullet-m-xw
202 $(Device/ubnt-xw)
203 DEVICE_TITLE := Ubiquiti Bullet-M XW
204 DEVICE_PACKAGES += rssileds
205 BOARDNAME := UBNT-BM-XW
206 endef
207 TARGET_DEVICES += ubnt-bullet-m-xw
208
209 define Device/ubnt-rocket-m-xw
210 $(Device/ubnt-xw)
211 DEVICE_TITLE := Ubiquiti Rocket M XW
212 DEVICE_PACKAGES += rssileds
213 BOARDNAME := UBNT-RM-XW
214 endef
215 TARGET_DEVICES += ubnt-rocket-m-xw
216
217 define Device/ubnt-rocket-m-ti
218 $(Device/ubnt-xw)
219 DEVICE_TITLE := Ubiquiti Rocket M TI
220 BOARDNAME := UBNT-RM-TI
221 UBNT_TYPE := TI
222 endef
223 TARGET_DEVICES += ubnt-rocket-m-ti
224
225 define Device/ubnt-air-gateway
226 $(Device/ubnt-xm)
227 DEVICE_TITLE := Ubiquiti Air Gateway
228 BOARDNAME := UBNT-AGW
229 UBNT_TYPE := AirGW
230 UBNT_CHIP := ar933x
231 CONSOLE := ttyATH0,115200
232 endef
233 TARGET_DEVICES += ubnt-air-gateway
234
235 define Device/ubnt-air-gateway-pro
236 $(Device/ubnt-xm)
237 DEVICE_TITLE := Ubiquiti Air Gateway Pro
238 BOARDNAME := UBNT-AGWP
239 UBNT_TYPE := AirGWP
240 UBNT_CHIP := ar934x
241 endef
242 TARGET_DEVICES += ubnt-air-gateway-pro
243
244 define Device/ubdev01
245 $(Device/ubnt-xm)
246 DEVICE_TITLE := Ubiquiti ubDEV01
247 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
248 BOARDNAME := UBNT-UF
249 UBNT_BOARD := UBDEV01
250 endef
251 TARGET_DEVICES += ubdev01
252
253 define Device/ubnt-routerstation
254 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
255 DEVICE_PROFILE := UBNT
256 IMAGE_SIZE := 16128k
257 IMAGES := sysupgrade.bin factory.bin
258 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage
259 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
260 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
261 endef
262
263 define Device/ubnt-rs
264 $(Device/ubnt-routerstation)
265 DEVICE_TITLE := Ubiquiti RouterStation
266 BOARDNAME := UBNT-RS
267 DEVICE_PROFILE += UBNTRS
268 UBNT_BOARD := RS
269 UBNT_TYPE := RSx
270 UBNT_CHIP := ar7100
271 endef
272 TARGET_DEVICES += ubnt-rs
273
274 define Device/ubnt-rspro
275 $(Device/ubnt-routerstation)
276 DEVICE_TITLE := Ubiquiti RouterStation Pro
277 BOARDNAME := UBNT-RSPRO
278 DEVICE_PROFILE += UBNTRSPRO
279 UBNT_BOARD := RSPRO
280 UBNT_TYPE := RSPRO
281 UBNT_CHIP := ar7100pro
282 endef
283 TARGET_DEVICES += ubnt-rspro
284
285 define Device/ubnt-ls-sr71
286 $(Device/ubnt-routerstation)
287 DEVICE_TITLE := Ubiquiti LS-SR71
288 BOARDNAME := UBNT-LS-SR71
289 UBNT_BOARD := LS-SR71
290 UBNT_TYPE := LS-SR71
291 UBNT_CHIP := ar7100
292 endef
293 TARGET_DEVICES += ubnt-ls-sr71
294
295 define Device/ubnt-uap-pro
296 DEVICE_TITLE := Ubiquiti UAP Pro
297 KERNEL_SIZE := 2048k
298 IMAGE_SIZE := 15744k
299 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2048k(kernel),13696k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
300 UBNT_TYPE := BZ
301 UBNT_CHIP := ar934x
302 BOARDNAME := UAP-PRO
303 DEVICE_PROFILE := UBNT UAPPRO
304 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
305 IMAGES := sysupgrade.bin factory.bin
306 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
307 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
308 endef
309 TARGET_DEVICES += ubnt-uap-pro
310
311 define Device/ubnt-unifi-outdoor-plus
312 $(Device/ubnt-uap-pro)
313 DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus
314 UBNT_CHIP := ar7240
315 BOARDNAME := UBNT-UOP
316 DEVICE_PROFILE := UBNT
317 endef
318 TARGET_DEVICES += ubnt-unifi-outdoor-plus