Patching 802.11 Linux STA driver for Kernel 2.6.37
[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:
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:
to
Right? But then, what happens to the older kernels? We need a more elegant solution for the problem. Check the one below:
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!)
(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
(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)
Code:
sema_init(&wl->sem,1)
Code:
#ifndef init_MUTEX sema_init(&wl->sem,1) #else init_MUTEX(&wl->sem) #endif
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!)
Total Comments 6
Comments
-
it's much better when you distribute a single .patch not copy entire source tree
Posted 02-08-2011 at 01:48 AM by Web31337 -
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.
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 01:46 AM by disturbed1 -
Posted 02-18-2011 at 04:56 PM by frandalla -
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: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 05:05 PM by frandalla -
Posted 08-17-2011 at 02:30 PM by kostya -
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 06:10 AM by romagnolo