I would like to understand more about how the kernel works. Part of this is to compile it myself. How do I cross-compile the Kernel on a Ubuntu host?
First, we need to install the required prerequisites. I assume you have
sudo apt-get install git ncurses-dev make gcc-arm-linux-gnueabi
gitis the version control system used by the Linux kernel team.
ncursesis a library for build console menus. It is necessary for
makeruns the compilation for us.
gcc-arm-linux-gnueabiis the cross-compiler.
Next, we need to retrieve the source, run:
git clone https://github.com/raspberrypi/linux raspberrypi-linux cd raspberrypi-linux
This will clone the source code to a directory called
raspberrypi-linux and change to it.
We first need to move the config file by running
cp arch/arm/configs/bcmrpi_cutdown_defconfig .config
Then configure the kernel build
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig
Optional: Customise the build using menuconfig
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig
Then run the compilation
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k
I think Alex is right but the gcc-arm-linux-gnueabi is compiled for arm cpus without hardware floating point unit. You can find a cross-compiler with armhf support on: https://github.com/raspberrypi/tools and a good tutorial to start with here: http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/
I would recommend that you just follow the steps there, or send a pull request if something becomes outdated or is not clear enough: those instructions are the most likely ones to be correct and up to date since they are part of the official documentation of the project.