Testing FreeBSD PVHVM: Difference between revisions
(Created page with "This guide will explain how to setup a FreeBSD PVHVM for testing purposes. It is assumed that the user has a working Dom0 with the xl toolstack. ===Setting up a FreeBSD HVM=== …") |
No edit summary |
||
Line 66: | Line 66: | ||
# git clone git://xenbits.xen.org/people/royger/freebsd.git |
# git clone git://xenbits.xen.org/people/royger/freebsd.git |
||
# cd freebsd |
# cd freebsd |
||
# git checkout |
# git checkout pvhvm_v7 |
||
</pre> |
</pre> |
||
Revision as of 09:46, 18 May 2013
This guide will explain how to setup a FreeBSD PVHVM for testing purposes. It is assumed that the user has a working Dom0 with the xl toolstack.
Setting up a FreeBSD HVM
To speed things, we will use a FreeBSD-HEAD snapshot ISO to install the guest, since the changes are based on FreeBSD-HEAD, this will prevent us from setting a stable version and then doing a full update to HEAD. First grab a FreeBSD-HEAD ISO, they can be found in FreeBSD ftp servers under the path snapshots/ISO-IMAGES/amd64/10.0/ (replace amd64 with i386 if you wish to test 32bit support). Fetch and save one of this ISOs.
Now we need to setup the guest config file, here is an example:
boot="cd" disk = [ 'phy:/dev/guests/freebsd,hda,w', 'file:/root/freebsd-10.iso,hdc:cdrom,r', ] vif = ['mac=00:AA:BB:CC:DD:EE,bridge=bridge0'] memory=4096 vcpus=7 name = "freebsd" xen_platform_pci=1 builder='hvm' vnc=1 vnclisten="0.0.0.0" serial='pty'
Change the disk and vif options to match your paths. Once done, the guest can be launched:
# xl create freebsd.cfg
Connect to the guest using a vnc client and follow the installation process. Once finished, we will configure FreeBSD to use the serial console, so we no longer need to use a vnc client. This process is detailed in The FreeBSD Handbook, we have to edit /boot/loader.conf and add the following lines:
boot_multicons="YES" boot_serial="YES" comconsole_speed="115200" console="comconsole,vidconsole"
This will allow us to get the boot output to the serial console, now we need to setup the seria tty, to do so edit /etc/ttys and search for the line that starts with:
ttyu0 "/usr/libexec/getty std.115200" dialup on secure
Set it to "on" as shown above and change the baudrate. We are done with the setup, on next reboot of the guest you should be able to get the boot output and a terminal using "xl console freebsd".
Fetching the sources and installing the PVHVM kernel
In order to test the new code, you will need git to fetch the sources, this can be installed using ports:
# cd /usr/ports/devel/git # make config-recursive install clean clean-depends
Once git is installed, you can fetch the source:
# git clone git://xenbits.xen.org/people/royger/freebsd.git # cd freebsd # git checkout pvhvm_v7
It is recommended to add the option "ALT_BREAK_TO_DEBUGGER" to the XENHVM config file, so you can easily break to KDB from the serial console. We can proceed with the kernel compilation and install now:
# make kernel-toolchain && make buildkernel KERNCONF=XENHVM && make installkernel KERNCONF=XENHVM
Before rebooting into the new XENHVM kernel, you should add the following line to /etc/rc.conf:
# echo ifconfig_xn0="DHCP" >> /etc/rc.conf
And change the devices in /etc/fstab:
# Device Mountpoint FStype Options Dump Pass# /dev/ad0p2 / ufs rw 1 1 /dev/ad0p3 none swap sw 0 0
Notice that ada0p2 is changed to ad0p2 and so on. With this changes you can now reboot into the FreeBSD PVHVM, happy testing!