2d0b1adadbb42418380496d29e8659a542f9523c
[openwrt/openwrt.git] / target / linux / ath79 / image / generic-ubnt.mk
1 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION
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/WA devices 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).v$(UBNT_VERSION)-$(VERSION_DIST)-$(REVISION) \
21 -k $@.old1 \
22 -r $@.old2 \
23 -o $@; \
24 rm $@.old1 $@.old2 )
25 endef
26
27 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
28 # UBNT_TYPE e.g. one of (BZ, XM, XW)
29 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
30 # UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
31 define Device/ubnt
32 DEVICE_PACKAGES := kmod-usb-core kmod-usb2
33 IMAGE_SIZE := 7552k
34 UBNT_BOARD := XM
35 UBNT_VERSION := 6.0.0
36 IMAGES += factory.bin
37 IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
38 append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split
39 endef
40
41 define Device/ubnt-xm
42 $(Device/ubnt)
43 DEVICE_PACKAGES += kmod-usb-ohci rssileds
44 UBNT_TYPE := XM
45 UBNT_CHIP := ar7240
46 ATH_SOC := ar7241
47 KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
48 endef
49
50 define Device/ubnt-bz
51 $(Device/ubnt)
52 UBNT_TYPE := BZ
53 UBNT_CHIP := ar7240
54 ATH_SOC := ar7241
55 endef
56
57 define Device/ubnt-wa
58 $(Device/ubnt)
59 UBNT_TYPE := WA
60 UBNT_CHIP := ar934x
61 UBNT_BOARD := WA
62 UBNT_VERSION := 8.5.0
63 ATH_SOC := ar9342
64 endef
65
66 define Device/ubnt-xw
67 $(Device/ubnt)
68 UBNT_TYPE := XW
69 UBNT_CHIP := ar934x
70 UBNT_BOARD := XM
71 UBNT_VERSION := 6.0.4
72 ATH_SOC := ar9342
73 endef
74
75 define Device/ubnt_bullet-m
76 $(Device/ubnt-xm)
77 DEVICE_TITLE := Ubiquiti Bullet-M
78 SUPPORTED_DEVICES += bullet-m
79 endef
80 TARGET_DEVICES += ubnt_bullet-m
81
82 define Device/ubnt_bullet-m-xw
83 $(Device/ubnt-xw)
84 DEVICE_TITLE := Ubiquiti Bullet-M (XW)
85 SUPPORTED_DEVICES += bullet-m-xw
86 endef
87 TARGET_DEVICES += ubnt_bullet-m-xw
88
89 define Device/ubnt_rocket-m
90 $(Device/ubnt-xm)
91 DEVICE_TITLE := Ubiquiti Rocket-M
92 SUPPORTED_DEVICES += rocket-m
93 endef
94 TARGET_DEVICES += ubnt_rocket-m
95
96 define Device/ubnt_nano-m
97 $(Device/ubnt-xm)
98 DEVICE_TITLE := Ubiquiti Nano-M
99 SUPPORTED_DEVICES += nano-m
100 endef
101 TARGET_DEVICES += ubnt_nano-m
102
103 define Device/ubnt_lap-120
104 $(Device/ubnt-wa)
105 DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)
106 DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
107 IMAGE_SIZE := 15744k
108 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
109 endef
110 TARGET_DEVICES += ubnt_lap-120
111
112 define Device/ubnt_nanostation-ac
113 $(Device/ubnt-wa)
114 DEVICE_TITLE := Ubiquiti Nanostation AC
115 DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
116 IMAGE_SIZE := 15744k
117 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
118 endef
119 TARGET_DEVICES += ubnt_nanostation-ac
120
121 define Device/ubnt_nanostation-ac-loco
122 $(Device/ubnt-wa)
123 DEVICE_TITLE := Ubiquiti Nanostation AC loco
124 DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x
125 IMAGE_SIZE := 15744k
126 IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
127 endef
128 TARGET_DEVICES += ubnt_nanostation-ac-loco
129
130 define Device/ubnt_unifi
131 $(Device/ubnt-bz)
132 DEVICE_TITLE := Ubiquiti UniFi
133 SUPPORTED_DEVICES += unifi
134 endef
135 TARGET_DEVICES += ubnt_unifi
136
137 define Device/ubnt_unifiac
138 ATH_SOC := qca9563
139 IMAGE_SIZE := 7744k
140 IMAGES := sysupgrade.bin
141 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
142 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
143 endef
144
145
146 define Device/ubnt_unifiac-lite
147 $(Device/ubnt_unifiac)
148 DEVICE_TITLE := Ubiquiti UniFi AC-Lite
149 SUPPORTED_DEVICES += ubnt-unifiac-lite
150 endef
151 TARGET_DEVICES += ubnt_unifiac-lite
152
153 define Device/ubnt_unifiac-mesh
154 $(Device/ubnt_unifiac)
155 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh
156 SUPPORTED_DEVICES += ubnt-unifiac-mesh
157 endef
158 TARGET_DEVICES += ubnt_unifiac-mesh
159
160 define Device/ubnt_unifiac-mesh-pro
161 $(Device/ubnt_unifiac)
162 DEVICE_TITLE := Ubiquiti UniFi AC-Mesh Pro
163 SUPPORTED_DEVICES += ubnt-unifiac-mesh-pro
164 endef
165 TARGET_DEVICES += ubnt_unifiac-mesh-pro
166
167 define Device/ubnt_unifiac-pro
168 $(Device/ubnt_unifiac)
169 DEVICE_TITLE := Ubiquiti UniFi AC-Pro
170 DEVICE_PACKAGES += kmod-usb-core kmod-usb2
171 SUPPORTED_DEVICES += ubnt-unifiac-pro
172 endef
173 TARGET_DEVICES += ubnt_unifiac-pro
174
175 define Device/ubnt_routerstation_common
176 DEVICE_PACKAGES := -kmod-ath9k -wpad-mini -uboot-envtools kmod-usb-ohci kmod-usb2 fconfig
177 ATH_SOC := ar7161
178 IMAGE_SIZE := 16128k
179 IMAGES := sysupgrade.bin factory.bin
180 IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE)
181 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) | append-metadata
182 KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
183 KERNEL_INITRAMFS := kernel-bin | append-dtb
184 endef
185
186 define Device/ubnt_routerstation
187 $(Device/ubnt_routerstation_common)
188 DEVICE_TITLE := Ubiquiti RouterStation
189 UBNT_BOARD := RS
190 UBNT_TYPE := RSx
191 UBNT_CHIP := ar7100
192 DEVICE_PACKAGES += -swconfig
193 endef
194 TARGET_DEVICES += ubnt_routerstation
195
196 define Device/ubnt_routerstation-pro
197 $(Device/ubnt_routerstation_common)
198 DEVICE_TITLE := Ubiquiti RouterStation Pro
199 UBNT_BOARD := RSPRO
200 UBNT_TYPE := RSPRO
201 UBNT_CHIP := ar7100pro
202 endef
203 TARGET_DEVICES += ubnt_routerstation-pro