diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-11 12:45:15 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-27 21:01:08 +0000 |
commit | bfa18b58d320edafef847e46f7670ddddfb8e3cf (patch) | |
tree | 570031392a05f98b4cf84cc715c6b3e2d9516748 /bitbake/doc/user-manual/user-manual-bitbakecommand.xml | |
parent | 034e49004fd74d6c2bd25856382238045601fb5d (diff) | |
download | poky-bfa18b58d320edafef847e46f7670ddddfb8e3cf.tar.gz |
bitbake: user-manual: Separate out chapters into individual files
Splitting the manual into a chapter per file makes the content
a little more managable.
(Bitbake rev: 020178eba958d2d5142ee0909fc0fd133b97cd92)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/doc/user-manual/user-manual-bitbakecommand.xml')
-rw-r--r-- | bitbake/doc/user-manual/user-manual-bitbakecommand.xml | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/bitbake/doc/user-manual/user-manual-bitbakecommand.xml b/bitbake/doc/user-manual/user-manual-bitbakecommand.xml new file mode 100644 index 0000000000..119c89299f --- /dev/null +++ b/bitbake/doc/user-manual/user-manual-bitbakecommand.xml | |||
@@ -0,0 +1,158 @@ | |||
1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | ||
2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | ||
3 | |||
4 | <chapter> | ||
5 | <title>The BitBake command</title> | ||
6 | <section> | ||
7 | <title>Introduction</title> | ||
8 | <para>bitbake is the primary command in the system. It facilitates executing tasks in a single .bb file, or executing a given task on a set of multiple .bb files, accounting for interdependencies amongst them.</para> | ||
9 | </section> | ||
10 | <section> | ||
11 | <title>Usage and syntax</title> | ||
12 | <para> | ||
13 | <screen><prompt>$ </prompt>bitbake --help | ||
14 | usage: bitbake [options] [package ...] | ||
15 | |||
16 | Executes the specified task (default is 'build') for a given set of BitBake files. | ||
17 | It expects that BBFILES is defined, which is a space separated list of files to | ||
18 | be executed. BBFILES does support wildcards. | ||
19 | Default BBFILES are the .bb files in the current directory. | ||
20 | |||
21 | options: | ||
22 | --version show program's version number and exit | ||
23 | -h, --help show this help message and exit | ||
24 | -b BUILDFILE, --buildfile=BUILDFILE | ||
25 | execute the task against this .bb file, rather than a | ||
26 | package from BBFILES. | ||
27 | -k, --continue continue as much as possible after an error. While the | ||
28 | target that failed, and those that depend on it, | ||
29 | cannot be remade, the other dependencies of these | ||
30 | targets can be processed all the same. | ||
31 | -f, --force force run of specified cmd, regardless of stamp status | ||
32 | -i, --interactive drop into the interactive mode also called the BitBake | ||
33 | shell. | ||
34 | -c CMD, --cmd=CMD Specify task to execute. Note that this only executes | ||
35 | the specified task for the providee and the packages | ||
36 | it depends on, i.e. 'compile' does not implicitly call | ||
37 | stage for the dependencies (IOW: use only if you know | ||
38 | what you are doing). Depending on the base.bbclass a | ||
39 | listtasks task is defined and will show available | ||
40 | tasks | ||
41 | -r FILE, --read=FILE read the specified file before bitbake.conf | ||
42 | -v, --verbose output more chit-chat to the terminal | ||
43 | -D, --debug Increase the debug level. You can specify this more | ||
44 | than once. | ||
45 | -n, --dry-run don't execute, just go through the motions | ||
46 | -p, --parse-only quit after parsing the BB files (developers only) | ||
47 | -s, --show-versions show current and preferred versions of all packages | ||
48 | -e, --environment show the global or per-package environment (this is | ||
49 | what used to be bbread) | ||
50 | -g, --graphviz emit the dependency trees of the specified packages in | ||
51 | the dot syntax | ||
52 | -I IGNORED_DOT_DEPS, --ignore-deps=IGNORED_DOT_DEPS | ||
53 | Stop processing at the given list of dependencies when | ||
54 | generating dependency graphs. This can help to make | ||
55 | the graph more appealing | ||
56 | -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS | ||
57 | Show debug logging for the specified logging domains | ||
58 | -P, --profile profile the command and print a report | ||
59 | |||
60 | |||
61 | </screen> | ||
62 | </para> | ||
63 | <para> | ||
64 | <example> | ||
65 | <title>Executing a task against a single .bb</title> | ||
66 | <para>Executing tasks for a single file is relatively simple. You specify the file in question, and BitBake parses it and executes the specified task (or <quote>build</quote> by default). It obeys intertask dependencies when doing so.</para> | ||
67 | <para><quote>clean</quote> task:</para> | ||
68 | <para><screen><prompt>$ </prompt>bitbake -b blah_1.0.bb -c clean</screen></para> | ||
69 | <para><quote>build</quote> task:</para> | ||
70 | <para><screen><prompt>$ </prompt>bitbake -b blah_1.0.bb</screen></para> | ||
71 | </example> | ||
72 | </para> | ||
73 | <para> | ||
74 | <example> | ||
75 | <title>Executing tasks against a set of .bb files</title> | ||
76 | <para>There are a number of additional complexities introduced when one wants to manage multiple .bb files. Clearly there needs to be a way to tell BitBake what files are available, and of those, which we want to execute at this time. There also needs to be a way for each .bb to express its dependencies, both for build time and runtime. There must be a way for the user to express their preferences when multiple .bb's provide the same functionality, or when there are multiple versions of a .bb.</para> | ||
77 | <para>The next section, Metadata, outlines how to specify such things.</para> | ||
78 | <para>Note that the bitbake command, when not using --buildfile, accepts a <varname>PROVIDER</varname>, not a filename or anything else. By default, a .bb generally PROVIDES its packagename, packagename-version, and packagename-version-revision.</para> | ||
79 | <screen><prompt>$ </prompt>bitbake blah</screen> | ||
80 | <screen><prompt>$ </prompt>bitbake blah-1.0</screen> | ||
81 | <screen><prompt>$ </prompt>bitbake blah-1.0-r0</screen> | ||
82 | <screen><prompt>$ </prompt>bitbake -c clean blah</screen> | ||
83 | <screen><prompt>$ </prompt>bitbake virtual/whatever</screen> | ||
84 | <screen><prompt>$ </prompt>bitbake -c clean virtual/whatever</screen> | ||
85 | </example> | ||
86 | <example> | ||
87 | <title>Generating dependency graphs</title> | ||
88 | <para>BitBake is able to generate dependency graphs using the dot syntax. These graphs can be converted | ||
89 | to images using the <application>dot</application> application from <ulink url="http://www.graphviz.org">Graphviz</ulink>. | ||
90 | Two files will be written into the current working directory, <emphasis>depends.dot</emphasis> containing dependency information at the package level and <emphasis>task-depends.dot</emphasis> containing a breakdown of the dependencies at the task level. To stop depending on common depends, one can use the <prompt>-I depend</prompt> to omit these from the graph. This can lead to more readable graphs. This way, <varname>DEPENDS</varname> from inherited classes such as base.bbclass can be removed from the graph.</para> | ||
91 | <screen><prompt>$ </prompt>bitbake -g blah</screen> | ||
92 | <screen><prompt>$ </prompt>bitbake -g -I virtual/whatever -I bloom blah</screen> | ||
93 | </example> | ||
94 | </para> | ||
95 | </section> | ||
96 | <section> | ||
97 | <title>Special variables</title> | ||
98 | <para>Certain variables affect BitBake operation:</para> | ||
99 | <section> | ||
100 | <title><varname>BB_NUMBER_THREADS</varname></title> | ||
101 | <para> The number of threads BitBake should run at once (default: 1).</para> | ||
102 | </section> | ||
103 | </section> | ||
104 | <section> | ||
105 | <title>Metadata</title> | ||
106 | <para>As you may have seen in the usage information, or in the information about .bb files, the <varname>BBFILES</varname> variable is how the BitBake tool locates its files. This variable is a space separated list of files that are available, and supports wildcards. | ||
107 | <example> | ||
108 | <title>Setting BBFILES</title> | ||
109 | <programlisting><varname>BBFILES</varname> = "/path/to/bbfiles/*.bb"</programlisting> | ||
110 | </example></para> | ||
111 | <para>With regard to dependencies, it expects the .bb to define a <varname>DEPENDS</varname> variable, which contains a space separated list of <quote>package names</quote>, which themselves are the <varname>PN</varname> variable. The <varname>PN</varname> variable is, in general, set to a component of the .bb filename by default.</para> | ||
112 | <example> | ||
113 | <title>Depending on another .bb</title> | ||
114 | <para>a.bb: | ||
115 | <screen>PN = "package-a" | ||
116 | DEPENDS += "package-b"</screen> | ||
117 | </para> | ||
118 | <para>b.bb: | ||
119 | <screen>PN = "package-b"</screen> | ||
120 | </para> | ||
121 | </example> | ||
122 | <example> | ||
123 | <title>Using PROVIDES</title> | ||
124 | <para>This example shows the usage of the <varname>PROVIDES</varname> variable, which allows a given .bb to specify what functionality it provides.</para> | ||
125 | <para>package1.bb: | ||
126 | <screen>PROVIDES += "virtual/package"</screen> | ||
127 | </para> | ||
128 | <para>package2.bb: | ||
129 | <screen>DEPENDS += "virtual/package"</screen> | ||
130 | </para> | ||
131 | <para>package3.bb: | ||
132 | <screen>PROVIDES += "virtual/package"</screen> | ||
133 | </para> | ||
134 | <para>As you can see, we have two different .bb's that provide the same functionality (virtual/package). Clearly, there needs to be a way for the person running BitBake to control which of those providers gets used. There is, indeed, such a way.</para> | ||
135 | <para>The following would go into a .conf file, to select package1: | ||
136 | <screen>PREFERRED_PROVIDER_virtual/package = "package1"</screen> | ||
137 | </para> | ||
138 | </example> | ||
139 | <example> | ||
140 | <title>Specifying version preference</title> | ||
141 | <para>When there are multiple <quote>versions</quote> of a given package, BitBake defaults to selecting the most recent version, unless otherwise specified. If the .bb in question has a <varname>DEFAULT_PREFERENCE</varname> set lower than the other .bb's (default is 0), then it will not be selected. This allows the person or persons maintaining the repository of .bb files to specify their preference for the default selected version. In addition, the user can specify their preferred version.</para> | ||
142 | <para>If the first .bb is named <filename>a_1.1.bb</filename>, then the <varname>PN</varname> variable will be set to <quote>a</quote>, and the <varname>PV</varname> variable will be set to 1.1.</para> | ||
143 | <para>If we then have an <filename>a_1.2.bb</filename>, BitBake will choose 1.2 by default. However, if we define the following variable in a .conf that BitBake parses, we can change that. | ||
144 | <screen>PREFERRED_VERSION_a = "1.1"</screen> | ||
145 | </para> | ||
146 | </example> | ||
147 | <example> | ||
148 | <title>Using <quote>bbfile collections</quote></title> | ||
149 | <para>bbfile collections exist to allow the user to have multiple repositories of bbfiles that contain the same exact package. For example, one could easily use them to make one's own local copy of an upstream repository, but with custom modifications that one does not want upstream. Usage:</para> | ||
150 | <screen>BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb" | ||
151 | BBFILE_COLLECTIONS = "upstream local" | ||
152 | BBFILE_PATTERN_upstream = "^/stuff/openembedded/" | ||
153 | BBFILE_PATTERN_local = "^/stuff/openembedded.modified/" | ||
154 | BBFILE_PRIORITY_upstream = "5" | ||
155 | BBFILE_PRIORITY_local = "10"</screen> | ||
156 | </example> | ||
157 | </section> | ||
158 | </chapter> | ||