Linux內核包含了很多東西,她能支持很多的驅動,設備,所以Linux內核會很大(通常一個壓縮的Linux內核包在70多M)。在嵌入式開發中,我們需要我們自己的內核小一點,以便能放到我們的設備上面跑,但又不失其內核的功能。所以,我們需要對Linux內核進行裁剪,使其足夠小。
[Linuxidc@CentOS6 kernel]$ ls
build.sh linux-3.0 linux-3.0.tar.bz2 patch
[Linuxidc@centos6 kernel]$ cd linux-3.0
[Linuxidc@centos6 linux-3.0]$ ls
arch CREDITS drivers include Kbuild lib mm README scripts tools
block crypto firmware init Kconfig MAINTAINERS modules.order REPORTING-BUGS security usr
COPYING Documentation fs ipc kernel Makefile net samples sound virt
[Linuxidc@centos6 linux-3.0]
使用如下的命令,可以配置實現內核的裁剪
[Linuxidc@centos6 linux-3.0]$
[Linuxidc@centos6 linux-3.0]$ export TERM=vt100
[Linuxidc@centos6 linux-3.0]$ make menuconfig
scripts/kconfig/mconf Kconfig
.config - Linux/x86_64 3.0.0 Kernel Configuration
----------------------------------------------------------------------------------------------------------------------------------
+------------------------------------------ Linux/x86_64 3.0.0 Kernel Configuration ------------------------------------------+
| Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted letters are hotkeys. Pressing <Y> includes, |
| <N> excludes, <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] built-in |
| [ ] excluded <M> module < > module capable |
| |
| +-------------------------------------------------------------------------------------------------------------------------+ |
| | General setup ---> | |
| | [*] Enable loadable module support ---> | |
| | -*- Enable the block layer ---> | |
| | Processor type and features ---> | |
| | Power management and ACPI options ---> | |
| | Bus options (PCI etc.) ---> | |
| | Executable file formats / Emulations ---> | |
| | -*- Networking support ---> | |
| | Device Drivers ---> | |
| | Firmware Drivers ---> | |
| | File systems ---> | |
| | Kernel hacking ---> | |
| | Security options ---> | |
| | -*- Cryptographic API ---> | |
| | [*] Virtualization ---> | |
| | Library routines ---> | |
| | --- | |
| | Load an Alternate Configuration File | |
| | Save an Alternate Configuration File | |
| +---------------------------------------------------------------------------------------------------------------------+ |
|+------------------------------------------------------------------------------------------------------------- +|| + <Select> < Exit > < Help > +|
| +----------------------------------------------------------------------------------------------------------------------+|
linux內核是以模塊化的形式存在的,或者說linux驅動是以模塊化的形式存在的。在linux中,存在有兩條鏈(做一個形象的比喻),一條是驅動鏈,一條是設備鏈。