I managed to boot kernel directly from nvme ssd in VF2. Here is the steps for anyone trying to do the same.
Note: These are some bleeding edge stuff and can potentially brick your VF2. You have been warned.
Step-1: Get the latest sdcard.img file from here. after booting this new sdcard.img, we need to update the bootloader in QSPI Flash.
Step-2: Update the QSPI Flash bootloader.
Either scp or use wget to download the required bootloader files into the running system.
wget https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.11.5/u-boot-spl.bin.normal.out
wget https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v2.11.5/visionfive2_fw_payload.img
Now using the flashcp command we will burn these files into the QSPI Fash
flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v visionfive2_fw_payload.img /dev/mtd1
Step-3: Prepare NVME SSD with VF2 Debian Image. For this step I just followed a very good blog post by James A. Chambers StarFive VisionFive 2 Official Debian SSD Boot Guide
We don’t need to following the complete blog post. just the parts where he copied the debian to nvme SSD.
Step-4: Make sure the boot mode is set to QSPI Flash. Remove the microSD card an power up the board. we are looking for the u-boot prompt.
For some unknown reason interrupting the u-boot at Hit any key to stop autoboot: results into PCI device not getting detected. One workaround is to let u-boot fall back to the prompt due to not having a valid boot configuration.
Step-5: look for a PCI device using the pci command.
Ones we have a PCI device detected, we can try for scan for a nvme device by using the nvme scan command.
Now we will check the partitions on this nvme SSD by using the nvme part command.
I know that its the 2nd partition that have kernel image and DTB for our board. we will check this files using the fatls command.
Setp-6: We now have all thing required to boot linux from nvme SSD. Execute the following command in sequence.
fatload nvme 0:2 ${kernel_addr_r} /boot/vmlinuz-5.15.0-starfive
fatload nvme 0:2 ${ramdisk_addr_r} /boot/initrd.img-5.15.0-starfive
fatload nvme 0:2 ${fdt_addr_r} /boot/dtbs/starfive/jh7110-visionfive-v2.dtb
setenv bootargs 'root=/dev/nvme0n1p3 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0'
setenv kernel_comp_addr_r 0x50000000
setenv kernel_comp_size 0x04000000
booti $kernel_addr_r $ramdisk_addr_r:$filesize $fdt_addr_r
This will let you boot the kernel.
Note: Make sure to have nothing connected to the board other then power and serial port. I found my kernel panic when HDMI cable is plugged in.