Centos8编译安装内核
首先下载kernel,5.x版本的内核,下载地址:https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/系统安装相关包:# yum install -y bc gcc make python3 ncurses-devel flex bison openssl-devel elfutils-libelf-devel将内核解压@localhost ~]# tar xvf linux-5.10.60.tar.xz# cd linux-5.10.60使用现有的config文件# cp -p /boot/config-4.18.0-305.3.1.el8.x86_64 .config使用老的配置参数# sh -c 'yes ""| make oldconfig'Make编译,使用nproc命令表示使用所有cpu线程:# make -j $(nproc)Make 报错:make: *** No rule to make target 'certs/rhel.pem', needed by 'certs/x509_certificate_list'.Stop.https://www.linuxprobe.com/wp-content/uploads/2022/05/image1.jpeg
和这个报错Failed to generate BTF for vmlinux
https://www.linuxprobe.com/wp-content/uploads/2022/05/image2-1.png
编辑.config配置文件,将下面两行注释掉#CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"#CONFIG_DEBUG_INFO_BTF=yhttps://www.linuxprobe.com/wp-content/uploads/2022/05/image3-2.png
https://www.linuxprobe.com/wp-content/uploads/2022/05/image4-1.png
然后再次执行make -j $(nproc)# make -j $(nproc)https://www.linuxprobe.com/wp-content/uploads/2022/05/image5-1.png
模块安装,把编译好的模块拷贝到系统目录下# make modules_installhttps://www.linuxprobe.com/wp-content/uploads/2022/05/image6-1.png
安装二进制内核镜像, 生成并安装boot初始化文件系统映像文件# make installhttps://www.linuxprobe.com/wp-content/uploads/2022/05/image7-1.png
现在可以查看/lib/modules目录下面多出来一个5.10.60内核的目录了# ll /lib/modulestotal 8drwxr-xr-x. 6 root root 4096 Apr 11 14:38 4.18.0-305.3.1.el8.x86_64drwxr-xr-x. 3 root root 4096 Apr 11 15:48 5.10.60https://www.linuxprobe.com/wp-content/uploads/2022/05/image8-1.jpeg
更新一下grub启动项# grub2-mkconfig -o /boot/grub2/grub.cfg查看默认启动项是否是5.10.60# grubby --default-kernel# grubby --default-indexhttps://www.linuxprobe.com/wp-content/uploads/2022/05/image9-1.png
查看所有启动项:# grubby --info=ALLhttps://www.linuxprobe.com/wp-content/uploads/2022/05/image10-1.jpeg
可使用grubby –set-default 来设置默认启动项。
设置完成之后,可以重启系统,查看是否可以进入系统了。
https://www.linuxprobe.com/wp-content/uploads/2022/05/image11-1.jpeg
https://www.linuxprobe.com/wp-content/uploads/2022/05/image12-1.jpeg
页:
[1]