View Full Version : installkernel without creating kernel.old
FestusHagen
January 15th, 2009, 01:37
How can one change the creation location of kernel.old or prevent it's creation when doing "make installkernel"??
Not enough disk space, and I have already created a backup elsewhere.
Thanks
-Enjoy
fh : )_~
trev
January 15th, 2009, 11:26
I'm guessing wildly, but perhaps 'make reinstallkernel' after a 'make buildkernel' would do what you want. Let us know :)
mk
January 15th, 2009, 12:20
didn't fully tested but you can try memory fs
mkdir /boot/kernel.old/
dd if=/dev/zero of=/usr/krn.old count=128 bs=1m
mdconfig -at vnode -f /usr/krn.old -u 33
newfs /dev/md33
mount /dev/md33 /boot/kernel.old
#after finish make installkernel unmount
#and then delete memdevice 33
mdconfig -du 33
FestusHagen
January 15th, 2009, 20:00
didn't fully tested but you can try memory fs
mkdir /boot/kernel.old/
dd if=/dev/zero of=/usr/krn.old count=128 bs=1m
mdconfig -at vnode -f /usr/krn.old -u 33
newfs /dev/md33
mount /dev/md33 /boot/kernel.old
#after finish make installkernel unmount
#and then delete memdevice 33
mdconfig -du 33
This doesn't work, It fails with:
rm: /boot/kernel.old: Device busy
Though trying it gave me some hints on where to look for the code that handles the backup, thus finding it in:
/usr/src/sys/conf/kern.post.mk
and thus was able to mod and accomplish the goal.
Thanks
-Enjoy
fh : )_~
mk
January 15th, 2009, 20:38
i test my idea and get too device busy message, but kernel install nice and boot/reboot with success 2 times.
how did you figure out which exact file to look since when i read your post try (not that hard) to see is any such option to point where to be moved kernel.old?
FestusHagen
January 17th, 2009, 18:04
i test my idea and get too device busy message, but kernel install nice and boot/reboot with success 2 times.
how did you figure out which exact file to look since when i read your post try (not that hard) to see is any such option to point where to be moved kernel.old?
There was no _option_, I just changed the relevant code in /usr/src/sys/conf/kern.post.mk to point to another location.
The lines with ".old" are the relevant code:
kernel-install:
@if [ ! -f ${KERNEL_KO} ] ; then \
echo "You must build a kernel first." ; \
exit 1 ; \
fi
.if exists(${DESTDIR}${KODIR})
-thiskernel=`sysctl -n kern.bootfile` ; \
if [ ! "`dirname "$$thiskernel"`" -ef ${DESTDIR}${KODIR} ] ; then \
chflags -R noschg ${DESTDIR}${KODIR} ; \
rm -rf ${DESTDIR}${KODIR} ; \
else \
if [ -d ${DESTDIR}${KODIR}.old ] ; then \
chflags -R noschg ${DESTDIR}${KODIR}.old ; \
rm -rf ${DESTDIR}${KODIR}.old ; \
fi ; \
mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old ; \
sysctl kern.bootfile=${DESTDIR}${KODIR}.old/"`basename "$$thiskernel"`" ; \
fi
.endif
-Enjoy
fh : )_~
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.