Booting UEFI firmware (OVMF) in Bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Booting UEFI firmware (OVMF) in Bochs

Post by kzinti »

I've been trying to get Bochs to boot using a UEFI firmware (OVMF) with no success. All I get is a black screen (no crash) and no useful information in the logs. The internets are also very unhelpful here.

Any pointers as to whether or not this is possible and how to do it? I am not married to OVMF and would happily switch to another firmware that works with Bochs.

Note: the same disk image works fine under QEMU and real hardware (2 different PCs).
Note 2: not loading my disk image produces the same result. Bochs appears to be running firmware code and never displaying anything.

Code: Select all

# Bochs configuration file

# Firmware
romimage: file="./third_party/tianocore/ovmf-x64-r15214.fd"

ata0-master: type=disk, path="./build/x86_64/rainbow-uefi.img", mode=flat
boot: disk

mouse: enabled=1
megs: 2048

# Display
display_library: sdl, options="gui_debug"
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Booting UEFI firmware (OVMF) in Bochs

Post by klange »

kzinti wrote:I've been trying to get Bochs to boot using a UEFI firmware (OVMF) with no success.
There's no hidden trick you're missing. OVMF does not work in Bochs, end of story. It is written only to run in QEMU.

EFI support in Bochs remains an unanswered feature request to this day.
Last edited by klange on Mon Jan 14, 2019 1:40 am, edited 1 time in total.
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Booting UEFI firmware (OVMF) in Bochs

Post by stlw »

It is actually even worse than you think.
Bochs has only two active developers which do not and absolute lack of interest from the community - looks like everybody prefer to contribute QEMU.
We have no clue what even required to be done to support OVMF in Bochs :(
Would be glad if somebody would join and explain.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Booting UEFI firmware (OVMF) in Bochs

Post by kzinti »

OK thanks, I'll just have to add a BIOS bootloader and image then.
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: Booting UEFI firmware (OVMF) in Bochs

Post by BenLunt »

stlw wrote:It is actually even worse than you think.
Bochs has only two active developers which do not and absolute lack of interest from the community - looks like everybody prefer to contribute QEMU.
We have no clue what even required to be done to support OVMF in Bochs :(
Would be glad if somebody would join and explain.
There is quite a bit of work that would need to be done to Bochs to get it to work with both a Legacy BIOS and an UEFI firmware. Bochs was written for the Legacy type and had no idea there would be a new type of BIOS in later years.

Currently, the Bochs code initializes parts of the virtual machine before the BIOS is called and also relies upon certain aspects of a Legacy BIOS. To get it to work with UEFI, a number of changes would have to be done to both the main core of Bochs as well as the Legacy BIOS code to allow both types. This is a challenge that I don't think many wish the start, though I have looked into it myself and gave up after hours (and hours) of work.

It is and will be a massive re-write unfortunately.

However, I am not an active member of the Bochs team, so don't take my word for it. I have contributed to a lot of the code, including some BIOS modifications, but Stanislav and Volker are the ones to ask. I think Stanislav even roams these forums once in a while.

Ben
- http://www.fysnet.net/osdesign_book_series.htm
Octocontrabass
Member
Member
Posts: 5586
Joined: Mon Mar 25, 2013 7:01 pm

Re: Booting UEFI firmware (OVMF) in Bochs

Post by Octocontrabass »

To make OVMF work in Bochs, you need to configure at least 64MB of RAM and the PCI (not ISA) Cirrus SVGA adapter.

Also, make sure you didn't build OVMF with SMM support. Bochs doesn't emulate the correct chipset for that feature.

Bochs still makes some legacy hardware assumptions, so you might notice some things that don't work quite right, but it's good enough to at least boot an operating system (I tested with a Linux installer).
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Booting UEFI firmware (OVMF) in Bochs

Post by stlw »

Octocontrabass wrote:To make OVMF work in Bochs, you need to configure at least 64MB of RAM and the PCI (not ISA) Cirrus SVGA adapter.

Also, make sure you didn't build OVMF with SMM support. Bochs doesn't emulate the correct chipset for that feature.

Bochs still makes some legacy hardware assumptions, so you might notice some things that don't work quite right, but it's good enough to at least boot an operating system (I tested with a Linux installer).
Can you post some detailed instructions and OVMF image you have got ?
I am willing to try fixing the SMM at least, I only need to know what to do ...

P.S>

Ben, I am here :)

Stanislav
Octocontrabass
Member
Member
Posts: 5586
Joined: Mon Mar 25, 2013 7:01 pm

Re: Booting UEFI firmware (OVMF) in Bochs

Post by Octocontrabass »

stlw wrote:Can you post some detailed instructions and OVMF image you have got ?
I downloaded a prebuilt OVMF from here. I've attached the bochsrc I use to boot it.
stlw wrote:I am willing to try fixing the SMM at least, I only need to know what to do ...
I suggest you first move port 0xe9 to port 0x402 so OVMF can tell you what it's doing when things stop working. After that, it's just the simple matter of implementing an entirely new chipset. :wink:
Attachments
OVMF bochsrc.zip
sample bochsrc for OVMF
(1.06 KiB) Downloaded 337 times
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Booting UEFI firmware (OVMF) in Bochs

Post by stlw »

Octocontrabass wrote: I suggest you first move port 0xe9 to port 0x402 so OVMF can tell you what it's doing when things stop working. After that, it's just the simple matter of implementing an entirely new chipset. :wink:
Which one ? - this is the question !
Octocontrabass
Member
Member
Posts: 5586
Joined: Mon Mar 25, 2013 7:01 pm

Re: Booting UEFI firmware (OVMF) in Bochs

Post by Octocontrabass »

Post Reply