Skip to content

Toolchain Installation for Out of Flexbuild Builds

Introduction

Installing a toolchain is a fundamental step when cross-compiling Linux and U-Boot from source. The toolchain provides the necessary compilers, linkers, and utilities required to build software for a target architecture different from the host system.

Prerequisites

Please ensure your host PC is running a 64-bit Debian-based distribution (e.g., Ubuntu 22.04 or 24.04). Other recent Debian-based systems may also work, but Ubuntu is the recommended and tested environment.

Install the Toolchain

Install GCC and the GCC cross compiler with:

sudo apt-get update
sudo apt-get install -y gcc gcc-arm-linux-gnueabihf

Depending on the build targets, further packages may be needed:

sudo apt-get install -y bc bison build-essential coccinelle  device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick  libgnutls28-dev libguestfs-tools libncurses-dev  libpython3-dev libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl  pkg-config python3 python3-asteval python3-coverage python3-filelock  python3-pkg-resources python3-pycryptodome python3-pyelftools  python3-pytest python3-pytest-xdist python3-sphinxcontrib.apidoc  python3-sphinx-rtd-theme python3-subunit python3-testtools  python3-venv swig uuid-dev u-boot-tools

Set Environment Variables Before Starting Any Cross-Compilation

Right before starting to compile U-Boot or Linux, run the following commands:

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm

This is needed to tell the compiler which toolchain should be used.

References