Build UEFI in QEMU-AARCH64

This section documents how to build a modern QEMU (post-2.2) and generate an AArch64 UEFI firmware image using TianoCore EDK2. The resulting firmware (QEMU_EFI.fd) can be used to boot AArch64 guests with UEFI, and optionally with UEFI Secure Boot enabled.


1) Download and build QEMU (version >= 2.2)

Clone QEMU from upstream:

git clone https://github.com/qemu/qemu.git
cd qemu

Configure and build the AArch64 system emulator target (aarch64-softmmu):

./configure --target-list=aarch64-softmmu
make -j$(nproc)

After build, the main binary is typically:

build/aarch64-softmmu/qemu-system-aarch64

2) Download EDK2 (TianoCore)

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

(Optional) Initialize submodules if your flow requires them:

git submodule update --init --recursive

3) Setup an AArch64 cross compiler environment

Install or provide an AArch64 cross toolchain (example prefix below). Make sure aarch64-linux-gnu-gcc and related tools are in your $PATH.

Example environment variable used by EDK2:

export GCC48_AARCH64_PREFIX=aarch64-linux-gnu-

4) Build EDK2 BaseTools

Initialize the EDK2 build environment and build BaseTools:

source edksetup.sh
make -C BaseTools

5) Build ArmVirtPkg UEFI firmware for QEMU (AArch64)

Build the QEMU AArch64 UEFI firmware using the ArmVirt package.

build -a AARCH64 -t GCC48 -p ArmVirtPkg/ArmVirtQemu.dsc

6) Locate the firmware image

After a successful build, the firmware image can be found at:

Build/ArmVirtQemu-AARCH64/DEBUG_GCC48/FV/QEMU_EFI.fd

7) Enable UEFI Secure Boot (optional)

To build a Secure Boot-enabled firmware image:

build -a AARCH64 -t GCC48 -p ArmVirtPkg/ArmVirtQemu.dsc \
    -D SECURE_BOOT_ENABLE

This produces a UEFI firmware image with Secure Boot support enabled (depending on build configuration and key provisioning workflow).

← Previous Post
Next Post →

Leave a Comment