Date added: November 8, 2018
Affected Products: EDM-GNOME , EDM-IMX7 , EDM1-CF-IMX6 , EDM1-CF-IMX6SX , EDM1-FAIRY , EDM1-GOBLIN , EDM1-IMX6UL , EDM2-ELF , EDM2-GREMLIN , EDM2-IMX6PLUS , PICO-DWARF , PICO-HOBBIT , PICO-IMX6 , PICO-IMX6UL , PICO-IMX7 , PICO-IMX8M , PICO-NYMPH , PICO-PI , PICO-PI-8M , PICO-PI-IMX8M , TEK3-IMX6 , TEK3-IMX6UL , TEP-0500-IMX6UL , TEP-0500-IMX7 , TEP-0700-IMX6UL , TEP-0700-IMX7 , TEP-1010-IMX6 , TEP-1560-IMX6 , TWP-1010-IMX6 , TWP-1560-IMX6 , WANDPI-8M , WBDUAL , WBQUAD , WBSOLO
If you are building from source with Yocto, Yocto automatically builds a native toolchain from source. In many cases, you will also want to build binaries for 32-bit or 64-bit ARM targets without using Yocto to build a toolchain for you. The following steps will show you how to download and prepare your host with a Linaro toolchain.
Download the toolchain from Linaro:
For 32-bit targets such as i.MX6, i.MX6UL, and i.MX6, the toolchain you use depends on the version of kernel and bootloader, as well as the target processor architecture:
Currently, for 64-bit ARM targets such as PICO-IMX8M, we are using the following Linaro GCC toolchain, which can be downloaded from here:
Install the toolchain
We normally install the toolchain into the /opt directory on our Linux host:
tar xvf [toolchain-file.tar.xz] -C /opt/
Export the environment
When you are building a binary for target CPU architectures other than that of your host, you are cross-compiling. To do that with GCC, you should set up certain environment variables that are used by the other tools to ensure that you are calling the correct toolchain executables when building. For kernel and u-boot, you should also set the ARCH variable to the appropriate processor architecture.
export PATH=$PATH:/opt/[toolchain directory]/bin
For ARM64 (64-bit ARM) targets such as i.MX8M:
export CROSS_COMPILE=/opt/[toolchain directory]/bin/aarch64-linux-gnu-
For 32-bit ARM targets such as i.MX6 and i.MX7:
export CROSS_COMPILE=/opt/[toolchain directory]/bin/arm-linux-gnueabihf-
Note that you will need to do this in every Linux terminal in which you intend to build for your target.