CentOS 7 aarch64上制作kernel rpm二进制包 —— 筑梦之路

环境说明

centos 7 aarch64

gcc 8.3.1

kernel 5.4.290

准备编译制作

bash 复制代码
# 安装必要的工具和包
 
yum install rpm-devel rpmdevtools
yum groupinstall "Development Tools"
 
yum install ncurses-devel  bc elfutils-libelf-devel openssl-devel 


# 安装gcc 8.3.1

# 修改repo文件

cd /etc/yum.repos.d/
cat > CentOS-SCLo-scl-rh.repo << 'EOF'
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-testing]
name=CentOS-7 - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOF

yum clean all
yum makecache fast
sudo yum install devtoolset-8-gcc devtoolset-8-gcc-c++

#临时启用gcc8
source /opt/rh/devtoolset-8/enable

#长期使用
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

# 下载源码包
wget http://mirrors.ustc.edu.cn/kernel.org/linux/kernel/v5.x/linux-5.4.290.tar.xz

tar -Jxf linux-5.4.290.tar.xz

开始编译制作rpm

bash 复制代码
cd linux-5.4.290

# 生成配置文件

make menuconfig
 
# 编译制作rpm包

make rpm-pkg  

# 更多参数说明参考
Kernel packaging:
  rpm-pkg             - Build both source and binary RPM kernel packages
  binrpm-pkg          - Build only the binary kernel RPM package
  deb-pkg             - Build both source and binary deb kernel packages
  bindeb-pkg          - Build only the binary kernel deb package
  snap-pkg            - Build only the binary kernel snap package
                        (will connect to external hosts)
  dir-pkg             - Build the kernel as a plain directory structure
  tar-pkg             - Build the kernel as an uncompressed tarball
  targz-pkg           - Build the kernel as a gzip compressed tarball
  tarbz2-pkg          - Build the kernel as a bzip2 compressed tarball
  tarxz-pkg           - Build the kernel as a xz compressed tarball
  perf-tar-src-pkg    - Build perf-5.7.1.tar source tarball
  perf-targz-src-pkg  - Build perf-5.7.1.tar.gz source tarball
  perf-tarbz2-src-pkg - Build perf-5.7.1.tar.bz2 source tarball
  perf-tarxz-src-pkg  - Build perf-5.7.1.tar.xz source tarball

成果展示

FAQ

  1. No rule to make target 'certs/rhel.pem', needed by 'certs/x509_certificat

解决:

修改.config文件

CONFIG_SYSTEM_TRUSTED_KEYS=""

  1. BTF: .tmp_vmlinux.btf: pahole (pahole) is not available

Failed to generate BTF for vmlinux

Try to disable CONFIG_DEBUG_INFO_BTF

make[3]: *** [vmlinux] Error 1

解决:

修改.config文件

CONFIG_DEBUG_INFO_BTF=n

相关推荐
水水沝淼㵘3 分钟前
嵌入式开发学习日志(数据结构--顺序结构单链表)Day19
linux·服务器·c语言·数据结构·学习·算法·排序算法
愚润求学10 分钟前
【Linux】基础 IO(一)
linux·运维·服务器·开发语言·c++·笔记
what_201811 分钟前
分布式链路跟踪
java·运维·分布式
大白的编程日记.42 分钟前
【Linux学习笔记】理解一切皆文件实现原理和文件缓冲区
linux·笔记·学习
孞㐑¥43 分钟前
Linux之进程控制
linux·开发语言·c++·经验分享·笔记
愚润求学1 小时前
【Linux】简单设计libc库
linux·运维·开发语言·c++·笔记
chennalC#c.h.JA Ptho1 小时前
Bodhi linux 系统详解
linux·经验分享·笔记·系统架构·系统安全
monstercl1 小时前
游戏资源传输服务器
运维·服务器·游戏
运维开发王义杰1 小时前
PAC文件:智能代理配置的瑞士军刀
运维
网硕互联的小客服2 小时前
服务器配置错误导致SSL/TLS出现安全漏洞,如何进行排查?
运维·服务器