kdump-utils/0016-mkdumprd-add-support-for-95squash-erofs.patch

89 lines
3.3 KiB
Diff
Raw Normal View History

From eaf2c3678e20b81134a4411d93aa6699867c079f Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Tue, 13 Aug 2024 18:31:25 +0200
Subject: [PATCH 16/16] mkdumprd: add support for 95squash-erofs
With dracut 104 support for erofs in 99squash was added. For that the
squashfs specific code was split from 99squash module into
95squash-squashfs and a new 95squash-erofs was added. The modules are
structured the way, that you can either add 99squash, which then picks
the 'best' back end, or one of the 95squash-{squashfs,erofs} if you want
to make sure which back end is used.
Unfortunately erofs doesn't support the same compression algorithms
squashfs supports. So explicitly set which image type we want so we can
set the correct --squash-compressor option.
Keep support for the old 99squash for the time being so newer versions
of kdump-utils can work with dracut <= 103.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
---
mkdumprd | 29 ++++++++++++++++++++++++++++-
mkfadumprd | 2 +-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 366bcdb..8c1b191 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -54,6 +54,22 @@ trap '
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
+# check whether the given dracut module is installed. If multiple modules are
+# provided return true if any of them is installed.
+has_dracut_module()
+{
+ local -a _args
+ local _e
+
+ [[ $# -ge 1 ]] || return 1
+
+ for _e in "$@"; do
+ _args+=(-e "$_e")
+ done
+
+ grep -x -q "${_args[@]}" <<< "$(dracut --list-modules)"
+}
+
# caller should ensure $1 is valid and mounted in 1st kernel
to_mount()
{
@@ -379,7 +395,18 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- if has_command mksquashfs; then
+ # With dracut 104 the 99squash module got split up into 99squash and
+ # 95squash-squashfs as well as the new 95squash-erofs. Explicitly set
+ # which image type is required otherwise the requested compression
+ # algorithm might not be supported.
+ if has_dracut_module squash-squashfs && has_command mksquashfs; then
+ dracut_args+=(--add squash-squashfs)
+ dracut_args+=(--squash-compressor zstd)
+ elif has_dracut_module squash-erofs && has_command mkfs.erofs; then
+ dracut_args+=(--add squash-erofs)
+ dracut_args+=(--squash-compressor lz4hc)
+ elif has_command mksquashfs; then
+ # only true for dracut <= 103
dracut_args+=(--add squash)
dracut_args+=(--squash-compressor zstd)
fi
diff --git a/mkfadumprd b/mkfadumprd
index 2fd09ad..37dc05d 100755
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -46,7 +46,7 @@ ddebug "rebuild fadump initrd: $FADUMP_INITRD"
# compression ratio and increases the size of the initramfs image.
# Don't compress the capture image as uncompressed image is needed immediately.
# Also, early microcode would not be needed here.
-if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs --omit squash --no-compress --no-early-microcode; then
+if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs --omit squash --omit squash-squashfs --omit squash-erofs --no-compress --no-early-microcode; then
perror_exit "mkfadumprd: failed to build image with dump capture support"
fi
--
2.46.1