Skip to main content
This guide takes you from a bare host machine to a booted CM5 system. By the end you will have a signed Arch Linux image flashed to storage, GRUB configured, and a dracut initramfs with early SSH ready for headless bring-up.

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.
ToolPackage (Arch Linux)Purpose
partedpartedPartition the image file
mkfs.fatdosfstoolsFormat the ESP (FAT32)
mkfs.btrfsbtrfs-progsFormat the root partition
losetuputil-linuxAttach the image as a loop device
btrfsbtrfs-progsCreate and manage btrfs subvolumes
wgetwgetDownload RPi5 UEFI firmware
unzipunzipExtract the UEFI firmware archive
arch-chrootarch-install-scriptsRun commands inside the target root
pacstraparch-install-scriptsBootstrap the Arch base system
qemu-aarch64-staticqemu-user-staticEmulate aarch64 binaries on x86-64

1

Clone the repo

git clone https://github.com/Lonewolf-Information-systems/CM5-Exaviz.git
cd CM5-Exaviz
2

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.
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.
export DROPBEAR_AUTHKEYS="$HOME/.ssh/id_ed25519.pub"
sudo DROPBEAR_AUTHKEYS="$HOME/.ssh/id_ed25519.pub" \
  bash scripts/cm5-setup.sh rpi5-arch.img 16G 4G
The script performs the following steps automatically:
  1. Creates a GPT image with a 256 MiB FAT32 ESP and a btrfs root partition.
  2. Creates btrfs subvolumes: @, @boot, @swap, @snapshots, @var_log, @home.
  3. Bootstraps Arch Linux aarch64 via pacstrap using QEMU user-mode emulation.
  4. Builds a dracut initramfs that includes btrfs, Dropbear, and network modules.
  5. Downloads and deploys the RPi5 UEFI firmware (RPI_EFI.fd).
  6. Installs GRUB for arm64-efi and writes grub.cfg with console=ttyAMA0,115200.
The root password is not set by the script. Before first boot, enter the chroot and set a password:
# Replace /dev/loop0p2 with the actual loop device shown in script output
sudo mount -o compress=zstd,space_cache=v2,noatime,subvol=@ \
  /dev/loop0p2 /mnt/rpi5-root
sudo arch-chroot /mnt/rpi5-root passwd
sudo umount -R /mnt/rpi5-root
3

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.
sudo dd if=rpi5-arch.img of=/dev/sdX bs=4M status=progress conv=fsync
bmaptool reads only the blocks that were actually written to the image, making it significantly faster than dd for sparse images. Install it with pacman -S bmap-tools on Arch, or apt install bmap-tools on Debian/Ubuntu.
4

First boot

Insert the storage into the CM5 on the ExaViz carrier and power on.UART consoleThe kernel command line passes console=ttyAMA0,115200. Connect a USB-to-UART adapter to the debug header on the ExaViz carrier and open a terminal session:
screen /dev/ttyUSB0 115200
Boot sequenceThe full chain is: RPi EEPROM → RPI_EFI.fd (UEFI) → grubaa64.efilinux-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:
ssh -p 222 root@<device-ip>
5

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:
sudo bash scripts/preflight.sh
The script checks three things:
--- 🧠 Memory & CMA Check ---
# Reads MemTotal and CMA allocation from /proc/meminfo.
# CMA (Contiguous Memory Allocator) is required by the Axelera AI chip.
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.

Build docs developers (and LLMs) love