Most commonly performed operations in Yocto

The Yocto Project is an embedded Linux distribution builder that makes use of several other open source projects. A Linux distribution is a collection of software packages and policies, and there are hundreds of Linux distributions available. Most of these are not designed for embedded systems and they lack the flexibility needed to accomplish target footprint sizes and functionality tweaks, as well as not catering well for resource constrained systems.

The Yocto Project, in contrast, is not a distribution per se; it allows you to create a Linux distribution designed for your particular embedded system. The Yocto Project provides a reference distribution for embedded Linux, called Poky.

The Yocto Project has the BitBake and OpenEmbedded-Core (OE-Core) projects at its base. Together they form the Yocto build system which builds the components needed for an embedded Linux product, namely:

  • A bootloader image
  • A Linux kernel image
  • A root filesystem image
  • Toolchains and software development kits (SDKs) for application development

With these, the Yocto Project covers the needs of both system and application developers. When the Yocto Project is used as an integration environment for bootloaders, the Linux kernel, and user space applications, we refer to it as system development.

1. To open the linux kernel menuconfig ( Here I am using meta-intel layer ), run the following commands.

bitbake -c menuconfig linux-intel

If you are using yocto kernel it will be:

bitbake -c menuconfig linux-yocto

2. To check whether your bbappend recipe is parsed by bitbake, run the following command:

bitbake-layers show-appends

3. To add a particular package in your root file system.

Open your local.conf file and add the recipe name below:

IMAGE_INSTALL += "recipe-name"

For example:

IMAGE_INSTALL += "libusb"

or

IMAGE_INSTALL_append = "libusb"

If you want this package to be included only in a particular image then,

IMAGE_INSTALL_append_pn-[image-name] = "recipe-name"

For example:

IMAGE_INSTALL_append_pn-core-image-sato = "libusb"

4. To include a kernel module in your root file system:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-cp210x"

5. To automatically load the module on boot:

KERNEL_MODULE_AUTOLOAD += "cp210x"

6. Command to check the list of available images.

Run the following command in your source directory:

$ ls meta*/recipes*/images/*.bb

7. Command to run the generated image in QEMU:

$ runqemu [machine] [zImage] [filesystem]

For example:

$ runqemu qemux86 core-image-minimal

8. Command to list the machines available:

$ ls meta*/conf/machine/*.conf

9. Command to generate SDK for a particular image:

$ bitbake [imagename] -c populate_sdk

For example:

$ bitbake core-image-full-cmdline -c populate_sdk

10. Order in which all tasks executed are stored in:

[build directory]/tmp/work/[machine toolchain]/[package name]/[package version]/temp/log.task_order

For example:

build/tmp/work/corei7-64-poky-linux/grep/3.1-r0/temp/log.task_order

11. Generate dependency tree information in the dot syntax:

$ bitbake -g core-image-minimal

The above command generates a dependency graph. Bitbake creates pn-buildlist, recipe-depends.dot and task-depends.dot files.

  • pn-buildlist: Simple list of packages which are going to be build
  • recipe-depends.dot: Show dependencies between recipes
  • task-depends.dot: Shows dependencies between tasks.

12. Displays environmental variables:

$ bitbake -e [recipe/target name]

For example:

$ bitbake -e core-image-minimal | grep ^SDKMACHINE

13. Enable verbose output of shell tasks:

$ bitbake -v [recipe/target name]

For example:

$ bitbake -v core-image-minimal

14. Continue bitbake even after error. This will be useful when you started a build and went for lunch and don’t want the bitbake to stop if it is unable to fetch a file over Internet.

$ bitbake -k [target]

For example:

$ bitbake -k core-image-minimal

15. Force the target to run even if there is sstate-cache available for it.

$ bitbake -f [target/recipe name]

For example:

$ bitbake -f busybox
Related Post