Trying to achieve a more stable hybrid (broadcom-wl) kernel module for broadcom 4328

On my Macbook (4,1) I am currently using Debian with kernel 2.6.30-1-686-bigmem. This Macbook has Broadcom 4328 wireless chipset installed (02:00.0 Network controller: Broadcom Corporation BCM4328 802.11a/b/g/n (rev 03)) and unfortunately the necessary kernel module provided by Broadcom is pretty unstable. Or very unstable. Oh well…it’s totally unstable.

I had random freezes, usually when I first booted and tried to modprobe the module. After some searching around the net and a lot of experiments I’ve managed to create a kernel module that looks quite stable. At least I stopped getting any more lockups and freezes…To reproduce the module with the patches I’ve used follow the directions bellow step by step.

Find your kernel version:
mybox:~# uname -r
2.6.30-1-686-bigmem

Install kernel header files related to the kernel version you found (on the above example it is: 2.6.30-1-686-bigmem):
mybox:~# aptitude install linux-headers-2.6.30-1-686-bigmem

Remember to replace the version (2.6.30-1-6-bigmem) with the output of your mybox:~# uname -r

Create necessary dirs:
mybox:~# mkdir hybrid_wl
mybox:~# cd hybrid_wl

Download Linux drivers package from Broadcom:
802.11 Linux STA 32-bit Driver
(Driver info site: 802.11 Linux STA driver)
mybox:~/hybrid_wl# wget http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-x86_32-v5_10_91_9.tar.gz

Download a few more patches from Archlinux and Gentoo:
hidden-essid patch
2.6.30 patch 1
2.6.30 patch 2
hybrid-portsrc-x86_32-v5_10_91_9-convert_to_net_device_ops.diff
mybox:~/hybrid_wl# wget http://aur.archlinux.org/packages/broadcom-wl/broadcom-wl/hidden-essid.patch
mybox:~/hybrid_wl# wget http://aur.archlinux.org/packages/broadcom-wl/broadcom-wl/broadcom-sta-5.10.91.9-linux-2.6.30.patch
mybox:~/hybrid_wl# wget http://aur.archlinux.org/packages/broadcom-wl/broadcom-wl/broadcom-sta-5.10.91.9-linux-2.6.30-2.patch
mybox:~/hybrid_wl# wget -O hybrid-portsrc-x86_32-v5_10_91_9-convert_to_net_device_ops.diff http://bugs.gentoo.org/attachment.cgi?id=195182

Extract package:
mybox:~/hybrid_wl# tar -xzf /path/to/hybrid-portsrc-x86_32-v5_10_91_9.tar.gz

Start Patching:
mybox:~/hybrid_wl# sed -i hidden-essid.patch -e 's|5.10.79.10|src/wl/sys|g'
mybox:~/hybrid_wl# patch -p0 < hidden-essid.patch
patching file src/wl/sys/wl_iw.c
mybox:~/hybrid_wl# sed -i broadcom-sta-5.10.91.9-linux-2.6.30.patch -e 's|hybrid-portsrc-x86_32-v5_10_91_9.orig/||g'
mybox:~/hybrid_wl# sed -i broadcom-sta-5.10.91.9-linux-2.6.30.patch -e 's|hybrid-portsrc-x86_32-v5_10_91_9/||g'
mybox:~/hybrid_wl# patch -p0 <broadcom-sta-5.10.91.9-linux-2.6.30.patch
patching file src/wl/sys/wl_iw.c
Hunk #1 succeeded at 611 (offset 1 line).
Hunk #2 succeeded at 640 (offset 1 line).
Hunk #3 succeeded at 1119 (offset 1 line).
Hunk #4 succeeded at 1147 (offset 1 line).
Hunk #5 succeeded at 1807 (offset 1 line).
Hunk #6 succeeded at 1942 (offset 1 line).
patching file src/wl/sys/wl_linux.c
patching file src/wl/sys/wl_linux.h
mybox:~/hybrid_wl# patch -p0 < broadcom-sta-5.10.91.9-linux-2.6.30-2.patch
patching file src/wl/sys/wl_linux.c
mybox:~/hybrid_wl# sed -i hybrid-portsrc-x86_32-v5_10_91_9-convert_to_net_device_ops.diff -e 's|a/src/|src/|g'
mybox:~/hybrid_wl# sed -i hybrid-portsrc-x86_32-v5_10_91_9-convert_to_net_device_ops.diff -e 's|b/src/|src/|g'
mybox:~/hybrid_wl# patch -p0 < hybrid-portsrc-x86_32-v5_10_91_9-convert_to_net_device_ops.diff
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 225 (offset 6 lines).
patching file src/wl/sys/wl_iw.c

Compile the kernel module:
mybox:~/hybrid_wl# make -C /lib/modules/2.6.30-1-686-bigmem/build M=`pwd` clean
make: Entering directory `/usr/src/linux-headers-2.6.30-1-686-bigmem'
make: Leaving directory `/usr/src/linux-headers-2.6.30-1-686-bigmem'
mybox:~/hybrid_wl# make -C /lib/modules/2.6.30-1-686-bigmem/build M=`pwd`
make: Entering directory `/usr/src/linux-headers-2.6.30-1-686-bigmem'
LD /root/hybrid_wl/built-in.o
CC [M] /root/hybrid_wl/src/wl/sys/wl_linux.o
CC [M] /root/hybrid_wl/src/wl/sys/wl_iw.o
CC [M] /root/hybrid_wl/src/shared/linux_osl.o
LD [M] /root/hybrid_wl/wl.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: modpost: missing MODULE_LICENSE() in /root/hybrid_wl/wl.o
see include/linux/module.h for more information
CC /root/hybrid_wl/wl.mod.o
LD [M] /root/hybrid_wl/wl.ko
make: Leaving directory `/usr/src/linux-headers-2.6.30-1-686-bigmem'

Install the new module:
mybox:~/hybrid_wl# cp wl.ko /lib/modules/2.6.30-1-686-bigmem/kernel/drivers/net/wireless/
mybox:~/hybrid_wl# depmod
mybox:~/hybrid_wl# modprobe wl

Check if everything loads correctly:
mybox:~/hybrid_wl# dmesg |tail
[ 66.229797] lib80211: common routines for IEEE802.11 drivers
[ 66.229805] lib80211_crypt: registered algorithm 'NULL'
[ 66.301793] wl: module license 'unspecified' taints kernel.
[ 66.301802] Disabling lock debugging due to kernel taint
[ 66.305919] wl 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[ 66.305933] wl 0000:02:00.0: setting latency timer to 64
[ 66.406146] lib80211_crypt: registered algorithm 'TKIP'
[ 66.408646] eth1: Broadcom BCM4328 802.11 Wireless Controller 5.10.91.9
[ 76.524135] eth1: no IPv6 routers present

You can also chek the iwconfig output. Hopefully everything will be fine…
I hope this saves a few hours of searching and experimenting for some people…

References:
1) 802.11 Linux STA driver
2) AUR broadcom-wl 5.10.91.9-2
3) Gentoo Bug: 284450 (New ebuild: net/wireless/broadcom-sta)

9 Responses to “Trying to achieve a more stable hybrid (broadcom-wl) kernel module for broadcom 4328”

  1. September 1st, 2009 | 06:03
    Using Mozilla Firefox Mozilla Firefox 3.0.6 on Debian GNU/Linux Debian GNU/Linux

    hi!

    it was a very useful post.
    i’m using debian lenny on a macbook 4.1 too, and yesterday i decided to upgrade to SID. Now folowing your post, i can get my wireless working again.

    Let me do more one question….. with 2.6.26 kernel i always get an error “Disabling IRQ #11” and a freeze on my system, do you know something about?

    i found a lot of posts talking about it on google, but nothing solved the problem, my hope is that with the kernel 2.6.30 it doesn’t appear anymore.

    thank you!!

  2. September 1st, 2009 | 11:55
    Using Mozilla Firefox Mozilla Firefox 3.5.2 on Linux Linux

    Hey, thanks for your kind words. I used to have some of these problems (Disabling IRQ #11) with 2.6.26 as well, but I decided to upgrade to 2.6.30 and fix the problem there. I never looked back at 2.6.26 after that…Right now the chip works great and I can suspend/resume without fear that the laptop will freeze.

  3. johnny q
    September 14th, 2009 | 21:15
    Using Mozilla Firefox Mozilla Firefox 3.0.14 on Ubuntu Linux Ubuntu Linux

    hi just a complication with mine, i was hoping to get some help with?
    umm turns out when i type

    [code]john@mobius:/lib/modules/2.6.30.5-ep0/hybrid_wl$ patch -p1 < broadcom-sta-5.10.91.9-linux-2.6.30-2.patch
    The program 'patch' is currently not installed. You can install it by typing:
    sudo apt-get install patch
    bash: patch: command not found
    [/code]

    that happens, it says that patch is not installed? ok i said, i tried to install it and

    [code] john@mobius:/lib/modules/2.6.30.5-ep0/hybrid_wl$ sudo apt-get install patch
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Suggested packages:
    diff-doc
    The following NEW packages will be installed:
    patch
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 100kB of archives.
    After this operation, 213kB of additional disk space will be used.
    Get:1 http://archive.ubuntu.com jaunty/main patch 2.5.9-5 [100kB]
    Fetched 100kB in 0s (116kB/s)
    debconf: unable to initialize frontend: Dialog
    debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
    debconf: falling back to frontend: Readline
    Selecting previously deselected package patch.
    (Reading database … 102689 files and directories currently installed.)
    Unpacking patch (from …/patch_2.5.9-5_i386.deb) …
    Processing triggers for man-db …
    Setting up patch (2.5.9-5) …
    E: Directory '/var/log/apt/' missing
    [/code] apperently thats missing, any ideas? do i do a mkdir? any help is greatly appreciated thanks in advance

  4. September 14th, 2009 | 23:59
    Using Mozilla Firefox Mozilla Firefox 3.5.2 on Linux Linux

    Check this: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/220239/comments/5 might help… I don’t have any ubuntu installation to test it though…

  5. Umesh
    September 15th, 2009 | 18:19
    Using Opera Opera 9.80 on Linux Linux

    Hi, thanks to your kind support. (I am pretty new in ubuntu) i’ve just updated my jaunty kernel to 2.6.31-020631rc9-generic and after that B43 wireless driver stoped functioning. after burning lots of hours, on google i found this article and now my wireless works beautifully. Thanks again..

  6. johnny q
    September 16th, 2009 | 05:55
    Using Mozilla Firefox Mozilla Firefox 3.0.14 on Ubuntu Linux Ubuntu Linux

    -.-” i really need this patch. i tried this yesterday and i failed, so i wanted to do it again from step one, but now i’m stuck there i’m trying to intsall the kernal header and this pops up.

    Couldn’t find any package whose name or description matched “linux-headers-2.6.30-1-686-bigmem”
    Couldn’t find any package whose name or description matched “linux-headers-2.6.30-1-686-bigmem”

    and says no header will be installed, upgraded, removed. so forth.

    what gives?

  7. johnny q
    September 16th, 2009 | 06:00
    Using Mozilla Firefox Mozilla Firefox 3.0.14 on Ubuntu Linux Ubuntu Linux

    ohhh wait nvm fixed my problem, i dident see the part that said i can replace it with my own 2.6.xx.xx

  8. Roy
    December 11th, 2009 | 09:21
    Using Mozilla Firefox Mozilla Firefox 3.0.15 on Ubuntu Linux Ubuntu Linux

    I am trying to learn a few things about openwrt.
    I plan to use the broadcom linux kernel instead of openwrt kernel and want to compile it.it is throwing up errors..is it possible in any way..if so can you kindly refer as to how…

    Thanks
    -Roy

  9. kebab
    December 17th, 2009 | 22:28
    Using Konqueror Konqueror 4.3 on Linux Linux

    Hi

    I tried to follow the step but I always get this error:

    salade-tomate-oignon:/home/kebab/hybrid_wl# patch -p0 < hidden-essid.patch
    patching file src/wl/sys/wl_iw.c
    Hunk #1 FAILED at 580.
    1 out of 1 hunk FAILED — saving rejects to file src/wl/sys/wl_iw.c.rej

    If anyone got an idea, I'm desperate.

Leave a reply