Take advantage of Windows NDIS drivers using WLAN DriverLoader or NdisWrapper.
Open source software is just that: open. There's no law requiring software or hardware manufacturers to ensure compatibility with operating systems. In the case of some wireless card manufacturers, this is exactly what has happened. Wireless cards are released, with accompanying drivers for Windows, and that's it. The companies, for various reasons, are not interested in allowing their cards to run under Linux, and do not release any information on their cards.
Unfortunately, some of these manufacturers are rather large, and one in particularBroadcomaccounts for a significant percentage of the 802.11g wireless cards being sold on the market. What is the dedicated Linux user to do?
There are a couple of options, both of which use the Windows binary drivers that come with a wireless card and load them under Linux. As with the Madwifi driver for Atheros cards [Hack #63], neither of these options is fully open source, since you are using the binary closed-source Windows driver.
5.20.1. WLAN DriverLoader
WLAN DriverLoader (available from http://www.linuxant.com/driverloader) is a compatibility wrapper program from a company called Linuxant. It allows the use of Windows NDIS(Network Driver Interface Specification) wireless network drivers in Linux.
You can get packages and the source code, but Linuxant has also provided a downloadable script that you can run to automates the installation. To work properly, you'll need to have existing Internet access for the script to download pieces it needs.
The script is named dldrinstall.run and you can execute it as follows:
When the script runs, a web browser opens, and you'll be prompted for the root username and password for your machine. This is required, because you're installing kernel-level drivers. The script will determine what kind of system you're running on and present a couple options for packages that can be installed.
The package will download and install. Once the installation is complete, you'll be prompted to send your browser to a different local URL to configure DriverLoader, as shown in Figure 5-29.
Figure 5-29. DriverLoader main configuration screen
At this point, you'll need the Windows driver for your wireless card. You can get these from the install disk that came with your card, or download them from the vendor. Linuxant also keeps a web page with lists of commonly used wireless cards and links directly to their driver downloads at http://www.linuxant.com/driverloader/drivers.php.
The pieces you'll need from the Windows driver package will be an INF and a SYS file. In our case, we were using an Atheros-based Linksys wireless card, so the required files were net5211.inf and ar5211.sys. Filenames and location of driver files will obviously vary for each vendor and card.
After you have uploaded both required files, the DriverLoader web page will show you a status screen that lists installed drivers and any hardware that matches the drivers. Assuming you have your card inserted or installed, you'll see a screen similar to Figure 5-30.
DriverLoader is commercial software and requires a license. You can get a 30-day trial license key from their web site, to ensure that the software works correctly for you and your card. Once you've verified that it works, a permanent license, keyed to the MAC address of your wireless card, costs $20. You can obtain either a trial or permanent license at https://www.linuxant.com/store.
Figure 5-30. Windows drivers loaded correctly
Now that you have entered a valid license key, you should have an active wireless interface. In our case, we had removed a MiniPCI Ethernet card from our system and installed a MiniPCI wireless card. This caused Driver-Loader to bring up the wireless card as eth0, since there were no other active network interfaces. Users installing on Fedora Core may have to manually create an /etc/sysconfig/ifcfg-eth0 file to bring up the interface on boot, since the original file for the MiniPCI ethernet card will be removed after a reboot.
An added advantage of using DriverLoader is support for WPA capabilities in the Windows drivers. To take advantage of this support, you'll need additional WPA supplicant software [Hack #42].
NdisWrapper is an open-source project hosted at SourceForge, which has essentially the same features and goals as Linux DriverLoader. There are no license fees, but there is also no technical support department. You'll have to do some heavy lifting to get it working, but it does work well.
The first thing to do is to make sure that you have the source for your Linux kernel. Debian and Ubuntu users can find the correct kernel source with the following command:
apt-cache search kernel-source
You'll need to find the correct kernel-source package that matches your installed kernel.
Fedora users have to jump through a little hoop. As of Fedora Core 3, there is no longer a kernel-source RPM available. You can get the SRPM (Source RPM) from the Fedora Core 3 install CD, but chances are it won't match the current kernel you're running, because of kernel updates.
Instead, execute the following commands:
sudo rpm -Uvh ftp://mirrors.kernel.org/fedora/core/updates/3/SRPMS/kernel- `uname -r`.src.rpm cd /usr/src/redhat/SPECS sudo rpmbuild bp target=`uname m` kernel-2.6.spec
This will get the kernel source RPM and build the necessary kernel source files you need to continue compiling NdisWrapper.
Now that you have the kernel sources, you'll need the NdisWrapper source code, which you can download from http://ndiswrapper.sourceforge.net. Extract the compressed file, change to the newly created ndiswrapper directory, and issue these commands:
make distclean sudo make sudo make install
This will compile and install the NdisWrapper kernel modules and user utilities.
According to the developers, you might or might not have good luck with the Windows drivers that came with your wireless card. Instead, they suggest that you first check http://ndiswrapper.sourceforge.net/phpwiki/index.php/List? for an updated list of known working cards and the correct drivers.
Once you've identified your card and downloaded the driver, or have decided to experiment with your own card and driver that isn't listed, you'll need to find the INF and SYS files in the driver directory. Again, we're using an Atheros-based Linksys card, so we're looking for net5211.inf and ar5211.sys.
Make sure the INF and SYS files are in one directory, and then execute the following as root:
ndiswrapper i filename.inf
This will copy necessary files to /etc/ndiswrapper and set up configuration files for your wireless card. At this point, if you don't have your wireless card inserted or installed, go ahead and do it. You can now check the status of the drivers:
If all is well, you'll see output like this:
Installed ndis drivers: net5211 driver present, hardware present
Finally, you'll need to manually load the kernel module:
To verify that the module loaded successfully, execute the dmesg command. You should see output at the end like this:
ndiswrapper: driver net5211 loaded wlan0: ndiswrapper ethernet device 0a:43:32:6a:33:01
If you don't see the second line, chances are the driver has not successfully loaded. Check to see if there is more diagnostic information.
You can now configure the card using the Wireless Tools:
iwconfig wlan0 essid Example mode Managed
At this point, there are a couple of things you'll want to do in order for your card to be recognized at boot. Add a line of ndiswrapper to the /etc/modules file, and then execute this command:
Depending on your distribution, you'll also want to make sure there is TCP/IP configuration for your wireless interface. Debian and Ubuntu users should edit /etc/network/interfaces, RedHat and Fedora users will need to create or edit /etc/sysconfig/network-scripts/ifcfg-interface.
5.20.3. Final Thoughts
Both of these programs require quite a bit of configuration and fiddling. However, for using certain brands of wireless cards with Linux, they are your only options. If you want technical support and don't mind forking over the $20 for a license, DriverLoader is probably your better choice. NdisWrapper works well but does take a little more knowledge up front.
Bluetooth, Mobile Phones, and GPS
Network Discovery and Monitoring
Wireless Network Design
Appendix A. Wireless Standards
Appendix B. Wireless Hardware Guide