分类: LINUX
2011-04-23 13:20:34
apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended pciutils-dev mercurial build-essential make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev iasl libbz2-dev e2fslibs-dev git-core uuid-dev ocaml ocaml-findlib libx11-dev bison flex xz-utils gcc-multilib liblzma-dev lzma lzma-dev python-lzma -Vy
wget
tar -zxvf xen-4.1.0.tar.gz
cd xen-4.1.0
make xen
make tools
make stubdom
After the compilation is done, you will have the Xen hypervisor/tools binaries located at “dist” folder.
make install-xen
make install-tools PYTHON_PREFIX_ARG=
make install-stubdom
Now you are done with the Xen compilation and installation steps. The next thing you need is to build a Xen kernel. In my case I built one with Dom0 and DomU support.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
cd linux-2.6-xen
git reset --hard
git checkout -b xen/stable-2.6.32.x origin/xen/stable-2.6.32.x
git pull
git log | less
CONFIG_PARAVIRT_GUEST=y
CONFIG_XEN=y
CONFIG_HVC_DRIVER=y
CONFIG_HVC_XEN=y
CONFIG_X86_IO_APIC=y
CONFIG_ACPI=y
CONFIG_PCI_XEN=y
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_BACKEND=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_XEN_PCIDEV_BACKEND=y
CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
CONFIG_ACPI_PROCFS=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=32
CONFIG_XEN_SAVE_RESTORE=y
CONFIG_XEN_DOM0=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_PCI=y
CONFIG_XEN_BLKDEV_FRONTEND=m
CONFIG_NETXEN_NIC=m
CONFIG_XEN_NETDEV_FRONTEND=m
CONFIG_XEN_KBDDEV_FRONTEND=m
CONFIG_XEN_FBDEV_FRONTEND=m
CONFIG_XEN_BALLOON=y
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_XENBUS_FRONTEND=m
CONFIG_XEN_PCIDEV_FRONTEND=y
Also, make sure you don’t have any debugging options turned on in the “Hacking” section otherwise the kernel compilation may take longer then necessary.
make ARCH=x86_64 oldconfig
make menuconfig (if you need to change something)
make -j2
make modules_install install
Now, let’s build a kernel .deb package and install the package. Then update the modules and initram.
chmod g-s /usr/src -R
make deb-pkg
dpkg -i ../linux-image*.deb
depmod 2.6.32.36
update-initramfs -c -k 2.6.32.36
:~# cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Xen 4.1 / Ubuntu 10.04 kernel 2.6.32.36" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 29be7760-1e5c-4236-adcb-057aef390aad
multiboot (hd0,1)/boot/xen.gz dummy=dummy dom0_mem=4096M
module (hd0,1)/boot/vmlinuz-2.6.32.36 dummy=dummy nopat root=UUID=29be7760-1e5c-4236-adcb-057aef390aad ro console=tty0
module (hd0,1)/boot/initrd.img-2.6.32.36
}