linux內核心手動升級(到最新版)淺談

本文參考轉載http://linux.vbird.org/linux_basic/0540kernel.php#make_module 鳥哥的linux私房菜。提供兩個方法,(聽說)第一個方法適合內核小範圍更新,不適合一次更新到最新的內核。
一、
[root@www1 ~]# uname -r #當前內核
3.10.0-327.el7.x86_64
[root@www1 ~]# tar -xf linux-3.11.tar.xz -C /usr/src #下載內核
[root@www1 ~]# cd /usr/src/; ls
[root@www1 src]# ln -s linux-3.11 linux
[root@www1 src]# cd linux
[root@www1 linux]# cp /boot/config-3.10.0-327.el7.x86_64 .config
[root@www1 linux]# make help
[root@www1 linux]# make menuconfig #yum -y install ncurses-devel
linux內核心手動升級(到最新版)淺談
#打開內核編譯界面,隨便(或根據需要)做個小改動測試
[root@www1 linux]# screen #用screen界面編譯,在編譯過程出現斷線時,還能繼續編譯,用法請自行man
[root@www1 linux]# make -j 4
[root@www1 linux]# make modules_install
[root@www1 linux]# make install
[root@www1 linux]# reboot #編譯完成重啓系統

二、升級到新版內核(含升級過程中出現的錯誤提示)
[root@www1 ~]# wget http://elrepo.org/linux/kernel/el7/SRPMS/kernel-lt-4.4.143-1.el7.elrepo.nosrc.rpm
[root@www1 ~]# rpm -ivh kernel-lt-4.4.143-1.el7.elrepo.nosrc.rpm
warning: kernel-lt-4.4.143-1.el7.elrepo.nosrc.rpm: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Updating / installing...
1:kernel-lt-4.4.143-1.el7.elrepo ################################# [100%]
warning: user ajb does not exist - using root
[root@www1 ~]# useradd -s /sbin/nologin ajb
[root@www1 ~]# cd rpmbuild/SOURCES/
[root@www1 SOURCES]# vim config-4.4.143-x86_64
5813 CONFIG_VFIO_PCI_VGA=y
[root@www1 SOURCES]# cd ../SPECS/
[root@www1 SPECS]# vim kernel-lt-4.4.spec
145 Source0:linux-%{LKAver}.tar.xz
[root@www1 SPECS]# yum install asciidoc openssl-devel xmlto audit-libs-devel binutils-devel
[root@www1 SPECS]# yum install elfutils-devel java-1.8.0-openjdk-devel newt-devel numactl-devel perl slang-devel xz-devel pciutils-devel
[root@www1 SPECS]# yum install perl-devel perl-ExtUtils-Embed
[root@www1 SPECS]# rpmbuild -bb kernel-lt-4.4.spec
[root@www1 ~]# yum install /root/rpmbuild/RPMS/x86_64/kernel-lt-4.4.143-1.el7.centos.x86_64.rpm
[root@www1 ~]# reboot
linux內核心手動升級(到最新版)淺談
[root@www1 ~]# uname -r
4.4.143-1.el7.centos.x86_64 #已成功升級內核

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章