How to Figure out Which Yocto Recipe is Getting Built by PetaLinux Tools 2017.4

yocto_project

This post shows how to figure out which Yocto recipe is getting built by PetaLinux Tools 2017.4.

TL;DR

Run the following and grep for the recipe you’re interested in from inside the PetaLinux project, just above the build directory:

export PETALINUX_TOOLS_INSTALL_DIR=/home/pfefferz/tools/opt/pkg/petalinux
source $PETALINUX_TOOLS_INSTALL_DIR/components/yocto/source/aarch64/environment-setup-aarch64-xilinx-linux
source $PETALINUX_TOOLS_INSTALL_DIR/components/yocto/source/aarch64/layers/core/oe-init-build-env
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PETALINUX"
which bitbake

This should drop you into the build directory. If it does, type the following to show the current and preferred versions of all recipes:

bitbake -s

Grep this to filter for the recipe you’re interested in.

This has been adapted from “Accessing BitBake in a Project” on page 80 of the PetaLinux Tools Reference Guide (link to doc below).

Motivation

Add a Yocto Layer to a PetaLinux Project and Build a Recipe in the Layer with PetaLinux Tools listed the steps to add a new Yocto layer to a PetaLinux Tools managed build.

Some layers contain multiple recipe versions.

Figuring out the Version without bitbake -s

This example uses SWUpdate.

The morty branch of the SWUpdate layer @ link contains three release recipes and a tip recipe:

./recipes-support/swupdate/swupdate_git.bb
./recipes-support/swupdate/swupdate_2016.10.bb
./recipes-support/swupdate/swupdate_2016.07.bb
./recipes-support/swupdate/swupdate_2017.01.bb

Which one gets used and why?

Which one is Used and Why?

BitBake defaults to the highest version of a provider. PREFERRED_VERSION can be used to specify a particular version.

DEFAULT_PREFERENCE can influence the default:

  • By default, files have a preference of “0”

  • Setting DEFAULT_PREFERENCE to “-1” makes the recipe unlikely to be used unless it is explicitly referenced

  • Setting DEFAULT_PREFERENCE to “1” makes it likely the recipe will be used

PREFERRED_VERSION overrides any DEFAULT_PREFERENCE setting.

To figure out which version of SWUpdate will be pulled in grep with:

pfefferz@plc2:~/plprjs5/mtd_board/components/ext_source/meta-swupdate$ grep -REns "PREFERRED_VERSION|DEFAULT_PREFERENCE" *
recipes-support/swupdate/swupdate_git.bb:4:DEFAULT_PREFERENCE = "-1"

By the rules above, BitBake will choose the highest version: 2017.1. Running bitbake -s confirms it.

This has been adapted from sections 2.3 Providers and 2.4 Preferences in version 2.2.3 of the BitBake User Manual(link to doc below).

References

  • Bitbake User Manual 2.2.3 @ link

  • PetaLinux Tools Reference Guide UG1144 (v2017.3) October 4, 2017 @ link

  • The Xilinx + Yocto graphic is an amalgamation of Xilinx and Yocto icons.

Get SWUpdate

Get SWUpdate layer and checkout morty with:

git clone https://github.com/sbabic/meta-swupdate.git 
cd meta-swupdate
git checkout morty