OpenEmbedded®/Yocto Project®: Build From Sources

Last modified by Microchip on 2026/05/27 07:47

How to Build OpenEmbedded Core for MPU

Information

Note: Building an entire distribution is a long process. It also requires a large amount of free disk space.

Support for the Microchip MPU System-on-a-Chip (SoC) family is provided through the meta-mchp Yocto Project® layer. The source for this layer is hosted on the Linux4Microchip GitHub® account on the Microchip Yocto Project BSP page.

Building Environment

A step-by-step, comprehensive installation is explained on the Yocto Project Quick Build page. The following lines should be considered as an add-on that is MPU-specific, or that can facilitate your setup.

Step-by-Step Build Procedure
Information

Note: The README procedure is available directly in the meta-mchp-common layer. This file in the meta-mchp layer repository should be considered the reference, and the following copy may be out of sync.

Information

Note: Starting with the Linux4Microchip 2025.04 release, the meta-mchp layer supports Yocto Project templates, so make sure you create a new build environment using oe-init-build-env.

OpenEmbedded/Yocto Project BSP Layer for Microchip's SoCs
  • Description
    • The meta-mchp-common layer consolidates common Board Support Package (BSP) components and metadata for Microchip platforms, streamlining development across various Microchip devices for use with OpenEmbedded and/or Yocto Project.
  • Supported Machines
    • The meta-mchp-common layer provides support for various Microchip platforms. For detailed information about supported machines, please refer to the documentation in the relevant sub-layers:
  • Prerequisites
    • Before starting, please refer to the "Required Packages for Build Host" section in the Yocto Project documentation to install the required dependencies for the build environment:
Information

Note: Make sure to install git-lfs and repo in addition to the required packages for your Linux distribution.

For instance, on Ubuntu® or Debian®, these packages need to be installed on your development host:

sudo apt-get install gawk wget git-core git-lfs diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
     xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
     pylint3 xterm repo
  • Usage

    • To integrate this layer into your Yocto Project build environment:

    Clone the necessary repositories.

    Create an empty directory to hold the workspace:

    mkdir yocto-dev
    cd yocto-dev

    Use the repo tool to fetch all the required repositories.

    Information

    Note: Make sure to install the repo utility first.

    repo init -u https://github.com/linux4microchip/meta-mchp-manifest.git -b <branch> -m <target>/default.xml

    Replace and with the Yocto Project release branch and the manifest required. For example:

    repo init -u https://github.com/linux4microchip/meta-mchp-manifest.git -b scarthgap -m mpu/default.xml

    Fetch all the required repositories using the following repo command:

    repo sync

    Initialize the build environment.

    The meta-mchp repository provides sample configuration templates that help set up BitBake layers and key configuration files in the Yocto Project build directory.

    Set the TEMPLATECONF environment variable to point to the appropriate configuration template before initializing the build environment:

    export TEMPLATECONF=${TEMPLATECONF:-../meta-mchp/<meta-layer>/conf/templates/default}

    Replace meta-layer above with the desired layer based on your target platform. For example:

    export TEMPLATECONF=${TEMPLATECONF:-../meta-mchp/meta-mchp-mpu/meta-mchp-mpu-apps/conf/templates/default}
    Information

    Note: Setting TEMPLATECONF is only needed the first time you will run the source command.

    Then initialize the Yocto Project build environment:

    source openembedded-core/oe-init-build-env

    Set the target machine and build the image.

    MACHINE=<machine> bitbake core-image-minimal

    Each sub-layer provides several images that include demos and applications tailored for its respective platform.

    For more information on the supported images, please refer to the MPU layer README.

    • Layer dependencies

      This layer depends on the following layers:

      - meta-openembedded
       - URI: git://git.openembedded.org/meta-openembedded
       - Layers: meta-oe, meta-networking, meta-python

      - openembedded-core
       - URI: git://git.openembedded.org/openembedded-core
       - Layers: meta

    For information on the specific revisions used, refer to the meta-mchp manifest repository.

  • Licensing
    • The contents of this layer are licensed under the MIT License. See COPYING.MIT for details.
  • Contributing 

Back to Top

 

OpenEmbedded Software Development Kit (SDK)

The meta-toolchain recipes build tarballs that contain a cross-compilation toolchain, cross-compiled libraries, header files, and configuration tools suitable for application development outside OpenEmbedded.

The cross-compilation toolchain and all cross-compiled libraries are included in this Software Development Kit (SDK), allowing users to match exactly what is provided in the associated Linux4SAM demo image.

Using a different cross-compilation toolchain may lead to undefined symbols and mismatched library calls. Because the SDK matches the software available on the target system, developers can fully use the shared libraries typically expected in an embedded Linux® environment.

This cross-development cycle does not need to be integrated into an OpenEmbedded build flow. Standard development tools such as Makefiles, CMake, or IDEs can be used. This allows the development phase to remain separate from the integration phase.

Build OpenEmbedded 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 OpenEmbedded 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.

Note: Some of the SDK variants can apply to several boards or SoCs (the 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 of the user, as well as the appropriate installation rights:

Hereunder is an example with an 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 OpenEmbedded SDK

The installation directory (/opt/oecore) contains a setup script that 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"
[...]

Note: To be able to compile the EGT demo applications provided in the Linux4SAM release, the 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 steps below.

$ 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

Note: To use the SDK toolchain directly, one can refer to the Yocto Project documentation.

Back to Top

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 fine-grained control over the package building.

Hello World example

Back to Top

Recent FAQ

Back to Top