source: trunk/package/madwifi/Makefile @ 31138

Last change on this file since 31138 was 31138, checked in by nbd, 4 years ago

madwifi: fix compile issues with linux 3.1/3.2

  • Property svn:copyright set to Copyright (C) 2006 OpenWrt.org
  • Property svn:eol-style set to native
File size: 6.4 KB
Line 
1#
2# Copyright (C) 2006-2009 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9include $(INCLUDE_DIR)/kernel.mk
10
11PKG_NAME:=madwifi
12
13PKG_REV:=3314
14PKG_VERSION:=r$(PKG_REV)
15PKG_RELEASE:=6
16
17PKG_SOURCE_PROTO:=svn
18PKG_SOURCE_VERSION:=$(PKG_REV)
19PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
20PKG_SOURCE_URL:=http://madwifi-project.org/svn/madwifi/$(if $(PKG_BRANCH),branches/$(PKG_BRANCH),trunk)
21PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
22
23PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
24
25HAL_VERSION:=20090508
26HAL_FILE:=ath_hal-$(HAL_VERSION).tgz
27HAL_MD5SUM:=4ab7ae8bdb96c0be388c98bf8f92d5ca
28
29PKG_BUILD_DEPENDS:=wprobe
30
31include $(INCLUDE_DIR)/package.mk
32
33ifdef CONFIG_MADWIFI_COMPRESSION
34  COMPRESSION:=1
35else
36  COMPRESSION:=0
37endif
38
39define Download/hal
40  FILE:=$(HAL_FILE)
41  URL:=http://mirror2.openwrt.org/sources
42  MD5SUM:=$(HAL_MD5SUM)
43endef
44$(eval $(call Download,hal))
45
46
47ifneq ($(CONFIG_TARGET_atheros),)
48  BUS:=AHB
49else
50  ifneq ($(CONFIG_PCI_SUPPORT),)
51    BUS:=PCI
52  endif
53endif
54
55ifneq ($(CONFIG_CPU_MIPS32_R2),)
56  ifeq ($(ARCH),mips)
57    HAL_TARGET:=mips32r2-be-elf
58  endif
59  ifeq ($(ARCH),mipsel)
60    HAL_TARGET:=mips32r2-le-elf
61  endif
62else
63  ifeq ($(ARCH),mips)
64    HAL_TARGET:=mips32-be-elf
65  endif
66  ifeq ($(ARCH),mipsel)
67    HAL_TARGET:=mips32-le-elf
68  endif
69endif
70ifeq ($(ARCH),i386)
71  HAL_TARGET:=i386-elf
72endif
73ifeq ($(ARCH),i686)
74  HAL_TARGET:=i386-elf
75endif
76ifeq ($(ARCH),armeb)
77  HAL_TARGET:=xscale-be-elfgnueabi
78endif
79ifeq ($(ARCH),arm)
80  HAL_TARGET:=xscale-le-elfgnueabi
81  ifeq ($(BOARD),cns21xx)
82    HAL_TARGET:=armv4-le-elfgnueabi
83  endif
84  ifeq ($(BOARD),cns3xxx)
85    HAL_TARGET:=arm11-le-elfgnueabi
86  endif
87  ifeq ($(BOARD),gemini)
88    HAL_TARGET:=armv4-le-elfgnueabi
89  endif
90endif
91ifeq ($(ARCH),powerpc)
92  HAL_TARGET:=powerpc-be-elf
93endif
94ifneq ($(CONFIG_TARGET_atheros),)
95  HAL_TARGET:=wisoc
96endif
97
98ifdef CONFIG_MADWIFI_RCA_MINSTREL
99  RATE_CONTROL:=minstrel
100endif
101
102ifdef CONFIG_MADWIFI_RCA_ONOE
103  RATE_CONTROL:=onoe
104endif
105
106ifdef CONFIG_MADWIFI_RCA_AMRR
107  RATE_CONTROL:=amrr
108endif
109
110ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
111  RATE_CONTROL:=sample
112endif
113
114ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
115MADWIFI_FILES:= $(PKG_BUILD_DIR)/ath_hal/ath_hal.ko
116else
117MADWIFI_FILES:= \
118        $(PKG_BUILD_DIR)/net80211/wlan.ko \
119        $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.ko \
120        $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.ko \
121        $(PKG_BUILD_DIR)/ath_hal/ath_hal.ko \
122        $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).ko \
123        $(PKG_BUILD_DIR)/net80211/wlan_acl.ko \
124        $(PKG_BUILD_DIR)/net80211/wlan_ccmp.ko \
125        $(PKG_BUILD_DIR)/net80211/wlan_tkip.ko \
126        $(PKG_BUILD_DIR)/net80211/wlan_wep.ko \
127        $(PKG_BUILD_DIR)/net80211/wlan_xauth.ko
128endif
129
130ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
131  MADWIFI_AUTOLOAD:= ath_hal
132else
133  MADWIFI_AUTOLOAD:= \
134        wlan \
135        wlan_scan_ap \
136        wlan_scan_sta \
137        ath_hal \
138        ath_rate_$(RATE_CONTROL) \
139        wlan_acl \
140        wlan_ccmp \
141        wlan_tkip \
142        wlan_wep \
143        wlan_xauth
144endif
145
146ifeq ($(findstring AHB,$(BUS)),AHB)
147  MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.ko
148  MADWIFI_AUTOLOAD+= ath_ahb
149endif
150ifeq ($(findstring PCI,$(BUS)),PCI)
151  MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.ko
152  MADWIFI_AUTOLOAD+= ath_pci
153endif
154
155MADWIFI_APPLETS:=80211stats athchans athkey athstats wlanconfig ath_info madwifi_multi
156ifdef CONFIG_MADWIFI_DEBUG
157  MADWIFI_APPLETS += athdebug 80211debug
158endif
159
160define KernelPackage/madwifi
161  SUBMENU:=Wireless Drivers
162  TITLE:=Driver for Atheros wireless chipsets
163  URL:=http://madwifi-project.org/
164  DEPENDS:=+wireless-tools @PCI_SUPPORT @(!(TARGET_avr32||TARGET_cobalt||TARGET_ep93xx||TARGET_etrax||TARGET_octeon||TARGET_pxcab||TARGET_sibyte)||BROKEN) +@DRIVER_WEXT_SUPPORT
165  FILES:=$(MADWIFI_FILES)
166  AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
167  MENU:=1
168endef
169
170define KernelPackage/madwifi/description
171 This package contains a driver for Atheros 802.11a/b/g chipsets.
172endef
173
174define KernelPackage/madwifi/config
175        source "$(SOURCE)/Config.in"
176endef
177
178MADWIFI_INC = \
179        -I$(PKG_BUILD_DIR) \
180        -I$(PKG_BUILD_DIR)/include \
181        -I$(PKG_BUILD_DIR)/hal \
182        -I$(PKG_BUILD_DIR)/ath \
183        -I$(PKG_BUILD_DIR)/ath_hal \
184        -I$(PKG_BUILD_DIR)/net80211 \
185        -I$(STAGING_DIR)/usr/include/wprobe \
186        -include $(PKG_BUILD_DIR)/include/compat.h
187
188MAKE_ARGS:= \
189        PATH="$(TARGET_PATH)" \
190        ARCH="$(LINUX_KARCH)" \
191        ARCH-y="$(LINUX_KARCH)" \
192        CROSS_COMPILE="$(TARGET_CROSS)" \
193        TARGET="$(HAL_TARGET)" \
194        TOOLPREFIX="$(KERNEL_CROSS)" \
195        TOOLPATH="$(KERNEL_CROSS)" \
196        KERNELPATH="$(LINUX_DIR)" \
197        LDOPTS="--no-warn-mismatch " \
198        ATH_RATE="$(RATE_CONTROL)" \
199        ATH_CAP_SUPERG_COMP="$(COMPRESSION)" \
200        DO_MULTI=1 \
201        SINGLE_MODULE=$(if $(CONFIG_MADWIFI_SINGLE_MODULE),1) \
202        INCS="$(MADWIFI_INC)" \
203        $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
204
205MAKE_VARS:= \
206        COPTS="-DATH_REVERSE_ENGINEERING=1" \
207
208define Build/Prepare/HAL
209        rm -rf $(PKG_BUILD_DIR)/tmp
210        mkdir -p $(PKG_BUILD_DIR)/tmp
211        tar xvzf $(DL_DIR)/$(HAL_FILE) -C $(PKG_BUILD_DIR)/tmp
212        $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
213        rm -rf $(PKG_BUILD_DIR)/tmp
214endef
215
216define Build/Prepare
217        $(call Build/Prepare/Default)
218        $(call Build/Prepare/HAL)
219        # patch cflags
220        $(SED) 's, -E[LB],,' \
221                -e 's, -mips2,,' \
222                -e 's, -mapcs-32,,' \
223                -e 's, -mlong-calls,,' \
224                $(PKG_BUILD_DIR)/hal/public/*.inc
225        $(SED) 's,march=armv4,march=armv5te,' \
226                $(PKG_BUILD_DIR)/hal/public/xscale*.inc
227endef
228
229ifeq ($(findstring AHB,$(BUS)),AHB)
230  define Build/Compile/ahb
231        $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
232        $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
233  endef
234endif
235
236ifeq ($(findstring PCI,$(BUS)),PCI)
237  define Build/Compile/pci
238        $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
239        $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
240  endef
241endif
242
243define Build/Configure
244        $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
245endef
246
247define Build/Compile
248        $(call Build/Compile/ahb)
249        $(call Build/Compile/pci)
250endef
251
252define Build/InstallDev
253        mkdir -p $(1)/usr/include/madwifi
254        $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
255        mkdir -p $(1)/usr/include/madwifi/net80211
256        $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
257endef
258
259define KernelPackage/madwifi/install
260        $(INSTALL_DIR) $(1)/usr/sbin
261        $(CP) ./files/* $(1)/
262        $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
263endef
264
265$(eval $(call KernelPackage,madwifi))
Note: See TracBrowser for help on using the repository browser.