Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel install target (was: CVS commit: syssrc/sys/conf)



On Sat, Dec 08, 2001 at 08:54:08PM -0500, Perry E. Metzger wrote:
> 
> A bad idea. You can easily nuke your running kernel that way by
> accident. We don't have that functionality by intent. The mechanisms
> for picking up kernels for snapshots don't need it anyway.

Note the install target does preserve what it no doubt assumes is the
running kernel, though not in a way I would do it.  The current install
target does not rename the current kernel image to a name commonly
loaded as a backup by most boot programs, and it does not install the
new kernel in a way that makes it easier to preserve a series of kernels
(i.e. multiple installs between reboots would still trash the running
kernel's load image).

I would suggest something more along these lines:

install-kernel-${MACHINE_NAME}:
        if [ ! -f /netbsd.old ] ; then mv /netbsd /netbsd.old; fi
        newkern=netbsd-$$(sh $S/conf/osrelease.sh)-$$(basename $$(pwd))-$$(date 
'+%Y%m%d%H%M')-$$(cat version); \
        echo "install -c -m 444 -o root -g wheel netbsd /$$newkern";    \
        install -c -m 444 -o root -g wheel netbsd /$$newkern;           \
        rm -f /netbsd;                                                  \
        echo "ln /$$newkern /netbsd";                                   \
        ln /$$newkern /netbsd

(that's the absolute minimum info I'd put in the filename, BTW!)

And then perhaps have a script in /etc/rc.d that renames /netbsd.old to
/netbsd.last (clobbering any previous /netbsd.last unconditionally) as
the last step in a successful multi-user boot.  Cleaning of old kernel
image files should probably only be done by hand, though in theory the
ones older than /netbsd.last and any between /netbsd.last and
/netbsd.old are usually no longer useful.

This way the last booted kernel is always linked to /netbsd.old until a
new one boots and successfully "goes live", and if you have to back down
to a previously stable kernel it should always be the one linked to
/netbsd.last.

The above is essentially what I usually do now, by hand.  Having the
default kernel install target work this way would be nice, and I guess I
could always override in /etc/mk.conf, but that seems to result in some
nasty warnings for reasons I can't quite figure out at the moment:

$ make -n install
make: "/work/woods/NetBSD-src/sys/arch/i386/compile/PROVEN/Makefile" line 683: 
warning: duplicate script for target "install-kernel-proven" ignored
make: "/etc/mk.conf" line 65: warning: using previous script for 
"install-kernel-proven" defined here
make: "/work/woods/NetBSD-src/sys/arch/i386/compile/PROVEN/Makefile" line 684: 
warning: duplicate script for target "install-kernel-proven" ignored
make: "/etc/mk.conf" line 65: warning: using previous script for 
"install-kernel-proven" defined here
make: "/work/woods/NetBSD-src/sys/arch/i386/compile/PROVEN/Makefile" line 685: 
warning: duplicate script for target "install-kernel-proven" ignored
make: "/etc/mk.conf" line 65: warning: using previous script for 
"install-kernel-proven" defined here
make: "/work/woods/NetBSD-src/sys/arch/i386/compile/PROVEN/Makefile" line 686: 
warning: duplicate script for target "install-kernel-proven" ignored
make: "/etc/mk.conf" line 65: warning: using previous script for 
"install-kernel-proven" defined here
if [ ! -f /netbsd.old ] ; then mv /netbsd /netbsd.old; fi
newkern=netbsd-$(sh ../../../../conf/osrelease.sh)-$(basename $(pwd))-$(date 
'+%Y%m%d%H%M')-$(cat version);  echo "install -c -m 444 -o root -g wheel netbsd 
/$newkern";  install -c -m 444 -o root -g wheel netbsd /$newkern;  rm -f 
/netbsd;  echo "ln /$newkern /netbsd";  ln /$newkern /netbsd

There's always the source that could be modified too....

-- 
                                                                Greg A. Woods

+1 416 218-0098;  <gwoods%acm.org@localhost>;  <g.a.woods%ieee.org@localhost>;  
<woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>; VE3TCP; Secrets of the Weird 
<woods%weird.com@localhost>



Home | Main Index | Thread Index | Old Index