Subject: Re: First boot in domain0.
To: Juan RP <juan@xtraeme.unixbsd.org>
From: Christian Limpach <chris@pin.lu>
List: port-xen
Date: 04/27/2004 16:40:05
Hi,

On Tue, Apr 27, 2004 at 03:34:57PM +0200, Juan RP wrote:
> > > To load the NetBSD/Xen, enter the following in the grub shell:
> > > 
> > > grub> configfile /grub/menu.lst
> > 
> > Can't you make it load this by default?  Grub seems to do so when installed
> > on a disk!?
> 
> Doesn't work! I don't know why, I think you have to install grub to see the
> menu directly, but as it's a cdrom no idea if we could make this.

I think it's looking for menu.lst in /boot/grub.  How do you install
grub to the cdrom?  grub-install includes code to set the grub prefix on
NetBSD to /grub and I'd guess that if you don't install using grub-install
it will default to /boot/grub.
 
> I have another question... do I have to mount /kern with kernfs for the
> xentools12?

yes, /kern should have a xen subdirectory with the following files:
qube# ls -l /kern/xen/*
-r--------  1 root  wheel  0 Apr 27 17:55 /kern/xen/machmem
-r--------  1 root  wheel  0 Apr 27 17:55 /kern/xen/privcmd
-r--------  1 root  wheel  0 Apr 27 17:55 /kern/xen/vfr

Once you have a kernel with /kern/xen, you should be able to start
additional domains like this:
# xc_dom_create.py -f netbsd-disk -D 'vmid=1;ip=172.20.4.19' -m 32 -k \
/path/to/XEN/netbsd

netbsd-disk is a config file for the xc_dom_create.py tool.  It's
almost like the one from the pkgsrc package (/usr/pkg/etc/xc12/netbsd)
with the following changes:

--- netbsd	2004-04-22 05:42:07.000000000 +0200
+++ netbsd-disk	2004-04-27 18:05:45.000000000 +0200
@@ -73,6 +73,7 @@
 #vbd_list = [ ('phy:sda%d'%(7+vmid),'sda1','w' ), 
 #	     ('phy:sda6','sda6','r') ]
 
+vbd_list = [ ('phy:wd0i','hda1','w') ]
 
 
 # STEP 5b. Set the VBD expertise level.  Most people should leave this
@@ -103,7 +104,8 @@
     cmdline_root = "nfsroot="+nfsserv+":/netboot/netbsd"
     #cmdline_root = "nfsroot=/full/path/to/root/directory"
 
-cmdline_extra = "bootdev=xennet0"
+#cmdline_extra = "bootdev=xennet0"
+cmdline_extra = "bootdev=wd0a"
 
 
 # STEP 7. Set according to whether you want the script to watch the domain 


The vbd_list defines disks/partitions for the created domain.  The
definition in the example exports partition /dev/wd0i to the created
domain, allows write acces and makes it show up as an IDE device, the
only information parsed out of hda1 for NetBSD domains is that it's an
IDE device (using sda1 would make it show up as a SCSI device).  Also
the order in which the partitions are listed matters.  In a NetBSD
domain, each exported partition will show up as a separate disk.  For
the example this means that partition wd0a will show up as device
wd0 with partitions wd0a and wd0d (like any disk without as disklabel).
The cmdline_extra's bootdev=wd0a makes the created domain use its wd0a
device as root device.

The xc_dom_create.py command should give output like this:
Parsing config file 'netbsd-disk'
/usr/pkg/lib/python2p3/site-packages/XenoUtil.py:115: FutureWarning: x<<y losing bits or changing sign will return a long in Python 2.4 and up
  a = ( (string.atoi(l[0])<<24) | (string.atoi(l[1])<<16) |
VM image           : "/devel/netbsd/src-current-xen/compile/XEN/netbsd"
VM ramdisk         : ""
VM memory (MB)     : "32"
VM IP address(es)  : "172.20.4.19; 169.254.1.1"
VM block device(s) : "phy:wd0i,hda1,w"
VM cmdline         : "ip=172.20.4.19:169.254.1.0:172.20.1.1:255.255.128.0::eth0:off nfsroot=169.254.1.0:/netboot/netbsd bootdev=wd0a"
VM started in domain 4

Now to get the domain's console output you'll need the xen_read_console
tool (from xentools12/work/xeno-1.2/tools/misc, it's not built in my
package but compiles without any changes).  You'll have to add the
IP address 169.254.1.0 as an alias in domain0 (ifconfig xennet0 alias
169.254.1.0) and you should then see the created domain's console
output if you run xen_read_console.

    christian