Pi:dev build environment: Difference between revisions
No edit summary |
via /pi-wiki-publish |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
'''Working draft.''' Procedure re-validated 2026-05-05 on Pi OS Bookworm / Pi 5 | '''Working draft.''' Procedure re-validated 2026-05-05 on Pi OS Bookworm / Pi 5. | ||
---- | ---- | ||
| Line 33: | Line 33: | ||
sudo apt-get install -y debootstrap qemu-user-static binfmt-support | sudo apt-get install -y debootstrap qemu-user-static binfmt-support | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Verify: | Verify: | ||
| Line 44: | Line 42: | ||
=== 2. Add the apt signing key === | === 2. Add the apt signing key === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 69: | Line 65: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Ends with <code>W: Failure while configuring required packages</code>. Continue. | |||
=== 4. Neutralise segfaulting postinsts and force-install === | |||
<syntaxhighlight lang="bash"> | |||
for pkg in systemd plymouth mountall; do | |||
printf '#!/bin/sh\nexit 0\n' \ | |||
| sudo tee /srv/nextpi-buildroot/var/lib/dpkg/info/${pkg}.postinst > /dev/null | |||
sudo chmod +x /srv/nextpi-buildroot/var/lib/dpkg/info/${pkg}.postinst | |||
done | |||
sudo chroot /srv/nextpi-buildroot \ | sudo chroot /srv/nextpi-buildroot \ | ||
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C \ | /usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C \ | ||
| Line 88: | Line 81: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Errors on <code>systemd</code>, <code>plymouth</code>, <code>mountall</code> are expected | Errors on <code>systemd</code>, <code>plymouth</code>, <code>mountall</code> are expected. Verify: | ||
Verify: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 108: | Line 99: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Session-only; see [[#Persistent mounts|Persistent mounts]] for fstab. | |||
=== 6. Hold systemd, plymouth, mountall === | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 120: | Line 109: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== 7. Install | === 7. Install the NextPi 1.92D package set + dev variants === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo chroot /srv/nextpi-buildroot \ | sudo chroot /srv/nextpi-buildroot \ | ||
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C HOME=/root \ | /usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C HOME=/root \ | ||
/bin/bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | /bin/bash -c " | ||
apt-get update -qq && \ | |||
wget -q -O /tmp/buildroot.packages https://zx.xalior.com/nextpi_dev/buildroot.packages && \ | |||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | |||
\$(cat /tmp/buildroot.packages) | |||
" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
~50 s on Pi 5 / NVMe; chroot grows to ~2.0 GB. Toolchain check: | |||
Toolchain check: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 159: | Line 146: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
~10–15 s on Pi 5 / NVMe. Verify: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 165: | Line 152: | ||
# ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked | # ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Persistent mounts == | == Persistent mounts == | ||
Add to <code>/etc/fstab</code>: | |||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
| Line 179: | Line 164: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<code>/etc/resolv.conf</code> needs re-copying after host reboot. | |||
== Sources == | |||
* Apt mirror: <code>http://zx.xalior.com/nextpi_dev stretch main contrib non-free rpi firmware</code>. | |||
* Signing key: https://zx.xalior.com/nextpi_dev/debian_nextpi.key — sha256 <code>ca59cd4f2bcbc3a1d41ba6815a02a8dc5c175467a59bd87edeac458f4a5345de</code>. Byte-identical to https://archive.raspbian.org/raspbian.public.key. | |||
* Package list: https://zx.xalior.com/nextpi_dev/buildroot.packages — 369 entries (NextPi 1.92D installed set, less firmware/kernel/Pi-hardware, plus available <code>-dev</code> variants). | |||
* Smoke-test source: libspectrum 1.6.0 from https://sourceforge.net/projects/fuse-emulator/files/libspectrum/. | |||
Latest revision as of 19:07, 5 May 2026
Working draft. Procedure re-validated 2026-05-05 on Pi OS Bookworm / Pi 5.
Reproducible procedure for setting up a build host that produces stretch-armhf binaries (compatible with the Raspbian-9 base used by NextPi) on any modern aarch64 Raspberry Pi running Pi OS Bookworm.
Why
NextPi releases ship as Raspbian 9 (stretch) armhf binaries. This procedure builds those binaries inside a stretch-armhf chroot hosted on a modern aarch64 Pi. aarch64 hardware can execute armhf userspace natively via aarch32 compat, so the build runs at host CPU speed without QEMU emulation, while the toolchain and libraries remain pinned to stretch for ABI compatibility with the deployment target. Apt sources point at the project's stretch mirror at http://zx.xalior.com/nextpi_dev, which keeps package versions deterministic across build hosts.
Measured speedup, libspectrum 1.6.0 build:
| Build host | Time | Ratio |
|---|---|---|
| Pi 3, 4× Cortex-A53 armv7l, SD card (native stretch) | 65 s | 1.0× |
| Pi 5, 4× Cortex-A76 aarch64, NVMe (chroot) | 11 s | 5.9× |
Prerequisites
- Vanilla Pi OS Bookworm on a Pi 4 or Pi 5 with ~5 GB free disk.
- SSH access as a sudo-capable user.
- Network reach to
zx.xalior.com.
Procedure
1. Install host tooling
sudo apt-get update
sudo apt-get install -y debootstrap qemu-user-static binfmt-supportVerify:
dpkg --print-foreign-architectures # should list: armhf
ls /proc/sys/fs/binfmt_misc/ | grep qemu-arm2. Add the apt signing key
curl -sL https://zx.xalior.com/nextpi_dev/debian_nextpi.key \
| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian_nextpi.gpgConfirm:
sudo gpg --no-default-keyring --keyring /etc/apt/trusted.gpg.d/debian_nextpi.gpg --list-keys
# pub rsa2048 2012-04-01 [SC] A0DA38D0D76E8B5D638872819165938D90FDDD2E
# uid Mike Thompson (Raspberry Pi Debian armhf ARMv6+VFP)3. Debootstrap the chroot
sudo debootstrap --arch=armhf --variant=buildd \
--keyring=/etc/apt/trusted.gpg.d/debian_nextpi.gpg \
stretch /srv/nextpi-buildroot/ \
http://zx.xalior.com/nextpi_devEnds with W: Failure while configuring required packages. Continue.
4. Neutralise segfaulting postinsts and force-install
for pkg in systemd plymouth mountall; do
printf '#!/bin/sh\nexit 0\n' \
| sudo tee /srv/nextpi-buildroot/var/lib/dpkg/info/${pkg}.postinst > /dev/null
sudo chmod +x /srv/nextpi-buildroot/var/lib/dpkg/info/${pkg}.postinst
done
sudo chroot /srv/nextpi-buildroot \
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C \
/bin/bash -c "dpkg --install --force-depends --force-confdef --force-confold --force-overwrite --force-bad-version --recursive /var/cache/apt/archives/"Errors on systemd, plymouth, mountall are expected. Verify:
sudo chroot /srv/nextpi-buildroot \
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C \
/bin/bash -c "type apt-get && type gcc"5. Bind-mount runtime filesystems
for m in proc sys dev dev/pts; do
sudo mkdir -p /srv/nextpi-buildroot/$m
sudo mount --bind /$m /srv/nextpi-buildroot/$m
done
sudo cp /etc/resolv.conf /srv/nextpi-buildroot/etc/Session-only; see Persistent mounts for fstab.
6. Hold systemd, plymouth, mountall
sudo chroot /srv/nextpi-buildroot \
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C \
/bin/bash -c "apt-mark hold systemd plymouth mountall"7. Install the NextPi 1.92D package set + dev variants
sudo chroot /srv/nextpi-buildroot \
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C HOME=/root \
/bin/bash -c "
apt-get update -qq && \
wget -q -O /tmp/buildroot.packages https://zx.xalior.com/nextpi_dev/buildroot.packages && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
\$(cat /tmp/buildroot.packages)
"~50 s on Pi 5 / NVMe; chroot grows to ~2.0 GB. Toolchain check:
sudo chroot /srv/nextpi-buildroot /usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c \
"gcc --version | head -1; automake --version | head -1; libtool --version | head -1; pkg-config --version"Expect: gcc 6.3.0, automake 1.15, libtool 2.4.6, pkg-config 0.29.
8. Smoke test: build libspectrum 1.6.0
sudo chroot /srv/nextpi-buildroot \
/usr/bin/env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C HOME=/root \
/bin/bash -c '
cd /tmp && \
wget -q https://sourceforge.net/projects/fuse-emulator/files/libspectrum/1.6.0/libspectrum-1.6.0.tar.gz/download -O libspectrum-1.6.0.tar.gz && \
tar xzf libspectrum-1.6.0.tar.gz && \
cd libspectrum-1.6.0 && \
./configure --with-fake-glib --quiet && \
time make -s
'~10–15 s on Pi 5 / NVMe. Verify:
file /srv/nextpi-buildroot/tmp/libspectrum-1.6.0/.libs/libspectrum.so.8.10.0
# ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linkedPersistent mounts
Add to /etc/fstab:
/proc /srv/nextpi-buildroot/proc none bind 0 0
/sys /srv/nextpi-buildroot/sys none bind 0 0
/dev /srv/nextpi-buildroot/dev none bind 0 0
/dev/pts /srv/nextpi-buildroot/dev/pts none bind 0 0/etc/resolv.conf needs re-copying after host reboot.
Sources
- Apt mirror:
http://zx.xalior.com/nextpi_dev stretch main contrib non-free rpi firmware. - Signing key: https://zx.xalior.com/nextpi_dev/debian_nextpi.key — sha256
ca59cd4f2bcbc3a1d41ba6815a02a8dc5c175467a59bd87edeac458f4a5345de. Byte-identical to https://archive.raspbian.org/raspbian.public.key. - Package list: https://zx.xalior.com/nextpi_dev/buildroot.packages — 369 entries (NextPi 1.92D installed set, less firmware/kernel/Pi-hardware, plus available
-devvariants). - Smoke-test source: libspectrum 1.6.0 from https://sourceforge.net/projects/fuse-emulator/files/libspectrum/.