From 975dddcf8e54ca8bc5b646ebef97bdc13db90f36fc02eb5583a648da55f6601c Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Tue, 4 Jan 2022 12:20:20 +0000 Subject: [PATCH] Accepting request 941875 from home:benoit_monin:branches:Virtualization Add initrd_support_ztd-compressed_modules.patch: backport of 4306a131c6cd to add support of zstd compressed kernel modules. OBS-URL: https://build.opensuse.org/request/show/941875 OBS-URL: https://build.opensuse.org/package/show/Virtualization/supermin?expand=0&rev=69 --- initrd_support_ztd-compressed_modules.patch | 83 +++++++++++++++++++++ supermin.changes | 7 ++ supermin.spec | 3 + 3 files changed, 93 insertions(+) create mode 100644 initrd_support_ztd-compressed_modules.patch diff --git a/initrd_support_ztd-compressed_modules.patch b/initrd_support_ztd-compressed_modules.patch new file mode 100644 index 0000000..e956d26 --- /dev/null +++ b/initrd_support_ztd-compressed_modules.patch @@ -0,0 +1,83 @@ +From 4306a131c6cde92f8d0a2dd9376f4096ee538eff Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 5 Aug 2021 08:16:28 +0100 +Subject: [PATCH] initrd: Support ztd-compressed modules + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1990209 +--- + README | 2 ++ + configure.ac | 3 +++ + src/config.ml.in | 1 + + src/format_ext2_initrd.ml | 16 ++++++++++++++-- + 4 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/README b/README +index e5187a6..ccd6f96 100644 +--- a/README ++++ b/README +@@ -102,6 +102,8 @@ are building: + + xzcat (command) - if your kernel uses xz-compressed modules + ++ zstdcat (command) - if your kernel uses zstd-compressed modules ++ + Building and installing + ----------------------- + +diff --git a/configure.ac b/configure.ac +index cd5d8c0..ad86ca5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -157,6 +157,9 @@ AC_PATH_PROG(ZCAT,[zcat],[no]) + dnl Check for xzcat, only needed if you have xz-compressed kernel modules. + AC_PATH_PROG(XZCAT,[xzcat],[no]) + ++dnl Check for zstdcat, only needed if you have zstd-compressed kernel modules. ++AC_PATH_PROG(ZSTDCAT,[zstdcat],[no]) ++ + dnl mke2fs. + AC_PATH_PROG([MKE2FS],[mke2fs],[no], + [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR]) +diff --git a/src/config.ml.in b/src/config.ml.in +index 313d6e6..b0953dc 100644 +--- a/src/config.ml.in ++++ b/src/config.ml.in +@@ -39,6 +39,7 @@ let urpmi = "@URPMI@" + let yumdownloader = "@YUMDOWNLOADER@" + let xzcat = "@XZCAT@" + let zcat = "@ZCAT@" ++let zstdcat = "@ZSTDCAT@" + let zypper = "@ZYPPER@" + + let mke2fs = "@MKE2FS@" +diff --git a/src/format_ext2_initrd.ml b/src/format_ext2_initrd.ml +index 6268442..98d2692 100644 +--- a/src/format_ext2_initrd.ml ++++ b/src/format_ext2_initrd.ml +@@ -106,12 +106,24 @@ let rec build_initrd debug tmpdir modpath initrd = + visit deps; + + (* Copy module to the init directory. +- * Uncompress the module, if the name ends in .xz or .gz. ++ * Uncompress the module, if the name ends in .zst, .xz or .gz. + *) + let basename = Filename.basename modl in + let basename = + let len = String.length basename in +- if Config.xzcat <> "no" && ++ if Config.zstdcat <> "no" && ++ Filename.check_suffix basename ".zst" ++ then ( ++ let basename = String.sub basename 0 (len-4) in ++ let cmd = sprintf "%s %s > %s" ++ (quote Config.zstdcat) ++ (quote (modpath // modl)) ++ (quote (initdir // basename)) in ++ if debug >= 2 then printf "supermin: %s\n" cmd; ++ run_command cmd; ++ basename ++ ) ++ else if Config.xzcat <> "no" && + Filename.check_suffix basename ".xz" + then ( + let basename = String.sub basename 0 (len-3) in diff --git a/supermin.changes b/supermin.changes index 4d459f2..cf2dfb6 100644 --- a/supermin.changes +++ b/supermin.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Dec 21 15:33:22 UTC 2021 - BenoƮt Monin + +- Add initrd_support_ztd-compressed_modules.patch: + backport of 4306a131c6cd to add support of zstd compressed kernel + modules. + ------------------------------------------------------------------- Sun Sep 12 10:20:30 UTC 2021 - ohering@suse.de diff --git a/supermin.spec b/supermin.spec index e79b6da..95eecfe 100644 --- a/supermin.spec +++ b/supermin.spec @@ -31,6 +31,8 @@ Patch0: Avoid-lstat-Value-too-large-for-defined-data-type.patch Patch10: suse_release.patch Patch11: supermin-kernel_version_compressed.patch Patch12: disable-test-if-newer-ext2.patch +# Backport of https://github.com/libguestfs/supermin/commit/4306a131c6cde92f8d0a2dd9376f4096ee538eff.patch +Patch13: initrd_support_ztd-compressed_modules.patch BuildRequires: augeas BuildRequires: autoconf BuildRequires: automake @@ -48,6 +50,7 @@ BuildRequires: pkgconfig BuildRequires: xz BuildRequires: xz-devel BuildRequires: zlib-devel +BuildRequires: zstd BuildRequires: zypper BuildRequires: pkgconfig(com_err) BuildRequires: pkgconfig(ext2fs)