First you need to decide how you are going to be building for Yocto
Third party software downloads are now disabled per default. To build using an old Yocto release that doesn't come with all third party software you need to add --Recipes [*]
to your command line which will re-enable the download.
- Building using a prebuild Yocto SDK
- Building using a full Yocto build
- Using the demo framework
- To Compile and run an existing sample application
- To create a new demo project named 'CoolNewDemo'
- Copying DemoFramework apps to the sdcard
- Building Vulkan demo framework apps
- Building OpenCV demo framework apps
Building using a prebuild Yocto SDK and a prebuild sd-card image. This tend to be the fastest way to get started.
-
Ubuntu 22.04
-
Python 3.6 (this is standard from Ubuntu 16.04 and forward)
-
A prebuild sdk for your board typically called something like
toolchain.sh
-
A prebuild sd-card image for your board typically called
BoardName.rootfs.sdcard.bz2
-
Git
sudo apt-get install git
-
Ninja build
sudo apt-get install ninja-build
For this guide we will assume you are using a FB image.
- Download the DemoFramework source using git.
It's also a good idea to read the introduction to the FslBuild toolchain
-
Start a terminal (ctrl+alt t)
-
Install the sdk:
./fsl-imx-internal-xwayland-glibc-x86_64-fsl-image-gui-aarch64-toolchain-4.9.51-mx8-beta.sh
Chose where to install it, you can use the default location or a location of your choice. For this example, we use "~/sdk/4.9.51-mx8-beta". When the setup is complete it will list the configuration script you need to run to configure the sdk environment. Something like this
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . ~/sdk/4.9.51-mx8-beta/environment-setup-aarch64-poky-linux
-
Your SDK is now installed.
-
Start a terminal (ctrl+alt t)
-
Prepare the yocto build environment by running the config command you got during the sdk install
. ~/sdk/4.9.51-mx8-beta/environment-setup-aarch64-poky-linux
-
You should now be ready to build using the demo framework. However, if you experience issues with the
prepare.sh
script you can help it out by defining the platform name and the location of the root fsexport FSL_PLATFORM_NAME=Yocto export ROOTFS=~/sdk/4.9.51-mx8-beta/sysroots/aarch64-poky-linux export FSL_HOST_ROOTFS=~/sdk/4.9.51-mx8-beta/sysroots/x86_64-poky-linux
Another possible error you can encounter is that the FslBuild.py scripts fail to include the 'typing' library. This can happen because the SDK comes with a too old Python3 version or a incomplete Python3.6 version. As a workaround for that you could delete the Python3 binaries from the SDK which will cause it to use the system Python3 version instead.
You are now ready to start building Yocto apps using the demo framework. Please continue the guide at [Using the demo framework].
Building using a full manually build Yocto build. This process provides the most flexible solution but it also takes significantly longer to build the initial Yocto sdcard and toolchain.
-
The Ubuntu version required by the BSP release.
-
Python 3.6+ It should be part of the default Ubuntu install.
-
Ninja build
sudo apt-get install ninja-build
-
A working yocto build For example follow one of these:
- https://github.com/nxp-imx/imx-manifest
- Or read from here: [Preparing a Yocto build]
For this guide we will assume you are using a FB image.
- Download the DemoFramework source using git.
It's also a good idea to read the introduction to the FslBuild toolchain
Before you build one of these yocto images you need to
-
Run the yocto build setup (X11 example).
MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-x11 -e x11
-
Bake
bitbake fsl-image-gui bitbake meta-toolchain bitbake meta-ide-support
You can now build one of the images below (or a custom one)
Example:
-
Perform step 1
MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-x11 -e x11
-
Perform step 2
bitbake fsl-image-gui bitbake meta-toolchain bitbake meta-ide-support
Extracted rootfs
We assume your yocto build dir is located at ~/fsl-release-bsp/build-x11
and
that the rootfs will be unpacked to ~/unpacked-rootfs/build-x11
and
the image is called fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2
(you will need to locate your image name)
runqemu-extract-sdk ~/fsl-release-bsp/build-x11/tmp/deploy/images/imx6qpsabresd/fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2 ~/unpacked-rootfs/build-x11
Example:
-
Perform step 1
MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-fb -e fb
-
Perform step 2
bitbake fsl-image-gui bitbake meta-toolchain bitbake meta-ide-support
Extracted rootfs
We assume your yocto build dir is located at ~/fsl-release-bsp/build-fb
and
that the rootfs will be unpacked to ~/unpacked-rootfs/build-fb
and
the image is called fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2
(you will need to locate your image name)
runqemu-extract-sdk ~/fsl-release-bsp/build-fb/tmp/deploy/images/imx6qpsabresd/fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2 ~/unpacked-rootfs/build-fb
Example:
-
Perform step 1
MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-wayland -e wayland
-
Perform step 2
bitbake fsl-image-gui bitbake meta-toolchain bitbake meta-ide-support
Extracted rootfs
We assume your yocto build dir is located at ~/fsl-release-bsp/build-wayland
and
that the rootfs will be unpacked to ~/unpacked-rootfs/build-wayland
and
the image is called fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2
(you will need to locate your image name)
runqemu-extract-sdk ~/fsl-release-bsp/build-wayland/tmp/deploy/images/imx6qpsabresd/fsl-image-gui-imx6qpsabresd.rootfs.tar.bz2 ~/unpacked-rootfs/build-wayland
-
Start a terminal (ctrl+alt t)
-
Prepare the yocto build environment
pushd ~/fsl-release-bsp/build-fb/tmp source environment-setup-cortexa9hf-neon-poky-linux-gnueabi export ROOTFS=~/unpacked-rootfs/build-fb export FSL_PLATFORM_NAME=Yocto popd
You are now ready to start building Yocto apps using the demo framework, please continue the guide at [Using the demo framework].
-
Make sure that you performed the Yocto environment setup for your chosen Yocto environment.
- SDK build [Yocto SDK environment setup]
- Custom build [Yocto environment setup].
-
cd to the demoframework folder
-
Run the
prepare.sh
file located in the root of the framework folder to configure the necessary environment variables and paths. Please beware that theprepare.sh
file requires the current working directory to be the root of your demoframework folder to function (which is also the folder it resides in).source prepare.sh
Also verify that the script detect that you are doing a Yocto build by outputting
PlatformName: Yocto
If it doesn't you can override the platform auto detection by setting the environment variable
export FSL_PLATFORM_NAME=Yocto
Before running the prepare.sh script.
The general approach will be:
-
Make sure that you performed the simple setup, including the API's the sample need.
-
Change directory to the sample directory:
cd DemoApps/<MAIN-API-NAME>/<SAMPLE-NAME>
Example MAIN-API-NAME's: GLES2, GLES3, OpenCL, Vulkan.
Type
dir
to see the dir choice.Example SAMPLE-NAME's: Bloom, S06_Texturing.
Type
dir
after entering a API folder to see the list of samples -
Build and the application.
FslBuild.py --Variants [WindowSystem=FB]
WindowSystem can bet set to either
FB
,Wayland
,Wayland_IVI
,X11
be sure to pick the right one. If the app doesn't require a WindowSystem the--Variants [WindowSystem=FB]
can be omitted.
The following commands are also pretty useful to know.
Command | Description |
---|---|
FslBuild.py |
To build the example. |
FslBuild.py --ListVariants |
List all the build variants that can be specified. List all the build variants that can be specified. This is useful to see the WindowSystem's. |
FslBuildInfo.py --ListRequirements |
To list the samples requirements. |
It is also recommended to check out the README.md
and Example.jpg
that is included with all samples.
Note:
If you add source files to a project or change the Fsl.gen file then run the
FslBuildGen.py
script in the project root folder to regenerate the various
build files or just make sure you always use the FslBuild.py
script as it
automatically adds files and regenerate build files as needed.
In this example we will utilize the GLES2.S06_Texturing app.
-
Make sure that you performed the simple setup.
-
Change directory to the sample directory:
cd DemoApps/GLES2/S06_Texturing
-
Compile the project
FslBuild.py --Variants [WindowSystem=FB]
In this example we will utilize the GLES2.S06_Texturing
app.
-
Make sure that you performed the simple setup.
-
Change directory to the sample directory:
cd DemoApps/GLES2/S06_Texturing
-
Compile and install the project to
$FSL_GRAPHICS_SDK/bin
FslBuild.py --Variants [WindowSystem=FB] -c install --CMakeInstallPrefix $FSL_GRAPHICS_SDK/bin
-
Copy the content of
$FSL_GRAPHICS_SDK/bin
to the target
-
Make sure that you performed the simple setup including the additional OpenGL ES setup.
-
Change directory to the appropriate sample directory:
cd DemoApps/<MAIN-API-NAME>
Example MAIN-API-NAME's: GLES2, GLES3, OpenCL, Vulkan.
Type
dir
to see the dir choice. -
Create the project template using the FslBuildNew.py script
FslBuildNew.py <TEMPLATE-NAME> CoolNewDemo
Example TEMPLATE-NAME's: GLES2, GLES3, OpenCL1_2, OpenCV4, Vulkan.
To get a full list run
FslBuildNew.py . . --List
-
Change directory to the newly created project folder 'CoolNewDemo'
cd CoolNewDemo
-
Compile the project
FslBuild.py --Variants [WindowSystem=FB]
Note:
If you add source files to a project or change the Fsl.gen file then run the
FslBuildGen.py
script in the project root folder to regenerate the various
build files or just make sure you always use the FslBuild.py
script as it
automatically adds files and regenerate build files as needed.
In this example we will create a GLES2 app called CoolNewDemo.
-
Make sure that you performed the simple setup
-
Change directory to the GLES2 sample directory:
cd DemoApps/GLES2
-
Create the project template using the FslBuildNew.py script
FslBuildNew.py GLES2 CoolNewDemo
-
Change directory to the newly created project folder 'CoolNewDemo'
cd CoolNewDemo
-
Compile the project
FslBuild.py --Variants [WindowSystem=FB]
WindowSystem can bet set to either
FB
,Wayland
,Wayland_IVI
,X11
be sure to pick the right one.
-
Make sure that you performed the simple setup.
-
Compile everything (a good rule of thumb for '--BuildThreads N' is number of cpu cores * 2) If '--BuildThreads' is not specified it will be set to 'auto' which uses your cpu core count.
FslBuild.py --Variants [WindowSystem=FB] -t sdk --BuildThreads 2
WindowSystem can bet set to either
FB
,Wayland
,Wayland_IVI
,X11
be sure to pick the right one.
-
Make sure that you performed the simple setup
-
Change directory to the GLES2 sample directory:
cd DemoApps/GLES2
-
Create the project template using the
FslBuildNew.py
scriptFslBuild.py --ListFeatures
- Mount the SDK card in ubuntu.
- Manually copy the build Exectuable and its content directory to the sdcard
- Unmount the sdcard
-
Mount the SDK card in ubuntu.
-
Build using
FslBuild.py -- install
This will cause the app to install itself and its content to the the demo framework root under a directory called bin. This directory can then be copied manually to the sdcard. Beware that 'install' can be used for all build commands, so you could build all apps and then just copy the bin directory.
-
Manually copy the build Executable and its content directory to the sdcard
-
Unmount the sdcard
To build Vulkan demoes you need access to the glslangValidator tool which is used to compile shaders into SPIR-V format. The easiest way to get it is to install the Vulkan SDK, See the official SDK guide
-
Download the Vulkan sdk from https://vulkan.lunarg.com/sdk/home
-
Move the downloaded file to a sdk dir
mkdir ~/vulkan mv vulkansdk-linux-x86_64-1.1.92.1.tar.gz ~/vulkan
-
Unpack it it
cd ~/vulkan tar zxf vulkansdk-linux-x86_64-1.1.92.1.tar.gz
-
Install the necessary packages
sudo apt-get install libglm-dev cmake libxcb-dri3-0 libxcb-present0 libpciaccess0 libpng-dev libxcb-keysyms1-dev libxcb-dri3-dev libx11-dev libmirclient-dev libwayland-dev libxrandr-dev libxcb-ewmh-dev
-
Setup the vulkan environment
pushd ~/vulkan/1.1.92.1 source setup-env.sh popd
-
Ensure that the LIBRARY_PATH is set for GCC
export LIBRARY_PATH=$VULKAN_SDK/lib:$LIBRARY_PATH
-
Run the normal setup.
-
Edit the
<build directory>/conf/local.conf
file and add the line:CORE_IMAGE_EXTRA_INSTALL += "libopencv-core-dev libopencv-highgui-dev"
- Help: http://imxcv.blogspot.dk/2014/02/building-opencv-24x-for-freescales-imx6.html
- Note: CORE_IMAGE_EXTRA_INSTALL += "gpu-viv-bin-mx6q gpu-viv-bin-mx6q-dev" does not appear to be needed.