starfive-tech / VisionFive2

438 stars 78 forks source link

Boot from USB is broken with "upstream" u-boot (2023.10-rc4+) #80

Closed misuzu closed 8 months ago

misuzu commented 10 months ago

u-boot is crashing when a (single) USB drive is connected to the VF2 board:

U-Boot SPL 2023.10-rc4 (Jan 01 1980 - 00:00:00 +0000)
DDR version: dc2e84f0.
Trying to boot from MMC2

U-Boot 2023.10-rc4 (Jan 01 1980 - 00:00:00 +0000)

CPU:   rv64imafdc_zba_zbb
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB
Core:  130 devices, 24 uclasses, devicetree: board
MMC:   mmc@16010000: 0, mmc@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-00002367
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:34:47
Ethernet MAC1 address: 6c:cf:39:00:34:48
--------EEPROM INFO--------

starfive_7110_pcie pcie@2b000000: Starfive PCIe bus probed.
starfive_7110_pcie pcie@2c000000: Starfive PCIe bus probed.
In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... Adding disk for usb_mass_storage.lun0 failed (err=-9223372036854775788/0x8000000000000014)
device 'usb_mass_storage.lun0' failed to unbind
3 USB Device(s) found
device 'usb_mass_storage.lun0' failed to unbind
       scanning usb for storage devices... 2 Storage Device(s) found
Working FDT set to ff7319d0
Hit any key to stop autoboot:  0
Unhandled exception: Load access fault
EPC: 00000000fff690ee RA: 00000000fff617f2 TVAL: 0000000000000029
EPC: 000000004021f0ee RA: 00000000402177f2 reloc adjusted

Code: 00c8 6614 9af1 6be3 fed7 3803 0186 bf69 (6514)

resetting ...
reset not supported yet
### ERROR ### Please RESET the board ###

I'm using upstream u-boot with this small patch to make it possible to boot from USB out of the box.

mangelajo commented 10 months ago

ohhh I will be watching this, I am looking forward to use vf2 with github.com/redhat-et/jumpstarter https://github.com/redhat-et/jumpstarter-board

misuzu commented 8 months ago

It works now with https://github.com/u-boot/u-boot/commit/9a3a58396b78b1f9d0c14580dc03f81d29207dd2 (https://github.com/misuzu/u-boot/commit/0489a089f5345b6726c7e6681fff93195258854c)

U-Boot SPL 2023.10 (Jan 01 1980 - 00:00:00 +0000)
DDR version: dc2e84f0.
Trying to boot from MMC2

U-Boot 2023.10 (Jan 01 1980 - 00:00:00 +0000)

CPU:   rv64imafdc_zba_zbb
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB
Core:  130 devices, 24 uclasses, devicetree: board
MMC:   mmc@16010000: 0, mmc@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-00002367
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:34:47
Ethernet MAC1 address: 6c:cf:39:00:34:48
--------EEPROM INFO--------

starfive_7110_pcie pcie@2b000000: Starfive PCIe bus probed.
starfive_7110_pcie pcie@2c000000: Starfive PCIe bus probed.
In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Working FDT set to ff72f9c0
Hit any key to stop autoboot:  0

Device 0: Vendor:          Rev: PMAP Prod: USB FLASH DRIVE
            Type: Removable Hard Disk
            Capacity: 1912.0 MB = 1.8 GB (3915776 x 512)
... is now current device
Scanning usb 0:1...
Card did not respond to voltage select! : -110
BootOrder not defined
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootriscv64.efi
82569 bytes read in 5 ms (15.7 MiB/s)
Booting /efi\boot\bootriscv64.efi
mangelajo commented 8 months ago

@misuzu can we keep it open until we get it in the stock vision five 2 u boot binary?

mangelajo commented 8 months ago

And 👏

mangelajo commented 8 months ago

Also, could you share the binary on this thread?

misuzu commented 8 months ago

@misuzu can we keep it open until we get it in the stock vision five 2 u boot binary?

There's already https://github.com/starfive-tech/VisionFive2/issues/64 for vendor u-boot, this issue is about upstream u-boot

Also, could you share the binary on this thread?

You can build it using nix:

  1. Install nix curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  2. Build u-boot sudo nix build --accept-flake-config github:misuzu/nixos-vf2#firmware-vf2-upstream

The firmware files will be linked to result in the current directory

mangelajo commented 8 months ago

What env script did you use to boot from usb? I saw that the latest uboot published for the vf2 has support for usb, but it doesn't seem to boot from it.

misuzu commented 8 months ago

What env script did you use to boot from usb?

I don't use vendor u-boot. Upstream u-boot should work with default configuration if an extlinux.conf or an efi binary is provided in the expected place