Kernel

From OLPC
Revision as of 20:55, 28 February 2011 by DanielDrake (talk | contribs)
Jump to navigation Jump to search


The OLPC kernel

OLPC OS Releases use our OLPC-modified version of the Linux kernel.

The OLPC kernel is maintained in git:

Current maintainers: Chris Ball, Daniel Drake, Paul Fox

We work on specific branches for each release. Looking at git history should be enough to identify which branches we are actively working on, and looking at the version of each branch compared to the kernel shipped in each release will help you identify which branch corresponds to which release(s).

OLPC-specific configurations can be found at arch/x86/configs/, these are what we use for automated builds and official releases. This configuration is also installed in /boot in our software releases.

Questions and contributions should be sent to the devel mailing list.

Installing kernel RPMs

Due to OLPC's versioned filesystem layout, installing a new kernel RPM is not enough for it to become active on reboot. This is explained in detail in /boot/README. To summarise, after installing a kernel you must copy it to a special place:

If running a software release that uses partitions:

rsync --delete-before -av /boot/ /bootpart/boot/

If running a software release that does not use partitions:

cp -a /boot/* /versions/boot/current/boot/

Building an OLPC kernel

  1. Check out the kernel from git
  2. Switch to the appropriate branch
  3. Make your changes (updating the configs under arch/x86/configs/ if changes are needed)
  4. Commit all your changes
  5. Run make clean distclean
  6. Run make xo_1-kernel-rpm for XO-1, or make xo_1_5-kernel-rpm for XO-1.5.

RPM files will be output which you can install on an XO (with the above versioned filesystem layout issues in mind).

Automatic RPM generation

Some branches are automatically built every 30 minutes (but only when there are new changes), the results are published at http://dev.laptop.org/~kernels/

The directories you see there are also linked to RPM dropboxes, therefore are automatically published for inclusion in development builds. In other words, to get your kernel changes included in the current software release development efforts, you simply have to push your changes to the correct branch of olpc-2.6.

The utility behind this magic is olpc-kernel-builder:

Running vanilla kernels

In late 2010, OLPC started a focused effort to upstream its kernel patches so that unmodified "vanilla" kernels run with complete functionality on the XO.

As of 2.6.38 this is coming along nicely, and these efforts will continue til everything is upstream. Unmodified kernels run reasonably well with most functionality available.

You may have to hunt around a bit to satisfy the configuration options so that the relevant drivers get built, and the XO-1.5 needs some special kernel parameters to boot (you can find them in a recent olpc-2.6 branch in the XO-1.5 defconfig as CONFIG_CMDLINE). If in doubt, feel free to ask on the devel mailing list for someone's recent .config file.

Boot your development kernel from USB

When doing kernel development, it is time consuming to commit each small change, make an RPM, install RPM on the XO, reboot, and test. Instead, you can follow this procedure:

On your development system, prepare a USB disk as follows:

  • /boot/olpc.fth (download for XO-1 or XO-1.5, be sure to rename to olpc.fth)
  • /boot/irfs.img (download here - this is a hacked OLPC initramfs which doesn't require /ofw support)
  • /boot/bzImage (your kernel that you want to test)

Now plug this disk into your XO, turn it on, and the system will load the kernel from USB while booting the rest of the system as normal. If your new kernel crashes badly, just unplug the USB disk and boot the system again - it will revert to booting the "good" kernel from local disk.

Note: for XO-1 this only works with JFFS2. (small tweaks to olpc.fth or the hacked initramfs would be needed for ubifs).