kdump-utils/0018-kdumpctl-add-comments-to-different-initrd-variables.patch
Coiby Xu d2f21f374d spec: drop dependency for binutils
Resolves: https://issues.redhat.com/browse/RHEL-138697
Conflict: None

commit 48dd252bf8cc75c696d5d7e9a07efc838e3aad66
Author: Philipp Rudo <prudo@redhat.com>
Date:   Tue Sep 2 13:28:32 2025 +0200

    spec: drop dependency for binutils

    The binutils were added as dependency to support UKIs. With the main
    part of the UKI support been moved to kexec-tools only one spot remains
    in prepare_kdump_bootinfo where they are used. Refractor
    prepare_kdump_bootinfo to get rid of the dependency.

    This slightly changes the behavior for UKIs. In particular the kdump
    initrd is moved from /boot to /var/lib/kdump.

    While at it also simplify the logic in prepare_kdump_bootinfo as it is
    unnecessarily complex and can lead to weird corner cases. For example if
    the default initrd is located at /boot/$machine_id/$kernel_version/initrd
    and the directory is not writable, then the kdump initrd would be stored
    at /var/lib/kdump/initrdkdump without any information about the kernel
    version. This can lead to all sorts of problems when multiple kernel
    versions are installed. Thus always use
    initramfs-${kernel_version}kdump.img when the initrd is stored at
    /var/lib/kdump. Update 60-kdump.install accordingly.

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

Signed-off-by: Coiby Xu <coxu@redhat.com>
2026-01-21 13:31:54 +08:00

94 lines
3.1 KiB
Diff

From db47f86cf273a539d803bacc22a9fc825ef5af93 Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Tue, 19 Aug 2025 12:44:30 +0200
Subject: [PATCH] kdumpctl: add comments to different initrd variables
kdumpctl has multiple variables for different initrds it is using. From
the variable names it is not always clear what the difference of those
initrds are. Thus add some comments to describe the differences and what
the initrds are used for.
While at it rename INITRD_CHECKSUM_LOCATION to DEFAULT_INITRD_CHECKSUM
so it aligns better with the naming convention.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
kdumpctl | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 2d2c81a..dd69318 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -7,11 +7,23 @@ KEXEC_ARGS=""
MKDUMPRD="/sbin/mkdumprd -f"
MKFADUMPRD="/sbin/mkfadumprd"
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
+
+# Path to the initrd used for normal boot. Used to determine the naming
+# convention and in case for fadump (and earlykdump) gets rebuild.
DEFAULT_INITRD=""
+
+# Path to backup and checksum of the default initrd. Used to backup/restore the
+# default initrd for fadump.
DEFAULT_INITRD_BAK=""
-INITRD_CHECKSUM_LOCATION=""
+DEFAULT_INITRD_CHECKSUM=""
+
+# Path to the initrd used for kdump
KDUMP_INITRD=""
+
+# Path to the initrd depending on the dump mode. Identical to KDUMP_INITRD for
+# kdump and DEFAULT_INITRD for fadump
TARGET_INITRD=""
+
#kdump shall be the default dump mode
DEFAULT_DUMP_MODE="kdump"
VMCORE_CREATION_STATUS="/var/lib/kdump/vmcore-creation.status"
@@ -258,7 +270,7 @@ backup_default_initrd()
rm -f -- "$DEFAULT_INITRD_BAK"
return
fi
- sha512sum "$DEFAULT_INITRD_BAK" > "$INITRD_CHECKSUM_LOCATION"
+ sha512sum "$DEFAULT_INITRD_BAK" > "$DEFAULT_INITRD_CHECKSUM"
}
restore_default_initrd()
@@ -275,19 +287,19 @@ restore_default_initrd()
return
fi
- if [[ ! -f $INITRD_CHECKSUM_LOCATION ]]; then
- ddebug "\$INITRD_CHECKSUM_LOCATION=$INITRD_CHECKSUM_LOCATION does not exist"
+ if [[ ! -f $DEFAULT_INITRD_CHECKSUM ]]; then
+ ddebug "\$DEFAULT_INITRD_CHECKSUM=$DEFAULT_INITRD_CHECKSUM does not exist"
return
fi
# If a backup initrd exists, we must be switching back from
# fadump to kdump. Restore the original default initrd.
- if ! sha512sum --status --check "$INITRD_CHECKSUM_LOCATION"; then
+ if ! sha512sum --status --check "$DEFAULT_INITRD_CHECKSUM"; then
dwarn "WARNING: checksum mismatch! Can't restore original initrd."
return
fi
- rm -f "$INITRD_CHECKSUM_LOCATION"
+ rm -f "$DEFAULT_INITRD_CHECKSUM"
if mv "$DEFAULT_INITRD_BAK" "$DEFAULT_INITRD"; then
derror "Restoring original initrd as fadump mode is disabled."
sync -f "$DEFAULT_INITRD"
@@ -421,7 +433,7 @@ setup_initrd()
fi
DEFAULT_INITRD_BAK="$KDUMP_BOOTDIR/.$(basename "$DEFAULT_INITRD").default"
- INITRD_CHECKSUM_LOCATION="$DEFAULT_INITRD_BAK.checksum"
+ DEFAULT_INITRD_CHECKSUM="$DEFAULT_INITRD_BAK.checksum"
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
TARGET_INITRD="$DEFAULT_INITRD"
--
2.52.0