Dextrose/Building

From Sugar Labs
< Dextrose
Revision as of 21:16, 24 August 2010 by Bernie (talk | contribs)
Jump to navigation Jump to search

Build system

Dextrose uses olpc-os-builder, a tool used by OLPC to create official and customized system images. The Dextrose git repository contains, olpc-os-builder, local customizations specific to Dextrose, and to be pushed upstream.

Build host requirements

The olpc-os-builder machinery has been used successfully with systems running Fedora 11 i386 through Fedora 13 x86_64. What the host system runs shouldn't matter much, because all the work is being done in a chroot environment, but olpc-os-builder is known to fail on Ubuntu due to a missing dependency.

You will also need a lot of bandwidth to download about 700MB of rpm packages and Sugar activity bundles.

Initial setup

  • Checkout our top-level build system
 cd src/olpc
 git clone git://git.sugarlabs.org/dextrose/mainline.git dextrose
  • Install dependencies
 yum upgrade
 yum install libtomcrypt-devel bitfrost make gcc mtd-utils python-imgcreate zip unzip
  • Compile C programs
 make
  • Do not do make install even though the original README recommends it. It's useless and may lead to confusion.
  • Generate initial sequence number for the builds
 echo 42 >buildnr-dx

Creating a build

  • Build (have a look at the available configuration files):
 time sudo ./osbuilder.py examples/dextrose2-xo1.ini
  • Wait 15-20 minutes
  • If everything goes well, your new build can be found in build/output. Serve hot.

Of course, a number of things will go wrong the first time. Error output could be misleading and obscure due to nesting of several tools: olpc-os-builder, imgcreate and yum. Before you dig into code, you may want to ask on IRC in case someone has already seen the same problem.


Publishing the images

Signed builds should be published only if they correctly implement the OLPC anti-theft system). Signing does not have anything to do with quality or endorsement (i.e. signed builds are not necessarily bug-free or supported).


Customizing the build

The topic of is too vast to discuss in detail here. Start by reading README in the olpc-os-builder tree. Then, as needed, read the various README files contained in the modules directory.

Being a Build Master involves knowledge of many workflows, including:

  • Dealing with yum and rpm.
  • Creating yum package repositories with [1].
  • Uploading activities to [2].
  • General understanding of the Linux system plumbing infrastructure: kernel,

udev, dbus, DeviceKit, NetworkManager, Xorg...

  • Flashing laptops and debugging any problems
  • Interaction with the Sugar and OLPC community to solve issues and minimize our divergence from the official builds.

Upstream

Our upstream code comes from dev.laptop.org:

git remote add olpc git://dev.laptop.org/projects/olpc-os-builder
git fetch olpc
git log olpc/master

Building custom RPMs

  • Go to the rpms/PACKAGENAME in the dextrose tree
  • Edit the spec file. Typically this involves adding a new patch, which is done by adding a PatchNN: tag and a corresponding %patchNN rule in %setup. Some of the intricacies of RPM spec files are unveiled in the Fedora Packaging Guidelines.
  • Remember to bump the revision after each change or your package won't be seen as an update relative to what is in the cache!
  • make i586
  • Wait for rpmbuild to do its job
  • Now upload this rpm to a yum repository and add it to the ini file used by the OLPC OS builder.
  • To automate this step, we have a rule make uploadrpm which points at the Dextrose repository. Edit rpms/common/Makefile.common or rpms/common/uploadrpm to retarget this rule to your repository.


Building custom OLPC kernels

$ git clone http://dev.laptop.org/git/olpc-2.6/
$ cd olpc-2.6
$ setarch i386 make ARCH=i386 xo_1-kernel-rpm