linux上安裝網路卡驅動程式

來源:互聯網
上載者:User

首先看網卡是否已經正確串連到電腦。這一步一般是不會有問題的。使用的命令是lspci,在ubuntu下還可以使用lshw命令,輸出如下:
redhat上使用lspci的輸出:
[root@jcwkyl class]# lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 0a)
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 0a)
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)
00:1d.0 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 IDE interface: Intel Corporation N10/ICH7 Family SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc RV610 video device [Radeon HD 2400 PRO]
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
Ubuntu上使用lshw命令的輸出:
root@jcwkyl:~# lshw -C network
  *-network              
       description: Ethernet interface
       product: NetLink BCM5784M Gigabit Ethernet PCIe
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: peth0
       version: 10
       serial: 00:e0:4c:3d:aa:ba
       size: 100MB/s
       capacity: 1GB/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.92.1 duplex=full ip=10.60.59.31 latency=0 link=yes module=tg3 multicast=yes port=twisted pair promiscuous=yes speed=100MB/s

以上是網卡已經成功驅動後的輸出。如果網卡沒有正常驅動,則lshw的輸出會有類似於*-network UNCLAIMED字樣。
另 外在lspci命令的輸出中有可能會顯示Unknown Device,這是因為網卡的id沒有被作業系統識別,可以運行update-pciids命令從網路上下載最新的pci裝置的ID列表。這一步對安裝驅 動程式來說不是必須。如果電腦因為網卡驅動不能串連網路,手頭又有一份最新的PCI裝置ID,可以從man lspci中找到PCI裝置ID列表檔案所在位置, 在Redhat下一般是/usr/share/hwdata/pci.ids,Ubuntu下是/usr/share/misc/pci.ids,可以手 動替換ID列表檔案。

接下來就是找到網卡的驅動程式。首先要把網卡的ID找到,使用lspci-n命令找到網卡ID,如上面的lspci命令所示,輸出的第一列格式是bus:slot.func,如上的lspci輸出結果,網卡的pci domain是0000,bus是02,slot是00,func編號是0。這些資訊結合起來可以惟一標識電腦上的一個PCI裝置。通過這些資訊可以找 到PCI裝置的廠商ID和裝置ID,使用lspci -n參數,如下:
[root@jcwkyl class]# lspci -n
00:00.0 0600: 8086:29c0 (rev 0a)
00:01.0 0604: 8086:29c1 (rev 0a)
00:1b.0 0403: 8086:27d8 (rev 01)
00:1c.0 0604: 8086:27d0 (rev 01)
00:1d.0 0c03: 8086:27c8 (rev 01)
00:1d.1 0c03: 8086:27c9 (rev 01)
00:1d.2 0c03: 8086:27ca (rev 01)
00:1d.3 0c03: 8086:27cb (rev 01)
00:1d.7 0c03: 8086:27cc (rev 01)
00:1e.0 0604: 8086:244e (rev e1)
00:1f.0 0601: 8086:27b8 (rev 01)
00:1f.1 0101: 8086:27df (rev 01)
00:1f.2 0101: 8086:27c0 (rev 01)
00:1f.3 0c05: 8086:27da (rev 01)
01:00.0 0300: 1002:94c3
02:00.0 0200: 14e4:1698 (rev 10)
從 這個輸出中找到02:00.0的一行,從後面可以看到廠商ID是14e4,該廠商生產的這款網卡ID是1698。數字都是十六進位。這個時候就可以在google上搜尋broadcom 14e4:1698,在http: //www.broadcom.com/support/ethernet_nic/determine_driver.php找到驅動程式下載。
到 這一步也有另一種方法,在fedora core的bug list中有人提出fedora core不能識別broadcom 57780型號的網卡,這個型號的網卡裝置ID是1692。有人提出保證broadcom模組在tg3模組之前載入的話可以解決問題,我有一次確實這樣把 問題解決了,可以試一下這種方法。
在linux安裝時的/lib/modules/$(uname-r)目錄下有很多模組關係描述檔案,比如modules.pcimap檔案,這個檔案中儲存了PCI裝置的驅動程式模組名稱,廠商ID,裝置ID對應 表,比如在我的電腦上的這個檔案中用可以找到我的網卡對應的驅動程式:
tg3                  0x000014e4 0x00001698 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
可以看到我的電腦上網卡的驅動程式是tg3。

下載到tg3原始碼後解壓,進入解壓後的Server/Linux/Driver/tg3-3.110g目錄,在tg3.h檔案中肯定能找到網卡ID的定義,如下:
#define  TG3PCI_DEVICE_TIGON3_57780      0x1692
如果沒有的話,肯定是出問題了,必須重新找驅動程式原始碼,手動加上不一定管用,自己也沒試過。

然 後是敲入make命令編譯,可能會出錯,和gcc版本以及代碼都可能有關。出了錯誤也只是一些編譯錯誤,根據錯誤修改tg3的原始碼,再重新編譯過就可 以。make成功以後,可以先試一試,順序敲入rmmod tg3, insmod tg3.ko,用ifconfig看一看是不是有eth0網卡了,如果還是沒有eth0網卡,可能和上面說的模組載入順序有關係,先rmmod tg3,然後modprobe broadcom, insmod tg3.ko,再看看。
最後使用make install命令把tg3.ko安裝到/lib/module下面對應的位置。

 

轉載:http://blog.chinaunix.net/uid-10697776-id-3080243.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.