VisionFive 2 up and running instructions

You’ll need a DHCP server that can show you all the leases. In my case, I have a MikroTik RB4011 which gleefully provides a list of all the addresses it’s leased out sorted by order of lease time remaining.

I’m lazy, I would ping the broadcast address for 1-2 seconds. And then do your “arp -a” (But I would only ever do that on a home network). ping is a command that, in the wrong hands, can do really bad things.

The first 6 digits of the MAC address you are looking for starts with 6C:CF:39
IEEE OUI registration confirms that:

6C-CF-39   (hex)		Guangdong Starfive Technology Co., Ltd.
6CCF39     (base 16)		Guangdong Starfive Technology Co., Ltd.
1 Like

While those will “work” – they are unfortunately likely using the ZeroVM (interpreted mode only) and probably feel not only sluggish, but you sort of feel really let down by the VF2.

I wasn’t able to find any optimized builds of the JDK for riscv64 (that specifically don’t use the “Zero VM”), so I went ahead and built one for folks to use.

While debian/ubuntu provide openjdk packages, they are built with the interpreted-only Zero VM. However, JDK 19+, offer native riscv64 optimized HotSpot server VMs, if it’s built with that feature. That’s what my build does – it supports GLIBC 2.5+, so its more compatible with various ubuntu and debian versions. You can check it out here: GitHub - fizzed/nitro: Alternative OpenJDK builds for architectures such as riscv64

It has roughly 4-8 x’ed the performance of the JVM on my VF2 and it’s currently beating my RPi4 in many tests. Would love to know what you think or if there’s any other optimizations folks can think of.

4 Likes

Yeah, I found that out too, it’s a huge hassle because there’s no easy way to get the files onto the device. The wget that’s part of busybox doesn’t do HTTPS but only HTTP and github helpfully rewrites an HTTP URL to an HTTPS one because security so that doesn’t work either. There’s no FTP present (although wget will do at a pinch), and no sftp either.

However, there is a uudecode, which is what I’m currently looking at using…

1 Like

Did you try the -O flag as mentioned later?

Here’s my version of the HOWTO notes, based on the latest release, these also correct things that don’t quite work as described in the docs.

Check latest release at Releases · starfive-tech/VisionFive2 · GitHub, currently 2.6.0 for which $releasepath is https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0/ so download https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0/sdcard.img

Download $release-path/sdcard.img (ca.800MB), flash to micro SD card and insert. This isn’t the full image but a stripped-down one to allow firmware flashing so doesn’t need the usual SSH-enabling hack.

Plug an ethernet cable into the left ethernet port, the right one doesn’t give you a DHCP address, and power up. The boot process may take awhile.

ssh to the device which will appear on the LAN as ‘buildroot’, user = root, password = starfive. In theory you should now do:

releasepath="https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0"
wget $releasepath/u-boot-spl.bin.normal.out
wget $releasepath/visionfive2_fw_payload.img

however the Busybox wget doesn’t understand HTTPS so you need to download it on another machine:

https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0/u-boot-spl.bin.normal.out
https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0/visionfive2_fw_payload.img

uuencode it, paste it into an SSH session (this may take awhile, the VisionFive will appear to hang as it catches up on the pasted stream), uudecode it on the VisionFive, and then check it with md5sum, which if you’re using a Windows machine that doesn’t have it needs to be done with:

certutil -hashfile u-boot-spl.bin.normal.out md5
md5sum u-boot-spl.bin.normal.out
certutil -hashfile visionfive2_fw_payload.img md5
md5sum visionfive2_fw_payload.img

This is to make sure that nothing went wrong in the binary → text → paste → binary translation. Finally, reflash:

flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v visionfive2_fw_payload.img /dev/mtd1
shutdown -h now

Unplug the power to fully shut down.

Download the latest image from the Google Cloud link at https://debian.starfivetech.com/, current direct link Engineering Release - Google 云端硬盘, this is a 6GB image. Note that this will require retrying the download over and over again until it stops failing, once you get past the endless “Failed” or “Failed: Network error” problems it downloads in a few minutes.

bunzip2 starfive-jh7110-VF2*

This takes around fifteen minutes since it’s a single-threaded decompress of 16 GB of data. Write to SD card (if this had sdcard.img flashed to it earlier it’ll contain multiple partitions that may appear as odd drives, may need to delete these first and unplug and re-plug to de-confuse the OS), which also takes around 15 minutes. Finally plug into the device, wait some time for it to boot and it’ll appear on the LAN as ‘starfive’. SSH in with user = user (not root), password = starfive.

Next, fix up some missing stuff:

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
sudo apt install unzip
sudo apt install mtd-utils
sudo apt install usbutils
sudo apt install clang
sudo apt install make

At this point you’ve got a basic dev system up and running.

Finally, to compensate for all the junk you’ve just dumped on there in the previous set of commands:

sudo apt purge --auto-remove libx11-6 libwayland-client0

This gets rid of the GUI bloat.

5 Likes

I used a USB stick. You can mount it manually and work from there.
You can also try to mount the SD card on another machine and copy the files, before booting on the VF2.

3 Likes

What, you mean actually get up and walk across the room to plug in a USB stick when I can just sit here typing? :-).

Good point, USB stick would probably have been quicker.

1 Like

Too late to edit now so I’ll have to add a comment in a reply: This is a bit annoying because it’s eth1 not eth0, so if you leave it plugged in once the full image is loaded you’ll end up with your network access on an unexpected interface. Tomorrow I’ll check whether the full image is fine with DHCP on the right-hand port as well as the left-hand one, which would make the default interface the expected eth0.

Does anyone know how to fix the broken PATH problem? I’m not very familiar with apt. It seems apt will install binary packages into /usr/bin or /usr/sbin or /sbin.

bucketoffun mentioned:

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.

I hope it helps you.

Updating this one again, the right-hand-side ethernet port is fine once you’ve got the full image on there. So for the BusyBox firmware-flash image you need to use the left-hand ethernet port, for the full-install image either port is fine but the right-hand one is probably better because it’s the default eth0.

Unless you are using Debian Image-55, from the pdf release notes:
“Eth0 cannot be assigned IP address”

Oh, odd, maybe it was a bug specific to -55 because -69 has no problems with it.

1 Like

it was

We got our vf2 board yesterday.
I did a dd to an older sdcard I had with Debian Image-55.
Plugged in the sdcard.
Plugged in the hdmi.
Plugged in the ethernet cable.
Plugged in a usb type c phone usb charger.

At first I got a red light, then given a minute or two, the green light appeared.

I went to the router/hub and it gave me a device called “starfive” and an ip for it.

I wasn’t successful with ssh root@theip, but I was successful with ssh user@theip with password starfive.
Afterwards you can “su -l” with the same password.

I’ll keep you posted on my firmware update.

su -l
apt-get install mtd-utils
rsync --archive /mnt/mynewfw/u-boot-spl.bin.normal.out ./u-boot-spl.bin.normal.out
rsync --archive /mnt/mynewfw/visionfive2_fw_payload.img ./visionfive2_fw_payload.img
root@starfive:/home/user# flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
**While trying to open /dev/mtd0 for read/write access: No such file or directory**
root@starfive:/home/user# mtd_debug info /dev/mtd0
**mtd_debug: error!: open()**
root@starfive:/home/user#

I failed to update the firmware via ssh.

1 Like

Thank you @hfield Your instructions were the best to install the firmware update.
I am explicitly referring to this posting: VisionFive 2 up and running instructions - #40 by hfield

Heavily inspired from this posting, but I'll do my best to be brief.
https://forum.rvspace.org/t/visionfive-2-up-and-running-instructions/1238/40

prepare image-69-minimal on sdcard
#################################################
lsblk
###this returns /dev/sdb where the sdcard is in my case
###unmount any sdcard mountpoints
unmount /dev/sdb1
unmount /dev/sdb2
unmount /dev/sdb3
###manufacture wipe that scard
wipefs --all /dev/sdb

Download debian engineering image 69 minimal
https://drive.google.com/file/d/10-LX1n1olviVPDs6VL0v9cuSZyc9IfA3/view?usp=share_link
cd ~/Downloads/Image-69/minimal/
cp starfive-jh7110-VF2_515_v2.5.0-69-minimal-desktop.img.bz2 vf250_69.img.bz2

#be patient duration 15 minutes
#it turns into a 16GB file roughly.
bunzip2 vf250_69.img.bz2

#please be patient duration 15-30 minutes
dd if=vf250_69.img of=/dev/sdb bs=4M status=progress conv=fdatasync


###the sdcard is 32GB capacity, but the .img file wrote an 8GB filesystem with 3 partitions.
###using gparted, stretch the 3rd partition to take up the remaining sdcard capacity. Click the checkmark(apply) button. After it's done committing the change, close gparted.
gparted /dev/sdb
sync
###take out the sdcard from your host computer.

###############################################
Plugin the sdcard into the VF2 board
Plugin the ethernet
Plugin the usb type c phone charger into the VF2 board

starfive
192.168.2.52

ssh user@192.168.2.52
###password starfive
###be patient.  It takes about 5 seconds before it comes back with the usual session bash prompt.

###enter superuser(administrator) mode
su -l
###password starfive

###stuff to help install the firmware updates
apt-get install curl wget unzip bunzip2 mtd-utils usbutils

releasepath="https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.6.0"
wget $releasepath/u-boot-spl.bin.normal.out
wget $releasepath/visionfive2_fw_payload.img

###actual firmware updates
flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v visionfive2_fw_payload.img /dev/mtd1
shutdown -h now
##################################
Pull out usb type c phone charger from VF2 board to power off.
Take out sdcard from VF2 board


###NOW we can run the full latest debian image 69
###prepare image-69 full on sdcard
#################################################
lsblk
###this returns /dev/sdb where the sdcard is in my case
###unmount any sdcard mountpoints
unmount /dev/sdb1
unmount /dev/sdb2
unmount /dev/sdb3
###manufacture wipe that scard
wipefs --all /dev/sdb

Download debian engineering image 69 FULL
https://drive.google.com/file/d/1DN0zWkvAHMB9xF7j2QZgN5Xm-VA9WCwk/view?usp=share_link
cd ~/Downloads/Image-69/
cp starfive-jh7110-VF2_515_v2.5.0-69.img.bz2 vf2250-69-FULL.img.bz2

#be patient duration 15 minutes
#it turns into a 16GB file roughly.
bunzip2 vf2250-69-FULL.img.bz2 

#please be patient duration 15-30 minutes
dd if=vf2250-69-FULL.img of=/dev/sdb bs=4M status=progress conv=fdatasync
###the sdcard is 32GB capacity, but the .img file wrote an 8GB filesystem with 3 partitions.
###using gparted, stretch the 3rd partition to take up the remaining sdcard capacity. Click the checkmark(apply) button. After it's done committing the change, close gparted.
gparted /dev/sdb
sync
###########################################





RUNNING FULL Debian 69 image and a bit of developer setup
###############################################
Plugin the sdcard into the VF2 board
Plugin the ethernet
Plugin the usb type c phone charger into the VF2 board

starfive
192.168.2.52

ssh user@192.168.2.52
password starfive

su -l
password starfive

apt-get install curl wget unzip bunzip2 mtd-utils usbutils
###https://forum.rvspace.org/t/visionfive-2-debian-image-released/994/93
apt-get install aptitude emacs-nox build-essential clang-15-tools lld-15 llvm-15-tools git-core gitk

as login user
#install rust nightly
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#customize default for everything except nightly (not stable).

git clone https://github.com/rust-lang/rust-mode.git rust-mode

###################
cat /home/user/.emacs
(global-set-key (kbd "M-,") 'tags-loop-continue) ; Alt+a
(add-to-list 'load-path "/home/user/rust-mode/")
(autoload 'rust-mode "rust-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
(require 'rust-mode)
####################

######append this to your /home/user/.bashrc
export PS1="\u@\h \D{%F_%T_%Z} : \w\n $ "

if ! [[ "$PATH" =~ "$HOME/.cargo/bin:" ]]
then
    PATH="$HOME/.cargo/bin:$PATH"
fi
export PATH
############

su -l
sync
sync
shutdown -h now
########################################

That should be a decent dev environment. I hope this helps others.

2 Likes

It was very informative thread, but I still have a problem. Neither debian 55, 69, minimal nor arch linux boot up from sd card. sdcard.img does boot up fine though. I’ve tried updating firmware with the latest vision of visionfive2_fw_payload.img and u-boot-spl.bin.normal.out, 2.6.0 and 2.5.0 as well as compiling them myself as instructed in technical reference manual. But every time I flash a new image on a sd card, it just refuses to boot. Only a red light is on. flashcp command is working properly and is displaying the same things written in QSG. What could be the problem?

@hfield maybe you have some recomendations?

Uhh, recommendations for what?