1.3.3 Apply Xen patches
Apply all the patches downloaded above following the patch number.
You may need to install patch if it isn’t installed:
# yum install patch
This patch.sh script can be used (we assume the patch and the kernel are in the same directory): patch.sh:
#!/bin/bash
for P in `ls ../xen-patches-2.6.32-2/6*.patch1 | sort`
do
patch -p1 -s -i $P
if [ $? = 0 ]; then
echo $P applied
else
echo "Error processing "$P
exit 1
fi
done
Put this script into Linux source directory(linux-2.6.32.13目录下) and execute:
$ sh ./patch.sh
The structure of these directories are as follows:
▲注:结构如上图。按照patch脚本,Linux-2.6.32.13 和xen=patches-2.6.32-2放在同一个目录。
1.3.4 Configure Xenified Linux kernel
A working configuration file that I used can be downloaded directly from here:
config-for-xenified-linux-2.6.32.13
Just download this file, put it into the kernel source code file directory(linux-2.6.32.13目录下) and rename it to .config.
Other than use my configuration file, you can also configure it by yourself by using “make menuconfig”.
Make sure you build the kernel with these components enabled:
Processor type and features --->
Symmetric multi-processing support
Support sparse irq numbering
Enable Xen compatible kernel
Device Drivers --->
XEN --->
Privileged Guest (domain 0)
Backend driver support (NEW)
Block-device backend driver (NEW)
Block-device tap backend driver (NEW) < > Block-device tap backend driver 2 (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)
< > TPM-device backend driver (NEW)
SCSI backend driver (NEW)
USB backend driver (NEW)
Block-device frontend driver
Network-device frontend driver
Network-device frontend driver acceleration for Solarflare NICs (NEW)
SCSI frontend driver (NEW)
USB frontend driver (NEW)
Taking the HCD statistics (for debug) (NEW)
[ ] HCD suspend/resume support (DO NOT USE) (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 (no compatibility code) --->
Place shared vCPU info in per-CPU storage (NEW) 1.3.5 Build kernel (linux-2.6.32.13目录下)
$ make -jX X can be two times of the number of the processor. We use this to let make invoke compilation work in X-wayparallel.
1.3.6 Install modules and kernel (linux-2.6.32.13目录下)
# make modules_install install
【这一步执行时间很长,中间有停顿现象】 1.4 Configure grub
Add one entry for Xen in /boot/grub/grub.conf. This is an example entry:
# vi /boot/grub/grub.conf
The root and other parameters may be different depending on the configuration.
# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,7)
# kernel /vmlinuz-version ro root=/dev/sda11
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=3
timeout=5
splashimage=(hd0,7)/grub/splash.xpm.gz
hiddenmenu
title Xen 3.4.3 -Xenified Linux 2.6.32.13
root (hd0,7)
kernel /xen-3.4.3.gz console=vga vga=ask noreboot
module /vmlinuz-2.6.32.13 ro root=UUID=7329a86e-6254-48ab-a084-69fed3fc6881 nomodeset LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
module /initramfs-2.6.32.13.img
1.5 Make Xend and Xendomains services automatically start when system boots
# cd /etc/init.d/
# chkconfig --add xend
# chkconfig --add xendomains
Check whether Xend and Xendomains services are automatically started in level 3-5:
# chkconfig --list | grep xend
It should be like this: