VisionFive 2 up and running instructions

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?

You mentioned only a red light is on. Did you wait about 5 minutes? You should see some flashing green after a while.
You should also notice some ethernet port light blinking with activity and solid on after a while.

Do you see anything like that? Please be more patient with the board.

The default when you bought had recovery bin from Dec22 installed already on the board.
I never uploaded the dec22 recovery bin to the board.

The first image file was v2.5.0 I believe.
Then you could have upgraded to v2.6.0. for the two firmware files NOT RECOVERY BIN.
Then you could have upgraded to v2.8.0 for the two firmware files. These came out 3 weeks ago, but I just installed it yesterday. No issues.

You keep on saying the only image that works for you is the original image file. Ok. At least you have one that boots up.
Once booted up, log into it, download the latest firmware v.2.8.0 directly on that sdcard.
Then run the flashcp for both of them.
sync
sync

Then shutdown -h now

Power down. Take out that sdcard. Now get another sdcard and wipefs --all /dev/NEWSDCARD, then dd the full image 69 on it, or try the experimental debian sid image. Take your pick. They both work. The archlinux, gentoo image are available as well, but I haven’t spent time with them. I also heard there are opensuse tumbleweed, deepin, and openeuler images available as well.

FYI I booted off a debian 69 minimal image to do the firmware upgrade from v2.5.0 to v.2.6.0.
I then started using the experimental debian sid image and apt-get install mtd-utils, then upgraded to v2.8.0 and shutdown and continued using the experimental debian sid without issues.

cwt say to avoid using uboot-upgraded/uboot-update because it fiddles with the fdt files. No matter. Don’t be scared. At the very worst you can always uart and upload the recovery binary and re-update the firmware files again. My only advice is continue playing with the board until you get it right. Be patient with yourself and keep on asking questions.

When running any commands, be patient. Let the commands settled down, give them time to do their task.
For the initial bootup, wait 5 minutes before logging in via ssh.
After entering your password for ssh, wait 5-10 seconds and you’ll eventually see the bash prompt show up.
When you are using a slow sdcard, everything is slow. That’s my situation and understand it perfectly well.
Once you start debootstrapping to an nvme and chroot /mnt the nvme, things go a bit faster in my case 6x faster.
It doesn’t boot from the nvme, but that’s ok. It’s still early days.

This is not a user board. This is definitely a developer board because it’s early days for riscv tv-boxes, pi4 like sbc’s and such. pi4’s have a desktop gui. vf2 is still working out the bugs for desktop gui and such. vf2 is still working out how to make it easy to boot off of emmc and nvme. Please be patient. Other images will come that will be easier to use, but in the mean time be aware this is more for developers trying to get their feet wet to improve the riscv ecosystem. Cheers.

2 Likes

+1 for the “wait 5 minutes” part, some steps in the process can take an awfully long time before the system is ready to work with.

Also, for the OP have you changed any GPIO pin settings for boot options? Other posts indicate that you really don’t want to change those from the default settings.

I heard you can get away with not touching the switches if you take out the sdcard, it will automatically go to xmodem upload mode. THAT’S THE FALLBACK STATE BEHAVIOUR. It’s not the primary behaviour for the switch settings though.

That said, the official docs state to go directly into xmodem upload mode and in order to upload the recovery bin, you need to do the switches set to 1,1. That’s what the official docs say along with stating to set it back to the default 0, 0 settings updating the recovery binary and firmware updates.

Michael Zhu from Starfive posted all the pics and instructions and also mentioned setting the switches to 1,1 and returning them back to 0,0 afterwards as well.

1 Like

What do I do if I get the message:

u-boot-spl.bin.normal.out won't fit into /dev/mtd0!

Can you post the output of cat /proc/mtd and specify which u-boot-spl.bin.normal.out you are trying to flash?

I was trying to flash the files from the 202303 release, but I just tried again with the 202302 release and those flash fine.

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00020000 00001000 "spl"
mtd1: 00300000 00001000 "uboot"
mtd2: 00100000 00001000 "data"

You need newer image since newer dts modified mtd patition layout.

Why can’t we just set the pins to 0, 1 and have the firmware be loaded from SD?

Also why can’t StarFive make a distro release that fixes all firmware problems automatically upon first boot?

1st problem doesn’t exist in newer images. But if you want to boot through nvme drive, newer qspi firmware is still needed.

1 Like