上次通过更换内核实现成功编译驱动无线网卡,但是启动到系统原内核下依然没有bcm43142的驱动,遂准备在原内核下编译驱动,记录一下
ps:更推荐这种方法,避免因更换内核出现其他兼容性问题
1.准备驱动包
点我下载bcm_wireless_dirver_linux
下载完成可以拷贝进u盘,再将源码包拷贝至/usr
2.安装工具
安装gccyum install -y gcc
,如已安装可跳过
安装内核对应版本的kernel-headers,kerner-devel,本次使用当前系统镜像作为yum源,所以版本也是一致的
[root@king ~]# yum list|grep kernel
kernel.x86_64 3.10.0-327.el7 @anaconda/7.2
kernel-devel.x86_64 3.10.0-327.el7 @rhel7.2_iso
kernel-headers.x86_64 3.10.0-327.el7 @rhel7.2_iso
3.编译源码与安装驱动
复制源码包并解压
[root@king ~]# mkdir -p /usr/local/other/wireless7_2
[root@king ~]# cp /usr/hybrid-v35_64-nodebug-pcoem-6_30_223_271.zip /usr/local/other/wireless7_2
[root@king ~]# cd /usr/local/other/wireless7_2
[root@king wireless7_2]# unzip hybrid-v35_64-nodebug-pcoem-6_30_223_271.zip
[root@king wireless7_2]# ls
hybrid-v35_64-nodebug-pcoem-6_30_223_271.zip lib Makefile src
编译
[root@king wireless7_2]# make
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make: *** /lib/modules/3.10.0-327.el7.x86_64/build: No such file or directory. Stop.
make: *** [all] Error 2
报错,分析错误原因,发现/lib/modules/3.10.0-327.el7.x86_64/build
软链接失效,重做之
ln -s /usr/src/kernels/3.10.0-327.el7.x86_64/ /lib/modules/3.10.0-327.el7.x86_64/build #注意做软链接要写绝对路径
重新编译
[root@king wireless7_2]# make clean && make
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd` clean
make[1]: Entering directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
CFG80211 API is prefered for this kernel version
/usr/local/other/wireless7_2/Makefile:85: Neither CFG80211 nor Wireless Extension is enabled in kernel
CLEAN /usr/local/other/wireless7_2/.tmp