Linux内核配置和驱动文件


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中,存在有两条链(做一个形象的比喻),一条是驱动链,一条是设备链。

  • 1
  • 2
  • 下一页

相关内容