Adrian's Xen Images
Overview
These Xen DomU images are provided purely to make it easier for people to evaluate the FreeBSD/Xen DomU support and provide feedback to the FreeBSD developers.
Please email freebsd-xen@freebsd.org with feedback about these images; do not contact Adrian or other developers directly.
More information about the workings of all of this can be found at ../XenHackery.
What are these images?
These images are the result from a make buildworld/buildkernel/installworld/installkernel/distribution. There is a little bit of customisation to make them work as a FreeBSD Xen DomU.
The image contains a complete base system (with all tardists installed; but no source, no ports, no X11 and no packages.) The images default to booting to single user mode unless otherwise indicated.
They are intended to be self-contained and boot vi "pygrub".
How did you build them?
- make buildworld/buildkernel/installworld/installkernel/distribution with KERNCONF=XEN, relevant MAKEOBJDIRPATH and DESTDIR
- customise etc/ttys
- customise etc/fstab
- customise boot/grub/menu.lst
- for FreeBSD-6.x, create boot/device.hints
Then! I run "makefs" (from NetBSD, and sysutils/makefs) which creates a basic FFS image from a directory tree. For example,
# makefs -M 512m root.img /path/to/destdir # gzip -9 root.img
The build/install script can be found here: http://people.freebsd.org/~adrian/xen/build.sh .
Note that I am currently manually building the disk images.
How does it boot?
These images use "pygrub", the python GRUB bootloader provided with Xen. This reads the filesystem image enough to extract the kernel, ramdisk (remember this is all primarily designed for Linux!) and the config file. It then copies these to the Xen management code so it can assemble the virtual domain and start it.
Pygrub will read /boot/grub/menu.lst from the first filesystem listed in the xen configuration file.
The shipped images contain two boot options, both booting /boot/kernel with the root device on "/dev/xbd0". One is a multi-user boot, one is a single-user boot. The choice is selected by "default=" in the menu.lst file. Note that this starts from 0, so "0" is the first option and "1" is the second option.
The reason they boot to single user mode is so you get the opportunity to enable softupdates, run growfs, etc, before you run the system live.
How is it configured?
The images are configured with two block devices in /etc/fstab - root on /dev/xbd0 and a (disabled) swap device on /dev/xbd1. The grub config tells the kernel to boot from /dev/xbd0. This is a filesystem image and NOT a DOS/GPT disk image.
The xen block device configuration for this requires the use of device numbers. 0xCA00 is xbd0, 0xCA10 is xbd1, 0xCA20 is xbd2, etc.
disk = [ 'phy:/dev/hosting_2_D1/XEN_freebsd2_root,0xCA00,w', 'phy:/dev/hosting_2_D1/XEN_freebsd2_swap,0xCA10,w' ]
As mentioned before, the basic pygrub required boot config is in /boot/grub/menu.lst .
The xen console (xc0) is added to /etc/ttys and enabled; you can use "xm console" from the Dom0 domain to control the VM.
How do I install and use the images?
- Grab the config file and image
- Uncompress the image
- If you use LVM (like I do in the config file), just create a logical volume dd the file image into it
- Create a swap file or LVM logical volume
- Modify the config file as appropriate (set MAC address, path to the physical device, or modify it to use a file instead)
- run "xm create -c /path/to/config/file"
- select the appropriate boot in the pygrub menu
It should boot to single user mode (unless the image states otherwise.)
What then?
You can grab the source via Subversion.
FreeBSD-current: http://svn.freebsd.org/base/head
FreeBSD-6.3-RELEASE Xen branch: http://svn.freebsd.org/base/projects/release_6_3_xen/
FreeBSD-RELENG_6 Xen branch: http://svn.freebsd.org/base/projects/releng_6_xen/
FreeBSD-RELENG_7 Xen branch: http://svn.freebsd.org/base/projects/releng_7_xen/
You can do this inside the Xen VM and rebuild world/kernel yourself. Just make sure you use the "XEN" kernel configuration (make buildworld KERNCONF=XEN ; make installworld KERNCONF=XEN) or it won't boot.
You can also use growfs, tunefs (to enable softupdates) from inside the VM as long as you've booted into single user mode. Edit /boot/grub/menu.lst and change the default to boot the single user mode entry.
FreeBSD-current images
Example configuration: http://people.freebsd.org/~adrian/xen/freebsd_current.sxp
http://people.freebsd.org/~adrian/xen/root-head-r192577.img.gz
- defaults to multi-user boot
- There's a bug which crashes the VM after running "gstat" and quitting (a badly mapped VM page perhaps.)
http://people.freebsd.org/~adrian/xen/root-head_r193475.img.gz
- Defaults to single-user boot
- Same VM bug as above
FreeBSD-6.3-RELEASE images
http://people.freebsd.org/~adrian/xen/release_6_3_r188351.img.gz
- Defaults to single-user boot
FreeBSD-RELENG_6 images
I haven't yet built a stable image.
FreeBSD-RELENG_7 images
I haven't yet successfully built an image.