create /etc/fstab on boot (closes #3458)
[openwrt.git] / package / madwifi / Makefile
1 #
2 # Copyright (C) 2006-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$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=madwifi
13 PKG_REV:=3314
14 PKG_VERSION:=r$(PKG_REV)
15 # PKG_BRANCH:=madwifi-dfs
16 PKG_RELEASE:=1
17
18 PKG_SOURCE_PROTO:=svn
19 PKG_SOURCE_VERSION:=$(PKG_REV)
20 PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
21 PKG_SOURCE_URL:=http://svn.madwifi.org/madwifi/$(if $(PKG_BRANCH),branches/$(PKG_BRANCH),trunk)
22 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
23
24 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
25
26 include $(INCLUDE_DIR)/package.mk
27
28 ifdef CONFIG_MADWIFI_BUS_DEFAULT
29 ifneq ($(CONFIG_TARGET_atheros),)
30 BUS:=AHB
31 else
32 ifneq ($(CONFIG_PCI_SUPPORT),)
33 BUS:=PCI
34 endif
35 endif
36
37 # XXX: remove this check later when we have PCI support properly detected on all targets
38 ifneq ($(CONFIG_TARGET_ar7)$(CONFIG_TARGET_uml),)
39 BUS:=
40 endif
41 else
42 ifdef CONFIG_MADWIFI_BUS_PCI
43 BUS:=PCI
44 else
45 ifdef CONFIG_MADWIFI_BUS_AHB
46 BUS:=AHB
47 endif
48 endif
49 endif
50
51 ifdef CONFIG_MADWIFI_HAL_DEFAULT
52 ifeq ($(ARCH),mips)
53 HAL_TARGET:=mips-be-elf
54 endif
55 ifeq ($(ARCH),mipsel)
56 HAL_TARGET:=mips-le-elf
57 endif
58 ifeq ($(ARCH),i386)
59 HAL_TARGET:=i386-elf
60 endif
61 ifeq ($(ARCH),i686)
62 HAL_TARGET:=i386-elf
63 endif
64 ifeq ($(BOARD),ixp4xx)
65 HAL_TARGET:=xscale-be-elf
66 endif
67 ifeq ($(BOARD),iop32x)
68 HAL_TARGET:=xscale-le-elf
69 endif
70 ifeq ($(ARCH),powerpc)
71 HAL_TARGET:=powerpc-be-elf
72 endif
73 ifeq ($(BOARD),storm)
74 HAL_TARGET:=armv4-le-elf
75 endif
76 ifneq ($(CONFIG_TARGET_atheros),)
77 HAL_TARGET:=ap51
78 endif
79 else
80 ifdef CONFIG_MADWIFI_HAL_MIPS_BE_ELF
81 HAL_TARGET:=mips-be-elf
82 endif
83
84 ifdef CONFIG_MADWIFI_HAL_MIPS_LE_ELF
85 HAL_TARGET:=mips-le-elf
86 endif
87
88 ifdef CONFIG_MADWIFI_HAL_I386_ELF
89 HAL_TARGET:=i386-elf
90 endif
91
92 ifdef CONFIG_MADWIFI_HAL_XSCALE_BE_ELF
93 HAL_TARGET:=xscale-be-elf
94 endif
95
96 ifdef CONFIG_MADWIFI_HAL_XSCALE_LE_ELF
97 HAL_TARGET:=xscale-le-elf
98 endif
99
100 ifdef CONFIG_MADWIFI_HAL_ARMV4_LE_ELF
101 HAL_TARGET:=armv4-le-elf
102 endif
103
104 ifdef CONFIG_MADWIFI_HAL_AP30
105 HAL_TARGET:=ap30
106 endif
107
108 ifdef CONFIG_MADWIFI_HAL_AP43
109 HAL_TARGET:=ap43
110 endif
111
112 ifdef CONFIG_MADWIFI_HAL_AP51
113 HAL_TARGET:=ap51
114 endif
115
116 ifdef CONFIG_MADWIFI_HAL_AP61
117 HAL_TARGET:=ap61
118 endif
119
120 endif
121
122 ifdef CONFIG_MADWIFI_RCA_MINSTREL
123 RATE_CONTROL:=minstrel
124 endif
125
126 ifdef CONFIG_MADWIFI_RCA_ONOE
127 RATE_CONTROL:=onoe
128 endif
129
130 ifdef CONFIG_MADWIFI_RCA_AMRR
131 RATE_CONTROL:=amrr
132 endif
133
134 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
135 RATE_CONTROL:=sample
136 endif
137
138 MADWIFI_FILES:= \
139 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
140 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
141 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
142 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
143 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
144 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
145 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
146 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
147 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
148 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
149
150 MADWIFI_AUTOLOAD:= \
151 wlan \
152 wlan_scan_ap \
153 wlan_scan_sta \
154 ath_hal \
155 ath_rate_$(RATE_CONTROL) \
156 wlan_acl \
157 wlan_ccmp \
158 wlan_tkip \
159 wlan_wep \
160 wlan_xauth \
161
162 ifeq ($(findstring AHB,$(BUS)),AHB)
163 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
164 MADWIFI_AUTOLOAD+= ath_ahb
165 endif
166 ifeq ($(findstring PCI,$(BUS)),PCI)
167 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
168 MADWIFI_AUTOLOAD+= ath_pci
169 endif
170
171 MADWIFI_APPLETS:=80211stats,athchans,athctrl,athkey,athstats,wlanconfig
172 ifdef CONFIG_MADWIFI_DEBUG
173 MADWIFI_APPLETS:=$(strip $(MADWIFI_APPLETS)),athdebug,80211debug
174 endif
175
176
177 define KernelPackage/madwifi
178 SUBMENU:=Wireless Drivers
179 TITLE:=Driver for Atheros wireless chipsets
180 URL:=http://madwifi.org/
181 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_ar7 @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml
182 FILES:=$(MADWIFI_FILES)
183 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
184 endef
185
186 define KernelPackage/madwifi/description
187 This package contains a driver for Atheros 802.11a/b/g chipsets.
188 endef
189
190 define KernelPackage/madwifi/config
191 menu "MadWifi Configuration"
192 depends on PACKAGE_kmod-madwifi
193 source "$(SOURCE)/Config.in"
194 endmenu
195 endef
196
197 MAKE_ARGS:= \
198 PATH="$(TARGET_PATH)" \
199 ARCH="$(LINUX_KARCH)" \
200 CROSS_COMPILE="$(TARGET_CROSS)" \
201 TARGET="$(HAL_TARGET)" \
202 TOOLPREFIX="$(KERNEL_CROSS)" \
203 TOOLPATH="$(KERNEL_CROSS)" \
204 KERNELPATH="$(LINUX_DIR)" \
205 LDOPTS="--no-warn-mismatch " \
206 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
207 WARNINGS="-Wno-unused" \
208 $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG="") \
209 DOMULTI=1
210
211 MAKE_VARS:= \
212 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
213
214 HALFILE:=$(lastword $(sort $(wildcard ./ath_hal-*.tgz)))
215 ifneq ($(HALFILE),)
216 define Build/Prepare
217 $(call Build/Prepare/Default)
218 rm -rf $(PKG_BUILD_DIR)/tmp
219 mkdir -p $(PKG_BUILD_DIR)/tmp
220 tar xvzf $(HALFILE) -C $(PKG_BUILD_DIR)/tmp
221 $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
222 rm -rf $(PKG_BUILD_DIR)/tmp
223 endef
224 endif
225
226 ifeq ($(findstring AHB,$(BUS)),AHB)
227 define Build/Compile/ahb
228 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
229 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
230 endef
231 endif
232
233 ifeq ($(findstring PCI,$(BUS)),PCI)
234 define Build/Compile/pci
235 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
236 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
237 endef
238 endif
239
240 define Build/Configure
241 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
242 endef
243
244 define Build/Compile
245 $(call Build/Compile/ahb)
246 $(call Build/Compile/pci)
247 endef
248
249 define Build/InstallDev
250 mkdir -p $(1)/usr/include/madwifi
251 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
252 mkdir -p $(1)/usr/include/madwifi/net80211
253 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
254 endef
255
256 define KernelPackage/madwifi/install
257 $(INSTALL_DIR) $(1)/lib/wifi
258 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
259 $(INSTALL_DIR) $(1)/usr/sbin
260 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,$(MADWIFI_APPLETS)} $(1)/usr/sbin/
261 endef
262
263 $(eval $(call KernelPackage,madwifi))
This page took 0.0527 seconds and 5 git commands to generate.