blob: 410548727cef976d81e5ad8a953e8aaea38cadc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<chapter id='hello'>
<title>A BitBake Hello World</title>
<section>
<title>BitBake Hello World</title>
<para>The simplest example commonly used to demonstrate any new
programming language or tool is the
<ulink url="http://en.wikipedia.org/wiki/Hello_world_program">Hello World</ulink>
example.
This chapter demonstrates, in tutorial form, Hello
World within the context of BitBake.
This tutorial describes how to create a new Project
and the applicable metadata files necessary to allow
BitBake to build it.
</para>
</section>
<section>
<title>Obtaining BitBake</title>
<para>Please refer to Chapter 1 Section 1.7 for the various methods to
obtain BitBake.
Once the source code is on your machine the BitBake directory will
appear as follows:
<screen>
$ ls -al
total 100
drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 .
drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 ..
-rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS
drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin
drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build
-rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog
drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes
drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf
drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib
-rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING
drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc
-rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore
-rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER
drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib
-rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in
-rwxrwxr-x. 1 wmat wmat 3195 Jan 31 11:57 setup.py
-rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO
</screen>
</para>
<para>At this point you should have BitBake extracted or cloned to
a directory and it should match the directory tree above.
Please note that you'll see your username wherever
"wmat" appears above.
</para>
</section>
<section>
<title>Setting Up the BitBake Environment</title>
<para>The recommended method to run BitBake is from a directory of your
choice.
The directory can be within your home directory or in /usr/local,
depending on your preference.
Let's run BitBake now to make sure it's working.
From the BitBake source code directory issue the following command:
<screen>$ ./bin/bitbake --version
BitBake Build Tool Core version 1.19.0, bitbake version
1.19.0
</screen>
You're now ready to use BitBake.
</para>
<para>Note that if you're a Vim user, you will find useful
Vim configuration contributions in the
<emphasis>contrib/vim</emphasis>
directory.
Copy the files from that directory to your
<emphasis>/home/yourusername/.vim</emphasis>
directory.
If it doesn't exist, create it, and restart Vim.
</para>
</section>
<section>
<title>The Hello World Example</title>
<para>The following example leaps directly into how BitBake
works.
Every attempt is made to explain what is happening,
however, further information can be found in the
Metadata chapter.
</para>
<para>The overall goal of this exercise is to create a Hello
World example utilizing concepts used to
build and construct a complete example application
including Tasks and Layers.
This is how modern projects such as OpenEmbedded and
the Yocto Project utilize BitBake, therefore it
provides an excellent starting point for understanding
BitBake.
</para>
<para>It should be noted that this chapter was inspired by
and draws heavily from several sources:
<itemizedlist>
<listitem>
<ulink href="http://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html">Mailing List post - The BitBake equivalent of "Hello, World!"</ulink>
</listitem>
<listitem>
<ulink href="http://hambedded.org/blog/2012/11/24/from-bitbake-hello-world-to-an-image/">Hambedded Linux blog post - From Bitbake Hello World to an Image</ulink>
</listitem>
</itemizedlist>
</para>
<para>
</para>
</section>
</chapter>
|