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>
50 lines
1.2 KiB
Bash
Executable File
50 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
. /etc/sysconfig/kdump
|
|
. /lib/kdump/kdump-lib.sh
|
|
|
|
KDUMP_KERNEL=""
|
|
KDUMP_INITRD=""
|
|
|
|
check() {
|
|
if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\
|
|
|| [ -n "${IN_KDUMP}" ]
|
|
then
|
|
return 1
|
|
fi
|
|
return 255
|
|
}
|
|
|
|
depends() {
|
|
echo "base shutdown"
|
|
return 0
|
|
}
|
|
|
|
prepare_kernel_initrd() {
|
|
KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}")
|
|
if [ -z "$KDUMP_KERNELVER" ]; then
|
|
kdump_kver=`uname -r`
|
|
else
|
|
kdump_kver=$KDUMP_KERNELVER
|
|
fi
|
|
KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}"
|
|
KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img"
|
|
}
|
|
|
|
install() {
|
|
inst_multiple tail find cut dirname hexdump
|
|
inst_simple "/etc/sysconfig/kdump"
|
|
inst_binary "/usr/sbin/kexec"
|
|
inst_binary "/usr/bin/gawk" "/usr/bin/awk"
|
|
inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
|
inst_hook cmdline 00 "$moddir/early-kdump.sh"
|
|
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"
|
|
}
|