Version 17 (modified by ibaldin, 11 years ago)


Creating ORCA-compatible DomU images

This procedure describes building an ORCA-compatible DomU image in step-by-step fashion.

CentOS 5.2

Building a standalone image and booting stock kernel

BEN ORCA deployment uses CentOS 5.2, so it is uses as a basis for building a DomU. These instructions should translate into other RedHat derivatives and near-term future versions.

  1. We assume that CentOS was installed with virtualization (typically means that Xen and libvirt have been installed) and booted into Xen kernel
    • NOTE: Disable libvirtd - it only gets in the way
      > chkconfig --level 123456 libvirtd off
  2. Acquire a filesystem image from (it has minimal filesystem images available for many distributions)
  3. Build a Xen-compliant initrd for the kernel of your choice
    > mkinitrd --with=xennet --preload=xenblk /wherever/you/want/to/put/initrd-<kernel version>.domU.img `uname -r`
  4. Modify the config file that came from to match your kernel and initrd and disk image locations
  5. Mount the image and modify it to your liking, e.g. change the IP address assignment
    > mount -o loop /where/the/image/is /loop/mount/point
  6. Start the vm. With CentOS the last thing the console showed was sshd starting.
    <vm config file>
    kernel = "/boot/vmlinuz-2.6.18-92.1.18.el5xen"
    ramdisk = "/boot/initrd-2.6.18-53.1.19.el5xen.domU.img"
    memory = 256
    name = "centos-5.2-1"
    vif = [ 'bridge=xenbr1', 'bridge=slice1' ]
    disk = ['file:/vm/centos-5.2/centos.5-2.64-1.img,sda1,w']
    root = "/dev/sda1 ro"
    > xm create <config file>
  7. SSH into it and use Yum to add whatever software you need
  8. To add java follow instructions here:

Modifying the image for NFS root mount

Edit /etc/fstab in the image to have the root point to /dev/nfs:

/dev/nfs       /       defaults     0 0

Building a Centos Xen kernel for NFS root mount

  • Follow instructions here to get kernel source with Centos patches (don't forget the xen src rpm).
  • Follow instructions here (basically copy the appropriate config file into BUILD/kernel-2.6.18/linux-2.6.18.x86_64/.config from BUILD/kernel-2.6.18/linux-2.6.18.x86_64/configs)
  • Follow instructions and apply the NFS patch from here: or here
  • Edit the Makefile to give this kernel a different suffix (like -orca or -nfsroot)
  • Do
    > make oldconfig
  • Do
    > make menuconfig
    • Be sure to select IP autoconfiguration (add DHCP if needed, but static is sufficient)
    • Add NFS root support
    • Build all of XEN parts into the kernel - making an initrd that understands nfs roots is a whole other story only supported recently
  • Do
    > make
  • Optionally do (don't forget to copy the module onto the image)
    > make modules
  • Do (this will install in the Dom0 or host you are working in)
    > make modules_install
  • Gather the modules from /lib/modules/2.6.8-<your prefix> and put them in the NFS image
  • Deploy image somewhere over NFS
  • Use the kernel to boot using a config file like this one (note the absence of initrd/ramdisk):
    kernel = "vmlinuz-nfsroot"
    memory = 256
    name = "centos-5.2"
    vif = [ 'bridge=xenbr1', 'bridge=slice1' ]
    root = "/dev/nfs"
    interface = "eth0"
    ip = ""
    netmask = ""
    gateway = ""
    nfs_server = ""
    nfs_root = "/vm/centos-5.2/loop"