feat: Add DKMS support for Depot-managed kernel modules

- Introduced a new `dkms` module in the installation helpers.
- Updated `BuildType` enum to include `Dkms`.
- Enhanced `PackageSpec` to validate DKMS-specific fields and added methods to retrieve effective DKMS names, versions, and install directories.
- Implemented DKMS build and installation logic in a new `dkms.rs` file, including staging source trees and lifecycle scripts.
- Added runtime support for managing installed DKMS modules, including autoinstall and removal functionalities.
- Created tests to validate DKMS parsing and module management.
This commit is contained in:
2026-07-08 02:23:19 -05:00
parent 86905c59d3
commit 98eb1fe246
14 changed files with 1293 additions and 2 deletions
+16
View File
@@ -4,6 +4,7 @@ mod autotools;
mod bin;
mod cmake;
mod custom;
mod dkms;
mod makefile;
mod meson;
mod perl;
@@ -489,6 +490,13 @@ pub(crate) fn requested_development_package() -> Option<String> {
crate::build_options::requested_development_package()
}
pub(crate) fn stage_generated_lifecycle_scripts(spec: &PackageSpec, destdir: &Path) -> Result<()> {
match spec.build.build_type {
BuildType::Dkms => dkms::stage_lifecycle_scripts(spec, destdir),
_ => Ok(()),
}
}
fn configured_install_dir(value: &str, default: &str) -> String {
let trimmed = value.trim();
if trimmed.is_empty() {
@@ -1100,6 +1108,14 @@ pub fn build(
export_compiler_flags,
host_build_dir,
),
BuildType::Dkms => dkms::build(
spec,
src_dir,
destdir,
cross,
export_compiler_flags,
host_build_dir,
),
BuildType::Bin => bin::build(
spec,
src_dir,