2 # Copyright (C) 2006 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
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
18 PKG_MD5SUM:=a75baacbe07085ddc5cb28e1fb43edbb
21 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 include $(INCLUDE_DIR)/package.mk
28 HAL_TARGET:=mips-be-elf
31 HAL_TARGET:=mips-le-elf
37 HAL_TARGET:=xscale-be-elf
39 ifeq ($(ARCH),powerpc)
40 HAL_TARGET:=powerpc-be-elf
44 ifneq ($(CONFIG_LINUX_2_4_AR531X),)
47 ifneq ($(CONFIG_LINUX_2_6_ARUBA),)
48 BUS:=PCI AHB # no suitable HAL for AHB yet.
52 ifeq ($(findstring AHB,$(BUS)),AHB)
53 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
55 ifeq ($(findstring PCI,$(BUS)),PCI)
56 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
64 ath_rate_$(RATE_CONTROL) \
71 ifeq ($(findstring AHB,$(BUS)),AHB)
72 MADWIFI_AUTOLOAD += ath_ahb
74 ifeq ($(findstring PCI,$(BUS)),PCI)
75 MADWIFI_AUTOLOAD += ath_pci
78 define KernelPackage/madwifi
79 SUBMENU:=Wireless Drivers
80 DEFAULT:=y if LINUX_2_6_BRCM || LINUX_2_6_ARUBA || LINUX_2_4_AR531X || LINUX_2_6_XSCALE, m if ALL
81 TITLE:=Driver for Atheros wireless chipsets
83 This package contains a driver for Atheros 802.11a/b/g chipsets.
84 URL:=http://madwifi.org/
85 VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
87 $(PKG_BUILD_DIR)/ath/ath_hal.$(LINUX_KMOD_SUFFIX) \
89 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
90 $(PKG_BUILD_DIR)/net80211/wlan*.$(LINUX_KMOD_SUFFIX)
91 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
94 MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
95 PATH="$(TARGET_PATH)" \
96 ARCH="$(LINUX_KARCH)" \
97 CROSS_COMPILE="$(TARGET_CROSS)" \
98 TARGET="$(HAL_TARGET)" \
99 TOOLPREFIX="$(KERNEL_CROSS)" \
100 TOOLPATH="$(KERNEL_CROSS)" \
101 KERNELPATH="$(LINUX_DIR)" \
103 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
106 ifeq ($(findstring AHB,$(BUS)),AHB)
107 define Build/Compile/ahb
108 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" modules
112 ifeq ($(findstring PCI,$(BUS)),PCI)
113 define Build/Compile/pci
114 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" modules
119 $(call Build/Compile/ahb)
120 $(call Build/Compile/pci)
121 $(MAKE) $(MADWIFI_MAKEOPTS) \
122 CFLAGS="$(TARGET_CFLAGS)" \
126 define Build/InstallDev
127 mkdir -p $(STAGING_DIR)/usr/include/madwifi
128 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
129 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
130 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
133 define Build/UninstallDev
134 rm -rf $(STAGING_DIR)/usr/include/madwifi
137 define KernelPackage/madwifi/install
138 mkdir -p $(1)/etc/init.d
139 mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
140 mkdir -p $(1)/usr/sbin
141 install -m0755 ./files/madwifi.init $(1)/etc/init.d/madwifi
142 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/
145 $(eval $(call KernelPackage,madwifi))