Wednesday, March 24, 2010

How to install broadcom BCM4312 wireless driver in ubuntu 9.10

I purchased a new Dell Inspiron 1525 laptop.
I tried ubuntu 9.10 live cd but the wireless was not working. Infact the hardware drivers in system>administraton shows i need to download driver to use my broadcom wireless device. I used wired connection to download the package and activated the hardware from it. It started working.

So with same hope. Hope that everything will work in my machine, I installed ubuntu 9.10 in my laptop. But unexpected happened. my wireless device was not working and as i rechecked hardware drivers tool in system>administration, there is no device shown.

I did #lspci in terminal and then found that my wireless device is listed as:
0b:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g (rev 01)

I gave multiple tries installing and removing broadcom package as listed in synaptic list. To my surprise nothing positive happened. In one point my linux was not booting with same kernel (2.6.31-20-generic) saying "kernel panic". I tried with another kernel (2.6.31-14-generic) from grub and linux booted. I then went through all sort of forum and mailing lists. But no solution.

At one point i reached this site:

Success story is below:

Download wireless driver from the link
Download as per your OS architecture. My was 32bit so I used 32-bit driver version

Extract it and read the readme file
On Ubuntu, you will need headers and tools to compile/make the driver. Type following lines in terminal:
# sudo apt-get install build-essential linux-headers-generic
# sudo apt-get build-dep linux

To check to see if you have this directory do this:

# ls /lib/modules/`uname -r`/build

Now go to terminal and type:

# mkdir hybrid_wl
# cd hybrid_wl
# tar xzf /hybrid-portsrc-x86_32-v5.60.48.36.tar.gz
(in my case: /home/prabin/Downloads/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz)

Now make:

# make clean (optional)
# make

now when its done.. wl.ko file along with other files will be created.

Let me be lazy and copy steps from readme file

Fresh installation:
1: Remove any other drivers for the Broadcom wireless device.

There are several open source drivers that are used to drive Broadcom 802.11
chips such as b43 and ssb. They will conflict with this driver and need
to be uninstalled before this driver can be installed. Any previous
revisions of the wl driver also need to be removed.

Note: On some systems such as Ubuntu 9.10, the ssb module may load during
boot even though it is blacklisted (see note under Common Issues on how to
resolve this). Nevertheless, ssb still must be removed
(by hand or script) before wl is loaded. The wl driver will not function
properly if ssb the module is loaded.

# lsmod | grep "b43\|ssb\|wl"

If any of these are installed, remove them:
# rmmod b43
# rmmod ssb
# rmmod wl

To blacklist these drivers and prevent them from loading in the future:
# echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf
# echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf

2: Insmod the driver.

Otherwise, if you have not previously installed a wl driver, you'll need
to add a security module before using the wl module. Most newer systems
use lib80211 while others use ieee80211_crypt_tkip. See which one works for
your system.

# modprobe lib80211
# modprobe ieee80211_crypt_tkip

# insmod wl.ko

wl.ko is now operational. It may take several seconds for the Network
Manager to notice a new network driver has been installed and show the
surrounding wireless networks.

Now you are done.

It must work but in my case i had to type :

# modprobe lib80211
# insmod wl.ko

every time after login to my account.

I tried with rc5.d and init.d making script to make it run at startup but i failed. for few days I kept the script file in "startup applications"(system>preferences)

Finally AKS(friend of mine) told me to add both lines above to /etc/rc.local

I did so above the line "exit 0"

Hurray! its working now...

The rc.local now looks:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

modprobe lib80211
insmod /lib/modules/2.6.31-20-generic/build/hybrid_wl/wl.ko

exit 0

No comments: