345c038dce85ce22a6489640a7bbd36360294133
[openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_VERSION:=2015-03-11
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:=a94e01211aed8eac39331bc030fd3474357f05e0
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 wireless driver
25   DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
26   FILES:=$(PKG_BUILD_DIR)/mt76pci.ko
27   AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76pci)
28 endef
29
30 NOSTDINC_FLAGS = \
31         -I$(PKG_BUILD_DIR) \
32         -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
33         -I$(STAGING_DIR)/usr/include/mac80211-backport \
34         -I$(STAGING_DIR)/usr/include/mac80211/uapi \
35         -I$(STAGING_DIR)/usr/include/mac80211 \
36         -include backport/backport.h
37
38 define Build/Compile
39         +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
40                 ARCH="$(LINUX_KARCH)" \
41                 CROSS_COMPILE="$(TARGET_CROSS)" \
42                 SUBDIRS="$(PKG_BUILD_DIR)" \
43                 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
44                 modules
45 endef
46
47 define KernelPackage/mt76/install
48         $(INSTALL_DIR) $(1)/lib/firmware
49         $(CP) $(PKG_BUILD_DIR)/firmware/mt7662_patch_e3_hdr_v0.0.2_P48.bin $(1)/lib/firmware/mt7662_rom_patch.bin
50         $(CP) $(PKG_BUILD_DIR)/firmware/mt7662_firmware_e3_v1.5.bin $(1)/lib/firmware/mt7662.bin
51 endef
52
53 $(eval $(call KernelPackage,mt76))