How to build target and host Sysroot with yocto / poky ?

If you want to build some external packages which are using sysroot within yocto framework or buildsystem, you will first need to build the sysroot which you can then link with the package during compilation.

The matching target sysroot contains needed headers and libraries for generating binaries that run on the target architecture. The sysroot is based on the target root filesystem image that is built by the OpenEmbedded build system and uses the same Metadata configuration used to build the cross-toolchain.

Similarly host sysroot contains the prerequisite binaries, headers and libraries which are required to build target sysroot

For building host and target sysroots with yocto, follow below mentioned steps. 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”

 $ 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 sysroot

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

Once the compilation gets over, you can see the target sysroot at, build/tmp/sysroots/MACHINE e.g. build/tmp/sysroots/raspberrypi3 if you have compiled for raspberrypi3 and host sysroot is available at build/tmp/sysroots/x86_64

Related :   How to Compile and Install device-tree-compiler (DTC) On Ubuntu ?

If you want to use these sysroots for building some source, as mentioned earlier, you can use following arguments as,

STAGING_DIR_TARGET for accessing target sysroot, STAGING_DIR_NATIVE for accessing host sysroot

example : –target-sysroot=${STAGING_DIR_TARGET}


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded