Cross Container Support Project

Introduction
This page is aimed to introduce the GSoC 2012 project: Cross Container Support.

I will document the progress of my project here.

Running Qemu-user on Chroot
This section updates the qemu-user and describes how to build a chroot with qemu-user on x86 machine.

Qemu-user Installation
In order to take advantage of qemu-user mode we need to do a few things. First we need to merge the main package we are going to need. Note the use of the static use flag. Python is needed during qemu-user compiling.

Binfmt_misc Configuration
First you need to build the kernel module binfmt_misc. Add this to your kernel .config: CONFIG_BINFMT_MISC=m or CONFIG_BINFMT_MISC=y. If this module is not built already, then the devel host will require a reboot after the kernel update and modules_install. The complete list of relevant kernel options (tested on 3.2.1-gentoo-r2) is as follows.

Mount the binfmt_misc handler if it's not already, then we need to register our format with the kernel via the procfs.

Next, register qemu-user-arch to the binfmt_misc module. You don't need to add them one by one and Luca has provided a initscript to get the bin formats registered. You can use it:

or start the service on bootstrap:

You could learn more detail of registering bin formats through /usr/portage/app-emulation/qemu-user/files/qemu-binfmt.initd.

Enter/Exit the Chroot
Firstly, you should chose and download a stage3 tarball from installation media. We take arm arch as an example to show how to enter/exit the chroot.


 * Download and unpack arm stage tarball


 * Install the static qemu-user into the chroot


 * Mount the required directories


 * Chroot into the environment


 * Unmount stuff when not in use

Automatic setup
The lxc.sh tool can download, configure and create a multi-arch gentoo guest. You can download it here: lxc.sh

Additional developers, bug fixes, comments, etc. are welcome.