From owner-freebsd-ppc@FreeBSD.ORG Sun Feb 27 07:45:40 2005 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07B9F16A4CE for ; Sun, 27 Feb 2005 07:45:40 +0000 (GMT) Received: from smtp1.server.rpi.edu (smtp1.server.rpi.edu [128.113.2.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7359F43D62 for ; Sun, 27 Feb 2005 07:45:39 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp1.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j1R7jben006332 for ; Sun, 27 Feb 2005 02:45:38 -0500 Mime-Version: 1.0 Message-Id: Date: Sun, 27 Feb 2005 02:45:36 -0500 To: freebsd-ppc@FreeBSD.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.1 Subject: Setting kern.bootfile, and backup kernels X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Feb 2005 07:45:40 -0000 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///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