The following patch provides feature to generate special initrd for regular kernel which can load the dump capture kernel while booting.
--- mkinitrd.orig 2005-08-24 18:55:49.000000000 +0530 +++ mkinitrd 2005-08-24 18:55:44.000000000 +0530 @@ -101,6 +101,8 @@ Options: -r root Override ROOT setting in mkinitrd.conf. -c dump_device Copy dump to this device -f dump_dev_fs Filesystem on the dump device + -i initrd Capture kernel's initrd + -v kernel_image Capture kernel (vmlinux only for now) See mkinitrd(8) for further details. EOF @@ -1213,6 +1215,9 @@ gendir() { /sbin/pivot_root /bin/cat /bin/mknod \ /usr/sbin/chroot /bin/uname \ $([ $kdump_capture -eq 1 ] && find /bin /sbin -name dd && find /bin /sbin -name reboot) \ + $([ $auto_kdump -eq 1 ] && for i in `find / -noleaf -type f -name kexec`; do + echo $i; break; + done ) \ `command -v stat` $readlink \ `cat "$@" exe` do @@ -1289,6 +1294,12 @@ gendir() { > etc/mtab + if [ $auto_kdump -eq 1 ]; then + cp $capture_initrd capture_initrd + cp $capture_kernel capture_kernel + fi + + if [ $kdump_capture -eq 1 -a ! -b "${dump_dev#/}" ]; then dump_maj=$(ls -l $dump_dev | cut -d " " -f 6 | cut -d "," -f 1) dump_min=$(ls -l $dump_dev | cut -d " " -f 7) @@ -1323,6 +1334,13 @@ umount /dump echo Rebooting the system reboot -f" >> script fi + + if [ "$auto_kdump" -eq 1 ]; then + echo "mount -t sysfs sys /sys +echo Kexec loading the capture kernel +`find . -name kexec` -p capture_kernel --args-linux --crash-dump --initrd="capture_initrd" --append='root=$device init 1' +echo Kexec loading done ">> script + fi } ORIGDIR=`pwd` @@ -1331,11 +1349,12 @@ PROG="$0" dump_dev="" dump_fs="" kdump_capture=0 +auto_kdump=0 CONFDIR=/etc/mkinitrd unset keep croot cmkimage out || : -while getopts "d:km:o:r:c:f:" flag; do +while getopts "d:km:o:r:c:f:i:v:" flag; do case $flag in d) CONFDIR="$OPTARG" @@ -1364,6 +1383,12 @@ while getopts "d:km:o:r:c:f:" flag; do f) dump_fs=$OPTARG ;; + i) + capture_initrd=$OPTARG + ;; + v) + capture_kernel=$OPTARG + ;; *) usage ;; @@ -1389,6 +1414,36 @@ else kdump_capture=1 fi +if [ $kdump_capture -eq 0 ]; then + if [ -z "$capture_initrd" -a -z "$capture_kernel" ]; then + auto_kdump=0 + elif [ ! -z "$capture_initrd" -a -z "$capture_kernel" ]; then + echo 'Please specify the capture kernel' + usage + exit 1 + elif [ -z "$capture_initrd" -a ! -z "$capture_kernel" ]; then + echo " Please specify the capture kernel's initrd " + usage + exit 1 + else + if [ ! -e "$capture_initrd" ]; then + echo Capture kernel initrd "$capture_initrd" does not exist...Aborting + exit 1 + fi + if [ ! -e "$capture_kernel" ]; then + echo Capture kernel image "$capture_kernel" does not exist...Aborting + exit 1 + else + if [ $(file $capture_kernel | cut -d " " -f 2) != "ELF" ]; then + echo Capture kernel image "$capture_kernel" is not an ELF \ + executable...Aborting + exit 1 + fi + fi + auto_kdump=1 + fi +fi + VERSION=$1 [ $# -gt 0 ] || unset VERSION case $VERSION in -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]