Makefile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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:=2016-10-08
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  13. PKG_BACKPORT_VERSION:=
  14. PKG_MD5SUM:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb
  15. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  16. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  19. PKG_DRIVERS = \
  20. ath ath5k ath9k ath9k-common ath9k-htc \
  21. lib80211 \
  22. mac80211-hwsim \
  23. PKG_CONFIG_DEPENDS:= \
  24. CONFIG_PACKAGE_kmod-mac80211 \
  25. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  26. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  27. CONFIG_PACKAGE_MAC80211_MESH \
  28. CONFIG_PACKAGE_MAC80211_TRACING \
  29. CONFIG_PACKAGE_ATH_DEBUG \
  30. CONFIG_PACKAGE_ATH_DFS \
  31. CONFIG_ATH9K_SUPPORT_PCOEM \
  32. CONFIG_ATH9K_TX99 \
  33. CONFIG_ATH_USER_REGD \
  34. include $(INCLUDE_DIR)/package.mk
  35. WMENU:=Wireless Drivers
  36. define KernelPackage/mac80211/Default
  37. SUBMENU:=$(WMENU)
  38. URL:=https://wireless.wiki.kernel.org/
  39. MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  40. endef
  41. define KernelPackage/cfg80211
  42. $(call KernelPackage/mac80211/Default)
  43. TITLE:=cfg80211 - wireless configuration API
  44. DEPENDS+= +iw
  45. FILES:= \
  46. $(PKG_BUILD_DIR)/compat/compat.ko \
  47. $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
  48. endef
  49. define KernelPackage/cfg80211/description
  50. cfg80211 is the Linux wireless LAN (802.11) configuration API.
  51. endef
  52. define KernelPackage/mac80211
  53. $(call KernelPackage/mac80211/Default)
  54. TITLE:=Linux 802.11 Wireless Networking Stack
  55. DEPENDS+= +kmod-cfg80211 +hostapd-common
  56. KCONFIG:=\
  57. CONFIG_AVERAGE=y
  58. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  59. MENU:=1
  60. endef
  61. define KernelPackage/mac80211/config
  62. if PACKAGE_kmod-mac80211
  63. config PACKAGE_MAC80211_DEBUGFS
  64. bool "Export mac80211 internals in DebugFS"
  65. select KERNEL_DEBUG_FS
  66. default y
  67. help
  68. Select this to see extensive information about
  69. the internal state of mac80211 in debugfs.
  70. config PACKAGE_MAC80211_TRACING
  71. bool "Enable tracing (mac80211 and supported drivers)"
  72. select KERNEL_FTRACE
  73. select KERNEL_ENABLE_DEFAULT_TRACERS
  74. default n
  75. help
  76. Select this to enable tracing of mac80211 and
  77. related wifi drivers (using trace-cmd).
  78. config PACKAGE_MAC80211_MESH
  79. bool "Enable 802.11s mesh support"
  80. default y
  81. endif
  82. endef
  83. define KernelPackage/mac80211/description
  84. Generic IEEE 802.11 Networking Stack (mac80211)
  85. endef
  86. define KernelPackage/ath/config
  87. if PACKAGE_kmod-ath
  88. config ATH_USER_REGD
  89. bool "Force Atheros drivers to respect the user's regdomain settings"
  90. default y
  91. help
  92. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  93. the regulatory limits and the user is only allowed to restrict the settings
  94. even further, even if the country allows frequencies or power levels that
  95. are forbidden by the EEPROM settings.
  96. Select this option if you want the driver to respect the user's decision about
  97. regulatory settings.
  98. config PACKAGE_ATH_DEBUG
  99. bool "Atheros wireless debugging"
  100. help
  101. Say Y, if you want to debug atheros wireless drivers.
  102. Only ath9k & ath10k make use of this.
  103. config PACKAGE_ATH_DFS
  104. bool "Enable DFS support"
  105. default y
  106. help
  107. Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  108. channels in Europe, US, and Japan.
  109. Select this option if you want to use such channels.
  110. endif
  111. endef
  112. define KernelPackage/ath
  113. $(call KernelPackage/mac80211/Default)
  114. TITLE:=Atheros common driver part
  115. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  116. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  117. MENU:=1
  118. endef
  119. define KernelPackage/ath/description
  120. This module contains some common parts needed by Atheros Wireless drivers.
  121. endef
  122. define KernelPackage/ath5k
  123. $(call KernelPackage/mac80211/Default)
  124. TITLE:=Atheros 5xxx wireless cards support
  125. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  126. DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  127. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  128. AUTOLOAD:=$(call AutoProbe,ath5k)
  129. endef
  130. define KernelPackage/ath5k/description
  131. This module adds support for wireless adapters based on
  132. Atheros 5xxx chipset.
  133. endef
  134. define KernelPackage/ath9k-common
  135. $(call KernelPackage/mac80211/Default)
  136. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  137. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  138. HIDDEN:=1
  139. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  140. FILES:= \
  141. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  142. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  143. endef
  144. define KernelPackage/ath9k
  145. $(call KernelPackage/mac80211/Default)
  146. TITLE:=Atheros 802.11n PCI wireless cards support
  147. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  148. DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  149. FILES:= \
  150. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  151. AUTOLOAD:=$(call AutoProbe,ath9k)
  152. endef
  153. define KernelPackage/ath9k/description
  154. This module adds support for wireless adapters based on
  155. Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  156. endef
  157. define KernelPackage/ath9k/config
  158. config ATH9K_SUPPORT_PCOEM
  159. bool "Support chips used in PC OEM cards"
  160. depends on PACKAGE_kmod-ath9k
  161. config ATH9K_TX99
  162. bool "Enable TX99 support"
  163. depends on PACKAGE_kmod-ath9k
  164. endef
  165. define KernelPackage/ath9k-htc
  166. $(call KernelPackage/mac80211/Default)
  167. TITLE:=Atheros 802.11n USB device support
  168. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  169. DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware
  170. FILES:= \
  171. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  172. AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  173. endef
  174. define KernelPackage/ath9k-htc/description
  175. This module adds support for wireless adapters based on
  176. Atheros USB AR9271 and AR7010 family of chipsets.
  177. endef
  178. define KernelPackage/lib80211
  179. $(call KernelPackage/mac80211/Default)
  180. TITLE:=802.11 Networking stack
  181. DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  182. FILES:= \
  183. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  184. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  185. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  186. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  187. AUTOLOAD:=$(call AutoProbe, \
  188. lib80211 \
  189. lib80211_crypt_wep \
  190. lib80211_crypt_ccmp \
  191. lib80211_crypt_tkip \
  192. )
  193. endef
  194. define KernelPackage/lib80211/description
  195. Kernel modules for 802.11 Networking stack
  196. Includes:
  197. - lib80211
  198. - lib80211_crypt_wep
  199. - lib80211_crypt_tkip
  200. - lib80211_crytp_ccmp
  201. endef
  202. define KernelPackage/mac80211-hwsim
  203. $(call KernelPackage/mac80211/Default)
  204. TITLE:=mac80211 HW simulation device
  205. DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  206. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  207. AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  208. endef
  209. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  210. config-y:= \
  211. WLAN \
  212. NL80211_TESTMODE \
  213. CFG80211_WEXT \
  214. CFG80211_INTERNAL_REGDB \
  215. CFG80211_CERTIFICATION_ONUS \
  216. MAC80211_RC_MINSTREL \
  217. MAC80211_RC_MINSTREL_HT \
  218. MAC80211_RC_MINSTREL_VHT \
  219. MAC80211_RC_DEFAULT_MINSTREL \
  220. WLAN_VENDOR_ATH \
  221. config-$(call config_package,cfg80211) += CFG80211
  222. config-$(call config_package,mac80211) += MAC80211
  223. config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH
  224. ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  225. config-y += \
  226. CFG80211_DEBUGFS \
  227. MAC80211_DEBUGFS \
  228. ATH9K_DEBUGFS \
  229. ATH9K_HTC_DEBUGFS \
  230. CARL9170_DEBUGFS \
  231. ATH5K_DEBUG
  232. endif
  233. ifdef CONFIG_PACKAGE_MAC80211_TRACING
  234. config-y += \
  235. ATH10K_TRACING \
  236. ATH6KL_TRACING \
  237. ATH_TRACEPOINTS \
  238. WIL6210_TRACING \
  239. ATH5K_TRACER \
  240. IWLWIFI_DEVICE_TRACING
  241. endif
  242. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  243. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  244. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
  245. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  246. config-$(call config_package,ath9k) += ATH9K
  247. config-$(call config_package,ath9k-common) += ATH9K_COMMON
  248. config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  249. config-$(CONFIG_PCI) += ATH9K_PCI
  250. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  251. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  252. config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  253. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  254. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  255. config-$(call config_package,ath5k) += ATH5K
  256. ifdef CONFIG_TARGET_ath25
  257. config-y += ATH5K_AHB
  258. else
  259. config-y += ATH5K_PCI
  260. endif
  261. config-$(call config_package,carl9170) += CARL9170
  262. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  263. config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS
  264. MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
  265. CROSS_COMPILE="$(KERNEL_CROSS)" \
  266. ARCH="$(LINUX_KARCH)" \
  267. EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
  268. KLIB_BUILD="$(LINUX_DIR)" \
  269. MODPROBE=true \
  270. KLIB=$(TARGET_MODULES_DIR) \
  271. KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
  272. KBUILD_LDFLAGS_MODULE_PREREQ=
  273. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  274. MAKE_OPTS += V=1
  275. endif
  276. define ConfigVars
  277. $(subst $(space),,$(foreach opt,$(config-$(1)),CPTCFG_$(opt)=$(1)
  278. ))
  279. endef
  280. define mac80211_config
  281. $(call ConfigVars,m)$(call ConfigVars,y)
  282. endef
  283. $(eval $(call shexport,mac80211_config))
  284. define Build/Prepare
  285. rm -rf $(PKG_BUILD_DIR)
  286. mkdir -p $(PKG_BUILD_DIR)
  287. $(PKG_UNPACK)
  288. $(Build/Patch)
  289. rm -rf \
  290. $(PKG_BUILD_DIR)/include/linux/ssb \
  291. $(PKG_BUILD_DIR)/include/linux/bcma \
  292. $(PKG_BUILD_DIR)/include/net/bluetooth
  293. rm -f \
  294. $(PKG_BUILD_DIR)/include/linux/cordic.h \
  295. $(PKG_BUILD_DIR)/include/linux/crc8.h \
  296. $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
  297. $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
  298. $(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
  299. $(PKG_BUILD_DIR)/include/net/ieee80211.h \
  300. $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
  301. echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
  302. $(CP) ./files/regdb.txt $(PKG_BUILD_DIR)/net/wireless/db.txt
  303. endef
  304. ifneq ($(CONFIG_PACKAGE_kmod-cfg80211)$(CONFIG_PACKAGE_kmod-lib80211),)
  305. define Build/Compile/kmod
  306. rm -rf $(PKG_BUILD_DIR)/modules
  307. +$(MAKE) $(PKG_JOBS) $(MAKE_OPTS) modules
  308. endef
  309. endif
  310. define Build/Configure
  311. cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_DIR)/include/linux/ath9k_platform.h
  312. cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_DIR)/include/linux/ath5k_platform.h
  313. endef
  314. define Build/Compile
  315. $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config
  316. $(MAKE) $(MAKE_OPTS) allnoconfig
  317. $(call Build/Compile/kmod)
  318. endef
  319. define Build/InstallDev
  320. mkdir -p \
  321. $(1)/usr/include/mac80211 \
  322. $(1)/usr/include/mac80211-backport \
  323. $(1)/usr/include/mac80211/ath \
  324. $(1)/usr/include/net/mac80211
  325. $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  326. $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  327. $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  328. $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  329. rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  330. endef
  331. define KernelPackage/cfg80211/install
  332. $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  333. $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  334. $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  335. endef
  336. $(eval $(call KernelPackage,ath))
  337. $(eval $(call KernelPackage,ath5k))
  338. $(eval $(call KernelPackage,ath9k))
  339. $(eval $(call KernelPackage,ath9k-common))
  340. $(eval $(call KernelPackage,cfg80211))
  341. $(eval $(call KernelPackage,lib80211))
  342. $(eval $(call KernelPackage,mac80211))
  343. $(eval $(call KernelPackage,mac80211-hwsim))