본문 바로가기

Technical/Cloud, Virtualization, Containers

Setting up Xen Dom0 kernel 2.6.31.12 on OpenSuse 11.2



Setting up Xen Dom0 kernel 2.6.31.13 on OpenSuse 11.2

 * Installation methods are as follows
  (1) Binary tarball from xensource.com(xen-3.x.x-install.tgz)
  (2) RPM download and install
  (3) Online Package installation by zypper or yast or yast2(software installation)
  (4) From source
    - Xen source(make dist-xen,...) / Kernel source+patch(Patch & make modules_install & modifying grub)
    - Xen source / Custom kernel source(make ARCH=xen xconfig, ...)
  * Must-have softwares
  (1) bridge-utils(brctl,...)
  (2) hotplug system(mostly in Linux udev)
  (3) Build utils and related(gcc, binutils, GNU make, zlib, python)
  
1. Check virtualization env. if needed
# rpm -qa | egrep "(xen|virt)" | sort

2. Disable SElinux if installed

3. Install xen related packages and build tools
   (Or install RPMs by yast, yast2 GUI interface...If U r lucky enough).
# zypper search xen*
# zypper install xen xen-devel xen-doc-html xen-doc-pdf xen-libs xen-tools xen_server
# zypper install make gcc gcc-c++

  3-1. Or, install xen by building source like this...
  # wget http://bits.xensource.com/oss-xen/release/3.4.2/xen-3.4.2.tar.gz
  # tar -xvzf xen-3.4.2.tar.gz
  # cd xen-3.4.2
  # zypper install dev86 => essential to build !!
  # make dist-xen dist-tools dist-stubdom
  # make install-xen install-tools install-stubdom

  3-2. Download Vanilla kernel source & xen patch
  # cd /usr/src
  # wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.12.tar.bz2
  # tar xvjf linux-2.6.31.12.tar.bz2
  # mv linux-2.6.31.12 linux-2.6.31.12-xen-byMe
  # wget http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-10.tar.bz2
  # mkdir xen-patches-v10_2.6.31.12
  # cd xen-patches-v10_2.6.31.12
  # tar xvjf ../xen-patches-2.6.31-10.tar.bz2
  # cd ../
  # cd linux-2.6.31.12-xen-byMe
  # for i in `ls ../xen-patches-v10_2.6.31.12/`; do patch -p1 < ../xen-patches-v10_2.6.31.12/"$i"; done

  3-3. Copy original kernel config file for convenience
  # cp /boot/config-2.6.31.xx-generic .config
   * curses lib will be required...
  # make menuconfig => Set each items exactly !
  -----------------------------------------------
  Processor type and features --->
    [*] Enable Xen compatible kernel
    Networking support --->
    Networking options --->
     <*> 802.1d Ethernet Bridging
    Device Drivers --->
     XEN --->
     [*] Privileged Guest (domain 0)
     <M> Backend driver support
     <M>   Block-device backend driver
     <M>   Block-device tap backend driver
     <M>   Block-device tap backend driver 2
     <M>   Network-device backend driver
     <M>   PCI-device backend driver
     <M>   SCSI backend driver
     <M>   USB backend driver
     <*> Block-device frontend driver
     <*> Network-device frontend driver
     <M> SCSI frontend driver
     <M> USB frontend driver
     <*> Framebuffer-device frontend driver
     <*>   Keyboard-device frontend driver
     [*] Disable serial port drivers
     <*> Export Xen attributes in sysfs
        Xen version compatibility (3.3.0 and later) --->
           3.3.0 and later
  -----------------------------------------------

  3-4. Xenifying Kernel - Make & install
  # export CONCURRENCY_LEVEL=5
  # make => maybe some hours ... --;
  # make modules
  # make modules_install  
  # make install
   * If using mkinitramfs,
  # mkinitramfs -o /boot/initrd.img-2.6.31.12-xen-byMe 2.6.31.12-xen-byMe
   * Or if mkinitrd,
  # depmod -a 2.6.31.12-xen-byMe
  # mkinitrd /boot/initrd-2.6.31.12-xen-byMe.img 2.6.31.12-xen-byMe
  
  3-5. Now, edit Grub menu
  # vi /boot/grub/menu.lst
  Title Xen 3.4.2 - Kernel 2.6.31.12 on OpenSUSE 11.2
    kernel /boot/xen.gz dom0_mem=512000
    module /boot/vmlinuz-2.6.31.12-xen-ByMe ...
    module /boot/initrd-2.6.31.12-xen-byMe.img <= Add this line
  
4. Reboot the system by Grub menu - Xen kernel

  # chkconfig --add xend
  # chkconfig xend on
  # /etc/init.d/xend start
  # chkconfig --add xendomains
  # chkconfig xendomains on
  # /etc/init.d/xendomains start
  
  # chkconfig --add libvirtd
  # chkconfig libvirt on
  # /etc/init.d/libvirtd start
  
5. Check if Xen dom0 system is correctly set up

  # ps aux | egrep "(xen|virt)" | sort
  ...xenwatch, xenbus, xend, HalDaemon.py, xenstored, xencolsoled, libvirtd, ...
  
All done, now test it by creating VMs.