riscvarchive / riscv-edk2

Port of EDK2 implementation of UEFI to RISC-V. See documentation at:
https://github.com/riscv/riscv-uefi-edk2-docs
Other
22 stars 10 forks source link

Where is Riscv64VirtPkg? #2

Closed kallisti5 closed 3 years ago

kallisti5 commented 4 years ago

I've been rummaging through edk2 sources, but just can't locate where the latest RISCV64 qemu / virt code is.

Found this repo with activity.

But, I don't see a Riscv64VirtPkg... so unsure.

Are there any docs on building the edk2 Tianocore EFI bios for qemu-system-riscv64? I have Haiku's EFI bootloader building for RISCV64, but nothing to test it on :-)

https://download.haiku-os.org/nightly-images/riscv64

JohnAZoidberg commented 4 years ago

There's no Riscv64VirtPkg yet. I'm currently trying to create that. If what you want is the equivalent of OVMF.

However, QEMU also has a machine type that emulates the HifiveUnleashed platform (U540). So you can build the firmware image for the U540 and use it with QEMU. The only problem is that QEMU does not have the SD card interface of the U540 implemented, so you will not have an disk. Check this out to see how I managed to run Linux on it: https://github.com/JohnAZoidberg/riscv-edk2-docker

JohnAZoidberg commented 4 years ago

Uboot also supports EFI booting by the way ;)

kallisti5 commented 4 years ago

ack! I was kind of hoping to avoid the per-SoC u-boot like arm suffers from :-) definitely working though.. you know how to get a virtio block device picked up from qemu?

qemu-system-riscv64 -bios riscv64/qemu/u-boot.bin -M virt -device virtio-scsi-pci -drive file=~/Code/haiku/generated.riscv64/haiku-mmc.image,if=none,id=hd0 -m 2048
U-Boot 2020.10-rc3 (Aug 27 2020 - 08:30:57 -0500)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  2 GiB
In:    uart@10000000
Out:   uart@10000000
Err:   uart@10000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 

Device 0: unknown device
No ethernet found.
No ethernet found.
=> virtio scan
=> ls virtio 0
=> 
kallisti5 commented 4 years ago

Nevermind! Slight adjustment, and things looking a bit better :-)

qemu-system-riscv64 -bios riscv64/qemu/u-boot.bin -M virt -device virtio-blk-device,drive=hd -drive file=~/Code/haiku/generated.riscv64/haiku-mmc.image,format=raw,id=hd -m 2048
U-Boot 2020.10-rc3 (Aug 27 2020 - 08:30:57 -0500)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  2 GiB
In:    uart@10000000
Out:   uart@10000000
Err:   uart@10000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 

Device 0: QEMU VirtIO Block Device
            Type: Hard Disk
            Capacity: 428.0 MB = 0.4 GB (876544 x 512)
... is now current device
Scanning virtio 0:1...
** Unable to read file / **
Failed to load '/'
Found EFI removable media binary efi/boot/bootriscv64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk virtio-blk#0...
Found 2 disks
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
595112 bytes read in 4 ms (141.9 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Unhandled exception: Store/AMO access fault
EPC: 00000000fe6d5ca0 RA: 00000000fe6d5c94 TVAL: 0000000000000000
EPC: 000000007e768ca0 RA: 000000007e768c94 reloc adjusted

UEFI image [0x00000000fe6d5000:0x00000000fe7344bf] pc=0xca0 '/efi\boot\bootriscv64.efi'
### ERROR ### Please RESET the board ###
JohnAZoidberg commented 3 years ago

See progress at riscv/riscv-edk2-platforms#7. I'd appreciate if you could try it with Haiku and let me know if it works or how it fails, @kallisti5.

I'll close this here, since the platform will likely go into edk2-platforms. We eventually will try to get it into edk2 like OvmfPkg and ArmVirtPkg but upstream said it needs to be more mature first.