1.install necessary packages,include but not limited in:

   build-essencial, curses, openssl, python(ssl support), mercial, gawk, bridge- 
   utils
, bin86, bcc, texinfo

2.
download these packages from Xen official website

   xen-
3.4.2.tar.gz => uncompress to ../xen-4.3.2

   linux-
2.6.18-xen-3.4.2.tar.gz => uncomcompress to ../xen-4.3.2/linux-2.6.18-xen.hg


3.
put these files in /stubdom/

   A.grub-0.97.tar.gz(ftp://alpha.gnu.org/gnu/grub/grub-0.97.tar.gz)
   B.
lwip-1.3.0.tar.gz(http://download.savannah.gnu.org/releases-noredirect/lwip/lwip-1.3.0.tar.gz)
   C.
newlib-1.16.0.tar.gz(ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz)
   D.
pciutils-2.2.9.tar.gz(http://xenbits.xensource.com/xen-extfiles/pciutils-2.2.9.tar.bz2)
   E.
zlib-1.2.3.tar.gz(http://www.zlib.net/zlib-1.2.3.tar.gz)

4.
进入buildconfigs, [root@localhost buildconfigs]#vim src.hg-clone.删掉其中一些语句,为了绕过hg文件的从网络上下载,最后的样子是:

# Mercurial
HG ?= hg

LINUX_SRCDIR ?= linux-$(LINUX_VER)-xen.hg

# Repository to clone.
XEN_LINUX_HGREPO ?= $$(sh buildconfigs/select-repository $(LINUX_SRCDIR) $(LINUX_SRC_PATH))

# Set XEN_LINUX_HGREV to update to a particlar revision.
XEN_LINUX_HGREV ?= tip

$(LINUX_SRCDIR)/.valid-src: $(__XEN_LINUX_UPDATE)
    set -e ; \
    touch $@


5. 在Xen的源码目录里:打make dist; make install (不要打make world,因为会把linux的补丁源码给删除了)

6.# mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_modinitrd-2.6.18.8-xen.img 2.6.18.8-xen

7.将生成的镜像文件initrd-2.6.18.8-xen.img移动到/boot.

8.#cd /boot/grub,编辑menu.lst.其内容如下(仅供参考):



default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-164.15.1.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-164.15.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-164.15.1.el5.img
title CentOS (2.6.18-164.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-164.el5.img
title Xen 3.4.2
        root(hd0,0)
        kernel /xen-3.4.2.gz console=vga
        module /vmlinuz-2.6.18.8-xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        module /initrd-2.6.18.8-xen-3.4.2


9. 重新启动,xend start,提示安装一个bridge-utils,
   在终端里输入:yum install bridge-utils即可
09-25 00:03