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