1095ea049SAnatol Belski# UEFI Boot 2095ea049SAnatol Belski 3095ea049SAnatol BelskiCloud Hypervisor supports UEFI boot through the utilization of the EDK II based UEFI firmware. 4095ea049SAnatol Belski 52b11966fSHenry Wang## Building UEFI Firmware for x86-64 6095ea049SAnatol Belski 7095ea049SAnatol BelskiTo 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. 8095ea049SAnatol Belski 9*683d1164SClaudio FontanaPlease note that nasm-2.15 is required for the build to succeed. 10*683d1164SClaudio Fontana 11095ea049SAnatol BelskiThe commands below will compile an OVMF firmware suitable for Cloud Hypervisor. 12095ea049SAnatol Belski 13095ea049SAnatol Belski```shell 14095ea049SAnatol Belskisudo apt-get update 15095ea049SAnatol Belskisudo apt-get install uuid-dev nasm iasl build-essential python3-distutils git 16095ea049SAnatol Belski 17*683d1164SClaudio Fontanagit clone https://github.com/tianocore/edk2 18095ea049SAnatol Belskicd edk2 19095ea049SAnatol Belski. edksetup.sh 20095ea049SAnatol Belskigit submodule update --init 21095ea049SAnatol Belski 22779bc1a5SSebastien Boeufecho "ACTIVE_PLATFORM=OvmfPkg/CloudHv/CloudHvX64.dsc" >> Conf/target.txt 23095ea049SAnatol Belskiecho "TARGET_ARCH=X64" >> Conf/target.txt 24095ea049SAnatol Belskiecho "TOOL_CHAIN_TAG=GCC5" >> Conf/target.txt 25095ea049SAnatol Belski 26095ea049SAnatol Belskimake -C ./BaseTools 27095ea049SAnatol Belskibuild 28095ea049SAnatol Belski``` 29095ea049SAnatol Belski 30779bc1a5SSebastien BoeufAfter the successful build, the resulting firmware binaries are available under `Build/CloudHvX64/DEBUG_GCC5/FV` underneath the edk2 checkout. 31095ea049SAnatol Belski 322b11966fSHenry Wang## Building UEFI Firmware for AArch64 332b11966fSHenry Wang 342b11966fSHenry Wang```shell 352b11966fSHenry Wang# On an AArch64 machine: 362b11966fSHenry Wang$ sudo apt-get update 372b11966fSHenry Wang$ sudo apt-get install uuid-dev nasm iasl build-essential python3-distutils git 382b11966fSHenry Wang$ git clone --depth 1 https://github.com/tianocore/edk2.git -b master 392b11966fSHenry Wang$ cd edk2 402b11966fSHenry Wang$ git submodule update --init 412b11966fSHenry Wang$ cd .. 422b11966fSHenry Wang$ git clone --depth 1 https://github.com/tianocore/edk2-platforms.git -b master 432b11966fSHenry Wang$ git clone --depth 1 https://github.com/acpica/acpica.git -b master 442b11966fSHenry Wang 452b11966fSHenry Wang# Build tools 462b11966fSHenry Wang$ export PACKAGES_PATH="$PWD/edk2:$PWD/edk2-platforms" 472b11966fSHenry Wang$ export IASL_PREFIX="$PWD/acpica/generate/unix/bin/" 482b11966fSHenry Wang$ make -C acpica 492b11966fSHenry Wang$ cd edk2/ 502b11966fSHenry Wang$ . edksetup.sh 512b11966fSHenry Wang$ cd .. 522b11966fSHenry Wang$ make -C edk2/BaseTools 532b11966fSHenry Wang 542b11966fSHenry Wang# Build EDK2 552b11966fSHenry Wang$ build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b RELEASE 562b11966fSHenry Wang``` 572b11966fSHenry Wang 582b11966fSHenry WangIf the build goes well, the EDK2 binary is available at 592b11966fSHenry Wang`edk2/Build/ArmVirtCloudHv-AARCH64/RELEASE_GCC5/FV/CLOUDHV_EFI.fd`. 602b11966fSHenry Wang 61095ea049SAnatol Belski## Using OVMF Binaries 62095ea049SAnatol Belski 63095ea049SAnatol BelskiAny 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. 64095ea049SAnatol Belski 652b11966fSHenry WangTo 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. 66095ea049SAnatol Belski 67095ea049SAnatol Belski# Links 68095ea049SAnatol Belski 69095ea049SAnatol Belski- [OVMF wiki](https://github.com/tianocore/tianocore.github.io/wiki/OVMF) 70095ea049SAnatol Belski- [Cloud Hypervisor specific tree](https://github.com/cloud-hypervisor/edk2/tree/ch) 71