EDK II Build Specification
1.0.0
Search…
⌃K

6.1 Environment Variables

There are two required system level environment variables that must be set, and several optional environment variables.

6.1.1 Required Environment Variables

The first of the two required variables is WORKSPACE. This variable points to a directory that will contain a Conf directory (containing the text files that are used to control build options) and the typical Build output directory tree. The following two lines are an example of setting this variable, the first in a Microsoft Windows* Command Prompt Window, while the second represents setting the variable in a UNIX terminal bash shell.
set WORKSPACE=C:\MyWork\Proj1\edk2
export WORKSPACE=/usr/local/src/proj1/edk2
The second required environment variable, EDK_TOOLS_PATH, required points to the directory containing the Conf directory for the BaseTools directory. The EDK II project contains a BaseTools directory,that contains setup scripts, template files and XML Schema files. Only one copy of the BaseTools directories needs to be installed on a workstation (although multiple copies are permitted, such as having one in each workspace). The EDK_TOOLS_PATH variable must point to the directory containing the BaseTools/Conf directory. The following lines are an example of setting this variable in a Microsoft Windows* Command Prompt window. The first line sets an absolute path to single location, outside of the workspace, while the second line uses tools located within the workspace.
set EDK_TOOLS_PATH=C:\Tools
set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
If assembly code is used by the modules and the NASM assembler is used, the system environment variable, NASM_PREFIX must be set as shown below and must include the trailing backslash character:
set NASM_PREFIX=C:\nasm\

6.1.2 Optional Environment Variables

When EDK II Packages are distributed within different directory trees on a developer's workstation, the PACKAGES_PATH environment variable is used to list directories (prioritized from left to right) that contain EDK II Package directories. The operating system delimiter, such as the semi-colon character for Microsoft operating systems, is used to separate the directory names. If all development is performed under the root of the edk2 source tree, this variable is not required. The edk2 reference build system will look for EDK II packages in the directory specified in the WORKSPACE, then search for the package directory in the directories listed in the PACKAGES_PATH; the first occurrence of an EDK II package found will be used.
For Microsoft windows environments, the EDK_TOOLS_BIN environment variable can be used to point to the directory that contains the Win32 BaseTools binaries. If these Win32 binaries are located in edk2 directory tree under the BaseTools\Bin\Win32 directory; this variable is not required. Since developers using *NIX operating systems must build the 'C'-based tools prior to using them and run the Python based tools from source, this environment variable is not required. The edksetup script is used to add the path to the binaries to the system PATH environment variable.
The final optional environment variable, ECP_SOURCE, is used to define the location of the EDK Compatibility Package content for building EDK modules. If these values are not set, the build system will automatically set the value to the EdkCompatibilityPkg directory in the WORKSPACE.

6.1.3 Configuring the Environment Variables

If all development will be done within the root of the edk2 directory tree, and the Win32 BaseTools binaries are in the BaseTools\Bin\Win32 directory, then the edksetup script may be used to setup the development workspace by setting system environment variables, WORKSPACE and EDK_TOOLS_PATH.
If a more complex development environment is used (multiple directories containing EDK II Packages), then the WORKSPACE, PACKAGES_PATH and EDK_TOOLS_BIN environment variables must be set before running the edksetup script.
The script must be executed prior to building in a new command prompt window or new terminal shell.
Another feature of the script is that it adds the path of the build system tools into the OS environment variable, PATH.