AddThis Social Bookmark Button

03 Kernels


Kernel Selection

Kernel keeps growing to support new hardware and devices. The developer should study the kernel very carefully to check the availability of specified features in the kernel. Basically, only kernel.org is the main site. But it is better to get kernels or kernel patches ported to specific platforms as following:

x86

 

 

 

 

 

ARM

 

 

 

 

 

PowerPC

 

 

 

 

 

MIPS

 

 

 

 

 

SuperH

 

 

 

 

 

M68K

 

 

 

 

 

Kernel Configuration
The kernel has many platform dependent configuration items. That means some items/options are only available for specific platforms. And some options may have different meaning or have dependency on other options. The developer must check the release note and support documents for detail. The developer can configurate his new kernel in many ways and generate corresponding .config file as result. These configuration methods (commands) are:

  • make config, a command line tool to ask for your kernel one by one.
  • make oldconfig, a tool to load existing .config file.
  • make menuconfig, an interactive config tools, it need building the tools from source. I was completely confused when I first use this tool, but it is main tool to make a kernel config, and it works fine on non-x86 host computer.
  • make xconfig, another interactive config tools based upon X-Windows.

Build Kernel
To build / compile a kernel, we have three steps to complete: setup dependency of sources, build kernel image and build kernel modules. If we use ARM as sample project, we must use following commands:

Setup Dependency
$ make ARCH=arm CROSS_COMPILE=arm-linux- clean dep

Build Kernel Image
$ make ARCH=arm CROSS_COMPILE=arm-linux- zImage

Build Kernel Modules
$ make ARCH=arm CROSS_COMPILE=arm-linux- module

Then backup .config file, generated file and run
$ make ARCH=arm CROSS_COMPILE=arm-linux- disclean

Books

  • Running Linux, O'Reilly
  • Linux Device Drivers
  • Understanding the Linux Kernel