-
Notifications
You must be signed in to change notification settings - Fork 0
How to run OVMF
How to run OVMF with QEMU or KVM
In order to run OVMF with QEMU, you must have QEMU version 0.9.1 or newer installed on your system.
To install on Debian/Ubuntu: sudo apt-get install qemu
The latest pre-built binaries of OVMF are available from the main OVMF page, or from OVMF downloads area. You can also build OVMF if you are interested.
Be sure to align the processor architecture for OVMF with the proper processor archtecture of QEMU.
For the IA32 build of OVMF, there is a little more choice, since the X64 processor is also compatible with IA32. Therefore, with the IA32 build of OVMF, you can use the following commands: qemu, qemu-system-i386 or qemu-system-x86_64.
For the X64 build of OVMF, however, you can only use the qemu-system-x86_64 command.
To use OVMF with QEMU, we utilize the -L QEMU command line parameter. This paramter takes a directory path, and QEMU will load the bios.bin from this directory.
For example:
bash$ mkdir ~/run-ovmf
bash$ cd ~/run-ovmf
Next, copy the OVMF.fd file into this directory, but rename OVMF.fd to bios.bin:
bash$ cp /path/to/ovmf/OVMF.fd bios.bin
(QEMU can turn the contents of a directory into a disk image 'on-the-fly'):
bash$ mkdir hda-contents
Here is a sample command:
bash$ qemu-system-x86_64 -L . -hda fat:hda-contents
If everything goes well, you should see a graphic logo, and the UEFI shell should start.
Note: iPXE is enabled on recent builds of QEMU, and may try to network boot if a valid network adapter is detected. To disable iPXE, add -net none
to the command line.
The path to the OVMF.fd
image can be directly provided on the command line, rather than copying to another directory. Example for debug image built using GCC5, with iPXE disabled:
qemu-system-x86_64 -L . --bios ~/src/edk2/Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd -net none
qemu-system-x86_64 -pflash bios.bin -hda fat:hda-contents -net none
(Beware that QEMU makes the virtual FAT table once and host could get out of sync and QEMU might get confused)
qemu-system-x86_64 -pflash bios.bin -hda fat:rw:hda-contents -net none
Although the latest versions of OVMF should now support the latest versions of KVM, there is still a chance that you might encounter issues when using KVM. If OVMF fails to boot on QEMU (with KVM), try disabling KVM.