U-Boot broken?

I tried to boot a native debian image from a nvme disk. Before I’ve updated SPL and U-Boot to the latest version. But I was not able to boot debian directly from the nvme. Even worse: when I’ve updated the SPL and U-Boot (version v5.13.1) on the debian SD card this won’t boot anymore also.

Then I’ve seen this message: Specific image does not boot after SPL and U-Boot update to v3.8.2 · Issue #87 · starfive-tech/VisionFive2 · GitHub

Looks like the partition order is hard coded to U-Boot? The only system I can boot without any problems is @andrew Gentoo image which has this geometry:

Device            Start       End   Sectors   Size Type
/dev/nvme0n1p1     2048      6143      4096     2M HiFive BBL
/dev/nvme0n1p2     6144     14335      8192     4M HiFive FSBL
/dev/nvme0n1p3    14336    219135    204800   100M EFI System
/dev/nvme0n1p4   219136  16996351  16777216     8G Linux swap
/dev/nvme0n1p5 16996352 976773119 959776768 457.7G Linux filesystem

Can someone approve, that the third partition MUST be a vfat with the /boot stuff?

Here is the layout of the latest Debian image

fdisk -l starfive-jh7110-202405-SD-minimal-desktop-wayland.img
Disk starfive-jh7110-202405-SD-minimal-desktop-wayland.img: 3.91 GiB, 4194304000 bytes, 8192000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C0EE9D8A-2FE7-435A-9DFC-2BBA376C2E46

Device                                                  Start     End Sectors  Size Type
starfive-jh7110-202405-SD-minimal-desktop-wayland.img1   4096    8191    4096    2M HiFi
starfive-jh7110-202405-SD-minimal-desktop-wayland.img2   8192   16383    8192    4M HiFi
starfive-jh7110-202405-SD-minimal-desktop-wayland.img3  16384  221183  204800  100M EFI 
starfive-jh7110-202405-SD-minimal-desktop-wayland.img4 221184 8189918 7968735  3.8G Linu

The third Partition is the EFI Partition which is FAT Based.

The nvme version has the same layout
fdisk -l starfive-jh7110-202409-nvme-minimal-desktop-wayland.img
Disk starfive-jh7110-202409-nvme-minimal-desktop-wayland.img: 3.91 GiB, 4194304000 bytes, 8192000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 807C3CAC-74CD-4F35-A4B1-B46574E22FA5

Device Start End Sectors Size Type
starfive-jh7110-202409-nvme-minimal-desktop-wayland.img1 4096 8191 4096 2M HiFi
starfive-jh7110-202409-nvme-minimal-desktop-wayland.img2 8192 16383 8192 4M HiFi
starfive-jh7110-202409-nvme-minimal-desktop-wayland.img3 16384 221183 204800 100M EFI
starfive-jh7110-202409-nvme-minimal-desktop-wayland.img4 221184 8189918 7968735 3.8G Linu

I’ve now written the image starfive-jh7110-202409-nvme-minimal-desktop-wayland.img with dd to a nvme disk and removed the SD card.

When the boot switches on the board are in SD mode I get this error message:

dwmci_s: Response Timeout.
dwmci_s: Response Timeout.
BOOT fail,Error is 0xffffffff

With the boot switches in Flash mode I get this:

U-Boot SPL 2021.10 (Sep 28 2024 - 01:14:56 +0800)
LPDDR4: 8G version: g8ad50857.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|___/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : ---
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Platform Suspend Device   : ---
Firmware Base             : 0x40000000
Firmware Size             : 392 KB
Firmware RW Offset        : 0x40000
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01          : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02          : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03          : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes
Domain0 SysSuspend        : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Sep 28 2024 - 01:14:56 +0800), Build: jenkins-github_visionfive2_6.6-5

CPU:   rv64imacu_zba_zbb
Model: StarFive VisionFive V2
DRAM:  8 GiB
MMC:   sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110B1-2253-D008E000-00005754
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:5f:f0
Ethernet MAC1 address: 6c:cf:39:00:5f:f3
--------EEPROM INFO--------

In:    serial
Out:   serial
Err:   serial
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
starting USB...
No working controllers found
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
starting USB...
No working controllers found
USB is stopped. Please issue 'usb start' first.
starfive_pcie pcie@2B000000: Port link up.
starfive_pcie pcie@2B000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
starfive_pcie pcie@2C000000: Port link up.
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10

Device 1: unknown device
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

I’m very sorry to ask this odd “the board does not boot from nvme” question again as it has been disussed here so often. But I was not able to find a straight forward and usable documentation how to get this damn U-Boot to boot from the nvme disk.

Could it be, that my U-Boot env is corrupted? The nvme is a Crucial P3 Plus 1TB disk. The same 500GB variant does boot just fine on another VisionFive2 board with Gentoo Linux. As it is executing my Home Assistant instance I don’t want to get it out of my working environment to test it in this non working board.

Power could not be an issue. The USB-C connection has plenty of power.

Here some more informations from the SPI console:

StarFive # pci
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
00.00.00   0x1556     0x1111     Bridge device           0x04
StarFive # nvme device

IDE device 0: Vendor: 0x1344 Rev: P9CR413  Prod: 241247C5D913        
            Type: Hard Disk
            Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
StarFive # nvme detail 
Blk device 0: Optional Admin Command Support:
        Namespace Management/Attachment: no
        Firmware Commit/Image download: yes
        Format NVM: yes
        Security Send/Receive: yes
Blk device 0: Optional NVM Command Support:
        Reservation: yes
        Save/Select field in the Set/Get features: no
        Write Zeroes: yes
        Dataset Management: yes
        Write Uncorrectable: yes
Blk device 0: Format NVM Attributes:
        Support Cryptographic Erase: No
        Support erase a particular namespace: Yes
        Support format a particular namespace: Yes
Blk device 0: LBA Format Support:
        LBA Foramt 0 Support: (current)
                Metadata Size: 0
                LBA Data Size: 512
                Relative Performance: Better
Blk device 0: End-to-End DataProtect Capabilities:
        As last eight bytes: No
        As first eight bytes: No
        Support Type3: No
        Support Type2: No
        Support Type1: No
Blk device 0: Metadata capabilities:
        As part of a separate buffer: No
        As part of an extended data LBA: No
StarFive # nvme part

Partition Map for NVMe device 0  --   Partition Type: EFI

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00001000      0x00001fff      ""
        attrs:  0x0000000000000000
        type:   2e54b353-1271-4842-806f-e436d6af6985
        guid:   ecea2689-2ecf-433b-9ddb-67613400f779
  2     0x00002000      0x00003fff      ""
        attrs:  0x0000000000000000
        type:   5b193300-fc78-40cd-8002-e86c45580b47
        guid:   a010bbc0-b573-432d-a11a-57a2ac647f0a
  3     0x00004000      0x00035fff      ""
        attrs:  0x0000000000000000
        type:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
        type:   system
        guid:   c00fcbd2-e8d6-4c21-ba35-30fb815967d9
  4     0x00036000      0x747067ff      ""
        attrs:  0x0000000000000000
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
        type:   linux
        guid:   e2a4e09f-2dfb-421e-89aa-82c928d4b6b3

As I’m exited to get the official Debian port to boot from the nvme any help would be very welcome! :slight_smile:

Okay, after

env default -a -
env save

I can boot with the boot mode switches set to “Flash” from the nvme! :slight_smile:

1 Like

NVME gets booted from flash. Do some homework on how uboot works. fail to boot should leave you at the uboot prompt, from there you can do some script or command line magic to get anything booting, steep learning curve, RTFM.

1 Like