OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 20, 2019 5:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Sun Jan 13, 2019 11:34 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 294
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"

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Sun Jan 13, 2019 11:59 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 286
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.

_________________
toaruos on github | toaruos.org | gitlab | twitter |


Last edited by klange on Mon Jan 14, 2019 1:40 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Mon Jan 14, 2019 12:28 am 
Offline
Member
Member

Joined: Fri Apr 04, 2008 6:43 am
Posts: 339
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.


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Mon Jan 14, 2019 9:07 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 294
OK thanks, I'll just have to add a BIOS bootloader and image then.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Mon Jan 14, 2019 12:12 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 552
Location: USA
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


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Mon Jan 14, 2019 12:48 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1497
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).


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Tue Jan 15, 2019 12:58 am 
Offline
Member
Member

Joined: Fri Apr 04, 2008 6:43 am
Posts: 339
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


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Tue Jan 15, 2019 3:03 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1497
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 7 times
Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Wed Jan 16, 2019 10:05 am 
Offline
Member
Member

Joined: Fri Apr 04, 2008 6:43 am
Posts: 339
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 !


Top
 Profile  
 
 Post subject: Re: Booting UEFI firmware (OVMF) in Bochs
PostPosted: Wed Jan 16, 2019 11:16 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1497
This one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group