Installing Xen on NetBSD-5 on VMWare Player
July 26th, 2009I gave up installing Xen since I can’t find any vmx|svm flags on my debian’s /proc/cpuinfo and/or since I have been unable to make Xen to work on it. The last installation hanged at booting domO process. I can’t remember what the error messages were.
Then I found this awesome page about netbsd/xen. Combining the info from this page with some trial and error processes of getting the configuration files right, I finally managed to get NetBSD dom0 and domU running.
Installing dom0
- Install NetBSD-5 to vmware player as usual (use www.easyvmx.com to get vmplayer config and virtual disks)
- Install the followings using pkg_add:
sysutils/grub
sysutils/xentools3
sysutils/xenkernel3
sysutils/e2fsprogs - cp /usr/pkg/share/examples/rc.d/xen* /etc/rc.d
- vi /etc/rc.conf
xend=YES
xenbackendd=YES
xendomains=YES - cd /dev
sh MAKEDEV xen - Get “netbsd-XEN3_DOM0.gz” from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
- Backup original netbsd kernel
cp /netbsd /netbsd.old - gunzip netbsd-XEN3_DOM0.gz
mv netbsd-XEN3_DOM0 /netbsd - cp /usr/pkg/xen3-kernel/xen.gz /
cd /
gunzip xen.gz - mkdir /grub
vi /grub/menu.lst
default=0
timeout=5
title XEN3
root(hd0,0)
kernel (hd0,a)/xen dom0_mem=128M
module (hd0,a)/netbsd bootdev=wd0a ro console=pc
title NetBSD
root (hd0,0,a)
kernel /netbsd.old - grub-install ‘(hd0)’
- grub –no-floppy
root (hd0,a)
setup (hd0)
quit - vi /etc/ifconfig.bridge0
create
!brconfig $int add pcn0 up # replace pcn0 with your shared network interface. - cd /dev
sh MAKEDEV all
sh MAKEDEV xen - shutdown -r now
Installing self-made domU
- You need to mount the NetBSD-5 installation cd
mkdir /mnt/cdrom
mount /dev/cd0a /mnt/cdrom - Make a directory to contain NetBSD-5 sets
mkdir /root/lala - Make a directory to contain domU kernel
mkdir /root/kernels - Get netbsd-XEN3_DOMU.gz from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
- cp netbsd-XEN3_DOMU.gz /root/kernels
cd /root/kernels
gunzip netbsd-XEN3_DOMU.gz - Extract NetBSD sets:
tar xzpfe /mnt/cdrom/i386/binary/sets/kern-XEN_DOMU… -C /root/lala
tar xzpfe /mnt/cdrom/i386/binary/sets/base.tgz -C /root/lala
tar xzpfe /mnt/cdrom/i386/binary/sets/comp.tgz -C /root/lala
(… and the rest) - cd /root
makefs -M 1073741824 lala.ffs lala
(Note. 1G=1073741824 and 2.5G=2684354560) - A flat swap
dd if=/dev/zero of=lala/swap bs=1024 count=400 - mv lala lala.old
mkdir lala
vnconfig vnd0 lala.ffs
mount /dev/vnd0a lala - vi lala/etc/fstab,
/dev/xbd0a / ffs rw 1 1
/swap none swap sw 0 0
kernfs /kern kernfs rw
procfs /proc procfs rw,noauto - vi /etc/rc.conf
rc_configured=YES
hostname=blah
dhclient=YES
sshd=YES
(… etc) - vi /usr/pkg/etc/xen/nbsd
kernel = “/root/kernels/netbsd_XEN3_DOMU”
memory = 256
name = “nbsd”
vif = [ 'bridge=bridge0' ]
disk = ['file:/root/lala.fs,0x01,w']
root = “xbd0″ - To make nbsd domain start at boot
vi /etc/rc.conf
xendomains=”nbsd” # edit this line add your domains separated by space instead of “YES” - shutdown -r now
Now, you should have NetBSD dom0 and domU running at boot. Use “xm list” to list domains and “xm console ID” to access domU console.
I am new to UNIX, follow above instructions at your own risk.
References:
NetBSD/xen Howto : www.netbsd.org/ports/xen/howto.html
Xen on NetBSD : www.gutch.de/NetBSD/docs/xen.html
http://pbraun.nethence.com/doc/sysutils/xen_netbsd.html