documentation/poky-ref-manual/technical-details.xml: edits per Richard Purdie

Richard reviewed the new sections and had a couple comments.  There
was one technical error and he also wanted YP worked out when it was
being used in the context of the code that was doing the work here.
So I replaced with more generic terms or specifically called out
BitBake as the responsible software.

(From yocto-docs rev: 89641ffa35d7978961790d750ce84073dc8520c1)

Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark 2011-12-15 08:22:30 -08:00 committed by Richard Purdie
parent 85408dfd36
commit 155d0deae8
1 changed files with 33 additions and 38 deletions

View File

@ -150,9 +150,9 @@
<title>Shared State Cache</title> <title>Shared State Cache</title>
<para> <para>
By design, the Yocto Project builds everything from scratch unless it can determine that By design, the Yocto Project build system builds everything from scratch unless
parts don't need to be rebuilt. BitBake can determine that parts don't need to be rebuilt.
Fundamentally, building from scratch is an attraction as it means all parts are Fundamentally, building from scratch is attractive as it means all parts are
built fresh and there is no possibility of stale data causing problems. built fresh and there is no possibility of stale data causing problems.
When developers hit problems, they typically default back to building from scratch When developers hit problems, they typically default back to building from scratch
so they know the state of things from the start. so they know the state of things from the start.
@ -200,7 +200,7 @@
<title>Overall Architecture</title> <title>Overall Architecture</title>
<para> <para>
When determining what parts of the system need to be built, the Yocto Project When determining what parts of the system need to be built, BitBake
uses a per-task basis and does not use a per-recipe basis. uses a per-task basis and does not use a per-recipe basis.
You might wonder why using a per-task basis is preferred over a per-recipe basis. You might wonder why using a per-task basis is preferred over a per-recipe basis.
To help explain, consider having the IPK packaging backend enabled and then switching to DEB. To help explain, consider having the IPK packaging backend enabled and then switching to DEB.
@ -220,9 +220,9 @@
<title>Checksums (Signatures)</title> <title>Checksums (Signatures)</title>
<para> <para>
The Yocto Project uses a checksum, which is a unique signature of a task's The shared state code uses a checksum, which is a unique signature of a task's
inputs, to determine if a task needs to be run again. inputs, to determine if a task needs to be run again.
Because it is a change in a task's inputs that trigger a rerun, the process Because it is a change in a task's inputs that triggers a rerun, the process
needs to detect all the inputs to a given task. needs to detect all the inputs to a given task.
For shell tasks, this turns out to be fairly easy because For shell tasks, this turns out to be fairly easy because
the build process generates a "run" shell script for each task and the build process generates a "run" shell script for each task and
@ -247,8 +247,8 @@
<para> <para>
Another problem results from the "run" scripts containing functions that Another problem results from the "run" scripts containing functions that
might or might not get called. might or might not get called.
The Yocto Project contains code that figures out dependencies between shell The incremental build solution contains code that figures out dependencies
functions. between shell functions.
This code is used to prune the "run" scripts down to the minimum set, This code is used to prune the "run" scripts down to the minimum set,
thereby alleviating this problem and making the "run" scripts much more thereby alleviating this problem and making the "run" scripts much more
readable as a bonus. readable as a bonus.
@ -257,13 +257,12 @@
<para> <para>
So far we have solutions for shell scripts. So far we have solutions for shell scripts.
What about python tasks? What about python tasks?
Handling these tasks are more difficult but the the same approach The same approach applies even though these tasks are more difficult.
applies.
The process needs to figure out what variables a python function accesses The process needs to figure out what variables a python function accesses
and what functions it calls. and what functions it calls.
Again, the Yocto Project contains code that first figures out the variable and function Again, the incremental build solution contains code that first figures out
dependencies, and then creates a checksum for the data used as the input to the variable and function dependencies, and then creates a checksum for the data
the task. used as the input to the task.
</para> </para>
<para> <para>
@ -279,8 +278,7 @@
</para> </para>
<para> <para>
Equally, there are cases where we need to add in dependencies Equally, there are cases where we need to add dependencies BitBake is not able to find.
BitBake is not able to find.
You can accomplish this by using a line like the following: You can accomplish this by using a line like the following:
<literallayout class='monospaced'> <literallayout class='monospaced'>
PACKAGE_ARCHS[vardeps] = "MACHINE" PACKAGE_ARCHS[vardeps] = "MACHINE"
@ -300,13 +298,12 @@
</para> </para>
<para> <para>
Thus far, this section has limited discussion to the direct inputs into a Thus far, this section has limited discussion to the direct inputs into a task.
task.
Information based on direct inputs is referred to as the "basehash" in the code. Information based on direct inputs is referred to as the "basehash" in the code.
However, there is still the question of a task's indirect inputs, the things that However, there is still the question of a task's indirect inputs, the things that
were already built and present in the build directory. were already built and present in the build directory.
The checksum (or signature) for a particular task needs to add the hashes of all the The checksum (or signature) for a particular task needs to add the hashes of all the
tasks the particular task depends upon. tasks on which the particular task depends.
Choosing which dependencies to add is a policy decision. Choosing which dependencies to add is a policy decision.
However, the effect is to generate a master checksum that combines the However, the effect is to generate a master checksum that combines the
basehash and the hashes of the task's dependencies. basehash and the hashes of the task's dependencies.
@ -327,7 +324,7 @@
Also within the BitBake configuration file, we can give BitBake Also within the BitBake configuration file, we can give BitBake
some extra information to help it handle this information. some extra information to help it handle this information.
The following statements effectively result in a list of global The following statements effectively result in a list of global
list of variable dependency excludes - variables never included in variable dependency excludes - variables never included in
any checksum: any checksum:
<literallayout class='monospaced'> <literallayout class='monospaced'>
BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH" BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH"
@ -346,7 +343,7 @@
The <filename>BB_HASHTASK_WHITELIST</filename> covers dependent tasks and The <filename>BB_HASHTASK_WHITELIST</filename> covers dependent tasks and
excludes certain kinds of tasks from the dependency chains. excludes certain kinds of tasks from the dependency chains.
The effect of the previous example is to isolate the native, target, The effect of the previous example is to isolate the native, target,
and cross components. and cross-components.
So, for example, toolchain changes do not force a rebuild of the whole system. So, for example, toolchain changes do not force a rebuild of the whole system.
</para> </para>
@ -380,7 +377,7 @@
<title>Shared State</title> <title>Shared State</title>
<para> <para>
Checksums and dependencies as discussed in the previous section solves half the Checksums and dependencies, as discussed in the previous section, solve half the
problem. problem.
The other part of the problem is being able to use checksum information during the build The other part of the problem is being able to use checksum information during the build
and being able to reuse or rebuild specific components. and being able to reuse or rebuild specific components.
@ -388,10 +385,8 @@
<para> <para>
The shared state class (<filename>sstate.bbclass</filename>) The shared state class (<filename>sstate.bbclass</filename>)
is a relatively generic implementation of how to is a relatively generic implementation of how to "capture" a snapshot of a given task.
"capture" a snapshot of a given task. The idea is that the build process does not care about the source of a task's output.
The idea is that the build process does not care about the source of a
task's output.
Output could be freshly built or it could be downloaded and unpacked from Output could be freshly built or it could be downloaded and unpacked from
somewhere - the build process doesn't need to worry about its source. somewhere - the build process doesn't need to worry about its source.
</para> </para>
@ -431,8 +426,8 @@
</para> </para>
<para> <para>
If you have a directory whose contents you need to preserve, If you have a directory whose contents you need to preserve, you can do this with
you can do this with a line like the following: a line like the following:
<literallayout class='monospaced'> <literallayout class='monospaced'>
do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}" do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}"
</literallayout> </literallayout>
@ -483,7 +478,7 @@
only the <filename>do_package_write_ipk</filename> tasks would have their only the <filename>do_package_write_ipk</filename> tasks would have their
shared state packages fetched and extracted. shared state packages fetched and extracted.
Since the sysroot is not used, it would never get extracted. Since the sysroot is not used, it would never get extracted.
This is another reason to prefer the task-based approach over a This is another reason why a task-based approach is preferred over a
recipe-based approach, which would have to install the output from every task. recipe-based approach, which would have to install the output from every task.
</para> </para>
</section> </section>
@ -515,13 +510,13 @@
(or <filename>-S</filename>) option, BitBake dumps out (or <filename>-S</filename>) option, BitBake dumps out
<filename>.siginfo</filename> files in <filename>.siginfo</filename> files in
the stamp directory for every task it would have executed instead of the stamp directory for every task it would have executed instead of
building the target package specified.</para></listitem> building the specified target package.</para></listitem>
<listitem><para>There is a <filename>bitbake-diffsigs</filename> command that <listitem><para>There is a <filename>bitbake-diffsigs</filename> command that
can process these <filename>.siginfo</filename> files. can process these <filename>.siginfo</filename> files.
If one file is specified, it will dump out the dependency If one file is specified, it will dump out the dependency
information in the file. information in the file.
If two files are specified, it will compare the If two files are specified, it will compare the two files and dump out
two files and dump out the differences between the two. the differences between the two.
This allows the question of "What changed between X and Y?" to be This allows the question of "What changed between X and Y?" to be
answered easily.</para></listitem> answered easily.</para></listitem>
</itemizedlist> </itemizedlist>
@ -532,18 +527,18 @@
<title>Invalidating Shared State</title> <title>Invalidating Shared State</title>
<para> <para>
The Yocto Project shared state code uses checksums and shared state memory The shared state code uses checksums and shared state memory
cache to avoide building tasks that don't need built. cache to avoid unnecessarily rebuilding tasks.
As with all schemes, this one has some drawbacks. As with all schemes, this one has some drawbacks.
It is possible that you could make implicit changes that are not factored into the checksum It is possible that you could make implicit changes that are not factored
calculation, but do affect a task's output. into the checksum calculation, but do affect a task's output.
A good example is perhaps when a tool changes its output. A good example is perhaps when a tool changes its output.
Let's say that the output of <filename>rpmdeps</filename> needed to change. Let's say that the output of <filename>rpmdeps</filename> needed to change.
The result of the change should be that all the "package", "package_write_rpm", The result of the change should be that all the "package", "package_write_rpm",
and "package_deploy-rpm" shared state cache items would become invalid. and "package_deploy-rpm" shared state cache items would become invalid.
But, because this is a change that is external to the code and therefore implicit, But, because this is a change that is external to the code and therefore implicit,
the associated shared state cache items do not become invalidated. the associated shared state cache items do not become invalidated.
In this case, the build process would use the cache items rather than running the In this case, the build process would use the cached items rather than running the
task again. task again.
Obviously, these types of implicit changes can cause problems. Obviously, these types of implicit changes can cause problems.
</para> </para>
@ -565,8 +560,8 @@
</para> </para>
<note> <note>
For an example of a commit that makes a cosmetic change to invalidate an sstate, For an example of a commit that makes a cosmetic change to invalidate
see this a shared state, see this
<ulink url='http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/classes/package.bbclass?id=737f8bbb4f27b4837047cb9b4fbfe01dfde36d54'>commit</ulink>. <ulink url='http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/classes/package.bbclass?id=737f8bbb4f27b4837047cb9b4fbfe01dfde36d54'>commit</ulink>.
</note> </note>
</section> </section>