Building a custom kernel

From BubbaWiki
Revision as of 18:34, 2 August 2013 by Charles Leclerc (talk | contribs) (Created page with '= Introduction = This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

This a very quick-and-dirty how-to to build (and customize) a kernel for your bubba 3 device. It also works for bubba 2 providing some small differences I will point out.

Preparing an compilation host

You could compile direclty on the B3 (resp. B2) itself, but it would take HOURS. That's why we will use a host which will be cross-compiling the kernel much quicker. Personnaly I use a virtual host in VirtualBox, but you use whatever machine/virtualization technology.

OS install

The host must run debian squeeze, either i386 or amd64. I will not detail the OS install phase, if you want a custom kernel, you probably know how to do that. Nothing fancy here just a plain debian install. The desktop environment is obviously not needed ;-) .

Installing the compilation tools

After the install is completed, install the compiling tools :

  • emdebian cross-compilation toolchain :
apt-get install emdebian-archive-keyring
echo "deb http://www.emdebian.org/debian/ squeeze main" > /etc/apt/sources.list.d/emdebian.list
apt-get update

For the B3 :

apt-get install gcc-4.4-arm-linux-gnueabi

For the B2 :

apt-get install gcc-4.4-powerpc-linux-gnu

Note : you can install both toolchains if you have both platforms as I do :-)

  • native compiler and debian package utils :
apt-get install build-essential devscripts
  • platform specific tools :
apt-get install device-tree-compiler uboot-mkimage
  • development files for ncurses :
apt-get install libncurses5-dev

Download and prepare the excito kernel source

The next operations can be done as a regular user.

  • Prepare the environment :
    • For the B3 :
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
    • For the B2 :
export ARCH=powerpc
export CROSS_COMPILE=powerpc-linux-gnu-
  • Download the source files
dget -xu http://b3.update.excito.org/pool/main/l/linux/linux_2.6.39.4-13.dsc

Note : the above link will work as long as excito does not upgrade the kernel.

Customizing the kernel

Now everything is in place, time to customize the kernel :

  • Move into the source directory :
cd linux-2.6.39.4
  • Run the curses-based configuration tool (if you wish to use xconfig, be my guest, there are a few more dependencies to install) :
make menuconfig
  • Load the default excito configuration : From the menu, select Load an Alternate Configuration File and enter the following path :
arch/arm/configs/bubba3_defconfig
  • From now on you can customize the configuration to suit your needs.
  • When you're satisfied, save the configuration : From the menu, select Save an Alternate Configuration File, the path entered above sould have been kept.
  • You may exit the configuration, no need to save

Note : whenever you customize the kernel, the resulting configuration must be placed in arch/arm/configs/bubba3_defconfig ; only this file will be used during the compilation phase.

Compiling and building the debian package

From the same directory, build the debian package :

dpkg-buildpackage -us -uc -b

Installing the new kernel on the device