Yocto Toolchain installation

From Variscite Wiki
Yocto toolchain installation for out of Yocto builds

Prerequisites

A full Yocto build environment is required for the toolchain generation.
To setup a Yocto build environment follow steps 1 & 3 of the Build Yocto from source code guide and then proceed to either the toolchain or complete SDK steps below:

Build a toolchain

TI SDK v8.x has a dedicated target for generating a toolchain.

$ MACHINE=am62x-var-som bitbake meta-toolchain-arago-tisdk

Build a complete SDK

To compile applications that require libraries other than glibc you should build an SDK which contains development versions of all libraries in the rootfs image, and not just the basic toolchain.

E.g. when using the var-default-image image:

$ MACHINE=am62x-var-som bitbake -c populate_sdk var-default-image
The SDK should match the rootfs image on the target, otherwise you may experience difficulties when trying to debug application failures.
TI's Yocto Dunfell Arago distribution does not officially support building the complete SDK using populate_sdk by default.
To fix it, dedicated patches have been introduced in Variscite BSP and are available only in the latest source code. For more information, please see FAQ: AM6x/AM335x/AM437x: Using a Yocto-internal toolchain for target image builds and cross-development SDK installer generation with Yocto Dunfell-based v8.x SDKs for Sitara MPUs.
Starting in Yocto Kirkstone, populate_sdk will be supported.
When including some C++ headers, TI's Yocto Dunfell toolchain may not be able to automatically find the full header path.
To fix it, the expected paths can be manually added to the list of the include paths (either in the Makefile or in the target build environment), with
-I/opt/arago-2021.09/sysroots/aarch64-linux/usr/include/c++/9.2.1 -I/opt/arago-2021.09/sysroots/aarch64-linux/usr/include/c++/9.2.1/aarch64-none-linux-gnu

Install the toolchain/SDK

Install the tools by running the resulted script in arago-tmp-external-arm-glibc/deploy/sdk.

E.g.

$ arago-tmp-external-arm-glibc/deploy/sdk/arago-2021.09-aarch64-linux-tisdk.sh

Note: The toolchain/script name depends on your build machine and the bitbaked image/recipe, and may change.

Accept all the default options, and at the end of the installation you should see the following:

SDK has been successfully set up and is ready to be used.

Use the toolchain/SDK

Each time you wish to use the toolchain in a new shell session, you need to source the environment setup script:

$ source /opt/arago-2021.09/environment-setup-aarch64-linux