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 ($(BOARD
),cns3xxx
)
89 HAL_TARGET
:=arm11-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
91 ifeq ($(ARCH
),powerpc
)
92 HAL_TARGET
:=powerpc-be-elf
94 ifeq ($(BOARD
),gemini
)
95 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
97 ifneq ($(CONFIG_TARGET_atheros
),)
101 ifdef CONFIG_MADWIFI_RCA_MINSTREL
102 RATE_CONTROL
:=minstrel
105 ifdef CONFIG_MADWIFI_RCA_ONOE
109 ifdef CONFIG_MADWIFI_RCA_AMRR
113 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
117 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE
),)
118 MADWIFI_FILES
:= $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.ko
121 $(PKG_BUILD_DIR
)/net80211
/wlan.ko \
122 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.ko \
123 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.ko \
124 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.ko \
125 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).ko \
126 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.ko \
127 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.ko \
128 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.ko \
129 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.ko \
130 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.ko
133 ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE
),)
134 MADWIFI_AUTOLOAD
:= ath_hal
141 ath_rate_
$(RATE_CONTROL
) \
149 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
150 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.ko
151 MADWIFI_AUTOLOAD
+= ath_ahb
153 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
154 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.ko
155 MADWIFI_AUTOLOAD
+= ath_pci
158 MADWIFI_APPLETS
:=80211stats athchans athkey athstats wlanconfig ath_info madwifi_multi
159 ifdef CONFIG_MADWIFI_DEBUG
160 MADWIFI_APPLETS
+= athdebug
80211debug
163 define KernelPackage
/madwifi
164 SUBMENU
:=Wireless Drivers
165 TITLE
:=Driver for Atheros wireless chipsets
166 URL
:=http
://madwifi-project.org
/
167 MAINTAINER
:=Felix Fietkau
<nbd@openwrt.org
>
168 DEPENDS
:=+wireless-tools @PCI_SUPPORT @
(!(TARGET_avr32||TARGET_cobalt||TARGET_ep93xx||TARGET_etrax||TARGET_octeon||TARGET_pxcab||TARGET_sibyte
)||BROKEN
)
169 FILES
:=$(MADWIFI_FILES
)
170 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
174 define KernelPackage
/madwifi
/description
175 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
178 define KernelPackage
/madwifi
/config
179 source
"$(SOURCE)/Config.in"
184 -I
$(PKG_BUILD_DIR
)/include \
185 -I
$(PKG_BUILD_DIR
)/hal \
186 -I
$(PKG_BUILD_DIR
)/ath \
187 -I
$(PKG_BUILD_DIR
)/ath_hal \
188 -I
$(PKG_BUILD_DIR
)/net80211 \
189 -I
$(STAGING_DIR
)/usr
/include/wprobe \
190 -include $(PKG_BUILD_DIR
)/include/compat.h
193 PATH
="$(TARGET_PATH)" \
194 ARCH
="$(LINUX_KARCH)" \
195 ARCH-y
="$(LINUX_KARCH)" \
196 CROSS_COMPILE
="$(TARGET_CROSS)" \
197 TARGET
="$(HAL_TARGET)" \
198 TOOLPREFIX
="$(KERNEL_CROSS)" \
199 TOOLPATH
="$(KERNEL_CROSS)" \
200 KERNELPATH
="$(LINUX_DIR)" \
201 LDOPTS
="--no-warn-mismatch " \
202 ATH_RATE
="$(RATE_CONTROL)" \
203 ATH_CAP_SUPERG_COMP
="$(COMPRESSION)" \
205 SINGLE_MODULE
=$(if
$(CONFIG_MADWIFI_SINGLE_MODULE
),1) \
206 INCS
="$(MADWIFI_INC)" \
207 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
210 COPTS
="-DATH_REVERSE_ENGINEERING=1" \
212 define Build
/Prepare
/HAL
213 rm -rf
$(PKG_BUILD_DIR
)/tmp
214 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
215 tar xvzf
$(DL_DIR
)/$(HAL_FILE
) -C
$(PKG_BUILD_DIR
)/tmp
216 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
217 rm -rf
$(PKG_BUILD_DIR
)/tmp
221 $(call Build
/Prepare
/Default
)
222 $(call Build
/Prepare
/HAL
)
224 $(SED
) 's, -E[LB],,' \
226 -e
's, -mapcs-32,,' \
227 -e
's, -mlong-calls,,' \
228 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
229 $(SED
) 's,march=armv4,march=armv5te,' \
230 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
233 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
234 define Build
/Compile
/ahb
235 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
236 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
240 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
241 define Build
/Compile
/pci
242 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
243 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
247 define Build
/Configure
248 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
252 $(call Build
/Compile
/ahb
)
253 $(call Build
/Compile
/pci
)
256 define Build
/InstallDev
257 mkdir
-p
$(1)/usr
/include/madwifi
258 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
259 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
260 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
263 define KernelPackage
/madwifi
/install
264 $(INSTALL_DIR
) $(1)/usr
/sbin
265 $(CP
) .
/files
/* $(1)/
266 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
269 $(eval
$(call KernelPackage
,madwifi
))