Centos&Redhat下bcm 43142博通ワイヤレスネットワークカードlinux駆動の2

10909 ワード

前回はカーネルを交換してワイヤレスネットワークカードのコンパイル駆動に成功したが、システムの元のカーネルに起動してもbcm 43142の駆動はなく、元のカーネルの下でコンパイル駆動する準備ができており、記録しておく.
ps:カーネルの交換による他の互換性の問題を回避するために、この方法をお勧めします.
1.ドライバパッケージの準備
hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz点私は密cmetをダウンロードしてuディスクにコピーして、ソースパッケージを/usrにコピーします
2.インストールツール
gcc yum 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ファイル第1460147718942037224行にエラーがあり、次のように変更されました.
 [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!
参考12
転載先:https://blog.51cto.com/kking/2096757