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
以上有不到之处尽请谅解,若有侵权行为,及时更正。