mt76: update to the latest version, fixes stability issues
[openwrt/openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_RELEASE=1
5
6 PKG_LICENSE:=GPLv2
7 PKG_LICENSE_FILES:=
8
9 PKG_SOURCE_URL:=https://github.com/openwrt/mt76
10 PKG_SOURCE_PROTO:=git
11 PKG_SOURCE_DATE:=2017-07-17
12 PKG_SOURCE_VERSION:=3c4c9a647e4feff3a42ee94d477041fdcf26c463
13 PKG_MIRROR_HASH:=7ed7ef6356fafc2525cb6204ca2a3d584c1b83340ef5a1f7c581052f3a1982b1
14
15 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
16 PKG_BUILD_PARALLEL:=1
17
18 STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
19
20 include $(INCLUDE_DIR)/kernel.mk
21 include $(INCLUDE_DIR)/package.mk
22
23 define KernelPackage/mt76-default
24 SUBMENU:=Wireless Drivers
25 DEPENDS:= \
26 +kmod-mac80211 @PCI_SUPPORT @!LINUX_3_18 \
27 +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
28 endef
29
30 define KernelPackage/mt76
31 SUBMENU:=Wireless Drivers
32 TITLE:=MediaTek MT76x2/MT7603 wireless driver (metapackage)
33 DEPENDS:= \
34 +kmod-mt76-core +kmod-mt76x2 +kmod-mt7603
35 endef
36
37 define KernelPackage/mt76-core
38 $(KernelPackage/mt76-default)
39 TITLE:=MediaTek MT76xx wireless driver
40 FILES:=\
41 $(PKG_BUILD_DIR)/mt76.ko
42 AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76)
43 endef
44
45 define KernelPackage/mt76x2
46 $(KernelPackage/mt76-default)
47 TITLE:=MediaTek MT76x2 wireless driver
48 DEPENDS+=+kmod-mt76-core
49 FILES:=\
50 $(PKG_BUILD_DIR)/mt76x2e.ko
51 AUTOLOAD:=$(call AutoLoad,51,mt76x2e)
52 endef
53
54 define KernelPackage/mt7603
55 $(KernelPackage/mt76-default)
56 TITLE:=MediaTek MT7603 wireless driver
57 DEPENDS+=+kmod-mt76-core
58 FILES:=\
59 $(PKG_BUILD_DIR)/mt7603e.ko
60 AUTOLOAD:=$(call AutoLoad,51,mt7603e)
61 endef
62
63 NOSTDINC_FLAGS = \
64 -I$(PKG_BUILD_DIR) \
65 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
66 -I$(STAGING_DIR)/usr/include/mac80211-backport \
67 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
68 -I$(STAGING_DIR)/usr/include/mac80211 \
69 -include backport/autoconf.h \
70 -include backport/backport.h
71
72 ifdef CONFIG_PACKAGE_MAC80211_MESH
73 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
74 endif
75
76 define Build/Compile
77 +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
78 ARCH="$(LINUX_KARCH)" \
79 CROSS_COMPILE="$(TARGET_CROSS)" \
80 SUBDIRS="$(PKG_BUILD_DIR)" \
81 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
82 modules
83 endef
84
85 define Package/kmod-mt76/install
86 true
87 endef
88
89 define KernelPackage/mt76x2/install
90 $(INSTALL_DIR) $(1)/lib/firmware
91 cp \
92 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
93 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
94 $(1)/lib/firmware
95 endef
96
97 define KernelPackage/mt7603/install
98 $(INSTALL_DIR) $(1)/lib/firmware
99 cp $(if $(CONFIG_TARGET_ramips_mt7628)$(CONFIG_TARGET_ramips_mt7688), \
100 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
101 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
102 ,\
103 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
104 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
105 ) \
106 $(1)/lib/firmware
107 endef
108
109 $(eval $(call KernelPackage,mt76-core))
110 $(eval $(call KernelPackage,mt76x2))
111 $(eval $(call KernelPackage,mt7603))
112 $(eval $(call KernelPackage,mt76))