1# UEFI Boot 2 3Cloud Hypervisor supports UEFI boot through the utilization of the EDK II based UEFI firmware. 4 5## Building UEFI Firmware for x86-64 6 7To avoid any unnecessary issues, it is recommended to use Ubuntu 18.04 and its default toolset. Any other compatible Linux distribution is otherwise suitable, however it is suggested to use a temporary Docker container with Ubuntu 18.04 for a quick build on an existing Linux machine. 8 9Please note that nasm-2.15 is required for the build to succeed. 10 11The commands below will compile an OVMF firmware suitable for Cloud Hypervisor. 12 13```shell 14sudo apt-get update 15sudo apt-get install uuid-dev nasm iasl build-essential python3-distutils git 16 17git clone https://github.com/tianocore/edk2 18cd edk2 19. edksetup.sh 20git submodule update --init 21 22echo "ACTIVE_PLATFORM=OvmfPkg/CloudHv/CloudHvX64.dsc" >> Conf/target.txt 23echo "TARGET_ARCH=X64" >> Conf/target.txt 24echo "TOOL_CHAIN_TAG=GCC5" >> Conf/target.txt 25 26make -C ./BaseTools 27build 28``` 29 30After the successful build, the resulting firmware binaries are available under `Build/CloudHvX64/DEBUG_GCC5/FV` underneath the edk2 checkout. 31 32## Building UEFI Firmware for AArch64 33 34```shell 35# On an AArch64 machine: 36$ sudo apt-get update 37$ sudo apt-get install uuid-dev nasm iasl build-essential python3-distutils git 38$ git clone --depth 1 https://github.com/tianocore/edk2.git -b master 39$ cd edk2 40$ git submodule update --init 41$ cd .. 42$ git clone --depth 1 https://github.com/tianocore/edk2-platforms.git -b master 43$ git clone --depth 1 https://github.com/acpica/acpica.git -b master 44 45# Build tools 46$ export PACKAGES_PATH="$PWD/edk2:$PWD/edk2-platforms" 47$ export IASL_PREFIX="$PWD/acpica/generate/unix/bin/" 48$ make -C acpica 49$ cd edk2/ 50$ . edksetup.sh 51$ cd .. 52$ make -C edk2/BaseTools 53 54# Build EDK2 55$ build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b RELEASE 56``` 57 58If the build goes well, the EDK2 binary is available at 59`edk2/Build/ArmVirtCloudHv-AARCH64/RELEASE_GCC5/FV/CLOUDHV_EFI.fd`. 60 61## Using OVMF Binaries 62 63Any UEFI capable image can be booted using the Cloud Hypervisor specific firmware. Windows guests under Cloud Hypervisor only support UEFI boot, therefore OVMF is mandatory there. 64 65To make Cloud Hypervisor use UEFI boot, pass the `CLOUDHV.fd` (for x86-64) / `CLOUDHV_EFI.fd` (for AArch64) file path as an argument to the `--kernel` option. The firmware file will be opened in read only mode. 66 67# Links 68 69- [OVMF wiki](https://github.com/tianocore/tianocore.github.io/wiki/OVMF) 70- [Cloud Hypervisor specific tree](https://github.com/cloud-hypervisor/edk2/tree/ch) 71