Good suggestion, I don't have a particular preference so let keep the
code untouched if there are no further comments.
On Wed, Jan 9, 2019 at 10:50 PM lijiang <lijiang(a)redhat.com> wrote:
在 2019年01月09日 22:11, Kairui Song 写道:
> Sorry I sent with the wrong subject, it should be [PATCH] earlykdump:
> Use unified static naming for installed kernel image and initramfs
>
Thanks for your patch. But i tend to let users set the 'KDUMP_KERNELVER'
in the '/etc/sysconfig/kdump' for this case.
This is also a purpose that sources '/etc/sysconfig/kdump' in early-kdump
modules.
> On Wed, Jan 9, 2019 at 10:05 PM Kairui Song <kasong(a)redhat.com> wrote:
>>
>> 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 fix the problem by using unified installed kernel image and
>> initramfs name.
>>
>> Signed-off-by: Kairui Song <kasong(a)redhat.com>
>> ---
>> dracut-early-kdump-module-setup.sh | 9 +++++++--
>> dracut-early-kdump.sh | 13 ++-----------
>> 2 files changed, 9 insertions(+), 13 deletions(-)
>>
>> diff --git a/dracut-early-kdump-module-setup.sh
b/dracut-early-kdump-module-setup.sh
>> index 7613fbc..cd84542 100755
>> --- a/dracut-early-kdump-module-setup.sh
>> +++ b/dracut-early-kdump-module-setup.sh
>> @@ -22,13 +22,18 @@ depends() {
>>
>> 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"
>> +
>> +
KDUMP_KERNEL_INST_DEST="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}"
>> +
KDUMP_INITRD_INST_DEST="${KDUMP_BOOTDIR}/initramfs-earlykdump.img"
>> }
>>
>> install() {
>> @@ -39,6 +44,6 @@ install() {
>> 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"
>> + inst_binary "$KDUMP_KERNEL" "$KDUMP_KERNEL_INST_DEST"
>> + inst_binary "$KDUMP_INITRD" "$KDUMP_INITRD_INST_DEST"
>> }
>> 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()
>> --
>> 2.20.1
>>
>
>
--
Best Regards,
Kairui Song