NixOS on ARM/PINE64 ROCK64: Difference between revisions

From NixOS Wiki
imported>Mic92
No edit summary
imported>Mic92
No edit summary
Line 45: Line 45:
== Board-specific installation notes ==
== Board-specific installation notes ==


U-Boot needs to be copied to specific sectors on the microSD card, eMMC or image with <code>dd</code>. Download/build U-Boot for the board, and write <code>idbloader.img</code> and <code>u-boot.itb</code>.
U-Boot needs to be copied to specific sectors on the microSD card, eMMC or image with <code>dd</code>.  
 
You can use [nixos-aarch64-images https://github.com/Mic92/nixos-aarch64-images] to get an rock64 compatible disk image
or running the commands manually.
 
Download/build U-Boot for the board, and write <code>idbloader.img</code> and <code>u-boot.itb</code>.
Replace in the command below <code>/dev/mmcblkX</code> with the correct device to the sdcard i.e.  <code>/dev/mmcblk0</code>. You can use the <code>lsblk</code> command to get a list of all devices:
Replace in the command below <code>/dev/mmcblkX</code> with the correct device to the sdcard i.e.  <code>/dev/mmcblk0</code>. You can use the <code>lsblk</code> command to get a list of all devices:


Line 54: Line 59:


This will make the first partition of the installation device unmountable and it can be deleted, but the space needs to be kept to not overwrite the bootloader with another filesystem.
This will make the first partition of the installation device unmountable and it can be deleted, but the space needs to be kept to not overwrite the bootloader with another filesystem.


{{note|Prior to NixOS 20.03, a downstream version of U-Boot 2017.09 was packaged, which placed U-Boot in a single <code>idbloader.img</code> file. If that version is used, simply disregard the second command above.}}
{{note|Prior to NixOS 20.03, a downstream version of U-Boot 2017.09 was packaged, which placed U-Boot in a single <code>idbloader.img</code> file. If that version is used, simply disregard the second command above.}}

Revision as of 16:29, 6 September 2020

PINE64 ROCK64
A PINE64 Rock64.
Manufacturer PINE64 (Pine Microsystems Inc.)
Architecture AArch64
Bootloader Upstream U-Boot
Boot options microSD, eMMC, SPI NOR Flash

The ROCK64 is a single board computer built around the Rockchip RK3328 SoC.

There are three models of the board, with 1, 2 or 4 GB of RAM. It can boot from an microSD card or an eMMC. It also has a 128 Mbit SPI flash that can be used to store the bootloader.

Status

This board has upstream U-Boot and kernel support, although the mainline kernel may still be missing some features. NixOS can be installed using manual partitioning and nixos-install or by modifying the aarch64 installation image as described in the next section.

U-Boot for this board is packaged in nixpkgs, and Hydra builds can be found here:

https://hydra.nixos.org/job/nixpkgs/trunk/ubootRock64.aarch64-linux

This bootloader is not entirely open, incorporating a binary blob for the tertiary program loader (TPL). If your have nix installed you can download the latest version with (This command also works on different architectures since it can be downloaded from the binary cache):

$ nix-build '<nixpkgs>' -A ubootRock64 --argstr system aarch64-linux
$ ls -la result
.r--r--r-- 107k root  1 Jan  1970  idbloader.img
.r--r--r-- 765k root  1 Jan  1970  u-boot.itb

Board-specific installation notes

U-Boot needs to be copied to specific sectors on the microSD card, eMMC or image with dd.

You can use [nixos-aarch64-images https://github.com/Mic92/nixos-aarch64-images] to get an rock64 compatible disk image or running the commands manually.

Download/build U-Boot for the board, and write idbloader.img and u-boot.itb. Replace in the command below /dev/mmcblkX with the correct device to the sdcard i.e. /dev/mmcblk0. You can use the lsblk command to get a list of all devices:

dd if=idbloader.img of=/dev/mmcblkX conv=fsync,notrunc bs=512 seek=64
dd if=u-boot.itb of=/dev/mmcblkX conv=fsync,notrunc bs=512 seek=16384

This will make the first partition of the installation device unmountable and it can be deleted, but the space needs to be kept to not overwrite the bootloader with another filesystem.


Note: Prior to NixOS 20.03, a downstream version of U-Boot 2017.09 was packaged, which placed U-Boot in a single idbloader.img file. If that version is used, simply disregard the second command above.

Serial console

The ROCK64 uses a GPIO pinout compatible with the Raspberry Pi 2 and newer. This means that the following pins can be used to connect a serial adapter:

Pi-2 Bus
Pin Function
6 GND
8 UART0_TX
10 UART0_RX

The serial console runs at 1500000 baud in the bootloader. When using the standard NixOS aarch64 sd image, set console=ttyS2,115200n8 as kernel option in extlinux/extlinux.conf on the boot partition of the sdimage to get a serial linux console. For debugging, console=uart8250,mmio32,0xff130000 should give you an early UART console, before the full serial console is up.

Compatibility notes

Mainline kernel ayufan-rock64/linux-mainline-kernel
Ethernet Works Works
USB As of 5.4, USB 3.0 does not work Works
HDMI Works Works

Downstream kernel

To use all hardware functionality, it is currently necessary to use a downstream kernel:

Note: The old vendor U-Boot 2017.09 did not leave enough room between the kernel and initrd, causing recent kernels to overwrite the beginning of the initrd. This can be fixed by increasing ramdisk_addr_r in the U-Boot console, or using upstream U-Boot.

Resources