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