1
0

Makefile 8.3 KB

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