Debian Flexbuild Toolchain installation: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 5: Line 5:


= Introduction =
= Introduction =
The toolchain installation is an essential tool for cross-compiling {{varlink|Debian_Build_Linux|{{#var:RELEASE_NAME}}|Linux}} and {{varlink|Debian_Build_U-Boot|{{#var:RELEASE_NAME}}|U-Boot}} from source code.
Installing a toolchain is a fundamental step when cross-compiling {{varlink|Debian_Build_Linux|{{#var:RELEASE_NAME}}|Linux}} and {{varlink|Debian_Build_U-Boot|{{#var:RELEASE_NAME}}|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 =
= Prerequisites =
Please ensure your host PC is running Ubuntu 22.04/24.04 64-bit.
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 the toolchain =
From the terminal, run the following commands to update your machine and install the toolchain:
You could install GCC and the GCC cross compiler for the ARMv8 architecture with:
  $ sudo apt-get update
  $ sudo apt-get update
  $ sudo apt-get install -y gcc-aarch64-linux-gnu
  $ sudo apt-get install -y gcc gcc-aarch64-linux-gnu


= Install essential packages for cross-compilation =
Depending on the build targets further packages maybe needed:
Now, install the additional packages with the following commands:
  $ sudo apt-get install -y bc bison build-essential coccinelle \
  $ sudo apt-get install -y git sudo build-essential bison flex libssl-dev wget zlib1g-dev u-boot-tools
  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 =
= Set environment variables before starting any cross-compilation =
Line 26: Line 33:


= References =
= References =
[https://docs.u-boot.org/en/latest/build/gcc.html Building with GCC]
- [https://docs.u-boot.org/en/latest/build/gcc.html Building U-Boot with GCC]<br>
- [https://www.kernel.org/doc/html/next/process/changes.html Minimal requirements to compile the Kernel]

Revision as of 14:17, 6 June 2025

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

This page is using the default release 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

You could 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 maybe 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