1 export KMODDIR?= updates
2 KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
3 ifneq ($(origin KLIB), undefined)
4 KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
5 else
6 export 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)
12 OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
14 DESTDIR?=
16 ifneq ($(KERNELRELEASE),)
18 NOSTDINC_FLAGS := -I$(M)/include/ \
19 -include $(M)/include/linux/compat-2.6.h \
20 $(CFLAGS)
22 obj-y := compat/
24 obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
26 ifeq ($(BT),)
27 obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
28 obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
30 obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
32 obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/
33 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/ drivers/misc/eeprom/
34 endif
36 obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
37 obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
39 else
41 export PWD := $(shell pwd)
42 CFLAGS += \
43 -DCOMPAT_BASE_TREE="\"$(shell cat compat_base_tree)\"" \
44 -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat compat_base_tree_version)\"" \
45 -DCOMPAT_PROJECT="\"Compat-wireless\"" \
46 -DCOMPAT_VERSION="\"$(shell cat compat_version)\""
48 # These exported as they are used by the scripts
49 # to check config and compat autoconf
50 export COMPAT_CONFIG=config.mk
51 export CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt
52 export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
53 export CREL=$(shell cat $(PWD)/compat_version)
54 export CREL_PRE:=.compat_autoconf_
55 export CREL_CHECK:=$(CREL_PRE)$(CREL)
57 include $(PWD)/$(COMPAT_CONFIG)
59 all: modules
61 modules: $(CREL_CHECK)
62 @./scripts/check_config.sh
63 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
64 @touch $@
66 bt: $(CREL_CHECK)
67 @./scripts/check_config.sh
68 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
69 @touch $@
71 # With the above and this we make sure we generate a new compat autoconf per
72 # new relase of compat-wireless-2.6 OR when the user updates the
73 # $(COMPAT_CONFIG) file
74 $(CREL_CHECK):
75 @# Force to regenerate compat autoconf
76 @rm -f $(CONFIG_CHECK)
77 @./scripts/check_config.sh
78 @touch $@
79 @md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
81 btinstall: btuninstall bt-install-modules
83 bt-install-modules: bt
84 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
85 modules_install
86 @/sbin/depmod -ae
87 @echo
88 @echo "Currently detected bluetooth subsystem modules:"
89 @echo
90 @$(MODPROBE) -l sco
91 @$(MODPROBE) -l l2cap
92 @$(MODPROBE) -l hidp
93 @$(MODPROBE) -l rfcomm
94 @$(MODPROBE) -l bnep
95 @$(MODPROBE) -l btusb
96 @$(MODPROBE) -l bluetooth
97 @echo
98 @echo Now run:
99 @echo
100 @echo sudo make btunload:
101 @echo
102 @echo And the load the needed bluetooth modules. If unsure reboot.
103 @echo
105 btuninstall:
106 @# New location, matches upstream
107 @rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
108 @rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
109 @# Lets only remove the stuff we are sure we are providing
110 @# on the misc directory.
111 @/sbin/depmod -ae
112 @echo
113 @echo "Your old bluetooth subsystem modules were left intact:"
114 @echo
115 @$(MODPROBE) -l sco
116 @$(MODPROBE) -l l2cap
117 @$(MODPROBE) -l hidp
118 @$(MODPROBE) -l rfcomm
119 @$(MODPROBE) -l bnep
120 @$(MODPROBE) -l btusb
121 @$(MODPROBE) -l bluetooth
122 @
123 @echo
125 btclean:
126 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
127 @rm -f $(CREL_PRE)*
129 install: uninstall install-modules install-scripts
131 install-modules: modules
132 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
133 modules_install
134 @./scripts/update-initramfs
136 install-scripts:
137 @# All the scripts we can use
138 @mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
139 @install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-wireless/
140 @install scripts/madwifi-unload $(DESTDIR)/usr/sbin/
141 @# This is to allow switching between drivers without blacklisting
142 @install scripts/athenable $(DESTDIR)/usr/sbin/
143 @install scripts/b43enable $(DESTDIR)/usr/sbin/
144 @install scripts/iwl-enable $(DESTDIR)/usr/sbin/
145 @install scripts/athload $(DESTDIR)/usr/sbin/
146 @install scripts/b43load $(DESTDIR)/usr/sbin/
147 @install scripts/iwl-load $(DESTDIR)/usr/sbin/
148 @if [ ! -z "$(MADWIFI)" ] && [ -z "$(DESTDIR)" ]; then \
149 echo ;\
150 echo -n "Note: madwifi detected, we're going to disable it. " ;\
151 echo "If you would like to enable it later you can run:" ;\
152 echo " sudo athenable madwifi" ;\
153 echo ;\
154 echo Running athenable ath5k...;\
155 /usr/sbin/athenable ath5k ;\
156 fi
157 @if [ ! -z "$(OLD_IWL)" ] && [ -z "$(DESTDIR)" ]; then \
158 echo ;\
159 echo -n "Note: iwl4965 detected, we're going to disable it. " ;\
160 echo "If you would like to enable it later you can run:" ;\
161 echo " sudo iwl-load iwl4965" ;\
162 echo ;\
163 echo Running iwl-enable iwlagn...;\
164 /usr/sbin/iwl-enable iwlagn ;\
165 fi
166 @# If on distributions like Mandriva which like to
167 @# compress their modules this will find out and do
168 @# it for you. Reason is some old version of modutils
169 @# won't know mac80211.ko should be used instead of
170 @# mac80211.ko.gz
171 @./scripts/compress_modules
172 @# Mandrake doesn't have a depmod.d/ conf file to prefer
173 @# the updates/ dir which is what we use so we add one for it
174 @# (or any other distribution that doens't have this).
175 @./scripts/check_depmod
176 @# Udev stuff needed for the new compat_firmware_class.
177 @./compat/scripts/compat_firmware_install
178 @/sbin/depmod -a
179 @echo
180 @echo "Currently detected wireless subsystem modules:"
181 @echo
182 @$(MODPROBE) -l mac80211
183 @$(MODPROBE) -l cfg80211
184 @$(MODPROBE) -l lib80211
185 @$(MODPROBE) -l adm8211
186 @$(MODPROBE) -l ar9170usb
187 @$(MODPROBE) -l at76c50x-usb
188 @$(MODPROBE) -l ath
189 @$(MODPROBE) -l ath5k
190 @$(MODPROBE) -l ath9k
191 @$(MODPROBE) -l b43
192 @$(MODPROBE) -l b43legacy
193 @$(MODPROBE) -l b44
194 @$(MODPROBE) -l cdc_ether
195 @$(MODPROBE) -l eeprom_93cx6
196 @$(MODPROBE) -l ipw2100
197 @$(MODPROBE) -l ipw2200
198 @$(MODPROBE) -l iwl3945
199 @$(MODPROBE) -l iwlagn
200 @$(MODPROBE) -l iwlcore
201 @$(MODPROBE) -l lib80211_crypt_ccmp
202 @$(MODPROBE) -l lib80211_crypt_tkip
203 @$(MODPROBE) -l lib80211_crypt_wep
204 @$(MODPROBE) -l libertas
205 @$(MODPROBE) -l libertas_cs
206 @$(MODPROBE) -l libertas_sdio
207 @$(MODPROBE) -l libertas_spi
208 @$(MODPROBE) -l libertas_tf
209 @$(MODPROBE) -l libertas_tf_usb
210 @$(MODPROBE) -l libipw
211 @$(MODPROBE) -l mac80211_hwsim
212 @$(MODPROBE) -l mwl8k
213 @$(MODPROBE) -l p54common
214 @$(MODPROBE) -l p54pci
215 @$(MODPROBE) -l p54spi
216 @$(MODPROBE) -l p54usb
217 @$(MODPROBE) -l rndis_host
218 @$(MODPROBE) -l rndis_wlan
219 @$(MODPROBE) -l rt2400pci
220 @$(MODPROBE) -l rt2500pci
221 @$(MODPROBE) -l rt2500usb
222 @$(MODPROBE) -l rt2x00lib
223 @$(MODPROBE) -l rt2x00pci
224 @$(MODPROBE) -l rt2x00usb
225 @$(MODPROBE) -l rt61pci
226 @$(MODPROBE) -l rt73usb
227 @$(MODPROBE) -l rtl8180
228 @$(MODPROBE) -l rtl8187
229 @$(MODPROBE) -l ssb
230 @$(MODPROBE) -l usb8xxx
231 @$(MODPROBE) -l usbnet
232 @$(MODPROBE) -l zd1211rw
233 @echo
234 @echo "Currently detected bluetooth subsystem modules:"
235 @echo
236 @$(MODPROBE) -l sco
237 @$(MODPROBE) -l l2cap
238 @$(MODPROBE) -l hidp
239 @$(MODPROBE) -l rfcomm
240 @$(MODPROBE) -l bnep
241 @$(MODPROBE) -l btusb
242 @$(MODPROBE) -l bluetooth
243 @echo
244 @echo Now run:
245 @echo
246 @echo sudo make unload to unload both wireless and bluetooth modules
247 @echo sudo make wlunload to unload wireless modules
248 @echo sudo make btunload to unload bluetooth modules
249 @echo
250 @echo And then load the wireless or bluetooth module you need. If unsure reboot.
251 @echo Alternatively use "sudo make load/wlload/btload" to load modules
252 @echo
254 uninstall:
255 @# New location, matches upstream
256 @rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
257 @rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/
258 @rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
259 @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
260 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
261 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
262 @# Lets only remove the stuff we are sure we are providing
263 @# on the misc directory.
264 @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko*
265 @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko*
266 @rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko*
267 @/sbin/depmod -a
268 @echo
269 @echo "Your old wireless subsystem modules were left intact:"
270 @echo
271 @$(MODPROBE) -l mac80211
272 @$(MODPROBE) -l cfg80211
273 @$(MODPROBE) -l lib80211
274 @$(MODPROBE) -l adm8211
275 @$(MODPROBE) -l ar9170usb
276 @$(MODPROBE) -l at76c50x-usb
277 @$(MODPROBE) -l ath
278 @$(MODPROBE) -l ath5k
279 @$(MODPROBE) -l ath9k
280 @$(MODPROBE) -l b43
281 @$(MODPROBE) -l b43legacy
282 @$(MODPROBE) -l b44
283 @$(MODPROBE) -l cdc_ether
284 @$(MODPROBE) -l eeprom_93cx6
285 @$(MODPROBE) -l ipw2100
286 @$(MODPROBE) -l ipw2200
287 @$(MODPROBE) -l iwl3945
288 @$(MODPROBE) -l iwlagn
289 @$(MODPROBE) -l iwlcore
290 @$(MODPROBE) -l lib80211_crypt_ccmp
291 @$(MODPROBE) -l lib80211_crypt_tkip
292 @$(MODPROBE) -l lib80211_crypt_wep
293 @$(MODPROBE) -l libertas
294 @$(MODPROBE) -l libertas_cs
295 @$(MODPROBE) -l libertas_sdio
296 @$(MODPROBE) -l libertas_spi
297 @$(MODPROBE) -l libertas_tf
298 @$(MODPROBE) -l libertas_tf_usb
299 @$(MODPROBE) -l libipw
300 @$(MODPROBE) -l mac80211_hwsim
301 @$(MODPROBE) -l mwl8k
302 @$(MODPROBE) -l p54common
303 @$(MODPROBE) -l p54pci
304 @$(MODPROBE) -l p54spi
305 @$(MODPROBE) -l p54usb
306 @$(MODPROBE) -l rndis_host
307 @$(MODPROBE) -l rndis_wlan
308 @$(MODPROBE) -l rt2400pci
309 @$(MODPROBE) -l rt2500pci
310 @$(MODPROBE) -l rt2500usb
311 @$(MODPROBE) -l rt2x00lib
312 @$(MODPROBE) -l rt2x00pci
313 @$(MODPROBE) -l rt2x00usb
314 @$(MODPROBE) -l rt61pci
315 @$(MODPROBE) -l rt73usb
316 @$(MODPROBE) -l rtl8180
317 @$(MODPROBE) -l rtl8187
318 @$(MODPROBE) -l ssb
319 @$(MODPROBE) -l usb8xxx
320 @$(MODPROBE) -l usbnet
321 @$(MODPROBE) -l zd1211rw
322 @echo
323 @echo "Your old bluetooth subsystem modules were left intact:"
324 @echo
325 @$(MODPROBE) -l sco
326 @$(MODPROBE) -l l2cap
327 @$(MODPROBE) -l hidp
328 @$(MODPROBE) -l rfcomm
329 @$(MODPROBE) -l bnep
330 @$(MODPROBE) -l btusb
331 @$(MODPROBE) -l bluetooth
332 @
333 @echo
335 clean:
336 @if [ -d net -a -d $(KLIB_BUILD) ]; then \
337 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
338 fi
339 @rm -f $(CREL_PRE)*
340 unload:
341 @./scripts/unload.sh
343 load: unload
344 @./scripts/load.sh
346 btunload:
347 @./scripts/btunload.sh
349 btload: btunload
350 @./scripts/btload.sh
352 wlunload:
353 @./scripts/wlunload.sh
355 wlload: wlunload
356 @./scripts/wlload.sh
358 .PHONY: all clean install uninstall unload load btunload btload wlunload wlload modules bt
360 endif
362 clean-files += Module.symvers Module.markers modules modules.order
363 clean-files += $(CREL_CHECK) $(CONFIG_CHECK)