系統:slackware 10.1
kernel: 2.4.29 ---> 2.6.11
step 1 #mkdir /usr/src/linux-2.6.11//新建一個2.6.11內核目錄
#cp linux-2.6.11.tar.gz /usr/src/linux-2.6.11
#cd /usr/src/linux-2.6.11
step 2 #bzip2 -d linux-2.6.11.tar.bz2
#tar -xvf linux-2.6.11.tar//解壓,如果下載的是.bz2文件
#tar -xzvf linux-2.6.11tar.gz //如果所下載的是.tar.gz(.tgz)文件
step 3 #cd linux-2.6.11
#make mrproper //第一次編譯可省略
#make menuconfig //配置內核,這一部分比較煩瑣,而且……
#make
#make modules_install
#make install
#cp System.map /boot/System.map-2.6.11 //可選
#cp .config /boot/config-2.6.11 //可選
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.11
step 4 #vi lilo.conf
增加如下代碼:
image = /boot/vmlinuz-2.6.11
label = linux2.6.11
read -only
root = /dev/hdax ("x"表示/boot所在的分區)
#lilo
step 5 #reboot
setup 6 后續問題的解決(比如網絡,聲卡,顯示卡,USB,……)
附內核配置選項說明(來自網絡,請慎重選擇 :)
代碼成熟度選項:
Code maturity level options --->
[*] Prompt for development and/or incomplete code/drivers
[*] Select only drivers expected to compile cleanly
打開使用開發中、不完全的代碼/驅動會讓內核配置多出很多選項,由于我們需要使用一些正在開發中的功能,因此必需打開這一選項。
通用設置選項,
General setup --->
() Local version - append to kernel release
這里填入的是64字符以內的字符串,你在這里填上的字符口串可以用uname -a命令看到。
[*] Support for paging of anonymous memory (swap)
這是使用交換分區或者交換文件來做為虛擬內存的,當然要選上了。
[*] System V IPC
表示系統5的Inter Process Communication,它用于處理器在程序之間同步和交換信息,如果不選這項,很多程序運行不起來
[*] POSIX Message Queues
這是POSIX的消息隊列,它同樣是一種IPC。建議你最好將它選上
[*] BSD Process Aclearcase/" target="_blank" >ccounting
這是充許用戶進程訪問內核將賬戶信息寫入文件中的。這通常被認為是個好主意,建議你最好將它選上。
[*] BSD Process Accounting version 3 file format
[*] Sysctl support
這個選項能不重新編譯內核修改內核的某些參數和變量,如果你也選擇了支持/proc,將能從/proc/sys存取可以影響內核的參數或變量。建議你最好將它選上
[ ] Auditing support
審記支持,用于和內核的某些子模塊同時工作,例如SELinux。只有選擇此項及它的子項,才能調用有關審記的系統調用
(15) Kernel log buffer size (16 => 64KB, 17 => 128KB)
內核日志緩存的大小,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
是否支持熱插拔的選項,肯定要選上
[*] Kernel Userspace Events
內核中分為系統區和用戶區,這里系統區和用戶區進行通訊的一種方式,選上。
[*] Kernel .config support
將.config配置信息保存在內核中,選上它及它的子項使得其它用戶能從/proc中得到內核的配置
[*] Enable access to .config through /proc/config.gz
[ ] Configure standard kernel features (for small systems) --->
這是為了編譯某些特殊的內核使用的,通常你可以不選擇這一選項,你也不用對它下面的子項操心了。
--- Configure standard kernel features (for small systems)
[ ] Load all symbols for debugging/kksymoops
是否裝載所有的調試符號表信息,如果你不需要對內核調試,不需要選擇此項。
[*] Enable futex support
不選這個內核不一定能正確的運行使用glibc的程序,當然要選上
[*] Enable eventpoll support
不選這個內核將不支持事件輪循的系統調用,最好選上
[*] Optimize for size
這個選項使gcc使用-Os的參數而不是-O2的參數來優化編譯,以獲得更小尺寸的內核,建議選上。
[*] Use full shmem filesystem
除非你在很少的內存且不使用交換內存時,才不要選擇這項
(0) Function alignment
(0) Label alignment
(0) Loop alignment
(0) Jump alignment
可加載模塊:
Loadable module support --->
[*] Enable loadable module support
[*] Module unloading
不選這個功能,加載的模塊就不能卸載
[ ] 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
這一選項針對x86系列的CPU使用更多的常規優化。如果你在上面一項選的是i386、i586之類的才選這個
[*] HPET Timer Support
HPET是替代8254芯片的下一代時鐘處理器。這里你可以安全的選上這一選項。如果硬件不支持的話,將仍使用8254時鐘處理器
[*] Symmetric multi-processing support
對稱多處理器支持,在單CPU的機器上,不選這個選項會更快一些。由于超線程技術,看起來是兩顆CPU,因些要選上這個選項
(1) Maximum number of CPUs (2-255) 支持的最大CPU數
[ ] SMT (Hyperthreading) scheduler support
[*] Preemptible Kernel
這個選項能使應用程序即使內核在高負載時也很可靠,建議最好選上
[*] Machine Check Exception
這個選項能讓CPU檢測到系統故障時通知內核,一般我用組裝的臺式機會選這項。
< > 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是否支持。如果支持的話建議你選上這項
[ ] Sleep States (EXPERIMENTAL)
< > AC Adapter
< > Battery
<*> Button 捕獲Power、Sleep、Lid(我也不知道這是什么按鈕)等按鈕是否按下,并做相應的動作
<*> Video 集成在板上的顯卡的ACPI支持,對有些板卡可能不起作用
< > 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
高級電源管理的支持,一般來說筆記本應該選上,臺式機可以不選。
[ ] 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的標準,硬件的時鐘應該設為格林威治時間
[ ] Allow interrupts during APM BIOS calls
[*] Use real mode APM BIOS call to power off
[*] CPU Frequency scaling
這一選項允許改變CPU的主頻,使CPU在低負荷或使用電池時降低主頻,達到省電的目的。
[ ] Enable CPUfreq debugging
< > /proc/cpufreq interface (deprecated)
Default CPUFreq governor (performance) --->
--- 'performance' governor
<*> 'powersave' governor
<*> 'userspace' governor for userspace frequency scaling
[ ] /proc/sys/cpu/ interface (2.4. / OLD)
<*> 'ondemand' cpufreq policy governor自動調節主頻
<*> CPU frequency table helpers 多數的CPU需要這一項來調節主頻
<*> ACPI Processor P-States driver 報告處理器的狀態
< > AMD Mobile K6-2/K6-3 PowerNow!
< > AMD Mobile Athlon/Duron PowerNow!
< > AMD Opteron/Athlon64 PowerNow!
< > Cyrix MediaGX/NatSemi Geode Suspend Modulation
<*> Intel Enhanced SpeedStep Intel的變頻技術支持
[ ] Use ACPI tables to decode valid frequency/voltage pairs
--- Built-in tables for Banias CPUs
< > Intel Speedstep on ICH-M chipsets (ioport interface)
< > Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)
< > Intel Pentium 4 clock modulation
< > nVidia nForce2 FSB changing
< > Transmeta LongRun
< > VIA Cyrix III Longhaul
--- shared options
[ ] /proc/acpi/processor/../performance interface (deprecated)
[ ] Relaxed speedstep capability checks
總線類型:
[*] PCI support
PCI access mode (Any) --->強列建議選Any,系統將優先使用MMConfig,然后使用BIOS,最后使用Direct檢測PCI設備。
[ ] 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 --->一般只有筆記本電腦上才會有PCMCIA插槽,如果你是臺式機的話,可以不選這一項,然后跳過這一部份。
PCI Hotplug Support --->
< > Support for PCI Hotplug (EXPERIMENTAL)
一般來講只有服務器上會有熱插拔的設備,如果你使用的是臺式機,你可以不選擇此項并跳過這一部份。
可執行文件格式,
[*] Kernel support for ELF binaries
ELF是開放平臺下最常用的二進制文件,它支持不同的硬件平臺
< > Kernel support for a.out and ECOFF binaries
<*> Kernel support for MISC binaries
此選項允許插入二進制的封裝層到內核中,當使用Java、.NET、Python、Lisp等語言編寫的程序時非常有用
硬件設備[相當復雜,看得偶頭暈,大家針對自己的設備慎重選擇(手邊最好準備一本漢英字典:)如果想使用adsl,記得網絡部分除了TCP/IP協議還得把ppp部分編譯進內核,想當初偶就是把這個給忘了,郁悶了許久:)
文件系統,
<*> Second extended fs support
[*] Ext2 extended attributes
[*] Ext2 POSIX Access Control Lists
[*] Ext2 Security Labels
<*> Ext3 journalling file system support
[*] Ext3 extended attributes
[*] Ext3 POSIX Access Control Lists
[*] Ext3 Security Labels
[ ] JBD (ext3) debugging support
<*> Reiserfs support
[ ] Enable reiserfs debug mode
[ ] Stats in /proc/fs/reiserfs
[*] ReiserFS extended attributes
[*] ReiserFS POSIX Access Control Lists
[*] ReiserFS Security Labels
[*] JFS POSIX Access Control Lists
[ ] JFS debugging
[ ] JFS statistics
[*] Realtime support (EXPERIMENTAL)
[*] Quota support
[*] Security Label support
[*] POSIX ACL support
< > Minix fs support
< > ROM file system support
[*] Quota support
< > Old quota format support
[*] Dnotify support
< > Kernel automounter support
< > Kernel automounter version 4 support (also supports v3)
CD-ROM/DVD Filesystems --->
DOS/FAT/NT Filesystems --->
Pseudo filesystems --->
Miscellaneous filesystems --->
Network File Systems --->
Partition Types --->
Native Language Support --->
Profiling support --->
Kernel hacking --->
Security options --->
Cryptographic options --->
Library routines --->
NOTE:
1。如果你英文還可以的話,可以邊選擇,邊看help,個人認為這是最好,最徹底的方法,好象目前 網絡上還沒一份較好的教程(也許有,偶找不到:)
2。對于有些選項不是很確定的時候,或者英文實在爛的時候(比如偶)help的最后一句基本上都是 “If you are no sure say no/y"這時候你知道該怎么做了吧:)
3?;趥€人習慣,偶喜歡把大部分的選項編譯進內核,你可以不用這么做,只是個人習慣。
4。以上文字基本來自于網絡,我在自己的機器上基本沒錯(或者有錯誤,我沒看出來),如果你照著做了,出了問題(比如mm跑了之類的)偶實在是無能為力,其實偶也很菜呀?。?!
5。其實玩linux最重要的是要有一個百折不撓的心,不用太著急,
For everything just for fun:)