2.0 KiB
2.0 KiB
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