2
0

Makefile 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. #
  2. # Copyright (C) 2007-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=mac80211
  10. PKG_VERSION:=4.19.66-1
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.66/
  13. PKG_HASH:=1f3c6a58cb45b247f6e473d1b52236bfbb41cb3e11e38a74526727e911b51a02
  14. PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
  15. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
  16. PKG_BUILD_PARALLEL:=1
  17. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  18. PKG_DRIVERS = \
  19. adm8211 \
  20. lib80211 \
  21. mac80211-hwsim
  22. PKG_CONFIG_DEPENDS:= \
  23. CONFIG_PACKAGE_kmod-mac80211 \
  24. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  25. CONFIG_PACKAGE_MAC80211_MESH \
  26. CONFIG_PACKAGE_MAC80211_TRACING \
  27. CONFIG_PACKAGE_IWLWIFI_DEBUG \
  28. CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  29. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  30. include $(INCLUDE_DIR)/package.mk
  31. WMENU:=Wireless Drivers
  32. define KernelPackage/mac80211/Default
  33. SUBMENU:=$(WMENU)
  34. URL:=https://wireless.wiki.kernel.org/
  35. MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  36. endef
  37. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  38. config-y:= \
  39. WLAN \
  40. NL80211_TESTMODE \
  41. CFG80211_WEXT \
  42. CFG80211_CERTIFICATION_ONUS \
  43. MAC80211_RC_MINSTREL \
  44. MAC80211_RC_MINSTREL_HT \
  45. MAC80211_RC_MINSTREL_VHT \
  46. MAC80211_RC_DEFAULT_MINSTREL \
  47. WLAN_VENDOR_ADMTEK \
  48. WLAN_VENDOR_ATH \
  49. WLAN_VENDOR_ATMEL \
  50. WLAN_VENDOR_BROADCOM \
  51. WLAN_VENDOR_CISCO \
  52. WLAN_VENDOR_INTEL \
  53. WLAN_VENDOR_INTERSIL \
  54. WLAN_VENDOR_MARVELL \
  55. WLAN_VENDOR_MEDIATEK \
  56. WLAN_VENDOR_RALINK \
  57. WLAN_VENDOR_REALTEK \
  58. WLAN_VENDOR_RSI \
  59. WLAN_VENDOR_ST \
  60. WLAN_VENDOR_TI \
  61. WLAN_VENDOR_ZYDAS \
  62. config-$(call config_package,cfg80211) += CFG80211
  63. config-$(call config_package,mac80211) += MAC80211
  64. config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH
  65. include ath.mk
  66. PKG_CONFIG_DEPENDS += \
  67. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS))
  68. define KernelPackage/cfg80211
  69. $(call KernelPackage/mac80211/Default)
  70. TITLE:=cfg80211 - wireless configuration API
  71. DEPENDS+= +iw +wireless-regdb
  72. ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
  73. FILES:= \
  74. $(PKG_BUILD_DIR)/compat/compat.ko \
  75. $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
  76. endef
  77. define KernelPackage/cfg80211/description
  78. cfg80211 is the Linux wireless LAN (802.11) configuration API.
  79. endef
  80. define KernelPackage/mac80211
  81. $(call KernelPackage/mac80211/Default)
  82. TITLE:=Linux 802.11 Wireless Networking Stack
  83. # +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c
  84. DEPENDS+= +kmod-cfg80211 +hostapd-common
  85. KCONFIG:=\
  86. CONFIG_AVERAGE=y
  87. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  88. ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
  89. MENU:=1
  90. endef
  91. define KernelPackage/mac80211/config
  92. if PACKAGE_kmod-mac80211
  93. config PACKAGE_MAC80211_DEBUGFS
  94. bool "Export mac80211 internals in DebugFS"
  95. select KERNEL_DEBUG_FS
  96. default y
  97. help
  98. Select this to see extensive information about
  99. the internal state of mac80211 in debugfs.
  100. config PACKAGE_MAC80211_TRACING
  101. bool "Enable tracing (mac80211 and supported drivers)"
  102. select KERNEL_FTRACE
  103. select KERNEL_ENABLE_DEFAULT_TRACERS
  104. default n
  105. help
  106. Select this to enable tracing of mac80211 and
  107. related wifi drivers (using trace-cmd).
  108. config PACKAGE_MAC80211_MESH
  109. bool "Enable 802.11s mesh support"
  110. default y
  111. endif
  112. endef
  113. define KernelPackage/mac80211/description
  114. Generic IEEE 802.11 Networking Stack (mac80211)
  115. endef
  116. define KernelPackage/adm8211
  117. $(call KernelPackage/mac80211/Default)
  118. TITLE:=ADMTek 8211 support
  119. DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  120. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko
  121. AUTOLOAD:=$(call AutoProbe,adm8211)
  122. endef
  123. define KernelPackage/lib80211
  124. $(call KernelPackage/mac80211/Default)
  125. TITLE:=802.11 Networking stack
  126. DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  127. FILES:= \
  128. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  129. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  130. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  131. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  132. AUTOLOAD:=$(call AutoProbe, \
  133. lib80211 \
  134. lib80211_crypt_wep \
  135. lib80211_crypt_ccmp \
  136. lib80211_crypt_tkip \
  137. )
  138. endef
  139. define KernelPackage/lib80211/description
  140. Kernel modules for 802.11 Networking stack
  141. Includes:
  142. - lib80211
  143. - lib80211_crypt_wep
  144. - lib80211_crypt_tkip
  145. - lib80211_crytp_ccmp
  146. endef
  147. define KernelPackage/mac80211-hwsim
  148. $(call KernelPackage/mac80211/Default)
  149. TITLE:=mac80211 HW simulation device
  150. DEPENDS+= +kmod-mac80211 +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
  151. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  152. AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  153. endef
  154. ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  155. config-y += \
  156. CFG80211_DEBUGFS \
  157. MAC80211_DEBUGFS
  158. endif
  159. ifdef CONFIG_PACKAGE_MAC80211_TRACING
  160. config-y += \
  161. IWLWIFI_DEVICE_TRACING
  162. endif
  163. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  164. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  165. config-$(call config_package,adm8211) += ADM8211
  166. config-$(call config_package,rsi91x) += RSI_91X
  167. config-$(call config_package,rsi91x-usb) += RSI_USB
  168. config-$(call config_package,rsi91x-sdio) += RSI_SDIO
  169. config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS
  170. MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
  171. $(KERNEL_MAKE_FLAGS) \
  172. EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
  173. KLIB_BUILD="$(LINUX_DIR)" \
  174. MODPROBE=true \
  175. KLIB=$(TARGET_MODULES_DIR) \
  176. KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
  177. KBUILD_LDFLAGS_MODULE_PREREQ=
  178. define ConfigVars
  179. $(subst $(space),,$(foreach opt,$(config-$(1)),CPTCFG_$(opt)=$(1)
  180. ))
  181. endef
  182. define mac80211_config
  183. $(call ConfigVars,m)$(call ConfigVars,y)
  184. endef
  185. $(eval $(call shexport,mac80211_config))
  186. define Build/Prepare
  187. rm -rf $(PKG_BUILD_DIR)
  188. mkdir -p $(PKG_BUILD_DIR)
  189. $(PKG_UNPACK)
  190. $(Build/Patch)
  191. rm -rf \
  192. $(PKG_BUILD_DIR)/include/linux/ssb \
  193. $(PKG_BUILD_DIR)/include/linux/bcma \
  194. $(PKG_BUILD_DIR)/include/net/bluetooth
  195. rm -f \
  196. $(PKG_BUILD_DIR)/include/linux/cordic.h \
  197. $(PKG_BUILD_DIR)/include/linux/crc8.h \
  198. $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
  199. $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
  200. $(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
  201. $(PKG_BUILD_DIR)/include/net/ieee80211.h \
  202. $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
  203. echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
  204. endef
  205. ifneq ($(CONFIG_PACKAGE_kmod-cfg80211)$(CONFIG_PACKAGE_kmod-lib80211),)
  206. define Build/Compile/kmod
  207. rm -rf $(PKG_BUILD_DIR)/modules
  208. +$(MAKE) $(PKG_JOBS) $(MAKE_OPTS) modules
  209. endef
  210. endif
  211. #do not Build/Configure for EXTERNAL KERNEL
  212. ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
  213. ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
  214. define Build/Configure
  215. cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_DIR)/include/linux/ath9k_platform.h
  216. cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_DIR)/include/linux/ath5k_platform.h
  217. cmp $(PKG_BUILD_DIR)/include/linux/rt2x00_platform.h $(LINUX_DIR)/include/linux/rt2x00_platform.h
  218. endef
  219. endif
  220. endif
  221. define Build/Patch
  222. $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
  223. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
  224. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
  225. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
  226. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
  227. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
  228. $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
  229. $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
  230. endef
  231. define Quilt/Refresh/Package
  232. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
  233. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
  234. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
  235. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
  236. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
  237. $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
  238. endef
  239. define Build/Compile
  240. $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config
  241. $(MAKE) $(MAKE_OPTS) allnoconfig
  242. $(call Build/Compile/kmod)
  243. endef
  244. define Build/InstallDev
  245. mkdir -p \
  246. $(1)/usr/include/mac80211 \
  247. $(1)/usr/include/mac80211-backport \
  248. $(1)/usr/include/mac80211/ath \
  249. $(1)/usr/include/net/mac80211
  250. $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  251. $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  252. $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  253. $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  254. rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  255. endef
  256. define KernelPackage/cfg80211/install
  257. $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  258. $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  259. $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  260. $(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
  261. $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect
  262. endef
  263. $(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv))))
  264. $(eval $(call KernelPackage,cfg80211))
  265. $(eval $(call KernelPackage,mac80211))