16

Can any one explain to me more comprehensively how the sstate cache works in yocto?

This explanation is far from clear.

I don't understand when such situation occurs:

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Running setscene task 118 of 155 (virtual:native:/home/lulianhao/poky-build/edwin/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot_setscene)
NOTE: Running setscene task 119 of 155 (/home/lulianhao/poky-build/edwin/poky/meta/recipes-devtools/quilt/quilt-native_0.48.bb:do_populate_sysroot_setscene)

When it found the artifacts or got the candidates, and then checks the signatures. I want to know when setscene tasks are actually run.

Additional question: When it looks in local sstate_cache folder and when into mirror?

Stephano
  • 5,716
  • 7
  • 41
  • 57
mastier
  • 872
  • 1
  • 10
  • 22
  • 2
    Dude. Me too. What a colossal pain to debug. I have a dependency on base-passwd:do_populate_sysroot_setscene that cannot be found no matter what I try. Allegedly they all inherit it from the base recipe. It's just not working and I'm tearing my hair out. – izak Jul 13 '16 at 12:55
  • Yeah. So far, I've not found well written docs on anything in yocto. The authors don't seem to understand that we don't already know. So poorly written :( – steve Mar 26 '21 at 12:41

1 Answers1

26

The Yocto Project manual has a section devoted to Shared State Cache.

To answer your question, the sstate-cache folder is checked first, then the mirrors are checked if nothing is found locally.

This cache is built based on a set of inputs which are hashed into "signatures" which can be found in the $BUILD_DIR/tmp/stamps, but keep in mind you'll need bitbake-dumpsigs to view the file. Having a look at bitbake-dumpsigs and bitbake-diffsigs can help you understand how the cache works. Also there is a great "Tips & Tricks" article on Understanding What Changed in your build environment.

While it can take some time to understand, shared state cache is extremely valuable and rigorously tested.

In terms of tracing dependancies, for example why your image might contain passwd, bitbake -g will give you a dependency tree and oe-pkgdata-util find-path can help you understand which recipe resulted in a given binary on the resultant image.

Useful tip: "When we need to rebuild from scratch, we either remove the build/tmp so that we can use sstate-cache to speed up the build or we remove both build/tmp and sstate-cache so that no cache is reused during the build."1

1Salvador, Otavio, and Daiane Angolini. "6.2 Understanding Shared State Cache." Embedded Linux Development with Yocto Project

FkYkko
  • 1,015
  • 1
  • 12
  • 18
Stephano
  • 5,716
  • 7
  • 41
  • 57