audk/OvmfPkg/PlatformCI
Laszlo Ersek 702ba436ed OvmfPkg/PlatformCI: bump QEMU choco package version to 2021.5.5
We currently require QEMU choco package version 2020.08.14 (from commit
3ab9d60fcb), in "OvmfPkg/PlatformCI/.azurepipelines/Windows-VS2019.yml".
Said package version references the following URLs:

https://community.chocolatey.org/packages/Qemu/2020.08.14#files
-> https://qemu.weilnetz.de/w32/qemu-w32-setup-20200814.exe
-> https://qemu.weilnetz.de/w64/qemu-w64-setup-20200814.exe

These URLs no longer work; Stefan Weil seems to have moved the binaries to
the following archive directories:

- https://qemu.weilnetz.de/w32/2020/
- https://qemu.weilnetz.de/w64/2020/

In theory, the old QEMU choco packages should be fixed (their powershell
scripts should be updated to reference the new URLs on Stefan Weil's
website). However, this PlatformCI issue is blocking the merging of the
security fix for TianoCore#3356, so getting PlatformCI functional again is
urgent. Let's bump our QEMU choco package requirement to 2021.5.5, whose
URLs work, for now.

(Currently we cannot use any other choco package version, as Stefan's
directories <https://qemu.weilnetz.de/w32> and
<https://qemu.weilnetz.de/w64>, without any further subdirectories, only
offer the 20210505 EXE files.)

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210609155731.10431-1-lersek@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2021-06-09 16:43:39 +00:00
..
.azurepipelines OvmfPkg/PlatformCI: bump QEMU choco package version to 2021.5.5 2021-06-09 16:43:39 +00:00
PlatformBuild.py OvmfPkg: Add Platform CI and configuration for Core CI 2020-04-28 18:07:59 +00:00
ReadMe.md OvmfPkg: Add Platform CI and configuration for Core CI 2020-04-28 18:07:59 +00:00
iasl_ext_dep.yaml OvmfPkg: Add Platform CI and configuration for Core CI 2020-04-28 18:07:59 +00:00

ReadMe.md

OvmfPkg - Platform CI

This ReadMe.md describes the Azure DevOps based Platform CI for OvmfPkg and how to use the same Pytools based build infrastructure locally.

Supported Configuration Details

This solution for building and running OvmfPkg has only been validated with Windows 10 with VS2019 and Ubuntu 18.04 with GCC5 toolchain. Four different firmware builds are supported and are described below.

Configuration name Architectures DSC File Additional Flags
IA32 IA32 OvmfPkgIa32.dsc None
X64 X64 OvmfPkgIa64.dsc None
IA32 X64 PEI-IA32 DXE-X64 OvmfPkgIa32X64.dsc None
IA32 X64 Full PEI-IA32 DXE-X64 OvmfPkgIa32X64.dsc SECURE_BOOT_ENABLE=1 SMM_REQUIRE=1 TPM_ENABLE=1 TPM_CONFIG_ENABLE=1 NETWORK_TLS_ENABLE=1 NETWORK_IP6_ENABLE=1 NETWORK_HTTP_BOOT_ENABLE=1

EDK2 Developer environment

Note: edksetup, Submodule initialization and manual installation of NASM, iASL, or the required cross-compiler toolchains are not required, this is handled by the Pytools build system.

Building with Pytools for OvmfPkg

  1. [Optional] Create a Python Virtual Environment - generally once per workspace

    python -m venv <name of virtual environment>
    
  2. [Optional] Activate Virtual Environment - each time new shell opened

    • Linux

      source <name of virtual environment>/bin/activate
      
    • Windows

      <name of virtual environment>/Scripts/activate.bat
      
  3. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes

    pip install --upgrade -r pip-requirements.txt
    
  4. Initialize & Update Submodules - only when submodules updated

    stuart_setup -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
    
  5. Initialize & Update Dependencies - only as needed when ext_deps change

    stuart_update -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
    
  6. Compile the basetools if necessary - only when basetools C source files change

    python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>
    
  7. Compile Firmware

    • To build IA32
    stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
    
    • To build X64
    stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
    
    • To build IA32 X64
    stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32,X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
    
    • use stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -h option to see additional options like --clean
  8. Running Emulator

    • You can add --FlashRom to the end of your build command and the emulator will run after the build is complete.

    • or use the --FlashOnly feature to just run the emulator.

      stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --FlashOnly
      

Notes

  1. Configuring ACTIVE_PLATFORM and TARGET_ARCH in Conf/target.txt is not required. This environment is set by PlatformBuild.py based upon the [-a <TARGET_ARCH>] parameter.
  2. QEMU must be on your path. On Windows this is a manual process and not part of the QEMU installer.

NOTE: Logging the execution output will be in the normal stuart log as well as to your console.

Custom Build Options

MAKE_STARTUP_NSH=TRUE will output a startup.nsh file to the location mapped as fs0. This is used in CI in combination with the --FlashOnly feature to run QEMU to the UEFI shell and then execute the contents of startup.nsh.

QEMU_HEADLESS=TRUE Since CI servers run headless QEMU must be told to run with no display otherwise an error occurs. Locally you don't need to set this.

Passing Build Defines

To pass build defines through stuart_build, prepend BLD_*_to the define name and pass it on the command-line. stuart_build currently requires values to be assigned, so add an=1 suffix for bare defines. For example, to enable the TPM2 support, instead of the traditional "-D E1000_ENABLE", the stuart_build command-line would be:

stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py BLD_*_E1000_ENABLE=1

References