Skip to content
impl edited this page Oct 25, 2011 · 4 revisions

Building

Setup

Unless you’re already running a PowerPC system, you’ll need a cross-compiling toolchain for building the kernel. If you use Debian, Emdebian is an excellent choice.

Getting the source code

The most direct way to get the source code is by checking out this Git repository; this has the additional benefit of allowing you to keep in sync with any changes to this source tree with minimal effort. However, it has a pretty significant overhead (it’s about an order of magnitude larger than the kernel tree by itself).

If you have a standalone copy of the kernel source tree, you can download a copy of a patch file directly from GitHub. Note that this repository is based on Linus Torvalds’s source code tree, so it doesn’t include bugfix versions. (In other words, it has a tag for v3.0, but not for v3.0.1.) Usually the number of manual changes you’ll have to make against a bugfix version (compared to a major or minor release) will be insignificant, so feel free to try using these patches against bugfix kernels as well. The current patch against tag v3.1 is available using GitHub’s comparison interface. You can also view a graphical rundown of the commits.

Patches can be applied from the root of the kernel source tree using the patch command; e.g.:

$ patch -p1 -i v3.1...master.diff

Building the kernel

Default configurations are currently provided for RB333 and RB600 platforms. You can snag them from the support repository. Rename the relevant file to .config in the kernel source tree.

To configure other options, like which modules get built, use the standard menuconfig interface, but make sure you specify the architecture:

$ make ARCH=powerpc menuconfig

Once you’re satisfied with your configuration, building the kernel itself is nearly as straightforward:

$ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-

CROSS_COMPILE should be set to whatever prefix your toolchain uses (e.g., there should be a powerpc-linux-gnu-gcc in my example). powerpc-linux-gnu- should work for all Emdebian users at a minimum.

After your kernel is built, copy the files you need to a staging location (they need a bit more manipulation before they can be used). For RB333, something like this:

$ cp arch/powerpc/boot/dtbImage.rb333.elf $OUTBOUND
$ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- INSTALL_MOD_PATH=$OUTBOUND/modules modules_install

And for RB600:

$ cp arch/powerpc/boot/dtbImage.rb600.elf $OUTBOUND
$ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- INSTALL_MOD_PATH=$OUTBOUND/modules modules_install
Clone this wiki locally