Florian Pester · 3 min read

NixOS on ARM: Rock 5 B

We currently have a couple of projects that use the Radxa Rock 5B SBC as base platform. It's a nice ARM board based on the Rockchip RK3588. Upstream support for the CPU has improved quite a bit during the course of 2024, making it a solid choice for ARM PoCs and other projects. Read on to discover how to run NixOS on the board.

NixOS on ARM:  Rock 5 B

While it is possible to boot NixOS on the board as-is, we found that the most reliable way to run NixOS is to flash the firmware and get to a board with UEFI support. This sounds a lot scarier than it actually is, all that is needed is a few commands in the terminal and the following hardware:

  • A laptop with Linux (preferably NixOS 😉) and a USB port
  • Your Rock 5B board with a suitable power supply
  • A USB-C cable to connect the Rock 5B board and the laptop

Once the board has UEFI support, running NixOS on it is a straight-forward affair. The unstable NixOS image can be used to install the system on the board without further tinkering. Let’s dive right in!

Flashing the firmware

We will follow the advanced method from the vendor’s Wiki. We found this method to be simpler and more reliable than the “simple method”. First we need to download a few firmware images and tools. On NixOS you can just type in these commands:

$ wget https://dl.radxa.com/rock5/sw/images/loader/rk3588_spl_loader_v1.15.113.bin
$ wget https://github.com/edk2-porting/edk2-rk3588/releases/download/v0.12.2/rock-5b_UEFI_Release_v0.12.2.img
# On a flake based system:
$ nix shell nixpkgs#rkdeveloptool
# OR without flakes:
$ nix-shell -p rkdeveloptool

You now have the SPL loader, the UEFI image and the rkdeveloptool available. For different boards or newer releases of the UEFI image check the EDK2 repo on GitHub and pick the correct download from there.

Next you need to boot your Rock 5 into maskrom mode. Make sure it is powered off and no external media (SD card etc.) is attached. Find the small button labeled “maskrom” on the lower left edge of the board. It is usually gold or silver.

Press and hold the button and attach the USB cable to your board and your laptop. If you’re on the Rock 5 ITX you need to also attach the power supply to the board. You can now list attached devices with $ sudo rkdeveloptool ld on your laptop. Running that command should output a line ending in Maskrom.

You can now flash the firmware on the device. The first two commands upload the images we downloaded in the previous step, while the last command resets the device.

$ sudo rkdeveloptool db ./rk3588_spl_loader_v1.15.113.bin
$ sudo rkdeveloptool wl 0 ./rock-5b_UEFI_Release_v0.12.2.img
$ sudo rkdeveloptool rd

Once the device reboots you should see a graphical boot screen. Press ESC to enter the boot options screen.

Installing NixOS on the device

In order to install NixOS, get the latest aarch64 unstable build from Hydra and unpack the image. Write it to a thumbdrive.

# Latest NixOS unstable image at the time of writing
wget https://hydra.nixos.org/build/287253386/download/1/nixos-image-sd-card-25.05beta745286.9d3ae807ebd2-aarch64-linux.img.zst
unzstd nixos-image-sd-card-25.05beta745286.9d3ae807ebd2-aarch64-linux.img.zst
dd if=./nixos-image-sd-card-25.05beta745286.9d3ae807ebd2-aarch64-linux.img of=/path/to/thumbdrive bs=4M status=progress oflag=sync

Insert the thumbdrive into your Rock 5 and power it on. Press ESC to enter the graphical setup and navigate to Boot Manager. Select your thumbrive and boot from it.

You can now install NixOS as outlined in the manual. Make sure to select the latest (6.13) kernel in your configuration:

{
  boot.kernelPackages = pkgs.linuxPackages_latest;
}

You should also enable these options to boot from UEFI:

{
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
}

Once the installation is done, use the UEFI firmware setup menu to configure the board to always boot from your SD card (or whatever you chose to install your system on).

That’s it! Have fun! 🎉

Share: