linux 内核模块管理

已加载模块
lsmod
 
安装模块
insmod /lib/modules/.....
 
 
卸载模块
rmmod usbnet
 
模块信息

modinfo usbserial.ko
filename: usbserial.ko
license: GPL
description: USB Serial Driver core
author: Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/
srcversion: 2FFD0C7B16BC3040AC5800D
depends:
vermagic: 2.6.32-38-generic SMP mod_unload modversions 586
parm: vendor:User specified USB idVendor (ushort)
parm: product:User specified USB idProduct (ushort)
parm: debug:Debug enabled or not (bool)

 

 usb设备

lsusb
Bus 002 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lspci 

lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)

 

 lscpu
Architecture: i686
CPU op-mode(s): 64-bit
CPU(s): 1
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Stepping: 3
CPU MHz: 3292.410
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K

 

 

Module                  Size  Used by
nls_utf8                1069  1 
isofs                  29915  1 
usb_storage            40208  0 
binfmt_misc             6412  1 
nfsd                  241120  11 
lockd                  64615  1 nfsd
nfs_acl                 2257  1 nfsd
auth_rpcgss            33416  1 nfsd
sunrpc                192277  12 nfsd,lockd,nfs_acl,auth_rpcgss
exportfs                3417  1 nfsd
acpiphp                17000  0 
snd_ens1371            18375  2 
gameport                8701  1 snd_ens1371
snd_ac97_codec         98980  1 snd_ens1371
ac97_bus                1014  1 snd_ac97_codec
snd_pcm                71474  2 snd_ens1371,snd_ac97_codec
snd_seq_midi            4652  0 
snd_rawmidi            17836  2 snd_ens1371,snd_seq_midi
snd_seq_midi_event      6047  1 snd_seq_midi
snd_seq                46801  2 snd_seq_midi,snd_seq_midi_event
snd_timer              18657  2 snd_pcm,snd_seq
snd_seq_device          5776  3 snd_seq_midi,snd_rawmidi,snd_seq
snd                    48853  11 snd_ens1371,snd_ac97_codec,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
ppdev                   5238  0 
joydev                  8743  0 
usbhid                 35355  0 
lp                      7181  0 
hid                    67796  1 usbhid
soundcore                880  1 snd
intel_agp               9842  1 
intel_gtt              12830  1 intel_agp
agpgart                30657  2 intel_agp,intel_gtt
i2c_piix4               7707  0 
snd_page_alloc          7248  1 snd_pcm
parport_pc             26052  1 
shpchp                 25010  0 
parport                31531  3 ppdev,lp,parport_pc
vmw_balloon             3534  0 
psmouse                55905  0 
serio_raw               3990  0 
pcnet32                29107  0 
vmw_pvscsi             12727  0 
mii                     4425  1 pcnet32
mptspi                 14771  2 
mptscsih               30987  1 mptspi
mptbase                86394  2 mptspi,mptscsih
vmxnet3                26975  0 
scsi_transport_spi     20621  1 mptspi
 

 

让驱动自动加载

/etc/moudles 加入模块名,不要加.ko

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp

# Generated by ath9k_htc-installer on 一  4月 27 16:18:43 2015
ath9k_htc

  

depmod
depmod - program to generate modules.dep and map files
当把模块文件放到/lib/module/`uname -r`/目录下,运行depmod,则会在/lib/modules/<kernel-version>/目录下生成modules.dep(.bb)文件,表明了模块的依赖关系

 

 

 

posted @ 2012-06-03 13:22  ahuo  阅读(472)  评论(0编辑  收藏  举报