VisionFive2 board-some progress

Earlier this year I had no success with FreeBSD on this board.

I noticed that Armbian, OpenBSD, and Ubuntu have no problem running.
I noticed that the u-boot firmware seems to have a lot to do with a successful boot.

It seems that the key to success is to follow the instructions to create the u-boot images.
u-boot documentation

Sometimes those images fail. My last successful build was 11 Sep 2024.
That is currently what I am using on the board spi memory.

The latest FreeBSD 15 CURRENT-riscv-riscv64-GENERICSD snapshot boots just fine (31 Oct 2024):
FreeBSD snapshot

To boot that image add the dtb file to efi partition.
add it to the efi partition here--> starfive/jh7110-starfive-visionfive-2-v1.3b.dtb

The u-boot firmware looks for that directory and filename when attempting to boot.

Ignore the two u-boot partitions on the image and only use the spi to boot.
Also the current u-boot port will not boot--> sysutils/u-boot-starfive-visionfive2

The board boots OK (from sdcard) into FreeBSD 15. There is no video, no network, no usb, no nvme.
 
add it to the efi partition here--> starfive/jh7110-starfive-visionfive-2-v1.3b.dtb
Sure this works as does in root of msdos filesystem but the proper path on the EFI drive is:
/dtb/${VENDOR}/${DTB}
As you can see on FreeBSD Arm Images.

You can see in u-boot with printenv but it does omit the /dtb part of the path.
fdtfile=/rockchip/rock-pi-4.dtb

I hesitated even posting this it is so minor a detail.

I am writing a script to setup u-boot with poudriere image post install so this stuff is fresh in the mind.
 
I find what I said incorrect.
For the dtb files on ESP they will be found if in root dir, /dtb directory or /dtb/vendor directory.

But I have noticed that the loader only finds DTB in the /boot/dtb/ directory.
/boot/dtb/vendor is not in path and it falls back to EFI provided DTB.
So u-boot picks up the DTB on ESP and forwards it to FreeBSD loader.
OK boot
Using DTB provided by EFI at 0x3ce8c000.

If you specify in loader.conf It uses what you tell it. Provided it is in the path.
/boot/loader.conf
Code:
dtbfile_load="YES"
dtbfile_type="dtb"
dtbfile_name="rk3566-radxa-zero-3e.dtb"
OK boot
Using DTB from loaded file '/boot/dtb/rk3566-radxa-zero-3e.dtb'.
You can add the vendor to the path and it works fine.
dtbfile_name="/boot/dtb/rockchip/rk3566-radxa-zero-3e.dtb"
 
The FreeBSD snapshot for generic sdcard is now working with the nics and sdcard for storage.
The basics -- networking, storage, ssh, iscsi --- no usb, nvme or video at this time
Download the --> FreeBSD-15.0-CURRENT-riscv-riscv64-GENERICSD

FreeBSD current generic sdcard

Do not use a usb stick... only the sd card is working at this time.
You must be using a serial connection (for console)... hdmi is working at this time

Copy the dtb file to the EFI partition of the sdcard image --> /dtb/jh7110-starfive-visionfive-2-v1.3b.dtb

The disk (sd card) layout looks like this after booting
Code:
 root@generic:~ # gpart show mmcsd0
     =>       40  122142640  mmcsd0  GPT  (58G)
              40       4056            - free -  (2.0M)
            4096       4096          1   hifive-fsbl  (2.0M)
            8192       8192           2  hifive-bbl  (4.0M)
           16384     110592        3  efi  (54M)
          126976  109670400       4  freebsd-ufs  (52G)
       109797376   1233712       5  freebsd-swap  (5.9G)
       122134528       8152             - free -  (4.0M)
Need to boot from spi-- flip the boot switch to spi boot
The first two partitions on the generic sd card will not work for booting the visionfive2

Interrupt the u-boot normal boot process
Then these commands will boot the sdcard:
Code:
StarFive # mmc list
mmc@16010000: 0
mmc@16020000: 1

StarFive # mmc dev 1
switch to partitions #0, OK
mmc1 is current device

StarFive #  load mmc 1:3 ${fdt_addr_r}      dtb/jh7110-starfive-visionfive-2-v1.3b.dtb
32134 bytes read in 5 ms (6.1 MiB/s)

StarFive #  load mmc 1:3 ${kernel_addr_r} efi/boot/bootriscv64.efi
712636 bytes read in 34 ms (20 MiB/s)

StarFive #  bootefi ${kernel_addr_r} ${fdt_addr_r}

** now should see FreeBSD boot
You will need to have your own riscv repository to load software.
Poudriere is your friend.

You can also build riscv sd card image on amd64.
After buildworld and buildkernel go to release directory and make vm-image
Code:
freebsd@generic:~ % uname -a
FreeBSD generic 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n277145-6ee513f4f26d: Thu May 8 04:27:15 UTC 2025 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC riscv

freebsd@generic:~ % neofetch
```                        `       freebsd@generic
  ` `.....---.......--.```   -/    ---------------
  +o   .--`         /y:`      +.   OS: FreeBSD 15.0-CURRENT riscv64
   yo`:.            :o      `+-    Uptime: 41 mins
    y/               -/`   -o/     Packages: 7 (pkg)
   .-                  ::/sy+:.    Shell: csh tcsh 6.22.04
   /                     `--  /    Terminal: /dev/pts/0
  `:                          :`   CPU: (4)
freebsd@generic:~ %           :`
   /                          /
   .-                        -.
    --                      -.
     `:`                  `:`
       .--             `--.
          .---.....----.
 
Are there any updates according the both gigabit network ports? Want to use the Board as Firewall for my home network.

I have seen also U-Boot seems to have drivers for the Starfive JH7110. I have also successfully released some patches on the official U-Boot mailing list. Is somebody already working on the network driver? Maybe I can help too. :)
 
The nics work.
I do not use the u-boot from ports.
I compile u-boot from u-boot.org. But since 26 April 2025, the builds fail to boot. Hangs during memory check.
The sdcard seems questionable using Poudriere. I notice a a strange error when Poudriere completes and attempts to create the repository.
Code:
mmcsd0: Error indicated: 4 Failed
I do not see much activity or follow up to make some ports work on riscv.
A basic firewall is possible at this time.
 
Are there any updates according the both gigabit network ports? Want to use the Board as Firewall for my home network.

I have seen also U-Boot seems to have drivers for the Starfive JH7110. I have also successfully released some patches on the official U-Boot mailing list. Is somebody already working on the network driver? Maybe I can help too. :)
I think freebsd-riscv mailing list is more development focused if you could work on some driver... just my opinion, nothing bad with forums per se.
 
Is something wrong with u-boot from ports? Or do you need more recent or development version for some reason?
I do not use the u-boot from ports due to other other operating systems I use on this board. Also, wanted to understand how u-boot works and builds.
I wish the visionfive2 had a replacement for the u-boot.
I am really surprised how how other boards can use a replacement to u-boot. I am speaking of a uefi replacement:
edk2-rk3588
That uefi replacement makes it easy to use the OrangePi 5 Plus and other rk3588 based boards.
The starfive edk2 is poor quality and needs major help starfive-tech edk2
 
Good news. Compiled u-boot u-boot.org today and it now works with FreeBSD 15. Also, no longer need to create/store boot commands for FreeBSD. The normal u-boot boot command now boots.
Code:
bootcmd=bootflow scan

Code:
U-Boot 2025.07 (Jul 25 2025 - 10:02:46 +0300)

CPU:   sifive,u74-mc
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB
Core:  159 devices, 29 uclasses, devicetree: board
WDT:   Not starting watchdog@13070000
MMC:   mmc@16010000: 0, mmc@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
 
Some notes for others when building OpenSBI v1.7/U-Boot v2025.10:

OpenSBI version 1.7 (Git-tag: v1.7):
There is might be a bug in the build system, because the parameter FW_TEXT_ADDR will be ignored with version 1.7 this leads into that the firmware start address defaults to 0x00000000 instead of the required address 0x40000000 which raises an unhandled exception (Store/AMO access fault) during the relocation from OpenSBI.

But it works with OpenSBI versions above 1.7 (at least v1.7-71-g38a6106):
Code:
U-Boot SPL 2025.10 (Nov 06 2025 - 07:48:41 +0100)
DDR version: dc2e84f0.
Trying to boot from MMC2

OpenSBI v1.7-71-g38a6106
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name               : StarFive VisionFive 2 v1.3B
Platform Features           : medeleg
Platform HART Count         : 4
Platform IPI Device         : aclint-mswi
Platform Timer Device       : aclint-mtimer @ 4000000Hz
Platform Console Device     : uart8250
Platform HSM Device         : ---
Platform PMU Device         : ---
Platform Reboot Device      : pm-reset
Platform Shutdown Device    : pm-reset
Platform Suspend Device     : ---
Platform CPPC Device        : ---
Firmware Base               : 0x40000000
Firmware Size               : 357 KB
Firmware RW Offset          : 0x40000
Firmware RW Size            : 101 KB
Firmware Heap Offset        : 0x4d000
Firmware Heap Size          : 49 KB (total), 0 KB (reserved), 12 KB (used), 35 KB (free)
Firmware Scratch Size       : 4096 B (total), 416 B (used), 3680 B (free)
Runtime SBI Version         : 3.0
Standard SBI Extensions     : time,rfnc,ipi,base,hsm,srst,pmu,dbcn,fwft,legacy,dbtr,sse
Experimental SBI Extensions : none

Domain0 Name                : root
Domain0 Boot HART           : 1
Domain0 HARTs               : 1*,2*,3*,4*
Domain0 Region00            : 0x0000000040040000-0x000000004005ffff M: (F,R,W) S/U: ()
Domain0 Region01            : 0x0000000040000000-0x000000004003ffff M: (F,R,X) S/U: ()
Domain0 Region02            : 0x0000000010000000-0x0000000010000fff M: (I,R,W) S/U: (R,W)
Domain0 Region03            : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region04            : 0x000000000c000000-0x000000000fffffff M: (I,R,W) S/U: (R,W)
Domain0 Region05            : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X)
Domain0 Next Address        : 0x0000000040200000
Domain0 Next Arg1           : 0x00000000402c1d28
Domain0 Next Mode           : S-mode
Domain0 SysReset            : yes
Domain0 SysSuspend          : yes

Boot HART ID                : 1
Boot HART Domain            : root
Boot HART Priv Version      : v1.11
Boot HART Base ISA          : rv64imafdcbx
Boot HART ISA Extensions    : zihpm,sdtrig
Boot HART PMP Count         : 8
Boot HART PMP Granularity   : 12 bits
Boot HART PMP Address Bits  : 34
Boot HART MHPM Info         : 2 (0x00000018)
Boot HART Debug Triggers    : 8 triggers
Boot HART MIDELEG           : 0x0000000000000222
Boot HART MEDELEG           : 0x000000000000b109


U-Boot 2025.10 (Nov 06 2025 - 07:48:41 +0100)

CPU:   sifive,u74-mc
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB
Core:  159 devices, 29 uclasses, devicetree: board
WDT:   Not starting watchdog@13070000
MMC:   mmc@16010000: 0, mmc@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110B1-2318-D008E000-18003208
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:5d:7e
Ethernet MAC1 address: 6c:cf:39:00:5d:7f
--------EEPROM INFO--------

starfive_7110_pcie pcie@940000000: Starfive PCIe bus probed.
starfive_7110_pcie pcie@9c0000000: Starfive PCIe bus probed.
In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
starting USB...
Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
Bus xhci_pci: 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Working FDT set to ff719f00
Hit any key to stop autoboot: 0
StarFive #
 
Back
Top