These are instructions for setting up EDK II build environment on Ubuntu, and building OVMF images for use with qemu.

Initial set up

Install required packages

$ sudo apt-get install build-essential git uuid-dev iasl nasm libxext-dev libx11-dev 

Get the latest source for EDKII

$ git clone git://github.com/tianocore/edk2.git
cd edk2

Compile base tools

For MS Windows, prebuilt binaries of the base tools are shipped with the source; on Ubuntu the base tools required for building EDKII need to be built first.

$ make -C BaseTools

Set up build environment

You need to set EDK_TOOLS_PATH and set up the build environment by running the edksetup.sh script provided in the source. This script will copy template and configuration files to edk2/Conf directory.

$ source edksetup.sh

Set up build target

To set up the build target you need to modify the conf file Conf/target.txt. This will enable the firmware package to be built and set up the compiler version used.

$ vim Conf/target.txt

ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc TOOL_CHAIN_TAG = GCC46 TARGET_ARCH = X64

Building MdeModulePkg module package

This will build MdeModulePkg and helloworld program that we can use later when we launch the UEFI shell from emulator. Just type build:

$ build

Build a full system firmware image (OVMF)

The Open Virtual Machine Firmware (or “OVMF”) can be used to enable UEFI within virtual machines. It provides libraries and drivers related to virtual machines. Currently OVMF support QEMU for emulating UEFI on IA32 and X86-64 based systems. You could also build OVMF with source level debugging enabled.

$ build -o X64 -p OvmfPkg/OvmfPkgX64.dsc

If you’d like debug output on the serial console, use the DEBUG_ON_SERIAL_PORT option:

$ build -o X64 -p OvmfPkg/OvmfPkgX64.dsc -DDEBUG_ON_SERIAL_PORT=TRUE
  • Building OvmfPkg with Secure Boot support

If you wish to build OVMF with Secure Boot, you must follow the openssl installation instructions found in CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt, and build with the SECURE_BOOT_ENABLE option:

$ build -o X64 -p OvmfPkg/OvmfPkgX64.dsc -DSECURE_BOOT_ENABLE=TRUE
  • Running UEFI in QEMU

    $ qemu-system-x86_64 -bios “OVMF.fd” -M “pc” -m 256 -cpu “qemu64” -vga cirrus -serial vc -parallel vc -name “UEFI” -boot order=dc