Linux查找内核模块(设备驱动程序)版本号

时间:2020-01-09 10:41:19  来源:igfitidea点击:

如何在Linux服务器中找到内核模块的版本(位于/lib/modules /目录中的ko文件)?
您需要使用modinfo命令来显示有关Linux内核模块的信息。
语法如下:

modinfo Module-Name-Here

要列出已加载的模块,请执行:

# lsmod
# lsmod | less

输出示例:

Module                  Size  Used by
sha1_generic            1759  4 
ppp_mppe                5240  2 
ppp_async               6245  1 
crc_ccitt               1323  1 ppp_async
ppp_generic            19291  6 ppp_mppe,ppp_async
slhc                    4003  1 ppp_generic
aes_x86_64              7340  0 
aes_generic            25714  1 aes_x86_64
hidp                   11083  1 
vmnet                  37057  13 
vmblock                10462  1 
vsock                  35775  0 
vmci                   46596  1 vsock
vmmon                  64195  0 
parport_pc             18855  0 
ppdev                   5030  0 
lp                      7462  0 
acpi_cpufreq            5571  1 
cpufreq_stats           2659  0 
parport                27954  3 parport_pc,ppdev,lp
cpufreq_userspace       1992  0 
cpufreq_conservative     5162  0 
vboxnetadp              4683  0 
cpufreq_powersave        902  0 
vboxnetflt             15920  0 
vboxdrv              1749361  2 vboxnetadp,vboxnetflt
sco                     7225  2 
bridge                 39662  0 
stp                     1440  1 bridge
bnep                    9443  2 
rfcomm                 29629  8 
l2cap                  24736  21 hidp,bnep,rfcomm
uinput                  6376  1 
binfmt_misc             6447  1 
fuse                   50940  1 
loop                   11799  0 
firewire_sbp2          11530  0 
btusb                   9913  4 
bluetooth              41843  10 hidp,sco,bnep,rfcomm,l2cap,btusb
snd_hda_codec_idt      42513  1 
arc4                    1274  4 
snd_hda_intel          20051  1 
pcmcia                 19474  0 
snd_hda_codec          54244  2 snd_hda_codec_idt,snd_hda_intel
ecb                     1841  4 
snd_hwdep               5380  1 snd_hda_codec
snd_pcm                60503  2 snd_hda_intel,snd_hda_codec
snd_seq                42913  0 
snd_timer              15582  2 snd_pcm,snd_seq
snd_seq_device          4493  1 snd_seq
iwlagn                 73171  0 
iwlcore                77938  1 iwlagn
snd                    46542  10 snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_seq,snd_timer,snd_seq_device
soundcore               4598  1 snd
yenta_socket           19115  1 
tifm_7xx1               3850  0 
joydev                  8459  0 
mac80211              137516  2 iwlagn,iwlcore
rsrc_nonstatic          7294  1 yenta_socket
dell_laptop             1985  0 
snd_page_alloc          6265  2 snd_hda_intel,snd_pcm
tifm_core               4356  1 tifm_7xx1
nvidia              10484934  57 
cfg80211              101656  3 iwlagn,iwlcore,mac80211
pcmcia_core            24118  3 pcmcia,yenta_socket,rsrc_nonstatic
rfkill                 13060  5 bluetooth,dell_laptop,cfg80211
video                  17445  0 
output                  1692  1 video
i2c_i801                7830  0 
i2c_core               15835  2 nvidia,i2c_i801
psmouse                49937  0 
evdev                   7352  22 
serio_raw               3752  0 
pcspkr                  1699  0 
dcdbas                  5048  1 dell_laptop
wmi                     4323  0 
processor              29951  9 acpi_cpufreq
ac                      2192  0 
battery                 4998  0 
button                  4650  0 
ext4                  288478  1 
mbcache                 5050  1 ext4
jbd2                   67079  1 ext4
crc16                   1319  2 l2cap,ext4
sg                     24085  0 
sd_mod                 29937  3 
sr_mod                 12602  0 
crc_t10dif              1276  1 sd_mod
cdrom                  29415  1 sr_mod
hid_apple               4594  0 
usbhid                 33324  0 
hid                    63273  3 hidp,hid_apple,usbhid
sdhci_pci               5581  0 
sdhci                  13982  1 sdhci_pci
mmc_core               45798  1 sdhci
ahci                   32534  2 
firewire_ohci          19692  0 
tg3                    95695  0 
firewire_core          36880  2 firewire_sbp2,firewire_ohci
ehci_hcd               32129  0 
crc_itu_t               1307  1 firewire_core
led_class               2433  2 iwlcore,sdhci
libata                133680  1 ahci
libphy                 14054  1 tg3
scsi_mod              126597  5 firewire_sbp2,sg,sd_mod,sr_mod,libata
thermal                11674  0 
usbcore               122450  4 btusb,usbhid,ehci_hcd
nls_base                6377  1 usbcore
thermal_sys            11942  3 video,processor,thermal

要查找有关tg3驱动程序/模块的版本和其他信息,请执行:

# modinfo tg3 | less
# modinfo tg3 | grep -i version

输出示例:

version:        3.102
srcversion:     29B86B4EFF2E078A71F716A
vermagic:       2.6.32-5-amd64 SMP mod_unload modversions