initramfs module #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The initramfs module provides comprehensive initramfs generation capabilities for Linux systems, creating minimal initial RAM filesystems that contain exactly the modules, binaries, and scripts needed for system boot. This module ensures fast startup times and minimal memory footprint by including only essential components.
The module handles the complex process of building initramfs images with specific configurations for different boot scenarios, including systemd integration, network support, and storage drivers. It supports multiple compression formats and can be customized for various deployment targets from embedded systems to cloud servers.
Functionality
Module API
Initramfs Generation
InitramfsBuilder::new() -> Self- Create a new initramfs builder with default configurationcreate_base_initramfs() -> Result<InitramfsBuilder, InitramfsError>- Initialize a base initramfs structureadd_binary(&mut self, binary: &str) -> &mut Self- Add a binary executable to the initramfsadd_binary_with_path(&mut self, binary: &str, dest: &str) -> &mut Self- Add binary to specific pathadd_library(&mut self, library: &str) -> &mut Self- Add a shared libraryresolve_dependencies(&mut self, binary: &str) -> Result<Vec<String>, InitramfsError>- Resolve binary dependenciesadd_module(&mut self, module: &str) -> &mut Self- Add a kernel module to be loaded at bootadd_firmware(&mut self, firmware: &str) -> &mut Self- Add firmware filesadd_script(&mut self, script: InitScript) -> &mut Self- Add an initialization script to run during bootadd_hook(&mut self, hook: InitHook) -> &mut Self- Add boot hook at specific stageFeature Integration
add_systemd_support(&mut self) -> &mut Self- Include systemd services and support filesadd_network_support(&mut self, modules: Vec<String>) -> &mut Self- Add network drivers and configurationadd_storage_support(&mut self, drivers: Vec<String>) -> &mut Self- Add storage drivers and filesystem supportadd_crypto_support(&mut self) -> &mut Self- Add cryptographic modules and toolsadd_udev_rules(&mut self, rules: Vec<UdevRule>) -> &mut Self- Add udev rules for device managementadd_debug_tools(&mut self) -> &mut Self- Add debugging tools for troubleshootingCompression and Building
compress_initramfs(&self, method: CompressionMethod) -> Result<PathBuf, InitramfsError>- Compress the initramfsset_compression_level(&mut self, level: u32) -> &mut Self- Set compression levelbuild(&self) -> Result<PathBuf, InitramfsError>- Build the final initramfs imagebuild_uncompressed(&self) -> Result<PathBuf, InitramfsError>- Build without compressionverify_initramfs(&self, path: &Path) -> Result<VerificationReport, InitramfsError>- Verify initramfs integrityConfiguration Management
InitramfsConfig::new() -> Self- Create initramfs configurationset_kernel_version(&mut self, version: &str) -> &mut Self- Set target kernel versionset_modules_directory(&mut self, path: &Path) -> &mut Self- Set modules directory pathadd_early_module(&mut self, module: &str) -> &mut Self- Add module to load earlyset_timeout(&mut self, timeout: Duration) -> &mut Self- Set boot timeoutenable_debug(&mut self) -> &mut Self- Enable debug outputBoot Integration
generate_boot_config(&self, format: BootFormat) -> Result<String, InitramfsError>- Generate boot configcreate_boot_entry(&self, kernel_path: &Path, initramfs_path: &Path) -> BootEntry- Create boot entrygenerate_cmdline(&self) -> Result<String, InitramfsError>- Generate kernel command lineadd_kernel_param(&mut self, param: &str) -> &mut Self- Add kernel boot parameter