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