Unlocking New Possibilities: StarFive VisionFive 2 SBC Now Supports TianoCore EDK II (UEFI)

I am trying to get EDK2 to boot from an SD card, /dev/sda . I set up the card as described from the wiki with partitions as follows:
/dev/sd1|4096|8191|4096|2M|HiFive BBL|
/dev/sd
2|8192|40959|32769|16M|HiFive FSBL|
/dev/sd3|40960|245760|204800|100M|EFI System|
I copied the files to the partitions as follows
sudo dd if=u-boot-spl.bin.normal.out of=/dev/sd
1 bs=4096 oflag=direct
sudo dd if=JH7110.fd of=/dev/sd2 bs=4096 oflag=direct
sudo dd if=linux.iso of=/dev/sd
3 bs=4096 oflag=direct
However when I try to boot the sdcard, I get no response. the boot mode is set according to the wiki. Any suggestion?

When you say no response, do you mean the green LED next to the red power LED does not begin to flash?

Have you tried hooking up a USB-TTL-serial cable to the GPIO pins? That’s how you get messages from the early stages of the boot process before Linux is given control.

With the VF2 board facing you so “StarFive” is readable, Dip switch 1, top, is to the right and 2 is to the left for SDcard? That works on my version 1.2A VF2 board.

The green led doesn’t flash and I get nothing on the minicom terminal connected to the VF2 GPIO pins. I even switched the TX and RX pins and still got nothing. the boot mode switches are the same as when I boot 2102306 from a sdcard.

Do you see messages on the minicom terminal when you successfully boot 2102306?

If no - I’d want to check things related to that like the settings on the minicom, whether you have a ground connection, etc. And get that working prior to trying the EDK2 boot.

If yes - I’m stumped as to what to look at next.

No I don’t get messages on minicom when I successfully boot 202306. the red and green led’s on the USB-TTY board blink. my minicom settings are /dev/ttyUSB0, 115200 8N1, no lockfile location,
Modem and dialing parameters A-H are blank. I verified the /dev/ttyUSB0 with dmesg | grep tty
I have photos of the USB-TTY board and the VF2 pin connections (6,8,10).

Well @kengreen I think it would be worthwhile pursuing those messages for a good boot, because you should get them and once you do I think they could yield a clue on the failed boot.

Your settings seem right to me. I have some suggestions but they’re rather in the realm of “grasping at straws”:

  • Try a different terminal emulator-or even a whole different system if you have one, maybe putty (which is what’s used as an example in the “VisionFive 2 Single Board Computer Quick Start Guide Version 1.1 Date 2022-12-27 Doc ID VisionFive2-QSGEN-001” or TeraTerm on a Windows machine. Page 29 of the guide has some example output.

  • If you are hardware inclined and have a scope verify the signal coming out of the TX pin on the VF2 board.

OK - can we see them?

And may the force be with you.

I got minicom to work with booting 202306. I had to write udev rules.d for the serial port. When I try to boot the EDK2 I get output that ends with
Run /init as init process
/bin/sh can’t access tty: job control turned off
mipi_0p9 disabling

1 Like

Interesting - that maybe suggests an issue with display, but I don’t know how to pursue from here.

I wonder if the uboot_spl_patch was applied to the u-boot-spl.bin.normal.out supplied in the pre-built binaries in the OP?

This is interesting. What does this patch do?

I am curious as both UEFI and u-boot run after / depend on SBI, which happens after SPL. No runtime from SPL is available to the next stages. What is different in the setup, then?

Does Grub2 support in EDK2 is added ? I don’t see any repo in visionfive2 for grub.

Hi kengreen,

Yes, the uboot_spl_patch has been applied to the u-boot-spl.bin.normal.out pre-built binary.
Please note that " JH7110 VF2 APR 2023" and “JH7110 VF2 JUNE 2023” patches are different.

Regards,
John

Hi rvalles,

The purpose of this patch is to adjust the image size for loading. U-Boot and UEFI images have different sizes, and the patch ensures that the correct image size is set for loading.

Regards,
John

Hi prashanthv85,

Just wanted to give you an update that we haven’t added support for Grub2 into our EDK2 yet. It’s something we plan to work on soon.

Regards,
John

5 Likes

I am trying to boot EDK2 from SD card (/dev/sde), I followed 2 methods of flashing images into SD card with the help of wiki reference manual.

  1. flash sdcard.img(downloaded from starfive-tech git repo) to the SD card using balenaEtcher and it is booting fine.
  2. create partition manually and flash images into each partition.
    /dev/sde1|4096|8191|4096|2M|HiFive BBL|
    /dev/sde2|8192|40959|32769|16M|HiFive FSBL|
    /dev/sde3|40960|245760|204800|100M|EFI System|
    I copied the files to the partitions as follows
    sudo dd if=u-boot-spl.bin.normal.out of=/dev/sde1 bs=4096 oflag=direct
    sudo dd if=JH7110.fd of=/dev/sde2 bs=4096 oflag=direct
    sudo dd if=linux.iso of=/dev/sde3 bs=4096 oflag=direct

Is there any way to create a custom sdcard.img with the images (u-boot, EDK2 and linux.iso) which is customized from source?

Hi jinton,

After you replace the partition with your custom image you can create sdcard.img using the following command:

sudo dd if=/dev/sdX of=<your_folder_path>/sdcard.img bs=1M --progress

sdX - You may replace it with ‘sde’ for your case.

Regards,
John

1 Like

Hi Johnchewyy,

I am able to create a sdcard with the below dd command.

sudo dd if=/dev/sdX of=<your_folder_path>/sdcard.img bs=1M  status=progress

I am using 32GB SD card and created below 3 partitions.
/dev/sde1|4096|8191|4096|2M|HiFive BBL|
/dev/sde2|8192|40959|32769|16M|HiFive FSBL|
/dev/sde3|40960|245760|204800|100M|EFI System|

sdcard.img is created with 30 GB (equal to sd card size) by using the below command but this is huge and taking long time to create and flash.
I could see sdcard.img size is 121 MB which is downloaded from starfive-tech repo.

sudo dd if=/dev/sdX of=<your_folder_path>/sdcard.img bs=1M status=progress

Any suggestions?

Hi jinton:

You can create sdcard.img with the following command:

sudo dd if=/dev/zero of=sdcard.img bs=1M count=121
sudo sgdisk -g --clear --new=1:4096:8191: --typecode=1:2e54b353-1271-4842-806f-e436d6af6985 --new=2:8192:40959: --typecode=2:5b193300-fc78-40cd-8002-e86c45580b47 --new=3:40960:-1M: -t 3:EF00 sdcard.img

Mount and view the partitions created as follows:

sudo losetup --partscan --find --show sdcard.img | sudo tee losetup-name
sudo fdisk -l

Flash your custom images according to the command below:

sudo dd if=u-boot-spl.bin.normal.out of=/dev/loopXp1 bs=4096 oflag=direct
sudo dd if=JH7110.fd of=/dev/loopXp2 bs=4096 oflag=direct
sudo dd if=linux.iso of=/dev/loopXp3 bs=4096 oflag=direct

I hope this fulfills what you are aiming to achieve. :smile:

Regards,
John

3 Likes

Excuse probably stupid question from uninitiated. I just booted Ubuntu 23.04 server image, which is provided by Canonical. It uses EFI and Grub in a very similar way how Ubuntu on amd64 works. Granted it does not currently supports SSD or USB boot but I imagine it maybe coming. And it actually supports both as long you do not boot from them. Is Canonical code to achieve this proprietary, and if not why not to try it?

Thanks @johnchewyy!
I followed the given steps, I am able to create sdcard image with the custom files.

1 Like