Skip to content

feat(kernel): add kernel module loading helper with static kernel port#97

Merged
imlk0 merged 3 commits intomasterfrom
fix-static-kernel
Apr 1, 2026
Merged

feat(kernel): add kernel module loading helper with static kernel port#97
imlk0 merged 3 commits intomasterfrom
fix-static-kernel

Conversation

@imlk0
Copy link
Copy Markdown
Collaborator

@imlk0 imlk0 commented Mar 31, 2026

Add kernel_module.rs to cryptpilot-core with helper functions for loading kernel modules. The new implementation:

  • Checks /sys/module/ before attempting modprobe to support statically linked kernels (built-in modules)
  • Converts hyphens to underscores for module name compatibility
  • Provides ensure_module_loaded() for async module loading with params

Update all modprobe calls across the codebase to use the new helper:

  • cryptpilot-fde: dm_mod, dm-linear, dm-verity, dm-snapshot, dm-zero, overlay, zram modules
  • cryptpilot-core: nbd, loop modules
  • luks2: dm_crypt, dm-integrity modules

Add documentation for statically linked kernel configuration in boot.md and boot_zh.md, listing required kernel config options.

imlk0 added 3 commits April 1, 2026 14:33
…port

Add kernel_module.rs to cryptpilot-core with helper functions for loading
kernel modules. The new implementation:

- Checks /sys/module/<name> before attempting modprobe to support
  statically linked kernels (built-in modules)
- Converts hyphens to underscores for module name compatibility
- Provides ensure_module_loaded() for async module loading with params

Update all modprobe calls across the codebase to use the new helper:
- cryptpilot-fde: dm_mod, dm-linear, dm-verity, dm-snapshot, dm-zero,
  overlay, zram modules
- cryptpilot-core: nbd, loop modules
- luks2: dm_crypt, dm-integrity modules

Add documentation for statically linked kernel configuration in
boot.md and boot_zh.md, listing required kernel config options.
Change ensure_module_loaded() from returning Result<()> to () to make
module loading failures non-fatal. This improves compatibility with
containerized environments where modprobe may not be available.

Key changes:
- Check for modprobe binary existence before attempting to load
- Convert all errors to warnings using tracing::warn!()
- Remove anyhow dependency from kernel_module.rs
- Update all call sites to remove ? error handling
- Add dm_crypt and dm_integrity to static kernel config docs

This allows CryptPilot to continue execution even when:
- modprobe is not installed (containers, minimal systems)
- Module loading fails (module may be built-in)
- Kernel modules are statically linked
Correct the UKI parameter from --uki-mode to --uki in both English and
Chinese quick-start documentation. The actual command-line option is
--uki, not --uki-mode.
@imlk0 imlk0 force-pushed the fix-static-kernel branch from 0817c07 to 3a4c902 Compare April 1, 2026 06:34
@imlk0 imlk0 merged commit 3a4c902 into master Apr 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant