红联Linux门户
Linux帮助

centos5.1安装realtek 8101网卡驱动出错

发布时间:2011-12-01 14:58:16来源:红联作者:xiangbei1573
回复 9# chenyx

首先,这是系统信息:
[root@localhost ~]# uname -r
2.6.18-53.el5
[root@localhost net]# rpm -qa|grep kernel
kernel-2.6.18-53.el5
[root@localhost net]# rpm -qa|grep gcc
libgcc-4.1.2-14.el5
我下载的驱动是“r8101-1.021.00.tar.bz2”,realtek官方下载的。

解压的说明文档中有一下几句话:
This is the Linux device driver released for RealTek RTL8101E(我的网卡是 RealTek RTL8101E,说明我下载的驱动是对的)
supported Linux kernel 2.6.x and 2.4.x(我的centos版本是:2.6.18-53.el5,说明驱动版本是符合内核要求)
然后,我按照说明文档 的步骤:

Unpack the tarball :

# tar vjxf r8101-1.aaa.bb.tar.bz2
Change to the directory:(更改目录)
# cd r8101-1.aaa.bb
If you are running the target kernel, then you should be able to do :(如果想加载到内核,请执行命令)
# ./autorun.sh (as root or with sudo)
You can check whether the driver is loaded by using following commands.(您可以检查是否加载的驱动程序使用下面的命令)
# lsmod | grep r8101
# ifconfig -a
If there is a device name, ethX, shown on the monitor, the linux diver is loaded. Then, you can use the following command to activate the ethX.(这个是激活命令)
# ifconfig ethX up
说明文档接下来是介绍设置IP的内容,我就不粘贴了。

但是在我执行到“# ./autorun.sh”这个命令的时候提示:
[root@localhost r8101-1.021.00]# ./autorun.sh
Check old driver and unload it.
Build the module and install
make: *** /lib/modules/2.6.18-53.el5/build: No such file or directory.Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2
我在这个 /lib/modules/2.6.18-53.el5/中确实没有找到build文件。
我在这个 /lib/modules/2.4.18-3/kernel/drivers/net 中找到了 "r8169.ko"。
若是有r8101.ko应该说明驱动安装成功,这位高手,帮我分析下,谢谢!!麻烦你了。~
文章评论

共有 7 条评论

  1. dhero1989 于 2012-05-14 15:58:00发表:

    我装时 都不用装驱动的

  2. zhoutingting 于 2012-05-13 20:35:54发表:

    你在安装网卡之前道首先进入它的目录用vi查看它里面的readme

  3. zhoutingting 于 2012-05-13 20:21:45发表:

    你在安装网卡之前道首先进入它的目录用vi查看它里面的readme

  4. hongzuo2012 于 2012-04-30 15:41:07发表:

    ddddd

  5. xiangbei1573 于 2011-12-02 15:56:24发表:

    已经搞定:
    1、安装系统的时候开发工具和开发包都需要安装,能勾选的都选上吧。
    2、将从realtek官方网站的“r8101-1.021.00.tar.bz2”文件copy到CentOS系统中(U盘格式一定是FAT32),然后解压到桌面。
    3、可以分为两种方式安装:
    1)使用ctrl+alt+F7,在图形界面下双击文件夹“r8101-1.021.00”中的“autorun.sh”,选择在终端中运行。
    2)按照readme文档步骤,一步一步做。
    4、其中可能会出错:
    -------------------------------
    Fri Dec 2 11:38:34 EST 2011
    make -C src/ clean
    make[1]: Entering directory `/root/Desktop/r8101-1.021.00/src'
    make -C /lib/modules/2.6.18-53.el5xen/build SUBDIRS=/root/Desktop/r8101-1.021.00/src clean
    make[2]: Entering directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    make[2]: Leaving directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    make[1]: Leaving directory `/root/Desktop/r8101-1.021.00/src'
    make -C src/ modules
    make[1]: Entering directory `/root/Desktop/r8101-1.021.00/src'
    make -C /lib/modules/2.6.18-53.el5xen/build SUBDIRS=/root/Desktop/r8101-1.021.00/src modules
    make[2]: Entering directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    CC [M] /root/Desktop/r8101-1.021.00/src/r8101_n.o
    CC [M] /root/Desktop/r8101-1.021.00/src/rtl_eeprom.o
    CC [M] /root/Desktop/r8101-1.021.00/src/rtltool.o
    LD [M] /root/Desktop/r8101-1.021.00/src/r8101.o
    Building modules, stage 2.
    MODPOST
    CC /root/Desktop/r8101-1.021.00/src/r8101.mod.o
    LD [M] /root/Desktop/r8101-1.021.00/src/r8101.ko
    make[2]: Leaving directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    make[1]: Leaving directory `/root/Desktop/r8101-1.021.00/src'
    make -C src/ install
    make[1]: Entering directory `/root/Desktop/r8101-1.021.00/src'
    make -C /lib/modules/2.6.18-53.el5xen/build SUBDIRS=/root/Desktop/r8101-1.021.00/src INSTALL_MOD_DIR=kernel/drivers/net modules_install
    make[2]: Entering directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    INSTALL /root/Desktop/r8101-1.021.00/src/r8101.ko
    DEPMOD 2.6.18-53.el5xen
    make[2]: Leaving directory `/usr/src/kernels/2.6.18-53.el5-xen-i686'
    make[1]: Leaving directory `/root/Desktop/r8101-1.021.00/src'

    不要紧,进入桌面的/r8101-1.021.00/src中,copy文件“r8101.ko”到“/lib/modules/2.XX.XX-X/kernel/drivers/net ”中。
    5、再次执行“autorun.sh”。
    6、进入“root/Desktop/r8101-1.021.00/src ”中,执行命令:depmod -a和insmod r8101.ko 。
    7、验证r8101是否加载:
    [root@localhost ~]# lsmod |grep r8101
    r8101 87464 0
    8、查看eth0是否激活:
    [root@localhost ~]# ifconfig -a
    eth0 Link encap:Ethernet HWaddr 00:E0:4C:2A:2E:0C
    inet addr:192.168.1.57 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::2e0:4cff:fe2a:2e0c/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2939 errors:0 dropped:0 overruns:0 frame:0
    TX packets:650 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:245723 (239.9 KiB) TX bytes:62514 (61.0 KiB)
    Interrupt:17
    9、配置IP、网关、DNS。

  6. xiangbei1573 于 2011-12-02 12:38:20发表:

    我重新安装了系统,所以的可以选的开发工具我都安装了,这是安装readme的步骤做的结果:
    [root@localhost ~]# cd Desktop/

    [root@localhost Desktop]# ls

    r8101-1.021.00 r8101-1.021.00.tar.bz2 readme

    [root@localhost Desktop]# cd r8101-1.021.00

    [root@localhost r8101-1.021.00]# ls

    autorun.sh Makefile readme src

    [root@localhost r8101-1.021.00]# ./autorun.sh


    Check old driver and unload it.
    Build the module and install
    /root/Desktop/r8101-1.021.00/src/r8101_n.c: In function

    ‘rtl8101_init_board’:
    /root/Desktop/r8101-1.021.00/src/r8101_n.c:5421: warning: left shift count >= width of type
    /root/Desktop/r8101-1.021.00/src/r8101_n.c: In function ‘rtl8101_tx_clear’:
    /root/Desktop/r8101-1.021.00/src/r8101_n.c:6758:

    warning: unused variable ‘dev’
    In file included from /root/Desktop/r8101-1.021.00/src/rtltool.c:6:
    /root/Desktop/r8101-

    1.021.00/src/r8101.h:816: warning: ‘struct ethtool_cmd’ declared inside parameter list
    /root/Desktop/r8101-

    1.021.00/src/r8101.h:816: warning: its scope is only this definition or declaration, which is probably not what you want
    Backup r8169.ko
    rename r8169.ko to r8169.bak
    load module r8101
    FATAL: Module r8101 not found.
    Completed.

    [root@localhost r8101-1.021.00]# lsmod | grep r8101

    排版可能有问题,不过不会有错的,能帮我看下是为什么还是不行呢

  7. ma-ml 于 2011-12-01 15:36:27发表:

    没看懂。。。。。。:0w223dc