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:
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:
init_MUTEX(&wl->sem)
sema_init(&wl->sem,1)
#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!)
(originally posted by me here)