Install your preferred version of Ubuntu. Kubuntu 11.04 Natty was used in this example. You can download the dvd iso image here or alternatively you can you use WUBI to install. You will need at least 60GB system partition to set up all the tools used and have enough space to be able to compile. Alternatively, you can also use a vmplayer or virtualbox virtual appliance found here.
Cross Compiling The Kernel
To set-up the cross compiling environment we will be using schroot because of there are issues with some of the libraries and software dependencies need to install the ARM gcc cross complier tools. First we need to install schroot. Use the following command:
UPDATE: I have gone through these instructions again and found that if you don’t allow the Ubuntu installer to update any packages during the install, that you can avoid installing schroot. Once the installer is complete just start cross compiling from the note found below.
$ sudo apt-get install schroot
Now we need to configure and entry point for schroot. Edit configuration file in /etc/schroot/schroot.conf. Append the following text to schroot.conf using nano or any other text editor:
Now we can install Ubuntu Natty. Create the directory Ubuntu will be installed into using the following command:
$ sudo mkdir -p /srv/chroot/natty
Once the directory is created. An initial base Ubuntu can be installed using the following command:
*Note you need to be connected to the internet and this process will take several minutes to complete. So go grab a frosty beverage and a snack.
$ sudo debootstrap natty /srv/chroot/natty http://archive.ubuntu.com/ubuntu/
Once this has completed we need to add some resources to the apt-get repositories. Follow the process shown below to enter the schroot natty installation and update the apt sources and also install the ARM GNUeabi cross compiler tools.
$ schroot -c natty
$ sudo -s
$ echo "deb http://archive.ubuntu.com/ubuntu natty restricted" >> /etc/apt/sources.list
$ echo "deb http://archive.ubuntu.com/ubuntu natty universe" >> /etc/apt/sources.list
$ apt-get update
*If you are running on a fresh install of Ubuntu without any update applied, you can start cross compiling from here and ignore all the schroot commands.
$ apt-get install gitk bzr bzr-grep bzr-gtk linaro-image-tools make picocom u-boot-tools gcc-4.5-arm-linux-gnueabi ccache gcc ctags cscope
$ update-alternatives --install /usr/bin/arm-linux-gnueabi-gcc arm-linux-gnueabi-gcc /usr/bin/arm-linux-gnueabi-gcc-4.5 80
Now that we have an properly configured environment we can cross compile a kernel for use on the Beagleboard. The next step is downloading kernel sources from the kernel.org using git. Enter schroot and use the following commands in you home directory to download the extra tools sources we need to compile. You will also need to download the provided pre-configured defconfig file to set up the necessary kernel options.
$ schroot -c natty
$ sudo apt-get install git-core debhelper build-essential fakeroot kernel-wedge uboot-mkimage
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git linux-omap
$ cd linux-omap
$ git checkout -b temp v2.6.39
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- distclean
This next step is optional:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap2plus_defconfig
Use this defconfig instead:
$ sudo wget http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/linux/linux-omap-2.6.39/beagleboard/defconfig
$ sudo mv defconfig .config
Some changes need to be made to the config file that you just downloaded to enable the DSP Bridge. Use the following command to configure the kernel.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
Once menuconfig is running. Use the arrow keys to scroll down to Device Drivers and press ‘Enter’ key. In the sub-menu scroll down to Staging Driver and enable it by pressing the ‘spacebar’. Enter the Staging Driver sub-menu and scroll down to DSP Bridge Driver and press ‘M’ key to make it a kernel module. Press ‘ESC’ key until you reach the main menu. Press ‘ESC’ key once again and you should be prompted to save the changes you just made to the config file. Now continue with the following commands. Hopefully you still have some snacks left.
*Note the next two commands are not necessary to build the kernel, but will be needed if you plan on compiling the DSPLink kernel modules, to be discussed in a later posting.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- prepare
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- scripts
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=`pwd`/copy-modules
The compiled uImage file will be located in $HOME/linux-omap/arch/arm/boot directory. Copy this file to the root of the boot partition of your sdcard. Now copy the contents of the copy-modules folder to the rootfs of your sdcard.