NixOS on ARM/Orange Pi One

From NixOS Wiki
Orange Pi One
Orange Pi One.
Manufacturer Xunlong / Orange Pi
Architecture ARMv7
Bootloader Upstream u-boot
Maintainer makefu
URL Sunxi Wiki

The Orange Pi One is an Xunlong SoC based on the Allwinner H3. As the board is on the market for quite some time and the device is relatively cheap, the community effort resulted in a better than average mainline support with the current kernel (5.0). Refer to the H3 column in the SunXI Mainline Status Matrix.

Status

@dezgeg's porting efforts to ARMv7 works on the Orange Pi One, using the proper upstream u-boot.

Even though the upstream uboot does support the Orange Pi One, it is not part of nixpkgs. However with the new cross-compiler toolchain added with nixpkgs-18.09 it is straight forward to build the bootloader yourself.

Board-specific installation notes

First follow the generic installation steps to get the installer image on an SD card.

U-Boot needs to be copied to specific sectors on the microSD card with dd. At first, build the u-boot for the device, then copy it to the correct location with (again, replace /dev/sdX with the correct path to the SD card device):

nix-build -E 'let plat = ((import <nixpkgs> ){}).pkgsCross.armv7l-hf-multiplatform; in plat.buildUBoot{defconfig = "orangepi_one_defconfig"; extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-sunxi-with-spl.bin"];}'
sudo dd if=result/uboot-orangepi_pc_defconfig-2017.11.nixpkgs.*.u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8

Then, install using the installation and configuration steps.

Serial console

Your configuration.nix will need to add console=ttyS0,115200n8 to the boot.kernelParams configuration to use the serial console.

/etc/nixos/configuration.nix
{ config, pkgs, lib, ... }:
{
  boot.kernelParams = [
    "console=ttyS0,115200n8"
  ];
}

Compatibility notes

  • Ethernet works with 4.19 kernel
  • HDMI should work since kernel 4.17 (untested)

Resources