1.下载内核
https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/
2.安装依赖包
#安装依赖包
yum -y install openssh-devel elfutils-libelf-devel bc #安装开发工具包组
yum -y groupinstall "development tools"
#安装ncurse-devel包 (make menuconfig 文本界面窗口依赖包) yum -y install ncurses-devel
#编译依赖的安装包
yum install openssl-devel -y
3.解压、配置
[root@centos7 ~]#tar xf linux-5.4.6.tar.xz -C /usr/src
[root@centos7 ~]#cd /usr/src
[root@centos7 src]#ln -sv linux-5.4.6 linux
[root@centos7 src]#cd linux
[root@centos7 linux]#cp /boot/config-$(uname -r) ./.config
[root@centos7 linux]#make menuconfig
(1)修改内核名称
General setup --->local version -append to kernel release
(2)新添加NTFS文件系统支持模块
File systems --->DOS/FAT/NT Filesystems --->NTFS file system support
4.编译
[root@centos7 linux]#make -j `cat /proc/cpuinfo | grep 'model name'|wc -l` #时间较长,具体时间根据硬件性能决定
.................
#编译安装模块
[root@centos7 linux]# make modules_install
#安装内核核心文件
[root@centos7 linux]# make install
#更换内核
[root@centos7 linux]# egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \' #查看内核版本
CentOS Linux (5.4.6_hanweize.cn_5.4.6) 7 (Core)
CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core)
[root@centos7 linux]# grub2-set-default 0
#重启
[root@centos7 linux]# reboot
测试
[root@centos7 ~]# uname -r 5.4.6_hanweize.cn_5.4.6