Kernel

From OLPC
Revision as of 22:33, 11 January 2010 by Kevin Puetz (talk | contribs) (Adding link for 2.6.31 kernels)
Jump to: navigation, search
  This page is monitored by the OLPC team.
Merge-arrows.gif
It has been suggested that this article or section be merged with Rebuilding OLPC kernel. (Discuss)


We use a modified version of the Linux kernel on the OLPC laptop.

Note: You will not be able to boot a new kernel on your XO until you have a Developer key.

The OLPC kernel git repository

We use git to track changes that we've made, as well as to easily merge with Linus's (and others!) kernel tree. The git repository can be downloaded with the following command:

git clone git://dev.laptop.org/olpc-2.6

Alternatively, you can use gitweb to view and search changes by going to:

http://dev.laptop.org/git?p=olpc-2.6;a=summary

Note that at the bottom of that page, there is a list of branches. We keep around different branches for a number of reasons; within a cloned git repository, you can switch to branch 'FOO' by running:

git checkout FOO

The branches to note are:

  • master - this is the default branch, and is the equivalent of cvs's HEAD. Code that we want in our future releases goes into this branch, and needs to be vetted before being committed.
  • stable - this is the branch that we automatically pull kernels from when we build a release. It is usually a snapshot of the 'master' branch, although we sometimes cherry-pick fixes into it.
  • testing - this is the branch for joyride kernels. It is usually more recently updated than stable but not as recently updated as master.

The other branches can be ignored - if you don't already know what they are, they're not going to be of any use to you.

OLPC kernel configuration

The Linux kernel has a config file that describes the various options that are built into the kernel. For OLPC, we store that in the root of the git repository, in the 'arch/i386/configs/olpc_defconfig' file. Via gitweb, it can be viewed (for the 'master' branch) here:

http://dev.laptop.org/git?p=olpc-2.6;a=blob;f=arch/i386/configs/olpc_defconfig;h=f1675e86312eee9c1cc9e59ebefca91ff8afe979;hb=HEAD

For official OLPC kernel RPMS (and on OLPC OS images), the config ends up being installed as /boot/config-$VERS. This allows you to see how the currently running kernel is configured.

Installing OLPC kernel RPMs

We auto-build kernel RPMs every 30 mins, which means that new, shiny commit that just occurred will show up in the following places (depending upon branch):

The SRPMs (Source RPMs) are available in the same place.

The RPMs have the dates they were built, and the number of the build. For example, 'kernel-2.6.21-20070322.4.olpc.5fe63334a44da42.i586.rpm' was built on March 22, 2007. It was the 4th build on that day. The '5fe63334a44da42' is part of the git commit ID, if you're trying to match up what specific commits made it into the kernel.

The 'kernel-' RPMs contains all you need to boot into that new kernel; simply install it, reboot, and you're set. The 'kernel-devel-' RPMs contain headers necessary for building out-of-tree kernel modules. The 'kernel-debuginfo-' RPMs contain debugging info necessary for debugging the kernel with, say, systemtap.

To install your rpm:

rpm -ivh kernel-....rpm
cp -a /boot/* /versions/boot/current/boot/

(If you omit the -a in the above recipe, the vmlinuz symlink will not be updated correctly)

See the instructions at Kernel Building if you need to update modules in the initramfs. If you don't do this, you will likely get modprobe warnings at boot (before the initramfs starts); they are harmless.

Building an OLPC kernel

So you've decided that you want to build an OLPC kernel? Are you certain? The kernel is filled with arcane magic and sharp pointy things that may draw blood. If you're really serious, see the Kernel Building page.

Building an OLPC kernel RPM

It takes a bit longer to build, but it's easier to distribute if you build a proper kernel RPM. The instructions for doing so are on the Rebuilding OLPC kernel page.