I've been spending some time in the #ubuntu IRC channel and on the forums of late, and one of the most asked questions pertains to making wireless chips work in Ubuntu. My own chipset is a Broadcom BCM4306 and the ndiswrapper packages that come with Hoary wouldn't work for me. I needed to compile the ndiswrapper-1.1.tar.gz package available at the ndiswrapper website. Since others might also need to do this also, I'll include those directions here.
I (Seb Payne - Someone else) have got ndiswrapper-1.1 to work fine with Ubuntu Hoary and a D-Link DWL-G122 USB adaptor with the Realtek chipset. It works with WPA, DHCP, netapplet and everything I've thrown at it!
Notes and Terminology Used in the Wiki Page
There have been reports of confusion by new users with regards to some of the terminology used in this page. I will attempt to clear them up here since a) I don't know how to change the terminology used to make it simpler, and b) to embed explanations in the instructions would make it more confusing I'm afraid.
It should be noted that Ubuntu comes with an earlier version of the ndiswrapper kernel modules that are pre-compiled. Many users find success by simply using these. To see if the precompiled modules work for you, simply install the ndiswrapper-utils packages from the Synaptic Package Manager and skip the steps below in the "Compiling from Source" section. Be sure to have the very latest version of the INF file (the windows driver). You may need to download it from the manufacturer, as the one that came with the card may be a version older than the one used to develop ndiswrapper.
The instructions make reference to the user's $HOME directory. This is typically dependant on your username, but is always the directory you end up in when you type cd as your regular user. As an example, my username is dcraven, so my $HOME directory is /home/dcraven. Therefore, when the instructions below make reference to a directory called $HOME/windows_drivers/, I would substitute /home/dcraven/windows_drivers/.
Step #2 in the "Compiling from Source" section involves creating a root (superuser) shell with the command sudo -s. This is done to avoid the need to prepend each instruction with sudo. It has been reported that using the sudo method causes grief with some of the commands given on this wiki page, so creating a root shell will allieviate some of this pain. To exit the root shell and return to being your normal user, type exit.
Before going any further, are you using a Live CD? If you are, give up now. This won't work. Rest assured however, that if you actually do install it on the real hardware, the directions here will work flawlessly. Have faith
If you do not know what chipset your wifi card uses, issue the lspci command in a terminal. It should be listed there. In order to see if your chipset is known to work with the ndiswrapper module, find your card in the list here. That link might even provide you with useful tips to get your specific card to work, as well as providing a link to the working Windows drivers.
Compiling from Source
To make these instructions simpler, I'll assume that you have downloaded the Windows drivers for your wifi card already and that they are located in $HOME/windows_drivers/. I'll also assume that you are using the bcmwl5 (Broadcom) drivers, but you can easily modify these instructions to suit your own situation.
1. First, download the ndiswrapper-1.1.tar.gz file from here to your $HOME directory.
2. Get yourself in a root shell by running sudo -s followed by your user's password.
3. Now before we attempt to build the source, let's make sure we have the required tools to make it work. The following command should get us everything we need.
apt-get install debhelper build-essential fakeroot linux-headers-$(uname -r)
4. Untar the ndiswrapper-1.1.tar.gz file to your /usr/src directory. NOTE: the location where you untar the source doesn't really matter, but the rest of these instructions will assume /usr/src.
cd /usr/src tar xvzf ~/ndiswrapper-1.1.tar.gz
5. By default, the rules file that is responsible for specifying Debian packaging parameters specifies an install directory different from where Ubuntu keeps the same module. I adjusted my rules file to install in the proper place like so
cd /usr/src/ndiswrapper-1.1 sed -e "s/misc/kernel\/drivers\/net\/ndiswrapper/g" debian/rules > debian/temp mv debian/temp debian/rules
6. Enter the source directory and issue the make deb command.
cd /usr/src/ndiswrapper-1.1/ make deb
7. In your /usr/src directory, if all went well, you should find two brand new .deb package files. Let's install them, overwriting the modules that came with Hoary that don't work for us.
cd /usr/src dpkg -i --force-overwrite ndiswrapper-utils_1.1-1_i386.deb dpkg -i --force-overwrite ndiswrapper-modules-$(uname -r)_1.1-1_i386.deb
Installing the Windows Drivers
This part is short and simple, but I created a section for it because people that don't need to compile the ndiswrapper from source can just start from here. I'll start the numbers from 1. again too.
1. Important: Do NOT use the drivers on your bundled wifi card CD. They may work, but you may experience serious problems. Instead, you need to download appropriate Windows XP driver for your card from the ndiswrapper wiki's list. To identify the driver that you need, first identify the card you have with 'lspci' and note the first column such as 0000:00:0c.0 and then find out the PCI ID of the card that with 'lspci -n' corresponding to the first column of 'lspci' output. The PCI ID is third column or fourth in some distributions and of the form '104c:8400'. Now you need to get the Windows driver for this chipset. In the ndiswrapper wiki list, find out an entry for the same PCI ID and download the driver corresponding to it. Do not worry if the driver link does not have the exact name of your wifi card as many cards have the same chipsets. Decompress the Windows driver with an unzip tool and find both the INF file (.INF or .inf extension) and the SYS file (.SYS or .sys extension). (this is important as some drivers have a connection with the .sys file which makes the driver work properly) If there are multiple INF/SYS files, try looking at the list to see if there are any hints about which should be used. Make sure the INF file, SYS file and any BIN files (TI drivers use BIN files) are all in one directory on your harddrive.
2. Install the Windows driver with the following command. Remember, substitute your driver filename for mine. In the example given below, my driver filename is bcmw15.inf yours may be different depending on your wireless hardware, but it will always end with the .inf file extension. For some cards, it may be necessary to have both the .inf and the .sys files in the same location before using the following command.
ndiswrapper -i ~/windows_drivers/bcmwl5.inf
3. Now we create and alias for wlan0 into module configuration file so that this module is used whenever the wireless interface is started.
4. Lastly, before you configure your wireless connection, load your new module in the running kernel.
5. You should be able to check whether the driver was loaded successfully now and whether the hardware has been detected or not.
ndiswrapper -l Installed ndis drivers: bcmwl5 driver present, hardware present
6. You also need to add the ndiswrapper module to the startup modules so Ubuntu can setup the device when your machine starts. You need to add ndiswrapper to the end of the /etc/modules file. You can do this by:
sudo gedit /etc/modules
Add ndiswrapper to the end of this, save and close. When your machine reboots, it will find the Wireless Adaptor and start it up.
Configure Your New Wifi Interface
A great resource is already on this wiki at [WiFiHowto].
This wiki page has benefited from suggestions from:
Their suggestions have been integrated into the instructions above wherever it was feasable. If you have further suggestions, please feel free to leave a comment at the bottom of this page.
I had to also install gcc-3.4 on Breezy Badger in order to get these instructions to work. You may want to include that under the section where you compile ndiswrapper. -- TomPurl