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.
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
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
)
42 PKG_BUILD_DEPENDS
:=wprobe
44 include $(INCLUDE_DIR
)/package.mk
46 ifneq ($(CONFIG_TARGET_atheros
),)
49 ifneq ($(CONFIG_PCI_SUPPORT
),)
54 # XXX: remove this check later when we have PCI support properly detected on all targets
55 ifneq ($(CONFIG_TARGET_ar7
)$(CONFIG_TARGET_uml
),)
59 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
61 HAL_TARGET
:=mips32r2-be-elf
64 HAL_TARGET
:=mips32r2-le-elf
68 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-be-elf
,mips32-be-elf
)
71 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-le-elf
,mips32-le-elf
)
80 ifeq ($(BOARD
),ixp4xx
)
81 HAL_TARGET
:=xscale-be-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
83 ifeq ($(BOARD
),iop32x
)
84 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
87 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
89 ifeq ($(ARCH
),powerpc
)
90 HAL_TARGET
:=powerpc-be-elf
93 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
95 ifneq ($(CONFIG_TARGET_atheros
),)
99 ifdef CONFIG_MADWIFI_RCA_MINSTREL
100 RATE_CONTROL
:=minstrel
103 ifdef CONFIG_MADWIFI_RCA_ONOE
107 ifdef CONFIG_MADWIFI_RCA_AMRR
111 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
116 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
117 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
118 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
119 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
120 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
121 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
122 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
123 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
124 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
125 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
) \
132 ath_rate_
$(RATE_CONTROL
) \
139 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
140 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
141 MADWIFI_AUTOLOAD
+= ath_ahb
143 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
144 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
145 MADWIFI_AUTOLOAD
+= ath_pci
148 MADWIFI_APPLETS
:=80211stats athchans athctrl athkey athstats wlanconfig ath_info
149 ifdef CONFIG_MADWIFI_DEBUG
150 MADWIFI_APPLETS
+= athdebug
80211debug
152 ifndef CONFIG_MADWIFI_UPSTREAM
153 MADWIFI_APPLETS
+= madwifi_multi
156 define KernelPackage
/madwifi
157 SUBMENU
:=Wireless Drivers
158 TITLE
:=Driver for Atheros wireless chipsets
159 URL
:=http
://madwifi.org
/
160 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_ar7 @
!TARGET_avr32 @
!TARGET_etrax @
!TARGET_uml @LINUX_2_6
161 FILES
:=$(MADWIFI_FILES
)
162 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
165 define KernelPackage
/madwifi
/description
166 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
169 define KernelPackage
/madwifi
/config
170 source
"$(SOURCE)/Config.in"
175 -I
$(PKG_BUILD_DIR
)/include \
176 -I
$(PKG_BUILD_DIR
)/hal \
177 -I
$(PKG_BUILD_DIR
)/ath \
178 -I
$(PKG_BUILD_DIR
)/ath_hal \
179 -I
$(PKG_BUILD_DIR
)/net80211 \
180 -I
$(STAGING_DIR
)/usr
/include \
181 -include $(PKG_BUILD_DIR
)/include/compat.h
184 PATH
="$(TARGET_PATH)" \
185 ARCH
="$(LINUX_KARCH)" \
186 CROSS_COMPILE
="$(TARGET_CROSS)" \
187 TARGET
="$(HAL_TARGET)" \
188 TOOLPREFIX
="$(KERNEL_CROSS)" \
189 TOOLPATH
="$(KERNEL_CROSS)" \
190 KERNELPATH
="$(LINUX_DIR)" \
191 LDOPTS
="--no-warn-mismatch " \
192 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
194 INCS
="$(MADWIFI_INC)" \
195 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
198 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
200 ifeq ($(CONFIG_MADWIFI_UPSTREAM
),)
201 HALFILE
:=$(lastword
$(sort $(wildcard .
/ath_hal-
*.tgz
)))
205 define Build
/Prepare
/HAL
206 rm -rf
$(PKG_BUILD_DIR
)/tmp
207 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
208 tar xvzf
$(HALFILE
) -C
$(PKG_BUILD_DIR
)/tmp
209 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
210 rm -rf
$(PKG_BUILD_DIR
)/tmp
215 $(call Build
/Prepare
/Default
)
216 $(call Build
/Prepare
/HAL
)
218 $(SED
) 's, -E[LB],,' \
220 -e
's, -mapcs-32,,' \
221 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
222 $(SED
) 's,march=armv4,march=armv5te,' \
223 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
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)/usr
/sbin
258 $(CP
) .
/files
/* $(1)/
259 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
262 $(eval
$(call KernelPackage
,madwifi
))