Yocto: bitbake build/populate sysroot

Yocto stops building the global sysroot (both native and cross) from version 2.6. To build any package yocto copies the sysroot as “recipes-sysroot” and “recipes-sysroot-native” into each WORKDIR. This stops the external application builders from using “tmp/sysroots/<MACHINE>” for cross compilation. To do the same way building external application using common sysroot and toolchain one need to build or populate the sysroot explicitly using

bitbake build-sysroots

This bitbake command explicitly populates the sysroot in “tmp/sysroots/<MACHINE>”  and “tmp/sysroots/x86_64 or x86” accordingly. With this application developers can cross compile after exporting the toolchain path “tmp/sysroots/x86_64/usr/bin/<toolchain-name>”. All the dependent cross compiled binaries and libraries can be found under “tmp/sysroots/<MACHINE>”.

Use bitbake sysroot to find provider:

You can also use this sysroot to find the provider of a particular file. For example, if you want to use blkid functionality and you don’t know the yocto/bitbake provider for this libraries or binaries to include into your recipe, you can grep for the header/library/binary inside “tmp/sysroots/<MACHINE>” directory. For this case “libblkid.so/blkid.h” is provided by util-linux, which can be obtained from “manifest-armv7ahf-neon-util-linux.populate_sysroot” (machine type may vary according to your target configuration).

Reference: Build directory structure in Yocto Mega manual


No Comment

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *