读文网>电脑>操作系统>Linux教程

如何最简内核配置

最简内核配置

怎样得到一个最简内核配置呢?

(1)首先,用内核的 allnoconfig 配置目标,得到一个最最基本的内核配置。即,执行下面的命令

make allnoconfig

内核的 allnoconfig 配置目标会把所有的内核选项都设置为no,也就是把它们既不编译进内核,也不编译成模块。

有了这个最基本的配置,我们再添加必须的配置项:再执行

make menuconfig

命令,按下面的步骤添加其他的配置——

(2)把 Executable file formats 下的ELF 和 emulations for 32bit ELF 选项编译进内核。

(3)在 Processor type and features 下面,选择合适的CPU类型。

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

(5)加入对根文件系统所在磁盘控制器的驱动:

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。

这样一个最简的内核配置,编译出来的内核映像文件的大小只有744KB。

相关热搜

相关文章

【Linux教程】热点

【Linux教程】最新