Centos Kernel编译rpm包
Posted 云计算基础架构
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos Kernel编译rpm包相关的知识,希望对你有一定的参考价值。
参考:https://wiki.centos.org/HowTos/RebuildSRPM
建议使用非root用户
创建相关目录
[user@host]$ mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
[user@host]$ echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
下载kernel src包
wget https://archive.kernel.org/centos-vault/centos/7.6.1810/updates/Source/SPackages/kernel-alt-4.14.0-115.10.1.el7a.src.rpm
安装相关包
[root@host]# yum install asciidoc audit-libs-devel bash bc binutils binutils-devel bison diffutils elfutils
[root@host]# yum install elfutils-devel elfutils-libelf-devel findutils flex gawk gcc gettext gzip hmaccalc hostname java-devel
[root@host]# yum install m4 make module-init-tools ncurses-devel net-tools newt-devel numactl-devel openssl
[root@host]# yum install patch pciutils-devel perl perl-ExtUtils-Embed pesign python-devel python-docutils redhat-rpm-config
[root@host]# yum install rpm-build sh-utils tar xmlto xz zlib-devel
解压包生成source file
[user@host]$ cd ~/rpmbuild/SPECS
[user@host SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec
编译kernel
$cd /home/centos/rpmbuild/BUILD/kernel-alt-4.14.0-115.10.1.el7a/linux-4.14.0-115.10.1.el7a.x86_64 $make rpm -j 30
编译后生成相关文件
/home/centos/rpmbuild/RPMS/x86_64
kernel-4.14.0-1.x86_64.rpm kernel-devel-4.14.0-1.x86_64.rpm kernel-headers-4.14.0-1.x86_64.rpm
使用该rpm文件安装kernel并设置从该kernel启动
以上是关于Centos Kernel编译rpm包的主要内容,如果未能解决你的问题,请参考以下文章