Optimizing Build Time

Optimizing Build Time in Yocto

Yocto supports smart caching through the use of shared download and sstate (shared state) directories. This significantly reduces build times, especially when reusing previously built artifacts with the same configuration.

To take advantage of this, configure builds to pull prebuilt sources and build artifacts from centralized mirrors:

  • Source mirrors: Fetch source files from a pre-populated mirror instead of downloading them individually from the Internet.

  • Sstate mirrors: Use cached build results for previously built components, skipping the need to rebuild them locally.

By pointing to AMD’s hosted mirrors (configured in local.conf), the build system can reuse existing outputs, dramatically speeding up the build process.

Optimizing Build Time Locally - Central Download and Shared State Locations

You can also place the downloads cache and the shared state cache in central locations outside of the project directory. Yocto exposes each cache as a variable in local.conf: DL_DIR for the downloads cache and SSTATE_DIR for the shared state cache. Setting either to a path outside the project directory lets multiple users share the cache.

DL_DIR ?= "your_path"
SSTATE_DIR ?= "your path"

For example:

DL_DIR ?= "/opt/yoctoCentralDownloads"
SSTATE_DIR ?= "/opt/yoctoCentralSstate-cache"

These settings let the build system access a centralized location for all downloads.