diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:46:05 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:47:32 +0100 |
commit | 14b00ff23a912494edc7f146e668c40ca82b8508 (patch) | |
tree | f7f4e592ccb935bc312cfa0cfc3c0cbbe444970d /documentation/ref-manual/usingpoky.xml | |
download | yocto-docs-14b00ff23a912494edc7f146e668c40ca82b8508.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'documentation/ref-manual/usingpoky.xml')
-rw-r--r-- | documentation/ref-manual/usingpoky.xml | 859 |
1 files changed, 859 insertions, 0 deletions
diff --git a/documentation/ref-manual/usingpoky.xml b/documentation/ref-manual/usingpoky.xml new file mode 100644 index 0000000..b9df733 --- /dev/null +++ b/documentation/ref-manual/usingpoky.xml | |||
@@ -0,0 +1,859 @@ | |||
1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | ||
2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" | ||
3 | [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] > | ||
4 | |||
5 | <chapter id='usingpoky'> | ||
6 | <title>Using the Yocto Project</title> | ||
7 | |||
8 | <para> | ||
9 | This chapter describes common usage for the Yocto Project. | ||
10 | The information is introductory in nature as other manuals in the Yocto Project | ||
11 | documentation set provide more details on how to use the Yocto Project. | ||
12 | </para> | ||
13 | |||
14 | <section id='usingpoky-build'> | ||
15 | <title>Running a Build</title> | ||
16 | |||
17 | <para> | ||
18 | This section provides a summary of the build process and provides information | ||
19 | for less obvious aspects of the build process. | ||
20 | For general information on how to build an image using the OpenEmbedded build | ||
21 | system, see the | ||
22 | "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>" | ||
23 | section of the Yocto Project Quick Start. | ||
24 | </para> | ||
25 | |||
26 | <section id='build-overview'> | ||
27 | <title>Build Overview</title> | ||
28 | |||
29 | <para> | ||
30 | The first thing you need to do is set up the OpenEmbedded build | ||
31 | environment by sourcing an environment setup script | ||
32 | (i.e. | ||
33 | <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link> | ||
34 | or | ||
35 | <link linkend='structure-memres-core-script'><filename>oe-init-build-env-memres</filename></link>). | ||
36 | Here is an example: | ||
37 | <literallayout class='monospaced'> | ||
38 | $ source &OE_INIT_FILE; [<build_dir>] | ||
39 | </literallayout> | ||
40 | </para> | ||
41 | |||
42 | <para> | ||
43 | The <filename>build_dir</filename> argument is optional and specifies the directory the | ||
44 | OpenEmbedded build system uses for the build - | ||
45 | the <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. | ||
46 | If you do not specify a Build Directory, it defaults to a directory | ||
47 | named <filename>build</filename> in your current working directory. | ||
48 | A common practice is to use a different Build Directory for different targets. | ||
49 | For example, <filename>~/build/x86</filename> for a <filename>qemux86</filename> | ||
50 | target, and <filename>~/build/arm</filename> for a <filename>qemuarm</filename> target. | ||
51 | See the "<link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>" | ||
52 | section for more information on this script. | ||
53 | </para> | ||
54 | |||
55 | <para> | ||
56 | Once the build environment is set up, you can build a target using: | ||
57 | <literallayout class='monospaced'> | ||
58 | $ bitbake <target> | ||
59 | </literallayout> | ||
60 | </para> | ||
61 | |||
62 | <para> | ||
63 | The <filename>target</filename> is the name of the recipe you want to build. | ||
64 | Common targets are the images in <filename>meta/recipes-core/images</filename>, | ||
65 | <filename>meta/recipes-sato/images</filename>, etc. all found in the | ||
66 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>. | ||
67 | Or, the target can be the name of a recipe for a specific piece of software such as | ||
68 | BusyBox. | ||
69 | For more details about the images the OpenEmbedded build system supports, see the | ||
70 | "<link linkend="ref-images">Images</link>" chapter. | ||
71 | </para> | ||
72 | |||
73 | <note> | ||
74 | Building an image without GNU General Public License Version 3 (GPLv3) components | ||
75 | is supported for only minimal and base images. | ||
76 | See the "<link linkend='ref-images'>Images</link>" chapter for more information. | ||
77 | </note> | ||
78 | </section> | ||
79 | |||
80 | <section id='building-an-image-using-gpl-components'> | ||
81 | <title>Building an Image Using GPL Components</title> | ||
82 | |||
83 | <para> | ||
84 | When building an image using GPL components, you need to maintain your original | ||
85 | settings and not switch back and forth applying different versions of the GNU | ||
86 | General Public License. | ||
87 | If you rebuild using different versions of GPL, dependency errors might occur | ||
88 | due to some components not being rebuilt. | ||
89 | </para> | ||
90 | </section> | ||
91 | </section> | ||
92 | |||
93 | <section id='usingpoky-install'> | ||
94 | <title>Installing and Using the Result</title> | ||
95 | |||
96 | <para> | ||
97 | Once an image has been built, it often needs to be installed. | ||
98 | The images and kernels built by the OpenEmbedded build system are placed in the | ||
99 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink> in | ||
100 | <filename class="directory">tmp/deploy/images</filename>. | ||
101 | For information on how to run pre-built images such as <filename>qemux86</filename> | ||
102 | and <filename>qemuarm</filename>, see the | ||
103 | "<ulink url='&YOCTO_DOCS_QS_URL;#using-pre-built'>Using Pre-Built Binaries and QEMU</ulink>" | ||
104 | section in the Yocto Project Quick Start. | ||
105 | For information about how to install these images, see the documentation for your | ||
106 | particular board or machine. | ||
107 | </para> | ||
108 | </section> | ||
109 | |||
110 | <section id='usingpoky-debugging'> | ||
111 | <title>Debugging Build Failures</title> | ||
112 | |||
113 | <para> | ||
114 | The exact method for debugging build failures depends on the nature of the | ||
115 | problem and on the system's area from which the bug originates. | ||
116 | Standard debugging practices such as comparison against the last | ||
117 | known working version with examination of the changes and the re-application of steps | ||
118 | to identify the one causing the problem are | ||
119 | valid for the Yocto Project just as they are for any other system. | ||
120 | Even though it is impossible to detail every possible potential failure, | ||
121 | this section provides some general tips to aid in debugging. | ||
122 | </para> | ||
123 | |||
124 | <para> | ||
125 | For discussions on debugging, see the | ||
126 | "<ulink url='&YOCTO_DOCS_DEV_URL;#platdev-gdb-remotedebug'>Debugging With the GNU Project Debugger (GDB) Remotely</ulink>" | ||
127 | and | ||
128 | "<ulink url='&YOCTO_DOCS_DEV_URL;#adt-eclipse'>Working within Eclipse</ulink>" | ||
129 | sections in the Yocto Project Development Manual. | ||
130 | </para> | ||
131 | |||
132 | <section id='usingpoky-debugging-taskfailures'> | ||
133 | <title>Task Failures</title> | ||
134 | |||
135 | <para>The log file for shell tasks is available in | ||
136 | <filename>${WORKDIR}/temp/log.do_taskname.pid</filename>. | ||
137 | For example, the <filename>compile</filename> task for the QEMU minimal image for the x86 | ||
138 | machine (<filename>qemux86</filename>) might be | ||
139 | <filename>tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_compile.20830</filename>. | ||
140 | To see what BitBake runs to generate that log, look at the corresponding | ||
141 | <filename>run.do_taskname.pid</filename> file located in the same directory. | ||
142 | </para> | ||
143 | |||
144 | <para> | ||
145 | Presently, the output from Python tasks is sent directly to the console. | ||
146 | </para> | ||
147 | </section> | ||
148 | |||
149 | <section id='usingpoky-debugging-taskrunning'> | ||
150 | <title>Running Specific Tasks</title> | ||
151 | |||
152 | <para> | ||
153 | Any given package consists of a set of tasks. | ||
154 | The standard BitBake behavior in most cases is: <filename>fetch</filename>, | ||
155 | <filename>unpack</filename>, | ||
156 | <filename>patch</filename>, <filename>configure</filename>, | ||
157 | <filename>compile</filename>, <filename>install</filename>, <filename>package</filename>, | ||
158 | <filename>package_write</filename>, and <filename>build</filename>. | ||
159 | The default task is <filename>build</filename> and any tasks on which it depends | ||
160 | build first. | ||
161 | Some tasks, such as <filename>devshell</filename>, are not part of the | ||
162 | default build chain. | ||
163 | If you wish to run a task that is not part of the default build chain, you can use the | ||
164 | <filename>-c</filename> option in BitBake. | ||
165 | Here is an example: | ||
166 | <literallayout class='monospaced'> | ||
167 | $ bitbake matchbox-desktop -c devshell | ||
168 | </literallayout> | ||
169 | </para> | ||
170 | |||
171 | <para> | ||
172 | If you wish to rerun a task, use the <filename>-f</filename> force option. | ||
173 | For example, the following sequence forces recompilation after changing files in the | ||
174 | working directory. | ||
175 | <literallayout class='monospaced'> | ||
176 | $ bitbake matchbox-desktop | ||
177 | . | ||
178 | . | ||
179 | [make some changes to the source code in the working directory] | ||
180 | . | ||
181 | . | ||
182 | $ bitbake matchbox-desktop -c compile -f | ||
183 | $ bitbake matchbox-desktop | ||
184 | </literallayout> | ||
185 | </para> | ||
186 | |||
187 | <para> | ||
188 | This sequence first builds and then recompiles | ||
189 | <filename>matchbox-desktop</filename>. | ||
190 | The last command reruns all tasks (basically the packaging tasks) after the compile. | ||
191 | BitBake recognizes that the <filename>compile</filename> task was rerun and therefore | ||
192 | understands that the other tasks also need to be run again. | ||
193 | </para> | ||
194 | |||
195 | <para> | ||
196 | You can view a list of tasks in a given package by running the | ||
197 | <filename>listtasks</filename> task as follows: | ||
198 | <literallayout class='monospaced'> | ||
199 | $ bitbake matchbox-desktop -c listtasks | ||
200 | </literallayout> | ||
201 | The results are in the file <filename>${WORKDIR}/temp/log.do_listtasks</filename>. | ||
202 | </para> | ||
203 | </section> | ||
204 | |||
205 | <section id='usingpoky-debugging-dependencies'> | ||
206 | <title>Dependency Graphs</title> | ||
207 | |||
208 | <para> | ||
209 | Sometimes it can be hard to see why BitBake wants to build some other packages before a given | ||
210 | package you have specified. | ||
211 | The <filename>bitbake -g targetname</filename> command creates the | ||
212 | <filename>depends.dot</filename>, <filename>package-depends.dot</filename>, | ||
213 | and <filename>task-depends.dot</filename> files in the current directory. | ||
214 | These files show the package and task dependencies and are useful for debugging problems. | ||
215 | You can use the <filename>bitbake -g -u depexp targetname</filename> command to | ||
216 | display the results in a more human-readable form. | ||
217 | </para> | ||
218 | </section> | ||
219 | |||
220 | <section id='usingpoky-debugging-bitbake'> | ||
221 | <title>General BitBake Problems</title> | ||
222 | |||
223 | <para> | ||
224 | You can see debug output from BitBake by using the <filename>-D</filename> option. | ||
225 | The debug output gives more information about what BitBake | ||
226 | is doing and the reason behind it. | ||
227 | Each <filename>-D</filename> option you use increases the logging level. | ||
228 | The most common usage is <filename>-DDD</filename>. | ||
229 | </para> | ||
230 | |||
231 | <para> | ||
232 | The output from <filename>bitbake -DDD -v targetname</filename> can reveal why | ||
233 | BitBake chose a certain version of a package or why BitBake | ||
234 | picked a certain provider. | ||
235 | This command could also help you in a situation where you think BitBake did something | ||
236 | unexpected. | ||
237 | </para> | ||
238 | </section> | ||
239 | |||
240 | <section id='development-host-system-issues'> | ||
241 | <title>Development Host System Issues</title> | ||
242 | |||
243 | <para> | ||
244 | Sometimes issues on the host development system can cause your | ||
245 | build to fail. | ||
246 | Following are known, host-specific problems. | ||
247 | Be sure to always consult the | ||
248 | <ulink url='&YOCTO_RELEASE_NOTES;'>Release Notes</ulink> | ||
249 | for a look at all release-related issues. | ||
250 | <itemizedlist> | ||
251 | <listitem><para><emphasis><filename>eglibc-initial</filename> fails to build</emphasis>: | ||
252 | If your development host system has the unpatched | ||
253 | <filename>GNU Make 3.82</filename>, | ||
254 | the <filename>do_install</filename> task | ||
255 | fails for <filename>eglibc-initial</filename> during the | ||
256 | build.</para> | ||
257 | <para>Typically, every distribution that ships | ||
258 | <filename>GNU Make 3.82</filename> as | ||
259 | the default already has the patched version. | ||
260 | However, some distributions, such as Debian, have | ||
261 | <filename>GNU Make 3.82</filename> as an option, which | ||
262 | is unpatched. | ||
263 | You will see this error on these types of distributions. | ||
264 | Switch to <filename>GNU Make 3.81</filename> or patch | ||
265 | your <filename>make</filename> to solve the problem. | ||
266 | </para></listitem> | ||
267 | </itemizedlist> | ||
268 | </para> | ||
269 | </section> | ||
270 | |||
271 | <section id='usingpoky-debugging-buildfile'> | ||
272 | <title>Building with No Dependencies</title> | ||
273 | <para> | ||
274 | To build a specific recipe (<filename>.bb</filename> file), | ||
275 | you can use the following command form: | ||
276 | <literallayout class='monospaced'> | ||
277 | $ bitbake -b <somepath/somerecipe.bb> | ||
278 | </literallayout> | ||
279 | This command form does not check for dependencies. | ||
280 | Consequently, you should use it | ||
281 | only when you know dependencies already exist. | ||
282 | <note> | ||
283 | You can also specify fragments of the filename. | ||
284 | In this case, BitBake checks for a unique match. | ||
285 | </note> | ||
286 | </para> | ||
287 | </section> | ||
288 | |||
289 | <section id='usingpoky-debugging-variables'> | ||
290 | <title>Variables</title> | ||
291 | <para> | ||
292 | You can use the <filename>-e</filename> BitBake option to | ||
293 | display the parsing environment for a configuration. | ||
294 | The following displays the general parsing environment: | ||
295 | <literallayout class='monospaced'> | ||
296 | $ bitbake -e | ||
297 | </literallayout> | ||
298 | This next example shows the parsing environment for a specific | ||
299 | recipe: | ||
300 | <literallayout class='monospaced'> | ||
301 | $ bitbake -e <recipename> | ||
302 | </literallayout> | ||
303 | </para> | ||
304 | </section> | ||
305 | |||
306 | <section id='recipe-logging-mechanisms'> | ||
307 | <title>Recipe Logging Mechanisms</title> | ||
308 | <para> | ||
309 | Best practices exist while writing recipes that both log build progress and | ||
310 | act on build conditions such as warnings and errors. | ||
311 | Both Python and Bash language bindings exist for the logging mechanism: | ||
312 | <itemizedlist> | ||
313 | <listitem><para><emphasis>Python:</emphasis> For Python functions, BitBake | ||
314 | supports several loglevels: <filename>bb.fatal</filename>, | ||
315 | <filename>bb.error</filename>, <filename>bb.warn</filename>, | ||
316 | <filename>bb.note</filename>, <filename>bb.plain</filename>, | ||
317 | and <filename>bb.debug</filename>.</para></listitem> | ||
318 | <listitem><para><emphasis>Bash:</emphasis> For Bash functions, the same set | ||
319 | of loglevels exist and are accessed with a similar syntax: | ||
320 | <filename>bbfatal</filename>, <filename>bberror</filename>, | ||
321 | <filename>bbwarn</filename>, <filename>bbnote</filename>, | ||
322 | <filename>bbplain</filename>, and <filename>bbdebug</filename>.</para></listitem> | ||
323 | </itemizedlist> | ||
324 | </para> | ||
325 | |||
326 | <para> | ||
327 | For guidance on how logging is handled in both Python and Bash recipes, see the | ||
328 | <filename>logging.bbclass</filename> file in the | ||
329 | <filename>meta/classes</filename> folder of the | ||
330 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>. | ||
331 | </para> | ||
332 | |||
333 | <section id='logging-with-python'> | ||
334 | <title>Logging With Python</title> | ||
335 | <para> | ||
336 | When creating recipes using Python and inserting code that handles build logs, | ||
337 | keep in mind the goal is to have informative logs while keeping the console as | ||
338 | "silent" as possible. | ||
339 | Also, if you want status messages in the log, use the "debug" loglevel. | ||
340 | </para> | ||
341 | |||
342 | <para> | ||
343 | Following is an example written in Python. | ||
344 | The code handles logging for a function that determines the number of tasks | ||
345 | needed to be run: | ||
346 | <literallayout class='monospaced'> | ||
347 | python do_listtasks() { | ||
348 | bb.debug(2, "Starting to figure out the task list") | ||
349 | if noteworthy_condition: | ||
350 | bb.note("There are 47 tasks to run") | ||
351 | bb.debug(2, "Got to point xyz") | ||
352 | if warning_trigger: | ||
353 | bb.warn("Detected warning_trigger, this might be a problem later.") | ||
354 | if recoverable_error: | ||
355 | bb.error("Hit recoverable_error, you really need to fix this!") | ||
356 | if fatal_error: | ||
357 | bb.fatal("fatal_error detected, unable to print the task list") | ||
358 | bb.plain("The tasks present are abc") | ||
359 | bb.debug(2, "Finished figuring out the tasklist") | ||
360 | } | ||
361 | </literallayout> | ||
362 | </para> | ||
363 | </section> | ||
364 | |||
365 | <section id='logging-with-bash'> | ||
366 | <title>Logging With Bash</title> | ||
367 | <para> | ||
368 | When creating recipes using Bash and inserting code that handles build | ||
369 | logs, you have the same goals - informative with minimal console output. | ||
370 | The syntax you use for recipes written in Bash is similar to that of | ||
371 | recipes written in Python described in the previous section. | ||
372 | </para> | ||
373 | |||
374 | <para> | ||
375 | Following is an example written in Bash. | ||
376 | The code logs the progress of the <filename>do_my_function</filename> function. | ||
377 | <literallayout class='monospaced'> | ||
378 | do_my_function() { | ||
379 | bbdebug 2 "Running do_my_function" | ||
380 | if [ exceptional_condition ]; then | ||
381 | bbnote "Hit exceptional_condition" | ||
382 | fi | ||
383 | bbdebug 2 "Got to point xyz" | ||
384 | if [ warning_trigger ]; then | ||
385 | bbwarn "Detected warning_trigger, this might cause a problem later." | ||
386 | fi | ||
387 | if [ recoverable_error ]; then | ||
388 | bberror "Hit recoverable_error, correcting" | ||
389 | fi | ||
390 | if [ fatal_error ]; then | ||
391 | bbfatal "fatal_error detected" | ||
392 | fi | ||
393 | bbdebug 2 "Completed do_my_function" | ||
394 | } | ||
395 | </literallayout> | ||
396 | </para> | ||
397 | </section> | ||
398 | </section> | ||
399 | |||
400 | <section id='usingpoky-debugging-others'> | ||
401 | <title>Other Tips</title> | ||
402 | |||
403 | <para> | ||
404 | Here are some other tips that you might find useful: | ||
405 | <itemizedlist> | ||
406 | <listitem><para>When adding new packages, it is worth watching for | ||
407 | undesirable items making their way into compiler command lines. | ||
408 | For example, you do not want references to local system files like | ||
409 | <filename>/usr/lib/</filename> or <filename>/usr/include/</filename>. | ||
410 | </para></listitem> | ||
411 | <listitem><para>If you want to remove the <filename>psplash</filename> | ||
412 | boot splashscreen, | ||
413 | add <filename>psplash=false</filename> to the kernel command line. | ||
414 | Doing so prevents <filename>psplash</filename> from loading | ||
415 | and thus allows you to see the console. | ||
416 | It is also possible to switch out of the splashscreen by | ||
417 | switching the virtual console (e.g. Fn+Left or Fn+Right on a Zaurus). | ||
418 | </para></listitem> | ||
419 | </itemizedlist> | ||
420 | </para> | ||
421 | </section> | ||
422 | </section> | ||
423 | |||
424 | <section id='maintaining-build-output-quality'> | ||
425 | <title>Maintaining Build Output Quality</title> | ||
426 | |||
427 | <para> | ||
428 | Many factors can influence the quality of a build. | ||
429 | For example, if you upgrade a recipe to use a new version of an upstream software | ||
430 | package or you experiment with some new configuration options, subtle changes | ||
431 | can occur that you might not detect until later. | ||
432 | Consider the case where your recipe is using a newer version of an upstream package. | ||
433 | In this case, a new version of a piece of software might introduce an optional | ||
434 | dependency on another library, which is auto-detected. | ||
435 | If that library has already been built when the software is building, | ||
436 | the software will link to the built library and that library will be pulled | ||
437 | into your image along with the new software even if you did not want the | ||
438 | library. | ||
439 | </para> | ||
440 | |||
441 | <para> | ||
442 | The <filename>buildhistory</filename> class exists to help you maintain | ||
443 | the quality of your build output. | ||
444 | You can use the class to highlight unexpected and possibly unwanted | ||
445 | changes in the build output. | ||
446 | When you enable build history, it records information about the contents of | ||
447 | each package and image and then commits that information to a local Git | ||
448 | repository where you can examine the information. | ||
449 | </para> | ||
450 | |||
451 | <para> | ||
452 | The remainder of this section describes the following: | ||
453 | <itemizedlist> | ||
454 | <listitem><para>How you can enable and disable | ||
455 | build history</para></listitem> | ||
456 | <listitem><para>How to understand what the build history contains | ||
457 | </para></listitem> | ||
458 | <listitem><para>How to limit the information used for build history | ||
459 | </para></listitem> | ||
460 | <listitem><para>How to examine the build history from both a | ||
461 | command-line and web interface</para></listitem> | ||
462 | </itemizedlist> | ||
463 | </para> | ||
464 | |||
465 | <section id='enabling-and-disabling-build-history'> | ||
466 | <title>Enabling and Disabling Build History</title> | ||
467 | |||
468 | <para> | ||
469 | Build history is disabled by default. | ||
470 | To enable it, add the following statements to the end of your | ||
471 | <filename>conf/local.conf</filename> file found in the | ||
472 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>: | ||
473 | <literallayout class='monospaced'> | ||
474 | INHERIT += "buildhistory" | ||
475 | BUILDHISTORY_COMMIT = "1" | ||
476 | </literallayout> | ||
477 | Enabling build history as previously described | ||
478 | causes the build process to collect build | ||
479 | output information and commit it to a local | ||
480 | <ulink url='&YOCTO_DOCS_DEV_URL;#git'>Git</ulink> repository. | ||
481 | <note> | ||
482 | Enabling build history increases your build times slightly, | ||
483 | particularly for images, and increases the amount of disk | ||
484 | space used during the build. | ||
485 | </note> | ||
486 | </para> | ||
487 | |||
488 | <para> | ||
489 | You can disable build history by removing the previous statements | ||
490 | from your <filename>conf/local.conf</filename> file. | ||
491 | However, you should realize that enabling and disabling | ||
492 | build history in this manner can change the | ||
493 | <filename>do_package</filename> task checksums which, if you | ||
494 | are using the OEBasicHash signature generator (the default | ||
495 | for many current distro configurations including | ||
496 | <filename>DISTRO = "poky"</filename> and | ||
497 | <filename>DISTRO = ""</filename>) will result in the packaging | ||
498 | tasks being re-run during the subsequent build. | ||
499 | </para> | ||
500 | |||
501 | <para> | ||
502 | To disable the build history functionality without causing the | ||
503 | packaging tasks to be re-run, add this statement to your | ||
504 | <filename>conf/local.conf</filename> file: | ||
505 | <literallayout class='monospaced'> | ||
506 | BUILDHISTORY_FEATURES = "" | ||
507 | </literallayout> | ||
508 | </para> | ||
509 | </section> | ||
510 | |||
511 | <section id='understanding-what-the-build-history-contains'> | ||
512 | <title>Understanding What the Build History Contains</title> | ||
513 | |||
514 | <para> | ||
515 | Build history information is kept in | ||
516 | <filename>$</filename><link linkend='var-TMPDIR'><filename>TMPDIR</filename></link><filename>/buildhistory</filename> | ||
517 | in the Build Directory. | ||
518 | The following is an example abbreviated listing: | ||
519 | <imagedata fileref="figures/buildhistory.png" align="center" width="6in" depth="4in" /> | ||
520 | </para> | ||
521 | |||
522 | <para> | ||
523 | At the top level, there is a <filename>metadata-revs</filename> file | ||
524 | that lists the revisions of the repositories for the layers enabled | ||
525 | when the build was produced. | ||
526 | The rest of the data splits into separate | ||
527 | <filename>packages</filename>, <filename>images</filename> and | ||
528 | <filename>sdk</filename> directories, the contents of which are | ||
529 | described below. | ||
530 | </para> | ||
531 | |||
532 | <section id='build-history-package-information'> | ||
533 | <title>Build History Package Information</title> | ||
534 | |||
535 | <para> | ||
536 | The history for each package contains a text file that has | ||
537 | name-value pairs with information about the package. | ||
538 | For example, <filename>buildhistory/packages/core2-poky-linux/busybox/busybox/latest</filename> | ||
539 | contains the following: | ||
540 | <literallayout class='monospaced'> | ||
541 | PV = 1.19.3 | ||
542 | PR = r3 | ||
543 | RDEPENDS = update-rc.d eglibc (>= 2.13) | ||
544 | RRECOMMENDS = busybox-syslog busybox-udhcpc | ||
545 | PKGSIZE = 564701 | ||
546 | FILES = /usr/bin/* /usr/sbin/* /usr/libexec/* /usr/lib/lib*.so.* \ | ||
547 | /etc /com /var /bin/* /sbin/* /lib/*.so.* /usr/share/busybox \ | ||
548 | /usr/lib/busybox/* /usr/share/pixmaps /usr/share/applications \ | ||
549 | /usr/share/idl /usr/share/omf /usr/share/sounds /usr/lib/bonobo/servers | ||
550 | FILELIST = /etc/busybox.links /etc/init.d/hwclock.sh /bin/busybox /bin/sh | ||
551 | </literallayout> | ||
552 | Most of these name-value pairs correspond to variables used | ||
553 | to produce the package. | ||
554 | The exceptions are <filename>FILELIST</filename>, which is the | ||
555 | actual list of files in the package, and | ||
556 | <filename>PKGSIZE</filename>, which is the total size of files | ||
557 | in the package in bytes. | ||
558 | </para> | ||
559 | |||
560 | <para> | ||
561 | There is also a file corresponding to the recipe from which the | ||
562 | package came (e.g. | ||
563 | <filename>buildhistory/packages/core2-poky-linux/busybox/latest</filename>): | ||
564 | <literallayout class='monospaced'> | ||
565 | PV = 1.19.3 | ||
566 | PR = r3 | ||
567 | DEPENDS = virtual/i586-poky-linux-gcc virtual/i586-poky-linux-compilerlibs \ | ||
568 | virtual/libc update-rc.d-native | ||
569 | PACKAGES = busybox-httpd busybox-udhcpd busybox-udhcpc busybox-syslog \ | ||
570 | busybox-mdev busybox-dbg busybox busybox-doc busybox-dev \ | ||
571 | busybox-staticdev busybox-locale | ||
572 | </literallayout> | ||
573 | </para> | ||
574 | |||
575 | <para> | ||
576 | Finally, for those recipes fetched from a version control | ||
577 | system (e.g., Git), a file exists that lists source revisions | ||
578 | that are specified in the recipe and lists the actual revisions | ||
579 | used during the build. | ||
580 | Listed and actual revisions might differ when | ||
581 | <link linkend='var-SRCREV'><filename>SRCREV</filename></link> | ||
582 | is set to | ||
583 | <filename>${<link linkend='var-AUTOREV'>AUTOREV</link>}</filename>. | ||
584 | Here is an example assuming | ||
585 | <filename>buildhistory/packages/emenlow-poky-linux/linux-yocto/latest_srcrev</filename>): | ||
586 | <literallayout class='monospaced'> | ||
587 | # SRCREV_machine = "b5c37fe6e24eec194bb29d22fdd55d73bcc709bf" | ||
588 | SRCREV_machine = "b5c37fe6e24eec194bb29d22fdd55d73bcc709bf" | ||
589 | # SRCREV_emgd = "caea08c988e0f41103bbe18eafca20348f95da02" | ||
590 | SRCREV_emgd = "caea08c988e0f41103bbe18eafca20348f95da02" | ||
591 | # SRCREV_meta = "c2ed0f16fdec628242a682897d5d86df4547cf24" | ||
592 | SRCREV_meta = "c2ed0f16fdec628242a682897d5d86df4547cf24" | ||
593 | </literallayout> | ||
594 | You can use the <filename>buildhistory-collect-srcrevs</filename> | ||
595 | command to collect the stored <filename>SRCREV</filename> values | ||
596 | from build history and report them in a format suitable for use in | ||
597 | global configuration (e.g., <filename>local.conf</filename> | ||
598 | or a distro include file) to override floating | ||
599 | <filename>AUTOREV</filename> values to a fixed set of revisions. | ||
600 | Here is some example output from this command: | ||
601 | <literallayout class='monospaced'> | ||
602 | # emenlow-poky-linux | ||
603 | SRCREV_machine_pn-linux-yocto = "b5c37fe6e24eec194bb29d22fdd55d73bcc709bf" | ||
604 | SRCREV_emgd_pn-linux-yocto = "caea08c988e0f41103bbe18eafca20348f95da02" | ||
605 | SRCREV_meta_pn-linux-yocto = "c2ed0f16fdec628242a682897d5d86df4547cf24" | ||
606 | # core2-poky-linux | ||
607 | SRCREV_pn-kmod = "62081c0f68905b22f375156d4532fd37fa5c8d33" | ||
608 | SRCREV_pn-blktrace = "d6918c8832793b4205ed3bfede78c2f915c23385" | ||
609 | SRCREV_pn-opkg = "649" | ||
610 | </literallayout> | ||
611 | <note> | ||
612 | Here are some notes on using the | ||
613 | <filename>buildhistory-collect-srcrevs</filename> command: | ||
614 | <itemizedlist> | ||
615 | <listitem><para>By default, only values where the | ||
616 | <filename>SRCREV</filename> was | ||
617 | not hardcoded (usually when <filename>AUTOREV</filename> | ||
618 | was used) are reported. | ||
619 | Use the <filename>-a</filename> option to see all | ||
620 | <filename>SRCREV</filename> values. | ||
621 | </para></listitem> | ||
622 | <listitem><para>The output statements might not have any effect | ||
623 | if overrides are applied elsewhere in the build system | ||
624 | configuration. | ||
625 | Use the <filename>-f</filename> option to add the | ||
626 | <filename>forcevariable</filename> override to each output line | ||
627 | if you need to work around this restriction. | ||
628 | </para></listitem> | ||
629 | <listitem><para>The script does apply special handling when | ||
630 | building for multiple machines. | ||
631 | However, the script does place a | ||
632 | comment before each set of values that specifies | ||
633 | which triplet to which they belong as shown above | ||
634 | (e.g., <filename>emenlow-poky-linux</filename>). | ||
635 | </para></listitem> | ||
636 | </itemizedlist> | ||
637 | </note> | ||
638 | </para> | ||
639 | </section> | ||
640 | |||
641 | <section id='build-history-image-information'> | ||
642 | <title>Build History Image Information</title> | ||
643 | |||
644 | <para> | ||
645 | The files produced for each image are as follows: | ||
646 | <itemizedlist> | ||
647 | <listitem><para><filename>image-files:</filename> | ||
648 | A directory containing selected files from the root | ||
649 | filesystem. | ||
650 | The files are defined by | ||
651 | <filename>BUILDHISTORY_IMAGE_FILES</filename>. | ||
652 | </para></listitem> | ||
653 | <listitem><para><filename>build-id:</filename> | ||
654 | Human-readable information about the build configuration | ||
655 | and metadata source revisions.</para></listitem> | ||
656 | <listitem><para><filename>*.dot:</filename> | ||
657 | Dependency graphs for the image that are | ||
658 | compatible with <filename>graphviz</filename>. | ||
659 | </para></listitem> | ||
660 | <listitem><para><filename>files-in-image.txt:</filename> | ||
661 | A list of files in the image with permissions, | ||
662 | owner, group, size, and symlink information. | ||
663 | </para></listitem> | ||
664 | <listitem><para><filename>image-info.txt:</filename> | ||
665 | A text file containing name-value pairs with information | ||
666 | about the image. | ||
667 | See the following listing example for more information. | ||
668 | </para></listitem> | ||
669 | <listitem><para><filename>installed-package-names.txt:</filename> | ||
670 | A list of installed packages by name only.</para></listitem> | ||
671 | <listitem><para><filename>installed-package-sizes.txt:</filename> | ||
672 | A list of installed packages ordered by size. | ||
673 | </para></listitem> | ||
674 | <listitem><para><filename>installed-packages.txt:</filename> | ||
675 | A list of installed packages with full package | ||
676 | filenames.</para></listitem> | ||
677 | </itemizedlist> | ||
678 | <note> | ||
679 | Installed package information is able to be gathered and | ||
680 | produced even if package management is disabled for the final | ||
681 | image. | ||
682 | </note> | ||
683 | </para> | ||
684 | |||
685 | <para> | ||
686 | Here is an example of <filename>image-info.txt</filename>: | ||
687 | <literallayout class='monospaced'> | ||
688 | DISTRO = poky | ||
689 | DISTRO_VERSION = 1.1+snapshot-20120207 | ||
690 | USER_CLASSES = image-mklibs image-prelink | ||
691 | IMAGE_CLASSES = image_types | ||
692 | IMAGE_FEATURES = debug-tweaks x11-base apps-x11-core \ | ||
693 | package-management ssh-server-dropbear package-management | ||
694 | IMAGE_LINGUAS = en-us en-gb | ||
695 | IMAGE_INSTALL = task-core-boot task-base-extended | ||
696 | BAD_RECOMMENDATIONS = | ||
697 | ROOTFS_POSTPROCESS_COMMAND = buildhistory_get_image_installed ; rootfs_update_timestamp ; | ||
698 | IMAGE_POSTPROCESS_COMMAND = buildhistory_get_imageinfo ; | ||
699 | IMAGESIZE = 171816 | ||
700 | </literallayout> | ||
701 | Other than <filename>IMAGESIZE</filename>, which is the | ||
702 | total size of the files in the image in Kbytes, the | ||
703 | name-value pairs are variables that may have influenced the | ||
704 | content of the image. | ||
705 | This information is often useful when you are trying to determine | ||
706 | why a change in the package or file listings has occurred. | ||
707 | </para> | ||
708 | </section> | ||
709 | |||
710 | <section id='using-build-history-to-gather-image-information-only'> | ||
711 | <title>Using Build History to Gather Image Information Only</title> | ||
712 | |||
713 | <para> | ||
714 | As you can see, build history produces image information, | ||
715 | including dependency graphs, so you can see why something | ||
716 | was pulled into the image. | ||
717 | If you are just interested in this information and not | ||
718 | interested in collecting history or any package information, | ||
719 | you can enable writing only image information without | ||
720 | any history by adding the following | ||
721 | to your <filename>conf/local.conf</filename> file found in the | ||
722 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>: | ||
723 | <literallayout class='monospaced'> | ||
724 | INHERIT += "buildhistory" | ||
725 | BUILDHISTORY_COMMIT = "0" | ||
726 | BUILDHISTORY_FEATURES = "image" | ||
727 | </literallayout> | ||
728 | </para> | ||
729 | </section> | ||
730 | |||
731 | <section id='build-history-sdk-information'> | ||
732 | <title>Build History SDK Information</title> | ||
733 | <para> | ||
734 | Build history collects similar information on the contents | ||
735 | of SDKs (e.g., <filename>meta-toolchain</filename> | ||
736 | or <filename>bitbake -c populate_sdk imagename</filename>) | ||
737 | as compared to information it collects for images. | ||
738 | The following list shows the files produced for each SDK: | ||
739 | <itemizedlist> | ||
740 | <listitem><para><filename>files-in-sdk.txt:</filename> | ||
741 | A list of files in the SDK with permissions, | ||
742 | owner, group, size, and symlink information. | ||
743 | This list includes both the host and target parts | ||
744 | of the SDK. | ||
745 | </para></listitem> | ||
746 | <listitem><para><filename>sdk-info.txt:</filename> | ||
747 | A text file containing name-value pairs with information | ||
748 | about the SDK. | ||
749 | See the following listing example for more information. | ||
750 | </para></listitem> | ||
751 | <listitem><para>The following information appears under | ||
752 | each of the <filename>host</filename> | ||
753 | and <filename>target</filename> directories | ||
754 | for the portions of the SDK that run on the host and | ||
755 | on the target, respectively: | ||
756 | <itemizedlist> | ||
757 | <listitem><para><filename>depends.dot:</filename> | ||
758 | Dependency graph for the SDK that is | ||
759 | compatible with <filename>graphviz</filename>. | ||
760 | </para></listitem> | ||
761 | <listitem><para><filename>installed-package-names.txt:</filename> | ||
762 | A list of installed packages by name only. | ||
763 | </para></listitem> | ||
764 | <listitem><para><filename>installed-package-sizes.txt:</filename> | ||
765 | A list of installed packages ordered by size. | ||
766 | </para></listitem> | ||
767 | <listitem><para><filename>installed-packages.txt:</filename> | ||
768 | A list of installed packages with full package | ||
769 | filenames.</para></listitem> | ||
770 | </itemizedlist> | ||
771 | </para></listitem> | ||
772 | </itemizedlist> | ||
773 | </para> | ||
774 | |||
775 | <para> | ||
776 | Here is an example of <filename>sdk-info.txt</filename>: | ||
777 | <literallayout class='monospaced'> | ||
778 | DISTRO = poky | ||
779 | DISTRO_VERSION = 1.3+snapshot-20130327 | ||
780 | SDK_NAME = poky-eglibc-i686-arm | ||
781 | SDK_VERSION = 1.3+snapshot | ||
782 | SDKMACHINE = | ||
783 | SDKIMAGE_FEATURES = dev-pkgs dbg-pkgs | ||
784 | BAD_RECOMMENDATIONS = | ||
785 | SDKSIZE = 352712 | ||
786 | </literallayout> | ||
787 | Other than <filename>SDKSIZE</filename>, which is the | ||
788 | total size of the files in the SDK in Kbytes, the | ||
789 | name-value pairs are variables that might have influenced the | ||
790 | content of the SDK. | ||
791 | This information is often useful when you are trying to | ||
792 | determine why a change in the package or file listings | ||
793 | has occurred. | ||
794 | </para> | ||
795 | </section> | ||
796 | |||
797 | <section id='examining-build-history-information'> | ||
798 | <title>Examining Build History Information</title> | ||
799 | |||
800 | <para> | ||
801 | You can examine build history output from the command line or | ||
802 | from a web interface. | ||
803 | </para> | ||
804 | |||
805 | <para> | ||
806 | To see any changes that have occurred (assuming you have | ||
807 | <filename>BUILDHISTORY_COMMIT = "1"</filename>), you can simply | ||
808 | use any Git command that allows you to view the history of | ||
809 | a repository. | ||
810 | Here is one method: | ||
811 | <literallayout class='monospaced'> | ||
812 | $ git log -p | ||
813 | </literallayout> | ||
814 | You need to realize, however, that this method does show | ||
815 | changes that are not significant (e.g. a package's size | ||
816 | changing by a few bytes). | ||
817 | </para> | ||
818 | |||
819 | <para> | ||
820 | A command-line tool called <filename>buildhistory-diff</filename> | ||
821 | does exist, though, that queries the Git repository and prints just | ||
822 | the differences that might be significant in human-readable form. | ||
823 | Here is an example: | ||
824 | <literallayout class='monospaced'> | ||
825 | $ ~/poky/poky/scripts/buildhistory-diff . HEAD^ | ||
826 | Changes to images/qemux86_64/eglibc/core-image-minimal (files-in-image.txt): | ||
827 | /etc/anotherpkg.conf was added | ||
828 | /sbin/anotherpkg was added | ||
829 | * (installed-package-names.txt): | ||
830 | * anotherpkg was added | ||
831 | Changes to images/qemux86_64/eglibc/core-image-minimal (installed-package-names.txt): | ||
832 | anotherpkg was added | ||
833 | packages/qemux86_64-poky-linux/v86d: PACKAGES: added "v86d-extras" | ||
834 | * PR changed from "r0" to "r1" | ||
835 | * PV changed from "0.1.10" to "0.1.12" | ||
836 | packages/qemux86_64-poky-linux/v86d/v86d: PKGSIZE changed from 110579 to 144381 (+30%) | ||
837 | * PR changed from "r0" to "r1" | ||
838 | * PV changed from "0.1.10" to "0.1.12" | ||
839 | </literallayout> | ||
840 | </para> | ||
841 | |||
842 | <para> | ||
843 | To see changes to the build history using a web interface, follow | ||
844 | the instruction in the <filename>README</filename> file here. | ||
845 | <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/buildhistory-web/'></ulink>. | ||
846 | </para> | ||
847 | |||
848 | <para> | ||
849 | Here is a sample screenshot of the interface: | ||
850 | <imagedata fileref="figures/buildhistory-web.png" align="center" scalefit="1" width="130%" contentdepth="130%" /> | ||
851 | </para> | ||
852 | </section> | ||
853 | </section> | ||
854 | </section> | ||
855 | |||
856 | </chapter> | ||
857 | <!-- | ||
858 | vim: expandtab tw=80 ts=4 | ||
859 | --> | ||