Last Updated: Nov 30, 2023
This guide provides step-by-step instructions on how to compile Open Virtual Machine Firmware (OVMF) for Project ACRN and Proxmox Virtual Environment (PVE) using an Ubuntu 18.04 LTS system. The resulting OVMF is particularly useful for scenarios requiring Intel Integrated GPU (iGPU) passthrough to virtual machines. We’ll cover the necessary dependencies and compilation commands for each target environment.
Compile OVMF for ACRN using Ubuntu 18.04 LTS
This section will guide you through compiling OVMF specifically for use with Project ACRN, enabling iGPU passthrough capabilities.
Install Compile Dependencies
First, we need to install essential packages and clone the ACPICA (ACPI Component Architecture) project, which is necessary for the build process.
sudo apt install git build-essential curl gcc-5 g++-5 python uuid-dev nasm flex bison -y
git clone https://github.com/acpica/acpica.git
cd acpica
make clean
make
sudo make install
cd ..
These commands will update your package list, install the required development tools and libraries, and then download, compile, and install the ACPICA utilities.
Compile OVMF for ACRN
With the dependencies in place, we can now proceed to compile OVMF for ACRN. This build will incorporate elements needed for iGPU support.
git clone https://github.com/projectacrn/acrn-edk2.git
mkdir -p acrn-edk2/OvmfPkg/IntelGop/
mkdir -p acrn-edk2/OvmfPkg/Vbt/
cp IntelGopDriver.efi acrn-edk2/OvmfPkg/IntelGop/IntelGopDriver.efi
cp Vbt.bin acrn-edk2/OvmfPkg/Vbt/Vbt.bin
wget https://projectacrn.github.io/latest/_static/downloads/Use-the-default-vbt-released-with-GOP-driver.patch
wget https://projectacrn.github.io/latest/_static/downloads/Integrate-IntelGopDriver-into-OVMF.patch
cd acrn-edk2/
git apply ../Use-the-default-vbt-released-with-GOP-driver.patch
git apply ../Integrate-IntelGopDriver-into-OVMF.patch
git submodule update --init CryptoPkg/Library/OpensslLib/openssl
source edksetup.sh
make -C BaseTools
vim Conf/target.txt
During the steps above, we clone the ACRN EDK2 repository, create necessary directories for Intel Graphics Output Protocol (GOP) driver and Video BIOS Table (VBT), and copy the respective files (IntelGopDriver.efi
and Vbt.bin
– ensure these files are present in your working directory before running the cp
commands). These components are crucial for iGPU passthrough. We then download and apply patches required for ACRN. After updating the submodules, we set up the EDK2 build environment and build the base tools.
Next, you need to edit the Conf/target.txt
file. Open it with vim
or your preferred text editor and ensure the following content is present:
ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc
TARGET_ARCH = X64
TOOL_CHAIN_TAG = GCC5
Finally, build OVMF with the specified options:
build -DFD_SIZE_2MB -DDEBUG_ON_SERIAL_PORT=TRUE
Compile OVMF for PVE
This section details the process for compiling OVMF tailored for a Proxmox VE setup, specifically for enabling iGPU passthrough. This method utilizes Docker for a containerized build environment.
Install Compile Dependencies (Docker)
The primary dependency for this build method is Docker. The following commands will download and execute the official Docker installation script.
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
This ensures you have a working Docker environment. For managing Docker as a non-root user, you might need to add your user to the docker
group (often handled by the script, but can be done manually with sudo usermod -aG docker $USER
and then logging out and back in or using newgrp docker
).
Compile OVMF for PVE
Now, we’ll clone the build repository and execute the build scripts. This OVMF build is intended to support iGPU passthrough in PVE. You’ll need to have your GitHub access key added to the ssh-agent to clone the repository via SSH.
# You need to add your github accese key to the ssh-agent
git clone [email protected]:cmd2001/build-edk2-gvtd.git
cd build-edk2-gvtd
sh ./init_edk2.sh
mkdir gop
cp ../IntelGopDriver.efi gop/IntelGopDriver.efi
sudo bash ./build_ovmf.sh
sudo bash ./build_oprom.sh
These commands clone the build-edk2-gvtd
repository, initialize the EDK2 environment using a script, create a directory for the GOP driver, and copy your IntelGopDriver.efi
file into it (ensure this file is located in the parent directory before running cp
). The IntelGopDriver.efi
is key for iGPU functionality. Finally, it runs the provided shell scripts to build OVMF and the option ROM using Docker. The sudo
prefix is used as the scripts likely perform operations requiring root privileges within the Docker environment or for file system manipulation.
Following these instructions should result in successfully compiled OVMF images for either ACRN or PVE environments, configured to support iGPU passthrough.
Leave a Reply to Find out more Cancel reply