From 8e51ebe6fb6faa32775de5eb6e20932a192c814c Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Fri, 25 Jun 2021 14:44:45 +0800 Subject: [PATCH] fadump: kdumpctl should check the modules used by the fadump initramfs Resolves: bz1924115 Conflict: None Upstream: Fedora commit bf6671b60de3e1a33cda0a814b1729090f12f349 Author: Kairui Song Date: Fri Jun 25 14:44:45 2021 +0800 fadump: kdumpctl should check the modules used by the fadump initramfs After fadump embedded the fadump initramfs in the normal initramfs, kdumpctl will mistakenly rebuild the initramfs everytime. kdumpctl checks the hostonly-kernel-modules.txt file in initramfs to check if required drivers are included, but the normal initramfs is built in non-hostonly mode, so it doesn't have a hostonly-kernel-modules.txt file. The check will always fail. So let mkfadumprd make a copy of the hostonly-kernel-modules.txt in the fadump initramfs and let kdumpctl check that file instead. Signed-off-by: Kairui Song Acked-by: Hari Bathini Signed-off-by: Kairui Song --- kdumpctl | 8 ++++++-- mkfadumprd | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/kdumpctl b/kdumpctl index 1e908b6..be8ae2a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -443,9 +443,13 @@ check_drivers_modified() # Include watchdog drivers if watchdog module is not omitted is_dracut_mod_omitted watchdog || _new_drivers+=" $(get_watchdog_drvs)" - [ -z "$_new_drivers" ] && return 0 - _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')" + + if is_fadump_capable; then + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/fadump-kernel-modules.txt | tr '\n' ' ')" + else + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')" + fi ddebug "Modules required for kdump: '$_new_drivers'" ddebug "Modules included in old initramfs: '$_old_drivers'" diff --git a/mkfadumprd b/mkfadumprd index 4af4ae6..aecf2a8 100644 --- a/mkfadumprd +++ b/mkfadumprd @@ -44,14 +44,18 @@ fi ### Unpack the initramfs having dump capture capability mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot" -if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$MKFADUMPRD_TMPDIR/fadump.img" && \ +if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" && \ popd > /dev/null); then derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'" exit 1 fi ### Pack it into the normal boot initramfs with zz-fadumpinit module -_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit -i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot" +_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit \ + -i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot \ + -i $MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/hostonly-kernel-modules.txt + /usr/lib/dracut/fadump-kernel-modules.txt" + if is_squash_available; then _dracut_isolate_args="$_dracut_isolate_args --add squash" fi