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

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

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

depmod命令介绍

功能

  • 生成依赖列表:depmod会分析指定目录下的内核模块(通常在/lib/modules/<kernel-version>),并生成一个名为modules.dep的依赖文件,记录每个模块所需的其他模块。
  • 创建符号列表:它还会生成一个文件modules.symbols,列出模块提供的符号。
  • 映射硬件标识符:生成的映射文件用于将硬件标识符与处理它们的模块关联起来。

语法

bash
depmod [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:~#

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lisanmengmeng

蚊子腿也是肉

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值