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
14 PKG_VERSION
:=r
$(PKG_REV
)
18 PKG_SOURCE_VERSION
:=$(PKG_REV
)
19 PKG_SOURCE_SUBDIR
:=$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
20 PKG_SOURCE_URL
:=http
://madwifi-project.org
/svn
/madwifi
/$(if
$(PKG_BRANCH
),branches
/$(PKG_BRANCH
),trunk
)
21 PKG_SOURCE
:=$(PKG_SOURCE_SUBDIR
).
tar.gz
23 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
26 HAL_FILE
:=ath_hal-
$(HAL_VERSION
).tgz
27 HAL_MD5SUM
:=4ab7ae8bdb96c0be388c98bf8f92d5ca
29 PKG_BUILD_DEPENDS
:=wprobe
31 include $(INCLUDE_DIR
)/package.mk
33 ifdef CONFIG_MADWIFI_COMPRESSION
41 URL
:=http
://mirror2.openwrt.org
/sources
44 $(eval
$(call Download
,hal
))
47 ifneq ($(CONFIG_TARGET_atheros
),)
50 ifneq ($(CONFIG_PCI_SUPPORT
),)
55 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
57 HAL_TARGET
:=mips32r2-be-elf
60 HAL_TARGET
:=mips32r2-le-elf
64 HAL_TARGET
:=mips32-be-elf
67 HAL_TARGET
:=mips32-le-elf
76 ifeq ($(BOARD
),ixp4xx
)
77 HAL_TARGET
:=xscale-be-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
79 ifeq ($(BOARD
),iop32x
)
80 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
82 ifeq ($(BOARD
),kirkwood
)
83 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
86 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
88 ifeq ($(ARCH
),powerpc
)
89 HAL_TARGET
:=powerpc-be-elf
91 ifeq ($(BOARD
),gemini
)
92 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
94 ifneq ($(CONFIG_TARGET_atheros
),)
98 ifdef CONFIG_MADWIFI_RCA_MINSTREL
99 RATE_CONTROL
:=minstrel
102 ifdef CONFIG_MADWIFI_RCA_ONOE
106 ifdef CONFIG_MADWIFI_RCA_AMRR
110 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
114 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE
),)
115 MADWIFI_FILES
:= $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
)
118 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
119 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
120 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
121 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
122 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
123 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
124 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
125 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
126 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
127 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
)
130 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE
),)
131 MADWIFI_AUTOLOAD
:= ath_hal
138 ath_rate_
$(RATE_CONTROL
) \
146 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
147 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
148 MADWIFI_AUTOLOAD
+= ath_ahb
150 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
151 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
152 MADWIFI_AUTOLOAD
+= ath_pci
155 MADWIFI_APPLETS
:=80211stats athchans athkey athstats wlanconfig ath_info madwifi_multi
156 ifdef CONFIG_MADWIFI_DEBUG
157 MADWIFI_APPLETS
+= athdebug
80211debug
160 define KernelPackage
/madwifi
161 SUBMENU
:=Wireless Drivers
162 TITLE
:=Driver for Atheros wireless chipsets
163 URL
:=http
://madwifi-project.org
/
164 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_avr32 @
!TARGET_etrax @
!TARGET_cobalt @LINUX_2_6
165 FILES
:=$(MADWIFI_FILES
)
166 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
169 define KernelPackage
/madwifi
/description
170 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
173 define KernelPackage
/madwifi
/config
174 source
"$(SOURCE)/Config.in"
179 -I
$(PKG_BUILD_DIR
)/include \
180 -I
$(PKG_BUILD_DIR
)/hal \
181 -I
$(PKG_BUILD_DIR
)/ath \
182 -I
$(PKG_BUILD_DIR
)/ath_hal \
183 -I
$(PKG_BUILD_DIR
)/net80211 \
184 -I
$(STAGING_DIR
)/usr
/include/wprobe \
185 -include $(PKG_BUILD_DIR
)/include/compat.h
188 PATH
="$(TARGET_PATH)" \
189 ARCH
="$(LINUX_KARCH)" \
190 ARCH-y
="$(LINUX_KARCH)" \
191 CROSS_COMPILE
="$(TARGET_CROSS)" \
192 TARGET
="$(HAL_TARGET)" \
193 TOOLPREFIX
="$(KERNEL_CROSS)" \
194 TOOLPATH
="$(KERNEL_CROSS)" \
195 KERNELPATH
="$(LINUX_DIR)" \
196 LDOPTS
="--no-warn-mismatch " \
197 ATH_RATE
="$(RATE_CONTROL)" \
198 ATH_CAP_SUPERG_COMP
="$(COMPRESSION)" \
200 SINGLE_MODULE
=$(if
$(CONFIG_MADWIFI_SINGLE_MODULE
),1) \
201 INCS
="$(MADWIFI_INC)" \
202 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
205 COPTS
="-DATH_REVERSE_ENGINEERING=1" \
207 define Build
/Prepare
/HAL
208 rm -rf
$(PKG_BUILD_DIR
)/tmp
209 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
210 tar xvzf
$(DL_DIR
)/$(HAL_FILE
) -C
$(PKG_BUILD_DIR
)/tmp
211 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
212 rm -rf
$(PKG_BUILD_DIR
)/tmp
216 $(call Build
/Prepare
/Default
)
217 $(call Build
/Prepare
/HAL
)
219 $(SED
) 's, -E[LB],,' \
221 -e
's, -mapcs-32,,' \
222 -e
's, -mlong-calls,,' \
223 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
224 $(SED
) 's,march=armv4,march=armv5te,' \
225 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
228 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
229 define Build
/Compile
/ahb
230 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
231 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
235 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
236 define Build
/Compile
/pci
237 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
238 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
242 define Build
/Configure
243 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
247 $(call Build
/Compile
/ahb
)
248 $(call Build
/Compile
/pci
)
251 define Build
/InstallDev
252 mkdir
-p
$(1)/usr
/include/madwifi
253 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
254 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
255 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
258 define KernelPackage
/madwifi
/install
259 $(INSTALL_DIR
) $(1)/usr
/sbin
260 $(CP
) .
/files
/* $(1)/
261 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
264 $(eval
$(call KernelPackage
,madwifi
))