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