1 include $(TOPDIR
)/rules.mk
9 PKG_SOURCE_URL
:=https
://github.com
/openwrt
/mt76
11 PKG_SOURCE_DATE
:=2020-08-13
12 PKG_SOURCE_VERSION
:=efc8669db5f9ff1bf1d7487e0f762ab1bbe8cd85
13 PKG_MIRROR_HASH
:=2638b63e3b1df743b89806458c910e34472274b7f6ed275f62b475da5dfd649b
15 PKG_MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
18 PKG_CONFIG_DEPENDS
+= \
19 CONFIG_PACKAGE_kmod-mt76-usb \
20 CONFIG_PACKAGE_kmod-mt76x02-common \
21 CONFIG_PACKAGE_kmod-mt76x0-common \
22 CONFIG_PACKAGE_kmod-mt76x0u \
23 CONFIG_PACKAGE_kmod-mt76x2-common \
24 CONFIG_PACKAGE_kmod-mt76x2 \
25 CONFIG_PACKAGE_kmod-mt76x2u \
26 CONFIG_PACKAGE_kmod-mt7603 \
27 CONFIG_PACKAGE_CFG80211_TESTMODE
29 STAMP_CONFIGURED_DEPENDS
:= $(STAGING_DIR
)/usr
/include/mac80211-backport
/backport
/autoconf.h
31 include $(INCLUDE_DIR
)/kernel.mk
32 include $(INCLUDE_DIR
)/package.mk
33 include $(INCLUDE_DIR
)/cmake.mk
35 CMAKE_SOURCE_DIR
:=$(PKG_BUILD_DIR
)/tools
36 CMAKE_BINARY_DIR
:=$(PKG_BUILD_DIR
)/tools
38 define KernelPackage
/mt76-default
39 SUBMENU
:=Wireless Drivers
42 +@DRIVER_11AC_SUPPORT
+@DRIVER_11N_SUPPORT
+@DRIVER_11W_SUPPORT
45 define KernelPackage
/mt76
46 SUBMENU
:=Wireless Drivers
47 TITLE
:=MediaTek MT76x2
/MT7603 wireless driver
(metapackage
)
49 +kmod-mt76-core
+kmod-mt76x2
+kmod-mt7603
52 define KernelPackage
/mt76-core
53 $(KernelPackage
/mt76-default
)
54 TITLE
:=MediaTek MT76xx wireless driver
57 $(PKG_BUILD_DIR
)/mt76.ko
60 define KernelPackage
/mt76-usb
61 $(KernelPackage
/mt76-default
)
62 TITLE
:=MediaTek MT76xx wireless driver USB support
63 DEPENDS
+= +kmod-usb-core
+kmod-mt76-core
66 $(PKG_BUILD_DIR
)/mt76-usb.ko
69 define KernelPackage
/mt76x02-usb
70 $(KernelPackage
/mt76-default
)
71 TITLE
:=MediaTek MT76x0
/MT76x2 USB wireless driver common code
72 DEPENDS
+=+kmod-mt76-usb
+kmod-mt76x02-common
74 FILES
:=$(PKG_BUILD_DIR
)/mt76x02-usb.ko
77 define KernelPackage
/mt76x02-common
78 $(KernelPackage
/mt76-default
)
79 TITLE
:=MediaTek MT76x0
/MT76x2 wireless driver common code
80 DEPENDS
+=+kmod-mt76-core
82 FILES
:=$(PKG_BUILD_DIR
)/mt76x02-lib.ko
85 define KernelPackage
/mt76x0-common
86 $(KernelPackage
/mt76-default
)
87 TITLE
:=MediaTek MT76x0 wireless driver common code
88 DEPENDS
+=+kmod-mt76x02-common
90 FILES
:=$(PKG_BUILD_DIR
)/mt76x0
/mt76x0-common.ko
93 define KernelPackage
/mt76x0e
94 $(KernelPackage
/mt76-default
)
95 TITLE
:=MediaTek MT76x0E wireless driver
96 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76x0-common
98 $(PKG_BUILD_DIR
)/mt76x0
/mt76x0e.ko
99 AUTOLOAD
:=$(call AutoProbe
,mt76x0e
)
102 define KernelPackage
/mt76x0u
103 $(KernelPackage
/mt76-default
)
104 TITLE
:=MediaTek MT76x0U wireless driver
105 DEPENDS
+=+kmod-mt76x0-common
+kmod-mt76x02-usb
107 $(PKG_BUILD_DIR
)/mt76x0
/mt76x0u.ko
108 AUTOLOAD
:=$(call AutoProbe
,mt76x0u
)
111 define KernelPackage
/mt76x2-common
112 $(KernelPackage
/mt76-default
)
113 TITLE
:=MediaTek MT76x2 wireless driver common code
114 DEPENDS
+=+kmod-mt76-core
+kmod-mt76x02-common
116 FILES
:=$(PKG_BUILD_DIR
)/mt76x2
/mt76x2-common.ko
119 define KernelPackage
/mt76x2u
120 $(KernelPackage
/mt76-default
)
121 TITLE
:=MediaTek MT76x2U wireless driver
122 DEPENDS
+=+kmod-mt76x2-common
+kmod-mt76x02-usb
124 $(PKG_BUILD_DIR
)/mt76x2
/mt76x2u.ko
125 AUTOLOAD
:=$(call AutoProbe
,mt76x2u
)
128 define KernelPackage
/mt76x2
129 $(KernelPackage
/mt76-default
)
130 TITLE
:=MediaTek MT76x2 wireless driver
131 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76x2-common
133 $(PKG_BUILD_DIR
)/mt76x2
/mt76x2e.ko
134 AUTOLOAD
:=$(call AutoProbe
,mt76x2e
)
137 define KernelPackage
/mt7603
138 $(KernelPackage
/mt76-default
)
139 TITLE
:=MediaTek MT7603 wireless driver
140 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
142 $(PKG_BUILD_DIR
)/mt7603
/mt7603e.ko
143 AUTOLOAD
:=$(call AutoProbe
,mt7603e
)
146 define KernelPackage
/mt7615-common
147 $(KernelPackage
/mt76-default
)
148 TITLE
:=MediaTek MT7615 wireless driver common code
150 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
151 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615-common.ko
154 define KernelPackage
/mt7615-firmware
155 $(KernelPackage
/mt76-default
)
156 TITLE
:=MediaTek MT7615e firmware
157 DEFAULT
:=PACKAGE_kmod-mt7615e
160 define KernelPackage
/mt7615e
161 $(KernelPackage
/mt76-default
)
162 TITLE
:=MediaTek MT7615e wireless driver
163 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
164 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615e.ko
165 AUTOLOAD
:=$(call AutoProbe
,mt7615e
)
168 define KernelPackage
/mt7663-firmware-ap
169 $(KernelPackage
/mt76-default
)
170 TITLE
:=MediaTek MT7663e firmware
(optimized for AP
)
173 define KernelPackage
/mt7663-firmware-sta
174 $(KernelPackage
/mt76-default
)
175 TITLE
:=MediaTek MT7663e firmware
(client mode offload
)
178 define KernelPackage
/mt7663-usb-sdio
179 $(KernelPackage
/mt76-default
)
180 TITLE
:=MediaTek MT7663 USB
/SDIO shared code
181 DEPENDS
+=+kmod-mt7615-common
184 $(PKG_BUILD_DIR
)/mt7615
/mt7663-usb-sdio-common.ko
187 define KernelPackage
/mt7663s
188 $(KernelPackage
/mt76-default
)
189 TITLE
:=MediaTek MT7663s wireless driver
190 DEPENDS
+=+kmod-mmc
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
192 $(PKG_BUILD_DIR
)/mt76-sdio.ko \
193 $(PKG_BUILD_DIR
)/mt7615
/mt7663s.ko
194 AUTOLOAD
:=$(call AutoProbe
,mt7663s
)
197 define KernelPackage
/mt7663u
198 $(KernelPackage
/mt76-default
)
199 TITLE
:=MediaTek MT7663u wireless driver
200 DEPENDS
+=+kmod-mt76-usb
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
201 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7663u.ko
202 AUTOLOAD
:=$(call AutoProbe
,mt7663u
)
205 define KernelPackage
/mt7915e
206 $(KernelPackage
/mt76-default
)
207 TITLE
:=MediaTek MT7915e wireless driver
208 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
+@DRIVER_11AX_SUPPORT
209 FILES
:= $(PKG_BUILD_DIR
)/mt7915
/mt7915e.ko
210 AUTOLOAD
:=$(call AutoProbe
,mt7915e
)
213 define Package
/mt76-test
215 CATEGORY
:=Development
216 TITLE
:=mt76 testmode CLI
217 DEPENDS
:=kmod-mt76-core
+libnl-tiny
220 TARGET_CFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
224 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport
/uapi \
225 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport \
226 -I
$(STAGING_DIR
)/usr
/include/mac80211
/uapi \
227 -I
$(STAGING_DIR
)/usr
/include/mac80211 \
228 -include backport
/autoconf.h \
229 -include backport
/backport.h
231 ifdef CONFIG_PACKAGE_MAC80211_MESH
232 NOSTDINC_FLAGS
+= -DCONFIG_MAC80211_MESH
235 ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
236 NOSTDINC_FLAGS
+= -DCONFIG_NL80211_TESTMODE
237 PKG_MAKE_FLAGS
+= CONFIG_NL80211_TESTMODE
=y
240 ifdef CONFIG_PACKAGE_kmod-mt76-usb
241 PKG_MAKE_FLAGS
+= CONFIG_MT76_USB
=m
243 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
244 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_LIB
=m
246 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
247 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_USB
=m
249 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
250 PKG_MAKE_FLAGS
+= CONFIG_MT76x0_COMMON
=m
252 ifdef CONFIG_PACKAGE_kmod-mt76x0e
253 PKG_MAKE_FLAGS
+= CONFIG_MT76x0E
=m
255 ifdef CONFIG_PACKAGE_kmod-mt76x0u
256 PKG_MAKE_FLAGS
+= CONFIG_MT76x0U
=m
258 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
259 PKG_MAKE_FLAGS
+= CONFIG_MT76x2_COMMON
=m
261 ifdef CONFIG_PACKAGE_kmod-mt76x2
262 PKG_MAKE_FLAGS
+= CONFIG_MT76x2E
=m
264 ifdef CONFIG_PACKAGE_kmod-mt76x2u
265 PKG_MAKE_FLAGS
+= CONFIG_MT76x2U
=m
267 ifdef CONFIG_PACKAGE_kmod-mt7603
268 PKG_MAKE_FLAGS
+= CONFIG_MT7603E
=m
270 ifdef CONFIG_PACKAGE_kmod-mt7615-common
271 PKG_MAKE_FLAGS
+= CONFIG_MT7615_COMMON
=m
273 ifdef CONFIG_PACKAGE_kmod-mt7615e
274 PKG_MAKE_FLAGS
+= CONFIG_MT7615E
=m
275 ifdef CONFIG_TARGET_mediatek_mt7622
276 PKG_MAKE_FLAGS
+= CONFIG_MT7622_WMAC
=y
277 NOSTDINC_FLAGS
+= -DCONFIG_MT7622_WMAC
280 ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
281 PKG_MAKE_FLAGS
+= CONFIG_MT7663_USB_SDIO_COMMON
=m
283 ifdef CONFIG_PACKAGE_kmod-mt7663s
284 PKG_MAKE_FLAGS
+= CONFIG_MT76_SDIO
=m
285 PKG_MAKE_FLAGS
+= CONFIG_MT7663S
=m
287 ifdef CONFIG_PACKAGE_kmod-mt7663u
288 PKG_MAKE_FLAGS
+= CONFIG_MT7663U
=m
290 ifdef CONFIG_PACKAGE_kmod-mt7915e
291 PKG_MAKE_FLAGS
+= CONFIG_MT7915E
=m
295 +$(MAKE
) $(PKG_JOBS
) -C
"$(LINUX_DIR)" \
296 $(KERNEL_MAKE_FLAGS
) \
298 M
="$(PKG_BUILD_DIR)" \
299 NOSTDINC_FLAGS
="$(NOSTDINC_FLAGS)" \
301 $(MAKE
) -C
$(PKG_BUILD_DIR
)/tools
308 define Package
/kmod-mt76
/install
312 define KernelPackage
/mt76x0-common
/install
313 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
315 $(PKG_BUILD_DIR
)/firmware
/mt7610e.bin \
316 $(1)/lib
/firmware
/mediatek
319 define KernelPackage
/mt76x2-common
/install
320 $(INSTALL_DIR
) $(1)/lib
/firmware
322 $(PKG_BUILD_DIR
)/firmware
/mt7662_rom_patch.bin \
323 $(PKG_BUILD_DIR
)/firmware
/mt7662.bin \
327 define KernelPackage
/mt76x0u
/install
328 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
329 ln
-sf mt7610e.bin
$(1)/lib
/firmware
/mediatek
/mt7610u.bin
332 define KernelPackage
/mt76x2u
/install
333 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
334 ln
-sf ..
/mt7662.bin
$(1)/lib
/firmware
/mediatek
/mt7662u.bin
335 ln
-sf ..
/mt7662_rom_patch.bin
$(1)/lib
/firmware
/mediatek
/mt7662u_rom_patch.bin
338 define KernelPackage
/mt7603
/install
339 $(INSTALL_DIR
) $(1)/lib
/firmware
340 cp
$(if
$(CONFIG_TARGET_ramips_mt76x8
), \
341 $(PKG_BUILD_DIR
)/firmware
/mt7628_e1.bin \
342 $(PKG_BUILD_DIR
)/firmware
/mt7628_e2.bin \
344 $(PKG_BUILD_DIR
)/firmware
/mt7603_e1.bin \
345 $(PKG_BUILD_DIR
)/firmware
/mt7603_e2.bin \
350 define KernelPackage
/mt7615-firmware
/install
351 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
353 $(PKG_BUILD_DIR
)/firmware
/mt7615_cr4.bin \
354 $(PKG_BUILD_DIR
)/firmware
/mt7615_n9.bin \
355 $(PKG_BUILD_DIR
)/firmware
/mt7615_rom_patch.bin \
356 $(if
$(CONFIG_TARGET_mediatek_mt7622
), \
357 $(PKG_BUILD_DIR
)/firmware
/mt7622_n9.bin \
358 $(PKG_BUILD_DIR
)/firmware
/mt7622_rom_patch.bin
) \
359 $(1)/lib
/firmware
/mediatek
362 define KernelPackage
/mt7663-firmware-ap
/install
363 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
365 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_rebb.bin \
366 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h_rebb.bin \
367 $(1)/lib
/firmware
/mediatek
370 define KernelPackage
/mt7663-firmware-sta
/install
371 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
373 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_v3.bin \
374 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h.bin \
375 $(1)/lib
/firmware
/mediatek
378 define KernelPackage
/mt7915e
/install
379 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
381 $(PKG_BUILD_DIR
)/firmware
/mt7915_wa.bin \
382 $(PKG_BUILD_DIR
)/firmware
/mt7915_wm.bin \
383 $(PKG_BUILD_DIR
)/firmware
/mt7915_rom_patch.bin \
384 $(1)/lib
/firmware
/mediatek
387 define Package
/mt76-test
/install
388 mkdir
-p
$(1)/usr
/sbin
389 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tools
/mt76-test
$(1)/usr
/sbin
392 $(eval
$(call KernelPackage
,mt76-core
))
393 $(eval
$(call KernelPackage
,mt76-usb
))
394 $(eval
$(call KernelPackage
,mt76x02-usb
))
395 $(eval
$(call KernelPackage
,mt76x02-common
))
396 $(eval
$(call KernelPackage
,mt76x0-common
))
397 $(eval
$(call KernelPackage
,mt76x0e
))
398 $(eval
$(call KernelPackage
,mt76x0u
))
399 $(eval
$(call KernelPackage
,mt76x2-common
))
400 $(eval
$(call KernelPackage
,mt76x2u
))
401 $(eval
$(call KernelPackage
,mt76x2
))
402 $(eval
$(call KernelPackage
,mt7603
))
403 $(eval
$(call KernelPackage
,mt7615-common
))
404 $(eval
$(call KernelPackage
,mt7615-firmware
))
405 $(eval
$(call KernelPackage
,mt7615e
))
406 $(eval
$(call KernelPackage
,mt7663-firmware-ap
))
407 $(eval
$(call KernelPackage
,mt7663-firmware-sta
))
408 $(eval
$(call KernelPackage
,mt7663-usb-sdio
))
409 $(eval
$(call KernelPackage
,mt7663u
))
410 $(eval
$(call KernelPackage
,mt7663s
))
411 $(eval
$(call KernelPackage
,mt7915e
))
412 $(eval
$(call KernelPackage
,mt76
))
413 $(eval
$(call BuildPackage
,mt76-test
))