Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2451606
  • 博文数量: 540
  • 博客积分: 11289
  • 博客等级: 上将
  • 技术积分: 6160
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-11 20:27
个人简介

潜龙勿用,见龙在田

文章分类

全部博文(540)

文章存档

2018年(2)

2013年(5)

2012年(24)

2011年(104)

2010年(60)

2009年(217)

2008年(128)

分类: LINUX

2009-03-02 17:34:00

原系统RHEL5U2,后换了主板,硬盘还在,系统能正常进入,但就是找不到网卡了。于是不想重新安装系统,便去找驱动来装了。新主板是ASUS P5BV-C,到官网下载了驱动,不过官网驱动只提供到RHEL4U4的,没有RHEL5的,但是我想问题不大。
驱动只有400多KB,通过U盘copy到HDD上:先要找到USB盘在/dev下所对应的设备名称。有规律可循的,我的U盘对应的设备名是/dev/sdb,只有一个分区,相应的设备名是/dev/sdb1,于是:
mount /dev/sdb1 /mnt  (或者:mount -t vfat /dev/sdb1 /mnt,我的没有加-t参数)

将驱动包Marvell_LAN_CAP_Linux_105013.zip 拷贝到/tmp目录下,然后解压:
unzip Marvell_LAN_CAP_Linux_105013.zip
cd DriverInstall
先看看README,解压后又个install.sh安装脚本,
chmod +x install.sh
./install.sh
...
错误提示:
Check kernel header files (not found)                                [ failed ]
Kernel header not found. Please install the linux header files
development package or create a symbolic link from the
/usr/src/KERNEL_VERSION directory to linux
Example: ln -s /usr/src/KERNEL_VERSION /usr/src/linux
按照提示一步步安装,到后提示找不到kernel header,因为找不到/usr/src目录下有kernel相关的文件夹。我看了下install.sh这个脚本,安装这个驱动是要去找内核目录下的相关头文件(应该是在include目录)。于是在REDHAT官方下载了kernel source:kernel-2.6.18-92.el5.src.rpm,当然你也可以到kernel.org去下载linux-2.6.18.tar.gz。


rpm -ivh kernel-2.6.18-92.el5.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild --target i686 -bp kernel-2.6.spec
会在/usr/src/redhat/BUILD生成kernel目录:
/usr/src/redhat/BUILD/kernel-2.6.18
下面这个目录才是kernel主目录($sourcedir)了:后面将会用到
/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686

原本以为按照上面的错误提示输入下面命令便能安装成功了:
ln -s /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686 /usr/src/linux

但又出现下面的错误提示:
The kernel's modpost utility is not available. As the source code
for the utility is available in your current installed linux kernel
source tree, you can compile the utility for your own.

To do so, please follow the description below:
(Please read the next lines before you execute them!)
[1] Change to /usr/src/linux
[2] Call make (this begins to create a new linux kernel)
[3] Take a look at the output: After a few seconds the modpost utility
will be compiled
[4] Now interrupt the make process by pressing ctrl-c

The modpost utility now is created. You can check this by taking a look
at /usr/src/linux/scripts/mod. Here you should find a file modpost now.

If you are finished recall install.sh again. That's it.

按照提示说是要编译内核才行啊,晕倒。要是每个驱动都要编译内核,谁还有耐心使用linux啊,编译一次内核整个流程跑完下来有可能比重新安装一次Linux的时间还多些,要不是我原系统上安装了不少应用,我才不干安装这个驱动这事儿呢。还好这里不需要跑整个流程,意思一下就行,即当看到modpost这个工具出现时就可以ctrl-c停止继续编译了。 Linux驱动安装这方面真的还需要大力改进啊。(感叹一番,呵呵!)

没办法,只能编译内核了:


  224  cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/
  230  make
编译过程中看到出现有modpost出现则可以按ctrl-c停止编译了
ln -s /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/ /usr/src/linux
./install.sh
根据提示:
modprobe sk98lin

建议reboot后检验一下:
lsmod |grep sk98lin
lspci查看一下网卡信息:
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller (rev 12)
03:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller (rev 12)

[root@localhost ~]# dmesg |grep eth
eth0: Marvell Yukon 88E8056 Gigabit Ethernet Controller
eth1: Marvell Yukon 88E8056 Gigabit Ethernet Controller
...

如果uname -r的结果是一样,可以将这个.ko文件直接cp到其他系统中去,然后
mkdir /lib/modules/`uname -r`/kernel/drivers/net/sk98lin
cp sk98lin.ko /lib/modules/`uname -r`/kernel/drivers/net/sk98lin
insmod sk98lin
正常插入模块后会显示网卡厂商等相关信息
modprobe sk98lin
正常的话没有任何显示,表示安装成功了
---------------

另外一种安装方法:

现在下载的该驱动sk98lin.tar.gz内带一个安装shell脚本install.sh,你只需要提供系统对应kernel的源码目录(说明:/usr/src/kernel/`uname -r`是默认的,但该驱动去访问的源码目录则为/usr/src/linux,安装过程中会提示你建立一个软链接)以及kernel-header和gcc编译器。

kernel-devel

按照脚本提示和推荐的安装就能搞定了。最后安装成功的话会提示你运行modprobe sk98lin,然后你应该reboot使网卡驱动加载运行。

阅读(3247) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~