Building OVMF is fairly easy once you have installed a few pre-requisites. Please note, however, that building OVMF is not required if you are only interested in running OVMF, since we have provided pre-built binaries of OVMF.
First decide which version of OVMF you will build. You can choose to build the IA32 processor architecture and/or the X64 processor architecture. You should take into account the processor architectures which your toolchain is capable of building. Depending upon which you select, you should modify the ACTIVE_PLATFORM and TARGET_ARCH in Conf/target.txt.
| ACTIVE_PLATFORM | TARGET_ARCH | PEI code | DXE/UEFI code |
|---|---|---|---|
| OvmfPkg/OvmfPkgIa32.dsc | IA32 | IA32 | IA32 |
| OvmfPkg/OvmfPkgIa32X64.dsc | IA32 X64 | IA32 | X64 |
| OvmfPkg/OvmfPkgX64.dsc | X64 | X64 | X64 |
Example: Conf/target.txt values to build x64 UEFI image for OVMF using GCC5 compiler:
ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc TARGET_ARCH = X64 TOOL_CHAIN_TAG = GCC5
Once you have modified Conf/target.txt, you can run the build command.
bash$ build
If successful, you should now have a OVMF.Fd file under the Build sub-directory. The exact directory under the Build directory will depend upon the toolchain, dsc and processor architecture.
You can use OVMF.Fd to run OVMF.