(1)安裝module-init-tools-3.0.tar.gz: # tar -zxvf module-init-tools-3.0.tar.gz # cd module-init-tools-3.0 # ./configure --prefix=/sbin # make # make install # ./generate-modprobe.conf /etc/modprobe.conf
Code maturity level options ---> [*] Prompt for development and/or incomplete code/drivers [*] Select only drivers expected to compile cleanly 打開使用開發(fā)中、不完全的代碼/驅(qū)動(dòng)會(huì)讓內(nèi)核配置多出很多選項(xiàng),由于我們需要使用一些正在開發(fā)中的功能,因此必需打開這一選項(xiàng)。 通用設(shè)置選項(xiàng),
General setup --->
() Local version - append to kernel release 這里填入的是64字符以內(nèi)的字符串,你在這里填上的字符口串可以用uname -a命令看到。 [*] Support for paging of anonymous memory (swap) 這是使用交換分區(qū)或者交換文件來做為虛擬內(nèi)存的,當(dāng)然要選上了。 [*] System V IPC 表示系統(tǒng)5的Inter Process Communication,它用于處理器在程序之間同步和交換信息,如果不選這項(xiàng),很多程序運(yùn)行不起來 [*] POSIX Message Queues 這是POSIX的消息隊(duì)列,它同樣是一種IPC。建議你最好將它選上 [*] BSD Process Accounting 這是充許用戶進(jìn)程訪問內(nèi)核將賬戶信息寫入文件中的。這通常被認(rèn)為是個(gè)好主意,建議你最好將它選上。 [*] BSD Process Accounting version 3 file format [*] Sysctl support 這個(gè)選項(xiàng)能不重新編譯內(nèi)核修改內(nèi)核的某些參數(shù)和變量,如果你也選擇了支持/proc,將能從/proc/sys存取可以影響內(nèi)核的參數(shù)或變量。建議你最好將它選上 [ ] Auditing support 審記支持,用于和內(nèi)核的某些子模塊同時(shí)工作,例如SELinux。只有選擇此項(xiàng)及它的子項(xiàng),才能調(diào)用有關(guān)審記的系統(tǒng)調(diào)用 (15) Kernel log buffer size (16 => 64KB, 17 => 128KB) 內(nèi)核日志緩存的大小,12 => 4 KB,13 => 8 KB,14 => 16 KB單處理器,15 => 32 KB多處理器,16 => 64 KB for x86 NUMAQ or IA-64,17 => 128 KB for S/390 [*] Support for hot-pluggable devices 是否支持熱插拔的選項(xiàng),肯定要選上 [*] Kernel Userspace Events 內(nèi)核中分為系統(tǒng)區(qū)和用戶區(qū),這里系統(tǒng)區(qū)和用戶區(qū)進(jìn)行通訊的一種方式,選上。 [*] Kernel .config support 將.config配置信息保存在內(nèi)核中,選上它及它的子項(xiàng)使得其它用戶能從/proc中得到內(nèi)核的配置 [*] Enable access to .config through /proc/config.gz [ ] Configure standard kernel features (for small systems) ---> 這是為了編譯某些特殊的內(nèi)核使用的,通常你可以不選擇這一選項(xiàng),你也不用對(duì)它下面的子項(xiàng)操心了。 --- Configure standard kernel features (for small systems) [ ] Load all symbols for debugging/kksymoops 是否裝載所有的調(diào)試符號(hào)表信息,如果你不需要對(duì)內(nèi)核調(diào)試,不需要選擇此項(xiàng)。 [*] Enable futex support 不選這個(gè)內(nèi)核不一定能正確的運(yùn)行使用glibc的程序,當(dāng)然要選上 [*] Enable eventpoll support 不選這個(gè)內(nèi)核將不支持事件輪循的系統(tǒng)調(diào)用,最好選上 [*] Optimize for size 這個(gè)選項(xiàng)使gcc使用-Os的參數(shù)而不是-O2的參數(shù)來優(yōu)化編譯,以獲得更小尺寸的內(nèi)核,建議選上。 [*] Use full shmem filesystem 除非你在很少的內(nèi)存且不使用交換內(nèi)存時(shí),才不要選擇這項(xiàng) (0) Function alignment (0) Label alignment (0) Loop alignment (0) Jump alignment
可加載模塊: Loadable module support ---> [*] Enable loadable module support [*] Module unloading 不選這個(gè)功能,加載的模塊就不能卸載 [ ] Forced module unloading [ ] Module versioning support (EXPERIMENTAL) [ ] Source checksum for all modules [*] Automatic kernel module loading
處理器類型及特性: Processor type and features ---> Subarchitecture Type (PC-compatible) ---> Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon) ---> [ ] Generic x86 support 這一選項(xiàng)針對(duì)x86系列的CPU使用更多的常規(guī)優(yōu)化。如果你在上面一項(xiàng)選的是i386、i586之類的才選這個(gè) [*] HPET Timer Support HPET是替代8254芯片的下一代時(shí)鐘處理器。這里你可以安全的選上這一選項(xiàng)。如果硬件不支持的話,將仍使用8254時(shí)鐘處理器 [*] Symmetric multi-processing support 對(duì)稱多處理器支持,在單CPU的機(jī)器上,不選這個(gè)選項(xiàng)會(huì)更快一些。由于超線程技術(shù),看起來是兩顆CPU,因些要選上這個(gè)選項(xiàng) (1) Maximum number of CPUs (2-255) 支持的最大CPU數(shù) [ ] SMT (Hyperthreading) scheduler support [*] Preemptible Kernel 這個(gè)選項(xiàng)能使應(yīng)用程序即使內(nèi)核在高負(fù)載時(shí)也很可靠,建議最好選上 [*] Machine Check Exception 這個(gè)選項(xiàng)能讓CPU檢測(cè)到系統(tǒng)故障時(shí)通知內(nèi)核,一般我用組裝的臺(tái)式機(jī)會(huì)選這項(xiàng)。 < > Toshiba Laptop support < > Dell laptop support < > /dev/cpu/microcode - Intel IA32 CPU microcode support < > /dev/cpu/*/msr - Model-specific register support < > /dev/cpu/*/cpuid - CPU information support Firmware Drivers ---> < > BIOS Enhanced Disk Drive calls determine boot disk (EXPERIMENTAL) High Memory Support (4GB) ---> [ ] Allocate 3rd-level pagetables from highmem [ ] Math emulation [*] MTRR (Memory Type Range Register) support [ ] Boot from EFI support (EXPERIMENTAL) [*] Enable kernel irq balancing [ ] Use register arguments (EXPERIMENTAL)
電源管理: Power management options (ACPI, APM) ---> [*] Power Management support [ ] Power Management Debug Support [ ] Software Suspend (EXPERIMENTAL) ACPI (Advanced Configuration and Power Interface) Support ---> APM (Advanced Power Management) BIOS Support ---> CPU Frequency scaling --->
ACPI (Advanced Configuration and Power Interface) Support ---> [*] ACPI Support 這是一種電源管理方式,你可以看看你的BIOS是否支持。如果支持的話建議你選上這項(xiàng) [ ] Sleep States (EXPERIMENTAL) < > AC Adapter < > Battery <*> Button 捕獲Power、Sleep、Lid(我也不知道這是什么按鈕)等按鈕是否按下,并做相應(yīng)的動(dòng)作 <*> Video 集成在板上的顯卡的ACPI支持,對(duì)有些板卡可能不起作用 < > Fan <*> Processor <*> Thermal Zone < > ASUS/Medion Laptop Extras < > IBM ThinkPad Laptop Extras < > Toshiba Laptop Extras (0) Disable ACPI for systems before Jan 1st this year [ ] Debug Statements [*] Power Management Timer Support
APM (Advanced Power Management) BIOS Support ---> < > APM (Advanced Power Management) BIOS support 高級(jí)電源管理的支持,一般來說筆記本應(yīng)該選上,臺(tái)式機(jī)可以不選。 [ ] Ignore USER SUSPEND [*] Enable PM at boot time [ ] Make CPU Idle calls when idle [ ] Enable console blanking using APM [ ] RTC stores time in GMT 按Unix的標(biāo)準(zhǔn),硬件的時(shí)鐘應(yīng)該設(shè)為格林威治時(shí)間 [ ] Allow interrupts during APM BIOS calls [*] Use real mode APM BIOS call to power off
總線類型: [*] PCI support PCI access mode (Any) --->強(qiáng)列建議選Any,系統(tǒng)將優(yōu)先使用MMConfig,然后使用BIOS,最后使用Direct檢測(cè)PCI設(shè)備。 [ ] Message Signaled Interrupts (MSI and MSI-X) [ ] Legacy /proc/pci interface [ ] PCI device name database [ ] ISA support [*] EISA support [*] Vesa Local Bus priming [*] Generic PCI/EISA bridge [*] EISA virtual root device [ ] EISA device name database [ ] MCA support < > NatSemi SCx200 support PCCARD (PCMCIA/CardBus) support ---> PCI Hotplug Support --->
PCCARD (PCMCIA/CardBus) support --->一般只有筆記本電腦上才會(huì)有PCMCIA插槽,如果你是臺(tái)式機(jī)的話,可以不選這一項(xiàng),然后跳過這一部份。
PCI Hotplug Support ---> < > Support for PCI Hotplug (EXPERIMENTAL) 一般來講只有服務(wù)器上會(huì)有熱插拔的設(shè)備,如果你使用的是臺(tái)式機(jī),你可以不選擇此項(xiàng)并跳過這一部份。
可執(zhí)行文件格式, [*] Kernel support for ELF binaries ELF是開放平臺(tái)下最常用的二進(jìn)制文件,它支持不同的硬件平臺(tái) < > Kernel support for a.out and ECOFF binaries <*> Kernel support for MISC binaries 此選項(xiàng)允許插入二進(jìn)制的封裝層到內(nèi)核中,當(dāng)使用Java、.NET、Python、Lisp等語言編寫的程序時(shí)非常有用
編譯內(nèi)核: # cd /usr/src/linux # make dep -----鏈接程序代碼與函數(shù)庫(kù). # make clean -----刪除不必要的模塊和文件. # make bzImage -----開始編譯系統(tǒng)內(nèi)核. # make modules -----開始編譯外掛模塊. # make modules_install -----安裝編譯完成的模塊. 要好常時(shí)間的,我洗了一件衣服,抽了N根白沙之后,總算完成了,好激動(dòng)呀! # su - # /sbin/depmod -a -----創(chuàng)建模塊的鏈接.
如果你用GRUB來管理開機(jī),簡(jiǎn)單點(diǎn)就是你裝了win還裝了linux就要修改/boot/grub下的menu.1st文件: # vi /boot/grub/menu.1st 鍵入i進(jìn)入編輯模式:
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You do not have a /boot partition. This means that # all kernel and initrd paths are relative to /, eg. # root (hd0,1) # kernel /boot/vmlinuz-version ro root=/dev/hda2 # initrd /boot/initrd-version.img #boot=/dev/hda default=1 timeout=10 splashimage=(hd0,1)/boot/grub/splash.xpm.gz title Fedora Core(2.6.11) root (hd0,1) kernel /boot/vmlinuz ro root=/dev/hda2 ---你的linux所在的分區(qū) title DOS rootnoverify (hd0,0) chainloader +1