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