LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Blogs > frandalla
User Name
Password

Notices

Rate this Entry

Patching 802.11 Linux STA driver for Kernel 2.6.37

Posted 02-07-2011 at 10:12 AM by frandalla
Updated 02-18-2011 at 06:01 PM by frandalla

[UPDATE: Sent an email to Broadcom about it, including my patch, and the answer was that their internal version works fine but they'll only release a patch if many people complain about it)

(If you don't want to read about the problem and just want the patched driver go to the end of this post)
I've been using Linux, and particularly Slackware, for sometime and I've seen my share of problems with hardware support. Things definitely work a great deal easier than before but there's always that piece of hardware that doesn't really go as we expected. I think we all agree that Broadcom one of the biggest contributors to these hardware frustrations.

I just got an Acer 753-N32C/2 and it has one of the dreaded Broadcom Wifi boards. More specifically a Broadcom 43225.

As Broadcom released its own driver I decided to go with it and it worked beautifully until I decided to upgrade my kernel from 2.6.35 to 2.6.37.

When I tried to recompile Broadcom's driver for the new kernel, it would keep giving me an annoying error:
Code:
  CC [M]  /home/dalla/Downloads/broadcom/src/wl/sys/wl_linux.o
/home/dalla/Downloads/broadcom/src/wl/sys/wl_linux.c: In function 'wl_attach':
/home/dalla/Downloads/broadcom/src/wl/sys/wl_linux.c:485:3: error: implicit declaration of function 'init_MUTEX'
make[2]: *** [/home/dalla/Downloads/broadcom/src/wl/sys/wl_linux.o] Error 1
make[1]: *** [_module_/home/dalla/Downloads/broadcom] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.37'
make: *** [all] Error 2
So there's a guy called init_MUTEX that seems to be our villain. So I went on to search on that guy. It happens that init_MUTEX was removed from the kernel being substituted by sema_init.
(actualy it wasn't subsitituted, init_MUTEX was an alias that pointed to sema_init but let's leave this conversation for another time - or if you want, you can always ask through comments)

So, what can we do about it?
We have to change the drivers source code to reflect the change to the kernel.
So we go the line 485 of wl_linux.c (in src/wl/sys) and change the line:
Code:
init_MUTEX(&wl->sem)
to

Code:
sema_init(&wl->sem,1)
Right? But then, what happens to the older kernels? We need a more elegant solution for the problem. Check the one below:
Code:
#ifndef init_MUTEX
sema_init(&wl->sem,1)
#else
init_MUTEX(&wl->sem)
#endif
Now we got it right! If init_MUTEX doesn't exist (kernel 2.6.37+) it will use sema_init instead, but if we do have init_MUTEX( >2.6.36) then we use the original version.

For those of you who don't want to go through all the trouble of patching files and all that, you can just download my patched version while Broadcom doesn't get that in the official version:
broadcom_driver_x86-v5_100_82_38-PATCHED.tar.gz

If you want to apply the patch yourself, download it from the link below:
broadcom-sta_4_kernel-2.6.37.patch
(Thanks Web31337 for reminding me of posting the patch itself too!)
Posted in Uncategorized
Views 28474 Comments 6
« Prev     Main     Next »
Total Comments 6

Comments

  1. Old Comment
    it's much better when you distribute a single .patch not copy entire source tree
    Posted 02-08-2011 at 02:48 AM by Web31337 Web31337 is offline
  2. Old Comment
    2.6.37 is supposed to have better Broadcom drivers since they joined the Linux Foundation.
    Quote:
    In September, Broadcom® announced it had open sourced its drivers for
    selected Wi-Fi chipsets, a pivotal move that garnered applause throughout
    the Linux community. Since then, the driver has been integrated into the
    latest Linux kernel release 2.6.37 and, as a result, is actively being
    improved upon by the entire Linux community. Given its portfolio of
    semiconductors for wired and wireless communications, Broadcom is an
    important addition to The Linux Foundation.
    Maybe 2.6.38 will better
    I'm using the STA driver on 2.6.35.11 with a Dell Mini 9 BCM4312. Provides flawless performance. The kernel provided module was pretty much useless.

    Personally, I've only had acceptable performance on Intel and Atheros wireless chips using the kernel provided modules.
    Posted 02-09-2011 at 02:46 AM by disturbed1 disturbed1 is offline
  3. Old Comment
    Quote:
    Originally Posted by Web31337 View Comment
    it's much better when you distribute a single .patch not copy entire source tree
    Putting a link to the patch too! Thanks for reminding me of that
    Posted 02-18-2011 at 05:56 PM by frandalla frandalla is offline
  4. Old Comment
    My board didn't really work with the kernel modules either.
    I do wonder if them joining the Linux Foundation (specially at the Silver level) will make that much of a difference. Can only pray that it will.
    Quote:
    Originally Posted by disturbed1 View Comment
    2.6.37 is supposed to have better Broadcom drivers since they joined the Linux Foundation.


    Maybe 2.6.38 will better
    I'm using the STA driver on 2.6.35.11 with a Dell Mini 9 BCM4312. Provides flawless performance. The kernel provided module was pretty much useless.

    Personally, I've only had acceptable performance on Intel and Atheros wireless chips using the kernel provided modules.
    Posted 02-18-2011 at 06:05 PM by frandalla frandalla is offline
  5. Old Comment
    Quote:
    Originally Posted by frandalla View Comment
    My board didn't really work with the kernel modules either.
    I do wonder if them joining the Linux Foundation (specially at the Silver level) will make that much of a difference. Can only pray that it will.
    Not just yet :/. The same thing.
    Posted 08-17-2011 at 03:30 PM by kostya kostya is offline
  6. Old Comment
    Thank you dude!
    It seems that it's still necessary to apply also the patch from broadcom for > 2.6.37 , so for kernels 2.6.38 it's a double patching. By this way i'm gonna patch my nuts too :-)
    Posted 09-06-2011 at 07:10 AM by romagnolo romagnolo is offline
 

  



All times are GMT -5. The time now is 03:32 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration