Makefile 8.7 KB

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