Subject: Success in unprivileged domain
To: None <port-xen@netbsd.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: port-xen
Date: 03/08/2005 13:04:21
Hi.

Finaly I was successful to get NetBSD runing in a unprivileged domain.
(I have to run Linux in domain 0 for now due to non NetBSD related
reasons.)

This was a bit tricky, so I'll line up in short how I did it:
CVSed latest source from bouyer-xen2 branch.
Build a complete i386 release.
Build XEN und XEN-INSTALL kernels from src/sys/arch/xen/conf useing
nbconfig and nbmake-i386 directly circumventing build.sh.
When the XEN-INSTALL kernel was ready I run 
mdsetimage netbsd $OBJDIR/i386/distrib/i386/floppies/ramdisk-big/ramdisk-big.fs

On the target machine I created a 1 GB disk image file and set up a
domain like this:
kernel = "/xen/XEN-INSTALL"
memory = 64
name = "netbsd"
nics = 1
disk = ['file:/xen/netbsd.img,sda,w']

Booting this I got the usual i386 sysinst. Unfortunately sysinst doesn't
know about the xbd(4) disks so it said somthing like "Could not find any
disk to install to."

I exited sysinst and did the install by hand:
cd /dev and mknod all xbd0[a-h] and rxbd0[a-h] device nodes (block and char 
major 142, minor 0..7)
fdisk xbd0
disklabel -Ii xbd0
newfs /dev/rxbd0a
newfs /dev/rxbd0e
mount -o softdep /dev/xbd0a /mnt
mkdir /mnt/usr
mount -o softdep /dev/xbd0e /mnt/usr
ifconfig xennet0 ...
mount nfsserver:/netbsd/i386/binary/sets /mnt2
cd /mnt
for a in /mnt2/*.tgz ; do pax -rzpe -f $a ; done
cd /mnt/dev && ./MAKEDEV all
mknod all xbd0[a-h] and rxbd0[a-h] device nodes by hand in /mnt/dev
halt

I changed the domain configuration file to use the XEN kernel insted the
XEN-INSTALL kernel, booted the new instaled domain and got to single
user mode. I did basic system configuration (/etc/fstab, /etc/rc.conf),
reboot(8) and got a usable multi user system.

Two things:
1. The i386 sysinst should be made aware of the xen devices.
2. When I use "xm console ..." to connect to the console device of the
NetBSD domain the console looses characters. I.e. fast input like
pasting with X11 doesn't echo the characters. But the NetBSD system got
all characters, pressing <ENTER> after a pasted command executes the
command correctely. Fast screen output like in vi(1) lead to a garbled
screen. CTRL-L did help most of the time. ssh(1) connections are fine,
minus PAM... But PAM is an other story. ;-)
-- 



tschüß,
         Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/