diff --git a/.gitignore b/.gitignore
index e69de29..7a38a39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,23 @@
+*.gz
+*.xz
+*.swp
+*.rpm
+/eppic_030413.tar.gz
+/makedumpfile-1.5.7.tar.gz
+/kexec-tools-2.0.8.tar.xz
+/kdump-anaconda-addon-005-2-g86366ae.tar.gz
+/kdump-anaconda-addon-005-5-gbf53665.tar.gz
+/kdump-anaconda-addon-005-8-ge6ea581.tar.gz
+/kdump-anaconda-addon-005-9-g6115ca7.tar.gz
+/kexec-tools-2.0.9.tar.xz
+/makedumpfile-1.5.8.tar.gz
+/eppic_050615.tar.gz
+/kexec-tools-2.0.10.tar.xz
+/kdump-anaconda-addon-005-10-gd16915f.tar.gz
+/kdump-anaconda-addon-005-11-g59f9b73.tar.gz
+/kdump-anaconda-addon-005-12-g60fa4c1.tar.gz
+/kdump-anaconda-addon-005-14-g563e904.tar.gz
+/kdump-anaconda-addon-005-16-g586cc82.tar.gz
+/kexec-tools-2.0.11.tar.xz
+/makedumpfile-1.5.9.tar.gz
+/kexec-tools-2.0.12.tar.xz
diff --git a/60-kdump.install b/60-kdump.install
new file mode 100755
index 0000000..0a3b40e
--- /dev/null
+++ b/60-kdump.install
@@ -0,0 +1,30 @@
+#!/usr/bin/bash
+
+COMMAND="$1"
+KERNEL_VERSION="$2"
+BOOT_DIR_ABS="$3"
+KERNEL_IMAGE="$4"
+
+if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
+    exit 0
+fi
+
+if [[ -d "$BOOT_DIR_ABS" ]]; then
+    KDUMP_INITRD="initrdkdump"
+else
+    BOOT_DIR_ABS="/boot"
+    KDUMP_INITRD="initramfs-${KERNEL_VERSION}kdump.img"
+fi
+
+ret=0
+case "$COMMAND" in
+    add)
+        # Do nothing, kdump initramfs is strictly host only
+        # and managed by kdump service
+        ;;
+    remove)
+        rm -f -- "$BOOT_DIR_ABS/$KDUMP_INITRD"
+        ret=$?
+        ;;
+esac
+exit $ret
diff --git a/98-kexec.rules b/98-kexec.rules
new file mode 100644
index 0000000..b73b701
--- /dev/null
+++ b/98-kexec.rules
@@ -0,0 +1,16 @@
+SUBSYSTEM=="cpu", ACTION=="add", GOTO="kdump_reload"
+SUBSYSTEM=="cpu", ACTION=="remove", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling kdump-udev-throttle will end up
+# doing nothing, but systemd-run will always generate extra logs for
+# each call, so trigger the kdump-udev-throttler only if kdump
+# service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
+
+LABEL="kdump_reload_end"
diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
new file mode 100644
index 0000000..1a91220
--- /dev/null
+++ b/98-kexec.rules.ppc64
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling kdump-udev-throttle will end up
+# doing nothing, but systemd-run will always generate extra logs for
+# each call, so trigger the kdump-udev-throttler only if kdump
+# service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
+
+LABEL="kdump_reload_end"
diff --git a/README b/README
new file mode 100644
index 0000000..9c1fb1a
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+Adding a patch to kexec-tools
+=============================
+There is a mailing list kexec@lists.fedoraproject.org where all the dicussion
+related to fedora kexec-tools happen. All the patches are posted there for
+inclusion and committed to kexec-tools after review.
+
+So if you want your patches to be included in fedora kexec-tools package,
+post these to kexec@lists.fedoraproject.org.
+
+One can subscribe to list and browse through archives here.
+
+https://admin.fedoraproject.org/mailman/listinfo/kexec
diff --git a/dracut-early-kdump-module-setup.sh b/dracut-early-kdump-module-setup.sh
new file mode 100755
index 0000000..f30bd67
--- /dev/null
+++ b/dracut-early-kdump-module-setup.sh
@@ -0,0 +1,60 @@
+#!/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() {
+    prepare_kdump_bootinfo
+
+    # $kernel is a variable from dracut
+    if [ "$KDUMP_KERNELVER" != $kernel ]; then
+        dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
+            "but the initramfs is generated for kernel version '$kernel'"
+    fi
+}
+
+install() {
+    prepare_kernel_initrd
+    if [ ! -f "$KDUMP_KERNEL" ]; then
+        derror "Could not find required kernel for earlykdump," \
+            "earlykdump will not work!"
+        return 1
+    fi
+    if [ ! -f "$KDUMP_INITRD" ]; then
+        derror "Could not find required kdump initramfs for earlykdump," \
+            "please ensure kdump initramfs is generated first," \
+            "earlykdump will not work!"
+        return 1
+    fi
+
+    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"
+    inst_binary "$KDUMP_KERNEL"
+    inst_binary "$KDUMP_INITRD"
+
+    ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump"
+    ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump"
+
+    chmod -x "${initdir}/$KDUMP_KERNEL"
+}
diff --git a/dracut-early-kdump.sh b/dracut-early-kdump.sh
new file mode 100755
index 0000000..92913fb
--- /dev/null
+++ b/dracut-early-kdump.sh
@@ -0,0 +1,73 @@
+#! /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}")
+    EARLY_KDUMP_KERNEL="/boot/kernel-earlykdump"
+    EARLY_KDUMP_INITRD="/boot/initramfs-earlykdump"
+}
+
+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
diff --git a/dracut-kdump-capture.service b/dracut-kdump-capture.service
new file mode 100644
index 0000000..3f20aba
--- /dev/null
+++ b/dracut-kdump-capture.service
@@ -0,0 +1,30 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Kdump Vmcore Save Service
+After=initrd.target initrd-parse-etc.service sysroot.mount
+After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service dracut-pre-pivot.service
+Before=initrd-cleanup.service
+ConditionPathExists=/etc/initrd-release
+OnFailure=emergency.target
+OnFailureJobMode=isolate
+
+[Service]
+Environment=DRACUT_SYSTEMD=1
+Environment=NEWROOT=/sysroot
+Type=oneshot
+ExecStart=/bin/kdump.sh
+StandardInput=null
+StandardOutput=syslog
+StandardError=syslog+console
+KillMode=process
+RemainAfterExit=yes
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/dracut-kdump-emergency.service b/dracut-kdump-emergency.service
new file mode 100644
index 0000000..e023284
--- /dev/null
+++ b/dracut-kdump-emergency.service
@@ -0,0 +1,28 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+# This service will be placed in kdump initramfs and replace both the systemd
+# emergency service and dracut emergency shell. IOW, any emergency will be
+# kick this service and in turn isolating to kdump error handler.
+
+[Unit]
+Description=Kdump Emergency
+DefaultDependencies=no
+IgnoreOnIsolate=yes
+
+[Service]
+ExecStart=/usr/bin/systemctl --no-block isolate kdump-error-handler.service
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+IgnoreSIGPIPE=no
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/dracut-kdump-emergency.target b/dracut-kdump-emergency.target
new file mode 100644
index 0000000..a1bb493
--- /dev/null
+++ b/dracut-kdump-emergency.target
@@ -0,0 +1,14 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Emergency Mode
+Documentation=man:systemd.special(7)
+Requires=emergency.service
+After=emergency.service
+AllowIsolate=yes
+IgnoreOnIsolate=yes
diff --git a/dracut-kdump-error-handler.service b/dracut-kdump-error-handler.service
new file mode 100644
index 0000000..a23b75e
--- /dev/null
+++ b/dracut-kdump-error-handler.service
@@ -0,0 +1,33 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+# This service will run the real kdump error handler code. Executing the
+# failure action configured in kdump.conf
+
+[Unit]
+Description=Kdump Error Handler
+DefaultDependencies=no
+After=systemd-vconsole-setup.service
+Wants=systemd-vconsole-setup.service
+AllowIsolate=yes
+
+[Service]
+Environment=HOME=/
+Environment=DRACUT_SYSTEMD=1
+Environment=NEWROOT=/sysroot
+WorkingDirectory=/
+ExecStart=/bin/kdump-error-handler.sh
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+IgnoreSIGPIPE=no
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/dracut-kdump-error-handler.sh b/dracut-kdump-error-handler.sh
new file mode 100755
index 0000000..fc2b932
--- /dev/null
+++ b/dracut-kdump-error-handler.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. /lib/kdump-lib-initramfs.sh
+
+set -o pipefail
+export PATH=$PATH:$KDUMP_SCRIPT_DIR
+
+get_kdump_confs
+do_failure_action
+do_final_action
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
new file mode 100755
index 0000000..6f948fc
--- /dev/null
+++ b/dracut-kdump.sh
@@ -0,0 +1,271 @@
+#!/bin/sh
+
+# continue here only if we have to save dump.
+if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
+    exit 0
+fi
+
+exec &> /dev/console
+. /lib/dracut-lib.sh
+. /lib/kdump-lib-initramfs.sh
+
+set -o pipefail
+DUMP_RETVAL=0
+
+export PATH=$PATH:$KDUMP_SCRIPT_DIR
+
+do_dump()
+{
+    local _ret
+
+    eval $DUMP_INSTRUCTION
+    _ret=$?
+
+    if [ $_ret -ne 0 ]; then
+        echo "kdump: saving vmcore failed"
+    fi
+
+    return $_ret
+}
+
+do_kdump_pre()
+{
+    local _ret
+
+    if [ -n "$KDUMP_PRE" ]; then
+        "$KDUMP_PRE"
+        _ret=$?
+        if [ $_ret -ne 0 ]; then
+            echo "kdump: $KDUMP_PRE exited with $_ret status"
+            return $_ret
+        fi
+    fi
+
+    # if any script fails, it just raises warning and continues
+    if [ -d /etc/kdump/pre.d ]; then
+        for file in /etc/kdump/pre.d/*; do
+            "$file"
+            _ret=$?
+            if [ $_ret -ne 0 ]; then
+                echo "kdump: $file exited with $_ret status"
+            fi
+        done
+    fi
+    return 0
+}
+
+do_kdump_post()
+{
+    local _ret
+
+    if [ -d /etc/kdump/post.d ]; then
+        for file in /etc/kdump/post.d/*; do
+            "$file" "$1"
+            _ret=$?
+            if [ $_ret -ne 0 ]; then
+                echo "kdump: $file exited with $_ret status"
+            fi
+        done
+    fi
+
+    if [ -n "$KDUMP_POST" ]; then
+        "$KDUMP_POST" "$1"
+        _ret=$?
+        if [ $_ret -ne 0 ]; then
+            echo "kdump: $KDUMP_POST exited with $_ret status"
+        fi
+    fi
+}
+
+add_dump_code()
+{
+    DUMP_INSTRUCTION=$1
+}
+
+dump_raw()
+{
+    local _raw=$1
+
+    [ -b "$_raw" ] || return 1
+
+    echo "kdump: saving to raw disk $_raw"
+
+    if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then
+        _src_size=`ls -l /proc/vmcore | cut -d' ' -f5`
+        _src_size_mb=$(($_src_size / 1048576))
+        monitor_dd_progress $_src_size_mb &
+    fi
+
+    echo "kdump: saving vmcore"
+    $CORE_COLLECTOR /proc/vmcore | dd of=$_raw bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
+    sync
+
+    echo "kdump: saving vmcore complete"
+    return 0
+}
+
+dump_ssh()
+{
+    local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
+    local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
+    local _host=$2
+
+    echo "kdump: saving to $_host:$_dir"
+
+    cat /var/lib/random-seed > /dev/urandom
+    ssh -q $_opt $_host mkdir -p $_dir || return 1
+
+    save_vmcore_dmesg_ssh ${DMESG_COLLECTOR} ${_dir} "${_opt}" $_host
+    save_opalcore_ssh ${_dir} "${_opt}" $_host
+
+    echo "kdump: saving vmcore"
+
+    if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
+        scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete" || return 1
+        ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore" || return 1
+    else
+        $CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete" || return 1
+        ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore.flat" || return 1
+    fi
+
+    echo "kdump: saving vmcore complete"
+    return 0
+}
+
+save_opalcore_ssh() {
+    local _path=$1
+    local _opts="$2"
+    local _location=$3
+
+    if [ ! -f $OPALCORE ]; then
+        # Check if we are on an old kernel that uses a different path
+        if [ -f /sys/firmware/opal/core ]; then
+            OPALCORE="/sys/firmware/opal/core"
+        else
+            return 0
+        fi
+    fi
+
+    echo "kdump: saving opalcore"
+    scp $_opts $OPALCORE $_location:$_path/opalcore-incomplete
+    if [ $? -ne 0 ]; then
+        echo "kdump: saving opalcore failed"
+       return 1
+    fi
+
+    ssh $_opts $_location mv $_path/opalcore-incomplete $_path/opalcore
+    echo "kdump: saving opalcore complete"
+    return 0
+}
+
+save_vmcore_dmesg_ssh() {
+    local _dmesg_collector=$1
+    local _path=$2
+    local _opts="$3"
+    local _location=$4
+
+    echo "kdump: saving vmcore-dmesg.txt"
+    $_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt"
+    _exitcode=$?
+
+    if [ $_exitcode -eq 0 ]; then
+        ssh -q $_opts $_location mv $_path/vmcore-dmesg-incomplete.txt $_path/vmcore-dmesg.txt
+        echo "kdump: saving vmcore-dmesg.txt complete"
+    else
+        echo "kdump: saving vmcore-dmesg.txt failed"
+    fi
+}
+
+get_host_ip()
+{
+    local _host
+    if is_nfs_dump_target || is_ssh_dump_target
+    then
+        kdumpnic=$(getarg kdumpnic=)
+        [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
+        _host=`ip addr show dev $kdumpnic|grep '[ ]*inet'`
+        [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
+        _host=`echo $_host | head -n 1 | cut -d' ' -f2`
+        _host="${_host%%/*}"
+        [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
+        HOST_IP=$_host
+    fi
+    return 0
+}
+
+read_kdump_conf()
+{
+    if [ ! -f "$KDUMP_CONF" ]; then
+        echo "kdump: $KDUMP_CONF not found"
+        return
+    fi
+
+    get_kdump_confs
+
+    # rescan for add code for dump target
+    while read config_opt config_val;
+    do
+        # remove inline comments after the end of a directive.
+        case "$config_opt" in
+        dracut_args)
+            config_val=$(get_dracut_args_target "$config_val")
+            if [ -n "$config_val" ]; then
+                config_val=$(get_mntpoint_from_target "$config_val")
+                add_dump_code "dump_fs $config_val"
+            fi
+            ;;
+        ext[234]|xfs|btrfs|minix|nfs)
+            config_val=$(get_mntpoint_from_target "$config_val")
+            add_dump_code "dump_fs $config_val"
+            ;;
+        raw)
+            add_dump_code "dump_raw $config_val"
+            ;;
+        ssh)
+            add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
+            ;;
+        esac
+    done <<< "$(read_strip_comments $KDUMP_CONF)"
+}
+
+fence_kdump_notify()
+{
+    if [ -n "$FENCE_KDUMP_NODES" ]; then
+        $FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES &
+    fi
+}
+
+read_kdump_conf
+fence_kdump_notify
+
+get_host_ip
+if [ $? -ne 0 ]; then
+    echo "kdump: get_host_ip exited with non-zero status!"
+    exit 1
+fi
+
+if [ -z "$DUMP_INSTRUCTION" ]; then
+    add_dump_code "dump_fs $NEWROOT"
+fi
+
+do_kdump_pre
+if [ $? -ne 0 ]; then
+    echo "kdump: kdump_pre script exited with non-zero status!"
+    do_final_action
+    # During systemd service to reboot the machine, stop this shell script running
+    exit 1
+fi
+make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab'
+do_dump
+DUMP_RETVAL=$?
+
+do_kdump_post $DUMP_RETVAL
+if [ $? -ne 0 ]; then
+    echo "kdump: kdump_post script exited with non-zero status!"
+fi
+
+if [ $DUMP_RETVAL -ne 0 ]; then
+    exit 1
+fi
+
+do_final_action
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
new file mode 100755
index 0000000..a186570
--- /dev/null
+++ b/dracut-module-setup.sh
@@ -0,0 +1,872 @@
+#!/bin/bash
+
+. $dracutfunctions
+. /lib/kdump/kdump-lib.sh
+
+if ! [[ -d "${initdir}/tmp" ]]; then
+    mkdir -p "${initdir}/tmp"
+fi
+
+check() {
+    [[ $debug ]] && set -x
+    #kdumpctl sets this explicitly
+    if [ -z "$IN_KDUMP" ] || [ ! -f /etc/kdump.conf ]
+    then
+        return 1
+    fi
+    return 0
+}
+
+depends() {
+    local _dep="base shutdown"
+
+    is_squash_available() {
+        for kmodule in squashfs overlay loop; do
+            if [ -z "$KDUMP_KERNELVER" ]; then
+                modprobe --dry-run $kmodule &>/dev/null || return 1
+            else
+                modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
+            fi
+        done
+    }
+
+    if is_squash_available && ! is_fadump_capable; then
+        _dep="$_dep squash"
+    else
+        dwarning "Required modules to build a squashed kdump image is missing!"
+    fi
+
+    if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then
+        _dep="$_dep drm"
+    fi
+
+    if is_generic_fence_kdump || is_pcs_fence_kdump; then
+        _dep="$_dep network"
+    fi
+
+    echo $_dep
+    return 0
+}
+
+kdump_is_bridge() {
+     [ -d /sys/class/net/"$1"/bridge ]
+}
+
+kdump_is_bond() {
+     [ -d /sys/class/net/"$1"/bonding ]
+}
+
+kdump_is_team() {
+     [ -f /usr/bin/teamnl ] && teamnl $1 ports &> /dev/null
+}
+
+kdump_is_vlan() {
+     [ -f /proc/net/vlan/"$1" ]
+}
+
+# $1: netdev name
+source_ifcfg_file() {
+    local ifcfg_file
+
+    ifcfg_file=$(get_ifcfg_filename $1)
+    if [ -f "${ifcfg_file}" ]; then
+        . ${ifcfg_file}
+    else
+        dwarning "The ifcfg file of $1 is not found!"
+    fi
+}
+
+# $1: netdev name
+kdump_setup_dns() {
+    local _nameserver _dns
+    local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf
+
+    source_ifcfg_file $1
+
+    [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile"
+    [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
+
+    while read content;
+    do
+        _nameserver=$(echo $content | grep ^nameserver)
+        [ -z "$_nameserver" ] && continue
+
+        _dns=$(echo $_nameserver | cut -d' ' -f2)
+        [ -z "$_dns" ] && continue
+
+        if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
+            echo "nameserver=$_dns" >> "$_dnsfile"
+        fi
+    done < "/etc/resolv.conf"
+}
+
+#$1: netdev name
+#$2: srcaddr
+#if it use static ip echo it, or echo null
+kdump_static_ip() {
+    local _netdev="$1" _srcaddr="$2" _ipv6_flag
+    local _netmask _gateway _ipaddr _target _nexthop
+
+    _ipaddr=$(ip addr show dev $_netdev permanent | awk "/ $_srcaddr\/.* /{print \$2}")
+
+    if is_ipv6_address $_srcaddr; then
+        _ipv6_flag="-6"
+    fi
+
+    if [ -n "$_ipaddr" ]; then
+        _gateway=$(ip $_ipv6_flag route list dev $_netdev | \
+                awk '/^default /{print $3}' | head -n 1)
+
+        if [ "x" !=  "x"$_ipv6_flag ]; then
+            # _ipaddr="2002::56ff:feb6:56d5/64", _netmask is the number after "/"
+            _netmask=${_ipaddr#*\/}
+            _srcaddr="[$_srcaddr]"
+            _gateway="[$_gateway]"
+        else
+            _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
+        fi
+        echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
+    fi
+
+    /sbin/ip $_ipv6_flag route show | grep -v default |\
+    grep ".*via.* $_netdev " | grep -v "^[[:space:]]*nexthop" |\
+    while read _route; do
+        _target=`echo $_route | cut -d ' ' -f1`
+        _nexthop=`echo $_route | cut -d ' ' -f3`
+        if [ "x" !=  "x"$_ipv6_flag ]; then
+            _target="[$_target]"
+            _nexthop="[$_nexthop]"
+        fi
+        echo "rd.route=$_target:$_nexthop:$_netdev"
+    done >> ${initdir}/etc/cmdline.d/45route-static.conf
+
+    kdump_handle_mulitpath_route $_netdev $_srcaddr
+}
+
+kdump_handle_mulitpath_route() {
+    local _netdev="$1" _srcaddr="$2" _ipv6_flag
+    local _target _nexthop _route _weight _max_weight _rule
+
+    if is_ipv6_address $_srcaddr; then
+        _ipv6_flag="-6"
+    fi
+
+    while IFS="" read _route; do
+        if [[ "$_route" =~ [[:space:]]+nexthop ]]; then
+            _route=$(echo "$_route" | sed -e 's/^[[:space:]]*//')
+            # Parse multipath route, using previous _target
+            [[ "$_target" == 'default' ]] && continue
+            [[ "$_route" =~ .*via.*\ $_netdev ]] || continue
+
+            _weight=`echo "$_route" | cut -d ' ' -f7`
+            if [[ "$_weight" -gt "$_max_weight" ]]; then
+                _nexthop=`echo "$_route" | cut -d ' ' -f3`
+                _max_weight=$_weight
+                if [ "x" !=  "x"$_ipv6_flag ]; then
+                    _rule="rd.route=[$_target]:[$_nexthop]:$_netdev"
+                else
+                    _rule="rd.route=$_target:$_nexthop:$_netdev"
+                fi
+            fi
+        else
+            [[ -n "$_rule" ]] && echo "$_rule"
+            _target=`echo "$_route" | cut -d ' ' -f1`
+            _rule="" _max_weight=0 _weight=0
+        fi
+    done >> ${initdir}/etc/cmdline.d/45route-static.conf\
+        <<< "$(/sbin/ip $_ipv6_flag route show)"
+
+    [[ -n $_rule ]] && echo $_rule >> ${initdir}/etc/cmdline.d/45route-static.conf
+}
+
+kdump_get_mac_addr() {
+    cat /sys/class/net/$1/address
+}
+
+#Bonding or team master modifies the mac address
+#of its slaves, we should use perm address
+kdump_get_perm_addr() {
+    local addr=$(ethtool -P $1 | sed -e 's/Permanent address: //')
+    if [ -z "$addr" ] || [ "$addr" = "00:00:00:00:00:00" ]
+    then
+        derror "Can't get the permanent address of $1"
+    else
+        echo "$addr"
+    fi
+}
+
+# Prefix kernel assigned names with "kdump-". EX: eth0 -> kdump-eth0
+# Because kernel assigned names are not persistent between 1st and 2nd
+# kernel. We could probably end up with eth0 being eth1, eth0 being
+# eth1, and naming conflict happens.
+kdump_setup_ifname() {
+    local _ifname
+
+    # If ifname already has 'kdump-' prefix, we must be switching from
+    # fadump to kdump. Skip prefixing 'kdump-' in this case as adding
+    # another prefix may truncate the ifname. Since an ifname with
+    # 'kdump-' is already persistent, this should be fine.
+    if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
+        _ifname="kdump-$1"
+    else
+        _ifname="$1"
+    fi
+
+    echo "$_ifname"
+}
+
+kdump_setup_bridge() {
+    local _netdev=$1
+    local _brif _dev _mac _kdumpdev
+    for _dev in `ls /sys/class/net/$_netdev/brif/`; do
+        _kdumpdev=$_dev
+        if kdump_is_bond "$_dev"; then
+            kdump_setup_bond "$_dev"
+        elif kdump_is_team "$_dev"; then
+            kdump_setup_team "$_dev"
+        elif kdump_is_vlan "$_dev"; then
+            kdump_setup_vlan "$_dev"
+        else
+            _mac=$(kdump_get_mac_addr $_dev)
+            _kdumpdev=$(kdump_setup_ifname $_dev)
+            echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/41bridge.conf
+        fi
+        _brif+="$_kdumpdev,"
+    done
+    echo " bridge=$_netdev:$(echo $_brif | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/41bridge.conf
+}
+
+kdump_setup_bond() {
+    local _netdev=$1
+    local _dev _mac _slaves _kdumpdev
+    for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
+        _mac=$(kdump_get_perm_addr $_dev)
+        _kdumpdev=$(kdump_setup_ifname $_dev)
+        echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
+        _slaves+="$_kdumpdev,"
+    done
+    echo -n " bond=$_netdev:$(echo $_slaves | sed 's/,$//')" >> ${initdir}/etc/cmdline.d/42bond.conf
+    # Get bond options specified in ifcfg
+
+    source_ifcfg_file $_netdev
+
+    bondoptions=":$(echo $BONDING_OPTS | xargs echo | tr " " ",")"
+    echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf
+}
+
+kdump_setup_team() {
+    local _netdev=$1
+    local _dev _mac _slaves _kdumpdev
+    for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
+        _mac=$(kdump_get_perm_addr $_dev)
+        _kdumpdev=$(kdump_setup_ifname $_dev)
+        echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/44team.conf
+        _slaves+="$_kdumpdev,"
+    done
+    echo " team=$_netdev:$(echo $_slaves | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/44team.conf
+    #Buggy version teamdctl outputs to stderr!
+    #Try to use the latest version of teamd.
+    teamdctl "$_netdev" config dump > ${initdir}/tmp/$$-$_netdev.conf
+    if [ $? -ne 0 ]
+    then
+        derror "teamdctl failed."
+        exit 1
+    fi
+    inst_dir /etc/teamd
+    inst_simple ${initdir}/tmp/$$-$_netdev.conf "/etc/teamd/$_netdev.conf"
+    rm -f ${initdir}/tmp/$$-$_netdev.conf
+}
+
+kdump_setup_vlan() {
+    local _netdev=$1
+    local _phydev="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")"
+    local _netmac="$(kdump_get_mac_addr $_phydev)"
+    local _kdumpdev
+
+    #Just support vlan over bond, it is not easy
+    #to support all other complex setup
+    if kdump_is_bridge "$_phydev"; then
+        derror "Vlan over bridge is not supported!"
+        exit 1
+    elif kdump_is_team "$_phydev"; then
+        derror "Vlan over team is not supported!"
+        exit 1
+    elif kdump_is_bond "$_phydev"; then
+        kdump_setup_bond "$_phydev"
+        echo " vlan=$(kdump_setup_ifname $_netdev):$_phydev" > ${initdir}/etc/cmdline.d/43vlan.conf
+    else
+        _kdumpdev="$(kdump_setup_ifname $_phydev)"
+        echo " vlan=$(kdump_setup_ifname $_netdev):$_kdumpdev ifname=$_kdumpdev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf
+    fi
+}
+
+# setup s390 znet cmdline
+# $1: netdev name
+kdump_setup_znet() {
+    local _options=""
+    local _netdev=$1
+
+    source_ifcfg_file $_netdev
+
+    for i in $OPTIONS; do
+        _options=${_options},$i
+    done
+    echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
+}
+
+kdump_get_ip_route()
+{
+    local _route=$(/sbin/ip -o route get to $1 2>&1)
+    [ $? != 0 ] && die "Bad kdump network destination: $1"
+    echo $_route
+}
+
+kdump_get_ip_route_field()
+{
+    if `echo $1 | grep -q $2`; then
+        echo ${1##*$2} | cut -d ' ' -f1
+    fi
+}
+
+kdump_get_remote_ip()
+{
+    local _remote=$(get_remote_host $1) _remote_temp
+    if is_hostname $_remote; then
+        _remote_temp=`getent ahosts $_remote | grep -v : | head -n 1`
+        if [ -z "$_remote_temp" ]; then
+            _remote_temp=`getent ahosts $_remote | head -n 1`
+        fi
+        _remote=`echo $_remote_temp | cut -d' ' -f1`
+    fi
+    echo $_remote
+}
+
+# Setup dracut to bring up network interface that enable
+# initramfs accessing giving destination
+# $1: destination host
+kdump_install_net() {
+    local _destaddr _srcaddr _route _netdev
+    local _static _proto _ip_conf _ip_opts _ifname_opts
+
+    _destaddr=$(kdump_get_remote_ip $1)
+    _route=$(kdump_get_ip_route $_destaddr)
+    _srcaddr=$(kdump_get_ip_route_field "$_route" "src")
+    _netdev=$(kdump_get_ip_route_field "$_route" "dev")
+    _netmac=$(kdump_get_mac_addr $_netdev)
+
+    if [ "$(uname -m)" = "s390x" ]; then
+        kdump_setup_znet $_netdev
+    fi
+
+    _static=$(kdump_static_ip $_netdev $_srcaddr)
+    if [ -n "$_static" ]; then
+        _proto=none
+    elif is_ipv6_address $_srcaddr; then
+        _proto=either6
+    else
+        _proto=dhcp
+    fi
+
+    _ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
+    _ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
+
+    # dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same.
+    # so we have to avoid adding duplicates
+    # We should also check /proc/cmdline for existing ip=xx arg.
+    # For example, iscsi boot will specify ip=xxx arg in cmdline.
+    if [ ! -f $_ip_conf ] || ! grep -q $_ip_opts $_ip_conf &&\
+        ! grep -q "ip=[^[:space:]]*$_netdev" /proc/cmdline; then
+        echo "$_ip_opts" >> $_ip_conf
+    fi
+
+    if kdump_is_bridge "$_netdev"; then
+        kdump_setup_bridge "$_netdev"
+    elif kdump_is_bond "$_netdev"; then
+        kdump_setup_bond "$_netdev"
+    elif kdump_is_team "$_netdev"; then
+        kdump_setup_team "$_netdev"
+    elif kdump_is_vlan "$_netdev"; then
+        kdump_setup_vlan "$_netdev"
+    else
+        _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
+        echo "$_ifname_opts" >> $_ip_conf
+    fi
+
+    kdump_setup_dns "$_netdev"
+
+    if [ ! -f ${initdir}/etc/cmdline.d/50neednet.conf ]; then
+        # network-manager module needs this parameter
+        echo "rd.neednet" >> ${initdir}/etc/cmdline.d/50neednet.conf
+    fi
+
+    # Save netdev used for kdump as cmdline
+    # Whoever calling kdump_install_net() is setting up the default gateway,
+    # ie. bootdev/kdumpnic. So don't override the setting if calling
+    # kdump_install_net() for another time. For example, after setting eth0 as
+    # the default gate way for network dump, eth1 in the fence kdump path will
+    # call kdump_install_net again and we don't want eth1 to be the default
+    # gateway.
+    if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] &&
+       [ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then
+        echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf
+        echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf
+    fi
+}
+
+# install etc/kdump/pre.d and /etc/kdump/post.d
+kdump_install_pre_post_conf() {
+    if [ -d /etc/kdump/pre.d ]; then
+        for file in /etc/kdump/pre.d/*; do
+            if [ -x "$file" ]; then
+                dracut_install $file
+            elif [ $file != "/etc/kdump/pre.d/*" ]; then
+               echo "$file is not executable"
+            fi
+        done
+    fi
+
+    if [ -d /etc/kdump/post.d ]; then
+        for file in /etc/kdump/post.d/*; do
+            if [ -x "$file" ]; then
+                dracut_install $file
+            elif [ $file != "/etc/kdump/post.d/*" ]; then
+                echo "$file is not executable"
+            fi
+        done
+    fi
+}
+
+default_dump_target_install_conf()
+{
+    local _target _fstype
+    local _mntpoint _save_path
+
+    is_user_configured_dump_target && return
+
+    _save_path=$(get_bind_mount_source $(get_save_path))
+    _target=$(get_target_from_path $_save_path)
+    _mntpoint=$(get_mntpoint_from_target $_target)
+
+    _fstype=$(get_fs_type_from_target $_target)
+    if is_fs_type_nfs $_fstype; then
+        kdump_install_net "$_target"
+        _fstype="nfs"
+    else
+        _target=$(kdump_get_persistent_dev $_target)
+    fi
+
+    echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
+
+    # don't touch the path under root mount
+    if [ "$_mntpoint" != "/" ]; then
+        _save_path=${_save_path##"$_mntpoint"}
+    fi
+
+    #erase the old path line, then insert the parsed path
+    sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
+    echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
+}
+
+#install kdump.conf and what user specifies in kdump.conf
+kdump_install_conf() {
+    local _opt _val _pdev
+    (read_strip_comments /etc/kdump.conf) > ${initdir}/tmp/$$-kdump.conf
+
+    while read _opt _val;
+    do
+        # remove inline comments after the end of a directive.
+        case "$_opt" in
+        raw)
+            _pdev=$(persistent_policy="by-id" kdump_get_persistent_dev $_val)
+            sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
+            ;;
+        ext[234]|xfs|btrfs|minix)
+            _pdev=$(kdump_get_persistent_dev $_val)
+            sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
+            ;;
+        ssh|nfs)
+            kdump_install_net "$_val"
+            ;;
+        dracut_args)
+            if [[ $(get_dracut_args_fstype "$_val") = nfs* ]] ; then
+                kdump_install_net "$(get_dracut_args_target "$_val")"
+            fi
+            ;;
+        kdump_pre|kdump_post|extra_bins)
+            dracut_install $_val
+            ;;
+        core_collector)
+            dracut_install "${_val%%[[:blank:]]*}"
+            ;;
+        esac
+    done <<< "$(read_strip_comments /etc/kdump.conf)"
+
+    kdump_install_pre_post_conf
+
+    default_dump_target_install_conf
+
+    kdump_configure_fence_kdump  "${initdir}/tmp/$$-kdump.conf"
+    inst "${initdir}/tmp/$$-kdump.conf" "/etc/kdump.conf"
+    rm -f ${initdir}/tmp/$$-kdump.conf
+}
+
+# Remove user custom configurations sysctl.conf & sysctl.d/*
+# and apply some optimization for kdump
+overwrite_sysctl_conf() {
+    # As custom configurations like vm.min_free_kbytes can lead
+    # to OOM issues in kdump kernel, avoid them
+    rm -f "${initdir}/etc/sysctl.conf"
+    rm -rf "${initdir}/etc/sysctl.d"
+    rm -rf "${initdir}/run/sysctl.d"
+    rm -rf "${initdir}/usr/lib/sysctl.d"
+
+    mkdir -p "${initdir}/etc/sysctl.d"
+    echo "vm.zone_reclaim_mode = 3" > "${initdir}/etc/sysctl.d/99-zone-reclaim.conf"
+}
+
+kdump_iscsi_get_rec_val() {
+
+    local result
+
+    # The open-iscsi 742 release changed to using flat files in
+    # /var/lib/iscsi.
+
+    result=$(/sbin/iscsiadm --show -m session -r ${1} | grep "^${2} = ")
+    result=${result##* = }
+    echo $result
+}
+
+kdump_get_iscsi_initiator() {
+    local _initiator
+    local initiator_conf="/etc/iscsi/initiatorname.iscsi"
+
+    [ -f "$initiator_conf" ] || return 1
+
+    while read _initiator; do
+        [ -z "${_initiator%%#*}" ] && continue # Skip comment lines
+
+        case $_initiator in
+            InitiatorName=*)
+                initiator=${_initiator#InitiatorName=}
+                echo "rd.iscsi.initiator=${initiator}"
+                return 0;;
+            *) ;;
+        esac
+    done < ${initiator_conf}
+
+    return 1
+}
+
+# Figure out iBFT session according to session type
+is_ibft() {
+    [ "$(kdump_iscsi_get_rec_val $1 "node.discovery_type")" = fw ]
+}
+
+kdump_setup_iscsi_device() {
+    local path=$1
+    local tgt_name; local tgt_ipaddr;
+    local username; local password; local userpwd_str;
+    local username_in; local password_in; local userpwd_in_str;
+    local netroot_str ; local initiator_str;
+    local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
+    local initiator_conf="/etc/iscsi/initiatorname.iscsi"
+
+    dinfo "Found iscsi component $1"
+
+    # Check once before getting explicit values, so we can bail out early,
+    # e.g. in case of pure-hardware(all-offload) iscsi.
+    if ! /sbin/iscsiadm -m session -r ${path} &>/dev/null ; then
+        return 1
+    fi
+
+    if is_ibft ${path}; then
+        return
+    fi
+
+    # Remove software iscsi cmdline generated by 95iscsi,
+    # and let kdump regenerate here.
+    rm -f ${initdir}/etc/cmdline.d/95iscsi.conf
+
+    tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
+    tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
+
+    # get and set username and password details
+    username=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.username")
+    [ "$username" == "<empty>" ] && username=""
+    password=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.password")
+    [ "$password" == "<empty>" ] && password=""
+    username_in=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.username_in")
+    [ -n "$username" ] && userpwd_str="$username:$password"
+
+    # get and set incoming username and password details
+    [ "$username_in" == "<empty>" ] && username_in=""
+    password_in=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.password_in")
+    [ "$password_in" == "<empty>" ] && password_in=""
+
+    [ -n "$username_in" ] && userpwd_in_str=":$username_in:$password_in"
+
+    kdump_install_net "$tgt_ipaddr"
+
+    # prepare netroot= command line
+    # FIXME: Do we need to parse and set other parameters like protocol, port
+    #        iscsi_iface_name, netdev_name, LUN etc.
+
+    if is_ipv6_address $tgt_ipaddr; then
+        tgt_ipaddr="[$tgt_ipaddr]"
+    fi
+    netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
+
+    [[ -f $netroot_conf ]] || touch $netroot_conf
+
+    # If netroot target does not exist already, append.
+    if ! grep -q $netroot_str $netroot_conf; then
+         echo $netroot_str >> $netroot_conf
+         dinfo "Appended $netroot_str to $netroot_conf"
+    fi
+
+    # Setup initator
+    initiator_str=$(kdump_get_iscsi_initiator)
+    [ $? -ne "0" ] && derror "Failed to get initiator name" && return 1
+
+    # If initiator details do not exist already, append.
+    if ! grep -q "$initiator_str" $netroot_conf; then
+         echo "$initiator_str" >> $netroot_conf
+         dinfo "Appended "$initiator_str" to $netroot_conf"
+    fi
+}
+
+kdump_check_iscsi_targets () {
+    # If our prerequisites are not met, fail anyways.
+    type -P iscsistart >/dev/null || return 1
+
+    kdump_check_setup_iscsi() (
+        local _dev
+        _dev=$1
+
+        [[ -L /sys/dev/block/$_dev ]] || return
+        cd "$(readlink -f /sys/dev/block/$_dev)"
+        until [[ -d sys || -d iscsi_session ]]; do
+            cd ..
+        done
+        [[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
+    )
+
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
+    }
+}
+
+# hostname -a is deprecated, do it by ourself
+get_alias() {
+    local ips
+    local entries
+    local alias_set
+
+    ips=$(hostname -I)
+    for ip in $ips
+    do
+            # in /etc/hosts, alias can come at the 2nd column
+            entries=$(grep $ip /etc/hosts | awk '{ $1=""; print $0 }')
+            if [ $? -eq 0 ]; then
+                    alias_set="$alias_set $entries"
+            fi
+    done
+
+    echo $alias_set
+}
+
+is_localhost() {
+    local hostnames=$(hostname -A)
+    local shortnames=$(hostname -A -s)
+    local aliasname=$(get_alias)
+    local nodename=$1
+
+    hostnames="$hostnames $shortnames $aliasname"
+
+    for name in ${hostnames}; do
+        if [ "$name" == "$nodename" ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+
+# retrieves fence_kdump nodes from Pacemaker cluster configuration
+get_pcs_fence_kdump_nodes() {
+    local nodes
+
+    pcs cluster sync > /dev/null 2>&1 && pcs cluster cib-upgrade > /dev/null 2>&1
+    # get cluster nodes from cluster cib, get interface and ip address
+    nodelist=`pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -`
+
+    # nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"'
+    # we need to convert each to node1, node2 ... nodeX in each iteration
+    for node in ${nodelist}; do
+        # convert $node from 'uname="nodeX"' to 'nodeX'
+        eval $node
+        nodename=$uname
+        # Skip its own node name
+        if is_localhost $nodename; then
+            continue
+        fi
+        nodes="$nodes $nodename"
+    done
+
+    echo $nodes
+}
+
+# retrieves fence_kdump args from config file
+get_pcs_fence_kdump_args() {
+    if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+        . $FENCE_KDUMP_CONFIG_FILE
+        echo $FENCE_KDUMP_OPTS
+    fi
+}
+
+get_generic_fence_kdump_nodes() {
+    local filtered
+    local nodes
+
+    nodes=$(get_option_value "fence_kdump_nodes")
+    for node in ${nodes}; do
+        # Skip its own node name
+        if is_localhost $node; then
+            continue
+        fi
+        filtered="$filtered $node"
+    done
+    echo $filtered
+}
+
+# setup fence_kdump in cluster
+# setup proper network and install needed files
+kdump_configure_fence_kdump () {
+    local kdump_cfg_file=$1
+    local nodes
+    local args
+
+    if is_generic_fence_kdump; then
+        nodes=$(get_generic_fence_kdump_nodes)
+
+    elif is_pcs_fence_kdump; then
+        nodes=$(get_pcs_fence_kdump_nodes)
+
+        # set appropriate options in kdump.conf
+        echo "fence_kdump_nodes $nodes" >> ${kdump_cfg_file}
+
+        args=$(get_pcs_fence_kdump_args)
+        if [ -n "$args" ]; then
+            echo "fence_kdump_args $args" >> ${kdump_cfg_file}
+        fi
+
+    else
+        # fence_kdump not configured
+        return 1
+    fi
+
+    # setup network for each node
+    for node in ${nodes}; do
+        kdump_install_net $node
+    done
+
+    dracut_install /etc/hosts
+    dracut_install /etc/nsswitch.conf
+    dracut_install $FENCE_KDUMP_SEND
+}
+
+# Install a random seed used to feed /dev/urandom
+# By the time kdump service starts, /dev/uramdom is already fed by systemd
+kdump_install_random_seed() {
+    local poolsize=`cat /proc/sys/kernel/random/poolsize`
+
+    if [ ! -d ${initdir}/var/lib/ ]; then
+        mkdir -p ${initdir}/var/lib/
+    fi
+
+    dd if=/dev/urandom of=${initdir}/var/lib/random-seed \
+       bs=$poolsize count=1 2> /dev/null
+}
+
+kdump_install_systemd_conf() {
+    local failure_action=$(get_option_value "failure_action")
+
+    # Kdump turns out to require longer default systemd mount timeout
+    # than 1st kernel(90s by default), we use default 300s for kdump.
+    grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null
+    if [ $? -ne 0 ]; then
+        mkdir -p ${initdir}/etc/systemd/system.conf.d
+        echo "[Manager]" > ${initdir}/etc/systemd/system.conf.d/kdump.conf
+        echo "DefaultTimeoutStartSec=300s" >> ${initdir}/etc/systemd/system.conf.d/kdump.conf
+    fi
+
+    # Forward logs to console directly, this avoids unneccessary memory
+    # consumption and make console output more useful.
+    # Only do so for non fadump image.
+    if ! is_fadump_capable && [ "$failure_action" != "shell" ]; then
+        mkdir -p ${initdir}/etc/systemd/journald.conf.d
+        echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
+        echo "Storage=none" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
+        echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
+    fi
+}
+
+install() {
+    kdump_install_conf
+    overwrite_sysctl_conf
+
+    if is_ssh_dump_target; then
+        kdump_install_random_seed
+    fi
+    dracut_install -o /etc/adjtime /etc/localtime
+    inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"
+    chmod +x ${initdir}/kdumpscripts/monitor_dd_progress
+    inst "/bin/dd" "/bin/dd"
+    inst "/bin/tail" "/bin/tail"
+    inst "/bin/date" "/bin/date"
+    inst "/bin/sync" "/bin/sync"
+    inst "/bin/cut" "/bin/cut"
+    inst "/bin/head" "/bin/head"
+    inst "/bin/awk" "/bin/awk"
+    inst "/bin/sed" "/bin/sed"
+    inst "/sbin/makedumpfile" "/sbin/makedumpfile"
+    inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
+    inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
+    inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
+    inst "$moddir/kdump.sh" "/usr/bin/kdump.sh"
+    inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service"
+    mkdir -p "$initdir/$systemdsystemunitdir/initrd.target.wants"
+    ln_r "$systemdsystemunitdir/kdump-capture.service" "$systemdsystemunitdir/initrd.target.wants/kdump-capture.service"
+    inst "$moddir/kdump-error-handler.sh" "/usr/bin/kdump-error-handler.sh"
+    inst "$moddir/kdump-error-handler.service" "$systemdsystemunitdir/kdump-error-handler.service"
+    # Replace existing emergency service and emergency target
+    cp "$moddir/kdump-emergency.service" "$initdir/$systemdsystemunitdir/emergency.service"
+    cp "$moddir/kdump-emergency.target" "$initdir/$systemdsystemunitdir/emergency.target"
+    # Also redirect dracut-emergency to kdump error handler
+    ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service"
+
+    # Check for all the devices and if any device is iscsi, bring up iscsi
+    # target. Ideally all this should be pushed into dracut iscsi module
+    # at some point of time.
+    kdump_check_iscsi_targets
+
+    kdump_install_systemd_conf
+
+    # nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail
+    if is_nfs_dump_target || is_ssh_dump_target; then
+        inst "ip"
+    fi
+
+    # For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
+    # safely replace "reserved_memory=XXXX"(default value is 8192) with
+    # "reserved_memory=1024" to lower memory pressure under kdump. We do
+    # it unconditionally here, if "/etc/lvm/lvm.conf" doesn't exist, it
+    # actually does nothing.
+    sed -i -e \
+      's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
+      ${initdir}/etc/lvm/lvm.conf &>/dev/null
+
+    # Save more memory by dropping switch root capability
+    if ! is_fadump_capable; then
+        dracut_no_switch_root
+    fi
+}
diff --git a/dracut-monitor_dd_progress b/dracut-monitor_dd_progress
new file mode 100644
index 0000000..e139d33
--- /dev/null
+++ b/dracut-monitor_dd_progress
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+SRC_FILE_MB=$1
+
+while true
+do
+    DD_PID=`pidof dd`
+    if [ -n "$DD_PID" ]; then
+        break
+    fi
+done
+
+while true
+do
+    sleep 5
+    if [ ! -d /proc/$DD_PID ]; then
+        break
+    fi
+
+    kill -s USR1 $DD_PID
+    CURRENT_SIZE=`tail -n 1 /tmp/dd_progress_file | sed "s/[^0-9].*//g"`
+    [ -n "$CURRENT_SIZE" ] && {
+        CURRENT_MB=$(($CURRENT_SIZE / 1048576))
+        echo -e "Copied $CURRENT_MB MB / $SRC_FILE_MB MB\r"
+    }
+done
+
+rm -f /tmp/dd_progress_file
diff --git a/early-kdump-howto.txt b/early-kdump-howto.txt
new file mode 100644
index 0000000..68b23c7
--- /dev/null
+++ b/early-kdump-howto.txt
@@ -0,0 +1,95 @@
+Early Kdump HOWTO
+
+Introduction
+------------
+
+Early kdump is a mechanism to make kdump operational earlier than normal kdump
+service.  The kdump service starts early enough for general crash cases, but
+there are some cases where it has no chance to make kdump operational in boot
+sequence, such as detecting devices and starting early services.  If you hit
+such a case, early kdump may allow you to get more information of it.
+
+Early kdump is implemented as a dracut module.  It adds a kernel (vmlinuz) and
+initramfs for kdump to your system's initramfs in order to load them as early
+as possible.  After that, if you provide "rd.earlykdump" in kernel command line,
+then in the initramfs, early kdump will load those files like the normal kdump
+service.  This is disabled by default.
+
+For the normal kdump service, it can check whether the early kdump has loaded
+the crash kernel and initramfs. It has no conflict with the early kdump.
+
+How to configure early kdump
+----------------------------
+
+We assume if you're reading this document, you should already have kexec-tools
+installed.
+
+You can rebuild the initramfs with earlykdump support with below steps:
+
+1. start kdump service to make sure kdump initramfs is created.
+
+    # systemctl start kdump
+
+    NOTE: If a crash occurs during boot process, early kdump captures a vmcore
+    and reboot the system by default, so the system might go into crash loop.
+    You can avoid such a crash loop by adding the following settings, which
+    power off the system after dump capturing, to kdump.conf in advance:
+
+        final_action poweroff
+        failure_action poweroff
+
+    For the failure_action, you can choose anything other than "reboot".
+
+2. rebuild system initramfs with earlykdump support.
+
+    # dracut --force --add earlykdump
+
+    NOTE: Recommend to backup the original system initramfs before performing
+    this step to put it back if something happens during boot-up.
+
+3. add rd.earlykdump in grub kernel command line.
+
+After making said changes, reboot your system to take effect. Of course, if you
+want to disable early kdump, you can simply remove "rd.earlykdump" from kernel
+boot parameters in grub, and reboot system like above.
+
+Once the boot is completed, you can check the status of the early kdump support
+on the command prompt:
+
+    # journalctl -b | grep early-kdump
+
+Then, you will see some useful logs, for example:
+
+- if early kdump is successful.
+
+Mar 09 09:57:56 localhost dracut-cmdline[190]: early-kdump is enabled.
+Mar 09 09:57:56 localhost dracut-cmdline[190]: kexec: loaded early-kdump kernel
+
+- if early kdump is disabled.
+
+Mar 09 10:02:47 localhost dracut-cmdline[189]: early-kdump is disabled.
+
+Notes
+-----
+
+- The size of early kdump initramfs will be large because it includes vmlinuz
+  and kdump initramfs.
+
+- Early kdump inherits the settings of normal kdump, so any changes that
+  caused normal kdump rebuilding also require rebuilding the system initramfs
+  to make sure that the changes take effect for early kdump. Therefore, after
+  the rebuilding of kdump initramfs is completed, provide a prompt message to
+  tell the fact.
+
+- If you install an updated kernel and reboot the system with it, the early
+  kdump will be disabled by default.  To enable it with the new kernel, you
+  need to take the above steps again.
+
+Limitation
+----------
+
+- At present, early kdump doesn't support fadump.
+
+- Early kdump loads a crash kernel and initramfs at the beginning of the
+  process in system's initramfs, so a crash at earlier than that (e.g. in
+  kernel initialization) cannot be captured even with the early kdump.
diff --git a/fadump-howto.txt b/fadump-howto.txt
new file mode 100644
index 0000000..c891e37
--- /dev/null
+++ b/fadump-howto.txt
@@ -0,0 +1,338 @@
+Firmware assisted dump (fadump) HOWTO
+
+Introduction
+
+Firmware assisted dump is a new feature in the 3.4 mainline kernel supported
+only on powerpc architecture. The goal of firmware-assisted dump is to enable
+the dump of a crashed system, and to do so from a fully-reset system, and to
+minimize the total elapsed time until the system is back in production use. A
+complete documentation on implementation can be found at
+Documentation/powerpc/firmware-assisted-dump.txt in upstream linux kernel tree
+from 3.4 version and above.
+
+Please note that the firmware-assisted dump feature is only available on Power6
+and above systems with recent firmware versions.
+
+Overview
+
+Fadump
+
+Fadump is a robust kernel crash dumping mechanism to get reliable kernel crash
+dump with assistance from firmware. This approach does not use kexec, instead
+firmware assists in booting the kdump kernel while preserving memory contents.
+Unlike kdump, the system is fully reset, and loaded with a fresh copy of the
+kernel. In particular, PCI and I/O devices are reinitialized and are in a
+clean, consistent state.  This second kernel, often called a capture kernel,
+boots with very little memory and captures the dump image.
+
+The first kernel registers the sections of memory with the Power firmware for
+dump preservation during OS initialization. These registered sections of memory
+are reserved by the first kernel during early boot. When a system crashes, the
+Power firmware fully resets the system, preserves all the system memory
+contents, save the low memory (boot memory of size larger of 5% of system
+RAM or 256MB) of RAM to the previous registered region. It will also save
+system registers, and hardware PTE's.
+
+Fadump is supported only on ppc64 platform. The standard kernel and capture
+kernel are one and the same on ppc64.
+
+If you're reading this document, you should already have kexec-tools
+installed. If not, you install it via the following command:
+
+    # yum install kexec-tools
+
+Fadump Operational Flow:
+
+Like kdump, fadump also exports the ELF formatted kernel crash dump through
+/proc/vmcore. Hence existing kdump infrastructure can be used to capture fadump
+vmcore. The idea is to keep the functionality transparent to end user. From
+user perspective there is no change in the way kdump init script works.
+
+However, unlike kdump, fadump does not pre-load kdump kernel and initrd into
+reserved memory, instead it always uses default OS initrd during second boot
+after crash. Hence, for fadump, we rebuild the new kdump initrd and replace it
+with default initrd. Before replacing existing default initrd we take a backup
+of original default initrd for user's reference. The dracut package has been
+enhanced to rebuild the default initrd with vmcore capture steps. The initrd
+image is rebuilt as per the configuration in /etc/kdump.conf file.
+
+The control flow of fadump works as follows:
+01. System panics.
+02. At the crash, kernel informs power firmware that kernel has crashed.
+03. Firmware takes the control and reboots the entire system preserving
+    only the memory (resets all other devices).
+04. The reboot follows the normal booting process (non-kexec).
+05. The boot loader loads the default kernel and initrd from /boot
+06. The default initrd loads and runs /init
+07. dracut-kdump.sh script present in fadump aware default initrd checks if
+    '/proc/device-tree/rtas/ibm,kernel-dump'  file exists  before executing
+    steps to capture vmcore.
+    (This check will help to bypass the vmcore capture steps during normal boot
+     process.)
+09. Captures dump according to /etc/kdump.conf
+10. Is dump capture successful (yes goto 12, no goto 11)
+11. Perform the failure action specified in /etc/kdump.conf
+    (The default failure action is reboot, if unspecified)
+12. Perform the final action specified in /etc/kdump.conf
+    (The default final action is reboot, if unspecified)
+
+
+How to configure fadump:
+
+Again, we assume if you're reading this document, you should already have
+kexec-tools installed. If not, you install it via the following command:
+
+    # yum install kexec-tools
+
+Make the kernel to be configured with FADump as the default boot entry, if
+it isn't already:
+
+   # grubby --set-default=/boot/vmlinuz-<kver>
+
+Boot into the kernel to be configured for FADump. To be able to do much of
+anything interesting in the way of debug analysis, you'll also need to install
+the kernel-debuginfo package, of the same arch as your running kernel, and the
+crash utility:
+
+    # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
+
+Next up, we need to modify some boot parameters to enable firmware assisted
+dump. With the help of grubby, it's very easy to append "fadump=on" to the end
+of your kernel boot parameters. To reserve the appropriate amount of memory
+for boot memory preservation, pass 'crashkernel=X' kernel cmdline parameter.
+For the recommended value of X, see 'FADump Memory Requirements' section.
+
+   # grubby --args="fadump=on crashkernel=6G" --update-kernel=/boot/vmlinuz-`uname -r`
+
+The term 'boot memory' means size of the low memory chunk that is required for
+a kernel to boot successfully when booted with restricted memory.  By default,
+the boot memory size will be the larger of 5% of system RAM or 256MB.
+Alternatively, user can also specify boot memory size through boot parameter
+'fadump_reserve_mem=' which will override the default calculated size. Use this
+option if default boot memory size is not sufficient for second kernel to boot
+successfully.
+
+After making said changes, reboot your system, so that the specified memory is
+reserved and left untouched by the normal system. Take note that the output of
+'free -m' will show X MB less memory than without this parameter, which is
+expected. If you see OOM (Out Of Memory) error messages while loading capture
+kernel, then you should bump up the memory reservation size.
+
+Now that you've got that reserved memory region set up, you want to turn on
+the kdump init script:
+
+    # systemctl enable kdump.service
+
+Then, start up kdump as well:
+
+    # systemctl start kdump.service
+
+This should turn on the firmware assisted functionality in kernel by
+echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
+to capture a vmcore upon crashing. For journaling filesystems like XFS an
+additional step is required to ensure bootloader does not pick the
+older initrd (without vmcore capture scripts):
+
+  * If /boot is a separate partition, run the below commands as the root user,
+    or as a user with CAP_SYS_ADMIN rights:
+
+        # fsfreeze -f
+        # fsfreeze -u
+
+  * If /boot is not a separate partition, reboot the system.
+
+After reboot check if the kdump service is up and running with:
+
+  # systemctl status kdump.service
+
+To test out whether FADump is configured properly, you can force-crash your
+system by echo'ing a 'c' into /proc/sysrq-trigger:
+
+    # echo c > /proc/sysrq-trigger
+
+You should see some panic output, followed by the system reset and booting into
+fresh copy of kernel. When default initrd loads and runs /init, vmcore should
+be copied out to disk (by default, in /var/crash/<YYYY.MM.DD-HH:MM:SS>/vmcore),
+then the system rebooted back into your normal kernel.
+
+Once back to your normal kernel, you can use the previously installed crash
+kernel in conjunction with the previously installed kernel-debuginfo to
+perform postmortem analysis:
+
+    # crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux
+    /var/crash/2006-08-23-15:34/vmcore
+
+    crash> bt
+
+and so on...
+
+Saving vmcore-dmesg.txt
+-----------------------
+Kernel log bufferes are one of the most important information available
+in vmcore. Now before saving vmcore, kernel log bufferes are extracted
+from /proc/vmcore and saved into a file vmcore-dmesg.txt. After
+vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for
+vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will
+not be available if dump target is raw device.
+
+FADump Memory Requirements:
+
+  System Memory          Recommended memory
+--------------------- ----------------------
+    4 GB - 16 GB     :        768 MB
+   16 GB - 64 GB     :       1024 MB
+   64 GB - 128 GB    :          2 GB
+  128 GB - 1 TB      :          4 GB
+    1 TB - 2 TB      :          6 GB
+    2 TB - 4 TB      :         12 GB
+    4 TB - 8 TB      :         20 GB
+    8 TB - 16 TB     :         36 GB
+   16 TB - 32 TB     :         64 GB
+   32 TB - 64 TB     :        128 GB
+   64 TB & above     :        180 GB
+
+Things to remember:
+
+1) The memory required to boot capture Kernel is a moving target that depends
+   on many factors like hardware attached to the system, kernel and modules in
+   use, packages installed and services enabled, there is no one-size-fits-all.
+   But the above recommendations are based on system memory. So, the above
+   recommendations for FADump come with a few assumptions, based on available
+   system memory, about the resources the system could have. So, please take
+   the recommendations with a pinch of salt and remember to try capturing dump
+   a few times to confirm that the system is configured successfully with dump
+   capturing support.
+
+2) Though the memory requirements for FADump seem high, this memory is not
+   completely set aside but made available for userspace applications to use,
+   through the CMA allocator.
+
+3) As the same initrd is used for booting production kernel as well as capture
+   kernel and with dump being captured in a restricted memory environment, few
+   optimizations (like not inclding network dracut module, disabling multipath
+   and such) are applied while building the initrd. In case, the production
+   environment needs these optimizations to be avoided, dracut_args option in
+   /etc/kdump.conf file could be leveraged. For example, if a user wishes for
+   network module to be included in the initrd, adding the below entry in
+   /etc/kdump.conf file and restarting kdump service would take care of it.
+
+   dracut_args --add "network"
+
+4) If FADump is configured to capture vmcore to a remote dump target using SSH
+   or NFS protocol, the network interface is renamed to kdump-<interface-name>
+   if <interface-name> is generic, for example, *eth#, or net#. This problem
+   occurs because the vmcore capture scripts in the initial RAM disk (initrd)
+   add the kdump- prefix to the network interface name to secure persistent
+   naming. As the same initrd is used for production kernel boot, the interface
+   name is changed for the production kernel too.
+
+Dump Triggering methods:
+
+This section talks about the various ways, other than a Kernel Panic, in which
+fadump can be triggered. The following methods assume that fadump is configured
+on your system, with the scripts enabled as described in the section above.
+
+1) AltSysRq C
+
+FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
+keyboard keys. Please refer to the following link for more details:
+
+https://fedoraproject.org/wiki/QA/Sysrq
+
+In addition, on PowerPC boxes, fadump can also be triggered via Hardware
+Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
+
+2) Kernel OOPs
+
+If we want to generate a dump everytime the Kernel OOPses, we can achieve this
+by setting the 'Panic On OOPs' option as follows:
+
+    # echo 1 > /proc/sys/kernel/panic_on_oops
+
+3) PowerPC specific methods:
+
+On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if
+XMON is configured). To configure XMON one needs to compile the kernel with
+the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with
+CONFIG_XMON and booting the kernel with xmon=on option.
+
+Following are the ways to remotely issue a soft reset on PowerPC boxes, which
+would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an
+'Enter' here will trigger the dump.
+
+3.1) HMC
+
+Hardware Management Console(HMC) available on Power4 and Power5 machines allow
+partitions to be reset remotely. This is specially useful in hang situations
+where the system is not accepting any keyboard inputs.
+
+Once you have HMC configured, the following steps will enable you to trigger
+fadump via a soft reset:
+
+On Power4
+  Using GUI
+
+    * In the right pane, right click on the partition you wish to dump.
+    * Select "Operating System->Reset".
+    * Select "Soft Reset".
+    * Select "Yes".
+
+  Using HMC Commandline
+
+    # reset_partition -m <machine> -p <partition> -t soft
+
+On Power5
+  Using GUI
+
+    * In the right pane, right click on the partition you wish to dump.
+    * Select "Restart Partition".
+    * Select "Dump".
+    * Select "OK".
+
+  Using HMC Commandline
+
+    # chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar
+
+3.2) Blade Management Console for Blade Center
+
+To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in
+the Blade Management Console. Select the corresponding blade for which you want
+to initate the dump and then click "Restart blade with NMI". This issues a
+system reset and invokes xmon debugger.
+
+
+Advanced Setups & Failure action:
+
+Kdump and fadump exhibit similar behavior in terms of setup & failure action.
+For fadump advanced setup related information see section "Advanced Setups" in
+"kexec-kdump-howto.txt" document. Refer to "Failure action" section in "kexec-
+kdump-howto.txt" document for fadump failure action related information.
+
+Compression and filtering
+
+Refer "Compression and filtering" section in "kexec-kdump-howto.txt" document.
+Compression and filtering are same for kdump & fadump.
+
+
+Notes on rootfs mount:
+Dracut is designed to mount rootfs by default. If rootfs mounting fails it
+will refuse to go on. So fadump leaves rootfs mounting to dracut currently.
+We make the assumtion that proper root= cmdline is being passed to dracut
+initramfs for the time being. If you need modify "KDUMP_COMMANDLINE=" in
+/etc/sysconfig/kdump, you will need to make sure that appropriate root=
+options are copied from /proc/cmdline. In general it is best to append
+command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing
+the original command line completely.
+
+How to disable FADump:
+
+Remove "fadump=on" from kernel cmdline parameters:
+
+   # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=on"
+
+If KDump is to be used as the dump capturing mechanism, update the crashkernel
+parameter (Else, remove "crashkernel=" parameter too, using grubby):
+
+   # grubby --update-kernel=/boot/vmlinuz-$kver --args="crashkernl=auto"
+
+Reboot the system for the settings to take effect.
diff --git a/kdump-dep-generator.sh b/kdump-dep-generator.sh
new file mode 100644
index 0000000..b6fab2d
--- /dev/null
+++ b/kdump-dep-generator.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# More details about systemd generator:
+# http://www.freedesktop.org/wiki/Software/systemd/Generators/
+
+. /usr/lib/kdump/kdump-lib.sh
+
+# If invokded with no arguments for testing purpose, output to /tmp to
+# avoid overriding the existing.
+dest_dir="/tmp"
+
+if [ -n "$1" ]; then
+    dest_dir=$1
+fi
+
+systemd_dir=/usr/lib/systemd/system
+kdump_wants=$dest_dir/kdump.service.wants
+
+if is_ssh_dump_target; then
+    mkdir -p $kdump_wants
+    ln -sf $systemd_dir/network-online.target $kdump_wants/
+fi
diff --git a/kdump-in-cluster-environment.txt b/kdump-in-cluster-environment.txt
new file mode 100644
index 0000000..de1eb5e
--- /dev/null
+++ b/kdump-in-cluster-environment.txt
@@ -0,0 +1,91 @@
+Kdump-in-cluster-environment HOWTO
+
+Introduction
+
+Kdump is a kexec based crash dumping mechansim for Linux. This docuement 
+illustrate how to configure kdump in cluster environment to allow the kdump 
+crash recovery service complete without being preempted by traditional power
+fencing methods. 
+
+Overview
+
+Kexec/Kdump
+
+Details about Kexec/Kdump are available in Kexec-Kdump-howto file and will not
+be described here.
+
+fence_kdump
+
+fence_kdump is an I/O fencing agent to be used with the kdump crash recovery 
+service. When the fence_kdump agent is invoked, it will listen for a message 
+from the failed node that acknowledges that the failed node is executing the 
+kdump crash kernel. Note that fence_kdump is not a replacement for traditional
+fencing methods. The fence_kdump agent can only detect that a node has entered
+the kdump crash recovery service. This allows the kdump crash recovery service
+complete without being preempted by traditional power fencing methods. 
+
+fence_kdump_send
+
+fence_kdump_send is a utility used to send messages that acknowledge that the 
+node itself has entered the kdump crash recovery service. The fence_kdump_send
+utility is typically run in the kdump kernel after a cluster node has 
+encountered a kernel panic. Once the cluster node has entered the kdump crash 
+recovery service, fence_kdump_send will periodically send messages to all 
+cluster nodes. When the fence_kdump agent receives a valid message from the 
+failed nodes, fencing is complete.
+
+How to configure Pacemaker cluster environment:
+
+If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump
+should be installed in every nodes in the cluster. You can achieve this via
+the following command:
+
+  # yum install -y fence-agents-kdump
+
+Next is to add kdump_fence to the cluster. Assuming that the cluster consists 
+of three nodes, they are node1, node2 and node3, and use Pacemaker to perform
+resource management and pcs as cli configuration tool. 
+
+With pcs it is easy to add a stonith resource to the cluster. For example, add
+a stonith resource named mykdumpfence with fence type of fence_kdump via the 
+following commands:
+  
+   # pcs stonith create mykdumpfence fence_kdump \
+     pcmk_host_check=static-list pcmk_host_list="node1 node2 node3"
+   # pcs stonith update mykdumpfence pcmk_monitor_action=metadata --force
+   # pcs stonith update mykdumpfence pcmk_status_action=metadata --force
+   # pcs stonith update mykdumpfence pcmk_reboot_action=off --force
+   
+Then enable stonith
+   # pcs property set stonith-enabled=true
+
+How to configure kdump:
+
+Actually there are two ways how to configure fence_kdump support:
+
+1) Pacemaker based clusters
+     If you have successfully configured fence_kdump in Pacemaker, there is
+     no need to add some special configuration in kdump. So please refer to
+     Kexec-Kdump-howto file for more information.
+
+2) Generic clusters
+     For other types of clusters there are two configuration options in
+     kdump.conf which enables fence_kdump support:
+
+       fence_kdump_nodes <node(s)>
+            Contains list of cluster node(s) separated by space to send
+            fence_kdump notification to (this option is mandatory to enable
+            fence_kdump)
+
+       fence_kdump_args <arg(s)>
+            Command line arguments for fence_kdump_send (it can contain
+            all valid arguments except hosts to send notification to)
+
+     These options will most probably be configured by your cluster software,
+     so please refer to your cluster documentation how to enable fence_kdump
+     support.
+
+Please be aware that these two ways cannot be combined and 2) has precedence
+over 1). It means that if fence_kdump is configured using fence_kdump_nodes
+and fence_kdump_args options in kdump.conf, Pacemaker configuration is not
+used even if it exists.
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
new file mode 100755
index 0000000..c98a43b
--- /dev/null
+++ b/kdump-lib-initramfs.sh
@@ -0,0 +1,221 @@
+# These variables and functions are useful in 2nd kernel
+
+. /lib/kdump-lib.sh
+
+KDUMP_PATH="/var/crash"
+CORE_COLLECTOR=""
+DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
+DMESG_COLLECTOR="/sbin/vmcore-dmesg"
+FAILURE_ACTION="systemctl reboot -f"
+DATEDIR=`date +%Y-%m-%d-%T`
+HOST_IP='127.0.0.1'
+DUMP_INSTRUCTION=""
+SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
+KDUMP_SCRIPT_DIR="/kdumpscripts"
+DD_BLKSIZE=512
+FINAL_ACTION="systemctl reboot -f"
+KDUMP_CONF="/etc/kdump.conf"
+KDUMP_PRE=""
+KDUMP_POST=""
+NEWROOT="/sysroot"
+OPALCORE="/sys/firmware/opal/mpipl/core"
+
+get_kdump_confs()
+{
+    local config_opt config_val
+
+    while read config_opt config_val;
+    do
+        # remove inline comments after the end of a directive.
+        case "$config_opt" in
+            path)
+                KDUMP_PATH="$config_val"
+            ;;
+            core_collector)
+                [ -n "$config_val" ] && CORE_COLLECTOR="$config_val"
+            ;;
+            sshkey)
+                if [ -f "$config_val" ]; then
+                    SSH_KEY_LOCATION=$config_val
+                fi
+            ;;
+            kdump_pre)
+                KDUMP_PRE="$config_val"
+            ;;
+            kdump_post)
+                KDUMP_POST="$config_val"
+            ;;
+            fence_kdump_args)
+                FENCE_KDUMP_ARGS="$config_val"
+            ;;
+            fence_kdump_nodes)
+                FENCE_KDUMP_NODES="$config_val"
+            ;;
+            failure_action|default)
+                case $config_val in
+                    shell)
+                        FAILURE_ACTION="kdump_emergency_shell"
+                    ;;
+                    reboot)
+                        FAILURE_ACTION="systemctl reboot -f && exit"
+                    ;;
+                    halt)
+                        FAILURE_ACTION="halt && exit"
+                    ;;
+                    poweroff)
+                        FAILURE_ACTION="systemctl poweroff -f && exit"
+                    ;;
+                    dump_to_rootfs)
+                        FAILURE_ACTION="dump_to_rootfs"
+                    ;;
+                esac
+            ;;
+            final_action)
+                case $config_val in
+                    reboot)
+                        FINAL_ACTION="systemctl reboot -f"
+                    ;;
+                    halt)
+                        FINAL_ACTION="halt"
+                    ;;
+                    poweroff)
+                        FINAL_ACTION="systemctl poweroff -f"
+                    ;;
+                esac
+            ;;
+        esac
+    done <<< "$(read_strip_comments $KDUMP_CONF)"
+
+    if [ -z "$CORE_COLLECTOR" ]; then
+        CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
+        if is_ssh_dump_target || is_raw_dump_target; then
+            CORE_COLLECTOR="$CORE_COLLECTOR -F"
+        fi
+    fi
+}
+
+# dump_fs <mount point>
+dump_fs()
+{
+    local _mp=$1
+    local _dev=$(get_mount_info SOURCE target $_mp -f)
+    local _op=$(get_mount_info OPTIONS target $_mp -f)
+
+    # If dump path have a corresponding device entry but not mounted, mount it.
+    if [ -n "$_dev" ]; then
+        if ! is_mounted "$_mp"; then
+            echo "kdump: dump target $_dev is not mounted, trying to mount..."
+            mkdir -p $_mp
+            mount -o $_op $_dev $_mp
+
+            if [ $? -ne 0 ]; then
+                echo "kdump: mounting failed (mount point: $_mp, option: $_op)"
+                return 1
+            fi
+        fi
+    else
+        echo "kdump: failed to dump to \"$_mp\", it's not a mount point!"
+        return 1
+    fi
+
+    # Remove -F in makedumpfile case. We don't want a flat format dump here.
+    [[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
+
+    local _dump_path=$(echo "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
+
+    echo "kdump: saving to $_dump_path"
+
+    # Only remount to read-write mode if the dump target is mounted read-only.
+    if [[ "$_op" = "ro"* ]]; then
+       echo "kdump: Mounting Dump target $_dev in rw mode."
+       mount -o remount,rw $_dev $_mp || return 1
+    fi
+
+    mkdir -p $_dump_path || return 1
+
+    save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_path"
+    save_opalcore_fs "$_dump_path"
+
+    echo "kdump: saving vmcore"
+    $CORE_COLLECTOR /proc/vmcore $_dump_path/vmcore-incomplete || return 1
+    mv $_dump_path/vmcore-incomplete $_dump_path/vmcore
+    sync
+
+    echo "kdump: saving vmcore complete"
+
+    # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
+    return 0
+}
+
+save_vmcore_dmesg_fs() {
+    local _dmesg_collector=$1
+    local _path=$2
+
+    echo "kdump: saving vmcore-dmesg.txt"
+    $_dmesg_collector /proc/vmcore > ${_path}/vmcore-dmesg-incomplete.txt
+    _exitcode=$?
+    if [ $_exitcode -eq 0 ]; then
+        mv ${_path}/vmcore-dmesg-incomplete.txt ${_path}/vmcore-dmesg.txt
+
+        # Make sure file is on disk. There have been instances where later
+        # saving vmcore failed and system rebooted without sync and there
+        # was no vmcore-dmesg.txt available.
+        sync
+        echo "kdump: saving vmcore-dmesg.txt complete"
+    else
+        echo "kdump: saving vmcore-dmesg.txt failed"
+    fi
+}
+
+save_opalcore_fs() {
+    local _path=$1
+
+    if [ ! -f $OPALCORE ]; then
+        # Check if we are on an old kernel that uses a different path
+        if [ -f /sys/firmware/opal/core ]; then
+            OPALCORE="/sys/firmware/opal/core"
+        else
+            return 0
+        fi
+    fi
+
+    echo "kdump: saving opalcore"
+    cp $OPALCORE ${_path}/opalcore
+    if [ $? -ne 0 ]; then
+        echo "kdump: saving opalcore failed"
+        return 1
+    fi
+
+    sync
+    echo "kdump: saving opalcore complete"
+    return 0
+}
+
+dump_to_rootfs()
+{
+
+    echo "Kdump: trying to bring up rootfs device"
+    systemctl start dracut-initqueue
+    echo "Kdump: waiting for rootfs mount, will timeout after 90 seconds"
+    systemctl start sysroot.mount
+
+    dump_fs $NEWROOT
+}
+
+kdump_emergency_shell()
+{
+    echo "PS1=\"kdump:\\\${PWD}# \"" >/etc/profile
+    /bin/dracut-emergency
+    rm -f /etc/profile
+}
+
+do_failure_action()
+{
+    echo "Kdump: Executing failure action $FAILURE_ACTION"
+    eval $FAILURE_ACTION
+}
+
+do_final_action()
+{
+    eval $FINAL_ACTION
+}
diff --git a/kdump-lib.sh b/kdump-lib.sh
new file mode 100755
index 0000000..e18c473
--- /dev/null
+++ b/kdump-lib.sh
@@ -0,0 +1,770 @@
+#!/bin/sh
+#
+# Kdump common variables and functions
+#
+
+DEFAULT_PATH="/var/crash/"
+FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
+FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
+
+is_fadump_capable()
+{
+    # Check if firmware-assisted dump is enabled
+    # if no, fallback to kdump check
+    if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
+        rc=`cat $FADUMP_ENABLED_SYS_NODE`
+        [ $rc -eq 1 ] && return 0
+    fi
+    return 1
+}
+
+perror_exit() {
+    echo $@ >&2
+    exit 1
+}
+
+perror() {
+    echo $@ >&2
+}
+
+is_fs_type_nfs()
+{
+    [ "$1" = "nfs" ] || [ "$1" = "nfs4" ]
+}
+
+is_ssh_dump_target()
+{
+    grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
+}
+
+is_nfs_dump_target()
+{
+    if grep -q "^nfs" /etc/kdump.conf; then
+        return 0;
+    fi
+
+    if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then
+        return 0
+    fi
+
+    local _save_path=$(get_save_path)
+    local _target=$(get_target_from_path $_save_path)
+    local _fstype=$(get_fs_type_from_target $_target)
+
+    if is_fs_type_nfs $_fstype; then
+        return 0
+    fi
+
+    return 1
+}
+
+is_raw_dump_target()
+{
+    grep -q "^raw" /etc/kdump.conf
+}
+
+is_fs_dump_target()
+{
+    egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
+}
+
+strip_comments()
+{
+    echo $@ | sed -e 's/\(.*\)#.*/\1/'
+}
+
+# Read from kdump config file stripping all comments
+read_strip_comments()
+{
+    # strip heading spaces, and print any content starting with
+    # neither space or #, and strip everything after #
+    sed -n -e "s/^\s*\([^# \t][^#]\+\).*/\1/gp" $1
+}
+
+# Check if fence kdump is configured in Pacemaker cluster
+is_pcs_fence_kdump()
+{
+    # no pcs or fence_kdump_send executables installed?
+    type -P pcs > /dev/null || return 1
+    [ -x $FENCE_KDUMP_SEND ] || return 1
+
+    # fence kdump not configured?
+    (pcs cluster cib | grep 'type="fence_kdump"') &> /dev/null || return 1
+}
+
+# Check if fence_kdump is configured using kdump options
+is_generic_fence_kdump()
+{
+    [ -x $FENCE_KDUMP_SEND ] || return 1
+
+    grep -q "^fence_kdump_nodes" /etc/kdump.conf
+}
+
+to_dev_name() {
+    local dev="${1//\"/}"
+
+    case "$dev" in
+    UUID=*)
+        dev=`blkid -U "${dev#UUID=}"`
+        ;;
+    LABEL=*)
+        dev=`blkid -L "${dev#LABEL=}"`
+        ;;
+    esac
+    echo $dev
+}
+
+is_user_configured_dump_target()
+{
+    grep -E -q "^ext[234]|^xfs|^btrfs|^minix|^raw|^nfs|^ssh" /etc/kdump.conf || is_mount_in_dracut_args;
+}
+
+get_user_configured_dump_disk()
+{
+    local _target
+
+    _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
+    [ -n "$_target" ] && echo $_target && return
+
+    _target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)")
+    [ -b "$_target" ] && echo $_target
+}
+
+get_root_fs_device()
+{
+    findmnt -k -f -n -o SOURCE /
+}
+
+get_save_path()
+{
+    local _save_path=$(awk '$1 == "path" {print $2}' /etc/kdump.conf)
+    [ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
+
+    # strip the duplicated "/"
+    echo $_save_path | tr -s /
+}
+
+get_block_dump_target()
+{
+    local _target _path
+
+    if is_ssh_dump_target || is_nfs_dump_target; then
+        return
+    fi
+
+    _target=$(get_user_configured_dump_disk)
+    [ -n "$_target" ] && echo $(to_dev_name $_target) && return
+
+    # Get block device name from local save path
+    _path=$(get_save_path)
+    _target=$(get_target_from_path $_path)
+    [ -b "$_target" ] && echo $(to_dev_name $_target)
+}
+
+is_dump_to_rootfs()
+{
+    grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
+}
+
+get_failure_action_target()
+{
+    local _target
+
+    if is_dump_to_rootfs; then
+        # Get rootfs device name
+        _target=$(get_root_fs_device)
+        [ -b "$_target" ] && echo $(to_dev_name $_target) && return
+        # Then, must be nfs root
+        echo "nfs"
+    fi
+}
+
+# Get kdump targets(including root in case of dump_to_rootfs).
+get_kdump_targets()
+{
+    local _target _root
+    local kdump_targets
+
+    _target=$(get_block_dump_target)
+    if [ -n "$_target" ]; then
+        kdump_targets=$_target
+    elif is_ssh_dump_target; then
+        kdump_targets="ssh"
+    else
+        kdump_targets="nfs"
+    fi
+
+    # Add the root device if dump_to_rootfs is specified.
+    _root=$(get_failure_action_target)
+    if [ -n "$_root" -a "$kdump_targets" != "$_root" ]; then
+        kdump_targets="$kdump_targets $_root"
+    fi
+
+    echo "$kdump_targets"
+}
+
+# Return the bind mount source path, return the path itself if it's not bind mounted
+# Eg. if /path/to/src is bind mounted to /mnt/bind, then:
+# /mnt/bind -> /path/to/src, /mnt/bind/dump -> /path/to/src/dump
+#
+# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir]
+# in the SOURCE column for bind-mounts, then if $_mntpoint equals to
+# $_mntpoint_nofsroot, the mountpoint is not bind mounted directory.
+#
+# Below is just an example for mount info
+# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the
+# directory is bind mounted. The former part represents the device path, rest
+# part is the bind mounted directory which quotes by bracket "[]".
+get_bind_mount_source()
+{
+    local _path=$1
+    # In case it's a sub path in a mount point, get the mount point first
+    local _mnt_top=$(df $_path | tail -1 | awk '{print $NF}')
+    local _mntpoint=$(findmnt $_mnt_top | tail -n 1 | awk '{print $2}')
+    local _mntpoint_nofsroot=$(findmnt -v $_mnt_top | tail -n 1 | awk '{print $2}')
+
+    if [[ "$_mntpoint" = $_mntpoint_nofsroot ]]; then
+        echo $_path && return
+    fi
+
+    _mntpoint=${_mntpoint#*$_mntpoint_nofsroot}
+    _mntpoint=${_mntpoint#[}
+    _mntpoint=${_mntpoint%]}
+    _path=${_path#$_mnt_top}
+
+    echo $_mntpoint$_path
+}
+
+# Return the current underlaying device of a path, ignore bind mounts
+get_target_from_path()
+{
+    local _target
+
+    _target=$(df $1 2>/dev/null | tail -1 |  awk '{print $1}')
+    [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device)
+    echo $_target
+}
+
+is_mounted()
+{
+    findmnt -k -n $1 &>/dev/null
+}
+
+get_mount_info()
+{
+    local _info_type=$1 _src_type=$2 _src=$3; shift 3
+    local _info=$(findmnt --real -k -n -r -o $_info_type --$_src_type $_src $@)
+
+    [ -z "$_info" ] && [ -e "/etc/fstab" ] && _info=$(findmnt --real -s -n -r -o $_info_type --$_src_type $_src $@)
+
+    echo $_info
+}
+
+get_fs_type_from_target()
+{
+    get_mount_info FSTYPE source $1 -f
+}
+
+get_mntopt_from_target()
+{
+    get_mount_info OPTIONS source $1 -f
+}
+# Find the general mount point of a dump target, not the bind mount point
+get_mntpoint_from_target()
+{
+    # Expcilitly specify --source to findmnt could ensure non-bind mount is returned
+    get_mount_info TARGET source $1 -f
+}
+
+# Get the path where the target will be mounted in kdump kernel
+# $1: kdump target device
+get_kdump_mntpoint_from_target()
+{
+    local _mntpoint=$(get_mntpoint_from_target $1)
+
+    # mount under /sysroot if dump to root disk or mount under
+    # mount under /kdumproot if dump target is not mounted in first kernel
+    # mount under /kdumproot/$_mntpoint in other cases in 2nd kernel.
+    # systemd will be in charge to umount it.
+    if [ -z "$_mntpoint" ];then
+        _mntpoint="/kdumproot"
+    else
+        if [ "$_mntpoint" = "/" ];then
+            _mntpoint="/sysroot"
+        else
+            _mntpoint="/kdumproot/$_mntpoint"
+        fi
+    fi
+
+    # strip duplicated "/"
+    echo $_mntpoint | tr -s "/"
+}
+
+# get_option_value <option_name>
+# retrieves value of option defined in kdump.conf
+get_option_value() {
+    strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\  -f2-`
+}
+
+kdump_get_persistent_dev() {
+    local dev="${1//\"/}"
+
+    case "$dev" in
+    UUID=*)
+        dev=`blkid -U "${dev#UUID=}"`
+        ;;
+    LABEL=*)
+        dev=`blkid -L "${dev#LABEL=}"`
+        ;;
+    esac
+    echo $(get_persistent_dev "$dev")
+}
+
+is_ipv6_address()
+{
+    echo $1 | grep -q ":"
+}
+
+# get ip address or hostname from nfs/ssh config value
+get_remote_host()
+{
+    local _config_val=$1
+
+    # ipv6 address in kdump.conf is around with "[]",
+    # factor out the ipv6 address
+    _config_val=${_config_val#*@}
+    _config_val=${_config_val%:/*}
+    _config_val=${_config_val#[}
+    _config_val=${_config_val%]}
+    echo $_config_val
+}
+
+is_hostname()
+{
+    local _hostname=`echo $1 | grep ":"`
+
+    if [ -n "$_hostname" ]; then
+        return 1
+    fi
+    echo $1 | grep -q "[a-zA-Z]"
+}
+
+# Copied from "/etc/sysconfig/network-scripts/network-functions"
+get_hwaddr()
+{
+    if [ -f "/sys/class/net/${1}/address" ]; then
+        awk '{ print toupper($0) }' < /sys/class/net/${1}/address
+    elif [ -d "/sys/class/net/${1}" ]; then
+       LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
+            awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
+                                        "\\1", 1)); }'
+    fi
+}
+
+get_ifcfg_by_device()
+{
+    grep -E -i -l "^[[:space:]]*DEVICE=\"*${1}\"*[[:space:]]*$" \
+         /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
+}
+
+get_ifcfg_by_hwaddr()
+{
+    grep -E -i -l "^[[:space:]]*HWADDR=\"*${1}\"*[[:space:]]*$" \
+         /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
+}
+
+get_ifcfg_by_uuid()
+{
+    grep -E -i -l "^[[:space:]]*UUID=\"*${1}\"*[[:space:]]*$" \
+         /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
+}
+
+get_ifcfg_by_name()
+{
+    grep -E -i -l "^[[:space:]]*NAME=\"*${1}\"*[[:space:]]*$" \
+         /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
+}
+
+is_nm_running()
+{
+    [ "$(LANG=C nmcli -t --fields running general status 2>/dev/null)" = "running" ]
+}
+
+is_nm_handling()
+{
+    LANG=C nmcli -t --fields device,state  dev status 2>/dev/null \
+          | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
+}
+
+# $1: netdev name
+get_ifcfg_nmcli()
+{
+    local nm_uuid nm_name
+    local ifcfg_file
+
+    # Get the active nmcli config name of $1
+    if is_nm_running && is_nm_handling "${1}" ; then
+        # The configuration "uuid" and "name" generated by nm is wrote to
+        # the ifcfg file as "UUID=<nm_uuid>" and "NAME=<nm_name>".
+        nm_uuid=$(LANG=C nmcli -t --fields uuid,device c show --active 2>/dev/null \
+                  | grep "${1}" | head -1 | cut -d':' -f1)
+        nm_name=$(LANG=C nmcli -t --fields name,device c show --active 2>/dev/null \
+                  | grep "${1}" | head -1 | cut -d':' -f1)
+        ifcfg_file=$(get_ifcfg_by_uuid "${nm_uuid}")
+        [ -z "${ifcfg_file}" ] && ifcfg_file=$(get_ifcfg_by_name "${nm_name}")
+    fi
+
+    echo -n "${ifcfg_file}"
+}
+
+# $1: netdev name
+get_ifcfg_legacy()
+{
+    local ifcfg_file
+
+    ifcfg_file="/etc/sysconfig/network-scripts/ifcfg-${1}"
+    [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
+
+    ifcfg_file=$(get_ifcfg_by_name "${1}")
+    [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
+
+    local hwaddr=$(get_hwaddr "${1}")
+    if [ -n "$hwaddr" ]; then
+        ifcfg_file=$(get_ifcfg_by_hwaddr "${hwaddr}")
+        [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
+    fi
+
+    ifcfg_file=$(get_ifcfg_by_device "${1}")
+
+    echo -n "${ifcfg_file}"
+}
+
+# $1: netdev name
+# Return the ifcfg file whole name(including the path) of $1 if any.
+get_ifcfg_filename() {
+    local ifcfg_file
+
+    ifcfg_file=$(get_ifcfg_nmcli "${1}")
+    if [ -z "${ifcfg_file}" ]; then
+        ifcfg_file=$(get_ifcfg_legacy "${1}")
+    fi
+
+    echo -n "${ifcfg_file}"
+}
+
+# returns 0 when omission of watchdog module is desired in dracut_args
+# returns 1 otherwise
+is_wdt_mod_omitted() {
+	local dracut_args
+	local ret=1
+
+	dracut_args=$(grep  "^dracut_args" /etc/kdump.conf)
+	[[ -z $dracut_args ]] && return $ret
+
+	eval set -- $dracut_args
+	while :; do
+		[[ -z $1 ]] && break
+		case $1 in
+			-o|--omit)
+				echo $2 | grep -qw "watchdog"
+				[[ $? == 0 ]] && ret=0
+				break
+		esac
+		shift
+	done
+
+	return $ret
+}
+
+# If "dracut_args" contains "--mount" information, use it
+# directly without any check(users are expected to ensure
+# its correctness).
+is_mount_in_dracut_args()
+{
+    grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf
+}
+
+# If $1 contains dracut_args "--mount", return <filesystem type>
+get_dracut_args_fstype()
+{
+    echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3
+}
+
+# If $1 contains dracut_args "--mount", return <device>
+get_dracut_args_target()
+{
+    echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
+}
+
+check_crash_mem_reserved()
+{
+    local mem_reserved
+
+    mem_reserved=$(cat /sys/kernel/kexec_crash_size)
+    if [ $mem_reserved -eq 0 ]; then
+        echo "No memory reserved for crash kernel"
+        return 1
+    fi
+
+    return 0
+}
+
+check_kdump_feasibility()
+{
+    if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
+        echo "Kdump is not supported on this kernel"
+        return 1
+    fi
+    check_crash_mem_reserved
+    return $?
+}
+
+check_current_kdump_status()
+{
+    if [ ! -f /sys/kernel/kexec_crash_loaded ];then
+        echo "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel"
+        return 1
+    fi
+
+    rc=`cat /sys/kernel/kexec_crash_loaded`
+    if [ $rc == 1 ]; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
+# Remove a list of kernel parameters from a given kernel cmdline and print the result.
+# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
+remove_cmdline_param()
+{
+    local cmdline=$1
+    shift
+
+    for arg in $@; do
+        cmdline=`echo $cmdline | \
+                 sed -e "s/\b$arg=[^ ]*//g" \
+                 -e "s/^$arg\b//g" \
+                 -e "s/[[:space:]]$arg\b//g" \
+                 -e "s/\s\+/ /g"`
+    done
+    echo $cmdline
+}
+
+#
+# This function returns the "apicid" of the boot
+# cpu (cpu 0) if present.
+#
+get_bootcpu_apicid()
+{
+    awk '                                                       \
+        BEGIN { CPU = "-1"; }                                   \
+        $1=="processor" && $2==":"      { CPU = $NF; }          \
+        CPU=="0" && /^apicid/           { print $NF; }          \
+        '                                                       \
+        /proc/cpuinfo
+}
+
+#
+# append_cmdline <kernel cmdline> <parameter name> <parameter value>
+# This function appends argument "$2=$3" to string ($1) if not already present.
+#
+append_cmdline()
+{
+    local cmdline=$1
+    local newstr=${cmdline/$2/""}
+
+    # unchanged str implies argument wasn't there
+    if [ "$cmdline" == "$newstr" ]; then
+        cmdline="${cmdline} ${2}=${3}"
+    fi
+
+    echo $cmdline
+}
+
+# This function check iomem and determines if we have more than
+# 4GB of ram available. Returns 1 if we do, 0 if we dont
+need_64bit_headers()
+{
+    return `tail -n 1 /proc/iomem | awk '{ split ($1, r, "-"); \
+    print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'`
+}
+
+# Check if secure boot is being enforced.
+#
+# Per Peter Jones, we need check efivar SecureBoot-$(the UUID) and
+# SetupMode-$(the UUID), they are both 5 bytes binary data. The first four
+# bytes are the attributes associated with the variable and can safely be
+# ignored, the last bytes are one-byte true-or-false variables. If SecureBoot
+# is 1 and SetupMode is 0, then secure boot is being enforced.
+#
+# Assume efivars is mounted at /sys/firmware/efi/efivars.
+is_secure_boot_enforced()
+{
+    local secure_boot_file setup_mode_file
+    local secure_boot_byte setup_mode_byte
+
+    # On powerpc, os-secureboot-enforcing DT property indicates whether secureboot
+    # is enforced. Return success, if it is found.
+    if [ -f /proc/device-tree/ibm,secureboot/os-secureboot-enforcing ]; then
+		return 0
+    fi
+
+    secure_boot_file=$(find /sys/firmware/efi/efivars -name SecureBoot-* 2>/dev/null)
+    setup_mode_file=$(find /sys/firmware/efi/efivars -name SetupMode-* 2>/dev/null)
+
+    if [ -f "$secure_boot_file" ] && [ -f "$setup_mode_file" ]; then
+        secure_boot_byte=$(hexdump -v -e '/1 "%d\ "' $secure_boot_file|cut -d' ' -f 5)
+        setup_mode_byte=$(hexdump -v -e '/1 "%d\ "' $setup_mode_file|cut -d' ' -f 5)
+
+        if [ "$secure_boot_byte" = "1" ] && [ "$setup_mode_byte" = "0" ]; then
+            return 0
+        fi
+    fi
+
+    return 1
+}
+
+#
+# prepare_kexec_args <kexec args>
+# This function prepares kexec argument.
+#
+prepare_kexec_args()
+{
+    local kexec_args=$1
+    local found_elf_args
+
+    ARCH=`uname -m`
+    if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]
+    then
+        need_64bit_headers
+        if [ $? == 1 ]
+        then
+            found_elf_args=`echo $kexec_args | grep elf32-core-headers`
+            if [ -n "$found_elf_args" ]
+            then
+                echo -n "Warning: elf32-core-headers overrides correct elf64 setting"
+                echo
+            else
+                kexec_args="$kexec_args --elf64-core-headers"
+            fi
+        else
+            found_elf_args=`echo $kexec_args | grep elf64-core-headers`
+            if [ -z "$found_elf_args" ]
+            then
+                kexec_args="$kexec_args --elf32-core-headers"
+            fi
+        fi
+    fi
+    echo $kexec_args
+}
+
+#
+# Detect initrd and kernel location, results are stored in global enviromental variables:
+# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
+#
+# Expectes KDUMP_BOOTDIR, KDUMP_IMG, KDUMP_IMG_EXT, KDUMP_KERNELVER to be loaded from config already
+# and will prefer already set values so user can specify custom kernel/initramfs location
+#
+prepare_kdump_bootinfo()
+{
+    local boot_imglist boot_dirlist boot_initrdlist curr_kver="$(uname -r)"
+    local machine_id
+
+    if [ -z "$KDUMP_KERNELVER"]; then
+        KDUMP_KERNELVER="$(uname -r)"
+    fi
+
+    read machine_id < /etc/machine-id
+    boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
+    boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
+
+    # Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
+    local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
+    if [ -n "$boot_img" ]; then
+        boot_imglist="$boot_img $boot_imglist"
+    fi
+
+    for dir in $boot_dirlist; do
+        for img in $boot_imglist; do
+            if [ -f "$dir/$img" ]; then
+                KDUMP_KERNEL=$(echo $dir/$img | tr -s '/')
+                break 2
+            fi
+        done
+    done
+
+    if ! [ -e "$KDUMP_KERNEL" ]; then
+        echo "Failed to detect kdump kernel location"
+        return 1
+    fi
+
+    # Set KDUMP_BOOTDIR to where kernel image is stored
+    KDUMP_BOOTDIR=$(dirname $KDUMP_KERNEL)
+
+    # Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
+    boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
+    for initrd in $boot_initrdlist; do
+        if [ -f "$KDUMP_BOOTDIR/$initrd" ]; then
+            DEFAULT_INITRD="$KDUMP_BOOTDIR/$initrd"
+            break
+        fi
+    done
+
+    # Get kdump initrd from default initrd filename
+    # initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
+    # initrd => initrdkdump
+    if [[ -z "$DEFAULT_INITRD" ]]; then
+        KDUMP_INITRD=${KDUMP_BOOTDIR}/initramfs-${KDUMP_KERNELVER}kdump.img
+    elif [[ $(basename $DEFAULT_INITRD) == *.* ]]; then
+        KDUMP_INITRD=${DEFAULT_INITRD%.*}kdump.${DEFAULT_INITRD##*.}
+    else
+        KDUMP_INITRD=${DEFAULT_INITRD}kdump
+    fi
+}
+
+#
+# prepare_cmdline <commandline> <commandline remove> <commandline append>
+# This function performs a series of edits on the command line.
+# Store the final result in global $KDUMP_COMMANDLINE.
+prepare_cmdline()
+{
+    local cmdline id
+
+    if [ -z "$1" ]; then
+        cmdline=$(cat /proc/cmdline)
+    else
+        cmdline="$1"
+    fi
+
+    # These params should always be removed
+    cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn)
+    # These params can be removed configurably
+    cmdline=$(remove_cmdline_param "$cmdline" "$2")
+
+    # Always remove "root=X", as we now explicitly generate all kinds
+    # of dump target mount information including root fs.
+    #
+    # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
+    # about it(e.g. for debug purpose), then can pass "root=X" using
+    # KDUMP_COMMANDLINE_APPEND.
+    cmdline=$(remove_cmdline_param "$cmdline" root)
+
+    # With the help of "--hostonly-cmdline", we can avoid some interitage.
+    cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe)
+
+    # Remove netroot, rd.iscsi.initiator and iscsi_initiator since
+    # we get duplicate entries for the same in case iscsi code adds
+    # it as well.
+    cmdline=$(remove_cmdline_param "$cmdline" netroot rd.iscsi.initiator iscsi_initiator)
+
+    cmdline="${cmdline} $3"
+
+    id=$(get_bootcpu_apicid)
+    if [ ! -z ${id} ] ; then
+        cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id})
+    fi
+    echo ${cmdline}
+}
diff --git a/kdump-udev-throttler b/kdump-udev-throttler
new file mode 100755
index 0000000..cd77a31
--- /dev/null
+++ b/kdump-udev-throttler
@@ -0,0 +1,42 @@
+#!/bin/bash
+# This util helps to reduce the workload of kdump service restarting
+# on udev event. When hotplugging memory / CPU, multiple udev
+# events may be triggered concurrently, and obviously, we don't want
+# to restart kdump service for each event.
+
+# This script will be called by udev, and make sure kdump service is
+# restart after all events we are watching are settled.
+
+# On each call, this script will update try to aquire the $throttle_lock
+# The first instance acquired the file lock will keep waiting for events
+# to settle and then reload kdump. Other instances will just exit
+# In this way, we can make sure kdump service is restarted immediately
+# and for exactly once after udev events are settled.
+
+throttle_lock="/var/lock/kdump-udev-throttle"
+
+exec 9>$throttle_lock
+if [ $? -ne 0 ]; then
+        echo "Failed to create the lock file! Fallback to non-throttled kdump service restart"
+        /bin/kdumpctl reload
+        exit 1
+fi
+
+flock -n 9
+if [ $? -ne 0 ]; then
+        echo "Throttling kdump restart for concurrent udev event"
+        exit 0
+fi
+
+# Wait for at least 1 second, at most 4 seconds for udev to settle
+# Idealy we will have a less than 1 second lag between udev events settle
+# and kdump reload
+sleep 1 && udevadm settle --timeout 3
+
+# Release the lock, /bin/kdumpctl will block and make the process
+# holding two locks at the same time and we might miss some events
+exec 9>&-
+
+/bin/kdumpctl reload
+
+exit 0
diff --git a/kdump.conf b/kdump.conf
new file mode 100644
index 0000000..9fc0a4f
--- /dev/null
+++ b/kdump.conf
@@ -0,0 +1,183 @@
+# This file contains a series of commands to perform (in order) in the kdump
+# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
+#
+# Directives in this file are only applicable to the kdump initramfs, and have
+# no effect once the root filesystem is mounted and the normal init scripts are
+# processed.
+#
+# Currently, only one dump target and path can be specified.  If the dumping to
+# the configured target fails, the failure action which can be configured via
+# the "failure_action" directive will be performed.
+#
+# Supported options:
+#
+# raw <partition>
+#           - Will dd /proc/vmcore into <partition>.
+#             Use persistent device names for partition devices,
+#             such as /dev/vg/<devname>.
+#
+# nfs <nfs mount>
+#           - Will mount nfs to <mnt>, and copy /proc/vmcore to
+#             <mnt>/<path>/%HOST-%DATE/, supports DNS.
+#
+# ssh <user@server>
+#           - Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
+#             supports DNS.
+#             NOTE: make sure the user has write permissions on the server.
+#
+# sshkey <path>
+#           - Will use the sshkey to do ssh dump.
+#             Specify the path of the ssh key to use when dumping
+#             via ssh. The default value is /root/.ssh/kdump_id_rsa.
+#
+# <fs type> <partition>
+#           - Will mount -t <fs type> <partition> <mnt>, and copy
+#             /proc/vmcore to <mnt>/<path>/%HOST_IP-%DATE/.
+#             NOTE: <partition> can be a device node, label or uuid.
+#             It's recommended to use persistent device names
+#             such as /dev/vg/<devname>.
+#             Otherwise it's suggested to use label or uuid.
+#
+# path <path>
+#           - "path" represents the file system path in which vmcore
+#             will be saved.  If a dump target is specified in
+#             kdump.conf, then "path" is relative to the specified
+#             dump target.
+#
+#             Interpretation of "path" changes a bit if the user didn't
+#             specify any dump target explicitly in kdump.conf.  In this
+#             case, "path" represents the absolute path from root. The
+#             dump target and adjusted path are arrived at automatically
+#             depending on what's mounted in the current system.
+#
+#             Ignored for raw device dumps.  If unset, will use the default
+#             "/var/crash".
+#
+# core_collector <command> <options>
+#           - This allows you to specify the command to copy
+#             the vmcore.  The default is makedumpfile, which on
+#             some architectures can drastically reduce vmcore size.
+#             See /sbin/makedumpfile --help for a list of options.
+#             Note that the -i and -g options are not needed here,
+#             as the initrd will automatically be populated with a
+#             config file appropriate for the running kernel.
+#             The default core_collector for raw/ssh dump is:
+#             "makedumpfile -F -l --message-level 1 -d 31".
+#             The default core_collector for other targets is:
+#             "makedumpfile -l --message-level 1 -d 31".
+#
+#             "makedumpfile -F" will create a flattened vmcore.
+#             You need to use "makedumpfile -R" to rearrange the dump data to
+#             a normal dumpfile readable with analysis tools.  For example:
+#             "makedumpfile -R vmcore < vmcore.flat".
+#
+#             For core_collector format details, you can refer to
+#             kexec-kdump-howto.txt or kdump.conf manpage.
+#
+# kdump_post <binary | script>
+#           - This directive allows you to run a executable binary
+#             or script after the vmcore dump process terminates.
+#             The exit status of the current dump process is fed to
+#             the executable binary or script as its first argument.
+#             All files under /etc/kdump/post.d are collectively sorted
+#             and executed in lexical order, before binary or script
+#             specified kdump_post parameter is executed.
+#
+# kdump_pre <binary | script>
+#           - Works like the "kdump_post" directive, but instead of running
+#             after the dump process, runs immediately before it.
+#             Exit status of this binary is interpreted as follows:
+#               0 - continue with dump process as usual
+#               non 0 - run the final action (reboot/poweroff/halt)
+#             All files under /etc/kdump/pre.d are collectively sorted and
+#             executed in lexical order, after binary or script specified
+#             kdump_pre parameter is executed.
+#             Even if the binary or script in /etc/kdump/pre.d directory
+#             returns non 0 exit status, the processing is continued.
+#
+# extra_bins <binaries | shell scripts>
+#           - This directive allows you to specify additional binaries or
+#             shell scripts to be included in the kdump initrd.
+#             Generally they are useful in conjunction with a kdump_post
+#             or kdump_pre binary or script which depends on these extra_bins.
+#
+# extra_modules <module(s)>
+#           - This directive allows you to specify extra kernel modules
+#             that you want to be loaded in the kdump initrd.
+#             Multiple modules can be listed, separated by spaces, and any
+#             dependent modules will automatically be included.
+#
+# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
+#           - Action to perform in case dumping fails.
+#             reboot:   Reboot the system.
+#             halt:     Halt the system.
+#             poweroff: Power down the system.
+#             shell:    Drop to a bash shell.
+#                       Exiting the shell reboots the system by default,
+#                       or perform "final_action".
+#             dump_to_rootfs:  Dump vmcore to rootfs from initramfs context and
+#                       reboot by default or perform "final_action".
+#                       Useful when non-root dump target is specified.
+#             The default option is "reboot".
+#
+# default <reboot | halt | poweroff | shell | dump_to_rootfs>
+#           - Same as the "failure_action" directive above, but this directive
+#             is obsolete and will be removed in the future.
+#
+# final_action <reboot | halt | poweroff>
+#           - Action to perform in case dumping succeeds. Also performed
+#             when "shell" or "dump_to_rootfs" failure action finishes.
+#             Each action is same as the "failure_action" directive above.
+#             The default is "reboot".
+#
+# force_rebuild <0 | 1>
+#           - By default, kdump initrd will only be rebuilt when necessary.
+#             Specify 1 to force rebuilding kdump initrd every time when kdump
+#             service starts.
+#
+# force_no_rebuild <0 | 1>
+#           - By default, kdump initrd will be rebuilt when necessary.
+#             Specify 1 to bypass rebuilding of kdump initrd.
+#
+#             force_no_rebuild and force_rebuild options are mutually
+#             exclusive and they should not be set to 1 simultaneously.
+#
+# override_resettable <0 | 1>
+#           - Usually an unresettable block device can't be a dump target.
+#             Specifying 1 when you want to dump even though the block
+#             target is unresettable
+#             By default, it is 0, which will not try dumping destined to fail.
+#
+# dracut_args <arg(s)>
+#           - Pass extra dracut options when rebuilding kdump initrd.
+#
+# fence_kdump_args <arg(s)>
+#           - Command line arguments for fence_kdump_send (it can contain
+#             all valid arguments except hosts to send notification to).
+#
+# fence_kdump_nodes <node(s)>
+#           - List of cluster node(s) except localhost, separated by spaces,
+#             to send fence_kdump notifications to.
+#             (this option is mandatory to enable fence_kdump).
+#
+
+#raw /dev/vg/lv_kdump
+#ext4 /dev/vg/lv_kdump
+#ext4 LABEL=/boot
+#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
+#nfs my.server.com:/export/tmp
+#ssh user@my.server.com
+#sshkey /root/.ssh/kdump_id_rsa
+path /var/crash
+core_collector makedumpfile -l --message-level 1 -d 31
+#core_collector scp
+#kdump_post /var/crash/scripts/kdump-post.sh
+#kdump_pre /var/crash/scripts/kdump-pre.sh
+#extra_bins /usr/bin/lftp
+#extra_modules gfs2
+#failure_action shell
+#force_rebuild 1
+#force_no_rebuild 1
+#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
+#fence_kdump_args -p 7410 -f auto -c 0 -i 10
+#fence_kdump_nodes node1 node2
diff --git a/kdump.conf.5 b/kdump.conf.5
new file mode 100644
index 0000000..34c996c
--- /dev/null
+++ b/kdump.conf.5
@@ -0,0 +1,370 @@
+.TH KDUMP.CONF 5 "07/23/2008" "kexec-tools"
+
+.SH NAME
+kdump.conf \- configuration file for kdump kernel.
+
+.SH DESCRIPTION 
+
+kdump.conf is a configuration file for the kdump kernel crash
+collection service.
+
+kdump.conf provides post-kexec instructions to the kdump kernel. It is
+stored in the initrd file managed by the kdump service. If you change
+this file and do not want to reboot in order for the changes to take
+effect, restart the kdump service to rebuild the initrd.
+
+For most configurations, you can simply review the examples provided
+in the stock /etc/kdump.conf.
+
+.B NOTE: 
+For filesystem dumps the dump target must be mounted before building
+kdump initramfs.
+
+kdump.conf only affects the behavior of the initramfs.  Please read the
+kdump operational flow section of kexec-kdump-howto.txt in the docs to better
+understand how this configuration file affects the behavior of kdump.
+
+.SH OPTIONS
+
+.B raw <partition>
+.RS
+Will dd /proc/vmcore into <partition>.  Use persistent device names for
+partition devices, such as /dev/vg/<devname>.
+.RE
+
+.B nfs <nfs mount>
+.RS
+Will mount nfs to <mnt>, and copy /proc/vmcore to <mnt>/<path>/%HOST-%DATE/,
+supports DNS. Note that a fqdn should be used as the server name in the 
+mount point.
+.RE
+
+.B ssh <user@server>
+.RS
+Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
+supports DNS. NOTE: make sure user has necessary write permissions on
+server and that a fqdn is used as the server name.
+.RE
+
+.B sshkey <path>
+.RS
+Specify the path of the ssh key to use when dumping via ssh.
+The default value is /root/.ssh/kdump_id_rsa.
+.RE
+
+.B <fs type> <partition>
+.RS
+Will mount -t <fs type> <partition> <mnt>, and copy /proc/vmcore to
+<mnt>/<path>/%HOST_IP-%DATE/.  NOTE: <partition> can be a device node, label
+or uuid.  It's recommended to use persistent device names such as
+/dev/vg/<devname>.  Otherwise it's suggested to use label or uuid.
+.RE
+
+.B path <path>
+.RS
+"path" represents the file system path in which vmcore will be saved.
+If a dump target is specified in kdump.conf, then "path" is relative to the
+specified dump target.
+.PP
+Interpretation of "path" changes a bit if the user didn't specify any dump
+target explicitly in kdump.conf. In this case, "path" represents the
+absolute path from root.  The dump target and adjusted path are arrived
+at automatically depending on what's mounted in the current system.
+.PP
+Ignored for raw device dumps.  If unset, will use the default "/var/crash".
+.RE
+
+.B core_collector <command> <options>
+.RS
+This allows you to specify the command to copy the vmcore.
+The default is makedumpfile, which on some architectures can drastically reduce
+core file size. See /sbin/makedumpfile --help for a list of options.
+Note that the -i and -g options are not needed here, as the initrd
+will automatically be populated with a config file appropriate
+for the running kernel.
+.PP
+Note 1: About default core collector:
+The default core_collector for raw/ssh dump is:
+"makedumpfile -F -l --message-level 1 -d 31".
+The default core_collector for other targets is:
+"makedumpfile -l --message-level 1 -d 31".
+Even if core_collector option is commented out in kdump.conf, makedumpfile
+is the default core collector and kdump uses it internally.
+If one does not want makedumpfile as default core_collector, then they
+need to specify one using core_collector option to change the behavior.
+.PP
+Note 2: If "makedumpfile -F" is used then you will get a flattened format
+vmcore.flat, you will need to use "makedumpfile -R" to rearrange the
+dump data from standard input to a normal dumpfile (readable with analysis
+tools).
+ie. "makedumpfile -R vmcore < vmcore.flat"
+
+.RE
+
+.B kdump_post <binary | script>
+.RS
+This directive allows you to run a specified executable
+just after the vmcore dump process terminates.  The exit
+status of the current dump process is fed to the kdump_post
+executable as its first argument($1).  Executable can modify
+it to indicate the new exit status of succeeding dump process,
+.PP
+All files under /etc/kdump/post.d are collectively sorted
+and executed in lexical order, before binary or script
+specified kdump_post parameter is executed.
+.PP
+Note that scripts written for use with this directive must use
+the /bin/bash interpreter.
+.RE
+
+.B kdump_pre <binary | script>
+.RS
+Works just like the "kdump_post" directive, but instead
+of running after the dump process, runs immediately
+before.  Exit status of this binary is interpreted
+as follows:
+.PP
+0 - continue with dump process as usual
+.PP
+non 0 - run the final action (reboot/poweroff/halt)
+.PP
+All files under /etc/kdump/pre.d are collectively sorted and
+executed in lexical order, after binary or script specified
+kdump_pre parameter is executed.
+Even if the binary or script in /etc/kdump/pre.d directory
+returns non 0 exit status, the processing is continued.
+.PP
+Note that scripts written for this directive must use
+the /bin/bash interpreter.
+.RE
+
+.B extra_bins <binaries | shell scripts>
+.RS
+This directive allows you to specify additional
+binaries or shell scripts you'd like to include in
+your kdump initrd. Generally only useful in
+conjunction with a kdump_post binary or script that
+relies on other binaries or scripts.
+.RE
+
+.B extra_modules <module(s)>
+.RS
+This directive allows you to specify extra kernel
+modules that you want to be loaded in the kdump
+initrd, typically used to set up access to
+non-boot-path dump targets that might otherwise
+not be accessible in the kdump environment. Multiple
+modules can be listed, separated by spaces, and any
+dependent modules will automatically be included.
+.RE
+
+.B failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
+.RS
+Action to perform in case dumping to the intended target fails. The default is "reboot".
+reboot: Reboot the system (this is what most people will want, as it returns the system
+to a normal state).  halt: Halt the system and lose the vmcore.  poweroff: The system
+will be powered down.  shell: Drop to a shell session inside the initramfs, from which
+you can manually perform additional recovery actions.  Exiting this shell reboots the
+system by default or performs "final_action".
+Note: kdump uses bash as the default shell.  dump_to_rootfs: If non-root dump
+target is specified, the failure action can be set as dump_to_rootfs.  That means when
+dumping to target fails, dump vmcore to rootfs from initramfs context and reboot
+by default or perform "final_action".
+.RE
+
+.B default <reboot | halt | poweroff | shell | dump_to_rootfs>
+.RS
+Same as the "failure_action" directive above, but this directive is obsolete
+and will be removed in the future.
+.RE
+
+.B final_action <reboot | halt | poweroff>
+.RS
+Action to perform in case dumping to the intended target succeeds.
+Also performed when "shell" or "dump_to_rootfs" failure action finishes.
+Each action is same as the "failure_action" directive above.
+The default is "reboot".
+.RE
+
+.B force_rebuild <0 | 1>
+.RS
+By default, kdump initrd will only be rebuilt when necessary.
+Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
+.RE
+
+.B force_no_rebuild <0 | 1>
+.RS
+By default, kdump initrd will be rebuilt when necessary.
+Specify 1 to bypass rebuilding of kdump initrd.
+
+.PP
+force_no_rebuild and force_rebuild options are mutually exclusive and
+they should not be set to 1 simultaneously.
+.RE
+
+.B override_resettable <0 | 1>
+.RS
+Usually an unresettable block device can't be a dump target. Specifying 1 means
+that even though the block target is unresettable, the user wants to try dumping anyway.
+By default, it's set to 0, which will not try something destined to fail.
+.RE
+
+
+.B dracut_args <arg(s)>
+.RS
+Kdump uses dracut to generate initramfs for second kernel. This option
+allows a user to pass arguments to dracut directly.
+.RE
+
+
+.B fence_kdump_args <arg(s)>
+.RS
+Command line arguments for fence_kdump_send (it can contain all valid
+arguments except hosts to send notification to).
+.RE
+
+
+.B fence_kdump_nodes <node(s)>
+.RS
+List of cluster node(s) except localhost, separated by spaces, to send fence_kdump notification
+to (this option is mandatory to enable fence_kdump).
+.RE
+
+
+.SH DEPRECATED OPTIONS
+
+.B net <nfs mount>|<user@server>
+.RS
+net option is replaced by nfs and ssh options. Use nfs or ssh options
+directly.
+.RE
+
+.B options <module> <option list>
+.RS
+Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add module options as
+kernel command line parameters. For example, specify 'loop.max_loop=1' to limit
+maximum loop devices to 1.
+.RE
+
+.B link_delay <seconds>
+.RS
+link_delay was used to wait for a network device to initialize before using it.
+Now dracut network module takes care of this issue automatically.
+.RE
+
+.B disk_timeout <seconds>
+.RS
+Similar to link_delay, dracut ensures disks are ready before kdump uses them.
+.RE
+
+.B debug_mem_level <0-3>
+.RS
+Turn on verbose debug output of kdump scripts regarding free/used memory at
+various points of execution.  This feature has been
+moved to dracut now.
+Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump and
+append dracut cmdline param rd.memdebug=[0-3] to enable the debug output.
+
+Higher level means more debugging output.
+.PP
+0 - no output
+.PP
+1 - partial /proc/meminfo
+.PP
+2 - /proc/meminfo
+.PP
+3 - /proc/meminfo + /proc/slabinfo
+.RE
+
+.B blacklist <list of kernel modules>
+.RS
+blacklist option was recently being used to prevent loading modules in
+initramfs. General terminology for blacklist has been that module is
+present in initramfs but it is not actually loaded in kernel. Hence
+retaining blacklist option creates more confusing behavior. It has been
+deprecated.
+.PP
+Instead, use rd.driver.blacklist option on second kernel to blacklist
+a certain module. One can edit /etc/sysconfig/kdump.conf and edit
+KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer
+to dracut.cmdline man page for more details on module blacklist option.
+.RE
+
+.RE
+
+.SH EXAMPLES
+Here are some examples for core_collector option:
+.PP
+Core collector command format depends on dump target type. Typically for
+filesystem (local/remote), core_collector should accept two arguments.
+First one is source file and second one is target file. For ex.
+.TP
+ex1.
+core_collector "cp --sparse=always"
+
+Above will effectively be translated to:
+
+cp --sparse=always /proc/vmcore <dest-path>/vmcore
+.TP
+ex2.
+core_collector "makedumpfile -l --message-level 1 -d 31"
+
+Above will effectively be translated to:
+
+makedumpfile -l --message-level 1 -d 31 /proc/vmcore <dest-path>/vmcore
+.PP
+For dump targets like raw and ssh, in general, core collector should expect
+one argument (source file) and should output the processed core on standard
+output (There is one exception of "scp", discussed later). This standard
+output will be saved to destination using appropriate commands.
+
+raw dumps examples:
+.TP
+ex3.
+core_collector "cat"
+
+Above will effectively be translated to.
+
+cat /proc/vmcore | dd of=<target-device>
+.TP
+ex4.
+core_collector "makedumpfile -F -l --message-level 1 -d 31"
+
+Above will effectively be translated to.
+
+makedumpfile -F -l --message-level 1 -d 31 | dd of=<target-device>
+.PP
+ssh dumps examples
+.TP
+ex5.
+core_collector "cat"
+
+Above will effectively be translated to.
+
+cat /proc/vmcore | ssh <options> <remote-location> "dd of=path/vmcore"
+.TP
+ex6.
+core_collector "makedumpfile -F -l --message-level 1 -d 31"
+
+Above will effectively be translated to.
+
+makedumpfile -F -l --message-level 1 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore"
+
+There is one exception to standard output rule for ssh dumps. And that is
+scp. As scp can handle ssh destinations for file transfers, one can
+specify "scp" as core collector for ssh targets (no output on stdout).
+.TP
+ex7.
+core_collector "scp"
+
+Above will effectively be translated to.
+
+scp /proc/vmcore <user@host>:path/vmcore
+
+.PP
+examples for other options please see
+.I /etc/kdump.conf
+
+.SH SEE ALSO
+
+kexec(8) mkdumprd(8) dracut.cmdline(7)
diff --git a/kdump.service b/kdump.service
new file mode 100644
index 0000000..f888dd6
--- /dev/null
+++ b/kdump.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Crash recovery kernel arming
+After=network.target network-online.target remote-fs.target basic.target
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/kdumpctl start
+ExecStop=/usr/bin/kdumpctl stop
+ExecReload=/usr/bin/kdumpctl reload
+RemainAfterExit=yes
+StartLimitInterval=0
+
+[Install]
+WantedBy=multi-user.target
diff --git a/kdump.sysconfig b/kdump.sysconfig
new file mode 100644
index 0000000..ffc387a
--- /dev/null
+++ b/kdump.sysconfig
@@ -0,0 +1,37 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS=""
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64
new file mode 100644
index 0000000..6f55c03
--- /dev/null
+++ b/kdump.sysconfig.aarch64
@@ -0,0 +1,37 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS=""
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
new file mode 100644
index 0000000..45f6d50
--- /dev/null
+++ b/kdump.sysconfig.i386
@@ -0,0 +1,40 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS=""
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
+
+#What is the images extension.  Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
new file mode 100644
index 0000000..8dcbe60
--- /dev/null
+++ b/kdump.sysconfig.ppc64
@@ -0,0 +1,42 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS="--dt-no-old-root"
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
+
+#What is the images extension.  Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
+
+#Specify the action after failure
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
new file mode 100644
index 0000000..8dcbe60
--- /dev/null
+++ b/kdump.sysconfig.ppc64le
@@ -0,0 +1,42 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS="--dt-no-old-root"
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
+
+#What is the images extension.  Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
+
+#Specify the action after failure
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
new file mode 100644
index 0000000..2a24688
--- /dev/null
+++ b/kdump.sysconfig.s390x
@@ -0,0 +1,43 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
+
+# Any additional /sbin/mkdumprd arguments required.
+MKDUMPRD_ARGS=""
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS=""
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
+
+#What is the images extension.  Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
new file mode 100644
index 0000000..f67d999
--- /dev/null
+++ b/kdump.sysconfig.x86_64
@@ -0,0 +1,40 @@
+# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
+# If no version is specified, then the init script will try to find a
+# kdump kernel with the same version number as the running kernel.
+KDUMP_KERNELVER=""
+
+# The kdump commandline is the command line that needs to be passed off to
+# the kdump kernel.  This will likely match the contents of the grub kernel
+# line.  For example:
+#   KDUMP_COMMANDLINE="ro root=LABEL=/"
+# Dracut depends on proper root= options, so please make sure that appropriate
+# root= options are copied from /proc/cmdline. In general it is best to append
+# command line options using "KDUMP_COMMANDLINE_APPEND=".
+# If a command line is not specified, the default will be taken from
+# /proc/cmdline
+KDUMP_COMMANDLINE=""
+
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
+
+# This variable lets us append arguments to the current kdump commandline
+# after processed by KDUMP_COMMANDLINE_REMOVE
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd"
+
+# Any additional kexec arguments required.  In most situations, this should
+# be left empty
+#
+# Example:
+#   KEXEC_ARGS="--elf32-core-headers"
+KEXEC_ARGS=""
+
+#Where to find the boot image
+#KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG="vmlinuz"
+
+#What is the images extension.  Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
diff --git a/kdumpctl b/kdumpctl
new file mode 100755
index 0000000..2248da4
--- /dev/null
+++ b/kdumpctl
@@ -0,0 +1,1311 @@
+#!/bin/bash
+KEXEC=/sbin/kexec
+
+KDUMP_KERNELVER=""
+KDUMP_KERNEL=""
+KDUMP_COMMANDLINE=""
+KEXEC_ARGS=""
+KDUMP_CONFIG_FILE="/etc/kdump.conf"
+MKDUMPRD="/sbin/mkdumprd -f"
+DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
+SAVE_PATH=/var/crash
+SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
+INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum"
+DUMP_TARGET=""
+DEFAULT_INITRD=""
+DEFAULT_INITRD_BAK=""
+KDUMP_INITRD=""
+TARGET_INITRD=""
+FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
+#kdump shall be the default dump mode
+DEFAULT_DUMP_MODE="kdump"
+image_time=0
+
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
+. /lib/kdump/kdump-lib.sh
+
+standard_kexec_args="-p"
+
+# Some default values in case /etc/sysconfig/kdump doesn't include
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
+if [ -f /etc/sysconfig/kdump ]; then
+	. /etc/sysconfig/kdump
+fi
+
+single_instance_lock()
+{
+	local rc timeout=5
+
+	exec 9>/var/lock/kdump
+	if [ $? -ne 0 ]; then
+		echo "Create file lock failed"
+		exit 1
+	fi
+
+	flock -n 9
+	rc=$?
+
+	while [ $rc -ne 0 ]; do
+		echo "Another app is currently holding the kdump lock; waiting for it to exit..."
+		flock -w $timeout 9
+		rc=$?
+	done
+}
+
+determine_dump_mode()
+{
+	# Check if firmware-assisted dump is enabled
+	# if yes, set the dump mode as fadump
+	if is_fadump_capable; then
+		echo "Dump mode is fadump"
+		DEFAULT_DUMP_MODE="fadump"
+	fi
+}
+
+save_core()
+{
+	coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
+
+	mkdir -p $coredir
+	cp --sparse=always /proc/vmcore $coredir/vmcore-incomplete
+	if [ $? == 0 ]; then
+		mv $coredir/vmcore-incomplete $coredir/vmcore
+		echo "saved a vmcore to $coredir"
+	else
+		echo "failed to save a vmcore to $coredir" >&2
+	fi
+
+	# pass the dmesg to Abrt tool if exists, in order
+	# to collect the kernel oops message.
+	# https://fedorahosted.org/abrt/
+	if [ -x /usr/bin/dumpoops ]; then
+		makedumpfile --dump-dmesg $coredir/vmcore $coredir/dmesg >/dev/null 2>&1
+		dumpoops -d $coredir/dmesg >/dev/null 2>&1
+		if [ $? == 0 ]; then
+			echo "kernel oops has been collected by abrt tool"
+		fi
+	fi
+}
+
+rebuild_fadump_initrd()
+{
+	local target_initrd_tmp
+
+	# this file tells the initrd is fadump enabled
+	touch /tmp/fadump.initramfs
+	target_initrd_tmp="$TARGET_INITRD.tmp"
+	$MKDUMPRD $target_initrd_tmp --rebuild $DEFAULT_INITRD_BAK --kver $KDUMP_KERNELVER \
+		-i /tmp/fadump.initramfs /etc/fadump.initramfs
+	if [ $? != 0 ]; then
+		echo "mkdumprd: failed to rebuild initrd with fadump support" >&2
+		rm -f /tmp/fadump.initramfs
+		return 1
+	fi
+	rm -f /tmp/fadump.initramfs
+
+	# updating fadump initrd
+	mv $target_initrd_tmp $TARGET_INITRD
+	sync
+
+	return 0
+}
+
+check_earlykdump_is_enabled()
+{
+	grep -q -w "rd.earlykdump" /proc/cmdline
+	return $?
+}
+
+rebuild_kdump_initrd()
+{
+	$MKDUMPRD $TARGET_INITRD $KDUMP_KERNELVER
+	if [ $? != 0 ]; then
+		echo "mkdumprd: failed to make kdump initrd" >&2
+		return 1
+	fi
+
+	if check_earlykdump_is_enabled; then
+		echo "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump."
+	fi
+
+	return 0
+}
+
+rebuild_initrd()
+{
+	if [[ ! -w "$KDUMP_BOOTDIR" ]];then
+		echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD"
+		return 1
+	fi
+
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		rebuild_fadump_initrd
+	else
+		rebuild_kdump_initrd
+	fi
+
+	return $?
+}
+
+#$1: the files to be checked with IFS=' '
+check_exist()
+{
+	for file in $1; do
+		if [ ! -e "$file" ]; then
+			echo -n "Error: $file not found."; echo
+			return 1
+		fi
+	done
+}
+
+#$1: the files to be checked with IFS=' '
+check_executable()
+{
+	for file in $1; do
+		if [ ! -x "$file" ]; then
+			echo -n "Error: $file is not executable."; echo
+			return 1
+		fi
+	done
+}
+
+backup_default_initrd()
+{
+	if [ ! -f "$DEFAULT_INITRD" ]; then
+		return
+	fi
+
+	if [ ! -e $DEFAULT_INITRD_BAK ]; then
+		echo "Backing up $DEFAULT_INITRD before rebuild."
+		# save checksum to verify before restoring
+		sha1sum $DEFAULT_INITRD > $INITRD_CHECKSUM_LOCATION
+		cp $DEFAULT_INITRD $DEFAULT_INITRD_BAK
+		if [ $? -ne 0 ]; then
+			echo "WARNING: failed to backup $DEFAULT_INITRD."
+			rm -f $DEFAULT_INITRD_BAK
+		fi
+	fi
+}
+
+restore_default_initrd()
+{
+	if [ ! -f "$DEFAULT_INITRD" ]; then
+		return
+	fi
+
+	# If a backup initrd exists, we must be switching back from
+	# fadump to kdump. Restore the original default initrd.
+	if [ -f $DEFAULT_INITRD_BAK ] && [ -f $INITRD_CHECKSUM_LOCATION ]; then
+		# verify checksum before restoring
+		backup_checksum=`sha1sum $DEFAULT_INITRD_BAK | awk '{ print $1 }'`
+		default_checksum=`cat $INITRD_CHECKSUM_LOCATION | awk '{ print $1 }'`
+		if [ "$default_checksum" != "$backup_checksum" ]; then
+			echo "WARNING: checksum mismatch! Can't restore original initrd.."
+		else
+			rm -f $INITRD_CHECKSUM_LOCATION
+			mv $DEFAULT_INITRD_BAK $DEFAULT_INITRD
+			if [[ $? -eq 0 ]]; then
+				echo -n "Restoring original initrd as fadump mode "
+				echo "is disabled."
+				sync
+			fi
+		fi
+	fi
+}
+
+check_config()
+{
+	local nr
+
+	nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
+	[ $nr -gt 1 ] && {
+		echo "More than one dump targets specified."
+		return 1
+	}
+
+	# Check if path option is set more than once.
+        nr=$(awk 'BEGIN{cnt=0} /^path /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
+        [ $nr -gt 1 ] && {
+                echo "Mutiple paths specifed in $KDUMP_CONFIG_FILE"
+                return 1
+        }
+
+	nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l)
+	[ $nr -gt 1 ] && {
+		echo "Multiple mount targets specified in one \"dracut_args\"."
+		return 1
+	}
+
+	# Check if we have any leading spaces (or tabs) before the
+	# variable name in the kdump conf file
+	if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then
+		echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE"
+		return 1
+	fi
+
+	while read config_opt config_val; do
+		case "$config_opt" in
+		\#* | "")
+			;;
+		raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+			# remove inline comments after the end of a directive.
+			[ -z "$config_val" ] && {
+				echo "Invalid kdump config value for option $config_opt."
+				return 1;
+			}
+			if [ -d "/proc/device-tree/ibm,opal/dump" ] && [ "$config_opt" == "raw" ]; then
+				echo "WARNING: Won't capture opalcore when 'raw' dump target is used."
+			fi
+			;;
+		net|options|link_delay|disk_timeout|debug_mem_level|blacklist)
+			echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
+			return 1
+			;;
+		*)
+			echo "Invalid kdump config option $config_opt"
+			return 1;
+			;;
+		esac
+	done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
+
+	check_failure_action_config || return 1
+	check_final_action_config || return 1
+
+	check_fence_kdump_config || return 1
+
+	return 0
+}
+
+# get_pcs_cluster_modified_files <image timestamp>
+# return list of modified file for fence_kdump modified in Pacemaker cluster
+get_pcs_cluster_modified_files()
+{
+	local time_stamp
+	local modified_files
+
+	is_generic_fence_kdump && return 1
+	is_pcs_fence_kdump || return 1
+
+	time_stamp=`pcs cluster cib | xmllint --xpath 'string(/cib/@cib-last-written)' - | \
+		xargs -0 date +%s --date`
+
+	if [ -n $time_stamp -a $time_stamp -gt $image_time ]; then
+		modified_files="cluster-cib"
+	fi
+
+	if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+		time_stamp=`stat -c "%Y" $FENCE_KDUMP_CONFIG_FILE`
+		if [ "$time_stamp" -gt "$image_time" ]; then
+			modified_files="$modified_files $FENCE_KDUMP_CONFIG_FILE"
+		fi
+	fi
+
+	echo $modified_files
+}
+
+setup_initrd()
+{
+	prepare_kdump_bootinfo
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+
+	DEFAULT_INITRD_BAK="$KDUMP_BOOTDIR/.$(basename $DEFAULT_INITRD).default"
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		TARGET_INITRD="$DEFAULT_INITRD"
+
+		# backup initrd for reference before replacing it
+		# with fadump aware initrd
+		backup_default_initrd
+	else
+		TARGET_INITRD="$KDUMP_INITRD"
+
+		# check if a backup of default initrd exists. If yes,
+		# it signifies a switch from fadump mode. So, restore
+		# the backed up default initrd.
+		restore_default_initrd
+	fi
+}
+
+check_files_modified()
+{
+	local modified_files=""
+
+	#also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled.
+	modified_files=$(get_pcs_cluster_modified_files)
+
+	EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\  -f2`
+	CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\  -f2`
+	HOOKS="/etc/kdump/post.d/ /etc/kdump/pre.d/"
+	if [ -d /etc/kdump/post.d ]; then
+		for file in /etc/kdump/post.d/*; do
+			if [ -x "$file" ]; then
+				POST_FILES="$POST_FILES $file"
+			fi
+		done
+	fi
+	if [ -d /etc/kdump/pre.d ]; then
+		for file in /etc/kdump/pre.d/*; do
+			if [ -x "$file" ]; then
+				PRE_FILES="$PRE_FILES $file"
+			fi
+		done
+	fi
+	HOOKS="$HOOKS $POST_FILES $PRE_FILES"
+	CORE_COLLECTOR=`grep ^core_collector $KDUMP_CONFIG_FILE | cut -d\  -f2`
+	CORE_COLLECTOR=`type -P $CORE_COLLECTOR`
+	# POST_FILES and PRE_FILES are already checked against executable, need not to check again.
+	EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
+	CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\  -f2-`
+	EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
+	files="$KDUMP_CONFIG_FILE $KDUMP_KERNEL $EXTRA_BINS $CORE_COLLECTOR"
+	[[ -e /etc/fstab ]] && files="$files /etc/fstab"
+
+	# Check for any updated extra module
+	EXTRA_MODULES="$(grep ^extra_modules $KDUMP_CONFIG_FILE | sed 's/^extra_modules\s*//')"
+	if [ -n "$EXTRA_MODULES" ]; then
+		if [ -e /lib/modules/$KDUMP_KERNELVER/modules.dep ]; then
+			files="$files /lib/modules/$KDUMP_KERNELVER/modules.dep"
+		fi
+		for _module in $EXTRA_MODULES; do
+			_module_file="$(modinfo --set-version "$KDUMP_KERNELVER" --filename "$_module" 2>/dev/null)"
+			if [[ $? -eq 0 ]]; then
+				files="$files $_module_file"
+				for _dep_modules in $(modinfo -F depends $_module | tr ',' ' '); do
+				    files="$files $(modinfo --set-version "$KDUMP_KERNELVER" --filename $_dep_modules 2>/dev/null)"
+				done
+			else
+				# If it's not a module nor builtin, give an error
+				if ! ( modprobe --set-version "$KDUMP_KERNELVER" --dry-run "$_module" &>/dev/null ); then
+					echo "Module $_module not found"
+				fi
+			fi
+		done
+	fi
+
+	# HOOKS is mandatory and need to check the modification time
+	files="$files $HOOKS"
+	check_exist "$files" && check_executable "$EXTRA_BINS"
+	[ $? -ne 0 ] && return 2
+
+	for file in $files; do
+		if [ -e "$file" ]; then
+			time_stamp=`stat -c "%Y" $file`
+			if [ "$time_stamp" -gt "$image_time" ]; then
+				modified_files="$modified_files $file"
+			fi
+			if [ -L "$file" ]; then
+				file=$(readlink -m $file)
+				time_stamp=`stat -c "%Y" $file`
+				if [ "$time_stamp" -gt "$image_time" ]; then
+					modified_files="$modified_files $file"
+				fi
+			fi
+		else
+			echo "$file doesn't exist"
+		fi
+	done
+
+	if [ -n "$modified_files" ]; then
+		echo "Detected change(s) in the following file(s):"
+		echo -n "  "; echo "$modified_files" | sed 's/\s/\n  /g'
+		return 1
+	fi
+
+	return 0
+}
+
+check_dump_fs_modified()
+{
+	local _old_dev _old_mntpoint _old_fstype
+	local _new_dev _new_mntpoint _new_fstype
+	local _target _path _dracut_args
+	local _target_drivers _module_name _module_filename
+
+	local _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
+
+	# No need to check in case of mount target specified via "dracut_args".
+	if is_mount_in_dracut_args; then
+		return 0
+	fi
+
+	# No need to check in case of raw target.
+	# Currently we do not check also if ssh/nfs target is specified
+	if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
+		return 0
+	fi
+
+	_target=$(get_user_configured_dump_disk)
+
+	if [[ -n "$_target" ]]; then
+		_target=$(to_dev_name $_target)
+		_new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d '"' -f 2)
+	else
+		_path=$(get_save_path)
+		_target=$(get_target_from_path $_path)
+		_target=$(to_dev_name $_target)
+		_new_fstype=$(get_fs_type_from_target $_target)
+		if [[ -z "$_target" || -z "$_new_fstype" ]];then
+			echo "Dump path $_path does not exist"
+			return 2
+		fi
+	fi
+
+	_record_block_drivers() {
+		local _drivers
+		if [[ -b /dev/block/$1 ]]; then
+			_drivers=$(udevadm info -a "/dev/block/$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p')
+		fi
+		if [[ -b $1 ]]; then
+			_drivers=$(udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p')
+		fi
+		for _driver in $_drivers; do
+			if ! [[ " $_target_drivers " == *" $_driver "* ]]; then
+				_target_drivers="$_target_drivers $_driver"
+			fi
+		done
+		return 1
+	}
+
+	check_block_and_slaves_all _record_block_drivers "$(get_maj_min "$_target")"
+	for _driver in $_target_drivers; do
+		# Skip deprecated/invalid driver name or built-in module
+		_module_name=$(modinfo --set-version "$KDUMP_KERNELVER" -F name $_driver 2>/dev/null)
+		_module_filename=$(modinfo --set-version "$KDUMP_KERNELVER" -n $_driver 2>/dev/null)
+		if [ $? -ne 0 ] || [ -z "$_module_name" ] || [[ "$_module_filename" = *"(builtin)"* ]]; then
+			continue
+		fi
+		if ! [[ " $_old_drivers " == *" $_module_name "* ]]; then
+			echo "Detected change in block device driver, new loaded module: $_module_name"
+			return 1
+		fi
+	done
+
+	if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
+		_new_dev=$_target
+	else
+		_new_dev=$(kdump_get_persistent_dev $_target)
+		if [ -z "$_new_dev" ]; then
+			echo "Get persistent device name failed"
+			return 2
+		fi
+	fi
+
+	_new_mntpoint="$(get_kdump_mntpoint_from_target $_target)"
+	_dracut_args=$(lsinitrd $TARGET_INITRD -f usr/lib/dracut/build-parameter.txt)
+	if [[ -z "$_dracut_args" ]];then
+		echo "Warning: No dracut arguments found in initrd"
+		return 0
+	fi
+
+	# if --mount argument present then match old and new target, mount
+	# point and file system. If any of them mismatches then rebuild
+	echo $_dracut_args | grep "\-\-mount" &> /dev/null
+	if [[ $? -eq 0 ]];then
+		set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3)
+		_old_dev=$1
+		_old_mntpoint=$2
+		_old_fstype=$3
+		[[ $_new_dev = $_old_dev && $_new_mntpoint = $_old_mntpoint && $_new_fstype = $_old_fstype ]] && return 0
+	# otherwise rebuild if target device is not a root device
+	else
+		[[ "$_target" = "$(get_root_fs_device)" ]] && return 0
+	fi
+
+	echo "Detected change in File System"
+	return 1
+}
+
+check_wdt_modified()
+{
+	local -A _drivers
+	local _alldrivers _active _wdtdrv _wdtppath _dir
+	local wd_old wd_new
+
+	is_wdt_mod_omitted
+	[[ $? -eq 0 ]] && return 0
+	[[ -d /sys/class/watchdog/ ]] || return 0
+
+	# Copied logic from dracut 04watchdog/module-setup.sh::installkernel()
+	for _dir in /sys/class/watchdog/*; do
+		[[ -d "$_dir" ]] || continue
+		[[ -f "$_dir/state" ]] || continue
+		_active=$(< "$_dir/state")
+		[[ "$_active" =  "active" ]] || continue
+		# device/modalias will return driver of this device
+		_wdtdrv=$(< "$_dir/device/modalias")
+		# There can be more than one module represented by same
+		# modalias. Currently load all of them.
+		# TODO: Need to find a way to avoid any unwanted module
+		# represented by modalias
+		_wdtdrv=$(modprobe --set-version "$KDUMP_KERNELVER" -R $_wdtdrv 2>/dev/null)
+		if [[ $_wdtdrv ]]; then
+			for i in $_wdtdrv; do
+				_drivers[$i]=1
+			done
+		fi
+		# however in some cases, we also need to check that if there is
+		# a specific driver for the parent bus/device.  In such cases
+		# we also need to enable driver for parent bus/device.
+		_wdtppath=$(readlink -f "$_dir/device")
+		while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
+			_wdtppath=$(readlink -f "$_wdtppath/..")
+			[[ -f "$_wdtppath/modalias" ]] || continue
+
+			_wdtdrv=$(< "$_wdtppath/modalias")
+			_wdtdrv=$(modprobe --set-version "$KDUMP_KERNELVER" -R $_wdtdrv 2>/dev/null)
+			if [[ $_wdtdrv ]]; then
+				for i in $_wdtdrv; do
+					_drivers[$i]=1
+				done
+			fi
+		done
+	done
+
+	# ensure that watchdog module is loaded as early as possible
+	_alldrivers="${!_drivers[*]}"
+	[[ $_alldrivers ]] && wd_new="rd.driver.pre=${_alldrivers// /,}"
+	wd_old=$(lsinitrd $TARGET_INITRD -f etc/cmdline.d/00-watchdog.conf)
+
+	[[ "$wd_old" = "$wd_new" ]] && return 0
+
+	return 1
+}
+
+# returns 0 if system is not modified
+# returns 1 if system is modified
+# returns 2 if system modification is invalid
+check_system_modified()
+{
+	local ret
+
+	[[ -f $TARGET_INITRD ]] || return 1
+
+	check_files_modified
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		return $ret
+	fi
+
+	check_dump_fs_modified
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		return $ret
+	fi
+
+	check_wdt_modified
+	if [ $? -ne 0 ]; then
+		echo "Detected change in watchdog state"
+		return 1
+	fi
+
+	return 0
+}
+
+check_rebuild()
+{
+	local capture_capable_initrd="1"
+	local _force_rebuild force_rebuild="0"
+	local _force_no_rebuild force_no_rebuild="0"
+	local ret system_modified="0"
+
+	setup_initrd
+
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+
+	_force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+	if [ $? -eq 0 ]; then
+		force_no_rebuild=`echo $_force_no_rebuild | cut -d' '  -f2`
+		if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then
+			echo "Error: force_no_rebuild value is invalid"
+			return 1
+		fi
+	fi
+
+	_force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+	if [ $? -eq 0 ]; then
+		force_rebuild=`echo $_force_rebuild | cut -d' '  -f2`
+		if [ "$force_rebuild" != "0" ] && [ "$force_rebuild" != "1" ];then
+			echo "Error: force_rebuild value is invalid"
+			return 1
+		fi
+	fi
+
+	if [[ "$force_no_rebuild" == "1" && "$force_rebuild" == "1" ]]; then
+		echo "Error: force_rebuild and force_no_rebuild are enabled simultaneously in kdump.conf"
+		return 1
+	fi
+
+	# Will not rebuild kdump initrd
+	if [ "$force_no_rebuild" == "1" ]; then
+		return 0
+	fi
+
+	#check to see if dependent files has been modified
+	#since last build of the image file
+	if [ -f $TARGET_INITRD ]; then
+		image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null`
+
+		#in case of fadump mode, check whether the default/target
+		#initrd is already built with dump capture capability
+		if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
+			capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l)
+		fi
+	fi
+
+	check_system_modified
+	ret=$?
+	if [ $ret -eq 2 ]; then
+		return 1
+	elif [ $ret -eq 1 ];then
+		system_modified="1"
+	fi
+
+	if [ $image_time -eq 0 ]; then
+		echo  -n "No kdump initial ramdisk found."; echo
+	elif [ "$capture_capable_initrd" == "0" ]; then
+		echo -n "Rebuild $TARGET_INITRD with dump capture support"; echo
+	elif [ "$force_rebuild" != "0" ]; then
+		echo -n "Force rebuild $TARGET_INITRD"; echo
+	elif [ "$system_modified" != "0" ]; then
+		:
+	else
+		return 0
+	fi
+
+	echo "Rebuilding $TARGET_INITRD"
+	rebuild_initrd
+	return $?
+}
+
+# Load the kdump kernel specified in /etc/sysconfig/kdump
+# If none is specified, try to load a kdump kernel with the same version
+# as the currently running kernel.
+load_kdump()
+{
+	KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
+	KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
+
+	# For secureboot enabled machines, use new kexec file based syscall.
+	# Old syscall will always fail as it does not have capability to
+	# to kernel signature verification.
+	if is_secure_boot_enforced; then
+		echo "Secure Boot is enabled. Using kexec file based syscall."
+		KEXEC_ARGS="$KEXEC_ARGS -s"
+	fi
+
+	$KEXEC $KEXEC_ARGS $standard_kexec_args \
+		--command-line="$KDUMP_COMMANDLINE" \
+		--initrd=$TARGET_INITRD $KDUMP_KERNEL
+	if [ $? == 0 ]; then
+		echo "kexec: loaded kdump kernel"
+		return 0
+	else
+		echo "kexec: failed to load kdump kernel" >&2
+		return 1
+	fi
+}
+
+check_ssh_config()
+{
+	while read config_opt config_val; do
+		case "$config_opt" in
+		sshkey)
+			# remove inline comments after the end of a directive.
+			if [ -f "$config_val" ]; then
+				# canonicalize the path
+				SSH_KEY_LOCATION=$(/usr/bin/readlink -m $config_val)
+			else
+				echo "WARNING: '$config_val' doesn't exist, using default value '$SSH_KEY_LOCATION'"
+			fi
+			;;
+		path)
+			SAVE_PATH=$config_val
+			;;
+		ssh)
+			DUMP_TARGET=$config_val
+			;;
+		*)
+			;;
+		esac
+	done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
+
+	#make sure they've configured kdump.conf for ssh dumps
+	local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'`
+	if [ -z "$SSH_TARGET" ]; then
+		return 1
+	fi
+	return 0
+}
+
+# ipv6 host address may takes a long time to be ready.
+# Instead of checking against ipv6 address, we just check the network reachable
+# by the return val of 'ssh'
+check_and_wait_network_ready()
+{
+	local start_time=$(date +%s)
+	local warn_once=1
+	local cur
+	local diff
+	local retval
+	local errmsg
+
+	while true; do
+		errmsg=$(ssh -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH 2>&1)
+		retval=$?
+
+		# ssh exits with the exit status of the remote command or with 255 if an error occurred
+		if [ $retval -eq 0 ]; then
+			return 0
+		elif [ $retval -ne 255 ]; then
+			echo "Could not create $DUMP_TARGET:$SAVE_PATH, you should check the privilege on server side"  >&2
+			return 1
+		fi
+
+		# if server removes the authorized_keys or, no /root/.ssh/kdump_id_rsa
+		echo $errmsg | grep -q "Permission denied\|No such file or directory\|Host key verification failed"
+		if [ $? -eq 0 ]; then
+			echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\""  >&2
+			return 1
+		fi
+
+		if [ $warn_once -eq 1 ]; then
+			echo "Network dump target is not usable, waiting for it to be ready"
+			warn_once=0
+		fi
+		echo -n .
+
+		cur=$(date +%s)
+		let "diff = $cur - $start_time"
+		# 60s time out
+		if [ $diff -gt 180 ]; then
+			break;
+		fi
+		sleep 1
+	done
+
+	echo "Could not create $DUMP_TARGET:$SAVE_PATH, ipaddr is not ready yet. You should check network connection"  >&2
+	return 1
+}
+
+check_ssh_target()
+{
+	check_and_wait_network_ready
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+	return 0
+}
+
+propagate_ssh_key()
+{
+	check_ssh_config
+	if [ $? -ne 0 ]; then
+		echo "No ssh config specified in $KDUMP_CONFIG_FILE.  Can't propagate" >&2
+		exit 1
+	fi
+
+	local KEYFILE=$SSH_KEY_LOCATION
+	local errmsg="Failed to propagate ssh key"
+
+	#Check to see if we already created key, if not, create it.
+	if [ -f $KEYFILE ]; then
+		echo "Using existing keys..."
+	else
+		echo -n "Generating new ssh keys... "
+		/usr/bin/ssh-keygen -t rsa -f $KEYFILE -N "" 2>&1 > /dev/null
+		echo "done."
+	fi
+
+	#now find the target ssh user and server to contact.
+	SSH_USER=`echo $DUMP_TARGET | cut -d\  -f2 | cut -d@ -f1`
+	SSH_SERVER=`echo $DUMP_TARGET | sed -e's/\(.*@\)\(.*$\)/\2/'`
+
+	#now send the found key to the found server
+	ssh-copy-id -i $KEYFILE $SSH_USER@$SSH_SERVER
+	RET=$?
+	if [ $RET == 0 ]; then
+		echo $KEYFILE has been added to ~$SSH_USER/.ssh/authorized_keys on $SSH_SERVER
+		return 0
+	else
+		echo $errmsg, $KEYFILE failed in transfer to $SSH_SERVER  >&2
+		exit 1
+	fi
+}
+
+show_reserved_mem()
+{
+    local mem=$(cat /sys/kernel/kexec_crash_size)
+    local mem_mb=$(expr $mem / 1024 / 1024)
+
+    echo "Reserved "$mem_mb"MB memory for crash kernel"
+}
+
+check_current_fadump_status()
+{
+	# Check if firmware-assisted dump has been registered.
+	rc=`cat $FADUMP_REGISTER_SYS_NODE`
+	[ $rc -eq 1 ] && return 0
+	return 1
+}
+
+check_current_status()
+{
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		check_current_fadump_status
+	else
+		check_current_kdump_status
+	fi
+
+	return $?
+}
+
+save_raw()
+{
+	local kdump_dir
+	local raw_target
+
+	raw_target=$(awk '$1 ~ /^raw$/ { print $2; }' $KDUMP_CONFIG_FILE)
+	[ -z "$raw_target" ] && return 0
+	[ -b "$raw_target" ] || {
+		echo "raw partition $raw_target not found"
+		return 1
+	}
+	check_fs=$(lsblk --nodeps -npo FSTYPE $raw_target)
+	if [[ $(echo $check_fs | wc -w) -ne 0 ]]; then
+		echo "Warning: Detected '$check_fs' signature on $raw_target, data loss is expected."
+		return 0
+	fi
+	kdump_dir=`grep ^path $KDUMP_CONFIG_FILE | cut -d' '  -f2-`
+	if [ -z "${kdump_dir}" ]; then
+		coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
+	else
+		coredir="${kdump_dir}/`date +"%Y-%m-%d-%H:%M"`"
+	fi
+
+	mkdir -p "$coredir"
+	[ -d "$coredir" ] || {
+		echo "failed to create $coredir"
+		return 1
+	}
+	if makedumpfile -R $coredir/vmcore <$raw_target >/dev/null 2>&1; then
+		# dump found
+		echo "Dump saved to $coredir/vmcore"
+		# wipe makedumpfile header
+		dd if=/dev/zero of=$raw_target bs=1b count=1 2>/dev/null
+	else
+		rm -rf "$coredir"
+	fi
+
+	return 0
+}
+
+local_fs_dump_target()
+{
+	local _target
+
+	_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf)
+	if [ $? -eq 0 ]; then
+		echo $_target|awk '{print $2}'
+	fi
+}
+
+path_to_be_relabeled()
+{
+	local _path _target _mnt="/" _rmnt
+
+	if is_user_configured_dump_target; then
+		if is_mount_in_dracut_args; then
+		    return;
+		fi
+
+		_target=$(local_fs_dump_target)
+		if [[ -n "$_target" ]]; then
+			_mnt=$(get_mntpoint_from_target $_target)
+			if ! is_mounted "$_mnt"; then
+				return
+			fi
+		else
+			return
+		fi
+	fi
+
+	_path=$(get_save_path)
+	# if $_path is masked by other mount, we will not relabel it.
+	_rmnt=$(df $_mnt/$_path 2>/dev/null | tail -1 | awk '{ print $NF }')
+	if [ "$_rmnt" == "$_mnt" ]; then
+		echo $_mnt/$_path
+	fi
+}
+
+selinux_relabel()
+{
+	local _path _i _attr
+
+	_path=$(path_to_be_relabeled)
+	if [ -z "$_path" ] || ! [ -d "$_path" ] ; then
+		return
+	fi
+
+	for _i in $(find $_path); do
+		_attr=$(getfattr -m "security.selinux" $_i 2>/dev/null)
+		if [ -z "$_attr" ]; then
+			restorecon $_i;
+		fi
+	done
+}
+
+check_fence_kdump_config()
+{
+	local hostname=`hostname`
+	local ipaddrs=`hostname -I`
+	local nodes=$(get_option_value "fence_kdump_nodes")
+
+	for node in $nodes; do
+		if [ "$node" = "$hostname" ]; then
+			echo "Option fence_kdump_nodes cannot contain $hostname"
+			return 1
+		fi
+		# node can be ipaddr
+		echo $ipaddrs | grep $node > /dev/null
+		if [ $? -eq 0 ]; then
+			echo "Option fence_kdump_nodes cannot contain $node"
+			return 1
+		fi
+	done
+
+	return 0
+}
+
+check_dump_feasibility()
+{
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		return 0
+	fi
+
+	check_kdump_feasibility
+	return $?
+}
+
+start_fadump()
+{
+	echo 1 > $FADUMP_REGISTER_SYS_NODE
+	if ! check_current_fadump_status; then
+		echo "fadump: failed to register"
+		return 1
+	fi
+
+	echo "fadump: registered successfully"
+	return 0
+}
+
+start_dump()
+{
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		start_fadump
+	else
+		load_kdump
+	fi
+
+	return $?
+}
+
+check_failure_action_config()
+{
+	local default_option
+	local failure_action
+	local option="failure_action"
+
+	default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE)
+	failure_action=$(awk '$1 ~ /^failure_action$/ {print $2;}' $KDUMP_CONFIG_FILE)
+
+	if [ -z "$failure_action" -a -z "$default_option" ]; then
+		return 0
+	elif [ -n "$failure_action" -a -n "$default_option" ]; then
+		echo "Cannot specify 'failure_action' and 'default' option together"
+		return 1
+	fi
+
+	if [ -n "$default_option" ]; then
+		option="default"
+		failure_action="$default_option"
+	fi
+
+	case "$failure_action" in
+	  reboot|halt|poweroff|shell|dump_to_rootfs)
+		return 0
+	  ;;
+	  *)
+		echo $"Usage kdump.conf: $option {reboot|halt|poweroff|shell|dump_to_rootfs}"
+		return 1
+	esac
+}
+
+check_final_action_config()
+{
+	local final_action
+
+	final_action=$(awk '$1 ~ /^final_action$/ {print $2;}' $KDUMP_CONFIG_FILE)
+	if [ -z "$final_action" ]; then
+		return 0
+	else
+		case "$final_action" in
+		  reboot|halt|poweroff)
+			return 0
+		  ;;
+		  *)
+			echo $"Usage kdump.conf: final_action {reboot|halt|poweroff}"
+			return 1
+		esac
+	fi
+}
+
+start()
+{
+	check_dump_feasibility
+	if [ $? -ne 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	check_config
+	if [ $? -ne 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	if sestatus 2>/dev/null | grep -q "SELinux status.*enabled"; then
+		selinux_relabel
+	fi
+
+	save_raw
+	if [ $? -ne 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	check_current_status
+	if [ $? == 0 ]; then
+		echo "Kdump already running: [WARNING]"
+		return 0
+	fi
+
+	if check_ssh_config; then
+		if ! check_ssh_target; then
+			echo "Starting kdump: [FAILED]"
+			return 1
+		fi
+	fi
+
+	check_rebuild
+	if [ $? != 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	start_dump
+	if [ $? != 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	echo "Starting kdump: [OK]"
+}
+
+reload()
+{
+	check_current_status
+	if [ $? -ne 0 ]; then
+		echo "Kdump was not running: [WARNING]"
+	fi
+
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		reload_fadump
+		return $?
+	else
+		stop_kdump
+	fi
+
+	if [ $? -ne 0 ]; then
+		echo "Stopping kdump: [FAILED]"
+		return 1
+	fi
+
+	echo "Stopping kdump: [OK]"
+
+	setup_initrd
+	if [ $? -ne 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	start_dump
+	if [ $? -ne 0 ]; then
+		echo "Starting kdump: [FAILED]"
+		return 1
+	fi
+
+	echo "Starting kdump: [OK]"
+}
+
+stop_fadump()
+{
+	echo 0 > $FADUMP_REGISTER_SYS_NODE
+	if check_current_fadump_status; then
+		echo "fadump: failed to unregister"
+		return 1
+	fi
+
+	echo "fadump: unregistered successfully"
+	return 0
+}
+
+stop_kdump()
+{
+	if is_secure_boot_enforced; then
+		$KEXEC -s -p -u
+	else
+		$KEXEC -p -u
+	fi
+
+	if [ $? != 0 ]; then
+		echo "kexec: failed to unload kdump kernel"
+		return 1
+	fi
+
+	echo "kexec: unloaded kdump kernel"
+	return 0
+}
+
+reload_fadump()
+{
+	echo 1 > $FADUMP_REGISTER_SYS_NODE
+	if [ $? == 0 ]; then
+		echo "fadump: re-registered successfully"
+		return 0
+	else
+		# FADump could fail on older kernel where re-register
+		# support is not enabled. Try stop/start from userspace
+		# to handle such scenario.
+		stop_fadump
+		if [ $? == 0 ]; then
+			start_fadump
+			return $?
+		fi
+	fi
+
+	return 1
+}
+
+stop()
+{
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		stop_fadump
+	else
+		stop_kdump
+	fi
+
+	if [ $? != 0 ]; then
+		echo "Stopping kdump: [FAILED]"
+		return 1
+	fi
+
+	echo "Stopping kdump: [OK]"
+	return 0
+}
+
+rebuild() {
+	check_config
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+
+	if check_ssh_config; then
+		if ! check_ssh_target; then
+			return 1
+		fi
+	fi
+
+	setup_initrd
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+
+	echo "Rebuilding $TARGET_INITRD"
+	rebuild_initrd
+	return $?
+}
+
+if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
+	echo "Error: No kdump config file found!"  >&2
+	exit 1
+fi
+
+main ()
+{
+	# Determine if the dump mode is kdump or fadump
+	determine_dump_mode
+
+	case "$1" in
+	  start)
+		if [ -s /proc/vmcore ]; then
+			save_core
+			reboot
+		else
+			start
+		fi
+		;;
+	  stop)
+		stop
+		;;
+	  status)
+		EXIT_CODE=0
+		check_current_status
+		case "$?" in
+		  0)
+			echo "Kdump is operational"
+			EXIT_CODE=0
+			;;
+		  1)
+			echo "Kdump is not operational"
+			EXIT_CODE=3
+			;;
+		esac
+		exit $EXIT_CODE
+		;;
+	  reload)
+		reload
+		;;
+	  restart)
+		stop
+		start
+		;;
+	  rebuild)
+		rebuild
+		;;
+	  condrestart)
+		;;
+	  propagate)
+		propagate_ssh_key
+		;;
+	  showmem)
+		show_reserved_mem
+		;;
+	  *)
+		echo $"Usage: $0 {start|stop|status|restart|reload|rebuild|propagate|showmem}"
+		exit 1
+	esac
+}
+
+# Other kdumpctl instances will block in queue, until this one exits
+single_instance_lock
+
+# To avoid fd 9 leaking, we invoke a subshell, close fd 9 and call main.
+# So that fd isn't leaking when main is invoking a subshell.
+(exec 9<&-; main $1)
+
+exit $?
diff --git a/kdumpctl.8 b/kdumpctl.8
new file mode 100644
index 0000000..ae97af7
--- /dev/null
+++ b/kdumpctl.8
@@ -0,0 +1,50 @@
+.TH KDUMPCTL 8 2015-07-13 kexec-tools
+
+.SH NAME
+kdumpctl \- control interface for kdump
+
+.SH SYNOPSIS
+.B kdumpctl
+.I COMMAND
+
+.SH DESCRIPTION
+.B kdumpctl
+is used to check or control the kdump service.
+In most cases, you should use
+.B systemctl
+to start / stop / enable kdump service instead. However,
+.B kdumpctl
+provides more details for debug and a helper to setup ssh key authentication.
+
+.SH COMMANDS
+.TP
+.I start
+Start the service.
+.TP
+.I stop
+Stop the service.
+.TP
+.I status
+Prints the current status of kdump service.
+It returns non-zero value if kdump is not operational.
+.TP
+.I restart
+Is equal to
+.I start; stop
+.TP
+.I reload
+reload crash kernel image and initramfs without triggering a rebuild.
+.TP
+.I rebuild
+rebuild the crash kernel initramfs.
+.TP
+.I propagate
+Helps to setup key authentication for ssh storage since it's
+impossible to use password authentication during kdump.
+.TP
+.I showmem
+Prints the size of reserved memory for crash kernel in megabytes.
+
+.SH "SEE ALSO"
+.BR kdump.conf (5),
+.BR mkdumprd (8)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
new file mode 100644
index 0000000..2209e5a
--- /dev/null
+++ b/kexec-kdump-howto.txt
@@ -0,0 +1,887 @@
+=================
+Kexec/Kdump HOWTO
+=================
+
+
+Introduction
+============
+
+Kexec and kdump are new features in the 2.6 mainstream kernel. These features
+are included in Red Hat Enterprise Linux 5. The purpose of these features
+is to ensure faster boot up and creation of reliable kernel vmcores for
+diagnostic purposes.
+
+
+Overview
+========
+
+Kexec
+-----
+
+Kexec is a fastboot mechanism which allows booting a Linux kernel from the
+context of already running kernel without going through BIOS. BIOS can be very
+time consuming especially on the big servers with lots of peripherals. This can
+save a lot of time for developers who end up booting a machine numerous times.
+
+Kdump
+-----
+
+Kdump is a new kernel crash dumping mechanism and is very reliable because
+the crash dump is captured from the context of a freshly booted kernel and
+not from the context of the crashed kernel. Kdump uses kexec to boot into
+a second kernel whenever system crashes. This second kernel, often called
+a capture kernel, boots with very little memory and captures the dump image.
+
+The first kernel reserves a section of memory that the second kernel uses
+to boot. Kexec enables booting the capture kernel without going through BIOS
+hence contents of first kernel's memory are preserved, which is essentially
+the kernel crash dump.
+
+Kdump is supported on the i686, x86_64, ia64 and ppc64 platforms. The
+standard kernel and capture kernel are one in the same on i686, x86_64,
+ia64 and ppc64.
+
+If you're reading this document, you should already have kexec-tools
+installed. If not, you install it via the following command:
+
+    # yum install kexec-tools
+
+Now load a kernel with kexec:
+
+    # kver=`uname -r` # kexec -l /boot/vmlinuz-$kver
+    --initrd=/boot/initrd-$kver.img \
+        --command-line="`cat /proc/cmdline`"
+
+NOTE: The above will boot you back into the kernel you're currently running,
+if you want to load a different kernel, substitute it in place of `uname -r`.
+
+Now reboot your system, taking note that it should bypass the BIOS:
+
+    # reboot
+
+
+How to configure kdump
+======================
+
+Again, we assume if you're reading this document, you should already have
+kexec-tools installed. If not, you install it via the following command:
+
+    # yum install kexec-tools
+
+To be able to do much of anything interesting in the way of debug analysis,
+you'll also need to install the kernel-debuginfo package, of the same arch
+as your running kernel, and the crash utility:
+
+    # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
+
+Next up, we need to modify some boot parameters to reserve a chunk of memory for
+the capture kernel. With the help of grubby, it's very easy to append
+"crashkernel=128M" to the end of your kernel boot parameters. Note that the X
+values are such that X = the amount of memory to reserve for the capture kernel.
+And based on arch and system configuration, one might require more than 128M to
+be reserved for kdump. One need to experiment and test kdump, if 128M is not
+sufficient, try reserving more memory.
+
+   # grubby --args="crashkernel=128M" --update-kernel=/boot/vmlinuz-`uname -r`
+
+Note that there is an alternative form in which to specify a crashkernel
+memory reservation, in the event that more control is needed over the size and
+placement of the reserved memory.  The format is:
+
+crashkernel=range1:size1[,range2:size2,...][@offset]
+
+Where range<n> specifies a range of values that are matched against the amount
+of physical RAM present in the system, and the corresponding size<n> value
+specifies the amount of kexec memory to reserve.  For example:
+
+crashkernel=512M-2G:64M,2G-:128M
+
+This line tells kexec to reserve 64M of ram if the system contains between
+512M and 2G of physical memory.  If the system contains 2G or more of physical
+memory, 128M should be reserved.
+
+Besides, since kdump needs to access /proc/kallsyms during a kernel
+loading if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to
+make sure that the content of /proc/kallsyms is exposed correctly.
+We recommend to set the value of kptr_restrict to '1'. Otherwise
+capture kernel loading could fail.
+
+After making said changes, reboot your system, so that the X MB of memory is
+left untouched by the normal system, reserved for the capture kernel. Take note
+that the output of 'free -m' will show X MB less memory than without this
+parameter, which is expected. You may be able to get by with less than 128M, but
+testing with only 64M has proven unreliable of late. On ia64, as much as 512M
+may be required.
+
+Now that you've got that reserved memory region set up, you want to turn on
+the kdump init script:
+
+    # chkconfig kdump on
+
+Then, start up kdump as well:
+
+    # systemctl start kdump.service
+
+This should load your kernel-kdump image via kexec, leaving the system ready
+to capture a vmcore upon crashing. To test this out, you can force-crash
+your system by echo'ing a c into /proc/sysrq-trigger:
+
+    # echo c > /proc/sysrq-trigger
+
+You should see some panic output, followed by the system restarting into
+the kdump kernel. When the boot process gets to the point where it starts
+the kdump service, your vmcore should be copied out to disk (by default,
+in /var/crash/<YYYY-MM-DD-HH:MM>/vmcore), then the system rebooted back into
+your normal kernel.
+
+Once back to your normal kernel, you can use the previously installed crash
+kernel in conjunction with the previously installed kernel-debuginfo to
+perform postmortem analysis:
+
+    # crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux
+    /var/crash/2006-08-23-15:34/vmcore
+
+    crash> bt
+
+and so on...
+
+
+Notes on kdump
+==============
+
+When kdump starts, the kdump kernel is loaded together with the kdump
+initramfs. To save memory usage and disk space, the kdump initramfs is
+generated strictly against the system it will run on, and contains the
+minimum set of kernel modules and utilities to boot the machine to a stage
+where the dump target could be mounted.
+
+With kdump service enabled, kdumpctl will try to detect possible system
+change and rebuild the kdump initramfs if needed. But it can not guarantee
+to cover every possible case. So after a hardware change, disk migration,
+storage setup update or any similar system level changes, it's highly
+recommended to rebuild the initramfs manually with following command:
+
+    # kdumpctl rebuild
+
+
+Saving vmcore-dmesg.txt
+=======================
+
+Kernel log bufferes are one of the most important information available
+in vmcore. Now before saving vmcore, kernel log bufferes are extracted
+from /proc/vmcore and saved into a file vmcore-dmesg.txt. After
+vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for
+vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will
+not be available if dump target is raw device.
+
+
+Dump Triggering methods
+=======================
+
+This section talks about the various ways, other than a Kernel Panic, in which
+Kdump can be triggered. The following methods assume that Kdump is configured
+on your system, with the scripts enabled as described in the section above.
+
+1) AltSysRq C
+
+Kdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
+keyboard keys. Please refer to the following link for more details:
+
+http://kbase.redhat.com/faq/FAQ_43_5559.shtm
+
+In addition, on PowerPC boxes, Kdump can also be triggered via Hardware
+Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
+
+2) NMI_WATCHDOG
+
+In case a machine has a hard hang, it is quite possible that it does not
+respond to keyboard interrupts. As a result 'Alt-SysRq' keys will not help
+trigger a dump. In such scenarios Nmi Watchdog feature can prove to be useful.
+The following link has more details on configuring Nmi watchdog option.
+
+http://kbase.redhat.com/faq/FAQ_85_9129.shtm
+
+Once this feature has been enabled in the kernel, any lockups will result in an
+OOPs message to be generated, followed by Kdump being triggered.
+
+3) Kernel OOPs
+
+If we want to generate a dump everytime the Kernel OOPses, we can achieve this
+by setting the 'Panic On OOPs' option as follows:
+
+    # echo 1 > /proc/sys/kernel/panic_on_oops
+
+This is enabled by default on RHEL5.
+
+4) NMI(Non maskable interrupt) button
+
+In cases where the system is in a hung state, and is not accepting keyboard
+interrupts, using NMI button for triggering Kdump can be very useful. NMI
+button is present on most of the newer x86 and x86_64 machines. Please refer
+to the User guides/manuals to locate the button, though in most occasions it
+is not very well documented. In most cases it is hidden behind a small hole
+on the front or back panel of the machine. You could use a toothpick or some
+other non-conducting probe to press the button.
+
+For example, on the IBM X series 366 machine, the NMI button is located behind
+a small hole on the bottom center of the rear panel.
+
+To enable this method of dump triggering using NMI button, you will need to set
+the 'unknown_nmi_panic' option as follows:
+
+   # echo 1 > /proc/sys/kernel/unknown_nmi_panic
+
+5) PowerPC specific methods:
+
+On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if
+XMON is configured). To configure XMON one needs to compile the kernel with
+the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with
+CONFIG_XMON and booting the kernel with xmon=on option.
+
+Following are the ways to remotely issue a soft reset on PowerPC boxes, which
+would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an
+'Enter' here will trigger the dump.
+
+5.1) HMC
+
+Hardware Management Console(HMC) available on Power4 and Power5 machines allow
+partitions to be reset remotely. This is specially useful in hang situations
+where the system is not accepting any keyboard inputs.
+
+Once you have HMC configured, the following steps will enable you to trigger
+Kdump via a soft reset:
+
+On Power4
+  Using GUI
+
+    * In the right pane, right click on the partition you wish to dump.
+    * Select "Operating System->Reset".
+    * Select "Soft Reset".
+    * Select "Yes".
+
+  Using HMC Commandline
+
+    # reset_partition -m <machine> -p <partition> -t soft
+
+On Power5
+  Using GUI
+
+    * In the right pane, right click on the partition you wish to dump.
+    * Select "Restart Partition".
+    * Select "Dump".
+    * Select "OK".
+
+  Using HMC Commandline
+
+    # chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar
+
+5.2) Blade Management Console for Blade Center
+
+To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in
+the Blade Management Console. Select the corresponding blade for which you want
+to initate the dump and then click "Restart blade with NMI". This issues a
+system reset and invokes xmon debugger.
+
+
+Dump targets
+============
+
+In addition to being able to capture a vmcore to your system's local file
+system, kdump can be configured to capture a vmcore to a number of other
+locations, including a raw disk partition, a dedicated file system, an NFS
+mounted file system, or a remote system via ssh/scp. Additional options
+exist for specifying the relative path under which the dump is captured,
+what to do if the capture fails, and for compressing and filtering the dump
+(so as to produce smaller, more manageable, vmcore files, see "Advanced Setups"
+for more detail on these options).
+
+In theory, dumping to a location other than the local file system should be
+safer than kdump's default setup, as its possible the default setup will try
+dumping to a file system that has become corrupted. The raw disk partition and
+dedicated file system options allow you to still dump to the local system,
+but without having to remount your possibly corrupted file system(s),
+thereby decreasing the chance a vmcore won't be captured. Dumping to an
+NFS server or remote system via ssh/scp also has this advantage, as well
+as allowing for the centralization of vmcore files, should you have several
+systems from which you'd like to obtain vmcore files. Of course, note that
+these configurations could present problems if your network is unreliable.
+
+Kdump target and advanced setups are configured via modifications to
+/etc/kdump.conf, which out of the box, is fairly well documented itself.
+Any alterations to /etc/kdump.conf should be followed by a restart of the
+kdump service, so the changes can be incorporated in the kdump initrd.
+Restarting the kdump service is as simple as '/sbin/systemctl restart kdump.service'.
+
+There are two ways to config the dump target, config dump target only
+using "path", and config dump target explicitly. Interpretation of "path"
+also differs in two config styles.
+
+Config dump target only using "path"
+------------------------------------
+
+You can change the dump target by setting "path" to a mount point where
+dump target is mounted. When there is no explicitly configured dump target,
+"path" in kdump.conf represents the current file system path in which vmcore
+will be saved.  Kdump will automatically detect the underlying device of
+"path" and use that as the dump target.
+
+In fact, upon dump, kdump creates a directory $hostip-$date with-in "path"
+and saves vmcore there. So practically dump is saved in $path/$hostip-$date/.
+
+Kdump will only check current mount status for mount entry corresponding to
+"path". So please ensure the dump target is mounted on "path" before kdump
+service starts.
+
+NOTES:
+
+- It's strongly recommanded to put an mount entry for "path" in /etc/fstab
+  and have it auto mounted on boot. This make sure the dump target is
+  reachable from the machine and kdump's configuration is stable.
+
+EXAMPLES:
+
+- path /var/crash/
+
+  This is the default configuration. Assuming there is no disk mounted
+  on /var/ or on /var/crash, dump will be saved on disk backing rootfs
+  in directory /var/crash.
+
+- path /var/crash/ (A separate disk mounted on /var/crash)
+
+  Say a disk /dev/sdb is mounted on /var. In this case dump target will
+  become /dev/sdb and path will become "/" and dump will be saved
+  on "sdb:/var/crash/" directory.
+
+- path /var/crash/ (NFS mounted on /var)
+
+  Say foo.com:/export/tmp is mounted on /var. In this case dump target is
+  nfs server and path will be adjusted to "/crash" and dump will be saved to
+  foo.com:/export/tmp/crash/ directory.
+
+Config dump target explicitely
+------------------------------
+
+You can set the dump target explicitly in kdump.conf, and "path" will be
+the relative path in the specified dump target. For example, if dump
+target is "ext4 /dev/sda", then dump will be saved in "path" directory
+on /dev/sda.
+
+Same is the case for nfs dump. If user specified "nfs foo.com:/export/tmp/"
+as dump target, then dump will effectively be saved in
+"foo.com:/export/tmp/var/crash/" directory.
+
+If the dump target is "raw", then "path" is ignored.
+
+If it's a filesystem target, kdump will need to know the right mount option.
+Kdump will check current mount status, and then /etc/fstab for mount options
+corresponding to the specified dump target and use it. If there are
+special mount option required for the dump target, it could be set by put
+an entry in fstab.
+
+If there are no related mount entry, mount option is set to "defaults".
+
+NOTES:
+
+- It's recommended to put an entry for the dump target in /etc/fstab
+  and have it auto mounted on boot. This make sure the dump target is
+  reachable from the machine and kdump won't fail.
+
+- Kdump ignores some mount options, including "noauto", "ro". This
+  make it possible to keep the dump target unmounted or read-only
+  when not used.
+
+EXAMPLES:
+
+- ext4 /dev/sda (mounted)
+  path /var/crash/
+
+  In this case dump target is set to /dev/sdb, path is the absolute path
+  "/var/crash" in /dev/sda, vmcore path will saved on
+  "sda:/var/crash" directory.
+
+- nfs foo.com:/export/tmp (mounted)
+  path /var/crash/
+
+  In this case dump target is nfs server, path is the absolute path
+  "/var/crash", vmcore path will saved on "foo.com:/export/tmp/crash/" directory.
+
+- nfs foo.com:/export/tmp (not mounted)
+  path /var/crash/
+
+  Same with above case, kdump will use "defaults" as the mount option
+  for the dump target.
+
+- nfs foo.com:/export/tmp (not mounted, entry with option "noauto,nolock" exists in /etc/fstab)
+  path /var/crash/
+
+  In this case dump target is nfs server, vmcore path will saved on
+  "foo.com:/export/tmp/crash/" directory, and kdump will inherit "nolock" option.
+
+Dump target and mkdumprd
+------------------------
+
+MKdumprd is the tool used to create kdump initramfs, and it may change
+the mount status of the dump target in some condition.
+
+Usually the dump target should be used only for kdump. If you worry about
+someone uses the filesystem for something else other than dumping vmcore
+you can mount it as read-only or make it a noauto mount. Mkdumprd will
+mount/remount it as read-write for creating dump directory and will
+move it back to it's original state afterwards.
+
+Supported dump target types and requirements
+--------------------------------------------
+
+1) Raw partition
+
+Raw partition dumping requires that a disk partition in the system, at least
+as large as the amount of memory in the system, be left unformatted. Assuming
+/dev/vg/lv_kdump is left unformatted, kdump.conf can be configured with
+'raw /dev/vg/lv_kdump', and the vmcore file will be copied via dd directly
+onto partition /dev/vg/lv_kdump. Restart the kdump service via
+'/sbin/systemctl restart kdump.service' to commit this change to your kdump
+initrd. Dump target should be persistent device name, such as lvm or device
+mapper canonical name.
+
+2) Dedicated file system
+
+Similar to raw partition dumping, you can format a partition with the file
+system of your choice, Again, it should be at least as large as the amount
+of memory in the system. Assuming it should be at least as large as the
+amount of memory in the system. Assuming /dev/vg/lv_kdump has been
+formatted ext4, specify 'ext4 /dev/vg/lv_kdump' in kdump.conf, and a
+vmcore file will be copied onto the file system after it has been mounted.
+Dumping to a dedicated partition has the advantage that you can dump multiple
+vmcores to the file system, space permitting, without overwriting previous ones,
+as would be the case in a raw partition setup. Restart the kdump service via
+'/sbin/systemctl restart kdump.service' to commit this change to
+your kdump initrd.  Note that for local file systems ext4 and ext2 are
+supported as dumpable targets.  Kdump will not prevent you from specifying
+other filesystems, and they will most likely work, but their operation
+cannot be guaranteed.  for instance specifying a vfat filesystem or msdos
+filesystem will result in a successful load of the kdump service, but during
+crash recovery, the dump will fail if the system has more than 2GB of memory
+(since vfat and msdos filesystems do not support more than 2GB files).
+Be careful of your filesystem selection when using this target.
+
+It is recommended to use persistent device names or UUID/LABEL for file system
+dumps. One example of persistent device is /dev/vg/<devname>.
+
+3) NFS mount
+
+Dumping over NFS requires an NFS server configured to export a file system
+with full read/write access for the root user. All operations done within
+the kdump initial ramdisk are done as root, and to write out a vmcore file,
+we obviously must be able to write to the NFS mount. Configuring an NFS
+server is outside the scope of this document, but either the no_root_squash
+or anonuid options on the NFS server side are likely of interest to permit
+the kdump initrd operations write to the NFS mount as root.
+
+Assuming your're exporting /dump on the machine nfs-server.example.com,
+once the mount is properly configured, specify it in kdump.conf, via
+'nfs nfs-server.example.com:/dump'. The server portion can be specified either
+by host name or IP address. Following a system crash, the kdump initrd will
+mount the NFS mount and copy out the vmcore to your NFS server. Restart the
+kdump service via '/sbin/systemctl restart kdump.service' to commit this change
+to your kdump initrd.
+
+4) Special mount via "dracut_args"
+
+You can utilize "dracut_args" to pass "--mount" to kdump, see dracut manpage
+about the format of "--mount" for details. If there is any "--mount" specified
+via "dracut_args", kdump will build it as the mount target without doing any
+validation (mounting or checking like mount options, fs size, save path, etc),
+so you must test it to ensure all the correctness. You cannot use other targets
+in /etc/kdump.conf if you use "--mount" in "dracut_args". You also cannot specify
+mutliple "--mount" targets via "dracut_args".
+
+One use case of "--mount" in "dracut_args" is you do not want to mount dump target
+before kdump service startup, for example, to reduce the burden of the shared nfs
+server. Such as the example below:
+dracut_args --mount "192.168.1.1:/share /mnt/test nfs4 defaults"
+
+NOTE:
+- <mountpoint> must be specified as an absolute path.
+
+5) Remote system via ssh/scp
+
+Dumping over ssh/scp requires setting up passwordless ssh keys for every
+machine you wish to have dump via this method. First up, configure kdump.conf
+for ssh/scp dumping, adding a config line of 'ssh user@server', where 'user'
+can be any user on the target system you choose, and 'server' is the host
+name or IP address of the target system. Using a dedicated, restricted user
+account on the target system is recommended, as there will be keyless ssh
+access to this account.
+
+Once kdump.conf is appropriately configured, issue the command
+'kdumpctl propagate' to automatically set up the ssh host keys and transmit
+the necessary bits to the target server. You'll have to type in 'yes'
+to accept the host key for your targer server if this is the first time
+you've connected to it, and then input the target system user's password
+to send over the necessary ssh key file. Restart the kdump service via
+'/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+
+Advanced Setups
+===============
+
+Kdump boot directory
+--------------------
+
+Usually kdump kernel is the same as 1st kernel. So kdump will try to find
+kdump kernel under /boot according to /proc/cmdline. E.g we execute below
+command and get an output:
+	cat /proc/cmdline
+	BOOT_IMAGE=/xxx/vmlinuz-3.yyy.zzz  root=xxxx .....
+Then kdump kernel will be /boot/xxx/vmlinuz-3.yyy.zzz.
+However a variable KDUMP_BOOTDIR in /etc/sysconfig/kdump is provided to
+user if kdump kernel is put in a different directory.
+
+Kdump Post-Capture Executable
+-----------------------------
+
+It is possible to specify a custom script or binary you wish to run following
+an attempt to capture a vmcore. The executable is passed an exit code from
+the capture process, which can be used to trigger different actions from
+within your post-capture executable.
+If /etc/kdump/post.d directory exist, All files in the directory are
+collectively sorted and executed in lexical order, before binary or script
+specified kdump_post parameter is executed.
+
+Kdump Pre-Capture Executable
+----------------------------
+
+It is possible to specify a custom script or binary you wish to run before
+capturing a vmcore. Exit status of this binary is interpreted:
+0 - continue with dump process as usual
+non 0 - run the final action (reboot/poweroff/halt)
+If /etc/kdump/pre.d directory exists, all files in the directory are collectively
+sorted and executed in lexical order, after binary or script specified
+kdump_pre parameter is executed.
+Even if the binary or script in /etc/kdump/pre.d directory returns non 0
+exit status, the processing is continued.
+
+Extra Binaries
+--------------
+
+If you have specific binaries or scripts you want to have made available
+within your kdump initrd, you can specify them by their full path, and they
+will be included in your kdump initrd, along with all dependent libraries.
+This may be particularly useful for those running post-capture scripts that
+rely on other binaries.
+
+Extra Modules
+-------------
+
+By default, only the bare minimum of kernel modules will be included in your
+kdump initrd. Should you wish to capture your vmcore files to a non-boot-path
+storage device, such as an iscsi target disk or clustered file system, you may
+need to manually specify additional kernel modules to load into your kdump
+initrd.
+
+Failure action
+--------------
+
+Failure action specifies what to do when dump to configured dump target
+fails. By default, failure action is "reboot" and that is system reboots
+if attempt to save dump to dump target fails.
+
+There are other failure actions available though.
+
+- dump_to_rootfs
+  This option tries to mount root and save dump on root filesystem
+  in a path specified by "path". This option will generally make
+  sense when dump target is not root filesystem. For example, if
+  dump is being saved over network using "ssh" then one can specify
+  failure action to "dump_to_rootfs" to try saving dump to root
+  filesystem if dump over network fails.
+
+- shell
+  Drop into a shell session inside initramfs.
+
+- halt
+  Halt system after failure
+
+- poweroff
+  Poweroff system after failure.
+
+Compression and filtering
+-------------------------
+
+The 'core_collector' parameter in kdump.conf allows you to specify a custom
+dump capture method. The most common alternate method is makedumpfile, which
+is a dump filtering and compression utility provided with kexec-tools. On
+some architectures, it can drastically reduce the size of your vmcore files,
+which becomes very useful on systems with large amounts of memory.
+
+A typical setup is 'core_collector makedumpfile -F -l --message-level 1 -d 31',
+but check the output of '/sbin/makedumpfile --help' for a list of all available
+options (-i and -g don't need to be specified, they're automatically taken care
+of). Note that use of makedumpfile requires that the kernel-debuginfo package
+corresponding with your running kernel be installed.
+
+Core collector command format depends on dump target type. Typically for
+filesystem (local/remote), core_collector should accept two arguments.
+First one is source file and second one is target file. For ex.
+
+- ex1.
+
+  core_collector "cp --sparse=always"
+
+  Above will effectively be translated to:
+
+  cp --sparse=always /proc/vmcore <dest-path>/vmcore
+
+- ex2.
+
+  core_collector "makedumpfile -l --message-level 1 -d 31"
+
+  Above will effectively be translated to:
+
+  makedumpfile -l --message-level 1 -d 31 /proc/vmcore <dest-path>/vmcore
+
+For dump targets like raw and ssh, in general, core collector should expect
+one argument (source file) and should output the processed core on standard
+output (There is one exception of "scp", discussed later). This standard
+output will be saved to destination using appropriate commands.
+
+raw dumps core_collector examples:
+
+- ex3.
+
+  core_collector "cat"
+
+  Above will effectively be translated to.
+
+  cat /proc/vmcore | dd of=<target-device>
+
+- ex4.
+
+  core_collector "makedumpfile -F -l --message-level 1 -d 31"
+
+  Above will effectively be translated to.
+
+  makedumpfile -F -l --message-level 1 -d 31 | dd of=<target-device>
+
+ssh dumps core_collector examples:
+
+- ex5.
+
+  core_collector "cat"
+
+  Above will effectively be translated to.
+
+  cat /proc/vmcore | ssh <options> <remote-location> "dd of=path/vmcore"
+
+- ex6.
+
+  core_collector "makedumpfile -F -l --message-level 1 -d 31"
+
+  Above will effectively be translated to.
+
+  makedumpfile -F -l --message-level 1 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore"
+
+There is one exception to standard output rule for ssh dumps. And that is
+scp. As scp can handle ssh destinations for file transfers, one can
+specify "scp" as core collector for ssh targets (no output on stdout).
+
+- ex7.
+
+  core_collector "scp"
+
+  Above will effectively be translated to.
+
+  scp /proc/vmcore <user@host>:path/vmcore
+
+About default core collector
+----------------------------
+
+Default core_collector for ssh/raw dump is:
+"makedumpfile -F -l --message-level 1 -d 31".
+Default core_collector for other targets is:
+"makedumpfile -l --message-level 1 -d 31".
+
+Even if core_collector option is commented out in kdump.conf, makedumpfile
+is default core collector and kdump uses it internally.
+
+If one does not want makedumpfile as default core_collector, then they
+need to specify one using core_collector option to change the behavior.
+
+Note: If "makedumpfile -F" is used then you will get a flattened format
+vmcore.flat, you will need to use "makedumpfile -R" to rearrange the
+dump data from stdard input to a normal dumpfile (readable with analysis
+tools).
+For example: "makedumpfile -R vmcore < vmcore.flat"
+
+
+Caveats
+=======
+
+Console frame-buffers and X are not properly supported. If you typically run
+with something along the lines of "vga=791" in your kernel config line or
+have X running, console video will be garbled when a kernel is booted via
+kexec. Note that the kdump kernel should still be able to create a dump,
+and when the system reboots, video should be restored to normal.
+
+
+Notes
+=====
+
+Notes on resetting video:
+-------------------------
+
+Video is a notoriously difficult issue with kexec.  Video cards contain ROM code
+that controls their initial configuration and setup.  This code is nominally
+accessed and executed from the Bios, and otherwise not safely executable. Since
+the purpose of kexec is to reboot the system without re-executing the Bios, it
+is rather difficult if not impossible to reset video cards with kexec.  The
+result is, that if a system crashes while running in a graphical mode (i.e.
+running X), the screen may appear to become 'frozen' while the dump capture is
+taking place.  A serial console will of course reveal that the system is
+operating and capturing a vmcore image, but a casual observer will see the
+system as hung until the dump completes and a true reboot is executed.
+
+There are two possiblilties to work around this issue.  One is by adding
+--reset-vga to the kexec command line options in /etc/sysconfig/kdump.  This
+tells kdump to write some reasonable default values to the video card register
+file, in the hopes of returning it to a text mode such that boot messages are
+visible on the screen.  It does not work with all video cards however.
+Secondly, it may be worth trying to add vga15fb.ko to the extra_modules list in
+/etc/kdump.conf.  This will attempt to use the video card in framebuffer mode,
+which can blank the screen prior to the start of a dump capture.
+
+Notes on rootfs mount
+---------------------
+
+Dracut is designed to mount rootfs by default. If rootfs mounting fails it
+will refuse to go on. So kdump leaves rootfs mounting to dracut currently.
+We make the assumtion that proper root= cmdline is being passed to dracut
+initramfs for the time being. If you need modify "KDUMP_COMMANDLINE=" in
+/etc/sysconfig/kdump, you will need to make sure that appropriate root=
+options are copied from /proc/cmdline. In general it is best to append
+command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing
+the original command line completely.
+
+Notes on watchdog module handling
+---------------------------------
+
+If a watchdog is active in first kernel then, we must have it's module
+loaded in crash kernel, so that either watchdog is deactivated or started
+being kicked in second kernel. Otherwise, we might face watchdog reboot
+when vmcore is being saved. When dracut watchdog module is enabled, it
+installs kernel watchdog module of active watchdog device in initrd.
+kexec-tools always add "-a watchdog" to the dracut_args if there exists at
+least one active watchdog and user has not added specifically "-o watchdog"
+in dracut_args of kdump.conf. If a watchdog module (such as hp_wdt) has
+not been written in watchdog-core framework then this option will not have
+any effect and module will not be added. Please note that only systemd
+watchdog daemon is supported as watchdog kick application.
+
+Notes for disk images
+---------------------
+
+Kdump initramfs is a critical component for capturing the crash dump.
+But it's strictly generated for the machine it will run on, and have
+no generality. If you install a new machine with a previous disk image
+(eg. VMs created with disk image or snapshot), kdump could be broken
+easily due to hardware changes or disk ID changes. So it's strongly
+recommended to not include the kdump initramfs in the disk image in the
+first place, this helps to save space, and kdumpctl will build the
+initramfs automatically if it's missing. If you have already installed
+a machine with a disk image which have kdump initramfs embedded, you
+should rebuild the initramfs using "kdumpctl rebuild" command manually,
+or else kdump may not work as expeceted.
+
+Notes on encrypted dump target
+------------------------------
+
+Currently, kdump is not working well with encrypted dump target.
+First, user have to give the password manually in capture kernel,
+so a working interactive terminal is required in the capture kernel.
+And another major issue is that an OOM problem will occur with certain
+encryption setup. For example, the default setup for LUKS2 will use a
+memory hard key derivation function to mitigate brute force attach,
+it's impossible to reduce the memory usage for mounting the encrypted
+target. In such case, you have to either reserved enough memory for
+crash kernel according, or update your encryption setup.
+It's recommanded to use a non-encrypted target (eg. remote target)
+instead.
+
+Notes on device dump
+--------------------
+
+Device dump allows drivers to append dump data to vmcore, so you can
+collect driver specified debug info. The drivers could append the
+data without any limit, and the data is stored in memory, this may
+bring a significant memory stress. So device dump is disabled by default
+by passing "novmcoredd" command line option to the kdump capture kernel.
+If you want to collect debug data with device dump, you need to modify
+"KDUMP_COMMANDLINE_APPEND=" value in /etc/sysconfig/kdump and remove the
+"novmcoredd" option. You also need to increase the "crashkernel=" value
+accordingly in case of OOM issue.
+Besides, kdump initramfs won't automatically include the device drivers
+which support device dump, only device drivers that are required for
+the dump target setup will be included. To ensure the device dump data
+will be included in the vmcore, you need to force include related
+device drivers by using "extra_modules" option in /etc/kdump.conf
+
+
+Parallel Dumping Operation
+==========================
+
+Kexec allows kdump using multiple cpus. So parallel feature can accelerate
+dumping substantially, especially in executing compression and filter.
+For example:
+
+	1."makedumpfile -c --num-threads [THREAD_NUM] /proc/vmcore dumpfile"
+	2."makedumpfile -c /proc/vmcore dumpfile",
+
+	1 has better performance than 2, if THREAD_NUM is larger than two
+	and the usable cpus number is larger than THREAD_NUM.
+
+Notes on how to use multiple cpus on a capture kernel on x86 system:
+
+Make sure that you are using a kernel that supports disable_cpu_apicid
+kernel option as a capture kernel, which is needed to avoid x86 specific
+hardware issue (*). The disable_cpu_apicid kernel option is automatically
+appended by kdumpctl script and is ignored if the kernel doesn't support it.
+
+You need to specify how many cpus to be used in a capture kernel by specifying
+the number of cpus in nr_cpus kernel option in /etc/sysconfig/kdump. nr_cpus
+is 1 at default.
+
+You should use necessary and sufficient number of cpus on a capture kernel.
+Warning: Don't use too many cpus on a capture kernel, or the capture kernel
+may lead to panic due to Out Of Memory.
+
+(*) Without disable_cpu_apicid kernel option, capture kernel may lead to
+hang, system reset or power-off at boot, depending on your system and runtime
+situation at the time of crash.
+
+
+Debugging Tips
+==============
+
+- One can drop into a shell before/after saving vmcore with the help of
+  using kdump_pre/kdump_post hooks. Use following in one of the pre/post
+  scripts to drop into a shell.
+
+  #!/bin/bash
+  _ctty=/dev/ttyS0
+  setsid /bin/sh -i -l 0<>$_ctty 1<>$_ctty 2<>$_ctty
+
+  One might have to change the terminal depending on what they are using.
+
+- Serial console logging for virtual machines
+
+  I generally use "virsh console <domain-name>" to get to serial console.
+  I noticed after dump saving system reboots and when grub menu shows up
+  some of the previously logged messages are no more there. That means
+  any important debugging info at the end will be lost.
+
+  One can log serial console as follows to make sure messages are not lost.
+
+  virsh ttyconsole <domain-name>
+  ln -s <name-of-tty> /dev/modem
+  minicom -C /tmp/console-logs
+
+  Now minicom should be logging serial console in file console-logs.
diff --git a/kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch b/kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
new file mode 100644
index 0000000..966f007
--- /dev/null
+++ b/kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
@@ -0,0 +1,98 @@
+From 23daba8bb97ff4291447e54859ed759cfe07975e Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@redhat.com>
+Date: Wed, 29 Jan 2020 10:48:27 +0800
+Subject: [PATCH] kexec-tools: Remove duplicated variable declarations
+
+When building kexec-tools for Fedora 32, following error is observed:
+
+/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
+kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
+
+And apparently, these variables are wrongly declared multiple times. So
+remove duplicated declaration.
+
+Signed-off-by: Kairui Song <kasong@redhat.com>
+---
+ kexec/arch/arm64/kexec-arm64.h      | 6 +++---
+ kexec/arch/ppc64/kexec-elf-ppc64.c  | 2 --
+ kexec/arch/x86_64/kexec-bzImage64.c | 1 -
+ kexec/fs2dt.h                       | 2 +-
+ 4 files changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
+index 628de79..ed447ac 100644
+--- a/kexec/arch/arm64/kexec-arm64.h
++++ b/kexec/arch/arm64/kexec-arm64.h
+@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
+ void zImage_arm64_usage(void);
+ 
+ 
+-off_t initrd_base;
+-off_t initrd_size;
++extern off_t initrd_base;
++extern off_t initrd_size;
+ 
+ /**
+  * struct arm64_mem - Memory layout info.
+@@ -65,7 +65,7 @@ struct arm64_mem {
+ };
+ 
+ #define arm64_mem_ngv UINT64_MAX
+-struct arm64_mem arm64_mem;
++extern struct arm64_mem arm64_mem;
+ 
+ uint64_t get_phys_offset(void);
+ uint64_t get_vp_offset(void);
+diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
+index 3510b70..695b8b0 100644
+--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
++++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
+@@ -44,8 +44,6 @@
+ uint64_t initrd_base, initrd_size;
+ unsigned char reuse_initrd = 0;
+ const char *ramdisk;
+-/* Used for enabling printing message from purgatory code */
+-int my_debug = 0;
+ 
+ int elf_ppc64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
+index 8edb3e4..ba8dc48 100644
+--- a/kexec/arch/x86_64/kexec-bzImage64.c
++++ b/kexec/arch/x86_64/kexec-bzImage64.c
+@@ -42,7 +42,6 @@
+ #include <arch/options.h>
+ 
+ static const int probe_debug = 0;
+-int bzImage_support_efi_boot;
+ 
+ int bzImage64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
+index 7633273..fe24931 100644
+--- a/kexec/fs2dt.h
++++ b/kexec/fs2dt.h
+@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
+ 
+ /* Used for enabling printing message from purgatory code
+  * Only has implemented for PPC64 */
+-int my_debug;
++extern int my_debug;
+ extern int dt_no_old_root;
+ 
+ void reserve(unsigned long long where, unsigned long long length);
+-- 
+2.24.1
+
diff --git a/kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch b/kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
new file mode 100644
index 0000000..8d77b9b
--- /dev/null
+++ b/kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
@@ -0,0 +1,36 @@
+From 2837fb1f5f8362976c188b30ebe50dc8b0377f64 Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@redhat.com>
+Date: Wed, 29 Jan 2020 11:33:18 +0800
+Subject: [PATCH] Remove duplicated variable declaration
+
+When building on Fedora 32, following error is observed:
+
+...
+/usr/bin/ld: ../eppic/libeppic/libeppic.a(eppic_stat.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: multiple definition of `lastv';
+../eppic/libeppic/libeppic.a(eppic_func.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: first defined here
+...
+
+And apparently, the variable is wrongly declared multiple times. So
+remove duplicated declaration.
+
+Signed-off-by: Kairui Song <kasong@redhat.com>
+---
+ libeppic/eppic.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libeppic/eppic.h b/libeppic/eppic.h
+index 5664583..836b475 100644
+--- a/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
++++ b/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
+@@ -471,7 +471,7 @@ type_t  *eppic_addstorage(type_t *t1, type_t *t2);
+ type_t  *eppic_getvoidstruct(int ctype);
+ 
+ extern int lineno, needvar, instruct, nomacs, eppic_legacy;
+-node_t *lastv;
++extern node_t *lastv;
+ 
+ #define NULLNODE ((node_t*)0)
+ 
+-- 
+2.24.1
+
diff --git a/kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch b/kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch
new file mode 100644
index 0000000..3f0fb33
--- /dev/null
+++ b/kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch
@@ -0,0 +1,88 @@
+From 940c3a1e1a304fbecc850c593a272215b0f52eab Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@redhat.com>
+Date: Wed, 31 Jul 2019 16:30:47 +0800
+Subject: [PATCH] x86: Fix broken multiboot2 buliding for i386
+
+When building for i386, an error occured:
+
+kexec/arch/i386/kexec-x86.c:39:22: error: 'multiboot2_x86_probe'
+undeclared here (not in a function); did you mean 'multiboot_x86_probe'?
+39 |  { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
+   |                      ^~~~~~~~~~~~~~~~~~~~
+   |                      multiboot_x86_probe
+
+kexec/arch/i386/kexec-x86.c:39:44: error: 'multiboot2_x86_load'
+undeclared here (not in a function); did you mean 'multiboot_x86_load'?
+39 |  { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
+   |                                            ^~~~~~~~~~~~~~~~~~~
+   |                                            multiboot_x86_load
+kexec/arch/i386/kexec-x86.c:40:4: error: 'multiboot2_x86_usage'
+ undeclared here (not in a function); did you mean 'multiboot_x86_usage'?
+40 |    multiboot2_x86_usage },
+   |    ^~~~~~~~~~~~~~~~~~~~
+   |    multiboot_x86_usage
+
+Fix this issue by putting the definition in the right header, also tidy
+up Makefile.
+
+Fixes: 22a2ed55132e ("x86: Support multiboot2 images")
+Signed-off-by: Kairui Song <kasong@redhat.com>
+---
+ kexec/arch/i386/Makefile         | 2 +-
+ kexec/arch/i386/kexec-x86.h      | 5 +++++
+ kexec/arch/x86_64/kexec-x86_64.h | 5 -----
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/kexec/arch/i386/Makefile b/kexec/arch/i386/Makefile
+index 105cefd..f486103 100644
+--- a/kexec/arch/i386/Makefile
++++ b/kexec/arch/i386/Makefile
+@@ -7,6 +7,7 @@ i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-rel-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-bzImage.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-multiboot-x86.c
++i386_KEXEC_SRCS += kexec/arch/i386/kexec-mb2-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-beoboot-x86.c
+ i386_KEXEC_SRCS += kexec/arch/i386/kexec-nbi.c
+ i386_KEXEC_SRCS += kexec/arch/i386/x86-linux-setup.c
+@@ -14,7 +15,6 @@ i386_KEXEC_SRCS += kexec/arch/i386/crashdump-x86.c
+ 
+ dist += kexec/arch/i386/Makefile $(i386_KEXEC_SRCS)			\
+ 	kexec/arch/i386/crashdump-x86.h					\
+-	kexec/arch/i386/kexec-mb2-x86.c					\
+ 	kexec/arch/i386/kexec-x86.h					\
+ 	kexec/arch/i386/x86-linux-setup.h				\
+ 	kexec/arch/i386/include/arch/options.h
+diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
+index 1b58c3b..16d0f6c 100644
+--- a/kexec/arch/i386/kexec-x86.h
++++ b/kexec/arch/i386/kexec-x86.h
+@@ -60,6 +60,11 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
+ 	struct kexec_info *info);
+ void multiboot_x86_usage(void);
+ 
++int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len,
++                       struct kexec_info *info);
++void multiboot2_x86_usage(void);
++int multiboot2_x86_probe(const char *buf, off_t buf_len);
++
+ int elf_x86_probe(const char *buf, off_t len);
+ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
+ 	struct kexec_info *info);
+diff --git a/kexec/arch/x86_64/kexec-x86_64.h b/kexec/arch/x86_64/kexec-x86_64.h
+index 21c3a73..4cdeffb 100644
+--- a/kexec/arch/x86_64/kexec-x86_64.h
++++ b/kexec/arch/x86_64/kexec-x86_64.h
+@@ -33,9 +33,4 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
+ 			struct kexec_info *info);
+ void bzImage64_usage(void);
+ 
+-int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len,
+-			struct kexec_info *info);
+-void multiboot2_x86_usage(void);
+-int multiboot2_x86_probe(const char *buf, off_t buf_len);
+-
+ #endif /* KEXEC_X86_64_H */
+-- 
+2.21.0
+
diff --git a/kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch b/kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch
new file mode 100644
index 0000000..5314ad9
--- /dev/null
+++ b/kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch
@@ -0,0 +1,255 @@
+From 989152e113bfcb4fbfbad6f3aed6f43be4455919 Mon Sep 17 00:00:00 2001
+From: Kazuhito Hagio <k-hagio-ab@nec.com>
+Date: Tue, 25 Feb 2020 16:04:55 -0500
+Subject: [PATCH] Introduce --check-params option
+
+Currently it's difficult to check whether a makedumpfile command-line
+is valid or not without an actual panic.  This is inefficient and if
+a wrong configuration is not tested, you will miss the vmcore when an
+actual panic occurs.
+
+In order for kdump facilities like kexec-tools to be able to check
+the specified command-line parameters in advance, introduce the
+--check-params option that only checks them and exits immediately.
+
+Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
+---
+ makedumpfile.8 |  5 ++++
+ makedumpfile.c | 75 ++++++++++++++++++++++++++++++++++++++------------
+ print_info.c   |  4 +++
+ 4 files changed, 69 insertions(+), 17 deletions(-)
+
+diff --git a/makedumpfile-1.6.7/makedumpfile.8 b/makedumpfile-1.6.7/makedumpfile.8
+index bf156a8..c5d4806 100644
+--- a/makedumpfile-1.6.7/makedumpfile.8
++++ b/makedumpfile-1.6.7/makedumpfile.8
+@@ -632,6 +632,11 @@ Show help message and LZO/snappy support status (enabled/disabled).
+ \fB\-v\fR
+ Show the version of makedumpfile.
+ 
++.TP
++\fB\-\-check-params\fR
++Only check whether the command-line parameters are valid or not, and exit.
++Preferable to be given as the first parameter.
++
+ .SH ENVIRONMENT VARIABLES
+ 
+ .TP 8
+diff --git a/makedumpfile-1.6.7/makedumpfile.c b/makedumpfile-1.6.7/makedumpfile.c
+index 607e07f..f5860a1 100644
+--- a/makedumpfile-1.6.7/makedumpfile.c
++++ b/makedumpfile-1.6.7/makedumpfile.c
+@@ -10978,12 +10978,6 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
+ 	if (info->flag_generate_vmcoreinfo || info->flag_rearrange)
+ 		return FALSE;
+ 
+-	if ((message_level < MIN_MSG_LEVEL)
+-	    || (MAX_MSG_LEVEL < message_level)) {
+-		message_level = DEFAULT_MSG_LEVEL;
+-		MSG("Message_level is invalid.\n");
+-		return FALSE;
+-	}
+ 	if ((info->flag_compress && info->flag_elf_dumpfile)
+ 	    || (info->flag_read_vmcoreinfo && info->name_vmlinux)
+ 	    || (info->flag_read_vmcoreinfo && info->name_xen_syms))
+@@ -11013,6 +11007,11 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
+ 	if (info->flag_partial_dmesg && !info->flag_dmesg)
+ 		return FALSE;
+ 
++	if (info->flag_excludevm && !info->working_dir) {
++		MSG("-%c requires --work-dir\n", OPT_EXCLUDE_UNUSED_VM);
++		return FALSE;
++	}
++
+ 	if ((argc == optind + 2) && !info->flag_flatten
+ 				 && !info->flag_split
+ 				 && !info->flag_sadump_diskset) {
+@@ -11408,6 +11407,23 @@ int show_mem_usage(void)
+ 	return TRUE;
+ }
+ 
++static int set_message_level(char *str_ml)
++{
++	int ml;
++
++	ml = atoi(str_ml);
++	if ((ml < MIN_MSG_LEVEL) || (MAX_MSG_LEVEL < ml)) {
++		message_level = DEFAULT_MSG_LEVEL;
++		MSG("Message_level(%d) is invalid.\n", ml);
++		return FALSE;
++	}
++
++	if (info->flag_check_params)
++		return TRUE;
++
++	message_level = ml;
++	return TRUE;
++}
+ 
+ static struct option longopts[] = {
+ 	{"split", no_argument, NULL, OPT_SPLIT},
+@@ -11429,6 +11445,7 @@ static struct option longopts[] = {
+ 	{"splitblock-size", required_argument, NULL, OPT_SPLITBLOCK_SIZE},
+ 	{"work-dir", required_argument, NULL, OPT_WORKING_DIR},
+ 	{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
++	{"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
+ 	{0, 0, 0, 0}
+ };
+ 
+@@ -11527,7 +11544,8 @@ main(int argc, char *argv[])
+ 			info->flag_compress = DUMP_DH_COMPRESSED_LZO;
+ 			break;
+ 		case OPT_MESSAGE_LEVEL:
+-			message_level = atoi(optarg);
++			if (!set_message_level(optarg))
++				goto out;
+ 			break;
+ 		case OPT_DUMP_DMESG:
+ 			info->flag_dmesg = 1;
+@@ -11590,6 +11608,10 @@ main(int argc, char *argv[])
+ 		case OPT_NUM_THREADS:
+ 			info->num_threads = MAX(atoi(optarg), 0);
+ 			break;
++		case OPT_CHECK_PARAMS:
++			info->flag_check_params = TRUE;
++			message_level = DEFAULT_MSG_LEVEL;
++			break;
+ 		case '?':
+ 			MSG("Commandline parameter is invalid.\n");
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+@@ -11599,11 +11621,9 @@ main(int argc, char *argv[])
+ 	if (flag_debug)
+ 		message_level |= ML_PRINT_DEBUG_MSG;
+ 
+-	if (info->flag_excludevm && !info->working_dir) {
+-		ERRMSG("Error: -%c requires --work-dir\n", OPT_EXCLUDE_UNUSED_VM);
+-		ERRMSG("Try `makedumpfile --help' for more information\n");
+-		return COMPLETED;
+-	}
++	if (info->flag_check_params)
++		/* suppress debugging messages */
++		message_level = DEFAULT_MSG_LEVEL;
+ 
+ 	if (info->flag_show_usage) {
+ 		print_usage();
+@@ -11634,6 +11654,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (!open_files_for_generating_vmcoreinfo())
+ 			goto out;
+ 
+@@ -11657,6 +11680,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (!check_dump_file(info->name_dumpfile))
+ 			goto out;
+ 
+@@ -11677,6 +11703,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (!check_dump_file(info->name_dumpfile))
+ 			goto out;
+ 
+@@ -11690,6 +11719,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (!check_dump_file(info->name_dumpfile))
+ 			goto out;
+ 		if (!dump_dmesg())
+@@ -11703,6 +11735,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (!populate_kernel_version())
+ 			goto out;
+ 
+@@ -11721,6 +11756,9 @@ main(int argc, char *argv[])
+ 			MSG("Try `makedumpfile --help' for more information.\n");
+ 			goto out;
+ 		}
++		if (info->flag_check_params)
++			goto check_ok;
++
+ 		if (info->flag_split) {
+ 			for (i = 0; i < info->num_dumpfile; i++) {
+ 				SPLITTING_FD_BITMAP(i) = -1;
+@@ -11748,13 +11786,16 @@ main(int argc, char *argv[])
+ 			MSG("The dumpfile is saved to %s.\n", info->name_dumpfile);
+ 		}
+ 	}
++check_ok:
+ 	retcd = COMPLETED;
+ out:
+-	MSG("\n");
+-	if (retcd != COMPLETED)
+-		MSG("makedumpfile Failed.\n");
+-	else if (!info->flag_mem_usage)
+-		MSG("makedumpfile Completed.\n");
++	if (!info->flag_check_params) {
++		MSG("\n");
++		if (retcd != COMPLETED)
++			MSG("makedumpfile Failed.\n");
++		else if (!info->flag_mem_usage)
++			MSG("makedumpfile Completed.\n");
++	}
+ 
+ 	free_for_parallel();
+ 
+diff --git a/makedumpfile-1.6.7/makedumpfile.h b/makedumpfile-1.6.7/makedumpfile.h
+index 7217407..03fb4ce 100644
+--- a/makedumpfile-1.6.7/makedumpfile.h
++++ b/makedumpfile-1.6.7/makedumpfile.h
+@@ -1303,6 +1303,7 @@ struct DumpInfo {
+ 	int		flag_read_vmcoreinfo;    /* flag of reading vmcoreinfo file */
+ 	int		flag_show_usage;     /* flag of showing usage */
+ 	int		flag_show_version;   /* flag of showing version */
++	int		flag_check_params;   /* only check parameters */
+ 	int		flag_flatten;        /* flag of outputting flattened
+ 						format to a standard out */
+ 	int		flag_rearrange;      /* flag of creating dumpfile from
+@@ -2364,6 +2365,7 @@ struct elf_prstatus {
+ #define OPT_WORKING_DIR         OPT_START+15
+ #define OPT_NUM_THREADS         OPT_START+16
+ #define OPT_PARTIAL_DMESG       OPT_START+17
++#define OPT_CHECK_PARAMS        OPT_START+18
+ 
+ /*
+  * Function Prototype.
+diff --git a/makedumpfile-1.6.7/print_info.c b/makedumpfile-1.6.7/print_info.c
+index 0be12ea..e0c38b4 100644
+--- a/makedumpfile-1.6.7/print_info.c
++++ b/makedumpfile-1.6.7/print_info.c
+@@ -321,6 +321,10 @@ print_usage(void)
+ 	MSG("  [-v]:\n");
+ 	MSG("      Show the version of makedumpfile.\n");
+ 	MSG("\n");
++	MSG("  [--check-params]:\n");
++	MSG("      Only check whether the command-line parameters are valid or not, and exit.\n");
++	MSG("      Preferable to be given as the first parameter.\n");
++	MSG("\n");
+ 	MSG("  VMLINUX:\n");
+ 	MSG("      This is a pathname to the first kernel's vmlinux.\n");
+ 	MSG("      This file must have the debug information of the first kernel to analyze\n");
+-- 
+2.24.1
+
+
diff --git a/kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch b/kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch
new file mode 100644
index 0000000..f240e8c
--- /dev/null
+++ b/kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch
@@ -0,0 +1,76 @@
+From efa29d476996a20052be80878767cfe09e4b6224 Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@redhat.com>
+Date: Wed, 29 Jan 2020 10:59:08 +0800
+Subject: [PATCH] makedumpfile: Remove duplicated variable declarations
+
+When building on Fedora 32, following error is observed:
+
+/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010:
+multiple definition of `crash_reserved_mem_nr'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010: first defined here
+/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009:
+multiple definition of `crash_reserved_mem'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009: first defined here
+/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278:
+multiple definition of `parallel_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278: first defined here
+/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265:
+multiple definition of `splitting_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265: first defined here
+
+And apparently, these variables are wrongly declared multiple times. So
+remove duplicated declaration.
+
+Signed-off-by: Kairui Song <kasong@redhat.com>
+---
+ makedumpfile.c |  2 ++
+ makedumpfile.h | 10 ++++++----
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/makedumpfile.c b/makedumpfile.c
+index e290fbd..9aad77b 100644
+--- a/makedumpfile-1.6.7/makedumpfile.c
++++ b/makedumpfile-1.6.7/makedumpfile.c
+@@ -34,6 +34,8 @@ struct array_table	array_table;
+ struct number_table	number_table;
+ struct srcfile_table	srcfile_table;
+ struct save_control	sc;
++struct parallel_info	parallel_info_t;
++struct splitting_info	splitting_info_t;
+ 
+ struct vm_table		vt = { 0 };
+ struct DumpInfo		*info = NULL;
+diff --git a/makedumpfile.h b/makedumpfile.h
+index 68d9691..614764c 100644
+--- a/makedumpfile-1.6.7/makedumpfile.h
++++ b/makedumpfile-1.6.7/makedumpfile.h
+@@ -1262,7 +1262,8 @@ struct splitting_info {
+ 	mdf_pfn_t		end_pfn;
+ 	off_t			offset_eraseinfo;
+ 	unsigned long		size_eraseinfo;
+-} splitting_info_t;
++};
++extern struct splitting_info splitting_info_t;
+ 
+ struct parallel_info {
+ 	int			fd_memory;
+@@ -1275,7 +1276,8 @@ struct parallel_info {
+ #ifdef USELZO
+ 	lzo_bytep		wrkmem;
+ #endif
+-} parallel_info_t;
++};
++extern struct parallel_info parallel_info_t;
+ 
+ struct ppc64_vmemmap {
+ 	unsigned long		phys;
+@@ -2006,8 +2008,8 @@ struct memory_range {
+ };
+ 
+ #define CRASH_RESERVED_MEM_NR   8
+-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
+-int crash_reserved_mem_nr;
++extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
++extern int crash_reserved_mem_nr;
+ 
+ unsigned long read_vmcoreinfo_symbol(char *str_symbol);
+ int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
+-- 
+2.24.1
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
new file mode 100644
index 0000000..669fd6c
--- /dev/null
+++ b/kexec-tools.spec
@@ -0,0 +1,2038 @@
+%global eppic_ver d84c3541035d95077aa8571f5d5c3e07c6ef510b
+%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
+%global mkdf_ver 1.6.7
+
+Name: kexec-tools
+Version: 2.0.20
+Release: 18%{?dist}
+License: GPLv2
+Summary: The kexec/kdump userspace component
+
+Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
+Source1: kdumpctl
+Source2: kdump.sysconfig
+Source3: kdump.sysconfig.x86_64
+Source4: kdump.sysconfig.i386
+Source5: kdump.sysconfig.ppc64
+Source7: mkdumprd
+Source8: kdump.conf
+Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/%{mkdf_ver}/makedumpfile-%{mkdf_ver}.tar.gz
+Source10: kexec-kdump-howto.txt
+Source11: fadump-howto.txt
+Source12: mkdumprd.8
+Source13: 98-kexec.rules
+Source14: 98-kexec.rules.ppc64
+Source15: kdump.conf.5
+Source16: kdump.service
+Source18: kdump.sysconfig.s390x
+Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz
+Source20: kdump-lib.sh
+Source21: kdump-in-cluster-environment.txt
+Source22: kdump-dep-generator.sh
+Source23: kdump-lib-initramfs.sh
+Source24: kdump.sysconfig.ppc64le
+Source25: kdumpctl.8
+Source26: live-image-kdump-howto.txt
+Source27: early-kdump-howto.txt
+Source28: kdump-udev-throttler
+Source29: kdump.sysconfig.aarch64
+Source30: 60-kdump.install
+
+#######################################
+# These are sources for mkdumpramfs
+# Which is currently in development
+#######################################
+Source100: dracut-kdump.sh
+Source101: dracut-module-setup.sh
+Source102: dracut-monitor_dd_progress
+Source103: dracut-kdump-error-handler.sh
+Source104: dracut-kdump-emergency.service
+Source105: dracut-kdump-error-handler.service
+Source106: dracut-kdump-capture.service
+Source107: dracut-kdump-emergency.target
+Source108: dracut-early-kdump.sh
+Source109: dracut-early-kdump-module-setup.sh
+
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(pre): coreutils sed zlib
+Requires: dracut >= 050
+Requires: dracut-network >= 050
+Requires: dracut-squash >= 050
+Requires: ethtool
+BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
+BuildRequires: pkgconfig intltool gettext
+BuildRequires: systemd-units
+BuildRequires: automake autoconf libtool
+%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
+Obsoletes: diskdumputils netdump kexec-tools-eppic
+%endif
+
+%ifnarch s390x
+Requires:       systemd-udev%{?_isa}
+%endif
+
+#START INSERT
+
+#
+# Patches 0 through 100 are meant for x86 kexec-tools enablement
+#
+Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch
+
+#
+# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
+#
+
+#
+# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
+#
+
+#
+# Patches 401 through 500 are meant for s390 kexec-tools enablement
+#
+#
+# Patches 501 through 600 are meant for ARM kexec-tools enablement
+#
+
+#
+# Patches 601 onward are generic patches
+#
+Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
+Patch602: ./kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch
+Patch603: ./kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
+Patch604: ./kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch
+
+%description
+kexec-tools provides /sbin/kexec binary that facilitates a new
+kernel to boot using the kernel's kexec feature either on a
+normal or a panic reboot. This package contains the /sbin/kexec
+binary and ancillary utilities that together form the userspace
+component of the kernel's kexec feature.
+
+%prep
+%setup -q
+
+mkdir -p -m755 kcp
+tar -z -x -v -f %{SOURCE9}
+tar -z -x -v -f %{SOURCE19}
+
+%patch0 -p1
+
+%patch601 -p1
+%patch602 -p1
+%patch603 -p1
+%patch604 -p1
+
+%ifarch ppc
+%define archdef ARCH=ppc
+%endif
+
+%build
+autoreconf
+%configure \
+%ifarch ppc64
+    --host=powerpc64-redhat-linux-gnu \
+    --build=powerpc64-redhat-linux-gnu \
+%endif
+%ifarch ppc64le
+    --host=powerpc64le-redhat-linux-gnu \
+    --build=powerpc64le-redhat-linux-gnu \
+%endif
+    --sbindir=/usr/sbin
+rm -f kexec-tools.spec.in
+# setup the docs
+cp %{SOURCE10} .
+cp %{SOURCE11} .
+cp %{SOURCE21} .
+cp %{SOURCE26} .
+cp %{SOURCE27} .
+
+make
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+make -C eppic-%{eppic_ver}/libeppic
+make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on
+make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
+%endif
+
+%install
+mkdir -p -m755 $RPM_BUILD_ROOT/usr/sbin
+mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump
+mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/pre.d
+mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/post.d
+mkdir -p -m755 $RPM_BUILD_ROOT%{_localstatedir}/crash
+mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man8/
+mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man5/
+mkdir -p -m755 $RPM_BUILD_ROOT%{_docdir}
+mkdir -p -m755 $RPM_BUILD_ROOT%{_datadir}/kdump
+mkdir -p -m755 $RPM_BUILD_ROOT%{_udevrulesdir}
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
+mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
+mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
+install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
+
+install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec
+install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg
+install -m 644 build/man/man8/kexec.8  $RPM_BUILD_ROOT%{_mandir}/man8/
+install -m 644 build/man/man8/vmcore-dmesg.8  $RPM_BUILD_ROOT%{_mandir}/man8/
+
+SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
+[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_arch}
+[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig
+install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
+
+install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
+install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
+install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
+install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
+install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
+install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
+install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
+%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
+# For s390x the ELF header is created in the kdump kernel and therefore kexec
+# udev rules are not required
+install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
+%endif
+%ifarch ppc64 ppc64le
+install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
+%endif
+install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
+install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
+install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
+install -m 755 -D %{SOURCE30} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60-kdump.install
+
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+install -m 755 makedumpfile-%{mkdf_ver}/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
+install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
+install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
+install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
+install -m 755 makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
+mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
+install -m 644 makedumpfile-%{mkdf_ver}/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
+%endif
+
+%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')
+%define remove_dracut_early_kdump_prefix() %(echo -n %1|sed 's/.*dracut-early-kdump-//g')
+
+# deal with dracut modules
+mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase
+cp %{SOURCE100} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
+cp %{SOURCE101} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
+cp %{SOURCE102} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE102}}
+cp %{SOURCE103} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE103}}
+cp %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE104}}
+cp %{SOURCE105} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE105}}
+cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}}
+cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}}
+chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
+chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
+mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump
+cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
+cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
+chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
+chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
+
+
+%define dracutlibdir %{_prefix}/lib/dracut
+#and move the custom dracut modules to the dracut directory
+mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
+mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
+
+%post
+# Initial installation
+%systemd_post kdump.service
+
+touch /etc/kdump.conf
+# This portion of the script is temporary.  Its only here
+# to fix up broken boxes that require special settings 
+# in /etc/sysconfig/kdump.  It will be removed when 
+# These systems are fixed.
+
+if [ -d /proc/bus/mckinley ]
+then
+	# This is for HP zx1 machines
+	# They require machvec=dig on the kernel command line
+	sed -e's/\(^KDUMP_COMMANDLINE_APPEND.*\)\("$\)/\1 machvec=dig"/' \
+	/etc/sysconfig/kdump > /etc/sysconfig/kdump.new
+	mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
+elif [ -d /proc/sgi_sn ]
+then
+	# This is for SGI SN boxes
+	# They require the --noio option to kexec 
+	# since they don't support legacy io
+	sed -e's/\(^KEXEC_ARGS.*\)\("$\)/\1 --noio"/' \
+	/etc/sysconfig/kdump > /etc/sysconfig/kdump.new
+	mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
+fi
+
+
+%postun
+%systemd_postun_with_restart kdump.service
+
+%preun
+# Package removal, not upgrade
+%systemd_preun kdump.service
+
+%triggerun -- kexec-tools < 2.0.2-3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply kdump
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save kdump >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del kdump >/dev/null 2>&1 || :
+/bin/systemctl try-restart kdump.service >/dev/null 2>&1 || :
+
+
+%triggerin -- kernel-kdump
+touch %{_sysconfdir}/kdump.conf
+
+
+%triggerpostun -- kernel kernel-xen kernel-debug kernel-PAE kernel-kdump
+# List out the initrds here, strip out version nubmers
+# and search for corresponding kernel installs, if a kernel
+# is not found, remove the corresponding kdump initrd
+
+
+IMGDIR=/boot
+for i in `ls $IMGDIR/initramfs*kdump.img 2>/dev/null`
+do
+	KDVER=`echo $i | sed -e's/^.*initramfs-//' -e's/kdump.*$//'`
+	if [ ! -e $IMGDIR/vmlinuz-$KDVER ]
+	then
+		# We have found an initrd with no corresponding kernel
+		# so we should be able to remove it
+		rm -f $i
+	fi
+done
+
+%files
+/usr/sbin/kexec
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+/usr/sbin/makedumpfile
+%endif
+/usr/sbin/mkdumprd
+/usr/sbin/vmcore-dmesg
+%{_bindir}/*
+%{_datadir}/kdump
+%{_prefix}/lib/kdump
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+%{_sysconfdir}/makedumpfile.conf.sample
+%endif
+%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
+%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf
+%ifnarch s390x
+%config %{_udevrulesdir}
+%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%{dracutlibdir}/modules.d/*
+%dir %{_localstatedir}/crash
+%dir %{_sysconfdir}/kdump
+%dir %{_sysconfdir}/kdump/pre.d
+%dir %{_sysconfdir}/kdump/post.d
+%{_mandir}/man8/kdumpctl.8.gz
+%{_mandir}/man8/kexec.8.gz
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+%{_mandir}/man8/makedumpfile.8.gz
+%endif
+%{_mandir}/man8/mkdumprd.8.gz
+%{_mandir}/man8/vmcore-dmesg.8.gz
+%{_mandir}/man5/*
+%{_unitdir}/kdump.service
+%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
+%{_prefix}/lib/kernel/install.d/60-kdump.install
+%doc News
+%license COPYING
+%doc TODO
+%doc kexec-kdump-howto.txt
+%doc early-kdump-howto.txt
+%doc fadump-howto.txt
+%doc kdump-in-cluster-environment.txt
+%doc live-image-kdump-howto.txt
+%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
+%{_libdir}/eppic_makedumpfile.so
+/usr/share/makedumpfile/
+%endif
+
+%changelog
+* Thu Aug 27 2020 Kairui Song <kasong@redhat.com> - 2.0.20-18
+- mkdumprd: Improve the warning message when using encrypted target
+- kdump-lib.sh: Remove is_atomic
+- Refactor kernel image and initrd detection code
+- early-kdump: Use consistent symbol link for kernel and initramfs
+- Add a kernel install hook to clean up kdump initramfs
+
+* Tue Aug 04 2020 Kairui Song <kasong@redhat.com> - 2.0.20-17
+- Drop static lib dependencies
+- Revert "x86_64: enable the kexec file load by default"
+- Revert "s390x: enable the kexec file load by default"
+- kdumpctl: exit if either pre.d or post.d is missing
+- kdump_pre: make notes more precise
+- dracut-kdump.sh: exit shell when machine reboot
+- kdumpctl: detect modification of scripts by its directory's timestamp
+- module-setup.sh: suppress false alarm
+- kexec-tools.spec: make the existence of pre.d and post.d mandatory
+- ppc64/kdump: use kexec_file_load when secureboot is enabled
+
+* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.20-16
+- Second attempt - Rebuilt for
+  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
+
+* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.20-15
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
+
+* Wed Jul 1 2020 Kairui Song <kasong@redhat.com> - 2.0.20-14
+- s390x: enable the kexec file load by default
+- x86_64: enable the kexec file load by default
+- Revert "s390x: add kdump sysconfig option to use the kexec_file_load() syscall"
+- Revert "kdump-lib: switch to the kexec_file_load() syscall on x86_64 by default"
+- kdump.conf: fix a grammar issue
+- man: improve description about /etc/kdump/{pre.d,post.d}interface
+- mkdumprd: Improve the error message for umounted dump target
+- mkdumprd: Fix nfs detection in to_mount
+- Always wrap up call to dracut get_persistent_dev function
+- s390x: add kdump sysconfig option to use the kexec_file_load() syscall
+- mkdumprd: Fix dracut error on multiple extra_modules
+- Fix kdump failure when mount target specified by dracut_args
+- kdump.conf: Specify /etc/kdump/{pre.d,post.d}interface
+- dracut-kdump.sh: Execute the binary and script filesin /etc/kdump/{pre.d,post.d}
+- kdumpctl: Check the update of the binary and script files in /etc/kdump/{pre.d,post.d}
+- dracut-module-setup.sh: Install files under /etc/kdump/{pre.d,post.d} into kdump initramfs
+- Drop switch root capability for non fadump initramfs
+- fadump: update fadump-howto.txt with some more troubleshooting help
+- fadump-howto.txt: source it in spec file
+- Don't inherit swiotlb parameter form 1st kernel by default
+- module-setup.sh: Add "rd.neednet" parameter if network is needed
+- Revert "Add a hook to wait for kdump target in initqueue"
+- kdump.sysconfig: Remove the option 'log_buf_len' from kdump command line
+
+* Fri May 22 2020 Kairui Song <kasong@redhat.com> - 2.0.20-13
+- Update docs for the new noauto dump target support
+- kexec-kdump-howto.txt: Add some format to the document
+- mkdumprd: generate usable kdump initramfs even target is not mounted
+- User get_mount_info to replace findmnt calls
+- kdump-lib.sh: add fstab failback helper for getting mount info
+- Allow calling mkdumprd from kdumpctl even if targat not mounted
+- Add a is_mounted helper
+- Introduce get_kdump_mntpoint_from_target and fix duplicated /
+- Append both nofail and x-systemd.before to kdump mount target
+- Fix the problem that kdump prints redundant /
+- Partially Revert "Don't mount the dump target unless needed"
+- fadump: update fadump-howto.txt with some troubleshooting help
+- Add a new option 'rd.znet_ifname' in order to use it in udev rules
+- Don't unmount the dump target just after saving vmcore
+- dracut-module-setup.sh: fix breakage in get_pcs_fence_kdump_nodes()
+- dracut-module-setup.sh: ensure cluster info is ready before query
+
+* Thu Apr 2 2020 Kairui Song <kasong@redhat.com> - 2.0.20-12
+- Remove adjust_bind_mount_path call
+- No longer treat atomic/silverblue specially
+- mkdumprd: Simplify handling of user specified target
+- mkdumprd: Use get_save_path instead of parsing config
+- Remove is_dump_target_configured
+- dracut-module-setup.sh: improve get_alias()
+
+* Tue Mar 24 2020 Kairui Song <kasong@redhat.com> - 2.0.20-11
+- Fix a potential syntax error
+- Use read_strip_comments to filter the installed kdump.conf
+- kdumpctl: fix driver change detection on latest Fedora
+- kdumpctl: check hostonly-kernel-modules.txt for kernel module
+- dracut-module-setup.sh: Ensure initrd.target.wants dir exists
+- mkdumprd: Use DUMP_TARGET which printing error message during ssh
+- kdump-lib.sh: Fix is_user_configured_dump_target()
+- mkdumprd: Use makedumpfile --check-params option
+- makedumpfile: Introduce --check-params option
+- Improves the early-kdump-howto.txt document in several points:
+
+* Thu Feb 13 2020 Kairui Song <kasong@redhat.com> - 2.0.20-10
+- Add --force option to step 2 in early-kdump-howto.txt
+- Fix typo in early-kdump-howto.txt
+- kexec-tools/module-setup: Ensure eth devices get IP address for VLAN
+- powerpc: enable the scripts to capture dump on POWERNV platform
+- kdump-lib: switch to the kexec_file_load() syscall on x86_64 by default
+
+* Wed Jan 29 2020 Kairui Song <kasong@redhat.com> - 2.0.20-9
+- Fix building failure
+
+* Wed Jan 29 2020 Kairui Song <kasong@redhat.com> - 2.0.20-8
+- Update makedumpfile to 1.6.7
+- Add a hook to wait for kdump target in initqueue
+- Always install sed and awk
+- Fix potential ssh/nfs kdump failure of missing "ip" command
+- kdump-lib.sh: Fix is_nfs_dump_target
+- Always use get_save_path to get the 'path' option
+- kdump-lib: Don't abuse echo, and clean up
+
+* Sun Dec 29 2019 Kairui Song <kasong@redhat.com> - 2.0.20-7
+- Fix building failure due to makedumpfile's compile flag
+- mkdumprd: Fix dracut args parsing
+
+* Thu Nov 28 2019 Kairui Song <kasong@redhat.com> - 2.0.20-6
+- kdump-error-handler.service: Remove ExecStopPost
+- mkdumprd: simplify dracut args parsing
+- Always set vm.zone_reclaim_mode = 3 in kdump kernel
+- kdumpctl: make reload fail proof
+- spec: move binaries from /sbin to /usr/sbin
+- Don't execute final_action if failure_action terminates the system
+- module-setup.sh: Simplify the network setup code
+- mkdumprd: ensure ssh path exists before check size
+- module-setup: re-fix 99kdumpbase network dependency
+- kdumpctl: bail out immediately if host key verification failed
+
+* Tue Oct 15 2019 Kairui Song <kasong@redhat.com> - 2.0.20-5
+- Don't mount the dump target unless needed
+- kdump-lib: strip grub device from kdump_bootdir
+- Add systemd-udev require.
+
+* Tue Sep 24 2019 Kairui Song <kasong@redhat.com> - 2.0.20-4
+- kdumpctl: echo msg when waiting for connection
+- makedumpfile: Fix inconsistent return value from find_vmemmap()
+- makedumpfile: Fix exclusion range in find_vmemmap_pages()
+- makedumpfile: x86_64: Fix incorrect exclusion by -e option with KASLR
+- kdumpctl: distinguish the failed reason of ssh
+- kexec-kdump-howto.txt: Add notes about device dump
+- Disable device dump by default
+- dracut-module-setup: fix bond ifcfg processing
+- dracut-module-setup: filter out localhost for generic_fence_kdump
+- dracut-module-setup: get localhost alias by manual
+
+* Mon Aug 12 2019 Kairui Song <kasong@redhat.com> - 2.0.20-3
+- kdumpctl: wait a while for network ready if dump target is ssh
+- makedumpfile: Increase SECTION_MAP_LAST_BIT to 4
+- makedumpfile: Do not proceed when get_num_dumpable_cyclic() fails
+- Don't forward and drop journalctl logs for fadump
+
+* Fri Aug 02 2019 Kairui Song <kasong@redhat.com> - 2.0.20-2
+- x86: Fix broken multiboot2 buliding for i386
+- dracut-module-setup.sh: skip alias of localhost in get_pcs_fence_kdump_nodes()
+
+* Wed Jul 31 2019 Kairui Song <kasong@redhat.com> - 2.0.20-1
+- Update makedumpfile to 1.6.6
+- dracut-module-setup.sh: Don't use squash module for fadump
+- Forward logs in kdump kernel to console directly
+- kdump.sysconfig/x86_64: Disable HEST by default
+- dracut-kdump-capture.service: Use OnFailureJobMode instead of deprecated OnFailureIsolate
+- makedumpfile: x86_64: Add support for AMD Secure Memory Encryption
+- aarch64/kdump.sysconfig: Make config options similar to x86_64
+- Add aarch64 specific kdump.sysconfig and use 'nr_cpus' instead of 'maxcpus'
+- kdumpctl: check for ssh path availability when rebuild
+- kdumpctl: Check kdump.conf for error when rebuild is called
+
+* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.19-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
+
+* Mon May 20 2019 Kairui Song <kasong@redhat.com> - 2.0.19-2
+- kdumpctl: don't always rebuild when extra_modules is set
+- kdumpctl: follow symlink when checking for modified files
+- Get rid of duplicated strip_comments when reading config
+- earlykdump: provide a prompt message after the rebuilding of kdump initramfs.
+- kexec-kdump-howto.txt: Add document about encrypted targets
+- kexec-kdump-howto.txt: Add document about initramfs rebiuld
+- kdumpctl: Detect block device driver change for initramfs rebuild
+- Revert "kdumpctl: Rebuild initramfs if loaded kernel modules changed"
+- kexec.rules: create dedicated udev rules for ppc64
+- kexec-kdump-howto: Add note on setting correct value of kptr_restrict
+- Update man page for new kdumpctl command: reload / rebuild
+- kdumpctl: add rebuild support
+- mkdumprd: Improve the config reading logic
+
+* Fri Mar 22 2019 Kairui Song <kasong@redhat.com> - 2.0.19-1
+- Update eppic to latest snapshot
+- fadump: leverage kernel support to re-regisgter FADump
+- fadump: use the original initrd to rebuild fadump initrdfrom
+
+* Fri Feb 22 2019 Kairui Song <kasong@redhat.com> - 2.0.18-5
+- Update eppic to latest upstream snapshot
+- Enable building with hardening flags
+- Remove unused patches
+- Remove obsolete Group tag
+- mkdumprd: refine regex on dropping mount options
+
+* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.18-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Tue Jan 22 2019 Kairui Song <kasong@redhat.com> - 2.0.18-3
+- earlykdump: Add a note of final_action option to avoid crash loop
+- Add final_action option to kdump.conf
+- Add failure_action as alias of default and make default obsolete
+- mkdumprd: force drop earlykdump module
+- earlykdump: warn when installed kernel version differs from dracut target
+- earlykdump: add more sanity check when generating initramfs
+- earlykdump: generate symlink with stable name to kernel image and iniramfs
+- earlykdump: fix kexec fails to load the early kdump kernel
+- mkdumprd: allow spaces after 'path' config phrase with network dump setting
+- dracut-module-setup: Don't build squashed image if required modules are missing
+- kdump-lib-initramfs.sh: using -force option when poweroff
+
+* Fri Dec 7 2018 Kairui Song <kasong@redhat.com> - 2.0.18-2
+- Update makedumpfile 1.6.5
+- Make udev reload rules quiet during bootup
+- dracut-module-setup: Fix routing failure on multipath route
+- mkdumprd: drop some nfs mount options when reading from kernel
+- doc/kdump.conf: Local dump path should be <mnt>/<path>/%HOST_IP-%DATE
+- As /etc/kdump.conf timestamp is updated do not compare it when doing rpm --verify
+- Add missing usage info
+
+* Mon Nov 5 2018 Kairui Song <kasong@redhat.com> - 2.0.18-1
+- Update to kexec-tools 2.0.18
+
+* Thu Nov 1 2018 Kairui Song <kasong@redhat.com> - 2.0.17-12
+- Throttle kdump reload request triggered by udev event
+- Rewrite kdump's udev rules
+- kdumpctl: Add reload support
+
+* Mon Oct 15 2018 Kairui Song <kasong@redhat.com> - 2.0.17-11
+- Enable dracut squash module
+- kdumpctl: Print warning in case the raw device is formatted and contains filesystem
+- kdump-lib-initramfs.sh: Add check to remount to rw mode only if dump target is ro
+
+* Wed Aug 22 2018 Kairui Song <kasong@redhat.com> - 2.0.17-10
+- kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
+- kdumpctl: Error out if path is set more than once
+- Always drop nofail or nobootwait options
+
+* Tue Aug 07 2018 Kairui Song <kasong@redhat.com> - 2.0.17-9
+- Remove redundant kdump-anaconda-addon source codes
+- dracut-module-setup: Fix DRM module inclusion test for hyper-v
+- Remove kdump-anaconda subpackage
+
+* Thu Jul 26 2018 Dave Young <dyoung@redhat.com> - 2.0.17-8
+- Fix armv7hl build failure
+
+* Thu Jul 26 2018 Dave Young <dyoung@redhat.com> - 2.0.17-7
+- Remove koji build workaround patch
+- kexec-tools.spec: Drop kexec-tools-2.0.3-disable-kexec-test.patch
+- Remove obsolete kdump tool
+- dracut-module-setup.sh: don't include multipath-hostonly
+- kdumpctl: Rebuild initramfs if loaded kernel modules changed
+
+* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.17-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Mon Jul 9 2018 Dave Young <dyoung@redhat.com> - 2.0.17-5
+- Update makedumpfile 1.6.4
+- dracut-module-setup.sh: pass ip=either6 param for ipv6
+- dracut-module-setup.sh: install /etc/hosts when using fence_kdump
+
+* Wed Jun 27 2018 Dave Young <dyoung@redhat.com> - 2.0.17-4
+- kdump anaconda addon fix for rhbz1594827
+
+* Wed May 30 2018 Dave Young <dyoung@redhat.com> - 2.0.17-3
+- Add early kdump support in initramfs.
+- move some common functions from kdumpctl to kdump-lib.sh
+- Fix kdumpctl showmem
+- kdumpctl: Remove 'netroot' and 'iscsi initiator' entries from kdump
+- kdumpctl: add showmem cmd
+- Revert "dracut-module-setup.sh: pass correct ip= param for ipv6"
+
+* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-2
+- pull in makedumpfile 1.6.3 
+
+* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-1
+- pull in 2.0.17
+
+* Sun Apr 08 2018 Dave Young <dyoung@redhat.com> - 2.0.16-6
+- kdump.sysconfig.ppc64(le): remove "root=" param from ppc64(le) 2nd kernel
+- kdumpctl: Check the modification time of core_collector
+- dracut-module-setup.sh: pass correct ip= param for ipv6
+
+* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.16-5
+- Escape macros in %%changelog
+
+* Wed Feb 7 2018 Dave Young <dyoung@redhat.com> - 2.0.16-4
+- update anaconda addon migrate with Anaconda changes.
+
+* Fri Dec 8 2017 Dave Young <dyoung@redhat.com> - 2.0.16-3
+- workaround koji build failure (rhbz1520805)
+
+* Mon Dec 4 2017 Dave Young <dyoung@redhat.com> - 2.0.16-2
+- dracut-module-setup.sh: check whether to include multipath-hostonly or not
+- Revert "kdumpctl: sanity check of nr_cpus for x86_64 in case running out of vectors"
+- kdumpctl: skip selinux-relabel for dracut_args --mount dump target
+
+* Tue Nov 21 2017 Dave Young <dyoung@redhat.com> - 2.0.16-1
+- update to kexec-tools 2.0.16
+
+* Thu Nov 9 2017 Dave Young <dyoung@redhat.com> - 2.0.15-15
+- Use absolute path /usr/bin/dracut in mkdumprd
+
+* Wed Oct 11 2017 Dave Young <dyoung@redhat.com> - 2.0.15-14
+- kdumpctl: Error out in case there are white spaces before an option name
+
+* Wed Sep 6 2017 Dave Young <dyoung@redhat.com> - 2.0.15-13
+- dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call
+- mkdumprd: use --quiet dracut argument to speedup initramfs build
+- mkdumprd: fix patterns to modify mount options
+- fadump: rebuild default initrd with dump capture capability
+- module-setup: remove software iscsi cmdline generated by dracut
+- kdumpctl: remove some cmdline inheritage from 1st kernel
+- mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device"
+- Change dump_to_rootfs to use "--mount" instead of "root=X"
+- kdumpctl: move is_fadump_capable() to kdump-lib.sh
+- Revert "kdumpctl: use generated rd.lvm.lv=X"
+- Revert "mkdumprd: omit crypt when there is no crypt kdump target"
+- Revert "mkdumprd: omit dracut modules in case of no dm target"
+- Revert "mkdumprd: omit dracut modules in case of network dumping"
+- update bogus date in rpm spec
+
+* Thu Aug 17 2017 Dave Young <dyoung@redhat.com> - 2.0.15-12
+- makedumpfile: fix 4.13 kernel larget vmcore bug
+- Revert "Improve 'cpu add' udev rules"
+
+* Tue Aug 15 2017 Dave Young <dyoung@redhat.com> - 2.0.15-11
+- Own the /usr/share/makedumpfile dir
+- Mark COPYING as %%license
+
+* Tue Aug 8 2017 Dave Young <dyoung@redhat.com> - 2.0.15-10
+- Improve 'cpu add' udev rules
+- module-setup: suppress the early iscsi error messages
+- mkdumprd: use 300s as the default systemd unit timeout for kdump mount 
+
+* Mon Aug 7 2017 Dave Young <dyoung@redhat.com> - 2.0.15-9
+- fix makedumpfile bug 1474706 
+
+* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Sun Jul 30 2017 Florian Weimer <fweimer@redhat.com> - 2.0.15-7
+- Rebuild with binutils fix for ppc64le (#1475636)
+
+* Fri Jul 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-6
+- update upstream makedumpfile 1.6.2
+
+* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-5
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Wed Jul 19 2017 Dave Young <dyoung@redhat.com> - 2.0.15-4
+- mkdumprd: remove useless "x-initrd.mount"
+- kdumpctl: use "apicid" other than "initial apicid"
+
+* Fri Jul 14 2017 Dave Young <dyoung@redhat.com> - 2.0.15-3
+- module-setup: fix 99kdumpbase network dependency
+- mkdumprd: omit dracut modules in case of network dumping
+- mkdumprd: omit dracut modules in case of no dm target
+- mkdumprd: omit crypt when there is no crypt kdump target
+- kdumpctl: use generated rd.lvm.lv=X
+- mkdumprd: change for_each_block_target() to use get_kdump_targets()
+- kdump-lib.sh: introduce get_kdump_targets()
+- kdump-lib.sh: fix improper get_block_dump_target()
+- kdumpctl: fix infinite loop caused by running under bash
+
+* Wed Jun 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-2
+- enable makedumpfile for arm64
+
+* Fri Jun 23 2017 Dave Young <dyoung@redhat.com> - 2.0.15-1
+- rebase kexec-tools-2.0.15
+
+* Thu Jun 15 2017 Dave Young <dyoung@redhat.com> - 2.0.14-13
+- kexec-tools.spec: Fix whitespace errors
+- dracut-module-setup: Fix test for inclusion of DRM modules
+- kdump.conf.5: clarify the fence_kdump_nodes option
+
+* Thu May 18 2017 Dave Young <dyoung@redhat.com> - 2.0.14-12
+- kdumpctl: for fence_kdump, the ipaddr of this node should be excluded
+
+* Fri May 12 2017 Dave Young <dyoung@redhat.com> - 2.0.14-11
+- kdumpctl: change the shebang header to use /bin/bash
+- kdumpctl: call strip_comments only when necessary to speedup
+- Revert "kdumpctl: improve "while read" time for /etc/kdump.conf" (rhbz1449801)
+
+* Fri May 5 2017 Dave Young <dyoung@redhat.com> - 2.0.14-10
+- kdumpctl: improve "while read" time for /etc/kdump.conf
+- kdumpctl: update check_dump_fs_modified() to use "lsinitrd -f"
+- kdumpctl: improve check_wdt_modified()
+- kdumpctl: remove is_mode_switched()
+- kdumpctl: bail out earlier in case of no reserved memory
+
+* Thu Apr 27 2017 Dave Young <dyoung@redhat.com> - 2.0.14-9
+- kdump: Introduce 'force_no_rebuild' option
+- kdump-lib-initramfs.sh: ignore the failure of echo
+- kdump.sysconfig/x86_64: Add nokaslr to kdump kernel cmdline
+
+* Tue Apr 11 2017 Dave Young <dyoung@redhat.com> - 2.0.14-8
+- kdumpctl: fix status check when CONFIG_CRASH_DUMP is not enabled in kernel
+- kdumpctl: fix a bug in remove_cmdline_param()
+- kdumpctl: remove "root=X" for kdump boot
+- Revert "kdumpctl: filter 'root' kernel parameter when running in live images"
+
+* Fri Mar 31 2017 Dave Young <dyoung@redhat.com> - 2.0.14-7
+- kdump-emergency: fix "Transaction is destructive" emergency failure
+- mkdumprd: reduce lvm2 memory under kdump
+
+* Fri Mar 17 2017 Dave Young <dyoung@redhat.com> - 2.0.14-6
+- Fix kernel kaslr caused regressions (kexec -p and makedumpfile --mem-usage)
+
+* Thu Mar 9 2017 Dave Young <dyoung@redhat.com> - 2.0.14-5
+- kdump-lib.sh: fix incorrect usage with pipe as input for grep -q in is_pcs_fence_kdump()
+- Document: fix incorrect link in fadump-how.txt
+
+* Mon Jan 23 2017 Dave Young <dyoung@redhat.com> - 2.0.14-4
+- drop kdump script rhcrashkernel-param in kexec-tools repo
+- kdumpctl: sanity check of nr_cpus for x86_64 in case running out of vectors
+- kdumpctl: change prepare_cmdline() to operate KDUMP_COMMANDLINE directly
+- use --hostonly-i18n for dracut
+
+* Wed Jan 4 2017 Dave Young <dyoung@redhat.com> - 2.0.14-3
+- Rebase makedumpfile 1.6.1
+- Delete unused patches
+
+* Tue Dec 20 2016 Dave Young <dyoung@redhat.com> - 2.0.14-2
+- rebase upstream kexec-tools 2.0.14
+- update kdump anaconda addon
+- cleanup sources file
+
+* Mon Nov 28 2016 Dave Young <dyoung@redhat.com> - 2.0.14-1
+- kexec-tools 2.0.14-1
+
+* Mon Nov 28 2016 Dave Young <dyoung@redhat.com> - 2.0.13-9
+- rename function kdump_to_udev_name
+- Raw dump: use by-id as persistent policy in 2nd kernel
+- drop dracut duplicate functions
+- dracut-kdump: use POSIX shell syntax
+- Correct two typos in kdumpctl and kdump.conf
+
+* Fri Nov 11 2016 Dave Young <dyoung@redhat.com> - 2.0.13-8
+- kexec/arch/i386: Add support for KASLR memory randomization
+- Update kdump anaconda addon
+- fadump: restore default initrd when fadump mode is disabled
+- kdump/fadump: fix network interface name when switching from fadump to kdump
+- kdumpctl: filter 'root' kernel parameter when running in live images
+- Documentation: step by step guide on confiuring kdump in live images
+
+* Thu Oct 27 2016 Dave Young <dyoung@redhat.com> - 2.0.13-7
+- fix wrong page_offset added in 2.0.13-6
+
+* Wed Oct 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-6
+- add kexec support for arm64
+- support x86 kaslr which is enabled by default in F25 kernel
+
+* Fri Sep 16 2016 Dave Young <dyoung@redhat.com> - 2.0.13-5
+- Fix bug 1373958 for system boot without initrd
+- Do not depend on /etc/fstab in kdumpctl in case it does not exist
+
+* Fri Aug 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-4
+- Add special dump target "--mount" in dracut_args
+
+* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-3
+- Fix armv7 build failure
+
+* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-2
+- Drop old patches for 2.0.12
+
+* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-1
+- Rebase kexec-tools 2.0.13
+
+* Thu Jul 21 2016 Dave Young <dyoung@redhat.com> - 2.0.12-10
+- kdump.conf manpage and kdump.conf comments fixes.
+- kdump watchdog support.
+
+* Wed Jul 13 2016 Dave Young <dyoung@redhat.com> - 2.0.12-9
+- Update kdump anaconda addon
+- makedumpfile: Support _count -> _refcount rename in struct page
+- module-setup: Don't handle iBFT in kdump
+
+* Wed Jul 6 2016 Dave Young <dyoung@redhat.com> - 2.0.12-8
+- Rebase makedumpfile 1.6.0
+
+* Mon Jun 27 2016 Dave Young <dyoung@redhat.com> - 2.0.12-7
+- Fix date format in spec file.
+
+* Mon Jun 27 2016 Dave Young <dyoung@redhat.com> - 2.0.12-6
+- get_persistent_dev(): fix name contention with dracut's similar function
+
+* Mon Jun 6 2016 Dave Young <dyoung@redhat.com> - 2.0.12-5
+- kdump-lib: Add get_ifcfg_filename() to get the proper ifcfg file
+- module-setup: Use get_ifcfg_filename() to get the proper ifcfg file
+
+* Mon May 30 2016 Dave Young <dyoung@redhat.com> - 2.0.12-4
+- update kdump anaconda addon to add mem range in tui 
+- .gitignore: Update to make it more generic
+- kdumpctl: check_rebuild improvement 
+- kdumpctl: Do not rebuild initramfs when $KDUMP_BOOTDIR is read only
+
+* Tue Mar 29 2016 Dave Young <dyoung@redhat.com> - 2.0.12-3
+- update kdump anaconda addon to adapt to blivet-2.0 API
+
+* Thu Mar 24 2016 Dave Young <dyoung@redhat.com> - 2.0.12-2
+- Release 2.0.12-2
+- ppc64le: fix kexec hang due to ppc64 elf abi breakage
+
+* Tue Mar 22 2016 Dave Young <dyoung@redhat.com> - 2.0.12-1
+- Rebase kexec-tools to 2.0.12 
+
+* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Fri Dec 11 2015 Dave Young <dyoung@redhat.com> - 2.0.11-3
+- use "systemctl reboot -f" for reboot action
+- Remove kernel param "quiet" from kdump kernel cmdline
+- kdump.sysconfig: add KDUMP_COMMANDLINE_REMOVE
+- Add missing prefixes in default sysconfig file
+- fix bogus date in changelog
+
+* Thu Nov 19 2015 Dave Young <dyoung@redhat.com> - 2.0.11-2
+- Rebase to upstream makedumpfile 1.5.9 
+
+* Mon Nov 9 2015 Dave Young <dyoung@redhat.com> - 2.0.11-1
+- Rebase to upstream kexec-tools 2.0.11
+
+* Mon Oct 19 2015 Dave Young <dyoung@redhat.com> - 2.0.10-9
+- kexec-kdump-howto:Add introduction of parallel dumping
+- Remove duplicate prefix path ${initdir}
+
+* Tue Sep 8 2015 Dave Young <dyoung@redhat.com> - 2.0.10-8
+- update kdump addon to fix a kickstart installationi issue 
+
+* Wed Aug 19 2015 Dave Young <dyoung@redhat.com> - 2.0.10-7
+- add man page for kdumpctl
+
+* Thu Aug 13 2015 Baoquan He <bhe@redhat.com> - 2.0.10-6
+- mkdumprd: Remove ifcfg from dracut's modules
+- module-setup: Choose the first matched gateway in kdump_static_ip
+- module-setup: Add permanent option to detect static ip address or not
+
+* Tue Aug 4 2015 Dave Young <dyoung@redhat.com> - 2.0.10-5
+- Update kdump addon to fix an installation hang issue.
+
+* Tue Jul 28 2015 Dave Young <dyoung@redhat.com> - 2.0.10-4
+- ipv6 support (except for link scope addresses)
+- Apply the manual DNS to the 2nd kernel
+- load iTCO_wdt early in cmdline hook
+
+* Thu Jul 23 2015 Dave Young <dyoung@redhat.com> - 2.0.10-3
+- Update kdump addon icon
+- Revert static route corner case patches per bhe. He discussed with Marc
+  it is just a corner case.
+
+* Mon Jul 13 2015 Dave Young <dyoung@redhat.com> - 2.0.10-2
+- update kdump addon icon
+
+* Thu Jul 9 2015 Dave Young <dyoung@redhat.com> - 2.0.10-1
+- Rebase kexec-tools 2.0.10
+- Rebase eppic git tree 050615
+- Enhance kdump.conf "default" parameters check
+
+* Thu Jul 2 2015 Dave Young <dyoung@redhat.com> - 2.0.9-2
+- Resolve bug 1236456, kexec load fail because koji add extra gcc flags.
+- Remove -FPIC for makedumpfile since it is not necessary without harden build
+
+* Tue Jun 23 2015 Dave Young <dyoung@redhat.com> - 2.0.9-1
+- Rebase kexec-tools 2.0.9
+- Rebase makedumpfile 1.5.8
+- revert 6347630 since ipv6 patches has not been reviewed.
+
+* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.8-13
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Thu Jun 11 2015 Dave Young <dyoung@redhat.com> -2.0.8-13
+- Update kdump anaconda addon icon again.
+
+* Wed Jun 10 2015 Dave Young <dyoung@redhat.com> -2.0.8-12
+- Update kdump anaconda addon, change an icon.
+
+* Wed Jun 03 2015 Baoquan He <bhe@redhat.com> -2.0.8-11
+- make kdump work when kernel crash after shutdown
+- Disable transparent hugepages in second kernel
+- Filtered out "noauto" options in 2nd kernel fstab
+
+* Tue Apr 21 2015 Baoquan He <bhe@redhat.com> -2.0.8-10
+- add fPIC to makefumpfile CFLAGS to support hardening
+- dracut-module-setup: Enhance kdump to support the bind mounted feature in Atomic
+- Fix the warning if the target path is bind mount in Atomic
+- Get the mount point correctly, if the device has several mount point
+- kdump-lib: Add new function to judge the system is Atomic or not
+- kdump-lib: Add the new function to enhance bind mounted judgement
+- Remove duplicate slash in save path
+
+* Thu Apr 09 2015 Baoquan He <bhe@redhat.com> -2.0.8-9
+- Revert "execute kdump_post after do_default_action"
+- dracut-module-setup.sh: change the insecure use of /tmp/*$$* filenames
+- make kdump saving directory name consistent with RHEL6
+
+* Sun Feb 15 2015 Dave Young <dyoung@redhat.com> - 2.0.8-8
+- execute kdump_post after do_default_action
+- update kdump anaconda addon (translations/help text issus)
+
+* Fri Jan 30 2015 Baoquan He <bhe@redhat.com> - 2.0.8-7
+- kdumpctl: adjust the boot dir if kernel is put in sub dir of /boot
+
+* Tue Jan 13 2015 WANG Chao <chaowang@redhat.com> - 2.0.8-6
+- mount fail if its mount point doesn't exist in /sysroot
+- rebuild initrd dependency during kdump restart
+- fix a dump path issue
+
+* Tue Jan 06 2015 WANG Chao <chaowang@redhat.com> - 2.0.8-5
+- remove panic_on_warn kernel param in 2nd kernel
+- remove sysctl.conf to restore sysctl default values in 2nd kernel
+- fix a core_collector issue in ssh and raw dump case
+- update to kdump-anaconda-addon-005-2-g86366ae.tar.gz
+- some cleanups
+
+* Tue Nov 04 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-4
+- Fix ppc64le installation issue
+- Fix get_option_value function
+
+* Tue Oct 28 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-3
+- fix static route corner case
+- fadump fix
+
+* Tue Oct 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-2
+- Fix build issue on ARM
+
+* Mon Oct 20 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-1
+- Rebase kexec-tools-2.0.8
+- Remove subpackage kexec-tools-eppic
+- Rebase kdump-anaconda-addon-005
+
+* Fri Sep 26 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-11
+- Fix build failure on ppc64le
+- Fix an issue on iscsi boot environment
+
+* Tue Sep 23 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-10
+- Enable ppc64le arch.
+- Rebase makedumpfile-1.5.7
+- add sample eppic scripts to kexec-tools-eppic package
+- Restart kdump service on cpu ADD/REMOVE events
+
+* Wed Sep 10 2014 Baoquan He <bhe@redhat.com> - 2.0.7-9
+- kdumpctl: Use kexec file based syscall for secureboot enabled machines
+- kdumpctl: Use kexec file based mode to unload kdump kernel
+- kdumpctl: Do not redirect error messages to /dev/null
+- kexec: Provide an option to use new kexec system call
+
+* Fri Aug 29 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-8
+- use absolute path for executable in systemd service
+- update to kdump-anaconda-addon-003
+- remove dead kdump firstboot module and po files
+
+* Thu Aug 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-7
+- install 98-kexec.rules to /usr/lib/
+- update kdump-anaconda-addon-0.2
+
+* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Wed Aug 06 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-5
+- rework of kdump error handling
+- add fadump support
+- add static route support
+- systemd will take care of shutdown and umount filesystems
+
+* Thu Jul 24 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-4
+- update to kdump-anaconda-addon-001-4-g03898ef.tar.gz
+- prefix "kdump-" to eth name
+
+* Mon Jul 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-3
+- update to kdump-anaconda-addon-20140721.tar.gz
+
+* Wed Jul 16 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-2
+- Fix makedumpfile OOM issue
+
+* Tue Jun 10 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-1
+- Rebase kexec-tools-2.0.7
+
+* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.6-9
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Thu May 22 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-8
+- re-construct anaconda-addon file hierarchy
+
+* Wed May 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-7
+- fix a typo in kexec-tools.spec
+
+* Tue May 20 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-6
+- New package kdump-anaconda-addon
+- fixes for udev event based service restart
+
+* Wed Apr 30 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-5
+- Remove nofail mount option
+- Rebase makedumpfile-1.5.6
+
+* Thu Apr 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-4
+- generate kdump service dependencies on the fly
+- kdump.conf: a standalone path directive becomes a relative path to it's backed disk.
+
+* Wed Apr 02 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-3
+- Add README to git repo
+- Add fence_kdump support for generic clusters
+
+* Thu Mar 27 2014 Peter Robinson <pbrobinson@fedoraproject.org> 2.0.6-2
+- Exclude AArch64
+
+* Wed Mar 26 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-1
+- Rebase kexec-tools-2.0.6
+- fix an issue when dump path is mounted on nfs
+- vmcore-dmesg: stack smashing fix
+- get_ssh_size fix for localized df output
+
+* Mon Mar 10 2014 WANG Chao <chaowang@redhat.com> - 2.0.5-2
+- Warn about save vmcore patch mounted by another disk
+- Omit dracut resume module
+
+* Tue Mar 04 2014 WANG Chao <chaowang@redhat.com> - 2.0.5-1
+- Rebase kexec-tools-2.0.5
+- backport several patches from upstream for i386 build
+
+* Mon Mar 03 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-25
+- Pass disable_cpu_apicid to kexec of capture kernel
+- Relax restriction of dumping on encrypted target
+- regression fix on wdt kernel drivers instal
+
+* Mon Feb 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-24
+- add kdump-in-cluster-environment.txt to rpm pkg
+- Secure Boot status check warning
+- Some watchdog driver support
+
+* Wed Jan 29 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-23
+- ssh dump: create random-seed manually
+- makedumpfile: memset() in cyclic bitmap initialization introduce segment fault.
+- Add acpi_no_memhotplug to kdump kernel
+- Add fence kdump support
+
+* Tue Jan 28 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-22
+- Rebase makedumpfile-1.5.5
+
+* Wed Jan 22 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-21
+- makedumpfile: Improve progress information for huge memory system
+- s390: use nr_cpus=1 instead of maxcpus=1
+
+* Fri Jan 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-20
+- vmcore-dmesg: fix timestamp error in vmcore-dmesg.txt
+- makedumpfile: re-enable mmap() and introduce --non-mmap
+- kdump.conf uncomment default core_collector line
+- fix an issue when 'ssh' directive appearing in kdump.conf, the rest part of
+  lines in this file are ignored
+
+* Tue Dec 24 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-18
+- update translation files
+- makedumpfile: default to lzo compression
+- makedumpfile: add makedumpfile.conf.sample and its manpage
+
+* Sat Dec 21 2013 Ville Skyttä <ville.skytta@iki.fi> - 2.0.4-15
+- Fix Tamil (India) locale subdir name.
+- Fix bogus date in %%changelog.
+
+* Tue Dec 03 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-14
+- Add rd.memdebug in kdump module
+- kdumpctl: Avoid leaking fd to subshell
+- makedumpfile: Understand >= v3.11-rc4 dmesg
+- makedumpfile, ppc: Support to filter dump for kernels that use CONFIG_SPARSEMEM_VMEMMAP.
+
+* Fri Nov 15 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-13
+- makedumpfile: disable mmap()
+
+* Tue Oct 29 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-12
+- fix sadump format phys_base calculating error
+- kdump, x86: Process multiple Crash kernel in /proc/iomem
+- makedumpfile: wrong cyclic buffer size recalculation causes bitmap data corruption
+- Fix max_mapnr issue on system has over 44-bit addressing.
+
+* Sat Oct 12 2013 Baoquan He <bhe@redhat.com> -2.0.4-11
+- kdump-lib.sh: strip_comments is not implemented correcty
+
+* Fri Sep 27 2013 Baoquan He <bhe@redhat.com> - 2.0.4-10
+- Back port 2 revert commits
+- kdump.sysconfig: default to "nofail" mount
+
+* Fri Sep 27 2013 Baoquan He <bhe@redhat.com> - 2.0.4-9
+- Strip inline comments from the kdump config file before use
+- kdump-lib.sh: add common function strip_comments
+- Introduce kdump-lib.sh for kdump shared functions
+- kdump.service: Start kdump after network is online and remote fs is mounted
+- dracut-module-setup: _dev to be a local variable
+- kdumpctl: Run multiple kdumpctl instances one by one in serial order
+
+* Wed Aug 21 2013 Baoquan He <bhe@redhat.com> - 2.0.4-8
+- remove 98selinux dependency
+
+* Fri Aug 2  2013 Baoquan He <bhe@redhat.com> - 2.0.4-7
+- dracut-kdump.sh: add do_dump() and error out if dump vmcore fails
+- dracut-module-setup.sh: setup correct system time and time zone in 2nd kernel.
+- kernel cmdline: Remove hugepage allocations
+- Use /lib/dracut/no-emergency-shell to control action on fail
+- Revert: kdump.sysconfig: Add option action_on_fail and set its default as continue
+- dracut-kdump.sh: Redirect kdump script stdout/stderr to /dev/console
+- makedumpfile: Add vmap_area_list definition for ppc/ppc64.
+
+* Fri Jul 12 2013 Baoquan He <bhe@redhat.com> - 2.0.4-6
+- add snappy build
+- add lzo build
+- pull makedumpfile-1.5.4
+- mkdumprd: check return value of subshell
+- mkdumprd: get_persistent_dev() return original dev if no persistent dev exists.
+- dracut-kdump.sh: Merge dump_to_rootfs() to dump_fs()
+- dracut-kdump.sh: explicitly sync after each dump
+- Correct wrong weekday of changelog
+- kexec-tools.spec: Remove incorrect description in changelog
+
+* Tue Jun 25 2013 Baoquan He <bhe@redhat.com> - 2.0.4-5
+- monitor-dd-progress fix
+- rawdump: only show dd progress bar when core_collector is not makedumpfile
+- kexec-tools.spec: replaces scriptlets with new systemd macros
+- dracut-kdump.sh: umount fs right before kdump exit
+- dracut-kdump.sh: recursively umount fs and its submounts
+- dracut-kdump.sh: cleanup - using local variable names instead of $1/$2 in functions
+- dracut-kdump.sh: name the invalid vmcore to vmcore-incomplete
+- dracut-kdump.sh: Output top level information about the kdump progress.
+- kexec-kdump-howto: Add a section for debugging tips
+
+* Tue Jun 18 2013 Baoquan He <bhe@redhat.com> - 2.0.4-4
+- dracut-module-setup.sh: improve the approach to get a bridged interface list
+- dracut-module-setup.sh: cleanup - use kdump_get_mac_addr() function
+- dracut-module-setup.sh: use kernel exported mac address in kdump_get_mac_addr()
+- dracut-module-setup.sh: use perm addr of slaves to setup bonding network
+- kdump: Do not output debug messages by default
+- dracut-module-setup.sh: kdump module depends on drm module
+- mkdumprd: return error if no write permission on save path of server for ssh
+
+* Thu Jun 13 2013 Baoquan He <bhe@redhat.com> - 2.0.4-3
+- mkdumprd: remove -M option for dracut
+- kdumpctl: add selinux relabel when service startup
+- depends on dracut selinux module
+- dracut-kdump.sh: umount rootfs after dump_to_rootfs
+- kdump.sysconfig: append "panic=10" to kdump cmdline
+- kexec-kdump-howto: grubby is suggested modifing kernel cmdline
+- kexec-tools.spec: removes kexec udev rules for s390
+- kdump.sysconfig: Add option action_on_fail and set its default as continue
+- Add tab key as delimiter for core_collector in kdump.conf
+- redirect stdout to stderr
+
+* Tue May 14 2013 Baoquan He <bhe@redhat.com> - 2.0.4-2
+- kdump: Save vmcore-dmesg.txt before saving vmcore
+- Remove "ip=" overwrite to 40ip.conf
+- Add support for bridge over bond/team/vlan.
+- Fix bonding options syntax and get all specified options from ifcfg file.
+- add dracut_args option to kdump.conf
+- kexec-tools.spec: Add ethtool to dependency.
+- error out if dump target is encrypted
+
+* Wed Apr  3 2013 Baoquan He <bhe@redhat.com> - 2.0.4-1
+- Delete several patches which have been merged into kexec-tools-2.0.4
+- Revert: Release 2.0.3-72
+- Release 2.0.3-72
+- Pull kexec-tools-2.0.4
+- Check if block device as dump target is resettable
+- mkdumprd: add function perror_exit
+- Deprecate blacklist option
+
+* Wed Mar 27 2013 Baoquan He <bhe@redhat.com> - 2.0.3-71
+- Remove eppic support on ppc and s390 arch
+
+* Mon Mar 18 2013 Baoquan He <bhe@redhat.com> - 2.0.3-70
+- Change rules related to eppic in kexec-tools.spec
+
+* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-69
+- Support for eppic language as a subpackage
+ 
+* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-68
+- tune sysconfig to save memory usage
+- Remove useless codes related to LOGGER in kdumpctl
+- kdumpctl:print out the service status
+- Return to start() function when check_ssh_target failed
+- use findmnt instead of blkid in mkdumprd
+- check dump target mounting earlier
+- kdumpctl: rename function name check_config
+- add function to check kdump config file
+- dracut-module-setup.sh: remove UUID/LABEL quotes before using it
+- Change dump_to_rootfs to be a default option and reboot to be default action
+- Remove "-F" in CORE_COLLECTOR when dump_to_rootfs
+
+* Tue Feb 19 2013 Baoquan He <bhe@redhat.com> - 2.0.3-67
+- Remove comma which is redundant
+- Modify codes related to dump dir to make it clearer
+- Rectify the get_host_ip implementation
+- Revert: Merge an upstream patch for fix a ppc64 makedumpfile bug with with CONFIG_SPARSEMEM_EXTREME
+- pull makedumpfile 1.5.3
+
+* Tue Feb 5 2013 Dave Young <ruyang@redhat.com> - 2.0.3-66
+- Spec: remove kdump image when a corresponding kernel is removed
+- Merge an upstream patch for fix a ppc64 makedumpfile bug
+
+* Mon Jan 28 2013 Dave Young <ruyang@redhat.com> - 2.0.3-65
+- Add support for team devices
+- Update translation file po/it.po
+- remove wait for net ok function
+- add bootdev cmdline param
+- kdumpnic cmdline file name cleanup
+
+* Fri Jan 4 2013 Dave Young <ruyang@redhat.com> - 2.0.3-64
+- fix issue of exec on stack for ppc32
+
+* Fri Dec 21 2012 Dave Young <ruyang@redhat.com> - 2.0.3-63
+- revert explictly handling of PIPESTATUS
+- enable pipefail bash option
+- wrong ssh key fix
+- build fix: Update 3 po files: po/gu.po po/or.po po/zh_CN.po
+
+* Fri Dec 21 2012 Dave Young <ruyang@redhat.com> - 2.0.3-62
+- Pull translated po files from zanata
+- Optimize redundent code fetching server of network dump
+- change the dump dir format to be more readable
+
+* Wed Dec 12 2012 Dave Young <ruyang@redhat.com> - 2.0.3-61
+- firstboot:fix reserve mem ui spinbox step size
+- handle readonly mounted filesystem
+
+* Mon Dec 10 2012 Dave Young <ruyang@redhat.com> - 2.0.3-60
+- makedumpfile 1.5.1
+- Update po tar.gz
+- Add a notes for zanata process
+- Add two xmls file for po zanata translation
+- Cleanup and recreate po files
+
+* Fri Nov 16 2012 Dave Young <ruyang@redhat.com> - 2.0.3-59
+- Enable kdump service after installation
+- get MEM_RESERVED from sysfs attribute
+- get_ssh_size: use -n to redirect stdin from /dev/null
+- add random feeding code for ssh dump
+- kdump option space checking improvement
+- kdumpctl: multi dump target checking fix
+
+* Thu Oct 25 2012 Dave Young <ruyang@redhat.com> - 2.0.3-58
+- pull in two upstream patches
+
+* Thu Oct 11 2012 Dave Young <ruyang@redhat.com> - 2.0.3-57
+- improve persistent name handling
+
+* Sat Sep 29 2012 Dave Young <ruyang@redhat.com> - 2.0.3-56
+- Pull vmcore-dmesg patches from vivek
+- ppc/ppc64: compile purgatory with gcc option msoft-float
+- Update to support f18 grub2 efi config file
+- pass persistent name to dracut --device
+- pass persistent name to dracut --mount
+- use persistent name in kdump.conf of initramfs
+- mkdumprd: add function get_persistent_dev
+- remove useless uuid and label handling
+
+* Thu Sep 06 2012 Dave Young <ruyang@redhat.com> - 2.0.3-55
+- doc fix for mount dump target before mkdumprd
+- pull makedumpfile 1.5.0
+
+* Wed Aug 29 2012 Dave Young <ruyang@redhat.com> - 2.0.3-54
+- pass raw device as dracut argument
+- iscsi setup fix
+- firstboot: add automatic and manual memory reservation for rhel
+- firstboot: remove unnecessary underline shortkey
+- firstboot: fix gtk warning about non-zero page size
+- firstboot: update all kernels config in grubbyCmd
+- firstboot: add actual reserved memory widget
+- firstboot code cleanup
+- rhcrashkernel-param: echo crashkernel=auto for rhel7
+- Remove the kernel-kdump handling
+- s390x firstboot fix
+- remove elilo support
+- grub2 fix in firstboot
+- Take closing the reboot dialog as no
+- Handle new crashkernel= syntax in firstboot
+- Fix a localized string in firstboot
+- Configure kdump in firstboot
+- fix firstboot to ensure kdump svc is disabled properly
+- firstboot text domain fix
+- Update to use systemctl instead of sysv chkconfig
+- port force_rebuild kdump.conf option
+- Change return value to indicate the result of dump_raw() correctly.
+- call dracut function for default shell
+
+* Mon Jul 23 2012 Dave Young <ruyang@redhat.com> - 2.0.3-53
+- refactor net option
+- use fstab-sys to mount nfs
+- rename function dump_localfs
+- dump_localfs error path fix
+- update kexec-kdump-howto.txt about systemctl commands
+- ssh propagate alert message fix
+- remove useless dracut cmdline '-c /dev/null'
+- remove useless dracut cmdline for kernel-modules and kdumpbase
+- install core_collector in module-setup.sh
+- install extra_bins in module-setup.sh
+- remove busybox dependency
+- improve warning message of space checking
+- do not mount root twice
+- do not add fstab-sys module in dracut cmdline
+- omit dash module
+- network dns config fix
+- shell exit value fix 
+
+* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-52
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Thu Jul 5 2012 Dave Young <ruyang@redhat.com> - 2.0.3-51
+- add s390x netdev setup
+- Add s390x support
+- Cleanup temp file leaved at /tmp/
+- add check_size function for fs dump
+- add ssh check_size
+- blacklist patch apply fix
+- Respect bonding mode
+- Support dump over vlan tagged bonding
+
+* Fri Jun 22 2012 Dave Young <ruyang@redhat.com> - 2.0.3-50
+- add blacklist option, Resolves: bz805774
+- Add kdump_post and kdump_pre support, Resolves: bz805773
+- Port check_config from rhel6, Resolves: bz805778
+- raw core_collector fix
+- ssh core_collector fix
+- drcut-kdump.sh: cleanup kdump.conf check
+
+* Tue Jun 12 2012 Dave Young <ruyang@redhat.com> - 2.0.3-49
+- cleanup DUMP_INSTRUCTION handling
+- final reboot behavior fix
+- dump_rootfs for default target fix
+- add vlan support
+- fix and refactor bond handling code
+- fix and refactor bridge handling code
+- core_collector doc basic fix
+- omit plymouth module, Resolves: bz821997
+- mkdumprd manpage cleanup manpage
+- mkdumprd: remove --debug
+- mkdumprd: remove noconf
+- makedumprd: remove -d
+- kdump.conf add sshkey
+- kdump.conf remove disk_timeout
+- kdump.conf make path uncommented
+- kdump.conf.5 add default poweroff
+- kdump.conf default shell fix
+- kdump.conf default default action fix
+- kdump.conf.5 remove module option
+- kdump.conf remove kdump_pre/kdump_post
+- kdump.conf: remove link_delay
+
+* Mon May 28 2012 Dave Young <ruyang@redhat.com> - 2.0.3-48
+- do_default_action cleanup, Resolves: bz805773
+- add rhcrashkernel-param for anaconda use, Resolves: bz707441
+- Basic iscsi target dump support (software initiator), Resolves bz822701
+- Static ip configuratio support, Resolves: bz822739
+- udev rules fix, Resolves: bz808817
+
+* Thu May 3 2012 Dave Young <ruyang@redhat.com> - 2.0.3-47
+- remove dracut-files.tgz2
+
+* Wed May 2 2012 Dave Young <ruyang@redhat.com> - 2.0.3-46
+- mkdumprd: Start using --hostonly and --add kdumpbase while calling dracut
+- get_mp function cleanup
+- move kdump script order to the end of pre pivot
+- port raw dump from rhel6
+- remove multi dump
+
+* Mon Apr 23 2012 Dave Young <ruyang@redhat.com> - 2.0.3-45
+- update dracut-files.tbz2
+
+* Thu Apr 19 2012 Dave Young <dyoung@redhat.com> - 2.0.3-44
+- update ppc64 sysconfig, resolve bug 811449
+- deal with nic rename issue, resolve bug 810107
+- update x86_64 sysconfig, resolve bug 813711
+
+* Wed Apr 11 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-43
+- variable name fix from Dave Young.
+
+* Fri Mar 30 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-42
+- get ip addr with getent
+- spec: depends on dracut-network
+- Handle net option for nfs in kdump.conf correctly
+
+* Mon Feb 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-41
+- Bump this version.
+
+* Wed Feb 22 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-40
+- Fixup sysytemd service file.
+
+* Wed Feb 22 2012 Dave Young <ruyang@redhat.com> - 2.0.2-39
+- Add ssh dump support, resolve bug 789253.
+
+* Fri Jan 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-38
+- Pull the latest makedumpfile release, 1.4.2.
+
+* Fri Jan 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-37
+- Add initial NFS dump support, experimental.
+
+* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-36
+- Really upload the dracut module.
+
+* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-35
+- Fix various bugs for nfs dump.
+
+* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-34
+- kdump.sh cleanup for fstab handling, from Dave Young.
+
+* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-33
+- Handle rootfs correctly.
+
+* Tue Jan 10 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-32
+- Fix add_dracut_arg in mkdumprd.
+
+* Tue Jan 10 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-31
+- Update kdump dracut module with the latest dracut kdump branch.
+
+* Fri Dec 16 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-30
+- Update kdump dracut module to use the latest dracut feature.
+
+* Fri Sep 9 2011 Tom Callaway <spot@fedoraproject.org> - 2.0.2-29
+- fix systemd scriptlets
+
+* Wed Sep 7 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-28
+- Rename mkdumprd2 to mkdumpramfs.
+
+* Wed Aug 31 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-27
+- Add debug_mem_level debugging option, from Jan Stancek.
+  Resolve Bug 731395.
+
+* Mon Aug 15 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-26
+- Fix several issues caused by the previous revert.
+
+* Mon Aug 15 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-25
+- Switch back to old mkdumprd and also keep the new one.
+
+* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-24
+- Fix default action handling.
+
+* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-23
+- Install modified kdump.conf in initrd.
+
+* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-22
+- Handle lvm in pre-pivot hook.
+
+* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-21
+- Fix udev rules in module-setup.sh
+
+* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-20
+- Generate udev rules in module-setup.sh
+
+* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-19
+- Generate udev rules to handle device names.
+
+* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-18
+- Fix dump to local filesystem and raw dump.
+
+* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-17
+- Depend on dracut-network.
+
+* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-16
+- Move dracut module detection code to module-setup.sh.
+
+* Thu Jul 28 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-15
+- Use shutdown module of dracut to handle reboot/shutdown/halt.
+
+* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-14
+- Wait for loginit.
+
+* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-13
+- Use absolute path of reboot/halt/poweroff.
+
+* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-12
+- Don't use consolehelper, use real reboot/halt/poweroff.
+
+* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-11
+- Rename initrd to initramfs.
+
+* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-10
+- Don't depend on busybox, as it doesn't save much space.
+
+* Tue Jul 26 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-9
+- Parse default action.
+
+* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-8
+- Move path/core_collector/default parsing code to initrd.
+
+* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-7
+- Remove obsolete code in kdumpctl.
+
+* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-6
+- Support core_collector and extran_bins.
+
+* Thu Jul 21 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-5
+- Bypass '-d' option.
+
+* Thu Jul 21 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-4
+- Update initramfs infrastructure to make it working
+  with dracut.
+
+* Wed Jul 06 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-3
+- Removed sysv init script from package
+
+* Mon Jul 04 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-2
+- Added systemd unit file (bz 716994)
+
+* Fri Jun 24 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-1
+- Updated to upstream version 2.0.2
+
+* Thu Jun 02 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-47
+- Fixed misuse of readlink command after directory change (bz 710744)
+
+* Tue Apr 26 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-46
+- Fix some grammer in man page (bz 673817)
+
+* Mon Mar 28 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-45
+- Fix misuse of basename in mkdumprd (bz 683769)
+
+* Thu Mar 10 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-44
+- Fix build break in purgatory makefile
+
+* Thu Mar 10 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-43
+- Remove vestigual emitdms code and call from mkdumprd
+
+* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-42
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Fri Oct 22 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-41
+- Fixed dhcp retry mechanism (bz 645734)
+
+* Wed Sep 29 2010 jkeating - 2.0.0-40
+- Rebuilt for gcc bug 634757
+
+* Wed Sep 22 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-39
+- fix finding modalias/mkdumprd hang (bz 635893)
+
+* Wed Aug 11 2010 David Malcolm <dmalcolm@redhat.com> - 2.0.0-38
+- recompiling .py files against Python 2.7 (rhbz#623327)
+
+* Sun Jun 13 2010 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-37
+- Fix a syntax error in kdump init script
+
+* Sun Jun 13 2010 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-36
+- Cosmetic mkdumprd fixes (drop an unused function, streamline another)
+
+* Sat May 29 2010 CAI Qian <caiqian@redhat.com> - 2.0.0-35
+- Forward-port from F13
+- Fixed kernel text area search in kcore (bz 587750)
+
+* Sat May 29 2010 CAI Qian <caiqian@redhat.com> - 2.0.0-34
+- Massive forward-port from RHEL6
+- Update kexec-kdump-howto.txt
+- Update docs to reflect use of ext4
+- Update mkdumprd to pull in all modules needed
+- Fix mkdumprd typo
+- Removed universal add of ata_piix from mkdumprd
+- Fix infinite loop from modprobe changes
+- Fixed kexec-kdump-howto.doc for RHEL6
+- Update makedumpfile to 1.3.5
+- Improved mkdumprd run time
+- Cai's fix for broken regex
+- Fixing crashkernel syntax parsing
+- Fix initscript to return proper LSB return codes
+- Fixed bad call to resolve_dm_name
+- Added poweroff option to mkdumprd
+- Fixed readlink issue
+- Fixed x86_64 page_offset specifictaion
+- Fixed lvm setup loop to not hang
+- Added utsname support to makedumpfile for 2.6.32
+- Fix critical_disks list to exclude cciss/md
+- Add help info for -b option
+- Add ability to handle firmware hotplug events
+- Update mkdumprd to deal with changes in busybox fsck
+- Vitaly's fix to detect need for 64 bit elf
+- Fix major/minor numbers on /dev/rtc
+- Fix ssh id propogation w/ selinux
+- Add blacklist feature to kdump.conf
+- Removed rhpl code from firstboot
+- Fixed firstboot enable sense
+- Remove bogus debug comment from mkdumprd.
+- Handle SPARSEMEM properly
+- Fix scp monitoring script
+- Fix firstboot to find grub on EFI systems
+- Fixed mkdumprd to remove dup insmod
+- Fixed kdump fsck pause
+- Fixed kdump option handling
+- fixed raid5 module detection
+
+* Thu Mar 11 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-33
+- Remove nash references from mkdumprd
+
+* Wed Feb 17 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-32
+- Fixed spec file error
+
+* Wed Feb 17 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-31
+- Adding kdump.conf man page
+- Adding disk timeout parameter (bz 566135)
+
+* Tue Dec 01 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-30
+- Fix raid support in mkdumprd (bz 519767)
+
+* Mon Nov 23 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-29
+- Updating firstboot script to RHEL-6 version (bz 539812)
+
+* Fri Nov 06 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-28
+- Added abrt infrastructure to kdump init script (bz 533370)
+
+* Tue Sep 15 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-27
+- Fixing permissions on dracut module files
+
+* Fri Sep 11 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-26
+- Rebuild for translation team (bz 522415)
+
+* Thu Sep 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-25
+- Fix dracut module check file (bz 522486)
+
+* Thu Aug 13 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-24
+- update kdump adv conf init script & dracut module
+
+* Wed Jul 29 2009 Neil Horman <nhorman@redhat.com> - 2.0,0-23
+- Remove mkdumprd2 and start replacement with dracut
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-22
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-21
+- Fixed build break
+
+* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-20
+- Make makedumpfile a dynamic binary
+
+* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-19
+- Fix build issue 
+
+* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-18
+- Updated initscript to use mkdumprd2 if manifest is present
+- Updated spec to require dash
+- Updated sample manifest to point to correct initscript
+- Updated populate_std_files helper to fix sh symlink
+
+* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-17
+- Fixed mkdumprd2 tarball creation
+
+* Tue Jun 23 2009 Neil Horman <nhorman@redhat.com> 2.0.0-16
+- Fix up kdump so it works with latest firstboot
+
+* Mon Jun 15 2009 Neil Horman <nhorman@redhat.com> 2.0.0-15
+- Fixed some stat drive detect bugs by E. Biederman (bz505701)
+
+* Wed May 20 2009 Neil Horman <nhorman@redhat.com> 2.0.0-14
+- Put early copy of mkdumprd2 out in the wild (bz 466392)
+
+* Fri May 08 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-13
+- Update makedumpfile to v 1.3.3 (bz 499849)
+
+* Tue Apr 07 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-12
+- Simplifed rootfs mounting code in mkdumprd (bz 494416)
+
+* Sun Apr 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-11
+- Install the correct configuration for i586
+
+* Fri Apr 03 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-10
+- Fix problem with quoted CORE_COLLECTOR string (bz 493707)
+
+* Thu Apr 02 2009 Orion Poplawski <orion@cora.nwra.com> - 2.0.0-9
+- Add BR glibc-static
+
+* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.0-7
+- Rebuild for Python 2.6
+
+* Mon Dec 01 2008 Neil Horman <nhorman@redhat.com> - 2.0.0.6
+- adding makedumpfile man page updates (bz 473212)
+
+* Mon Dec 01 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.0-5
+- Rebuild for Python 2.6
+
+* Wed Nov 05 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-3
+- Correct source file to use proper lang package (bz 335191)
+
+* Wed Oct 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-2
+- Fix mkdumprd typo (bz 469001)
+
+* Mon Sep 15 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-2
+- Fix sysconfig files to not specify --args-linux on x86 (bz 461615)
+
+* Wed Aug 27 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-1
+- Update kexec-tools to latest upstream version
+
+* Wed Aug 27 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-16
+- Fix mkdumprd to properly use UUID/LABEL search (bz 455998)
+
+* Tue Aug  5 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.102pre-15
+- fix license tag
+
+* Mon Jul 28 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-14
+- Add video reset section to docs (bz 456572)
+
+* Fri Jul 11 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-13
+- Fix mkdumprd to support dynamic busybox (bz 443878)
+
+* Wed Jun 11 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-12
+- Added lvm to bin list (bz 443878)
+
+* Thu Jun 05 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-11
+- Update to latest makedumpfile from upstream
+- Mass import of RHEL fixes missing in rawhide
+
+* Thu Apr 24 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-10
+- Fix mkdumprd to properly pull in libs for lvm/mdadm (bz 443878)
+
+* Wed Apr 16 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-9
+- Fix cmdline length issue
+
+* Tue Mar 25 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-8
+- Fixing ARCH definition for bz 438661
+
+* Mon Mar 24 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-7
+- Adding patches for bz 438661
+
+* Fri Feb 22 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-6
+- Bringing rawhide up to date with bugfixes from RHEL5
+- Adding patch to prevent kexec buffer overflow on ppc (bz 428684)
+
+* Tue Feb 19 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-5
+- Modifying mkdumprd to include dynamic executibles (bz 433350)
+
+* Tue Feb 12 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-4
+- bumping rev number for rebuild
+
+* Wed Jan 02 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-3
+- Fix ARCH placement in kdump init script (bz 427201)
+- Fix BuildRequires
+- Fix Makedumpfile to build with new libelf
+
+* Mon Oct 01 2007 Neil Horman <nhorman@redhat.com> - 1.102pre-2
+- Fix triggerpostun script (bz 308151)
+
+* Thu Aug 30 2007 Neil Horman <nhorman@redhat.com> - 1.102pre-1
+- Bumping kexec version to latest horms tree (bz 257201)
+- Adding trigger to remove initrds when a kernel is removed
+
+* Wed Aug 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-81
+- Add xen-syms patch to makedumpfile (bz 250341)
+
+* Wed Aug 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-80
+- Fix ability to determine space on nfs shares (bz 252170)
+
+* Tue Aug 21 2007 Neil Horman <nhorman@redhat.com> - 1.101-79
+- Update kdump.init to always create sparse files (bz 253714)
+
+* Fri Aug 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-78
+- Update init script to handle xen kernel cmdlnes (bz 250803)
+
+* Wed Aug 01 2007 Neil Horman <nhorman@redhat.com> - 1.101-77
+- Update mkdumprd to suppres notifications /rev makedumpfile (bz 250341)
+
+* Thu Jul 19 2007 Neil Horman <nhorman@redhat.com> - 1.101-76
+- Fix mkdumprd to suppress informative messages (bz 248797)
+
+* Wed Jul 18 2007 Neil Horman <nhorman@redhat.com> - 1.101-75
+- Updated fr.po translations (bz 248287)
+
+* Tue Jul 17 2007 Neil Horman <nhorman@redhat.com> - 1.101-74
+- Fix up add_buff to retry locate_hole on segment overlap (bz 247989)
+
+* Mon Jul 09 2007 Neil Horman <nhorman@redhat.com> - 1.101-73
+- Fix up language files for kexec (bz 246508)
+
+* Thu Jul 05 2007 Neil Horman <nhorman@redhat.com> - 1.101-72
+- Fixing up initscript for LSB (bz 246967)
+
+* Tue Jun 19 2007 Neil Horman <nhorman@redhat.com> - 1.101-71
+- Fixed conflict in mkdumprd in use of /mnt (bz 222911)
+
+* Mon Jun 18 2007 Neil Horman <nhorman@redhat.com> - 1.101-70
+- Fixed kdump.init to properly read cmdline (bz 244649)
+
+* Wed Apr 11 2007 Neil Horman <nhorman@redhat.com> - 1.101-69
+- Fixed up kdump.init to enforce mode 600 on authorized_keys2 (bz 235986)
+
+* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-68
+- Fix alignment of bootargs and device-tree structures on ppc64
+
+* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-67
+- Allow ppc to boot ppc64 kernels (bz 235608)
+
+* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-66
+- Reduce rmo_top to 0x7c000000 for PS3 (bz 235030)
+
+* Mon Mar 26 2007 Neil Horman <nhorman@redhat.com> - 1.101-65
+- Fix spec to own kexec_tools directory (bz 219035)
+
+* Wed Mar 21 2007 Neil Horman <nhorman@redhat.com> - 1.101-64
+- Add fix for ppc memory region computation (bz 233312)
+
+* Thu Mar 15 2007 Neil Horman <nhorman@redhat.com> - 1.101-63
+- Adding extra check to avoid oom kills on nfs mount failure (bz 215056)
+
+* Tue Mar 06 2007 Neil Horman <nhorman@redhat.com> - 1.101-62
+- Updating makedumpfile to version 1.1.1 (bz 2223743)
+
+* Thu Feb 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-61
+- Adding multilanguage infrastructure to firstboot_kdump (bz 223175)
+
+* Mon Feb 12 2007 Neil Horman <nhorman@redhat.com> - 1.101-60
+- Fixing up file permissions on kdump.conf (bz 228137)
+
+* Fri Feb 09 2007 Neil Horman <nhorman@redhat.com> - 1.101-59
+- Adding mkdumprd man page to build
+
+* Thu Jan 25 2007 Neil Horman <nhorman@redhat.com> - 1.101-58
+- Updating kdump.init and mkdumprd with most recent RHEL5 fixes
+- Fixing BuildReq to require elfutils-devel-static
+
+* Thu Jan 04 2007 Neil Horman <nhorman@redhat.com> - 1.101-56
+- Fix option parsing problem for bzImage files (bz 221272)
+
+* Fri Dec 15 2006 Neil Horman <nhorman@redhat.com> - 1.101-55
+- Wholesale update of RHEL5 revisions 55-147
+
+* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-54
+- integrate default elf format patch
+
+* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-53
+- Taking Viveks x86_64 crashdump patch (rcv. via email)
+
+* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-52
+- Taking ia64 tools patch for bz 181358
+
+* Mon Aug 28 2006 Neil Horman <nhorman@redhat.com> - 1.101-51
+- more doc updates
+- added patch to fix build break from kernel headers change
+
+* Thu Aug 24 2006 Neil Horman <nhorman@redhat.com> - 1.101-50
+- repo patch to enable support for relocatable kernels.
+
+* Thu Aug 24 2006 Neil Horman <nhorman@redhat.com> - 1.101-49
+- rewriting kcp to properly do ssh and scp
+- updating mkdumprd to use new kcp syntax
+
+* Wed Aug 23 2006 Neil Horman <nhorman@redhat.com> - 1.101-48
+- Bumping revision number 
+
+* Tue Aug 22 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-47
+- ppc64 no-more-platform fix
+
+* Mon Aug 21 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-46
+- ppc64 fixups:
+  - actually build ppc64 binaries (bug 203407)
+  - correct usage output
+  - avoid segfault in command-line parsing
+- install kexec man page
+- use regulation Fedora BuildRoot
+
+* Fri Aug 18 2006 Neil Horman <nhorman@redhat.com> - 1.101-45
+- fixed typo in mkdumprd for bz 202983
+- fixed typo in mkdumprd for bz 203053
+- clarified docs in kdump.conf with examples per bz 203015
+
+* Tue Aug 15 2006 Neil Horman <nhorman@redhat.com> - 1.101-44
+- updated init script to implement status function/scrub err messages
+ 
+* Wed Aug 09 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-43
+- Misc spec cleanups and macro-ifications
+
+* Wed Aug 09 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-42
+- Add %%dir /var/crash, so default kdump setup works
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-41
+- fix another silly makefile error for makedumpfile 
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-40
+- exclude makedumpfile from build on non-x86[_64] arches 
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-39
+- exclude makedumpfile from build on non-x86[_64] arches 
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-38
+- updating makedumpfile makefile to use pkg-config on glib-2.0
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-37
+- updating makedumpfile makefile to use pkg-config
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-36
+- Removing unneeded deps after Makefile fixup for makedumpfile
+
+* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-35
+- fixing up FC6/RHEL5 BuildRequires line to build in brew
+
+* Wed Aug 02 2006 Neil Horman <nhorman@redhat.com> - 1.101-34
+- enabling makedumpfile in build
+
+* Wed Aug 02 2006 Neil Horman <nhorman@redhat.com> - 1.101-33
+- added makedumpfile source to package
+
+* Mon Jul 31 2006 Neil Horman <nhorman@redhat.com> - 1.101-32
+- added et-dyn patch to allow loading of relocatable kernels
+
+* Thu Jul 27 2006 Neil Horman <nhorman@redhat.com> - 1.101-30
+- fixing up missing patch to kdump.init
+
+* Wed Jul 19 2006 Neil Horman <nhorman@redhat.com> - 1.101-30
+- add kexec frontend (bz 197695)
+
+* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.101-29
+- rebuild
+
+* Fri Jul 07 2006 Neil Horman <nhorman@redhat.com> 1.101-27.fc6
+- Buildrequire zlib-devel
+
+* Thu Jun 22 2006 Neil Horman <nhorman@redhat.com> -1.101-19
+- Bumping rev number
+
+* Thu Jun 22 2006 Neil Horman <nhorman@redhat.com> -1.101-17
+- Add patch to allow ppc64 to ignore args-linux option
+
+* Wed Mar 08 2006 Bill Nottingham <notting@redhat.com> - 1.101-16
+- fix scriptlet - call chkconfig --add, change the default in the
+  script itself (#183633)
+
+* Wed Mar 08 2006 Thomas Graf <tgraf@redhat.com> - 1.101-15
+- Don't add kdump service by default, let the user manually add it to
+  avoid everyone seeing a warning.
+
+* Tue Mar 07 2006 Thomas Graf <tgraf@redhat.com> - 1.101-14
+- Fix kdump.init to call kexec from its new location
+
+* Mon Mar  6 2006 Jeremy Katz <katzj@redhat.com> - 1.101-13
+- proper requires for scriptlets
+
+* Mon Mar 06 2006 Thomas Graf <tgraf@redhat.com> - 1.101-12
+- Move kexec and kdump binaries to /sbin
+
+* Thu Mar 02 2006 Thomas Graf <tgraf@redhat.com> - 1.101-11
+- Fix argument order when stopping kexec
+
+* Mon Feb 27 2006 Thomas Graf <tgraf@redhat.com> - 1.101-10
+- kdump7.patch
+   o Remove elf32 core headers support for x86_64
+   o Fix x86 prepare elf core header routine
+   o Fix ppc64 kexec -p failure for gcc 4.10
+   o Fix few warnings for gcc 4.10
+   o Add the missing --initrd option for ppc64
+   o Fix ppc64 persistent root device bug
+- Remove --elf32-core-headers from default configuration, users
+  may re-add it via KEXEC_ARGS.
+- Remove obsolete KEXEC_HEADERS
+* Wed Feb 22 2006 Thomas Graf <tgraf@redhat.com> - 1.101-9
+- Remove wrong quotes around --command-line in kdump.init
+
+* Fri Feb 17 2006 Jeff Moyer <jmoyer@redhat.com> - 1.101-8
+- Fix the service stop case.  It was previously unloading the wrong kernel.
+- Implement the "restart" function.
+- Add the "irqpoll" option as a default kdump kernel commandline parameter.
+- Create a default kernel command line in the sysconfig file upon rpm install.
+
+* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.101-7.1.1
+- rebuilt for new gcc4.1 snapshot and glibc changes
+
+* Thu Feb 02 2006 Thomas Graf <tgraf@redhat.com> - 1.101-7.1
+- Add patch to enable the kdump binary for x86_64
+* Wed Feb 01 2006 Thomas Graf <tgraf@redhat.com>
+- New kdump patch to support s390 arch + various fixes
+- Include kdump in x86_64 builds
+* Mon Jan 30 2006 Thomas Graf <tgraf@redhat.com>
+- New kdump patch to support x86_64 userspace
+
+* Fri Dec 16 2005 Jesse Keating <jkeating@redhat.com>
+- rebuilt for new gcj
+
+* Wed Nov 16 2005 Thomas Graf <tgraf@redhat.com> - 1.101-5
+- Report missing kdump kernel image as warning
+ 
+* Thu Nov  3 2005 Jeff Moyer <jmoyer@redhat.com> - 1.101-4
+- Build for x86_64 as well.  Kdump support doesn't work there, but users
+  should be able to use kexec.
+
+* Fri Sep 23 2005 Jeff Moyer <jmoyer@redhat.com> - 1.101-3
+- Add a kdump sysconfig file and init script
+- Spec file additions for pre/post install/uninstall
+
+* Thu Aug 25 2005 Jeff Moyer <jmoyer@redhat.com>
+- Initial prototype for RH/FC5
diff --git a/live-image-kdump-howto.txt b/live-image-kdump-howto.txt
new file mode 100644
index 0000000..1695a1c
--- /dev/null
+++ b/live-image-kdump-howto.txt
@@ -0,0 +1,25 @@
+Kdump now works on live images with some manual configurations. Here is the step
+by step guide.
+
+1. Enable crashkernel reservation
+
+Since there isn't any config file that can be used to configure kernel
+parameters for live images before booting them, we have to append 'crashkernel'
+argument in boot menu every time we boot a live image.
+
+2. Change dump target in /etc/kdump.conf
+
+When kdump kernel boots in a live environment, the default target /var/crash is
+in RAM so you need to change the dump target to an external disk or a network
+dump target.
+
+Besides, make sure that "default dump_to_rootfs" is not specified.
+
+3. Start kdump service
+
+    $ kdumpctl start
+
+4. Trigger a kdump test
+
+    $ echo 1 > /proc/sys/kernel/sysrq
+    $ echo c > /proc/sysrq-trigger
diff --git a/mkdumprd b/mkdumprd
new file mode 100644
index 0000000..36f71b7
--- /dev/null
+++ b/mkdumprd
@@ -0,0 +1,485 @@
+#!/bin/bash --norc
+# New mkdumprd
+#
+# Copyright 2011 Red Hat, Inc.
+#
+# Written by Cong Wang <amwang@redhat.com>
+#
+
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
+. /lib/kdump/kdump-lib.sh
+export IN_KDUMP=1
+
+conf_file="/etc/kdump.conf"
+SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
+SAVE_PATH=$(get_save_path)
+OVERRIDE_RESETTABLE=0
+
+extra_modules=""
+dracut_args="--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
+
+readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
+[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
+readonly MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target"
+
+trap '
+    ret=$?;
+    is_mounted $MKDUMPRD_TMPMNT && umount -f $MKDUMPRD_TMPMNT;
+    [[ -d $MKDUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKDUMPRD_TMPDIR";
+    exit $ret;
+    ' EXIT
+
+# clean up after ourselves no matter how we die.
+trap 'exit 1;' SIGINT
+
+is_wdt_addition_needed() {
+	local active
+
+	is_wdt_mod_omitted
+	[[ $? -eq 0 ]] && return 1
+	[[ -d /sys/class/watchdog/ ]] || return 1
+	for dir in /sys/class/watchdog/*; do
+		[[ -f "$dir/state" ]] || continue
+		active=$(< "$dir/state")
+		[[ "$active" =  "active" ]] && return 0
+	done
+	return 1
+}
+
+add_dracut_arg() {
+    dracut_args="$dracut_args $@"
+}
+
+add_dracut_module() {
+    add_dracut_arg "--add" "\"$1\""
+}
+
+add_dracut_mount() {
+    add_dracut_arg "--mount" "\"$1\""
+}
+
+add_dracut_sshkey() {
+    add_dracut_arg "--sshkey" "\"$1\""
+}
+
+# caller should ensure $1 is valid and mounted in 1st kernel
+to_mount() {
+    local _target=$1 _fstype=$2 _options=$3 _new_mntpoint _pdev
+
+    _new_mntpoint=$(get_kdump_mntpoint_from_target $_target)
+    _fstype="${_fstype:-$(get_fs_type_from_target $_target)}"
+    _options="${_options:-$(get_mntopt_from_target $_target)}"
+    _options="${_options:-defaults}"
+
+    if [[ "$_fstype" == "nfs"* ]]; then
+        _pdev=$_target
+        _options=$(echo $_options | sed 's/,addr=[^,]*//')
+        _options=$(echo $_options | sed 's/,proto=[^,]*//')
+        _options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
+    else
+        # for non-nfs _target converting to use udev persistent name
+        _pdev="$(kdump_get_persistent_dev $_target)"
+        if [ -z "$_pdev" ]; then
+            return 1
+        fi
+    fi
+
+    # mount fs target as rw in 2nd kernel
+    _options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
+    # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
+    # kernel, filter it out here.
+    _options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
+    # drop nofail or nobootwait
+    _options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
+    _options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
+    # use both nofail and x-systemd.before to ensure systemd will try best to
+    # mount it before kdump starts, this is an attempt to improve robustness
+    _options="$_options,nofail,x-systemd.before=initrd-fs.target"
+
+    echo "$_pdev $_new_mntpoint $_fstype $_options"
+}
+
+#Function: get_ssh_size
+#$1=dump target
+#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
+get_ssh_size() {
+    local _opt _out _size
+    _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
+    _out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH")
+    [ $? -ne 0 ] && {
+        perror_exit "checking remote ssh server available size failed."
+    }
+
+    #ssh output removed the line break, so print field NF-2
+    _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}')
+    echo -n $_size
+}
+
+#mkdir if save path does not exist on ssh dump target
+#$1=ssh dump target
+#caller should ensure write permission on $1:$SAVE_PATH
+#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
+mkdir_save_path_ssh()
+{
+    local _opt _dir
+    _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
+    ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null
+    _ret=$?
+    if [ $_ret -ne 0 ]; then
+        perror_exit "mkdir failed on $1:$SAVE_PATH"
+    fi
+
+    #check whether user has write permission on $1:$SAVE_PATH
+    _dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null)
+    _ret=$?
+    if [ $_ret -ne 0 ]; then
+        perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination"
+    fi
+    ssh -qn $_opt $1 rmdir $_dir
+
+    return 0
+}
+
+#Function: get_fs_size
+#$1=dump target
+get_fs_size() {
+    local _mnt=$(get_mntpoint_from_target $1)
+    echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
+}
+
+#Function: get_raw_size
+#$1=dump target
+get_raw_size() {
+        echo -n $(fdisk -s "$1")
+}
+
+#Function: check_size
+#$1: dump type string ('raw', 'fs', 'ssh')
+#$2: dump target
+check_size() {
+    local avail memtotal
+
+    memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo)
+    case "$1" in
+        raw)
+            avail=$(get_raw_size "$2")
+            ;;
+        ssh)
+            avail=$(get_ssh_size "$2")
+            ;;
+        fs)
+            avail=$(get_fs_size "$2")
+            ;;
+        *)
+            return
+    esac
+
+    if [ $? -ne 0 ]; then
+            perror_exit "Check dump target size failed"
+    fi
+
+    if [ $avail -lt $memtotal ]; then
+        echo "Warning: There might not be enough space to save a vmcore."
+        echo "         The size of $2 should be greater than $memtotal kilo bytes."
+    fi
+}
+
+check_save_path_fs()
+{
+    local _path=$1
+
+    if [ ! -d $_path ]; then
+        perror_exit "Dump path $_path does not exist."
+    fi
+}
+
+check_user_configured_target()
+{
+    local _target=$1 _cfg_fs_type=$2 _mounted
+    local _mnt=$(get_mntpoint_from_target $_target)
+    local _opt=$(get_mntopt_from_target $_target)
+    local _fstype=$(get_fs_type_from_target $_target)
+
+    if [ -n "$_fstype" ]; then
+        # In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf
+        [[ $_fstype = "nfs"* ]] && _fstype=nfs
+
+        if [ -n "$_cfg_fs_type" ] && [ "$_fstype" != "$_cfg_fs_type" ]; then
+            perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\""
+        fi
+    else
+        _fstype="$_cfg_fs_type"
+        _fstype="$_cfg_fs_type"
+    fi
+
+    # For noauto mount, mount it inplace with default value.
+    # Else use the temporary target directory
+    if [ -n "$_mnt" ]; then
+        if ! is_mounted "$_mnt"; then
+            if [[ $_opt  = *",noauto"* ]]; then
+                mount $_mnt
+                [ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check."
+                _mounted=$_mnt
+            else
+                perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\""
+            fi
+        fi
+    else
+        _mnt=$MKDUMPRD_TMPMNT
+        mkdir -p $_mnt
+        mount $_target $_mnt -t $_fstype -o defaults
+        [ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check."
+        _mounted=$_mnt
+    fi
+
+    # For user configured target, use $SAVE_PATH as the dump path within the target
+    if [ ! -d "$_mnt/$SAVE_PATH" ]; then
+        perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\""
+    fi
+
+    check_size fs "$_target"
+
+    # Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway
+    if [ -n "$_mounted" ]; then
+        umount -f -- $_mounted
+    fi
+}
+
+# $1: core_collector config value
+verify_core_collector() {
+    local _cmd="${1%% *}"
+    local _params="${1#* }"
+
+    if [ "$_cmd" != "makedumpfile" ]; then
+        if is_raw_dump_target; then
+            echo "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
+        fi
+        return
+    fi
+
+    if is_ssh_dump_target || is_raw_dump_target; then
+        if ! strstr "$_params" "-F"; then
+            perror_exit "The specified dump target needs makedumpfile \"-F\" option."
+        fi
+        _params="$_params vmcore"
+    else
+        _params="$_params vmcore dumpfile"
+    fi
+
+    if ! $_cmd --check-params $_params; then
+        perror_exit "makedumpfile parameter check failed."
+    fi
+}
+
+add_mount() {
+    local _mnt=$(to_mount $@)
+
+    if [ $? -ne 0 ]; then
+        exit 1
+    fi
+
+    add_dracut_mount "$_mnt"
+}
+
+#handle the case user does not specify the dump target explicitly
+handle_default_dump_target()
+{
+    local _target
+    local _mntpoint
+
+    is_user_configured_dump_target && return
+
+    check_save_path_fs $SAVE_PATH
+
+    _save_path=$(get_bind_mount_source $SAVE_PATH)
+    _target=$(get_target_from_path $_save_path)
+    _mntpoint=$(get_mntpoint_from_target $_target)
+
+    SAVE_PATH=${_save_path##"$_mntpoint"}
+    add_mount "$_target"
+    check_size fs $_target
+}
+
+get_override_resettable()
+{
+    local override_resettable
+
+    override_resettable=$(grep "^override_resettable" $conf_file)
+    if [ -n "$override_resettable" ]; then
+        OVERRIDE_RESETTABLE=$(echo $override_resettable | cut -d' '  -f2)
+        if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then
+            perror_exit "override_resettable value $OVERRIDE_RESETTABLE is invalid"
+        fi
+    fi
+}
+
+
+# $1: function name
+for_each_block_target()
+{
+    local dev majmin
+
+    for dev in $(get_kdump_targets); do
+        [ -b "$dev" ] || continue
+        majmin=$(get_maj_min $dev)
+        check_block_and_slaves $1 $majmin && return 1
+    done
+
+    return 0
+}
+
+
+
+#judge if a specific device with $1 is unresettable
+#return false if unresettable.
+is_unresettable()
+{
+    local path="/sys/$(udevadm info --query=all --path=/sys/dev/block/$1 | awk '/^P:/ {print $2}' | sed -e 's/\(cciss[0-9]\+\/\).*/\1/g' -e 's/\/block\/.*$//')/resettable"
+    local resettable=1
+
+    if [ -f "$path" ]
+    then
+        resettable="$(cat $path)"
+        [ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
+            local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
+            echo "Error: Can not save vmcore because device $device is unresettable"
+            return 0
+        }
+    fi
+
+    return 1
+}
+
+#check if machine is resettable.
+#return true if resettable
+check_resettable()
+{
+    local _ret _target
+
+    get_override_resettable
+
+    for_each_block_target is_unresettable
+    _ret=$?
+
+    [ $_ret -eq 0 ] && return
+
+    return 1
+}
+
+# $1: maj:min
+is_crypt()
+{
+    local majmin=$1 dev line ID_FS_TYPE=""
+
+    line=$(udevadm info --query=property --path=/sys/dev/block/$majmin \
+            | grep "^ID_FS_TYPE")
+    eval "$line"
+    [[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && {
+        dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}')
+        echo "Device $dev is encrypted."
+        return 0
+    }
+    return 1
+}
+
+check_crypt()
+{
+    local _ret _target
+
+    for_each_block_target is_crypt
+    _ret=$?
+
+    [ $_ret -eq 0 ] && return
+
+    return 1
+}
+
+if ! check_resettable; then
+    exit 1
+fi
+
+if ! check_crypt; then
+    echo "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
+fi
+
+# firstly get right SSH_KEY_LOCATION
+keyfile=$(awk '/^sshkey/ {print $2}' $conf_file)
+if [ -f "$keyfile" ]; then
+    # canonicalize the path
+    SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)
+fi
+
+if [ "$(uname -m)" = "s390x" ]; then
+    add_dracut_module "znet"
+fi
+
+if is_wdt_addition_needed; then
+    add_dracut_arg "-a" "watchdog"
+fi
+
+while read config_opt config_val;
+do
+    # remove inline comments after the end of a directive.
+    case "$config_opt" in
+    extra_modules)
+        extra_modules="$extra_modules $config_val"
+        ;;
+    ext[234]|xfs|btrfs|minix|nfs)
+        check_user_configured_target "$config_val" "$config_opt"
+        add_mount "$config_val" "$config_opt"
+        ;;
+    raw)
+        # checking raw disk writable
+        dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
+            perror_exit "Bad raw disk $config_val"
+        }
+        _praw=$(persistent_policy="by-id" kdump_get_persistent_dev $config_val)
+        if [ -z "$_praw" ]; then
+            exit 1
+        fi
+        add_dracut_arg "--device" "$_praw"
+        check_size raw $config_val
+        ;;
+    ssh)
+        if strstr "$config_val" "@";
+        then
+            mkdir_save_path_ssh $config_val
+            check_size ssh $config_val
+            add_dracut_module "ssh-client"
+            add_dracut_sshkey "$SSH_KEY_LOCATION"
+        else
+            perror_exit "Bad ssh dump target $config_val"
+        fi
+        ;;
+    core_collector)
+        verify_core_collector "$config_val"
+        ;;
+    dracut_args)
+        add_dracut_arg $config_val
+        ;;
+    *)
+        ;;
+    esac
+done <<< "$(read_strip_comments $conf_file)"
+
+handle_default_dump_target
+
+if [ -n "$extra_modules" ]
+then
+    add_dracut_arg "--add-drivers" \"$extra_modules\"
+fi
+
+if ! is_fadump_capable; then
+    # The 2nd rootfs mount stays behind the normal dump target mount,
+    # so it doesn't affect the logic of check_dump_fs_modified().
+    is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))"
+
+    add_dracut_arg "--no-hostonly-default-device"
+fi
+
+echo "$dracut_args $@" | xargs dracut
+
+_rc=$?
+sync
+exit $_rc
diff --git a/mkdumprd.8 b/mkdumprd.8
new file mode 100644
index 0000000..7faae57
--- /dev/null
+++ b/mkdumprd.8
@@ -0,0 +1,33 @@
+.TH MKDUMRD 8 "Fri Feb 9 2007"
+.SH NAME
+mkdumprd \- creates initial ramdisk images for kdump crash recovery 
+.SH SYNOPSIS
+\fBmkdumprd\fR [OPTION]
+
+.SH DESCRIPTION
+\fBmkdumprd\fR creates an initial ram file system for use in conjunction with
+the booting of a kernel within the kdump framework for crash recovery.
+\fBmkdumprds\fR purpose is to create an initial ram filesystem capable of copying
+the crashed systems vmcore image to a location specified in \fI/etc/kdump.conf 
+
+\fBmkdumprd\fR interrogates the running system to understand what modules need to
+be loaded in the initramfs (based on configuration retrieved from
+\fI/etc/kdump.conf)\fR
+
+\fBmkdumprd\fR add a new \fBdracut\fR module 99kdumpbase and use \fBdracut\fR
+utility to generate the initramfs.
+
+\fBmkdumprd\fR was not intended for casual use outside of the service
+initialization script for the kdump utility, and should not be run manually.  If
+you require a custom kdump initramfs image, it is suggested that you use the
+kdump service infrastructure to create one, and then manually unpack, modify and
+repack the image.
+
+
+.SH OPTIONS
+.TP
+All options here are passed to dracut directly, please refer \fBdracut\fR docs
+for the info.
+
+.SH "SEE ALSO"
+.BR dracut (8)
diff --git a/sources b/sources
new file mode 100644
index 0000000..574d13c
--- /dev/null
+++ b/sources
@@ -0,0 +1,3 @@
+SHA512 (eppic-d84c354.tar.gz) = 455b3386c3e4cc546b858f1f8b0e6874072aaae708ebe072452fb5f0b6a81b1f3a315b40f94c3967f38525cadd276864a7bc7f0f12fa421655dcc3b15b70914d
+SHA512 (kexec-tools-2.0.20.tar.xz) = 3112b6202c1030705c53e3f65a2b58aec14d65333a35aad681d48b9f2bd1c51a2e05c985a1e5e867ab02f8a9c97708483d9d225619db7c6993676f1a242e2d99
+SHA512 (makedumpfile-1.6.7.tar.gz) = fdd78bfea5f96eda094269480ebbceead6ae8d9d2bb1184ffa1e18c6effda5c6df296fbcecc25735109194c0690d6f9ca684c37da1825d7d65568ba18a71a940
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..6144809
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,88 @@
+TEST_CASE ?=
+BASE_IMAGE ?=
+
+TEST_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
+BUILD_ROOT := $(TEST_ROOT)/build
+REPO = $(shell realpath $(TEST_ROOT)/../)
+ARCH ?= $(shell arch)
+SPEC = kexec-tools.spec
+
+DIST ?= fedora
+DIST_ABR ?= f
+DIST_ABRL ?= fc
+DIST_UNSET ?= rhel
+RELEASE ?= 32
+
+DEFAULT_BASE_IMAGE_VER ?= 1.6
+DEFAULT_BASE_IMAGE ?= Fedora-Cloud-Base-$(RELEASE)-$(DEFAULT_BASE_IMAGE_VER).$(ARCH).raw.xz
+DEFAULT_BASE_IMAGE_URL ?= https://dl.fedoraproject.org/pub/fedora/linux/releases/$(RELEASE)/Cloud/$(ARCH)/images/$(DEFAULT_BASE_IMAGE)
+
+BUILD_ROOT = $(TEST_ROOT)/build
+RPMDEFINE = --define '_sourcedir $(REPO)'\
+	    --define '_specdir $(REPO)'\
+	    --define '_builddir $(BUILD_ROOT)'\
+	    --define '_srcrpmdir $(BUILD_ROOT)'\
+	    --define '_rpmdir $(BUILD_ROOT)'\
+	    --define 'dist %{?distprefix}.$(DIST_ABRL)$(RELEASE)'\
+	    --define '$(DIST) $(RELEASE)'\
+	    --eval '%undefine $(DIST_UNSET)'\
+	    --define '$(DIST_ABRL)$(RELEASE) 1'\
+
+KEXEC_TOOLS_SRC = $(filter-out $(REPO)/tests,$(wildcard $(REPO)/*))
+KEXEC_TOOLS_TEST_SRC = $(wildcard $(REPO)/tests/scripts/**/*)
+KEXEC_TOOLS_NVR = $(shell rpm $(RPMDEFINE) -q --specfile $(REPO)/$(SPEC) 2>/dev/null | grep -m 1 .)
+KEXEC_TOOLS_RPM = $(BUILD_ROOT)/$(ARCH)/$(KEXEC_TOOLS_NVR).rpm
+
+all: $(TEST_ROOT)/output/test-base-image
+
+# Use either:
+# fedpkg --release $(DIST_ABR)$(RELEASE) --path ../../ local
+# or
+# rpmbuild $(RPMDEFINE) -ba $(REPO)/$(SPEC)
+# to rebuild the rpm, currently use rpmbuild to have better control over the rpm building process
+#
+$(KEXEC_TOOLS_RPM): $(KEXEC_TOOLS_SRC)
+	sh -c "cd .. && fedpkg sources"
+	@echo Rebuilding RPM due to modification of sources: $?
+	rpmbuild $(RPMDEFINE) -ba $(REPO)/$(SPEC)
+
+$(BUILD_ROOT)/base-image:
+	mkdir -p $(BUILD_ROOT)
+ifeq ($(strip $(BASE_IMAGE)),)
+	wget $(DEFAULT_BASE_IMAGE_URL) -O $(BUILD_ROOT)/$(DEFAULT_BASE_IMAGE)
+	$(TEST_ROOT)/scripts/build-image.sh \
+		$(BUILD_ROOT)/$(DEFAULT_BASE_IMAGE)\
+		$(BUILD_ROOT)/base-image
+else
+	$(TEST_ROOT)/scripts/build-image.sh \
+		$(BASE_IMAGE)\
+		$(BUILD_ROOT)/base-image
+endif
+
+$(BUILD_ROOT)/inst-base-image: $(BUILD_ROOT)/base-image
+	@echo "Building installation base image"
+	echo $(KEXEC_TOOLS_NVR)
+	$(TEST_ROOT)/scripts/build-image.sh \
+		$(BUILD_ROOT)/base-image \
+		$(BUILD_ROOT)/inst-base-image \
+		$(TEST_ROOT)/scripts/build-scripts/base-image.sh
+
+$(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS_RPM) $(KEXEC_TOOLS_TEST_SRC)
+	@echo "Building test base image"
+	mkdir -p $(TEST_ROOT)/output
+	$(TEST_ROOT)/scripts/build-image.sh \
+		$(BUILD_ROOT)/inst-base-image \
+		$(TEST_ROOT)/output/test-base-image \
+		$(TEST_ROOT)/scripts/build-scripts/test-base-image.sh \
+		$(KEXEC_TOOLS_RPM)
+
+test-run: $(TEST_ROOT)/output/test-base-image
+ifeq ($(strip $(TEST_CASE)),)
+	$(TEST_ROOT)/scripts/run-test.sh
+else
+	$(TEST_ROOT)/scripts/run-test.sh --console $(TEST_CASE)
+endif
+
+clean:
+	rm -rf $(TEST_ROOT)/build
+	rm -rf $(TEST_ROOT)/output
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..6ab63a8
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,65 @@
+=====================
+Kexec Kdump Self-test
+=====================
+
+
+Introduction
+============
+The self-tests here are useful for quick sanity tests for new patches, and also helpful for debugging issues.
+
+
+How it works
+============
+All tests are run within VMs using qemu. By default, VM images are based on Fedora Cloud image, and the image for each test run is a layered qcow2 snapshot on top of the base image.
+Test images are managed by Makefile, so if there are any code change in the kexec-tools repository, `make` command will detect that and only rebuild the top image layer. This makes the test runs boot fast and each test run is clean.
+
+
+Basic usage
+===========
+Before you start, you can make the self-tests use your own base image by running following command:
+
+`make clean && make BASE_IMAGE=<path/to/your/image>`
+
+This is helpful if you have a slow network, else self-test will try to download the cloud image from Fedora's official website using `wget`.
+
+- Use the following command to run all tests:
+  $ make test-run
+
+  All available tests will be executed.
+
+  Test artifacts are stored in output/<testcase>
+
+- For easier debugging, you can run only on test with the following command:
+  $ make TEST_CASE=<testcase> test-run
+
+  This way, VM's console is directly connected to stdin/out so debugging will be easier.
+  If there are multiple VMs used in a test case, the VM performing actual kdump/kexec operation will be connected to stdin/out.
+
+Test Cases
+==========
+Each test case is a folder under scripts/testcases/, a test case folder will contain at least one executable shell script, and each script should contain two functions: "on_build" and "on_test".
+
+"on_build" is called when building the test image, which can instruct the self-test framework to install packages or create files, etc.
+"on_test" is called when VM finished booting, which can get the boot count by calling "get_test_boot_count" and determine what to do. It should call "test_passed" on success, and call "test_failed" on failure. "test_aborted" is called when unexpected behavior occurs.
+
+When there are multiple scripts in a single test case folder, they will spawn VMs in lexical order, and the last VM is considered the VM performing the actual test. Other VMs could be hosting test required service. This is useful for the network dump test. However, "test_passed" or "test_failed" or "test_aborted" could be called in any of these VMs, so during network kdump test, the dump target can also terminate the test and mark it passed when a valid vmcore is detected.
+
+
+Debugging
+=========
+
+- When the test VM boots, you can append "no_test" to kernel args in grub, which tells the test services to quit early.
+
+- You can launch the VMs manually or inspect the image after ran a test.
+
+  Test images are located as:
+
+    output/<testcase>/<vm-name>.img
+
+  Test images' corresponding qemu command are located as:
+
+    output/<testcase>/<vm-name>.qemu_cmd
+
+  To repeat/debug a test manually, you should launch all VMs in output/<testcase> menu in lexical order, and append 'no_test' in the last VM's grub cmdline, then VM will hang on login prompt, login with root/fedora. Test script is located as /kexec-kdump-test/test.sh
+
+- If you just want to inspect the images file content, you can also use scripts/spawn-image-shell.sh <test-image> to spawn a shell in the image quickly.
diff --git a/tests/scripts/build-image.sh b/tests/scripts/build-image.sh
new file mode 100755
index 0000000..c196bfb
--- /dev/null
+++ b/tests/scripts/build-image.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+
+if [ $# -lt 2 ]; then
+	echo "Usage: $(basename $0) <base-image> <output-image> <build-script> [<build-script-args>]
+	Build a new <output-image> on top of <base-image>, and install
+	contents defined in <build-script>. <args> are directly passed
+	to <build-script>.
+
+	If <base-image> is raw, will copy it and create <output-image>
+	in qcow2 format.
+
+	If <base-image> is qcow2, will create <output-image> as a snapshot
+	on top of <base-image>"
+	exit 1
+fi
+
+BASEDIR=$(realpath $(dirname "$0"))
+. $BASEDIR/image-init-lib.sh
+
+# Base image to build from
+BASE_IMAGE=$1 && shift
+if [[ ! -e $BASE_IMAGE ]]; then
+	perror_exit "Base image '$BASE_IMAGE' not found"
+else
+	BASE_IMAGE=$(realpath "$BASE_IMAGE")
+fi
+
+OUTPUT_IMAGE=$1 && shift
+if [[ ! -d $(dirname $OUTPUT_IMAGE) ]]; then
+	perror_exit "Path '$(dirname $OUTPUT_IMAGE)' doesn't exists"
+fi
+
+INST_SCRIPT=$1 && shift
+
+create_image_from_base_image $BASE_IMAGE $OUTPUT_IMAGE.building
+
+mount_image $OUTPUT_IMAGE.building
+
+img_inst() {
+	inst_in_image $OUTPUT_IMAGE.building $@
+}
+
+img_inst_pkg() {
+	inst_pkg_in_image $OUTPUT_IMAGE.building $@
+}
+
+img_run_cmd() {
+	run_in_image $OUTPUT_IMAGE.building "$@"
+}
+
+img_add_qemu_cmd() {
+	QEMU_CMD+="$@"
+}
+
+[ -e "$INST_SCRIPT" ] && source $INST_SCRIPT
+
+mv $OUTPUT_IMAGE.building $OUTPUT_IMAGE
diff --git a/tests/scripts/build-scripts/base-image.sh b/tests/scripts/build-scripts/base-image.sh
new file mode 100755
index 0000000..62624e4
--- /dev/null
+++ b/tests/scripts/build-scripts/base-image.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+img_inst_pkg grubby\
+	dnsmasq\
+	openssh openssh-server\
+	dracut-network dracut-squash squashfs-tools ethtool snappy
+
+img_run_cmd "grubby --args systemd.journald.forward_to_console=1 systemd.log_target=console --update-kernel ALL"
+img_run_cmd "grubby --args selinux=0 --update-kernel ALL"
+img_run_cmd "grubby --args crashkernel=224M --update-kernel ALL"
diff --git a/tests/scripts/build-scripts/test-base-image.sh b/tests/scripts/build-scripts/test-base-image.sh
new file mode 100755
index 0000000..5e2d86a
--- /dev/null
+++ b/tests/scripts/build-scripts/test-base-image.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Test RPMs to be installed
+TEST_RPMS=
+for _rpm in $@; do
+	if [[ ! -e $_rpm ]]; then
+		perror_exit "'$_rpm' not found"
+	else
+		TEST_RPMS=$(realpath "$_rpm")
+	fi
+done
+
+img_run_cmd "mkdir -p /kexec-kdump-test"
+img_inst $TESTDIR/scripts/kexec-kdump-test/init.sh /kexec-kdump-test/init.sh
+img_inst $TESTDIR/scripts/kexec-kdump-test/test.sh /kexec-kdump-test/test.sh
+img_inst $TESTDIR/scripts/kexec-kdump-test/kexec-kdump-test.service /etc/systemd/system/kexec-kdump-test.service
+img_run_cmd "systemctl enable kexec-kdump-test.service"
+
+img_inst_pkg $TEST_RPMS
+# Test script should start kdump manually to save time
+img_run_cmd "systemctl disable kdump.service"
diff --git a/tests/scripts/build-scripts/test-image.sh b/tests/scripts/build-scripts/test-image.sh
new file mode 100755
index 0000000..d8e907e
--- /dev/null
+++ b/tests/scripts/build-scripts/test-image.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+. $TESTDIR/scripts/test-lib.sh
+TEST_SCRIPT=$1
+
+QEMU_CMD="$DEFAULT_QEMU_CMD \
+-serial stdio \
+-serial file:$(get_test_output_file $TEST_SCRIPT) \
+-monitor none \
+-hda $OUTPUT_IMAGE"
+
+img_add_qemu_cmd() {
+	QEMU_CMD+=" $@"
+}
+
+source $TEST_SCRIPT
+
+on_build
+
+img_inst $TEST_SCRIPT /kexec-kdump-test/test.sh
+
+echo $QEMU_CMD > $(get_test_qemu_cmd_file $TEST_SCRIPT)
diff --git a/tests/scripts/copy-from-image.sh b/tests/scripts/copy-from-image.sh
new file mode 100755
index 0000000..9b71054
--- /dev/null
+++ b/tests/scripts/copy-from-image.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+BASEDIR=$(realpath $(dirname "$0"))
+. $BASEDIR/image-init-lib.sh
+
+# Base image to copy from
+BOOT_IMAGE=$1 && shift
+if [ ! -e "$BOOT_IMAGE" ]; then
+	perror_exit "Image '$BOOT_IMAGE' not found"
+else
+	BOOT_IMAGE=$(realpath "$BOOT_IMAGE")
+fi
+
+mount_image $BOOT_IMAGE
+
+IMAGE_MNT=$(get_image_mount_root $BOOT_IMAGE)
+
+SRC=
+while [ $# -gt 1 ]; do
+	SRC="$SRC $IMAGE_MNT/$1"
+	shift
+done
+DST=$1
+
+cp -rv $SRC $DST
diff --git a/tests/scripts/image-init-lib.sh b/tests/scripts/image-init-lib.sh
new file mode 100644
index 0000000..7be55d1
--- /dev/null
+++ b/tests/scripts/image-init-lib.sh
@@ -0,0 +1,252 @@
+#!/usr/bin/env bash
+[ -z "$TESTDIR" ] && TESTDIR=$(realpath $(dirname "$0")/../)
+
+SUDO="sudo"
+
+declare -A MNTS=()
+declare -A DEVS=()
+
+perror() {
+       echo $@>&2
+}
+
+perror_exit() {
+       echo $@>&2
+       exit 1
+}
+
+is_mounted()
+{
+       findmnt -k -n $1 &>/dev/null
+}
+
+clean_up()
+{
+	for _mnt in ${MNTS[@]}; do
+		is_mounted $_mnt && $SUDO umount -f $_mnt
+	done
+
+	for _dev in ${DEVS[@]}; do
+		[ ! -e "$_dev" ] && continue
+		[[ "$_dev" == "/dev/loop"* ]] && $SUDO losetup -d "$_dev"
+		[[ "$_dev" == "/dev/nbd"* ]] && $SUDO qemu-nbd --disconnect "$_dev"
+	done
+
+	[ -d "$TMPDIR" ] && $SUDO rm --one-file-system -rf -- "$TMPDIR";
+
+	sync
+}
+
+trap '
+ret=$?;
+clean_up
+exit $ret;
+' EXIT
+
+# clean up after ourselves no matter how we die.
+trap 'exit 1;' SIGINT
+
+readonly TMPDIR="$(mktemp -d -t kexec-kdump-test.XXXXXX)"
+[ -d "$TMPDIR" ] || perror_exit "mktemp failed."
+
+get_image_fmt() {
+	local image=$1 fmt
+
+	[ ! -e "$image" ] && perror "image: $image doesn't exist" && return 1
+
+	fmt=$(qemu-img info $image | sed -n "s/file format:\s*\(.*\)/\1/p")
+
+	[ $? -eq 0 ] && echo $fmt && return 0
+
+	return 1
+}
+
+# If it's partitioned, return the mountable partition, else return the dev
+get_mountable_dev() {
+	local dev=$1 parts
+
+	$SUDO partprobe $dev && sync
+	parts="$(ls -1 ${dev}p*)"
+	if [ -n "$parts" ]; then
+		if [ $(echo "$parts" | wc -l) -gt 1 ]; then
+			perror "It's a image with multiple partitions, using last partition as main partition"
+		fi
+		echo "$parts" | tail -1
+	else
+		echo "$dev"
+	fi
+}
+
+prepare_loop() {
+	[ -n "$(lsmod | grep "^loop")" ] && return
+
+	$SUDO modprobe loop
+
+	[ ! -e "/dev/loop-control" ] && perror_exit "failed to load loop driver"
+}
+
+prepare_nbd() {
+	[ -n "$(lsmod | grep "^nbd")" ] && return
+
+	$SUDO modprobe nbd max_part=4
+
+	[ ! -e "/dev/nbd0" ] && perror_exit "failed to load nbd driver"
+}
+
+mount_nbd() {
+	local image=$1 size dev
+	for _dev in /sys/class/block/nbd* ; do
+		size=$(cat $_dev/size)
+		if [ "$size" -eq 0 ] ; then
+			dev=/dev/${_dev##*/}
+			$SUDO qemu-nbd --connect=$dev $image 1>&2
+			[ $? -eq 0 ] && echo $dev && break
+		fi
+	done
+
+	return 1
+}
+
+image_lock()
+{
+	local image=$1 timeout=5 fd
+
+	eval "exec {fd}>$image.lock"
+	if [ $? -ne 0 ]; then
+		perror_exit "failed acquiring image lock"
+		exit 1
+	fi
+
+	flock -n $fd
+	rc=$?
+	while [ $rc -ne 0 ]; do
+		echo "Another instance is holding the image lock ..."
+		flock -w $timeout $fd
+		rc=$?
+	done
+}
+
+# Mount a device, will umount it automatially when shell exits
+mount_image() {
+	local image=$1 fmt
+	local dev mnt mnt_dev
+
+	# Lock the image just in case user run this script in parrel
+	image_lock $image
+
+	fmt=$(get_image_fmt $image)
+	[ $? -ne 0 ] || [ -z "$fmt" ] && perror_exit "failed to detect image format"
+
+	if [ "$fmt" == "raw" ]; then
+		prepare_loop
+
+		dev="$($SUDO losetup --show -f $image)"
+		[ $? -ne 0 ] || [ -z "$dev" ] && perror_exit "failed to setup loop device"
+
+	elif [ "$fmt" == "qcow2" ]; then
+		prepare_nbd
+
+		dev=$(mount_nbd $image)
+		[ $? -ne 0 ] || [ -z "$dev" ] perror_exit "failed to connect qemu to nbd device '$dev'"
+	else
+		perror_exit "Unrecognized image format '$fmt'"
+	fi
+	DEVS[$image]="$dev"
+
+	mnt="$(mktemp -d -p $TMPDIR -t mount.XXXXXX)"
+	[ $? -ne 0 ] || [ -z "$mnt" ] && perror_exit "failed to create tmp mount dir"
+	MNTS[$image]="$mnt"
+
+	mnt_dev=$(get_mountable_dev "$dev")
+	[ $? -ne 0 ] || [ -z "$mnt_dev" ] && perror_exit "failed to setup loop device"
+
+	$SUDO mount $mnt_dev $mnt
+	[ $? -ne 0 ] && perror_exit "failed to mount device '$mnt_dev'"
+}
+
+get_image_mount_root() {
+	local image=$1
+	local root=${MNTS[$image]}
+
+	echo $root
+
+	if [ -z "$root" ]; then
+		return 1
+	fi
+}
+
+shell_in_image() {
+	local root=$(get_image_mount_root $1) && shift
+
+	pushd $root
+
+	$SHELL
+
+	popd
+}
+
+inst_pkg_in_image() {
+	local root=$(get_image_mount_root $1) && shift
+
+	# LSB not available
+	# release_info=$($SUDO chroot $root /bin/bash -c "lsb_release -a")
+	# release=$(echo "$release_info" | sed -n "s/Release:\s*\(.*\)/\1/p")
+	# distro=$(echo "$release_info" | sed -n "s/Distributor ID:\s*\(.*\)/\1/p")
+	# if [ "$distro" != "Fedora" ]; then
+	# 	perror_exit "only Fedora image is supported"
+	# fi
+	release=$(cat $root/etc/fedora-release | sed -n "s/.*[Rr]elease\s*\([0-9]*\).*/\1/p")
+	[ $? -ne 0 ] || [ -z "$release" ] && perror_exit "only Fedora image is supported"
+
+	$SUDO dnf --releasever=$release --installroot=$root install -y $@
+}
+
+run_in_image() {
+	local root=$(get_image_mount_root $1) && shift
+
+	$SUDO chroot $root /bin/bash -c "$@"
+}
+
+inst_in_image() {
+	local image=$1 src=$2 dst=$3
+	local root=${MNTS[$image]}
+
+	$SUDO cp $src $root/$dst
+}
+
+# If source image is qcow2, create a snapshot
+# If source image is raw, convert to raw
+# If source image is xz, decompress then repeat the above logic
+#
+# Won't touch source image
+create_image_from_base_image() {
+	local image=$1
+	local output=$2
+	local decompressed_image
+
+	local ext="${image##*.}"
+	if [[ "$ext" == 'xz' ]]; then
+		echo "Decompressing base image..."
+		xz -d -k $image
+		decompressed_image=${image%.xz}
+		image=$decompressed_image
+	fi
+
+	local image_fmt=$(qemu-img info $image | sed -n "s/file format:\s*\(.*\)/\1/p")
+	if [ "$image_fmt" != "raw" ]; then
+		if [ "$image_fmt" == "qcow2" ]; then
+			echo "Source image is qcow2, using snapshot..."
+			qemu-img create -f qcow2 -b $image $output
+		else
+			perror_exit "Unrecognized base image format $image_mnt"
+		fi
+	else
+		echo "Source image is raw, converting to qcow2..."
+		qemu-img convert -f raw -O qcow2 $image $output
+	fi
+
+	# Clean up decompress temp image
+	if [ -n "$decompressed_image" ]; then
+		rm $decompressed_image
+	fi
+}
diff --git a/tests/scripts/kexec-kdump-test/init.sh b/tests/scripts/kexec-kdump-test/init.sh
new file mode 100755
index 0000000..5737810
--- /dev/null
+++ b/tests/scripts/kexec-kdump-test/init.sh
@@ -0,0 +1,114 @@
+#!/usr/bin/env sh
+BOOT_ARG="test_boot_count"
+_YELLOW='\033[1;33m'
+_GREEN='\033[0;32m'
+_RED='\033[0;31m'
+_NC='\033[0m' # No Color
+
+if [ -n "$(cat /proc/cmdline | grep "\bno_test\b")" ]; then
+	exit 0
+fi
+
+get_test_boot_count() {
+	local boot_count=$(cat /proc/cmdline | sed -n "s/.*$BOOT_ARG=\([0-9]*\).*/\1/p")
+
+	if [ -z "$boot_count" ]; then
+		boot_count=1
+	fi
+
+	echo $boot_count
+}
+
+test_output() {
+	echo $@ > /dev/ttyS1
+	echo $@ > /dev/ttyS0
+
+	sync
+}
+
+test_passed() {
+	echo -e "${_GREEN}TEST PASSED${_NC}" > /dev/ttyS1
+	echo -e "${_GREEN}kexec-kdump-test: TEST PASSED${_NC}" > /dev/ttyS0
+
+	echo $@ > /dev/ttyS1
+	echo $@ > /dev/ttyS0
+
+	sync
+
+	shutdown -h 0
+
+	exit 0
+}
+
+test_failed() {
+	echo -e "${_RED}TEST FAILED${_NC}" > /dev/ttyS1
+	echo -e "${_RED}kexec-kdump-test: TEST FAILED${_NC}" > /dev/ttyS0
+
+	echo $@ > /dev/ttyS1
+	echo $@ > /dev/ttyS0
+
+	sync
+
+	shutdown -h 0
+
+	exit 1
+}
+
+test_abort() {
+	echo -e "${_YELLOW}TEST ABORTED${_NC}" > /dev/ttyS1
+	echo -e "${_YELLOW}kexec-kdump-test: TEST ABORTED${_NC}" > /dev/ttyS0
+
+	echo $@ > /dev/ttyS1
+	echo $@ > /dev/ttyS0
+
+	sync
+
+	shutdown -h 0
+
+	exit 2
+}
+
+has_valid_vmcore_dir() {
+	local path=$1
+	local vmcore_dir=$path/$(ls -1 $path | tail -n 1)
+	local vmcore="<invalid>"
+
+	# Checking with `crash` is slow and consume a lot of memory/disk,
+	# just do a sanity check by check if log are available.
+	if [ -e $vmcore_dir/vmcore ]; then
+		vmcore=$vmcore_dir/vmcore
+		makedumpfile --dump-dmesg $vmcore $vmcore_dir/vmcore-dmesg.txt.2 || return 1
+	elif [ -e $vmcore_dir/vmcore.flat ]; then
+		vmcore=$vmcore_dir/vmcore.flat
+		makedumpfile -R $vmcore_dir/vmcore < $vmcore || return 1
+		makedumpfile --dump-dmesg $vmcore_dir/vmcore $vmcore_dir/vmcore-dmesg.txt.2 || return 1
+		rm $vmcore_dir/vmcore
+	else
+		return 1
+	fi
+
+	if diff $vmcore_dir/vmcore-dmesg.txt.2 $vmcore_dir/vmcore-dmesg.txt; then
+		return 1
+	fi
+
+	test_output "Found a valid vmcore in \"$vmcore_dir\""
+	test_output "VMCORE: $vmcore"
+	test_output "KERNEL VERSION: $(rpm -q kernel-core)"
+
+	return 0
+}
+
+BOOT_COUNT=$(get_test_boot_count)
+test_output "Kexec-Kdump-Test Boot #$BOOT_COUNT"
+
+echo 'fedora' | passwd --stdin root
+
+test_output "Updating kernel cmdline"
+grubby --update-kernel ALL --args $BOOT_ARG=$(expr $BOOT_COUNT + 1) && sync
+
+test_output "Executing test hook"
+source /kexec-kdump-test/test.sh
+
+on_test;
+
+test_output "Test exited, system hang for inspect"
diff --git a/tests/scripts/kexec-kdump-test/kexec-kdump-test.service b/tests/scripts/kexec-kdump-test/kexec-kdump-test.service
new file mode 100644
index 0000000..ba7b11e
--- /dev/null
+++ b/tests/scripts/kexec-kdump-test/kexec-kdump-test.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Kexec Kdump Test Service
+
+[Service]
+ExecStart=/kexec-kdump-test/init.sh
+Type=idle
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tests/scripts/kexec-kdump-test/test.sh b/tests/scripts/kexec-kdump-test/test.sh
new file mode 100755
index 0000000..66ac15d
--- /dev/null
+++ b/tests/scripts/kexec-kdump-test/test.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env sh
+# A test example that do nothing
+
+# Executed before VM starts
+on_build() {
+	:
+}
+
+# Executed when VM boots
+on_test() {
+	:
+	# call get_test_boot_count to get boot cound
+	# call test_passed if test passed
+	# call test_failed if test passed
+}
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh
new file mode 100755
index 0000000..ef628aa
--- /dev/null
+++ b/tests/scripts/run-test.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+
+_kill_all_jobs() {
+	local _jobs=$(jobs -r -p)
+
+	[ -n "$_jobs" ] && kill $_jobs
+}
+
+trap '
+ret=$?;
+_kill_all_jobs
+exit $ret;
+' EXIT
+
+trap 'exit 1;' SIGINT
+
+BASEDIR=$(realpath $(dirname "$0"))
+. $BASEDIR/test-lib.sh
+TESTCASEDIR="$BASEDIR/testcases"
+
+console=0
+testcases=""
+
+while [ $# -gt 0 ]; do
+	case $1 in
+		'')
+			break
+			;;
+		--console )
+			console=1
+			;;
+		-*)
+			echo "Invalid option $1"
+			;;
+		*)
+			testcases+=" $1"
+			;;
+	esac
+	shift;
+done
+
+if [ -z "$testcases" ]; then
+	echo "==== Starting all tests: ===="
+	testcases=$(ls -1 $TESTCASEDIR)
+else
+	echo "==== Starting specified tests: ===="
+fi
+echo ${testcases##*/}
+echo
+
+declare -A results
+ret=0
+
+for test_case in $testcases; do
+	echo "======== Running Test Case $test_case ========"
+	results[$test_case]="<Test Skipped>"
+
+	testdir=$TESTCASEDIR/$test_case
+	script_num=$(ls -1 $testdir | wc -l)
+	scripts=$(ls -r -1 $testdir | tr '\n' ' ')
+	test_outputs=""
+	read main_script aux_script <<< "$scripts"
+
+	if [ -z "$main_script" ]; then
+		echo "ERROR: Empty testcase dir $testdir"
+		continue
+	fi
+
+	for script in $scripts; do
+		echo "---- Building image for: $script ----"
+		echo "-------- Output image is: $(get_test_image $testdir/$script)"
+		echo "-------- Building log is: $(get_test_image $testdir/$script).log"
+
+		mkdir -p $(dirname $(get_test_image $testdir/$script))
+		build_test_image $testdir/$script &> $(get_test_image $testdir/$script).log
+
+		if [ $? -ne 0 ]; then
+			echo "Failing building image!"
+			continue 2
+		fi
+	done
+
+	for script in $aux_script; do
+		echo "---- Starting VM: $script ----"
+
+		script="$testdir/$script"
+		echo "-------- Qemu cmdline: $(get_test_qemu_cmd_file $script)"
+		echo "-------- Console log: $(get_test_console_file $script)"
+		echo "-------- Test log: $(get_test_output_file $script)"
+		test_outputs+="$(get_test_output_file $script) "
+
+		rm -f $(get_test_console_file $script)
+		rm -f $(get_test_output_file $script)
+
+		$(run_test_sync $script > $(get_test_console_file $script)) &
+
+		sleep 3
+	done
+
+	script="$main_script"
+	echo "---- Starting test VM: $(basename $script) ----"
+	script="$testdir/$script"
+
+	echo "-------- Qemu cmdline: $(get_test_qemu_cmd_file $script)"
+	echo "-------- Console log: $(get_test_console_file $script)"
+	echo "-------- Test log: $(get_test_output_file $script)"
+	test_outputs+="$(get_test_output_file $script) "
+
+	rm -f $(get_test_console_file $script)
+	rm -f $(get_test_output_file $script)
+
+	if [ $console -eq 1 ]; then
+		run_test_sync $script | tee $(get_test_console_file $script)
+		[ -n "$(jobs -p)" ] && kill $(jobs -p)
+	else
+		$(run_test_sync $script > $(get_test_console_file $script)) &
+		watch_test_outputs $test_outputs
+	fi
+
+	res="$(gather_test_result $test_outputs)"
+
+	[ $? -ne 0 ] && ret=$(expr $ret + 1)
+	results[$test_case]="$res"
+
+	echo -e "-------- Test finished: $test_case $res --------"
+	for script in $scripts; do
+		script="$testdir/$script"
+		output="$(get_test_output_file $script) "
+		image="$(get_test_image $script)"
+		vmcore="$(sed -n 's/^VMCORE: \(\S*\).*/\1/p' $output)"
+		kernel="$(sed -n 's/^KERNEL VERSION: \(\S*\).*/\1/p' $output)"
+		if [ -n "$vmcore" ]; then
+			echo "You can retrive the verify the vmcore file using following command:"
+			echo "./scripts/copy-from-image.sh \\"
+			echo "    $image \\"
+			echo "    $vmcore ./"
+			echo "Kernel package verion is: $kernel"
+		fi
+	done
+done
+
+echo "======== Test results ========"
+for i in ${!results[@]}; do
+	echo "----------------"
+	echo -e "$i:\t\t${results[$i]}"
+done
+
+exit $ret
diff --git a/tests/scripts/spawn-image-shell.sh b/tests/scripts/spawn-image-shell.sh
new file mode 100755
index 0000000..ccfb655
--- /dev/null
+++ b/tests/scripts/spawn-image-shell.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+BASEDIR=$(realpath $(dirname "$0"))
+. $BASEDIR/image-init-lib.sh
+
+# Base image to build from
+BOOT_IMAGE=$1
+if [[ ! -e $BOOT_IMAGE ]]; then
+	perror_exit "Image '$BOOT_IMAGE' not found"
+else
+	BOOT_IMAGE=$(realpath "$BOOT_IMAGE")
+fi
+
+mount_image $BOOT_IMAGE
+
+shell_in_image $BOOT_IMAGE
diff --git a/tests/scripts/test-lib.sh b/tests/scripts/test-lib.sh
new file mode 100644
index 0000000..aff5cd3
--- /dev/null
+++ b/tests/scripts/test-lib.sh
@@ -0,0 +1,177 @@
+#!/usr/bin/env sh
+[ -z "$BASEDIR" ] && BASEDIR=$(realpath $(dirname "$0"))
+[ -z "$TESTDIR" ] && TESTDIR=$(realpath $BASEDIR/../)
+[ -z "$TEST_BASE_IMAGE" ] && TEST_BASE_IMAGE=$TESTDIR/output/test-base-image
+
+[[ ! -e $TEST_BASE_IMAGE ]] && echo "Test base image not found." && exit 1
+
+DEFAULT_QEMU_CMD="-nodefaults \
+-nographic \
+-smp 2 \
+-m 768M \
+-monitor none"
+
+_YELLOW='\033[1;33m'
+_GREEN='\033[0;32m'
+_RED='\033[0;31m'
+_NC='\033[0m' # No Color
+
+get_test_path() {
+	local script=$1
+	local testname=$(basename $(dirname $script))
+	local output=$TESTDIR/output/$testname
+
+	echo $output
+}
+
+get_test_entry_name() {
+	echo $(basename ${1%.*})
+}
+
+get_test_image() {
+	local script=$1
+	local testout=$(get_test_path $script)
+	local entry=$(get_test_entry_name $script)
+
+	echo $testout/$entry.img
+}
+
+get_test_qemu_cmd_file() {
+	local script=$1
+	local testout=$(get_test_path $script)
+	local entry=$(get_test_entry_name $script)
+
+	echo $testout/$entry.qemu_cmd
+}
+
+get_test_qemu_cmd() {
+	cat $(get_test_qemu_cmd_file $1)
+}
+
+get_test_output_file() {
+	local script=$1
+	local testout=$(get_test_path $script)
+	local entry=$(get_test_entry_name $script)
+
+	echo $testout/$entry.output
+}
+
+get_test_console_file() {
+	local script=$1
+	local testout=$(get_test_path $script)
+	local entry=$(get_test_entry_name $script)
+
+	echo $testout/$entry.console
+}
+
+get_test_output() {
+	local output=$(get_test_output_file $1)
+	if [ -e "$output" ]; then
+		cat $(get_test_output_file $1)
+	else
+		echo "<No Output>"
+	fi
+}
+
+build_test_image() {
+	local script=$1
+	local test_image=$(get_test_image $script)
+	mkdir -p $(dirname $test_image)
+
+	$BASEDIR/build-image.sh \
+		$TEST_BASE_IMAGE \
+		$test_image \
+		$BASEDIR/build-scripts/test-image.sh \
+		$script
+}
+
+run_test_sync() {
+	local qemu_cmd=$(get_test_qemu_cmd $1)
+
+	if [ -n "$qemu_cmd" ]; then
+		timeout --foreground 10m qemu-kvm $(get_test_qemu_cmd $1)
+	else
+		echo "error: test qemu command line is not configured" > /dev/stderr
+		return 1
+	fi
+}
+
+_check_test_result() {
+	grep "TEST PASSED" $1 2>/dev/null
+	[ $? -eq 0 ] && return 0
+
+	grep "TEST FAILED" $1 2>/dev/null
+	[ $? -eq 0 ] && return 1
+
+	grep "TEST ABORTED" $1 2>/dev/null
+	[ $? -eq 0 ] && return 2
+
+	return 255
+}
+
+# Print test result and return below value:
+# 0: Test passed
+# 1: Test failed
+# 2: Test aborted, test scripts errored out
+# 3: Test exited unexpectely, VM got killed early, or time out
+gather_test_result() {
+	local ret=255
+	local res=""
+
+	for i in $@; do
+		res=$(_check_test_result $i)
+		ret=$?
+
+		if [ $ret -ne 255 ]; then
+			echo $res
+			return $ret
+		fi
+	done
+
+	echo "${_RED}TEST RESULT NOT FOUND!${_NC}"
+	return 3
+}
+
+# Wait and watch for test result
+watch_test_outputs() {
+	local ret=255
+	local res=""
+	# If VMs are still running, check for test result, if
+	# test finished, kill remaining VMs
+	while true; do
+		if [ -n "$(jobs -r)" ]; then
+			# VMs still running
+			for i in $@; do
+				res=$(_check_test_result $i)
+				ret=$?
+
+				if [ $ret -ne 255 ]; then
+					# Test finished, kill VMs
+					kill $(jobs -p)
+					break 2
+				fi
+			done
+		else
+			# VMs exited
+			ret=255
+
+			for i in $@; do
+				res=$(_check_test_result $i)
+				ret=$?
+
+				if [ $ret -ne 255 ]; then
+					break 2
+				fi
+			done
+
+			if [ $ret -eq 255 ]; then
+				ret=3
+				break
+			fi
+		fi
+
+		sleep 1
+	done
+
+	return $ret
+}
diff --git a/tests/scripts/testcases/local-kdump/0-local.sh b/tests/scripts/testcases/local-kdump/0-local.sh
new file mode 100755
index 0000000..d09c6f0
--- /dev/null
+++ b/tests/scripts/testcases/local-kdump/0-local.sh
@@ -0,0 +1,32 @@
+on_build() {
+	:
+}
+
+on_test() {
+	local boot_count=$(get_test_boot_count)
+
+	if [ $boot_count -eq 1 ]; then
+		cat << EOF > /etc/kdump.conf
+path /var/crash
+core_collector makedumpfile -l --message-level 1 -d 31
+EOF
+		kdumpctl start || test_failed "Failed to start kdump"
+
+		sync
+
+		echo 1 > /proc/sys/kernel/sysrq
+		echo c > /proc/sysrq-trigger
+
+	elif [ $boot_count -eq 2 ]; then
+
+		if has_valid_vmcore_dir /var/crash; then
+			test_passed
+		else
+			test_failed
+		fi
+
+		shutdown -h 0
+	else
+		test_failed "Unexpected reboot"
+	fi
+}
diff --git a/tests/scripts/testcases/nfs-kdump/0-server.sh b/tests/scripts/testcases/nfs-kdump/0-server.sh
new file mode 100755
index 0000000..04f102e
--- /dev/null
+++ b/tests/scripts/testcases/nfs-kdump/0-server.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env sh
+
+# Executed before VM starts
+on_build() {
+	img_inst_pkg "nfs-utils dnsmasq"
+
+	img_run_cmd "mkdir -p /srv/nfs/var/crash"
+	img_run_cmd "echo /srv/nfs 192.168.77.1/24\(rw,async,insecure,no_root_squash\) > /etc/exports"
+	img_run_cmd "systemctl enable nfs-server"
+
+	img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf"
+	img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf"
+	img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
+	img_run_cmd "systemctl enable dnsmasq"
+
+	img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"'
+	img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+
+	img_add_qemu_cmd "-nic socket,listen=:8010,mac=52:54:00:12:34:56"
+}
+
+# Executed when VM boots
+on_test() {
+	while true; do
+		if has_valid_vmcore_dir /srv/nfs/var/crash; then
+			# Wait a few seconds so client finish it's work to generate a full log
+			sleep 5
+
+			test_passed
+		fi
+
+		sleep 1
+	done
+}
diff --git a/tests/scripts/testcases/nfs-kdump/1-client.sh b/tests/scripts/testcases/nfs-kdump/1-client.sh
new file mode 100755
index 0000000..df62463
--- /dev/null
+++ b/tests/scripts/testcases/nfs-kdump/1-client.sh
@@ -0,0 +1,30 @@
+# Executed before VM starts
+on_build() {
+	img_inst_pkg "nfs-utils"
+	img_add_qemu_cmd "-nic socket,connect=127.0.0.1:8010,mac=52:54:00:12:34:57"
+}
+
+on_test() {
+	local boot_count=$(get_test_boot_count)
+	local nfs_server=192.168.77.1
+
+	if [ "$boot_count" -eq 1 ]; then
+		cat << EOF > /etc/kdump.conf
+nfs $nfs_server:/srv/nfs
+core_collector makedumpfile -l --message-level 1 -d 31
+EOF
+
+		while ! ping -c 1 $nfs_server -W 1; do
+			:
+		done
+
+		kdumpctl start || test_failed "Failed to start kdump"
+
+		sync
+
+		echo 1 > /proc/sys/kernel/sysrq
+		echo c > /proc/sysrq-trigger
+	else
+		shutdown -h 0
+	fi
+}
diff --git a/tests/scripts/testcases/ssh-kdump/0-server.sh b/tests/scripts/testcases/ssh-kdump/0-server.sh
new file mode 100755
index 0000000..f1e5073
--- /dev/null
+++ b/tests/scripts/testcases/ssh-kdump/0-server.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env sh
+
+# Executed before VM starts
+on_build() {
+	img_add_qemu_cmd "-nic socket,listen=:8010,mac=52:54:00:12:34:56"
+
+	img_run_cmd "echo root:fedora | chpasswd"
+	img_run_cmd 'sed -i "s/^.*PasswordAuthentication .*\$/PasswordAuthentication yes/"  /etc/ssh/sshd_config'
+	img_run_cmd 'sed -i "s/^.*PermitRootLogin .*\$/PermitRootLogin yes/"  /etc/ssh/sshd_config'
+	img_run_cmd "systemctl enable sshd"
+
+	img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf"
+	img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf"
+	img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
+	img_run_cmd "systemctl enable dnsmasq"
+
+	img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"'
+	img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+	img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+}
+
+# Executed when VM boots
+on_test() {
+	while true; do
+		if has_valid_vmcore_dir /var/crash; then
+			test_passed
+		fi
+
+		sleep 1
+	done
+}
diff --git a/tests/scripts/testcases/ssh-kdump/1-client.sh b/tests/scripts/testcases/ssh-kdump/1-client.sh
new file mode 100755
index 0000000..d79f00f
--- /dev/null
+++ b/tests/scripts/testcases/ssh-kdump/1-client.sh
@@ -0,0 +1,40 @@
+# Executed before VM starts
+on_build() {
+	img_inst_pkg "sshpass"
+	img_add_qemu_cmd "-nic socket,connect=127.0.0.1:8010,mac=52:54:00:12:34:57"
+}
+
+on_test() {
+	local boot_count=$(get_test_boot_count)
+	local ssh_server=192.168.77.1
+
+	if [ "$boot_count" -eq 1 ]; then
+cat << EOF > /etc/kdump.conf
+ssh root@192.168.77.1
+core_collector makedumpfile -l --message-level 1 -d 31 -F
+EOF
+
+		ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa <<< y &>/dev/ttyS1
+
+		while ! ping -c 1 $ssh_server -W 1; do
+			sleep 1
+		done
+
+		while [ -z "$(cat /root/.ssh/known_hosts)" ]; do
+			ssh-keyscan -H 192.168.77.1 > /root/.ssh/known_hosts
+		done
+
+		sshpass -p fedora ssh-copy-id root@$ssh_server -f &>/dev/ttyS1
+
+		sshpass -p fedora kdumpctl propagate &>/dev/ttyS1
+
+		kdumpctl start || test_failed "Failed to start kdump"
+
+		sync
+
+		echo 1 > /proc/sys/kernel/sysrq
+		echo c > /proc/sysrq-trigger
+	else
+		shutdown -h 0
+	fi
+}
diff --git a/zanata-notes.txt b/zanata-notes.txt
new file mode 100644
index 0000000..2358c7a
--- /dev/null
+++ b/zanata-notes.txt
@@ -0,0 +1,79 @@
+Zanata is a web-based system for managing localisation projects.
+For kexec-tools firstboot module, I created a zanata project with name of
+"kexec-tools": https://translate.zanata.org/zanata/project/view/kexec-tools
+
+There's several clients available for zanata translation management, such as
+python client and Maven client. It's suggested to use maven client for latest
+zanata issues
+
+Firstly you need install mvn rpms, just do below for fedora 16 and beyond:
+yum install maven
+
+create zanata.ini in your home dir:
+>~/.config/zanata.ini
+There should be something need to change like below:
+translate_zanata_org.url=https://translate.zanata.org/zanata/
+translate_zanata_org.username=
+translate_zanata_org.key=
+
+Change username to your zanata username
+Change the key to the "API key" of zanata which can be generate from
+zanata web page.
+ Open user profile page of zanata.org, click "Generate API Key" to create it.
+
+zanata is a plugin of maven, to activate it, you need do below configurations:
+1. cd kexec-tools/po, (assume kexec-tools is the git repo)
+2. add a pom.xml like below: (note: version 2.0.0 is better than 1.7.5
+for performance improvement)
+<project>
+...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.zanata</groupId>
+        <artifactId>zanata-maven-plugin</artifactId>
+        <version>1.7.5</version>
+      </plugin>
+    </plugins>
+  </build>
+...
+</project>
+3. add zanata.xml for your project with content like below:
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<config xmlns="http://zanata.org/namespace/config/">
+  <url>https://translate.zanata.org/zanata/</url>
+  <project>kexec-tools</project>
+  <project-version>F18</project-version>
+  <project-type>gettext</project-type>
+
+  <locales>
+    <locale>ar</locale>
+...
+</config>
+
+You can get mostly-complete zanata.xml from the project version page on zanata
+Things need to be modified is:
+a) project-type, please use gettext
+b) for locales which are diffrent between local name and zanata server name,
+   for example for kexec-tools we have bn_IN but zanata server accept bn-IN,
+   so we need to add below line:
+   <locale map-from="bn_IN">bn-IN</locale>
+
+The first running of "mvn zanata:help" will download and activate the new
+version of zanata plugin for you.
+
+I use below command to upload both pot file and translated po files:
+mvn zanata:push -Dzanata.pushType=both
+If you only need to upload po files, you can use:
+mvn zanata:push -Dzanata.pushType=trans
+
+You can use mvn zanata:help to lookup the detail help content of param names
+
+The other thing to be careful is specifying the correct source and
+translation directories. 
+They are relative path. You can also put the pom.xml and zanata.xml under toplevel directory and run:
+mvn zanata:push -Dzanata.pushType=both -Dzanata.srcDir=po -Dzanata.transDir=po
+
+--
+[1] https://github.com/zanata/zanata/wiki/Zanata-Maven-Integration
+[2] https://github.com/zanata/zanata/wiki/client-configuration