[Android] michael.the.don:
Part II

Part II

Overview Linux Kernel Source:-

The Linux Source structure is defined in this section. The directories give here are at the top level of the Linux source tree.

Makefile

This is the top level Makefile for the whole source tree. It defines a lot of useful variable and rules, such as the default gcc compilation flag. Here also we set the architecture and the version.

Documentation/

This directory contains a lot of useful information about configuring the kernel and all the help items. The help entries corresponding to the different configuration cannot be found here. They are located in the Kconfig files in each source directory. If you are starting out this folder you should now miss.

arch/

All the architecture corresponding codes are in this directory. Each architecture has its own directory underneath this directory. Some of the important sub-directories are -

arch/<ARCH>/mach-<machine>

machine/board specific code

arch/<ARCH>/include/asm

architecture specific headers

arch/<ARCH>boot/dts

Device tree architecture

block/

Block layer code

COPYING

This contains the license(GNU GPLv2)

CREDITS

This contains the main contributors are mentioned here.

crypto/

This is the cryptographic API for the use by the kernel itself

drivers/

In this directory we find all the device drivers of the peripheral devices. Only sound device driver is not located here.

firmware/

Firmware images extracted from old drivers are located here.

fs/

This directory contains the generic filesystem code, known as Virtual File System and also the code for each different filesystem are found in this directory. If you are on a Linux distribution, the root filesystem is probably ext4 filesystem. The code to read the ext4 filesystem can be found in

fs/ext4

.

include/

This directory contains all the kernel headers. During compilation a symbolic link from the asm-<ARCH> is created so the

#include <asm/file.h>

will get proper file for that architecture. There are other non-architectural specific header file.

init/

This directory contains the files main.c and version.c and code for creating an “early userspace”. The version.c defines the Linux version string.

ipc/

IPC stands for inter process communication. It contains the code for shared memory and other forms of process communications.

Kbuild

Part of the kernel build system.

kernel/

It contains the general kernel level code.

lib/

Routines of generic usefulness to all kernel code are here.

mm/

High level memory management codes are found here. Virtual memory(VM) implementation and early boot memory management are done here, as well as memory mapping of files, management of paging cache, memory allocation are done here.

net/

The high-level networking code is here. The low-level networking driver pass received packets up to and get get packets to send from this level, then it passes the data to the main application.

scripts/

This directory contains scripts that are useful in building the kernel, but does not include any code that is incorporated into the kernel itself.

sound/

Drivers for sound cards and other sound related code is placed here.

usr/

This directory contains code that builds a cpio-format archive containing a root filesystem image, which will be used for early user space.

tools/

Code for various user space tools

security/

Code for different Linux security models can be found here.

samples/

Sample codes