summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-01-21 01:16:11 +0000
committersobomax <sobomax@FreeBSD.org>2002-01-21 01:16:11 +0000
commit4e0549db5573bd438ce183a3604b25b9ee373c32 (patch)
tree797223f639fe4f7e38b0645d11503b107b19512e
parent149d99c26eff591dab1ec3964744640075e3d7cb (diff)
downloadFreeBSD-src-4e0549db5573bd438ce183a3604b25b9ee373c32.zip
FreeBSD-src-4e0549db5573bd438ce183a3604b25b9ee373c32.tar.gz
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
-rw-r--r--sbin/dumpon/dumpon.818
-rw-r--r--sys/boot/common/loader.86
-rw-r--r--sys/boot/forth/loader.conf1
-rw-r--r--sys/kern/kern_shutdown.c11
4 files changed, 30 insertions, 6 deletions
diff --git a/sbin/dumpon/dumpon.8 b/sbin/dumpon/dumpon.8
index 99c2cc3..8d57557 100644
--- a/sbin/dumpon/dumpon.8
+++ b/sbin/dumpon/dumpon.8
@@ -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
diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8
index 185f391..d7466d5 100644
--- a/sys/boot/common/loader.8
+++ b/sys/boot/common/loader.8
@@ -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.
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index 7256ea6..e04aa4a 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -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
##############################################################
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 9263af9..d0cfe6e 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -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;
}
OpenPOWER on IntegriCloud