Creating images with MIC and KVM

While MIC (MeeGo Image Creator) is supported on many popular Linux distributions, the variety adds complexity and often support is not up to date and certain things might not work as expected.

This approach of using KVM and MeeGo can provide an answer, since MIC by nature should work well inside MeeGo, hence there will be no compatibility issues and in addition to that, running the complete process in a VM will provide us with consistency and reproducibility, since we will always be using the same VM image and it will not be contaminated by the user environment.

Note:

This is a proof of concept only. Many details are not described here and you need to have an understanding of MeeGo, MIC and KVM.. Also, the scripts are not perfect, written and tested in just a few hours, so many things are a bit ugly…

The first thing we need here is a working KVM environment. Most Linux distribution provide the needed tools and packages to get you going very fast. In short, you need to enable virtualization on your system, install Qemu with KVM support (qemu-kvm).

MeeGo kernel lacks some important virtualization support, notably VIRTIO support, which we  will need here to speed things up. I created a custom kernel based on the MeeGo kernel with such support which we will be using to create the base image. The attached kickstart file (base.ks.txt) will create an image we can use to boot into a VM environment. It installs a basic set of packages in addition to MIC of course. So first thing, you need to create the MeeGo environment where images will be created, this can be done using the following command:

mic create -c base.ks -f loop --save-kernel

Once you have the base image with the associated kernel, you are ready to go already. Using the attached scripts you will be able to create basic images in a VM environment. The main script basically takes the base image you have created, injects the kickstart file and some additional files into it and starts KVM using qemu-kvm. MeeGo boots and starts MIC immediately with the kickstart file of your choice and creates the image as specified.

To start the whole process, the following command will be needed:

sh kvmic.sh -i netbook-ia32.ks -l meego-base-1.1.80.20110122.1421.img \
-k meego-base-1.1.80.20110122.1421-vmlinuz-2.6.37-14.1 -r 1.1.90.0.20110120.2

The options have the following meaning:

  • i: the kickstart file for the image you are creating
  • l: the base image you have created above
  • k: The kernel file that was created with the base image
  • r: The release options, see the MIC help for what that means.

Update 1 (23.01.2010) : Of course we can create a transparent wrapper around MIC and do the KVM related stuff based on some hardcoded configurations of the base image and the kernel, since those do not change often anyways.

So basically, make kvmic.sh accept all options MIC accepts and parse the command line options in the background to facilitate copying of files and passing of arguments inside the VM.

This entry was posted in MeeGo and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">