Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2000 05:20:24 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        mjacob@feral.com
Cc:        John Polstra <jdp@polstra.com>, current@FreeBSD.ORG
Subject:   Re: savecore broken because kern.bootfile is set wrong
Message-ID:  <3A0EFB88.2F7D8A03@newsguy.com>
References:  <Pine.LNX.4.21.0011101734230.31159-100000@zeppo.feral.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Jacob wrote:
> 
> > Also, in "src/sys/boot/common/boot.c" we still have this:
> >
> >     static const char *default_bootfiles = "kernel.ko";
> >
> > which isn't right any more.
> 
> Absolutely wrong, yes.
> 
> Look at kern_mib.c:
> 
> 
> char kernelname[MAXPATHLEN] = "/kernel";        /* XXX bloat */
> 
> SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
>     kernelname, sizeof kernelname, "Name of kernel file booted");
> 
> This is also wrong now.

In loader(8), the environment variable "bootfile" contains a list of
file names that will be tried for the kernel name. The environment
variable "kernelname" is set to the full path name to the kernel (or so
I believe :) when the kernel is loaded. This is done in
common/load_elf.c and common/load_aout.c. The function elf_loadfile(),
for instance, receives the name of the module/kernel to be loaded, and
set kernelname to that if it is a kernel and the load is succesful.

Since that function uses open(filename, ...), it is garanteed that it
needs to receive the full path.

Of course, none of this works with the device/slice[/partition] that has
the kernel isn't mounted later as root. :-)

Afterwards, I don't know how this information gets passed to the kernel.
On i386, this happens:

    kernelname = getenv("kernelname");
    i386_getdev(NULL, kernelname, &kernelpath);
    bi.bi_kernelname = VTOP(kernelpath);

Though the alpha code (alpha/libalpha/bootinfo.c) also fill in a lot of
stuff in bi, it has no reference at all to "kernelname". Did it ever
work? :-)

-- 
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com
dcs@freebsd.org
capo@world.wide.bsdconspiracy.net

		He has been convicted of criminal possession of a clue with intent to
distribute.


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A0EFB88.2F7D8A03>