Linux 內(nèi)核編譯升級記錄
先是裝了個 VMware
然后再里面裝了個 CentOS
之后就是漫長的內(nèi)核編譯升級
上周周四、周五兩天都在忙這個,但是最終沒有成功
內(nèi)核編譯一次需要花費一個小時,在虛擬機(jī)里面
一開始編譯的時候,出現(xiàn)錯誤。
主要存在兩個錯誤,剛開始不知道為什么,也沒有對出現(xiàn)的問題進(jìn)行解決,只是重新編譯,結(jié)果當(dāng)然失敗
第一個運行錯誤是
“insmod: error inserting ‘/lib/dm-region-hash.ko”
Google 了一下,是因為 init 里存在重復(fù)行,vi 編輯刪除之
第二個錯誤是:
“Volume group "VolGroup00" not found”
Google 了一下,是因為 .config 文件的配置問題
需要將
General setup --->
enable deprecated sysfs features
勾選了
這兩個問題解決后,Linux 內(nèi)核升級即可完成。
下面說一下具體的步驟:
1.
下載最新版本的 Linux 內(nèi)核
http://www.kernel.org/
這里是 linux-2.6.37.6.tar.bz2
拷到 /usr/src
2.
加壓 *.tar.bz2
root# tar -jvxf linux-2.6.37.6.tar.bz2
3.
進(jìn)入 linux-2.6.37.6 文件夾
# cd linux-2.6.37.6
# make clean
# make mvproper
4.
配置
make menuconfig
注意,就是這里要勾選
General setup --->
enable deprecated sysfs features
否則會造成
“Volume group "VolGroup00" not found”
錯誤
5.
編譯
# make all
6.
安裝
# make modules_install
# make install
7.
設(shè)置
# mkinitrd /boot/initrd-2.6.37.6.img 2.6.37.6
# cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.37.6
# cp /usr/src/linux-2.6.37.6/System.map /boot/System.map-2.6.37.6
8. 修改默認(rèn)啟動內(nèi)核
# cat /etc/grub.conf
# vi /etc/grub.conf
將 default=1 修改為
default=0
9.
刪除多余行,這是編譯的一個小 bug ,造成出現(xiàn)重復(fù)行
會造成
“insmod: error inserting ‘/lib/dm-region-hash.ko”
的錯誤
# cp /boot/initrd-2.6.37.6.img /tmp/
# cd /tmp/
# mkdir newinitrd
# cd newinitrd
# zcat ../initrd-2.6.37.6.img | cpio -i
# ls
# vi init
刪除 init 中存在的重復(fù)
echo “Loading dm-region-hash.ko module”
insmod /lib/dm-region-hash.ko
兩行
保存
# find . | cpio -c -o > ../initrd
# cd ..
# gzip -9 < initrd > initrd-2.6.37.6.img
# ls
# mv /boot/initrd-2.6.37.6.img /home/
# cp initrd-2.6.37.6.img /boot/
# reboot
進(jìn)入新內(nèi)核后,查看新內(nèi)核的版本
# uname -a
# uname -r
===================================================
下面是我在升級過程中的命令記錄 history
543 tar -jvxf linux-2.6.37.6.tar.bz2
544 clear
545 cd linux-2.6.37.6
546 ls
547 make clean
548 make mvproper
549 clear
550 make all
551 make clean
552 make mrporper
553 make menuconfig
554 make menuconfig
555 \
556 \
557 cd /usr/src/linux-2.6.37.6
558 ls
559 ls -a
560 make all
561 clear
562 make modules_install
563 make install
564 mkinitrd /boot/initrd-2.6.37.6.img 2.6.37.6
565 rm /boot/initrd-2.6.37.6.img
566 ls
567 ls /boot/
568 mkinitrd /boot/initrd-2.6.37.6.img 2.6.37.6
569 cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.37.6
570 cp /usr/src/linux-2.6.37.6/System.map /boot/System.map-2.6.37.6
571 cat /etc/grub.conf
572 cp /boot/initrd-2.6.37.6.img /tmp/
573 cd /tmp/
574 rm -rf newinitrd/
575 mkdir newinitrd
576 cd newinitrd/
577 zcat ../initrd-2.6.37.6.img | cpio -i
578 ls
579 vi init
580 find . | cpio -c -o > ../initrd
581 cd ..
582 gzip -9 < initrd > initrd-2.6.37.6.img
583 ls
584 mv /boot/initrd-2.6.37.6.img /home/
585 cp initrd-2.6.37.6.img /boot/
586 reboot
587 uname -r
588 uname -a
589 uname -r
590 history
======================================================
網(wǎng)上查的資料,主要是第一個和第二個
http://www.linuxidc.com/Linux/2010-09/28735.htm
http://blog.csdn.net/douzi24/article/details/5781148
http://hi.baidu.com/mhlovejn/blog/item/7a4a55fe65de7488b801a020.html/
http://blog.csdn.net/cdsnmdl/article/details/3922513
http://www.cublog.cn/u/9483/showart_2524232.html
http://blog.csdn.net/do2jiang/article/details/4965967
http://my.chinaunix.net/space.php?uid=113544&do=blog&id=85646
http://www.shnenglu.com/momoxiao/archive/2010/06/26/118758.html
posted on 2011-07-11 11:22
unixfy 閱讀(446)
評論(1) 編輯 收藏 引用