4589345d4074bc0a6040e1fa08ef4e93788ce1f6
[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 $(word 1,$^) \
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_PROFILE := UBNT
43 IMAGE_SIZE := 7552k
44 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
45 UBNT_TYPE := XM
46 UBNT_BOARD := XM
47 UBNT_CHIP := ar7240
48 IMAGES := sysupgrade.bin factory.bin
49 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
50 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
51 endef
52
53 define Device/ubnt-xw
54 DEVICE_PROFILE := UBNT
55 IMAGE_SIZE := 7552k
56 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
57 UBNT_TYPE := XW
58 UBNT_BOARD := XM
59 UBNT_CHIP := ar934x
60 IMAGES := sysupgrade.bin factory.bin
61 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
62 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
63 endef
64
65 define Device/ubnt-bz
66 DEVICE_PROFILE := UBNT
67 IMAGE_SIZE := 7552k
68 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
69 UBNT_TYPE := BZ
70 UBNT_BOARD := XM
71 UBNT_CHIP := ar934x
72 IMAGES := sysupgrade.bin factory.bin
73 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
74 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
75 endef
76
77 define Device/ubnt-unifiac
78 DEVICE_PROFILE := UBNT
79 IMAGE_SIZE := 7744k
80 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
81 IMAGES := sysupgrade.bin
82 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
83 endef
84
85 define Device/rw2458n
86 $(Device/ubnt-xm)
87 BOARDNAME := RW2458N
88 endef
89
90 define Device/ubnt-airrouter
91 $(Device/ubnt-xm)
92 BOARDNAME := UBNT-AR
93 endef
94
95 define Device/ubnt-bullet-m
96 $(Device/ubnt-xm)
97 BOARDNAME := UBNT-BM
98 endef
99
100 define Device/ubnt-rocket-m
101 $(Device/ubnt-xm)
102 BOARDNAME := UBNT-RM
103 endef
104
105 define Device/ubnt-nano-m
106 $(Device/ubnt-xm)
107 BOARDNAME := UBNT-NM
108 endef
109 TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
110
111 define Device/ubnt-unifi
112 $(Device/ubnt-bz)
113 BOARDNAME := UBNT-UF
114 DEVICE_PROFILE := UBNT UBNTUNIFI
115 endef
116
117 define Device/ubnt-unifiac-lite
118 $(Device/ubnt-unifiac)
119 DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
120 BOARDNAME := UBNT-UF-AC-LITE
121 endef
122
123 define Device/ubnt-unifiac-pro
124 $(Device/ubnt-unifiac)
125 DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
126 BOARDNAME := UBNT-UF-AC-PRO
127 endef
128
129 define Device/ubnt-unifi-outdoor
130 $(Device/ubnt-bz)
131 BOARDNAME := UBNT-U20
132 DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
133 endef
134 TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor
135
136 define Device/ubnt-nano-m-xw
137 $(Device/ubnt-xw)
138 BOARDNAME := UBNT-NM-XW
139 endef
140
141 define Device/ubnt-loco-m-xw
142 $(Device/ubnt-xw)
143 BOARDNAME := UBNT-LOCO-XW
144 endef
145
146 define Device/ubnt-rocket-m-xw
147 $(Device/ubnt-xw)
148 BOARDNAME := UBNT-RM-XW
149 endef
150
151 define Device/ubnt-rocket-m-ti
152 $(Device/ubnt-xw)
153 BOARDNAME := UBNT-RM-TI
154 UBNT_TYPE := TI
155 UBNT_BOARD := XM
156 endef
157 TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
158
159 define Device/ubnt-air-gateway
160 $(Device/ubnt-xm)
161 BOARDNAME := UBNT-AGW
162 UBNT_BOARD := XM
163 UBNT_TYPE := AirGW
164 UBNT_CHIP := ar933x
165 CONSOLE = ttyATH0,115200
166 endef
167 TARGET_DEVICES += ubnt-air-gateway
168
169 define Device/ubnt-air-gateway-pro
170 $(Device/ubnt-xm)
171 BOARDNAME := UBNT-AGWP
172 UBNT_TYPE := AirGWP
173 UBNT_CHIP := ar934x
174 CONSOLE = ttyS0,115200
175 endef
176 TARGET_DEVICES += ubnt-air-gateway-pro
177
178 define Device/ubdev01
179 $(Device/ubnt-xm)
180 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
181 BOARDNAME := UBNT-UF
182 UBNT_BOARD := UBDEV01
183 UBNT_TYPE := XM
184 UBNT_CHIP := ar7240
185 endef
186
187 TARGET_DEVICES += ubdev01
188
189 define Device/ubnt-routerstation
190 IMAGE_SIZE := 16128k
191 IMAGES := sysupgrade.bin factory.bin
192 IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
193 IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
194 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
195 endef
196
197 define Device/ubnt-rs
198 $(Device/ubnt-routerstation)
199 BOARDNAME := UBNT-RS
200 DEVICE_PROFILE := Madwifi UBNT UBNTRS
201 UBNT_BOARD := RS
202 UBNT_TYPE := RSx
203 UBNT_CHIP := ar7100
204 endef
205
206 define Device/ubnt-rspro
207 $(Device/ubnt-routerstation)
208 BOARDNAME := UBNT-RSPRO
209 DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
210 UBNT_BOARD := RSPRO
211 UBNT_TYPE := RSPRO
212 UBNT_CHIP := ar7100pro
213 endef
214
215 define Device/ubnt-ls-sr71
216 $(Device/ubnt-routerstation)
217 BOARDNAME := UBNT-LS-SR71
218 DEVICE_PROFILE := Madwifi UBNT
219 UBNT_BOARD := LS-SR71
220 UBNT_TYPE := LS-SR71
221 UBNT_CHIP := ar7100
222 endef
223
224 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
225
226 define Device/ubnt-uap-pro
227 KERNEL_SIZE := 1536k
228 IMAGE_SIZE := 15744k
229 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)
230 UBNT_TYPE := BZ
231 UBNT_CHIP := ar934x
232 BOARDNAME := UAP-PRO
233 DEVICE_PROFILE := UBNT UAPPRO
234 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
235 IMAGES := sysupgrade.bin factory.bin
236 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
237 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
238 endef
239
240 define Device/ubnt-unifi-outdoor-plus
241 $(Device/ubnt-uap-pro)
242 UBNT_CHIP := ar7240
243 BOARDNAME := UBNT-UOP
244 DEVICE_PROFILE := UBNT
245 endef
246
247 TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus