Tuesday 25 February 2014

Linux kernel introduction

Hi guys...
    
    Today we'll try to gather information about Linux kernel source code... and then further we'll explore the Linux kernel and will cross compile Linux kernel source code for our ARM device (which i am using Beaglebone black... ).

The Linux kernel is one component of a system, which also requires libraries and applications to provide features to end users...

The Linux kernel was created  in 1991 by  Linus Torvalds.



Inside the Linux kernel :

The whole Linux sources are Free Software released under the GNU General Public License version 2.

Supported hardware architectures :  
See the arch/ directory in the kernel sources It support minimum 32 bit processors, with or without MMU, and gcc support... 
32 bit architectures (arch/ subdirectories) :
Examples: arm, avr32, blackfin, m68k, microblaze, mips, score, sparc, um
64 bit architectures:
Examples: alpha, arm64, ia64, sparc64 etc

Linux versioning scheme and development process : See in official kernel source code website which is maintained by Linus Torvald, You will get lots of Linux kernel Source code with different version... So here we need to understand the versioning system of linux kernel source...
Version of Linux kernel tells about two types of kernel one is stable kernel which is fully developed and ready to use and it is almost bugs free, and second one is unstable source which is under development...

So how to recognize...    One stable major branch comes in every 2 or 3 year which is identified  by an even middle number. examples: 1.0.x, 2.0.x, 2.2.x, 2.4.x 

One development branch(unstable kernel) to integrate new functionalities and major changes which is identified by an odd middle number.  examples: 2.1.x, 2.3.x, 2.5.x

After some time, a development version becomes the new base version for the stable branch.


Linux Kernel Source : The official version of the Linux kernel, as released by Linus Torvalds is available at http://www.kernel.org click here to see.

Linux 3.10 sources:
Raw size: 573 MB (43,000 les, approx 15,800,000 lines)
gzip compressed tar archive: 105 MB
bzip2 compressed tar archive: 83 MB (better)
xz compressed tar archive: 69 MB (best)


Getting Linux sources : You can get Linux kernel Source code from here.
http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.xz

After getting source code in tar folder we have to extract it using command: 
tar Jxvf linux-3.10.9.tar.xz

Don't worry about the commands and all now practically we will do it in next post... just understand the things how to get kernel and which version we should use... :)

Kernel con figuration :
The kernel con guration and build system is based on multiple Make files... 
All Makefiles inside the sub-directories in kernel source  interacts with the main Makefile which is present in the top directory of the kernel source tree. 
                      Interaction between all make files takes place using the make tool, which parses the Make file, through various targets, de fining which action should be done (con guration, compilation, installation, etc.).
Run make help to see all available targets.
Example:  $ make help // It will show all architecture defined in kernel source
                $ cd linux-3.6.x/
                $ make <target>  // Choose specific target 

The con guration for the specific target is stored in the .config file at the root of kernel source in simple text 
fi le, like key=value style.

As options have dependencies, typically never edited by hand, but through graphical or text interfaces:
 make xconfig, make gconfig (graphical)
 make menuconfig, make nconfig (text)
You can switch from one to another, they all load/save the same .config le, and show the same set of options

So this is how kernel is managed in kernel main line.... In next post we'll download latest kernel source code and we we'll compile the source code using cross compiler....

That's all for today !!
Good day

Abhishek Mourya 



No comments:

Post a Comment