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

相关推荐
半桔13 分钟前
【Linux手册】从接口到管理:Linux文件系统的核心操作指南
android·java·linux·开发语言·面试·系统架构
禁默21 分钟前
Linux Vim 编辑器详解:从入门到进阶(含图示+插件推荐)
linux·vim·excel
许白掰2 小时前
Linux入门篇学习——Linux 工具之 make 工具和 makefile 文件
linux·运维·服务器·前端·学习·编辑器
longze_75 小时前
Ubuntu连接不上网络问题(Network is unreachable)
linux·服务器·ubuntu
Dirschs6 小时前
【Ubuntu22.04安装ROS Noetic】
linux·ubuntu·ros
qianshanxue116 小时前
ubuntu 操作记录
linux
AmosTian8 小时前
【系统与工具】Linux——Linux简介、安装、简单使用
linux·运维·服务器
YC运维10 小时前
RIP实验以及核心原理
运维·网络·智能路由器
leo__52011 小时前
自动化运维:使用Ansible简化日常任务
运维·自动化·ansible