kali linux 安裝 BCM43227網卡驅動

系統信息: php

系統環境
Shell
root @lsw :~# uname -a Linux lsw 3.14-kali1-686-pae #1 SMP Debian 3.14.5-1kali1 (2014-06-07) i686 GNU/Linux
1
2
root @ lsw : ~ # uname -a
Linux lsw 3.14 - kali1 - 686 - pae #1 SMP Debian 3.14.5-1kali1 (2014-06-07) i686 GNU/Linux

無線網卡信息: linux

Shell
root @lsw :~# lspci 03:00.0 Network controller: Broadcom Corporation BCM43227 802.11b/g/n
1
2
root @ lsw : ~ # lspci
03 : 00.0 Network controller : Broadcom Corporation BCM43227 802.11b / g / n

 

正常狀況下,能夠經過軟件包的方式進行安裝: 網絡

Shell
# aptitude update # aptitude dist-upgrade # aptitude install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
1
2
3
# aptitude update
# aptitude dist-upgrade
# aptitude install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms

但軟件包安裝時出現編譯錯誤,故選擇從源碼手動安裝: less

1. 首先下載網卡驅動(官網下載本站備份下載 ),如官網可用,請勿下載備份文件。 函數

該驅動支持的硬件爲(包含筆者的BCM43227網卡): ui

Broadcom’s BCM4311-, BCM4312-, BCM4313-, BCM4321-, BCM4322-, BCM43224-, and BCM43225-, BCM43227- and BCM43228-based hardware this

2. 編譯安裝該驅動 spa

Shell
root @lsw :~/hybrid_tmp# make clean; make; KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd` clean make[1]: Entering directory `/usr/src/linux-headers-3.14-kali1-686-pae' CFG80211 API is prefered for this kernel version /root/hybrid_tmp/Makefile:85: Neither CFG80211 nor Wireless Extension is enabled in kernel CLEAN /root/hybrid_tmp/.tmp_versions make[1]: Leaving directory `/usr/src/linux-headers-3.14-kali1-686-pae' KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd` make[1]: Entering directory `/usr/src/linux-headers-3.14-kali1-686-pae' CFG80211 API is prefered for this kernel version Using CFG80211 API LD /root/hybrid_tmp/built-in.o CC [M] /root/hybrid_tmp/src/shared/linux_osl.o CC [M] /root/hybrid_tmp/src/wl/sys/wl_linux.o /root/hybrid_tmp/src/wl/sys/wl_linux.c: In function ‘wl_tkip_printstats’: /root/hybrid_tmp/src/wl/sys/wl_linux.c:3246:7: warning: passing argument 1 of ‘wl->tkipmodops->print_stats’ from incompatible pointer type [enabled by default] /root/hybrid_tmp/src/wl/sys/wl_linux.c:3246:7: note: expected ‘struct seq_file *’ but argument is of type ‘char *’ /root/hybrid_tmp/src/wl/sys/wl_linux.c:3249:4: warning: passing argument 1 of ‘wl->tkipmodops->print_stats’ from incompatible pointer type [enabled by default] /root/hybrid_tmp/src/wl/sys/wl_linux.c:3249:4: note: expected ‘struct seq_file *’ but argument is of type ‘char *’ /root/hybrid_tmp/src/wl/sys/wl_linux.c: In function ‘wl_reg_proc_entry’: /root/hybrid_tmp/src/wl/sys/wl_linux.c:3470:2: error: implicit declaration of function ‘create_proc_entry’ [-Werror=implicit-function-declaration] /root/hybrid_tmp/src/wl/sys/wl_linux.c:3470:22: warning: assignment makes pointer from integer without a cast [enabled by default] /root/hybrid_tmp/src/wl/sys/wl_linux.c:3475:16: error: dereferencing pointer to incomplete type /root/hybrid_tmp/src/wl/sys/wl_linux.c:3476:16: error: dereferencing pointer to incomplete type /root/hybrid_tmp/src/wl/sys/wl_linux.c:3477:16: error: dereferencing pointer to incomplete type cc1: some warnings being treated as errors make[4]: *** [/root/hybrid_tmp/src/wl/sys/wl_linux.o] 錯誤 1 make[3]: *** [_module_/root/hybrid_tmp] 錯誤 2 make[2]: *** [sub-make] 錯誤 2 make[1]: *** [all] 錯誤 2 make[1]: Leaving directory `/usr/src/linux-headers-3.14-kali1-686-pae' make: *** [all] 錯誤 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
root @ lsw : ~ / hybrid_tmp # make clean; make;
KBUILD_NOPEDANTIC = 1 make - C / lib / modules / ` uname - r ` / build M = ` pwd ` clean
make [ 1 ] : Entering directory ` / usr / src / linux - headers - 3.14 - kali1 - 686 - pae'
CFG80211 API is prefered for this kernel version
/ root / hybrid_tmp / Makefile : 85 : Neither CFG80211 nor Wireless Extension is enabled in kernel
   CLEAN    / root / hybrid_tmp / .tmp_versions
make [ 1 ] : Leaving directory ` / usr / src / linux - headers - 3.14 - kali1 - 686 - pae'
KBUILD_NOPEDANTIC = 1 make - C / lib / modules / ` uname - r ` / build M = ` pwd `
make [ 1 ] : Entering directory ` / usr / src / linux - headers - 3.14 - kali1 - 686 - pae'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
   LD        / root / hybrid_tmp / built - in .o
   CC [ M ]    / root / hybrid_tmp / src / shared / linux_osl .o
   CC [ M ]    / root / hybrid_tmp / src / wl / sys / wl_linux .o
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : In function wl_tkip _printstats’ :
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3246 : 7 : warning : passing argument 1 of wl -> tkipmodops -> print _stats’ from incompatible pointer type [ enabled by default ]
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3246 : 7 : note : expected struct seq_file * but argument is of type char *
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3249 : 4 : warning : passing argument 1 of wl -> tkipmodops -> print _stats’ from incompatible pointer type [ enabled by default ]
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3249 : 4 : note : expected struct seq_file * but argument is of type char *
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : In function wl_reg_proc _entry’ :
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3470 : 2 : error : implicit declaration of function create_proc _entry’ [ - Werror = implicit - function - declaration ]
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3470 : 22 : warning : assignment makes pointer from integer without a cast [ enabled by default ]
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3475 : 16 : error : dereferencing pointer to incomplete type
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3476 : 16 : error : dereferencing pointer to incomplete type
/ root / hybrid_tmp / src / wl / sys / wl_linux .c : 3477 : 16 : error : dereferencing pointer to incomplete type
cc1 : some warnings being treated as errors
make [ 4 ] : * * * [ / root / hybrid_tmp / src / wl / sys / wl_linux .o ] 錯誤 1
make [ 3 ] : * * * [ _module_ / root / hybrid_tmp ] 錯誤 2
make [ 2 ] : * * * [ sub - make ] 錯誤 2
make [ 1 ] : * * * [ all ] 錯誤 2
make [ 1 ] : Leaving directory ` / usr / src / linux - headers - 3.14 - kali1 - 686 - pae'
make : * * * [ all ] 錯誤 2

編譯錯誤,緣由是使用的 create_proc_entry() 函數已經廢棄了, 與新的proc_create() 函數接受的參數不一樣致使的。 .net

須要修改wl_linux.c 文件。下載針對kernel3.1補丁文件,並應用該補丁: ip

Shell
root @lsw :~/hybrid_tmp# patch -p1 ./src/wl/sys/wl_linux.c < ../wl-6xx-kmod-011_kernel_3.10.patch 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).
1
2
3
4
5
6
7
root @ lsw : ~ / hybrid_tmp # patch -p1 ./src/wl/sys/wl_linux.c < ../wl-6xx-kmod-011_kernel_3.10.patch
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).

而後編譯安裝:

Shell
make clean; make ;
1
make clean ; make ;

此時會在當前目錄下生成wl.ko文件,而後安裝該模塊:

# modprobe lib80211 # modprobe cfg80211 # insmod wl.ko
1
2
3
# modprobe lib80211
# modprobe cfg80211
# insmod wl.ko

此時點擊網絡圖標應該會列出附近的無線網絡了。

若是網絡驅動依舊沒法使用,極可能是 ssb 模塊致使的,須要卸載掉該模塊。但有時候僅阻止加載ssb模塊還不夠,由於在Debian 、Ubuntu這類系統上仍是會運行,需將其連帶的模塊一塊兒卸載掉。

首先檢查ssb,bcma,wl,或者b43模塊是否加載:

Shell
# lsmod | grep "brcmsmac\|ssb\|wl\|b43\|bcma"
1
# lsmod | grep "brcmsmac\|ssb\|wl\|b43\|bcma"

若是安裝了,就卸載掉:

Shell
# rmmod brcmsmac # rmmod ssb # rmmod bcma # rmmod wl # insmod wl.ko
1
2
3
4
5
# rmmod brcmsmac
# rmmod ssb
# rmmod bcma
# rmmod wl
# insmod wl.ko

此時無線網絡就能夠正常使用了。

爲了重啓後能自動加載,應用如下命令:

Shell
# cp wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless # depmod -a # echo modeprobe wl >> /etc/rc.local
1
2
3
# cp wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
# depmod -a
# echo modeprobe wl >> /etc/rc.local

可是重啓後會出現無線網絡再次沒法使用的狀況,此時須要把ssb模塊添加到禁用名單:

Shell
# echo "blacklist ssb" >> /etc/modprobe.d/blacklist-libnfc.conf # echo "blacklist bcma" >> /etc/modprobe.d/blacklist-libnfc.conf # echo "blacklist b43" >> /etc/modprobe.d/blacklist-libnfc.conf # echo "blacklist brcmsmac" >> /etc/modprobe.d/blacklist-libnfc.conf
1
2
3
4
# echo "blacklist ssb" >> /etc/modprobe.d/blacklist-libnfc.conf
# echo "blacklist bcma" >> /etc/modprobe.d/blacklist-libnfc.conf
# echo "blacklist b43" >> /etc/modprobe.d/blacklist-libnfc.conf
# echo "blacklist brcmsmac" >> /etc/modprobe.d/blacklist-libnfc.conf

並生成新的ramfs文件:

Shell
# cp /boot/initrd.img-`uname -r` /你備份的路徑/ # update-initramfs -u # reboot
1
2
3
# cp /boot/initrd.img-`uname -r`  /你備份的路徑/
# update-initramfs -u
# reboot

 

搞定。

相關內容:broadcom-sta-dkms bug report

相關文章
相關標籤/搜索