aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2007-11-11 02:19:58 -0500
committerLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2007-11-11 02:19:58 -0500
commita1d38b2d6cb956b7958767dfc2170751aa593d22 (patch)
treeac3942f2431821015ad771a2f4f5421c3d18ea92
downloadcompat-wireless-2.6-old-a1d38b2d6cb956b7958767dfc2170751aa593d22.tar.gz
Initial release, adds mac80211, ath5k, iwl3945, and zd1211rw-mac80211.
Backporting tested on 2.6.22. Fixed my git repository, updated ipw3945d detection. Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
-rw-r--r--COPYRIGHT356
-rw-r--r--Makefile94
-rw-r--r--README154
-rw-r--r--compat/compat.c329
-rw-r--r--compat/compat.diff277
-rw-r--r--compat/compat.h137
-rwxr-xr-xscripts/admin-clean.sh4
-rwxr-xr-xscripts/admin-refresh.sh3
-rwxr-xr-xscripts/admin-update.sh63
-rwxr-xr-xscripts/load.sh7
-rwxr-xr-xscripts/unload.sh29
11 files changed, 1453 insertions, 0 deletions
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..ca442d3
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,356 @@
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the Linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Also note that the only valid version of the GPL as far as the kernel
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4a35731
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,94 @@
+KMODDIR?= updates
+KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
+ifneq ($(origin $(KLIB)), undefined)
+KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
+else
+KLIB:= /lib/modules/$(shell uname -r)
+endif
+KLIB_BUILD := $(KLIB)/build
+MADWIFI=$(shell modprobe -l ath_pci)
+
+ifneq ($(KERNELRELEASE),)
+
+# 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
+
+else
+PWD := $(shell pwd)
+export PWD
+
+all: modules
+
+modules:
+ $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
+
+clean:
+ $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
+
+install:
+ @$(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 ;\
+ fi
+ @depmod -ae
+ @echo
+ @echo "Currently detected wireless subsystem modules:"
+ @echo
+ @modprobe -l mac80211
+ @# rc80211_simple is no longer a module
+ @#modprobe -l rc80211_simple
+ @modprobe -l cfg80211
+ @modprobe -l ath5k
+ @modprobe -l ssb
+ @modprobe -l b43
+ @modprobe -l iwl3945
+ @# This needs testing before we add it
+ @#modprobe -l iwl4965
+ @modprobe -l zd1211rw-mac80211
+ @echo
+
+uninstall:
+ @rm -rf $(KLIB)/$(KMODDIR)/mac80211/
+ @rm -rf $(KLIB)/$(KMODDIR)/wireless/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/
+ @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
+ @modprobe -l rc80211_simple
+ @modprobe -l cfg80211
+ @modprobe -l ath5k
+ @modprobe -l ssb
+ @modprobe -l b43
+ @modprobe -l iwl3945
+ @modprobe -l iwl4965
+ @modprobe -l ipw3945
+ @modprobe -l ath_pci
+ @modprobe -l ath_hal
+ @modprobe -l zd1211rw-mac80211
+ @echo
+
+unload:
+ @./scripts/unload.sh
+
+load: unload
+ @./scripts/load.sh
+
+.PHONY: all clean install uninstall unload load
+
+endif
diff --git a/README b/README
new file mode 100644
index 0000000..6154cc7
--- /dev/null
+++ b/README
@@ -0,0 +1,154 @@
+
+Linux Wireless compatibility package
+=====================================
+
+This is a Linux wireless compatibility package which provides the latest
+Linux wireless subsystem enhancements for kernels 2.6.22 and above. We provide
+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.
+
+Where to get the latest
+-----------------------
+
+This package lets you build your own 'latest', all you need is a local git repository
+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/
+
+Building, and installing
+------------------------
+
+Build: build the latest linux wireless subsystem
+
+ make
+
+Install:
+
+We use the updates/ directory so your distribution's drivers are left intact.
+
+ sudo make install
+
+Uninstall:
+
+This nukes our changes to updates/ so you can go back to using your
+distribution's supported drivers.
+
+ sudo make uninstall
+
+Load:
+
+This unloads your old mac80211 and wireless drivers and loads the new
+shiny ones. For example if ipw3945 and its proprietary daemon are found
+it'll be stopped and the module unloaded and then iwl3945 will be loaded.
+
+ sudo make load
+
+Drivers
+-------
+
+We'll add more as we go...
+
+Driver 2.6.22 2.6.23
+ath5k OK ?
+b43 + ssb ? ?
+iwl3945 OK ?
+iwl4965 ? ?
+zd1211rw-mac80211 OK ?
+
+Known issues
+------------
+
+* Strange wireless device names:
+
+On Ubuntu and Fedora you may end up with strange network device names,
+for example, wlan0_rename. This is a known issue and will be worked on.
+
+* nl80211:
+
+More compatibility work is needed to add nl80211
+
+* b43:
+
+We still need to iron out some compat stuff for 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.
+
+Why?
+----
+
+For users or developers stuck on older kernels that want to help test or
+patch wireless work. Additionally if you're on a recent kernel this lets
+you get the latest and greatest wireless-2.6 git work without much effort.
+This may mean new drivers for some users. Last but not least we hope this
+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.
+
+Bugs
+-----
+
+If you've found a bug please report it to our linux-wireless mailing list:
+
+linux-wireless@vger.kernel.org
+
+Report the bug because you are working with the latest and greatest.
+If your bug is compatibility-related then we should still try to fix
+it within the compat.[ch] work.
+
+License
+-------
+
+This work is a subset of the Linux kernel as such we keep the kernel's
+Copyright practice. Some files have their own copyright and in those
+cases the license is mentioned in the file. All additional work made
+to building this package is licensed under the GPLv2.
+
+Developers
+----------
+
+Please try adding new drivers, test them and if they work enable them. You
+can then send patches. Compatibility work goes into compat/compat.[ch]. If
+using those files do not suffice additional actual code changes can go into
+compat/compat.diff.
+
+scripts/admin-clean.sh - Cleans the compat-wireless-2.6 tree
+scripts/admin-update.sh - Updates compat-wireless-2.6 with your git tree
+scripts/admin-refresh.sh - Does the above two
+
+To add new drivers:
+
+1. Add directory to scripts/admin-update.sh $DRIVERS variable
+2. Add new compat-wireless-2.6/ dir to obj-y on the local Makefile
+3. Update compat patch:
+
+ cp drivers/foo/Makefile drivers/Makefile.old
+ # edit drivers/foo/Makefile and make necessary changes to enable module
+ diff -u drivers/foo/Makefile.old drivers/foo/Makefile >> \
+ compat/compat.diff
+ # Append to compat/compat.[ch] any new changes needed
+ # to support the driver, please be specific about the reasons
+ # for your additions
+
+4. Refresh and test:
+ ./scripts/admin-refresh.sh
+5. Send patches of the work
+
+Patches
+-------
+
+Please send patches against:
+
+git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat-wireless-2.6.git
+
+To: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
+CC: linux-wireless@vger.kernel.org
+Subject: [PATCH] compat-2.6: add driver foo
+
diff --git a/compat/compat.c b/compat/compat.c
new file mode 100644
index 0000000..5a58c1f
--- /dev/null
+++ b/compat/compat.c
@@ -0,0 +1,329 @@
+/*
+ * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 2.6.22 - tip
+ * The headers don't need to be modified as we're simply adding them.
+ */
+
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/netpoll.h>
+#include <linux/rtnetlink.h>
+#include <linux/audit.h>
+#include <linux/workqueue.h>
+#include <net/arp.h>
+#include <net/compat.h>
+
+/* All things not in 2.6.22 and 2.6.23 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
+
+/* Part of net/ethernet/eth.c as of 2.6.24 */
+char *print_mac(char *buf, const u8 *addr)
+{
+ sprintf(buf, MAC_FMT,
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+ return buf;
+}
+EXPORT_SYMBOL(print_mac);
+
+/* On net/core/dev.c as of 2.6.24 */
+int __dev_addr_delete(struct dev_addr_list **list, int *count,
+ void *addr, int alen, int glbl)
+{
+ struct dev_addr_list *da;
+
+ for (; (da = *list) != NULL; list = &da->next) {
+ if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
+ alen == da->da_addrlen) {
+ if (glbl) {
+ int old_glbl = da->da_gusers;
+ da->da_gusers = 0;
+ if (old_glbl == 0)
+ break;
+ }
+ if (--da->da_users)
+ return 0;
+
+ *list = da->next;
+ kfree(da);
+ (*count)--;
+ return 0;
+ }
+ }
+ return -ENOENT;
+}
+
+/* On net/core/dev.c as of 2.6.24. This is not yet used by mac80211 but
+ * might as well add it */
+int __dev_addr_add(struct dev_addr_list **list, int *count,
+ void *addr, int alen, int glbl)
+{
+ struct dev_addr_list *da;
+
+ for (da = *list; da != NULL; da = da->next) {
+ if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 &&
+ da->da_addrlen == alen) {
+ if (glbl) {
+ int old_glbl = da->da_gusers;
+ da->da_gusers = 1;
+ if (old_glbl)
+ return 0;
+ }
+ da->da_users++;
+ return 0;
+ }
+ }
+
+ da = kmalloc(sizeof(*da), GFP_ATOMIC);
+ if (da == NULL)
+ return -ENOMEM;
+ memcpy(da->da_addr, addr, alen);
+ da->da_addrlen = alen;
+ da->da_users = 1;
+ da->da_gusers = glbl ? 1 : 0;
+ da->next = *list;
+ *list = da;
+ (*count)++;
+ return 0;
+}
+
+/* 2.6.22 and 2.6.23 have eth_header_cache_update defined as extern in include/linux/etherdevice.h
+ * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
+
+/**
+ * eth_header_cache_update - update cache entry
+ * @hh: destination cache entry
+ * @dev: network device
+ * @haddr: new hardware address
+ *
+ * Called by Address Resolution module to notify changes in address.
+ */
+void eth_header_cache_update(struct hh_cache *hh,
+ struct net_device *dev,
+ unsigned char *haddr)
+{
+ memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
+ haddr, ETH_ALEN);
+}
+EXPORT_SYMBOL(eth_header_cache_update);
+
+/* 2.6.22 and 2.6.23 have eth_header_cache defined as extern in include/linux/etherdevice.h
+ * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
+
+/**
+ * eth_header_cache - fill cache entry from neighbour
+ * @neigh: source neighbour
+ * @hh: destination cache entry
+ * Create an Ethernet header template from the neighbour.
+ */
+int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh)
+{
+ __be16 type = hh->hh_type;
+ struct ethhdr *eth;
+ const struct net_device *dev = neigh->dev;
+
+ eth = (struct ethhdr *)
+ (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth))));
+
+ if (type == htons(ETH_P_802_3))
+ return -1;
+
+ eth->h_proto = type;
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
+ memcpy(eth->h_dest, neigh->ha, ETH_ALEN);
+ hh->hh_len = ETH_HLEN;
+ return 0;
+}
+EXPORT_SYMBOL(eth_header_cache);
+
+/* 2.6.22 and 2.6.23 have eth_rebuild_header defined as extern in include/linux/etherdevice.h
+ * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */
+
+/**
+ * eth_rebuild_header- rebuild the Ethernet MAC header.
+ * @skb: socket buffer to update
+ *
+ * This is called after an ARP or IPV6 ndisc it's resolution on this
+ * sk_buff. We now let protocol (ARP) fill in the other fields.
+ *
+ * This routine CANNOT use cached dst->neigh!
+ * Really, it is used only when dst->neigh is wrong.
+ */
+int eth_rebuild_header(struct sk_buff *skb)
+{
+ struct ethhdr *eth = (struct ethhdr *)skb->data;
+ struct net_device *dev = skb->dev;
+
+ switch (eth->h_proto) {
+#ifdef CONFIG_INET
+ case __constant_htons(ETH_P_IP):
+ return arp_find(eth->h_dest, skb);
+#endif
+ default:
+ printk(KERN_DEBUG
+ "%s: unable to resolve type %X addresses.\n",
+ dev->name, (int)eth->h_proto);
+
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
+ break;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(eth_rebuild_header);
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) */
+
+/* All things not in 2.6.22 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
+
+/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slightly different version.
+ * Since da->da_synced is not part of 2.6.22 we need to take longer route when
+ * syncing */
+
+/**
+ * dev_mc_sync - Synchronize device's multicast list to another device
+ * @to: destination device
+ * @from: source device
+ *
+ * Add newly added addresses to the destination device and release
+ * addresses that have no users left. The source device must be
+ * locked by netif_tx_lock_bh.
+ *
+ * This function is intended to be called from the dev->set_multicast_list
+ * function of layered software devices.
+ */
+int dev_mc_sync(struct net_device *to, struct net_device *from)
+{
+ struct dev_addr_list *da, *next, *da_to;
+ int err = 0;
+
+ netif_tx_lock_bh(to);
+ da = from->mc_list;
+ while (da != NULL) {
+ int synced = 0;
+ next = da->next;
+ da_to = to->mc_list;
+ /* 2.6.22 does not have da->da_synced so lets take the long route */
+ while (da_to != NULL) {
+ if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
+ da->da_addrlen == da_to->da_addrlen)
+ synced = 1;
+ break;
+ }
+ if (!synced) {
+ err = __dev_addr_add(&to->mc_list, &to->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+ if (err < 0)
+ break;
+ da->da_users++;
+ } else if (da->da_users == 1) {
+ __dev_addr_delete(&to->mc_list, &to->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+ __dev_addr_delete(&from->mc_list, &from->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+ }
+ da = next;
+ }
+ if (!err)
+ __dev_set_rx_mode(to);
+ netif_tx_unlock_bh(to);
+
+ return err;
+}
+EXPORT_SYMBOL(dev_mc_sync);
+
+
+/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slighty different version.
+ * Since da->da_synced is not part of 2.6.22 we need to take longer route when
+ * unsyncing */
+
+/**
+ * dev_mc_unsync - Remove synchronized addresses from the destination
+ * device
+ * @to: destination device
+ * @from: source device
+ *
+ * Remove all addresses that were added to the destination device by
+ * dev_mc_sync(). This function is intended to be called from the
+ * dev->stop function of layered software devices.
+ */
+void dev_mc_unsync(struct net_device *to, struct net_device *from)
+{
+ struct dev_addr_list *da, *next, *da_to;
+
+ netif_tx_lock_bh(from);
+ netif_tx_lock_bh(to);
+
+ da = from->mc_list;
+ while (da != NULL) {
+ bool synced = false;
+ next = da->next;
+ da_to = to->mc_list;
+ /* 2.6.22 does not have da->da_synced so lets take the long route */
+ while (da_to != NULL) {
+ if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
+ da->da_addrlen == da_to->da_addrlen)
+ synced = true;
+ break;
+ }
+ if (!synced) {
+ da = next;
+ continue;
+ }
+ __dev_addr_delete(&to->mc_list, &to->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+ __dev_addr_delete(&from->mc_list, &from->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+ da = next;
+ }
+ __dev_set_rx_mode(to);
+
+ netif_tx_unlock_bh(to);
+ netif_tx_unlock_bh(from);
+}
+EXPORT_SYMBOL(dev_mc_unsync);
+
+/* Added as of 2.6.23 on net/core/dev.c. Slightly modifed, no dev->set_rx_mode on
+ * 2.6.22 so ignore that. */
+
+/*
+ * Upload unicast and multicast address lists to device and
+ * configure RX filtering. When the device doesn't support unicast
+ * filtering it is put in promiscous mode while unicast addresses
+ * are present.
+ */
+void __dev_set_rx_mode(struct net_device *dev)
+{
+ /* dev_open will call this function so the list will stay sane. */
+ if (!(dev->flags&IFF_UP))
+ return;
+
+ if (!netif_device_present(dev))
+ return;
+
+/* This needs to be ported to 2.6.22 framework */
+#if 0
+ /* Unicast addresses changes may only happen under the rtnl,
+ * therefore calling __dev_set_promiscuity here is safe.
+ */
+ if (dev->uc_count > 0 && !dev->uc_promisc) {
+ __dev_set_promiscuity(dev, 1);
+ dev->uc_promisc = 1;
+ } else if (dev->uc_count == 0 && dev->uc_promisc) {
+ __dev_set_promiscuity(dev, -1);
+ dev->uc_promisc = 0;
+ }
+#endif
+
+ if (dev->set_multicast_list)
+ dev->set_multicast_list(dev);
+}
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */
+
diff --git a/compat/compat.diff b/compat/compat.diff
new file mode 100644
index 0000000..8f9b95f
--- /dev/null
+++ b/compat/compat.diff
@@ -0,0 +1,277 @@
+--- mac80211/tx.c.old2 2007-11-09 13:14:28.000000000 -0500
++++ mac80211/tx.c 2007-11-09 15:40:09.000000000 -0500
+@@ -18,7 +18,9 @@
+ #include <linux/etherdevice.h>
+ #include <linux/bitmap.h>
+ #include <linux/rcupdate.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #include <net/net_namespace.h>
++#endif
+ #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
+@@ -20,7 +20,9 @@
+ #include <linux/if_arp.h>
+ #include <linux/wireless.h>
+ #include <linux/bitmap.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #include <net/net_namespace.h>
++#endif
+ #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
+@@ -21,7 +21,9 @@
+ #include <linux/wireless.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/bitmap.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #include <net/net_namespace.h>
++#endif
+ #include <net/cfg80211.h>
+
+ #include "ieee80211_i.h"
+@@ -400,7 +402,9 @@
+ void ieee80211_if_setup(struct net_device *dev)
+ {
+ ether_setup(dev);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ dev->header_ops = &ieee80211_header_ops;
++#endif
+ dev->hard_start_xmit = ieee80211_subif_start_xmit;
+ dev->wireless_handlers = &ieee80211_iw_handler_def;
+ dev->set_multicast_list = ieee80211_set_multicast_list;
+@@ -987,7 +991,9 @@
+ mdev->open = ieee80211_master_open;
+ mdev->stop = ieee80211_master_stop;
+ mdev->type = ARPHRD_IEEE80211;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ mdev->header_ops = &ieee80211_header_ops;
++#endif
+ 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
+@@ -52,6 +52,7 @@
+ cfg80211_dev_free(rdev);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #ifdef CONFIG_HOTPLUG
+ static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
+ {
+@@ -59,15 +60,18 @@
+ return 0;
+ }
+ #endif
++#endif
+
+ struct class ieee80211_class = {
+ .name = "ieee80211",
+ .owner = THIS_MODULE,
+ .dev_release = wiphy_dev_release,
+ .dev_attrs = ieee80211_dev_attrs,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ #ifdef CONFIG_HOTPLUG
+ .dev_uevent = wiphy_uevent,
+ #endif
++#endif
+ };
+
+ 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
+@@ -1,12 +1,15 @@
+ #ifndef _LINUX_BITOPS_H
+ #define _LINUX_BITOPS_H
+ #include <asm/types.h>
++#include <linux/version.h>
+
+ #ifdef __KERNEL__
+ #define BIT(nr) (1UL << (nr))
+ #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
+ #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23))
+ #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
++#endif
+ #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>
++#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
+@@ -321,6 +321,27 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
++static int ssb_device_uevent(struct device *dev, char **envp,
++ int num_envp, char *buffer, int buffer_size)
++{
++ struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
++ int cur_index = 0, cur_len = 0;
++
++ if (!dev)
++ return -ENODEV;
++
++ return add_uevent_var(envp,
++ num_envp,
++ &cur_index,
++ buffer,
++ buffer_size,
++ &cur_len,
++ "MODALIAS=ssb:v%04Xid%04Xrev%02X",
++ ssb_dev->id.vendor, ssb_dev->id.coreid,
++ ssb_dev->id.revision);
++}
++#else
+ static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
+ {
+ struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+@@ -333,6 +354,7 @@
+ ssb_dev->id.vendor, ssb_dev->id.coreid,
+ ssb_dev->id.revision);
+ }
++#endif
+
+ 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
new file mode 100644
index 0000000..e852412
--- /dev/null
+++ b/compat/compat.h
@@ -0,0 +1,137 @@
+#ifndef LINUX_26_COMPAT_H
+#define LINUX_26_COMPAT_H
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/genetlink.h>
+#include <net/neighbour.h>
+
+/* XXX: move this stuff to our own .config stuff, would be nice to see our own
+ * make menuconfig stuff */
+
+#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_B43_DMA 1
+#define CONFIG_B43_PIO 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))
+
+/* From include/linux/mod_devicetable.h */
+
+/* SSB core, see drivers/ssb/ */
+struct ssb_device_id {
+ __u16 vendor;
+ __u16 coreid;
+ __u8 revision;
+};
+#define SSB_DEVICE(_vendor, _coreid, _revision) \
+ { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
+#define SSB_DEVTABLE_END \
+ { 0, },
+
+#define SSB_ANY_VENDOR 0xFFFF
+#define SSB_ANY_ID 0xFFFF
+#define SSB_ANY_REV 0xFF
+
+
+/* Namespace stuff, introduced on 2.6.24 */
+#define dev_get_by_index(a, b) dev_get_by_index(b)
+#define __dev_get_by_index(a, b) __dev_get_by_index(b)
+
+/*
+ * Display a 6 byte device address (MAC) in a readable format.
+ */
+#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
+extern char *print_mac(char *buf, const u8 *addr);
+#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused
+
+extern int eth_header(struct sk_buff *skb, struct net_device *dev,
+ unsigned short type, void *daddr,
+ void *saddr, unsigned len);
+extern int eth_rebuild_header(struct sk_buff *skb);
+extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
+ unsigned char * haddr);
+extern int eth_header_cache(struct neighbour *neigh,
+ struct hh_cache *hh);
+
+/* This structure is simply not present on 2.6.22 and 2.6.23 */
+struct header_ops {
+ int (*create) (struct sk_buff *skb, struct net_device *dev,
+ unsigned short type, void *daddr,
+ void *saddr, unsigned len);
+ int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
+ int (*rebuild)(struct sk_buff *skb);
+ #define HAVE_HEADER_CACHE
+ int (*cache)(struct neighbour *neigh, struct hh_cache *hh);
+ void (*cache_update)(struct hh_cache *hh,
+ struct net_device *dev,
+ unsigned char *haddr);
+};
+
+#endif
+
+/* Compat work for 2.6.22 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
+
+/* dev_mc_list was replaced with dev_addr_list as of 2.6.23 */
+#define dev_addr_list dev_mc_list
+#define da_addr dmi_addr
+#define da_addrlen dmi_addrlen
+#define da_users dmi_users
+#define da_gusers dmi_gusers
+
+/* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and
+ * dev_set_promiscuity() became a wrapper. */
+#define __dev_set_promiscuity dev_set_promiscuity
+
+/* Our own 2.6.22 port on compat.c */
+extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
+extern int dev_mc_sync(struct net_device *to, struct net_device *from);
+
+/* Our own 2.6.22 port on compat.c */
+extern void __dev_set_rx_mode(struct net_device *dev);
+
+/* Simple to add this */
+extern int cancel_delayed_work_sync(struct delayed_work *work);
+
+#define cancel_delayed_work_sync cancel_rearming_delayed_work
+
+#define debugfs_rename(a, b, c, d) 1
+
+/* Eh we need a lot more than this to complete this support. Not
+ * a priority for now. This is for nl80211 support */
+
+/**
+ * struct genl_multicast_group - generic netlink multicast group
+ * @name: name of the multicast group, names are per-family
+ * @id: multicast group ID, assigned by the core, to use with
+ * genlmsg_multicast().
+ * @list: list entry for linking
+ * @family: pointer to family, need not be set before registering
+ */
+struct genl_multicast_group
+{
+ struct genl_family *family; /* private */
+ struct list_head list; /* private */
+ char name[GENL_NAMSIZ];
+ u32 id;
+};
+
+#endif
+
+#endif
diff --git a/scripts/admin-clean.sh b/scripts/admin-clean.sh
new file mode 100755
index 0000000..c48dfbe
--- /dev/null
+++ b/scripts/admin-clean.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+make clean
+rm -rf mac80211 wireless drivers include Module.symvers git-describe
+echo "Cleaned wireless-compat-2.6"
diff --git a/scripts/admin-refresh.sh b/scripts/admin-refresh.sh
new file mode 100755
index 0000000..743ecd4
--- /dev/null
+++ b/scripts/admin-refresh.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+./scripts/admin-clean.sh
+./scripts/admin-update.sh
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
new file mode 100755
index 0000000..2da0a54
--- /dev/null
+++ b/scripts/admin-update.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Use this to update compat-wireless-2.6 to the lates wireless-2.6.git tree you have.
+#
+# Usage: you should have the latest pull of wireless-2.6.git
+# git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git
+# We assume you have it on your ~/devel/wireless-2.6/ directory. If you do,
+# just run this script from the compat-wireless-2.6 directory.
+
+INCLUDE_LINUX="ieee80211.h nl80211.h wireless.h pci_ids.h bitops.h"
+
+INCLUDE_NET="cfg80211.h ieee80211_radiotap.h iw_handler.h"
+INCLUDE_NET="$INCLUDE_NET mac80211.h wext.h wireless.h"
+
+NET_DIRS="wireless mac80211"
+GIT_TREE="/home/$USER/devel/wireless-2.6"
+
+DRIVERS="drivers/net/wireless/ath5k"
+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/
+
+# include/linux
+DIR="include/linux"
+for i in $INCLUDE_LINUX; do
+ echo "Copying $GIT_TREE/$DIR/$i"
+ cp "$GIT_TREE/$DIR/$i" $DIR/
+done
+
+cp -a $GIT_TREE/include/linux/ssb include/linux/
+
+# include/net
+DIR="include/net"
+for i in $INCLUDE_NET; do
+ echo "Copying $GIT_TREE/$DIR/$i"
+ cp "$GIT_TREE/$DIR/$i" $DIR/
+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/
+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##*/}/
+done
+
+# Compat stuff
+cp compat/compat.c mac80211/
+cp compat/compat.h include/net/
+
+patch -p0 < compat/compat.diff
+DIR="$PWD"
+cd $GIT_TREE && git-describe > $DIR/git-describe && cd $DIR
+echo "Updated ${GIT_TREE##*/}, git-describe says:"
+cat git-describe
diff --git a/scripts/load.sh b/scripts/load.sh
new file mode 100755
index 0000000..3b19a17
--- /dev/null
+++ b/scripts/load.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+MODULES="ath5k iwl3945 zd1211rw-mac80211"
+for i in $MODULES; do
+ echo Loading $i...
+ modprobe $i
+done
+
diff --git a/scripts/unload.sh b/scripts/unload.sh
new file mode 100755
index 0000000..45f14fa
--- /dev/null
+++ b/scripts/unload.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+OLD_MODULES="zd1211rw rc80211_simple"
+MODULES="$OLD_MODULES ath5k iwl3945 zd1211rw-mac80211"
+MODULES="$MODULES mac80211 cfg80211"
+MADWIFI_MODULES="ath_pci ath_rate_sample wlan_scan_sta wlan ath_hal"
+IPW3945D="/sbin/ipw3945d-`uname -r`"
+
+if [ -f $IPW3945D ]; then
+ $IPW3945D --isrunning
+ if [ ! $? ]; then
+ echo -n "Detected ipw3945 daemon loaded we're going to "
+ echo "shut the daemon down now and remove the module."
+ modprobe -r --ignore-remove ipw3945
+ fi
+fi
+
+grep ath_pci /proc/modules
+if [ ! $? ]; then
+ for i in $MADWIFI_MODULES; do
+ echo Unloading $i...
+ modprobe -r --ignore-remove $i
+ done
+fi
+
+for i in $MODULES; do
+ echo Unloading $i...
+ modprobe -r --ignore-remove $i
+done