首先,清理以前编译时留下的临时文件。如果是刚刚解开的包,不需要执行这步。如果是第二次或者是第n次编译,那么一定要执行。
相关命令如下:
$ sudo make mrproper
网上很多教程上说把现在使用的内核的config拷贝过来参考,据实验,是不需要的,ubuntu还有debian会自动做这步。不过这条命令倒是可以学习一下。当然你可以将以前的配置拷贝过来。
命令:
cp /boot/config-`uname -r` ./.config
./.config的意思是拷贝到当前目录并以.config重命名。
注意:在配制内核时,修改的文件为linux-2.6.25.10文件夹中的.config文件。这是个隐藏文件,更改查看方式可以看到。是make mrproper时自动拷贝过来的,下载的源包中没有。
配置2.6.0内核时如果你的主板是Intel芯片的话,你用默认配制也许就可以得到一个满意的内核哦。做法是make menuconfig后离开时选择保存。
这里的难点是pci,如果你硬盘是IDE的那一定要选择好你主板上南桥芯片。SCSI的话就是要选择上你的SCSI卡型号。
还有就是网卡,声卡芯片的型号了,他们的型号你都可以用lspci 查找到比如我的是。
# lspci 00:00.0 Host bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) 00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) 00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 08) 00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01) 00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB 00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter 00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01) 00:11.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10) 00:12.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
请务必要选中ext3文件系统,
File systems---> [*] Ext3 journalling file system support [*] Ext3 Security Labels [*] JBD (ext3) debugging support
以上三项一定要选上,而且要内建(即标*). 这个非常重要,在配置完后一定要检查一下.config文件有没有"CONFIG_EXT3_FS=y"这一项.
如果不是"CONFIG_EXT3_FS=y"而是"CONFIG_EXT3_FS=m",你在运行内核时就会遇上以下错误: pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed
务必把自己网卡对应的驱动编译进内核,比较普遍的网卡是realtek 8139,以下就是这种网卡的配置,以供参考
Device Drivers---> Networking support---> Ethernet (10 or 100Mbit) ---> <*> RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support (EXPERIMENTAL) <*> RealTek RTL-8139 PCI Fast Ethernet Adapter support
也要选择自己声卡对应的驱动编译进内核,比较普遍的声卡是i810_audio,以下就是这种声卡的配置,以供参考
Device Drivers ---> Sound ---> <*> Sound card support Advanced Linux Sound Architecture ---> <*> Advanced Linux Sound Architecture <*> Sequencer support < > Sequencer dummy client <*> OSS Mixer API <*> OSS PCM (digital audio) API[*] OSS Sequencer API <*> RTC Timer support PCI devices ---> <*> Intel i8x0/MX440, SiS 7012; Ali 5455; NForce Audio; AMD768/8111 Open Sound System ---> < > Open Sound System (DEPRECATED)
以上三项配置关系到新内核能否正常运行,请备加注意.其他的配置如果不是很了解,大可以按默认的选择.
更多请看:config配制详解