The “What I wish I’d known about Yocto Project” basic skill checklist

This is a completed version of the What I wish I’d known about Yocto Project page in the Yocto documentation.

1. Deal with corporate proxies

Use environment variables or ChameleonSocks.
https://wiki.yoctoproject.org/wiki/Working_Behind_a_Network_Proxy

2. Add a package to an image

To add a package to your image using the local configuration file, use the
IMAGE_INSTALL variable with the _append operator:

IMAGE_INSTALL_append = " strace"

Use EXTRA_IMAGE_FEATURES from within your local.conf file:

EXTRA_IMAGE_FEATURES ?= "debug-tweaks"

3. Understand the difference between a recipe and package

A recipe describes how to fetch, unpack, build, install a single piece of software.
A package is the output of that recipe in binary form. i.e. .rpm, .deb, etc…

4. Build a package by itself and why that’s useful

You can check if a single package is configured correctly by building it individually (rather than discovering problems after a long iterative build)

bitbake <basename>

where <basename> is the basename of the recipe.

5. Find out what packages are created by a recipe

Enable BuildHistory and check$(TOPDIR)/buildhistory/packagesdirectory
For example:

buildhistory/packages/all-ostl-linux/alsa-topology-conf/latest

OR

Get the packages created by this recipe:

oe-pkgdata-util list-pkgs -p <recipename>

6. Find out what files are in a package

Enable BuildHistory and check$(TOPDIR)/buildhistory/packagesdirectory
For example:

buildhistory/packages/all-ostl-linux/alsa-topology-conf/alsa-topology-conf/latest

OR

Get list of files used by a specific package:

oe-pkgdata-util list-pkg-files <pkg-name>

7. Find out what files are in an image

Enable BuildHistory and check$(TOPDIR)/buildhistory/imagesdirectory

For example:

buildhistory/images/stm32mp1_demo/glibc/st-image-core-openstlinux-eglfs/files-in-image.txt

8. Add an ssh server to an image (enable transferring of files to target)

https://wiki.yoctoproject.org/wiki/Cookbook:Example:Adding_packages_to_your_OS_image

9. Know the anatomy of a recipe

Generate a graphviz file

bitbake core-image-minimal -g

Convert dot into PDF

dot -Tpdf 'task-depends.dot' -o 'task-depends.pdf'

Grep can quickly reveal dependencies

grep 'readline.do_build' 'task-depends.dot'

You can also find dependencies of a recipe by running

bitbake-layers show-cross-depends

For example:

bitbake-layers show-cross-depends | grep example

meta/recipes-core/images/build-appliance-image_15.0.0.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-core/images/core-image-base.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-core/images/core-image-minimal-dev.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-core/images/core-image-minimal-mtdutils.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-core/images/core-image-minimal.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-extended/images/core-image-full-cmdline.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-extended/images/core-image-kernel-dev.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-extended/images/core-image-testmaster.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-graphics/images/core-image-clutter.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-graphics/images/core-image-x11.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-sato/images/core-image-sato-dev.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-sato/images/core-image-sato-sdk.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta/recipes-sato/images/core-image-sato.bb RDEPENDS meta-mylayer/recipes-example/example/example_0.1.bb
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/base.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/patch.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/terminal.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/staging.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/mirrors.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/utils.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/utility-tasks.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/metadata_scm.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/logging.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/package.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/packagedata.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/chrpath.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/package_pkgdata.bbclass
meta-mylayer/recipes-example/example/example_0.1.bb inherits meta/classes/insane.bbclass

10. Know how to create and use layers

bitbake-layers create-layer <layer-name>
bitbake-layers add-layer <layer-name>
bitbake-layers show-layers

11. Find recipes (with the OpenEmbedded Layer index)

search the website index:

https://layers.openembedded.org/layerindex/branch/master/recipes/

12. Understand difference between machine and distro settings

Board Support Package (BSP) layers provide machine-specific configurations. This type of information is specific to a particular target architecture.

The distribution layer provides top-level or general policies for the images or SDKs being built for a particular distribution.

13. Find and use the right BSP (machine) for your hardware

Preparing Your Build Host to Work With BSP Layers

14. Find examples of distro features and know where to set them

15. Understanding the task pipeline and executing individual tasks

16. Understand devtool and how it simplifies your workflow

17. Improve build speeds with shared downloads and shared state cache

18. Generate and understand a dependency graph

bitbake -g <recipe-name> && cat pn-buildlist | grep -ve "native"

Loading cache: 100% |###################################################################################################| Time: 0:00:00
Loaded 1328 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: PN build list saved to 'pn-buildlist'
NOTE: Task dependencies saved to 'task-depends.dot'
hello
binutils-cross-arm
glibc
gcc-runtime
gcc-cross-arm
linux-libc-headers
libgcc-initial
gcc-source-9.3.0
libgcc

19. Generate and understand bitbake environment

20. Build an Extensible SDK for applications development

21. Find which layer a recipe belongs to

bitbake-layers show-recipes <recipe-name>

22. Find packages contained in image

bitbake -g <image-name> && cat pn-buildlist | grep -ve "native"

23. Find the entire list of packages created in last build:

oe-pkgdata-util list-pkgs

Leave a Reply

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