2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
13 ifneq ($(CONFIG_MADWIFI_UPSTREAM
),)
17 PKG_SOURCE
:=madwifi-
$(PKG_VERSION
).
tar.gz
18 PKG_SOURCE_URL
:=http
://downloads.sourceforge.net
/madwifi
/
19 PKG_MD5SUM
:=399d20de8d855a59f20058857c2178ad
21 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/madwifi-
$(PKG_VERSION
)
23 PATCH_DIR
=.
/patches-upstream
25 # PKG_BRANCH:=madwifi-dfs
27 PKG_VERSION
:=r
$(PKG_REV
)
31 PKG_SOURCE_VERSION
:=$(PKG_REV
)
32 PKG_SOURCE_SUBDIR
:=$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
33 PKG_SOURCE_URL
:=http
://svn.madwifi.org
/madwifi
/$(if
$(PKG_BRANCH
),branches
/$(PKG_BRANCH
),trunk
)
34 PKG_SOURCE
:=$(PKG_SOURCE_SUBDIR
).
tar.gz
36 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
41 PKG_BUILD_DEPENDS
:=wprobe
43 include $(INCLUDE_DIR
)/package.mk
45 ifneq ($(CONFIG_TARGET_atheros
),)
48 ifneq ($(CONFIG_PCI_SUPPORT
),)
53 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
55 HAL_TARGET
:=mips32r2-be-elf
58 HAL_TARGET
:=mips32r2-le-elf
62 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-be-elf
,mips32-be-elf
)
65 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-le-elf
,mips32-le-elf
)
74 ifeq ($(BOARD
),ixp4xx
)
75 HAL_TARGET
:=xscale-be-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
77 ifeq ($(BOARD
),iop32x
)
78 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
81 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
83 ifeq ($(ARCH
),powerpc
)
84 HAL_TARGET
:=powerpc-be-elf
87 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
89 ifneq ($(CONFIG_TARGET_atheros
),)
93 ifdef CONFIG_MADWIFI_RCA_MINSTREL
94 RATE_CONTROL
:=minstrel
97 ifdef CONFIG_MADWIFI_RCA_ONOE
101 ifdef CONFIG_MADWIFI_RCA_AMRR
105 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
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
) \
126 ath_rate_
$(RATE_CONTROL
) \
133 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
134 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
135 MADWIFI_AUTOLOAD
+= ath_ahb
137 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
138 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
139 MADWIFI_AUTOLOAD
+= ath_pci
142 MADWIFI_APPLETS
:=80211stats athchans athctrl athkey athstats wlanconfig ath_info
143 ifdef CONFIG_MADWIFI_DEBUG
144 MADWIFI_APPLETS
+= athdebug
80211debug
146 ifndef CONFIG_MADWIFI_UPSTREAM
147 MADWIFI_APPLETS
+= madwifi_multi
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
))
159 define KernelPackage
/madwifi
/description
160 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
163 define KernelPackage
/madwifi
/config
164 source
"$(SOURCE)/Config.in"
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
178 PATH
="$(TARGET_PATH)" \
179 ARCH
="$(LINUX_KARCH)" \
180 CROSS_COMPILE
="$(TARGET_CROSS)" \
181 TARGET
="$(HAL_TARGET)" \
182 TOOLPREFIX
="$(KERNEL_CROSS)" \
183 TOOLPATH
="$(KERNEL_CROSS)" \
184 KERNELPATH
="$(LINUX_DIR)" \
185 LDOPTS
="--no-warn-mismatch " \
186 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
188 INCS
="$(MADWIFI_INC)" \
189 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
192 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
194 ifeq ($(CONFIG_MADWIFI_UPSTREAM
),)
195 HALFILE
:=$(lastword
$(sort $(wildcard .
/ath_hal-
*.tgz
)))
199 define Build
/Prepare
/HAL
200 rm -rf
$(PKG_BUILD_DIR
)/tmp
201 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
202 tar xvzf
$(HALFILE
) -C
$(PKG_BUILD_DIR
)/tmp
203 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
204 rm -rf
$(PKG_BUILD_DIR
)/tmp
209 $(call Build
/Prepare
/Default
)
210 $(call Build
/Prepare
/HAL
)
212 $(SED
) 's, -E[LB],,' \
214 -e
's, -mapcs-32,,' \
215 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
216 $(SED
) 's,march=armv4,march=armv5te,' \
217 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
220 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
221 define Build
/Compile
/ahb
222 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
223 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
227 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
228 define Build
/Compile
/pci
229 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
230 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
234 define Build
/Configure
235 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
239 $(call Build
/Compile
/ahb
)
240 $(call Build
/Compile
/pci
)
243 define Build
/InstallDev
244 mkdir
-p
$(1)/usr
/include/madwifi
245 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
246 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
247 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
250 define KernelPackage
/madwifi
/install
251 $(INSTALL_DIR
) $(1)/usr
/sbin
252 $(CP
) .
/files
/* $(1)/
253 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
256 $(eval
$(call KernelPackage
,madwifi
))