如何查看有关新加载的外部 Linux 内核模块的信息?
How to view information about a newly loaded external Linux kernel module?
我有一个来自 http://www.tldp.org/LDP/lkmpg/2.6/html/x121.html
的简单 Hello World 内核模块
我用 MODULE_AUTHOR
和 MODULE_DESCRIPTION
添加了几行
构建成功,我可以使用 insmod
将其插入当前内核,使用 dmesg
查看日志,使用 lsmod
检查模块是否存在。
但是,我希望能够使用 modinfo
查看模块的信息,但它不起作用。
我得到 modinfo: ERROR: Module hello not found.
我尝试了 运行 depmod
和 depmod -A
但它们没有任何区别。
有什么方法可以使 modinfo
"reload" 以便我可以查看新添加模块的信息吗?
来自手册页:
modinfo extracts information from the Linux Kernel modules given on the command line. If the module name is not a filename, then the /lib/modules/version directory is searched, as is also done by
modprobe(8) when loading kernel modules.
所以看起来这个命令只是使用内核模块文件来获取这个信息,所以你可以 运行:
modinfo hello.ko
或者您可以将内核模块放在 /lib/modules/version/
目录中
我有一个来自 http://www.tldp.org/LDP/lkmpg/2.6/html/x121.html
的简单 Hello World 内核模块
我用 MODULE_AUTHOR
和 MODULE_DESCRIPTION
构建成功,我可以使用 insmod
将其插入当前内核,使用 dmesg
查看日志,使用 lsmod
检查模块是否存在。
但是,我希望能够使用 modinfo
查看模块的信息,但它不起作用。
我得到 modinfo: ERROR: Module hello not found.
我尝试了 运行 depmod
和 depmod -A
但它们没有任何区别。
有什么方法可以使 modinfo
"reload" 以便我可以查看新添加模块的信息吗?
来自手册页:
modinfo extracts information from the Linux Kernel modules given on the command line. If the module name is not a filename, then the /lib/modules/version directory is searched, as is also done by modprobe(8) when loading kernel modules.
所以看起来这个命令只是使用内核模块文件来获取这个信息,所以你可以 运行:
modinfo hello.ko
或者您可以将内核模块放在 /lib/modules/version/
目录中