NAME
gyptazy.ch

OPTIONS

CONTENT
Switching from ARM64 to the open-source RISC-V hardware architecture (2024-01-21):
Making the transition from established architectures like ARM64 (AARCH64) and AMD64 (x86_64) to the RISC-V (risc64) open-source hardware architecture offers several compelling advantages. The shift brings about a paradigm change that goes beyond the traditional boundaries of proprietary systems. After ditching the AMD64 architecture completely, it got time to give RISC-V a try.

One notable benefit is reduced dependency on specific vendors. Unlike ARM64 and x86_64, which are dominated by a few major players, RISC-V's open-source nature allows for a more diverse supply chain. This diversification mitigates the risks associated with vendor lock-in and dependency, fostering healthy competition and providing users with greater freedom to choose components that best suit their needs.

Security considerations also play a role in the decision to switch. The transparent nature of RISC-V enables thorough code reviews and audits, enhancing the identification and mitigation of potential security vulnerabilities. This contrasts with closed architectures where users may have limited visibility into the inner workings, making it harder to ensure robust security measures.

As industries increasingly seek open and collaborative solutions, RISC-V's open-source philosophy positions it as an appealing alternative to traditional closed architectures. So, why not run open-source software on also open-source hardware? I will give it a try.

Finding Hardware and Shop
Finding a proper hardware solution is not that easy as it sounds. The first steps and tests in a possible transition to the open-source RISC-V hardware platform should not end up in a money grave. As a result, a smaller test platform for general tests is required. Most manufacturer of such devices are present in Asia which takes more time for shipping, more pre-research for the required and desired board(s) and a shop that at least sends the devices to Europe. The next big thing is that we need to ensure that those boards can run FreeBSD or at least a generic Linux distribution. Many ones already offer a prebuild Debian GNU/Linux image to run on these devices. However, this would result in trusting these images and the primary goal is to run a BSD based system like FreeBSD [1] or OpenBSD. My first two attempts in finding a proper devices ended up badly - they never arrived. A few month later I tried again and looped for newer boards and also for German stores having such things in stock. After the latest recommendations in the Fediverse, I ended up in ordering the VisionFive 2 board from StarFive Tech, a chinese company. What makes this board a little bit special is that it comes directly with 2x ethernet ports (only one is capable of Gbit, the inner one is limited to 100Mbit) which makes it also a good choice for a home router. Luckily, I also found a this board in the 8GB RAM configuration in a german shop at RasppiShop.de. They also offer different flavours like the smaller 4GB version including the Wifi module.

Pictures
As some people always ask for example pictures - here you can find some pictures of the Starfive VisionFive2 board:
RISC-V (risc64) board StarFive VisionFive2 RISC-V (risc64) board StarFive VisionFive2
RISC-V (risc64) board StarFive VisionFive2 RISC-V (risc64) board StarFive VisionFive2 running Debian Linux


Operating Systems
What is such a device worth without an operating system? Therefore, this becomes very important and it is great to see that there is not just a device thrown into the market but also getting supported. However, in some way at least. When it comes to the VisionFive 2 board you may find many information and even prebuild images to run Debian GNU/Linux [6] on it. The latest prebuild image is from 2023-11 based on Debian Snapshot 20221225T08486Z (sid) with kernel 5.15. You should keep in mind that upgrading this system will break overwrite the drivers and break the system. However, I do not want to deal with Linux. Therefore, my primary efforts result in getting FreeBSD running on this device but I also want to share the Debian related content:

Debian:
* Debian Wiki: InstallingDebianOn/StarFive/VisionFiveV2
* GitHub: vf2-debian-image (maintained by yuzibo)
* GitHub: Visionfive2 Debian Image Builder (maintained by thomasdstewart) * User Guide: VisionFive2_Debian_User_Guide
* Release: VisionFive2_Debian_Wiki_202302_Release
* Image: Debian_11_202311_vf2_risc64_starfive.img.bz2 (Mirror: Debian_11_202311_vf2_risc64_starfive.img.bz2)
* Checksums:
    33b95a1b4366f3454b40c3dcf40b012127b735acbfc3d82707ce2d4df9ece5e8
    starfive-jh7110-202311-SD-minimal-desktop.img.bz2     2ecdb8522ffd95c6a7c663dd7682a84fe0871e86d12f075bb272194017d3a875
    starfive-jh7110-202311-nvme-minimal-desktop.img.bz2     83234f44b6e4bef4f5677c43dd39b28f55d21771c534ce40b06a22215d81642b
    starfive-jh7110-202311-eMMC-minimal-desktop.img.bz2

FreeBSD:
* FreeBSD Mailinglist: freebsd-riscv
* FreeBSD Forums: FBSD on VisionFive2 board with RISC-V
* GitHub Gist: HowTo install FreeBSD and OpenBSD on SD
* GitHub: freebsd-vf2 (maintained by KyL0N)
* RVSpace: FreeBSD support on the VisionFive 2
* Tom Jones's insights: Booting FreeBSD on the RISC-V VisionFive2
* Image: FreeBSD_14.0_vf2_risc64_gyptazy.img
* Checksum:
    a86cae0369f76a0265842872a531d32150a03420927cd4b83bd9f0f0317f6cc8
    FreeBSD_14.0_vf2_risc64_gyptazy.img

If you are new to RISC-V, the easiest way might result by using the ready-to-use images from Starfive for Debian or my FreeBSD 14.0 image. Keep in mind, that you can and should create you own image for security concerns. When it comes to FreeBSD, it might become more difficult and take some more time and efforts. At least, it is up to you. Don't forget to switch the boot mode after flashing your image. If you are booting into your NVME, you will need to set your boot mode as QSPI boot. If you are booting with SD card, you will need to set your boot mode as SDIO boot. If you are booting with eMMC, you will need to set your boot mode as eMMC boot. I'm already working on providing you additional operating systems that you can directly flash on your system.

System:
After flashing the desired system we can power up the system and take some more looks at the system itself.

FreeBSD:
FreeBSD generic 14.0-STABLE FreeBSD 14.0-STABLE #0 stable/14-n266002-2ef9079ece5a:
Sat Dec 16 05:16:50 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/riscv.
riscv64/sys/GENERIC riscv
Found 4 CPUs in the device tree
CPU 0 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 1)
Starting CPU 1 (hart 2)
Starting CPU 2 (hart 3)
Starting CPU 3 (hart 4)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
CPU 0 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 1)
CPU 1 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 2)
CPU 2 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 3)
CPU 3 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 4)
MEM : tot 8.0G

Debian:
processor : 0
hart : 1
isa : rv64imafdc
mmu : sv39
uarch : sifive,u74-mc
processor : 1
hart : 2
isa : rv64imafdc
mmu : sv39
uarch : sifive,u74-mc
processor : 2
hart : 3
isa : rv64imafdc
mmu : sv39
uarch : sifive,u74-mc
processor : 3
hart : 4
isa : rv64imafdc
mmu : sv39
uarch : sifive,u74-mc


Next Steps:
My upcoming tasks involve meticulously crafting and assembling a set of risc64 images tailored specifically for this device. These images will seamlessly integrate, allowing for a straightforward flash and utilization process—akin to the streamlined experience of my Vagrant Box images for Apple Silicon on ARM64 architecture.

Furthermore, I am dedicating considerable time and effort towards compiling and packaging binaries for software crucial to my workflow. These applications, often absent from standard FreeBSD or Debian repositories, will be curated to ensure optimal compatibility and performance on the RISC-V platform.

Subsequently, my focus will shift towards the migration of both my authoritative name-server and ntp-server to the RISC-V architecture, anchored in the FreeBSD framework. This transition marks a deliberate step towards leveraging the capabilities of this platform for enhanced functionality and efficiency.