Debian Toolchain installation: Difference between revisions

From Variscite Wiki
(Initial: Based on Yocto_Toolchain_installation (20:29, 23 March 2023‎‎‎))
 
(Update to Debian)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use RELEASE_MORTY_V1.0_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use mx8m-debian-bullseye-5.4-2.1.x-v1.4 as default
--> {{INIT_RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}}<!--
--> {{INIT_RELEASE_PARAM|mx8m-debian-bullseye-5.4-2.1.x-v1.4}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|Debian toolchain installation for out of Debian builds}} {{DocImage|category1=Debian|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{#varexists:DEFAULT_IMAGE_BB_NAME | | {{ #vardefine:DEFAULT_IMAGE_BB_NAME | fsl-image-gui }} }} <!--
--> {{#vardefine:TOOLCHAIN_INSTALL_NAME | {{#switch: {{#var:SOC_SERIES|imx6}}
        |imx9|
        |imx8|={{#var:TOOLCHAIN_INSTALL_XWAYLAND_NAME}}
        |{{#var:TOOLCHAIN_INSTALL_X11_NAME}}
        }}}}<!--
--> {{#vardefine:TOOLCHAIN_INSTALL_NAME |  {{#var:TOOLCHAIN_INSTALL_B2QT_NAME | {{#var:TOOLCHAIN_INSTALL_NAME}}}}}} <!-- Override YOCTO_INSTALL_NAME if TOOLCHAIN_INSTALL_B2QT_NAME exists
--> {{#vardefine:BB_ENV | {{#var:BB_ENV|{{#varexists: B2QT_GIT | MACHINE={{#var:MACHINE_NAME}} | }} }} }} <!--
--> {{#vardefine:B2QT_OR_YOCTO | {{#varexists: B2QT_GIT | B2QT | Yocto }} }} <!--
--> {{PageHeader|Yocto toolchain installation for out of Yocto builds}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__


== Prerequisites==
= Installing the toolchain =
A full {{#var:B2QT_OR_YOCTO}} build environment is required for the toolchain generation.<br>
To setup a {{#var:B2QT_OR_YOCTO}} build environment follow steps 1 & 3 of the {{Varlink|{{#var:B2QT_OR_YOCTO}}_Build_Release|{{#var:RELEASE_LINK}}|Build {{#var:B2QT_OR_YOCTO}} from source code}} guide and then proceed to either the toolchain or complete SDK steps below:


== Build a toolchain ==
To install the toolchain, please go through the following steps of the {{varlink|Debian Build Release Stage|{{#var:RELEASE_LINK}}|Debian Build Release}} guide:
{{#lst:Yocto_Platform_Customization|YOCTO_ENV_SETUP_X}}
# {{varlink|Debian Build Release Stage#Setup Development Environment|{{#var:RELEASE_LINK}}|Setup Development Environment}}
# {{varlink|Debian Build Release Stage#Installing required packages|{{#var:RELEASE_LINK}}|Installing required packages}}
# {{varlink|Debian Build Release Stage#Download Debian archive|{{#var:RELEASE_LINK}}|Download Debian archive}}
# {{varlink|Debian Build Release Stage#Deploy sources|{{#var:RELEASE_LINK}}|Deploy/Fetch the sources and components}}


$ {{#var:BB_ENV}} bitbake {{#varexists: DEFAULT_TOOLCHAIN_BB_NAME | {{#var:DEFAULT_TOOLCHAIN_BB_NAME}} | {{#varexists: B2QT_BSP_VERSION | meta-toolchain-b2qt-embedded-qt5-sdk | meta-toolchain}} }}
You will have a development environment from this point, including the toolchain and the packages ready to be used.


== Build a complete SDK ==
The GNU Linux toolchain '''{{#var:TOOLCHAIN}}''' can be found at {{#var:BUILD_FOLDER}}/toolchain. <!--


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.
-->{{Note|'''Note:''' Alternatively, you can download the toolchain directly from the [https://releases.linaro.org/components/toolchain/binaries/ Linaro toolchain binaries archive]. Anyway, If you're considering downloading the toolchain directly, please still follow steps 1 and 2.
{{#lst:Yocto_Platform_Customization|YOCTO_ENV_SETUP_X}}
|info}}


E.g. when using the {{#var:DEFAULT_IMAGE_BB_NAME}} image:
= Build the sysroot/rootfs =
$ {{#var:BB_ENV}} bitbake -c populate_sdk {{#var:DEFAULT_IMAGE_BB_NAME}}
{{Note|The SDK should match the rootfs image on the target, otherwise you may experience difficulties when trying to debug application failures.}}


== Install the toolchain/SDK ==
To build the rootfs, which can be used as the sysroot for the cross-compilation, please follow the steps of the section {{varlink|Debian Build Release Stage#Setup and build Debian|{{#var:RELEASE_LINK}}|Setup and build Debian}}.
Install the tools by running the resulted script in tmp/deploy/sdk/.


E.g.
The Debian build script uses debootstrap to create a minimal Debian {{#var:DEBIAN_NAME}} system and adds the BSP support. Please consider installing extra (dev-)packages to your Debian file system as per your needs.
$ tmp/deploy/sdk/{{#var:TOOLCHAIN_INSTALL_NAME}}
Note: The toolchain/script name depends on your build machine and the bitbaked image/recipe, and may change.<br>
<br>
Accept all the default options, and at the end of the installation you should see the following:
<pre>
SDK has been successfully set up and is ready to be used.
</pre>


== Use the toolchain/SDK ==
A guide for adding or updating packages can be found here:
Each time you wish to use the toolchain in a new shell session, you need to source the environment setup script:
 
$ source {{#var:TOOLCHAIN_LOCATION}}{{#ifeq: {{#var:SOC_SERIES}}|imx8|<br>$ export LDFLAGS=|}}
* {{varlink2|Adding Debian packages|{{#var:RELEASE_LINK}}}}
* {{varlink|Debian Package Update|{{#var:RELEASE_LINK}}|Updating Debian packages}}
 
You can look up the available packages for Debian {{#var:DEBIAN_NAME}} at the [https://www.debian.org/distrib/packages Debian packages directory].<!--
 
-->{{Note|'''Note''': Keeping the host-side's rootfs in sync with the target' is recommended to avoid issues. Therefore, using NFS to share the host-side's rootfs with the target could be a good practice during development.
Please refer to the {{Varlink2|Debian Setup TFTP/NFS|{{#var:RELASE_LINK}}}} guide for more information on how to setup a TFTP/NFS configuration.
}}

Revision as of 15:22, 21 April 2023

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

This page is using the default release mx8m-debian-bullseye-5.4-2.1.x-v1.4.
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 installation for out of Debian builds

Installing the toolchain

To install the toolchain, please go through the following steps of the Debian Build Release guide:

  1. Setup Development Environment
  2. Installing required packages
  3. Download Debian archive
  4. Deploy/Fetch the sources and components

You will have a development environment from this point, including the toolchain and the packages ready to be used.

The GNU Linux toolchain gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu can be found at ~/debian_imx8mq-var-dart_debian_bullseye/toolchain.

Note: Alternatively, you can download the toolchain directly from the Linaro toolchain binaries archive. Anyway, If you're considering downloading the toolchain directly, please still follow steps 1 and 2.

Build the sysroot/rootfs

To build the rootfs, which can be used as the sysroot for the cross-compilation, please follow the steps of the section Setup and build Debian.

The Debian build script uses debootstrap to create a minimal Debian Bullseye system and adds the BSP support. Please consider installing extra (dev-)packages to your Debian file system as per your needs.

A guide for adding or updating packages can be found here:

You can look up the available packages for Debian Bullseye at the Debian packages directory.

Note: Keeping the host-side's rootfs in sync with the target' is recommended to avoid issues. Therefore, using NFS to share the host-side's rootfs with the target could be a good practice during development.

Please refer to the Debian Setup TFTP/NFS guide for more information on how to setup a TFTP/NFS configuration.