8a476dabf0
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 <kasong@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
76 lines
1.7 KiB
Bash
Executable File
76 lines
1.7 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
KEXEC=/sbin/kexec
|
|
standard_kexec_args="-p"
|
|
|
|
EARLY_KDUMP_INITRD=""
|
|
EARLY_KDUMP_KERNEL=""
|
|
EARLY_KDUMP_CMDLINE=""
|
|
EARLY_KDUMP_KERNELVER=""
|
|
EARLY_KEXEC_ARGS=""
|
|
|
|
. /etc/sysconfig/kdump
|
|
. /lib/dracut-lib.sh
|
|
. /lib/kdump-lib.sh
|
|
|
|
prepare_parameters()
|
|
{
|
|
EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
|
KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}")
|
|
|
|
EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}"
|
|
EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-earlykdump.img"
|
|
}
|
|
|
|
early_kdump_load()
|
|
{
|
|
check_kdump_feasibility
|
|
if [ $? -ne 0 ]; then
|
|
return 1
|
|
fi
|
|
|
|
if is_fadump_capable; then
|
|
echo "WARNING: early kdump doesn't support fadump."
|
|
return 1
|
|
fi
|
|
|
|
check_current_kdump_status
|
|
if [ $? == 0 ]; then
|
|
return 1
|
|
fi
|
|
|
|
prepare_parameters
|
|
|
|
EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
|
|
|
if is_secure_boot_enforced; then
|
|
echo "Secure Boot is enabled. Using kexec file based syscall."
|
|
EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s"
|
|
fi
|
|
|
|
$KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
|
|
--command-line="$EARLY_KDUMP_CMDLINE" \
|
|
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL
|
|
if [ $? == 0 ]; then
|
|
echo "kexec: loaded early-kdump kernel"
|
|
return 0
|
|
else
|
|
echo "kexec: failed to load early-kdump kernel"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
set_early_kdump()
|
|
{
|
|
if getargbool 0 rd.earlykdump; then
|
|
echo "early-kdump is enabled."
|
|
early_kdump_load
|
|
else
|
|
echo "early-kdump is disabled."
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
set_early_kdump
|