1 include $(TOPDIR
)/rules.mk
9 PKG_SOURCE_URL
:=https
://github.com
/openwrt
/mt76
11 PKG_SOURCE_DATE
:=2021-10-11
12 PKG_SOURCE_VERSION
:=5560b08f8e2dfe92aa920a9cf3c5655a309dd25b
13 PKG_MIRROR_HASH
:=36359a85325a60230838e38e087f9aecc49cf7abca0ef55b2dbee86cf9194425
15 PKG_MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
19 PKG_CONFIG_DEPENDS
+= \
20 CONFIG_PACKAGE_kmod-mt76-usb \
21 CONFIG_PACKAGE_kmod-mt76x02-common \
22 CONFIG_PACKAGE_kmod-mt76x0-common \
23 CONFIG_PACKAGE_kmod-mt76x0u \
24 CONFIG_PACKAGE_kmod-mt76x2-common \
25 CONFIG_PACKAGE_kmod-mt76x2 \
26 CONFIG_PACKAGE_kmod-mt76x2u \
27 CONFIG_PACKAGE_kmod-mt7603 \
28 CONFIG_PACKAGE_CFG80211_TESTMODE
30 STAMP_CONFIGURED_DEPENDS
:= $(STAGING_DIR
)/usr
/include/mac80211-backport
/backport
/autoconf.h
32 include $(INCLUDE_DIR
)/kernel.mk
33 include $(INCLUDE_DIR
)/package.mk
34 include $(INCLUDE_DIR
)/cmake.mk
36 CMAKE_SOURCE_DIR
:=$(PKG_BUILD_DIR
)/tools
37 CMAKE_BINARY_DIR
:=$(PKG_BUILD_DIR
)/tools
39 define KernelPackage
/mt76-default
40 SUBMENU
:=Wireless Drivers
43 +@DRIVER_11AC_SUPPORT
+@DRIVER_11N_SUPPORT
46 define KernelPackage
/mt76
47 SUBMENU
:=Wireless Drivers
48 TITLE
:=MediaTek MT76x2
/MT7603 wireless driver
(metapackage
)
50 +kmod-mt76-core
+kmod-mt76x2
+kmod-mt7603
53 define KernelPackage
/mt76-core
54 $(KernelPackage
/mt76-default
)
55 TITLE
:=MediaTek MT76xx wireless driver
58 $(PKG_BUILD_DIR
)/mt76.ko
61 define KernelPackage
/mt76-usb
62 $(KernelPackage
/mt76-default
)
63 TITLE
:=MediaTek MT76xx wireless driver USB support
64 DEPENDS
+= +kmod-usb-core
+kmod-mt76-core
67 $(PKG_BUILD_DIR
)/mt76-usb.ko
70 define KernelPackage
/mt76x02-usb
71 $(KernelPackage
/mt76-default
)
72 TITLE
:=MediaTek MT76x0
/MT76x2 USB wireless driver common code
73 DEPENDS
+=+kmod-mt76-usb
+kmod-mt76x02-common
75 FILES
:=$(PKG_BUILD_DIR
)/mt76x02-usb.ko
78 define KernelPackage
/mt76x02-common
79 $(KernelPackage
/mt76-default
)
80 TITLE
:=MediaTek MT76x0
/MT76x2 wireless driver common code
81 DEPENDS
+=+kmod-mt76-core
83 FILES
:=$(PKG_BUILD_DIR
)/mt76x02-lib.ko
86 define KernelPackage
/mt76x0-common
87 $(KernelPackage
/mt76-default
)
88 TITLE
:=MediaTek MT76x0 wireless driver common code
89 DEPENDS
+=+kmod-mt76x02-common
91 FILES
:=$(PKG_BUILD_DIR
)/mt76x0
/mt76x0-common.ko
94 define KernelPackage
/mt76x0e
95 $(KernelPackage
/mt76-default
)
96 TITLE
:=MediaTek MT76x0E wireless driver
97 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76x0-common
99 $(PKG_BUILD_DIR
)/mt76x0
/mt76x0e.ko
100 AUTOLOAD
:=$(call AutoProbe
,mt76x0e
)
103 define KernelPackage
/mt76x0u
104 $(KernelPackage
/mt76-default
)
105 TITLE
:=MediaTek MT76x0U wireless driver
106 DEPENDS
+=+kmod-mt76x0-common
+kmod-mt76x02-usb
108 $(PKG_BUILD_DIR
)/mt76x0
/mt76x0u.ko
109 AUTOLOAD
:=$(call AutoProbe
,mt76x0u
)
112 define KernelPackage
/mt76x2-common
113 $(KernelPackage
/mt76-default
)
114 TITLE
:=MediaTek MT76x2 wireless driver common code
115 DEPENDS
+=+kmod-mt76-core
+kmod-mt76x02-common
117 FILES
:=$(PKG_BUILD_DIR
)/mt76x2
/mt76x2-common.ko
120 define KernelPackage
/mt76x2u
121 $(KernelPackage
/mt76-default
)
122 TITLE
:=MediaTek MT76x2U wireless driver
123 DEPENDS
+=+kmod-mt76x2-common
+kmod-mt76x02-usb
125 $(PKG_BUILD_DIR
)/mt76x2
/mt76x2u.ko
126 AUTOLOAD
:=$(call AutoProbe
,mt76x2u
)
129 define KernelPackage
/mt76x2
130 $(KernelPackage
/mt76-default
)
131 TITLE
:=MediaTek MT76x2 wireless driver
132 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76x2-common
134 $(PKG_BUILD_DIR
)/mt76x2
/mt76x2e.ko
135 AUTOLOAD
:=$(call AutoProbe
,mt76x2e
)
138 define KernelPackage
/mt7603
139 $(KernelPackage
/mt76-default
)
140 TITLE
:=MediaTek MT7603 wireless driver
141 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
143 $(PKG_BUILD_DIR
)/mt7603
/mt7603e.ko
144 AUTOLOAD
:=$(call AutoProbe
,mt7603e
)
147 define KernelPackage
/mt76-connac
148 $(KernelPackage
/mt76-default
)
149 TITLE
:=MediaTek MT7615
/MT79xx wireless driver common code
151 DEPENDS
+=+kmod-mt76-core
152 FILES
:= $(PKG_BUILD_DIR
)/mt76-connac-lib.ko
155 define KernelPackage
/mt7615-common
156 $(KernelPackage
/mt76-default
)
157 TITLE
:=MediaTek MT7615 wireless driver common code
159 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
+kmod-mt76-connac
+kmod-hwmon-core
160 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615-common.ko
163 define KernelPackage
/mt7615-firmware
164 $(KernelPackage
/mt76-default
)
165 TITLE
:=MediaTek MT7615e firmware
166 DEFAULT
:=PACKAGE_kmod-mt7615e
169 define KernelPackage
/mt7615e
170 $(KernelPackage
/mt76-default
)
171 TITLE
:=MediaTek MT7615e wireless driver
172 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
173 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615e.ko
174 AUTOLOAD
:=$(call AutoProbe
,mt7615e
)
177 define KernelPackage
/mt7663-firmware-ap
178 $(KernelPackage
/mt76-default
)
179 TITLE
:=MediaTek MT7663e firmware
(optimized for AP
)
182 define KernelPackage
/mt7663-firmware-sta
183 $(KernelPackage
/mt76-default
)
184 TITLE
:=MediaTek MT7663e firmware
(client mode offload
)
187 define KernelPackage
/mt7663-usb-sdio
188 $(KernelPackage
/mt76-default
)
189 TITLE
:=MediaTek MT7663 USB
/SDIO shared code
190 DEPENDS
+=+kmod-mt7615-common
193 $(PKG_BUILD_DIR
)/mt7615
/mt7663-usb-sdio-common.ko
196 define KernelPackage
/mt7663s
197 $(KernelPackage
/mt76-default
)
198 TITLE
:=MediaTek MT7663s wireless driver
199 DEPENDS
+=+kmod-mmc
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
201 $(PKG_BUILD_DIR
)/mt76-sdio.ko \
202 $(PKG_BUILD_DIR
)/mt7615
/mt7663s.ko
203 AUTOLOAD
:=$(call AutoProbe
,mt7663s
)
206 define KernelPackage
/mt7663u
207 $(KernelPackage
/mt76-default
)
208 TITLE
:=MediaTek MT7663u wireless driver
209 DEPENDS
+=+kmod-mt76-usb
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
210 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7663u.ko
211 AUTOLOAD
:=$(call AutoProbe
,mt7663u
)
214 define KernelPackage
/mt7915e
215 $(KernelPackage
/mt76-default
)
216 TITLE
:=MediaTek MT7915e wireless driver
217 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
+kmod-hwmon-core
+kmod-thermal
+@DRIVER_11AX_SUPPORT
218 FILES
:= $(PKG_BUILD_DIR
)/mt7915
/mt7915e.ko
219 AUTOLOAD
:=$(call AutoProbe
,mt7915e
)
222 define KernelPackage
/mt7921e
223 $(KernelPackage
/mt76-default
)
224 TITLE
:=MediaTek MT7921e wireless driver
225 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-connac
226 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921e.ko
227 AUTOLOAD
:=$(call AutoProbe
,mt7921e
)
230 define Package
/mt76-test
232 CATEGORY
:=Development
233 TITLE
:=mt76 testmode CLI
234 DEPENDS
:=kmod-mt76-core
+libnl-tiny
237 TARGET_CFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
240 $(KERNEL_NOSTDINC_FLAGS
) \
242 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport
/uapi \
243 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport \
244 -I
$(STAGING_DIR
)/usr
/include/mac80211
/uapi \
245 -I
$(STAGING_DIR
)/usr
/include/mac80211 \
246 -include backport
/autoconf.h \
247 -include backport
/backport.h
249 ifdef CONFIG_PACKAGE_MAC80211_MESH
250 NOSTDINC_FLAGS
+= -DCONFIG_MAC80211_MESH
253 ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
254 NOSTDINC_FLAGS
+= -DCONFIG_NL80211_TESTMODE
255 PKG_MAKE_FLAGS
+= CONFIG_NL80211_TESTMODE
=y
258 ifdef CONFIG_PACKAGE_kmod-mt76-usb
259 PKG_MAKE_FLAGS
+= CONFIG_MT76_USB
=m
261 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
262 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_LIB
=m
264 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
265 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_USB
=m
267 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
268 PKG_MAKE_FLAGS
+= CONFIG_MT76x0_COMMON
=m
270 ifdef CONFIG_PACKAGE_kmod-mt76x0e
271 PKG_MAKE_FLAGS
+= CONFIG_MT76x0E
=m
273 ifdef CONFIG_PACKAGE_kmod-mt76x0u
274 PKG_MAKE_FLAGS
+= CONFIG_MT76x0U
=m
276 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
277 PKG_MAKE_FLAGS
+= CONFIG_MT76x2_COMMON
=m
279 ifdef CONFIG_PACKAGE_kmod-mt76x2
280 PKG_MAKE_FLAGS
+= CONFIG_MT76x2E
=m
282 ifdef CONFIG_PACKAGE_kmod-mt76x2u
283 PKG_MAKE_FLAGS
+= CONFIG_MT76x2U
=m
285 ifdef CONFIG_PACKAGE_kmod-mt7603
286 PKG_MAKE_FLAGS
+= CONFIG_MT7603E
=m
288 ifdef CONFIG_PACKAGE_kmod-mt76-connac
289 PKG_MAKE_FLAGS
+= CONFIG_MT76_CONNAC_LIB
=m
291 ifdef CONFIG_PACKAGE_kmod-mt7615-common
292 PKG_MAKE_FLAGS
+= CONFIG_MT7615_COMMON
=m
294 ifdef CONFIG_PACKAGE_kmod-mt7615e
295 PKG_MAKE_FLAGS
+= CONFIG_MT7615E
=m
296 ifdef CONFIG_TARGET_mediatek_mt7622
297 PKG_MAKE_FLAGS
+= CONFIG_MT7622_WMAC
=y
298 NOSTDINC_FLAGS
+= -DCONFIG_MT7622_WMAC
301 ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
302 PKG_MAKE_FLAGS
+= CONFIG_MT7663_USB_SDIO_COMMON
=m
304 ifdef CONFIG_PACKAGE_kmod-mt7663s
305 PKG_MAKE_FLAGS
+= CONFIG_MT76_SDIO
=m
306 PKG_MAKE_FLAGS
+= CONFIG_MT7663S
=m
308 ifdef CONFIG_PACKAGE_kmod-mt7663u
309 PKG_MAKE_FLAGS
+= CONFIG_MT7663U
=m
311 ifdef CONFIG_PACKAGE_kmod-mt7915e
312 PKG_MAKE_FLAGS
+= CONFIG_MT7915E
=m
314 ifdef CONFIG_PACKAGE_kmod-mt7921e
315 PKG_MAKE_FLAGS
+= CONFIG_MT7921E
=m
319 +$(MAKE
) $(PKG_JOBS
) -C
"$(LINUX_DIR)" \
320 $(KERNEL_MAKE_FLAGS
) \
322 M
="$(PKG_BUILD_DIR)" \
323 NOSTDINC_FLAGS
="$(NOSTDINC_FLAGS)" \
325 $(MAKE
) -C
$(PKG_BUILD_DIR
)/tools
332 define Package
/kmod-mt76
/install
336 define KernelPackage
/mt76x0-common
/install
337 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
339 $(PKG_BUILD_DIR
)/firmware
/mt7610e.bin \
340 $(1)/lib
/firmware
/mediatek
343 define KernelPackage
/mt76x2-common
/install
344 $(INSTALL_DIR
) $(1)/lib
/firmware
346 $(PKG_BUILD_DIR
)/firmware
/mt7662_rom_patch.bin \
347 $(PKG_BUILD_DIR
)/firmware
/mt7662.bin \
351 define KernelPackage
/mt76x0u
/install
352 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
353 ln
-sf mt7610e.bin
$(1)/lib
/firmware
/mediatek
/mt7610u.bin
356 define KernelPackage
/mt76x2u
/install
357 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
358 ln
-sf ..
/mt7662.bin
$(1)/lib
/firmware
/mediatek
/mt7662u.bin
359 ln
-sf ..
/mt7662_rom_patch.bin
$(1)/lib
/firmware
/mediatek
/mt7662u_rom_patch.bin
362 define KernelPackage
/mt7603
/install
363 $(INSTALL_DIR
) $(1)/lib
/firmware
364 cp
$(if
$(CONFIG_TARGET_ramips_mt76x8
), \
365 $(PKG_BUILD_DIR
)/firmware
/mt7628_e1.bin \
366 $(PKG_BUILD_DIR
)/firmware
/mt7628_e2.bin \
368 $(PKG_BUILD_DIR
)/firmware
/mt7603_e1.bin \
369 $(PKG_BUILD_DIR
)/firmware
/mt7603_e2.bin \
374 define KernelPackage
/mt7615-firmware
/install
375 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
377 $(PKG_BUILD_DIR
)/firmware
/mt7615_cr4.bin \
378 $(PKG_BUILD_DIR
)/firmware
/mt7615_n9.bin \
379 $(PKG_BUILD_DIR
)/firmware
/mt7615_rom_patch.bin \
380 $(if
$(CONFIG_TARGET_mediatek_mt7622
), \
381 $(PKG_BUILD_DIR
)/firmware
/mt7622_n9.bin \
382 $(PKG_BUILD_DIR
)/firmware
/mt7622_rom_patch.bin
) \
383 $(1)/lib
/firmware
/mediatek
386 define KernelPackage
/mt7663-firmware-ap
/install
387 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
389 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_rebb.bin \
390 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h_rebb.bin \
391 $(1)/lib
/firmware
/mediatek
394 define KernelPackage
/mt7663-firmware-sta
/install
395 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
397 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_v3.bin \
398 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h.bin \
399 $(1)/lib
/firmware
/mediatek
402 define KernelPackage
/mt7915e
/install
403 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
405 $(PKG_BUILD_DIR
)/firmware
/mt7915_wa.bin \
406 $(PKG_BUILD_DIR
)/firmware
/mt7915_wm.bin \
407 $(PKG_BUILD_DIR
)/firmware
/mt7915_rom_patch.bin \
408 $(1)/lib
/firmware
/mediatek
411 define KernelPackage
/mt7921e
/install
412 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
414 $(PKG_BUILD_DIR
)/firmware
/WIFI_MT7961_patch_mcu_1_2_hdr.bin \
415 $(PKG_BUILD_DIR
)/firmware
/WIFI_RAM_CODE_MT7961_1.bin \
416 $(1)/lib
/firmware
/mediatek
419 define Package
/mt76-test
/install
420 mkdir
-p
$(1)/usr
/sbin
421 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tools
/mt76-test
$(1)/usr
/sbin
424 $(eval
$(call KernelPackage
,mt76-core
))
425 $(eval
$(call KernelPackage
,mt76-usb
))
426 $(eval
$(call KernelPackage
,mt76x02-usb
))
427 $(eval
$(call KernelPackage
,mt76x02-common
))
428 $(eval
$(call KernelPackage
,mt76x0-common
))
429 $(eval
$(call KernelPackage
,mt76x0e
))
430 $(eval
$(call KernelPackage
,mt76x0u
))
431 $(eval
$(call KernelPackage
,mt76x2-common
))
432 $(eval
$(call KernelPackage
,mt76x2u
))
433 $(eval
$(call KernelPackage
,mt76x2
))
434 $(eval
$(call KernelPackage
,mt7603
))
435 $(eval
$(call KernelPackage
,mt76-connac
))
436 $(eval
$(call KernelPackage
,mt7615-common
))
437 $(eval
$(call KernelPackage
,mt7615-firmware
))
438 $(eval
$(call KernelPackage
,mt7615e
))
439 $(eval
$(call KernelPackage
,mt7663-firmware-ap
))
440 $(eval
$(call KernelPackage
,mt7663-firmware-sta
))
441 $(eval
$(call KernelPackage
,mt7663-usb-sdio
))
442 $(eval
$(call KernelPackage
,mt7663u
))
443 $(eval
$(call KernelPackage
,mt7663s
))
444 $(eval
$(call KernelPackage
,mt7915e
))
445 $(eval
$(call KernelPackage
,mt7921e
))
446 $(eval
$(call KernelPackage
,mt76
))
447 $(eval
$(call BuildPackage
,mt76-test
))