Jump to content

NixOS on ARM/Raspberry Pi 5: Difference between revisions

From Official NixOS Wiki
imported>Leo60228
Create page
 
Document nixos-unstable image support for the Pi 5 family, NVMe boot limits, serial setup, power and cooling, and the archived UEFI port
 
(37 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
{{ARM/breadcrumb}}
<div class="infobox">
<div class="infobox">
{|class="table"
{| class="table"
!colspan="2" class="title"|Raspberry Pi 5 Family
! colspan="2" class="title" | Raspberry Pi 5 family
|-
|-
|colspan="2"|[[File:Raspberry_Pi_5,_8_GB_RAM.jpg|frameless|256px|A Raspberry Pi 5.]]
| colspan="2" | [[File:Raspberry_Pi_5,_8_GB_RAM.jpg|frameless|256px|A Raspberry Pi 5.]]
|-
|-
!Manufacturer
! Manufacturer
|Raspberry Pi Foundation
| Raspberry Pi Ltd
|-
|-
!Architecture
! Architecture
|AArch64
| AArch64
|-
|-
!Bootloader
! Stock boot method
|Custom or UEFI
| Raspberry Pi EEPROM and firmware, U-Boot, and extlinux from microSD
|-
|-
!Boot order
! SoC
|Configurable; SD, USB, Netboot
| BCM2712
|-
|-
!Maintainer
! Variants
|leo60228
| Pi 5, Pi 500, Pi 500+, CM5, and CM5 Lite
|-
!colspan="2" class="title"|Raspberry Pi 5B
|-
!SoC
|BCM2712
|}
|}
</div>
</div>
The Raspberry Pi family of devices is a series of single-board computers made by the Raspberry Pi Foundation. They are all based on Broadcom System-on-a-chip (SoCs).


== Status ==
The generic AArch64 SD image on <code>nixos-unstable</code> supports the '''Raspberry Pi 5''', Raspberry Pi 500, Raspberry Pi 500+, Compute Module 5, and Compute Module 5 Lite. NixOS 26.05 images do not include the required Pi 5-family boot files, so use an image from <code>nixos-unstable</code>.<ref name="pi5-image">[https://github.com/NixOS/nixpkgs/pull/537862 nixpkgs PR #537862: sd-image-aarch64: support rpi5]</ref> The stock image boots from microSD through Raspberry Pi firmware, U-Boot, and extlinux.
 
== Installation ==
 
Use the unstable generic AArch64 SD image described on the [[NixOS on ARM/Raspberry Pi#Installation|family page]]. The image contains the device trees used by Raspberry Pi 5, Raspberry Pi 500, Raspberry Pi 500+, Compute Module 5, and Compute Module 5 Lite, together with a single 64-bit U-Boot binary for Raspberry Pi boards.<ref name="generic-image">[https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/sd-card/sd-image-aarch64.nix Nixpkgs generic AArch64 SD image module]</ref> Raspberry Pi 500 and Raspberry Pi 500+ share board type <code>0x19</code>, for which U-Boot selects <code>bcm2712-rpi-500.dtb</code>.<ref name="revision-codes">[https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes Raspberry Pi revision codes]</ref><ref name="uboot-models">[https://github.com/u-boot/u-boot/blob/v2026.07/board/raspberrypi/rpi/rpi.c U-Boot v2026.07 Raspberry Pi model table]</ref> In a flake, import <code>nixos-hardware.nixosModules.raspberry-pi-5</code>. With channels, import <code>&lt;nixos-hardware/raspberry-pi/5&gt;</code>. The family page explains that a profile does not create an image or stage U-Boot.
 
== Kernel and hardware defaults ==
 
The profile selects a pinned kernel from Raspberry Pi's downstream Linux tree and limits device trees to BCM2712 Raspberry Pi boards. Its initrd includes NVMe, BCM2712 PCIe, RP1 clock, and support for the RP1 multifunction device. It disables GRUB and enables extlinux generation.<ref name="profile">[https://github.com/NixOS/nixos-hardware/blob/master/raspberry-pi/5/default.nix nixos-hardware Raspberry Pi 5 profile]</ref>
 
See [[NixOS on ARM/Raspberry Pi#Board profiles|Board profiles]] for Wi-Fi firmware requirements on custom systems.
 
=== Graphics ===
 
The shared profile defaults request full VC4 KMS. For Xorg, the Pi 5 profile marks the VC4 modesetting device as the primary GPU. This configuration has not been tested with RP1-connected DPI, composite, or MIPI DSI displays.<ref name="profile" /> HDMI and other VC4 display configurations use <code>vc4-kms-v3d</code>. They do not require <code>vc4-kms-v3d-pi5</code>.
 
== Storage ==


Support for the Raspberry Pi 5 is currently downstream and experimental. It will not be fully supported until mature support exists in upstream Linux and U-Boot, but using UEFI already provides a workable solution. Graphics drivers are not yet available in NixOS.
The Pi 5 profile prepares Linux and the initrd to use PCIe and NVMe. This allows a system to load U-Boot, the kernel, and the initrd from microSD, then mount its root filesystem from NVMe.


== Board-specific installation notes ==
This Linux support does not mean that released U-Boot can load the NixOS boot files from NVMe. In U-Boot v2026.07, <code>rpi_arm64_defconfig</code> enables PCIe enumeration but does not set <code>CONFIG_NVME_PCI</code> or run <code>nvme scan</code>.<ref name="uboot-config">[https://github.com/u-boot/u-boot/blob/v2026.07/configs/rpi_arm64_defconfig U-Boot v2026.07 rpi_arm64_defconfig]</ref> Its NVMe driver also lacks the PCIe inbound DMA address translation required on Pi 5. A July 2026 patch series proposes those changes, but they are not part of v2026.07.<ref name="nvme-series">[https://lists.denx.de/pipermail/u-boot/2026-July/624063.html U-Boot patch series: Fix NVMe, not only on Raspberry Pi 5]</ref>


First, install EDK2, following the [https://github.com/worproject/rpi5-uefi#getting-started instructions from the port README]. With EDK2 installed as the Platform Firmware, you can follow the [[NixOS_on_ARM/UEFI|standard instructions for UEFI on ARM]].
The Pi EEPROM can discover NVMe media and may load <code>u-boot.bin</code> from it. Released U-Boot cannot then continue the normal extlinux flow from that device. Updating only the EEPROM does not remove this limitation. The stock U-Boot v2026.07 chain therefore does not support complete NVMe boot.


EDK2 enables booting a mainline kernel, but hardware support will be very limited. Notably need to perform the installation using Wi-Fi, as Ethernet is unsupported. Once the system is installed, you can switch to the vendor's modified kernel. This is not (yet?) available in Nixpkgs, so you'll need to get it from [https://gitlab.com/vriska/nix-rpi5 a flake]. If you're not using flakes, you can simply add this to your configuration:
== Serial console ==


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Pi 5 exposes its primary UART through the dedicated debug connector. Linux names the hardware device <code>/dev/ttyAMA10</code>, and <code>/dev/serial0</code> points to it.<ref name="uart">[https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts Raspberry Pi UART documentation]</ref>
 
The profile sets <code>enable_uart=0</code> for Pi 5 to prevent ghost UART input from interrupting U-Boot on affected boards.<ref name="config-defaults">[https://github.com/NixOS/nixos-hardware/blob/master/raspberry-pi/common/config-txt-defaults.nix nixos-hardware Raspberry Pi config.txt defaults]</ref> This example enables a serial console:
 
<syntaxhighlight lang="nix">
{ lib, ... }:
{
{
   boot.kernelPackages = (import (builtins.fetchTarball https://gitlab.com/vriska/nix-rpi5/-/archive/main.tar.gz)).legacyPackages.aarch64-linux.linuxPackages_rpi5;
   hardware.raspberry-pi.configtxt.settings.pi5.enable_uart = lib.mkForce true;
  boot.kernelParams = [ "console=ttyAMA10,115200n8" ];
}
}
</nowiki>}}
</syntaxhighlight>
 
Test U-Boot interaction after enabling the UART, and use a 3.3 V adapter designed for the Pi 5 debug connector.
 
== Power and cooling ==
 
Raspberry Pi recommends its 27 W USB-C supply for Pi 5. A 5 V, 3 A supply can boot the board, but it reduces the current available to USB devices and fan peripherals. Without a heatsink or fan, the Pi 5 may thermally throttle under sustained load.<ref name="power">[https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#power-supply Raspberry Pi power-supply documentation]</ref>
 
== Alternative implementation ==
 
The [[NixOS on ARM/Raspberry Pi#Alternative implementations|family page]] describes the [https://github.com/nvmd/nixos-raspberrypi nvmd/nixos-raspberrypi] flake. Its module names and <code>boot.loader.raspberry-pi</code> options are not Nixpkgs or <code>nixos-hardware</code> APIs.
 
== UEFI ==
 
The [https://github.com/worproject/rpi5-uefi worproject/rpi5-uefi] EDK2 port is an advanced alternative to U-Boot. The project was archived in February 2025 and is no longer maintained. Its support notice says that the final release was tested on early BCM2712C1 boards and reports problems with D0 boards and newer EEPROM firmware. It is therefore not the default Pi 5 installation path. For experiments, follow the archived project's limitations and the [[NixOS on ARM/UEFI|general ARM UEFI instructions]].
 
== See also ==
 
* [[NixOS on ARM/Raspberry Pi]]
* [[NixOS on ARM/Installation]]
* [https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#nvme-ssd-boot Raspberry Pi NVMe documentation]
 
== References ==
 
<references />


For the vendor kernel to boot properly, you must switch from ACPI to Device Tree in the UEFI settings (at Device Manager -> Raspberry Pi Configuration -> ACPI / Device Tree -> System Table Mode). When using the vendor kernel (which provides full power management support), you may additionally wish to remove <code>force_turbo=1</code> from <code>/boot/config.txt</code>.
[[Category:NixOS on ARM]]

Latest revision as of 17:18, 18 July 2026

Raspberry Pi 5 family
A Raspberry Pi 5.
Manufacturer Raspberry Pi Ltd
Architecture AArch64
Stock boot method Raspberry Pi EEPROM and firmware, U-Boot, and extlinux from microSD
SoC BCM2712
Variants Pi 5, Pi 500, Pi 500+, CM5, and CM5 Lite

The generic AArch64 SD image on nixos-unstable supports the Raspberry Pi 5, Raspberry Pi 500, Raspberry Pi 500+, Compute Module 5, and Compute Module 5 Lite. NixOS 26.05 images do not include the required Pi 5-family boot files, so use an image from nixos-unstable.[1] The stock image boots from microSD through Raspberry Pi firmware, U-Boot, and extlinux.

Installation

Use the unstable generic AArch64 SD image described on the family page. The image contains the device trees used by Raspberry Pi 5, Raspberry Pi 500, Raspberry Pi 500+, Compute Module 5, and Compute Module 5 Lite, together with a single 64-bit U-Boot binary for Raspberry Pi boards.[2] Raspberry Pi 500 and Raspberry Pi 500+ share board type 0x19, for which U-Boot selects bcm2712-rpi-500.dtb.[3][4] In a flake, import nixos-hardware.nixosModules.raspberry-pi-5. With channels, import <nixos-hardware/raspberry-pi/5>. The family page explains that a profile does not create an image or stage U-Boot.

Kernel and hardware defaults

The profile selects a pinned kernel from Raspberry Pi's downstream Linux tree and limits device trees to BCM2712 Raspberry Pi boards. Its initrd includes NVMe, BCM2712 PCIe, RP1 clock, and support for the RP1 multifunction device. It disables GRUB and enables extlinux generation.[5]

See Board profiles for Wi-Fi firmware requirements on custom systems.

Graphics

The shared profile defaults request full VC4 KMS. For Xorg, the Pi 5 profile marks the VC4 modesetting device as the primary GPU. This configuration has not been tested with RP1-connected DPI, composite, or MIPI DSI displays.[5] HDMI and other VC4 display configurations use vc4-kms-v3d. They do not require vc4-kms-v3d-pi5.

Storage

The Pi 5 profile prepares Linux and the initrd to use PCIe and NVMe. This allows a system to load U-Boot, the kernel, and the initrd from microSD, then mount its root filesystem from NVMe.

This Linux support does not mean that released U-Boot can load the NixOS boot files from NVMe. In U-Boot v2026.07, rpi_arm64_defconfig enables PCIe enumeration but does not set CONFIG_NVME_PCI or run nvme scan.[6] Its NVMe driver also lacks the PCIe inbound DMA address translation required on Pi 5. A July 2026 patch series proposes those changes, but they are not part of v2026.07.[7]

The Pi EEPROM can discover NVMe media and may load u-boot.bin from it. Released U-Boot cannot then continue the normal extlinux flow from that device. Updating only the EEPROM does not remove this limitation. The stock U-Boot v2026.07 chain therefore does not support complete NVMe boot.

Serial console

Pi 5 exposes its primary UART through the dedicated debug connector. Linux names the hardware device /dev/ttyAMA10, and /dev/serial0 points to it.[8]

The profile sets enable_uart=0 for Pi 5 to prevent ghost UART input from interrupting U-Boot on affected boards.[9] This example enables a serial console:

{ lib, ... }:
{
  hardware.raspberry-pi.configtxt.settings.pi5.enable_uart = lib.mkForce true;
  boot.kernelParams = [ "console=ttyAMA10,115200n8" ];
}

Test U-Boot interaction after enabling the UART, and use a 3.3 V adapter designed for the Pi 5 debug connector.

Power and cooling

Raspberry Pi recommends its 27 W USB-C supply for Pi 5. A 5 V, 3 A supply can boot the board, but it reduces the current available to USB devices and fan peripherals. Without a heatsink or fan, the Pi 5 may thermally throttle under sustained load.[10]

Alternative implementation

The family page describes the nvmd/nixos-raspberrypi flake. Its module names and boot.loader.raspberry-pi options are not Nixpkgs or nixos-hardware APIs.

UEFI

The worproject/rpi5-uefi EDK2 port is an advanced alternative to U-Boot. The project was archived in February 2025 and is no longer maintained. Its support notice says that the final release was tested on early BCM2712C1 boards and reports problems with D0 boards and newer EEPROM firmware. It is therefore not the default Pi 5 installation path. For experiments, follow the archived project's limitations and the general ARM UEFI instructions.

See also

References