Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1855620
  • 博文数量: 473
  • 博客积分: 13997
  • 博客等级: 上将
  • 技术积分: 5953
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-22 11:52
文章分类

全部博文(473)

文章存档

2014年(8)

2013年(38)

2012年(95)

2011年(181)

2010年(151)

分类: LINUX

2011-04-23 13:20:34

  1. Install the following package dependencies if not already installed
    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
  2. Get the Xen
    wget 
    tar -zxvf xen-4.1.0.tar.gz
    cd xen-4.1.0
  3. Compile and Install Xen
    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.

  4. Setting up the Xen kernel:
    At the time of the writing of this document, the current/stable branch of the xen kernel is xen/stable-2.6.32.x .
    • Getting the Xen kernel from git repo:
      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

    • Configuring & Installing the kernel
      Once you run “make ARCH=x86_64 oldconfig”, you will have a .config file created on the directory where your kernel source is. Now you can either modify this .config file by editing it or by using the “make menuconfig”. Either way, make sure that all the kernel option below are properly enabled.
    • 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
    }
阅读(1091) | 评论(1) | 转发(0) |
0

上一篇:KVM虚拟机和QEMU

下一篇:Xen Error List

给主人留下些什么吧!~~

chinaunix网友2011-05-15 16:43:36

你好,我按照你的方法编译有错误,不知道你用这种方法最后成功了没