1 include $(TOPDIR
)/rules.mk
9 PKG_SOURCE_URL
:=https
://github.com
/openwrt
/mt76
11 PKG_SOURCE_DATE
:=2021-12-02
12 PKG_SOURCE_VERSION
:=929a03a8d65daf912eb09ae07df522b863c7a8fc
13 PKG_MIRROR_HASH
:=8078d9f40fa341936252d27447821e4826af800b07e5fc412abcea34e648be59
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
225 FILES
:= $(PKG_BUILD_DIR
)/mt7915
/mt7915e.ko
226 AUTOLOAD
:=$(call AutoProbe
,mt7915e
)
229 define KernelPackage
/mt7921-common
230 TITLE
:=MediaTek MT7615 wireless driver common code
232 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-core
+kmod-mt76-connac
233 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921-common.ko
236 define KernelPackage
/mt7921s
237 $(KernelPackage
/mt76-default
)
238 TITLE
:=MediaTek MT7921s wireless driver
239 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-connac
+kmod-mt76-sdio
+kmod-mt7921-common
240 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921s.ko
241 AUTOLOAD
:=$(call AutoProbe
,mt7921s
)
244 define KernelPackage
/mt7921e
245 $(KernelPackage
/mt76-default
)
246 TITLE
:=MediaTek MT7921e wireless driver
247 DEPENDS
+=@PCI_SUPPORT
+kmod-mt76-connac
+kmod-mt7921-common
248 FILES
:= $(PKG_BUILD_DIR
)/mt7921
/mt7921e.ko
249 AUTOLOAD
:=$(call AutoProbe
,mt7921e
)
252 define Package
/mt76-test
254 CATEGORY
:=Development
255 TITLE
:=mt76 testmode CLI
256 DEPENDS
:=kmod-mt76-core
+libnl-tiny
259 TARGET_CFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
262 $(KERNEL_NOSTDINC_FLAGS
) \
264 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport
/uapi \
265 -I
$(STAGING_DIR
)/usr
/include/mac80211-backport \
266 -I
$(STAGING_DIR
)/usr
/include/mac80211
/uapi \
267 -I
$(STAGING_DIR
)/usr
/include/mac80211 \
268 -include backport
/autoconf.h \
269 -include backport
/backport.h
271 ifdef CONFIG_PACKAGE_MAC80211_MESH
272 NOSTDINC_FLAGS
+= -DCONFIG_MAC80211_MESH
275 ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
276 NOSTDINC_FLAGS
+= -DCONFIG_NL80211_TESTMODE
277 PKG_MAKE_FLAGS
+= CONFIG_NL80211_TESTMODE
=y
280 ifdef CONFIG_PACKAGE_kmod-mt76-usb
281 PKG_MAKE_FLAGS
+= CONFIG_MT76_USB
=m
283 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
284 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_LIB
=m
286 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
287 PKG_MAKE_FLAGS
+= CONFIG_MT76x02_USB
=m
289 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
290 PKG_MAKE_FLAGS
+= CONFIG_MT76x0_COMMON
=m
292 ifdef CONFIG_PACKAGE_kmod-mt76x0e
293 PKG_MAKE_FLAGS
+= CONFIG_MT76x0E
=m
295 ifdef CONFIG_PACKAGE_kmod-mt76x0u
296 PKG_MAKE_FLAGS
+= CONFIG_MT76x0U
=m
298 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
299 PKG_MAKE_FLAGS
+= CONFIG_MT76x2_COMMON
=m
301 ifdef CONFIG_PACKAGE_kmod-mt76x2
302 PKG_MAKE_FLAGS
+= CONFIG_MT76x2E
=m
304 ifdef CONFIG_PACKAGE_kmod-mt76x2u
305 PKG_MAKE_FLAGS
+= CONFIG_MT76x2U
=m
307 ifdef CONFIG_PACKAGE_kmod-mt7603
308 PKG_MAKE_FLAGS
+= CONFIG_MT7603E
=m
310 ifdef CONFIG_PACKAGE_kmod-mt76-connac
311 PKG_MAKE_FLAGS
+= CONFIG_MT76_CONNAC_LIB
=m
313 ifdef CONFIG_PACKAGE_kmod-mt76-sdio
314 PKG_MAKE_FLAGS
+= CONFIG_MT76_SDIO
=m
316 ifdef CONFIG_PACKAGE_kmod-mt7615-common
317 PKG_MAKE_FLAGS
+= CONFIG_MT7615_COMMON
=m
319 ifdef CONFIG_PACKAGE_kmod-mt7615e
320 PKG_MAKE_FLAGS
+= CONFIG_MT7615E
=m
321 ifdef CONFIG_TARGET_mediatek_mt7622
322 PKG_MAKE_FLAGS
+= CONFIG_MT7622_WMAC
=y
323 NOSTDINC_FLAGS
+= -DCONFIG_MT7622_WMAC
326 ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
327 PKG_MAKE_FLAGS
+= CONFIG_MT7663_USB_SDIO_COMMON
=m
329 ifdef CONFIG_PACKAGE_kmod-mt7663s
330 PKG_MAKE_FLAGS
+= CONFIG_MT7663S
=m
332 ifdef CONFIG_PACKAGE_kmod-mt7663u
333 PKG_MAKE_FLAGS
+= CONFIG_MT7663U
=m
335 ifdef CONFIG_PACKAGE_kmod-mt7915e
336 PKG_MAKE_FLAGS
+= CONFIG_MT7915E
=m
338 ifdef CONFIG_PACKAGE_kmod-mt7921-common
339 PKG_MAKE_FLAGS
+= CONFIG_MT7921_COMMON
=m
341 ifdef CONFIG_PACKAGE_kmod-mt7921s
342 PKG_MAKE_FLAGS
+= CONFIG_MT7921S
=m
344 ifdef CONFIG_PACKAGE_kmod-mt7921e
345 PKG_MAKE_FLAGS
+= CONFIG_MT7921E
=m
349 +$(MAKE
) $(PKG_JOBS
) -C
"$(LINUX_DIR)" \
350 $(KERNEL_MAKE_FLAGS
) \
352 M
="$(PKG_BUILD_DIR)" \
353 NOSTDINC_FLAGS
="$(NOSTDINC_FLAGS)" \
355 $(MAKE
) -C
$(PKG_BUILD_DIR
)/tools
362 define Package
/kmod-mt76
/install
366 define KernelPackage
/mt76x0-common
/install
367 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
369 $(PKG_BUILD_DIR
)/firmware
/mt7610e.bin \
370 $(1)/lib
/firmware
/mediatek
373 define KernelPackage
/mt76x2-common
/install
374 $(INSTALL_DIR
) $(1)/lib
/firmware
376 $(PKG_BUILD_DIR
)/firmware
/mt7662_rom_patch.bin \
377 $(PKG_BUILD_DIR
)/firmware
/mt7662.bin \
381 define KernelPackage
/mt76x0u
/install
382 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
383 ln
-sf mt7610e.bin
$(1)/lib
/firmware
/mediatek
/mt7610u.bin
386 define KernelPackage
/mt76x2u
/install
387 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
388 ln
-sf ..
/mt7662.bin
$(1)/lib
/firmware
/mediatek
/mt7662u.bin
389 ln
-sf ..
/mt7662_rom_patch.bin
$(1)/lib
/firmware
/mediatek
/mt7662u_rom_patch.bin
392 define KernelPackage
/mt7603
/install
393 $(INSTALL_DIR
) $(1)/lib
/firmware
394 cp
$(if
$(CONFIG_TARGET_ramips_mt76x8
), \
395 $(PKG_BUILD_DIR
)/firmware
/mt7628_e1.bin \
396 $(PKG_BUILD_DIR
)/firmware
/mt7628_e2.bin \
398 $(PKG_BUILD_DIR
)/firmware
/mt7603_e1.bin \
399 $(PKG_BUILD_DIR
)/firmware
/mt7603_e2.bin \
404 define KernelPackage
/mt7615-firmware
/install
405 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
407 $(PKG_BUILD_DIR
)/firmware
/mt7615_cr4.bin \
408 $(PKG_BUILD_DIR
)/firmware
/mt7615_n9.bin \
409 $(PKG_BUILD_DIR
)/firmware
/mt7615_rom_patch.bin \
410 $(if
$(CONFIG_TARGET_mediatek_mt7622
), \
411 $(PKG_BUILD_DIR
)/firmware
/mt7622_n9.bin \
412 $(PKG_BUILD_DIR
)/firmware
/mt7622_rom_patch.bin
) \
413 $(1)/lib
/firmware
/mediatek
416 define KernelPackage
/mt7663-firmware-ap
/install
417 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
419 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_rebb.bin \
420 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h_rebb.bin \
421 $(1)/lib
/firmware
/mediatek
424 define KernelPackage
/mt7663-firmware-sta
/install
425 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
427 $(PKG_BUILD_DIR
)/firmware
/mt7663_n9_v3.bin \
428 $(PKG_BUILD_DIR
)/firmware
/mt7663pr2h.bin \
429 $(1)/lib
/firmware
/mediatek
432 define KernelPackage
/mt7915e
/install
433 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
435 $(PKG_BUILD_DIR
)/firmware
/mt7915_wa.bin \
436 $(PKG_BUILD_DIR
)/firmware
/mt7915_wm.bin \
437 $(PKG_BUILD_DIR
)/firmware
/mt7915_rom_patch.bin \
438 $(1)/lib
/firmware
/mediatek
441 define KernelPackage
/mt7921e
/install
442 $(INSTALL_DIR
) $(1)/lib
/firmware
/mediatek
444 $(PKG_BUILD_DIR
)/firmware
/WIFI_MT7961_patch_mcu_1_2_hdr.bin \
445 $(PKG_BUILD_DIR
)/firmware
/WIFI_RAM_CODE_MT7961_1.bin \
446 $(1)/lib
/firmware
/mediatek
449 define Package
/mt76-test
/install
450 mkdir
-p
$(1)/usr
/sbin
451 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tools
/mt76-test
$(1)/usr
/sbin
454 $(eval
$(call KernelPackage
,mt76-core
))
455 $(eval
$(call KernelPackage
,mt76-usb
))
456 $(eval
$(call KernelPackage
,mt76x02-usb
))
457 $(eval
$(call KernelPackage
,mt76x02-common
))
458 $(eval
$(call KernelPackage
,mt76x0-common
))
459 $(eval
$(call KernelPackage
,mt76x0e
))
460 $(eval
$(call KernelPackage
,mt76x0u
))
461 $(eval
$(call KernelPackage
,mt76x2-common
))
462 $(eval
$(call KernelPackage
,mt76x2u
))
463 $(eval
$(call KernelPackage
,mt76x2
))
464 $(eval
$(call KernelPackage
,mt7603
))
465 $(eval
$(call KernelPackage
,mt76-connac
))
466 $(eval
$(call KernelPackage
,mt76-sdio
))
467 $(eval
$(call KernelPackage
,mt7615-common
))
468 $(eval
$(call KernelPackage
,mt7615-firmware
))
469 $(eval
$(call KernelPackage
,mt7615e
))
470 $(eval
$(call KernelPackage
,mt7663-firmware-ap
))
471 $(eval
$(call KernelPackage
,mt7663-firmware-sta
))
472 $(eval
$(call KernelPackage
,mt7663-usb-sdio
))
473 $(eval
$(call KernelPackage
,mt7663u
))
474 $(eval
$(call KernelPackage
,mt7663s
))
475 $(eval
$(call KernelPackage
,mt7915e
))
476 $(eval
$(call KernelPackage
,mt7921-common
))
477 $(eval
$(call KernelPackage
,mt7921s
))
478 $(eval
$(call KernelPackage
,mt7921e
))
479 $(eval
$(call KernelPackage
,mt76
))
480 $(eval
$(call BuildPackage
,mt76-test
))