Closed eliaskousk closed 4 years ago
For the build issue, we didn't try toolchain 10.1 though. The one we use for RISC-V edk2 is v9.2 as you pointed out. Do you install those prerequisites mentioned here https://github.com/riscv/riscv-gnu-toolchai?
For the boot fail, could you also specify -cpu sifive-u54 -smp cpus=5,maxcpus=5 to qemu-system-riscv64? BTW, the QEMU I am using is v4.1.50. that would be bad if later QEMU version or toolchain leads to the boot errors you met and we will have to figure it out.
The v9.2 toolchain archive provided for CI requires libmpfr v4 from Ubuntu 16.04 and I have Ubuntu 18.04 which has libmpfr v6. So I installed libmpfr v4 and the firmware build completed fine.
However, I still get the exact same hang when trying to load PeiMain.
(BTW I initially thought that libmpfr was needed as a library on the toolchain and not on the host that runs that toolchain, sorry for the confusion.)
I tried adding the above -cpu
and -smp
options and the result is the same and I get the same hang.
Qemu versions I've tried:
v4.1.1 complained if I put cpus=5
in -smp
(max allowed = 4). Regardless of that, whatever number I tried didn't boot at all.
I can't find anywhere Qemu v.4.1.50. Maybe it's from a package of a Linux distro?
Maybe you can provide me with a U540.fd binary that works for you so that I can try it? If it works for me as well it will at least verify that Qemu v.5.0 or v4.2 is not the issue here.
Thank you, Elias
Binary is sent by email to you. and the QEMU I am using seems old (last Oct), which is commit ID e9d42461920f6f40f4d847a5ba18e90d095ed0b9.
Let me know that binary works or not. Thanks.
Thank you Abner, I tested and the hang remains.
So probably the FW is not the issue and I will concentrate on Qemu, testing with the commit you mention above later today.
Best, Elias
Tested Qemu 4.1.50 e9d42461920f6f40f4d847a5ba18e90d095ed0b9 and the hang persists.
Something weird is going on!
For whoever looks this in the future, I used Qemu commandline options that Abner sent me and the issue was solved.
The important option was by giving more RAM memory to Qemu. The default 512MB is not enough and thus at least -m 1024
is needed in Qemu's commandline to boot without a hang.
qemu-system-riscv64 -machine sifive_u -m 1024 -bios ./U540.fd -nographic
Adding -cpu=sifive-u54 -smp cpus=5,maxcpus=5
is optional and I think these are set by default by Qemu when setting -machine sifive_u
All Qemu versions (4.1.50, 4.2.0, 5.0.0, 5.0.50) work fine when memory is 1024 or above.
The same is true for RISC-V Toolchain. Both 9.2 and 10.1 firmware builds work fine after setting the correct memory.
Thanks, Elias
P.S Now let's inverstigate why less than 1024MB is not enough!
Thank Elias for verifying this. I will add this information to the document under https://github.com/riscv/riscv-uefi-edk2-docs.
Thank Elias for verifying this. I will add this information to the document under https://github.com/riscv/riscv-uefi-edk2-docs.
Done. Add QEMU section on https://github.com/riscv/riscv-uefi-edk2-docs/blob/master/README.md
Hi,
I'm trying to boot the produced U540.fd on Qemu 5.0.0 but it hangs while trying to load PeiMain.
I'm using riscv-edk2 main branch (ca407c7) and riscv-edk2-platforms staging branch (1b9a7ba) on Ubuntu 18.04 with latest RISCV toolchain (10.1 256a410).
Could the issue be the toolchain? I can't use provided 9.2 for CI though (see below).
Any help on figuring this out will be great, thank you!
My build steps:
Qemu console output
It hangs when trying to load PeiMain module (52C05B14-0B98-496C-BC3B-04B50211D680):
I've also tried the provided v9.2 toolchain found here but cannot build the firmware with it due to the following error (the provided toolchain archive is missing libmpfr):
Moreover, I have also tried my own built v9.2 toolchain, where instead of hanging while trying to load PeiMain module, it enters an endless loop that continously boots the machine until the PeiMain module load. Each loop iteration starts from
FindAndReportEntryPoints: Entry
on the above log and ends onLoading PEIM 52C05B14-0B98-496C-BC3B-04B50211D680
.Best, Elias