kdump-utils/0016-mkdumprd-add-support-for-95squash-erofs.patch
Philipp Rudo d38412baaf Enable erofs support for the kdump initrd
Resolves: RHEL-50942
Upstream: https://github.com/rhkdump/kdump-utils.git
Conflict: Dropped hunks concerning OVS bridge support in patch 3 and 5
	   due to missing 224d310 ("Support setting up Open vSwitch
	   (Ovs) Bridge network")

Also contains upstream commit

commit 2970176d9e9b7b6a1191a9ee54423d2f1c56fbaf
Author: Philipp Rudo <prudo@redhat.com>
Date:   Tue Sep 24 10:39:32 2024 +0200

    spec: fix patching of files in subdirectories

    With 23df04b ("dracut: create sub-directories for dracut modules") the
    dracut modules were moved to subdirectories. This causes problems when
    someone wants to include a patch to the spec file to change one of the
    files in those subdirectories. Reason is that '%autosetup' in the spec
    file calls 'patch' per default. 'patch' however, will strip all
    directories when it is called without option -p. Which means that it
    will search the file in the root directory and then fail because it
    cannot find it. Thus add option -p1 to '%autosetup' which will be passed
    on to 'patch'. Choose -p1 as that will work with the most common patch
    creation tools like git and packit.

    Signed-off-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2024-09-27 15:48:12 +02:00

89 lines
3.3 KiB
Diff

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