Friday, 4 September 2009

Wireless Firmware Through Ndiswrapper

In my previous post, I set out a way to load broadcom firmware into a running Live CD distribution.

I said you had to firstly copy the firmware from an installation with wireless up and running which some what defeated the point. In order to avoid turning the last post into War and fucking Peace I avoided getting bogged down in the alternative ways to get a hold of the broadcom firmware files. I present hereunder the ndiswrapper method. You will need:

An Ubuntu Live CD
The Windows drivers for the card
Ndiswrapper deb files.

Step One.
Download the latest ubuntu live cd, and burn or use unetbootin to install it to a usb stick.

Step Two.
Download the windows wireless drivers for your card. Extract the file and find the 'Drivers' folder. It should contain three files, *.sys, *.inf, and *.cat. Those three are all you need. Copy them to a folder on the USB Key called 'drivers'.

Step Three.
Download the ndiswrapper deb files.
Ndiswrapper is a linux utility to wrap windows drivers up in linux code so they can be used on linux. It may be installed already on your Live CD. Best to get the .deb files (ubuntu install files) just in case.
You will need to download ndiswrapper-common, ndiswrapper-utils, and ndisgtk. Copy the .deb files into the 'drivers' folder on your USB Key.

Step Four.
Boot the Live CD. Mount your USB key.

Step Five.
Make sure that no ndiswrapper installation is hanging about already by running these commands in a terminal window:
sudo modprobe -r ndiswrapper
sudo ndiswrapper -r bcmwl5
sudo apt-get remove ndiswrapper-utils-1.9
sudo rm -r /etc/ndiswrapper/
sudo rm -r /etc/modprobe.d/ndiswrapper
Step Six.
Install ndiswrapper.
Open a terminal window, and navigate to your usb key 'drivers' directory. For instance:
cd /media/disk/drivers
Then run these commands [WARNING make sure the file names match up. So, if you have downloaded a more up to date version of these, change the file names. Run the 'ls' command to check the full filenames]:
sudo dpkg -i ./ndiswrapper-common_1.50-1ubuntu1_all.deb
sudo dpkg -i ./ndiswrapper-utils-1.9_1.50-1ubuntu1_i386.deb
sudo dpkg -i ./ndisgtk_0.8.3-1_i386.deb
The './' before the filename just tells linux that the file that comes next is in the current folder.

Step Seven.
Run ndiswrapper from the terminal using this command:
sudo ndisgtk
You then use the gui that pops up to locate the *.inf file for the appropriate driver. This is the file you copied in Step Two above.

Step Eight.
At this stage you may think you have managed to get wireless functioning, after all there is a nice box on the screen saying 'Hardware Detected: Yes'. Oh, you poor naive fool. The chances are that the b43 driver module is still hogging the wireless card. To check this run in a terminal:
sudo lshw -C network 
and check for driver=b43... instead of driver=ndis...
If that is the case run these commands in terminal:
sudo rmmod b43
sudo rmmod b44
sudo rmmod b43legacy
sudo rmmod wl
sudo rmmod ssb
sudo rmmod ndiswrapper
sudo modprobe ndiswrapper
sudo modprobe ssb
sudo modprobe b44 
You then run the:
sudo lshw -C network 
command again, and the b43 should have changed to ndis...

Step Nine.
Log onto your wireless network using network manager.

Step Ten.
Install b43-fwcutter.
Open a terminal window and type:
sudo apt-get install b43-fwcutter
'apt-get' is an ubuntu command to download a piece of software from the ubuntu servers. The install option installs the software once it has been downloaded. The 'b43-fwcutter' program is a utility to get the firmware that is the holy grail of this post. As part of the installation procedure you will be asked to agree to download and install the firmware. Say yes. If you panic and say no, then rerunning the above command will not work. Instead you have to run:
sudo dpkg-reconfigure b43-fwcutter
Step Eleven.
If you now look in /lib/firmware/ you will find the b43 folder referred to in my previous post. You can just copy the contents of that folder onto your usb stick and use them in the way described in said post.

Step Twelve.
(This is the important bit)
Save the b43 folder and it's contents somewhere safe. You will reuse this everytime you want to install linux or boot a Live CD on your machine. It is really easy - it is a tiny directory. It p7zips to 40k. But remember - do not email to anyone that needs it and can't be arsed going through the previous eleven steps, because that would be wrong.

No comments:

Post a Comment