⁽⁽◝( • ω • )◜⁾⁾
Go to file
Peder Bergebakken Sundt 662eb9565c flake.lock: Update
Flake lock file updates:

• Updated input 'nixos-hardware':
    'github:nixos/nixos-hardware/429f232fe1dc398c5afea19a51aad6931ee0fb89' (2023-06-15)
  → 'github:nixos/nixos-hardware/6e5cc385fc8cf5ca6495d70243074ccdea9f64c7' (2024-02-06)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f' (2023-06-23)
  → 'github:NixOS/nixpkgs/f8e2ebd66d097614d51a56a755450d4ae1632df1' (2024-02-07)
2024-02-10 23:52:39 +01:00
README.md stuff 2023-07-07 01:47:40 +02:00
efi-image.nix better nvme 2023-06-25 05:43:17 +02:00
flake.lock flake.lock: Update 2024-02-10 23:52:39 +01:00
flake.nix stuff 2023-07-07 01:47:40 +02:00
notes.md stuff 2023-07-07 01:47:40 +02:00
qemu-vm.nix stuff 2023-07-07 01:47:40 +02:00

README.md

Personal NixOS RISC-V 64 flake

Goals:

  • I want to flash NixOS on to the M.2 NVMe SSD of a VisionFive2
  • I want a flake with a neat cross story / UX

Nix?

How?

The VisionFive2 shipped with a stinky firmware, which does not support booting from the SSD. This capability was later added in starfive uboot v3.0.4. As such we have to flash an SD card, use it to flash new firmware to the VisionFive2 SPI flash, then finally boot from the NVMe, all the while fiddling with DIP switches.

Building an image

Pick a host, then pick your poison:

Hostname Description
demo-r12a Board rev 1.2A
demo-r12a-8g Board rev 1.2A, 8GB
demo-r13b Board rev 1.3B
demo-r13b-8g Board rev 1.3B, 8GB
asgaut Asgaut
gunder Gunder
nix build .#asgaut-qemu # emulation go brr
nix build .#asgaut-nvme-image
nix build .#asgaut-sd-image
nix build .#asgaut-sd-installer

Building without cross compilation

Either use a riscv64-linux host, or run the following command with riscv64-linux binfmt emulation configured:

nix build .#packages.riscv64-linux.demo-nvme-image

Flashing an image

nix build .#something
lsblk # locate your SD card
umount /run/media/pbsds/9C33-6BBD # example mounts
sudo dd if=result/sd-image/*.img of=/dev/sdX bs=4M conf=fsync status=progress
sync

Booting

Here are some sweet dip pics.

After flashing the firmware you can boot using quad SPI. Use SDIO3.0 to boot using the u-boot SPL and FIT firmware on the sd card.

Updating SPI firmware

sudo update-firmware