From 8a476dabf055d6d3390b6e6ec42330ae4fb6b20f Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Thu, 10 Jan 2019 18:07:41 +0800 Subject: [PATCH] earlykdump: generate symlink with stable name to kernel image and iniramfs There is currently a problem with earlykdump image building, when a user is upgrading kernel, dracut will generate new initramfs for the new kernel, and earlykdump will install currently running version of kernel into the initramfs, and remain the version based kernel image naming untouched. But after a reboot the new kernel is running, and it will try to load the image corresponding to the new kernel version by file naming. This patch fixes the problem by creating a symlink with unified stable naming to the installed kernel image and initramfs, and use the symlink instand so it will always work despite the kernel version number change. Signed-off-by: Kairui Song Acked-by: Dave Young --- dracut-early-kdump-module-setup.sh | 4 ++++ dracut-early-kdump.sh | 13 ++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dracut-early-kdump-module-setup.sh b/dracut-early-kdump-module-setup.sh index a004a49..44edc06 100755 --- a/dracut-early-kdump-module-setup.sh +++ b/dracut-early-kdump-module-setup.sh @@ -41,5 +41,9 @@ install() { prepare_kernel_initrd inst_binary "$KDUMP_KERNEL" inst_binary "$KDUMP_INITRD" + + ln_r "$KDUMP_KERNEL" "${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + ln_r "$KDUMP_INITRD" "${KDUMP_BOOTDIR}/initramfs-earlykdump.img" + chmod -x "${initdir}/$KDUMP_KERNEL" } diff --git a/dracut-early-kdump.sh b/dracut-early-kdump.sh index 34a9909..69a34eb 100755 --- a/dracut-early-kdump.sh +++ b/dracut-early-kdump.sh @@ -18,17 +18,8 @@ prepare_parameters() EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") - #make early-kdump kernel string - if [ -z "$KDUMP_KERNELVER" ]; then - EARLY_KDUMP_KERNELVER=`uname -r` - else - EARLY_KDUMP_KERNELVER=$KDUMP_KERNELVER - fi - - EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${EARLY_KDUMP_KERNELVER}${KDUMP_IMG_EXT}" - - #make early-kdump initrd string - EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${EARLY_KDUMP_KERNELVER}kdump.img" + EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-earlykdump.img" } early_kdump_load()