Allow dump device be configured as early as possible using loader(8) tunable.

This allows obtaining crash dumps from the panics occured during late stages
of kernel initialisation before system enters into single-user mode.

MFC after:	2 weeks
This commit is contained in:
Maxim Sobolev 2002-01-21 01:16:11 +00:00
parent 01b8b9e983
commit dcd7d9b7b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89601
4 changed files with 30 additions and 6 deletions

View File

@ -93,12 +93,24 @@ or to
.Ar special_file
is the text string:
.Dq Li off .
.Pp
Since
.Nm
can only be called after the system enters single-user mode,
it can not be used to create dumps
for system panics during kernel initialization. In such cases you
have to use
.Va dumpdev
tunable provided by
.Xr loader 8
instead.
.Sh SEE ALSO
.Xr sysctl 3 ,
.Xr fstab 5 ,
.Xr rc.conf 5 ,
.Xr config 8 ,
.Xr init 8 ,
.Xr loader 8 ,
.Xr rc 8 ,
.Xr savecore 8 ,
.Xr swapon 8 ,
@ -113,12 +125,6 @@ boot-time system configuration
.Sh BUGS
Because the filesystem layer is already dead by the time a crash dump
is taken, it is not possible to send crash dumps directly to a file.
.Pp
Since
.Nm
can only be called after the system enters single-user mode,
it can not be used to create dumps
for system panics during kernel initialization.
.Sh HISTORY
The
.Nm

View File

@ -392,6 +392,12 @@ when the kernel is booted.
This can be overridden by setting
.Va rootdev
explicitly.
.It Va dumpdev
A name of device where the kernel can save a crash dump in the case
of a panic. This automatically sets
.Va kern.dumpdev
.Xr sysctl 3
MIB variable.
.El
.Pp
Other variables are used to override kernel tunable parameters.

View File

@ -64,6 +64,7 @@ module_path="/boot/kernel;/boot/modules;/modules" # Set the module search path
#boot_verbose="NO" # Causes extra debugging information to be printed
#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/stand/sysinstall"
# Sets the list of init candidates
#dumpdev="ad0s1b" # Set device for crash dumps
##############################################################

View File

@ -54,6 +54,7 @@
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/reboot.h>
@ -457,6 +458,16 @@ setdumpdev(dev_t dev)
static void
dump_conf(void *dummy)
{
char *path;
dev_t dev;
path = malloc(MNAMELEN, M_TEMP, M_WAITOK);
if (TUNABLE_STR_FETCH("dumpdev", path, MNAMELEN) != 0) {
dev = getdiskbyname(path);
if (dev != NODEV)
dumpdev = dev;
}
free(path, M_TEMP);
if (setdumpdev(dumpdev) != 0)
dumpdev = NODEV;
}