Linux核心版本正式版已經發行,Linux核心版能提高更方便的使用效能。下面就這就來講術Linux核心版。因工作需要,需要升級Linux核心版本,系統為Fedora5 ,核心版本為2.6.15,需要升級為2.6.20,這個過程大概花了一個星期的時間,從一點不瞭解Linux核心版本,到升級成功,也經曆了不少困難,都是從google上搜尋得來的。以下是整個過程.
一。安裝Linux核心版本虛擬機器
Linux虛擬機器版本為Fedora5 ,核心版本為2.6.15,從網路上下載得來,大小為3.02 GB ,好像找不到了,大家去可以google搜尋。就是下載需要花費點時間安裝過程沒什麼需要注意的地方,大家按照正常安裝過程即可安裝完畢,是安裝過程中的介面:
[ATTACH]29538[/ATTACH]
正在安裝中ing以片是是安裝完成並顯示核心版本
[ATTACH]29549[/ATTACH]
二。下載Linux核心版本源碼
為:http://archives.fedoraproject.org/pub/archive/fedora/linux/core/updates/5/SRPMS/
有很多選項,找到2.6.20,kernel-2.6.20-1.2320.fc5.src.rpm 21-Jun-2007 18:48 45M RPM Package
大小為45M,貌似還有點大
三。安裝重要
[CODE][shabi004@localhost ~]$ su root
口令:
[root@localhost shabi004]# cd Desktop/
[root@localhost Desktop]# ls
kernel-2.6.20-1.2320.fc5.src.rpm
[root@localhost Desktop]# rpm -ivh kernel-2.6.20-1.2320.fc5.src.rpm[/CODE]
出現提示:[CODE]warning: group brewbuilder does not exist - using root[/CODE]
不用理會,繼續即可。
[CODE][root@localhost Desktop]# cd ..
[root@localhost shabi004]# cd ..
[root@localhost home]# cd ..
[root@localhost /]# cd usr/src/redhat/
[root@localhost redhat]# ls
BUILD RPMS SOURCES SPECS SRPMS
[root@localhost redhat]# cd SPECS
[root@localhost SPECS]# ls
kernel-2.6.spec
[root@localhost SPECS]# rpmbuild -bp --target i686 kernel-2.6.spec
[/CODE]
這個過程大概會持續10分鐘的樣子,依照電腦配置而定,查看的話會發現有一些警告,不用理會,繼續即可
[CODE][root@localhost SPECS]# cd ..
[root@localhost redhat]# cd BUILD/
[root@localhost BUILD]# ls
kernel-2.6.20
[root@localhost BUILD]# cd kernel-2.6.20/
[root@localhost kernel-2.6.20]# ls
Config.mk linux-2.6.20.i686 vanilla xen
[root@localhost kernel-2.6.20]# cd linux-2.6.20.i686/
[root@localhost linux-2.6.20.i686]# ls
arch CREDITS fs Kbuild Makefile REPORTING-BUGS usr
block crypto include kernel mm scripts
configs Documentation init lib net security
COPYING drivers ipc MAINTAINERS README sound
[root@localhost linux-2.6.20.i686]#[/CODE]
接下來就是最重要的,配置Linux核心版本,命令是
[CODE]make menuconfig[/CODE]
會彈出一個GUI選框,你可以選擇Linux核心版本支援模組,比如CPU,網卡,檔案系統類型,驅動等等許多內容,具體設定依照硬體環境進行設定,我會把一些有用的資料以附件的形式發在文後。
:
[ATTACH]29552[/ATTACH]
出現:
[CODE] Load an Alternate Configuration File
Save an Alternate Configuration File [/CODE]
在這個地方進行儲存,儲存配置好的Linux核心版本模組等等接下來,會出現.config介面,ENTER 斷行符號,按OK即可
exit 退出 Linux核心版本配置介面
[CODE][root@localhost linux-2.6.20.i686]# make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/mconf.o
HOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf arch/i386/Kconfig
End of Linux kernel configuration.
Execute 'make' to build the kernel or try 'make help'.[/CODE]
開始下一步,需要使用到的命令是
[CODE]
make dep
make
make bzImage
make modules
make modules_install
make install[/CODE]
其中:
第一個命令make dep實際上讀取配置過程產生的設定檔,來建立對應於配置的相依樹狀結構,從而決定哪些需要編譯而那些不需要;make zImage和make bzImage則實現完全編譯核心,二者產生的Linux核心版本都是使用gzip壓縮的,只要使用一個就夠了,它們的區別在於使用make bzImage可以產生大一點的核心。建議大家使用make bzImage命令。
後面三個命令只有在你進行配置的過程中,在回答Enable loadable module support (CONFIG_MODULES)時選了"Yes"才是必要的,make modules和make modules_install分別產生相應的模組和把模組拷貝到需要的目錄中
使用make這個命令的時候,花費的 時間比較長,需要耐心等待,中間會產生一些警告資訊,不用理會即可
執行到
[CODE][root@localhost linux-2.6.20.i686]# make install
sh /usr/src/redhat/BUILD/kernel-2.6.20/linux-2.6.20.i686/arch/i386/boot/install.sh 2.6.20-prep arch/i386/boot/bzImage System.map "/boot"[/CODE]
這裡好像核心已經升級完畢了,由於Fedora5是有Grub引導的,需要確認下
使用命令如下:
[CODE][root@localhost shabi004]# cd ..
[root@localhost home]# cd ..
[root@localhost /]# cd boot
[root@localhost boot]# ls
config-2.6.15-1.2054_FC5 System.map-2.6.15-1.2054_FC5
grub System.map-2.6.20-prep
initrd-2.6.15-1.2054_FC5.img vmlinuz
initrd-2.6.20-prep.img vmlinuz-2.6.15-1.2054_FC5
lost+found vmlinuz-2.6.20-prep
System.map
[root@localhost boot]# cd grub
[root@localhost grub]# ls
device.map grub.conf minix_stage1_5 stage2
e2fs_stage1_5 iso9660_stage1_5 reiserfs_stage1_5 ufs2_stage1_5
fat_stage1_5 jfs_stage1_5 splash.xpm.gz vstafs_stage1_5
ffs_stage1_5 menu.lst stage1 xfs_stage1_5
[root@localhost grub]# vi grup.conf[/CODE]
顯示:
[CODE]# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.20-prep)
root (hd0,0)
kernel /vmlinuz-2.6.20-prep ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.20-prep.img
title Fedora Core (2.6.15-1.2054_FC5)
root (hd0,0)
kernel /vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.15-1.2054_FC5.img
"grub.conf" 21L, 770C[/CODE]
關於其中的解釋,由於自己的水平有限,也解釋不清楚,還請大家去google下就可以得到完整答案。這裡我只說自己懂得:
title Fedora Core (2.6.20-prep): Linux核心版本啟動版本
root (hd0,0):hd*表示第幾個硬碟,比如本例就是第一塊硬碟,後面的*表示所第一個分區,本例為第一塊一硬碟,第一個分區。
現在重啟系統,在重啟時按任意鍵進入grub引導介面
[ATTACH]29575[/ATTACH]選擇對應的2.6.20進入系統
[CODE][shabi004@localhost Desktop]$ uname -a
Linux localhost 2.6.20-prep #1 Thu Aug 6 17:39:48 CST 2009 i686 i686 i386 GNU/Linux[/CODE]
到此:此次升級Linux核心版本算是完成了。
- 關於Linux核心版本的簡單介紹
- Linux核心統一裝置系統操作
- 學會刪除舊Linux核心
- 簡單講述Linux核心系統應用
- 闡述Linux核心裡面的APIC編程