ar71xx: Archer C58/C59/C60 fix qca9886 wireless interface
[openwrt/openwrt.git] / target / linux / ar71xx / image / ubnt.mk
1 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
2
3 # mkubntimage is using the kernel image direct
4 # routerboard creates partitions out of the ubnt header
5 define Build/mkubntimage
6 -$(STAGING_DIR_HOST)/bin/mkfwimage \
7 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
8 -k $(IMAGE_KERNEL) \
9 -r $@ \
10 -o $@
11 endef
12
13 # all UBNT XM device expect the kernel image to have 1024k while flash, when
14 # booting the image, the size doesn't matter.
15 define Build/mkubntimage-split
16 -[ -f $@ ] && ( \
17 dd if=$@ of=$@.old1 bs=1024k count=1; \
18 dd if=$@ of=$@.old2 bs=1024k skip=1; \
19 $(STAGING_DIR_HOST)/bin/mkfwimage \
20 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
21 -k $@.old1 \
22 -r $@.old2 \
23 -o $@; \
24 rm $@.old1 $@.old2 )
25 endef
26
27 define Build/mkubntimage2
28 -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
29 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
30 -p jffs2:0x50000:0xf60000:0:0:$@ \
31 -o $@.new
32 @mv $@.new $@
33 endef
34
35
36 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
37 # UBNT_TYPE e.g. one of (BZ, XM, XW)
38 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
39 define Device/ubnt
40 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
41 DEVICE_PROFILE := UBNT
42 IMAGE_SIZE := 7552k
43 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
44 UBNT_BOARD := XM
45 IMAGES := sysupgrade.bin factory.bin
46 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
47 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
48 endef
49
50 define Device/ubnt-xm
51 $(Device/ubnt)
52 DEVICE_PACKAGES += kmod-usb-ohci
53 UBNT_TYPE := XM
54 UBNT_CHIP := ar7240
55 endef
56
57 define Device/ubnt-xw
58 $(Device/ubnt)
59 UBNT_TYPE := XW
60 UBNT_CHIP := ar934x
61 endef
62
63 define Device/ubnt-bz
64 $(Device/ubnt)
65 UBNT_TYPE := BZ
66 UBNT_CHIP := ar7240
67 endef
68
69 define Device/rw2458n
70 $(Device/ubnt-xm)
71 DEVICE_TITLE := Ubiquiti RW2458N
72 BOARDNAME := RW2458N
73 endef
74
75 define Device/ubnt-airrouter
76 $(Device/ubnt-xm)
77 DEVICE_TITLE := Ubiquiti AirRouter
78 BOARDNAME := UBNT-AR
79 endef
80
81 define Device/ubnt-bullet-m
82 $(Device/ubnt-xm)
83 DEVICE_TITLE := Ubiquiti Bullet-M
84 BOARDNAME := UBNT-BM
85 endef
86
87 define Device/ubnt-rocket-m
88 $(Device/ubnt-xm)
89 DEVICE_TITLE := Ubiquiti Rocket-M
90 BOARDNAME := UBNT-RM
91 endef
92
93 define Device/ubnt-nano-m
94 $(Device/ubnt-xm)
95 DEVICE_TITLE := Ubiquiti Nano-M
96 BOARDNAME := UBNT-NM
97 endef
98 TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
99
100 define Device/ubnt-unifi
101 $(Device/ubnt-bz)
102 DEVICE_TITLE := Ubiquiti UniFi
103 BOARDNAME := UBNT-UF
104 DEVICE_PROFILE += UBNTUNIFI
105 endef
106
107 define Device/ubnt-unifiac
108 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
109 DEVICE_PROFILE := UBNT
110 IMAGE_SIZE := 7744k
111 MTDPARTS := spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
112 IMAGES := sysupgrade.bin
113 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
114 endef
115
116 define Device/ubnt-unifiac-lite
117 $(Device/ubnt-unifiac)
118 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
119 DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
120 DEVICE_PROFILE += UBNTUNIFIACLITE
121 BOARDNAME := UBNT-UF-AC-LITE
122 endef
123
124 define Device/ubnt-unifiac-mesh
125 $(Device/ubnt-unifiac-lite)
126 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
127 endef
128
129 define Device/ubnt-unifiac-pro
130 $(Device/ubnt-unifiac)
131 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
132 DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
133 DEVICE_PROFILE += UBNTUNIFIACPRO
134 BOARDNAME := UBNT-UF-AC-PRO
135 endef
136
137 define Device/ubnt-unifi-outdoor
138 $(Device/ubnt-bz)
139 DEVICE_TITLE := Ubiquiti UniFi Outdoor
140 BOARDNAME := UBNT-U20
141 DEVICE_PROFILE += UBNTUNIFIOUTDOOR
142 endef
143 TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-mesh ubnt-unifiac-pro ubnt-unifi-outdoor
144
145 define Device/ubnt-nano-m-xw
146 $(Device/ubnt-xw)
147 DEVICE_TITLE := Ubiquiti Nano M XW
148 BOARDNAME := UBNT-NM-XW
149 endef
150
151 define Device/ubnt-loco-m-xw
152 $(Device/ubnt-xw)
153 DEVICE_TITLE := Ubiquiti Loco XW
154 BOARDNAME := UBNT-LOCO-XW
155 endef
156
157 define Device/ubnt-rocket-m-xw
158 $(Device/ubnt-xw)
159 DEVICE_TITLE := Ubiquiti Rocket M XW
160 BOARDNAME := UBNT-RM-XW
161 endef
162
163 define Device/ubnt-rocket-m-ti
164 $(Device/ubnt-xw)
165 DEVICE_TITLE := Ubiquiti Rocket M TI
166 BOARDNAME := UBNT-RM-TI
167 UBNT_TYPE := TI
168 endef
169 TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
170
171 define Device/ubnt-air-gateway
172 $(Device/ubnt-xm)
173 DEVICE_TITLE := Ubiquiti Air Gateway
174 BOARDNAME := UBNT-AGW
175 UBNT_TYPE := AirGW
176 UBNT_CHIP := ar933x
177 CONSOLE := ttyATH0,115200
178 endef
179
180 define Device/ubnt-air-gateway-pro
181 $(Device/ubnt-xm)
182 DEVICE_TITLE := Ubiquiti Air Gateway Pro
183 BOARDNAME := UBNT-AGWP
184 UBNT_TYPE := AirGWP
185 UBNT_CHIP := ar934x
186 endef
187
188 define Device/ubdev01
189 $(Device/ubnt-xm)
190 DEVICE_TITLE := Ubiquiti ubDEV01
191 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
192 BOARDNAME := UBNT-UF
193 UBNT_BOARD := UBDEV01
194 endef
195 TARGET_DEVICES += ubnt-air-gateway ubnt-air-gateway-pro ubdev01
196
197 define Device/ubnt-routerstation
198 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
199 DEVICE_PROFILE := UBNT
200 IMAGE_SIZE := 16128k
201 IMAGES := sysupgrade.bin factory.bin
202 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage
203 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
204 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
205 endef
206
207 define Device/ubnt-rs
208 $(Device/ubnt-routerstation)
209 DEVICE_TITLE := Ubiquiti RouterStation
210 BOARDNAME := UBNT-RS
211 DEVICE_PROFILE += UBNTRS
212 UBNT_BOARD := RS
213 UBNT_TYPE := RSx
214 UBNT_CHIP := ar7100
215 endef
216
217 define Device/ubnt-rspro
218 $(Device/ubnt-routerstation)
219 DEVICE_TITLE := Ubiquiti RouterStation Pro
220 BOARDNAME := UBNT-RSPRO
221 DEVICE_PROFILE += UBNTRSPRO
222 UBNT_BOARD := RSPRO
223 UBNT_TYPE := RSPRO
224 UBNT_CHIP := ar7100pro
225 endef
226
227 define Device/ubnt-ls-sr71
228 $(Device/ubnt-routerstation)
229 DEVICE_TITLE := Ubiquiti LS-SR71
230 BOARDNAME := UBNT-LS-SR71
231 UBNT_BOARD := LS-SR71
232 UBNT_TYPE := LS-SR71
233 UBNT_CHIP := ar7100
234 endef
235 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
236
237 define Device/ubnt-uap-pro
238 DEVICE_TITLE := Ubiquiti UAP Pro
239 KERNEL_SIZE := 1536k
240 IMAGE_SIZE := 15744k
241 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
242 UBNT_TYPE := BZ
243 UBNT_CHIP := ar934x
244 BOARDNAME := UAP-PRO
245 DEVICE_PROFILE := UBNT UAPPRO
246 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
247 IMAGES := sysupgrade.bin factory.bin
248 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
249 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
250 endef
251
252 define Device/ubnt-unifi-outdoor-plus
253 $(Device/ubnt-uap-pro)
254 DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus
255 UBNT_CHIP := ar7240
256 BOARDNAME := UBNT-UOP
257 DEVICE_PROFILE := UBNT
258 endef