Note: This tutorial assumes that you have completed the previous tutorials: Ubuntu for Intel Atoms.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Ubuntu in a Chroot

Description: Part two of a three part tutorial illustrating how to install, maintain and deploy a stripped down ubuntu (lucid) on pen drives for intel atoms using an i686 intel build platform. This one covers maintainence in a chroot.

Tutorial Level: INTERMEDIATE

Next Tutorial: Ubuntu on Pen Drives

Image

Assuming you have finished the previous tutorial, you should now have a working pen drive. To extract an image, simply insert the pen drive into your pc, mount it and grab a tarball of the root filesystem. All further development will be done in a chroot off that tarball (substitute sdb for whatever device it shows up as).

sudo mkdir -p /mnt/ros
sudo mount -t ext4 /dev/sdb1 /mnt/ros
sudo tar -cvzf ros.tar.gz -C /mnt/ros .

Schroot

We'll use schroot to give us superuser priveleges immediately on accessing the chroot.

Requirements

  • Host system needs to be the same architecture as the embedded platform (e.g. x86 for x86).

Can also do it for other platforms via mechanisms like qemu's chroot emulation (e.g. x86 for arm), but that's a bit more complicated.

Configuration

Starting

* Untar the installation tarball (for sake of example, we'll define it at /mnt/zaphod/chroots/lucid). * Set up a schroot configuration for convenient login shell in the root.

Schroot

Install the necessary package.

apt-get install schroot

Then edit /etc/schroot/schroot.conf with the following configuration (swapping snorri/users for your username/user group combination and fixing the location):

[ros]
description=Embedded Ubuntu
type=directory
directory=/mnt/zaphod/chroots/lucid
users=snorri
groups=users
root-users=root,snorri
root-groups=root,snorri

Finally, use scripts for prepping, mounting and unprepping the root.

  • chrootprep - binds all the filesystems.

  • chrootuprep - unbinds all the filesystems.

  • chlucid - preps, enters and then unpreps the root filesystem.

Once you've got the three scripts downloaded into /usr/local/bin, edit the variables, then it should be a simple matter of running 'chlucid' whenever you need to do development.

Snapshots

You'll want to occasionally snapshot your directory tree which you can then use for Deployment on Pen Drives.

Wiki: eros/Tutorials/UbuntuChroot (last edited 2010-12-29 09:19:58 by DanielStonier)