StarFive Tech VisionFive 2

This would be interesting hardware for under 100 EUR.

https://www.starfivetech.com/en/site/boards

If the developers provided an official build for RISC-V I would buy one. I saw in the mailing list that there were already successful RISC-V builds but only in virtual machines so far.

https://lists.ipfire.org/pipermail/development/2022-February/012363.html

The risc-v build iso is available at

https://nightly.ipfire.org/next/latest/riscv64/

You can download the iso and confirm it with the b2sum value.

Be aware the risc-v build has not been tested with hardware and the version available is from the next git repository which is equivalent to the unstable branch.

3 Likes

Thanks I’m gonna try it and report how it works out.

2 Likes

Currently risc-v is not working due to bugs in the kernel (crash at module load) and grub that not support linux boot on risc-v.

3 Likes

This is true, but so far this is a very secondary architecture as we don’t have any hardware to test this on.

We don’t have build hardware either which is why we are using an emulated build on a 24 core Intel Xeon machine which still takes over 24 hours. This is far from ideal.

Cheap, but also weak. It would be great to see something that isn’t in the single board computer niche any more and that would be more powerful. I am not sure we have a lot of users who are aiming for an IPFire that small. It mostly is a personal firewall or maybe for a small home.

Sadly there is also a lot of trouble in the business with SiFive letting go lots of their engineers.

But let us know how you are getting on with the image and please send in patches to make IPFire work better on these devices, and maybe one day this will become a properly supported architecture.

2 Likes

Regarding the kernel is this an issue that you can fix or does it need to be fixed by the kernel developers?

Regarding GNU GRUB, is it really needed, I think U-Boot can directly load the kernel? Why bother with GRUB?

That’s exactly the intended use-case for me. According to benchmarks the performance is somewhere between a Raspberry Pi 3 and 4.

The board will only arrive on Monday, the case already arrived on Wednesday. I’ll give some technical details about the VisionFive 2 single-board computer (SBC).

System-on-chip (SoC): StarFive JH7110

consisting of these components:

CPU:

SiFive U74 64-bit High-performance RISC-V CPU quad-core for main general computing (RV64GC), up to 1.5 GHz
SiFive S7 64-bit monitor core (RV64IMAC)
SiFive E24 32-bit RISC-V CPU single-core for low power and control/configure tasks as a coprocessor

GPU:
Imagination IMG BXE-4-32 MC1 GPU, 400 MHz (up to 600 MHz)


PHY (GMAC in SoC):
Motorcomm YT8512C (only 100 MBit/s, left port in revision v1.2A)
Motorcomm YT8521C
Motorcomm YT8531C (revision v1.3B)

Memory: BIWIN 2/4/8 GB LPDDR4 (2,133 Mbps, up to 2,800 Mbps)

PMIC: X-Powers AXP15060

USB controller: Via Labs (VLI) VL805-Q6

Interfaces:

PoE 4-pin connector
USB-C (only for power)
MIPI CSI
Fan header 2-pin 5V
RJ45 1 GBit/s Ethernet (2x)
HDMI 2.0
USB 3.0 5 Gbps (4x)
3.5 mm 4-ring audio jack
MIPI DSI (4-lane)
MIPI DSI (2-lane)
GPIO header 40-pin
TF/microSD slot (SD 3.0)
eMMC (5.0)
QSPI Flash (100 Mbps)
M.2 M-Key (PCIe 2.0 x1)

This is a lesson learned from ARM. There are just too many quirks and builds required for all those different boards. Pretty much no distribution is able to support this. We need to have one boot loader that simply works on all boards. And GRUB (with EFI) is probably the best way to go.

@arne_f will know :slight_smile:

1 Like

Delivery was delayed but the board finally arrived today.



Shown above is the youyeetoo case which acts as a passive cooler. Included are bottom part, top part with included heat spreader, two mounting brackets, thermal pad and 12 screws (4 for the board, 4 for the case and 4 for the brackets).

But I didn’t come very far, after flashing the IPFire RISC-V .img to the SD card it successfully booted to GRUB but when selecting IPFire the following message came up.

V5_IPFire_GRUB_UART
V5_IPFire_GRUB_UART_error

Is that the mentioned kernel crash?

HDMI output didn’t work yet. Even the included Debian 11 image only showed a mouse cursor on a black background.

I connected the VisionFive 2 with a USB-to-serial UART adapter on the GPIO headers via PuTTY.

I found the error code (β€œLinux not supported yet.”) in the source code of GRUB. (β€œgrub-core\loader\riscv\linux.c”).

The file is only 2 KB large and contains:

#include <grub/command.h>
#include <grub/dl.h>
#include <grub/lib/cmdline.h>

GRUB_MOD_LICENSE ("GPLv3+");

static grub_err_t
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
		 int argc __attribute__ ((unused)),
		 char *argv[] __attribute__ ((unused)))
{
  grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, N_("Linux not supported yet"));

  return grub_errno;
}

static grub_err_t
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
		int argc __attribute__ ((unused)),
		char *argv[] __attribute__ ((unused)))
{
  grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, N_("Linux not supported yet"));

  return grub_errno;
}

static grub_command_t cmd_linux, cmd_initrd;

GRUB_MOD_INIT (linux)
{
  cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0,
				     N_("Load Linux."));
  cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0,
				      N_("Load initrd."));
}

GRUB_MOD_FINI (linux)
{
  grub_unregister_command (cmd_linux);
  grub_unregister_command (cmd_initrd);
}

I guess that means GRUB does not support RISC-V yet?

I just tried the latest build from yesterday, but because it still uses GRUB 2.06 it doesn’t boot. We probably have to wait until beginning of 2024 until GRUB 2.12 arrives?

V5_IPFire_GRUB_UART_error_CU182

GRUB supposedly has RISC-V support since version 2.04 but not from the boot menu?

The riscv support in grub 2.04 is for the native UEFI boot only.

The Linux version is in grub 2.12 but its release has continually been push on and on.

However @arne_f has now created a patch for the release candidate of grub 2.12

https://lists.ipfire.org/hyperkitty/list/development@lists.ipfire.org/thread/PXWRYC3QJOXXQCM4VSUTSBUSKN5SC6IL/

This should get merged shortly. I will keep an eye out for it and let you know when that patch has been merged and built so you can test it out.

2 Likes

So the grub-2.12-rc1 patched version has been merged into next.

https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=3273f4796a108c7fbe66c0c30a6d6b18be43d4d3

I would expect the riscv nightly build for that to occur during tonight so I will check in the morning to find the status.

But many important drivers and the device-tree-file for the board is still missing in kernel 6.1.x so there is much more work to do.

The riscv nightly build has run but it is still based on the changes before 20 hours ago so doesn’t include the grub change.

However, it sounds from @arne_f input above that even with the grub change there are further things still missing that need to be worked on before you will be able to make a meaningful test.

Thanks for the latest build. Here is the full boot log:


U-Boot SPL 2021.10 (Feb 28 2023 - 21:44:53 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : jh7110-hsm
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Firmware Base             : 0x40000000
Firmware Size             : 292 KB
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01          : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Feb 28 2023 - 21:44:53 +0800), Build: jenkins-VF2_515_Branch_SDK_Release-31

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  4 GiB
MMC:   sdio0@16010000: 0, sdio1@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-2310-D004E000-00001493
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:50:18
Ethernet MAC1 address: 6c:cf:39:00:50:19
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
Can't set block device
Failed to load '/boot/uEnv.txt'
Hit any key to stop autoboot:  0
Can't set block device
Importing environment from mmc1 ...
## Info: input data size = 790 = 0x316
Can't set block device
## Warning: defaulting to text format
## Error: "boot2" not defined
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Card did not respond to voltage select! : -110
** Unable to read file ubootefi.var **
Failed to load EFI variables
Scanning mmc 1:2...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Found EFI removable media binary efi/boot/bootriscv64.efi
151552 bytes read in 13 ms (11.1 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
error: failed to retrieve the structure field.
error: serial port `com0' isn't found.
error: terminal `serial' isn't found.
error: terminal `serial' isn't found.
error: unable to determine partition UUID of boot device.


                           GNU GRUB  version 2.12~rc1

 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚*IPFire 2.27 (riscv64) - core182 Development Build: next/ff12bfda GNU/Linux β”‚
 β”‚ Advanced options for IPFire 2.27 (riscv64) - core182 Development Build: neβ–Ίβ”‚
 β”‚ Serial Console: IPFire 2.27 (riscv64) - core182 Development Build: next/ffβ–Ίβ”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β”‚                                                                            β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

      Use the β–² and β–Ό keys to select which entry is highlighted.
      Press enter to boot the selected OS, `e' to edit the commands
      before booting or `c' for a command-line.
   The highlighted entry will be executed automatically in 0s.
  Booting `IPFire 2.27 (riscv64) - core182 Development Build: next/ff12bfda
GNU/Linux'

Loading Linux 6.1.61-ipfire ...
Loading initial ramdisk ...
EFI stub: Booting Linux Kernel...
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
sbi_trap_error: hart0: trap handler failed (error -2)
sbi_trap_error: hart0: mcause=0x0000000000000005 mtval=0x0000000040048060
sbi_trap_error: hart0: mepc=0x0000000040004cac mstatus=0x0000000200001800
sbi_trap_error: hart0: ra=0x0000000040009ee2 sp=0x0000000040047f10
sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x0000000040048000
sbi_trap_error: hart0: s0=0x0000000040047f20 s1=0x0000000040048000
sbi_trap_error: hart0: a0=0x0000000040048060 a1=0x0000000000000002
sbi_trap_error: hart0: a2=0x0000000000000000 a3=0x0000000000000019
sbi_trap_error: hart0: a4=0x0000000000000001 a5=0x0000000040048060
sbi_trap_error: hart0: a6=0x00000000400480a8 a7=0x0000000000000004
sbi_trap_error: hart0: s2=0x00000000400241a8 s3=0x0000000000000000
sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000040029000
sbi_trap_error: hart0: s6=0x0000000040029020 s7=0x0000000000000000
sbi_trap_error: hart0: s8=0x000000000000001c s9=0x0000000040035ab0
sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000000
sbi_trap_error: hart0: t0=0x0000000000000000 t1=0x0000000000000000
sbi_trap_error: hart0: t2=0x0000000000000000 t3=0x0000000000002000
sbi_trap_error: hart0: t4=0x0000000000000000 t5=0x0000000000000000
sbi_trap_error: hart0: t6=0x0000000000000000
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
i2c read: write daddr 36 to
cannot read pmic power register

1 Like

grub is still not working. It still cannot boot any kernel. (also the visionfive2 provided kernel hang with the same output.)

But our kernel will also not boot via u-boot. (also the update to kernel 6.6.x will not boot at all.)

So we still have two problems and i have no idea how to solve at the moment.

I updated the VisionFive 2 firmware to the latest version (v3.9.3). Unfortunately now it doesn’t even boot into GRUB because StarFive Tech changed how U-Boot searches for the boot partition.

Is it possible that you change the partitions as mentioned in this thread?

How the IPFire partitions look:

How the V52 Debian partitions look:


U-Boot SPL 2021.10 (Nov 29 2023 - 14:51:40 +0800)
LPDDR4: 4G version: g8ad50857.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|___/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
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   : ---
Firmware Base             : 0x40000000
Firmware Size             : 392 KB
Firmware RW Offset        : 0x40000
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01          : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02          : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03          : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
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  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Nov 29 2023 - 14:51:40 +0800), Build: jenkins-github_visionfive2-20

CPU:   rv64imacu_zba_zbb
Model: StarFive VisionFive V2
DRAM:  4 GiB
MMC:   sdio0@16010000: 0, sdio1@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-2310-D004E000-00001493
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:50:18
Ethernet MAC1 address: 6c:cf:39:00:50:19
--------EEPROM INFO--------

In:    serial
Out:   serial
Err:   serial
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
Try booting from MMC1 ...
Can't set block device
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
## Error: "boot2" not defined
Card did not respond to voltage select! : -110
starfive_pcie pcie@2B000000: Port link up.
starfive_pcie pcie@2B000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
starfive_pcie pcie@2C000000: Port link down.
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10

Device 0: unknown device

Device 0: unknown device
Tring booting distro ...
switch to partitions #0, OK
mmc1 is current device
Try booting from MMC1 ...
Can't set block device
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
Can't set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'
Retrieving file: /extlinux/extlinux.conf
Can't set block device
Error reading config file
Card did not respond to voltage select! : -110

Device 0: unknown device

Device 0: unknown device
StarFive #

(thermal pad 3 mm)

There are many problems with this board. even ubuntu has not sorted the most bootproblems. A while ago they sugested to stay on 2.10.4 and now they use a own version. But they also state that it not work with mainline kernels.

For me it is too much work at the moment because the problems.
Also the nvme slower than an usb-3.0 disk and the socket is around an 1mm to large so the ssd is not correct mounted. (slips from the brass mount down to the board.