OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:57 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: More functional UEFI emulation via QEMU
PostPosted: Wed Sep 26, 2018 11:07 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Hi,

With recent work on my UEFI code, with recent talk about whether you should write a boot loader or use GRUB, and then later that Legacy BIOS may not be available anymore (a few post later from previous link), I went looking for a more detailed, more functional UEFI BIOS emulation for QEMU.

About a year or so ago, tianocore released an updated site with source code and documentation on how to build the OVMF file yourself. If you don't wish to build it yourself, you can get the latest pre-built file from a link at https://www.kraxel.org/repos/, further https://www.kraxel.org/repos/jenkins/edk2/. However it is a Read Hat Package Management file (RPM). (I don't have or use Linux).

The latest (32-bit) file is named "edk2.git-ovmf-ia32-0-20180807.263.g3cb0a311cb.noarch.rpm" along with a 64-bit version as well.

With a little research, come to find out Easy-7 Zip will extract these files on a Windows platform.

So, with this information, if you are interested in working on your UEFI boot code with a much more functional UEFI emulation, go and get this file. I use OVMF-pure-efi.fd found in the extracted tree of files. (I haven't looked to see if it is legal yet, so I haven't released a link to this single file to make it easier, as a single file download. Maybe later.) Simply point QEMU to OVMF-pure-efi.fd instead of OVMF.fd. No other change is needed.

I haven't been able to research it fully yet, and it has some issues I wasn't aware of. For example, if you simply let it boot, it will try to boot via your network card instead of your image file. I think all I need to do is change the settings and let it write these new setting back to the file, though I don't want to modify the file yet. Therefore, just after the "Guest has not initialized the display yet" screen and before the UEFI logo is displayed, hit the ESC key a few times to get to the settings menu. (wait for it, it is much slower emulation that the original, as far as the startup is concerned.)

Go to "Boot Maintenance Manager", "Boot From File", choose the volume, then the file to boot. This will boot from a hard drive image.

Again, I am pretty sure that if I change the boot sequence settings (via the emulated menu), I can skip this step. I just haven't done it yet.


By going and getting this new file, you get many more screen mode options. From the default of three of the normal OVMF.fd file included with QEMU (for Windows) to nearly 40 different modes including 2560x1600 resolution screens.

From another post here on the forum, sorry to the OP, my initial tests show that the mouse is still not supported, though I haven't investigated further.

Anyway, just thought others might want to know, you can get a much more detailed and functional UEFI emulation if you get the latest from the URLs above. Currently, the latest is dated 2018-08-07, just a month or so ago.

Note, if you use Linux, you probably already have/had this. I post this message for those using Windows as their host platform. I can't be the only one, right? :-)

Ben
- http://www.fysnet.net/osdesign_book_series.htm


Top
 Profile  
 
 Post subject: Re: More functional UEFI emulation via QEMU
PostPosted: Wed Sep 26, 2018 6:44 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Okay, I had a little time and with a little more research, you need to make sure you are telling QEMU how to use the UEFI.

If you simply do:
Quote:
qemu-system-i386.exe -bios OVMF-pure-efi.fd

This will work, but since the bios area is read only, you cannot save a boot order for next time. Here is a good explanation of why.

Therefore, you should use:
Quote:
qemu-system-i386.exe -drive if=pflash,format=raw,unit=0,readonly,file=OVMF_CODE-pure-efi.fd -drive if=pflash,format=raw,unit=1,file=OVMF_VARS-pure-efi.fd

This allows you to save your changes to the BIOS, such as boot order, etc. Please note that you might want to make a backup of the OVMF_VARS-pure-efi.fd file first.

You will need to go in to the settings and "add a boot option" to point to your BOOTxx.EFI file, then move it up the boot order list, but once you do this and F10 to save it, it will boot your OS each time after, no need to go to settings each time.

- Ben


Top
 Profile  
 
 Post subject: Re: More functional UEFI emulation via QEMU
PostPosted: Thu Sep 27, 2018 12:44 pm 
Offline
Member
Member

Joined: Sun Sep 06, 2015 5:40 am
Posts: 47
I can not get it to enter the settings menu, however disabling networking by adding `-net none` to the QEMU incantation also works and boots to the shell with the default vars file. I'd be nice for ESC to work though, so I could set the boot order :/

_________________
OS on Github | My Rust ACPI library


Top
 Profile  
 
 Post subject: Re: More functional UEFI emulation via QEMU
PostPosted: Thu Sep 27, 2018 1:27 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
As soon as the "Guest has not initialized the display yet" is cleared, press the ESC a few times until the splash screen is displayed. If you have a faster machine than I, it might be a short time. Therefore, press it a few times while the "Guest has not initialized the display yet" is being displayed and through to the splash screen. See what happens.

Ben


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot] and 83 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