2 # Copyright (C) 2006-2008 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 PKG_VERSION
:=r
$(PKG_REV
)
15 # PKG_BRANCH:=madwifi-dfs
19 PKG_SOURCE_VERSION
:=$(PKG_REV
)
20 PKG_SOURCE_SUBDIR
:=$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
21 PKG_SOURCE_URL
:=http
://svn.madwifi.org
/madwifi
/$(if
$(PKG_BRANCH
),branches
/$(PKG_BRANCH
),trunk
)
22 PKG_SOURCE
:=$(PKG_SOURCE_SUBDIR
).
tar.gz
24 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(if
$(PKG_BRANCH
),$(PKG_BRANCH
),madwifi-trunk
)-$(PKG_VERSION
)
26 include $(INCLUDE_DIR
)/package.mk
31 HAL_TARGET
:=mips-be-elf
34 HAL_TARGET
:=mips-le-elf
42 ifeq ($(BOARD
),ixp4xx
)
43 HAL_TARGET
:=xscale-be-elf
45 ifeq ($(BOARD
),iop32x
)
46 HAL_TARGET
:=xscale-le-elf
48 ifeq ($(ARCH
),powerpc
)
49 HAL_TARGET
:=powerpc-be-elf
52 HAL_TARGET
:=armv4-le-elf
55 ifneq ($(CONFIG_TARGET_atheros
),)
59 ifneq ($(CONFIG_PCI_SUPPORT
),)
64 # XXX: remove this check later when we have PCI support properly detected on all targets
65 ifneq ($(CONFIG_TARGET_ar7
)$(CONFIG_TARGET_uml
),)
69 RATE_CONTROL
:=minstrel
72 $(PKG_BUILD_DIR
)/net80211
/wlan.
$(LINUX_KMOD_SUFFIX
) \
73 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_ap.
$(LINUX_KMOD_SUFFIX
) \
74 $(PKG_BUILD_DIR
)/net80211
/wlan_scan_sta.
$(LINUX_KMOD_SUFFIX
) \
75 $(PKG_BUILD_DIR
)/ath_hal
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
76 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
77 $(PKG_BUILD_DIR
)/net80211
/wlan_acl.
$(LINUX_KMOD_SUFFIX
) \
78 $(PKG_BUILD_DIR
)/net80211
/wlan_ccmp.
$(LINUX_KMOD_SUFFIX
) \
79 $(PKG_BUILD_DIR
)/net80211
/wlan_tkip.
$(LINUX_KMOD_SUFFIX
) \
80 $(PKG_BUILD_DIR
)/net80211
/wlan_wep.
$(LINUX_KMOD_SUFFIX
) \
81 $(PKG_BUILD_DIR
)/net80211
/wlan_xauth.
$(LINUX_KMOD_SUFFIX
) \
88 ath_rate_
$(RATE_CONTROL
) \
95 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
96 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
97 MADWIFI_AUTOLOAD
+= ath_ahb
99 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
100 MADWIFI_FILES
+= $(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
101 MADWIFI_AUTOLOAD
+= ath_pci
104 MADWIFI_APPLETS
:=80211stats
,athchans
,athctrl
,athkey
,athstats
,wlanconfig
105 ifneq ($(MADWIFI_DEBUG
),)
106 MADWIFI_APPLETS
:=$(strip $(MADWIFI_APPLETS
)),athdebug
,80211debug
110 define KernelPackage
/madwifi
111 SUBMENU
:=Wireless Drivers
112 TITLE
:=Driver for Atheros wireless chipsets
113 URL
:=http
://madwifi.org
/
114 DEPENDS
:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @
!TARGET_ar7 @
!TARGET_avr32 @
!TARGET_etrax @
!TARGET_uml
115 FILES
:=$(MADWIFI_FILES
)
116 AUTOLOAD
:=$(call AutoLoad
,50,$(MADWIFI_AUTOLOAD
))
119 define KernelPackage
/madwifi
/description
120 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
124 PATH
="$(TARGET_PATH)" \
125 ARCH
="$(LINUX_KARCH)" \
126 CROSS_COMPILE
="$(TARGET_CROSS)" \
127 TARGET
="$(HAL_TARGET)" \
128 TOOLPREFIX
="$(KERNEL_CROSS)" \
129 TOOLPATH
="$(KERNEL_CROSS)" \
130 KERNELPATH
="$(LINUX_DIR)" \
131 LDOPTS
="--no-warn-mismatch " \
132 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
133 WARNINGS
="-Wno-unused" \
134 $(if
$(MADWIFI_DEBUG
),,DEBUG
="") \
138 COPTS
="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
140 HALFILE
:=$(lastword
$(sort $(wildcard .
/ath_hal-
*.tgz
)))
143 $(call Build
/Prepare
/Default
)
144 rm -rf
$(PKG_BUILD_DIR
)/tmp
145 mkdir
-p
$(PKG_BUILD_DIR
)/tmp
146 tar xvzf
$(HALFILE
) -C
$(PKG_BUILD_DIR
)/tmp
147 $(CP
) $(PKG_BUILD_DIR
)/tmp
/ath_hal
*/* $(PKG_BUILD_DIR
)/hal
/
148 rm -rf
$(PKG_BUILD_DIR
)/tmp
152 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
153 define Build
/Compile
/ahb
154 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="AHB" modules
155 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
159 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
160 define Build
/Compile
/pci
161 $(MAKE_VARS
) $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) BUS
="PCI" modules
162 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_ARGS
) CFLAGS
="$(TARGET_CFLAGS)" tools
166 define Build
/Configure
167 $(SED
) 's,-E[LB] ,,g' $(PKG_BUILD_DIR
)/hal
/public
/*.inc
171 $(call Build
/Compile
/ahb
)
172 $(call Build
/Compile
/pci
)
175 define Build
/InstallDev
176 mkdir
-p
$(1)/usr
/include/madwifi
177 $(CP
) $(PKG_BUILD_DIR
)/include $(1)/usr
/include/madwifi
/
178 mkdir
-p
$(1)/usr
/include/madwifi
/net80211
179 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(1)/usr
/include/madwifi
/net80211
/
182 define KernelPackage
/madwifi
/install
183 $(INSTALL_DIR
) $(1)/lib
/wifi
184 $(INSTALL_DATA
) .
/files
/lib
/wifi
/madwifi.sh
$(1)/lib
/wifi
185 $(INSTALL_DIR
) $(1)/usr
/sbin
186 $(CP
) $(PKG_BUILD_DIR
)/tools
/{madwifi_multi
,$(MADWIFI_APPLETS
)} $(1)/usr
/sbin
/
189 $(eval
$(call KernelPackage
,madwifi
))