Skip to main content

Cross compiling Kurobox Pro linux kernel

·2 mins

Today you can find some information of how to cross compile the linux kernel for a kurobox pro at NAS central wiki. However I  thought it would be a good idea to rewrite this tutorial from a debian user point of view. It’s only a more clean and elegant way to do the same thing on a debian system.

First of all we have to add a new repository in the /etc/apt/sources.list file:

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

This is the official Embedded Debian Project where you can find the needed prebuilt toolchains required to cross build for a lot of architectures (arm, armel, ia64, m68k, mips, mipsel, powerpc, s390 and sparc).

Now we have to update our repository information and install the required toolchain:

apt-get update
apt-get install libc6-armel-cross   
  libc6-dev-armel-cross   
  binutils-arm-linux-gnueabi   
  gcc-4.4-arm-linux-gnueabi   
  g++-4.4-arm-linux-gnueabi   
  uboot-mkimage devio libncurses5-dev

The next step is to download the linux kernel source code and make a default configuration for our architecture:

export VERSION="2.6.37"
export ARCH="arm"
export CROSS_COMPILE="arm-linux-gnueabi-"
export INSTALL_MOD_PATH="/tmp/kurobox"
export KERN_DIR="$INSTALL_MOD_PATH/boot"

mkdir -p "${KERN_DIR}"
wget "http://www.kernel.org/pub/linux/kernel/v2.6/linux-${VERSION}.tar.bz2"
tar xjf linux-${VERSION}.tar.bz2
cd "linux-${VERSION}"
make mrproper
make orion5x_defconfig

At this moment we have a default Linux kernel configuration for our Orion platform. We can customize our config executing ‘make menuconfig’. In my case I wanted to add ext4 compiled in support for my debian root filesystem and unmark all platforms in ‘System Type -> Orion Implementations’ except ‘Kurobox Pro’ of course.

Now we will compile the kernel modules and build the final kernel image.

make modules
make modules_install
make zImage
devio > foo 'wl 0xe3a01c05,4' 'wl 0xe38110e5,4' 
cat foo arch/arm/boot/zImage > ${KERN_DIR}/zImage
rm foo
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000   
 -n 'linux' -d "${KERN_DIR}/zImage" "${KERN_DIR}/uImage-${VERSION}"
rm "${KERN_DIR}/zImage"

cd "${INSTALL_MOD_PATH}"
tar cjvf kurobox-kernel.tar.bz2 *

Finally we have to copy the kernel image and the modules to the kurobox and install them:

scp kurobox-kernel.tar.bz2 root@kurobox:
ssh root@kurobox
tar -C / -xjvf  kurobox-kernel.tar.bz2
cd /boot
rm uImage.buffalo
ln -s uImage-2.6.37 uImage.buffalo
depmod -a
shutdown -r now

If something goes wrong you can use a serial console to see the boot process as explained in nas-central. In my case I use a self made DKU-5 compatible cable found at dealextreme.