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

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

Raj Board of Secondary Education, Rajasthan Results at rajeduboard.nic.in Board 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 ...

ahsec results 2008 | www.ahsec.nic.in

The official website of assam higher secondary education council Results of Assam is down seems they are uploading results , direct link to check ahsec results 2008 is http://resultsassam.nic.in/index.asp You can find results of AHSEC at the link above. current page The Website www.ahsec.nic.in Designed Developed & Hosted by NIC, Assam State Centre, Guwahati is down for result uploading. keep checking this page, I will update as soon as news comes. All the best to AHSEC - assam higher secondary education council students. Direct links http://assam.nic.in/ www.ahsec.nic.in http://resultsassam.nic.in/

Encyclopedia of Life - by the World's Leading Scientists

An epic effort to promote biodiversity and document all 1.8 million named species on the planet. When completed, http://www.eol.org will serve as a global biodiversity tool, providing scientists, policymakers, students, and citizens information they need to discover and protect the planet and encourage learning and conservation. The Encyclopedia of Life is a collaborative scientific effort led by the Field Museum of Natural History, Harvard University, Marine Biological Laboratory, Missouri Botanical Garden, Smithsonian Institution, and Biodiversity Heritage Library, a consortium including the core institutions and also the American Museum of Natural History (New York), Natural History Museum (London), New York Botanical Garden, and Royal Botanic Gardens (Kew). clipped from www.eol.org clipped from www.eol.org "Imagine an electronic page for each species of organism on Earth, available everywhere by single access on command." - Edward O. Wilson The Encyclopedia of Life (E...