madwifi: fix a wds related race condition
[openwrt.git] / package / madwifi / Makefile
1 #
2 # Copyright (C) 2006-2009 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:=madwifi
12
13 PKG_REV:=3314
14 PKG_VERSION:=r$(PKG_REV)
15 PKG_RELEASE:=3
16
17 PKG_SOURCE_PROTO:=svn
18 PKG_SOURCE_VERSION:=$(PKG_REV)
19 PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
20 PKG_SOURCE_URL:=http://madwifi-project.org/svn/madwifi/$(if $(PKG_BRANCH),branches/$(PKG_BRANCH),trunk)
21 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
22
23 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
24
25 HAL_VERSION:=20090508
26 HAL_FILE:=ath_hal-$(HAL_VERSION).tgz
27 HAL_MD5SUM:=4ab7ae8bdb96c0be388c98bf8f92d5ca
28
29 PKG_BUILD_DEPENDS:=wprobe
30
31 include $(INCLUDE_DIR)/package.mk
32
33 ifdef CONFIG_MADWIFI_COMPRESSION
34 COMPRESSION:=1
35 else
36 COMPRESSION:=0
37 endif
38
39 define Download/hal
40 FILE:=$(HAL_FILE)
41 URL:=http://mirror2.openwrt.org/sources
42 MD5SUM:=$(HAL_MD5SUM)
43 endef
44 $(eval $(call Download,hal))
45
46
47 ifneq ($(CONFIG_TARGET_atheros),)
48 BUS:=AHB
49 else
50 ifneq ($(CONFIG_PCI_SUPPORT),)
51 BUS:=PCI
52 endif
53 endif
54
55 ifneq ($(CONFIG_CPU_MIPS32_R2),)
56 ifeq ($(ARCH),mips)
57 HAL_TARGET:=mips32r2-be-elf
58 endif
59 ifeq ($(ARCH),mipsel)
60 HAL_TARGET:=mips32r2-le-elf
61 endif
62 else
63 ifeq ($(ARCH),mips)
64 HAL_TARGET:=mips32-be-elf
65 endif
66 ifeq ($(ARCH),mipsel)
67 HAL_TARGET:=mips32-le-elf
68 endif
69 endif
70 ifeq ($(ARCH),i386)
71 HAL_TARGET:=i386-elf
72 endif
73 ifeq ($(ARCH),i686)
74 HAL_TARGET:=i386-elf
75 endif
76 ifeq ($(BOARD),ixp4xx)
77 HAL_TARGET:=xscale-be-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
78 endif
79 ifeq ($(BOARD),iop32x)
80 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
81 endif
82 ifeq ($(BOARD),orion)
83 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
84 endif
85 ifeq ($(ARCH),powerpc)
86 HAL_TARGET:=powerpc-be-elf
87 endif
88 ifeq ($(BOARD),gemini)
89 HAL_TARGET:=armv4-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
90 endif
91 ifneq ($(CONFIG_TARGET_atheros),)
92 HAL_TARGET:=wisoc
93 endif
94
95 ifdef CONFIG_MADWIFI_RCA_MINSTREL
96 RATE_CONTROL:=minstrel
97 endif
98
99 ifdef CONFIG_MADWIFI_RCA_ONOE
100 RATE_CONTROL:=onoe
101 endif
102
103 ifdef CONFIG_MADWIFI_RCA_AMRR
104 RATE_CONTROL:=amrr
105 endif
106
107 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
108 RATE_CONTROL:=sample
109 endif
110
111 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
112 MADWIFI_FILES:= $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX)
113 else
114 MADWIFI_FILES:= \
115 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
116 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
117 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
118 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
119 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
120 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
121 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
122 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
123 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
124 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX)
125 endif
126
127 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
128 MADWIFI_AUTOLOAD:= ath_hal
129 else
130 MADWIFI_AUTOLOAD:= \
131 wlan \
132 wlan_scan_ap \
133 wlan_scan_sta \
134 ath_hal \
135 ath_rate_$(RATE_CONTROL) \
136 wlan_acl \
137 wlan_ccmp \
138 wlan_tkip \
139 wlan_wep \
140 wlan_xauth
141 endif
142
143 ifeq ($(findstring AHB,$(BUS)),AHB)
144 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
145 MADWIFI_AUTOLOAD+= ath_ahb
146 endif
147 ifeq ($(findstring PCI,$(BUS)),PCI)
148 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
149 MADWIFI_AUTOLOAD+= ath_pci
150 endif
151
152 MADWIFI_APPLETS:=80211stats athchans athkey athstats wlanconfig ath_info madwifi_multi
153 ifdef CONFIG_MADWIFI_DEBUG
154 MADWIFI_APPLETS += athdebug 80211debug
155 endif
156
157 define KernelPackage/madwifi
158 SUBMENU:=Wireless Drivers
159 TITLE:=Driver for Atheros wireless chipsets
160 URL:=http://madwifi-project.org/
161 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_avr32 @!TARGET_etrax @LINUX_2_6
162 FILES:=$(MADWIFI_FILES)
163 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
164 endef
165
166 define KernelPackage/madwifi/description
167 This package contains a driver for Atheros 802.11a/b/g chipsets.
168 endef
169
170 define KernelPackage/madwifi/config
171 source "$(SOURCE)/Config.in"
172 endef
173
174 MADWIFI_INC = \
175 -I$(PKG_BUILD_DIR) \
176 -I$(PKG_BUILD_DIR)/include \
177 -I$(PKG_BUILD_DIR)/hal \
178 -I$(PKG_BUILD_DIR)/ath \
179 -I$(PKG_BUILD_DIR)/ath_hal \
180 -I$(PKG_BUILD_DIR)/net80211 \
181 -I$(STAGING_DIR)/usr/include/wprobe \
182 -include $(PKG_BUILD_DIR)/include/compat.h
183
184 MAKE_ARGS:= \
185 PATH="$(TARGET_PATH)" \
186 ARCH="$(LINUX_KARCH)" \
187 ARCH-y="$(LINUX_KARCH)" \
188 CROSS_COMPILE="$(TARGET_CROSS)" \
189 TARGET="$(HAL_TARGET)" \
190 TOOLPREFIX="$(KERNEL_CROSS)" \
191 TOOLPATH="$(KERNEL_CROSS)" \
192 KERNELPATH="$(LINUX_DIR)" \
193 LDOPTS="--no-warn-mismatch " \
194 ATH_RATE="$(RATE_CONTROL)" \
195 ATH_CAP_SUPERG_COMP="$(COMPRESSION)" \
196 DO_MULTI=1 \
197 SINGLE_MODULE=$(if $(CONFIG_MADWIFI_SINGLE_MODULE),1) \
198 INCS="$(MADWIFI_INC)" \
199 $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
200
201 MAKE_VARS:= \
202 COPTS="-DATH_REVERSE_ENGINEERING=1" \
203
204 define Build/Prepare/HAL
205 rm -rf $(PKG_BUILD_DIR)/tmp
206 mkdir -p $(PKG_BUILD_DIR)/tmp
207 tar xvzf $(DL_DIR)/$(HAL_FILE) -C $(PKG_BUILD_DIR)/tmp
208 $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
209 rm -rf $(PKG_BUILD_DIR)/tmp
210 endef
211
212 define Build/Prepare
213 $(call Build/Prepare/Default)
214 $(call Build/Prepare/HAL)
215 # patch cflags
216 $(SED) 's, -E[LB],,' \
217 -e 's, -mips2,,' \
218 -e 's, -mapcs-32,,' \
219 -e 's, -mlong-calls,,' \
220 $(PKG_BUILD_DIR)/hal/public/*.inc
221 $(SED) 's,march=armv4,march=armv5te,' \
222 $(PKG_BUILD_DIR)/hal/public/xscale*.inc
223 endef
224
225 ifeq ($(findstring AHB,$(BUS)),AHB)
226 define Build/Compile/ahb
227 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
228 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
229 endef
230 endif
231
232 ifeq ($(findstring PCI,$(BUS)),PCI)
233 define Build/Compile/pci
234 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
235 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
236 endef
237 endif
238
239 define Build/Configure
240 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
241 endef
242
243 define Build/Compile
244 $(call Build/Compile/ahb)
245 $(call Build/Compile/pci)
246 endef
247
248 define Build/InstallDev
249 mkdir -p $(1)/usr/include/madwifi
250 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
251 mkdir -p $(1)/usr/include/madwifi/net80211
252 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
253 endef
254
255 define KernelPackage/madwifi/install
256 $(INSTALL_DIR) $(1)/usr/sbin
257 $(CP) ./files/* $(1)/
258 $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
259 endef
260
261 $(eval $(call KernelPackage,madwifi))
This page took 0.05144 seconds and 5 git commands to generate.