Lab4 - Cross Compile a Kernel (uImage) for Beagle Board

Objective:  Learn how to cross-compile a kernel for an OMAP target platform.
  • After this lab, you will be able to
    • Set up a cross-compiling environment
    • Configure the kernel Makefile accordingly
    • Cross compile the kernel for the Beagle arm board
    • Use U-Boot to download the kernel
    • Check that the kernel you compiled can boot the system


  1. Ubuntu 10.04 (Lucid Linux) as a virtual machine in VMware Server/Workstation.
  2. 2 GB SD card.
  3. Successful completion of Lab3.



(1) Setup

Go to the /home/<user>/felabs/sysdev/xkernel directory.


If you haven't done the previous labs, install the following packages: libqt3-mt-dev, g++.


Also install uboot-mkimage.

$ apt-get install libqt3-mt-dev g++ uboot-mkimage


Target system


We are going to cross-compile and boot a Linux kernel for the TI OMAP Beagle board.


(iGetting the sources


Get the latest kernel sources from the master branch of the official linux-omap-2.6 git repository.

git clone git:// linux-omap-2.6


Once more, if the git protocol is blocked by your firewall, you could also clone the git source tree through http:


git clone linux-omap-2.6



(ii) Cross-compiling environment setup


To cross-compile Linux, you need to install the cross-compiling toolchain. We will use the cross-compiling toolchain that we previously produced, so we just need to make it available in the



export PATH=$PATH:/usr/local/xtools/arm-unknown-linux-uclibcgnueabi/bin/



(iii) Makefile setup


Go into directory linux-omap-2.6.


cd linux-omap-2.6


Modify the toplevel Makefile file to cross-compile for the arm platform using the above toolchain.


(2) Linux kernel configuration [Optional]


By running make help, find the proper Makefile target to configure the kernel for the OMAP Beagle board. Once found, use this target to configure the kernel with the ready-made configuration.

Don't hesitate to visualize the new settings by running make xconfig afterwards!



(3) Cross compiling a Linux kernel


You're now ready to cross-compile your kernel.


Use following commands to build uImage and wait for while for the kernel to compile


Look at the end of the kernel build output to see which file contains the kernel image.


make distclean




make ARCH=arm CROSS_COMPILE=arm-linux- omap3_beagle_defconfig




However, the default image produced by the kernel build process is not suitable to be booted from U-Boot. A post-processing operation must be performed using the mkimage tool provided by U-Boot developers. This tool has already been installed in your system as part of the ubootmkimage package.


To run the post-processing operation on the kernel image, simply run:


$ make menuconfig                             # only needed if you want to change the default configuration
make ARCH=arm CROSS_COMPILE=arm-linux- uImage



Following Snapshot shows that uImage is successfully created.

Copy it in SD card first partition.



Following Snapshot shows files which are required in first partition of SD card. (Among them MLO, u-boot.bin, x-load.bin.ift are created in Lab 3 document).



(4) Integrating the root file system


Download following file which is required for beagle board root file system   [275MB]


Copy the root file system into the second partition (the ext3 one) as below:


$ sudo cp Angstrom-Beagleboard-demo-image..... /media/LABEL2


Untar it. (IMPORTANT: You must untar directly onto the SD card. Do not untar somewhere else and then copy to the SD):


$ cd /media/LABEL2
$ sudo tar -jxvf Angstrom-Beagleboard-demo-image....


(If you get "permission denied" errors while copying or untaring it to the SD Card then issue that command using 'sudo' e.g "sudo cp Angstrom-Beagleboard-demo-image..... /media/LABEL2")


Once that's done, delete the tarball:


$ sudo rm Angstrom-Beagleboard-demo-image....


LABEL2 partition of SD card is having following contents.



(5) Setting up serial communication with the board


Plug the Beagle board on your computer.

Start Minicom on /dev/ttyS0, or on /dev/ttyUSB0 if you are using a USB to serial adapter.


You should now see the U-Boot prompt:



Type the following command to set up the boot environment.


setenv bootargs 'console=ttyUSB0,115200n8 root=/dev/mmcblk0p2 rw rootwait'


Using this u-boot prompt, you now can start kernel uImage stored on MMC card manually:


OMAP3 # mmc init
OMAP3 # fatload mmc 0:1 0x80000000 uImage
OMAP3 # bootm 0x80000000


Following snapshot shows booting the kernel.


Type “root” at beagle board login and press enter.



Then go to the root directory and list files and you can see the following result.



You can mount first partition of SD card on beagle board as below.





[1]   To create uImage for Beagle Board

[2]    Information of cross compiling linux kernel

[3]    Download Angstrom Beagle board demo image required for beagle board root file system   [275MB]

[4]    Test root file system on Beagle Board