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

相关推荐
LH_R5 小时前
OneTerm开源堡垒机实战(四):访问授权与安全管控
运维·后端·安全
用户31187945592185 小时前
Kylin Linux 10 安装 glib2-devel-2.62.5-7.ky10.x86_64.rpm 方法(附安装包)
linux
Raymond运维5 小时前
MariaDB源码编译安装(二)
运维·数据库·mariadb
涛啊涛6 小时前
Centos7非LVM根分区容量不足后扩容,对调硬盘挂载/
linux·磁盘管理
JuiceFS1 天前
从 MLPerf Storage v2.0 看 AI 训练中的存储性能与扩展能力
运维·后端
CYRUS_STUDIO1 天前
用 Frida 控制 Android 线程:kill 命令、挂起与恢复全解析
android·linux·逆向
熊猫李1 天前
rootfs-根文件系统详解
linux
chen9451 天前
mysql 3节点mgr集群部署
运维·后端
LH_R1 天前
OneTerm开源堡垒机实战(三):功能扩展与效率提升
运维·后端·安全
dessler1 天前
Hadoop HDFS-高可用集群部署
linux·运维·hdfs