Friday, April 25, 2014

Installing Broadcom BCM43142 Drivers on Kali Linux

Introduction

I've seen some confusion when it comes to installing the wireless drivers for Broadcom's BCM43142 802.11b/g/n card, specifically with Kali or other Debian based distributions. If you're running Linux kernel < 3.10, then just comment out the lines regarding the wl_3.10 patch. This script has been run on both 32bit and 64bit installations with Kali 1.0.6.

lspci

$ lspci | grep BCM43142
02:00.0 Network controller: Broadcom Corporation BCM43142 802.11b/g/n (rev 01)

Installing the drivers

The script is available through Github using the wget command below, or check the bottom of this article for the full script.

$ wget https://gist.githubusercontent.com/chokepoint/11305606/raw/52109f648c2ad5ec6a65bf8eee78fbda15fa1cfb/bcm43142_drivers.sh
$ chmod +x bcm43142_drivers.sh
$ sudo ./bcm43142_drivers.sh

Resources

Kali Linux
Broadcom Driver Instructions
Original wl_3.10 Patch

Script

#!/bin/bash
# chmod +x broadcom_drivers.sh
# ./broadcom_drivers.sh

mkdir broadcom 
cd broadcom
apt-get install linux-headers-`uname -r` build-essential -y

if [ `uname -m` == "i686" ] ; then
 wget http://www.broadcom.com/docs/linux_sta/hybrid-v35-nodebug-pcoem-6_30_223_141.tar.gz
else
 wget http://www.broadcom.com/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-6_30_223_141.tar.gz
fi
tar -xvf hybrid-v35*
wget http://www.mindwerks.net/wp-content/uploads/2013/10/wl_3.10.patch
patch -p2 < wl_3.10.patch
make
cp wl.ko /lib/modules/`uname -r`/kernel/net/wireless/
depmod
rmmod bcma
echo "blacklist bcma" >> /etc/modprobe.d/blacklist.conf
modprobe wl

20 comments:

  1. Do you think this would work on Tails 1.1, too? I noticed that both Kali and Tails are *extremely* similar.

    ReplyDelete
  2. its working.............................

    ReplyDelete
  3. works on Kali.... Awesome

    ReplyDelete
  4. Superb! Thanks alot bro. I've been trying all the fixes but only this one worked. thanks again. :)

    ReplyDelete
  5. I am having issues with this installation I installed 32 bit Kalilinux OS on a 64 BIt sony VAIO...TECHIESSS please help meee



    root@Backtrack:~/Desktop# ./broadcom.sh


    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package linux-headers-3.7-trunk-686-pae
    E: Couldn't find any package by regex 'linux-headers-3.7-trunk-686-pae'
    --2014-09-24 16:58:53-- http://www.broadcom.com/docs/linux_sta/hybrid-v35-nodebug-pcoem-6_30_223_141.tar.gz
    Resolving www.broadcom.com (www.broadcom.com)... 63.251.216.155
    Connecting to www.broadcom.com (www.broadcom.com)|63.251.216.155|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1735911 (1.7M) [application/x-gzip]
    Saving to: `hybrid-v35-nodebug-pcoem-6_30_223_141.tar.gz'

    100%[======================================>] 17,35,911 11.6K/s in 2m 29s

    2014-09-24 17:01:25 (11.4 KB/s) - `hybrid-v35-nodebug-pcoem-6_30_223_141.tar.gz' saved [1735911/1735911]

    Makefile
    lib/
    lib/wlc_hybrid.o_shipped
    lib/LICENSE.txt
    src/
    src/shared/
    src/shared/linux_osl.c
    src/shared/bcmwifi/
    src/shared/bcmwifi/include/
    src/shared/bcmwifi/include/bcmwifi_channels.h
    src/shared/bcmwifi/include/bcmwifi_rates.h
    src/include/
    src/include/typedefs.h
    src/include/bcmdefs.h
    src/include/bcmendian.h
    src/include/linuxver.h
    src/include/wlioctl.h
    src/include/bcmutils.h
    src/include/osl.h
    src/include/linux_osl.h
    src/include/packed_section_end.h
    src/include/packed_section_start.h
    src/include/pcicfg.h
    src/include/epivers.h
    src/common/
    src/common/include/
    src/common/include/proto/
    src/common/include/proto/ethernet.h
    src/common/include/proto/bcmeth.h
    src/common/include/proto/bcmip.h
    src/common/include/proto/bcmevent.h
    src/common/include/proto/ieee80211_radiotap.h
    src/common/include/proto/802.11.h
    src/common/include/proto/802.1d.h
    src/common/include/proto/wpa.h
    src/wl/
    src/wl/sys/
    src/wl/sys/wl_cfg80211_hybrid.c
    src/wl/sys/wl_export.h
    src/wl/sys/wl_dbg.h
    src/wl/sys/wlc_key.h
    src/wl/sys/wlc_ethereal.h
    src/wl/sys/wl_linux.c
    src/wl/sys/wl_linux.h
    src/wl/sys/wl_cfg80211_hybrid.h
    src/wl/sys/wl_iw.c
    src/wl/sys/wl_iw.h
    src/wl/sys/wlc_types.h
    src/wl/sys/wlc_pub.h
    src/wl/sys/wlc_utils.h
    --2014-09-24 17:01:25-- http://www.mindwerks.net/wp-content/uploads/2013/10/wl_3.10.patch
    Resolving www.mindwerks.net (www.mindwerks.net)... 192.81.217.188
    Connecting to www.mindwerks.net (www.mindwerks.net)|192.81.217.188|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2916 (2.8K) [application/octet-stream]
    Saving to: `wl_3.10.patch'

    100%[======================================>] 2,916 18.0K/s in 0.2s

    2014-09-24 17:01:28 (18.0 KB/s) - `wl_3.10.patch' saved [2916/2916]

    patching file src/wl/sys/wl_linux.c
    Hunk #1 succeeded at 3236 (offset 7 lines).
    Hunk #2 succeeded at 3254 (offset 7 lines).
    Hunk #3 succeeded at 3417 (offset 7 lines).
    Hunk #4 succeeded at 3447 (offset 7 lines).
    Hunk #5 succeeded at 3483 (offset 7 lines).
    KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
    make: *** /lib/modules/3.7-trunk-686-pae/build: No such file or directory. Stop.
    make: *** [all] Error 2
    cp: cannot stat `wl.ko': No such file or directory
    Error: Module bcma is not currently loaded
    FATAL: Module wl not found.


    root@Backtrack:~/Desktop#

    ReplyDelete
    Replies
    1. Looks like you're on backtrack. Try manually installing the appropriate linux-headers package for your current kernel version and then rerun the script.

      Delete
  6. It is showing as "root@Backtrack:~/Desktop# " because I have named the host as "Backtrack" instead of "Kali" and here is the result for the OS version that i got on running "uname -a"

    Linux Backtrack 3.7-trunk-686-pae #1 SMP Debian 3.7.2-0+kali8 i686 GNU/Linux

    Please let me know the commands and steps needed to be done as I am illiterate in LINUX OS...THANKS IN ADVACE......stderr...

    ReplyDelete
  7. Try using "apt-cache search linux-headers". Find the package that matches your installed kernel version, and then "apt-get install ". Typically it is the result of "echo linux-headers-$(uname -r)" Hope this helps.

    ReplyDelete
  8. Is it the latest driver?
    As per the "broadcom driver instruction" mentioned in RESOURCES the site is showing latest driver as ----223.248 and the script is installing ----223.241
    What should I do? Need advice.......thanks

    ReplyDelete
    Replies
    1. Good call. I'll look into updating the script to point to the latest driver. You should be able to just copy/paste the link in the correct spot and run it, but I haven't tested the latest driver either.

      Delete
  9. JUST THANK YOU !!!

    ReplyDelete
  10. hello there! am new for kali and also having patch failure, i try to relocate the patch file too but it again...


    root@kali:~/broadcom# patch -p2 < wl_3.10.patch.1
    can't find file to patch at input line 4
    Perhaps you used the wrong -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff -Naur bcmwl-6.30.223.30+bdcom.orig/src/src/wl/sys/wl_linux.c bcmwl-6.30.223.30+bdcom/src/src/wl/sys/wl_linux.c
    |--- bcmwl-6.30.223.30+bdcom.orig/src/src/wl/sys/wl_linux.c 2013-04-23 12:31:31.011588881 +0200
    |+++ bcmwl-6.30.223.30+bdcom/src/src/wl/sys/wl_linux.c 2013-05-20 18:27:18.830187333 +0200
    --------------------------
    File to patch: wl_3.10.patch
    patching file wl_3.10.patch
    Hunk #1 FAILED at 3229.
    Hunk #2 FAILED at 3242.
    Hunk #3 FAILED at 3401.
    Hunk #4 FAILED at 3424.
    Hunk #5 FAILED at 3455.
    5 out of 5 hunks FAILED -- saving rejects to file wl_3.10.patch.rej
    root@kali:~/broadcom#
    any help please?


    ReplyDelete
  11. Thanks! Worked perfectly!

    ReplyDelete
  12. Soooo perfect, thanks

    ReplyDelete
  13. Thank you very much. It's working for me.

    ReplyDelete
  14. my lappy is lenovo y510p ideapad. my wireless chipset is bcm43142. i m working on enabling the wifi from last 3 weeks. i followed the above procedure and got my wifi working. but i am able to use it for injection on my dual boot kali linux. after looking around for it i found that my drivers wl is unable to support the injection. is it true ??? if yes then can i get it work after installing another drivers?? give me the link here. if it s not true then tell me how to enable it for injection. thank you!!!!

    ReplyDelete
    Replies
    1. *not able to use injection

      Delete