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

Dotnet, .Net 3.5, 2.0, C# Interview Questions

Few questions on dotnet, C# 2.0, 3.5 On Object oriented concepts 1)What is inheritance with e.g 2)What is polymorphism -function overloading -Function overriding -virtual keyword use -Static keyword and use -Abstract classes -Interface -Object 3)What is threading and how do we use in realtime application(cognizant) 4)What is threadpooling, lock, monitor(write code sample) 5)Architecture of current project 6)Session state, diffrent types of state management. 7)What is Application_Start, how it works. 8)Type of authentication in asp.net 9)How to configure ASP.NET application. 10) What is Impersonation. 11) What is WebService, WSDL, UDDI, Discovery, asmx files. 12) How to implement WebService and use it. 13) When to use WebServices. 14) WPF, how to implement(BOA) 15) Testing concvepts. 16) Test attributes 17) Flow of Automation Test Method execution 18) Features of dotnet 3.5 19) CLR, garbage collection 20) Finally block 21) Manifest, Metadata, MSIL 22) Assemblies, Type of assemblies, str...

Linux SMB write performance With Simple Tips

SMB write performance can be increased by Tuning the buffer cache. The secret to good performance is to keep as much of the data in memory for as long as is possible. Writing to the disk is the slowest part of any filesystem. If you know that the filesystem will be heavily used, then you can tune this process for Linux Samba. writing out dirty blocks to the disk until the filesystem buffer cache is 80 percent full (80). default is 40%, source = http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap29sec287.html by writing echo 80 > /proc/sys/vm/dirty_ratio I am getting around 2MB increase while write operation, tested in Xp. I have tried with this single option, as the ref source is for linux 2.2 and we are using 2.6 kernel. we can try out Linux General Optimization suggested at http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/gen-optim.html Tried with smb.conf, I am getting around 1MB gain while read and write. socket options = TCP_NODELAY I...

The Linux Foundation Free Training Program at linuxfoundation

The Linux Foundation Training Program is: * For the Community, by the Community. The Linux Foundation is building the program with its Technical Advisory Board to ensure the content, instructors and classes are the top quality available. * Technically the most advanced. Since the Linux Foundation works directly with community developers, it can cover features and advances in Linux before commercial companies. * Connected. The Linux Foundation has unfettered access to the leading developers and companies in the Linux ecosystem and will use these connections to best position attendees for success. For example, attendees can attend the exclusive, invite-only Collaboration Summit where they can forge connections beneficial to their career. * Real World. The Linux Foundation training courses all have hands on components and a highly rigorous curriculum of programming or administration exercises. Graduates will be well equipped to master Linux programming and system administr...