ea07fff7a19358074a9d20c3a98b27d80313b443
[openwrt-10.03/.git] / package / mac80211 / Makefile
1 #
2 # Copyright (C) 2007-2010 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:=2011-03-24
14 PKG_RELEASE:=1
15 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
16 PKG_MD5SUM:=f5713fb3ab59bdd3d0ce931b813ef960
17
18 PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
19 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
20 PKG_BUILD_PARALLEL:=1
21
22 PKG_DRIVERS = \
23         ath5k libertas-usb libertas-sd p54-common p54-pci p54-usb p54-spi \
24         rt2x00-lib rt2x00-pci rt2x00-usb rt2x00-soc rt2800-lib rt2400-pci \
25         rt2500-pci rt2500-usb rt61-pci rt73-usb rt2800-pci rt2800-usb \
26         rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
27         ath9k-common ath9k ath9k-htc ath net-libipw net-ipw2100 net-ipw2200 \
28         mwl8k net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia
29
30 PKG_CONFIG_DEPENDS:= \
31         CONFIG_PACKAGE_kmod-mac80211 \
32         $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
33         CONFIG_PACKAGE_MAC80211_DEBUGFS \
34         CONFIG_PACKAGE_ATH_DEBUG \
35         CONFIG_ATH_USER_REGD \
36
37 CARL9170_FW_VERSION:=1.9.2
38
39 include $(INCLUDE_DIR)/package.mk
40
41 WMENU:=Wireless Drivers
42
43 define KernelPackage/mac80211/Default
44   SUBMENU:=$(WMENU)
45   URL:=http://linuxwireless.org/
46   MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
47   DEPENDS:=@(!(TARGET_avr32||TARGET_ep93xx||TARGET_ps3||TARGET_pxcab)||BROKEN) @!LINUX_2_4
48 endef
49
50 define KernelPackage/cfg80211
51   $(call KernelPackage/mac80211/Default)
52   TITLE:=cfg80211 - wireless configuration API
53   DEPENDS+= +wireless-tools +iw +crda
54 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.33)),1)
55   FILES:= \
56         $(PKG_BUILD_DIR)/compat/compat.ko \
57         $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
58   AUTOLOAD:=$(call AutoLoad,20,compat cfg80211)
59 else
60   FILES:= \
61         $(PKG_BUILD_DIR)/compat/compat.ko \
62         $(PKG_BUILD_DIR)/compat/compat_firmware_class.ko \
63         $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
64   AUTOLOAD:=$(call AutoLoad,20,compat compat_firmware_class cfg80211)
65 endif
66 endef
67
68 define KernelPackage/cfg80211/description
69 cfg80211 is the Linux wireless LAN (802.11) configuration API.
70 endef
71
72 define KernelPackage/mac80211
73   $(call KernelPackage/mac80211/Default)
74   TITLE:=Linux 802.11 Wireless Networking Stack
75   DEPENDS+= +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-cfg80211
76   KCONFIG:=\
77         CONFIG_AVERAGE=y
78   FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
79   AUTOLOAD:=$(call AutoLoad,21,mac80211)
80   MENU:=1
81 endef
82
83 define KernelPackage/mac80211/config
84         menu "Configuration"
85                 depends on PACKAGE_kmod-mac80211
86
87         config PACKAGE_MAC80211_DEBUGFS
88                 bool "Export mac80211 internals in DebugFS"
89                 default y
90                 help
91                   Select this to see extensive information about
92                   the internal state of mac80211 in debugfs.
93
94                   Say N unless you know you need this.
95
96         endmenu
97 endef
98
99 define KernelPackage/mac80211/description
100 Generic IEEE 802.11 Networking Stack (mac80211)
101 endef
102
103 # Prism54 drivers
104 P54PCIFW:=2.13.12.0.arm
105 P54USBFW:=2.13.24.0.lm87.arm
106 P54SPIFW:=2.13.0.0.a.13.14.arm
107 CARL9170_FW:=carl9170-1.fw
108
109 define Download/p54usb
110   FILE:=$(P54USBFW)
111   URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
112   MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
113 endef
114 $(eval $(call Download,p54usb))
115
116 define Download/p54pci
117   FILE:=$(P54PCIFW)
118   URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
119   MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
120 endef
121 $(eval $(call Download,p54pci))
122
123 define Download/p54spi
124   FILE:=$(P54SPIFW)
125   URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
126   MD5SUM:=42661f8ecbadd88012807493f596081d
127 endef
128 $(eval $(call Download,p54spi))
129
130 define Download/carl9170
131   FILE:=$(CARL9170_FW)-$(CARL9170_FW_VERSION)
132   URL:=http://downloads.openwrt.org/sources/
133   MD5SUM:=9e33ac39dcd610aa1ad80bbf4f1abccf
134 endef
135 $(eval $(call Download,carl9170))
136
137 define KernelPackage/p54/Default
138   $(call KernelPackage/mac80211/Default)
139   TITLE:=Prism54 Drivers
140 endef
141
142 define KernelPackage/p54/description
143   Kernel module for Prism54 chipsets (mac80211)
144 endef
145
146 define KernelPackage/p54-common
147   $(call KernelPackage/p54/Default)
148   DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-crc-ccitt
149   TITLE+= (COMMON)
150   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
151   AUTOLOAD:=$(call AutoLoad,30,p54common)
152 endef
153
154 define KernelPackage/p54-pci
155   $(call KernelPackage/p54/Default)
156   TITLE+= (PCI)
157   DEPENDS+= @PCI_SUPPORT +kmod-p54-common
158   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
159   AUTOLOAD:=$(call AutoLoad,31,p54pci)
160 endef
161
162 define KernelPackage/p54-usb
163   $(call KernelPackage/p54/Default)
164   TITLE+= (USB)
165   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
166   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
167   AUTOLOAD:=$(call AutoLoad,31,p54usb)
168 endef
169
170 define KernelPackage/p54-spi
171   $(call KernelPackage/p54/Default)
172   TITLE+= (SPI)
173   DEPENDS+= @TARGET_omap24xx +kmod-p54-common
174   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
175   AUTOLOAD:=$(call AutoLoad,31,p54spi)
176 endef
177
178 # Ralink rt2x00 drivers
179 RT61FW:=RT61_Firmware_V1.2.zip
180 RT71FW:=RT71W_Firmware_V1.8.zip
181 RT2860FW:=RT2860_Firmware_V11.zip
182 RT2870FW:=RT2870_Firmware_V8.zip
183
184 define Download/rt61
185   FILE:=$(RT61FW)
186   URL:=http://www.ralinktech.com.tw/data/
187   MD5SUM:=d4c690c93b470bc9a681297c2adc6281
188 endef
189 $(eval $(call Download,rt61))
190
191 define Download/rt71w
192   FILE:=$(RT71FW)
193   URL:=http://www.ralinktech.com.tw/data/
194   MD5SUM:=1e7a5dc574e0268574fcda3fd5cf52f7
195 endef
196 $(eval $(call Download,rt71w))
197
198 define Download/rt2860
199   FILE:=$(RT2860FW)
200   URL:=http://www.ralinktech.com.tw/data/drivers
201   MD5SUM:=440a81756a52c53528f16faa41c40124
202 endef
203 $(eval $(call Download,rt2860))
204
205 define Download/rt2870
206   FILE:=$(RT2870FW)
207   URL:=http://www.ralinktech.com.tw/data/drivers
208   MD5SUM:=a7aae1d8cfd68e4d86a73000df0b6584
209 endef
210 $(eval $(call Download,rt2870))
211
212 AR9170FW:=ar9170.fw
213
214 define Download/ar9170
215   FILE:=$(AR9170FW)
216   URL:=http://www.kernel.org/pub/linux/kernel/people/mcgrof/firmware/ar9170
217   MD5SUM:=34feec4ec0eae3bb92c7c1ea2dfb4530
218 endef
219 $(eval $(call Download,ar9170))
220
221 NEED_RT2X00_LIB_CRYPTO:=y
222 NEED_RT2X00_LIB_FIRMWARE:=y
223 NEED_RT2X00_LIB_HT:=y
224 NEED_RT2X00_LIB_LEDS:=y
225
226 define KernelPackage/rt2x00/Default
227   $(call KernelPackage/mac80211/Default)
228   TITLE:=Ralink Drivers for RT2x00 cards
229 endef
230
231 define KernelPackage/rt2x00-lib
232 $(call KernelPackage/rt2x00/Default)
233   DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-crc-itu-t
234   TITLE+= (LIB)
235   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
236   AUTOLOAD:=$(call AutoLoad,25,rt2x00lib)
237   MENU:=1
238 endef
239
240 define KernelPackage/rt2x00-lib/config
241         menu "Configuration"
242                 depends PACKAGE_kmod-rt2x00-lib
243
244         config PACKAGE_RT2X00_LIB_DEBUGFS
245                 bool "Enable rt2x00 debugfs support"
246                 depends PACKAGE_MAC80211_DEBUGFS
247                 help
248                   Enable creation of debugfs files for the rt2x00 drivers.
249                   These debugfs files support both reading and writing of the
250                   most important register types of the rt2x00 hardware.
251
252         config PACKAGE_RT2X00_DEBUG
253                 bool "Enable rt2x00 debug output"
254                 help
255                   Enable debugging output for all rt2x00 modules
256
257         endmenu
258 endef
259
260 define KernelPackage/rt2x00-pci
261 $(call KernelPackage/rt2x00/Default)
262   DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
263   TITLE+= (PCI)
264   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
265   AUTOLOAD:=$(call AutoLoad,26,rt2x00pci)
266 endef
267
268 define KernelPackage/rt2x00-usb
269 $(call KernelPackage/rt2x00/Default)
270   DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
271   TITLE+= (USB)
272   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
273   AUTOLOAD:=$(call AutoLoad,26,rt2x00usb)
274 endef
275
276 define KernelPackage/rt2x00-soc
277 $(call KernelPackage/rt2x00/Default)
278   DEPENDS+= @TARGET_ramips +kmod-rt2x00-lib
279   TITLE+= (SoC)
280   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko
281   AUTOLOAD:=$(call AutoLoad,26,rt2x00soc)
282 endef
283
284 define KernelPackage/rt2800-lib
285 $(call KernelPackage/rt2x00/Default)
286   DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +USB_SUPPORT:kmod-rt2x00-usb +TARGET_ramips:kmod-rt2x00-soc +@DRIVER_11N_SUPPORT
287   TITLE+= (rt2800 LIB)
288   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
289   AUTOLOAD:=$(call AutoLoad,27,rt2800lib)
290 endef
291
292 define KernelPackage/rt2400-pci
293 $(call KernelPackage/rt2x00/Default)
294   DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
295   TITLE+= (RT2400 PCI)
296   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
297   AUTOLOAD:=$(call AutoLoad,27,rt2400pci)
298 endef
299
300 define KernelPackage/rt2500-pci
301 $(call KernelPackage/rt2x00/Default)
302   DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
303   TITLE+= (RT2500 PCI)
304   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
305   AUTOLOAD:=$(call AutoLoad,27,rt2500pci)
306 endef
307
308 define KernelPackage/rt2500-usb
309 $(call KernelPackage/rt2x00/Default)
310   DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
311   TITLE+= (RT2500 USB)
312   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
313   AUTOLOAD:=$(call AutoLoad,27,rt2500usb)
314 endef
315
316 define KernelPackage/rt61-pci
317 $(call KernelPackage/rt2x00/Default)
318   DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
319   TITLE+= (RT2x61 PCI)
320   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
321   AUTOLOAD:=$(call AutoLoad,27,rt61pci)
322 endef
323
324 define KernelPackage/rt73-usb
325   $(call KernelPackage/rt2x00/Default)
326   DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
327   TITLE+= (RT73 USB)
328   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
329   AUTOLOAD:=$(call AutoLoad,27,rt73usb)
330 endef
331
332 define KernelPackage/rt2800-pci
333 $(call KernelPackage/rt2x00/Default)
334   DEPENDS+= +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-crc-ccitt +TARGET_ramips:kmod-rt2x00-soc
335   TITLE+= (RT2860 PCI)
336   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
337   AUTOLOAD:=$(call AutoLoad,28,rt2800pci)
338 endef
339
340 define KernelPackage/rt2800-usb
341 $(call KernelPackage/rt2x00/Default)
342   DEPENDS+= +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-crc-ccitt
343   TITLE+= (RT2870 USB)
344   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
345   AUTOLOAD:=$(call AutoLoad,28,rt2800usb)
346 endef
347
348 define KernelPackage/rtl818x/Default
349   $(call KernelPackage/mac80211/Default)
350   TITLE:=Realtek Drivers for RTL818x devices
351   URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
352   DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
353 endef
354
355 define KernelPackage/rtl8180
356   $(call KernelPackage/rtl818x/Default)
357   DEPENDS+= @PCI_SUPPORT
358   TITLE+= (RTL8180 PCI)
359   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl8180.ko
360   AUTOLOAD:=$(call AutoLoad,27,rtl8180)
361 endef
362
363 define KernelPackage/rtl8187
364 $(call KernelPackage/rtl818x/Default)
365   DEPENDS+= @USB_SUPPORT
366   TITLE+= (RTL8187 USB)
367   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
368   AUTOLOAD:=$(call AutoLoad,27,rtl8187)
369 endef
370
371 ZD1211FW_NAME:=zd1211-firmware
372 ZD1211FW_VERSION:=1.4
373 define Download/zd1211rw
374   FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
375   URL:=@SF/zd1211/
376   MD5SUM:=19f28781d76569af8551c9d11294c870
377 endef
378 $(eval $(call Download,zd1211rw))
379
380 define KernelPackage/zd1211rw
381   $(call KernelPackage/mac80211/Default)
382   TITLE:=Zydas ZD1211 support
383   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
384   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
385   AUTOLOAD:=$(call AutoLoad,60,zd1211rw)
386 endef
387
388 define KernelPackage/ath/config
389         menu "Configuration"
390                 depends on PACKAGE_kmod-ath
391
392         config ATH_USER_REGD
393                 bool "Force Atheros drivers to respect the user's regdomain settings"
394                 help
395                   Atheros' idea of regulatory handling is that the EEPROM of the card defines
396                   the regulatory limits and the user is only allowed to restrict the settings
397                   even further, even if the country allows frequencies or power levels that
398                   are forbidden by the EEPROM settings.
399
400                   Select this option if you want the driver to respect the user's decision about
401                   regulatory settings.
402
403         config PACKAGE_ATH_DEBUG
404                 bool "Atheros wireless debugging"
405                 help
406                   Say Y, if you want to debug atheros wireless drivers.
407                   Right now only ath9k makes use of this.
408
409         endmenu
410 endef
411
412 define KernelPackage/ath
413   $(call KernelPackage/mac80211/Default)
414   TITLE:=Atheros common driver part
415   DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT +kmod-mac80211
416   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
417   AUTOLOAD:=$(call AutoLoad,26,ath)
418   MENU:=1
419 endef
420
421 define KernelPackage/ath/description
422  This module contains some common parts needed by Atheros Wireless drivers.
423 endef
424
425 define KernelPackage/ath5k
426   $(call KernelPackage/mac80211/Default)
427   TITLE:=Atheros 5xxx wireless cards support
428   URL:=http://linuxwireless.org/en/users/Drivers/ath5k
429   DEPENDS+= @PCI_SUPPORT||@TARGET_atheros +kmod-ath
430   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
431   AUTOLOAD:=$(call AutoLoad,27,ath5k)
432 endef
433
434 define KernelPackage/ath5k/description
435  This module adds support for wireless adapters based on
436  Atheros 5xxx chipset.
437 endef
438
439 define KernelPackage/ath9k-common
440   $(call KernelPackage/mac80211/Default)
441   TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
442   URL:=http://linuxwireless.org/en/users/Drivers/ath9k
443   DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
444   FILES:= \
445         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
446         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
447   AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k_common)
448 endef
449
450 define KernelPackage/ath9k
451   $(call KernelPackage/mac80211/Default)
452   TITLE:=Atheros 802.11n PCI wireless cards support
453   URL:=http://linuxwireless.org/en/users/Drivers/ath9k
454   DEPENDS+= @PCI_SUPPORT +kmod-ath9k-common
455   FILES:= \
456         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
457   AUTOLOAD:=$(call AutoLoad,28,ath9k)
458 endef
459
460 define KernelPackage/ath9k/description
461 This module adds support for wireless adapters based on
462 Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
463 endef
464
465 AR7010FW:=ar7010.fw
466 AR7010_1_1_FW:=ar7010_1_1.fw
467 AR9271FW:=ar9271.fw
468
469 define Download/ar9271
470   FILE:=$(AR9271FW)
471   URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar9271.fw;h=d0ee74a1c8dccb7cc21f5be90f1d4048fa9dbf9e;hb=HEAD;?
472   MD5SUM:=2e6f5045ec4c5a42bb93ced242bad0ba
473 endef
474 $(eval $(call Download,ar9271))
475
476 define Download/ar7010
477   FILE:=$(AR7010FW)
478   URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar7010.fw;h=840005d0f0c81838c581b8cd5d76c8dd3843731c;hb=HEAD;?
479   MD5SUM:=59823b82b1f72bed9b044e8cc78ad65c
480 endef
481 $(eval $(call Download,ar7010))
482
483 define Download/ar7010_1_1
484   FILE:=$(AR7010_1_1_FW)
485   URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar7010_1_1.fw;h=684d4cd1a8cac4f58305589e31f9d856d03a8ef0;hb=HEAD;?
486   MD5SUM:=544fcbe5a93cfa53c7e6d3ded2b05347
487 endef
488 $(eval $(call Download,ar7010_1_1))
489
490 define KernelPackage/ath9k-htc
491   $(call KernelPackage/mac80211/Default)
492   TITLE:=Atheros 802.11n USB device support
493   URL:=http://linuxwireless.org/en/users/Drivers/ath9k
494   DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
495   FILES:= \
496         $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
497   AUTOLOAD:=$(call AutoLoad,28,ath9k_htc)
498 endef
499
500 define KernelPackage/ath9k-htc/description
501 This module adds support for wireless adapters based on
502 Atheros USB AR9271 and AR7010 family of chipsets.
503 endef
504
505 define KernelPackage/carl9170
506   $(call KernelPackage/mac80211/Default)
507   TITLE:=Driver for Atheros AR9170 USB sticks
508   DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +@DRIVER_11N_SUPPORT
509   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
510   AUTOLOAD:=$(call AutoLoad,60,carl9170)
511 endef
512
513 define KernelPackage/carl9170/install
514         $(INSTALL_DIR) $(1)/lib/firmware
515         $(INSTALL_DATA) $(DL_DIR)/$(CARL9170_FW)-$(CARL9170_FW_VERSION) $(1)/lib/firmware/$(CARL9170_FW)
516 endef
517
518
519 USB8388FW_NAME:=usb8388
520 USB8388FW_VERSION:=5.110.22.p23
521
522 define Download/usb8388
523   URL:=http://dev.laptop.org/pub/firmware/libertas/
524   FILE:=$(USB8388FW_NAME)-$(USB8388FW_VERSION).bin
525   MD5SUM=5e38f55719df3d0c58dd3bd02575a09c
526 endef
527 $(eval $(call Download,usb8388))
528
529 SD8686FW_NAME:=sd8686
530 SD8686FW_VERSION:=9.70.7.p0
531
532 define Download/sd8686
533   URL:=http://dev.laptop.org/pub/firmware/libertas/
534   FILE:=$(SD8686FW_NAME)-$(SD8686FW_VERSION).bin
535   MD5SUM=b4f8be61e19780a14836f146c538c5dd
536 endef
537 $(eval $(call Download,sd8686))
538
539 SD8686HELPER_NAME:=sd8686_helper
540
541 define Download/sd8686_helper
542   URL:=http://dev.laptop.org/pub/firmware/libertas/
543   FILE:=$(SD8686HELPER_NAME).bin
544   MD5SUM=2a4d8f4df198ce949c350df5674f4ac6
545 endef
546 $(eval $(call Download,sd8686_helper))
547
548 define KernelPackage/libertas-usb
549   $(call KernelPackage/mac80211/Default)
550   DEPENDS+= @USB_SUPPORT +kmod-mac80211 +kmod-usb-core +kmod-lib80211
551   TITLE:=Marvell 88W8015 Wireless Driver
552   FILES:= \
553         $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
554         $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
555   AUTOLOAD:=$(call AutoLoad,27,libertas usb8xxx)
556 endef
557
558 define KernelPackage/libertas-sd
559   $(call KernelPackage/mac80211/Default)
560   DEPENDS+= +kmod-mac80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
561   TITLE:=Marvell 88W8686 Wireless Driver
562   FILES:= \
563         $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
564         $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
565   AUTOLOAD:=$(call AutoLoad,27,libertas libertas_sdio)
566 endef
567
568 define KernelPackage/mac80211-hwsim
569   $(call KernelPackage/mac80211/Default)
570   TITLE:=mac80211 HW simulation device
571   DEPENDS+= +kmod-mac80211
572   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
573   AUTOLOAD:=$(call AutoLoad,60,mac80211_hwsim)
574 endef
575
576 define KernelPackage/net-libipw
577   $(call KernelPackage/mac80211/Default)
578   TITLE:=libipw for ipw2100 and ipw2200
579   DEPENDS:=@PCI_SUPPORT +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211
580   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
581   AUTOLOAD:=$(call AutoLoad,49,libipw)
582 endef
583
584 define KernelPackage/net-libipw/description
585  Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
586 endef
587
588 IPW2100_NAME:=ipw2100-fw
589 IPW2100_VERSION:=1.3
590
591 define Download/net-ipw2100
592   URL:=http://bughost.org/firmware/
593   FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
594   MD5SUM=46aa75bcda1a00efa841f9707bbbd113
595 endef
596 $(eval $(call Download,net-ipw2100))
597
598 define KernelPackage/net-ipw2100
599   $(call KernelPackage/mac80211/Default)
600   TITLE:=Intel IPW2100 driver
601   DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
602   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
603   AUTOLOAD:=$(call AutoLoad,50,ipw2100)
604 endef
605
606 define KernelPackage/net-ipw2100/description
607  Kernel support for Intel IPW2100
608  Includes:
609  - ipw2100
610 endef
611
612 IPW2200_NAME:=ipw2200-fw
613 IPW2200_VERSION:=3.1
614
615 define Download/net-ipw2200
616   URL:=http://bughost.org/firmware/
617   FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
618   MD5SUM=eaba788643c7cc7483dd67ace70f6e99
619 endef
620 $(eval $(call Download,net-ipw2200))
621
622 define KernelPackage/net-ipw2200
623   $(call KernelPackage/mac80211/Default)
624   TITLE:=Intel IPW2200 driver
625   DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
626   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
627   AUTOLOAD:=$(call AutoLoad,50,ipw2200)
628 endef
629
630 define KernelPackage/net-ipw2200/description
631  Kernel support for Intel IPW2200
632  Includes:
633  - ipw2200
634 endef
635
636
637 define KernelPackage/net-hermes
638   $(call KernelPackage/mac80211/Default)
639   TITLE:=Hermes 802.11b chipset support
640   DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
641   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
642   AUTOLOAD:=$(call AutoLoad,50,orinoco)
643 endef
644
645 define KernelPackage/net-hermes/description
646  Kernel support for Hermes 802.11b chipsets
647 endef
648
649 define KernelPackage/net-hermes-pci
650   $(call KernelPackage/mac80211/Default)
651   TITLE:=Intersil Prism 2.5 PCI support
652   DEPENDS:=@PCI_SUPPORT +kmod-net-hermes +kmod-cfg80211
653   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
654   AUTOLOAD:=$(call AutoLoad,55,orinoco_pci)
655 endef
656
657 define KernelPackage/net-hermes-pci/description
658  Kernel modules for Intersil Prism 2.5 PCI support
659 endef
660
661 define KernelPackage/net-hermes-plx
662   $(call KernelPackage/mac80211/Default)
663   TITLE:=PLX9052 based PCI adaptor
664   DEPENDS:=@PCI_SUPPORT +kmod-net-hermes +kmod-cfg80211
665   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
666   AUTOLOAD:=$(call AutoLoad,55,orinoco_plx)
667 endef
668
669 define KernelPackage/net-hermes-plx/description
670  Kernel modules for Hermes in PLX9052 based PCI adaptors
671 endef
672
673 define KernelPackage/net-hermes-pcmcia
674   $(call KernelPackage/mac80211/Default)
675   TITLE:=Hermes based PCMCIA adaptors
676   DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes +kmod-cfg80211 @BROKEN
677   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
678   AUTOLOAD:=$(call AutoLoad,55,orinoco_cs)
679 endef
680
681 define KernelPackage/net-hermes-pcmcia/description
682  Kernel modules for Hermes based PCMCIA adaptors
683 endef
684
685
686 define KernelPackage/mwl8k
687   $(call KernelPackage/mac80211/Default)
688   TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
689   URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
690   DEPENDS+= @PCI_SUPPORT +kmod-mac80211
691   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
692   AUTOLOAD:=$(call AutoLoad,27,mwl8k)
693 endef
694
695 define KernelPackage/mwl8k/description
696  Kernel modules for Marvell TOPDOG 802.11 Wireless cards
697 endef
698
699 #Broadcom firmware
700 ifneq ($(CONFIG_B43_EXPERIMENTAL),)
701   PKG_B43_FWV4_NAME:=broadcom-wl
702   PKG_B43_FWV4_VERSION:=4.178.10.4
703   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
704   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
705   PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
706   PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
707 else
708   PKG_B43_FWV4_NAME:=broadcom-wl
709   PKG_B43_FWV4_VERSION:=4.150.10.5
710   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
711   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
712   PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
713   PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
714 endif
715 ifneq ($(CONFIG_B43_OPENFIRMWARE),)
716   PKG_B43_FWV4_NAME:=broadcom-wl
717   PKG_B43_FWV4_VERSION:=5.2
718   PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
719   PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
720   PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
721   PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
722 endif
723
724
725 PKG_B43_FWV3_NAME:=wl_apsta
726 PKG_B43_FWV3_VERSION:=3.130.20.0
727 PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
728 PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
729 PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
730
731 ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
732   PKG_B43_FWCUTTER_NAME:=b43-fwcutter
733   PKG_B43_FWCUTTER_VERSION:=3e69531aa65b8f664a0ab00dfc3e2eefeb0cb417
734   PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2
735   PKG_B43_FWCUTTER_PROTO:=git
736   PKG_B43_FWCUTTER_SOURCE_URL:=http://git.bu3sch.de/git/b43-tools.git
737   PKG_B43_FWCUTTER_SUBDIR:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)
738   PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/fwcutter/
739 else
740   PKG_B43_FWCUTTER_NAME:=b43-fwcutter
741   PKG_B43_FWCUTTER_VERSION:=013
742   PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2
743   PKG_B43_FWCUTTER_PROTO:=default
744   PKG_B43_FWCUTTER_SOURCE_URL:=http://bu3sch.de/b43/fwcutter/
745   PKG_B43_FWCUTTER_MD5SUM:=3547ec6c474ac1bc2c4a5bb765b791a4
746   PKG_B43_FWCUTTER_SUBDIR:=b43-fwcutter-$(PKG_B43_FWCUTTER_VERSION)
747   PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/
748 endif
749
750 define Download/b43-common
751   FILE:=$(PKG_B43_FWCUTTER_SOURCE)
752   URL:=$(PKG_B43_FWCUTTER_SOURCE_URL)
753   MD5SUM:=$(PKG_B43_FWCUTTER_MD5SUM)
754   PROTO:=$(PKG_B43_FWCUTTER_PROTO)
755   VERSION:=$(PKG_B43_FWCUTTER_VERSION)
756   SUBDIR:=$(PKG_B43_FWCUTTER_SUBDIR)
757 endef
758 $(eval $(call Download,b43-common))
759
760 define Download/b43
761   FILE:=$(PKG_B43_FWV4_SOURCE)
762   URL:=$(PKG_B43_FWV4_SOURCE_URL)
763   MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
764 endef
765 $(eval $(call Download,b43))
766
767 define Download/b43legacy
768   FILE:=$(PKG_B43_FWV3_SOURCE)
769   URL:=$(PKG_B43_FWV3_SOURCE_URL)
770   MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
771 endef
772 $(eval $(call Download,b43legacy))
773
774 define KernelPackage/b43-common
775   $(call KernelPackage/mac80211/Default)
776   TITLE:=Generic stuff for Broadcom wireless devices
777   URL:=http://linuxwireless.org/en/users/Drivers/b43
778   KCONFIG:= \
779         CONFIG_HW_RANDOM=y
780   DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
781 endef
782
783 define KernelPackage/b43
784 $(call KernelPackage/b43-common)
785   TITLE:=Broadcom 43xx wireless support
786   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
787   AUTOLOAD:=$(call AutoLoad,30,b43)
788   MENU:=1
789 endef
790
791 define KernelPackage/b43/config
792         menu "Configuration"
793                 depends on PACKAGE_kmod-b43
794
795         choice
796                 prompt "b43 firmware version"
797                 default B43_STABLE
798                 help
799                   This option allows you to select the version of the b43 firmware.
800
801         config B43_STABLE
802                 bool "4.150.10.5 (stable)"
803                 help
804                   Stable firmware for BCM43xx devices.
805
806                   If unsure, select this.
807
808         config B43_EXPERIMENTAL
809                 bool "4.178.10.4 (experimental)"
810                 help
811                   Experimental firmware for BCM43xx devices.
812
813                   This firmware is not tested as much as the "stable" firmware.
814
815                   If unsure, select the "stable" firmware.
816
817         config B43_OPENFIRMWARE
818                 bool "Open FirmWare for WiFi networks"
819                 help
820                   Opensource firmware for BCM43xx devices.
821
822                   Do _not_ select this, unless you know what you are doing.
823                   The Opensource firmware is not suitable for embedded devices, yet.
824                   It does not support QoS, which is bad for AccessPoints.
825                   It does not support hardware crypto acceleration, which is a showstopper
826                   for embedded devices with low CPU resources.
827
828                   If unsure, select the "stable" firmware.
829
830         endchoice
831
832         config B43_FW_SQUASH
833                 bool "Remove unnecessary firmware files"
834                 depends on !B43_OPENFIRMWARE
835                 default y
836                 help
837                   This options allows you to remove unnecessary b43 firmware files
838                   from the final rootfs image. This can reduce the rootfs size by
839                   up to 200k.
840
841                   If unsure, say Y.
842
843         config B43_FW_SQUASH_COREREVS
844                 string "Core revisions to include"
845                 depends on B43_FW_SQUASH
846                 default "5,6,7,8,9,10,13,14,15"
847                 help
848                   This is a comma seperated list of core revision numbers.
849
850                   Example (keep files for rev5 only):
851                     5
852
853                   Example (keep files for rev5 and rev11):
854                     5,11
855
856         config B43_FW_SQUASH_PHYTYPES
857                 string "PHY types to include"
858                 depends on B43_FW_SQUASH
859                 default "G,LP"
860                 help
861                   This is a comma seperated list of PHY types:
862                     A  => A-PHY
863                     AG => Dual A-PHY G-PHY
864                     G  => G-PHY
865                     LP => LP-PHY
866                     N  => N-PHY
867
868                   Example (keep files for G-PHY only):
869                     G
870
871                   Example (keep files for G-PHY and N-PHY):
872                     G,N
873
874         endmenu
875 endef
876
877 define KernelPackage/b43/description
878 Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
879 endef
880
881 define KernelPackage/b43legacy
882 $(call KernelPackage/b43-common)
883   TITLE:=Broadcom 43xx-legacy wireless support
884   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
885   AUTOLOAD:=$(call AutoLoad,30,b43legacy)
886   MENU:=1
887 endef
888
889 define KernelPackage/b43legacy/config
890         menu "Configuration"
891                 depends on PACKAGE_kmod-b43legacy
892
893         config B43LEGACY_FW_SQUASH
894                 bool "Remove unnecessary firmware files"
895                 default y
896                 help
897                   This options allows you to remove unnecessary b43legacy firmware files
898                   from the final rootfs image. This can reduce the rootfs size by
899                   up to 50k.
900
901                   If unsure, say Y.
902
903         config B43LEGACY_FW_SQUASH_COREREVS
904                 string "Core revisions to include"
905                 depends on B43LEGACY_FW_SQUASH
906                 default "1,2,3,4"
907                 help
908                   This is a comma seperated list of core revision numbers.
909
910                   Example (keep files for rev4 only):
911                     4
912
913                   Example (keep files for rev2 and rev4):
914                     2,4
915
916         endmenu
917 endef
918
919 define KernelPackage/b43legacy/description
920 Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
921 endef
922
923 BUILDFLAGS:= \
924         -I$(PKG_BUILD_DIR)/include \
925         $(foreach opt,$(CONFOPTS),-DCONFIG_$(opt)) \
926         $(if $(CONFIG_PCI),-DCONFIG_B43_PCI_AUTOSELECT -DCONFIG_B43_PCICORE_AUTOSELECT) \
927         $(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS -DCONFIG_AR9170_LEDS) \
928         -DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG \
929         $(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS -DCONFIG_ATH9K_DEBUGFS -DCONFIG_CARL9170_DEBUGFS) \
930         $(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG -DCONFIG_ATH9K_PKTLOG -DCONFIG_ATH5K_DEBUG) \
931         -D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
932         -DCONFIG_MAC80211_RC_MINSTREL_HT \
933         $(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) \
934         $(if $(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS),-DCONFIG_RT2X00_LIB_DEBUGFS) \
935         $(if $(CONFIG_PACKAGE_RT2X00_DEBUG),-DCONFIG_RT2X00_DEBUG) \
936         $(if $(NEED_RT2X00_LIB_HT),-DCONFIG_RT2X00_LIB_HT) \
937         $(if $(NEED_RT2X00_LIB_CRYPTO),-DCONFIG_RT2X00_LIB_CRYPTO) \
938         $(if $(NEED_RT2X00_LIB_FIRMWARE),-DCONFIG_RT2X00_LIB_FIRMWARE) \
939         $(if $(NEED_RT2X00_LIB_LEDS),-DCONFIG_RT2X00_LIB_LEDS) \
940         $(if $(CONFIG_PACKAGE_kmod-rt2x00-pci),-DCONFIG_RT2X00_LIB_PCI) \
941         $(if $(CONFIG_PACKAGE_kmod-rt2x00-usb),-DCONFIG_RT2X00_LIB_USB) \
942         $(if $(CONFIG_PACKAGE_kmod-rt2x00-soc),-DCONFIG_RT2X00_LIB_SOC) \
943         $(if $(CONFIG_TARGET_atheros),-DCONFIG_ATH5K_AHB,-DCONFIG_ATH5K_PCI)
944
945 MAKE_OPTS:= \
946         CROSS_COMPILE="$(KERNEL_CROSS)" \
947         ARCH="$(LINUX_KARCH)" \
948         EXTRA_CFLAGS="$(BUILDFLAGS)" \
949         $(foreach opt,$(CONFOPTS),CONFIG_$(opt)=m) \
950         CONFIG_MAC80211=$(if $(CONFIG_PACKAGE_kmod-mac80211),m) \
951         CONFIG_MAC80211_RC_MINSTREL=y \
952         CONFIG_MAC80211_LEDS=$(CONFIG_LEDS_TRIGGERS) \
953         CONFIG_MAC80211_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \
954         CONFIG_B43_PCMCIA=n CONFIG_B43_PIO=n \
955         CONFIG_B43_PCI_AUTOSELECT=$(if $(CONFIG_PCI),y) \
956         CONFIG_B43_PCICORE_AUTOSELECT=$(if $(CONFIG_PCI),y) \
957         CONFIG_B43LEGACY_LEDS=$(CONFIG_LEDS_TRIGGERS) \
958         CONFIG_B43_LEDS=$(CONFIG_LEDS_TRIGGERS) \
959         CONFIG_B43_HWRNG=$(if $(CONFIG_HW_RANDOM),y) \
960         CONFIG_B43LEGACY_HWRNG=$(if $(CONFIG_HW_RANDOM),y) \
961         CONFIG_B43=$(if $(CONFIG_PACKAGE_kmod-b43),m) \
962         CONFIG_B43LEGACY=$(if $(CONFIG_PACKAGE_kmod-b43legacy),m) \
963         CONFIG_ATH_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath),m) \
964         CONFIG_ATH_DEBUG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \
965         CONFIG_ATH5K_DEBUG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \
966         CONFIG_ATH9K_PKTLOG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \
967         CONFIG_ATH5K=$(if $(CONFIG_PACKAGE_kmod-ath5k),m) \
968         CONFIG_ATH5K_PCI=$(if $(CONFIG_TARGET_atheros),,y) \
969         CONFIG_ATH5K_AHB=$(if $(CONFIG_TARGET_atheros),y) \
970         CONFIG_ATH9K=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \
971         CONFIG_ATH9K_HTC=$(if $(CONFIG_PACKAGE_kmod-ath9k-htc),m) \
972         CONFIG_ATH9K_HW=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \
973         CONFIG_ATH9K_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \
974         CONFIG_ATH9K_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \
975         CONFIG_CARL9170=$(if $(CONFIG_PACKAGE_kmod-carl9170),m) \
976         CONFIG_CARL9170_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \
977         CONFIG_COMPAT_ZD1211RW=$(if $(CONFIG_PACKAGE_kmod-zd1211rw),m) \
978         CONFIG_P54_COMMON=$(if $(CONFIG_PACKAGE_kmod-p54-common),m) \
979         CONFIG_P54_PCI=$(if $(CONFIG_PACKAGE_kmod-p54-pci),m) \
980         CONFIG_P54_USB=$(if $(CONFIG_PACKAGE_kmod-p54-usb),m) \
981         CONFIG_P54_SPI=$(if $(CONFIG_PACKAGE_kmod-p54-spi),m) \
982         CONFIG_P54_SPI_DEFAULT_EEPROM=n \
983         CONFIG_RT2X00=$(if $(CONFIG_PACKAGE_kmod-rt2x00-lib),m) \
984         CONFIG_RT2X00_LIB=$(if $(CONFIG_PACKAGE_kmod-rt2x00-lib),m) \
985         CONFIG_RT2X00_LIB_PCI=$(if $(CONFIG_PACKAGE_kmod-rt2x00-pci),m) \
986         CONFIG_RT2X00_LIB_USB=$(if $(CONFIG_PACKAGE_kmod-rt2x00-usb),m) \
987         CONFIG_RT2X00_LIB_SOC=$(if $(CONFIG_PACKAGE_kmod-rt2x00-soc),m) \
988         CONFIG_RT2X00_LIB_DEBUGFS=$(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS) \
989         CONFIG_RT2X00_LIB_CRYPTO=$(NEED_RT2X00_LIB_CRYPTO) \
990         CONFIG_RT2X00_LIB_FIRMWARE=$(NEED_RT2X00_LIB_FIRMWARE) \
991         CONFIG_RT2X00_LIB_HT=$(NEED_RT2X00_LIB_HT) \
992         CONFIG_RT2X00_LIB_LEDS=$(NEED_RT2X00_LIB_LEDS) \
993         CONFIG_RT2400PCI=$(if $(CONFIG_PACKAGE_kmod-rt2400-pci),m) \
994         CONFIG_RT2500PCI=$(if $(CONFIG_PACKAGE_kmod-rt2500-pci),m) \
995         CONFIG_RT2500USB=$(if $(CONFIG_PACKAGE_kmod-rt2500-usb),m) \
996         CONFIG_RT61PCI=$(if $(CONFIG_PACKAGE_kmod-rt61-pci),m) \
997         CONFIG_RT73USB=$(if $(CONFIG_PACKAGE_kmod-rt73-usb),m) \
998         CONFIG_RT2800_LIB=$(if $(CONFIG_PACKAGE_kmod-rt2800-lib),m) \
999         CONFIG_RT2800PCI=$(if $(CONFIG_PACKAGE_kmod-rt2800-pci),m) \
1000         CONFIG_RT2800USB=$(if $(CONFIG_PACKAGE_kmod-rt2800-usb),m) \
1001         CONFIG_RTL8180=$(if $(CONFIG_PACKAGE_kmod-rtl8180),m) \
1002         CONFIG_RTL8187=$(if $(CONFIG_PACKAGE_kmod-rtl8187),m) \
1003         CONFIG_RTL8192CE= \
1004         CONFIG_RTLWIFI= \
1005         CONFIG_MAC80211_HWSIM=$(if $(CONFIG_PACKAGE_kmod-mac80211-hwsim),m) \
1006         CONFIG_PCMCIA= \
1007         CONFIG_LIBIPW=$(if $(CONFIG_PACKAGE_kmod-net-libipw),m) \
1008         CONFIG_LIBERTAS=$(if $(CONFIG_PACKAGE_kmod-libertas-sd)$(CONFIG_PACKAGE_kmod-libertas-usb),m) \
1009         CONFIG_LIBERTAS_CS= \
1010         CONFIG_LIBERTAS_SPI= \
1011         CONFIG_LIBERTAS_SDIO=$(if $(CONFIG_PACKAGE_kmod-libertas-sd),m) \
1012         CONFIG_LIBERTAS_THINFIRM= \
1013         CONFIG_LIBERTAS_USB=$(if $(CONFIG_PACKAGE_kmod-libertas-usb),m) \
1014         CONFIG_IPW2100=$(if $(CONFIG_PACKAGE_kmod-net-ipw2100),m) \
1015         CONFIG_IPW2200=$(if $(CONFIG_PACKAGE_kmod-net-ipw2200),m) \
1016         CONFIG_NL80211=y \
1017         CONFIG_LIB80211= \
1018         CONFIG_LIB80211_CRYPT_WEP= \
1019         CONFIG_LIB80211_CRYPT_CCMP= \
1020         CONFIG_LIB80211_CRYPT_TKIP= \
1021         CONFIG_COMPAT_IWLWIFI= \
1022         CONFIG_IWLWIFI_LEGACY= \
1023         CONFIG_IWLAGN= \
1024         CONFIG_MWL8K=$(if $(CONFIG_PACKAGE_kmod-mwl8k),m) \
1025         CONFIG_ATMEL= \
1026         CONFIG_PCMCIA_ATMEL= \
1027         CONFIG_ADM8211= \
1028         CONFIG_USB_NET_RNDIS_HOST= \
1029         CONFIG_USB_NET_RNDIS_WLAN= \
1030         CONFIG_USB_NET_CDCETHER= \
1031         CONFIG_USB_USBNET= \
1032         CONFIG_AT76C50X_USB= \
1033         CONFIG_WL12XX= \
1034         CONFIG_EEPROM_93CX6= \
1035         CONFIG_HERMES=$(if $(CONFIG_PACKAGE_kmod-net-hermes),m) \
1036         CONFIG_HERMES_CACHE_FW_ON_INIT= \
1037         CONFIG_PCI_HERMES=$(if $(CONFIG_PACKAGE_kmod-net-hermes-pci),m) \
1038         CONFIG_PLX_HERMES=$(if $(CONFIG_PACKAGE_kmod-net-hermes-plx),m) \
1039         CONFIG_PCMCIA_HERMES=$(if $(CONFIG_PACKAGE_kmod-net-hermes-pcmcia),m) \
1040         CONFIG_HERMES_PRISM= \
1041         CONFIG_APPLE_AIRPORT= \
1042         CONFIG_TMD_HERMES= \
1043         CONFIG_NORTEL_HERMES= \
1044         CONFIG_PCMCIA_SPECTRUM= \
1045         CONFIG_ORINOCO_USB= \
1046         CONFIG_AR9170_USB=$(if $(CONFIG_PACKAGE_kmod-ar9170),m) \
1047         CONFIG_AR9170_LEDS=$(CONFIG_LEDS_TRIGGERS) \
1048         CONFIG_IWM= \
1049         CONFIG_MAC80211_RC_MINSTREL_HT=y \
1050         MADWIFI= \
1051         OLD_IWL= \
1052         KLIB_BUILD="$(LINUX_DIR)" \
1053         MODPROBE=: \
1054         KLIB=$(TARGET_MODULES_DIR) \
1055         KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
1056         KBUILD_LDFLAGS_MODULE_PREREQ=
1057
1058 ifeq ($(CONFIG_PACKAGE_kmod-libertas-sd)$(CONFIG_PACKAGE_kmod-libertas-usb)$(CONFIG_PACKAGE_kmod-rt2x00-lib),)
1059   MAKE_OPTS += CONFIG_COMPAT_KFIFO=
1060 endif
1061
1062 define Build/Prepare
1063         rm -rf $(PKG_BUILD_DIR)
1064         mkdir -p $(PKG_BUILD_DIR)
1065         $(PKG_UNPACK)
1066         $(Build/Patch)
1067         unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT61FW)
1068         unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT71FW)
1069         -unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT2860FW)
1070         -unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT2870FW)
1071         $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
1072         $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
1073         $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
1074         rm -rf $(PKG_BUILD_DIR)/include/linux/ssb
1075         rm -f $(PKG_BUILD_DIR)/include/net/ieee80211.h
1076         rm $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h
1077 endef
1078
1079 ifneq ($(CONFIG_PACKAGE_kmod-cfg80211),)
1080  define Build/Compile/kmod
1081         rm -rf $(PKG_BUILD_DIR)/modules
1082         $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" $(MAKE_OPTS) all
1083  endef
1084 endif
1085
1086 define Build/Compile
1087         $(call Build/Compile/kmod)
1088 endef
1089
1090 define Build/InstallDev
1091         mkdir -p \
1092                 $(1)/usr/include/mac80211 \
1093                 $(1)/usr/include/mac80211/ath \
1094                 $(1)/usr/include/net/mac80211
1095         $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
1096         $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
1097         $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
1098 endef
1099
1100 define KernelPackage/libertas-usb/install
1101         $(INSTALL_DIR) $(1)/lib/firmware
1102         $(INSTALL_DATA) $(DL_DIR)/$(USB8388FW_NAME)-$(USB8388FW_VERSION).bin $(1)/lib/firmware/$(USB8388FW_NAME).bin
1103 endef
1104
1105 define KernelPackage/libertas-sd/install
1106         echo "Libertas install: $(CONFIG_PACKAGE_kmod-libertas-sd)"
1107         $(INSTALL_DIR) $(1)/lib/firmware
1108         $(INSTALL_DATA) $(DL_DIR)/$(SD8686FW_NAME)-$(SD8686FW_VERSION).bin $(1)/lib/firmware/$(SD8686FW_NAME).bin
1109         $(INSTALL_DATA) $(DL_DIR)/$(SD8686HELPER_NAME).bin $(1)/lib/firmware/$(SD8686HELPER_NAME).bin
1110 endef
1111
1112 define KernelPackage/cfg80211/install
1113         $(INSTALL_DIR) $(1)/lib/wifi
1114         $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
1115 endef
1116
1117 define KernelPackage/p54-pci/install
1118         $(INSTALL_DIR) $(1)/lib/firmware
1119         $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
1120 endef
1121
1122 define KernelPackage/p54-usb/install
1123         $(INSTALL_DIR) $(1)/lib/firmware
1124         $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
1125 endef
1126
1127 define KernelPackage/p54-spi/install
1128         $(INSTALL_DIR) $(1)/lib/firmware
1129         $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
1130 endef
1131
1132 define KernelPackage/rt61-pci/install
1133         $(INSTALL_DIR) $(1)/lib/firmware
1134         $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2?61*.bin $(1)/lib/firmware/
1135 endef
1136
1137 define KernelPackage/rt73-usb/install
1138         $(INSTALL_DIR) $(1)/lib/firmware
1139         $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/
1140 endef
1141
1142 define KernelPackage/rt2800-pci/install
1143         $(INSTALL_DIR) $(1)/lib/firmware
1144         $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2860.bin $(1)/lib/firmware/
1145 endef
1146
1147 define KernelPackage/rt2800-usb/install
1148         $(INSTALL_DIR) $(1)/lib/firmware
1149         $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2870.bin $(1)/lib/firmware/
1150 endef
1151
1152 define KernelPackage/zd1211rw/install
1153         $(INSTALL_DIR) $(1)/lib/firmware/zd1211
1154         $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
1155 endef
1156
1157 define KernelPackage/ar9170/install
1158         $(INSTALL_DIR) $(1)/lib/firmware
1159         $(INSTALL_DATA) $(DL_DIR)/$(AR9170FW) $(1)/lib/firmware/
1160 endef
1161
1162 define KernelPackage/ath9k-htc/install
1163         $(INSTALL_DIR) $(1)/lib/firmware
1164         $(INSTALL_DATA) \
1165                 $(DL_DIR)/$(AR9271FW) \
1166                 $(DL_DIR)/$(AR7010FW) \
1167                 $(DL_DIR)/$(AR7010_1_1_FW) \
1168                 $(1)/lib/firmware/
1169 endef
1170
1171 define KernelPackage/net-ipw2100/install
1172         $(INSTALL_DIR) $(1)/lib/firmware
1173         $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
1174 endef
1175
1176 define KernelPackage/net-ipw2200/install
1177         $(INSTALL_DIR) $(1)/lib/firmware
1178         $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
1179 endef
1180
1181 define Build/b43-common
1182         tar xjf "$(DL_DIR)/$(PKG_B43_FWCUTTER_SOURCE)" -C "$(PKG_BUILD_DIR)"
1183         $(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)" \
1184                 CFLAGS="-I$(STAGING_DIR_HOST)/include -include endian.h" \
1185                 QUIET_SPARSE=:
1186         $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)/b43-fwcutter $(STAGING_DIR_HOST)/bin/
1187 ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
1188         $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
1189         $(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/"
1190         $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/b43-asm $(STAGING_DIR_HOST)/bin/
1191         $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/b43-asm.bin $(STAGING_DIR_HOST)/bin/
1192 endif
1193         $(INSTALL_BIN) ./files/host_bin/b43-fwsquash.py $(STAGING_DIR_HOST)/bin/
1194 endef
1195
1196 define KernelPackage/b43/install
1197         rm -rf $(1)/lib/firmware/
1198         $(call Build/b43-common)
1199 ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
1200         tar xzf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)"
1201 else
1202         tar xjf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)"
1203 endif
1204         $(INSTALL_DIR) $(1)/lib/firmware/
1205 ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
1206         $(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/"
1207         $(INSTALL_DIR) $(1)/lib/firmware/b43-open/
1208         $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/ucode5.fw $(1)/lib/firmware/b43-open/ucode5.fw
1209         $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0bsinitvals5.fw $(1)/lib/firmware/b43-open/b0g0bsinitvals5.fw
1210         $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0initvals5.fw $(1)/lib/firmware/b43-open/b0g0initvals5.fw
1211 else
1212         b43-fwcutter -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)
1213 endif
1214 ifneq ($(CONFIG_B43_FW_SQUASH),)
1215         b43-fwsquash.py "$(CONFIG_B43_FW_SQUASH_PHYTYPES)" "$(CONFIG_B43_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43"
1216 endif
1217 endef
1218
1219 define KernelPackage/b43legacy/install
1220         $(call Build/b43-common)
1221         $(INSTALL_DIR) $(1)/lib/firmware/
1222
1223         b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_B43_FWV3_SOURCE)
1224 ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),)
1225         b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy"
1226 endif
1227 endef
1228
1229 $(eval $(call KernelPackage,ath5k))
1230 $(eval $(call KernelPackage,libertas-usb))
1231 $(eval $(call KernelPackage,libertas-sd))
1232 $(eval $(call KernelPackage,cfg80211))
1233 $(eval $(call KernelPackage,mac80211))
1234 $(eval $(call KernelPackage,p54-common))
1235 $(eval $(call KernelPackage,p54-pci))
1236 $(eval $(call KernelPackage,p54-usb))
1237 $(eval $(call KernelPackage,p54-spi))
1238 $(eval $(call KernelPackage,rt2x00-lib))
1239 $(eval $(call KernelPackage,rt2x00-pci))
1240 $(eval $(call KernelPackage,rt2x00-usb))
1241 $(eval $(call KernelPackage,rt2x00-soc))
1242 $(eval $(call KernelPackage,rt2800-lib))
1243 $(eval $(call KernelPackage,rt2400-pci))
1244 $(eval $(call KernelPackage,rt2500-pci))
1245 $(eval $(call KernelPackage,rt2500-usb))
1246 $(eval $(call KernelPackage,rt61-pci))
1247 $(eval $(call KernelPackage,rt73-usb))
1248 $(eval $(call KernelPackage,rt2800-pci))
1249 $(eval $(call KernelPackage,rt2800-usb))
1250 $(eval $(call KernelPackage,rtl8180))
1251 $(eval $(call KernelPackage,rtl8187))
1252 $(eval $(call KernelPackage,zd1211rw))
1253 $(eval $(call KernelPackage,mac80211-hwsim))
1254 $(eval $(call KernelPackage,ath9k-common))
1255 $(eval $(call KernelPackage,ath9k))
1256 $(eval $(call KernelPackage,ath9k-htc))
1257 $(eval $(call KernelPackage,ath))
1258 $(eval $(call KernelPackage,carl9170))
1259 $(eval $(call KernelPackage,b43))
1260 $(eval $(call KernelPackage,b43legacy))
1261 $(eval $(call KernelPackage,net-libipw))
1262 $(eval $(call KernelPackage,net-ipw2100))
1263 $(eval $(call KernelPackage,net-ipw2200))
1264 $(eval $(call KernelPackage,mwl8k))
1265 $(eval $(call KernelPackage,net-hermes))
1266 $(eval $(call KernelPackage,net-hermes-pci))
1267 $(eval $(call KernelPackage,net-hermes-plx))
1268 $(eval $(call KernelPackage,net-hermes-pcmcia))