FreeBSD PVH

From Xen
Revision as of 17:26, 22 November 2013 by Royger (talk | contribs)
Jump to navigationJump to search

This guide explains how to set up a FreeBSD PVH guest. The usage of PVH requires an Intel chip with EPT support.

This guide assumes that the user already has a working FreeBSD HVM amd64 guest installed, based on HEAD, and a Xen install using -unstable with a revision greater than b5dda35f5aa3ab5c7be2333a8a4e0cfa34226654.

Compiling the kernel

In order to compile a FreeBSD PVH capable kernel, we need to fetch the sources first (this should be done inside of the existing FreeBSD guest):

# git clone git://xenbits.xen.org/people/royger/freebsd.git /usr/src
# cd /usr/src
# git checkout pvh_v5

Note that at time of writing the most recent branch is pvh_v5 (this can change, so always look for the latest branch).

Now we can start the kernel compile process as usual:

# cd /usr/src
# make kernel-toolchain
# make buildkernel

Then, we need to copy the resulting /usr/obj/usr/src/sys/GENERIC/kernel kernel to the Dom0.

Finally, the following line has to be added to /etc/ttys:

xc0 	"/usr/libexec/getty Pc"         xterm   on  secure

And /etc/fstab should also be modified, in order to use xbd devices:

# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/xbd0p2	/		ufs	rw	1	1
/dev/xbd0p3	none		swap	sw	0	0

Now the FreeBSD HVM guest can be stopped, and we need to modify the configuration file so it looks like:

kernel = "/path/to/kernel"
extra="vfs.root.mountfrom=ufs:/dev/xbd0p2"

disk = [
	'phy:/path/to/block/device,xvda,w',
	]

vif = ['bridge=bridge0,mac=00:ff:ff:ff:ff:ff']

memory=4096
vcpus=2
name = "freebsd_pvh"

pvh=1

The main changes are the removal of the builder option, and the addition of kernel and extra instead. Also note the option pvh=1 must be set in order to boot in PVH mode. Then we can boot into the newly created FreeBSD PVH guest:

# xl create -c freebsd_pvh.cfg