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 ifneq ($(CONFIG_MADWIFI_UPSTREAM
),)
18 PKG_SOURCE
:=madwifi-
$(PKG_VERSION
).
tar.gz
19 PKG_SOURCE_URL
:=http
://downloads.sourceforge.net
/madwifi
/
20 PKG_MD5SUM
:=399d20de8d855a59f20058857c2178ad
22 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/madwifi-
$(PKG_VERSION
)
24 PATCH_DIR
=.
/patches-upstream
26 # PKG_BRANCH:=madwifi-dfs
27 PKG_REV
:=$(if
$(CONFIG_MADWIFI_TESTING
),3776,3314)
28 PKG_VERSION
:=r
$(PKG_REV
)
32 PKG_SOURCE_VERSION
:=$(PKG_REV
)
33 PKG_SOURCE_SUBDIR
:=$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
34 PKG_SOURCE_URL
:=http
://svn.madwifi.org
/madwifi
/$(if
$(PKG_BRANCH
),branches
/$(PKG_BRANCH
),trunk
)
35 PKG_SOURCE
:=$(PKG_SOURCE_SUBDIR
).
tar.gz
37 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
39 PATCH_DIR
=$(if
$(CONFIG_MADWIFI_TESTING
),.
/patches-testing
,.
/patches
)
42 include $(INCLUDE_DIR
)/package.mk
44 ifneq ($(CONFIG_TARGET_atheros
),)
47 ifneq ($(CONFIG_PCI_SUPPORT
),)
52 # XXX: remove this check later when we have PCI support properly detected on all targets
53 ifneq ($(CONFIG_TARGET_ar7
)$(CONFIG_TARGET_uml
),)
57 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
59 HAL_TARGET
:=mips32r2-be-elf
62 HAL_TARGET
:=mips32r2-le-elf
66 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-be-elf
,mips32-be-elf
)
69 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-le-elf
,mips32-le-elf
)
78 ifeq ($(BOARD
),ixp4xx
)
79 HAL_TARGET
:=xscale-be-elf
81 ifeq ($(BOARD
),iop32x
)
82 HAL_TARGET
:=xscale-le-elf
85 HAL_TARGET
:=xscale-le-elf
87 ifeq ($(ARCH
),powerpc
)
88 HAL_TARGET
:=powerpc-be-elf
91 HAL_TARGET
:=armv4-le-elf
93 ifneq ($(CONFIG_TARGET_atheros
),)
97 ifdef CONFIG_MADWIFI_RCA_MINSTREL
98 RATE_CONTROL
:=minstrel
101 ifdef CONFIG_MADWIFI_RCA_ONOE
105 ifdef CONFIG_MADWIFI_RCA_AMRR
109 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
114 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
115 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
116 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
117 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
118 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
119 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
120 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
121 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
122 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
123 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
) \
130 ath_rate_
$(RATE_CONTROL
) \
137 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
138 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
139 MADWIFI_AUTOLOAD
+= ath_ahb
141 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
142 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
143 MADWIFI_AUTOLOAD
+= ath_pci
146 MADWIFI_APPLETS
:=80211stats athchans athctrl athkey athstats wlanconfig
$(if
$(CONFIG_MADWIFI_TESTING
),ath_info
/)ath_info
147 ifdef CONFIG_MADWIFI_DEBUG
148 MADWIFI_APPLETS
+= athdebug
80211debug
150 ifndef CONFIG_MADWIFI_UPSTREAM
151 MADWIFI_APPLETS
+= madwifi_multi
154 define KernelPackage
/madwifi
155 SUBMENU
:=Wireless Drivers
156 TITLE
:=Driver for Atheros wireless chipsets
157 URL
:=http
://madwifi.org
/
158 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_ar7 @
!TARGET_avr32 @
!TARGET_etrax @
!TARGET_uml
159 FILES
:=$(MADWIFI_FILES
)
160 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
163 define KernelPackage
/madwifi
/description
164 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
167 define KernelPackage
/madwifi
/config
168 source
"$(SOURCE)/Config.in"
172 PATH
="$(TARGET_PATH)" \
173 ARCH
="$(LINUX_KARCH)" \
174 CROSS_COMPILE
="$(TARGET_CROSS)" \
175 TARGET
="$(HAL_TARGET)" \
176 TOOLPREFIX
="$(KERNEL_CROSS)" \
177 TOOLPATH
="$(KERNEL_CROSS)" \
178 KERNELPATH
="$(LINUX_DIR)" \
179 LDOPTS
="--no-warn-mismatch " \
180 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
183 ifneq ($(CONFIG_MADWIFI_TESTING
),)
184 MAKE_ARGS
+= $(if
$(CONFIG_MADWIFI_DEBUG
),,ATH_DEBUG
=)
186 MAKE_ARGS
+= $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
190 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
192 ifeq ($(CONFIG_MADWIFI_UPSTREAM
),)
193 HALFILE
:=$(lastword
$(sort $(wildcard .
/ath_hal-
*.tgz
)))
197 define Build
/Prepare
/HAL
198 rm -rf
$(PKG_BUILD_DIR
)/tmp
199 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
200 tar xvzf
$(HALFILE
) -C
$(PKG_BUILD_DIR
)/tmp
201 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
202 rm -rf
$(PKG_BUILD_DIR
)/tmp
207 $(call Build
/Prepare
/Default
)
208 $(call Build
/Prepare
/HAL
)
210 $(SED
) 's, -E[LB],,' \
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
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
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
232 define Build
/Configure
233 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
237 $(call Build
/Compile
/ahb
)
238 $(call Build
/Compile
/pci
)
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
/
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
/
254 $(eval
$(call KernelPackage
,madwifi
))