From owner-cvs-all Sun Oct 21 11:25:58 2001 Delivered-To: cvs-all@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 806AB37B401; Sun, 21 Oct 2001 11:25:45 -0700 (PDT) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f9LIPjM24946; Sun, 21 Oct 2001 11:25:45 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 8BF0C3803; Sun, 21 Oct 2001 11:25:44 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Brian Somers Cc: Brian Somers , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/conf Makefile.i386 In-Reply-To: <200110211707.f9LH79b86891@hak.lan.Awfulhak.org> Date: Sun, 21 Oct 2001 11:25:44 -0700 From: Peter Wemm Message-Id: <20011021182544.8BF0C3803@overcee.netplex.com.au> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Brian Somers wrote: > > Brian Somers wrote: > > > brian 2001/10/17 06:57:32 PDT > > > > > > Modified files: > > > sys/conf Makefile.i386 > > > Log: > > > Change kern.bootfile when mv'ing the kernel > > > > This backs out part of rev 1.169, which was an intentional change.. > > > > This is incomplete.. > > what if it is the second 'make install'? > > What if sysctl isn't in $PATH? > > What if it is an old sysctl that needs the -w switch? There isn't > > an error trap to eat the error code, will this cause 'make installkernel' > > to fail? Hmm, it seems it does: > > > > peter@overcee[12:15am]/home/src/sys/i386/compile/OVERCEE-111# make install rm -rf /boot/kernel.old > > mv /boot/kernel /boot/kernel.old > > [ "`sysctl -n kern.bootfile`" != "/boot/kernel/kernel" ] || sysctl kern.bo otfile=/boot/kernel.old/kernel > > sysctl: must use -w to modify variables > > *** Error code 1 > > > > Stop in /home/src/sys/i386/compile/OVERCEE. > > > > Nothing is supposed to be using this sysctl, it's purely informational > > these days, and even then it has only part of the story. The booted kernel > > may not even be reachable (eg: on an EFI filesystem or pulled in via tftp). > > I guess it's wrong information... Where is the name of the current > kernel supposed to be gotten from ? None of the documentation seems > to point anywhere else. > > Personally, I think my change was wrong. The installkernel code should > check to see if kern.bootfile is already kernel.old, and if it is, > shouldn't move /boot/kernel/ on top of it. > > WRT sysctl(8) not being in the path, are you suggesting that I spell > it /sbin/sysctl ? And WRT the command failing, are you suggesting > that I simply put a ``-'' in front of the command ? Have a look at the old code: @@ -231,13 +231,6 @@ -chflags noschg ${DESTDIR}/${KERNEL} mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old .endif - PATH=$${PATH}:/sbin:/usr/sbin; \ - if [ `sysctl -n kern.bootfile` = ${DESTDIR}/${KERNEL} ] ; then \ - sysctl -w kern.bootfile=${DESTDIR}/${KERNEL}.old ; \ - if [ -f /var/db/kvm_${KERNEL}.db ] ; then \ - mv -f /var/db/kvm_${KERNEL}.db /var/db/kvm_${KERNEL}.old.db ; \ - fi \ - fi install -c -m 555 -o root -g wheel -fschg \ ${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL} versus the new code: @@ -238,6 +238,8 @@ -rm -rf ${DESTDIR}${KODIR}.old .endif mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old + [ "`sysctl -n kern.bootfile`" != "${DESTDIR}${KODIR}/kernel" ] || \ + sysctl kern.bootfile=${DESTDIR}${KODIR}.old/kernel .endif mkdir -p ${DESTDIR}${KODIR} install -c -m 555 -o root -g wheel \ The old one was better, except ignore the kvm_${KERNEL} thing and use the new paths. ie: something like this: .if exists(${DESTDIR}${KODIR}) .if exists(${DESTDIR}${KODIR}.old) @-chflags -R noschg ${DESTDIR}${KODIR}.old -rm -rf ${DESTDIR}${KODIR}.old .endif mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old -PATH=$${PATH}:/sbin:/usr/sbin; \ if [ `sysctl -n kern.bootfile` = ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \ sysctl -w kern.bootfile=${DESTDIR}${KODIR}.old/${KERNEL_KO} ; \ fi .endif mkdir -p ${DESTDIR}${KODIR} install -c -m 555 -o root -g wheel \ ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR} I also noticed that you hardcoded "kernel" instead of ${KERNEL_KO}. Yes, I like your idea of not clobbering /boot/kernel.old if that is what kern.bootfile is already set to. Regarding getting the name of the current kernel.. It shouldn't have to be fetched. Bruce pointed out in another reply that there are a couple of things that are not going to be happy in a post-kld world. savecore(8) is probably the only legitimate user of it since it runs at boot and presumably before the user has had a chance to build/install a new kernel anyway. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message