Building custom images

From OLPC
Revision as of 16:23, 31 July 2010 by Skierpage (talk | contribs) (I'm pretty sure OS Builder obsoletes this)
Jump to navigation Jump to search
542-stopicon.png OS Builder is a replacement for pilgrim and Image builder


Motivation

This tutorial explains how you can build a completely customized OS image which can be used with:

Prerequisites

The following procedure has been tested on a Fedora 8 x86_64, but should work just fine on Fedora 7 and on i386.

Any Linux distribution capable of running yum should be able to run Pilgrim, maybe with minor adjustments.

The intended audience of this document is an OS developer with some experience in rebuilding RPMs and managing yum repositories.


Preparation

Before installing pilgrim, you need to install mtd-utils.

 sudo yum install mtd-utils
 git clone git://dev.laptop.org/users/cscott/pilgrim
 cd pilgrim
 make
 sudo make install

Note: this will litter your system with pilgrim files, but you can clean it up later with make uninstall.


Prepare your custom repositories

Build your custom RPMs and place them in a directory accessible via http. It is recommended, but not necessary, to adopt the standard Fedora layout:

 i386/os/     - i386 and noarch packages
 i386/debug/  - debuginfo packages
 source/      - src rpms

Create or update the RPM metadata information for your repositories:

createrepo i386/os
createrepo i386/debug
createrepo source


Pilgrim customization

Adding your yum repositories

Edit streams.d/olpc-development-yum-install.conf and append your yum repository (you only need the one containing the binary RPMs here). Mine looks like this:

[olpc-bernie]
name=OLPC bernie - i386
baseurl=http://www.codewiz.org/pub/olpc-bernie/i386/os/
enabled=1
gpgcheck=0

Note that I've explicitly specified i386 because the $basearch variable would expand to x86_64 on my host.

If you provide the full set of OS packages in your repository, then you should remove the default repositories altogether.


Adding repositories for the target

Edit streams.d/olpc-development.stream, and find the line saying "Writing out configuration for OLPC yum repo". The repositories listed here will appear in /etc/yum.repos.d on the target and are only used when the image is booted on the target.

Add your yum repositories below the official ones.

This is what I do for xtest:

   # keep this in sync with same repo defined in olpc-development-yum-install.conf
   cat <<EOF > $INSTALL_ROOT/etc/yum.repos.d/olpc-development.repo
[olpc_development]
name=OLPC development
baseurl=http://koji.fedoraproject.org/static-repos/dist-olpc2-build-current/i386/
enabled=1
gpgcheck=0
EOF

   cat <<EOF > $INSTALL_ROOT/etc/yum.repos.d/olpc-bernie.repo
[olpc-bernie]
name=OLPC bernie - \$basearch
baseurl=http://www.codewiz.org/pub/olpc-bernie/\$basearch/os/
enabled=1
gpgcheck=0

[olpc-bernie-debuginfo]
name=OLPC bernie - \$basearch - Debug
baseurl=http://www.codewiz.org/pub/olpc-bernie/\$basearch/debug/
enabled=0
gpgcheck=0

[olpc-bernie-source]
name=OLPC bernie - Source
baseurl=http://www.codewiz.org/pub/olpc-bernie/source/
enabled=0
gpgcheck=0
EOF

Adding and removing packages

The list of packages that will be installed is in streams.d/olpc-development.stream.

If your spec files are correct, you will only need to list the leaf packages here and yum will pull in all their dependencies automatically.


Further reading

Read README.olpc in the root directory of Pilgrim for further information.

The short story is:

 (become root)
 ./pilgrim-autobuild --config-dir . --stream olpc-development --dest-dir .

If you're only interest in the jffs2 image, do:

 ./pilgrim-autobuild --config-dir . --stream olpc-development --dest-dir . --variant devel_jffs2

To install OS images see Clean-install procedure.

We want you!

Please send your patches to the development mailing-list for consideration. For large changes, just publish your git repository and provide the URL.

Image Builder

If you are looking for a simpler and way of making a build, please have a look at Image Builder.

Image builder is a script which allows you to take an official OS image released by OLPC, and add in your own customizations. It is primarily intended for adding activities (.xo) and content bundles (.xol), but advanced users can script other customizations too.