Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Feb 2005 02:45:36 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        freebsd-ppc@FreeBSD.org
Subject:   Setting kern.bootfile, and backup kernels
Message-ID:  <p06210241be4722c0eec4@[128.113.24.47]>

next in thread | raw e-mail | index | archive | help
One thing that surprised me with my last go-round with kernels
is that I didn't seem to have a /boot/kernel.old directory.  At
the time, I didn't have time to investigate further.

I thought I would update my ppc system today, and this time I
checked after doing 'make installkernel', and indeed I again
ended up without a backup kernel.  (luckily I had saved away a
copy before I did the 'installkernel').

It turns out this is because `sysctl -n kern.bootfile' returns
/kernel on the powerpc port, not /boot/kernel/kernel.  You can
also notice this at system startup, because it will say:

Feb 27 01:50:48 mymac syslogd: kernel boot file is /kernel

even though the boot file is not /kernel.  After some quick checks,
it seems the problem is that sys/kern/kern_mib.c has:
       char kernelname[MAXPATHLEN] = "/kernel";

The next question is why does that cause a problem for powerpc when
it doesn't seem to for other platforms?  On most other platforms,
sys/<platform>/<platform>/machdep.c includes some code that looks
interesting.  E.g. from sys/sparc64/sparc64/machdep.c :

	/*
	 * Initialize tunables.
	 */
	init_param2(physmem);
	env = getenv("kernelname");
	if (env != NULL) {
		strlcpy(kernelname, env, sizeof(kernelname));
		freeenv(env);
	}

I *think* that's setting the value we care about, but I might be
wrong on that.  One caveat is that I didn't notice what code
resets the kernelname value for the i386 platform.  I also don't
know who sets up the environment-variable that this code is looking
at when it sets the name.

In any case, it'd be nice if that sysctl variable could be setup
with the right value on powerpc, or people won't have any backup
kernels!

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



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