1
0

Makefile 7.9 KB

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