Thursday, February 8, 2007

How to Port Linux on Arm 9

I did it in my Embedded systems Project.

here are exact steps to be followed:


Porting of Linux onto the ARM9 board

VARIOUS ASPECTS OF PROTING LINUX ON ARM 9 BASED BOARD : -

1. Board:- SMDK2410 has S3C2410 microprocessor based on arm9 architecture.
SMDK2410 for S3C2410 is a platform that is suitable for code development of SAMSUNG's S3C2410, 16/32-bit RISC microcontroller (ARM920T) for hand-held device and general applications.

It shows the basic system-based hardware design which uses the S3C2410. It can evaluate the basic operations of the S3C2410X01 and develop codes for it as well.

SMDK2410 (Samsung MCU Development Kit) consist of S3C2410, boot EEPROM (Flash ROM), SDRAM, LCD interface, two serial communication ports, configuration switches, JTAG interface and status LEDs.

2. Overview: - SMDK 2410 is a quite limited resource device. The functions that we require on our board after porting Linux on to it :-

- Webcam support
- Serial port API
- Some memory for handling files up to 50 KB and image compression code

We are using 2.6 kernels for our Port.
For the time being we are booting the Linux from the RAM of JTAG. In near future we will try to implement the booting from Flash memory or any other non volatile memory.

Boot loader we will be using is vivi.

3.Steps on Linux Porting:-

1. Installing cross compilers :- Since architecture of normal PC is different from that of target board we need to cross compile our kernel so that it can run on target.
We installed arm Linux tool chains for compiling the kernel for the arm.

Following files were used to install cross platform tool chains:-

2.6.10-at91.patch.gz
26_at91_serial.c.gz
binutils-2.16
binutils-2.16.tar.gz
flow.c.diff
gcc-3.4.4.tar.bz2
glibc-2.3.5.tar.gz
ioperm.c.diff
linux-2.6.10.tar.gz
t-linux.diff


Building toolchain:

gcc-core only contains the C compiler, if you want other languages you can download the sources separately or you can use the full gcc sources.

I downloaded to /usr/local/src/arm-elf-tools/src, then I used the following script:

#! /bin/sh
# Variables
export target=arm-elf
export prefix=/usr/local/src/arm-elf-tools
export PATH="$prefix/bin":"$PATH"
# Unpack
cd $prefix/src
tar jxf binutils-2.17.tar.bz2
tar jxf gcc-core-4.1.1.tar.bz2
tar zxf newlib-1.14.0.tar.gz
tar jxf gdb-6.5.tar.bz2
# Build
cd $prefix
mkdir build-binutils
cd build-binutils

../src/binutils-2.17/configure --target=$target --prefix=$prefix -v
make all install
cd ..
mkdir build-gcc
cd build-gcc
../src/gcc-4.1.1/configure --target=$target --prefix=$prefix -v \

--with-arch=armv4t --with-cpu=arm7tdmi --with-newlib \

--enable-languages=c \

--enable-static --disable-shared --disable-thread \

--disable-libssp --disable-libmudflap

make all install

cd ..



# newlib wants arm-elf-cc but there is only arm-elf-gcc, so we make a link

cd bin

ln -s arm-elf-gcc arm-elf-cc
cd ..
mkdir build-newlib
cd build-newlib

../src/newlib-1.14.0/configure --target=$target --prefix=$prefix -v

make all install

cd ..



cd build-gcc

# second make run for gcc

make all install

cd ..
mkdir build-gdb
cd build-gdb

../src/gdb-6.5/configure --target=$target --prefix=$prefix -v
make all install


2. Compiling Kernel:- We are building the kernel 2.6.10. We used arm-elf-gcc as compiler for our kernel. Instructions for compiling the kernel were available with the kernel source package that we downloaded. The kernel was compiled by using following command:-

-make menuconfig

# for configuring the kernel on our own rather that accepting the default configuration.

-make zImage
# for making kernel image


Note Make proper directory structure for building the kernel

3.Next Step :- Porting the custom built Linux on the target board using Jtag. .. Easy step but we are waiting due to non availability of JTAG till now.

4. Also configuring the boot loader program for booting from kernel image.

Thats mee ...

Thats mee ...

About Me

Delhi, Delhi, India
I am an Electrical Engineering student of Indian Institute of Technology, Delhi. I am currently in 5th year of my Dual Degree course. By the end of this course I will proudly be called Masters in Information and Communication Technology. I have hard core programming interest and good at Networking Fundamentals. Enjoy surfing around Linux journals.