feat(autoconfigure): find vmlinuz and initramfs pairs with linux autoconfigure module

This commit is contained in:
2025-10-27 15:41:29 -04:00
parent 99653b5192
commit d6e8fe0245
8 changed files with 317 additions and 39 deletions

View File

@@ -4,9 +4,14 @@ use uefi::fs::FileSystem;
use uefi::proto::device_path::DevicePath;
use uefi::proto::media::fs::SimpleFileSystem;
/// bls: autodetect and configure BLS-enabled systems.
/// bls: autodetect and configure BLS-enabled filesystems.
pub mod bls;
/// linux: autodetect and configure Linux kernels.
/// This autoconfiguration module should not be activated
/// on BLS-enabled filesystems as it may make duplicate entries.
pub mod linux;
/// Generate a [RootConfiguration] based on the environment.
/// Intakes a `config` to use as the basis of the autoconfiguration.
pub fn autoconfigure(config: &mut RootConfiguration) -> Result<()> {
@@ -31,8 +36,14 @@ pub fn autoconfigure(config: &mut RootConfiguration) -> Result<()> {
let mut filesystem = FileSystem::new(filesystem);
// Scan the filesystem for BLS supported configurations.
bls::scan(&mut filesystem, &root, config)
let bls_found = bls::scan(&mut filesystem, &root, config)
.context("unable to scan for bls configurations")?;
// If BLS was not found, scan for Linux configurations.
if !bls_found {
linux::scan(&mut filesystem, &root, config)
.context("unable to scan for linux configurations")?;
}
}
Ok(())