Fresh pull from upstream
[librecmc/librecmc.git] / package / kernel / mac80211 / Makefile
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
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=mac80211
12
13 PKG_VERSION:=2016-10-08
14 PKG_RELEASE:=1
15 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
16 PKG_BACKPORT_VERSION:=
17 PKG_HASH:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb
18
19 PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
20 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
21 PKG_BUILD_PARALLEL:=1
22
23 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
24
25 PKG_DRIVERS = \
26         ath ath5k ath9k ath9k-common ath9k-htc \
27         carl9170 \
28         lib80211 \
29         mac80211-hwsim \
30         rt2800-lib rt2800-mmio rt2800-soc \
31
32 PKG_CONFIG_DEPENDS:= \
33         CONFIG_PACKAGE_kmod-mac80211 \
34         $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
35         CONFIG_PACKAGE_MAC80211_DEBUGFS \
36         CONFIG_PACKAGE_MAC80211_MESH \
37         CONFIG_PACKAGE_MAC80211_TRACING \
38         CONFIG_PACKAGE_ATH_DEBUG \
39         CONFIG_PACKAGE_ATH_DFS \
40         CONFIG_ATH_USER_REGD \
41
42 include $(INCLUDE_DIR)/package.mk
43
44 WMENU:=Wireless Drivers
45
46 define KernelPackage/mac80211/Default
47   SUBMENU:=$(WMENU)
48   URL:=https://wireless.wiki.kernel.org/
49   MAINTAINER:=Felix Fietkau <nbd@nbd.name>
50 endef
51
52 define KernelPackage/cfg80211
53   $(call KernelPackage/mac80211/Default)
54   TITLE:=cfg80211 - wireless configuration API
55   DEPENDS+= +iw
56   FILES:= \
57         $(PKG_BUILD_DIR)/compat/compat.ko \
58         $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
59 endef
60
61 define KernelPackage/cfg80211/description
62 cfg80211 is the Linux wireless LAN (802.11) configuration API.
63 endef
64
65 define KernelPackage/mac80211
66   $(call KernelPackage/mac80211/Default)
67   TITLE:=Linux 802.11 Wireless Networking Stack
68   DEPENDS+= +kmod-cfg80211 +hostapd-common
69   KCONFIG:=\
70         CONFIG_AVERAGE=y
71   FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
72   MENU:=1
73 endef
74
75 define KernelPackage/mac80211/config
76   if PACKAGE_kmod-mac80211
77
78         config PACKAGE_MAC80211_DEBUGFS
79                 bool "Export mac80211 internals in DebugFS"
80                 select KERNEL_DEBUG_FS
81                 default y
82                 help
83                   Select this to see extensive information about
84                   the internal state of mac80211 in debugfs.
85
86         config PACKAGE_MAC80211_TRACING
87                 bool "Enable tracing (mac80211 and supported drivers)"
88                 select KERNEL_FTRACE
89                 select KERNEL_ENABLE_DEFAULT_TRACERS
90                 default n
91                 help
92                   Select this to enable tracing of mac80211 and
93                   related wifi drivers (using trace-cmd).
94
95         config PACKAGE_MAC80211_MESH
96                 bool "Enable 802.11s mesh support"
97                 default y
98
99   endif
100 endef
101
102 define KernelPackage/mac80211/description
103 Generic IEEE 802.11 Networking Stack (mac80211)
104 endef
105
106 define KernelPackage/adm8211
107   $(call KernelPackage/mac80211/Default)
108   TITLE:=ADMTek 8211 support
109   DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
110   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko
111   AUTOLOAD:=$(call AutoProbe,adm8211)
112 endef
113
114 define KernelPackage/airo
115   $(call KernelPackage/mac80211/Default)
116   TITLE:=Cisco Aironet driver
117   DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
118   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
119   AUTOLOAD:=$(call AutoProbe,airo)
120 endef
121
122 define KernelPackage/airo/description
123  Kernel support for Cisco Aironet cards
124 endef
125
126 define KernelPackage/ath/config
127   if PACKAGE_kmod-ath
128         config ATH_USER_REGD
129                 bool "Force Atheros drivers to respect the user's regdomain settings"
130                 default y
131                 help
132                   Atheros' idea of regulatory handling is that the EEPROM of the card defines
133                   the regulatory limits and the user is only allowed to restrict the settings
134                   even further, even if the country allows frequencies or power levels that
135                   are forbidden by the EEPROM settings.
136
137                   Select this option if you want the driver to respect the user's decision about
138                   regulatory settings.
139
140         config PACKAGE_ATH_DEBUG
141                 bool "Atheros wireless debugging"
142                 help
143                   Say Y, if you want to debug atheros wireless drivers.
144                   Only ath9k makes use of this.
145
146         config PACKAGE_ATH_DFS
147                 bool "Enable DFS support"
148                 default y
149                 help
150                   Dynamic frequency selection (DFS) is required for most of the 5 GHz band
151                   channels in Europe, US, and Japan.
152
153                   Select this option if you want to use such channels.
154
155   endif
156 endef
157
158 define KernelPackage/ath
159   $(call KernelPackage/mac80211/Default)
160   TITLE:=Atheros common driver part
161   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
162   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
163   MENU:=1
164 endef
165
166 define KernelPackage/ath/description
167  This module contains some common parts needed by Atheros Wireless drivers.
168 endef
169
170 define KernelPackage/ath5k
171   $(call KernelPackage/mac80211/Default)
172   TITLE:=Atheros 5xxx wireless cards support
173   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
174   DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath +@DRIVER_11W_SUPPORT
175   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
176   AUTOLOAD:=$(call AutoProbe,ath5k)
177 endef
178
179 define KernelPackage/ath5k/description
180  This module adds support for wireless adapters based on
181  Atheros 5xxx chipset.
182 endef
183
184 define KernelPackage/ath9k-common
185   $(call KernelPackage/mac80211/Default)
186   TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
187   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
188   HIDDEN:=1
189   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
190   FILES:= \
191         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
192         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
193 endef
194
195 define KernelPackage/ath9k
196   $(call KernelPackage/mac80211/Default)
197   TITLE:=Atheros 802.11n PCI wireless cards support
198   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
199   DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
200   FILES:= \
201         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
202   AUTOLOAD:=$(call AutoProbe,ath9k)
203 endef
204
205 define KernelPackage/ath9k/description
206 This module adds support for wireless adapters based on
207 Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
208 endef
209
210 define KernelPackage/ath9k/config
211
212         config ATH9K_SUPPORT_PCOEM
213                 bool "Support chips used in PC OEM cards"
214                 depends on PACKAGE_kmod-ath9k
215
216        config ATH9K_TX99
217                bool "Enable TX99 support"
218                depends on PACKAGE_kmod-ath9k
219
220         config ATH9K_UBNTHSR
221                 bool "Support for Ubiquiti UniFi Outdoor+ access point"
222                 depends on PACKAGE_kmod-ath9k && TARGET_ar71xx_generic
223                 default y
224
225 endef
226
227 define KernelPackage/ath9k-htc
228   $(call KernelPackage/mac80211/Default)
229   TITLE:=Atheros 802.11n USB device support
230   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
231   DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware
232   FILES:= \
233         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
234   AUTOLOAD:=$(call AutoProbe,ath9k_htc)
235 endef
236
237 define KernelPackage/ath9k-htc/description
238 This module adds support for wireless adapters based on
239 Atheros USB AR9271 and AR7010 family of chipsets.
240 endef
241
242 define KernelPackage/carl9170
243   $(call KernelPackage/mac80211/Default)
244   TITLE:=Driver for Atheros AR9170 USB sticks
245   DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware
246   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
247   AUTOLOAD:=$(call AutoProbe,carl9170)
248 endef
249
250
251 define KernelPackage/lib80211
252   $(call KernelPackage/mac80211/Default)
253   TITLE:=802.11 Networking stack
254   DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
255   FILES:= \
256         $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
257         $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
258         $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
259         $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
260   AUTOLOAD:=$(call AutoProbe, \
261         lib80211 \
262         lib80211_crypt_wep \
263         lib80211_crypt_ccmp \
264         lib80211_crypt_tkip \
265   )
266 endef
267
268 define KernelPackage/lib80211/description
269  Kernel modules for 802.11 Networking stack
270  Includes:
271  - lib80211
272  - lib80211_crypt_wep
273  - lib80211_crypt_tkip
274  - lib80211_crytp_ccmp
275 endef
276
277 define KernelPackage/mac80211-hwsim
278   $(call KernelPackage/mac80211/Default)
279   TITLE:=mac80211 HW simulation device
280   DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
281   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
282   AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
283 endef
284
285 define KernelPackage/rt2800-lib
286 $(call KernelPackage/rt2x00/Default)
287   DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
288   HIDDEN:=1
289   TITLE+= (rt2800 LIB)
290   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko
291 endef
292
293 define KernelPackage/rt2800-mmio
294 $(call KernelPackage/rt2x00/Default)
295   TITLE += (RT28xx/RT3xxx MMIO)
296   DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
297   HIDDEN:=1
298   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko
299 endef
300
301 define KernelPackage/rt2800-soc
302 $(call KernelPackage/rt2x00/Default)
303   DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
304   TITLE += (RT28xx/RT3xxx SoC)
305   FILES := \
306         $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \
307         $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko
308   AUTOLOAD:=$(call AutoProbe,rt2800soc)
309 endef
310
311 config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
312
313 config-y:= \
314         WLAN \
315         NL80211_TESTMODE \
316         CFG80211_WEXT \
317         CFG80211_INTERNAL_REGDB \
318         CFG80211_CERTIFICATION_ONUS \
319         MAC80211_RC_MINSTREL \
320         MAC80211_RC_MINSTREL_HT \
321         MAC80211_RC_MINSTREL_VHT \
322         MAC80211_RC_DEFAULT_MINSTREL \
323         WLAN_VENDOR_ADMTEK \
324         WLAN_VENDOR_ATH \
325         WLAN_VENDOR_ATMEL \
326         WLAN_VENDOR_INTEL \
327         WLAN_VENDOR_INTERSIL \
328         WLAN_VENDOR_MARVELL \
329         WLAN_VENDOR_MEDIATEK \
330         WLAN_VENDOR_RALINK \
331         WLAN_VENDOR_REALTEK \
332         WLAN_VENDOR_RSI \
333         WLAN_VENDOR_ST \
334         WLAN_VENDOR_TI \
335         WLAN_VENDOR_ZYDAS \
336
337 config-$(call config_package,cfg80211) += CFG80211
338
339 config-$(call config_package,mac80211) += MAC80211
340 config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH
341 ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
342   config-y += \
343         CFG80211_DEBUGFS \
344         MAC80211_DEBUGFS \
345         ATH9K_DEBUGFS \
346         ATH9K_HTC_DEBUGFS \
347         CARL9170_DEBUGFS \
348         ATH5K_DEBUG
349 endif
350
351 ifdef CONFIG_PACKAGE_MAC80211_TRACING
352   config-y += \
353         ATH6KL_TRACING \
354         ATH_TRACEPOINTS \
355         WIL6210_TRACING \
356         ATH5K_TRACER \
357         IWLWIFI_DEVICE_TRACING
358 endif
359
360 config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
361
362 config-$(call config_package,airo) += AIRO
363
364 config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
365 config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH9K_STATION_STATISTICS
366 config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED
367
368 config-$(call config_package,ath9k) += ATH9K
369 config-$(call config_package,ath9k-common) += ATH9K_COMMON
370 config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
371 config-$(CONFIG_PCI) += ATH9K_PCI
372 config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
373 config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
374 config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
375 config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR
376
377 config-$(call config_package,ath9k-htc) += ATH9K_HTC
378
379 config-$(call config_package,ath5k) += ATH5K
380 ifdef CONFIG_TARGET_ath25
381   config-y += ATH5K_AHB
382 else
383   config-y += ATH5K_PCI
384 endif
385
386 config-$(call config_package,carl9170) += CARL9170
387
388 config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
389
390 config-$(call config_package,rt2800-lib) += RT2800_LIB
391
392 config-$(call config_package,rt2800-soc) += RT2800SOC
393
394 config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS
395
396 MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
397         CROSS_COMPILE="$(KERNEL_CROSS)" \
398         ARCH="$(LINUX_KARCH)" \
399         EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
400         KLIB_BUILD="$(LINUX_DIR)" \
401         MODPROBE=true \
402         KLIB=$(TARGET_MODULES_DIR) \
403         KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
404         KBUILD_LDFLAGS_MODULE_PREREQ=
405
406 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
407   MAKE_OPTS += V=1
408 endif
409
410 define ConfigVars
411 $(subst $(space),,$(foreach opt,$(config-$(1)),CPTCFG_$(opt)=$(1)
412 ))
413 endef
414
415 define mac80211_config
416 $(call ConfigVars,m)$(call ConfigVars,y)
417 endef
418 $(eval $(call shexport,mac80211_config))
419
420 define Build/Prepare
421         rm -rf $(PKG_BUILD_DIR)
422         mkdir -p $(PKG_BUILD_DIR)
423         $(PKG_UNPACK)
424         $(Build/Patch)
425         rm -rf \
426                 $(PKG_BUILD_DIR)/include/linux/ssb \
427                 $(PKG_BUILD_DIR)/include/linux/bcma \
428                 $(PKG_BUILD_DIR)/include/net/bluetooth
429
430         rm -f \
431                 $(PKG_BUILD_DIR)/include/linux/cordic.h \
432                 $(PKG_BUILD_DIR)/include/linux/crc8.h \
433                 $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
434                 $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
435                 $(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
436                 $(PKG_BUILD_DIR)/include/net/ieee80211.h \
437                 $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
438
439         echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
440         $(CP) ./files/regdb.txt $(PKG_BUILD_DIR)/net/wireless/db.txt
441 endef
442
443 ifneq ($(CONFIG_PACKAGE_kmod-cfg80211)$(CONFIG_PACKAGE_kmod-lib80211),)
444  define Build/Compile/kmod
445         rm -rf $(PKG_BUILD_DIR)/modules
446         +$(MAKE) $(PKG_JOBS) $(MAKE_OPTS) modules
447  endef
448 endif
449
450 define Build/Configure
451         cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_DIR)/include/linux/ath9k_platform.h
452         cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_DIR)/include/linux/ath5k_platform.h
453 endef
454
455 define Build/Compile
456         $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config
457         $(MAKE) $(MAKE_OPTS) allnoconfig
458         $(call Build/Compile/kmod)
459 endef
460
461 define Build/InstallDev
462         mkdir -p \
463                 $(1)/usr/include/mac80211 \
464                 $(1)/usr/include/mac80211-backport \
465                 $(1)/usr/include/mac80211/ath \
466                 $(1)/usr/include/net/mac80211
467         $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
468         $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
469         $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
470         $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
471         rm -f $(1)/usr/include/mac80211-backport/linux/module.h
472 endef
473
474
475 define KernelPackage/cfg80211/install
476         $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
477         $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
478         $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
479         $(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
480         $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/00-wifi-detect
481 endef
482
483
484 $(eval $(call KernelPackage,ath))
485 $(eval $(call KernelPackage,ath5k))
486 $(eval $(call KernelPackage,ath9k))
487 $(eval $(call KernelPackage,ath9k-common))
488 $(eval $(call KernelPackage,ath9k-htc))
489 $(eval $(call KernelPackage,carl9170))
490 $(eval $(call KernelPackage,cfg80211))
491 $(eval $(call KernelPackage,lib80211))
492 $(eval $(call KernelPackage,mac80211))
493 $(eval $(call KernelPackage,mac80211-hwsim))
494 $(eval $(call KernelPackage,rt2800-lib))
495 $(eval $(call KernelPackage,rt2800-mmio))
496 $(eval $(call KernelPackage,rt2800-soc))