Useful tips to reduce build time in Yocto Project

Yocto Build system takes a few hours to complete the build process. This is a major drawback of the Yocto Project build system but it provides a mechanism to reduce the build time.

Yocto Project provides the share state cache mechanism to determine which recipes need to rebuild. this cache mechanism calculates the checksum data and if the checksum is different from the previous build then it needs to rebuild the recipes.

There is the following point that helps to reduce the build time in Yocto Project.

  1. Save the sstate-cache in your host and reuse it for further build. Set the SSTATE_DIR variable in build/local.conf which points to the sstate-cache directory.
    SSTATE_DIR ?= "/home/sstate-cache-dir"
  2. Save the downloads directory in your host and reuse it. this will reduce your build time. Set path of downloads directory using DL_DIR variable in build/local.conf.
    DL_DIR = "/home/your-download-dir/"

 

Build time also depends on other factors like the number of CPU cores and the number of threads run during the build.
You can also use mirror location to fetch downloads and the sstate-cache directory. I will guide you in the next article on how to set this SOURCE_MIRROR_URL variable to access mirror location.

Add comment


Security code
Refresh