OpenEmbedded / Yocto Project : build from sources

Last modified by Microchip on 2025/06/09 11:28

How to build OE core for MPU

Failed to execute the [display] macro. Cause: [Current user [null] doesn't have view rights on document [xwiki:Development.applications.linux4sam.faq.oebuild.oe-build.WebHome]]. Click on this message for details.

OE SDK

The meta-toolchain recipes build tarballs which contain cross compilation toolchain, cross compiled libraries, includes and configuration tools suitable for application development outside OE.
The cross-compilation toolchain and all coss-compiled libraries will be present in this SDK allowing the user to exactly match what is provided in the associated Linux4SAM demo image.

If a random cross-compilation toolchain was used, it would lead to undefined symbols and unmatched library calls. With this SDK matching what is present on the target, cross-development is enhanced with all possibilities offered by shared libraries that any embedded Linux developer could expect from such a system.
This cross-development cycle doesn't have to be integrated within an OpenEmbedded integration flow: usual Makefiles, cmake, IDE... in short: any developer-friendly environment could be used allowing the separation of the development phase from the integration phase.

Build OE SDK

This SDK is generated using the bitbake handy target populate_sdk.

bitbake -c populate_sdk mchp-graphics-image

or

bitbake -c populate_sdk mchp-headless-image

It will produce a comprehensive SDK script (auto-extracting archive) available in the deployment directory: from the build directory it is usually located in tmp/deploy/sdk.
For instance, for the sama5d27-wlsom1-ek-sd graphic image type of SDK, you can find it available in: tmp/deploy/sdk/oecore-mchp-graphics-image-x86_64-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-nodistro.0.sh

Install OE SDK

Once the SDK archive is generated, you can install it by running the script directly. Choose the appropriate script name according to your board.

HELP Note that some of the SDK variants can apply on several boards or SoC (sama5d2 or sama5d4 SDK could match all boards equipped with these SoCs). You can check the Yocto Project SDK table for more information about the different SDK "flavors".

Some installation information will be asked to the user as well as the appropriate installation rights:

Hereunder is an example with a SDK from the Scarthgap branch of OpenEmbedded present in Linux4SAM 2024.10:

$ ./oecore-mchp-graphics-image-x86_64-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-nodistro.0.sh
OpenEmbedded SDK installer version nodistro.0
=============================================
Enter target directory for SDK (default: /usr/local/oecore-x86_64): /opt/oecore
You are about to install the SDK to "/opt/oecore". Proceed [Y/n]? Y
[sudo] password for dharma:
Extracting SDK............................................................................................................................................................................................................................done
Setting it up...      done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/oecore/environment-setup-cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi

Use OE SDK

The installation directory (/opt/oecore) contains a setup script which can be sourced to initialize all required environment variables.

$ cd /opt/oecore/
$ source environment-setup-cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi

You can check your new environment

export | less
[...]
declare -x AR="arm-oe-linux-gnueabi-ar"
declare -x ARCH="arm"
declare -x AS="arm-oe-linux-gnueabi-as "
declare -x CC="arm-oe-linux-gnueabi-gcc  -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a5 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=/opt/oecore/sysroots/cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi"
[...]
declare -x CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
declare -x CMAKE_TOOLCHAIN_FILE="/opt/oecore/sysroots/x86_64-oesdk-linux/usr/share/cmake/OEToolchainConfig.cmake"
declare -x CONFIGURE_FLAGS="--target=arm-oe-linux-gnueabi --host=arm-oe-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=/opt/oecore/sysroots/cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi"
[...]
declare -x OECORE_DISTRO_VERSION="nodistro.0"
declare -x OECORE_NATIVE_SYSROOT="/opt/oecore/sysroots/x86_64-oesdk-linux"
declare -x OECORE_SDK_VERSION="nodistro.0"
declare -x OECORE_TARGET_ARCH="arm"
declare -x OECORE_TARGET_OS="linux-gnueabi"
[...]

NoteTo be able to compile the EGT demo applications provided in the Linux4SAM release, SDK needs to be generated using a clone of meta-atmel.

Note EGT demo applications can be compiled using the OE SDK by following the below steps

$ source environment-setup-cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi
$ git clone --recursive https://github.com/linux4sam/egt.git
$ cd egt/
$ ./autogen.sh
$ ./configure --host="arm"
$ make

NoteTo use the SDK toolchain directly one can refer to the Yocto Project documentation.

Tips & tricks

BitBake

  • BitBake User Manual
  • BitBake Cheat Sheet
  • List tasks provided by a package:

    bitbake -c listtasks <package_name>You can use one of those tasks to have a fine grained control over the package building.

Hello World example

Reference to the "Hello World" example.

Recent FAQ

 YoctoProject