501d956d9b6e97fe583cab287335e8abd48a56af
[openwrt/staging/dedeckeh.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-01-15
12 PKG_SOURCE_VERSION:=85d12fea1abe8654f694dc6594781f85168aa2c2
13 PKG_MIRROR_HASH:=d07c019a3f836860409c58c303195df832f5dc31168201c3fa7d23f4f5927a79
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
24 SUBMENU:=Wireless Drivers
25 TITLE:=MediaTek MT76x2/MT7603 wireless driver
26 DEPENDS:= \
27 +kmod-mac80211 @PCI_SUPPORT @!LINUX_3_18 \
28 +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
29 FILES:=\
30 $(PKG_BUILD_DIR)/mt76.ko \
31 $(PKG_BUILD_DIR)/mt76x2e.ko \
32 $(PKG_BUILD_DIR)/mt7603e.ko
33 AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
34 endef
35
36 NOSTDINC_FLAGS = \
37 -I$(PKG_BUILD_DIR) \
38 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
39 -I$(STAGING_DIR)/usr/include/mac80211-backport \
40 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
41 -I$(STAGING_DIR)/usr/include/mac80211 \
42 -include backport/autoconf.h \
43 -include backport/backport.h
44
45 ifdef CONFIG_PACKAGE_MAC80211_MESH
46 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
47 endif
48
49 define Build/Compile
50 +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
51 ARCH="$(LINUX_KARCH)" \
52 CROSS_COMPILE="$(TARGET_CROSS)" \
53 SUBDIRS="$(PKG_BUILD_DIR)" \
54 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
55 modules
56 endef
57
58 define KernelPackage/mt76/install
59 $(INSTALL_DIR) $(1)/lib/firmware
60 cp \
61 $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
62 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
63 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
64 ) \
65 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
66 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
67 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
68 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
69 $(1)/lib/firmware
70 endef
71
72 $(eval $(call KernelPackage,mt76))