Debian Flexbuild Toolchain installation

From Variscite Wiki
Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release mx8mm-debian-bookworm-6.6.52_24.12-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release


Debian toolchain 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 for the ARMv8 architecture with:

$ sudo apt-get update
$ sudo apt-get install -y gcc gcc-aarch64-linux-gnu

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, you should first run the following commands:

$ export CROSS_COMPILE=aarch64-linux-gnu-
$ export ARCH=arm64

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

References

- Building U-Boot with GCC
- Minimal requirements to compile the Kernel