Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=mt76
  3. PKG_RELEASE=1
  4. PKG_LICENSE:=GPLv2
  5. PKG_LICENSE_FILES:=
  6. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  7. PKG_SOURCE_PROTO:=git
  8. PKG_SOURCE_DATE:=2017-12-03
  9. PKG_SOURCE_VERSION:=e326bc2ac4229220203c32e856dcb47d5ee5326d
  10. PKG_MIRROR_HASH:=2342ad2f23aaa17343c7922212c5bc06637f5164a253d5053a9b75049a72f1e5
  11. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  12. PKG_BUILD_PARALLEL:=1
  13. STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  14. include $(INCLUDE_DIR)/kernel.mk
  15. include $(INCLUDE_DIR)/package.mk
  16. define KernelPackage/mt76-default
  17. SUBMENU:=Wireless Drivers
  18. DEPENDS:= \
  19. +kmod-mac80211 @PCI_SUPPORT @!LINUX_3_18 \
  20. +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
  21. endef
  22. define KernelPackage/mt76
  23. SUBMENU:=Wireless Drivers
  24. TITLE:=MediaTek MT76x2/MT7603 wireless driver (metapackage)
  25. DEPENDS:= \
  26. +kmod-mt76-core +kmod-mt76x2 +kmod-mt7603
  27. endef
  28. define KernelPackage/mt76-core
  29. $(KernelPackage/mt76-default)
  30. TITLE:=MediaTek MT76xx wireless driver
  31. FILES:=\
  32. $(PKG_BUILD_DIR)/mt76.ko
  33. AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76)
  34. endef
  35. define KernelPackage/mt76x2
  36. $(KernelPackage/mt76-default)
  37. TITLE:=MediaTek MT76x2 wireless driver
  38. DEPENDS+=+kmod-mt76-core
  39. FILES:=\
  40. $(PKG_BUILD_DIR)/mt76x2e.ko
  41. AUTOLOAD:=$(call AutoLoad,51,mt76x2e)
  42. endef
  43. define KernelPackage/mt7603
  44. $(KernelPackage/mt76-default)
  45. TITLE:=MediaTek MT7603 wireless driver
  46. DEPENDS+=+kmod-mt76-core
  47. FILES:=\
  48. $(PKG_BUILD_DIR)/mt7603e.ko
  49. AUTOLOAD:=$(call AutoLoad,51,mt7603e)
  50. endef
  51. NOSTDINC_FLAGS = \
  52. -I$(PKG_BUILD_DIR) \
  53. -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  54. -I$(STAGING_DIR)/usr/include/mac80211-backport \
  55. -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  56. -I$(STAGING_DIR)/usr/include/mac80211 \
  57. -include backport/autoconf.h \
  58. -include backport/backport.h
  59. ifdef CONFIG_PACKAGE_MAC80211_MESH
  60. NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  61. endif
  62. define Build/Compile
  63. +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  64. ARCH="$(LINUX_KARCH)" \
  65. CROSS_COMPILE="$(TARGET_CROSS)" \
  66. SUBDIRS="$(PKG_BUILD_DIR)" \
  67. NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  68. modules
  69. endef
  70. define Package/kmod-mt76/install
  71. true
  72. endef
  73. define KernelPackage/mt76x2/install
  74. $(INSTALL_DIR) $(1)/lib/firmware
  75. cp \
  76. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  77. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  78. $(1)/lib/firmware
  79. endef
  80. define KernelPackage/mt7603/install
  81. $(INSTALL_DIR) $(1)/lib/firmware
  82. cp $(if $(CONFIG_TARGET_ramips_mt7628)$(CONFIG_TARGET_ramips_mt7688), \
  83. $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  84. $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  85. ,\
  86. $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  87. $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  88. ) \
  89. $(1)/lib/firmware
  90. endef
  91. $(eval $(call KernelPackage,mt76-core))
  92. $(eval $(call KernelPackage,mt76x2))
  93. $(eval $(call KernelPackage,mt7603))
  94. $(eval $(call KernelPackage,mt76))