为 Raspberry Pi OS (ARM64) 创建 pBuilder chroot 环境

为 Raspberry Pi OS (ARM64) 创建 pBuilder chroot 环境

我正在尝试为 Raspberry Pi OS (ARM64) 创建 pBuilder chroot 环境,以便在 AMD64 主机上为 Raspberry Pi 4B/3B 构建 Debian 软件包。

我发现了一个似乎相关的教程:https://jod.al/2015/03/08/building-arm-debs-with-pbuilder/。然而,它似乎已经过时了,我一直无法找到更新的资源。

为了设置构建环境,我使用了这个 Vagrant 盒子,我将在本次调查的所有后续步骤中使用它:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/jammy64"

  config.vm.provision "shell", path: "bootstrap.sh"

  config.vm.provider 'virtualbox' do |vb|
    vb.memory = 2048
    vb.cpus = 2
  end
end

Bootstrap.sh脚本:

#!/bin/bash
sudo apt-get update
sudo apt-get install -y \
    debian-archive-keyring \
    devscripts \
    dh-make \
    dh-python \
    pbuilder \
    python3-all-dev \
    python3-setuptools \
    qemu-user-static \
    ubuntu-keyring

我成功创建了一个“常规”Debian chroot:

sudo OS=debian pbuilder create \
    --distribution bullseye \
    --mirror http://ftp.de.debian.org/debian/ \
    --architecture arm64

现在我正在尝试创建 Raspberry Pi OS chroot:

# Get and install apt keyring 
wget https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-archive-keyring/raspberrypi-archive-keyring_2021.1.1+rpt1_all.deb
sudo dpkg -i raspberrypi-archive-keyring_2021.1.1+rpt1_all.deb

# Create pBuilder chroot
sudo OS=debian pbuilder create \
    --distribution bullseye \
    --mirror https://archive.raspberrypi.org/debian \
    --debootstrapopts --keyring=/usr/share/keyrings/raspberrypi-archive-keyring.gpg \
    --architecture arm64

但这失败了,并显示“无法找到这些 debs:ca-certificates build-essential apt”:

W: /root/.pbuilderrc does not exist
I: Distribution is bullseye.
I: Current time: Mon Jul  3 10:49:50 UTC 2023
I: pbuilder-time-stamp: 1688381390
I: Building the build environment
I: running debootstrap
/usr/sbin/debootstrap
I: Retrieving InRelease 
I: Checking Release signature
I: Valid Release signature (key id CF8A1AF502A2AA2D763BAE7E82B129927FA3303E)
I: Retrieving Packages 
I: Validating Packages 
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on https://archive.raspberrypi.org/debian...
E: Couldn't find these debs: ca-certificates build-essential apt
E: debootstrap failed
E: Tail of debootstrap.log:
2023-07-03 10:49:51 URL:https://archive.raspberrypi.org/debian/dists/bullseye/InRelease [23602/23602] -> "/var/cache/pbuilder/build/32279/var/lib/apt/lists/partial/archive.raspberrypi.org_debian_dists_bullseye_InRelease" [1]
gpgv: Signature made Fri Jun 30 14:46:21 2023 UTC
gpgv:                using RSA key CF8A1AF502A2AA2D763BAE7E82B129927FA3303E
gpgv: Good signature from "Raspberry Pi Archive Signing Key"
2023-07-03 10:49:51 URL:https://archive.raspberrypi.org/debian/dists/bullseye/main/binary-arm64/Packages.gz [307612/307612] -> "/var/cache/pbuilder/build/32279/var/lib/apt/lists/partial/archive.raspberrypi.org_debian_dists_bullseye_main_binary-arm64_Packages.gz" [1]
E: End of debootstrap.log
W: Aborting with an error

这里有什么问题以及让 pBuilder chroot 运行的必要步骤是什么?

相关内容