2 # Copyright (C) 2006-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
10 include $(INCLUDE_DIR
)/kernel.mk
14 PKG_VERSION
:=r
$(PKG_REV
)
15 # PKG_BRANCH:=madwifi-dfs
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
24 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
26 include $(INCLUDE_DIR
)/package.mk
28 ifdef CONFIG_MADWIFI_BUS_DEFAULT
29 ifneq ($(CONFIG_TARGET_atheros
),)
32 ifneq ($(CONFIG_PCI_SUPPORT
),)
37 # XXX: remove this check later when we have PCI support properly detected on all targets
38 ifneq ($(CONFIG_TARGET_ar7
)$(CONFIG_TARGET_uml
),)
42 ifdef CONFIG_MADWIFI_BUS_PCI
45 ifdef CONFIG_MADWIFI_BUS_AHB
51 ifdef CONFIG_MADWIFI_HAL_DEFAULT
53 HAL_TARGET
:=mips-be-elf
56 HAL_TARGET
:=mips-le-elf
64 ifeq ($(BOARD
),ixp4xx
)
65 HAL_TARGET
:=xscale-be-elf
67 ifeq ($(BOARD
),iop32x
)
68 HAL_TARGET
:=xscale-le-elf
70 ifeq ($(ARCH
),powerpc
)
71 HAL_TARGET
:=powerpc-be-elf
74 HAL_TARGET
:=armv4-le-elf
76 ifneq ($(CONFIG_TARGET_atheros
),)
80 ifdef CONFIG_MADWIFI_HAL_MIPS_BE_ELF
81 HAL_TARGET
:=mips-be-elf
84 ifdef CONFIG_MADWIFI_HAL_MIPS_LE_ELF
85 HAL_TARGET
:=mips-le-elf
88 ifdef CONFIG_MADWIFI_HAL_I386_ELF
92 ifdef CONFIG_MADWIFI_HAL_XSCALE_BE_ELF
93 HAL_TARGET
:=xscale-be-elf
96 ifdef CONFIG_MADWIFI_HAL_XSCALE_LE_ELF
97 HAL_TARGET
:=xscale-le-elf
100 ifdef CONFIG_MADWIFI_HAL_ARMV4_LE_ELF
101 HAL_TARGET
:=armv4-le-elf
104 ifdef CONFIG_MADWIFI_HAL_AP30
108 ifdef CONFIG_MADWIFI_HAL_AP43
112 ifdef CONFIG_MADWIFI_HAL_AP51
116 ifdef CONFIG_MADWIFI_HAL_AP61
122 ifdef CONFIG_MADWIFI_RCA_MINSTREL
123 RATE_CONTROL
:=minstrel
126 ifdef CONFIG_MADWIFI_RCA_ONOE
130 ifdef CONFIG_MADWIFI_RCA_AMRR
134 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
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
) \
155 ath_rate_
$(RATE_CONTROL
) \
162 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
163 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
164 MADWIFI_AUTOLOAD
+= ath_ahb
166 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
167 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
168 MADWIFI_AUTOLOAD
+= ath_pci
171 MADWIFI_APPLETS
:=80211stats
,athchans
,athctrl
,athkey
,athstats
,wlanconfig
172 ifdef CONFIG_MADWIFI_DEBUG
173 MADWIFI_APPLETS
:=$(strip $(MADWIFI_APPLETS
)),athdebug
,80211debug
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
))
186 define KernelPackage
/madwifi
/description
187 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
190 define KernelPackage
/madwifi
/config
191 menu
"MadWifi Configuration"
192 depends on PACKAGE_kmod-madwifi
193 source
"$(SOURCE)/Config.in"
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 $(ifndef CONFIG_MADWIFI_DEBUG
,DEBUG
="") \
212 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
214 HALFILE
:=$(lastword
$(sort $(wildcard .
/ath_hal-
*.tgz
)))
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
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
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
240 define Build
/Configure
241 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
245 $(call Build
/Compile
/ahb
)
246 $(call Build
/Compile
/pci
)
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
/
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
/
263 $(eval
$(call KernelPackage
,madwifi
))