QEMU's integrated OpenSBI supports writing to console, but the one I compiled doesn't

Programming, for all ages and all languages.
Post Reply
saraelsa
Posts: 2
Joined: Sat Nov 02, 2024 3:03 pm

QEMU's integrated OpenSBI supports writing to console, but the one I compiled doesn't

Post by saraelsa »

I built OpenSBI (main branch) on macOS arm64 using the following command:

Code: Select all

make LLVM=1 PLATFORM=GENERIC
The following two files it generates are of interest:
  • build/platform/generic/firmware/payloads/test.bin
  • build/platform/generic/firmware/fw_jump.bin
I can run the test.bin payload using the following command:

Code: Select all

qemu-system-riscv64 -nographic -M virt -smp 1 -m 512M -kernel ./build/platform/generic/firmware/payloads/test.elf
It outputs "Test payload running" and then goes into a low-power infinite loop.

However, I can't get it to work with the OpenSBI binary I just built. I tried the following command for that purpose:

Code: Select all

qemu-system-riscv64 -nographic -M virt -smp 1 -m 512M -bios ./build/platform/generic/firmware/fw_jump.bin -kernel ./build/platform/generic/firmware/payloads/test.bin
I confirmed with lldb that it does work—in that all expected breakpoints are hit and it eventually ends up in the infinite loop—but it doesn't generate the output string.

In both cases, I can see OpenSBI's output printed.

What could the problem be?
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: QEMU's integrated OpenSBI supports writing to console, but the one I compiled doesn't

Post by Octocontrabass »

saraelsa wrote: Sat Nov 02, 2024 3:13 pmOpenSBI (main branch)
Are you sure the main branch works? QEMU uses release versions of OpenSBI.
saraelsa wrote: Sat Nov 02, 2024 3:13 pm

Code: Select all

make LLVM=1 PLATFORM=GENERIC
Is it case-sensitive? Maybe it needs to be "PLATFORM=generic" to build correctly.
saraelsa wrote: Sat Nov 02, 2024 3:13 pmfw_jump.bin
Have you tried fw_dynamic.bin? It shouldn't make a difference, but that's the one QEMU uses.
saraelsa
Posts: 2
Joined: Sat Nov 02, 2024 3:03 pm

Re: QEMU's integrated OpenSBI supports writing to console, but the one I compiled doesn't

Post by saraelsa »

Octocontrabass wrote: Sun Nov 03, 2024 5:22 pm
saraelsa wrote: Sat Nov 02, 2024 3:13 pmOpenSBI (main branch)
Are you sure the main branch works? QEMU uses release versions of OpenSBI.
saraelsa wrote: Sat Nov 02, 2024 3:13 pm

Code: Select all

make LLVM=1 PLATFORM=GENERIC
Is it case-sensitive? Maybe it needs to be "PLATFORM=generic" to build correctly.
saraelsa wrote: Sat Nov 02, 2024 3:13 pmfw_jump.bin
Have you tried fw_dynamic.bin? It shouldn't make a difference, but that's the one QEMU uses.

I tried compiling with lowercase 'generic' from branch release-1.5.x and loading fw_dynamic.bin. I get the same result.

I should note that OpenSBI itself prints a lot of output. It's only the payload that isn't able to print anything.
Post Reply