1 include $(TOPDIR
)/rules.mk
9 PKG_SOURCE_URL
:=https
://github.com
/openwrt
/mt76
11 PKG_SOURCE_DATE
:=2022-09-06
12 PKG_SOURCE_VERSION
:=d70546462b7b51ebc2bcdd5c534fdf3465be62a4
13 PKG_MIRROR_HASH
:=3d6b68d70a78c0072ed10ab2548344b6b3a70ad99e4edc258fafa16886f4abf9
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
/mt76-sdio
156 $(KernelPackage
/mt76-default
)
157 TITLE
:=MediaTek MT7615
/MT79xx SDIO driver common code
159 DEPENDS
+=+kmod-mt76-core
+kmod-mmc
160 FILES
:= $(PKG_BUILD_DIR
)/mt76-sdio.ko
163 define KernelPackage
/mt7615-common
164 $(KernelPackage
/mt76-default
)
165 TITLE
:=MediaTek MT7615 wireless driver common code
167 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
+kmod-mt76-connac
+kmod-hwmon-core
168 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615-common.ko
171 define KernelPackage
/mt7615-firmware
172 $(KernelPackage
/mt76-default
)
173 TITLE
:=MediaTek MT7615e firmware
174 DEFAULT
:=PACKAGE_kmod-mt7615e
177 define KernelPackage
/mt7615e
178 $(KernelPackage
/mt76-default
)
179 TITLE
:=MediaTek MT7615e wireless driver
180 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
181 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7615e.ko
182 AUTOLOAD
:=$(call AutoProbe
,mt7615e
)
185 define KernelPackage
/mt7663-firmware-ap
186 $(KernelPackage
/mt76-default
)
187 TITLE
:=MediaTek MT7663e firmware
(optimized for AP
)
190 define KernelPackage
/mt7663-firmware-sta
191 $(KernelPackage
/mt76-default
)
192 TITLE
:=MediaTek MT7663e firmware
(client mode offload
)
195 define KernelPackage
/mt7663-usb-sdio
196 $(KernelPackage
/mt76-default
)
197 TITLE
:=MediaTek MT7663 USB
/SDIO shared code
198 DEPENDS
+=+kmod-mt7615-common
201 $(PKG_BUILD_DIR
)/mt7615
/mt7663-usb-sdio-common.ko
204 define KernelPackage
/mt7663s
205 $(KernelPackage
/mt76-default
)
206 TITLE
:=MediaTek MT7663s wireless driver
207 DEPENDS
+=+kmod-mt76-sdio
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
209 $(PKG_BUILD_DIR
)/mt7615
/mt7663s.ko
210 AUTOLOAD
:=$(call AutoProbe
,mt7663s
)
213 define KernelPackage
/mt7663u
214 $(KernelPackage
/mt76-default
)
215 TITLE
:=MediaTek MT7663u wireless driver
216 DEPENDS
+=+kmod-mt76-usb
+kmod-mt7615-common
+kmod-mt7663-usb-sdio
217 FILES
:= $(PKG_BUILD_DIR
)/mt7615
/mt7663u.ko
218 AUTOLOAD
:=$(call AutoProbe
,mt7663u
)
221 define KernelPackage
/mt7915e
222 $(KernelPackage
/mt76-default
)
223 TITLE
:=MediaTek MT7915e wireless driver
224 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7615-common
+kmod-hwmon-core
+kmod-thermal
+@DRIVER_11AX_SUPPORT
+@KERNEL_RELAY
225 FILES
:= $(PKG_BUILD_DIR
)/mt7915
/mt7915e.ko
226 AUTOLOAD
:=$(call AutoProbe
,mt7915e
)
229 define KernelPackage
/mt7986-firmware
230 $(KernelPackage
/mt76-default
)
231 DEPENDS
:=@TARGET_mediatek_filogic
232 TITLE
:=MediaTek MT7986 firmware
235 define KernelPackage
/mt7921-common
236 $(KernelPackage
/mt76-default
)
237 TITLE
:=MediaTek MT7615 wireless driver common code
239 DEPENDS
+=+kmod-mt76-connac
+@DRIVER_11AX_SUPPORT
240 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921-common.ko
243 define KernelPackage
/mt7921u
244 $(KernelPackage
/mt76-default
)
245 TITLE
:=MediaTek MT7921U wireless driver
246 DEPENDS
+=+kmod-mt76-usb
+kmod-mt7921-common
247 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921u.ko
248 AUTOLOAD
:=$(call AutoProbe
,mt7921u
)
251 define KernelPackage
/mt7921s
252 $(KernelPackage
/mt76-default
)
253 TITLE
:=MediaTek MT7921S wireless driver
254 DEPENDS
+=+kmod-mt76-sdio
+kmod-mt7921-common
255 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921s.ko
256 AUTOLOAD
:=$(call AutoProbe
,mt7921s
)
259 define KernelPackage
/mt7921e
260 $(KernelPackage
/mt76-default
)
261 TITLE
:=MediaTek MT7921e wireless driver
262 DEPENDS
+=@PCI_SUPPORT
+kmod-mt7921-common
263 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921e.ko
264 AUTOLOAD
:=$(call AutoProbe
,mt7921e
)
267 define Package
/mt76-test
269 CATEGORY
:=Development
270 TITLE
:=mt76 testmode CLI
271 DEPENDS
:=kmod-mt76-core
+libnl-tiny
274 TARGET_CFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
277 $(KERNEL_NOSTDINC_FLAGS
) \
279 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport
/uapi \
280 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport \
281 -I
$(STAGING_DIR
)/usr
/include/mac80211
/uapi \
282 -I
$(STAGING_DIR
)/usr
/include/mac80211 \
283 -include backport
/autoconf.h \
284 -include backport
/backport.h
286 ifdef CONFIG_PACKAGE_MAC80211_MESH
287 NOSTDINC_FLAGS
+= -DCONFIG_MAC80211_MESH
290 ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
291 NOSTDINC_FLAGS
+= -DCONFIG_NL80211_TESTMODE
292 PKG_MAKE_FLAGS
+= CONFIG_NL80211_TESTMODE
=y
295 ifdef CONFIG_PACKAGE_kmod-mt76-usb
296 PKG_MAKE_FLAGS
+= CONFIG_MT76_USB
=m
298 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
299 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_LIB
=m
301 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
302 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_USB
=m
304 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
305 PKG_MAKE_FLAGS
+= CONFIG_MT76x0_COMMON
=m
307 ifdef CONFIG_PACKAGE_kmod-mt76x0e
308 PKG_MAKE_FLAGS
+= CONFIG_MT76x0E
=m
310 ifdef CONFIG_PACKAGE_kmod-mt76x0u
311 PKG_MAKE_FLAGS
+= CONFIG_MT76x0U
=m
313 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
314 PKG_MAKE_FLAGS
+= CONFIG_MT76x2_COMMON
=m
316 ifdef CONFIG_PACKAGE_kmod-mt76x2
317 PKG_MAKE_FLAGS
+= CONFIG_MT76x2E
=m
319 ifdef CONFIG_PACKAGE_kmod-mt76x2u
320 PKG_MAKE_FLAGS
+= CONFIG_MT76x2U
=m
322 ifdef CONFIG_PACKAGE_kmod-mt7603
323 PKG_MAKE_FLAGS
+= CONFIG_MT7603E
=m
325 ifdef CONFIG_PACKAGE_kmod-mt76-connac
326 PKG_MAKE_FLAGS
+= CONFIG_MT76_CONNAC_LIB
=m
328 ifdef CONFIG_PACKAGE_kmod-mt76-sdio
329 PKG_MAKE_FLAGS
+= CONFIG_MT76_SDIO
=m
331 ifdef CONFIG_PACKAGE_kmod-mt7615-common
332 PKG_MAKE_FLAGS
+= CONFIG_MT7615_COMMON
=m
334 ifdef CONFIG_PACKAGE_kmod-mt7615e
335 PKG_MAKE_FLAGS
+= CONFIG_MT7615E
=m
336 ifdef CONFIG_TARGET_mediatek_mt7622
337 PKG_MAKE_FLAGS
+= CONFIG_MT7622_WMAC
=y
338 NOSTDINC_FLAGS
+= -DCONFIG_MT7622_WMAC
341 ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
342 PKG_MAKE_FLAGS
+= CONFIG_MT7663_USB_SDIO_COMMON
=m
344 ifdef CONFIG_PACKAGE_kmod-mt7663s
345 PKG_MAKE_FLAGS
+= CONFIG_MT7663S
=m
347 ifdef CONFIG_PACKAGE_kmod-mt7663u
348 PKG_MAKE_FLAGS
+= CONFIG_MT7663U
=m
350 ifdef CONFIG_PACKAGE_kmod-mt7915e
351 PKG_MAKE_FLAGS
+= CONFIG_MT7915E
=m
352 ifdef CONFIG_TARGET_mediatek_filogic
353 PKG_MAKE_FLAGS
+= CONFIG_MT7986_WMAC
=y
354 NOSTDINC_FLAGS
+= -DCONFIG_MT7986_WMAC
357 ifdef CONFIG_PACKAGE_kmod-mt7921-common
358 PKG_MAKE_FLAGS
+= CONFIG_MT7921_COMMON
=m
360 ifdef CONFIG_PACKAGE_kmod-mt7921u
361 PKG_MAKE_FLAGS
+= CONFIG_MT7921U
=m
363 ifdef CONFIG_PACKAGE_kmod-mt7921s
364 PKG_MAKE_FLAGS
+= CONFIG_MT7921S
=m
366 ifdef CONFIG_PACKAGE_kmod-mt7921e
367 PKG_MAKE_FLAGS
+= CONFIG_MT7921E
=m
371 +$(MAKE
) $(PKG_JOBS
) -C
"$(LINUX_DIR)" \
372 $(KERNEL_MAKE_FLAGS
) \
374 M
="$(PKG_BUILD_DIR)" \
375 NOSTDINC_FLAGS
="$(NOSTDINC_FLAGS)" \
377 $(MAKE
) -C
$(PKG_BUILD_DIR
)/tools
384 define Package
/kmod-mt76
/install
388 define KernelPackage
/mt76x0-common
/install
389 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
391 $(PKG_BUILD_DIR
)/firmware
/mt7610e.bin \
392 $(1)/lib
/firmware
/mediatek
395 define KernelPackage
/mt76x2-common
/install
396 $(INSTALL_DIR
) $(1)/lib
/firmware
398 $(PKG_BUILD_DIR
)/firmware
/mt7662_rom_patch.bin \
399 $(PKG_BUILD_DIR
)/firmware
/mt7662.bin \
403 define KernelPackage
/mt76x0u
/install
404 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
405 ln
-sf mt7610e.bin
$(1)/lib
/firmware
/mediatek
/mt7610u.bin
408 define KernelPackage
/mt76x2u
/install
409 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
410 ln
-sf ..
/mt7662.bin
$(1)/lib
/firmware
/mediatek
/mt7662u.bin
411 ln
-sf ..
/mt7662_rom_patch.bin
$(1)/lib
/firmware
/mediatek
/mt7662u_rom_patch.bin
414 define KernelPackage
/mt7603
/install
415 $(INSTALL_DIR
) $(1)/lib
/firmware
416 cp
$(if
$(CONFIG_TARGET_ramips_mt76x8
), \
417 $(PKG_BUILD_DIR
)/firmware
/mt7628_e1.bin \
418 $(PKG_BUILD_DIR
)/firmware
/mt7628_e2.bin \
420 $(PKG_BUILD_DIR
)/firmware
/mt7603_e1.bin \
421 $(PKG_BUILD_DIR
)/firmware
/mt7603_e2.bin \
426 define KernelPackage
/mt7615-firmware
/install
427 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
429 $(PKG_BUILD_DIR
)/firmware
/mt7615_cr4.bin \
430 $(PKG_BUILD_DIR
)/firmware
/mt7615_n9.bin \
431 $(PKG_BUILD_DIR
)/firmware
/mt7615_rom_patch.bin \
432 $(if
$(CONFIG_TARGET_mediatek_mt7622
), \
433 $(PKG_BUILD_DIR
)/firmware
/mt7622_n9.bin \
434 $(PKG_BUILD_DIR
)/firmware
/mt7622_rom_patch.bin
) \
435 $(1)/lib
/firmware
/mediatek
438 define KernelPackage
/mt7663-firmware-ap
/install
439 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
441 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_rebb.bin \
442 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h_rebb.bin \
443 $(1)/lib
/firmware
/mediatek
446 define KernelPackage
/mt7663-firmware-sta
/install
447 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
449 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_v3.bin \
450 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h.bin \
451 $(1)/lib
/firmware
/mediatek
454 define KernelPackage
/mt7915e
/install
455 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
457 $(PKG_BUILD_DIR
)/firmware
/mt7915_wa.bin \
458 $(PKG_BUILD_DIR
)/firmware
/mt7915_wm.bin \
459 $(PKG_BUILD_DIR
)/firmware
/mt7915_rom_patch.bin \
460 $(1)/lib
/firmware
/mediatek
463 define KernelPackage
/mt7986-firmware
/install
464 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
466 $(PKG_BUILD_DIR
)/firmware
/mt7986_wa.bin \
467 $(PKG_BUILD_DIR
)/firmware
/mt7986_wm_mt7975.bin \
468 $(PKG_BUILD_DIR
)/firmware
/mt7986_wm.bin \
469 $(PKG_BUILD_DIR
)/firmware
/mt7986_rom_patch_mt7975.bin \
470 $(PKG_BUILD_DIR
)/firmware
/mt7986_rom_patch.bin \
471 $(PKG_BUILD_DIR
)/firmware
/mt7986_eeprom_mt7975_dual.bin \
472 $(PKG_BUILD_DIR
)/firmware
/mt7986_eeprom_mt7976_dual.bin \
473 $(1)/lib
/firmware
/mediatek
476 define KernelPackage
/mt7921e
/install
477 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
479 $(PKG_BUILD_DIR
)/firmware
/WIFI_MT7961_patch_mcu_1_2_hdr.bin \
480 $(PKG_BUILD_DIR
)/firmware
/WIFI_RAM_CODE_MT7961_1.bin \
481 $(1)/lib
/firmware
/mediatek
484 define Package
/mt76-test
/install
485 mkdir
-p
$(1)/usr
/sbin
486 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tools
/mt76-test
$(1)/usr
/sbin
489 $(eval
$(call KernelPackage
,mt76-core
))
490 $(eval
$(call KernelPackage
,mt76-usb
))
491 $(eval
$(call KernelPackage
,mt76x02-usb
))
492 $(eval
$(call KernelPackage
,mt76x02-common
))
493 $(eval
$(call KernelPackage
,mt76x0-common
))
494 $(eval
$(call KernelPackage
,mt76x0e
))
495 $(eval
$(call KernelPackage
,mt76x0u
))
496 $(eval
$(call KernelPackage
,mt76x2-common
))
497 $(eval
$(call KernelPackage
,mt76x2u
))
498 $(eval
$(call KernelPackage
,mt76x2
))
499 $(eval
$(call KernelPackage
,mt7603
))
500 $(eval
$(call KernelPackage
,mt76-connac
))
501 $(eval
$(call KernelPackage
,mt76-sdio
))
502 $(eval
$(call KernelPackage
,mt7615-common
))
503 $(eval
$(call KernelPackage
,mt7615-firmware
))
504 $(eval
$(call KernelPackage
,mt7615e
))
505 $(eval
$(call KernelPackage
,mt7663-firmware-ap
))
506 $(eval
$(call KernelPackage
,mt7663-firmware-sta
))
507 $(eval
$(call KernelPackage
,mt7663-usb-sdio
))
508 $(eval
$(call KernelPackage
,mt7663u
))
509 $(eval
$(call KernelPackage
,mt7663s
))
510 $(eval
$(call KernelPackage
,mt7915e
))
511 $(eval
$(call KernelPackage
,mt7986-firmware
))
512 $(eval
$(call KernelPackage
,mt7921-common
))
513 $(eval
$(call KernelPackage
,mt7921u
))
514 $(eval
$(call KernelPackage
,mt7921s
))
515 $(eval
$(call KernelPackage
,mt7921e
))
516 $(eval
$(call KernelPackage
,mt76
))
517 $(eval
$(call BuildPackage
,mt76-test
))