虚拟机硬盘最好大于40G, 要不然会提示空间不足,空间不足写入就会失败 建议50G左右
Cent OS8 内核编译 版本号:5.12.14
1.0 [root@localhost /]# wget -P /usr/src/ https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.12.14.tar.xz
2.0 [root@localhost /]# tar Jxvf linux-5.12.14.tar.xz
3.0 [root@localhost linux-5.12.14]# pwd # /usr/src/linux-5.12.14
4.0 [root@localhost linux-5.12.14]# cp /boot/config-4.18.0-305.3.1.el8.x86_64 ./.config 改名(.config)
5.0 安装的4个工具,前3个必须安装:1 ncurses-devel ,2 elfutils-libelf-devel ,3 openssl-devel,4 screen
5.1 yum install ncurses-devel elfutils-libelf-devel openssl-devel screen -y 安装4个工具
6.0 [root@localhost linux-5.12.14]# make menuconfig
make menuconfig 编译结束后会在当前目录下生成 .config 文件
7.0 make all -j4 编译内核,可能会遇到的错误,为防止错误出现,提前编辑 .config 文件,注释掉 行号:8017 和 8019,修改行号:8177 =n ,参考下面 7.1 三行内容,如果行号不一样,搜索内容修改,行号只是一个标识,内容是关键,看清楚再改。
make all #编译内核,等同于make bzImage;make modules
7.1 vim .config:
一、提前编辑 .config 文件
8017 #CONFIG_MODULE_SIG_K