一、内核源代码编译流程
编译环境:
cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
Linux内核版本:
uname -r
3.10.0-693.el7.x86_64
编译内核源代码版本:linux-4.19.90-all-arch-master
-
- cp /boot/config-xxx到内核源代码目录/.config
- make menuconfig

ncurses(字符终端处理库),下载命令:yum install ncurses-devel
-
- /搜索jump_label显示:

-
- 配置内核:将*删除后SAVE。使用空格键清除。


-
- make编译内核源码,报以下错误:

安装yum install elfutils-libelf-devel,其他两个不存在。

安装命令:yum install openssl-devel -y
编译成功截图:

-
- 安装模块和内核(root权限下执行):
make modules_install
make install

7. 编写测试hello.ko,insmod插入内核测试验证。
注意:makefile需要指定KENERL
KERNELDIR = /lib/modules/4.19.90-20/build