Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2225365
  • 博文数量: 668
  • 博客积分: 10016
  • 博客等级: 上将
  • 技术积分: 8588
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-29 19:22
文章分类

全部博文(668)

文章存档

2011年(1)

2010年(2)

2009年(273)

2008年(392)

分类:

2009-04-30 11:20:45

三、适合CLFS临时系统的最简内核配置
我的host系统是32位的,无法使用chroot方式构建CLFS系统,只能先交叉编译出一个最小的临时系统,然后以BOOT方式完成CLFS系统的构建。在CLFS BOOK中,对临时系统的内核的配置有下面的警告:
Warning
Here a temporary cross-compiled kernel will be built. When configuring it, select the minimal amount of options required to boot the target machine and build the final system. I.e., no support for sound, printers, etc. will be needed.
Also, try to avoid the use of modules if possible, and don't use the resulting kernel image for production systems.

那么,怎样得到一个适合CLFS临时系统的最简内核配置呢?

(1)首先,用内核的 allnoconfig 配置目标,得到一个最最基本的内核配置。即,执行下面的命令:
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}- allnoconfig
内核的 allnoconfig 配置目标会把所有的内核选项都设置为no,也就是把它们既不编译进内核,也不编译成模块。有了这个最基本的配置,我们再添加CLFS临时系统所必须的配置项:再执行
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}- menuconfig
命令,按下面的步骤添加其他的配置——

(2)按CLFS BOOK的建议,把 Executable file formats 下的ELF 和 emulations for 32bit ELF 选项编译进内核。

(3)在 Processor type and features 下面,选择合适的CPU类型。例如,我的CPU类型是Intel EM64T

(4)选择PCI/PCI-Express支持,位于Bus options (PCI, PCMCIA, EISA, MCA, ISA) 配置目录下。

(5)加入对根文件系统所在磁盘控制器的驱动,详细方法可参考:http://linuxman.blog.ccidnet.com/blog-htm-do-showone-uid-60710-type-blog-itemid-280649.html。例如,我的机器的配置是:
Device Driver
|---->SCSI device support
|---->SCSI disk support
|----->SCSI low-level drivers
  |---->Serial ATA (SATA) support
  |---->intel PIIX/ICH SATA support

(6)加入Ext2文件系统的支持:在 File systems 配置目录下,选择 Second extended fs support。如果根文件系统是Ext3,则选择 Ext3 journalling file system support。

(7)为了是 Udev 正常工作,需要内核支持 Unix domain sockets。此配置选项位于 Networking 配置目录中的 Networking support ---> Networking options 下。

(8)使内核支持 /proc 虚拟文件系统和 tmpfs 文件系统: File systems ---> Pseudo filesystems ---> /proc file system support / Virtual memory file system support (former shm fs)

(9)支持 swap 分区: General setup ---> Support for paging of anonymous memory (swap)

(10)支持 RTC 设备: Device Drivers ---> Character devices ---> Enhanced Real Time Clock Support

(11)为了充分发挥我的双核CPU的能力,我又加入了对SMP的支持: Processor type and features ---> Symmetric multi-processing support。这一特性,对CLFS系统来说,并不是必须的。

这样一个最简的内核配置,编译出来的内核映像文件的大小只有744KB,但却能完全满足CLFS系统后续的构建工作需要。
阅读(1176) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~