作者:博饼薄饼 | 来源:互联网 | 2023-09-13 13:46
这里从3.10升级到指定版本4.9.39
[root@docker-dev ~]# yum groupinstall "Development Tools" -y #安装开发工具包
[root@docker-dev ~]# yum install -y elfutils-libelf-devel bc openssl-devel ncurses-devel wget ntpdate vim net-tools #安装常用软件
[root@docker-dev ~]# ntpdate -u times.aliyun.com #同步时间,如果时间不对编译可能会出问题
[root@docker-dev ~]# wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.39.tar.xz #下载内核
[root@docker-dev ~]# tar -xf linux-4.9.39.tar.xz -C /usr/src/ #解压内核
[root@docker-dev ~]# cd /usr/src/linux-4.9.39/
[root@docker-dev linux-4.9.39]# cp /boot/config-3.10.0-514.el7.x86_64 .config
[root@docker-dev linux-4.9.39]# sh -c 'yes "" | make oldconfig'
[root@docker-dev linux-4.9.39]# make -j30 bzImage #测试机是32核,这里用30,尽可能加快编译速度
[root@docker-dev linux-4.9.39]# make -j30 modules
[root@docker-dev linux-4.9.39]# make -j30 modules_install
[root@docker-dev linux-4.9.39]# make install
[root@docker-dev linux-4.9.39]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
[root@docker-dev linux-4.9.39]# grub2-set-default 0 && init 6
[root@docker-dev ~]# uname -a
Linux docker-dev 4.9.39 #1 SMP Mon Jul 24 11:28:25 CST 2017 x86_64 x86_64 x86_64 GNU/Linux