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.
If you are unfamiliar with Pytools, it is recommended to first read through the generic set of edk2 Build Instructions.
[Optional] Create a Python Virtual Environment - generally once per workspace
python -m venv <name of virtual environment>
[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
Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes
pip install --upgrade -r pip-requirements.txt
Initialize & Update Submodules - only when submodules updated
stuart_setup -c UefiPayloadPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
Initialize & Update Dependencies - only as needed when ext_deps change
stuart_update -c UefiPayloadPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
Compile the basetools if necessary - only when basetools C source files change
python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>
Compile Firmware
stuart_build -c UefiPayloadPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
stuart_build -c UefiPayloadPkg/PlatformCI/PlatformBuild.py -h
option to see additional options like --clean
[-a <TARGET_ARCH>]
parameter.NOTE: Logging the execution output will be in the normal stuart log as well as to your console.
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 IP6 Network Stack, the stuart_build command-line would be:
stuart_build -c UefiPayloadPkg/PlatformCI/PlatformBuild.py BLD_*_NETWORK_DRIVER_ENABLE=1