OVMF (Open Virtual Machine Firmware) is a project that aim is to enable UEFI support in various virtual machines. According to whitepaper various projects have interest in supporting OVFM ie. VirtualBox, Xen, BHyVe and of course QEMU. Why may someone be interested in OVMF ?

  • IMHO the most important reason is that OVMF give the ability to develop UEFI applications without using real hardware. This speeds up development cycle by giving the ability to start before hardware prototype arrives. There are also cases when the hardware is available only remotely, dealing with the remote setup is usually annoying, so part of development can be performed locally.
  • It also improves testing and debugging, because we have full control over execution environment internals. Error injection and corner case analysis can be ineffective in the real world. OVMF and qemu open debugging to new levels.
  • It enables training and learning environment. Not everyone can obtain UEFI PC and mess with it when there is a risk of destroying sth.
  • Many other reasons like the ability to test/develop UEFI support for various OSes, simplified debugging, lack of dependencies on legacy address space and devices. This and other interesting reasons can be found in Laszlo Ersek whitepaper

What I want to show below is the procedure for setting up a development environment for UEFI applications and show how to compile and deploy Hello World application in that environment.


Let’s use an upstream version of QEMU:

Prepare application image

Of course, size depends on your application requirements. Usually, 128MB is way too much.


First build UEFI firmware with shell:

Now we need some application that can be delivered over app.disk to the virtual machine. There are couple examples of UEFI applications in edk2 source code, but let’s start with classical Hello World. Source code can be found in MdeModulePkg/Application/HelloWorld. This module is built in MdeModulePkg because of that, we can build it as follows:

Let’s put it into app.disk:

OVMF configuration

When we develop UEFI application best way would be to run OVMF to UEFI Shell for test purposes. This is not a default option. How to change the boot order so we every time will lend in shell?

On booting screen hit <Esc>.


You should be on the main menu of UEFI setup:


Go through Boot Maintenance Manager -> Boot Options -> Change Boot Order, select Change Boot Order and hit <Enter>. Then using +/- keys move EFI Internal Shell to the top.


Do not forget to save the configuration with <F10>.

Run HelloWorld.efi

To boot OVMF I’m using Laszlo’s slightly modified script which can be found here.

After booting to UEFI Shell we should look something like this:


Note FS0: in mapping table list – this is our app.disk.


The result should look like this: hello_world

NOTE: If your result is different then make sure to check last lines of app.ovmf.log it can give you some hints.


Hopefully at least part of above article was useful somehow. There are many ways to extend this sample presentation. For example, application delivery can be achieved by network transfer. If you have any question or need UEFI support please do not bother to ping me in comments or using any other medium.