在centos7(EL7.3 即 kernel-3.10.0-514.X )上安装BCM4312无线网卡驱动要注意的问题,centos7bcm4312

日期:2020-04-30编辑作者:操作系统

图片 1

在centos7(EL7.3 即 kernel-3.10.0-514.X )上安装BCM4312无线网卡驱动要注意的问题,centos7bcm4312

  我新装的centos7主机无法使用里面自带的网卡,查询后发现网卡型号为BCM4312。我在看资料安装的过程中遇到了些问题,纠结了好久,现在分享下要注意的点,为后来的遇到同样问题的人提供点帮助。现在开始说正事:

  若要安装以 Broadcom BCM4311、BCM4312、BCM4313、BCM4321、BCM4322、BCM43224、BCM43225、BCM43227 或 BCM43228 为基础的无线网络卡,请遵照以下的步骤:

雨林木风讯:Broadcom成为Linux基金会的最新成员。 2010年9月,博通(Broadcom)发布了其Linux的brcm80211无线驱动程序,在GPL2-兼容许可下,适用于BCM4313,BCM43224和BCM43225 802.11n无线芯片。 Broadcom还表示,它计划继续与Linux驱动程序项目合作,旨在为各种设备建立和维持开源Linux内核驱动程序。

第 1 步:辨认无线网络芯片及安装时依赖的组件

  首先,请确定你是位「拥有 Broadcom BCM43xx 无线网络卡的幸运儿」:

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

  辨认完无线网络芯片型号之后,请确定你不会欠缺编译及安装时所需的组件:

[[email protected]]# yum install kernel-headers kernel-devel gcc

  当然,假若你要为 Xen 内核(kernel-xen)编译驱动程序,你必须安装 kernel-xen-devel 而不是 kernel-devel。需不需安装,推荐看下:http://blog.sina.com.cn/s/blog_946b3ae20100yxdm.html

Linux基金会是一个非盈利组织,致力于促进Linux的发展。

第 2 步:下载并解压 Broadcom 驱动程序的压缩档

  请从Broadcom的官方网站(https://www.broadcom.com/)下载 Broadcom BCM43xx 的 linux 驱动程序压缩档到你的机器并将它解压到 /usr/local/src/hybrid-wl,请随你所需将这个目录的拥有者改为无特权的用户:(我下载的是hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz,把这个包放/usr/local/src/hybrid-wl这个目录下,我以这个包写的例子,你根据自己下的包来改动下面的语句。我选的无特权用户为nobody。)

[[email protected] ~]# mkdir -p /usr/local/src/hybrid-wl
[[email protected] hybrid-wl]# cd /usr/local/src/hybrid-wl
[[email protected] hybrid-wl]# tar xvfz /usr/local/src/hybrid-wl/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz
[[email protected] hybrid-wl]# chown -R nobody.nobody /usr/local/src/hybrid-wl 

注:为什么不随便将它解压到一个位置并保留缺省的拥有者?
  原因是上面的做法会把驱动模块的源代码保留在系统上 —— 在你放置它们的位置 —— 好让你可以随时按需要创建驱动程序(譬如:你将内核升了级 —— 因为驱动模块永远根据某个内核来编译),还有,就是你可以用无特权的用户来编译!

(责任编辑:admin)

第 3 步上:编译 Broadcom 驱动模块 (在 EL6 和 EL7 上) 

  驱动模块可以这样编译:

[[email protected] hybrid-wl]$ make -C /lib/modules/`uname -r`/build  M=`pwd`

  请留意引号(即反引号),centos官方的文档写的是[[email protected] hybrid-wl]$ make -C /lib/modules/`uname -r`/build/ M=`pwd`,我照做了,就是通不过,后来发现M前面的/是不需要的,加个空格就行。

  编译现有的驱动程序(6.30.223.271 版)时,你差不多肯定会获得一个错误信息,而不是一个编译好的驱动模块

make: Entering directory `/usr/src/kernels/2.6.32-573.7.1.el6.x86_64'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  LD /usr/local/src/hybrid-wl/built-in.o
  CC [M] /usr/local/src/hybrid-wl/src/shared/linux_osl.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_linux.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_iw.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.o
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:83: warning: ‘enum tx_power_setting’ declared inside parameter list
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:83: warning: its scope is only this definition or declaration, <snip>
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_cfg80211_join_ibss’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:730: error: ‘struct cfg80211_ibss_params’ has no member named ‘channel’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: At top level:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1096: warning: ‘enum tx_power_setting’ declared inside parameter list
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1096: error: parameter 2 (‘type’) has incomplete type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_cfg80211_set_tx_power’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1107: error: ‘TX_POWER_AUTOMATIC’ undeclared (first use in this <snip>
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1107: error: (Each undeclared identifier is reported only once
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1107: error: for each function it appears in.)
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1109: error: ‘TX_POWER_LIMITED’ undeclared (first use in this function)
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1115: error: ‘TX_POWER_FIXED’ undeclared (first use in this function)
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: At top level:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1774: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1779: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1780: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1781: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1782: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1783: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1784: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1789: warning: initialization from incompatible pointer type
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_inform_single_bss’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1984: error: too few arguments to function <snip>
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2023: warning: passing argument 1 of ‘cfg80211_put_bss’ from <snip>
include/net/cfg80211.h:3380: note: expected ‘struct wiphy *’ but argument is of type ‘struct cfg80211_bss *’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2023: error: too few arguments to function ‘cfg80211_put_bss’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_update_bss_info’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2276: error: ‘struct cfg80211_bss’ has no member named <snip>
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2277: error: ‘struct cfg80211_bss’ has no member named <snip>
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2283: warning: passing argument 1 of ‘cfg80211_put_bss’ from <snip>
include/net/cfg80211.h:3380: note: expected ‘struct wiphy *’ but argument is of type ‘struct cfg80211_bss *’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2283: error: too few arguments to function ‘cfg80211_put_bss’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_bss_roaming_done’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2322: warning: passing argument 2 of ‘cfg80211_roamed’ from <snip>
include/net/cfg80211.h:3726: note: expected ‘struct ieee80211_channel *’ but argument is of type ‘u8 *’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2322: warning: passing argument 4 of ‘cfg80211_roamed’ makes <snip>
include/net/cfg80211.h:3726: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2322: warning: passing argument 5 of ‘cfg80211_roamed’ makes <snip>
include/net/cfg80211.h:3726: note: expected ‘size_t’ but argument is of type ‘u8 *’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2322: warning: passing argument 6 of ‘cfg80211_roamed’ makes <snip>
include/net/cfg80211.h:3726: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2322: error: too few arguments to function ‘cfg80211_roamed’
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_update_wowl’:
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:2791: warning: unused variable ‘wdev’
make[1]: *** [/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.o] Error 1
make: *** [_module_/usr/local/src/hybrid-wl] Error 2
make: Leaving directory `/usr/src/kernels/2.6.32-573.7.1.el6.x86_64'

  注意: 在 EL6 和 EL7 的步骤由此起有分别。如果是 EL6,你应该遵从第 3 步上;而 EL7 只须应用第 3 步上的修正及第 3 步下的 sed 指命,并按照此步骤(3 上)内的指示编译它。即是说, EL7 要略过第3步上的 sed 指令。

  在 EL6 上,驱动程序由于 wl_cfg80211_hybrid.c 档内检查内核版本的 if-then-else 句式而不能编译。我们须要执行下列的 sed 替换指令来进行修正: 

。这则信息的内容随着内核和操作系统版本而变化,但是在 CentOS 6 上它大致上是:

 

[[email protected] hybrid-wl]$ sed -i 's/[ >][>=] KERNEL_VERSION(2, 6, 3.)/>= KERNEL_VERSION(2, 6, 32)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/[ >][>=] KERNEL_VERSION(3, ., .)/>= KERNEL_VERSION(2, 6, 32)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/[ >][>=] KERNEL_VERSION(3, 11, .)/>= KERNEL_VERSION(2, 6, 32)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/< KERNEL_VERSION(3, 18, .)/< KERNEL_VERSION(2, 6, 30)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/[ >][>=] KERNEL_VERSION(3, 15, .)/>= KERNEL_VERSION(2, 6, 32)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/[ >][>=] KERNEL_VERSION(4, 0, 0)/>= KERNEL_VERSION(2, 6, 32)/' src/wl/sys/wl_cfg80211_hybrid.c
[[email protected] hybrid-wl]$ sed -i 's/< KERNEL_VERSION(4,2,0)/< KERNEL_VERSION(2, 6, 30)/' src/wl/sys/wl_cfg80211_hybrid.c

  不过,这些 'sed' 替换命令仍未能确保驱动程序可以正常编译。我们还须要在编译驱动程序前应用 wl-kmod-fix-ioctl-handling.patch 这个修正。请将它下载至 /usr/local/src 然后执行下列指令来修正驱动程序的源代码:

[[email protected] hybrid-wl]$ patch -p1 < ../wl-kmod-fix-ioctl-handling.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #1 succeeded at 1467 (offset 17 lines).
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 1659 (offset 8 lines).

  现在,请尝试再次编译驱动模块:

[[email protected] hybrid-wl]$ make -C /lib/modules/`uname -r`/build  M=`pwd`

  编译器的输出大致上是这样:

make: Entering directory `/usr/src/kernels/2.6.32-573.7.1.el6.x86_64'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  LD /usr/local/src/hybrid-wl/built-in.o
  CC [M] /usr/local/src/hybrid-wl/src/shared/linux_osl.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_linux.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_iw.o
  CC [M] /usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.o
/usr/local/src/hybrid-wl/src/wl/sys/wl_cfg80211_hybrid.c:1802: warning: initialization from incompatible pointer type
  LD [M] /usr/local/src/hybrid-wl/wl.o
  Building modules, stage 2.
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  MODPOST 1 modules
  CC /usr/local/src/hybrid-wl/wl.mod.o
  LD [M] /usr/local/src/hybrid-wl/wl.ko.unsigned
  NO SIGN [M] /usr/local/src/hybrid-wl/wl.ko
make: Leaving directory `/usr/src/kernels/2.6.32-573.7.1.el6.x86_64'

  一旦这个模块被建成,你便可以删除不必要的符号:

[[email protected] hybrid-wl]$ strip --strip-debug wl.ko

  你会发现驱动模块的文件尺寸会缩小(由 8.2MB 降至 7.2MB)。而且,你的驱动模块仍能正常运作。

本文由www.129028.com金沙发布于操作系统,转载请注明出处:在centos7(EL7.3 即 kernel-3.10.0-514.X )上安装BCM4312无线网卡驱动要注意的问题,centos7bcm4312

关键词:

Axon推出兼容Mac www.129028.com金沙OS X平板电脑Haptic

据外国媒体报道,日前,Axon Logic公司专为移植安装Mac OSX设计的Haptic平板机终于开始接受预定。尽管由于授权方面的限...

详细>>

Win7图形界面设计受苹果Mac OS X启发

微软部门合作经理SimonAldous近日在接受采访时承认,windows7操作系统的图形化界面是在苹果MacOSX的启发下设计出来的。...

详细>>

www.129028.com金沙小型Linux发行版Puppy Linux 5.0 Wary发布

Puppy Linux 是个相当小巧的 Linux发行版,虽然它只有几十MB的大小,但它自带了大量的描扫仪、打印机、数码相机的驱动...

详细>>

2.0.1www.129028.com金沙 Mac OS X

曾头顶iPad杀手的JooJoo平板在遭遇一连串跳票后未能在发售时间上抢占先机,最终以几十台的预定量惨淡收场,并逐渐...

详细>>