Prerequisites
Install the following tools on your x86-64 Linux build host before continuing. The script checks for each one at startup and exits immediately if any are missing.| Tool | Package (Arch Linux) | Purpose |
|---|---|---|
parted | parted | Partition the image file |
mkfs.fat | dosfstools | Format the ESP (FAT32) |
mkfs.btrfs | btrfs-progs | Format the root partition |
losetup | util-linux | Attach the image as a loop device |
btrfs | btrfs-progs | Create and manage btrfs subvolumes |
wget | wget | Download RPi5 UEFI firmware |
unzip | unzip | Extract the UEFI firmware archive |
arch-chroot | arch-install-scripts | Run commands inside the target root |
pacstrap | arch-install-scripts | Bootstrap the Arch base system |
qemu-aarch64-static | qemu-user-static | Emulate aarch64 binaries on x86-64 |
Build the image
The build script must run as root. The three positional arguments are the output filename, total image size, and swap file size. The defaults shown are suitable for most configurations.The script performs the following steps automatically:
Set
DROPBEAR_AUTHKEYS to the public key you want injected into the early-SSH initramfs before building. Without it the Dropbear daemon will start during boot but will refuse all connections.- Creates a GPT image with a 256 MiB FAT32 ESP and a btrfs root partition.
- Creates btrfs subvolumes:
@,@boot,@swap,@snapshots,@var_log,@home. - Bootstraps Arch Linux aarch64 via
pacstrapusing QEMU user-mode emulation. - Builds a dracut initramfs that includes btrfs, Dropbear, and network modules.
- Downloads and deploys the RPi5 UEFI firmware (
RPI_EFI.fd). - Installs GRUB for
arm64-efiand writesgrub.cfgwithconsole=ttyAMA0,115200.
Flash the image to storage
Insert your target storage device (eMMC via USB adapter, SD card, or NVMe in an enclosure) and identify the device node with
lsblk. Replace /dev/sdX with the correct device.First boot
Insert the storage into the CM5 on the ExaViz carrier and power on.UART consoleThe kernel command line passes Boot sequenceThe full chain is: RPi EEPROM →
console=ttyAMA0,115200. Connect a USB-to-UART adapter to the debug header on the ExaViz carrier and open a terminal session:RPI_EFI.fd (UEFI) → grubaa64.efi → linux-rpi kernel → dracut initramfs → btrfs @ root.NetworkThe kernel command line includes ip=dhcp, so dracut requests a DHCP lease on eth0 before the root filesystem is mounted. Once the system is fully up, NetworkManager takes over.Early SSH via DropbearDuring the initramfs stage, Dropbear listens on port 222. This connection is available before the root filesystem is mounted, which is useful for rescue operations and pre-mount diagnostics:Run the hardware preflight check
Once the system has booted and you can reach it over SSH (port 22) or the UART console, run the preflight script to verify that the CM5 hardware and ExaViz carrier peripherals are enumerated correctly:The script checks three things:If any device shows
❌ MISSING, verify that the corresponding udev rules are installed and that the relevant device tree overlay is enabled in /boot/efi/config.txt.Next steps
Image build reference
Full reference for
cm5-setup.sh options, btrfs layout, and re-entering the chroot after build.Early SSH and rescue
How to use the Dropbear initramfs shell for unlocking, diagnostics, and rescue.
Axelera Metis AI
Install the Metis M.2 DKMS modules and wire up Frigate for hardware-accelerated inference.
Btrfs snapshots
Configure Snapper, mirror subvolumes to SATA, and restore from snapshots.