Compiling uClinux with kernel linux-2.6.21

Hello everybody!

Today I’ll show you what I did to compile the kernel.. First of all I’m assuming that you
have already installed build-essentials and mtd-tools packages.
Now let’s begin the hard work! =D

1) Download all these packages:
– uClinux-dist-20070130.tar.gz
– ea-uClinux-081020.diff.gz
– ea-v3_1_incr1.diff.gz
– linux-2.6.21.tar.gz
– arm-linux-tools-20061213.tar.gz
– arm-elf-tools-20040427.sh
– mkimage (used to generate uLinux.bin)

2) untar toolchain 1. (It will untar in the same directory where you download it. I add this path to the $PATH)

tar -zxvf arm-linux-tools-20061213.tar.gz
export PATH=$PATH:path-to-the-download-directory/usr/local/bin


Note: You can either move this directory to a directory in the PATH or add the path into the $PATH in your /home/user/.bashrc. In this way you don’t have to export everytime you open a new console.

install toolchain 2.

./arm-elf-tools-20040427.sh

I had a problem when installing this toolchain. If you get an error too, edit this file and try changing:

tail +${SKIP} ${SCRIPT} | gunzip | tar xvf -

by

tail -n +43 ${SCRIPT} | gunzip | tar xvf -

Copy mkimage to /usr/local/bin and set it as executable

sudo chmod +x /usr/local/bin/mkimage

3) untar uClinux and then remove old kernel

tar -zxvf uClinux-dist-20070130.tar.gz
rm -r ./uClinux-dist/linux-2.*

4) untar linux-2.6.21 and move it to uClinux-dist

tar -zxvf linux-2.6.21
mv ./linux-2.6.21 ./uClinux-dist/linux-2.6.x

5) apply both patchs

cd ./uClinux-dist
gunzip -c ../ea-uClinux-081029.diff.gz | patch –p1
gunzip -c ../ea-v3_1_incr1.diff.gz | patch –p1

6) Configure & Compile.
a)Choose vendor Embedded Artists and board LPC2468
b)Disable i2c in device drivers > I2C support > <> I2C support

make menuconfig
make ARCH=arm CROSS_COMPILE=arm-elf-

After make, you will get an error. You must include <linux/limits.h>  in the file ./linux-2.6.x/scripts/mod/sumversion.c. Make again and go take a coffe.
The images will be in the folder ./images

-rw-r--r--  1 user user 1012K 2011-06-14 14:13 cramfs.img
-rw-r--r--  1 user user  4.2M 2011-06-14 14:13 image.bin
-rw-r--r--  1 user user     0 2011-06-14 14:13 jffs2.img
-rwxr-xr-x  1 user user  162K 2011-06-14 14:13 linux.data
-rw-r--r--  1 user user  1.1M 2011-06-14 14:13 linux.gz
-rwxr-xr-x  1 user user  2.1M 2011-06-14 14:13 linux.text
-rw-r--r--  1 user user  1.9M 2011-06-14 14:13 romfs.img
-rw-r--r--  1 user user  1.1M 2011-06-14 14:13 uLinux.bin

It’s weird that we need 2 toolchain… I don’t know why, but arm-linux- is used to compile the kernel (actually the kernel complains that the toolchain arm-elf is too old). It has been forced to, even if you set CROSS_COMPILE=arm-elf-. The rest is compiled with arm-elf-, so, be sure that both toolchain is in the path.

Until today, jffs2 file system can’t be generated following these instructions. I’ll check later! =D

Next post we’ll update u-boot and boot the kernel! Wait and you’ll see! =D
That’s all

Marcelo Jo

Marcelo Jo

Marcelo Jo is an electronics engineer with 10+ years of experience in embedded system, postgraduate in computer networks and masters student in computer vision at Université Laval in Canada. He shares his knowledge in this blog when he is not enjoying his wonderful family – wife and 3 kids. Live couldn’t be better.

LinkedIn 

One Response to 'Compiling uClinux with kernel linux-2.6.21'

  1. DJ Tulan says:

    I guess the used Toolchains from EA are very old. Newer ucLinux Distributions can be compiled an easier way.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.