1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-12-18 15:49:45 +01:00
nixos-hardware/friendlyarm/nanopc-t4/README.md
Jakub Sokołowski ff1b798346
friendlyarm/nanopc-t4: init
As suggested by @Mic92 in https://github.com/NixOS/nixpkgs/pull/111034
I'm submitting my fixes for the FriendlyARM NanoPC-T4 device.

I'm not sure if forcing a specific kernel version is kosher, but on the
other hand I don't know if my kernel config changes will work on any
other version. I'm open to suggestions as to how to do this better.

Also unusure if I should call the folder `friendlyarm` or `friendlyelec`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2021-05-29 09:59:44 +02:00

3.3 KiB

Description

This document on how I configure NixOS on NanoPC-T4.

Installation

To install NixOS on you can follow the official instructions and use the pre-built images from @tmountain. You can also build the U-Boot image yourself from nixpkgs based on changes added in #111034.

NixOS on NVMe with ZFS

It is possible to migrate the OS from the eMMC storage to the NVMe.

In my case I migrated /, /nix, and /home, leaving /boot on the eMMC.

Create the ZFS pool and three filesystems on the SSD:

zpool create -O xattr=sa -O acltype=posixacl -O mountpoint=none rpool /dev/nvme0n1
for VOL in nix root home; do
    zfs create -o mountpoint=legacy rpool/$VOL
    mkdir /mnt/$VOL
    mount.zfs rpool/$VOL /mnt/$VOL
done

Then sync the original filesystem on eMMC to the new volumes:

rsync -rax /. /mnt/root
rsync -rax /nix/. /mnt/nix
rsync -rax /home/. /mnt/home
rsync -rax /boot/. /

Afterwards create a configuration that looks like this:

{
  # TODO: Make sure to update the eMMC device UUID!
  fileSystems."/boot" = { device = "/dev/disk/by-uuid/1234-5678"; fsType = "ext4"; };
  fileSystems."/" = { device = "rpool/root"; fsType = "zfs"; };
  fileSystems."/nix" = { device = "rpool/nix"; fsType = "zfs"; };
  fileSystems."/home" = { device = "rpool/home"; fsType = "zfs"; };
}

And rebuild he system:

sudo nixos-rebuild boot

⚠️ IMPORTANT: After that it's necessary to run all the four rsync commands again to sync filesystems.

Once everything is synced you can finally reboot.

You should also clean up /boot afterwards.

UART Debug Console

Device provides a Debug UART 4 Pin 2.54mm header connection, 3V level, 1500000bps.

To connect to you will need a USB to UART converter/receiver that supports the speed of 1500000bps.

The serial port parameters are 8-N-1.

A reader using CP2102 chip did not work but FT232RL works fine:

UART converter photo

You can use minicom or picocom to connect:

sudo minicom -b 1500000 -D /dev/ttyUSB0 
sudo picocom -b 1500000 /dev/ttyUSB0

But you'll need to disable flow control with Ctrl-A x.

Here is a good overview of UART USB-to-Serial adapters:

Pin layout where #4 is next to USB-C port:

Pin num. #1 #2 #3 #4
Purpose GND V5 TX RX

Remember that the TX and RX ports should be swapped between UART adapter and the board.

The V5 pin does not need to be connected if you're powering the board from another source.

See the full board diagram for more details:

Board diagram

You can access the recovery console by holding the Recovery button and then pressing the Power button. For this to work the device will have to be off, which requires holding the Power button long enough.