Skip to main content

Building Kernel for Embedded Linux with ARM board

I am giving general steps for building embedded linux for ARM board.
Building kernel for embedded linux

1. Download kernel
untar it using
bz2 format is more compressed than gz ;bz2 - tar -xvjx linux-x.x.x
GNU zip fromat gz - tar -xvzf linux-x.x.x

2. Configure kernel
Before you make build the kernel configure it. Linux kernel provides lot of features and almost all driver support.
All the features are not required for our embedded application. Select the required features, like processor type
if your board have USB support select the USB support. If your board have SATA support select the requried module.
one can configure linux kernel using
make config - text based configuration
make menuconfig - menu based configuration
make xconfig - x11 based configuration
make gconfig - gtk+ based configuration
If you are new to configuration you can start with make defconfig - creates default configuration and kept in
root folder as .config file. The flags which are set in this file are with CONFIG_USB.
Configuration comes as yes or no states. For modules it is tristate ie yes, no or module. In case of module yes
implies it is inbuilt in kernel. module implies it compiled as .ko and placed in respective directory. One can
attach these modules at runtime.
Make sure you have some root device (initial ramdisk, NFS) for your target system.

3. Build the kernel
Build the kernel using
make
no need to give compile option like make zImage if you are using linux 2.6 series.
This will compile the kernel using options selected, and compiled kernel image is kept in arch/arm/boot/zImage

4. Create the Filesystem
U-Boot does not support normal linux kernel images like zImage or Image (arch/arm/boot/),
you have to create an uImage file with the mkimage tool which encapsulates kernel image with header information,
CRC32 checksum, etc. More specifig "mkimage" encapsulates the images with a 64 byte header containing information about target architecture,
operating system, image type, compression method, entry points, time stamp, CRC32 checksums, etc.

The mkimage U-Boot tool is used to convert a standard kernel image into uImage format needed by bootm U-Boot
command. mkimage comes in source code with U-Boot distribution and it is built during U-Boot compilation

See U-Boot README file for more information.

Command to generate a compressed uImage file :

mkimage -T kernel -C none -a 0x8000 -e 0x8000 -d /arch/arm/boot/zImage scp_zimage


mkimage -A arch -O os -T type -C comp -a addr -e ep \
-n name -d data_file image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
5. Installing and loading the kernel image
To downloading a U-Boot image over the serial (console) interface, you must convert the image to S-Record format
using objcopy command. Instead load the kernel image over ethernet using TFTPBOOT command provided in U-boot.
In case of a Linux kernel image, the contents of the "bootargs" environment variable is passed to the kernel as
parameters. You can check and modify this variable using the "printenv" and "setenv" commands
change the bootargs as per your board configuration
on my board kernel image is stored in mtdblock3 so my options for bootargs is

setenv bootargs root=/dev/mtdblock3 rw rootfstype=jffs2 mem=64M@0x0


Mention filesystem type you are going to use, one can choose from ext2, ext3 and jffs2 filesystem type.
finally do bootmf to boot from flash,
These are very general steps and will require changes as per board design.

Comments

Popular posts from this blog

Xilinx's Interview Questions

Xilinx is the world's one of largest supplier of programmable logic devices. It has started R & D department in Hyderabad, India. It has broad scope for embedded system programming in device driver in linux.

Before the interview you have to feel the Xilinx form with information containing all academic details, current/previous employer, contacts of employer( to check out info about you), current ctc, expected ctc and expected date of joining, etc.

I appeared two back to back technical interviews.

The first interview was taken by a young man look like just crossed 30's.

He asked me to tell me about myself.

Then he asked my experience.

He checked my expertise in resume.

He asked questions about RTOS, and Linux Device Drivers.
What is RTOS ? Define it.
How a linux device driver works?
How a character driver works?

He looked at my project summaries and started to ask in depth questions about each project.

After that he asked me to write to delete nth node from starting in Singly Linked Li…

Rajasthan Board 10th Results | rajedubord.nic.in | RBSE

Raj Board of Secondary Education, Rajasthan Results at rajeduboard.nic.inBoard of Secondary Education, Rajasthan Ajmer declared result of secondary examination today at 4PM official site is rajedubord.nic.in

check Secondary Examination- 2008 Result
(To be announced on July 1st, 2008 at 4:00 PM)
source
http://rajresults.nic.in/

Declared result
Praveshika Examination-2008 Result
(Announced on June 25, 2008 at 4:00 PM)

The history of the Board of Secondary Education Rajasthan (BSER) is a remarkable panorama of progressive record of the futurological vision for developing a dynamic system of various sub-systems of examinations and highlights of the academic excellence of the last four decades. The BSER took rapid strides for promotion and development of Secondary Education in Rajasthan, spread over 3,42,239 sq. km. and in more than 6000 schools located in 32 districts involving 8.5 lakhs students for Secondary and Senior Secondary Examination in the year 2000.

At present the Board is conducting …

Delete Last Char in String C program Simple Way

How to delete the last character in a string?
Lets say I have a string "/data/share/" I want to delete the last character from the string ie "/" so that output will be "/data/share"; Here are some methods to do this in C language.
one way could be use of strncat() function;
char*strncat(char*restricts1, constchar*restricts2, size_tn);
The strncat() function appends not more than n characters from s2, and
then adds a terminating `\0'.
#include
Another simple way is,
say the string variable is str_p
Then simply put
str_p[(strlen(str_p)-1)] = '\0';
And you are done;