Subject: Re: passing in the booted kernel name...?
To: Soren S. Jorvang <soren@t.dk>
From: None <drochner@zel459.zel.kfa-juelich.de>
List: port-sparc
Date: 01/09/1999 00:32:38
soren@t.dk said:
> I was thinking of some more general way of accomplishing what
> machdep.booted_kernel does, i.e. mostly where to point kvm_mkdb at. 

What's wrong with some startup script like:
mykernel = /`sysctl machdep.booted_kernel`
if [a version check($mykernel) passes]; do
	kvm_mkdb $mykernel
else
	[print warning or so]
done

> so perhaps
> simply checking all of /netbsd* for a version string matching
> the running kernel's would be better than trying to improve
> booted_kernel. 

One can try to improve `sysctl machdep.booted_kernel`, but it can
never be perfect unless you restrict the ways the system can
be booted. As it looks now, this variable reflects the name
of the booted file, not more, and in particular not whether
or how this file is accessible in the final filesystem.
Only a system administrator can know this, so only he can make
sure that kvm_mkdb etc. get a path to the active kernel.
A standard setup should assume "/`machdep.booted_kernel`" to be
the kernel file, and who has a more exotic setup is on his own.

Of course it would make things safer if the symbol table would
be loaded with the kernel image and accessed via a system call,
but in most cases this as a waste of memory. I'd think that
people loading the kernel from an other place than their own
filesystem's root should be clever enough to set up a startup
script which gets the kernel symbols right.

best regards
Matthias