문제

in the linux, lsmod lists a lot of modules. but how can we find where those module loaded from. for some modules,linux command "modprobe -l" shows a path but some are not.
edited i also tried "find" and "locate". both of them lists all kind of versions

locate fake
/svf/SVDrv/kernel/linux/.fake.ko.cmd
/svf/SVDrv/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv/kernel/linux/.fake.o.cmd
/svf/SVDrv/kernel/linux/fake.ko
/svf/SVDrv/kernel/linux/fake.mod.o
/svf/SVDrv/kernel/linux/fake.o
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.ko.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.o.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.ko
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.mod.o
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.o
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.ko.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.o.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.ko
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.mod.o
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.o
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.ko
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.mod.o
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.o
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.ko
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.mod.o
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.o
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.ko
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.mod.o
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.o
도움이 되었습니까?

해결책 2

You can use "locate" or "find" command on these modules to find where they are , for example

[root@localhost core_src]# lsmod
Module                  Size  Used by
iptable_filter          2793  0
ipt_MASQUERADE          2466  1
iptable_nat             6158  1
vmware_balloon          7199  0
i2c_piix4              12608  0
i2c_core               31276  1 i2c_piix4
shpchp                 33482  0
ext4                  371331  2
mbcache                 8144  1 ext4
jbd2                   93312  1 ext4
sd_mod                 39488  4
crc_t10dif              1541  1 sd_mod
sr_mod                 16228  0
cdrom                  39803  1 sr_mod
mptspi                 17051  3
mptscsih               36828  1 mptspi
mptbase                94005  2 mptspi,mptscsih
scsi_transport_spi     26151  1 mptspi
pata_acpi               3701  0
ata_generic             3837  0
ata_piix               22846  0
dm_mirror              14101  0
dm_region_hash         12170  1 dm_mirror
dm_log                 10122  2 dm_mirror,dm_region_hash
dm_mod                 81692  2 dm_mirror,dm_log
[root@localhost core_src]# locate vmware_balloon
/lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/misc/vmware_balloon.ko

다른 팁

Sorry if the answer comes a bit late but I just stumbled across this particular question myself today...

To minimize manual labor here is my listing of the paths curretly loaded modules are loaded from:

awk '{ print $1 }' /proc/modules | xargs modinfo -n | sort

I needed this to create a minimal kernel image containg only the modules i really need. Unfortunately lsmod only displays the name field which does not alwys match the modules# file name (e.g phy-am335x-control.ko and phy_am335x_control). I hope this helps.

Get the paths from the list of loaded modules. Without the need for awk.

while IFS= read -r line;
    do modinfo -n "${line%% *}"
done < /proc/modules | sort
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top