Wednesday, April 7, 2010

Compiling Xen from sources on Debian

Some one explained me in detail on community so I am forwarding same here
This guide will explicate in detail about the procedure for compiling
vanilla kernel from source and customize it according to your hardware
specifications and then compiling latest XEN from source and patching
it with Linux.
First install these packages:

sudo apt-get install iproute bridge-utils gcc make gettext
sudo apt-get install libcurl4-openssl-dev è openssl
sudo apt-get install python-dev zlib1g-dev bcc libsdl-dev pciutils-dev
è zlib

First we will compile latest XEN Hypervisor from source.

Go to and download the
latest XEN hypervisor from there. [Version 3.4.1 at the time of
writing the guide]
Xen 3.4.1 is available WITH and WITHOUT 2.6.18 dom0 kernel. We need
the version without dom0 linux because we will compile our own vanilla
I am seting up XEN 3.4.1 on amd64 hardware and running debian
distribution on it with upgraded kernel.
My hardware specifications:
unme -a
Linux -04 #1 SMP Wed Oct 21 16:35:11 BST
2009 x86_64 GNU/Linux
Build / Install Xen

1. mkdir /home/tapas/xen
2. cd /home/tapas/xen
3. tar -xzf xen-3.4.1
4. cd xen-3.4.1
5. make xen
6. make install-xen
7. make tools
8. make install-tools

Build Vanilla kernel
Now we will build th PV_Ops Kernel. The Vanilla kernel source will be
downloaded from Jeremy's tree. Jeremy's git tree on
contains the pv_ops dom0 patches. If we use Jeremy's tree then we do
not any extra patches to bind XEN with kernel source.

1. mkdir /home/tapas/linux
2. cd /home/tapas/linux
3. git clone git://
4. linux-2.6-xen
5. cd linux-2.6-xen
6. git checkout origin/xen/master -b xen/master
7. make menuconfig [see Note below]
8. make-kpkg clean
9. CONCURRENCY_LEVEL=N fakeroot make-kpkg --initrd
--append-to-version=-custom kernel_image kernel_headers
10. This will make the debian packages in the parent directory which
you can install

Note: Please choose the following xen specific optiions in kernel configuration.

Processor type and features ---> Subarchitecture Type (PC-compatible)
---> (X) Enable Xen compatible kernel
Bus options (PCI etc.) ---> [*] PCI support
[*] Xen PCI Frontend
[ ] Xen PCI Frontend
Debugging (NEW)
Device Drivers ---> XEN ---> [*] Privileged Guest (domain 0)
<*> Backend driver support (NEW)
<*> Block-device
backend driver (NEW)
<*> Block-device tap
backend driver (NEW)
<*> Network-device
backend driver (NEW)
(8) Maximum
simultaneous transmit requests (as a power of 2) (NEW)
[ ] Pipelined
transmitter (DANGEROUS) (NEW)
< > Network-device
loopback driver (NEW)
<*> PCI-device
backend driver (NEW)
PCI Backend
Mode (Virtual PCI) --->
[ ] PCI
Backend Debugging (NEW)
< >
TPM-device backend driver (NEW)
SCSI backend driver (NEW)
< > TPM-device backend driver (NEW)
SCSI backend driver (NEW)
Block-device frontend driver
Network-device frontend driver
Network-device frontend driver
acceleration for Solarflare NICs (NEW)
SCSI frontend driver (NEW)
<*> User-space granted page access driver (NEW)
<*> Framebuffer-device frontend driver (NEW)
<*> Keyboard-device frontend driver (NEW)
[*] Disable serial port drivers (NEW)
<*> Export Xen attributes in sysfs (NEW)
(256) Number of guest devices (NEW)
Xen version compatibility (3.0.4
and later) --->

After xen confiuration, please make sure that .config has the
following parameter configuration:



Install these debian packages using
sudo dpkg -i
Add the following line to /etc/fstab

none /proc/xen xenfs defaults 0 0

and reboot the machine.

After installing the debian packages, the Grub Entry will look like
the following:
title Xen 3.4.1 / Debian GNU/Linux, kernel
root (hd0,0)
kernel /boot/xen-3.4.1.gz
module /boot/vmlinuz- root=/dev/sda1 ro
module /boot/initrd.img-

Hope that will help.
If you want to look at original post then here is a link
Note that file-backed VBDs may not be appropriate for backing I/O-intensive domains. File-backed VBDs are known to experience substantial slowdowns under heavy I/O workloads, due to the I/O handling by the loopback block device used to support file-backed VBDs in dom0. Better I/O performance can be achieved by using either LVM-backed VBDs (Section 6.3) or physical devices as VBDs (Section 6.1).

No comments: