How to build Cross-Toolchain using meta-toolchain recipe from Yocto / Poky ?

This article assumes, you already have development environment setup for yocto, if not please read and setup as per “Building Yocto for Raspberry Pi / Creating Embedded Linux for RPi using Yocto”

Along with recipes for building a compiler for its internal use, OpenEmbedded also has recipes to create a full toolchain / cross-compiler environment for the host. Toolchain can be build using meta-toolchain recipe which is part of “openembedded-core” meta layer, hence we will have to first add that layer as,

 $ git clone git://git.openembedded.org/openembedded-core 
 $ cd openembedded-core/ 
 $ git checkout -b thud origin/thud 
 $ cd poky 
 $ source oe-init-build-env 

Update local.conf to add openembedded-core layer which contains recipes for compiling toolchain

 $ vim conf/bblayers.conf 
 BBLAYERS ?= " \
  /home/myuser/workspace/openembedded-core \
  /home/myuser/workspace/poky \

Now compile the toolchain as

 $ bitbake meta-toolchain 

The compilation of toolchain will take some time and its a heavy compilation which might make your development machine unresponsive based on your RAM size, you just have an option to wait, nothing else 🙂

Once the compilation is done successfully, you will see a script generated at build/tmp/deploy/sdk as,

$ ls -l tmp/deploy/sdk/

tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-cortexa7t2hf-neon-vfpv4-toolchain-2.6.2.sh

When we want to install this toolchain, use below command or steps for installation. You can either choose the default location as shown below /opt/poky/2.6.2 or override by typing some directory name, which will be created in current working directory i.e. build. We used directory name “sdk” hence the toolchain will be installed as “build/sdk”

$ ./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-cortexa7t2hf-neon-vfpv4-toolchain-2.6.2.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.6.2
=================================================================
Enter target directory for SDK (default: /opt/poky/2.6.2): sdk
You are about to install the SDK to "/home/devlab/yocto/poky/build/sdk". Proceed[Y/n]? Y
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.
 $ . /home/devlab/yocto/poky/build/sdk/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi

As you can see above build/sdk/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi script is requested to be sourced to your environment since it contain all environment variables auto generated based on your installation of toolchain/sdk.

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded
Tags:

Leave a Reply / Ask Question