上次通过更换内核实现成功编译驱动无线网卡,但是启动到系统原内核下依然没有bcm43142的驱动,遂准备在原内核下编译驱动,记录一下

ps:更推荐这种方法,避免因更换内核出现其他兼容性问题
1.准备驱动包

hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz
点我下载 密cmet
下载拷贝进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.tar.gz /usr/local/other/wireless7_2
[root@king ~]# cd /usr/local/other/wireless7_2
[root@king wireless7_2]# tar zxf hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz
[root@king wireless7_2]# ls
hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz 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_versions
CLEAN /usr/local/other/wireless7_2/Module.symvers
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make[1]: Entering directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
LD /usr/local/other/wireless7_2/built-in.o
CC [M] /usr/local/other/wireless7_2/src/shared/linux_osl.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_linux.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_iw.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.o
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_cfg80211_get_station’:
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1460:20: error: ‘STATION_INFO_TX_BITRATE’ undeclared (first use in this function)
sinfo->filled |= STATION_INFO_TX_BITRATE;
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1460:20: note: each undeclared identifier is reported only once for each function it appears in
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1477:20: error: ‘STATION_INFO_SIGNAL’ undeclared (first use in this function)
sinfo->filled |= STATION_INFO_SIGNAL;
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c: At top level:
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1799:2: warning: initialization from incompatible pointer type [enabled by default]
.get_station = wl_cfg80211_get_station,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1799:2: warning: (near initialization for ‘wl_cfg80211_ops.get_station’) [enabled by default]
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_alloc_wdev’:
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1894:22: error: incompatible types when assigning to type ‘const struct wiphy_wowlan_support *’ from type ‘struct wiphy_wowlan_support’
wdev->wiphy->wowlan = wl_wowlan_support;
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_inform_single_bss’:
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2037:3: error: incompatible type for argument 3 of ‘cfg80211_inform_bss’
(const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4029:1: note: expected ‘enum cfg80211_bss_frame_type’ but argument is of type ‘const u8 *’
cfg80211_inform_bss(struct wiphy *wiphy,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2037:3: warning: passing argument 7 of ‘cfg80211_inform_bss’ makes integer from pointer without a cast [enabled by default]
(const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4029:1: note: expected ‘u16’ but argument is of type ‘const u8 *’
cfg80211_inform_bss(struct wiphy *wiphy,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2037:3: warning: passing argument 8 of ‘cfg80211_inform_bss’ makes pointer from integer without a cast [enabled by default]
(const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4029:1: note: expected ‘const u8 *’ but argument is of type ‘size_t’
cfg80211_inform_bss(struct wiphy *wiphy,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2037:3: error: too few arguments to function ‘cfg80211_inform_bss’
(const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4029:1: note: declared here
cfg80211_inform_bss(struct wiphy *wiphy,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_notify_connect_status’:
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2124:4: warning: passing argument 3 of ‘cfg80211_ibss_joined’ makes pointer from integer without a cast [enabled by default]
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4219:6: note: expected ‘struct ieee80211_channel *’ but argument is of type ‘unsigned int’
void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:2124:4: error: too few arguments to function ‘cfg80211_ibss_joined’
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, GFP_KERNEL);
^
In file included from /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:33:0:
include/net/cfg80211.h:4219:6: note: declared here
void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
^
make[2]: *** [/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.o] Error 1
make[1]: *** [_module_/usr/local/other/wireless7_2] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
make: *** [all] Error 2

发现报错,依次排错
由报错信息知wl_cfg80211_hybrid.c文件第1460,1477,1894,2037,2124行有错,做出如下更改

[root@king wireless7_2]# vim src/wl/sys/wl_cfg80211_hybrid.c
1460 // sinfo->filled |= STATION_INFO_TX_BITRATE;
1477 // sinfo->filled |= STATION_INFO_SIGNAL;
1894 wdev->wiphy->wowlan = &wl_wowlan_support;
2035 cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet),
2036 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int,
2037 (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL);
2124 cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, &wl->conf->channel, GFP_KERNEL);

tips:vim里按冒号输入set nu显示行号,冒号后接行号定位到该行

重新编译

[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_versions
CLEAN /usr/local/other/wireless7_2/Module.symvers
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make[1]: Entering directory `/usr/src/kernels/3.10.0-327.el7.x86_64'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
LD /usr/local/other/wireless7_2/built-in.o
CC [M] /usr/local/other/wireless7_2/src/shared/linux_osl.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_linux.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_iw.o
CC [M] /usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.o
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1799:2: warning: initialization from incompatible pointer type [enabled by default]
.get_station = wl_cfg80211_get_station,
^
/usr/local/other/wireless7_2/src/wl/sys/wl_cfg80211_hybrid.c:1799:2: warning: (near initialization for ‘wl_cfg80211_ops.get_station’) [enabled by default]
LD [M] /usr/local/other/wireless7_2/wl.o
Building modules, stage 2.
CFG80211 API is prefered for this kernel version
Using CFG80211 API
MODPOST 1 modules
CC /usr/local/other/wireless7_2/wl.mod.o
LD [M] /usr/local/other/wireless7_2/wl.ko
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64'

没有报错

[root@king wireless7_2]# ls
built-in.o modules.order wl.mod.c
hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz Module.symvers wl.mod.o
lib src wl.o
Makefile wl.ko

发现已生成驱动文件wl.ko

安装驱动文件

[root@king wireless7_2]# make install
install -D -m 755 wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless

4.驱动文件加载和配置

加载驱动文件

[root@king wireless7_2]# insmod wl.ko
[root@king wireless7_2]# lsmod|grep wl
wl 6445574 0
cfg80211 572836 1 wl

发现右上角出现wifi选项,驱动加载成功,可以连接wifi啦,Enjoying it!

参考
1
2

http://blog.51cto.com/kking/2096757

Centos&Redhat下bcm43142博通无线网卡linux驱动之二的更多相关文章

  1. Linux/centos/redhat下各种压缩解压缩方式详解

    1.zip命令 zip -r myfile.zip ./* 将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件. 2.unzip unzip -o -d ...

  2. 如何编写一个简单的Linux驱动(二)——完善设备驱动

    前期知识 1.如何编写一个简单的Linux驱动(一)——驱动的基本框架 2.如何编写一个简单的Linux驱动(二)——设备操作集file_operations 前言 在上一篇文章中,我们编写设备驱动遇 ...

  3. 如何编写一个简单的Linux驱动(二)——设备操作集file_operations

    前期知识 如何编写一个简单的Linux驱动(一)--驱动的基本框架 前言 在上一篇文章中,我们学习了驱动的基本框架.这一章,我们会在上一章代码的基础上,继续对驱动的框架进行完善.要下载上一篇文章的全部 ...

  4. Redis学习---CentOs/RedHat下Redis的安装

    redis是C语言开发,建议在linux上运行,本教程使用Centos6.4作为安装环境.      安装redis需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gc ...

  5. CentOS 7下设置Docker代理(Linux下Systemd服务的环境变量配置)

    Docker守护程序使用HTTP_PROXY,HTTPS_PROXY以及NO_PROXY环境变量在其启动环境来配置HTTP或HTTPS代理的行为.无法使用daemon.json文件配置这些环境变量. ...

  6. 为MarS Board安装无线网卡Linux驱动

    玩了几天MarS Board,发现要了解Linux是如何工作的,从嵌入式开发板玩起最有效率.因为会遇到无数的问题和未知领域,然后在解决问题的过程中有深入了解Linux的机会.   为这块开发板专门买了 ...

  7. 在全志平台调试博通的wifi驱动(类似ap6212)【转】

    转自:http://blog.csdn.net/fenzhi1988/article/details/44809779 调试驱动之前,首先先看看驱动代码,了解代码大致工作流程,再根据硬件配置驱动,比如 ...

  8. Linux驱动技术(二) _访问I/O内存

    ARM是对内存空间和IO空间统一编址的,所以,通过读写SFR来控制硬件也就变成了通过读写相应的SFR地址来控制硬件.这部分地址也被称为I/O内存.x86中对I/O地址和内存地址是分开编址的,这样的IO ...

  9. Centos8.3安装broadcom(博通)BCM43142无线网卡驱动,Centos8没有wifi选项(No wifi adapter found centos)解决办法

    参考:杆菌大祭司> https://www.jianshu.com/p/3cb41b7b8fec 第一步:查看网卡型号,确认无线网卡型号为BCMXXX lspci | grep Network ...

随机推荐

  1. [P2996][USACO10NOV]拜访奶牛Visiting Cows (树形DP)

    之前写在洛谷,结果没保存,作废…… 听说考前写题解RP++哦 思路 很容易想到是 树形DP 如果树形DP不知道是什么的话推荐百度一下 我在这里用vector储存边 设状态f[i][0]为i点不访问,f ...

  2. 最优贸易 [NOIP 2009]

    Description C 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市.任意两个城市之间最多只有一条道路直接相连.这 m 条道路中有一部分为单向通行的道路,一部分为双向 ...

  3. 使用Ajax和JSON实现注册时候验证用户名是否存在的功能

    功能实现的思路:当通常一个网站需要注册用户信息的时候,往往会让用户起一个名字,但一般要求这个用户名称是不能重复的,为了判断新注册的用户填写的用户名是否已经存在,需要对填写的用户名称进行判断,实际项目开 ...

  4. C/JS_二分法查找

    1. 二分法查找 前提: 数据是排好序的. 题设:给出一个有序arr,从中找出key,arr的区间是array[ low , higt]. 步骤: (1)mid=(low+high)/2 (2)arr ...

  5. GMA Round 1 抛硬币

    传送门 抛硬币 扔一个硬币,正面概率为0.6.扔这枚硬币666次,正面就得3分,反面就得1分,求总分的方差. 直接套公式$np(1-p)*(X-Y)^2=666*0.6*(1-0.6)*(3-1)^2 ...

  6. vue路由打开新窗口

    一. <router-link>标签实现新窗口打开: 官方文档中说 v-link 指令被 <router-link> 组件指令替代,且 <router-link> ...

  7. linux > 和 >> 、< 区别

    linux中经常会用到将内容输出到某文件当中,只需要在执行命令后面加上>或者>>号即可进入操作. 大于号:将一条命令执行结果(标准输出,或者错误输出,本来都要打印到屏幕上面的)重定向 ...

  8. HA主备路由模式的原理 + HA和负载均衡的区别

       HA主备路由模式的原理 HA是High Availability缩写,即高可用性 ,可防止网络中由于单个防火墙的设备故障或网络故障导致网络中断,保证网络服务的连续性和安全强度.目前,ha功能已经 ...

  9. UVA - 1456 Cellular Network

    题目大意: 手机在蜂窝网络中的定位是一个基本问题.如果蜂窝网络已经得知手机处于c1, c2,-,cn这些区域中的一个.最简单的方法是同一时候在这些区域中寻找手机.但这样做非常浪费带宽. 因为蜂窝网络中 ...

  10. 十进制转为x进制的递归代码

    十进制转为x进制的递归代码 #include <stdio.h> void fun(int n,int x) { ) return; else { fun(n/x,x); printf(& ...