yumdownloader --source kernel
下载的源码包为
kernel-4.18.0-372.9.1.el8.src.rpm
rpm -ivh kernel-4.18.0-372.9.1.el8.src.rpm
拷贝tar包目录
cp /home/wy/rpmbuild/SOURCES/linux-4.18.0-372.9.1.el8.tar.xz ~/code/
cp ~/rpmbuild/SOURCES/x509.genkey ~/linux-4.18/certs/
cd ~/rpmbuild/SOURCES/
openssl x509 -inform der -in rockydup1.x509 -out rockydup1.pem
openssl x509 -inform der -in rockykpatch1.x509 -out rockykpatch1.pem
cat rockydup1.pem rockykpatch1.pem > rocky.pem
pwd
cd ~/linux-4.18/
cp /home/wy/rpmbuild/SOURCES/rocky.pem ./certs/
ls
ls certs/
cd ..
拷贝编译的配置文件
~/linux-4.18.0-372.9.1.el8 cp ../config-4.18.0-372.9.1.el8.x86_64 .config
make -j16
一路回车就可以
make modules_install
make install
reboot
遇到的问题:
make[2]: *** No rule to make target needed by ‘certs/x509_certificate_list’. Stop
解决办法:
cp ~/rpmbuild/SOURCES/x509.genkey ~/linux-4.18/certs/
cd ~/rpmbuild/SOURCES/
openssl x509 -inform der -in rockydup1.x509 -out rockydup1.pem
openssl x509 -inform der -in rockykpatch1.x509 -out rockykpatch1.pem
cat rockydup1.pem rockykpatch1.pem > rocky.pem
pwd
cd ~/linux-4.18/
cp /home/wy/rpmbuild/SOURCES/rocky.pem ./certs/
重新编译内核
参考链接:
» Fedora / RedHat / CentOS7 / CentOS8 – compiling the latest kernel – updated 2020-01 | dwav
es.de
Signed kernel module support - Gentoo Wiki
Kernel module signing facility — The Linux Kernel documentation