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:
2026-07-08 22:08:15 -05:00
parent 26e2527492
commit bb503eec83
7 changed files with 1355 additions and 2 deletions
+23 -1
View File
@@ -1,7 +1,8 @@
project('vx', 'c',
project('vx', 'c', 'cpp',
version : '0.2.0',
default_options : [
'c_std=c11',
'cpp_std=c++17',
'warning_level=2',
],
)
@@ -19,6 +20,7 @@ all_utils = [
'xargs',
'lspci',
'setpci',
'depmod',
]
requested_utils = get_option('utils')
@@ -45,6 +47,7 @@ enable_find = enabled_utils.contains('find')
enable_xargs = enabled_utils.contains('xargs')
enable_lspci = enabled_utils.contains('lspci')
enable_setpci = enabled_utils.contains('setpci')
enable_depmod = enabled_utils.contains('depmod')
vx_cfg = configuration_data()
vx_cfg.set10('VX_ENABLE_PATCH', enable_patch)
@@ -59,6 +62,7 @@ vx_cfg.set10('VX_ENABLE_FIND', enable_find)
vx_cfg.set10('VX_ENABLE_XARGS', enable_xargs)
vx_cfg.set10('VX_ENABLE_LSPCI', enable_lspci)
vx_cfg.set10('VX_ENABLE_SETPCI', enable_setpci)
vx_cfg.set10('VX_ENABLE_DEPMOD', enable_depmod)
configure_file(output : 'vx-config.h', configuration : vx_cfg)
# --- Portability shim for building BSD userland on Linux ---
@@ -163,6 +167,10 @@ setpci_src = files(
'src/pci/setpci.c',
)
depmod_src = files(
'src/depmod/depmod.cpp',
)
pci_inc = include_directories('src/pci')
gzip_defines = [
@@ -248,6 +256,11 @@ if enable_setpci
vx_sources += setpci_src
endif
if enable_depmod
vx_sources += depmod_src
vx_dependencies += [dependency('zlib'), dependency('libzstd')]
endif
vx = executable('vx',
vx_sources,
include_directories : vx_include_dirs,
@@ -295,6 +308,9 @@ endif
if enable_setpci
install_applets += ['setpci']
endif
if enable_depmod
install_applets += ['depmod']
endif
foreach name : install_applets
meson.add_install_script('sh', '-c',
@@ -348,6 +364,9 @@ endif
if enable_setpci
manpages += ['src/pci/setpci.8']
endif
if enable_depmod
manpages += ['src/depmod/depmod.8']
endif
install_man(manpages)
@@ -409,6 +428,9 @@ endif
if enable_setpci
test_targets += ['test_setpci']
endif
if enable_depmod
test_targets += ['test_depmod']
endif
foreach t : test_targets
test(t, find_program('tests/' + t + '.sh'),