forked from pool/kexec-tools
This commit is contained in:
parent
7c048af0a7
commit
6c93df0407
66
kdump
66
kdump
@ -27,6 +27,7 @@
|
|||||||
. /etc/rc.status
|
. /etc/rc.status
|
||||||
|
|
||||||
KEXEC=/sbin/kexec
|
KEXEC=/sbin/kexec
|
||||||
|
KDUMP_HELPER=/usr/sbin/kdump-helper
|
||||||
|
|
||||||
BOOTDIR="/boot"
|
BOOTDIR="/boot"
|
||||||
|
|
||||||
@ -184,6 +185,11 @@ load_kdump()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# add the dump device
|
||||||
|
if [ -n "$KDUMP_DUMPDEV" ] ; then
|
||||||
|
KDUMP_COMMANDLINE="dumpdev=$KDUMP_DUMPDEV $KDUMP_COMMANDLINE"
|
||||||
|
fi
|
||||||
|
|
||||||
echo 1 > /proc/sys/kernel/panic_on_oops
|
echo 1 > /proc/sys/kernel/panic_on_oops
|
||||||
|
|
||||||
$KEXEC -p $kdump_kernel \
|
$KEXEC -p $kdump_kernel \
|
||||||
@ -208,20 +214,70 @@ is_crash_kernel ()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# return success if we have a valid dump on the dump device
|
||||||
|
have_valid_dump_in_dumpdev ()
|
||||||
|
{
|
||||||
|
if [ ! -b "$KDUMP_DUMPDEV" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# return the return code from this command
|
||||||
|
$KDUMP_HELPER -c "$KDUMP_DUMPDEV" >> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# invalidate the dump device so that it's not read on next boot
|
||||||
|
invalidate_dumpdev ()
|
||||||
|
{
|
||||||
|
dd if=/dev/zero of=$KDUMP_DUMPDEV bs=512 count=1
|
||||||
|
}
|
||||||
|
|
||||||
|
# copy the dump from the dumpdevice to the harddisk
|
||||||
|
copy_dump_from_dumpdev ()
|
||||||
|
{
|
||||||
|
if [ $KDUMP_KEEP_OLD_DUMPS -gt 0 ]; then
|
||||||
|
purge_old_dumps
|
||||||
|
fi
|
||||||
|
|
||||||
|
dumpsize=`$KDUMP_HELPER -l "$KDUMP_DUMPDEV" | sed -e 's/Length: //g'`
|
||||||
|
dumpsize_mb=$(($dumpsize / 1024 / 1024))
|
||||||
|
|
||||||
|
if [ $KDUMP_FREE_DISK_SIZE -gt 0 ]; then
|
||||||
|
restsize=`parse_rest_size "$KDUMP_SAVEDIR"`
|
||||||
|
needsize=`expr $dumpsize_mb + $KDUMP_FREE_DISK_SIZE`
|
||||||
|
if [ $restsize -lt $needsize ]; then
|
||||||
|
echo -n " No enough space left on dump device ($restsize MB)"
|
||||||
|
rc_status -s
|
||||||
|
rc_failed 6
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
coredir="${KDUMP_SAVEDIR}/`date +"%Y-%m-%d-%H:%M"`"
|
||||||
|
mkdir -p $coredir
|
||||||
|
echo -n "Saving crash dump to $coredir"
|
||||||
|
dd if=$KDUMP_DUMPDEV of=$coredir/vmcore count=$dumpsize
|
||||||
|
invalidate_dumpdev
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if is_crash_kernel; then
|
if is_crash_kernel; then
|
||||||
if [ -n "$KDUMP_TRANSFER" ]; then
|
if [ -z "$KDUMP_DUMPDEV" ] ; then
|
||||||
$KDUMP_TRANSFER
|
if [ -n "$KDUMP_TRANSFER" ]; then
|
||||||
else
|
$KDUMP_TRANSFER
|
||||||
save_core
|
else
|
||||||
fi
|
save_core
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if test "$KDUMP_IMMEDIATE_REBOOT" = "yes"; then
|
if test "$KDUMP_IMMEDIATE_REBOOT" = "yes"; then
|
||||||
/sbin/reboot
|
/sbin/reboot
|
||||||
# sleep to avoid the conflict with script "single"
|
# sleep to avoid the conflict with script "single"
|
||||||
sleep 600
|
sleep 600
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if have_valid_dump_in_dumpdev ; then
|
||||||
|
copy_dump_from_dumpdev
|
||||||
|
fi
|
||||||
load_kdump
|
load_kdump
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
3
kdump-helper-0.1.0.tar.bz2
Normal file
3
kdump-helper-0.1.0.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ca07cbc8d32fd9c6c90fe504d5db836dc61ff736fcd4fb76b52f38267144324f
|
||||||
|
size 7769
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 17 14:32:02 CET 2007 - bwalle@suse.de
|
||||||
|
|
||||||
|
- implemented Initrd based kdump saving
|
||||||
|
(#301538)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Dec 20 10:59:26 CET 2006 - tiwai@suse.de
|
Wed Dec 20 10:59:26 CET 2006 - tiwai@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package kexec-tools (Version 1.101)
|
# spec file for package kexec-tools (Version 1.101)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
# This file and all modifications and additions to the pristine
|
||||||
# package are under the same license as the package itself.
|
# package are under the same license as the package itself.
|
||||||
#
|
#
|
||||||
@ -11,6 +11,7 @@
|
|||||||
# norootforbuild
|
# norootforbuild
|
||||||
|
|
||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
|
%define helperversion 0.1.0
|
||||||
%define package_version testing-20061219
|
%define package_version testing-20061219
|
||||||
License: GNU General Public License (GPL)
|
License: GNU General Public License (GPL)
|
||||||
Group: System/Kernel
|
Group: System/Kernel
|
||||||
@ -18,15 +19,17 @@ Requires: %insserv_prereq %fillup_prereq
|
|||||||
Autoreqprov: on
|
Autoreqprov: on
|
||||||
Summary: Tools for fast kernel loading
|
Summary: Tools for fast kernel loading
|
||||||
Version: 1.101
|
Version: 1.101
|
||||||
Release: 59
|
Release: 63
|
||||||
Source: %{name}-%{package_version}.tar.bz2
|
Source: %{name}-%{package_version}.tar.bz2
|
||||||
Source1: kdump
|
Source1: kdump
|
||||||
Source2: sysconfig.kdump
|
Source2: sysconfig.kdump
|
||||||
Source3: gdbinit.kdump
|
Source3: gdbinit.kdump
|
||||||
Source4: gdb-kdump
|
Source4: gdb-kdump
|
||||||
Source5: README.SUSE
|
Source5: README.SUSE
|
||||||
|
Source6: kdump-helper-%{helperversion}.tar.bz2
|
||||||
URL: http://www.xmission.com/~ebiederm/files/kexec/
|
URL: http://www.xmission.com/~ebiederm/files/kexec/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
BuildRequires: libelf
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Kexec is a user space utiltity for loading another kernel and asking
|
Kexec is a user space utiltity for loading another kernel and asking
|
||||||
@ -46,6 +49,7 @@ Authors:
|
|||||||
Tim Deegan <tjd21@cl.cam.ac.uk>
|
Tim Deegan <tjd21@cl.cam.ac.uk>
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
%setup -b 6 -q -n kdump-helper-%{helperversion}
|
||||||
%setup -q -n kexec-tools
|
%setup -q -n kexec-tools
|
||||||
%{?suse_update_config -f}
|
%{?suse_update_config -f}
|
||||||
cp %{SOURCE5} .
|
cp %{SOURCE5} .
|
||||||
@ -54,6 +58,9 @@ cp %{SOURCE5} .
|
|||||||
autoreconf -fi
|
autoreconf -fi
|
||||||
./configure --prefix=/ --sbindir=/sbin --libdir=/%_lib
|
./configure --prefix=/ --sbindir=/sbin --libdir=/%_lib
|
||||||
make CPPFLAGS="$RPM_OPT_FLAGS"
|
make CPPFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
cd ../kdump-helper-%{helperversion}
|
||||||
|
make CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
cd -
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
make DESTDIR=$RPM_BUILD_ROOT install
|
||||||
@ -78,6 +85,9 @@ mkdir -p $RPM_BUILD_ROOT%{_datadir}
|
|||||||
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
||||||
install -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}
|
install -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}
|
||||||
install -c -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}
|
install -c -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}
|
||||||
|
cd ../kdump-helper-%{helperversion}
|
||||||
|
make DESTDIR=$RPM_BUILD_ROOT install
|
||||||
|
cd -
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%{fillup_and_insserv -n kdump kdump}
|
%{fillup_and_insserv -n kdump kdump}
|
||||||
@ -105,8 +115,12 @@ install -c -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}
|
|||||||
%endif
|
%endif
|
||||||
/etc/init.d/kdump
|
/etc/init.d/kdump
|
||||||
/var/adm/fillup-templates/sysconfig.kdump
|
/var/adm/fillup-templates/sysconfig.kdump
|
||||||
|
%{_sbindir}/kdump-helper
|
||||||
|
|
||||||
%changelog -n kexec-tools
|
%changelog -n kexec-tools
|
||||||
|
* Wed Jan 17 2007 - bwalle@suse.de
|
||||||
|
- implemented Initrd based kdump saving
|
||||||
|
(#301538)
|
||||||
* Wed Dec 20 2006 - tiwai@suse.de
|
* Wed Dec 20 2006 - tiwai@suse.de
|
||||||
- take kexec-tools-testing snapshot-20061219.
|
- take kexec-tools-testing snapshot-20061219.
|
||||||
o ia64 support
|
o ia64 support
|
||||||
|
@ -97,3 +97,21 @@ KDUMP_KEEP_OLD_DUMPS=5
|
|||||||
# The default value is 64MB.
|
# The default value is 64MB.
|
||||||
#
|
#
|
||||||
KDUMP_FREE_DISK_SIZE=64
|
KDUMP_FREE_DISK_SIZE=64
|
||||||
|
|
||||||
|
## Type: string
|
||||||
|
## Default: ""
|
||||||
|
#
|
||||||
|
# Specifies the dump device that is used for saving the dump in the kdump
|
||||||
|
# kernel. You don't need to specify a dump device here. Then the dump is
|
||||||
|
# written to KDUMP_SAVEDIR when booting from the kdump kernel.
|
||||||
|
#
|
||||||
|
# If KDUMP_DUMPDEV points to a device file, the dump is written to that device
|
||||||
|
# when booting from the kdump kernel. The advantage over is that you don't have to
|
||||||
|
# mount the root file system (which may be corrupted!) just to write the
|
||||||
|
# dump. On the first normal boot which is able to succesfully mount the
|
||||||
|
# root file system, the dump is saved to KDUMP_SAVEDIR as usual.
|
||||||
|
#
|
||||||
|
# Important: The KDUMP_DUMPDEV is overwritten by kdump, so don't use it for
|
||||||
|
# saving any data. Also don't use the currently used swap partition.
|
||||||
|
#
|
||||||
|
KDUMP_DUMPDEV=""
|
||||||
|
Loading…
Reference in New Issue
Block a user