add rt2860 firmware
[openwrt/openwrt.git] / package / mac80211 / Makefile
1 #
2 # Copyright (C) 2007-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: Makefile 7440 2007-06-02 02:22:01Z nbd $
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=mac80211
13 PKG_RELEASE:=1
14
15 ifneq ($(CONFIG_LINUX_2_6_27),)
16 PKG_VERSION:=2008-11-03
17 PKG_SOURCE_URL:=http://www.orbit-lab.org/kernel/compat-wireless-2.6/2008/11
18 else
19 PKG_VERSION:=2008-08-06
20 PKG_SOURCE_URL:=http://www.orbit-lab.org/kernel/compat-wireless-2.6/2008/08
21 PATCH_DIR:=./patches-old
22 endif
23
24 PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
25 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
26
27 include $(INCLUDE_DIR)/package.mk
28 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(call confvar,CONFIG_PACKAGE_kmod-mac80211)
29
30 define KernelPackage/mac80211
31 SUBMENU:=Wireless Drivers
32 TITLE:=Linux 802.11 Wireless Networking Stack
33 DEPENDS:=@LINUX_2_6 +kmod-crypto-arc4 +kmod-crypto-aes +wireless-tools @!TARGET_avr32
34 FILES:= \
35 $(PKG_BUILD_DIR)/net/mac80211/mac80211.$(LINUX_KMOD_SUFFIX) \
36 $(PKG_BUILD_DIR)/net/wireless/cfg80211.$(LINUX_KMOD_SUFFIX)
37 AUTOLOAD:=$(call AutoLoad,20,cfg80211 mac80211)
38 endef
39
40 define KernelPackage/mac80211/description
41 Linux 802.11 Wireless Networking Stack
42 endef
43
44 # Ralink rt2x00 drivers
45 RT61FW:=RT61_Firmware_V1.2.zip
46 RT71FW:=RT71W_Firmware_V1.8.zip
47 RT2860FW:=RT2860_Firmware_V11.zip
48
49 define Download/rt61
50 FILE:=$(RT61FW)
51 URL:=http://www.ralinktech.com.tw/data/
52 MD5SUM:=d4c690c93b470bc9a681297c2adc6281
53 endef
54 $(eval $(call Download,rt61))
55
56 define Download/rt71w
57 FILE:=$(RT71FW)
58 URL:=http://www.ralinktech.com.tw/data/
59 MD5SUM:=1e7a5dc574e0268574fcda3fd5cf52f7
60 endef
61 $(eval $(call Download,rt71w))
62
63 define Download/rt2860
64 FILE:=$(RT2860FW)
65 URL:=http://www.ralinktech.com.tw/data/drivers
66 MD5SUM:=440a81756a52c53528f16faa41c40124
67 endef
68 $(eval $(call Download,rt2860))
69
70 define KernelPackage/rt2x00/Default
71 SUBMENU:=Wireless Drivers
72 TITLE:=Ralink Drivers for RT2x00 cards
73 endef
74
75 define KernelPackage/rt2x00-lib
76 $(call KernelPackage/rt2x00/Default)
77 DEPENDS+= @PCI_SUPPORT||USB_SUPPORT +kmod-mac80211 +kmod-crc-itu-t
78 TITLE+= (LIB)
79 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.$(LINUX_KMOD_SUFFIX)
80 AUTOLOAD:=$(call AutoLoad,25,blkcipher ecb arc4 rt2x00lib)
81 endef
82
83 define KernelPackage/rt2x00-pci
84 $(call KernelPackage/rt2x00/Default)
85 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-lib +kmod-eeprom-93cx6
86 TITLE+= (PCI)
87 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.$(LINUX_KMOD_SUFFIX)
88 AUTOLOAD:=$(call AutoLoad,26,rt2x00pci)
89 endef
90
91 define KernelPackage/rt2x00-usb
92 $(call KernelPackage/rt2x00/Default)
93 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
94 TITLE+= (USB)
95 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.$(LINUX_KMOD_SUFFIX)
96 AUTOLOAD:=$(call AutoLoad,26,rt2x00usb)
97 endef
98
99 define KernelPackage/rt2400-pci
100 $(call KernelPackage/rt2x00/Default)
101 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
102 TITLE+= (RT2400 PCI)
103 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.$(LINUX_KMOD_SUFFIX)
104 AUTOLOAD:=$(call AutoLoad,27,rt2400pci)
105 endef
106
107 define KernelPackage/rt2500-pci
108 $(call KernelPackage/rt2x00/Default)
109 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
110 TITLE+= (RT2500 PCI)
111 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.$(LINUX_KMOD_SUFFIX)
112 AUTOLOAD:=$(call AutoLoad,27,rt2500pci)
113 endef
114
115 define KernelPackage/rt2500-usb
116 $(call KernelPackage/rt2x00/Default)
117 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
118 TITLE+= (RT2500 USB)
119 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.$(LINUX_KMOD_SUFFIX)
120 AUTOLOAD:=$(call AutoLoad,27,rt2500usb)
121 endef
122
123 define KernelPackage/rt61-pci
124 $(call KernelPackage/rt2x00/Default)
125 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
126 TITLE+= (RT2x61 PCI)
127 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.$(LINUX_KMOD_SUFFIX)
128 AUTOLOAD:=$(call AutoLoad,27,rt61pci)
129 endef
130
131 define KernelPackage/rt73-usb
132 $(call KernelPackage/rt2x00/Default)
133 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
134 TITLE+= (RT73 USB)
135 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.$(LINUX_KMOD_SUFFIX)
136 AUTOLOAD:=$(call AutoLoad,27,rt73usb)
137 endef
138
139 define KernelPackage/rt2800-pci
140 $(call KernelPackage/rt2x00/Default)
141 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci @LINUX_2_6_27
142 TITLE+= (RT2860 PCI)
143 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.$(LINUX_KMOD_SUFFIX)
144 AUTOLOAD:=$(call AutoLoad,27,rt2800pci)
145 endef
146
147 ZD1211FW_NAME:=zd1211-firmware
148 ZD1211FW_VERSION:=1.4
149 define Download/zd1211rw
150 FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
151 URL:=@SF/zd1211/
152 MD5SUM:=19f28781d76569af8551c9d11294c870
153 endef
154 $(eval $(call Download,zd1211rw))
155
156 define KernelPackage/zd1211rw
157 SUBMENU:=Wireless Drivers
158 TITLE:=Zydas ZD1211 support
159 DEPENDS:=@LINUX_2_6_24||@LINUX_2_6_25||@LINUX_2_6_26||@LINUX_2_6_27 @USB_SUPPORT +kmod-usb-core +kmod-mac80211
160 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.$(LINUX_KMOD_SUFFIX)
161 AUTOLOAD:=$(call AutoLoad,60,zd1211rw)
162 endef
163
164 define KernelPackage/ath5k
165 SUBMENU:=Wireless Drivers
166 TITLE:=Atheros 5xxx wireless cards support
167 DEPENDS+= @PCI_SUPPORT +kmod-mac80211
168 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath5k/ath5k.$(LINUX_KMOD_SUFFIX)
169 AUTOLOAD:=$(call AutoLoad,27,ath5k)
170 endef
171
172 BUILDFLAGS:= \
173 -I$(PKG_BUILD_DIR)/include \
174 $(foreach opt,$(CONFOPTS),-DCONFIG_$(opt)) \
175 $(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS) \
176 $(if $(CONFIG_DEBUG_FS), -DCONFIG_MAC80211_DEBUGFS) \
177 -D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
178
179 MAKE_OPTS:= \
180 CROSS_COMPILE="$(TARGET_CROSS)" \
181 ARCH="$(LINUX_KARCH)" \
182 EXTRA_CFLAGS="$(BUILDFLAGS)" \
183 $(foreach opt,$(CONFOPTS),CONFIG_$(opt)=m) \
184 CONFIG_NL80211=y \
185 CONFIG_MAC80211_RC_PID=y \
186 CONFIG_MAC80211_RC_MINSTREL=y \
187 CONFIG_MAC80211_LEDS=$(CONFIG_LEDS_TRIGGERS) \
188 CONFIG_MAC80211_DEBUGFS=$(CONFIG_DEBUG_FS) \
189 KLIB_BUILD="$(LINUX_DIR)" \
190 MODPROBE=:
191
192 define Build/Prepare
193 rm -rf $(PKG_BUILD_DIR)
194 mkdir -p $(PKG_BUILD_DIR)
195 $(PKG_UNPACK)
196 $(Build/Patch)
197 $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
198 unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT61FW)
199 unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT71FW)
200 -unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(RT2860FW)
201 $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
202 $(if $(CONFIG_TARGET_brcm47xx),rm -rf $(PKG_BUILD_DIR)/include/linux/ssb)
203 endef
204
205 ifneq ($(CONFIG_PACKAGE_kmod-mac80211),)
206 define Build/Compile/kmod
207 $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_OPTS) all
208 endef
209 endif
210
211 define Build/Compile
212 $(call Build/Compile/kmod)
213 endef
214
215 define Build/InstallDev
216 mkdir -p $(1)/usr/include/mac80211 $(1)/usr/include/net/mac80211
217 $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
218 $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
219 endef
220
221 define KernelPackage/mac80211/install
222 $(INSTALL_DIR) $(1)/lib/wifi
223 $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
224 endef
225
226 define KernelPackage/rt61-pci/install
227 $(INSTALL_DIR) $(1)/lib/firmware
228 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2?61*.bin $(1)/lib/firmware/
229 endef
230
231 define KernelPackage/rt73-usb/install
232 $(INSTALL_DIR) $(1)/lib/firmware
233 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/
234 endef
235
236 define KernelPackage/rt2800-pci/install
237 $(INSTALL_DIR) $(1)/lib/firmware
238 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2860.bin $(1)/lib/firmware/
239 endef
240
241 define KernelPackage/zd1211rw/install
242 $(INSTALL_DIR) $(1)/lib/firmware/zd1211
243 $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
244 endef
245
246 $(eval $(call KernelPackage,ath5k))
247 $(eval $(call KernelPackage,mac80211))
248 $(eval $(call KernelPackage,rt2x00-lib))
249 $(eval $(call KernelPackage,rt2x00-pci))
250 $(eval $(call KernelPackage,rt2x00-usb))
251 $(eval $(call KernelPackage,rt2400-pci))
252 $(eval $(call KernelPackage,rt2500-pci))
253 $(eval $(call KernelPackage,rt2500-usb))
254 $(eval $(call KernelPackage,rt61-pci))
255 $(eval $(call KernelPackage,rt73-usb))
256 $(eval $(call KernelPackage,rt2800-pci))
257 $(eval $(call KernelPackage,zd1211rw))