centos7.7上安裝broadcom bcm4312無線網卡驅動


broadcom bcm4312為比較老的無線網卡了,在centos7.7上默認是驅動不起來的。需要手動編譯安裝。按照centos官方的說法很多網卡都需要重新編譯驅動后才能正常運行。包括:

Broadcom Corporation BCM4311, BCM4312, BCM4313, BCM4321, BCM4322, BCM43224, BCM43225, BCM43227 and BCM43228 Based Wireless NICs

在安裝過程中參考了幾位大神的文章(文章鏈接附后)在執行make過程遇到各種個這樣的問題,就是執行不下去,總結起來有兩點:一是大神門的文章沒有細看,二是,官方補丁更新、步驟也有所更新,三是,基於針對報錯選擇方案。

以下過程結合了幾位大神文章和官方文檔,寫下來供后來的同道中人參考。

1.識別網卡的型號

執行lspci | grep '802'

官方:

[user@host ~]$ /sbin/lspci | grep Broadcom
0b:00.0 Network controller: Broadcom Corporation BCM4312 802.11a/b/g (rev 01)

2.確認kernel-headers kernel-devel gcc是否已經安裝

rpm -qa kernel-headers kernel-devel gcc 或 yum list kernel-headers kernel-devel gcc

kernel-headers kernel-devel gcc一般在安裝完整版操作系統時都安裝了,若沒有掛載操作系統鏡像直接安裝即可。

3.下載broadcom驅動

https://www.broadcom.com/site-search?filters[pages][Content_Type][type]=and&filters[pages][Content_Type][values][]=Downloads&page=1&per_page=10&q=BCM4312

 注意要與操作系統版本匹配,筆者選擇的是LINUX STA 64-bit driver

 

4.解壓文件

官方:

[root@host ~]# mkdir -p /usr/local/src/hybrid-wl
[root@host hybrid-wl]# cd /usr/local/src/hybrid-wl
[root@host hybrid-wl]# tar xvzf /path/to/the/tarball/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz
[root@host hybrid-wl]# chown -R someuser.somegroup /usr/local/src/hybrid-wl

在編譯過程中會生成相關被內核調用的文件,也會在你解壓的目錄下,因此解壓的文件要放到可以長久訪問的位置,筆者按照官方文檔進行的,其中someuser替換成系統的共享用戶,筆者參考了大神的文檔,使用的nobody.

5.編譯文件

官方

[user@host hybrid-wl]$ make -C /lib/modules/`uname -r`/build/ M=`pwd`

 關鍵點來了,注意了

此處直接使用make就行,官方安裝包已經集成了這些內容。

此處大部分會出錯,筆者就這這里卡殼了。

正確的步驟是:

1)先安裝官方補丁,詳見第6步

2)再執行sed修改操作,詳見第7步

3)最后執行make,第5步

6.安裝官方補丁包

下載官方提供補丁包

Again, esp. if you're running EL 7.3, or one of its kernels, you'll have to apply the following patches wl-kmod-01_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch wl-kmod-02_kernel_4.8_add_cfg80211_scan_info_struct.patch wl-kmod-03_fix_kernel_warnings.patch wl-kmod-04_kernel_4.11_remove_last_rx_in_net_device_struct.patch wl-kmod-05_kernel_4.12_add_cfg80211_roam_info_struct.patch BEFORE you apply the above sed replacement commands (otherwise, compilation won't work). Also, don't forget the patch from step 3a:

 安裝補丁包

[user@host hybrid-wl]$ patch -p1 < ../wl-kmod-01_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #6 succeeded at 1911 (offset 3 lines).
Hunk #7 succeeded at 2040 (offset 3 lines).
Hunk #8 succeeded at 2160 (offset 3 lines).
Hunk #9 succeeded at 2298 (offset 3 lines).
Hunk #10 succeeded at 2941 (offset 3 lines).
[user@host hybrid-wl]$ patch -p1 < ../wl-kmod-02_kernel_4.8_add_cfg80211_scan_info_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #1 succeeded at 2442 (offset 3 lines).
Hunk #2 succeeded at 2553 (offset 3 lines).
Hunk #3 succeeded at 2989 (offset 3 lines).
[user@host hybrid-wl]$ patch -p1 < ../wl-kmod-03_fix_kernel_warnings.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #1 succeeded at 2008 (offset 3 lines).
Hunk #2 succeeded at 2032 (offset 3 lines).
Hunk #3 succeeded at 2056 (offset 3 lines).
Hunk #4 succeeded at 2071 (offset 3 lines).
Hunk #5 succeeded at 2107 (offset 3 lines).
Hunk #6 succeeded at 2386 (offset 3 lines).
Hunk #7 succeeded at 2401 (offset 3 lines).
Hunk #8 succeeded at 2441 (offset 3 lines).
[user@host hybrid-wl]$ patch -p1 < ../wl-kmod-04_kernel_4.11_remove_last_rx_in_net_device_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 2911 (offset -18 lines).
[user@host hybrid-wl]$ patch -p1 < ../wl-kmod-05_kernel_4.12_add_cfg80211_roam_info_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #3 succeeded at 2450 (offset 3 lines).
Hunk #4 succeeded at 2466 (offset 3 lines).

7.安裝官方補丁包

執行如下sed命令

[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(3, 11, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(3, 15, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c

[user@host hybrid-wl]$ sed -i 's/ < KERNEL_VERSION(3, 18, 0)/ < KERNEL_VERSION(3, 9, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(4, 0, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c

[user@host hybrid-wl]$ sed -i 's/ < KERNEL_VERSION(4,2,0)/ < KERNEL_VERSION(3, 9, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(4, 7, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c

[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(4, 8, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c

[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(4, 11, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ < KERNEL_VERSION(4, 12, 0)/ < KERNEL_VERSION(3, 9, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ >= KERNEL_VERSION(4, 12, 0)/ >= KERNEL_VERSION(3, 10, 0)/' src/wl/sys/wl_cfg80211_hybrid.c
[user@host hybrid-wl]$ sed -i 's/ <= KERNEL_VERSION(4, 10, 0)/ < KERNEL_VERSION(3, 9, 0)/' src/wl/sys/wl_linux.c

 

7.執行make編譯

[user@host hybrid-wl]$ make -C /lib/modules/`uname -r`/build/ M=`pwd`

以上過程一定不能跳過,順序不能錯。

至此,編譯完成了。接下來開始模塊加載、系統模塊配置和自動啟動工作。

8.卸載系統中默認安裝的相關模塊,以免出現沖突。

[root@host ~]# modprobe -r bcm43xx
[root@host ~]# modprobe -r b43
[root@host ~]# modprobe -r b43legacy
[root@host ~]# modprobe -r ssb
[root@host ~]# modprobe -r bcma
[root@host ~]# modprobe -r brcmsmac
[root@host ~]# modprobe -r ndiswrapper

 以上步驟執行過程中可能會提示沒有發現驅動模塊,直接執行就好了。

8.加載安裝好的驅動模塊wl

copy the driver module file to a location where kernel can find it:

[root@host hybrid-wl]# cp -vi /usr/local/src/hybrid-wl/wl.ko /lib/modules/`uname -r`/extra/

此處會發現,此處命令實際是將在剛剛解壓后目錄下,通過make生成的模塊鏈接到modules下,這里也就解釋了為什么要放着在可長久訪問的位置。

9.自動檢測模塊的依賴性

[root@host ~]# depmod $(uname -r)

Linux depmod命令用於分析可載入模塊的相依性。

10.加載模塊

[root@host hybrid-wl]# modprobe wl

至此,你的無線網卡等應該亮起了,恭喜你,能登陸互聯網啦!

 

前面9、11是手動臨時的解決方案,為了永久生效,需要進行相關自動化設置。

11.設置系統自動卸載模塊

Couple of more steps are needed to get your module load every time the system boots. First, edit the /etc/modprobe.d/blacklist.conf file adding the lines:

在/etc/modprobe.d/blacklist.conf添加如下內容,若沒有此文件就創建。以確保剛剛卸載的系統默認模塊在下次不會啟動

blacklist bcm43xx
blacklist b43
blacklist b43legacy
blacklist bcma
blacklist brcmsmac
blacklist ssb
blacklist ndiswrapper

12.設置系統自動加載模塊

By doing so, you're preventing these modules from being loaded into kernel at boot time and conflicting with the wl module. Second, in order to load the wl module into the kernel on boot time, create/edit the file /etc/sysconfig/modules/kmod-wl.modules and copy-paste the following contents into it:

創建/etc/sysconfig/modules/kmod-wl.modules模塊使系統默認加載

#!/bin/bash

for M in lib80211 cfg80211 wl; do
    modprobe $M &>/dev/null
done

 

至此,可以踏實用的無線了。

 

以上內容摘自

參考鏈接:https://www.cnblogs.com/liangliu/p/6237487.html  在centos7(EL7.3 即 kernel-3.10.0-514.X )上安裝BCM4312無線網卡驅動要注意的問題

官方鏈接:https://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=show Broadcom Corporation BCM4311, BCM4312, BCM4313, BCM4321, BCM4322, BCM43224, BCM43225, BCM43227 and BCM43228 Based Wireless NICs

 

以上有不到之處盡請諒解,若有侵權行為,及時更正。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM