gentoo環(huán)境下裁剪、安裝內(nèi)核
作者:HMSIWTV
硬件平臺:TOSHIBA M600-02S
軟件平臺 :主機 Fedora 16 x86_64 虛擬機 VMware WorkStation 8.0.3
硬件平臺:TOSHIBA M600-02S
軟件平臺 :主機 Fedora 16 x86_64 虛擬機 VMware WorkStation 8.0.3
主機Lspci結(jié)果:
[plain] view plaincopy
- 00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
- 00:01.0 PCI bridge: Intel Corporation Core Processor PCI Express x16 Root Port (rev 02)
- 00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
- 00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
- 00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
- 00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05)
- 00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 05)
- 00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 05)
- 00:1c.2 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 (rev 05)
- 00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 05)
- 00:1c.4 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 (rev 05)
- 00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
- 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a5)
- 00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 05)
- 00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 05)
- 00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 05)
- 00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 05)
- 01:00.0 VGA compatible controller: nVidia Corporation GT216 [GeForce GT 330M] (rev a2)
- 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
- 07:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
- 16:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 20)
- 16:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 20)
- 16:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 20)
- 16:00.4 System peripheral: JMicron Technology Corp. xD Host Controller (rev 20)
- ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
- ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
- ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
- ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
- ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
- ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
#p#
VMware下lspic結(jié)果:
[plain] view plaincopy
- 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
- 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
- 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
- 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
- 00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
- 00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
- 00:0f.0 VGA compatible controller: VMware SVGA II Adapter
- 00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
- 00:11.0 PCI bridge: VMware PCI bridge (rev 02)
- 00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
- 00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
- 02:00.0 USB controller: VMware USB1.1 UHCI Controller
- 02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
- 02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
- 02:03.0 USB controller: VMware USB2 EHCI Controller
#p#
下面進入正題:
1、參照http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml一步步執(zhí)行,執(zhí)行到
[plain] view plaincopy
- make menuconfig
2、內(nèi)核功能:
能夠完成系統(tǒng)的基本功能,上網(wǎng),收發(fā)郵件等,支持xwindows圖形界面。
在menuconfig中配置:
詳細介紹內(nèi)核配置選項及刪改情況
第一部分:Genral setup——>
除以下選項,其他全部刪除

其中:
System V IPC (IPC:Inter Process Communication)是組系統(tǒng)調(diào)用及函數(shù)庫,它能讓程序彼此間同步進行交換信息。某些程序以及DOS模擬環(huán)境都需要它。為進程提供通信機制,這將使系統(tǒng)中各進程間有交換信息與保持同步的能力。有些程序只有在選Y的情況下才能運行,所以不用考慮,這里一定要選。
Support for paging of anonymous memory (swap),如果不編譯進內(nèi)核,系統(tǒng)啟動時會出現(xiàn)錯誤
[plain] view plaincopy
- Active /dev/sda[0-9] swap
- swapon fails function not implemented
第二部分 : [*] Enable loadable module support ——>
除以下選項,其它全部刪除

這個選項可以讓內(nèi)核動態(tài)加載或卸載模塊,所以選上。
第三部分:-*- Enable the block layer ——>
全部刪除
塊設(shè)備
第四部分:Processor type and features ——>

它會對每種CPU做最佳化,讓它跑的好又快,一般來說,你是什么型號的就選什么型號的就好。我的處理器是i5 520M,所以選擇這個選項。
第五部分:Power management and ACPI options ——>
除以下選項,其它全部刪除



ACPI Support ---〉高級電源接口配置支持,如果BIOS支持,建議選上這項
[]Button 這個選項用于注冊基于電源按鈕的事件,比如power, sleep等,當你按下按鈕時事件將發(fā)生,一個守護程序?qū)⒆x取/proc/acpi/event,并執(zhí)行用戶在這些事件上定義的動作比如讓系統(tǒng)關(guān)機。可以不選擇,根據(jù)自己的需求。
[]Button 這個選項用于注冊基于電源按鈕的事件,比如power, sleep等,當你按下按鈕時事件將發(fā)生,一個守護程序?qū)⒆x取/proc/acpi/event,并執(zhí)行用戶在這些事件上定義的動作比如讓系統(tǒng)關(guān)機。可以不選擇,根據(jù)自己的需求。
第六部分:Bus options (PCI etc.) ——>
除以下選項,其它全部刪除


第七部分:Executable file formats / Emulations ——>
除以下選項,其它全部刪除


Kernel support for ELF binaries ELF是開放平臺下最常用的二進制文件,它支持不同的硬件平臺。一定要選。
第八部分:-*- Networking support ——>
除以下選項,其它全部刪除


#p#
第九部分:Device Drivers ——>
除以下選項,其它全部刪除



上面這個選項如不選擇,系統(tǒng)啟動時會出現(xiàn)錯誤:
[plain] view plaincopy
- /etc/init.d/udev[1355]: Error: cannot start udev as udev-mount would not start


[]Loopback device support 大部分的人這一個選項都選N,因為沒有必要。但是如果你要mount iso文件的話,你得選上Y。這個選項的意思是說,可以將一個文件掛成一個文件系統(tǒng)。如果要燒光盤片的,那么您很有可能在把一個文件燒進去之前,看看這個文件是否符合IS09660的文件系統(tǒng)的內(nèi)容,是否符合您的需求。而且,可以對這個文件系統(tǒng)加以保護。不過,如果您想做到這點的話,您必須有最新的mount程序,版本是在2.5X版以上的。而且如果您希望對這個文件系統(tǒng)加上保護,則您必須有des.1.tar.gz這個程序。注意:此處與網(wǎng)絡(luò)無關(guān)。建議編譯成模塊

里面有關(guān)于USB支持的,要選擇

[]SCSI device support USB要用,必須選擇
[]legacy /proc/scsi/ support USB要用,必須選擇
[]SCSI disk support USB要用,必須選擇


根據(jù)lspci可知,這些要選上,否則無法識別分區(qū)。#p#


[]Intel PIIX/ICH SATA support 這個必須選擇,否則無法產(chǎn)生引導(dǎo)文件


上面的選項也是根據(jù)lspci選的,個人覺得還有可以刪減的地方,還沒有試驗。



我的電腦是千兆網(wǎng)卡所以就選這個。

這個沒什么好說的,自己隨意吧。

這個要選。


上面選項要選,gentoo安裝完有個奇怪的問題,就是時間要嗎提前8小時,要么晚了8小時。
解決方法是
[plain] view plaincopy
- date XXXXXXXX
- /sbin/hwclock --directisa --systohc
如果不選則上,會出現(xiàn)錯誤:
[plain] view plaincopy
- hwclock: Cannot access the Hardware Clock via any known method.
- hwclock: Use the --debug option to see the details of our search for an access method.


這個選項如不選擇,啟動時會出現(xiàn)下面錯誤:
[plain] view plaincopy
- May 7 19:48:26 Universe agetty[1560]: /dev/ttyS1: No such file or directory
- May 7 19:48:26 Universe agetty[1559]: /dev/ttyS0: No such file or directory
- May 7 19:48:36 Universe agetty[1561]: /dev/ttyS1: No such file or directory
- May 7 19:48:36 Universe agetty[1562]: /dev/ttyS0: No such file or directory

[]Support for frame buffer devices 支持Frame buffer的,一定要選擇的。




這個是我的聲卡。


HID input layer support 應(yīng)該選擇
USB Human Interface Device (full HID) support 里面選擇usb鼠標和usb鍵盤,如果你有一定選上這個必需選
/dev/hiddev raw HID device support如果這里有USB鍵盤和鼠標選項,一定要選擇





[]USB device filesystem 這個好象是用U盤必須的
[]EHCI HCD (USB 2.0) support 有usb2.0就選上把,編譯成模塊
[]OHCI HCD support 必須選擇,編譯成模塊
[]UHCI HCD (most Intel and VIA) support 必須選擇,編譯成模塊
[]USB Mass Storage support 用U盤必須選擇
[]EHCI HCD (USB 2.0) support 有usb2.0就選上把,編譯成模塊
[]OHCI HCD support 必須選擇,編譯成模塊
[]UHCI HCD (most Intel and VIA) support 必須選擇,編譯成模塊
[]USB Mass Storage support 用U盤必須選擇
#p#
第十部分:File systems ——>
除以下選項,其它全部刪除

Kernel automounter support 內(nèi)核自動掛載的,當然要選
Kernel automounter version 4 support (also supports v3) 當然要選

Kernel automounter support 內(nèi)核自動掛載的,當然要選
Kernel automounter version 4 support (also supports v3) 當然要選
至于Inotify,若不選,開機和關(guān)機時報錯:
[plain] view plaincopy
- * Starting udevd ...
- error initializing inotify
- * start-stop-daemon: failed to start `/sbin/udevd'


CD-ROM/DVD Filesystems ---> 這個是關(guān)于掛載ISO文件的,用的話就選。
<*>ISO 9660 CDROM file system support


[]NLS ISO 8859-1 必須選擇,這個是關(guān)于U盤掛載的。


這個要選擇,否則開機啟動時出錯:#p#
[plain] view plaincopy
- mounting /dev/shm...
- mount wrong fs type, bad option, bad superblock on shm, missing codepage, ...

Native language support語言支持,這里就支持英語和漢語就行了,不多說了
第十一部分: Kernel hacking ——>
全部刪除
Kernel hacking --->破解核心?可不是當骸客啦,不選
第十二部分:Security options ——>
全部刪除
第十三部分: [ ] Cryptographic API ——>
全部刪除
這是核心支持加密的選項
第十四部分:[ ] Virtualization ——>
全部刪除
第十五部分:Library routines ——>
全部刪除
最后: Save an Alternate Configuration File
責任編輯:趙寧寧