login
Header Space

 
 

Re: vkernel manager

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <kernel@...>
Date: Saturday, February 9, 2008 - 9:06 am

On Feb 9, 2008 7:04 AM, Aggelos Economopoulos <aoiko@cc.ece.ntua.gr> wrote:

Yah, this looks nice. Maybe this should go in somewhere
(/usr/src/tools?). Although I see the value of this script, I tend to
use the same rootimg and vkernel binary with different arguments each
time depending on the scenario I'm trying to build. I also often copy
the rootimg files around to create an instant replica of the virtual
machine.

To create the rootimgs, I use a (rudimentary) script which is
basically just a rip-off from the instructions on the vkernel manpage.

#!/bin/sh

UID=`/usr/bin/id -u`
if [ "x$UID" != "x0" ]; then
	echo "This utility must be run with root privileges."
	exit
fi

ROOTIMG=$1
if [ "x$ROOTIMG" = "x" ]; then
	echo "usage: $0 root_image_file [image_size]"
	exit
fi

IMGSIZE=$2
if [ "x$IMGSIZE" = "x" ]; then
	IMGSIZE=1024M
fi

MOUNTPOINT=/mnt/vkernel

truncate -s $IMGSIZE $ROOTIMG
chmod 664 $ROOTIMG
vnconfig -c -s labels /dev/vn0 ${ROOTIMG}
disklabel -r -w vn0s0 auto
disklabel vn0s0 > /tmp/vdisklabel.txt
echo "  a: * 0 4.2BSD" >> /tmp/vdisklabel.txt
disklabel -R -r /dev/vn0s0 /tmp/vdisklabel.txt
rm -f /tmp/vdisklabel.txt
newfs -i 1024 /dev/vn0s0a
mount /dev/vn0s0a $MOUNTPOINT
make installworld DESTDIR=$MOUNTPOINT
cd etc
make distribution DESTDIR=$MOUNTPOINT
echo "/dev/vn0s0a / ufs rw 1 1" >$MOUNTPOINT/etc/fstab
echo 'console "/usr/libexec/getty Pc" cons25 on secure' >$MOUNTPOINT/etc/ttys
umount $MOUNTPOINT
vnconfig -u /dev/vn0

Its only mandatory argument is the name of the rootimg, with an
optional argument for its size. If the size is not specified, then it
defaults to 1Gb in order to accommodate a full instalworld with debug
symbols.

This is still very rudimentary and could use more arguments
validation. I thought that something like this could be used by some
additional target in /usr/src/Makefile. Something like:
make buildrootimg ROOTIMG=/var/vkernel/rootimg.01 ROOTIMGSIZE=512m
But don't have a formal proposal for it so I never brought it up.
Another use of such a target would be to create a disk image for
dd'ing into a compact flash for embedded applications or so.

Nuno
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
vkernel manager, Aggelos Economopoulos, (Sat Feb 9, 3:04 am)
Re: vkernel manager, Chris Turner, (Sat Feb 9, 12:38 pm)
Re: vkernel manager, Aggelos Economopoulos, (Sat Feb 9, 4:51 pm)
Re: vkernel manager, Nuno Antunes, (Sat Feb 9, 9:06 am)
Re: vkernel manager, Aggelos Economopoulos, (Sat Feb 9, 4:51 pm)
Re: vkernel manager, Nuno Antunes, (Sat Feb 9, 9:09 am)
Re: vkernel manager, Aggelos Economopoulos, (Sat Feb 9, 4:50 pm)
speck-geostationary