This howto was a collaborative effort and thanks go to Moonie and Hawkwind for all of the work that they put into it.
You've got wireless and would like to use it in Linux. Sometimes this requires the use of ndiswrapper. The ndiswrapper project allows you to use the Windows wireless drivers in Linux. This howto is for Mandriva Linux, how well it will work on other distro's I have no idea. You must follow the instructions EXACTLY to be successful and it is highly recommended that you read the entire howto once before beginning.
A complete list of cards supported by ndiswrapper can be found here: http://ndiswrapper.sourceforge.net/mediawiki/index.php/List
The first thing you'll need to do is to remove the Mandriva ndiswrapper package, if it is installed. As root do the following in a terminal:
Now you need to make sure there is nothing left over on the system from ndiswrapper. Again, as root do:
updatedb && locate ndiswrapper
If the above command returned anything, then you need to remove them from the system. Use the following command, as root:
rm -rf /path/to/file
Just to be sure, check again that there are no ndiswrapper remnants on the system:
updatedb && locate ndiswrapper
Ok, now you need to install the kernel-source that matches the running kernel that you are using. You can find your version of your running kernel with:
For purposes of this howto, I'll be talking about LE2005 versions. The running kernel is 2.6.11-6mdk which means that I would need the 2.6.11-6mdk kernel-source. To install that package:
NOTE: If you already had kernel-source installed, uninstall it and reinstall it!
You should also have wireless-tools installed:
For, at least, Mandriva 10.1 and LE2005 you now need to edit the kernel-source Makefile. To do so, change to the directory containing the kernel-source and view its contents:
cd /usr/src/linux && ls
You should see a file listed that is named Makefile. Edit the Makefile as root using whatever editor that you prefer. On about line 4 you will see a line that says:
EXTRAVERSION = -6mdkcustom
Edit that line to match what 'uname -r' told you.
If 'uname -r' said -6mdk then change -6mdkcustom to -6mdk.
If 'uname -r' said -6mdksmp then change -6mdkcustom to -6mdksmp.
The other kernels work in the same manner.
Ok, now that you have the Makefile edited, it's time to run a few commands, as root, to make that change take effect:
cp /boot/config-[yourkernelversion] /usr/src/linux/.config && cd /usr/src/linux && make mrproper && make oldconfig && make custom writing service
Edit the above command and replace [yourkernelversion] with the kernel version you are running. You can always 'ls /boot' to see the exact name. This may take a while to run so go get some coffee or something.
Now you need to get the latest ndiswrapper from http://sourceforge.net/projects/ndiswrapper
Get the latest stable version, do not get a beta!
This will be a tar.gz file and you'll need to uncompress it as a normal user:
tar zxvf ndiswrapper-[version].tar.gz
Now cd to the directory that ndiswrapper created and uncompressed itself to:
Now build ndiswrapper (still in the ndiswrapper directory) by running:
Now change to root user (you may then need to cd back to the ndiswrapper directory) and run:
Ndiswrapper should now be built and it is time to install the Windows driver.
You need to download the Windows driver for your card. To identify the driver that you need, first identify the card you have with the 'lspci' command and note the first column (02:02.0 in this example).
Now run 'lspci -n' and find the line corresponding to column one of the 'lspci' command. The PCI ID is the third column (or fourth in some distributions) and is 1260:3873 in this example.
Now you need to get the Windows driver for this chipset. In the list of drivers, find an entry for the same PCI ID and download the driver corresponding to it. Unpack the Windows driver with unzip/cabextract/unshield tools and find the INF file (i.e., file with .INF or .inf extension) and the SYS file (i.e., file with .SYS or .sys extension). If there are multiple INF/SYS files, you may have to look in the List to see if there are any hints about which of them should be used. Make sure the INF file, SYS file and any BIN files (for example, TI drivers use BIN firmware files) are all in one directory. Now use 'ndiswrapper' tool to install the driver with:
ndiswrapper -i INF filename
This should copy all needed files to /etc/ndiswrapper and also creates the config files for your card.
If you should see this, 'basename: too many arguments', it means it may be having trouble due to spaces in the directory names.
After installing the drivers, you can now check the status of your installed drivers:
If you have installed the correct driver, you should see something like this:
Installed ndis drivers
bcmwl5 hardware present
Where "present" means that you have a card that can be used with the driver installed. In this case, broadcom driver bcmwl5 is used.
If everything has gone well to this point, it is now time to load the module:
If you got no error, then the driver should now be loaded. You can verify this by checking system log (produced by dmesg).
If the driver was loaded successfully, you should see something similar to the following message:
ndiswrapper version V loaded
Make sure the version V here matches the version of the ndiswrapper package that you downloaded and installed. If you get a different version, you should uninstall ndiswrapper and go back to the beginning.
If you don't get the the above message, check if ndiswrapper is loaded with the lsmod command:
If ndiswrapper is not listed with the 'lsmod' command then check dmesg for an error message.
If you have successfully installed windows drivers earlier (with ndiswrapper -i INF filename), the ndiswrapper module will load them all. You should then see the following messages in system log for each of the drivers.
ndiswrapper: driver driver1 added
If you don't see these messages, it usually means that there are no (usable) drivers installed in the /etc/ndiswrapper directory. Check if the /etc/ndiswrapper directory has one sub-directory for each driver and if in each driver's directory there are inf, sys and conf files. Otherwise, you may need to repeat the 'ndiswrapper -i INF filename' and 'ndiswrapper -l' steps.
If the system has a card that works with one of the loaded drivers, you should see the following message in the system log:
wlan0: ndiswrapper ethernet device xx:xx:xx:xx:xx:xx
Use iwconfig to configure the wireless network interface. First, see if the interface is available with:
This will print the wireless interface (e.g., wlan0). In the examples below wlan0 is used, replace wlan0 with the interface reported by iwconfig above. The wireless configuration to be used should match what your Access Point (AP) uses. First, find out if you can see your AP with:
iwlist wlan0 scan
If this lists your AP, you can continue. Otherwise, you may have one of two problems: Your AP doesn't broadcast SSID or the radio of the card is turned off.
If you see the AP in the scan above, set the operating mode of the interface according to your setup. In most cases this will be mode Managed.
iwconfig wlan0 mode Managed
If you use encryption (WEP), set the key:
iwconfig wlan0 key restricted XXXXXXXX
You can use 6 hex digits for 40-bit encryption or 10 hex digits for 128-bit encryption. You may need to use open security mode instead of restricted depending on the setup of your AP. If you want to write the key in ASCII use s: (e.g. iwconfig wlan0 key restricted s:password).
Set the network name, replace ESSID with the network name used by your AP:
iwconfig wlan0 essid ESSID
If essid is not set, then ndiswrapper itself works and the rest of this section may or may not help you.
Now, setup the network parameters for the interface wlan0. This varies from distribution to distribution. Refer to your distribution's documents on how to do this. Once this is done, you can use network tools to bring up the network:
ifconfig wlan0 up
Once everything works fine, you can write the correct modprobe settings to load ndiswrapper automatically when wlan0 interface is used, by running:
Note that this doesn't automatically load ndiswrapper module at boot time. If you want the module to be loaded automatically at boot time, you should configure your module setup, which depends on the distribution. Most distributions will load all modules listed in /etc/modules at boot time. For them, you can add a line in /etc/modules: