Thursday, April 10, 2008

A note on getting iwlwifi drivers to work on Ubuntu 7.10 Gutsy

Okay. Big thanks to Jun for getting me started on getting rid of my buggy ipw3945 driver that started crashing on me out of nowhere and installing the iwlwifi drivers to support my Intel 3945 wireless card. I am very appreciative of his helpful walk-through, however, I ran into several hitches along the way, so to save myself, and anyone else who may encounter the problem considerable time in the future, I am making a note of it. As an aside, I have my Dell Inspiron 1420 laptop dual booting into Backtrack, and I have previously gone through the installation of the iwlwifi drivers to get my card to do injection on that distro.

From Jun's blog:

1. Download the linux-ubuntu-modules source package

sudo apt-get source linux-ubuntu-modules-`uname -r`

2. Edit the iwlwifi download script to fetch the latest drivers from http://www.intellinuxwireless.org
cd linux-ubuntu-modules-2.6.22-2.6.22/ubuntu/wireless/iwlwifi
edit the BOM script file, set the correct versions and fix the firmware move, here is my diff:

@@ -4,10 +4,10 @@
# only need to do this when you are updating from one version
# if iwlwifi to the next.
#
-IVER=1.1.0
-MVER=10.0.0
-FW3945_VER=2.14.4
-FW4965_VER=4.44.17
+IVER=1.2.23
+MVER=10.0.4
+FW3945_VER=2.14.1.5
+FW4965_VER=4.44.1.20

if [ ! -f iwlwifi-${IVER}.tgz ] ; then wget http://intellinuxwireless.org/iwlwifi/downloads/iwlwifi-${IVER}.tgz; fi
if [ ! -f mac80211-${MVER}.tgz ] ; then wget http://intellinuxwireless.org/mac80211/downloads/mac80211-${MVER}.tgz; fi
@@ -24,13 +24,13 @@
# Note the '-1' in the new firmware file name.
#
tar xzf iwlwifi-3945-ucode-${FW3945_VER}.tgz
-mv iwlwifi-3945-ucode-${FW3945_VER}/iwlwifi-3945.ucode ../../../ubuntu-firmware/iwlwifi/iwlwifi-3945-1.ucode
+mv iwlwifi-3945-ucode-${FW3945_VER}/iwlwifi-3945-1.ucode ../../../ubuntu-firmware/iwlwifi/iwlwifi-3945-1.ucode
rm -rf iwlwifi-3945-ucode-${FW3945_VER}

#
# Note the '-1' in the new firmware file name.
#
tar xzf iwlwifi-4965-ucode-${FW4965_VER}.tgz
-mv iwlwifi-4965-ucode-${FW4965_VER}/iwlwifi-4965.ucode ../../../ubuntu-firmware/iwlwifi/iwlwifi-4965-1.ucode
+mv iwlwifi-4965-ucode-${FW4965_VER}/iwlwifi-4965-1.ucode ../../../ubuntu-firmware/iwlwifi/iwlwifi-4965-1.ucode
rm -rf iwlwifi-4965-ucode-${FW4965_VER}

3. Run the update script so it will fetch and patch the files.

./MUNGE

4. Rebuild the linux-unbuntu-modules, then reinstall the package.

fakeroot debian/rules binary-modules-generic
dpkg -i ../linux-ubuntu-modules-2.6.22-14-generic_2.6.22-14.37_i386.deb


Now my wireless is working flawlessly.

Not so easy for me.

First off when running the debian/rules you have to make sure you are in the top level directory "linux-ubuntu-modules-2.6.22-2.6.22/". This is probably obvious to some, and trivial, but it did trip me up so I am including it. (Also sudo before running "./MUNGE").

Next, I ran into a hiccup after the modules compiled when it tried to run a "dh_testdir". A quick google of the name, and I found that I needed to install the debhelper package which I remember from something else I did a while back is essential for building debian packages. I installed with

sudo apt-get install debhelper


and re-ran the debian/rules binary-modules-generic. This time, it created the .deb package smoothly (and it did not have to recompile all the modules).

The install of the deb package went fine as well, but then I ran into more problems.

1) You have to blacklist your ipw3945 drivers in /etc/modprobe.d/blacklist to keep it from starting every boot.
2) You need to add iwl3945 to /etc/modules so that it inserts the module on boot
3) To get rid of the funky crap you see when runing ifconfig (like eth1 showing up as Link encap: UNSPEC, and having the wlan0_ren as an additional interface) you need to open up /etc/udev/rules.d/70-persistent-net.rules and delete the two lines for the old interface using the ipw3945 driver. Mine looked like:
# PCI device 0x8086:0x4227 (ipw3945)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:13:02:4c:12:12",NAME="eth1
(Except for the mac address =P )

4) Unload and reload you iwl3945 module like:

sudo rmmod iwl3945
sudo modprobe iwl3945


Now you should have a new entry in your 70-persistent-net.rules file like:

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:13:02:4c:12:12", ATTRS{type}=="1", NAME="wlan0"
And an ifconfig will show no more eth1 interface, but a wlan0, which should show up with the correct mac address. You will also have an additional entry called wmaster0, but this is normal. It is the same way for my Backtrack installation using the iwl3945 drivers. I have now spent quite a bit of time writing this as since I got the drivers working and I haven't had any problems. The ipw3945 drivers surely would have crashed by now, and I would have had to reboot.

Additional links I used in this process:

http://ubuntuforums.org/showthread.php?t=579742
http://wiki.debian.org/iwlwifi#head-c9ab967d827d9e5de52656b78edab5f349bc70f6

No comments: