← 返回命令列表

Linux command

depmod 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate module dependencies

depmod

Generate for a specific kernel version

depmod [6.8.0-generic]

Probe all modules

depmod -a

Quick mode

depmod -A

Preview without writing

depmod -n

Use a staging module tree root

depmod -b [/path/to/root] [6.8.0-generic]

Report unresolved symbols

depmod -e -F [/boot/System.map-6.8.0] [6.8.0-generic]

说明

depmod generates module dependency files (modules.dep and related files) used by modprobe to load kernel modules and their dependencies automatically. It analyzes all modules in the kernel module directory and determines their interdependencies. The tool scans module files for exported and required symbols, building a dependency tree. This information allows modprobe to load prerequisite modules automatically when a module is requested. depmod is typically run automatically during kernel installation or module updates. The generated files are stored in /lib/modules/<kernel_version>/.

参数

-a, --all
Probe all modules. Enabled by default when no filenames are given.
-A, --quick
Exit silently unless a module is newer than modules.dep.
-b, --basedir _DIR_
Prepend _DIR_ to /lib/modules/<version>; useful for staging roots.
-o, --outdir _DIR_
Write generated files to _DIR_ instead of the module tree.
-e, --errsyms
Report symbols a module requires that are not provided by other modules or the kernel.
-F, --filesyms _System.map_
Use _System.map_ to resolve kernel-provided symbols when using -e.
-E, --symvers _Module.symvers_
With -e, also report symbol version (modversion) mismatches.
-n, --show, --dry-run
Print resulting modules.dep and map files to stdout instead of writing them.
-v, --verbose
Print each symbol dependency and providing module.
-w
Warn about duplicate dependencies, aliases, or symbol versions.
-C, --config _FILE_
Override the default configuration file or directory.
-V, --version
Show version and exit.
-h, --help
Display help information.

FAQ

What is the depmod command used for?

depmod generates module dependency files (modules.dep and related files) used by modprobe to load kernel modules and their dependencies automatically. It analyzes all modules in the kernel module directory and determines their interdependencies. The tool scans module files for exported and required symbols, building a dependency tree. This information allows modprobe to load prerequisite modules automatically when a module is requested. depmod is typically run automatically during kernel installation or module updates. The generated files are stored in /lib/modules/<kernel_version>/.

How do I run a basic depmod example?

Run `depmod` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in depmod?

Probe all modules. Enabled by default when no filenames are given.