Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Mar 2002 20:56:02 -0800
From:      Michael Smith <msmith@freebsd.org>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        arch@freebsd.org
Subject:   Re: For review: machdep.bootdev sysctl (for i386) 
Message-ID:  <200203100456.g2A4u2j01429@mass.dis.org>
In-Reply-To: Your message of "Sat, 09 Mar 2002 04:27:28 PST." <20020309042728.A21016@iguana.icir.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Looking at a way to determine the boot device from userland,
> I have come to the conclusion that the most reasonable way is to
> export to userland whatever information the kernel has (and this
> is machine dependent, sorry!), and let some userland program
> (getbootdev(1)) convert it into a reasonable device name.

What do you mean by "boot device"?

The device from which the initial bootstrap was loaded?  The device from 
which the loader was loaded?  The device from which the kernel was loaded?

There's really no such thing.

> In the i386 case, the relevant information is in the "bootdev"
> variable, defined in i386/i386/autoconf.c and initialized
> in i386/i386/locore.s 

This is unreliable; it's usually but not always the BIOS unit number for 
the "current" disk, which may or may not be any of the above "boot 
devices".

> In the Alpha case, there is no "bootdev" variable, so I need
> feedback from Alpha experts on this.

There is no way (that I am aware of) to extract the SRM name of the 
booted device.

> Unless someone can suggest a better way (i.e. more general
> and as little intrusive -- we are talking about a 3-line change
> here!) I would like to commit this simple patch, moving bootdev
> (which is currently written in locore.s and unused otherwise) to
> machdep.c where the SYSCTL hook exports it.

I think that this is not a good way to do things.  Exporting this number 
is not useful, and based on my current reservations, I would strongly 
oppose any attempt to use it for anything.

> As for the userland program to parse machdep.bootdev, for the time
> being i am going to write it as part of the picobsd "tinyware",
> pending suggestions on the best place to put it.

I can't imagine how you plan to do this and make it reliable, since there 
is no mapping from BIOS unit numbers to BSD devices.  In almost any case 
you are likely to care about, the "boot device" is also the root device.

Detecting, let alone doing anything useful about, the other cases is IME
an impossible proposition.

 = Mike

-- 
To announce that there must be no criticism of the president,
or that we are to stand by the president, right or wrong, is not
only unpatriotic and servile, but is morally treasonable to 
the American public.  - Theodore Roosevelt



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203100456.g2A4u2j01429>