From owner-freebsd-current Sun Nov 12 12:22:50 2000 Delivered-To: freebsd-current@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id B216F37B479 for ; Sun, 12 Nov 2000 12:22:47 -0800 (PST) Received: from newsguy.com (p09-dn03kiryunisiki.gunma.ocn.ne.jp [210.232.224.138]) by peach.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id FAA00470; Mon, 13 Nov 2000 05:22:04 +0900 (JST) Message-ID: <3A0EFB88.2F7D8A03@newsguy.com> Date: Mon, 13 Nov 2000 05:20:24 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,pt-BR MIME-Version: 1.0 To: mjacob@feral.com Cc: John Polstra , current@FreeBSD.ORG Subject: Re: savecore broken because kern.bootfile is set wrong References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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