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
:=@SF
/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
://madwifi-project.org
/svn
/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
)
42 HAL_FILE
:=ath_hal-
$(HAL_VERSION
).tgz
43 HAL_MD5SUM
:=4ab7ae8bdb96c0be388c98bf8f92d5ca
45 PKG_BUILD_DEPENDS
:=wprobe
47 include $(INCLUDE_DIR
)/package.mk
49 ifdef CONFIG_MADWIFI_COMPRESSION
57 URL
:=http
://mirror2.openwrt.org
/sources
60 $(eval
$(call Download
,hal
))
63 ifneq ($(CONFIG_TARGET_atheros
),)
66 ifneq ($(CONFIG_PCI_SUPPORT
),)
71 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
73 HAL_TARGET
:=mips32r2-be-elf
76 HAL_TARGET
:=mips32r2-le-elf
80 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-be-elf
,mips32-be-elf
)
83 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-le-elf
,mips32-le-elf
)
92 ifeq ($(BOARD
),ixp4xx
)
93 HAL_TARGET
:=xscale-be-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
95 ifeq ($(BOARD
),iop32x
)
96 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
99 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
101 ifeq ($(ARCH
),powerpc
)
102 HAL_TARGET
:=powerpc-be-elf
104 ifeq ($(BOARD
),gemini
)
105 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
107 ifneq ($(CONFIG_TARGET_atheros
),)
111 ifdef CONFIG_MADWIFI_RCA_MINSTREL
112 RATE_CONTROL
:=minstrel
115 ifdef CONFIG_MADWIFI_RCA_ONOE
119 ifdef CONFIG_MADWIFI_RCA_AMRR
123 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
128 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
129 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
130 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
131 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
132 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
133 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
134 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
135 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
136 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
137 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
) \
144 ath_rate_
$(RATE_CONTROL
) \
151 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
152 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
153 MADWIFI_AUTOLOAD
+= ath_ahb
155 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
156 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
157 MADWIFI_AUTOLOAD
+= ath_pci
160 MADWIFI_APPLETS
:=80211stats athchans athkey athstats wlanconfig ath_info
161 ifdef CONFIG_MADWIFI_DEBUG
162 MADWIFI_APPLETS
+= athdebug
80211debug
164 ifndef CONFIG_MADWIFI_UPSTREAM
165 MADWIFI_APPLETS
+= madwifi_multi
168 define KernelPackage
/madwifi
169 SUBMENU
:=Wireless Drivers
170 TITLE
:=Driver for Atheros wireless chipsets
171 URL
:=http
://madwifi-project.org
/
172 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_avr32 @
!TARGET_etrax @LINUX_2_6
173 FILES
:=$(MADWIFI_FILES
)
174 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
177 define KernelPackage
/madwifi
/description
178 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
181 define KernelPackage
/madwifi
/config
182 source
"$(SOURCE)/Config.in"
187 -I
$(PKG_BUILD_DIR
)/include \
188 -I
$(PKG_BUILD_DIR
)/hal \
189 -I
$(PKG_BUILD_DIR
)/ath \
190 -I
$(PKG_BUILD_DIR
)/ath_hal \
191 -I
$(PKG_BUILD_DIR
)/net80211 \
192 -I
$(STAGING_DIR
)/usr
/include/wprobe \
193 -include $(PKG_BUILD_DIR
)/include/compat.h
196 PATH
="$(TARGET_PATH)" \
197 ARCH
="$(LINUX_KARCH)" \
198 ARCH-y
="$(LINUX_KARCH)" \
199 CROSS_COMPILE
="$(TARGET_CROSS)" \
200 TARGET
="$(HAL_TARGET)" \
201 TOOLPREFIX
="$(KERNEL_CROSS)" \
202 TOOLPATH
="$(KERNEL_CROSS)" \
203 KERNELPATH
="$(LINUX_DIR)" \
204 LDOPTS
="--no-warn-mismatch " \
205 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
206 ATH_CAP_SUPERG_COMP
="$(COMPRESSION)" \
208 INCS
="$(MADWIFI_INC)" \
209 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
212 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
214 ifeq ($(CONFIG_MADWIFI_UPSTREAM
),)
215 define Build
/Prepare
/HAL
216 rm -rf
$(PKG_BUILD_DIR
)/tmp
217 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
218 tar xvzf
$(DL_DIR
)/$(HAL_FILE
) -C
$(PKG_BUILD_DIR
)/tmp
219 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
220 rm -rf
$(PKG_BUILD_DIR
)/tmp
225 $(call Build
/Prepare
/Default
)
226 $(call Build
/Prepare
/HAL
)
228 $(SED
) 's, -E[LB],,' \
230 -e
's, -mapcs-32,,' \
231 -e
's, -mlong-calls,,' \
232 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
233 $(SED
) 's,march=armv4,march=armv5te,' \
234 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
237 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
238 define Build
/Compile
/ahb
239 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
240 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
244 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
245 define Build
/Compile
/pci
246 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
247 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
251 define Build
/Configure
252 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
256 $(call Build
/Compile
/ahb
)
257 $(call Build
/Compile
/pci
)
260 define Build
/InstallDev
261 mkdir
-p
$(1)/usr
/include/madwifi
262 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
263 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
264 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
267 define KernelPackage
/madwifi
/install
268 $(INSTALL_DIR
) $(1)/usr
/sbin
269 $(CP
) .
/files
/* $(1)/
270 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
273 $(eval
$(call KernelPackage
,madwifi
))