NixOS on ARM/Radxa ROCK 4

Revision as of 21:48, 9 December 2024 by Msgilligan (talk | contribs) (Official hardware documentation is on Radxa Documentation site (not wiki))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Radxa ROCK 4B+ is a Single-Board Computer with a Rockchip RK3399 SoC.

  • CPU: ARM Cortex-A72 and Cortex-A53
  • GPU: Mali-T860 MP4
  • RAM: 2GB/4GB LPDDR4
  • MMC: eMMC Connector for up to 128GB
  • NET: 1 Gigabit Ethernet
  • USB: 1x USB3 OTG/HOST Type-A, 1x USB 3 Type-A, 2x USB 2 Type-A
  • PCIe: M.2 M Key M connector (4-lane PCIe 2.1) supports NVMe SSD
Radxa ROCK 4
Radxa Rock 4
Manufacturer Radxa
Architecture AArch64
Bootloader U-Boot
Boot order SPI NOR Flash, eMMC, SD
Maintainer msgilligan

The nixos-rockchip SD-card images have been tested with both the ROCK 4B+ and ROCK 4 SE variants.

Status

Support of this system is YMMV (your mileage may vary).

U-Boot bootloaders are available in different variants:

  • U-Boot
    • Mainline - Supports ?? boot options
    • Nixpkgs - tested by @ryjelsum, seemingly working but not thoroughly used

The official hardware documentation can be found on the Radxa Documentation site.

Bootloader Firmware

U-Boot Firmware

  • nixos-rockchip uses the mainline U-Boot repository.
  • As an alternative for using nixos-rockchip, There is also support for ROCK 4 U-Boot in Nixpkgs.

This build of u-boot is built using the defconfig from u-boot's repositories, so it should be equivalent to 'stock' u-boot, but be aware there may be unknown differences, as it has not been thoroughly tested. The following command will build the u-boot bootloader with Nix on a non-aarch64 system, and output its path as a 'result' symlink in the current directory:

nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootRockPi4

This will build u-boot as two separate files, idbloader.img and u-boot.itb. To flash the bootloader, follow the directions provided in u-boot's repos for how to transfer these files to storage (SD card or EMMC) for usage.

sudo dd if=idbloader.img of=/dev/sdc seek=64; sudo dd if=u-boot.itb of=/dev/sdc seek=16384

After this, take special care to leave the first ~16mb of the target disk unpartitioned during installation, as this will contain u-boot and overwriting this region will overwrite the bootloader.

The stock UEFI ISO boots fine for installation purposes. If you wish to flash directly to SD/EMMC, the extlinux 'sdimage' may require a minor u-boot env change (env set ramdisk_addr_r 0x06800000, env save) in order to boot, but should work after this change has been made.

(TODO: SPI flash installation directions, for boards where this is present. This requires changes in Nixpkgs, so that the build command presented here will output the file "u-boot-rockchip-spi.bin".)

System configuration

The following directions are for usage with nixos-rockchip.

Use the instructions in the README.

Use the following command to build the Rock 4B image:

nix build .#RadxaRock4

or for the Rock 4SE:

nix build .#RadxaRock4SE


nabam/nixos-rockchip GitHub Project

nabam/nixos-rockchip is a Nix flake for building several Rockchip SBC images, including Rock 4B and Rock 4SE.