linux操作系统下的depmod命令介绍和使用案例

韵味老鸟 2024-09-19 14:41:22

linux 操作系统下的 depmod 命令介绍和使用案例

depmod命令在Linux操作系统中用于生成内核模块的依赖关系和相关的映射文件。它分析内核模块并创建一个依赖列表,以确保在使用modprobe加载和卸载模块时,所有必需的模块都能得到正确处理。

depmod命令介绍功能生成依赖列表:depmod会分析指定目录下的内核模块(通常在/lib/modules/<kernel-version>),并生成一个名为modules.dep的依赖文件,记录每个模块所需的其他模块。创建符号列表:它还会生成一个文件modules.symbols,列出模块提供的符号。映射硬件标识符:生成的映射文件用于将硬件标识符与处理它们的模块关联起来。语法bashdepmod [OPTIONS] [version]常用选项-a:分析所有模块(默认行为,如果没有指定文件名)。-b basedir:指定模块的基本目录。-e:报告未解析的符号。-F System.map:使用指定的System.map文件来报告未解析的符号。-n:干运行,输出将要生成的文件而不实际写入。-v:详细模式,输出每个模块的处理信息。-V:显示版本信息并退出。

命令选项:

root@meng:~# which depmod

/usr/sbin/depmod

root@meng:~# depmod --help

Usage:

depmod -[aA] [options] [forced_version]

If no arguments (except options) are given, "depmod -a" is assumed

depmod will output a dependency list suitable for the modprobe utility.

Options:

-a, --all Probe all modules

-A, --quick Only does the work if there's a new module

-e, --errsyms Report not supplied symbols

-n, --show Write the dependency file on stdout only

-P, --symbol-prefix Architecture symbol prefix

-C, --config=PATH Read configuration from PATH

-v, --verbose Enable verbose mode

-w, --warn Warn on duplicates

-V, --version show version

-h, --help show this help

The following options are useful for people managing distributions:

-b, --basedir=DIR Use an image of a module tree.

-F, --filesyms=FILE Use the file instead of the

current kernel symbols.

-E, --symvers=FILE Use Module.symvers file to check

symbol versions.

root@meng:~# depmod

^Z

[1]+ Stopped depmod

root@meng:~#

命令案例:

ls -al /lib/modules/5.15.0-72-generic

root@meng:~# depmod -n -a |more

0 阅读:16

韵味老鸟

简介:感谢大家的关注