Installing NixOS on Rock64: 2024 experience

Wanted to document how it was to follow the documentation etc. as a laywoman.

  • The wiki page[1] has a scary warning about memory corruption. But if you follow the issue link[2], the last comment says that PR #191538 superseded it, and from what I can gather it fixed the issue in November 2023[3].

  • The wiki says you can get U-Boot from Hydra, and also provides a command to download the files (nix-build '<nixpkgs>' -A ubootRock64 --argstr system aarch64-linux). It then gives manual commands to dd 2 of the files (idbloader.img and u-boot.itb), but I didn’t know what to do with the 3rd file (u-boot-rockchip.bin). I also couldn’t figure out how would I put a root filesystem in it.

  • The wiki also says you can get a compatible image for an SD card with nixos-aarch64-images[4]. But the linked github repo was last updated 6 months ago. Would it get the fixed version of the binary blobs?

  • Unsure what to do, I cloned the nixos-aarch64-images repository and ran the commands in the documentation, which gave me an image to dd.

  • This created 3 partitions, the last being the mountable root fs. (It was only 2.7GiB, with 2.4GiB used, so I figured I’d have to enlarge it later; but once you boot at NixOS it enlarges itself, neat.)

  • At first I thought the image failed to boot, but this turned out to be due to a faulty HDMI cable / monitor or some incompatibility. With a different cable+monitor combo I could get a console.

  • Which promptly crashed with a kernel stack trace, starting on drm_atomic_helper_wait_for_vblanks (vblank_wait timed out).

  • I figured if I followed the wiki instructions to dd the idbloader.img and u-boot.itb , maybe it would update the binary thingies in the magic two first partitions while still keeping the root fs functional? I have no idea what I’m doing.

  • I done that anyway. the resulting system booted, and didn’t crash.

  • I realised I have no idea how to boot into memtest86 on NixOS on U-Boot, so I pulled memtester to try in userspace at least. 777 loops and no errors.

  • I tried stress(1) too to force some load on the CPUs, no crash either.

It’s still too early to be sure it’s not a coincidence, but in summary, what appears to have worked for me is:

  1. git-clone, build, and dd the nixos-aarch64-images then
  2. on top of the same SD card, dd the updated idbloader.img and u-boot.itb from hydra, with the offsets described in the wiki.

Beginner questions I’m left with are:

  • Where’s configuration.nix / hardware.nix ? (you have to run nixos-generate-config; maybe it would make sense if this ran automatically?)
  • What’s up with u-boot-rockchip.bin ? Am I supposed to dd it too, and if so where?
  • Is it even the case that the image built via nixos-aarch64-images is getting older blobs, or did I just get lucky?
  • how is memtest86+ formed? how girl gets U-boot options?
  1. NixOS on ARM/PINE64 ROCK64 - NixOS Wiki
  2. use unmodified (blob-free) U-Boot for the Rock64 board by royneary · Pull Request #145506 · NixOS/nixpkgs · GitHub
  3. u-boot: ROCK64 RAM init improvements by lorenz · Pull Request #191538 · NixOS/nixpkgs · GitHub
  4. GitHub - Mic92/nixos-aarch64-images: Build NixOS images for various ARM single computer boards
2 Likes

Thanks for pointing out the wiki page; I updated the note about the memory corruption. Note that this issue only applies to the older v2 revision boards.

u-boot-rockchip.bin was added in a recent U-Boot version, and combines idbloader.img and u-boot.itb at the proper offsets. I haven’t tried it, but the U-Boot documentation describes how it is supposed to be flashed: ROCKCHIP — Das U-Boot unknown version documentation

I don’t know much about nixos-aarch64-images, but it looks like it is not maintained and probably shouldn’t be recommended so prominently in the wiki. I would recommend that you flash the standard aarch64 SD card image, delete the Raspberry Pi specific firmware partition and then flash U-Boot as you already did. Unfortunately, I can’t give you more detailed instructions at the moment. On the other hand, since you seem to have a functioning installation now, it is probably easiest to just update it to the latest version like any other NixOS system.