Skip to content

Build with docker

Jake Garver edited this page Dec 5, 2023 · 5 revisions

Building UEFI for NVIDIA Platforms with docker

UEFI for NVIDIA Platforms can be built using the following instructions.

In these instructions, we'll first install and configure docker. Then we'll use the Ubuntu 22 dev image to create a workspace and run the build.

Install docker

The process for installing docker will depend on your host operating system. Please consult the documentation for your host operating system.

For example, to install docker on Ubuntu and allow the current user to use it:

sudo apt install docker.io
sudo usermod -a -G docker ${USER}
# Log out, log back in

Configure docker

To build UEFI for NVIDIA Platforms, we'll use the Ubuntu-22 dev image from the tianocore/containers repository. This image requires parameters identifying the host user and home directory. In addition, you'll also need to mount a build root, which will contain the workspace. These parameters result in a long command line. It is recommended to setup an alias or script as a convenience. The specifics of how to do this depend on the host operationg system and shell.

For example, in bash, an alias can be created with:

# Point to the Ubuntu-22 dev image
export EDK2_DEV_IMAGE="ghcr.io/tianocore/containers/ubuntu-22-dev:latest"

# Required
export EDK2_USER_ARGS="-v \"${HOME}\":\"${HOME}\" -e EDK2_DOCKER_USER_HOME=\"${HOME}\""

# Required, unless you want to build in your home directory.
# Change "/build" to be a suitable build root on your system.
export EDK2_BUILD_ROOT="/build"
export EDK2_BUILDROOT_ARGS="-v \"${EDK2_BUILD_ROOT}\":\"${EDK2_BUILD_ROOT}\""

# Create the alias
alias edk2_docker="docker run -it --rm -w \"\$(pwd)\" ${EDK2_BUILDROOT_ARGS} ${EDK2_USER_ARGS} \"${EDK2_DEV_IMAGE}\""

Verify the docker environment by running a simple command. If necessary, the image will be pulled.

edk2_docker echo hello

Configure edkrepo

edkrepo uses manifests to build workspaces and manifests are fetched from repositories. Before edkrepo can be used, we need to create it's base configuration in our home directory. Also, we need to add NVIDIA's manifest repository.

Add edkrepo's base configuration to the current user's home directory:

edk2_docker init_edkrepo_conf

Configure edkrepo with NVIDIA's manifest repository:

edk2_docker edkrepo manifest-repos add nvidia https://github.com/NVIDIA/edk2-edkrepo-manifest.git main nvidia

Create workspace

Now, edkrepo can be used to create workspaces for NVIDIA platforms. This is done using the clone command. The clone command needs to know where to create the workspace, what project to use, and which combination to sync. The project will always be NVIDIA-Platforms.

The syntax to create a workspace is:

edk2_docker edkrepo clone <workspace> NVIDIA-Platforms <combo>

It is important to select the right combination. For a list of available combinations, see NVIDIA Edkrepo Combinations.

For example, to create a workspace in nvidia-uefi using the main combination from the NVIDIA-Platforms project. It will be created under /build, which has been configured as the build root:

cd /build
edk2_docker edkrepo clone nvidia-uefi NVIDIA-Platforms main

Build UEFI

To build a platform, change directory into the workspace and run the platform's build.sh.

For example, to build Jetson:

cd nvidia-uefi
edk2_docker edk2-nvidia/Platform/NVIDIA/Jetson/build.sh

To build Server:

cd nvidia-uefi
edk2_docker edk2-nvidia/Platform/NVIDIA/Server/build.sh