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