Implement minimal depmod-compatible applet for vx
- Added depmod.cpp to scan kernel module ELF files, read .modinfo, and emit metadata files. - Implemented functionality to write binary trie indexes for libkmod/modprobe. - Introduced command-line options for module processing. - Created test script test_depmod.sh to verify help and version commands.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
.Dd July 8, 2026
|
||||
.Dt DEPMOD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm depmod
|
||||
.Nd generate Linux kernel module dependency metadata
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl aAenvwVh
|
||||
.Op Fl b Ar basedir
|
||||
.Op Fl m Ar moduledir
|
||||
.Op Fl o Ar outdir
|
||||
.Op Fl C Ar config
|
||||
.Op Fl E Ar Module.symvers
|
||||
.Op Fl F Ar System.map
|
||||
.Op Fl P Ar prefix
|
||||
.Op Ar version
|
||||
.Op Ar module ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
applet scans Linux kernel modules below
|
||||
.Pa /lib/modules/<version>
|
||||
and writes the usual module metadata files, including
|
||||
.Pa modules.dep ,
|
||||
.Pa modules.alias ,
|
||||
.Pa modules.symbols ,
|
||||
and the matching kmod binary index files.
|
||||
.Pp
|
||||
This implementation is intentionally small and does not use libkmod. It reads
|
||||
uncompressed modules plus gzip and zstd compressed modules.
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width Ds
|
||||
.It Fl a , Fl -all
|
||||
Scan all modules. This is the default when no module files are named.
|
||||
.It Fl A , Fl -quick
|
||||
Exit without regenerating output when
|
||||
.Pa modules.dep
|
||||
is newer than the scanned modules.
|
||||
.It Fl b Ar basedir , Fl -basedir Ns = Ns Ar basedir
|
||||
Use
|
||||
.Ar basedir
|
||||
as the input root.
|
||||
.It Fl m Ar moduledir , Fl -moduledir Ns = Ns Ar moduledir
|
||||
Use a module directory other than
|
||||
.Pa /lib/modules .
|
||||
.It Fl o Ar outdir , Fl -outdir Ns = Ns Ar outdir
|
||||
Use
|
||||
.Ar outdir
|
||||
as the output root.
|
||||
.It Fl n , Fl -show , Fl -dry-run
|
||||
Print text output to standard output instead of writing files.
|
||||
.It Fl e , Fl -errsyms
|
||||
Warn about unresolved module dependencies and symbols.
|
||||
.It Fl P Ar prefix , Fl -symbol-prefix Ns = Ns Ar prefix
|
||||
Ignore an architecture symbol prefix while matching symbols.
|
||||
.It Fl V , Fl -version
|
||||
Print version information.
|
||||
.It Fl h , Fl -help
|
||||
Print usage information.
|
||||
.El
|
||||
.Sh COMPATIBILITY
|
||||
The options
|
||||
.Fl C ,
|
||||
.Fl E ,
|
||||
and
|
||||
.Fl F
|
||||
are accepted for command-line compatibility, but this implementation does not
|
||||
parse depmod.d configuration, Module.symvers, or System.map content.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,9 @@ int lspci_main(int argc, char *argv[]);
|
||||
#if VX_ENABLE_SETPCI
|
||||
int setpci_main(int argc, char *argv[]);
|
||||
#endif
|
||||
#if VX_ENABLE_DEPMOD
|
||||
int depmod_main(int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
struct applet {
|
||||
const char *name;
|
||||
@@ -91,6 +94,9 @@ static const struct applet applets[] = {
|
||||
#if VX_ENABLE_SETPCI
|
||||
{ "setpci", setpci_main },
|
||||
#endif
|
||||
#if VX_ENABLE_DEPMOD
|
||||
{ "depmod", depmod_main },
|
||||
#endif
|
||||
};
|
||||
|
||||
static const size_t n_applets = sizeof(applets) / sizeof(applets[0]);
|
||||
|
||||
Reference in New Issue
Block a user