The CM5 image uses dracut to generate the initramfs. The initramfs includes Btrfs support, an early SSH server (Dropbear), network configuration, and custom modules for RPi5 hardware and Axelera device initialization.
dracut.conf.d/rpi5.conf
The main configuration is written to /etc/dracut.conf.d/rpi5.conf during the image build:
/etc/dracut.conf.d/rpi5.conf
# dracut config for RPi5 / CM5 btrfs + dropbear early SSH
hostonly="yes"
hostonly_cmdline="yes"
compress="zstd"
# btrfs root
add_dracutmodules+=" btrfs "
filesystems+=" btrfs "
# early SSH via dropbear for headless rescue
add_dracutmodules+=" dropbear "
dropbear_acl="/etc/dropbear/authorized_keys"
dropbear_rsa_key="/etc/dropbear/dropbear_rsa_host_key"
dropbear_ecdsa_key="/etc/dropbear/dropbear_ecdsa_host_key"
# IP config: dhcp on eth0 — adjust for CM5 Exaviz carrier NIC
kernel_cmdline="ip=dhcp"
# aarch64 / RPi specifics
add_drivers+=" broadcom vc4 drm "
# useful for headless debug
add_dracutmodules+=" network "
| Option | Purpose |
|---|
hostonly=yes | Only include modules needed for this specific hardware |
compress=zstd | Compress initramfs with Zstd (fast decompression) |
add_dracutmodules+=" btrfs " | Include Btrfs support for root mount |
add_dracutmodules+=" dropbear " | Include Dropbear SSH server |
add_dracutmodules+=" network " | Include network support (for DHCP + early SSH) |
kernel_cmdline="ip=dhcp" | Set DHCP kernel parameter in initramfs |
add_drivers+=" broadcom vc4 drm " | Include broadcom, VC4, and DRM drivers |
Building the initramfs
# Primary (hostonly) initramfs
dracut --force \
--kver $(uname -r) \
--add "btrfs dropbear network" \
/boot/initramfs-$(uname -r).img
# Fallback (no hostonly) — includes all drivers
dracut --force \
--no-hostonly \
--kver $(uname -r) \
--add "btrfs dropbear network" \
/boot/initramfs-$(uname -r)-fallback.img
Custom dracut modules
The repository includes three custom dracut modules installed at build time.
95rpi-hardware
Located at Dracut/module-setup.sh. This module embeds RPi5-specific kernel modules and device tree overlays:
#!/bin/bash
# /usr/lib/dracut/modules.d/95rpi-hardware/module-setup.sh
check() {
# Only include this if we are on an ARM64 RPi
[[ "$(uname -m)" == "aarch64" ]] || return 1
return 0
}
depends() {
echo "bash"
}
install() {
# Include the Axelera driver and RPi5 I/O drivers
inst_mods axdevice rp1_uart rp1_pci
# Include the specific DTBOs in the initramfs
inst "/boot/overlays/exaviz-cruiser.dtbo" "/boot/overlays/exaviz-cruiser.dtbo"
inst "/boot/overlays/axelera-metis.dtbo" "/boot/overlays/axelera-metis.dtbo"
}
| Item | Purpose |
|---|
axdevice | Axelera device kernel module |
rp1_uart | RPi5 RP1 UART driver |
rp1_pci | RPi5 RP1 PCIe driver |
exaviz-cruiser.dtbo | Device tree overlay for the Exaviz Cruiser carrier |
axelera-metis.dtbo | Device tree overlay for the Axelera Metis M.2 |
90exaviz
Located at scripts/90exaviz_module-setup.sh. Handles Exaviz hardware initialization and TPM/I2C/SPI support:
scripts/90exaviz_module-setup.sh
#dracut/90exaviz/module-setup.sh
install() {
# Reusing your 'slammer' for TPM, AI, and PoE
inst_multiple sh mkdir cat find
inst_script "$moddir/exaviz-init.sh" "/sbin/exaviz-init"
# Ensure we have the I2C/SPI drivers if using an external TPM
hostonly='' instmods i2c-dev tpm_tis_spi tpm_tis_i2c
}
90tpm
Located at scripts/90tpm_module-setup.sh. Handles TPM 2.0 initialization before the root filesystem is available:
scripts/90tpm_module-setup.sh
#dracut/90tpm/module-setup.sh
install() {
# Include TPM 2.0 stack and the SLB9670/9672 driver
inst_multiple tpm2_pcrread tpm2_seal tpm2_unseal
hostonly='' instmods tpm_tis_spi spi_bcm2835
# The 'Slammer': Load the overlay before the kernel tries to find /dev/tpm0
inst_script "$moddir/load-tpm-overlay.sh" "/sbin/tpm-init"
}
Device tree overlay hooks
Two scripts handle device tree overlay application in the initramfs. Dracut/apply-overlays.sh is the portable dracut module script that applies all .dtbo files found in /lib/firmware/overlays/:
#!/bin/sh
# Portable script to apply overlays via ConfigFS in the initramfs
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Mount ConfigFS if it's not already there
if [ ! -d /sys/kernel/config/device-tree ]; then
mount -t configfs none /sys/kernel/config
fi
# Apply each overlay found in our firmware directory
for dtbo in /lib/firmware/overlays/*.dtbo; do
name=$(basename "$dtbo" .dtbo)
mkdir -p "/sys/kernel/config/device-tree/overlays/$name"
cat "$dtbo" > "/sys/kernel/config/device-tree/overlays/$name/dtbo"
info "Cruiser-HAL: Loaded $name"
done
scripts/dracut-hook.sh is a more targeted variant that also forces the PCIe Gen3 link capability on the RPi5 controller:
#!/bin/bash
# dracut hook: pre-udev (runs before udev triggers)
# 1. Ensure ConfigFS is ready
if [ ! -d /sys/kernel/config/device-tree ]; then
mount -t configfs none /sys/kernel/config 2>/dev/null
fi
# 2. Slam the Overlays
for overlay in exaviz-cruiser axelera-metis; do
if [ -f "/lib/firmware/overlays/${overlay}.dtbo" ]; then
mkdir -p "/sys/kernel/config/device-tree/overlays/${overlay}"
cat "/lib/firmware/overlays/${overlay}.dtbo" \
> "/sys/kernel/config/device-tree/overlays/${overlay}/dtbo"
echo "Exaviz-HAL: Slammed ${overlay} into ConfigFS"
fi
done
# 3. Force PCIe Gen3
if [ -d "/sys/devices/platform/axi/1000110000.pcie" ]; then
echo 3 > /sys/devices/platform/axi/1000110000.pcie/pcie_gen_cap 2>/dev/null
echo "Exaviz-HAL: Forced PCIe Gen3 Link Cap"
fi
Rebuilding after kernel updates
After a kernel package update, rebuild the initramfs:
# Get new kernel version
KERNEL_VER=$(ls /lib/modules/ | sort -V | tail -1)
# Rebuild
sudo dracut --force --hostonly \
/boot/initramfs-${KERNEL_VER}.img ${KERNEL_VER}
# Rebuild fallback
sudo dracut --force --no-hostonly \
/boot/initramfs-${KERNEL_VER}-fallback.img ${KERNEL_VER}
Consider setting up a pacman hook in /etc/pacman.d/hooks/ to automatically rebuild the initramfs whenever linux-rpi is updated.