mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 18:42:21 +00:00
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:
1 parent
724180618b
commit
1f5bc07c22
1 file changed
+15
-1
@@ -123,7 +123,8 @@ pub fn build_xen_config(xen_options: &str, kernel_options: &str) -> String {
|
||||
}
|
||||
|
||||
/// 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.
|
||||
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]
|
||||
fn kernel_prefix_case_sensitive_no_match() {
|
||||
// match_kernel_prefix expects the caller to lowercase first; uppercase input won't match.
|
||||
|
||||
Reference in new issue
Block a user