Skip to content

Commit

Permalink
convert: linux: Add support for Zstandard compressed kernel modules
Browse files Browse the repository at this point in the history
OpenSUSE uses *.ko.zst for kernel modules.  This commit adds support
in the same way as the existing support for *.ko.xz.  Note this
requires a corresponding change to libguestfs to support Zstandard
compression in the guestfs_file_architecture API:

libguestfs/libguestfs@0e78482

Reported-by: Xiaodai Wang
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2116811
  • Loading branch information
rwmjones committed Aug 9, 2022
1 parent 8e4b732 commit 315c016
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions convert/linux_kernels.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ let print_kernel_info chan prefix ki =
ki.ki_supports_isa_pvpanic ki.ki_supports_virtio_socket
ki.ki_is_xen_pv_only_kernel ki.ki_is_debug

let rex_ko = PCRE.compile "\\.k?o(?:\\.xz)?$"
let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.xz)?$"
let rex_ko = PCRE.compile "\\.k?o(?:\\.(?:xz|zst))?$"
let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.(?:xz|zst))?$"

let detect_kernels (g : G.guestfs) inspect family bootloader =
(* What kernel/kernel-like packages are installed on the current guest? *)
Expand Down Expand Up @@ -203,7 +203,11 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
let all_candidates = List.flatten (
List.map (
fun f ->
[ "/" ^ f ^ ".o"; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ]
[ "/" ^ f ^ ".o";
"/" ^ f ^ ".ko";
"/" ^ f ^ ".ko.xz";
"/" ^ f ^ ".ko.zst";
]
) candidates
) in
let candidate =
Expand Down

0 comments on commit 315c016

Please sign in to comment.