OBS User unknown 2006-12-20 11:32:29 +00:00 committed by Git OBS Bridge
commit 7c048af0a7
11 changed files with 1323 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

290
README.SUSE Normal file
View File

@ -0,0 +1,290 @@
Kdump README for SLES 10
Prerequisites
=============
Be sure that you have installed the kexec-tools rpm. For x86, x86-64
and ppc64, install kernel-kdump.rpm, too. The version of the
kernel-kdump rpm must match the version of the running system kernel.
Overview
========
Kdump uses kexec to quickly boot to a recovery kernel whenever a dump of
the system kernel's memory needs to be taken (for example, when the
system panics). The system memory image is preserved across the reboot
and is accessible to the debug kernel. You can use common Linux
commands, such as cp and scp, to copy the memory image to a dump file on
the local host, or across the network to a remote system.
Kdump and kexec are currently supported on the x86, x86_64, and PPC64
architectures.
The system kernel reserves a small section of memory for the capture
kernel at boot time of the system kernel. This ensures that ongoing
Direct Memory Access (DMA) from the system kernel does not corrupt the
capture kernel. The "kexec -p" command loads the capture kernel into
this reserved memory area.
On x86 machines, the first 640 KB of physical memory is needed to boot,
irrespective of where the kernel loads. Therefore, kexec preserves this
region immediately before rebooting into the recovery kernel.
All of the necessary information about the system kernel's core image is
encoded in the ELF format, and stored in a reserved area of memory
before a crash. The physical address of the start of the ELF header is
passed to the recovery kernel through the "elfcorehdr=" boot parameter.
In the capture kernel, you can access the memory image from the system
kernel in two ways:
1) Through a /dev/oldmem device interface. A capture utility can read the
device file and write out the memory in raw format. This is a raw dump
of memory. Analysis and capture tools must be intelligent enough to
determine where to look for the right information.
2) Through /proc/vmcore. This exports the memory dump as an ELF format
file that can be written out using any file copy command such as cp or
scp. Further, you can use analysis tools such as the GNU Debugger (GDB)
or Crash to debug the dump file. This method ensures that the dump pages
are ordered correctly.
Setup of Kdump on SLES 10
=========================
Be sure the prerequisite RPMs are installed.
To enable a crash dump, you need to add an option to the boot loader to
specify the size and offset of the recovery kernel memory area.
An example of this boot loader option is "crashkernel=64M@16M". The 64M
shows the reserved space for the Kdump recovery kernel, and the 16M is
the address of the reserved area. On ia64, the start offset is
calculated by the kernel, so @xxx offset is ignored.
You can add this option either with the YaST boot loader module, or by
manually editing the boot loader configuration file.
The recommended values by architecture for the "crashkernel" option are:
i386: crashkernel=64M@16M
x86_64: crashkernel=64M@16M
ia64: crashkernel=128M
PPC64: crashkernel=128M@32M
After setting the boot loader option, activate the Kdump init script,
which is not activated by default. To do this, use the YaST System
Services (Runlevel) module. Alternately, enable the service on the
command line with the following command: "/sbin/chkconfig kdump on".
***Warning*** You must activate kdump service permanently via
YaST or chkconfig like above. Starting kdump service temporarily
(e.g. "rckdump start") doesn't suffice. It's because the system
is once rebooted over kexec to another state, and the temporary
activation is abandoned at the kdump boot stage.
After enabling the Kdump init script, reboot the system so that the
Kdump kernel image is loaded properly.
Test your Kdump setup by issuing the following commands as the root
user:
***Warning*** This procedure will crash your system. Shut down all
applications and ensure that no users are logged on before performing
this test.
# sync
# echo c > /proc/sysrq-trigger
After the system recovers, verify that a vmcore file was generated in
the save dump directory. By default the vmcore file is located in
/var/log/dumps/<date-string>.
When a crash occurs, the kernel crash handler starts the second recovery
kernel that the Kdump init script loaded earlier, and reboots the system
using the reserved memory up to the $KDUMP_RUNLEVEL runlevel.
During the boot of the recovery kernel, the Kdump init script loads
again, but this time it dumps the core image for later analysis.
When a crash happens in a graphical environment, you will likely have no
GUI in the second kernel boot. If you used a VGA console, you might
still have visual output from the secondary kernel. The default behavior
of the Kdump script is to save the old vmcore image, and then reboot the
system immediately. You can adjust the behavior of the Kdump script
through sysconfig variables described later in this document.
The Default Dumper
==================
By default, the Kdump script saves the vmcore file to a unique
sub-directory consisting of $KDUMP_SAVEDIR and the date string, such as
/var/log/dump/2006-02-21-13:20/vmcore.
Before copying the vmcore file, the default dumper does some system
checks. First, it checks the number of old dump directories and removes
them if there are more than $KDUMP_KEEP_OLD_DUMPS. Then, the dumper
checks the free disk space in the partition of the dump directory. If
the free space is less than the sum of the memory size and the value
given in $KDUMP_FREE_DISK_SIZE, then the dumper will not create a dump.
$KDUMP_RUNLEVEL specifies the runlevel of the Kdump (recovery) kernel
boot. When $KDUMP_IMMEDIATE_REBOOT is set to yes, then the init script
automatically reboots after saving the vmcore. By default, the dumper
uses KDUMP_RUNLEVEL=1 and KDUMP_IMMEDIATE_REBOOT=yes, in order to reduce
the possible risk of disk corruption in the recovery kernel environment.
If you want Kdump to run more complex jobs than set by the default
dumper configuration, set the name of the appropriate command or script
to be run via $KDUMP_TRANSFER, and change $KDUMP_RUNLEVEL and
$KDUMP_IMMEDIATE_REBOOT.
For example, setting $KDUMP_TRANSFER="scp /proc/vmcore remote:/dump" and
KDUMP_RUNLEVEL=3 will make Kdump act like a netdump. You can set
KDUMP_IMMEDIATE_REBOOT=no to prevent the immediate reboot. This could be
useful to check the system over the network, for example.
Note that the available memory size for the recovery kernel is limited.
Setting KDUMP_RUNLEVEL=5 (graphical login) is not recommended.
Tuning parameters
=================
You can adjust the basic behavior of the Kdump script by editing the
/etc/sysconfig/kdump file. Edit the script values with the YaST runlevel
System Services editor, or manually edit the /etc/sysconfig/kdump file,
and then restart the kdump service.
Generic options
---------------
- KDUMP_KERNELVER
This is the kernel version string for the Kdump kernel; an example is
"2.6.16-5-kdump". The init script will use a kernel named
/boot/vmlinux-$KDUMP_KERNELVER. The kdump script is located in the
/etc/sysconfig file.
If you do not specify a version, then the init script will try to find a
Kdump kernel with the same version number as the running kernel. Using
the string "kdump" will default to the most recently installed Kdump
kernel (suitable for x86, x86-64 and ppc64). For ia64, keep this
string empty to point the same running kernel.
- KDUMP_COMMANDLINE
This sets the command string to be passed to the Kdump kernel. This will
usually match the contents of the grub kernel line. An example is
KDUMP_COMMANDLINE="ro root=LABEL=/".
If you do not give a command line, then the default will be taken from
/proc/cmdline.
- KEXEC_OPTIONS
You can use this to pass additional arguments to kexec. For i386 and
x86-64, you likely need to pass "--args-linux" here.
- KDUMP-RUNLEVEL
This is the runlevel that the Kdump kernel boots to. The default is "1".
To enable network support in the Kdump recovery environment, set this to
"3".
- KDUMP_IMMEDIATE_REBOOT
This option specifies whether to reboot immediately after saving the
core in the Kdump kernel. The default is "yes."
- KDUMP_TRANSFER
This is an option to execute a script or command to process or transfer
the dump image. It can read the dump image either through /proc/vmcore
or /dev/oldmem. An empty string will use the default dumper.
Options for the Default Dumper
------------------------------
- KDUMP_SAVEDIR
This option specifies the path to the directory where the dumps are
saved. The default is "/var/log/dump".
- KDUMP_KEEP_OLD_DUMPS
This option specifies how many previous dumps are kept. If the number of
saved dump files exceeds this number, the dumper removes older dumps.
You can prevent automatic removal by setting this to "0" (zero). The
default value is "5".
- KDUMP_FREE_DISK_SIZE
This specifies the minimum free disk space in megabytes of the dump
partition. If the free disk space is less than the sum of this value and
the memory size, then the default dumper will not save the vmcore file
in order to prevent disk corruption. Setting this option to "0" (zero)
forces the dumper to dump without checking the size. The default value
is "64".
Dump Analysis
-------------
Dump analysis can be performed using GDB or the Crash utility. The Crash
utility is included in the crash RPM package. You must install a
debug-info kernel matching the version of the system kernel (of the
system where the dump was collected) on the system where the analysis is
to be performed. The debug-info kernel provides symbol and type
information that Crash and GDB use. You can find kernel debug
information RPMs on the SUSE support Web site. Alternately, you can
build a debug-info kernel from source by specifying the
CONFIG_DEBUG_INFO kernel parameter.
The symbol information in the debug-info kernel may differ from the
running kernel, therefor; when running crash against a vmcore you
should specify both the System.map file and the debug-info kernel.
For example, to run crash against a vmcore use the following command
line:
$ crash /boot/System.map-version /boot/vmlinux-version vmcore
Where:
/boot/System.map-<version> -- The map file matching the kernel
being analyzed.
/boot/vmlinux-<version> -- The matching kernel.
vmcore -- The crash dump.
The kernel rpm contains only gz-compressed file. Uncompress it
manually before using crash.
GDB Helper Script
-----------------
The GDB-kdump script is provided to simplify use of GDB on dump images.
The usage is "gdb-kdump [vmcore]".
The argument is the vmcore dump image to analyze. If you do not give an
argument, then the latest dump image will be taken. The script starts
GDB with the vmlinux of the currently running kernel. The script assumes
that the vmlinux file is at /boot/vmlinux-$kernel. If the script finds
only a gzip-compressed file, the file is automatically uncompressed.
Note that you will need to supply kernel-versionnumber-debuginfo, with
debug symbols. GDB-kdump also reads some useful macros for the Kdump
image, originally provided in /usr/src/linux/Documentation/kdump, at
startup. The following macros then become available: bttnobp, btt,
btpid, trapinfo, and dmesg. See the help topic of each command in GDB
for details.

65
gdb-kdump Normal file
View File

@ -0,0 +1,65 @@
#!/bin/sh
#
# Start gdb for kdump crash analysis
#
# Usage: gdb-kdump [-v vmlinux] [vmcore [gdb options...]]
#
# The script starts gdb using the currently running kernel image
# and the appopriate crash dump file. If the kernel image is
# compressed, it's decompressed automatically.
#
# When no arugment is given, the latest crash dump file is probed.
#
# The script also passes the gdb macros useful for analysis of crash
# dump.
. /etc/sysconfig/kdump
bootdir="/boot"
if [ "$1" = "-v" ]; then
vmlinux="$2"
if [ ! -f "$vmlinux" ]; then
echo "Cannot find vmlinux file $vmlinux, aborting"
exit 1
fi
shift 2
else
vmlinux="$bootdir"/vmlinux-`uname -r`
if [ ! -f $vmlinux ]; then
if [ -f "$bootdir/vmlinux" ]; then
vmlinux="$bootdir/vmlinux"
elif [ -f $vmlinux.gz ]; then
if gunzip $vmlinux.gz; then
echo "Uncompressed $vmlinux.gz"
else
echo "Cannot uncompress $vmlinux.gz, aborting"
exit 1
fi
else
echo "No useful vmlinux is found in $bootdir"
exit 1
fi
fi
fi
echo "Using $vmlinux as vmlinux"
if [ -n "$1" ]; then
if [ -f "$1" ]; then
dumpfile="$1"
shift
else
echo "Dumpfile $1 cannot be found"
exit 1
fi
else
dumpfile=`ls $KDUMP_SAVEDIR/*-*-*-*:*/vmcore 2>/dev/null | sort -r | head -n 1`
if [ -n "$dumpfile" -a -f "$dumpfile" ]; then
echo "Using $dumpfile as dumpfile"
else
echo "Cannot find the latest dumpfile"
exit 1
fi
fi
exec /usr/bin/gdb --command=/usr/share/gdbinit.kdump $vmlinux $dumpfile $*

201
gdbinit.kdump Normal file
View File

@ -0,0 +1,201 @@
#
# This file contains a few gdb macros (user defined commands) to extract
# useful information from kernel crashdump (kdump) like stack traces of
# all the processes or a particular process and trapinfo.
#
# These macros can be used by copying this file in .gdbinit (put in home
# directory or current directory) or by invoking gdb command with
# --command=<command-file-name> option
#
# Credits:
# Alexander Nyberg <alexn@telia.com>
# V Srivatsa <vatsa@in.ibm.com>
# Maneesh Soni <maneesh@in.ibm.com>
#
define bttnobp
set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next)
set $init_t=&init_task
set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
while ($next_t != $init_t)
set $next_t=(struct task_struct *)$next_t
printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
printf "===================\n"
set var $stackp = $next_t.thread.esp
set var $stack_top = ($stackp & ~4095) + 4096
while ($stackp < $stack_top)
if (*($stackp) > _stext && *($stackp) < _sinittext)
info symbol *($stackp)
end
set $stackp += 4
end
set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off)
while ($next_th != $next_t)
set $next_th=(struct task_struct *)$next_th
printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
printf "===================\n"
set var $stackp = $next_t.thread.esp
set var $stack_top = ($stackp & ~4095) + 4096
while ($stackp < $stack_top)
if (*($stackp) > _stext && *($stackp) < _sinittext)
info symbol *($stackp)
end
set $stackp += 4
end
set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off)
end
set $next_t=(char *)($next_t->tasks.next) - $tasks_off
end
end
document bttnobp
dump all thread stack traces on a kernel compiled with !CONFIG_FRAME_POINTER
end
define btt
set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next)
set $init_t=&init_task
set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
while ($next_t != $init_t)
set $next_t=(struct task_struct *)$next_t
printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
printf "===================\n"
set var $stackp = $next_t.thread.esp
set var $stack_top = ($stackp & ~4095) + 4096
set var $stack_bot = ($stackp & ~4095)
set $stackp = *($stackp)
while (($stackp < $stack_top) && ($stackp > $stack_bot))
set var $addr = *($stackp + 4)
info symbol $addr
set $stackp = *($stackp)
end
set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off)
while ($next_th != $next_t)
set $next_th=(struct task_struct *)$next_th
printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
printf "===================\n"
set var $stackp = $next_t.thread.esp
set var $stack_top = ($stackp & ~4095) + 4096
set var $stack_bot = ($stackp & ~4095)
set $stackp = *($stackp)
while (($stackp < $stack_top) && ($stackp > $stack_bot))
set var $addr = *($stackp + 4)
info symbol $addr
set $stackp = *($stackp)
end
set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off)
end
set $next_t=(char *)($next_t->tasks.next) - $tasks_off
end
end
document btt
dump all thread stack traces on a kernel compiled with CONFIG_FRAME_POINTER
end
define btpid
set var $pid = $arg0
set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next)
set $init_t=&init_task
set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
set var $pid_task = 0
while ($next_t != $init_t)
set $next_t=(struct task_struct *)$next_t
if ($next_t.pid == $pid)
set $pid_task = $next_t
end
set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off)
while ($next_th != $next_t)
set $next_th=(struct task_struct *)$next_th
if ($next_th.pid == $pid)
set $pid_task = $next_th
end
set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off)
end
set $next_t=(char *)($next_t->tasks.next) - $tasks_off
end
printf "\npid %d; comm %s:\n", $pid_task.pid, $pid_task.comm
printf "===================\n"
set var $stackp = $pid_task.thread.esp
set var $stack_top = ($stackp & ~4095) + 4096
set var $stack_bot = ($stackp & ~4095)
set $stackp = *($stackp)
while (($stackp < $stack_top) && ($stackp > $stack_bot))
set var $addr = *($stackp + 4)
info symbol $addr
set $stackp = *($stackp)
end
end
document btpid
backtrace of pid
end
define trapinfo
set var $pid = $arg0
set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next)
set $init_t=&init_task
set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
set var $pid_task = 0
while ($next_t != $init_t)
set $next_t=(struct task_struct *)$next_t
if ($next_t.pid == $pid)
set $pid_task = $next_t
end
set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off)
while ($next_th != $next_t)
set $next_th=(struct task_struct *)$next_th
if ($next_th.pid == $pid)
set $pid_task = $next_th
end
set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off)
end
set $next_t=(char *)($next_t->tasks.next) - $tasks_off
end
printf "Trapno %ld, cr2 0x%lx, error_code %ld\n", $pid_task.thread.trap_no, \
$pid_task.thread.cr2, $pid_task.thread.error_code
end
document trapinfo
Run info threads and lookup pid of thread #1
'trapinfo <pid>' will tell you by which trap & possibly
addresthe kernel paniced.
end
define dmesg
set $i = 0
set $end_idx = (log_end - 1) & (log_buf_len - 1)
while ($i < logged_chars)
set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1)
if ($idx + 100 <= $end_idx) || \
($end_idx <= $idx && $idx + 100 < log_buf_len)
printf "%.100s", &log_buf[$idx]
set $i = $i + 100
else
printf "%c", log_buf[$idx]
set $i = $i + 1
end
end
end
document dmesg
print the kernel ring buffer
end

249
kdump Normal file
View File

@ -0,0 +1,249 @@
#! /bin/sh
#
# Copyright 2005 Red Hat, Inc.
# Author: Jeff Moyer <jmoyer@redhat.com>
# Modifications for SUSE from Chris Mason <mason@suse.com>
# Takashi Iwai <tiwai@suse.de>
#
# kdump
#
# Description: The kdump init script provides the support necessary for
# loading a kdump kernel into memory at system bootup time,
# and for copying away a vmcore at system panic time.
#
#
# /etc/init.d/kexec
### BEGIN INIT INFO
# Provides: kdump
# Required-Start: boot.localfs $remote_fs
# Should-Start:
# Required-Stop:
# Default-Start: 1 2 3 5
# Default-Stop:
# Description: kdump core saving and boot configuration
### END INIT INFO
. /etc/sysconfig/kdump
. /etc/rc.status
KEXEC=/sbin/kexec
BOOTDIR="/boot"
# purge old dump directories if the number of directories
# exceeds $KDUMP_KEEP_OLD_DUMPS
purge_old_dumps()
{
dirs=`ls -d $KDUMP_SAVEDIR/*-*-*-*:* 2>/dev/null | sort`
numdirs=`echo $dirs | wc -w`
for d in $dirs; do
if [ $numdirs -le $KDUMP_KEEP_OLD_DUMPS ]; then
break;
fi
echo " Expiring old dump $d"
rm -rf $d
numdirs=`expr $numdirs - 1`
done
}
# get the free disk space of the given directory in MB
parse_rest_size()
{
test -d "$1" || mkdir -p "$1"
hdread=""
df -P "$1" | while read fs bl us av rest; do
test -n "$hdread" && expr $av / 1024
hdread="$fs"
done
}
# get vmcore size in MB
get_mem_size()
{
s=`stat -c '%s' /proc/vmcore`
expr \( $s + 1048575 \) / 1048576
}
# The default dumper
#
# Clean up old stuff if necessary, check the free size
# and save the vmcore
save_core()
{
if [ $KDUMP_KEEP_OLD_DUMPS -gt 0 ]; then
purge_old_dumps
fi
if [ $KDUMP_FREE_DISK_SIZE -gt 0 ]; then
restsize=`parse_rest_size "$KDUMP_SAVEDIR"`
needsize=`get_mem_size`
needsize=`expr $needsize + $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"
cp --sparse=always /proc/vmcore $coredir/vmcore
rc_status -v
}
# print the available kdump kernel path
# empty if no matching file is found
check_boot_kernel ()
{
local kstr
kstr="${BOOTDIR}/vmlinux-$1$2"
if [ -f $kstr ]; then
echo $kstr
return
fi
kstr="$kstr.gz"
if [ -f $kstr ]; then
echo $kstr
return
fi
case `uname -i` in
ia64)
# ia64 uses vmlinuz as of vmlinux.gz
kstr="${BOOTDIR}/vmlinuz-$1$2"
if [ -f $kstr ]; then
echo $kstr
return
fi
;;
esac
}
# Load the kdump kerel 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()
{
echo -n "Loading kdump "
if [ -z "$KDUMP_KERNELVER" ]; then
kdump_kver=`uname -r | sed -e's/-[^-]*$//g'`
kdump_kernel=`check_boot_kernel $kdump_kver -kdump`
if [ -n "$kdump_kernel" ]; then
kdump_kver="${kdump_kver}-kdump"
elif [ -z "$kdump_kernel" ]; then
kdump_kver=`uname -r`
kdump_kernel=`check_boot_kernel $kdump_kver`
fi
else
kdump_kver="$KDUMP_KERNELVER"
kdump_kernel=`check_boot_kernel $kdump_kver`
fi
if [ -z "$kdump_kernel" -o ! -f "$kdump_kernel" ]; then
echo -n ": No kdump kernel image found for kernel $kdump_kver."
rc_status -s
rc_failed 6
rc_exit
fi
kdump_initrd="${BOOTDIR}/initrd-${kdump_kver}"
if [ ! -f $kdump_initrd ]; then
echo -n ": No kdump initial ramdisk found."
echo "Tried to locate ${kdump_initrd}"
rc_status -s
rc_failed 6
rc_exit
fi
if [ -z "$KDUMP_COMMANDLINE" ]; then
KDUMP_COMMANDLINE=`cat /proc/cmdline`
KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | \
sed -e 's/crashkernel=[0-9]\+[mM]\(@[0-9]\+[Mm]\)\?//g' \
-e 's/ *splash=[^ ]* / /g' \
-e 's/ *showopts/ /g'`
# Use deadline for saving the memory footprint
KDUMP_COMMANDLINE="$KDUMP_COMMANDLINE elevator=deadline sysrq=1"
case `uname -i` in
i?86|x86_64)
KDUMP_COMMANDLINE="$KDUMP_COMMANDLINE irqpoll"
;;
esac
fi
KDUMP_COMMANDLINE="CRASH=1 $KDUMP_COMMANDLINE"
if [ -n "$KDUMP_RUNLEVEL" ]; then
case "$KDUMP_RUNLEVEL" in
[1-5s])
KDUMP_COMMANDLINE="$KDUMP_COMMANDLINE $KDUMP_RUNLEVEL"
;;
*)
echo " : Invalid KDUMP_RUNLEVEL=$KDUMP_RUNLEVEL, ignored"
;;
esac
fi
echo 1 > /proc/sys/kernel/panic_on_oops
$KEXEC -p $kdump_kernel \
--append="$KDUMP_COMMANDLINE" \
--initrd=$kdump_initrd \
$KEXEC_OPTIONS
rc_status -v
}
# return success if running in a crash environemnt
is_crash_kernel ()
{
test -f /proc/vmcore || return 1
# FIXME: any better way to detect crash environment?
test -n "$CRASH" && return 0
case `uname -i` in
ia64)
# ia64 has no kdump kernel
return 1;;
esac
return 0
}
case "$1" in
start)
if is_crash_kernel; then
if [ -n "$KDUMP_TRANSFER" ]; then
$KDUMP_TRANSFER
else
save_core
fi
if test "$KDUMP_IMMEDIATE_REBOOT" = "yes"; then
/sbin/reboot
# sleep to avoid the conflict with script "single"
sleep 600
fi
else
load_kdump
fi
;;
stop)
if [ ! -f /proc/vmcore ]; then
echo -n "Unloading kdump"
$KEXEC -p -u
rc_status -v
fi
;;
status)
echo "not implemented"
;;
restart|reload)
$0 stop
$0 start
;;
condrestart)
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 1
esac
exit $?

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bdf67b1ccb092c5ed806728707bebabb28448561c552ea0d1c96d151b422b87c
size 176790

185
kexec-tools.changes Normal file
View File

@ -0,0 +1,185 @@
-------------------------------------------------------------------
Wed Dec 20 10:59:26 CET 2006 - tiwai@suse.de
- take kexec-tools-testing snapshot-20061219.
o ia64 support
o relocatable kernel support
o lots of cleanups/fixes
- fix manpage and help about -u option (#208710)
- ia64 kdump support (#214865, FATE#301433, FATE#301434)
o add boot argument "CRASH=1" to indicate the crash environment
(for kexec'ing with the same kernel)
o fix kdump init script for ia64, which has only vmlinuz and
uses the same kernel for kdump
- reduce boot options for kdump kernel (#223500)
-------------------------------------------------------------------
Thu Jul 13 17:39:20 CEST 2006 - tiwai@suse.de
- fixed the calculation of required disk space in kdump
init script (#192172)
- fix the wrong usage of crash program in README.SUSE
-------------------------------------------------------------------
Thu Jun 22 15:23:22 CEST 2006 - tiwai@suse.de
- fix kexec to reserve ACPI NVS area (#179093)
- add more description about chkconfig and kdump service
(#183017)
-------------------------------------------------------------------
Fri Jun 16 12:24:03 CEST 2006 - tiwai@suse.de
- add irqpoll boot option for i386 and x86_64 for more robust
kdump (#183017)
-------------------------------------------------------------------
Thu Jun 1 18:07:35 CEST 2006 - tiwai@suse.de
- update README.SUSE for more precise description about crash
and debug kernel.
-------------------------------------------------------------------
Tue May 30 16:03:26 CEST 2006 - tiwai@suse.de
- ppc64 kdump ELF header fix for power 4 box (#175128).
-------------------------------------------------------------------
Mon May 22 12:49:01 CEST 2006 - tiwai@suse.de
- added the missing man page for kexec (#175084).
- add sleep after reboot in kdump init script for avoiding
confliction with script single (#171332)
-------------------------------------------------------------------
Fri May 19 14:56:15 CEST 2006 - olh@suse.de
- unconditionally add sysrq=1 for kdump boots, nothing to lose
-------------------------------------------------------------------
Fri May 19 13:57:15 CEST 2006 - olh@suse.de
- remove crashkernel= cmdline also if only the size is given
handle m as well as M because memparse() handles both
-------------------------------------------------------------------
Tue May 2 16:18:57 CEST 2006 - tiwai@suse.de
- update/improve README.SUSE
- fix the default value in sysconfig.kdump
- add elevator=deadline to the boot parameter of kdump kernel
to save memory footprint (#170591)
-------------------------------------------------------------------
Fri Apr 28 21:07:49 CEST 2006 - olh@suse.de
- use df -P to print all data for a mount point in a single line
long device node names will cause 2 lines in df output
-------------------------------------------------------------------
Wed Apr 26 13:42:38 CEST 2006 - olh@suse.de
- linux,platform properties were removed from kernel 2.6.17
assume non-LPAR if some properties do no exist in the device-tree
(164993 - LTC23056)
-------------------------------------------------------------------
Wed Apr 26 11:47:10 CEST 2006 - olh@suse.de
- set /proc/sys/kernel/panic_on_oops to actually trigger a dump
-------------------------------------------------------------------
Wed Mar 8 23:10:24 CET 2006 - olh@suse.de
- add --args-linux only on intel
copy vmcore with --sparse, maybe it saves a few bytes.
-------------------------------------------------------------------
Wed Feb 22 16:53:23 CET 2006 - tiwai@suse.de
- updated to kdump7 patch.
-------------------------------------------------------------------
Wed Feb 15 11:23:45 CET 2006 - tiwai@suse.de
- fixed gdb-kdump script (#151001)
-------------------------------------------------------------------
Mon Feb 13 15:09:58 CET 2006 - tiwai@suse.de
- fix for ppc64 (#149576)
-------------------------------------------------------------------
Sun Feb 12 17:58:43 CET 2006 - tiwai@suse.de
- added the system check before dumping
- added README.SUSE
- added gdb-kdump helper script
-------------------------------------------------------------------
Thu Feb 9 11:16:35 CET 2006 - tiwai@suse.de
- fixed Default-Start in kdump init script.
- fixed RequiredStart in sysconfig/kdump.
-------------------------------------------------------------------
Wed Feb 8 21:57:43 CET 2006 - tiwai@suse.de
- changed the default values of KDUMP_IMMEDIATE_REBOOT and
KDUMP_RUNLEVEL (#149140).
-------------------------------------------------------------------
Tue Feb 7 13:16:25 CET 2006 - tiwai@suse.de
- added missing preun and postun sections.
-------------------------------------------------------------------
Mon Feb 6 15:22:32 CET 2006 - tiwai@suse.de
- fixed the messages from kdump to use suse rc macros
- added $KDUMP_RUNLEVEL to /etc/sysconfig/kdump for specifying
the runlevel to boot kdump kernel.
- added /sbin/rckdump
- fixed a typo in kdump init script
-------------------------------------------------------------------
Fri Feb 3 16:20:13 CET 2006 - tiwai@suse.de
- sync with mainstream dump6 patch:
most of ppc64 patches were merged there.
new fixes included: vmcore copy fix for x86_64 and ext_mem_k
calculation fix for i386
- added KEXEC_TRANSFER sysconfig variable for user-defined
dump action.
-------------------------------------------------------------------
Fri Jan 27 12:13:59 CET 2006 - tiwai@suse.de
- added kdump init script and sysconfig.
-------------------------------------------------------------------
Wed Jan 25 21:37:11 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Mon Jan 23 15:02:24 CET 2006 - olh@suse.de
- update ppc64 kdump support
-------------------------------------------------------------------
Thu Jan 5 16:37:12 CET 2006 - tiwai@suse.de
- more fix for ppc64 kdump
- fix malloc size
-------------------------------------------------------------------
Thu Dec 15 16:09:27 CET 2005 - tiwai@suse.de
- use the latest kdump patch.
-------------------------------------------------------------------
Mon Dec 12 14:46:46 CET 2005 - tiwai@suse.de
- initial version: 1.101

207
kexec-tools.spec Normal file
View File

@ -0,0 +1,207 @@
#
# spec file for package kexec-tools (Version 1.101)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: kexec-tools
%define package_version testing-20061219
License: GNU General Public License (GPL)
Group: System/Kernel
Requires: %insserv_prereq %fillup_prereq
Autoreqprov: on
Summary: Tools for fast kernel loading
Version: 1.101
Release: 59
Source: %{name}-%{package_version}.tar.bz2
Source1: kdump
Source2: sysconfig.kdump
Source3: gdbinit.kdump
Source4: gdb-kdump
Source5: README.SUSE
URL: http://www.xmission.com/~ebiederm/files/kexec/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Kexec is a user space utiltity for loading another kernel and asking
the currently running kernel to do something with it. A currently
running kernel may be asked to start the loaded kernel on reboot, or to
start the loaded kernel after it panics.
Authors:
--------
Eric Biederman <ebiederm@xmission.com>
Albert Herranz
Jesse Barnes <jbarnes@sgi.com>
Khalid Aziz <khalid.aziz@hp.com>
Hariprasad Nellitheertha <hari@in.ibm.com>
Tim Deegan <tjd21@cl.cam.ac.uk>
%prep
%setup -q -n kexec-tools
%{?suse_update_config -f}
cp %{SOURCE5} .
%build
autoreconf -fi
./configure --prefix=/ --sbindir=/sbin --libdir=/%_lib
make CPPFLAGS="$RPM_OPT_FLAGS"
%install
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
install -c -m 0644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -c -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /etc/init.d/kdump $RPM_BUILD_ROOT/sbin/rckdump
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -c -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.kdump
%ifarch %ix86 x86_64
# add --args-linux kexec command line option as default
sed -i 's@^\(KEXEC_OPTIONS="\)\(.*"[[:blank:]]*$\)@\1--args-linux \2@' $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.kdump
%endif
%ifarch ia64
# empty string for kdump kernel version (to indicate the same kernel)
sed -i 's@^\(KDUMP_KERNELVER=\).*$@\1""@' $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.kdump
%endif
# install gdb helpers
mkdir -p $RPM_BUILD_ROOT%{_datadir}
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}
install -c -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}
%post
%{fillup_and_insserv -n kdump kdump}
%preun
%stop_on_removal kdump
%postun
%restart_on_update kdump
%insserv_cleanup
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
%doc AUTHORS COPYING News TODO doc
%doc README.SUSE
%doc %{_mandir}/man*/*
/sbin/*
%{_bindir}/*
%{_datadir}/gdbinit.*
%ifarch %ix86 x86_64
/%_lib/kexec-tools*
%endif
/etc/init.d/kdump
/var/adm/fillup-templates/sysconfig.kdump
%changelog -n kexec-tools
* Wed Dec 20 2006 - tiwai@suse.de
- take kexec-tools-testing snapshot-20061219.
o ia64 support
o relocatable kernel support
o lots of cleanups/fixes
- fix manpage and help about -u option (#208710)
- ia64 kdump support (#214865, FATE#301433, FATE#301434)
o add boot argument "CRASH=1" to indicate the crash environment
(for kexec'ing with the same kernel)
o fix kdump init script for ia64, which has only vmlinuz and
uses the same kernel for kdump
- reduce boot options for kdump kernel (#223500)
* Thu Jul 13 2006 - tiwai@suse.de
- fixed the calculation of required disk space in kdump
init script (#192172)
- fix the wrong usage of crash program in README.SUSE
* Thu Jun 22 2006 - tiwai@suse.de
- fix kexec to reserve ACPI NVS area (#179093)
- add more description about chkconfig and kdump service
(#183017)
* Fri Jun 16 2006 - tiwai@suse.de
- add irqpoll boot option for i386 and x86_64 for more robust
kdump (#183017)
* Thu Jun 01 2006 - tiwai@suse.de
- update README.SUSE for more precise description about crash
and debug kernel.
* Tue May 30 2006 - tiwai@suse.de
- ppc64 kdump ELF header fix for power 4 box (#175128).
* Mon May 22 2006 - tiwai@suse.de
- added the missing man page for kexec (#175084).
- add sleep after reboot in kdump init script for avoiding
confliction with script single (#171332)
* Fri May 19 2006 - olh@suse.de
- unconditionally add sysrq=1 for kdump boots, nothing to lose
* Fri May 19 2006 - olh@suse.de
- remove crashkernel= cmdline also if only the size is given
handle m as well as M because memparse() handles both
* Tue May 02 2006 - tiwai@suse.de
- update/improve README.SUSE
- fix the default value in sysconfig.kdump
- add elevator=deadline to the boot parameter of kdump kernel
to save memory footprint (#170591)
* Fri Apr 28 2006 - olh@suse.de
- use df -P to print all data for a mount point in a single line
long device node names will cause 2 lines in df output
* Wed Apr 26 2006 - olh@suse.de
- linux,platform properties were removed from kernel 2.6.17
assume non-LPAR if some properties do no exist in the device-tree
(164993 - LTC23056)
* Wed Apr 26 2006 - olh@suse.de
- set /proc/sys/kernel/panic_on_oops to actually trigger a dump
* Wed Mar 08 2006 - olh@suse.de
- add --args-linux only on intel
copy vmcore with --sparse, maybe it saves a few bytes.
* Wed Feb 22 2006 - tiwai@suse.de
- updated to kdump7 patch.
* Wed Feb 15 2006 - tiwai@suse.de
- fixed gdb-kdump script (#151001)
* Mon Feb 13 2006 - tiwai@suse.de
- fix for ppc64 (#149576)
* Sun Feb 12 2006 - tiwai@suse.de
- added the system check before dumping
- added README.SUSE
- added gdb-kdump helper script
* Thu Feb 09 2006 - tiwai@suse.de
- fixed Default-Start in kdump init script.
- fixed RequiredStart in sysconfig/kdump.
* Wed Feb 08 2006 - tiwai@suse.de
- changed the default values of KDUMP_IMMEDIATE_REBOOT and
KDUMP_RUNLEVEL (#149140).
* Tue Feb 07 2006 - tiwai@suse.de
- added missing preun and postun sections.
* Mon Feb 06 2006 - tiwai@suse.de
- fixed the messages from kdump to use suse rc macros
- added $KDUMP_RUNLEVEL to /etc/sysconfig/kdump for specifying
the runlevel to boot kdump kernel.
- added /sbin/rckdump
- fixed a typo in kdump init script
* Fri Feb 03 2006 - tiwai@suse.de
- sync with mainstream dump6 patch:
most of ppc64 patches were merged there.
new fixes included: vmcore copy fix for x86_64 and ext_mem_k
calculation fix for i386
- added KEXEC_TRANSFER sysconfig variable for user-defined
dump action.
* Fri Jan 27 2006 - tiwai@suse.de
- added kdump init script and sysconfig.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Jan 23 2006 - olh@suse.de
- update ppc64 kdump support
* Thu Jan 05 2006 - tiwai@suse.de
- more fix for ppc64 kdump
- fix malloc size
* Thu Dec 15 2005 - tiwai@suse.de
- use the latest kdump patch.
* Mon Dec 12 2005 - tiwai@suse.de
- initial version: 1.101

0
ready Normal file
View File

99
sysconfig.kdump Normal file
View File

@ -0,0 +1,99 @@
## Path: System/Kernel/Kdump
## Description: Crash Dump Configuration
## Type: string
## Default: "kdump"
## ServiceRestart: kdump
#
# Kernel Version string for the -kdump kernel, such as 2.6.16-5-kdump
# 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.
# The init script will use a kernel named:
# /boot/vmlinux-$KDUMP_KERNELVER
# Using "kdump" will default to the most recently installed kdump kernel.
#
KDUMP_KERNELVER="kdump"
## Type: string
## Default: ""
## ServiceRestart: kdump
#
# 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=/"
# If a command line is not specified, the default will be taken from
# /proc/cmdline
#
KDUMP_COMMANDLINE=""
## Type: string
## Default: ""
## ServiceRestart: kdump
#
# Additional arguments passed to kexec. For example, to generate
# ELF32 dump on x86-64 to allow i386 systems to read dump, set
# "--elf32-core-headers" here.
#
# Keep this empty in most cases.
#
KEXEC_OPTIONS=""
## Type: list(1,2,3,5,s)
## Default: 1
## ServiceRestart: kdump
#
# The run-level to boot the kdump kernel. The default is "1".
# If you need networks in the kdump environment, set "3".
#
KDUMP_RUNLEVEL="1"
## Type: yesno
## Default: yes
#
# Immediately reboot after saving the core in the kdump kernel?
# use "yes" or "no". Default is "yes"
#
KDUMP_IMMEDIATE_REBOOT="yes"
## Type: string
## Default: ""
#
# A script or command executed to process and transfer the dump image.
# It can read the dump image either via /proc/vmcore or /dev/oldmem.
#
# Keeping this empty will use the default dumper, which copies the vmcore
# file to $KDUMP_SAVEDIR with some system checks.
#
KDUMP_TRANSFER=""
## Type: string
## Default: "/var/log/dump"
#
# Which directory should the dumps be saved in by the default dumper?
#
KDUMP_SAVEDIR="/var/log/dump"
## Type: integer
## Default: 5
#
# Specifies how many old dumps are kept. If the number of dump files
# exceeds this number, older dumps are removed.
#
# You can prevent the automatic removal by setting zero to this.
# The default value is 5.
#
KDUMP_KEEP_OLD_DUMPS=5
## Type: integer
## Default: 64
#
# Specifies the minimal free disk space (in MB unit) on the dump
# partition. If the free disk space is less than the sum of this
# value and memory size, the default dumper won't save vmcore file
# in order to keep the system sane.
#
# Setting zero forces to dump without check.
# The default value is 64MB.
#
KDUMP_FREE_DISK_SIZE=64