[package] madwifi: Disable compression capability on AR71XX and make it optional...
[openwrt/svn-archive/archive.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 $(PKG_BUILD_DIR)/hal/public/*.inc
232 $(SED) 's,march=armv4,march=armv5te,' \
233 $(PKG_BUILD_DIR)/hal/public/xscale*.inc
234 endef
235
236 ifeq ($(findstring AHB,$(BUS)),AHB)
237 define Build/Compile/ahb
238 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
239 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
240 endef
241 endif
242
243 ifeq ($(findstring PCI,$(BUS)),PCI)
244 define Build/Compile/pci
245 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
246 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
247 endef
248 endif
249
250 define Build/Configure
251 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
252 endef
253
254 define Build/Compile
255 $(call Build/Compile/ahb)
256 $(call Build/Compile/pci)
257 endef
258
259 define Build/InstallDev
260 mkdir -p $(1)/usr/include/madwifi
261 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
262 mkdir -p $(1)/usr/include/madwifi/net80211
263 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
264 endef
265
266 define KernelPackage/madwifi/install
267 $(INSTALL_DIR) $(1)/usr/sbin
268 $(CP) ./files/* $(1)/
269 $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
270 endef
271
272 $(eval $(call KernelPackage,madwifi))