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