1 KMODDIR?= updates
2 KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
3 ifneq ($(origin $(KLIB)), undefined)
4 KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
5 else
6 KLIB:= /lib/modules/$(shell uname -r)
7 endif
8 export KLIB_BUILD ?= $(KLIB)/build
9 # Sometimes not available in the path
10 MODPROBE := /sbin/modprobe
11 MADWIFI=$(shell $(MODPROBE) -l ath_pci)
13 ifneq ($(KERNELRELEASE),)
15 include $(M)/$(COMPAT_CONFIG)
17 NOSTDINC_FLAGS := -I$(M)/include/ -include $(M)/include/net/compat.h $(CFLAGS)
19 obj-y := net/wireless/ net/mac80211/
20 ifeq ($(ONLY_CORE),)
21 obj-y += net/ieee80211/ \
22 drivers/ssb/ \
23 drivers/misc/ \
24 drivers/net/usb/ \
25 drivers/net/wireless/
26 endif
28 else
30 export PWD := $(shell pwd)
32 # These exported as they are used by the scripts
33 # to check config and compat autoconf
34 export COMPAT_CONFIG=config.mk
35 export CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt
36 export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
37 export CREL=$(shell cat $(PWD)/compat-release)
38 export CREL_PRE:=.compat_autoconf_
39 export CREL_CHECK:=$(CREL_PRE)$(CREL)
41 include $(PWD)/$(COMPAT_CONFIG)
43 all: modules
45 modules: $(CREL_CHECK)
46 @./scripts/check_config.sh
47 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
49 # With the above and this we make sure we generate a new compat autoconf per
50 # new relase of compat-wireless-2.6 OR when the user updates the
51 # $(COMPAT_CONFIG) file
52 $(CREL_CHECK):
53 @# Force to regenerate compat autoconf
54 @rm -f $(CONFIG_CHECK)
55 @./scripts/check_config.sh
56 @touch $@
57 @md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
59 install: uninstall modules
60 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
61 modules_install
62 @# All the scripts we can use
63 @mkdir -p /usr/lib/compat-wireless/
64 @install scripts/modlib.sh /usr/lib/compat-wireless/
65 @install scripts/madwifi-unload /usr/sbin/
66 @# This is to allow switching between drivers without blacklisting
67 @install scripts/athenable /usr/sbin/
68 @install scripts/b43enable /usr/sbin/
69 @install scripts/athload /usr/sbin/
70 @install scripts/b43load /usr/sbin/
71 @if [ ! -z $(MADWIFI) ]; then \
72 echo ;\
73 echo -n "Note: madwifi detected, we're going to disable it. " ;\
74 echo "If you would like to enable it later you can run:" ;\
75 echo " sudo athenable madwifi" ;\
76 echo ;\
77 echo Running athenable ath5k...;\
78 /usr/sbin/athenable ath5k ;\
79 fi
80 @/sbin/depmod -ae
81 @echo
82 @echo "Currently detected wireless subsystem modules:"
83 @echo
84 @$(MODPROBE) -l mac80211
85 @# rc80211_simple is a module only on 2.6.22 and 2.6.23
86 @$(MODPROBE) -l cfg80211
87 @$(MODPROBE) -l lib80211
88 @$(MODPROBE) -l adm8211
89 @$(MODPROBE) -l at76_usb
90 @$(MODPROBE) -l ath5k
91 @$(MODPROBE) -l ath9k
92 @$(MODPROBE) -l b43
93 @$(MODPROBE) -l b43legacy
94 @$(MODPROBE) -l ssb
95 @$(MODPROBE) -l iwl3945
96 @$(MODPROBE) -l iwl4965
97 @$(MODPROBE) -l ipw2100
98 @$(MODPROBE) -l ipw2200
99 @$(MODPROBE) -l ieee80211
100 @$(MODPROBE) -l ieee80211_crypt
101 @$(MODPROBE) -l libertas_cs
102 @$(MODPROBE) -l ub8xxx
103 @$(MODPROBE) -l p54_pci
104 @$(MODPROBE) -l p54_usb
105 @$(MODPROBE) -l rt2400pci
106 @$(MODPROBE) -l rt2500pci
107 @$(MODPROBE) -l rt2500usb
108 @$(MODPROBE) -l rt61pci
109 @$(MODPROBE) -l rt73usb
110 @$(MODPROBE) -l usbnet
111 @$(MODPROBE) -l cdc_ether
112 @$(MODPROBE) -l rndis_host
113 @$(MODPROBE) -l rndis_wlan
114 @$(MODPROBE) -l rtl8180
115 @$(MODPROBE) -l rtl8187
116 @$(MODPROBE) -l zd1211rw
117 @echo
118 @echo Now run:
119 @echo
120 @echo make unload
121 @echo
122 @echo And then load the wireless module you need. If unsure run:
123 @echo
124 @echo make load
125 @echo
127 uninstall:
128 @# New location, matches upstream
129 @rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
130 @rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
131 @rm -rf $(KLIB)/$(KMODDIR)/net/ieee80211/
132 @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
133 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
134 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
135 @# Lets only remove the stuff we are sure we are providing
136 @# on the misc directory.
137 @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko
138 @/sbin/depmod -ae
139 @echo
140 @echo "Your old wireless subsystem modules were left intact:"
141 @echo
142 @$(MODPROBE) -l mac80211
143 @$(MODPROBE) -l cfg80211
144 @$(MODPROBE) -l lib80211
145 @$(MODPROBE) -l adm8211
146 @$(MODPROBE) -l ath5k
147 @$(MODPROBE) -l ath9k
148 @$(MODPROBE) -l at76_usb
149 @$(MODPROBE) -l b43
150 @$(MODPROBE) -l b43legacy
151 @$(MODPROBE) -l ssb
152 @$(MODPROBE) -l rc80211_simple
153 @$(MODPROBE) -l iwl3945
154 @$(MODPROBE) -l iwl4965
155 @$(MODPROBE) -l ipw2100
156 @$(MODPROBE) -l ipw2200
157 @$(MODPROBE) -l ieee80211
158 @$(MODPROBE) -l ieee80211_crypt
159 @$(MODPROBE) -l libertas_cs
160 @$(MODPROBE) -l mac80211
161 @$(MODPROBE) -l ub8xxx
162 @$(MODPROBE) -l p54pci
163 @$(MODPROBE) -l p54usb
164 @$(MODPROBE) -l rt2400pci
165 @$(MODPROBE) -l rt2500pci
166 @$(MODPROBE) -l rt2500usb
167 @$(MODPROBE) -l rt61pci
168 @$(MODPROBE) -l rt73usb
169 @$(MODPROBE) -l usbnet
170 @$(MODPROBE) -l cdc_ether
171 @$(MODPROBE) -l rndis_host
172 @$(MODPROBE) -l rndis_wlan
173 @$(MODPROBE) -l rtl8180
174 @$(MODPROBE) -l rtl8187
175 @$(MODPROBE) -l zd1211rw
176 @
177 @echo
179 clean:
180 @if [ -d net -a -d $(KLIB_BUILD) ]; then \
181 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
182 fi
183 @rm -f $(CREL_PRE)*
184 unload:
185 @./scripts/unload.sh
187 load: unload
188 @./scripts/load.sh
190 .PHONY: all clean install uninstall unload load
192 endif
194 clean-files += Module.symvers modules.order $(CREL_CHECK) $(CONFIG_CHECK)