Pine64 PinePhone
Manufacturer

Pine64

Name

PinePhone

Identifier

pine64-pinephone

System Type

u-boot

SoC

allwinner-a64

Architecture

aarch64-linux

Supports Stage-0

yes

Source

Mobile NixOS repository

Builds

Device-specific notes

Platform Firmware

It is recommended to install Tow-Boot to dedicated storage (mmcboot).

Mainline U-Boot should work, but Mobile NixOS is tested with Tow-Boot.

Installer

The installer can be downloaded and flashed to an SD card.

 $ dd if=mobile-nixos_pine64-pinephone_installer.img of=/dev/mmcblkX bs=8M oflag=sync,direct status=progress

When using Tow-Boot, hold volume down during boot to boot from the SD card.

Follow the on-screen instructions to configure a basic system.

Usage notes

LED

In the default setup, the LED has been configured to show status information. Its colour or pattern can be used to infer the status.

During boot:

  • Green when the kernel initializes the LED driver

At any time after Linux booted:

  • The red LED will flash on panic

As it does not reset the other LED colours, it may flash green/yellow rather than off/red. If applications customize the LED status, it may flash in other patterns involving red.


Updating the boot image

The default suggested setup does not currently require updating the boot partition.

Building the boot image

If this is required, the boot partition image can be built with the following command:

 $ nix-build <nixpkgs/nixos> --attr config.mobile.outputs.u-boot.boot-partition

Note that building locally on the device may be undesirable. In such cases, you can instantiate the the derivation and build it on another system.

 $ nix-instantiate <nixpkgs/nixos> --attr config.mobile.outputs.u-boot.boot-partition
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-partition-mobile-nixos-boot.drv
 $ nix-copy-closure --to some-other-host /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-partition-mobile-nixos-boot.drv

On the other host:

 $ nix-build /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-partition-mobile-nixos-boot.drv

If you don’t have an aarch64-linux system to build the derivation, you should be able to instantiate a cross-compilable boot image this way:

 $ nix-instantiate --system x86_64-linux <nixpkgs/nixos> --attr config.mobile.outputs.u-boot.boot-partition
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-partition-mobile-nixos-boot.drv

The build infra for Mobile NixOS will activate cross-compiling for the derivation. It can be copied to a standard x86_64-linux host and built there.

Flashing the boot image

The resulting image can be flashed (dd) to the appropriate partition. With the partition layout as made by the guided installer, this will be the fourth partition on the main storage.

Development notes

Note

The following sections only apply for development.

Building a full disk image

This platform uses the u-boot system-type. This means that a full disk image can be produced, and this full disk image flashed outright to the block device. That block device can be the internal eMMC or the SD card.

The PinePhone will boot from SD card if a bootloader can be found. This means that the full disk image can be flashed to an SD card, and it will prioritise booting it.

 $ nix-build --argstr device pine64-pinephone -A outputs.disk-image
 $ dd if=result of=/dev/mmcblkX bs=8M oflag=sync,direct status=progress

Building the boot partition

Building the full disk image may require a native AArch64 system.

The boot partition can be built, and then flashed on top of an existing Mobile NixOS boot partition.

 $ nix-build --argstr device pine64-pinephone -A build.boot-partition
 $ dd if=result/mobile-nixos-boot.img of=/dev/mmcblkXpY bs=8M oflag=sync,direct status=progress

Building U-Boot

Mobile NixOS is not managing platform firmware builds anymore.

We recommend installing Tow-Boot to dedicated storage (mmcboot).