Yocto Images
meta-toolchain
To be able to build your own application or, for example, U-Boot and the Linux kernel outside of Yocto you need a toolchain. The toolchain consists of cross-compiler, linker, and necessary libraries. As mentioned in the Available Images section there is an image named meta-toolchain that will create the necessary toolchain. Note that this toolchain is very basic, to have a more complete toolchain see Improved Toolchain.
Build the image
bitbake meta-toolchain
The build will result in a file located at
<build dir>/tmp/deploy/sdk
. The exact name of the file depends on several factors, but in our example, it is called:fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa9hf-neontoolchain-4.14.78-sumo.sh
Install the toolchain
cd <build dir>/tmp/deploy/sdk
sudo ./fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa9hf-neontoolchain-4.14.78-sumo.shIf you select the default settings the toolchain will in this example be installed in
/opt/fslimx-fb/4.14-sumo/
Before building an application run the command below to setup environment variables
source /opt/fsl-imx-fb/4.14-sumo/environment-setup-cortexa9hfneon-poky-linux-gnueabi
If you get linker error(s) when compiling for an iMX8 target, unset LDFLAGS as below
unset LDFLAGS
You can verify that the environment variables has been correctly setup by running the command below that will show the version of the GCC compiler used.
$CC –-version
arm-poky-linux-gnueabi-gcc (GCC) 7.3.0
...
Note
Setting up environment variables in step 5 may overwrite other variables you already have in your environment. It is, for example, not recommended to do this in the same terminal where you run bitbake to build Yocto images.
Improved Toolchain
The toolchain created above is perfectly fine for compiling e.g. the Linux kernel or U-Boot. However, it does not support all the extra packages added to the image for the target like gstreamer, v4l or wayland. To get a toolchain that is customized for the image that you are using (this example shows ea-image-base for Linux 5.15.32 for iMX8MQ, but it could just as well be your own image):
Build the image
bitbake ea-image-base
Build the toolchain
bitbake ea-image-base -c populate_sdk
The build will result in a file located at
<build dir>/tmp/deploy/sdk
. The exact name of the file depends on several factors, but in our example, it is called:fsl-imx-wayland-glibc-x86_64-ea-image-base-armv8a-imx8mqea-com-toolchain-5.15-kirkstone.sh
Install the toolchain
cd <build dir>/tmp/deploy/sdk
sudo ./fsl-imx-wayland-glibc-x86_64-ea-image-base-armv8a-imx8mqea-com-toolchain-5.15-kirkstone.shIf you select the default settings the toolchain will in this example be installed in
/opt/fsl-imx-wayland/5.15-kirkstone/
Before building an application run the command below to setup environment variables
source /opt/fsl-imx-wayland/5.15-kirkstone/environment-setup-armv8a-poky-linux
You can verify that the environment variables has been correctly setup by running the command below that will show the version of the GCC compiler used.
$CC –-version
arm-poky-linux-gnueabi-gcc (GCC) 11.2.0
...
Note
Setting up environment variables in step 6 may overwrite other variables you already have in your environment. It is, for example, not recommended to do this in the same terminal where you run bitbake to build Yocto images.