VisionFive 2 up and running instructions

I just got my VisionFive 2 today, and in a couple hours I got Java running on it. Here’s all my steps to do it:

  1. Unpack VF2. Plug in ethernet to the left jack (the right one doesn’t work for some reason)

  2. Load sdcard.img from SF GitHub on to an SD card and boot up the VF2 with it.

  3. Wait for it to connect to the network and then SSH into the VF2 with “root@ip-address” and use the password “starfive”

  4. Download the two files from SF GitHub for SBI and U-boot.

  5. Use SCP to transfer the files over (there is no SFTP or FTP on sdcard.img) like “scp my-user@ip-address:my-file my-file”

  6. Use the commands listed in the flashcp section of the QSG to load up the files onto the flash

  7. Shutdown the VF2 with “shutdown now” and take out the SD card

  8. Load Debian Image 69 Minimal onto the SD card

  9. Boot the VF2 again and log in with SSH with “ssh user@ip-address” and password “starfive”

  10. The default user is not in the sudoers file and the PATH is broken. Fix the sudo problem by doing “su” then do “/usr/sbin/usermod -aG sudo user” then “/sbin/visudo” and add the line “user ALL=(ALL) NOPASSWD:ALL” at the bottom.

  11. The default partition size does not fill up the card. Fix this with “sudo /sbin/resize2fs /dev/mmcblk1p3”

  12. Reboot with “sudo systemctl reboot”

  13. Run “sudo apt update” and “sudo apt upgrade” to install the latest software.

  14. For Java, I downloaded a special build of Java JIT because it is not available in Debian yet.

10 Likes

I don’t know if this is good practice, but I’m using Ubuntu openJDK17 RISC-V build on another RISC-V machine, and the recent Temurin builds for JDK19 and JDK20 also work for me (with glibc 2.35).

I can’t find where I originally read it, but I did read somewhere that most major Linux distributions have locked onto a baseline hardware support for RV64GC (RV64IMAFDC).

All I can find after a quick search is a few lines from a Debian wiki!:

Debian port information

Hardware baseline and ABI choice

The Debian port uses RV64GC as the hardware baseline and the lp64d ABI (the default ABI for RV64G systems).Making the C extension a part of the default hardware baseline for general-purpose binary Linux distributions has been agreed upon between Fedora porters, Debian porters and members of the RISC-V foundation. According to the chairman of the board of the RISC-V foundation, the foundation will provide “a profile for standard RISC-V Unix platforms that will include C as mandatory”.

2 Likes

It seems that OpenJDK has risc-v release on Debian:

1 Like

Hm…

“The Linux/RISC-V port will only support the RV64GV configuration of RISC-V, which is a general-purpose 64-bit ISA that includes vector instructions.”

https://openjdk.org/jeps/422

2 Likes

That is interesting because the standard extension for vector operations has only been frozen for public review at version 1.0, and has not yet been Ratified (When ratified, the spec will be given version 2.0). And version 1.0 is incompatible at the assembly-language and binary level with the version implemented in the T-Head C906 core used by the Allwinner D1 RISC-V SoC (Vector ISA draft version 0.7.1).

I’m sure once it is ratified, there will be a whole new generation of SoC’s which will support RV64GCV (RV64IMAFDCV).

1 Like

And what it means in the future is that V is mandatory…

1 Like

My guess is that Oracle, reading between the lines, put in lot of effort to maximise the use of vector operations on x64 and ARM, and for them it would be a giant step backwards, especially in terms of performance, to disable vector support for RISC-V.

It also suggests to me that Oracle developers probably have early access to Horse Creek SoC’s based on SiFive P550 cores which have vector extension v1.0.

The P550 doesn’t actually have any vector support at all, but the new P570 does. It’s a shame that Horse Creek was just a little too bit early to get the P570 instead, so now we’re stuck with no vector support for whatever HC is in.

1 Like

You are totally right, I was thinking of the P270. It does makes me wonder now where Oracle are getting access to RISC-V test machines with RV64GV, that might not have the standard extension for compressed instructions.

Where can I find the files mentioned of the OP, sdcard.img, for SBI, and for U-boot? The official getting started guide has a link to Debian, but I don’t know where to find these other files.

Get the files here: Release VisionFive2 Software v2.5.0 · starfive-tech/VisionFive2 · GitHub

For SBI and U-Boot, get “u-boot-spl.bin.normal.out” and “visionfive2_fw_payload.img”

3 Likes

I got it working, with some notes. Hopefully this helps others.

I followed the instructions in the OP, but on step 5, SCP was not working for me:

% scp root@192.168.0.105:/root/u-boot-spl.bin.normal.out u-boot-spl.bin.normal.out
root@192.168.0.105's password: 
sh: /usr/libexec/sftp-server: not found
scp: Connection closed

Instead, I had to set up a local HTTP server on my regular computer and transfer the files by running wget on the VisionFive 2.

Then, on step 6 “Use the commands listed in the flashcp section of the QSG to load up the files onto the flash”, I assume you are referring to this section of the quick start guide. It says to run “apt install mtd-utils” but if I do that I get a message “-sh: apt: not found”. It turns out you can just skip the install command, mtd and flashcp seems to be already installed on sdcard.img.

On step 7, “shutdown now” did not actually do anything to shut down the system. I also tried “poweroff” which did kill the system but the power LED stayed on. I had to unplug it to fully power off the system.

On step 10, my default user was in the sudoers file already with Debian Image 69 full.

On step 11, I could not use resize2fs as-is because that only resizes the file system, not the partition. I used parted instead as per the quick start guide, then I could use resize2fs.

After performing all steps, I have a problem where any time I run sudo I get the text “sudo: unable to resolve host starfive: Name or service not known”. It seems that this just a cosmetic issue.

Also, after performing all steps, I do not have a GUI, but the screen does turn on (it’s just black).

2 Likes

I got the same issue at sometime, please go with the -O flag.

flashcp command has been integrated in sdcard.img since it is based on buildroot system, we have enable it.
but for debian system, you need do apt install mtd-utils.

1 Like

Could you please share where you’ve got Java from? have you tried SPEC2006 with it?

I did (gcc version 12.2.0, -Ofast -flto -fno-strict-aliasing -static):

400.perlbench    9770       1802       5.42 *                                  
401.bzip2        9650       2705       3.57 *                                  
403.gcc          8050       1674       4.81 *                                  
429.mcf          9120       3626       2.52 *                                  
445.gobmk       10490       1426       7.35 *                                  
456.hmmer        9330       2685       3.47 *                                  
458.sjeng       12100       1869       6.47 *                                  
462.libquantum  20720       2815       7.36 *                                  
464.h264ref     22130       3616       6.12 *                                  
471.omnetpp      6250       1998       3.13 *                                  
473.astar        7020       1713       4.10 *                                  
483.xalancbmk    6900       1432       4.82 *                                  
 Est. SPECint(R)_base2006              4.67

@tommythorn I mean how did you obtain JDK/JRE? Build from scratch or used the one from Debian (openjdk)? The problem with spec2006 is in incompatible java version - I can’t figure out what’s wrong …

JDK/JRE has nothing to do with SPECint. I don’t use Java (at least not since 1998). Rust FTW.

Apparently we’re talking about different tests. “java -jar SPECjvm2008.jar” - I want to see results from this benchmark.