NixOS on ARM/NanoPi-R6C
NanoPi-R6C | ||
---|---|---|
Manufacturer | FriendlyElec | |
Architecture | AArch64 | |
Bootloader | EDK2 UEFI firmware for Rockchip RK3588 platforms or | Original FriendlyARM U-Boot |
Boot order | official: eMMC, SD Card | |
Maintainer | jakubgs |
Hardware
NanoPi-R6C is a single board computer built around the Rockchip RK3588S SoC.
- CPU: ARM Cortex-A76 and Cortex-A55
- GPU: Mali-G610 MP4
- RAM: 4GB/8GB LPDDR4X at 2133MHz
- MMC: None or 32GB eMMC
- NET: Native Gigabit Ethernet, PCIe 2.5G Ethernet
- USB: 1x USB 3.0 Type-A, 1x USB 2.0 Type-A
- PCIe: 1x M.2 Key M connector with PCIe 2.1 x1
Status
The board boots systems like Armbian from USB pendrive or microSD reader out of the box. But stock NixOS arch64 images do not boot correctly due to lack of correct DTS file called rockchip-nanopi6.dtb. You can see details of research into the boot process here.
The official documentation, which is comprehensive, can be found on the FriendlyElec wiki.
U-Boot for this board can be compiled from source, and an example of how that can be done with Nix is here. But the best way to manage booting on this device is using the EDK2 UEFI firmware which supports booting from all available storage options, including NVMe, and works well both with standard NixOS ISO images as well as Armbian ones.
Board Specific Installation Notes
UEFI Firmware
Boot into a working Linux system, like Armbian using USB pendrive or SD Card, then simply write the UEFI image to the eMMC:
wget https://github.com/edk2-porting/edk2-rk3588/releases/download/v0.9.1/nanopi-r6c_UEFI_Release_v0.9.1.img
sudo dd if=nanopi-r6c_UEFI_Release_v0.9.1.img of=/dev/mmcblk2 bs=1M
Once that has been done the UEFI firmware should be visible via UART console or over HDMI after reboot:
In Boot Manager You can select what device to boot from this time and in Boot Maintenance Manager You can configure permanent boot order.
Booting NixOS
Since EDK2 UEFI firmware does not support extlinux an ISO aarch64 image needs to be used to successfully boot NixOS.
Currently NixOS 23.11 images can see the NVMe without issues, but eMMC storage is unavailable.
Installing NixOS
A very basic partition layout could look like this:
format() {
DEV="${1}" # First argument is NVMe path.
wipefs -a "${DEV}"
parted -s --align optimal "${DEV}" -- mklabel gpt;
parted -s --align optimal "${DEV}" -- mkpart 'EFI' 2MB 6GiB set 1 esp on;
parted -s --align optimal "${DEV}" -- mkpart 'SWAP' 6GiB 16GiB;
parted -s --align optimal "${DEV}" -- mkpart 'ROOT' 16GiB '100%';
parted -s --align optimal "${DEV}" -- print;
mkswap "${DEV}p2";
mkfs.vfat "${DEV}p1";
mkfs.ext4 "${DEV}p2";
}
Just call it it with format /dev/nvme0n1 and then mount your partitions:
swapon /dev/nvme0n1p2
mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p1 /mnt/boot
And you can continue with the installation as you normally would. A working bootloader configuration looks like this:
boot.loader = {
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
grub.enable = false;
};