On 14/06/21 3:59 pm, Hari Bathini wrote:
On 10/06/21 8:29 pm, Hari Bathini wrote:
> In case of fadump, the initramfs image has to be built to boot into
> the production environment as well as to offload the active crash dump
> to the specified dump target (for boot after crash). As the same image
> would be used for both boot scenarios, it could not be built optimally
> while accommodating both cases.
>
> Use --include to include the initramfs image built for offloading
> active crash dump to the specified dump target. Also, introduce a new
> out-of-tree dracut module (99zz-fadumpinit) that installs a customized
> init program while moving the default /init to /init.dracut. This
> customized init program is leveraged to isolate fadump image within
> the default initramfs image by kicking off default boot process
> (exec /init.dracut) for regular boot scenario and activating fadump
> initramfs image, if the system is booting after a crash.
>
> Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
>
> * Applying this patch, the initramfs image built with fadump support
> can be too large, without
>
https://github.com/dracutdevs/dracut/pull/1532
>
> TODO:
> * Fix missing ssh identify file /root/.ssh/kdump_id_rsa with
> squash not used and remote (ssh) dump target configured.
> Changes in V3:
> * Removed dependency with squash module by extracting fadump
> initramfs to /fadumproot directory.
> * Moved code that builds initramfs for fadump to mkfadumprd and
> added cleanup support based on inputs from Kairui.
>
> Changes in V2:
> * Moved kernel modules installation from install() to installkernel() for
> zz-fadumpinit dracut module.
> * Updated kexec-tools.spec to install zz-fadumpinit module files
> appropriately.
> * Fixed error check for capture initramfs image isolation with dracut.
>
>
> dracut-fadump-init-fadump.sh | 20 ++++++++++++++
> dracut-fadump-module-setup.sh | 17 ++++++++++++
> dracut-module-setup.sh | 6 +---
> kdumpctl | 22 +++-------------
> kexec-tools.spec | 14 ++++++++++
> mkfadumprd | 58
> +++++++++++++++++++++++++++++++++++++++++
> 6 files changed, 115 insertions(+), 22 deletions(-)
> create mode 100644 dracut-fadump-init-fadump.sh
> create mode 100644 dracut-fadump-module-setup.sh
> create mode 100644 mkfadumprd
>
> diff --git a/dracut-fadump-init-fadump.sh b/dracut-fadump-init-fadump.sh
> new file mode 100644
> index 0000000..736a7dd
> --- /dev/null
> +++ b/dracut-fadump-init-fadump.sh
> @@ -0,0 +1,20 @@
> +#!/bin/sh
> +PATH=/bin:/sbin
> +
> +[ -e /proc/self/mounts ] \
> + || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc
> /proc)
> +
> +grep -q '^sysfs /sys sysfs' /proc/self/mounts \
> + || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs
> /sys)
> +
> +# If system is booting after a crash, switch to initramfs built for
> dump capture
> +if [ -f /proc/device-tree/rtas/ibm,kernel-dump ] || [ -f
> /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
> + mkdir -p /newroot
> + mount -t ramfs ramfs /newroot
Hi Kairui,
> + mv /fadumproot/* /newroot
Similar to the dracut --include issue, this would also leave behind
filenames beginning with '.'. As replacing '*' with '.' won't
work,
How about the below instead:
for FILE in $(ls -A fadumproot); do mv fadumproot/$FILE newroot; done
Need to install 'ls' while setting up the module though..
Thanks
Hari