创建storage

$ sudo lvcreat -L 4096M -n netbsd-i386 domU

下载netbsd的xenified kernel

$ wget http://ftp.jaist.ac.jp/pub/NetBSD/NetBSD-5.1/i386/binary/kernel/netbsd-INSTALL_XEN3PAE_DOMU.gz /etc/xen/domU/netbsd5.1/i386/
$ wget http://ftp.jaist.ac.jp/pub/NetBSD/NetBSD-5.1/i386/binary/kernel/netbsd-XEN3_DOMU.gz /etc/xen/domU/boot/netbsd5.1/i386/
$ sudo zcat netbsd-INSTALL_XEN3PAE_DOMU.gz > netbsd-INSTALL_XEN3PAE_DOMU
$ sudo zcat netbsd-XEN3PAE_DOMU.gz > netbsd-XEN3PAE_DOMU

创建domU配置文件(启动)

/etc/xen/domU/netbsd-i386.cfg
kernel = "/etc/xen/domU/netbsd5.1/i386/netbsd-INSTALL_XEN3PAE_DOMU"
memory = 512
name = "netbsd"
vif = [ 'mac=00:16:3e:00:00:11, bridge=eth0' ]
disk = [ 'phy:/dev/domU/netbsd-i386,hda,w' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

安装

$ sudo xm create netbsd-i386.cfg -c

接着根据步骤来安装操作系统,在安装的过程中需要注意的是:

  1. 当出现network media type的时候,直接回车;

  2. 当需要选择安装源的时候,默认的是ftp.netbsd.org,可以改成日本源ftp.jaist.ac.jp,这样会更快一些。

安装结束后,先不忙着重启,需先执行以下操作:

选择e: Utility menu,然后a: Run /bin/sh,接着执行以下指令:

mount /dev/xbd0a /mnt
cp -pR /dev/rxbd* /mnt/dev
cp -pR /dev/xbd* /mnt/dev
halt -p

修改domU配置文件(启动)

/etc/xen/domU/netbsd-i386.cfg
...
# kernel = "/etc/xen/domU/netbsd5.1/i386/netbsd-INSTALL_XEN3PAE_DOMU"
kernel = "/etc/xen/domU/netbsd5.1/i386/netbsd-XEN3PAE_DOMU"
...

安装后的修葺工作

启动后会出现:

/dev/ttyEcfg: Device not configured

的错误提示,这时候需要调整/etc/ttys和/etc/wscons.conf这两个文件

修改ttys文件

/etc/ttys
console "/usr/libexec/getty Pc"         vt100   on  secure
ttyE0   "/usr/libexec/getty Pc"         vt220   off secure
ttyE1   "/usr/libexec/getty Pc"         vt220   off secure
ttyE2   "/usr/libexec/getty Pc"         vt220   off secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure

修改wscons.conf文件

/etc/wscons.conf
#screen 0       -       vt100
#screen 1       -       vt100
#screen 2       -       vt100
#screen 3       -       vt100
#screen 4       -       -
#screen 4       80x25bf vt100

至此,netbsd5.1-i386 domU就安装完成,netbsd5.1-amd64 domU也可以完全遵照本流程成功安装。