Yocto Project Interview Questions

Yocto is an Open source Project and is used to create custom Linux for embedded devices. This is part-1 of the Yocto interview Questions which are surely going to help you in your professional interviews. Here we will discuss the IMAGE_INSTALL variable, Variable assignment, DEPENDS, and RDEPENDS variable uses, etc...

What is difference between IMAGE_INSTALL += " packagename" and IMAGE_INSTALL_append = " packagename"?

  • Both variables are used to add the extra package to the image.
  • To avoid any ordering issue, use the IMAGE_INSTALL_append in conf/local.conf instead of IMAGE_INSTALL +=
  • Suppose you want to add strace in your image. so It is recommended to add the below code in conf/local.conf files.
  • IMAGE_INSTALL_append = " strace"
  • If you want to create your image recipe then it is preferred to use the IMAGE_INSTALL variable to add the packages or package groups to the image.
  • Example: In recipe core-image-minimal-mtdutils.bb,IMAGE_INSTALL += "mtd-utils" variable is used to add MTD Utilities.

    NoteIMAGE_INSTALL:append = " strace"    # Use this syntax to add packages in Yocto Honister or a newer release

     

    What is the default assignment Variable in the Bitbake Recipe?

    • In the Bitbake Recipe, the Variable is defined with "= " sign called the direct assignment.
    • Example: var = 10 --> value of var is equal to 10.
    • The Variable is defined with " ?= " sign called default assignment.
    • var1 ?=10
    • var2 ?= 20
    • var2 ?=30
    • The value of var1 would be 10.
    • The value of var2 would be 20 because it is previously defined so their value would retain.

    Yocto Recipe Layout

    How to read Bitbake Recipe variables

    Note: To read the recipe variable, use this command bitbake -e {recipe} | grep ^variable

     

    What is the difference between DEPENDS vs RDEPENDS variable in the Bitbake recipe?

    When Bitbake starts building any software packages and those packages have some dependency on another package so these variables DEPENDS and RDEPENDS are used to resolve the dependency.

    • DEPENDS variable is used for the build time dependency. so dependent packages and libraries are required before build the actual package.
    • Example: coreutils_8.32.bb recipe depends on gmp and libcap recipe. so Bitbake first build the gmp and libcap package before coreutils.
    • DEPENDS = "gmp libcap"

    Depends Variable in Yocto

     

    • RDEPENDS variable is used for run time dependency. so all the packages and libraries are required during the execution program on the target system.
    • Example: Recipe perf.bb is RDEPENDS on elfutils and bash recipes so in this case elfutils and bash should be available when perf is executed on the target.
    • RDEPENDS:${PN} += "elfutils bash"  # syntex for Honister or a newer release
    • RDEPENDS_${PN} += "elfutils bash"  # syntax for releases older than Honister

    RDEPENDS Variable in Yocto