linux 下手動編譯安裝無線網卡驅動

來源:互聯網
上載者:User

標籤:des   style   blog   c   tar   ext   

//先參照 《本地yum源安裝GCC 》安裝好gcc

hp的筆記本上安裝了CentOS6.3,沒有安裝無線網卡驅動,安裝這個驅動,在Google上找了好多資料,最後終於解決了這個問題。在這裡做點記錄,希望也能幫到別人。

我的機子是32位,CentOS的核心版本是2.6.32-279.19.1.el6.i686,下載的無線網卡驅動是hybrid-portsrc_x86_32-v5_100_82_112.tar.gz

下面是具體的步驟

一:確定無線網卡的型號,驅動下載

第一步要確定機子的無線網卡型號是什麼,可以用命令

[[email protected] ~]$/sbin/lspci | grep Broadcom
02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
或
[[email protected] ~]$lspci | grep Wireless

可見對應的驅動為:Broadcom BCM4313

下載驅動:http://www.broadcom.com/support/802.11/linux_sta.php

其中,在下載頁面有一個README.txt檔案,裡面有一段話這樣描述:

SUPPORTED DEVICES
—————–
The cards with the following PCI Device IDs are supported with this driver.
Both Broadcom and and Dell product names are described. Cards not listed
here may also work.

BRCM PCI PCI Dell
Product Name Vendor ID Device ID Product ID
————- ———- ——— ———–
4311 2.4 Ghz 0x14e4 0×4311 Dell 1390
4311 Dualband 0x14e4 0×4312 Dell 1490
4311 5 Ghz 0x14e4 0×4313
4312 2.4 Ghz 0x14e4 0×4315 Dell 1395
4313 2.4 Ghz 0x14e4 0×4727 Dell 1501
4321 Dualband 0x14e4 0×4328 Dell 1505
4321 Dualband 0x14e4 0×4328 Dell 1500
4321 2.4 Ghz 0x14e4 0×4329
4321 5 Ghz 0x14e4 0x432a
4322 Dualband 0x14e4 0x432b Dell 1510
4322 2.4 Ghz 0x14e4 0x432c
4322 5 Ghz 0x14e4 0x432d
43224 Dualband 0x14e4 0×4353 Dell 1520
43225 2.4 Ghz 0x14e4 0×4357
43227 2.4 Ghz 0x14e4 0×4358
43228 Dualband 0x14e4 0×4359 Dell 1530

To find the Device ID’s of Broadcom cards on your machines do:
# lspci -n | grep 14e4

運行:
[[email protected]ntOS ~]$ lspci -n | grep 14e4
02:00.0 0280: 14e4:4727 (rev 01)
0b:00.0 0200: 14e4:1680 (rev 10)

CentOS的核心源碼是放在 /usr/src/kernels 目錄中; 如果通過線上升級核心, 也是放在這個目錄中; 如果你的系統中的 /usr/src/kernels/ 中沒有內容,說明沒有安裝核心的源碼包 kernel-devel 軟體包; 通過線上安裝的核心源碼包, 可以通過 yum 安裝的, 核心源碼會被放到 /usr/src/kernel 下的目錄中

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

如果未安裝核心的源碼包,在後面make的時候會報錯誤:

[[email protected] hybird-wl]$ make -C /lib/modules/`uname -r`/build/ M=`pwd`
make: *** /lib/modules/2.6.32-279.el6.i686/build/: No such file or directory. Stop.

二:建立安裝目錄

[[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 /path/to/the/tarball/hybrid-portsrc_x86_32-v5_100_82_112.tar.gz(name of the downloaded file)
[[email protected] hybrid-wl]# chown -R someuser.somegroup /usr/local/src/hybrid-wl

三:編譯

[[email protected] hybird-wl]$ make

第一次編譯,報了如下的錯誤:

KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make[1]: Entering directory `/usr/src/kernels/2.6.32-279.el6.i686′
CFG80211 API is prefered for this kernel version
Using CFG80211 API
LD /usr/local/src/hybird-wl/built-in.o
CC [M] /usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.o
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:64: warning: ‘enum tx_power_setting’ declared inside parameter list
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:64: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1110: warning: ‘enum tx_power_setting’ declared inside parameter list
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1110: error: parameter 2 (‘type’) has incomplete type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c: In function ‘wl_cfg80211_set_tx_power’:
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1123: error: ‘TX_POWER_AUTOMATIC’ undeclared (first use in this function)
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1123: error: (Each undeclared identifier is reported only once
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1123: error: for each function it appears in.)
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1125: error: ‘TX_POWER_LIMITED’ undeclared (first use in this function)
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1131: error: ‘TX_POWER_FIXED’ undeclared (first use in this function)
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c: At top level:
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1649: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1651: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1652: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1653: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1654: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1658: warning: initialization from incompatible pointer type
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c: In function ‘wl_inform_single_bss’:
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:1817: error: too few arguments to function ‘ieee80211_channel_to_frequency’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c: In function ‘wl_bss_roaming_done’:
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 2 of ‘cfg80211_roamed’ from incompatible pointer type
include/net/cfg80211.h:3035: note: expected ‘struct ieee80211_channel *’ but argument is of type ‘u8 *’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 4 of ‘cfg80211_roamed’ makes pointer from integer without a cast
include/net/cfg80211.h:3035: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 5 of ‘cfg80211_roamed’ makes integer from pointer without a cast
include/net/cfg80211.h:3035: note: expected ‘size_t’ but argument is of type ‘u8 *’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 6 of ‘cfg80211_roamed’ makes pointer from integer without a cast
include/net/cfg80211.h:3035: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2117: error: too few arguments to function ‘cfg80211_roamed’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c: In function ‘wl_bss_connect_done’:
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 2 of ‘cfg80211_roamed’ from incompatible pointer type
include/net/cfg80211.h:3035: note: expected ‘struct ieee80211_channel *’ but argument is of type ‘u8 *’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 4 of ‘cfg80211_roamed’ makes pointer from integer without a cast
include/net/cfg80211.h:3035: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 5 of ‘cfg80211_roamed’ makes integer from pointer without a cast
include/net/cfg80211.h:3035: note: expected ‘size_t’ but argument is of type ‘u8 *’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 6 of ‘cfg80211_roamed’ makes pointer from integer without a cast
include/net/cfg80211.h:3035: note: expected ‘const u8 *’ but argument is of type ‘s32’
/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.c:2149: error: too few arguments to function ‘cfg80211_roamed’
make[2]: *** [/usr/local/src/hybird-wl/src/wl/sys/wl_cfg80211.o] Error 1
make[1]: *** [_module_/usr/local/src/hybird-wl] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-279.el6.i686′
make: *** [all] Error 2

google了一下,發現CentOS6.3版本報的都是相同的錯誤,找了好多資料都沒有好的解決辦法。回頭再看broadcom的REAMME.txt,裡面寫了一段話:

If your driver does not build, check to make sure you have installed the
kernel package described in the requirements above.

This driver now supports the new linux cfg80211 wireless configuration API in
addition to the older Wireless Extensions (Wext). The makefile will
automaticly build the right version for your system but it can be
overridden if needed:

# make API=WEXT
or
# make API=CFG80211

嘗試重新編譯

[[email protected] hybird-wl]$ make clean
[[email protected] hybird-wl]$ make API=WEXT

編譯通過了,產生了wl.ko這個檔案,發現還是得看官方的文檔。完成編譯後便是安裝

[[email protected] hybird-wl]$ make install

安裝就是把檔案COPY到/lib/modules/<kernel-version>/kernel/net/wireless 目錄。

四:驅動配置

移除所有其它的BROADCOM 無線裝置驅動。除了我們已經編譯好的驅動外,其它的Broadcom 802.11晶片驅動象b43, bcma和ssb。 這個驅動和我們新的驅動是衝突的。所以我們要先把它們移除。

# lsmod  | grep “b43\|ssb\|bcma\|wl”

如果以下任何一種驅動存在,移除它:

[[email protected] hybird-wl]$rmmod b43
[[email protected] hybird-wl]$rmmod ssb
[[email protected] hybird-wl]$rmmod bcma
[[email protected] hybird-wl]$rmmod wl

所這些配置加入黑名單,不讓它們被使用:

[[email protected] hybird-wl]$echo “blacklist ssb” >> /etc/modprobe.d/blacklist.conf
[[email protected] hybird-wl]$echo “blacklist bcma” >> /etc/modprobe.d/blacklist.conf
[[email protected] hybird-wl]$echo “blacklist b43″ >> /etc/modprobe.d/blacklist.conf

載入新的驅動

[[email protected] hybird-wl]$modprobe lib80211 # 因為 wl.ko 需要依賴該模組
[[email protected] hybird-wl]$insmod wl.ko

現在你的網路管理程式應該可以找到裝置, 你可以使用無線網路了!最後添加開機啟動

[[email protected] wireles_smoudules]# cp wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
[[email protected] wireles_smoudules]# depmod -a
[[email protected] wireles_smoudules]# echo modeprobe wl >> /etc/rc.local

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.