summaryrefslogtreecommitdiffstats
path: root/bitbake/doc
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2014-02-19 16:15:38 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 18:59:03 -0700
commit4cd882b9d05f503ee58f78cceebaa9e63dc2048f (patch)
treeba60c0698c567597d99a26e5da3e7daa4b22938f /bitbake/doc
parent9b3e31e5e16238a7038d3fea409121be1e0e0709 (diff)
downloadpoky-4cd882b9d05f503ee58f78cceebaa9e63dc2048f.tar.gz
bitbake: user-manual: Added "Hello World" Appendix.
I took Bill's chapter and made it into an appendix. I did some re-writing to make it not so much like a getting-started feel, although it still leans way that way for an appendix. The content is not complete. Had to add in a line to the user-manual.xml file so that the new appendix would be part of the book. Had to use a different form of the command in the user-manual-cusomization.xsl file in order to not through a bunch of errors for an unrecognized parameter value. I commented out the existing one. (Bitbake rev: 80e9306c288ca2ab42585f99fb0f396253cb8253) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/doc')
-rw-r--r--bitbake/doc/user-manual/user-manual-customization.xsl3
-rw-r--r--bitbake/doc/user-manual/user-manual-hello.xml213
-rw-r--r--bitbake/doc/user-manual/user-manual.xml2
3 files changed, 117 insertions, 101 deletions
diff --git a/bitbake/doc/user-manual/user-manual-customization.xsl b/bitbake/doc/user-manual/user-manual-customization.xsl
index 7d06e39d4d..a8ec28ae20 100644
--- a/bitbake/doc/user-manual/user-manual-customization.xsl
+++ b/bitbake/doc/user-manual/user-manual-customization.xsl
@@ -5,9 +5,10 @@
5 5
6 <xsl:param name="html.stylesheet" select="'user-manual-style.css'" /> 6 <xsl:param name="html.stylesheet" select="'user-manual-style.css'" />
7 <xsl:param name="chapter.autolabel" select="1" /> 7 <xsl:param name="chapter.autolabel" select="1" />
8 <xsl:param name="appendix.autolabel" select="A" /> 8<!-- <xsl:param name="appendix.autolabel" select="A" /> -->
9 <xsl:param name="section.autolabel" select="1" /> 9 <xsl:param name="section.autolabel" select="1" />
10 <xsl:param name="section.label.includes.component.label" select="1" /> 10 <xsl:param name="section.label.includes.component.label" select="1" />
11 <xsl:param name="appendix.autolabel">A</xsl:param>
11 12
12<!-- <xsl:param name="generate.toc" select="'article nop'"></xsl:param> --> 13<!-- <xsl:param name="generate.toc" select="'article nop'"></xsl:param> -->
13 14
diff --git a/bitbake/doc/user-manual/user-manual-hello.xml b/bitbake/doc/user-manual/user-manual-hello.xml
index 77869f80dd..5a616e07b3 100644
--- a/bitbake/doc/user-manual/user-manual-hello.xml
+++ b/bitbake/doc/user-manual/user-manual-hello.xml
@@ -1,8 +1,8 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3 3
4<chapter id='hello'> 4<appendix id='hello-world-example'>
5 <title>A BitBake Hello World</title> 5 <title>Hello World Example</title>
6 6
7 <section id='bitbake-hello-world'> 7 <section id='bitbake-hello-world'>
8 <title>BitBake Hello World</title> 8 <title>BitBake Hello World</title>
@@ -12,22 +12,23 @@
12 programming language or tool is the 12 programming language or tool is the
13 <ulink url="http://en.wikipedia.org/wiki/Hello_world_program">Hello World</ulink> 13 <ulink url="http://en.wikipedia.org/wiki/Hello_world_program">Hello World</ulink>
14 example. 14 example.
15 This chapter demonstrates, in tutorial form, Hello 15 This appendix demonstrates, in tutorial form, Hello
16 World within the context of BitBake. 16 World within the context of BitBake.
17 This tutorial describes how to create a new Project 17 The tutorial describes how to create a new Project
18 and the applicable metadata files necessary to allow 18 and the applicable metadata files necessary to allow
19 BitBake to build it. 19 BitBake to build it.
20 </para> 20 </para>
21 </section> 21 </section>
22 22
23 <section id='obtaining-bitbake'> 23 <section id='example-obtaining-bitbake'>
24 <title>Obtaining BitBake</title> 24 <title>Obtaining BitBake</title>
25 25
26 <para> 26 <para>
27 Please refer to Chapter 1 Section 1.7 for the various methods to 27 See the
28 obtain BitBake. 28 "<link linkend='obtaining-bitbake'>Obtaining BitBake</link>"
29 Once the source code is on your machine the BitBake directory will 29 section for information on how to obtain BitBake.
30 appear as follows: 30 Once you have the source code on your machine, the BitBake directory
31 appears as follows:
31 <literallayout class='monospaced'> 32 <literallayout class='monospaced'>
32 $ ls -al 33 $ ls -al
33 total 100 34 total 100
@@ -52,10 +53,9 @@
52 </para> 53 </para>
53 54
54 <para> 55 <para>
55 At this point you should have BitBake extracted or cloned to 56 At this point, you should have BitBake cloned to
56 a directory and it should match the directory tree above. 57 a directory that matches the previous listing except for
57 Please note that you'll see your username wherever 58 dates and user names.
58 "wmat" appears above.
59 </para> 59 </para>
60 </section> 60 </section>
61 61
@@ -68,62 +68,56 @@
68 The directory can be within your home directory or in 68 The directory can be within your home directory or in
69 <filename>/usr/local</filename>, 69 <filename>/usr/local</filename>,
70 depending on your preference. 70 depending on your preference.
71 Let's run BitBake now to make sure it's working.
72 </para> 71 </para>
73 72
74 <para> 73 <para>
74 First, run BitBake to make sure it's working.
75 From the BitBake source code directory, issue the following command: 75 From the BitBake source code directory, issue the following command:
76 <literallayout class='monospaced'> 76 <literallayout class='monospaced'>
77 $ ./bin/bitbake --version 77 $ ./bin/bitbake --version
78 BitBake Build Tool Core version 1.19.0, bitbake version 78 BitBake Build Tool Core version 1.19.0, bitbake version
79 1.19.0 79 1.19.0
80 </literallayout> 80 </literallayout>
81 You're now ready to use BitBake. 81 You are now ready to use BitBake.
82 </para> 82 </para>
83 83
84 <para> 84 <para>
85 A final step to make development easier is to add the executable 85 A final step to make development easier is to add the executable
86 binary to your environment <filename>PATH</filename>. 86 binary to your environment <filename>PATH</filename>.
87 First, have a look at your current <filename>PATH</filename> variable. 87 First, look at your current <filename>PATH</filename> variable
88 If I check mine, I get: 88 by entering the following:
89 <literallayout class='monospaced'> 89 <literallayout class='monospaced'>
90 $ echo $PATH 90 $ echo $PATH
91 /home/wmat/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:
92 /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
93 </literallayout> 91 </literallayout>
94 Now add the directory location for the BitBake binary to the <filename>PATH</filename> 92 Next, add the directory location for the BitBake binary to the
95 with: 93 <filename>PATH</filename> using this form:
96 <literallayout class='monospaced'> 94 <literallayout class='monospaced'>
97 $ export PATH={path to the bitbake executable}:$PATH 95 $ export PATH=&lt;path-to-bitbake-executable&gt;:$PATH
98 </literallayout> 96 </literallayout>
99 This will add the directory to the beginning of your PATH environment 97 This will add the directory to the beginning of your
100 variable. 98 <filename>PATH</filename> environment variable.
101 For example, on my machine: 99 You should now be able to enter the <filename>bitbake</filename>
102 <literallayout class='monospaced'> 100 command at the command line to run BitBake.
103 $ export PATH=/media/wmat/Backups/dev/bitbake/bin:$PATH 101 </para>
104 /media/wmat/Backups/dev/bitbake/bin:/home/wmat/bin: 102
105 /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin: 103 <para>
106 /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 104 For a more permanent solution assuming you are running the BASH
107 </literallayout>
108 Now, you should be able to simply enter the
109 <filename>bitbake</filename>
110 command at the command line to run bitbake.
111 For a more permanent solution and assuming you are running the BASH
112 shell, edit <filename>~/.bashrc</filename> and add the following to the end 105 shell, edit <filename>~/.bashrc</filename> and add the following to the end
113 of that file: 106 of that file:
114 <literallayout class='monospaced'> 107 <literallayout class='monospaced'>
115 PATH={path to the bitbake executable}:$PATH 108 PATH=&lt;path-to-bitbake-executable&gt;:$PATH
116 </literallayout> 109 </literallayout>
117 </para> 110 </para>
118 111
119 <para> 112 <para>
120 Note that if you're a Vim user, you will find useful 113 If you're a Vim user, you will find useful
121 Vim configuration contributions in the 114 Vim configuration contributions in the
122 <filename>contrib/vim</filename> directory. 115 <filename>contrib/vim</filename> directory.
123 Copy the files from that directory to your 116 Copy the files from that directory to your
124 <filename>/home/yourusername/.vim</filename> 117 <filename>/home/yourusername/.vim</filename>
125 directory. 118 directory.
126 If it doesn't exist, create it, and restart Vim. 119 If that directory does not exist, create it, and then
120 restart Vim.
127 </para> 121 </para>
128 </section> 122 </section>
129 123
@@ -133,16 +127,17 @@
133 <para> 127 <para>
134 The following example leaps directly into how BitBake 128 The following example leaps directly into how BitBake
135 works. 129 works.
136 Every attempt is made to explain what is happening, 130 While every attempt is made to explain what is happening,
137 however, further information can be found in the 131 not everything can be covered.
138 Metadata chapter. 132 You can find further information in the
133 "<link linkend='user-manual-metadata'>Syntax and Operators</link>"
134 chapter.
139 </para> 135 </para>
140 136
141 <para> 137 <para>
142 The overall goal of this exercise is to create a Hello 138 The overall goal of this exercise is to build a
143 World example utilizing concepts used to 139 complete "Hello World" example utilizing task and layer
144 build and construct a complete example application 140 concepts.
145 including Tasks and Layers.
146 This is how modern projects such as OpenEmbedded and 141 This is how modern projects such as OpenEmbedded and
147 the Yocto Project utilize BitBake, therefore it 142 the Yocto Project utilize BitBake, therefore it
148 provides an excellent starting point for understanding 143 provides an excellent starting point for understanding
@@ -162,34 +157,39 @@
162 </itemizedlist> 157 </itemizedlist>
163 </para> 158 </para>
164 159
165 <section id='a-reverse-walkthrough'> 160 <section id='a-reverse-walk-through'>
166 <title>A Reverse Walkthrough</title> 161 <title>A Reverse Walk-Through</title>
167 162
168 <para> 163 <para>
169 One of the best means to understand anything is to walk 164 A good way to understand anything is to walk through the steps
170 through the steps to where we want to be by observing first 165 that take you to where you want to be and observe first
171 principles. 166 principles.
172 BitBake allows us to do this through the -D or Debug command 167 BitBake allows us to do this through the
173 line parameter. 168 <filename>-D</filename> or <filename>Debug</filename>
174 We know we want to eventually compile a HelloWorld example, but 169 command-line parameter.
175 we don't know what we need to do that. 170 </para>
176 Remember that BitBake utilizes three types of metadata files: 171
177 Configuration Files, Classes, and Recipes. 172 <para>
178 But where do they go, how does BitBake find them, etc. etc.? 173 The goal is to eventually compile a "Hello World" example.
179 Hopefully we can use BitBake's error messaging to figure this 174 However, it is unknown what is needed to achieve that goal.
180 out and better understand exactly what's going on. 175 Recall that BitBake utilizes three types of metadata files:
176 <link linkend='configuration-files'>Configuration Files</link>,
177 <link linkend='classes'>Classes</link>, and
178 <link linkend='recipes'>Recipes</link>.
179 But where do they go?
180 How does BitBake find them?
181 BitBake's error messaging helps you answer these types of questions
182 and helps you better understand exactly what is going on.
181 </para> 183 </para>
182 184
183 <para> 185 <para>
184 First, let's begin by setting up a directory for our HelloWorld 186 First, set up a directory for the "Hello World" project.
185 project. 187 Here is how you can do so in your home directory:
186 I'll do this in my home directory and change into that
187 directory:
188 <literallayout class='monospaced'> 188 <literallayout class='monospaced'>
189 $ mkdir ~/dev/hello &amp;&amp; cd ~/dev/hello 189 $ mkdir ~/dev/hello &amp;&amp; cd ~/dev/hello
190 </literallayout> 190 </literallayout>
191 Within this new, empty directory, let's run BitBake with 191 Within this new, empty directory, run BitBake with
192 Debugging output and see what happens: 192 debugging output and see what happens:
193 <literallayout class='monospaced'> 193 <literallayout class='monospaced'>
194 $ bitbake -DDD 194 $ bitbake -DDD
195 The BBPATH variable is not set 195 The BBPATH variable is not set
@@ -208,38 +208,44 @@
208 </literallayout> 208 </literallayout>
209 The majority of this output is specific to environment variables 209 The majority of this output is specific to environment variables
210 that are not directly relevant to BitBake. 210 that are not directly relevant to BitBake.
211 However, the very 211 However, the very first message
212 first message <filename>The BBPATH variable is not set</filename> 212 "<filename>The BBPATH variable is not set</filename>"
213 is and needs to be rectified. 213 is relevant and you need to rectify it by setting
214 So how do we set the BBPATH 214 <link linkend='var-BBPATH'><filename>BBPATH</filename></link>.
215 variable? 215 </para>
216
217 <para>
218 When you run BitBake, it begins looking for metadata files.
219 The <filename>BBPATH</filename> variable is what tells
220 BitBake where to look.
221 You could set <filename>BBPATH</filename> in the same manner
222 that you set <filename>PATH</filename> as shown earlier.
223 However, it is much more flexible to set the
224 <link linkend='var-BBPATH'><filename>BBPATH</filename></link>
225 variable for each project.
216 </para> 226 </para>
217 227
218 <para> 228 <para>
219 When BitBake is run it begins looking for metadata files. 229 Without <filename>BBPATH</filename>, Bitbake cannot
220 The BBPATH variable is what tells BitBake where to look. 230 find any configuration files (<filename>.conf</filename>)
221 It is possible to set BBPATH as an environment variable as you 231 or recipe files (<filename>.bb</filename>) at all.
222 did above for the BitBake exexcutable's PATH. 232 BitBake also cannot find the <filename>bitbake.conf</filename>
223 However, it's much more flexible to set the BBPATH variable for 233 file.
224 each project, as this allows for greater flexibility.
225 </para> 234 </para>
226 235
227 <para> 236 <para>
228 Without BBPATH Bitbake will not find any <filename>.conf</filename>
229 files or recipe files at all.
230 It will also not find <filename>bitbake.conf</filename>.
231 Note the reference to <filename>conf/</filename>.
232 It is standard practice to organize the project's directory tree 237 It is standard practice to organize the project's directory tree
233 to include a <filename>conf/</filename> and a 238 to include both a <filename>conf/</filename> and
234 <filename>classes/</filename> directory. 239 <filename>classes/</filename> directory.
235 Add those now to your project directory: 240 You need to add those directories to your project:
236 <literallayout class='monospaced'> 241 <literallayout class='monospaced'>
237 $ mkdir conf classes 242 $ mkdir conf classes
238 </literallayout> 243 </literallayout>
239 Now let's copy the sample configuration files provided in the 244 Once those directories are in place, you can copy the
240 BitBake source tree to their appropriate conf and classes 245 sample configuration files provided in the
241 directory. 246 BitBake source tree to their appropriate directories.
242 Change to the BitBake source tree directory and: 247 First, change to the BitBake source tree directory and
248 then copy the directories:
243 <literallayout class='monospaced'> 249 <literallayout class='monospaced'>
244 cp conf/bitbake.conf ~/dev/hello/conf/ 250 cp conf/bitbake.conf ~/dev/hello/conf/
245 cp classes/base.bbclass ~/dev/hello/classes/ 251 cp classes/base.bbclass ~/dev/hello/classes/
@@ -249,36 +255,43 @@
249 <literallayout class='monospaced'> 255 <literallayout class='monospaced'>
250 ~/dev/hello$ tree 256 ~/dev/hello$ tree
251 . 257 .
252 ├── classes 258 |-- classes
253    └── base.bbclass 259 |   +-- base.bbclass
254 └── conf 260 +-- conf
255 └── bitbake.conf 261 +-- bitbake.conf
256 </literallayout> 262 </literallayout>
257 </para> 263 </para>
258 264
259 <para> 265 <para>
260 But what about BBPATH, we still haven't set it? 266 Once you have copied these files into your project, you
267 can now get back to resolving the <filename>BBPATH</filename>
268 issue.
261 </para> 269 </para>
262 270
263 <para> 271 <para>
264 The first configuration file that BitBake looks for is always 272 The first configuration file that BitBake looks for is always
265 <filename>bblayers.conf</filename>. 273 <filename>bblayers.conf</filename>.
266 With this knowledge we know that to resolve our BBPATH error we 274 With this knowledge, you know that to resolve your
267 can add a <filename>conf/bblayers.conf</filename> file to our 275 <filename>BBPATH</filename> error you can add a
268 project source tree and populate it with the BBPATH variable 276 <filename>conf/bblayers.conf</filename> file to the
269 declaration. 277 project source tree and populate it with the
278 <filename>BBPATH</filename> variable declaration.
279 </para>
280
281 <para>
270 From your project source tree: 282 From your project source tree:
271 <literallayout class='monospaced'> 283 <literallayout class='monospaced'>
272 $ vim conf/bblayers.conf 284 $ vim conf/bblayers.conf
273 </literallayout> 285 </literallayout>
274 Add the following to the empty bblayers.conf file: 286 Now add the following to the empty
287 <filename>bblayers.conf</filename> file:
275 <literallayout class='monospaced'> 288 <literallayout class='monospaced'>
276 BBPATH := "${TOPDIR}" 289 BBPATH := "${TOPDIR}"
277 </literallayout> 290 </literallayout>
278 </para> 291 </para>
279 292
280 <para> 293 <para>
281 Now from the root of our project directory, let's run BitBake 294 Now, from the root of your project directory, run BitBake
282 again and see what happens: 295 again and see what happens:
283 <literallayout class='monospaced'> 296 <literallayout class='monospaced'>
284 $ bitbake -DDD 297 $ bitbake -DDD
@@ -311,11 +324,11 @@
311 bb_codeparser.dat' 324 bb_codeparser.dat'
312 </literallayout> 325 </literallayout>
313 <note> 326 <note>
314 From this point forward, the environment variable 327 From this point forward in the example, the environment
315 removal messages will be ignored and omitted. 328 variable removal messages are ignored and omitted.
316 Let's examine the relevant DEBUG messages: 329 Examine the relevant DEBUG messages:
317 </note> 330 </note>
318 </para> 331 </para>
319 </section> 332 </section>
320 </section> 333 </section>
321</chapter> 334</appendix>
diff --git a/bitbake/doc/user-manual/user-manual.xml b/bitbake/doc/user-manual/user-manual.xml
index ba690ab243..76c3edf527 100644
--- a/bitbake/doc/user-manual/user-manual.xml
+++ b/bitbake/doc/user-manual/user-manual.xml
@@ -85,4 +85,6 @@
85 85
86 <xi:include href="user-manual-ref-variables.xml"/> 86 <xi:include href="user-manual-ref-variables.xml"/>
87 87
88 <xi:include href="user-manual-hello.xml"/>
89
88</book> 90</book>