From 444a80a355acf8e3d7a0126506dc6ed65913b039 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Mon, 11 Jul 2016 16:04:19 -0700 Subject: ref-manual: Added a new section on setscene task variants Fixes [YOCTO #9251] I added a new section on the task variants for setscene, which uses the shared state cache. The section describes the BitBake processing that helps the build system to not have to build everything from scratch. (From yocto-docs rev: 6aa0e6b837de14dd7d6c5ef34328bbf268dd6d71) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/ref-manual/closer-look.xml | 125 +++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) (limited to 'documentation/ref-manual/closer-look.xml') diff --git a/documentation/ref-manual/closer-look.xml b/documentation/ref-manual/closer-look.xml index 84ff584bad..e7b423f66f 100644 --- a/documentation/ref-manual/closer-look.xml +++ b/documentation/ref-manual/closer-look.xml @@ -1209,6 +1209,131 @@ which includes the environment setup script. + +
+ Setscene Tasks and Shared State + + + The description of tasks so far assumes that BitBake needs to + build everything and there are no prebuilt objects available. + BitBake does support skipping tasks if prebuilt objects are + available. + These objects are usually made available in the form of a + shared state (sstate) cache. + + For information on variables affecting sstate, see the + SSTATE_DIR + and + SSTATE_MIRRORS + variables. + + + + + The idea of a setscene task (i.e + do_taskname_setscene) + is a version of the task where + instead of building something, BitBake can skip to the end + result and simply place a set of files into specific locations + as needed. + In some cases, it makes sense to have a setscene task variant + (e.g. generating package files in the + do_package_write_* task). + In other cases, it does not make sense, (e.g. a + do_patch + task or + do_unpack + task) since the work involved would be equal to or greater than + the underlying task. + + + + In the OpenEmbedded build system, the common tasks that have + setscene variants are do_package, + do_package_write_*, + do_deploy, + do_packagedata, + and + do_populate_sysroot. + Notice that these are most of the tasks whose output is an + end result. + + + + The OpenEmbedded build system has knowledge of the relationship + between these tasks and other tasks that precede them. + For example, if BitBake runs + do_populate_sysroot_setscene for + something, there is little point in running any of the + do_fetch, do_unpack, + do_patch, + do_configure, + do_compile, and + do_install tasks. + However, if do_package needs to be run, + BitBake would need to run those other tasks. + + + + It becomes more complicated if everything can come from an + sstate cache because some objects are simply not required at + all. + For example, you do not need a compiler or native tools, such + as quilt, if there is nothing to compile or patch. + If the do_package_write_* packages are + available from sstate, BitBake does not need the + do_package task data. + + + + To handle all these complexities, BitBake runs in two phases. + The first is the "setscene" stage. + During this stage, BitBake first checks the sstate cache for + any targets it is planning to build. + BitBake does a fast check to see if the object exists rather + than a complete download. + If nothing exists, the second phase, which is the setscene + stage, completes and the main build proceeds. + + + + If objects are found in the sstate cache, the OpenEmbedded + build system works backwards from the end targets specified + by the user. + For example, if an image is being built, the OpenEmbedded build + system first looks for the packages needed for that image and + the tools needed to construct an image. + If those are available, the compiler is not needed. + Thus, the compiler is not even downloaded. + If something was found to be unavailable, or the download or + setscene task fails, the OpenEmbedded build system then tries + to install dependencies, such as the compiler, from the cache. + + + + The availability of objects in the sstate cache is handled by + the function specified by the + BB_HASHCHECK_FUNCTION + variable and returns a list of the objects that are available. + The function specified by the + BB_SETSCENE_DEPVALID + variable is the function that determines whether a given + dependency needs to be followed, and whether for any given + relationship the function needs to be passed. + The function returns a True or False value. + + + + Once the setscene process completes, the OpenEmbedded build + system has a list of tasks that it believes it can "accelerate" + and therefore does not need to run. + There is a final function call to the function specified by the + BB_SETSCENE_VERIFY_FUNCTION + variable that is able to require the tasks to be run that + that the OpenEmbedded build system initially was going to + skip. + +
-- cgit v1.2.3-54-g00ecf