mt76: update to the latest version, adds basic mt7628 support
[oweals/openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_VERSION:=2016-03-02
5 PKG_RELEASE=1
6
7 PKG_LICENSE:=GPLv2
8 PKG_LICENSE_FILES:=
9
10 PKG_SOURCE_URL:=https://github.com/openwrt/mt76
11 PKG_SOURCE_PROTO:=git
12 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
13 PKG_SOURCE_VERSION:=c190f15d6f4a112e795ac50391e8adc50a80fe91
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
15
16 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
17 PKG_BUILD_PARALLEL:=1
18
19 include $(INCLUDE_DIR)/kernel.mk
20 include $(INCLUDE_DIR)/package.mk
21
22 define KernelPackage/mt76
23   SUBMENU:=Wireless Drivers
24   TITLE:=MediaTek MT76x2/MT7603 wireless driver
25   DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
26   FILES:=\
27         $(PKG_BUILD_DIR)/mt76.ko \
28         $(PKG_BUILD_DIR)/mt76x2e.ko \
29         $(PKG_BUILD_DIR)/mt7603e.ko
30   AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
31 endef
32
33 NOSTDINC_FLAGS = \
34         -I$(PKG_BUILD_DIR) \
35         -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
36         -I$(STAGING_DIR)/usr/include/mac80211-backport \
37         -I$(STAGING_DIR)/usr/include/mac80211/uapi \
38         -I$(STAGING_DIR)/usr/include/mac80211 \
39         -include backport/autoconf.h \
40         -include backport/backport.h
41
42 ifdef CONFIG_PACKAGE_MAC80211_MESH
43   NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
44 endif
45
46 define Build/Compile
47         +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
48                 ARCH="$(LINUX_KARCH)" \
49                 CROSS_COMPILE="$(TARGET_CROSS)" \
50                 SUBDIRS="$(PKG_BUILD_DIR)" \
51                 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
52                 modules
53 endef
54
55 define KernelPackage/mt76/install
56         $(INSTALL_DIR) $(1)/lib/firmware
57         cp \
58                 $(if $(CONFIG_TARGET_ramips_mt7628), \
59                         $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
60                         $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
61                 ) \
62                 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
63                 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
64                 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
65                 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
66                 $(1)/lib/firmware
67 endef
68
69 $(eval $(call KernelPackage,mt76))