What is Packagegroup in the Yocto Project?

Packagegroup is a bundle of multiple packages. You can easily add these packages to the image using the package group name.
Package group is defined by the packagegroup recipe which follows the below syntax.

Syntex:packgroup-<name>.bb

 

How to create a packagegroup in Yocto Project

Suppose you want to add a few packages of debugging tools to your image using a package group recipe. So you need to follow the below steps

  • Go inside your custom meta layer and create packagegroups directory if not present.
    
    $ mkdir packagegroups
  • Create the package group recipe followed by packagegroup-<name>.bb
    For debug tools packagegroup, we can create packagegroup-debug.bb file.
    
    DESCRIPTION = "Package group for debug tools"
    LICENCE = "CLOSED"
    SUMMARY = "This package group adds various debug tools to the image"
    inherit packagegroup
    
    RDEPENDS_${PN} = "  \
        gdb             \
        gdbserver       \
        valgrind        \
        system-analyze  \
    "
    
  • Now using the image recipe or image append file, we can install these packages to the image and it is good practice to add package group using the image recipe.
    
    # To add debug packages 
    IMAGE_INSTALL += " packagegroup-debug"
    
  • You can also add packagegroup from build/conf/local.conf file.
    
    # To add debug packages 
    IMAGE_INSTALL += " packagegroup-debug"

 

Benefits of using packagegroup in Yocto Project.

Following benefits of using packagegroup in the Yocto Project

  • You can add multiple packages to the image with one command.
  • Using packagegroup , you can easily install the packages based on the distro features, machine features or combined features.
    Example:
    IMAGE_INSTALL += " ${@bb.utils.contains("DISTRO_FEATURES", "debug", "packagegroup-debug", "", d)}"

    if DISTRO_FEATURES variable contains the debug feature then these debug packages will add to the image otherwise it will not add to the image.

Add comment


Security code
Refresh