Two tools for enabling wireless cards

294

Author: Bruce Byfield

No other hardware nowadays supports GNU/Linux as weakly as wireless network adapters. Between the constant release of new models and major vendors who are uninterested in supporting the operating system, free drivers for wireless cards are next to impossible to reverse engineer. Nor can you find many retailers willing to customize laptops as readily as they do workstations. In this situation, ndiswrapper and the Broadcom firmware cutter provide a functional, if not always satisfactory, solution.

These two programs are unsatisfactory for two reasons. First, they fall under the category that the Debian repositories label “contrib”: they are free in themselves, but depend on proprietary programs to work. Basically, the programs extract the necessary GNU/Linux drivers from Windows drivers released by the manufacturers and provide a means of using them under GNU/Linux — a process that many free software supporters may find philosophically objectionable and that, despite the free availability of the drivers, may be technically illegal. Second, using the two programs is arcane enough to intimidate many users, especially since some of the details vary depending on the distribution with which they’re used.

To make matters worse, partial documentation for both programs clogs the Internet. Without trying this documentation, you cannot easily assess its quality, yet, by trying it, you risk leaving your computer in a state unfit for future attempts.

To make the effort less painful, this article assembles the information needed to use both programs and explains their requirements. So far as possible, it presents this information generically, but, at some stages in the use of the two programs, you may need to consult documentation for your distribution in order to complete the process.

Using ndiswrapper

ndiswrapper (Network Driver Interface Specification wrapper) provides an interface that allows you to use Windows drivers for your wireless card in GNU/Linux. At least two graphical interfaces are available for ndiswrapper, but most distributions and instructions do not bother to mention them — no doubt because anybody likely to use the program is apt to be comfortable at the command line.

To use ndiswrapper, you need at least a 2.6.6 or 2.4.26 kernel in their respective series. You also need the kernel headers for the kernel, gcc, and the wireless-tools package. If you are using an RPM distribution, you can use the dkms-ndiswrapper package from FreshRPMS, which includes the kernel-headers. Should your distribution not have wireless-tools, you can download it from Hewlett-Packard’s Wireless LAN Resources Page.

Before you begin, you also need to know whether you can use your card with ndiswrapper. Run lspci and record the first column entry for your wireless card. Then run lspci -n and use the first column entry from the bare command to locate the line for that card. In the third or fourth column of the line is the PCI ID for the wireless card, which consists of four digits followed by a colon and another four digits — for example, 14e4:4311. With this information, go to the project’s list of supported cards, look up the card by name, then see if the PCI ID is listed. If it is, you should be able to use ndiswrapper; if not, look into the firmware cutter instead.

Next, if you have already tried using ndiswrapper, remove all traces of the previous installation. Start by removing any drivers installed with the program with the command ndiswrapper -r driver. Next, remove the program, using either your distribution’s package management tool, or, if you compiled it from source, by using the command make uninstall in the directory that contains the ndiswrapper files. Then, enter the command modprobe -r ndiswrapper to remove the module from the kernel. If you used ndiswrapper -m to create an alias, run rm -f /etc/modprobe.d/ndiswrapper as well. Finally, delete the loadndisdrive file and any other reference to ndiswrapper from /usr/sbin and the kernel module from /lib/modules//misc. Should your distro store files in other locations, use a search tool to find the files related to ndiswrapper.

Once your system is clean, you can install ndiswrapper, using either your distribution’s package name or the source code available on the ndiswrapper site. Use the command sequence distclean, make, and make install to compile the source.

With this step, you are ready to begin installing the driver. The project’s list of supported drivers, which you used to see if installation was possible, also contains the name and URL of the driver you need. Download the driver to a new directory, and run unzip -a driverfile to decompress it.

Note that, in some of the incomplete sets of instructions you can find on the Internet, you may find other possible drivers available from other sources, and some of them might even work. However, other drivers for different versions of the wireless card model may not work, or may allow your system to detect the card without being able to use it. Currently, too, ndiswrapper supports only Windows XP drivers, so Vista drivers may not work. You should use alternative sources only if the recommended one does not work — and then you are off into the world of trial and error.

If you have a copy of Windows XP on your computer, you can find the .sys driver for your card under Control Panel -> System -> Hardware -> Device Manager. Search in the Windowsinf folder for both the .sys and .inf file of that name and transfer the files to your GNU/Linux distribution.

However you get the driver, find the .inf file associated with it and run the command ndiswrapper -i name.inf to install the driver. If you are using a driver that you have unzipped, you will find the necessary file in the /DRIVER folder in the directory of uncompressed files.

The command copies the necessary files to /etc/ndiswrapper and creates the configuration file for the card. If you run ndiswrapper -l, you can check whether the driver is installed and your system is detecting the device.

At this point, configure the wireless network interface using the programs contained in wireless-tools. Some of the most succinct instructions available are in the ndiswrapper documentation.

When you are satisfied that you can connect to a wireless network, enter the command ndiswrapper -m to load ndiswrapper — and hence the driver — anytime that the wireless interface is activated from a program like wifi-radar and network-manager. If you want the module loaded automatically at boot time, consult your distribution’s documentation for how to do so — in many distributions, you only need to add the line ndiswrapper in /etc/modules or the line modprobe ndiswrapper in /etc/rc.d/rc.local.

Using the Broadcom firmware cutter

The firmware cutter is for use specifically with Broadcom wireless cards. It uses a driver that is part of recent Linux kernels, but extracts the firmware it needs from files provided for Windows (either a file called bcm43xx or bem43xx_mac80211).

The firmware cutter requires at least a 2.6.17-rc2 kernel. As with ndiswrapper, you may also want to install wireless-tools to help you configure your wireless connection.

In addition, check that your wireless card can use a version of the firmware that the program supports. To find the firmware version, enter the command lspci and record the first column entry for your wireless card, then run lspci -vn and locate the entry for the card using the first column entry obtained by running the bare command. In the third or fourth column is the Chip ID, a four digit number, followed by a colon and another four digits. Take the last four digits and refer to the Devices page of the project homepage to see if your card is supported. If you have just bought your computer then the card is almost certainly supported, but you should check to make sure.

If this is not your first attempt to use the firmware cutter, you should also ensure a clean reinstall by removing all traces of previous efforts. You can do so in two ways: either with the command modprobe -r drivername or with echo 'blacklist drivername' >> /etc/modprobe.d/blacklist, which writes the driver to a list of modules that should not be loaded. To avoid confusion, you can also remove any downloaded files from previous attempts. Unlike with ndiswrapper, removing previous versions of the firmware cutter before installing a new one is not necessary.

You can install the firmware cutter from the repositories of many distributions. Alternatively, you can download the latest version from the project’s repository using the command checkout svn://svn.berlios.de/bcm43xx/trunk/sprom.

Once the firmware cutter is installed, your next step is to download the Broadcom firmware itself to a new directory. Just now, the most common source is the OpenWrt repository, but some distributions, such as Ubuntu, have other sources, so you should check the user forums for any customized versions of the firmware. These specialized versions of the firmware may give you a higher chance of using the firmware cutter successfully.

After the firmware is downloaded, change to its directory and run the command /usr/bin/bcm43xx-fwcutter -w /lib/firmware wl_apsta.o. At least one how-to also suggests adding the firmware to the kernel folder with bcm43xx-fwcutter -w /lib/firmware/`uname -r` ~/Desktop/wl_apsta.o>, but that does nothing so far as I can tell from my own experiences.

If, after using wireless-tools, you can establish a wireless connection, you may also choose to add modprobe drivername. Many how-tos leave out this step, and it does not seem necessary, but I mention it for the sake of thoroughness.

Conclusion

Even a summary of what ndiswrapper and the firmware cutter do sounds chancy, so don’t be discouraged if your first efforts at using either fails. Check your distribution’s mailing lists and IRC channels to see if they have any specific information about using these programs, and make sure that you start with a clean system to improve your chances. You may find that a different download source or a different software version or file makes all the difference.

Some day, using these programs may be as obsolete as balancing config.sys in DOS, but, for now, many users may have no other choice. The only other alternatives are to wait in the hopes that native support becomes available before your computer becomes obsolete, or to buy a card that works natively — and no one should be blamed for feeling that they should not have to do either.

Categories:

  • Wireless & Mobile
  • Desktop Hardware