Boot from eMMC or NVME? Existing Doubts

I now boot into my Debian under DIP QSPI mode.

  1. Due to https://rvspace.org/en/project/VisionFive2_Debian_User_Guide, original word: Tip: : The application value is 0 or 1. 1 for SD card and 0 for eMMC..

However, I don’t even have such case when X equals to 0, look:

➜  ~ sudo fdisk /dev/mmcblk0
[sudo] password for user: 

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/mmcblk0: No such file or directory

What can I do ? How can I communicate with my mmcblk0.

  1. flashcp to which one? or both mtd1 and mtd2?

flashcp -v visionfive2_fw_payload.img /dev/mtd1

The reason why? I’ve got both uboot-env and uboot.

➜  ~ cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00001000 "spl"
mtd1: 00010000 00001000 "uboot-env"
mtd2: 00300000 00001000 "uboot"
mtd3: 00100000 00001000 "data"
  1. Wondering if it’s possible to have dual boot or triple boot?

Is it possible to choose booting from

  • eMMC
  • SD Card
  • NVME?

I noticed https://forum.rvspace.org/t/nvme-boot-using-visionfive2-software-v2-11-5/2464, this issue actually took out the SD card and had NVME inserted only.

It looks we can’t have both at the same time?

  1. Since I booted into Debian with SD card already, can I flash the OS into NVME or eMMC directly from my current Debian 202310 booted from SD Card ??

  2. By the way, where is a standard visionfive_defconfig to use directly? So, that we can target at StarFive CPU and Imagination GPU, and without any further customized configuration???



Thank you very much.
1 Like

1.if you insert eMMC it will have /dev/mmcblk0 maybe you can try fdisk -l to show what device you have
2.flashcp to /dev/mtd2
Updating SPL and U-Boot of Flash (rvspace.org)
3.it could not choose. under the QSPI mode,the startup sequence is SD,eMMC and nvme
4.the sdcard OS could not flash to eMMC or nvme,they have their own OS
VisionFive 2 Debian Wiki - 202310 Release | RVspace
5.i dont know about this,maybe this link can help you
RVspace All-in-One User Experience Center | RVspace

1 Like

As long as you keep it in the same kernel major version, you can boot different OSes from NVME and/or SD. Just set to QSPI-Flash (0,0 on RPIO). Partitions 1-3 are the same as with one OS. Part4 then has OS1, Part5 has OS2 etc.
Just add entries to /boot/extlinux/extlinux.conf and you have two possibilities to choose which OS to boot:

  1. change default entry in extlinux.conf and then reboot
  2. have an USB2Serial attached and select via keyboard.

Important: kernel image and initial ramdisk must have different names between the OSes.
If you switch the system off while in this configuration and insert an SD, it boots from that one.

2 Likes

@kira

Thank you very much…

@Nightwulf

Thank you very much as well. Now, I’m able to have both successfully boot. However, as you suggested, I’ll have to manually edit that particular file under /boot, which is … Hmmm… I think this is quite similar to grub, which is now under my SD card.

One additional question, I can tell a noticable speed drop by changing fromSD to nvme. This is really out of my expectation.

Anyway, now it’s the time to build the system from source/scratch.

1 Like

Well, NVME is not at speeds it would be on a x86 motherboard but for me it’s at ~200 MB/s whereas the SD is at 25-30 MB/s. Perhaps there is some kind of an issue of this particular PCIe controller of the VF2 and your NVME?

Grub has the same issue…at that time it is run, there is no HDMI and keyboard. So USB2Serial is needed anyway.

Let me answer my own question:

visionfive_defconfig

I don’t understand how to flash to my nvme drive? Do I use the nvme command write to write the 202310 image to /dev/nmve0n1 or write the Linux file system to /dev/nvme0n1p4? I am using QSPI boot mode.

Hello kengreen,

Ensure you flashcp’ed the usual latest culprits to the sbc first.

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

apt-get install mtd-utils
cat /proc/mtd
flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
sync
flashcp -v visionfive2_fw_payload.img /dev/mtd1
sync

Ensure the SBC’s boot dip switches are at their default manufacturer settings.

Do a manufacturer wipe of the nvme to ensure it truly is wiped. It helps ensure a smooth running of the new img on a used nvme. Ensure no mountpoints are mounted on that nvme beforehand.
Dd the img to the nvme from any intel linux box. Ensure no mountpoints are mounted on that nvme beforehand.
Use gparted on the nvme to 1) fix the table (click yes) and 2) resize the last(root) partition to take up all the remaining capacity of the drive (right-click “btrfs root” and click “resize”).

I’m assuming you are root:

umount /run/media/cissy/root 
wipefs --all /dev/sda
dd bs=4M conv=fsync if=./starfive-jh7110-VF2-515-3.8.2-nvme-minimal-desktop-wayland.img of=/dev/sda
gparted /dev/sda

Finally, install the nvme on the SBC and take out your sdcard. Power up, it should just magically boot to the nvme. The default boot order is to boot from the sdcard, if it’s not there then try the nvme if it’s there.

So I have to remove the nvme drive from the VF2 and mount it on a USB M,2 NMVE enclosure to dd the starfive-jh7110-VF2-515-3.8.2-nvme-minimal-desktop-wayland.img to /dev/nvme0n1? Can I just unmount the nvme and dd it from the VF2 directly to the nvme?

before doing that, do the other stuff I mentioned.
also use gparted on the nvme to fix the table and resize the last(root) partition to take up all the remaining capacity of the drive.

It is best you take out the nvme. Please use gparted which is a gui much easier to deal with the nvme with. Yes there is an equivalent command to resize the nvme btrfs partition, but I honestly don’t want to crack my head trying to recall that. If you run gparted with your nvme, it will show you in its detailed entirety what cli command it ran to do it when you expand its treeview displaying its output. I hope this helps.

if you want to dd from the vf2 directly, you can boot from sdcard that flashed SDK and then you can mount nfs where have your starfive-jh7110-VF2-515-3.8.2-nvme-minimal-desktop-wayland.img, finally, use command
dd if=***.img of=/dev/nvme0n1 bs=4096 && sync

1 Like