What is Xen ?
Xen is an hypervisor, a thin software layer executing multiple virtual machines, each running its own operating system. Xen is normally used as a server virtualization platform, running on headless servers without graphical console and controlled through the network. However it is also possible to run Xen on graphical desktops, and with proper hardware virtualization, to dedicate the primary graphics card (and keyboard / mouse) to a virtual machine, making it possible to have high performance full 3D and video acceleration in a virtual machine (see Xen VGA Passthru). Xen is otherwise free and open source.
Xen runs on Intel X86 hardware and requires a processor and motherboard supporting VT-x and optionally VT-d for hardware virtualization. See this page for a list of Intel compatible motherboards and chipsets and this page for a list of compatible processors. Our system running Xen successfully at the time of this writing (June 2012) is based on a DZ77GA70K Intel motherboard, an Intel® Core™ i7-3770 Processor (the overclockable i7-3770 "K" model does not afford virtualization), 32 Gb of PC12800 memory and an MSI GeForce G210 graphics board.
Although the software itself works well and is pretty straighforward, good quality Internet information is missing. The volume of information on the Xen wiki is plethoric, but mostly irrelevant as pertaining to old versions of everything. Building the big picture requires interpretation of tiny bits in forum messages, a pretty painful process, although I have to recognize that it worked for me in the end. An alternative is to use one of these old-style information repositories named "books". Yes it is pretty old-fashionned ;) but actually there are good ones on the topic. Here is the most recent I found, it is a good value but of course you can find more on amazon(.co.uk).
To make a long story short, at the time of this writing (June 2012) working with nVidia graphic boards on Xen and X11 requires the "nouveau" driver. Other drivers like nv or the nVidia proprietary driver do not support Xen and switch off the screen when launched or do not display properly. "Nouveau" requires a fairly recent version of X11. Slackware 13.37 or newer is required. "Nouveau" is available in kernel 3.4.2 upstream and was previously included as a staging driver. Xen dom0 support was included in kernel 3.0. To benefit from both Xen and "Nouveau", the best is to use kernel 3.4.2 upstream.
Xen requires acpica. Download then install as below :
# tar -C /usr/local -xvf acpica-unix-yyyymmdd.tar.gz # cd /usr/local # chown -R root:root acpica-unix-yyyymmdd # cd acpica-unix-yyyymmdd # make # make install # make clean
Xen requires yajl. Download then install as below. Note : there is no option to specify the target library directory so the files need to be moved manually.
# tar -C /usr/local -xvf lloyd-yajl-x.y.z.f4b2bla.tar.gz # cd /usr/local # chown -R root:root lloyd-yajl-f4b2bla # cd lloyd-yajl-f4b2bla # ./configure # make # make install # make clean # cd ../lib # mv yajl* ../lib64
Download Xen from the official xen.org site. Note : File stubs-64.h is missing in the compiler includes so we add a link to the existing stubs-32.h. Also, some Xen Python scripts are installed in /usr/local/lib64/python-2.7/site-packages which python cannot find so we add links from the standard library as well.
# cd /usr/include/gnu # ln -s stubs-64.h stubs-32.h # cd # tar -C /usr/local -xvf xen-x.y.z.tar.gz # cd /usr/local # chown -R root:root xen-x.y.z # cd xen-x.y.z # ./configure --libdir=/usr/local/lib64 # make world # make install # make clean # cd ../lib64/python2.7/site-packages # ln -s xen /usr/lib64/python2.7/site-packages # ln -s xen-3.0-py2.7.egg-info /usr/lib64/python2.7/site-packages
Xen needs a couple of daemons to run to ensure VM management. Add these lines to rc.local and rc.local_shutdown :
PATH=/usr/local/sbin:/usr/local/bin:$PATH export PATH # start xencommons if [ -x /etc/init.d/xencommons ]; then /etc/init.d/xencommons start fi # start xend if [ -x /etc/init.d/xend ]; then /etc/init.d/xend start fi
# stop xend if [ -x /etc/init.d/xend ]; then /etc/init.d/xend stop fi # stop xencommons if [ -x /etc/init.d/xencommons ]; then /etc/init.d/xencommons stop fi
Compiling a dom0 Kernel
Domain-0 (dom0 for short) is a special guest (virtual machine) that the Xen hypervisor always loads on host startup. Dom0 is used to control and manage the Xen hypervisor, and provides virtual disks and networks for other unprivileged guests (=domUs). Dom0 support was introduced in Linux kernel 3.0. The kernel generated must include the .config file domU and dom0 options. Here is a minimal example of such a .config dom0 file. Feel free to use it as a base, replacing device drivers as required. The rest of the kernel compilation is nominal :
# tar -C /usr/src -xvf linux-3.18.9.tar.bz2 # cd /usr/local # rm linux # ln -s linux-3.18.9 linux # cd linux # make menuconfig # make # make modules_install # cp arch/x86_64/boot/bzImage /boot/vmlinuz-3.18.9-dom0 # cp System.map /boot/System.map-3.18.9-dom0 # cp .config /boot/config-3.18.9-dom0
We're now all set up, Xen is ready to be booted by grub2 !
|Compiling from Source||Main Page||Compiling Grub2|