OSDev.org
https://forum.osdev.org/

Booting UEFI firmware (OVMF) in Bochs
https://forum.osdev.org/viewtopic.php?f=1&t=33440
Page 1 of 1

Author:  kzinti [ Sun Jan 13, 2019 11:34 pm ]
Post subject:  Booting UEFI firmware (OVMF) in Bochs

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:
# 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"

Author:  klange [ Sun Jan 13, 2019 11:59 pm ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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.

Author:  stlw [ Mon Jan 14, 2019 12:28 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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.

Author:  kzinti [ Mon Jan 14, 2019 9:07 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

OK thanks, I'll just have to add a BIOS bootloader and image then.

Author:  BenLunt [ Mon Jan 14, 2019 12:12 pm ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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

Author:  Octocontrabass [ Mon Jan 14, 2019 12:48 pm ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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).

Author:  stlw [ Tue Jan 15, 2019 12:58 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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

Author:  Octocontrabass [ Tue Jan 15, 2019 3:03 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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:
File comment: sample bochsrc for OVMF
OVMF bochsrc.zip [1.06 KiB]
Downloaded 139 times

Author:  stlw [ Wed Jan 16, 2019 10:05 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

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 !

Author:  Octocontrabass [ Wed Jan 16, 2019 11:16 am ]
Post subject:  Re: Booting UEFI firmware (OVMF) in Bochs

This one.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/