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
)
42 HAL_FILE
:=ath_hal-
$(HAL_VERSION
).tgz
43 HAL_MD5SUM
:=4ab7ae8bdb96c0be388c98bf8f92d5ca
45 PKG_BUILD_DEPENDS
:=wprobe
47 include $(INCLUDE_DIR
)/package.mk
53 URL
:=http
://mirror2.openwrt.org
/sources
56 $(eval
$(call Download
,hal
))
59 ifneq ($(CONFIG_TARGET_atheros
),)
62 ifneq ($(CONFIG_PCI_SUPPORT
),)
67 ifneq ($(CONFIG_CPU_MIPS32_R2
),)
69 HAL_TARGET
:=mips32r2-be-elf
72 HAL_TARGET
:=mips32r2-le-elf
76 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-be-elf
,mips32-be-elf
)
79 HAL_TARGET
:=$(if
$(CONFIG_MADWIFI_UPSTREAM
),mips-le-elf
,mips32-le-elf
)
88 ifeq ($(BOARD
),ixp4xx
)
89 HAL_TARGET
:=xscale-be-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
91 ifeq ($(BOARD
),iop32x
)
92 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
95 HAL_TARGET
:=xscale-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
97 ifeq ($(ARCH
),powerpc
)
98 HAL_TARGET
:=powerpc-be-elf
100 ifeq ($(BOARD
),storm
)
101 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
103 ifeq ($(BOARD
),gemini
)
104 HAL_TARGET
:=armv4-le-elf
$(if
$(CONFIG_EABI_SUPPORT
),gnueabi
)
106 ifneq ($(CONFIG_TARGET_atheros
),)
110 ifdef CONFIG_MADWIFI_RCA_MINSTREL
111 RATE_CONTROL
:=minstrel
114 ifdef CONFIG_MADWIFI_RCA_ONOE
118 ifdef CONFIG_MADWIFI_RCA_AMRR
122 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
127 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
128 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
129 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
130 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
131 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
132 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
133 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
134 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
135 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
136 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
) \
143 ath_rate_
$(RATE_CONTROL
) \
150 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
151 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
152 MADWIFI_AUTOLOAD
+= ath_ahb
154 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
155 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
156 MADWIFI_AUTOLOAD
+= ath_pci
159 MADWIFI_APPLETS
:=80211stats athchans athkey athstats wlanconfig ath_info
160 ifdef CONFIG_MADWIFI_DEBUG
161 MADWIFI_APPLETS
+= athdebug
80211debug
163 ifndef CONFIG_MADWIFI_UPSTREAM
164 MADWIFI_APPLETS
+= madwifi_multi
167 define KernelPackage
/madwifi
168 SUBMENU
:=Wireless Drivers
169 TITLE
:=Driver for Atheros wireless chipsets
170 URL
:=http
://madwifi.org
/
171 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_avr32 @
!TARGET_etrax @LINUX_2_6
172 FILES
:=$(MADWIFI_FILES
)
173 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
176 define KernelPackage
/madwifi
/description
177 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
180 define KernelPackage
/madwifi
/config
181 source
"$(SOURCE)/Config.in"
186 -I
$(PKG_BUILD_DIR
)/include \
187 -I
$(PKG_BUILD_DIR
)/hal \
188 -I
$(PKG_BUILD_DIR
)/ath \
189 -I
$(PKG_BUILD_DIR
)/ath_hal \
190 -I
$(PKG_BUILD_DIR
)/net80211 \
191 -I
$(STAGING_DIR
)/usr
/include/wprobe \
192 -include $(PKG_BUILD_DIR
)/include/compat.h
195 PATH
="$(TARGET_PATH)" \
196 ARCH
="$(LINUX_KARCH)" \
197 ARCH-y
="$(LINUX_KARCH)" \
198 CROSS_COMPILE
="$(TARGET_CROSS)" \
199 TARGET
="$(HAL_TARGET)" \
200 TOOLPREFIX
="$(KERNEL_CROSS)" \
201 TOOLPATH
="$(KERNEL_CROSS)" \
202 KERNELPATH
="$(LINUX_DIR)" \
203 LDOPTS
="--no-warn-mismatch " \
204 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
205 ATH_CAP_SUPERG_COMP
="$(COMPRESSION)" \
207 INCS
="$(MADWIFI_INC)" \
208 $(if
$(CONFIG_MADWIFI_DEBUG
),,DEBUG
=) WARNINGS
="-Wno-unused"
211 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
213 ifeq ($(CONFIG_MADWIFI_UPSTREAM
),)
214 define Build
/Prepare
/HAL
215 rm -rf
$(PKG_BUILD_DIR
)/tmp
216 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
217 tar xvzf
$(DL_DIR
)/$(HAL_FILE
) -C
$(PKG_BUILD_DIR
)/tmp
218 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
219 rm -rf
$(PKG_BUILD_DIR
)/tmp
224 $(call Build
/Prepare
/Default
)
225 $(call Build
/Prepare
/HAL
)
227 $(SED
) 's, -E[LB],,' \
229 -e
's, -mapcs-32,,' \
230 $(PKG_BUILD_DIR
)/hal
/public
/*.inc
231 $(SED
) 's,march=armv4,march=armv5te,' \
232 $(PKG_BUILD_DIR
)/hal
/public
/xscale
*.inc
235 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
236 define Build
/Compile
/ahb
237 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
238 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
242 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
243 define Build
/Compile
/pci
244 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
245 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
249 define Build
/Configure
250 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
254 $(call Build
/Compile
/ahb
)
255 $(call Build
/Compile
/pci
)
258 define Build
/InstallDev
259 mkdir
-p
$(1)/usr
/include/madwifi
260 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
261 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
262 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
265 define KernelPackage
/madwifi
/install
266 $(INSTALL_DIR
) $(1)/usr
/sbin
267 $(CP
) .
/files
/* $(1)/
268 $(CP
) $(foreach applet
,$(MADWIFI_APPLETS
),$(PKG_BUILD_DIR
)/tools
/$(applet
)) $(1)/usr
/sbin
/
271 $(eval
$(call KernelPackage
,madwifi
))