How to boot OpenBSD from NVMe?

Hey, ive tried to install OpenBSD with this tutorial:

i suceeded to step 10. But i didn’t know how to boot from there, u-boot auto boots the install image from sd card, if i remove sd card it doesn’t work. Ive tried to install EDK2, it boots also the sd card but with errors:

User
Range:RISC-V unsupported function.
Failed to read data, mDwEmmcCommand:A0002351, mDwEmmcArgument:0, Status:Device Error
MmcIoBlocks(): Failed to transfer block and Status:Device Error
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
disks: sd0* sd1 sd2 sr0
>> OpenBSD/riscv64 BOOTRISCV64 1.5
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.
InvalidateDataCacheRange:RISC-V unsupported function.
WriteBackDataCacheRange:RISC-V unsupported function.

nvme boot, after sd card removed, also dont work in edk2.

ls

on FS0: (nvme) just says 0 dirs/0 files maybe because i installed openbsd without uefi? (I dont know really whats happening xD)

Ive tried to install openbsd again from edk2, and thought the errors are because of a missing .dtb file. So ive tried to add with

bcfg boot -opt "-dtb FS0:\visiofive2-v1.2a.dtb" 

but it always failed, edk2 dont knows what i mean with this argument :c (chatgpt’s idea)

i now switched back to u-boot (latest version) it doesnt boot and shows error: couldnt find partition nvme 0:3

Do u know how to come from here to boot?

Thank you :slight_smile:

output:

U-Boot SPL 2021.10 (Nov 29 2023 - 14:51:40 +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 (Nov 29 2023 - 14:51:40 +0800), Build: jenkins-github_visionfive2-20

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
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110A1-2249-D008E000-00000085
data version: 0x2
PCB revision: 0xa1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:1d:f5
Ethernet MAC1 address: 6c:cf:39:00:1d:f6
--------EEPROM INFO--------

In:    serial
Out:   serial
Err:   serial
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
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 0: Vendor: 0x1e4b Rev: SN11457  Prod: AA232520065         
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
... is now current device
Try booting from NVME0 ...
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
## Info: input data size = 16731 = 0x415B
## Error: "boot2" not defined

Device 0: Vendor: 0x1e4b Rev: SN11457  Prod: AA232520065         
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
... is now current device
Try booting from NVME0 ...
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
## Info: input data size = 16731 = 0x415B
## Error: "boot2" not defined
Tring booting distro ...
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110

Device 0: Vendor: 0x1e4b Rev: SN11457  Prod: AA232520065         
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
... is now current device
Try booting from NVME0 ...
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
## Warning: defaulting to text format
## Info: input data size = 16731 = 0x415B
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
** Invalid partition 3 **
Couldn't find partition nvme 0:3
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'
Retrieving file: /extlinux/extlinux.conf
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
Error reading config file

Device 0: Vendor: 0x1e4b Rev: SN11457  Prod: AA232520065         
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
... is now current device
Try booting from NVME0 ...
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
## Warning: defaulting to text format
## Info: input data size = 16731 = 0x415B
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
** Invalid partition 3 **
Couldn't find partition nvme 0:3
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'
Retrieving file: /extlinux/extlinux.conf
** Invalid partition 3 **
Couldn't find partition nvme 0:3
Can't set block device
Error reading config file
StarFive # 

Maybe this can help you:

1 Like

hey, yes seems to be the same problem! I finally managed to install openbsd on sdcard. I followed the instructions on github ive linked + i coped the efi directory from installer to sd card after installation + dtb file. then i booted like the installer :slight_smile: but nvme would be even better

It is basically the same. dd image to nvme and copy .dtb files to vendor directory. Load with command from my post (nvme instead of mmc).

yeah, i just plugged the nvme after install to my linux pc with a nvme to usb

then i copied the efi folder from mininstall img and the dtb file to the partition that appears in file manager :slight_smile:

and finally i can boot from nvme <3

load nvme 0:1 ${fdt_addr_r} jh7110-starfive-visionfive-2-v1.2a.dtb
load nvme 0:1 ${kernel_addr_r} efi/boot/bootriscv64.efi
bootefi ${kernel_addr_r} ${fdt_addr_r}

or automatic like in youre post:

env default -a -f
setenv distro_boot_env “echo Booting OpenBSD from NVME; load nvme 0:1 ${fdt_addr_r} jh7110-starfive-visionfive-2-v1.2a.dtb; load nvme 0:1 ${kernel_addr_r} efi/boot/bootriscv64.efi; bootefi ${kernel_addr_r} ${fdt_addr_r}”
saveenv
reset

thank you <33

1 Like

After installing the v3.9.3 u-boot in flash and env default -a -f then saveenv…

I also use the dtb file you mention, unfortunately it is pretty old and doesn’t match the flash0 partitions in the current u-boot. I have updated a few parts of the dtb

at u-boot prompt #StarFive
check these variables
setenv fdt_addr_r 0x48000000 WAS 0x46000000
setenv kernel_addr_r 0x44000000 WAS 0x40200000
setenv kernel_comp_addr_r 0x90000000 WAS 0x5a000000
setenv kernel_comp_size 0x10000000 WAS 0x4000000
setenv ramdisk_addr_r 0x48100000 WAS 0x46100000
setenv fdtfile starfive/jh7110-visionfive-v2.dtb
saveenv
setenv devnum 1
run mmc_boot
will boot microsd and run OpenBSD installation
after install, at u-boot prompt $StarFive
setenv devnum 0
run nvme_boot
will boot from nvme

Device 0: Vendor: 0x1e0f Rev: HP01AE00 Prod: 42CPC1KBQX74
Type: Hard Disk
Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
… is now current device
Scanning nvme 0:1…
28354 bytes read in 5 ms (5.4 MiB/s)
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
** Unable to read file ubootefi.var **
Failed to load EFI variables
Found EFI removable media binary efi/boot/bootriscv64.efi
152396 bytes read in 5 ms (29.1 MiB/s)
disks: sd0*

OpenBSD/riscv64 BOOTRISCV64 1.5
boot>

now a few changes to u-boot will get it automatic