Skip to content

Build without docker

Jake Garver edited this page Dec 6, 2023 · 10 revisions

Building UEFI for NVIDIA Platforms without docker

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

In these instructions, we'll first create a workspace using edkrepo. Then we'll run the build inside the workspace.

Supported OS

These instructions have been verified on Ubuntu 22.x. Other operating systems may work, but they have not been tested.

  • Ubuntu 18.x and earlier are known to not work.
  • There is a known issue with the GCC 10.5 toolchain in Ubuntu 20.x. It generates code that results in a spurious STACK FAULT on some images. A work-around is available.

Install edkrepo

To create the workspace and clone the source, we use edkrepo. It must be installed before proceeding. It is recommended to use a release distribution.

Releases of edkrepo can be found at: https://github.com/tianocore/edk2-edkrepo/releases

For detailed installation steps, refer to: https://github.com/tianocore/edk2-edkrepo

Briefly, to install edkrepo v2.1.2 (use a newer version, if available):

sudo apt-get install git python3 python3-setuptools python3-pip
mkdir edkrepo
cd edkrepo
wget https://github.com/tianocore/edk2-edkrepo/releases/download/edkrepo-v2.1.2/edkrepo-2.1.2.tar.gz
tar xvf edkrepo-2.1.2.tar.gz
sudo ./install.py --user ${USER}
cd ..

Also, after the installation, make sure the current user owns edkrepo's configuration files:

sudo chown -R ${USER}. ~/.edkrepo

Configure edkrepo

edkrepo uses manifests to build workspaces and manifests are fetched from repositories. To build an NVIDIA workspace, edkrepo must first be configured with NVIDIA's manifest repository.

Configure edkrepo with NVIDIA's manifest repo:

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. For a list of available combinations, see NVIDIA Edkrepo Combinations.

For example, this will create a workspace in nvidia-uefi using the main combination from the NVIDIA-Platforms project.

edkrepo clone nvidia-uefi NVIDIA-Platforms main

Install EDK2 developer environment

The following tools are required:

  • ARM cross compiler (GCC 12.x)
  • Host build tools
  • Python 3.10 or later, including virtualenv
  • Git
  • Mono
  • Misc tools and libraries

Steps to install requirements:

  1. Install all required packages:

    sudo apt-get update
    sudo apt-get install build-essential uuid-dev git gcc-12 g++-12 python3 \
                         virtualenv g++-12-aarch64-linux-gnu gcc-12-aarch64-linux-gnu \
                         device-tree-compiler mono-devel lcov
    
  2. Configure GCC-12 as the default:

    sudo update-alternatives \
      --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
      --slave /usr/bin/g++ g++ /usr/bin/g++-12 \
      --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-12 \
      --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-12 \
      --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-12 \
      --slave /usr/bin/gcov gcov /usr/bin/gcov-12
    sudo update-alternatives \
      --install /usr/bin/cpp cpp /usr/bin/cpp-12 100
    sudo update-alternatives \
      --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-12 100 \
      --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-12 \
      --slave /usr/bin/aarch64-linux-gnu-gcc-ar aarch64-linux-gnu-gcc-ar /usr/bin/aarch64-linux-gnu-gcc-ar-12 \
      --slave /usr/bin/aarch64-linux-gnu-gcc-nm aarch64-linux-gnu-gcc-nm /usr/bin/aarch64-linux-gnu-gcc-nm-12 \
      --slave /usr/bin/aarch64-linux-gnu-gcc-ranlib aarch64-linux-gnu-gcc-ranlib /usr/bin/aarch64-linux-gnu-gcc-ranlib-12 \
      --slave /usr/bin/aarch64-linux-gnu-gcov aarch64-linux-gnu-gcov /usr/bin/aarch64-linux-gnu-gcov-12
    sudo update-alternatives \
      --install /usr/bin/aarch64-linux-gnu-cpp aarch64-linux-gnu-cpp /usr/bin/aarch64-linux-gnu-cpp-12 100
    

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-nvidia/Platform/NVIDIA/Jetson/build.sh

To build Server:

cd nvidia-uefi
edk2-nvidia/Platform/NVIDIA/Server/build.sh
Clone this wiki locally