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
25 define Package
/kmod-madwifi
27 CATEGORY
:=Kernel drivers
28 DEFAULT
:=y if LINUX_2_6_BRCM || LINUX_2_6_ARUBA || LINUX_2_4_AR531X || LINUX_2_6_XSCALE
, m if ALL
29 TITLE
:=Driver for Atheros wireless chipsets
31 This package contains a driver for Atheros
802.11a
/b
/g chipsets.
32 URL
:=http
://madwifi.org
/
33 VERSION
:=$(LINUX_VERSION
)+$(PKG_VERSION
)-$(BOARD
)-$(PKG_RELEASE
)
39 HAL_TARGET
:=mips-be-elf
42 HAL_TARGET
:=mips-le-elf
48 HAL_TARGET
:=xscale-be-elf
50 ifeq ($(ARCH
),powerpc
)
51 HAL_TARGET
:=powerpc-be-elf
55 ifneq ($(CONFIG_LINUX_2_4_AR531X
),)
58 ifneq ($(CONFIG_LINUX_2_6_ARUBA
),)
59 BUS
:=PCI AHB
# no suitable HAL for AHB yet.
63 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
64 BUS_MODULES
+=$(PKG_BUILD_DIR
)/ath
/ath_ahb.
$(LINUX_KMOD_SUFFIX
)
66 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
67 BUS_MODULES
+=$(PKG_BUILD_DIR
)/ath
/ath_pci.
$(LINUX_KMOD_SUFFIX
)
70 MADWIFI_MAKEOPTS
= -C
$(PKG_BUILD_DIR
) \
71 PATH
="$(TARGET_PATH)" \
72 ARCH
="$(LINUX_KARCH)" \
73 CROSS_COMPILE
="$(TARGET_CROSS)" \
74 TARGET
="$(HAL_TARGET)" \
75 TOOLPREFIX
="$(KERNEL_CROSS)" \
76 TOOLPATH
="$(KERNEL_CROSS)" \
77 KERNELPATH
="$(LINUX_DIR)" \
79 ATH_RATE
="ath_rate/$(RATE_CONTROL)" \
82 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
83 define Build
/Compile
/ahb
84 $(MAKE
) $(MADWIFI_MAKEOPTS
) BUS
="AHB" all
88 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
89 define Build
/Compile
/pci
90 $(MAKE
) $(MADWIFI_MAKEOPTS
) BUS
="PCI" all
95 $(call Build
/Compile
/ahb
)
96 $(call Build
/Compile
/pci
)
99 define Build
/InstallDev
100 mkdir
-p
$(STAGING_DIR
)/usr
/include/madwifi
101 $(CP
) $(PKG_BUILD_DIR
)/include $(STAGING_DIR
)/usr
/include/madwifi
/
102 mkdir
-p
$(STAGING_DIR
)/usr
/include/madwifi
/net80211
103 $(CP
) $(PKG_BUILD_DIR
)/net80211
/*.h
$(STAGING_DIR
)/usr
/include/madwifi
/net80211
/
106 define Build
/UninstallDev
107 rm -rf
$(STAGING_DIR
)/usr
/include/madwifi
110 define Package
/kmod-madwifi
/install
111 mkdir
-p
$(1)/etc
/modules.d
112 mkdir
-p
$(1)/etc
/init.d
113 mkdir
-p
$(1)/lib
/modules
/$(LINUX_VERSION
)
114 mkdir
-p
$(1)/usr
/sbin
115 install -m0644 .
/files
/madwifi.modules
$(1)/etc
/modules.d
/20-madwifi
116 echo ath_rate_
$(RATE_CONTROL
) >> $(1)/etc
/modules.d
/20-madwifi
117 ifeq ($(findstring AHB
,$(BUS
)),AHB
)
118 echo ath_ahb
>> $(1)/etc
/modules.d
/20-madwifi
120 ifeq ($(findstring PCI
,$(BUS
)),PCI
)
121 echo
"ath_pci autocreate=none" >> $(1)/etc
/modules.d
/20-madwifi
123 install -m0755 .
/files
/madwifi.init
$(1)/etc
/init.d
/madwifi
125 $(PKG_BUILD_DIR
)/ath
/ath_hal.
$(LINUX_KMOD_SUFFIX
) \
127 $(PKG_BUILD_DIR
)/ath_rate
/$(RATE_CONTROL
)/ath_rate_
$(RATE_CONTROL
).
$(LINUX_KMOD_SUFFIX
) \
128 $(PKG_BUILD_DIR
)/net80211
/wlan
*.
$(LINUX_KMOD_SUFFIX
) \
129 $(1)/lib
/modules
/$(LINUX_VERSION
)/
130 $(CP
) $(PKG_BUILD_DIR
)/tools
/{madwifi_multi
,80211debug
,80211stats
,athchans
,athctrl
,athdebug
,athkey
,athstats
,wlanconfig
} $(1)/usr
/sbin
/
133 $(eval
$(call BuildPackage
,kmod-madwifi
))