diff options
author | luigi <luigi@FreeBSD.org> | 2002-03-10 20:08:44 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2002-03-10 20:08:44 +0000 |
commit | ad77debfc5dfa5b73a27c6a6b4f1f7657090fb38 (patch) | |
tree | 41722859cb6c9c6a67510a8addd4bbedc3dd3082 /sys/i386 | |
parent | c497ba78d2ef58a2c3bddbb3da9c12b9de6556c5 (diff) | |
download | FreeBSD-src-ad77debfc5dfa5b73a27c6a6b4f1f7657090fb38.zip FreeBSD-src-ad77debfc5dfa5b73a27c6a6b4f1f7657090fb38.tar.gz |
Export a (machine dependent) kernel variable bootdev as
machdep.guessed_bootdev, and add code to sysctl to parse its value
and give a (not necessarily correct) name to the device we booted
from (the main motivation for this code is to use the info in the
PicoBSD boot scripts, and the impact on the kernel is minimal).
NOTE: the information available in bootdev is not always reliable,
so you should not trust it too much. The parsing code is the same
as in boot2.c, and cannot cover all cases -- as it is, it seems to
work fine with floppies and IDE disks recognised by the BIOS. It
_should_ work as well with SCSI disks recognised by the BIOS.
Booting from a CDROM in floppy emulation will return /dev/fd0 (because
this is what the BIOS tells us).
Booting off the network (e.g. with etherboot) leaves bootdev unset so
the value will be printed as "invalid (0xffffffff)".
Finally, this feature might go away at some point, hopefully when we
have a more reliable way to get the same information.
MFC-after: 5 days
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/autoconf.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 618b2c6..af2cb5f 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -238,8 +238,6 @@ cpu_rootconf() } SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL) -u_long bootdev = 0; /* not a dev_t - encoding is different */ - #if defined(NFSCLIENT) && defined(NFS_ROOT) && !defined(BOOTP_NFSROOT) static int diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 3c459d4..b9d51c7 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -985,6 +985,10 @@ SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo, SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); +u_long bootdev; /* not a dev_t - encoding is different */ +SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, + CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)"); + /* * Initialize 386 and configure to run kernel */ |