Compiling Linux for SAM9: SAM9G20-EK board (Target) on Ubuntu (Host)

I am compiling Linux for SAM9G20-EK board. I will be doing this fresh with my Host as Ubuntu 9.10. Ubuntu will be running on Sun Virtual Machine. I will be also working on a native Linux machine

If you are expecting an already configured virtual machine for ARM9G20-EK board you can download form the following link

This exercise is to help any newbie in bringing up the tool-chain. Here the tool-chain will not be recompiled. I will fetch already compiled binaries to build Linux.

1. Please download the appropriate package from the link for the SAM9G20 a package with  arm5te should be chosen. I have chosen the package angstrom-2009.X-test-20091214-armv5te-linux-gnueabi-toolchain-qte-4.6.0-i686.tar.bz2 for Ubuntu9.0 on i686 host.

2. After downloading the same untar it to the root folder (/). You will find a new folder /usr/local/angstrom/arm/ and it contains the environment-setup.

3. Add the commands in environment-setup to your ~/.profile and log off and log in to make the commands take effect.

4. We can test our installation and tool-chain by following the example. This example is taken form Creating and building a simple example. We will create a simple Qt Embedded application and use qmake2 and make to cross compile.

$ cd $HOME
$ mkdir qte-example
$ cd qte-example

$ echo "TEMPLATE=app
" >

$ echo '#include <QApplication>
#include <QPushButton>

int main(int argc, char** argv) {
    QApplication app(argc, argv);

    QPushButton btn("Hello World");;

    return app.exec();
' > main.cpp

$ qmake2
$ make
$ ls -l

-rw-r--r-- 1 prajosh prajosh   221 2011-03-07 14:53 main.cpp
-rw-r--r-- 1 prajosh prajosh  4500 2011-03-07 14:53 main.o
-rw-r--r-- 1 prajosh prajosh 10505 2011-03-07 14:53 Makefile
-rwxr-xr-x 1 prajosh prajosh  9516 2011-03-07 14:53 qte-example
-rw-r--r-- 1 prajosh prajosh    31 2011-03-07 14:52

will be the output of ls command. Where qte-example is the executable generated from make

$ ./qte-example 
bash: ./qte-example: cannot execute binary file

which shows this executable is not for the Host. This confirms our toolchain

5. Download the kernel source from I have used linux-

6. Once the Kernel have been downloaded we can unzip it and start work
$ cd $HOME
$ mkdir Code
$ mkdir -p Code\Linux_kernel
$ cd Code\Linux_kernel

copy the kernel zip bundle here and unzip or rar or tar it here

$ cd linux- or which ever version you have downloaded
$ make at91sam9260ek_defconfig ARCH=arm

this will generate the .config file for the final make

6. Fire make with the following command
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi-

On completion of the make the Linux image can be found in the Linux folder in my case linux- 🙂 enjoy.........


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s