linux 安装驱动 与相关内容

Posted by 老沙
9月 10 2009

安装驱动

1.查看开机网卡的加载情况
[root@localhost mydisk]# dmesg|grep -n eth
383:e100: eth0: e100_probe: addr 0xdc100000, irq 90, MAC addr 00:01:B3:36:DB:1A
392:sky2 eth1: addr 00:13:d4:9d:65:38
426:sky2 eth0: enabling interface
427:sky2 eth0: ram buffer 48K
428:ADDRCONF(NETDEV_UP): eth0: link is not ready
429:sky2 eth0: Link is up at 100 Mbps, full duplex, flow control both
430:ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
441:eth0: no IPv6 routers present

2.按行号查看
[root@localhost mydisk]# dmesg|cat -n|less

3.查看模块信息
[root@localhost mydisk]# modinfo sky2
filename: /lib/modules/2.6.18-128.el5/kernel/drivers/net/sky2.ko
version: 1.14
license: GPL
author: Stephen Hemminger <shemminger@linux-foundation.org>
description: Marvell Yukon 2 Gigabit Ethernet driver
srcversion: 24BB88B15DBF35BF3881E0F
alias: pci:v000011ABd0000436Bsv*sd*bc*sc*i*
alias: pci:v000011ABd0000436Asv*sd*bc*sc*i*
alias: pci:v000011ABd00004369sv*sd*bc*sc*i*
alias: pci:v000011ABd00004368sv*sd*bc*sc*i*
alias: pci:v000011ABd00004367sv*sd*bc*sc*i*
alias: pci:v000011ABd00004366sv*sd*bc*sc*i*
alias: pci:v000011ABd00004364sv*sd*bc*sc*i*
alias: pci:v000011ABd00004363sv*sd*bc*sc*i*
alias: pci:v000011ABd00004362sv*sd*bc*sc*i*
alias: pci:v000011ABd00004361sv*sd*bc*sc*i*
alias: pci:v000011ABd00004360sv*sd*bc*sc*i*
alias: pci:v000011ABd00004356sv*sd*bc*sc*i*
alias: pci:v000011ABd00004353sv*sd*bc*sc*i*
alias: pci:v000011ABd00004352sv*sd*bc*sc*i*
alias: pci:v000011ABd00004351sv*sd*bc*sc*i*
alias: pci:v000011ABd00004350sv*sd*bc*sc*i*
alias: pci:v000011ABd00004347sv*sd*bc*sc*i*
alias: pci:v000011ABd00004346sv*sd*bc*sc*i*
alias: pci:v000011ABd00004345sv*sd*bc*sc*i*
alias: pci:v000011ABd00004344sv*sd*bc*sc*i*
alias: pci:v000011ABd00004343sv*sd*bc*sc*i*
alias: pci:v000011ABd00004342sv*sd*bc*sc*i*
alias: pci:v000011ABd00004341sv*sd*bc*sc*i*
alias: pci:v000011ABd00004340sv*sd*bc*sc*i*
alias: pci:v00001186d00004B03sv*sd*bc*sc*i*
alias: pci:v00001186d00004B02sv*sd*bc*sc*i*
alias: pci:v00001186d00004001sv*sd*bc*sc*i*
alias: pci:v00001186d00004B00sv*sd*bc*sc*i*
alias: pci:v00001148d00009E00sv*sd*bc*sc*i*
alias: pci:v00001148d00009000sv*sd*bc*sc*i*
depends:
vermagic: 2.6.18-128.el5 SMP mod_unload gcc-4.1
parm: debug:Debug level (0=none,…,16=all) (int)
parm: copybreak:Receive copy threshold (int)
parm: disable_msi:Disable Message Signaled Interrupt (MSI) (int)
module_sig: 883f350497747d075ed35fe9471dce112f4410a0881510ca254558bada0e5e7ed1b641cbdc1cf0a0bca569a1a3cb1e27d68c7cb09d1b3aeb0d13f

也可以查看以加载的模块
[root@localhost mydisk]# lsmod
Module Size Used by
nfs 290189 1
lockd 99185 2 nfs
fscache 52385 1 nfs
nfs_acl 36673 1 nfs
autofs4 57033 2
hidp 83521 2
rfcomm 104809 0
l2cap 89281 10 hidp,rfcomm
bluetooth 118597 5 hidp,rfcomm,l2cap
sunrpc 197897 9 nfs,lockd,nfs_acl
ip_conntrack_netbios_ns 36033 0
ipt_REJECT 38849 1
xt_state 35265 2
ip_conntrack 91109 2 ip_conntrack_netbios_ns,xt_state
nfnetlink 40457 1 ip_conntrack
iptable_filter 36161 1
ip_tables 55329 1 iptable_filter
ip6t_REJECT 38849 1
xt_tcpudp 36289 10
ip6table_filter 36033 1
ip6_tables 50049 1 ip6table_filter
x_tables 50377 6 ipt_REJECT,xt_state,ip_tables,ip6t_REJECT,xt_tcpudp,ip6_tables
cpufreq_ondemand 42449 1
powernow_k8 58073 0
freq_table 40889 2 cpufreq_ondemand,powernow_k8
dm_mirror 53193 0
dm_multipath 55257 0
scsi_dh 41665 1 dm_multipath
video 53197 0
backlight 39873 1 video
sbs 49921 0
i2c_ec 38593 1 sbs
button 40545 0
battery 43849 0
asus_acpi 50917 0
acpi_memhotplug 40133 0
ac 38729 0
ipv6 424609 17 ip6t_REJECT
xfrm_nalgo 43333 1 ipv6
crypto_api 42945 1 xfrm_nalgo
lp 47121 0
joydev 43969 0
pcspkr 36289 0
snd_via82xx_modem 49229 0
shpchp 70765 0
sky2 78661 0
snd_via82xx 62825 1
snd_ac97_codec 143257 2 snd_via82xx_modem,snd_via82xx
ac97_bus 35649 1 snd_ac97_codec
snd_seq_dummy 37061 0
snd_seq_oss 65473 0
snd_seq_midi_event 41025 1 snd_seq_oss
snd_seq 87777 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_pcm_oss 77377 0
snd_mixer_oss 49985 1 snd_pcm_oss
e100 70097 0
mii 38849 1 e100
snd_pcm 116681 4 snd_via82xx_modem,snd_via82xx,snd_ac97_codec,snd_pcm_oss
snd_timer 57161 2 snd_seq,snd_pcm
fglrx 2389864 26
snd_page_alloc 44113 3 snd_via82xx_modem,snd_via82xx,snd_pcm
i2c_viapro 42457 0
k8temp 39105 0
snd_mpu401 42985 0
snd_mpu401_uart 41921 2 snd_via82xx,snd_mpu401
snd_rawmidi 59713 1 snd_mpu401_uart
i2c_core 56129 2 i2c_ec,i2c_viapro
hwmon 36553 1 k8temp
snd_seq_device 41557 4 snd_seq_dummy,snd_seq_oss,snd_seq,snd_rawmidi
ns558 38593 0
parport_pc 62313 1
gameport 49745 3 snd_via82xx,ns558
parport 73165 2 lp,parport_pc
snd 99433 15 snd_via82xx_modem,snd_via82xx,snd_ac97_codec,snd_seq_oss,snd_seq,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_mpu401,snd_mpu401_uart,snd_rawmidi,snd_seq_device
soundcore 41825 1 snd
k8_edac 50693 0
edac_mc 60193 1 k8_edac
serio_raw 40517 0
dm_raid45 99025 0
dm_message 36161 1 dm_raid45
dm_region_hash 46145 1 dm_raid45
dm_log 44865 3 dm_mirror,dm_raid45,dm_region_hash
dm_mod 100369 4 dm_mirror,dm_multipath,dm_raid45,dm_log
dm_mem_cache 38977 1 dm_raid45
sata_via 44101 0
libata 208721 1 sata_via
sd_mod 56385 0
scsi_mod 196569 3 scsi_dh,libata,sd_mod
ext3 168017 2
jbd 94257 1 ext3
uhci_hcd 57433 0
ohci_hcd 55925 0
ehci_hcd 65741 0

4.编译网卡驱动
linux2.6.x以后的内核文件与关联函数放在/usr/src/kernels/版本/ 下,而老版本的linux默认在 /usr/src/linux中,所以做如下操作 ln -s /usr/src/kernels/版本/ /usr/src/linux

5.复制模块到/lib/modules/`uname -r`/kernel/drivers/net/
[root@localhost DriverInstall]# cp sk98lin.ko /lib/modules/`uname -r`/kernel/drivers/net/

6.分析所有模块,并建立关联
[root@localhost net]# depmod -a

7.确定模块是否加载
[root@localhost net]# lsmod|grep sk98lin
sk98lin 209340 0
应该是没有加载的,我这个显示是以加载的情况
加载模块
modprobe sk98lin

8.设置开机启动的网卡模块
/etc/modprobe.conf 2.4.x内核为/etc/modules.conf
修改或加放这一行
#alias eth0 sky2
alias eth0 sk98lin

内核模块加载就完成了,重启看看吧 sync;reboot

相关命令还有insmod,rmmod.

禁止开机自动加载模块相关文件
/lib/modules/`uname -r`/modules.dep
/etc/modprobe.d/*
/etc/modprobe.conf
/etc/rc.sysinit

One Response

  1. zero89说道:

    博主你好,请问你最上买的广告是怎么挂的?

Trackback URL for this entry