fix(autoconfigure): match arm64 Image kernels

File names are lowercased before matching kernel prefixes, but the
arm64 prefix was "Image", so it could never match and arm64 kernels
were not autoconfigured. Use a lowercase "image" prefix.
This commit is contained in:
alex authored and Alex Zenla committed 2026-09-26 18:58:54 -07:00
1 parent 724180618b
commit 1f5bc07c22
1 file changed
+15 -1
+15 -1
View File
@@ -123,7 +123,8 @@ pub fn build_xen_config(xen_options: &str, kernel_options: &str) -> String {
} }
/// Filename prefixes used to identify Linux kernel images. /// Filename prefixes used to identify Linux kernel images.
pub const LINUX_KERNEL_PREFIXES: &[&str] = &["vmlinuz", "Image"]; /// These must be lowercase, as file names are lowercased before matching.
pub const LINUX_KERNEL_PREFIXES: &[&str] = &["vmlinuz", "image"];
/// Filename prefixes used to identify initramfs images paired with a kernel. /// Filename prefixes used to identify initramfs images paired with a kernel.
pub const LINUX_INITRAMFS_PREFIXES: &[&str] = &["initramfs", "initrd", "initrd.img"]; pub const LINUX_INITRAMFS_PREFIXES: &[&str] = &["initramfs", "initrd", "initrd.img"];
@@ -363,6 +364,19 @@ mod tests {
); );
} }
#[test]
fn kernel_prefix_matches_lowercased_arm64_image() {
// Callers lowercase file names before matching, so "Image-6.1" arrives as "image-6.1".
assert_eq!(
match_kernel_prefix("image-6.1", LINUX_KERNEL_PREFIXES),
Some("image")
);
assert_eq!(
match_kernel_prefix("image", LINUX_KERNEL_PREFIXES),
Some("image")
);
}
#[test] #[test]
fn kernel_prefix_case_sensitive_no_match() { fn kernel_prefix_case_sensitive_no_match() {
// match_kernel_prefix expects the caller to lowercase first; uppercase input won't match. // match_kernel_prefix expects the caller to lowercase first; uppercase input won't match.