On Tue, Jan 21, 2014 at 10:48:28PM +0530, Hari Bathini wrote:
The current kdump infrastructure builds a separate initrd which then
gets loaded into memory by kexec-tools for use by kdump kernel. But
firmware assisted dump (FADUMP) does not use kexec-based approach.
After crash, firmware reboots the partition and loads grub loader
like the normal booting process does. Hence in the FADUMP approach,
the second kernel (after crash) will always use the default initrd
(OS built). So, to support FADUMP, change is required, as in to add
dump capturing steps, in default initrd.
The current kdumpctl script implementation already has the code to
build initrd using mkdumprd. This patch uses the new '--rebuild'
option introduced, in dracut, to incrementally build the initramfs
image. Once kdump (fadump) initrd is successfully rebuild from the
default initrd image, this patch replaces the default initrd image
with the newly built initrd.
check_config()
-> rebuild_initrd()
Rebuild default initrd with fadump support
-> handle_fadump_initrd()
Replace default with initrd built for fadump.
I think above description is wrong. You seem to be doing reverse. Directly
rebuilding initrd and if it fails, replace it with backup copy.
Can you please fix changelogs.
[..]
diff --git a/kdumpctl b/kdumpctl
index f4760b5..976dfe8 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -72,13 +72,25 @@ function save_core()
function rebuild_initrd()
{
if is_fadump_capable; then
+ if [ ! -s "$default_initrd" ]; then
+ echo "No default initrd found to rebuild for fadump support!"
+ return 1
+ fi
backup_default_initrd
- fi
-
- $MKDUMPRD $kdump_initrd $kdump_kver
- if [ $? != 0 ]; then
- echo "mkdumprd: failed to make kdump initrd" >&2
- return 1
+ echo "Rebuilding $default_initrd with fadump support"
+ $MKDUMPRD --rebuild $default_initrd --kver $kdump_kver
+ if [ $? != 0 ]; then
+ echo "mkdumprd: failed to make initrd with fadump support" >&2
+ restore_default_initrd
+ return 1
+ fi
+ else
+ echo "Rebuilding $kdump_initrd"
+ $MKDUMPRD $kdump_initrd $kdump_kver
+ if [ $? != 0 ]; then
+ echo "mkdumprd: failed to make kdump initrd" >&2
+ return 1
+ fi
How about splitting it in two functions. Something like.
rebuild_initrd() {
if (dump_mode == kdump)
rebuild_kdump_initrd()
else
rebuild_fadump_initrd()
fi
}
Thanks
Vivek