mt76: split kmod package
[openwrt/openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_RELEASE=2
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-02-03
12 PKG_SOURCE_VERSION:=a5eaeb27d6a80c012ffc8b5bb5549983e446b4ef
13 PKG_MIRROR_HASH:=c526586aba890c5645320145219bd5932e39cfc2ea540d7674c9a58ab9a4a36a
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 KernelPackage/mt76x2/install
86 $(INSTALL_DIR) $(1)/lib/firmware
87 cp \
88 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
89 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
90 $(1)/lib/firmware
91 endef
92
93 define KernelPackage/mt7603/install
94 $(INSTALL_DIR) $(1)/lib/firmware
95 cp $(if $(CONFIG_TARGET_ramips_mt7628)$(CONFIG_TARGET_ramips_mt7688), \
96 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
97 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
98 ,\
99 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
100 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
101 ) \
102 $(1)/lib/firmware
103 endef
104
105 $(eval $(call KernelPackage,mt76-core))
106 $(eval $(call KernelPackage,mt76x2))
107 $(eval $(call KernelPackage,mt7603))
108 $(eval $(call KernelPackage,mt76))