2.12. Customizing the Pyramid Kernel

You want to compile a custom kernel with everything built-in instead of hassling with kernel modules. Your little routerboard runs only a limited set of hardware, and it's not something you're going to be updating or modifying a lot. Additionally, this will save a fair amount of storage space on your Compact Flash card.

No problem. You need a build environment on a PC, with kernel sources and build tools. Build your kernel there, then copy it to your Pyramid board. Use Ubuntu kernel sources with Ubuntu patches. Fetch Ubuntu kernel sources and build tools with this command:

	$ sudo apt-get install linux-source linux-kernel-devel

That should get you everything you need.

If you want to start with the existing Pyramid kernel configuration, copy the /proc/config.gz file to your build machine:

	pyramid:/# scp /proc/config.gz carla@192.168.1.10:downloads/

Unpack it using gunzip:

	$ gunzip config.gz

Now you can build a new custom kernel and drop it into place on Pyramid. Remember to update /boot/grub/menu.lst with the new kernel name.

Pyramid consists of mostly unmodified Ubuntu binaries, so sticking with Ubuntu binaries and source files is the safest and easiest method for modifying it. As long as your Ubuntu CD is the same release as your Pyramid installation (Breezy, Dapper, and so forth), you shouldn't experience any compatibility problems.

To see how much space /lib/modules occupies, use the du command:

	pyramid:/# du --si -c /lib/modules/2.6.17.8-metrix
	...
	6.3M    /lib/modules/2.6.17.8-metrix
	6.3M    total

The kernel itself will occupy around 1 MB.

Typically, these little boards are "set it and forget it," so they are good candidates for statically compiled kernels.

  • Chapter 10, "Patching, Customizing, and Upgrading Kernels," in Linux Cookbook, by Carla Schroder (O'Reilly)