1 export KMODDIR?= updates
2 KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
3 ifneq ($(origin KLIB), undefined)
4 KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
6 export KLIB:= /lib/modules/$(shell uname -r)
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)
16 ifneq ($(KERNELRELEASE),)
18 NOSTDINC_FLAGS := -I$(M)/include/ -include $(M)/include/linux/compat-2.6.h $(CFLAGS)
22 obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
25 obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
26 obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
28 obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
30 obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/
31 obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/ drivers/misc/eeprom/
34 obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
35 obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
39 export PWD := $(shell pwd)
41 # These exported as they are used by the scripts
42 # to check config and compat autoconf
43 export COMPAT_CONFIG=config.mk
44 export CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt
45 export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
46 export CREL=$(shell cat $(PWD)/compat-release)
47 export CREL_PRE:=.compat_autoconf_
48 export CREL_CHECK:=$(CREL_PRE)$(CREL)
50 include $(PWD)/$(COMPAT_CONFIG)
54 modules: $(CREL_CHECK)
55 @./scripts/check_config.sh
56 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
60 @./scripts/check_config.sh
61 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
64 # With the above and this we make sure we generate a new compat autoconf per
65 # new relase of compat-wireless-2.6 OR when the user updates the
66 # $(COMPAT_CONFIG) file
68 @# Force to regenerate compat autoconf
69 @rm -f $(CONFIG_CHECK)
70 @./scripts/check_config.sh
72 @md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
74 btinstall: btuninstall bt-install-modules
76 bt-install-modules: bt
77 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
81 @echo "Currently detected bluetooth subsystem modules:"
86 @$(MODPROBE) -l rfcomm
89 @$(MODPROBE) -l bluetooth
93 @echo sudo make btunload:
95 @echo And the load the needed bluetooth modules. If unsure reboot.
99 @# New location, matches upstream
100 @rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
101 @rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
102 @# Lets only remove the stuff we are sure we are providing
103 @# on the misc directory.
106 @echo "Your old bluetooth subsystem modules were left intact:"
109 @$(MODPROBE) -l l2cap
111 @$(MODPROBE) -l rfcomm
113 @$(MODPROBE) -l btusb
114 @$(MODPROBE) -l bluetooth
119 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
122 install: uninstall install-modules install-scripts
124 install-modules: modules
125 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
127 @./scripts/update-initramfs
130 @# All the scripts we can use
131 @mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
132 @install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-wireless/
133 @install scripts/madwifi-unload $(DESTDIR)/usr/sbin/
134 @# This is to allow switching between drivers without blacklisting
135 @install scripts/athenable $(DESTDIR)/usr/sbin/
136 @install scripts/b43enable $(DESTDIR)/usr/sbin/
137 @install scripts/iwl-enable $(DESTDIR)/usr/sbin/
138 @install scripts/athload $(DESTDIR)/usr/sbin/
139 @install scripts/b43load $(DESTDIR)/usr/sbin/
140 @install scripts/iwl-load $(DESTDIR)/usr/sbin/
141 @if [ ! -z "$(MADWIFI)" ] && [ -z "$(DESTDIR)" ]; then \
143 echo -n "Note: madwifi detected, we're going to disable it. " ;\
144 echo "If you would like to enable it later you can run:" ;\
145 echo " sudo athenable madwifi" ;\
147 echo Running athenable ath5k...;\
148 /usr/sbin/athenable ath5k ;\
150 @if [ ! -z "$(OLD_IWL)" ] && [ -z "$(DESTDIR)" ]; then \
152 echo -n "Note: iwl4965 detected, we're going to disable it. " ;\
153 echo "If you would like to enable it later you can run:" ;\
154 echo " sudo iwl-load iwl4965" ;\
156 echo Running iwl-enable iwlagn...;\
157 /usr/sbin/iwl-enable iwlagn ;\
159 @# If on distributions like Mandriva which like to
160 @# compress their modules this will find out and do
161 @# it for you. Reason is some old version of modutils
162 @# won't know mac80211.ko should be used instead of
164 @./scripts/compress_modules
165 @# Mandrake doesn't have a depmod.d/ conf file to prefer
166 @# the updates/ dir which is what we use so we add one for it
167 @# (or any other distribution that doens't have this).
168 @./scripts/check_depmod
169 @# Udev stuff needed for the new compat_firmware_class.
170 @./compat/scripts/compat_firmware_install
173 @echo "Currently detected wireless subsystem modules:"
175 @$(MODPROBE) -l mac80211
176 @$(MODPROBE) -l cfg80211
177 @$(MODPROBE) -l lib80211
178 @$(MODPROBE) -l adm8211
179 @$(MODPROBE) -l ar9170usb
180 @$(MODPROBE) -l at76c50x-usb
182 @$(MODPROBE) -l ath5k
183 @$(MODPROBE) -l ath9k
185 @$(MODPROBE) -l b43legacy
187 @$(MODPROBE) -l cdc_ether
188 @$(MODPROBE) -l eeprom_93cx6
189 @$(MODPROBE) -l ipw2100
190 @$(MODPROBE) -l ipw2200
191 @$(MODPROBE) -l iwl3945
192 @$(MODPROBE) -l iwlagn
193 @$(MODPROBE) -l iwlcore
194 @$(MODPROBE) -l lib80211_crypt_ccmp
195 @$(MODPROBE) -l lib80211_crypt_tkip
196 @$(MODPROBE) -l lib80211_crypt_wep
197 @$(MODPROBE) -l libertas
198 @$(MODPROBE) -l libertas_cs
199 @$(MODPROBE) -l libertas_sdio
200 @$(MODPROBE) -l libertas_spi
201 @$(MODPROBE) -l libertas_tf
202 @$(MODPROBE) -l libertas_tf_usb
203 @$(MODPROBE) -l libipw
204 @$(MODPROBE) -l mac80211_hwsim
205 @$(MODPROBE) -l mwl8k
206 @$(MODPROBE) -l p54common
207 @$(MODPROBE) -l p54pci
208 @$(MODPROBE) -l p54spi
209 @$(MODPROBE) -l p54usb
210 @$(MODPROBE) -l rndis_host
211 @$(MODPROBE) -l rndis_wlan
212 @$(MODPROBE) -l rt2400pci
213 @$(MODPROBE) -l rt2500pci
214 @$(MODPROBE) -l rt2500usb
215 @$(MODPROBE) -l rt2x00lib
216 @$(MODPROBE) -l rt2x00pci
217 @$(MODPROBE) -l rt2x00usb
218 @$(MODPROBE) -l rt61pci
219 @$(MODPROBE) -l rt73usb
220 @$(MODPROBE) -l rtl8180
221 @$(MODPROBE) -l rtl8187
223 @$(MODPROBE) -l usb8xxx
224 @$(MODPROBE) -l usbnet
225 @$(MODPROBE) -l zd1211rw
227 @echo "Currently detected bluetooth subsystem modules:"
230 @$(MODPROBE) -l l2cap
232 @$(MODPROBE) -l rfcomm
234 @$(MODPROBE) -l btusb
235 @$(MODPROBE) -l bluetooth
239 @echo sudo make unload to unload both wireless and bluetooth modules
240 @echo sudo make wlunload to unload wireless modules
241 @echo sudo make btunload to unload bluetooth modules
243 @echo And then load the wireless or bluetooth module you need. If unsure reboot.
244 @echo Alternatively use "sudo make load/wlload/btload" to load modules
248 @# New location, matches upstream
249 @rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
250 @rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/
251 @rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
252 @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
253 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
254 @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
255 @# Lets only remove the stuff we are sure we are providing
256 @# on the misc directory.
257 @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko*
258 @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko*
259 @rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko*
262 @echo "Your old wireless subsystem modules were left intact:"
264 @$(MODPROBE) -l mac80211
265 @$(MODPROBE) -l cfg80211
266 @$(MODPROBE) -l lib80211
267 @$(MODPROBE) -l adm8211
268 @$(MODPROBE) -l ar9170usb
269 @$(MODPROBE) -l at76c50x-usb
271 @$(MODPROBE) -l ath5k
272 @$(MODPROBE) -l ath9k
274 @$(MODPROBE) -l b43legacy
276 @$(MODPROBE) -l cdc_ether
277 @$(MODPROBE) -l eeprom_93cx6
278 @$(MODPROBE) -l ipw2100
279 @$(MODPROBE) -l ipw2200
280 @$(MODPROBE) -l iwl3945
281 @$(MODPROBE) -l iwlagn
282 @$(MODPROBE) -l iwlcore
283 @$(MODPROBE) -l lib80211_crypt_ccmp
284 @$(MODPROBE) -l lib80211_crypt_tkip
285 @$(MODPROBE) -l lib80211_crypt_wep
286 @$(MODPROBE) -l libertas
287 @$(MODPROBE) -l libertas_cs
288 @$(MODPROBE) -l libertas_sdio
289 @$(MODPROBE) -l libertas_spi
290 @$(MODPROBE) -l libertas_tf
291 @$(MODPROBE) -l libertas_tf_usb
292 @$(MODPROBE) -l libipw
293 @$(MODPROBE) -l mac80211_hwsim
294 @$(MODPROBE) -l mwl8k
295 @$(MODPROBE) -l p54common
296 @$(MODPROBE) -l p54pci
297 @$(MODPROBE) -l p54spi
298 @$(MODPROBE) -l p54usb
299 @$(MODPROBE) -l rndis_host
300 @$(MODPROBE) -l rndis_wlan
301 @$(MODPROBE) -l rt2400pci
302 @$(MODPROBE) -l rt2500pci
303 @$(MODPROBE) -l rt2500usb
304 @$(MODPROBE) -l rt2x00lib
305 @$(MODPROBE) -l rt2x00pci
306 @$(MODPROBE) -l rt2x00usb
307 @$(MODPROBE) -l rt61pci
308 @$(MODPROBE) -l rt73usb
309 @$(MODPROBE) -l rtl8180
310 @$(MODPROBE) -l rtl8187
312 @$(MODPROBE) -l usb8xxx
313 @$(MODPROBE) -l usbnet
314 @$(MODPROBE) -l zd1211rw
316 @echo "Your old bluetooth subsystem modules were left intact:"
319 @$(MODPROBE) -l l2cap
321 @$(MODPROBE) -l rfcomm
323 @$(MODPROBE) -l btusb
324 @$(MODPROBE) -l bluetooth
329 @if [ -d net -a -d $(KLIB_BUILD) ]; then \
330 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
340 @./scripts/btunload.sh
346 @./scripts/wlunload.sh
351 .PHONY: all clean install uninstall unload load btunload btload wlunload wlload modules bt
355 clean-files += Module.symvers Module.markers modules modules.order
356 clean-files += $(CREL_CHECK) $(CONFIG_CHECK)