Kernel

From OLPC
Revision as of 12:09, 23 November 2007 by 210.22.158.132 (talk)
Jump to: navigation, search

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

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 downloading 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 currently in use 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.
  • powermgmt - this branch is where all the power management (suspend/resume) activity was happening. This code is now (mostly) in master; use that instead.
  • origin - this is a git-ism; it basically marks where the 'master' branch was checked out from. It can be ignored.
  • devtree - this branch is being used for development on the in-kernel OpenFirmware device tree.

The other branches are no longer used, and can be ignored.

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.

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.

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.