Most Qemu software runs BIOS (Legacy) initialization software. In many cases, a user may want to run Qemu with UEFI instead of BIOS. Additionally, a user may prefer run Qemu in command line or graphically with Aqemu. Instructions below explain how to do it all.
Requirements
In case you didn't have the required program, you must install it first.
$ sudo apt-get install ovmf # available for Ubuntu 16.04 to 21.04
To check whether it is installed, the command is:
$ dpkg -L | grep OVMF.fd
/usr/share/ovmf/OVMF.fd
/usr/share/qemu/OVMF.fd
The secret is, this package named ovmf is actually the program called TianoCore explained below. That name itself stands for Open Virtual Machine Firmware (click here to learn more).
Command line QEMU
To run an OS's image file in a virtual machine, we do the usual command but with an addition displayed in green color below. That code calls the file named OVMF.fd which is the UEFI firmware for Qemu.
$ qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -cdrom ubuntu-21.04-desktop-amd64.iso
Graphical user interface Aqemu
Likewise, the same command snippet above should be added to Aqemu if we wish graphical experience virtual machine like VirtualBox. To add it, select your virtual machine > visit VM tab > click Advanced > Advanced Options dialog will open > type the command snippet under the Custom QEMU command line arguments > OK > Apply.
Result
Before (BIOS Legacy):
(Notice the BIOS software name SeaBios at the top. )
After (UEFI):
(Notice the name of UEFI software TianoCore at the center.)
Now it's your time to test out operating systems with UEFI support! Happy computing!
This article is licensed under CC BY-SA 3.0.