d5e3aa5860ef8fbf2f5f714b4eb19b83b65491e9
[openwrt/staging/luka.git] / target / linux / ar71xx / image / generic-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 TARGET_DEVICES += rw2458n
75
76 define Device/ubnt-airrouter
77 $(Device/ubnt-xm)
78 DEVICE_TITLE := Ubiquiti AirRouter
79 BOARDNAME := UBNT-AR
80 endef
81 TARGET_DEVICES += ubnt-airrouter
82
83 define Device/ubnt-bullet-m
84 $(Device/ubnt-xm)
85 DEVICE_TITLE := Ubiquiti Bullet-M
86 BOARDNAME := UBNT-BM
87 endef
88 TARGET_DEVICES += ubnt-bullet-m
89
90 define Device/ubnt-rocket-m
91 $(Device/ubnt-xm)
92 DEVICE_TITLE := Ubiquiti Rocket-M
93 BOARDNAME := UBNT-RM
94 endef
95 TARGET_DEVICES += ubnt-rocket-m
96
97 define Device/ubnt-nano-m
98 $(Device/ubnt-xm)
99 DEVICE_TITLE := Ubiquiti Nano-M
100 BOARDNAME := UBNT-NM
101 endef
102 TARGET_DEVICES += ubnt-nano-m
103
104 define Device/ubnt-unifi
105 $(Device/ubnt-bz)
106 DEVICE_TITLE := Ubiquiti UniFi
107 BOARDNAME := UBNT-UF
108 DEVICE_PROFILE += UBNTUNIFI
109 endef
110 TARGET_DEVICES += ubnt-unifi
111
112 define Device/ubnt-unifiac
113 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
114 DEVICE_PROFILE := UBNT
115 IMAGE_SIZE := 7744k
116 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
117 IMAGES := sysupgrade.bin
118 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
119 endef
120
121 define Device/ubnt-unifiac-lite
122 $(Device/ubnt-unifiac)
123 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
124 DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
125 DEVICE_PROFILE += UBNTUNIFIACLITE
126 BOARDNAME := UBNT-UF-AC-LITE
127 endef
128 TARGET_DEVICES += ubnt-unifiac-lite
129
130 define Device/ubnt-unifiac-mesh
131 $(Device/ubnt-unifiac-lite)
132 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
133 endef
134 TARGET_DEVICES += ubnt-unifiac-mesh
135
136 define Device/ubnt-unifiac-pro
137 $(Device/ubnt-unifiac)
138 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
139 DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
140 DEVICE_PROFILE += UBNTUNIFIACPRO
141 BOARDNAME := UBNT-UF-AC-PRO
142 endef
143 TARGET_DEVICES += ubnt-unifiac-pro
144
145 define Device/ubnt-unifi-outdoor
146 $(Device/ubnt-bz)
147 DEVICE_TITLE := Ubiquiti UniFi Outdoor
148 BOARDNAME := UBNT-U20
149 DEVICE_PROFILE += UBNTUNIFIOUTDOOR
150 endef
151 TARGET_DEVICES += ubnt-unifi-outdoor
152
153 define Device/ubnt-nano-m-xw
154 $(Device/ubnt-xw)
155 DEVICE_TITLE := Ubiquiti Nano M XW
156 BOARDNAME := UBNT-NM-XW
157 endef
158 TARGET_DEVICES += ubnt-nano-m-xw
159
160 define Device/ubnt-lbe-m5
161 $(Device/ubnt-xw)
162 DEVICE_TITLE := Ubiquiti Litebeam M5
163 BOARDNAME := UBNT-LBE-M5
164 endef
165 TARGET_DEVICES += ubnt-lbe-m5
166
167 define Device/ubnt-loco-m-xw
168 $(Device/ubnt-xw)
169 DEVICE_TITLE := Ubiquiti Loco XW
170 BOARDNAME := UBNT-LOCO-XW
171 endef
172 TARGET_DEVICES += ubnt-loco-m-xw
173
174 define Device/ubnt-rocket-m-xw
175 $(Device/ubnt-xw)
176 DEVICE_TITLE := Ubiquiti Rocket M XW
177 BOARDNAME := UBNT-RM-XW
178 endef
179 TARGET_DEVICES += ubnt-rocket-m-xw
180
181 define Device/ubnt-rocket-m-ti
182 $(Device/ubnt-xw)
183 DEVICE_TITLE := Ubiquiti Rocket M TI
184 BOARDNAME := UBNT-RM-TI
185 UBNT_TYPE := TI
186 endef
187 TARGET_DEVICES += ubnt-rocket-m-ti
188
189 define Device/ubnt-air-gateway
190 $(Device/ubnt-xm)
191 DEVICE_TITLE := Ubiquiti Air Gateway
192 BOARDNAME := UBNT-AGW
193 UBNT_TYPE := AirGW
194 UBNT_CHIP := ar933x
195 CONSOLE := ttyATH0,115200
196 endef
197 TARGET_DEVICES += ubnt-air-gateway
198
199 define Device/ubnt-air-gateway-pro
200 $(Device/ubnt-xm)
201 DEVICE_TITLE := Ubiquiti Air Gateway Pro
202 BOARDNAME := UBNT-AGWP
203 UBNT_TYPE := AirGWP
204 UBNT_CHIP := ar934x
205 endef
206 TARGET_DEVICES += ubnt-air-gateway-pro
207
208 define Device/ubdev01
209 $(Device/ubnt-xm)
210 DEVICE_TITLE := Ubiquiti ubDEV01
211 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
212 BOARDNAME := UBNT-UF
213 UBNT_BOARD := UBDEV01
214 endef
215 TARGET_DEVICES += ubdev01
216
217 define Device/ubnt-routerstation
218 DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
219 DEVICE_PROFILE := UBNT
220 IMAGE_SIZE := 16128k
221 IMAGES := sysupgrade.bin factory.bin
222 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage
223 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
224 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
225 endef
226
227 define Device/ubnt-rs
228 $(Device/ubnt-routerstation)
229 DEVICE_TITLE := Ubiquiti RouterStation
230 BOARDNAME := UBNT-RS
231 DEVICE_PROFILE += UBNTRS
232 UBNT_BOARD := RS
233 UBNT_TYPE := RSx
234 UBNT_CHIP := ar7100
235 endef
236 TARGET_DEVICES += ubnt-rs
237
238 define Device/ubnt-rspro
239 $(Device/ubnt-routerstation)
240 DEVICE_TITLE := Ubiquiti RouterStation Pro
241 BOARDNAME := UBNT-RSPRO
242 DEVICE_PROFILE += UBNTRSPRO
243 UBNT_BOARD := RSPRO
244 UBNT_TYPE := RSPRO
245 UBNT_CHIP := ar7100pro
246 endef
247 TARGET_DEVICES += ubnt-rspro
248
249 define Device/ubnt-ls-sr71
250 $(Device/ubnt-routerstation)
251 DEVICE_TITLE := Ubiquiti LS-SR71
252 BOARDNAME := UBNT-LS-SR71
253 UBNT_BOARD := LS-SR71
254 UBNT_TYPE := LS-SR71
255 UBNT_CHIP := ar7100
256 endef
257 TARGET_DEVICES += ubnt-ls-sr71
258
259 define Device/ubnt-uap-pro
260 DEVICE_TITLE := Ubiquiti UAP Pro
261 KERNEL_SIZE := 1792k
262 IMAGE_SIZE := 15744k
263 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1792k(kernel),13952k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
264 UBNT_TYPE := BZ
265 UBNT_CHIP := ar934x
266 BOARDNAME := UAP-PRO
267 DEVICE_PROFILE := UBNT UAPPRO
268 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
269 IMAGES := sysupgrade.bin factory.bin
270 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
271 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
272 endef
273 TARGET_DEVICES += ubnt-uap-pro
274
275 define Device/ubnt-unifi-outdoor-plus
276 $(Device/ubnt-uap-pro)
277 DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus
278 UBNT_CHIP := ar7240
279 BOARDNAME := UBNT-UOP
280 DEVICE_PROFILE := UBNT
281 endef
282 TARGET_DEVICES += ubnt-unifi-outdoor-plus