First you need to decide how you are going to be building for Yocto
Building using a prebuild Yocto SDK and a prebuild sd-card image. This tend to be the fastest way to get started.
- Ubuntu 16.04
- Python 3.5 (this is standard in Ubuntu 16.04)
- 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
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:
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
./fsl-imx-internal-xwayland-glibc-x86_64-fsl-image-gui-aarch64-toolchain-4.9.51-mx8-beta.sh
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 fsAnother 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.5 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.export FSL_PLATFORM_NAME=Yocto export ROOTFS=~/sdk/4.9.51-mx8-beta/sysroots/aarch64-poky-linux
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.4+
It should be part of the default Ubuntu install.
If you use 3.4 you need to install the 'typing' library manually so we highly recommended using 3.5 or newer.
To install the typing library in Python 3.4 run:
sudo apt-get install python3-pip sudo pip3 install typing
- A working yocto build
For example follow one of these:
- http://git.freescale.com/git/cgit.cgi/imx/fsl-arm-yocto-bsp.git/
- https://community.freescale.com/docs/DOC-94866
- 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:
a. Perform step 1
bash MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-x11 -e x11
b. Perform step 2
bash 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:
a. Perform step 1
bash MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-fb -e fb
b. Perform step 2
bash 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:
a. Perform step 1
bash MACHINE=imx6qpsabresd source fsl-setup-release.sh -b build-wayland -e wayland
b. Perform step 2
bash 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).Also verify that the script detect that you are doing a Yocto build by outputtingsource prepare.sh
If it doesn't you can override the platform auto detection by setting the environment variablePlatformName: Yocto
Before running the prepare.sh script.export FSL_PLATFORM_NAME=Yocto
- Make sure that you performed the [simple setup].
- Compile everything (a good rule of thumb for '--BuildThreads N' is number of cpu cores * 2)
WindowSystem can be set to either: FB, Wayland or x11
FslBuild.py --Variants [WindowSystem=FB] -t sdk --BuildThreads 2
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 (a good rule of thumb for '--BuildThreads N' is number of cpu cores * 2)
WindowSystem can be set to either: FB, Wayland or x11
FslBuild.py --Variants [WindowSystem=FB] --BuildThreads 2
- 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 (a good rule of thumb for '--BuildThreads N' is number of cpu cores * 2)
WindowSystem can be set to either: FB, Wayland or x11
FslBuild.py --Variants [WindowSystem=FB] --BuildThreads 2
Note:
Once a build has been done once you can just invoke the make file directly. However this requires that you didn't change any dependencies or add files.
To do this run
bash make -f GNUmakefile_Yocto -j 2 WindowSystem=FB
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.
- 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
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.
FslBuild.py -- install
- Manually copy the build Exectuable 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 linux vulkan SDK.
- Download the vulkan sdk from https://vulkan.lunarg.com/sdk/home
- Make the downloaded file executable
chmod ugo+x vulkansdk-linux-x86_64-1.0.68.0.run
- Move the downloaded file to a sdk dir
mkdir ~/vulkan mv vulkansdk-linux-x86_64-1.0.68.0.run ~/vulkan
- Run it
cd ~/vulkan ./vulkansdk-linux-x86_64-1.0.68.0.run
- Install the necessary packages
sudo apt-get install libglm-dev graphviz libxcb-dri3-0 libxcb-present0 libpciaccess0 cmake libpng-dev libxcb-dri3-dev libx11-dev
- Setup the vulkan environment
pushd ~/vulkan/VulkanSDK/1.0.68.0 source setup-env.sh popd
- 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.