mt76: update to the latest version, adds stability fixes
[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-12-03
12 PKG_SOURCE_VERSION:=8e17d36381a119df346016dd2bd1c551988a583f
13 PKG_MIRROR_HASH:=3cad68b9ec2514c067cfd81ea51fe74aedce2a1b2c85a0a1b70f764726716861
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 endef
43
44 define KernelPackage/mt76x2
45 $(KernelPackage/mt76-default)
46 TITLE:=MediaTek MT76x2 wireless driver
47 DEPENDS+=+kmod-mt76-core
48 FILES:=\
49 $(PKG_BUILD_DIR)/mt76x2e.ko
50 AUTOLOAD:=$(call AutoProbe,mt76x2e)
51 endef
52
53 define KernelPackage/mt7603
54 $(KernelPackage/mt76-default)
55 TITLE:=MediaTek MT7603 wireless driver
56 DEPENDS+=+kmod-mt76-core
57 FILES:=\
58 $(PKG_BUILD_DIR)/mt7603e.ko
59 AUTOLOAD:=$(call AutoProbe,mt7603e)
60 endef
61
62 NOSTDINC_FLAGS = \
63 -I$(PKG_BUILD_DIR) \
64 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
65 -I$(STAGING_DIR)/usr/include/mac80211-backport \
66 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
67 -I$(STAGING_DIR)/usr/include/mac80211 \
68 -include backport/autoconf.h \
69 -include backport/backport.h
70
71 ifdef CONFIG_PACKAGE_MAC80211_MESH
72 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
73 endif
74
75 define Build/Compile
76 +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
77 $(KERNEL_MAKE_FLAGS) \
78 SUBDIRS="$(PKG_BUILD_DIR)" \
79 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
80 modules
81 endef
82
83 define Package/kmod-mt76/install
84 true
85 endef
86
87 define KernelPackage/mt76x2/install
88 $(INSTALL_DIR) $(1)/lib/firmware
89 cp \
90 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
91 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
92 $(1)/lib/firmware
93 endef
94
95 define KernelPackage/mt7603/install
96 $(INSTALL_DIR) $(1)/lib/firmware
97 cp $(if $(CONFIG_TARGET_ramips_mt76x8), \
98 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
99 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
100 ,\
101 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
102 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
103 ) \
104 $(1)/lib/firmware
105 endef
106
107 $(eval $(call KernelPackage,mt76-core))
108 $(eval $(call KernelPackage,mt76x2))
109 $(eval $(call KernelPackage,mt7603))
110 $(eval $(call KernelPackage,mt76))