Don't understand german? Read or subscribe to my english-only feed.

Cross compile the Linux kernel on Debian

As my ppc-based efika system is quite slow at building kernel packages I decided to cross compile the kernel on my x86 box. JFTR the necessary steps on a Debian system:

Adjust $KERNELSOURCE/Makefile to:

ARCH            = powerpc
CROSS_COMPILE   = powerpc-linux-gnu-

Thanks to the Embedded Debian project you can easily get the necessary gcc as Debian package. Just add the Embedded Debian pool to your /etc/apt/sources.list:

deb http://www.emdebian.org/debian/ unstable main

… and install the package ‘gcc-4.1-powerpc-linux-gnu’.

Make sure that the environment variable ARCH is set to ‘powerpc’ if you are using a kernel >=2.6.16, otherwise use ‘ppc’ (or whatever you need).

export ARCH=powerpc

If you are using make-kpkg for building the kernel-package make sure to use the arch-option:

make-kpkg --arch powerpc ...

I had problems with getting the vmlinuz image. The relevant files (the /usr/lib/$KERNEL stuff) weren’t present in the kernel package but without the vmlinuz image my OpenFirmware based system doesn’t boot. Thanks to Sven Luther I could hack my own Makefile and finally got a vmlinuz image using mkvmlinuz:

/usr/sbin/mkvmlinuz -o /boot/vmlinuz-2.6.19-grml 2.6.19-grml

Now I’m running my first grml-kernel on ppc:

root@grmlppc ~ # uname -a
Linux grmlppc 2.6.19-grml #2 PREEMPT Sat Jan 20 20:26:15 CET 2007 ppc GNU/Linux

Comments are closed.