This page walks through a simple process of setting up an chroot environment configured for doing many standard Linaro development activities like cross-compiling a kernel. schroot is handy tool that allows you to enter a chroot environment without being root and without having to set up mount points in the chroot directory. Having your complete dev system in one place makes it easy to backup your dev system and transfer it to new machines.

Once completed you'll be able to do something as simple as:

$ schroot -c natty
$ cd $HOME/<KERNEL SOURCE>
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage

Install / Configure Dependencies for Host System

schroot can be installed with:

$ sudo apt-get install schroot

You'll then need to configure an schroot entry. You can append the entry below to /etc/schroot/schroot.conf:

[natty]
description=Ubuntu Natty
type=directory
groups=users
root-users=doanac
directory=/srv/chroot/natty

NOTE: The "groups" and "root-users" values will be different on your system.

Create the chroot

Create the directory for it based on the schroot.conf "directory" value:

$ sudo mkdir -p /srv/chroot/natty

You can now create an initial Ubuntu Natty install with:

#NOTE: this operation will take several minutes to complete
$ sudo debootstrap natty /srv/chroot/natty http://archive.ubuntu.com/ubuntu/

Setting up the chroot

Entering the chroot is easy with schroot. It will take care of setting up mount points like /proc. It will also, by default, mount your actual /home into the chroot.

$ schroot -c natty

# Add some additional apt sources we'll need for package installation:
$ sudo -s
$ echo "deb http://archive.ubuntu.com/ubuntu natty restricted" >> /etc/apt/sources.list
$ echo "deb http://archive.ubuntu.com/ubuntu natty universe" >> /etc/apt/sources.list
$ apt-get update

# install common apps needed for Linaro development:
$ apt-get install gitk bzr bzr-grep bzr-gtk linaro-image-tools make picocom u-boot-tools gcc-4.5-arm-linux-gnueabi ccache gcc ctags cscope

# The schroot won't set up an alternative for the ARM cross compiler, so do it manually:
$ update-alternatives --install /usr/bin/arm-linux-gnueabi-gcc  arm-linux-gnueabi-gcc /usr/bin/arm-linux-gnueabi-gcc-4.5  80

# exit root shell
$ exit

X11 Apps from chroot

TODO:

$ export DISPLAY=:0.0


CategoryHowTo

Resources/HowTo/schroot-dev-env (last modified 2011-04-19 01:16:12)