aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2007-11-13 17:00:08 -0500
committerLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2007-11-13 17:00:08 -0500
commitf17daae687f1d6122b44c12498669d1e4c0e2305 (patch)
tree560d168491a694b7e2a455c9a19344dbff655022
parent682166019ab0f0c98c3561c98d76cfbbb94bd3cd (diff)
downloadcompat-wireless-2.6-old-f17daae687f1d6122b44c12498669d1e4c0e2305.tar.gz
* Make driver paths match the kernels
* Use a config.mk, so we get to strip down the compat.diff * Make compat.diff match patches for upstream * include <linux/version.h> on <net/cfg80211.h> as most wireless works uses that. * Lets unlaod MadWifi now automaticaly. Provide scipts to switch back to MadWifi easily if its present. The script is athenable. You can either: athenable ath5k athenable madwifi * Borrow from MadWifi madwifi-unload Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
-rw-r--r--Makefile43
-rw-r--r--README53
-rw-r--r--compat/compat.diff197
-rw-r--r--compat/compat.h30
-rw-r--r--config.mk39
-rwxr-xr-xscripts/admin-update.sh21
-rwxr-xr-xscripts/athenable114
-rwxr-xr-xscripts/madwifi-unload55
-rwxr-xr-xscripts/unload.sh10
9 files changed, 366 insertions, 196 deletions
diff --git a/Makefile b/Makefile
index 4a35731..fbcd64a 100644
--- a/Makefile
+++ b/Makefile
@@ -10,19 +10,19 @@ MADWIFI=$(shell modprobe -l ath_pci)
ifneq ($(KERNELRELEASE),)
+-include $(src)/config.mk
+
# This is a hack! But hey.. it works, got any better ideas, send a patch ;)
NOSTDINC_FLAGS := -I$(PWD)/include/ $(CFLAGS)
-obj-y := wireless/ mac80211/ \
- drivers/ath5k/ \
- drivers/iwlwifi/ \
- drivers/zd1211rw-mac80211/ \
-# drivers/b43/ drivers/ssb/ \
-# b43 needs a bit more compat work
+obj-y := net/wireless/ net/mac80211/ \
+ drivers/net/wireless/ath5k/ \
+ drivers/net/wireless/iwlwifi/ \
+ drivers/net/wireless/zd1211rw-mac80211/ \
+ drivers/net/wireless/b43/ drivers/ssb/ \
else
-PWD := $(shell pwd)
-export PWD
+export PWD := $(shell pwd)
all: modules
@@ -33,15 +33,24 @@ clean:
$(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
install:
+ @# Previous versions of compat installed stuff into different
+ @# directories lets make sure we remove that suff for now.
+ @rm -rf $(KLIB)/$(KMODDIR)/wireless/
+ @rm -rf $(KLIB)/$(KMODDIR)/mac80211/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/ath5k/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/iwlwifi/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/b43/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
@$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
modules_install
@if [ ! -z $(MADWIFI) ]; then \
echo ;\
- echo -n "Note: madwifi detected, rename the module " ;\
- echo "to keep it out of our way, example:" ;\
- echo " sudo mv $(MADWIFI) $(MADWIFI).ignore" ;\
- echo " depmod -ae" ;\
+ echo -n "Note: madwifi detected, we're going to disable it. " ;\
+ echo "If you would like to enable it later you can run:" ;\
+ echo -e "\tsudo ./scripts/athenable madwifi" ;\
echo ;\
+ echo Running scripts/athenable ath5k...;\
+ ./scripts/athenable ath5k ;\
fi
@depmod -ae
@echo
@@ -61,15 +70,17 @@ install:
@echo
uninstall:
- @rm -rf $(KLIB)/$(KMODDIR)/mac80211/
- @rm -rf $(KLIB)/$(KMODDIR)/wireless/
- @rm -rf $(KLIB)/$(KMODDIR)/drivers/
+ @# New location, matches upstream
+ @rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
+ @rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
@depmod -ae
@echo
@echo "Your old wireless subsystem modules were left intact:"
@echo
@modprobe -l mac80211
- @# It is on 2.6.22 and 2.6.23 though
+ @# rc80211_simple is a module on 2.6.22 and 2.6.23 though
@modprobe -l rc80211_simple
@modprobe -l cfg80211
@modprobe -l ath5k
diff --git a/README b/README
index 6154cc7..c83e20b 100644
--- a/README
+++ b/README
@@ -8,6 +8,21 @@ compatibility support since 2.6.22 as that is when mac80211 was introduced
onto the stock kernel. This adds mac80211 and mac80211 drivers as we go on testing
them.
+If you'd like to keep the wireless-2.6 git repository local as well, please read
+out git-guide which explains how to achieve this:
+
+http://linuxwireless.org/en/developers/git-guide
+
+With a local git repository you can update the compatibility package yourself.
+For more information on how to do this please refer the Developers section below.
+
+Documenation
+------------
+
+This package is also documented online.
+
+http://linuxwireless.org/en/users/download
+
Where to get the latest
-----------------------
@@ -15,7 +30,7 @@ This package lets you build your own 'latest', all you need is a local git repos
checkout of wireless-2.6.git. However since not many users are expected to keep
the git repository updated we provide hourly snapshots against the latest at:
-http://linuxwireless.org/download/compat-wireless-2.6/
+http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2
Building, and installing
------------------------
@@ -71,15 +86,21 @@ More compatibility work is needed to add nl80211
* b43:
-We still need to iron out some compat stuff for b43
+We still need to iron out some compatibility issues in order to enable b43.
* MadWifi:
-If MadWifi is present the build system will detect this and only recommend
-what to do. At the present time ath_pci is being picked up over ath5k if both
-are present. What the build system currently suggests is to just rename
-ath_pci.ko to ath_pci.ko.ignore and then running depmod -ae. This is not
-required with ipw3945 and iwl3945.
+If MadWifi is present the build system will detect this and disable it. It
+does this by simply renaming ath_pci.ko to ath_pci.ko.ignore. This lets us
+disable the MadWifi driver without blacklisting it which could cause issues
+with users later. If you would like to enable MadWifi at a later time and
+disable ath5k you can run:
+
+ sudo ./scripts/athenable madwifi
+
+To revert back to ath5k you can run:
+
+ sudo ./scripts/athenable ath5k
Why?
----
@@ -92,6 +113,12 @@ will encourage vendors and developers to post patches upstream first
rather than forking or maintaining their own mac80211 releases with
their own patches for their own drivers.
+How about compatibility work for kernels < 2.6.22 ?
+---------------------------------------------------
+
+Sure, feel free to send patches. The main work was designed to support
+kernels >= 2.6.22 as that was when mac80211 was introduced.
+
Bugs
-----
@@ -141,8 +168,8 @@ To add new drivers:
./scripts/admin-refresh.sh
5. Send patches of the work
-Patches
--------
+Patches for compatibility work
+------------------------------
Please send patches against:
@@ -152,3 +179,11 @@ To: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
CC: linux-wireless@vger.kernel.org
Subject: [PATCH] compat-2.6: add driver foo
+Patches for drivers
+-------------------
+
+If you'd like to send patches for a driver though you can send it using our
+Submitting Patches guideline:
+
+http://linuxwireless.org/en/developers/SubmittingPatches
+
diff --git a/compat/compat.diff b/compat/compat.diff
index 8f9b95f..fa7d120 100644
--- a/compat/compat.diff
+++ b/compat/compat.diff
@@ -1,5 +1,23 @@
---- mac80211/tx.c.old2 2007-11-09 13:14:28.000000000 -0500
-+++ mac80211/tx.c 2007-11-09 15:40:09.000000000 -0500
+--- a/include/net/cfg80211.h.old 2007-11-12 15:35:05.000000000 -0500
++++ b/include/net/cfg80211.h 2007-11-12 15:35:14.000000000 -0500
+@@ -5,6 +5,7 @@
+ #include <linux/skbuff.h>
+ #include <linux/nl80211.h>
+ #include <net/genetlink.h>
++#include <net/compat.h>
+
+ /*
+ * 802.11 configuration in-kernel interface
+--- a/net/mac80211/Makefile 2007-11-10 17:52:07.000000000 -0500
++++ b/net/mac80211/Makefile 2007-11-10 17:52:38.000000000 -0500
+@@ -24,4 +24,5 @@
+ key.o \
+ util.o \
+ event.o \
++ compat.o \
+ $(mac80211-objs-y)
+--- a/net/mac80211/tx.c 2007-11-09 13:14:28.000000000 -0500
++++ b/net/mac80211/tx.c 2007-11-09 15:40:09.000000000 -0500
@@ -18,7 +18,9 @@
#include <linux/etherdevice.h>
#include <linux/bitmap.h>
@@ -10,8 +28,21 @@
#include <net/ieee80211_radiotap.h>
#include <net/cfg80211.h>
#include <net/mac80211.h>
---- mac80211/util.c.old2 2007-11-09 13:14:57.000000000 -0500
-+++ mac80211/util.c 2007-11-09 15:41:40.000000000 -0500
+--- a/net/mac80211/cfg.c 2007-11-10 15:00:10.000000000 -0500
++++ b/net/mac80211/cfg.c 2007-11-10 15:00:21.000000000 -0500
+@@ -8,8 +8,10 @@
+
+ #include <linux/nl80211.h>
+ #include <linux/rtnetlink.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #include <net/net_namespace.h>
++#endif
+ #include <net/cfg80211.h>
+ #include "ieee80211_i.h"
+ #include "cfg.h"
+
+--- a/net/mac80211/util.c 2007-11-09 13:14:57.000000000 -0500
++++ b/net/mac80211/util.c 2007-11-09 15:41:40.000000000 -0500
@@ -20,7 +20,9 @@
#include <linux/if_arp.h>
#include <linux/wireless.h>
@@ -22,8 +53,8 @@
#include <net/cfg80211.h>
#include "ieee80211_i.h"
---- mac80211/ieee80211.c.old2 2007-11-07 12:42:38.000000000 -0500
-+++ mac80211/ieee80211.c 2007-11-09 13:18:58.000000000 -0500
+--- a/net/mac80211/ieee80211.c 2007-11-07 12:42:38.000000000 -0500
++++ b/net/mac80211/ieee80211.c 2007-11-09 13:18:58.000000000 -0500
@@ -21,7 +21,9 @@
#include <linux/wireless.h>
#include <linux/rtnetlink.h>
@@ -54,8 +85,8 @@
mdev->set_multicast_list = ieee80211_master_set_multicast_list;
sdata->type = IEEE80211_IF_TYPE_AP;
---- wireless/sysfs.c.old 2007-11-06 16:05:57.000000000 -0500
-+++ wireless/sysfs.c 2007-11-06 16:07:17.000000000 -0500
+--- a/net/wireless/sysfs.c 2007-11-06 16:05:57.000000000 -0500
++++ b/net/wireless/sysfs.c 2007-11-06 16:07:17.000000000 -0500
@@ -52,6 +52,7 @@
cfg80211_dev_free(rdev);
}
@@ -83,18 +114,8 @@
};
int wiphy_sysfs_init(void)
---- wireless/core.c.old 2007-11-05 18:10:07.000000000 -0500
-+++ wireless/core.c 2007-11-09 18:16:57.000000000 -0500
-@@ -16,6 +16,7 @@
- #include <net/genetlink.h>
- #include <net/cfg80211.h>
- #include <net/wireless.h>
-+#include <net/compat.h>
- #include "nl80211.h"
- #include "core.h"
- #include "sysfs.h"
---- include/linux/bitops.h.old 2007-11-05 18:44:25.000000000 -0500
-+++ include/linux/bitops.h 2007-11-05 18:55:18.000000000 -0500
+--- a/include/linux/bitops.h 2007-11-05 18:44:25.000000000 -0500
++++ b/include/linux/bitops.h 2007-11-05 18:55:18.000000000 -0500
@@ -1,12 +1,15 @@
#ifndef _LINUX_BITOPS_H
#define _LINUX_BITOPS_H
@@ -111,18 +132,18 @@
#define BITS_PER_BYTE 8
#endif
---- include/net/mac80211.h.old2 2007-11-07 12:40:46.000000000 -0500
-+++ include/net/mac80211.h 2007-11-07 12:42:12.000000000 -0500
-@@ -21,6 +21,7 @@
- #include <linux/ieee80211.h>
- #include <net/wireless.h>
- #include <net/cfg80211.h>
+--- a/include/linux/ssb/ssb.h 2007-11-09 18:46:01.000000000 -0500
++++ b/include/linux/ssb/ssb.h 2007-11-09 18:46:08.000000000 -0500
+@@ -9,6 +9,7 @@
+ #include <linux/mod_devicetable.h>
+
+ #include <linux/ssb/ssb_regs.h>
+#include <net/compat.h>
- /**
- * DOC: Introduction
---- drivers/ssb/main.c.old 2007-11-09 17:34:12.000000000 -0500
-+++ drivers/ssb/main.c 2007-11-09 17:54:47.000000000 -0500
+
+ struct pcmcia_device;
+--- a/drivers/ssb/main.c 2007-11-09 17:34:12.000000000 -0500
++++ b/drivers/ssb/main.c 2007-11-09 17:54:47.000000000 -0500
@@ -321,6 +321,27 @@
return 0;
}
@@ -159,119 +180,3 @@
static struct bus_type ssb_bustype = {
.name = "ssb",
---- drivers/ath5k/Makefile.old 2007-11-09 18:39:10.000000000 -0500
-+++ drivers/ath5k/Makefile 2007-11-09 18:38:02.000000000 -0500
-@@ -1,2 +1,2 @@
- ath5k-objs = base.o hw.o regdom.o initvals.o phy.o
--obj-$(CONFIG_ATH5K) += ath5k.o
-+obj-m += ath5k.o
---- drivers/b43/Makefile.old 2007-11-09 18:40:03.000000000 -0500
-+++ drivers/b43/Makefile 2007-11-09 18:02:24.000000000 -0500
-@@ -17,4 +17,5 @@
- b43-$(CONFIG_B43_DMA) += dma.o
- b43-$(CONFIG_B43_PIO) += pio.o
-
--obj-$(CONFIG_B43) += b43.o
-+#obj-$(CONFIG_B43) += b43.o
-+obj-n += b43.o
---- drivers/ssb/Makefile.old 2007-11-09 18:39:32.000000000 -0500
-+++ drivers/ssb/Makefile 2007-11-09 18:42:55.000000000 -0500
-@@ -15,4 +15,4 @@
- # Not strictly a part of SSB, but kept here for convenience
- ssb-$(CONFIG_SSB_PCIHOST) += b43_pci_bridge.o
-
--obj-$(CONFIG_SSB) += ssb.o
-+obj-m += ssb.o
---- include/linux/ssb/ssb.h.old 2007-11-09 18:46:01.000000000 -0500
-+++ include/linux/ssb/ssb.h 2007-11-09 18:46:08.000000000 -0500
-@@ -9,6 +9,7 @@
- #include <linux/mod_devicetable.h>
-
- #include <linux/ssb/ssb_regs.h>
-+#include <net/compat.h>
-
-
- struct pcmcia_device;
---- wireless/Makefile.old 2007-11-09 22:00:28.000000000 -0500
-+++ wireless/Makefile 2007-11-09 22:01:03.000000000 -0500
-@@ -1,5 +1,5 @@
- obj-$(CONFIG_WIRELESS_EXT) += wext.o
--obj-$(CONFIG_CFG80211) += cfg80211.o
-+obj-m += cfg80211.o
-
- cfg80211-y += core.o sysfs.o radiotap.o
--cfg80211-$(CONFIG_NL80211) += nl80211.o
-+cfg80211-n += nl80211.o
---- mac80211/cfg.c.old 2007-11-10 15:00:10.000000000 -0500
-+++ mac80211/cfg.c 2007-11-10 15:00:21.000000000 -0500
-@@ -8,8 +8,11 @@
-
- #include <linux/nl80211.h>
- #include <linux/rtnetlink.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- #include <net/net_namespace.h>
-+#endif
- #include <net/cfg80211.h>
-+#include <net/compat.h>
- #include "ieee80211_i.h"
- #include "cfg.h"
-
---- wireless/nl80211.c.old 2007-11-10 15:34:05.000000000 -0500
-+++ wireless/nl80211.c 2007-11-10 15:34:29.000000000 -0500
-@@ -16,6 +16,7 @@
- #include <linux/netlink.h>
- #include <net/genetlink.h>
- #include <net/cfg80211.h>
-+#include <net/compat.h>
- #include "core.h"
- #include "nl80211.h"
-
---- drivers/iwlwifi/Makefile.old 2007-11-10 16:27:33.000000000 -0500
-+++ drivers/iwlwifi/Makefile 2007-11-10 16:28:06.000000000 -0500
-@@ -1,5 +1,5 @@
--obj-$(CONFIG_IWL3945) += iwl3945.o
-+obj-m += iwl3945.o
- iwl3945-objs = iwl3945-base.o iwl-3945.o iwl-3945-rs.o
-
--obj-$(CONFIG_IWL4965) += iwl4965.o
-+obj-n += iwl4965.o
- iwl4965-objs = iwl4965-base.o iwl-4965.o iwl-4965-rs.o
---- drivers/iwlwifi/iwl-3945-rs.c.old 2007-11-10 17:10:24.000000000 -0500
-+++ drivers/iwlwifi/iwl-3945-rs.c 2007-11-10 17:11:58.000000000 -0500
-@@ -37,7 +37,7 @@
-
- #include <linux/workqueue.h>
-
--#include "../net/mac80211/ieee80211_rate.h"
-+#include "../mac80211/ieee80211_rate.h"
-
- #include "iwl-3945.h"
-
---- mac80211/Makefile.old 2007-11-10 17:52:07.000000000 -0500
-+++ mac80211/Makefile 2007-11-10 17:52:38.000000000 -0500
-@@ -1,9 +1,9 @@
--obj-$(CONFIG_MAC80211) += mac80211.o
-+obj-m += mac80211.o
-
- mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
- mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
- mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
--mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
-+mac80211-objs-y += rc80211_simple.o
-
- mac80211-objs := \
- ieee80211.o \
-@@ -24,4 +24,5 @@
- key.o \
- util.o \
- event.o \
-+ compat.o \
- $(mac80211-objs-y)
---- drivers/zd1211rw-mac80211/Makefile.old 2007-11-10 21:12:38.000000000 -0500
-+++ drivers/zd1211rw-mac80211/Makefile 2007-11-10 21:12:59.000000000 -0500
-@@ -1,4 +1,4 @@
--obj-$(CONFIG_ZD1211RW_MAC80211) += zd1211rw-mac80211.o
-+obj-m += zd1211rw-mac80211.o
-
- zd1211rw-mac80211-objs := zd_chip.o zd_mac.o \
- zd_rf_al2230.o zd_rf_rf2959.o \
diff --git a/compat/compat.h b/compat/compat.h
index e852412..6ae32ef 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -5,28 +5,36 @@
#include <linux/netdevice.h>
#include <linux/genetlink.h>
#include <net/neighbour.h>
+#include <linux/version.h>
-/* XXX: move this stuff to our own .config stuff, would be nice to see our own
- * make menuconfig stuff */
+/* So all *.[ch] can pick up the options as if defined
+ * by the kernel's .config. */
+/* XXX: See if we can do something better about this and config.mk */
+#define CONFIG_MAC80211 1
#define CONFIG_MAC80211_RCSIMPLE 1
-
-//#define CONFIG_B43_RFKILL 1
-//#define CONFIG_B43_LEDS 1
-//#define CONFIG_B43_PCMCIA 1
-//#define CONFIG_B43_DEBUG 1
+#define CONFIG_CFG80211 1
+#undef CONFIG_NL80211
+#define CONFIG_ATH5K 1
+#define CONFIG_IWL3945 1
+#define CONFIG_IWL4965 1
+#define CONFIG_ZD1211RW_MAC80211 1
+/*
+#define CONFIG_B43
+#define CONFIG_B43_RFKILL 1
+#define CONFIG_B43_LEDS 1
+#define CONFIG_B43_PCMCIA 1
+#define CONFIG_B43_DEBUG 1
#define CONFIG_B43_DMA 1
#define CONFIG_B43_PIO 1
-
+#define CONFIG_SSB 1
#define CONFIG_SSB_PCIHOST 1
#define CONFIG_SSB_PCMCIAHOST 1
#define CONFIG_SSB_DRIVER_MIPS 1
#define CONFIG_SSB_DRIVER_EXTIF 1
#define CONFIG_SSB_DRIVER_PCICORE 1
#define CONFIG_SSB_PCIHOST 1
-
-//#define CONFIG_IWL4965 1
-#define CONFIG_IWL3945 1
+*/
/* Compat work for 2.6.22 and 2.6.23 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..4fc875e
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,39 @@
+
+# XXX: Wouldn't it be nice to have a menuconfig ?
+#
+# Note: these CONFIG options won't be picked up through the
+# all *.[ch] files themselves so you should still define required
+# CONFIG_ items on compat.h, this is just a hack for
+# build time.
+export
+
+# Wireless subsystem stuff
+CONFIG_MAC80211=m
+CONFIG_MAC80211_RCSIMPLE=y
+CONFIG_CFG80211=m
+# Not yet supported in this compat work
+CONFIG_NL80211=n
+
+# Drivers
+CONFIG_ATH5K=m
+CONFIG_IWL3945=m
+# This guy just needs testing
+CONFIG_IWL4965=n
+CONFIG_ZD1211RW_MAC80211=m
+
+# Not yet, set to m when ready
+CONFIG_B43=n
+CONFIG_B43_RFKILL=n
+CONFIG_B43_LEDS=n
+CONFIG_B43_PCMCIA=n
+CONFIG_B43_DEBUG=n
+CONFIG_B43_DMA=y
+CONFIG_B43_PIO=y
+
+CONFIG_SSB=n
+CONFIG_SSB_PCIHOST=n
+CONFIG_SSB_PCMCIAHOST=n
+CONFIG_SSB_DRIVER_MIPS=n
+CONFIG_SSB_DRIVER_EXTIF=n
+CONFIG_SSB_DRIVER_PCICORE=n
+CONFIG_SSB_PCIHOST=n
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index 2da0a54..eebe93d 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -20,7 +20,10 @@ DRIVERS="$DRIVERS drivers/ssb drivers/net/wireless/b43"
DRIVERS="$DRIVERS drivers/net/wireless/iwlwifi"
DRIVERS="$DRIVERS drivers/net/wireless/zd1211rw-mac80211"
-mkdir -p include/linux include/net/ mac80211/ wireless/
+mkdir -p include/linux/ include/net/ \
+ net/mac80211/ net/wireless/ \
+ drivers/ssb/ \
+ drivers/net/wireless/
# include/linux
DIR="include/linux"
@@ -41,22 +44,24 @@ done
# net/wireless and net/mac80211
for i in $NET_DIRS; do
echo "Copying $GIT_TREE/net/$i/*.[ch]"
- cp $GIT_TREE/net/$i/*.[ch] $i/
- cp $GIT_TREE/net/$i/Makefile $i/
+ cp $GIT_TREE/net/$i/*.[ch] net/$i/
+ cp $GIT_TREE/net/$i/Makefile net/$i/
+ rm -f net/$i/*.mod.c
done
# drivers
for i in $DRIVERS; do
- mkdir -p drivers/${i##*/}
- cp $GIT_TREE/$i/*.[ch] drivers/${i##*/}/
- cp $GIT_TREE/$i/Makefile drivers/${i##*/}/
+ mkdir -p $i
+ cp $GIT_TREE/$i/*.[ch] $i/
+ cp $GIT_TREE/$i/Makefile $i/
+ rm -f net/$i/*.mod.c
done
# Compat stuff
-cp compat/compat.c mac80211/
+cp compat/compat.c net/mac80211/
cp compat/compat.h include/net/
-patch -p0 < compat/compat.diff
+patch -p1 < compat/compat.diff
DIR="$PWD"
cd $GIT_TREE && git-describe > $DIR/git-describe && cd $DIR
echo "Updated ${GIT_TREE##*/}, git-describe says:"
diff --git a/scripts/athenable b/scripts/athenable
new file mode 100755
index 0000000..684d451
--- /dev/null
+++ b/scripts/athenable
@@ -0,0 +1,114 @@
+#!/bin/bash
+# Makes sure either ath5k or MadWifi are ready to be used. This allows
+# us to choose any driver without blacklisting each other.
+
+if [[ $UID -ne 0 ]]; then
+ echo "Run with root privileges"
+ exit
+fi
+
+ATH5K="ath5k"
+MADWIFI="ath_pci"
+# Appended to module file at the end when we want to ignore one
+IGNORE_SUFFIX=".ignore"
+VER=`uname -r`
+USAGE="Usage: $0 [ ath5k | madwifi ]"
+
+# If 'module' is found, its renamed to 'module.ignore'
+function module_disable {
+ # Basic check to see if this is a module available for loading
+ MODULE_CHECK=`modprobe -l $1`
+ if [ -z $MODULE_CHECK ]; then
+ echo "Module $1 not detected -- this is fine"
+ return
+ fi
+ MODULE=$1
+ MODULE_KO=${MODULE}.ko
+ # In case there are more than one of these modules. This can
+ # happen, for example if your distribution provides one and you have
+ # compiled one in yourself later.
+ MODULE_COUNT=`find /lib/modules/$VER/ -name $MODULE_KO | wc -l`
+ ALL_MODULES=`find /lib/modules/$VER/ -name $MODULE_KO`
+ COUNT=1
+ CHECK=`modprobe -l $MODULE`
+ while [ ! -z $CHECK ]; do
+ if [[ $MODULE_COUNT -gt 1 ]]; then
+ if [[ $COUNT -eq 1 ]]; then
+ echo -en "$MODULE_COUNT $MODULE modules found "
+ echo -e "we'll disable all of them"
+ fi
+ echo -en "Disabling $MODULE ($COUNT) ..."
+ else
+ echo -en "Disabling $MODULE ..."
+ fi
+ mv -f $CHECK ${CHECK}${IGNORE_SUFFIX}
+ depmod -ae
+ CHECK_AGAIN=`modprobe -l $MODULE`
+ if [ "$CHECK" != "$CHECK_AGAIN" ]; then
+ echo -e "\t[OK]\tModule disabled:"
+ echo "$CHECK"
+ else
+ echo -e "[ERROR]\tModule is still being detected:"
+ echo "$CHECK"
+ fi
+ let COUNT=$COUNT+1
+ CHECK=$CHECK_AGAIN
+ done
+}
+
+# If 'module.ignore' is found, rename it back to 'module'
+function module_enable {
+ MODULE=$1
+ MODULE_KO=${MODULE}.ko
+ IGNORED_MODULE=${MODULE_KO}${IGNORE_SUFFIX}
+ # In case there are more than one of these modules. This can
+ # happen, for example if your distribution provides one and you have
+ # compiled one in yourself later.
+ ALL_MODULES=`find /lib/modules/$VER/ -name $IGNORED_MODULE`
+ for i in $ALL_MODULES; do
+ echo -en "Enabling $MODULE ..."
+ DIR=`dirname $i`
+ mv $i $DIR/$MODULE_KO
+ depmod -ae
+ CHECK=`modprobe -l $MODULE`
+ if [ "$DIR/$MODULE_KO" != $CHECK ]; then
+ if [ -z $CHECK ]; then
+ echo -e "\t[ERROR]\tModule could not be enabled"
+ else
+ echo -en "\t[OK]\tModule renamed but another "
+ echo "module file is being preferred"
+ echo -e "Renamed module:\t\t$DIR/$MODULE_KO"
+ echo -e "Preferred module:\t$CHECK"
+ fi
+ else
+ echo -e "\t[OK]\tModule enabled: "
+ echo "$DIR/$MODULE_KO"
+ fi
+ # Lets only do this for the first module found
+ break
+ done
+}
+
+
+# Default behavior: disables any MadWifi driver present and makes sure
+# ath5k is enabled
+if [ $# -eq 0 ]; then
+ module_disable $MADWIFI
+ module_enable $ATH5K
+ exit
+elif [ $# -ne 1 ]; then
+ echo "$USAGE"
+ exit
+fi
+
+MODULE=$1
+if [ "$MODULE" == "ath5k" ]; then
+ module_disable $MADWIFI
+ module_enable $ATH5K
+elif [ "$MODULE" == "madwifi" ]; then
+ module_disable $ATH5K
+ module_enable $MADWIFI
+else
+ echo "$USAGE"
+ exit
+fi
diff --git a/scripts/madwifi-unload b/scripts/madwifi-unload
new file mode 100755
index 0000000..5f033bf
--- /dev/null
+++ b/scripts/madwifi-unload
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+: ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'}
+: ${MAX_TRIES=10}
+
+test "`id -u`" = 0 || {
+ echo "ERROR: You must be root to run this script" >&2
+ exit 1
+}
+
+test -r /proc/modules || {
+ echo "ERROR: Cannot read /proc/modules" >&2
+ exit 1
+}
+
+tries="$MAX_TRIES"
+while test "$tries" != "0"; do
+ skipped=0
+ IFS='
+'
+ for line in `cat /proc/modules`; do
+ IFS=' '
+ set x $line
+ name="$2"
+ size="$3"
+ use_count="$4"
+ use_name="$5"
+ state="$6"
+ expr "$name" : "$PATTERN" >/dev/null || continue
+
+ # Compatibility for Linux 2.4.x
+ test -z "$state" && { use_name="-"; state="Live"; }
+
+ if test "$state" != "Live" || test "$use_count" != "0" || \
+ test "$use_name" != "-"; then
+ # Don't skip unload in the last run
+ if test "$tries" != "1"; then
+ skipped=1
+ continue
+ fi
+ fi
+
+ echo "Unloading \"$name\""
+ sync # to be safe
+ /sbin/rmmod "$name" || {
+ echo "ERROR: cannot unload module \"$name\"" >&2
+ exit 1
+ }
+ sync # to be even safer
+ done
+ test "$skipped" = "0" && break
+ tries=$(($tries - 1))
+done
+
+exit 0
diff --git a/scripts/unload.sh b/scripts/unload.sh
index 45f14fa..e7e743c 100755
--- a/scripts/unload.sh
+++ b/scripts/unload.sh
@@ -15,12 +15,10 @@ if [ -f $IPW3945D ]; then
fi
fi
-grep ath_pci /proc/modules
-if [ ! $? ]; then
- for i in $MADWIFI_MODULES; do
- echo Unloading $i...
- modprobe -r --ignore-remove $i
- done
+grep ath_pci /proc/modules 2>&1 > /dev/null
+if [ $? -eq 0 ]; then
+ echo "MadWifi driver is loaded, going to try to unload it..."
+ ./scripts/madwifi-unload
fi
for i in $MODULES; do