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

相关推荐
Miracle&几秒前
2.TCP深度解析:握手、挥手、状态机、流量与拥塞控制
linux·网络·tcp/ip
专注API从业者14 分钟前
Python/Java 代码示例:手把手教程调用 1688 API 获取商品详情实时数据
java·linux·数据库·python
Ribou1 小时前
Ubuntu 24.04.2安装k8s 1.33.4 配置cilium
linux·ubuntu·kubernetes
tan180°2 小时前
Boost搜索引擎 网络库与前端(4)
linux·网络·c++·搜索引擎
Mr. Cao code2 小时前
Docker:颠覆传统虚拟化的轻量级革命
linux·运维·ubuntu·docker·容器
抓饼先生3 小时前
Linux control group笔记
linux·笔记·bash
挺6的还3 小时前
25.线程概念和控制(二)
linux
wanhengidc3 小时前
云手机运行流畅,秒开不卡顿
运维·网络·科技·游戏·智能手机
您的通讯录好友3 小时前
conda环境导出
linux·windows·conda
笨小孩@GF 知行合一4 小时前
OSPF实验:外部路由引入
运维·网络·hcip·数通·ospf