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/yocto-project-qs/yocto-project-qs.xml | |
download | yocto-docs-master.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/yocto-project-qs/yocto-project-qs.xml')
-rw-r--r-- | documentation/yocto-project-qs/yocto-project-qs.xml | 958 |
1 files changed, 958 insertions, 0 deletions
diff --git a/documentation/yocto-project-qs/yocto-project-qs.xml b/documentation/yocto-project-qs/yocto-project-qs.xml new file mode 100644 index 0000000..96abe83 --- /dev/null +++ b/documentation/yocto-project-qs/yocto-project-qs.xml | |||
@@ -0,0 +1,958 @@ | |||
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 | <article id='intro'> | ||
6 | <articleinfo> | ||
7 | <title>Yocto Project Quick Start</title> | ||
8 | |||
9 | <copyright> | ||
10 | <year>©RIGHT_YEAR;</year> | ||
11 | <holder>Linux Foundation</holder> | ||
12 | </copyright> | ||
13 | |||
14 | <legalnotice> | ||
15 | <para> | ||
16 | Permission is granted to copy, distribute and/or modify this document under | ||
17 | the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-sa/2.0/uk/">Creative Commons Attribution-Share Alike 2.0 UK: England & Wales</ulink> as published by Creative Commons. | ||
18 | </para> | ||
19 | <note> | ||
20 | For the latest version of this manual associated with this | ||
21 | Yocto Project release, see the | ||
22 | <ulink url='&YOCTO_DOCS_QS_URL;'>Yocto Project Quick Start</ulink> | ||
23 | from the Yocto Project website. | ||
24 | </note> | ||
25 | </legalnotice> | ||
26 | |||
27 | |||
28 | <abstract> | ||
29 | <imagedata fileref="figures/yocto-project-transp.png" | ||
30 | width="6in" depth="1in" | ||
31 | align="right" scale="25" /> | ||
32 | </abstract> | ||
33 | </articleinfo> | ||
34 | |||
35 | <section id='welcome'> | ||
36 | <title>Welcome!</title> | ||
37 | <para> | ||
38 | Welcome to the Yocto Project! | ||
39 | The Yocto Project is an open-source collaboration project focused on embedded Linux | ||
40 | developers. | ||
41 | Among other things, the Yocto Project uses a build system based on the Poky project | ||
42 | to construct complete Linux images. | ||
43 | The Poky project, in turn, draws from and contributes back to the OpenEmbedded project. | ||
44 | </para> | ||
45 | |||
46 | <para> | ||
47 | If you don't have a system that runs Linux and you want to give the Yocto Project a test run, | ||
48 | you might consider using the Yocto Project Build Appliance. | ||
49 | The Build Appliance allows you to build and boot a custom embedded Linux image with the Yocto | ||
50 | Project using a non-Linux development system. | ||
51 | See the <ulink url='http://www.yoctoproject.org/documentation/build-appliance'>Yocto | ||
52 | Project Build Appliance</ulink> for more information. | ||
53 | </para> | ||
54 | |||
55 | <para> | ||
56 | On the other hand, if you know all about open-source development, Linux development environments, | ||
57 | Git source repositories and the like and you just want some quick information that lets you try out | ||
58 | the Yocto Project on your Linux system, skip right to the | ||
59 | "<link linkend='super-user'>Super User</link>" section at the end of this quick start. | ||
60 | </para> | ||
61 | |||
62 | <para> | ||
63 | For the rest of you, this short document will give you some basic information about the environment and | ||
64 | let you experience it in its simplest form. | ||
65 | After reading this document, you will have a basic understanding of what the Yocto Project is | ||
66 | and how to use some of its core components. | ||
67 | This document steps you through a simple example showing you how to build a small image | ||
68 | and run it using the Quick EMUlator (QEMU emulator). | ||
69 | </para> | ||
70 | |||
71 | <para> | ||
72 | For more detailed information on the Yocto Project, you should check out these resources: | ||
73 | <itemizedlist> | ||
74 | <listitem><para><emphasis>Website:</emphasis> The <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink> | ||
75 | provides the latest builds, breaking news, full development documentation, and a rich Yocto | ||
76 | Project Development Community into which you can tap. | ||
77 | </para></listitem> | ||
78 | <listitem><para><emphasis>FAQs:</emphasis> Lists commonly asked Yocto Project questions and answers. | ||
79 | You can find two FAQs: <ulink url='&YOCTO_WIKI_URL;/wiki/FAQ'>Yocto Project FAQ</ulink> on | ||
80 | a wiki, and the | ||
81 | "<ulink url='&YOCTO_DOCS_REF_URL;#faq'>FAQ</ulink>" chapter in | ||
82 | the Yocto Project Reference Manual. | ||
83 | </para></listitem> | ||
84 | <listitem><para><emphasis>Developer Screencast:</emphasis> The | ||
85 | <ulink url='http://vimeo.com/36450321'>Getting Started with the Yocto Project - New | ||
86 | Developer Screencast Tutorial</ulink> provides a 30-minute video for the user | ||
87 | new to the Yocto Project but familiar with Linux build systems.</para></listitem> | ||
88 | </itemizedlist> | ||
89 | </para> | ||
90 | </section> | ||
91 | |||
92 | <section id='yp-intro'> | ||
93 | <title>Introducing the Yocto Project Development Environment</title> | ||
94 | <para> | ||
95 | The Yocto Project through the OpenEmbedded build system provides an open source development | ||
96 | environment targeting the ARM, MIPS, PowerPC and x86 architectures for a variety of | ||
97 | platforms including x86-64 and emulated ones. | ||
98 | You can use components from the Yocto Project to design, develop, build, debug, simulate, | ||
99 | and test the complete software stack using Linux, the X Window System, GNOME Mobile-based | ||
100 | application frameworks, and Qt frameworks. | ||
101 | </para> | ||
102 | |||
103 | <mediaobject> | ||
104 | <imageobject> | ||
105 | <imagedata fileref="figures/yocto-environment.png" | ||
106 | format="PNG" align='center' scalefit='1' width="100%"/> | ||
107 | </imageobject> | ||
108 | <caption> | ||
109 | <para>The Yocto Project Development Environment</para> | ||
110 | </caption> | ||
111 | </mediaobject> | ||
112 | |||
113 | <para> | ||
114 | Here are some highlights for the Yocto Project: | ||
115 | </para> | ||
116 | |||
117 | <itemizedlist> | ||
118 | <listitem> | ||
119 | <para>Provides a recent Linux kernel along with a set of system commands and libraries suitable for the embedded environment.</para> | ||
120 | </listitem> | ||
121 | <listitem> | ||
122 | <para>Makes available system components such as X11, GTK+, Qt, Clutter, and SDL | ||
123 | (among others) so you can create a rich user experience on devices | ||
124 | that have display hardware. | ||
125 | For devices that don't have a display or where you wish to use alternative UI | ||
126 | frameworks, these components need not be installed.</para> | ||
127 | </listitem> | ||
128 | <listitem> | ||
129 | <para>Creates a focused and stable core compatible with the OpenEmbedded | ||
130 | project with which you can easily and reliably build and develop.</para> | ||
131 | </listitem> | ||
132 | <listitem> | ||
133 | <para>Fully supports a wide range of hardware and device emulation through the QEMU | ||
134 | Emulator.</para> | ||
135 | </listitem> | ||
136 | </itemizedlist> | ||
137 | |||
138 | <para> | ||
139 | The Yocto Project can generate images for many kinds of devices. | ||
140 | However, the standard example machines target QEMU full-system emulation for x86, x86-64, ARM, MIPS, | ||
141 | and PPC-based architectures as well as specific hardware such as the | ||
142 | <trademark class='registered'>Intel</trademark> Desktop Board DH55TC. | ||
143 | Because an image developed with the Yocto Project can boot inside a QEMU emulator, the | ||
144 | development environment works nicely as a test platform for developing embedded software. | ||
145 | </para> | ||
146 | |||
147 | <para> | ||
148 | Another important Yocto Project feature is the Sato reference User Interface. | ||
149 | This optional GNOME mobile-based UI, which is intended for devices with | ||
150 | restricted screen sizes, sits neatly on top of a device using the | ||
151 | GNOME Mobile Stack and provides a well-defined user experience. | ||
152 | Implemented in its own layer, it makes it clear to developers how they can implement | ||
153 | their own user interface on top of a Linux image created with the Yocto Project. | ||
154 | </para> | ||
155 | </section> | ||
156 | |||
157 | <section id='yp-resources'> | ||
158 | <title>What You Need and How You Get It</title> | ||
159 | |||
160 | <para> | ||
161 | You need these things to develop in the Yocto Project environment: | ||
162 | </para> | ||
163 | |||
164 | <itemizedlist> | ||
165 | <listitem> | ||
166 | <para>A host system running a supported Linux distribution | ||
167 | (i.e. recent releases of Fedora, openSUSE, CentOS, Debian, | ||
168 | and Ubuntu). | ||
169 | If the host system supports multiple cores and threads, you can configure the | ||
170 | Yocto Project build system to decrease the time needed to build images | ||
171 | significantly. | ||
172 | </para> | ||
173 | </listitem> | ||
174 | <listitem> | ||
175 | <para>The right packages.</para> | ||
176 | </listitem> | ||
177 | <listitem> | ||
178 | <para>A release of the Yocto Project.</para> | ||
179 | </listitem> | ||
180 | </itemizedlist> | ||
181 | |||
182 | <section id='the-linux-distro'> | ||
183 | <title>The Linux Distribution</title> | ||
184 | |||
185 | <para> | ||
186 | The Yocto Project team is continually verifying more and more Linux | ||
187 | distributions with each release. | ||
188 | In general, if you have the current release minus one of the following | ||
189 | distributions you should have no problems. | ||
190 | <itemizedlist> | ||
191 | <listitem><para>Ubuntu</para></listitem> | ||
192 | <listitem><para>Fedora</para></listitem> | ||
193 | <listitem><para>openSUSE</para></listitem> | ||
194 | <listitem><para>CentOS</para></listitem> | ||
195 | <listitem><para>Debian</para></listitem> | ||
196 | </itemizedlist> | ||
197 | For a more detailed list of distributions that support the Yocto Project, | ||
198 | see the | ||
199 | "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" section | ||
200 | in the Yocto Project Reference Manual. | ||
201 | </para> | ||
202 | <para> | ||
203 | The OpenEmbedded build system should be able to run on any modern | ||
204 | distribution that has the following versions for Git, tar, and | ||
205 | Python. | ||
206 | <itemizedlist> | ||
207 | <listitem><para>Git 1.7.5 or greater</para></listitem> | ||
208 | <listitem><para>tar 1.24 or greater</para></listitem> | ||
209 | <listitem><para>Python 2.7.3 or greater excluding Python | ||
210 | 3.x, which is not supported.</para></listitem> | ||
211 | </itemizedlist> | ||
212 | Earlier releases of Python are known to not work and the system | ||
213 | does not support Python 3 at this time. | ||
214 | If your system does not meet any of these three listed | ||
215 | version requirements, you can | ||
216 | take steps to prepare the system so that you can still use the build | ||
217 | system. | ||
218 | See the | ||
219 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</ulink>" | ||
220 | section in the Yocto Project Reference Manual for information. | ||
221 | </para> | ||
222 | <para> | ||
223 | This document assumes you are running one of the previously noted | ||
224 | distributions on your Linux-based host systems. | ||
225 | </para> | ||
226 | <note> | ||
227 | <para> | ||
228 | If you attempt to use a distribution not in the above list, | ||
229 | you may or may not have success. | ||
230 | Yocto Project releases are tested against the stable Linux | ||
231 | distributions listed in the | ||
232 | "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" | ||
233 | section of the Yocto Project Reference Manual. | ||
234 | If you encounter problems, please go to | ||
235 | <ulink url='&YOCTO_BUGZILLA_URL;'>Yocto Project Bugzilla</ulink> | ||
236 | and submit a bug. | ||
237 | We are interested in hearing about your experience. | ||
238 | </para> | ||
239 | </note> | ||
240 | </section> | ||
241 | |||
242 | <section id='packages'> | ||
243 | <title>The Packages</title> | ||
244 | |||
245 | <para> | ||
246 | Packages and package installation vary depending on your development system | ||
247 | and on your intent. | ||
248 | For example, if you want to build an image that can run | ||
249 | on QEMU in graphical mode (a minimal, basic build | ||
250 | requirement), then the number of packages is different than if you want to | ||
251 | build an image on a headless system or build out the Yocto Project | ||
252 | documentation set. | ||
253 | Collectively, the number of required packages is large | ||
254 | if you want to be able to cover all cases. | ||
255 | <note>In general, you need to have root access and then install the | ||
256 | required packages. | ||
257 | Thus, the commands in the following section may or may not work | ||
258 | depending on whether or not your Linux distribution has | ||
259 | <filename>sudo</filename> installed.</note> | ||
260 | </para> | ||
261 | |||
262 | <para> | ||
263 | The next few sections list, by supported Linux Distributions, the required | ||
264 | packages needed to build an image that runs on QEMU in graphical mode | ||
265 | (e.g. essential plus graphics support). | ||
266 | </para> | ||
267 | |||
268 | <para> | ||
269 | For lists of required packages for other scenarios, see the | ||
270 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>" | ||
271 | section in the Yocto Project Reference Manual. | ||
272 | </para> | ||
273 | |||
274 | <section id='ubuntu'> | ||
275 | <title>Ubuntu and Debian</title> | ||
276 | |||
277 | <para> | ||
278 | The essential and graphical support packages you need for a | ||
279 | supported Ubuntu or Debian distribution are shown in the | ||
280 | following command: | ||
281 | <literallayout class='monospaced'> | ||
282 | $ sudo apt-get install &UBUNTU_HOST_PACKAGES_ESSENTIAL; libsdl1.2-dev xterm | ||
283 | </literallayout> | ||
284 | </para> | ||
285 | </section> | ||
286 | |||
287 | <section id='fedora'> | ||
288 | <title>Fedora</title> | ||
289 | |||
290 | <para> | ||
291 | The essential and graphical packages you need for a supported | ||
292 | Fedora distribution are shown in the following command: | ||
293 | <literallayout class='monospaced'> | ||
294 | $ sudo yum install &FEDORA_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm | ||
295 | </literallayout> | ||
296 | </para> | ||
297 | </section> | ||
298 | |||
299 | <section id='opensuse'> | ||
300 | <title>OpenSUSE</title> | ||
301 | |||
302 | <para> | ||
303 | The essential and graphical packages you need for a supported | ||
304 | OpenSUSE distribution are shown in the following command: | ||
305 | <literallayout class='monospaced'> | ||
306 | $ sudo zypper install &OPENSUSE_HOST_PACKAGES_ESSENTIAL; libSDL-devel xterm | ||
307 | </literallayout> | ||
308 | </para> | ||
309 | </section> | ||
310 | |||
311 | <section id='centos'> | ||
312 | <title>CentOS</title> | ||
313 | |||
314 | <para> | ||
315 | The essential and graphical packages you need for a supported | ||
316 | CentOS distribution are shown in the following command: | ||
317 | <literallayout class='monospaced'> | ||
318 | $ sudo yum install &CENTOS_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm | ||
319 | </literallayout> | ||
320 | <note>Depending on the CentOS version you are using, other requirements | ||
321 | and dependencies might exist. | ||
322 | For details, you should look at the CentOS sections on the | ||
323 | <ulink url='https://wiki.yoctoproject.org/wiki/Poky/GettingStarted/Dependencies'>Poky/GettingStarted/Dependencies</ulink> | ||
324 | wiki page.</note> | ||
325 | </para> | ||
326 | </section> | ||
327 | </section> | ||
328 | |||
329 | <section id='releases'> | ||
330 | <title>Yocto Project Release</title> | ||
331 | |||
332 | <para> | ||
333 | You can download the latest Yocto Project release by going to the | ||
334 | <ulink url="&YOCTO_HOME_URL;">Yocto Project website</ulink> | ||
335 | clicking "Downloads" in the navigation pane to the left to view all | ||
336 | available Yocto Project releases. | ||
337 | Current and archived releases are available for download to the | ||
338 | right. | ||
339 | Nightly and developmental builds are also maintained at | ||
340 | <ulink url="&YOCTO_AB_NIGHTLY_URL;"></ulink>. | ||
341 | However, for this document a released version of Yocto Project is used. | ||
342 | </para> | ||
343 | |||
344 | <para> | ||
345 | You can also get the Yocto Project files you need by setting up (cloning in Git terms) | ||
346 | a local copy of the <filename>poky</filename> Git repository on your host development | ||
347 | system. | ||
348 | Doing so allows you to contribute back to the Yocto Project project. | ||
349 | For information on how to get set up using this method, see the | ||
350 | "<ulink url='&YOCTO_DOCS_DEV_URL;#local-yp-release'>Yocto | ||
351 | Project Release</ulink>" item in the Yocto Project Development Manual. | ||
352 | </para> | ||
353 | </section> | ||
354 | </section> | ||
355 | |||
356 | <section id='test-run'> | ||
357 | <title>A Quick Test Run</title> | ||
358 | |||
359 | <para> | ||
360 | Now that you have your system requirements in order, you can give the Yocto Project a try. | ||
361 | This section presents some steps that let you do the following: | ||
362 | </para> | ||
363 | |||
364 | <itemizedlist> | ||
365 | <listitem> | ||
366 | <para>Build an image and run it in the QEMU emulator</para> | ||
367 | </listitem> | ||
368 | <listitem> | ||
369 | <para>Use a pre-built image and run it in the QEMU emulator</para> | ||
370 | </listitem> | ||
371 | </itemizedlist> | ||
372 | |||
373 | <section id='building-image'> | ||
374 | <title>Building an Image</title> | ||
375 | |||
376 | <para> | ||
377 | In the development environment you will need to build an image whenever you change hardware | ||
378 | support, add or change system libraries, or add or change services that have dependencies. | ||
379 | </para> | ||
380 | |||
381 | <mediaobject> | ||
382 | <imageobject> | ||
383 | <imagedata fileref="figures/building-an-image.png" format="PNG" align='center' scalefit='1'/> | ||
384 | </imageobject> | ||
385 | <caption> | ||
386 | <para>Building an Image</para> | ||
387 | </caption> | ||
388 | </mediaobject> | ||
389 | |||
390 | <para> | ||
391 | Use the following commands to build your image. | ||
392 | The OpenEmbedded build process creates an entire Linux distribution, including the toolchain, | ||
393 | from source. | ||
394 | </para> | ||
395 | |||
396 | <note><para> | ||
397 | The build process using Sato currently consumes about 50GB of disk space. | ||
398 | To allow for variations in the build process and for future package expansion, we | ||
399 | recommend having at least 100GB of free disk space. | ||
400 | </para></note> | ||
401 | |||
402 | <note><para> | ||
403 | By default, the build process searches for source code using a pre-determined order | ||
404 | through a set of locations. | ||
405 | If you encounter problems with the build process finding and downloading source code, see the | ||
406 | "<ulink url='&YOCTO_DOCS_REF_URL;#how-does-the-yocto-project-obtain-source-code-and-will-it-work-behind-my-firewall-or-proxy-server'>How does the OpenEmbedded build system obtain source code and will it work behind my | ||
407 | firewall or proxy server?</ulink>" in the Yocto Project Reference Manual. | ||
408 | </para></note> | ||
409 | |||
410 | <para> | ||
411 | <literallayout class='monospaced'> | ||
412 | $ wget &YOCTO_POKY_DL_URL; | ||
413 | $ tar xjf &YOCTO_POKY;.tar.bz2 | ||
414 | $ cd &YOCTO_POKY; | ||
415 | $ source &OE_INIT_FILE; | ||
416 | </literallayout> | ||
417 | </para> | ||
418 | |||
419 | <tip><para> | ||
420 | To help conserve disk space during builds, you can add the following statement | ||
421 | to your project's configuration file, which for this example | ||
422 | is <filename>&YOCTO_POKY;/build/conf/local.conf</filename>. | ||
423 | Adding this statement deletes the work directory used for building a package | ||
424 | once the package is built. | ||
425 | <literallayout class='monospaced'> | ||
426 | INHERIT += "rm_work" | ||
427 | </literallayout> | ||
428 | </para></tip> | ||
429 | |||
430 | <itemizedlist> | ||
431 | <listitem><para>In the previous example, the first command retrieves the Yocto Project | ||
432 | release tarball from the source repositories using the | ||
433 | <filename>wget</filename> command. | ||
434 | Alternatively, you can go to the | ||
435 | <ulink url='&YOCTO_HOME_URL;'>Yocto Project website's</ulink> | ||
436 | "Downloads" page to retrieve the tarball.</para></listitem> | ||
437 | <listitem><para>The second command extracts the files from the tarball and places | ||
438 | them into a directory named <filename>&YOCTO_POKY;</filename> in the current | ||
439 | directory.</para></listitem> | ||
440 | <listitem><para>The third and fourth commands change the working directory to the | ||
441 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink> | ||
442 | and run the Yocto Project | ||
443 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> | ||
444 | environment setup script. | ||
445 | Running this script defines OpenEmbedded build environment settings needed to | ||
446 | complete the build. | ||
447 | The script also creates the | ||
448 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>, | ||
449 | which is <filename>build</filename> in this case and is located in the | ||
450 | Source Directory. | ||
451 | After the script runs, your current working directory is set | ||
452 | to the Build Directory. | ||
453 | Later, when the build completes, the Build Directory contains all the files | ||
454 | created during the build. | ||
455 | <note> | ||
456 | For information on running a memory-resident BitBake, see | ||
457 | the | ||
458 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink> | ||
459 | setup script. | ||
460 | </note></para></listitem> | ||
461 | </itemizedlist> | ||
462 | <para> | ||
463 | Take some time to examine your <filename>local.conf</filename> file | ||
464 | in your project's configuration directory, which is found in the Build Directory. | ||
465 | The defaults in that file should work fine. | ||
466 | However, there are some variables of interest at which you might look. | ||
467 | </para> | ||
468 | |||
469 | <para> | ||
470 | By default, the target architecture for the build is <filename>qemux86</filename>, | ||
471 | which produces an image that can be used in the QEMU emulator and is targeted at an | ||
472 | <trademark class='registered'>Intel</trademark> 32-bit based architecture. | ||
473 | To change this default, edit the value of the | ||
474 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
475 | variable in the configuration file before launching the build. | ||
476 | </para> | ||
477 | |||
478 | <para> | ||
479 | Another couple of variables of interest are the | ||
480 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></ulink> and the | ||
481 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></ulink> variables. | ||
482 | By default, these variables are commented out. | ||
483 | However, if you have a multi-core CPU you might want to uncomment | ||
484 | the lines and set both variables equal to twice the number of your | ||
485 | host's processor cores. | ||
486 | Setting these variables can significantly shorten your build time. | ||
487 | </para> | ||
488 | |||
489 | <para> | ||
490 | Another consideration before you build is the package manager used when creating | ||
491 | the image. | ||
492 | By default, the OpenEmbedded build system uses the RPM package manager. | ||
493 | You can control this configuration by using the | ||
494 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></ulink></filename> variable. | ||
495 | For additional package manager selection information, see the | ||
496 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-package'>Packaging - <filename>package*.bbclass</filename></ulink>" | ||
497 | section in the Yocto Project Reference Manual. | ||
498 | </para> | ||
499 | |||
500 | <para> | ||
501 | Continue with the following command to build an OS image for the target, which is | ||
502 | <filename>core-image-sato</filename> in this example. | ||
503 | For information on the <filename>-k</filename> option use the | ||
504 | <filename>bitbake --help</filename> command or see the | ||
505 | "<ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>" section in | ||
506 | the Yocto Project Reference Manual. | ||
507 | <literallayout class='monospaced'> | ||
508 | $ bitbake -k core-image-sato | ||
509 | </literallayout> | ||
510 | <note><para> | ||
511 | BitBake requires Python 2.6 or 2.7. For more information on this requirement, | ||
512 | see the | ||
513 | <ulink url='&YOCTO_DOCS_REF_URL;#faq'>FAQ</ulink> in the Yocto Project Reference | ||
514 | Manual. | ||
515 | </para></note> | ||
516 | The final command runs the image: | ||
517 | <literallayout class='monospaced'> | ||
518 | $ runqemu qemux86 | ||
519 | </literallayout> | ||
520 | <note><para> | ||
521 | Depending on the number of processors and cores, the amount or RAM, the speed of your | ||
522 | Internet connection and other factors, the build process could take several hours the first | ||
523 | time you run it. | ||
524 | Subsequent builds run much faster since parts of the build are cached. | ||
525 | </para></note> | ||
526 | </para> | ||
527 | </section> | ||
528 | |||
529 | <section id='using-pre-built'> | ||
530 | <title>Using Pre-Built Binaries and QEMU</title> | ||
531 | |||
532 | <para> | ||
533 | If hardware, libraries and services are stable, you can get started by using a pre-built binary | ||
534 | of the filesystem image, kernel, and toolchain and run it using the QEMU emulator. | ||
535 | This scenario is useful for developing application software. | ||
536 | </para> | ||
537 | |||
538 | <mediaobject> | ||
539 | <imageobject> | ||
540 | <imagedata fileref="figures/using-a-pre-built-image.png" format="PNG" align='center' scalefit='1'/> | ||
541 | </imageobject> | ||
542 | <caption> | ||
543 | <para>Using a Pre-Built Image</para> | ||
544 | </caption> | ||
545 | </mediaobject> | ||
546 | |||
547 | <para> | ||
548 | For this scenario, you need to do several things: | ||
549 | </para> | ||
550 | |||
551 | <itemizedlist> | ||
552 | <listitem><para>Install the appropriate stand-alone toolchain tarball.</para></listitem> | ||
553 | <listitem><para>Download the pre-built image that will boot with QEMU. | ||
554 | You need to be sure to get the QEMU image that matches your target machine’s | ||
555 | architecture (e.g. x86, ARM, etc.).</para></listitem> | ||
556 | <listitem><para>Download the filesystem image for your target machine's architecture. | ||
557 | </para></listitem> | ||
558 | <listitem><para>Set up the environment to emulate the hardware and then start the QEMU emulator. | ||
559 | </para></listitem> | ||
560 | </itemizedlist> | ||
561 | |||
562 | <section id='installing-the-toolchain'> | ||
563 | <title>Installing the Toolchain</title> | ||
564 | |||
565 | <para> | ||
566 | You can download a tarball installer, which includes the | ||
567 | pre-built toolchain, the <filename>runqemu</filename> | ||
568 | script, and support files from the appropriate directory under | ||
569 | <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>. | ||
570 | Toolchains are available for 32-bit and 64-bit x86 development | ||
571 | systems from the <filename>i686</filename> and | ||
572 | <filename>x86_64</filename> directories, respectively. | ||
573 | The toolchains the Yocto Project provides are based off the | ||
574 | <filename>core-image-sato</filename> image and contain | ||
575 | libraries appropriate for developing against that image. | ||
576 | Each type of development system supports five or more target | ||
577 | architectures. | ||
578 | </para> | ||
579 | |||
580 | <para> | ||
581 | The names of the tarball installer scripts are such that a | ||
582 | string representing the host system appears first in the | ||
583 | filename and then is immediately followed by a string | ||
584 | that represents the target architecture. | ||
585 | </para> | ||
586 | |||
587 | <literallayout class='monospaced'> | ||
588 | poky-eglibc-<<emphasis>host_system</emphasis>>-<<emphasis>image_type</emphasis>>-<<emphasis>arch</emphasis>>-toolchain-<<emphasis>release_version</emphasis>>.sh | ||
589 | |||
590 | Where: | ||
591 | <<emphasis>host_system</emphasis>> is a string representing your development system: | ||
592 | |||
593 | i686 or x86_64. | ||
594 | |||
595 | <<emphasis>image_type</emphasis>> is a string representing the image you wish to | ||
596 | develop a Software Development Toolkit (SDK) for use against. | ||
597 | The Yocto Project builds toolchain installers using the | ||
598 | following BitBake command: | ||
599 | |||
600 | bitbake core-image-sato -c do_populatesdk core-image-sato | ||
601 | |||
602 | <<emphasis>arch</emphasis>> is a string representing the tuned target architecture: | ||
603 | |||
604 | i586, x86_64, powerpc, mips, armv7a or armv5te | ||
605 | |||
606 | <<emphasis>release_version</emphasis>> is a string representing the release number of the | ||
607 | Yocto Project: | ||
608 | |||
609 | &DISTRO;, &DISTRO;+snapshot | ||
610 | </literallayout> | ||
611 | |||
612 | <para> | ||
613 | For example, the following toolchain installer is for a 64-bit | ||
614 | development host system and a i586-tuned target architecture | ||
615 | based off the SDK for <filename>core-image-sato</filename>: | ||
616 | <literallayout class='monospaced'> | ||
617 | poky-eglibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh | ||
618 | </literallayout> | ||
619 | </para> | ||
620 | |||
621 | <para> | ||
622 | Toolchains are self-contained and by default are installed into | ||
623 | <filename>/opt/poky</filename>. | ||
624 | However, when you run the toolchain installer, you can choose an | ||
625 | installation directory. | ||
626 | </para> | ||
627 | |||
628 | <para> | ||
629 | The following command shows how to run the installer given a toolchain tarball | ||
630 | for a 64-bit x86 development host system and a 32-bit x86 target architecture. | ||
631 | You must change the permissions on the toolchain | ||
632 | installer script so that it is executable. | ||
633 | </para> | ||
634 | |||
635 | <para> | ||
636 | The example assumes the toolchain installer is located in <filename>~/Downloads/</filename>. | ||
637 | <note> | ||
638 | If you do not have write permissions for the directory into which you are installing | ||
639 | the toolchain, the toolchain installer notifies you and exits. | ||
640 | Be sure you have write permissions in the directory and run the installer again. | ||
641 | </note> | ||
642 | </para> | ||
643 | |||
644 | <para> | ||
645 | <literallayout class='monospaced'> | ||
646 | $ ~/Downloads/poky-eglibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh | ||
647 | </literallayout> | ||
648 | </para> | ||
649 | |||
650 | <para> | ||
651 | For more information on how to install tarballs, see the | ||
652 | "<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>" and | ||
653 | "<ulink url='&YOCTO_DOCS_ADT_URL;#using-the-toolchain-from-within-the-build-tree'>Using BitBake and the Build Directory</ulink>" sections in the Yocto Project Application Developer's Guide. | ||
654 | </para> | ||
655 | </section> | ||
656 | |||
657 | <section id='downloading-the-pre-built-linux-kernel'> | ||
658 | <title>Downloading the Pre-Built Linux Kernel</title> | ||
659 | |||
660 | <para> | ||
661 | You can download the pre-built Linux kernel suitable for running in the QEMU emulator from | ||
662 | <ulink url='&YOCTO_QEMU_DL_URL;'></ulink>. | ||
663 | Be sure to use the kernel that matches the architecture you want to simulate. | ||
664 | Download areas exist for the five supported machine architectures: | ||
665 | <filename>qemuarm</filename>, <filename>qemumips</filename>, <filename>qemuppc</filename>, | ||
666 | <filename>qemux86</filename>, and <filename>qemux86-64</filename>. | ||
667 | </para> | ||
668 | |||
669 | <para> | ||
670 | Most kernel files have one of the following forms: | ||
671 | <literallayout class='monospaced'> | ||
672 | *zImage-qemu<<emphasis>arch</emphasis>>.bin | ||
673 | vmlinux-qemu<<emphasis>arch</emphasis>>.bin | ||
674 | |||
675 | Where: | ||
676 | <<emphasis>arch</emphasis>> is a string representing the target architecture: | ||
677 | x86, x86-64, ppc, mips, or arm. | ||
678 | </literallayout> | ||
679 | </para> | ||
680 | |||
681 | <para> | ||
682 | You can learn more about downloading a Yocto Project kernel in the | ||
683 | "<ulink url='&YOCTO_DOCS_DEV_URL;#local-kernel-files'>Yocto Project Kernel</ulink>" | ||
684 | bulleted item in the Yocto Project Development Manual. | ||
685 | </para> | ||
686 | </section> | ||
687 | |||
688 | <section id='downloading-the-filesystem'> | ||
689 | <title>Downloading the Filesystem</title> | ||
690 | |||
691 | <para> | ||
692 | You can also download the filesystem image suitable for your target architecture from | ||
693 | <ulink url='&YOCTO_QEMU_DL_URL;'></ulink>. | ||
694 | Again, be sure to use the filesystem that matches the architecture you want | ||
695 | to simulate. | ||
696 | </para> | ||
697 | |||
698 | <para> | ||
699 | The filesystem image has two tarball forms: <filename>ext3</filename> and | ||
700 | <filename>tar</filename>. | ||
701 | You must use the <filename>ext3</filename> form when booting an image using the | ||
702 | QEMU emulator. | ||
703 | The <filename>tar</filename> form can be flattened out in your host development system | ||
704 | and used for build purposes with the Yocto Project. | ||
705 | <literallayout class='monospaced'> | ||
706 | core-image-<<emphasis>profile</emphasis>>-qemu<<emphasis>arch</emphasis>>.ext3 | ||
707 | core-image-<<emphasis>profile</emphasis>>-qemu<<emphasis>arch</emphasis>>.tar.bz2 | ||
708 | |||
709 | Where: | ||
710 | <<emphasis>profile</emphasis>> is the filesystem image's profile: | ||
711 | lsb, lsb-dev, lsb-sdk, lsb-qt3, minimal, minimal-dev, sato, | ||
712 | sato-dev, or sato-sdk. For information on these types of image | ||
713 | profiles, see the "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" chapter in the Yocto Project | ||
714 | Reference Manual. | ||
715 | |||
716 | <<emphasis>arch</emphasis>> is a string representing the target architecture: | ||
717 | x86, x86-64, ppc, mips, or arm. | ||
718 | </literallayout> | ||
719 | </para> | ||
720 | </section> | ||
721 | |||
722 | <section id='setting-up-the-environment-and-starting-the-qemu-emulator'> | ||
723 | <title>Setting Up the Environment and Starting the QEMU Emulator</title> | ||
724 | |||
725 | <para> | ||
726 | Before you start the QEMU emulator, you need to set up the emulation environment. | ||
727 | The following command form sets up the emulation environment. | ||
728 | <literallayout class='monospaced'> | ||
729 | $ source &YOCTO_ADTPATH_DIR;/environment-setup-<<emphasis>arch</emphasis>>-poky-linux-<<emphasis>if</emphasis>> | ||
730 | |||
731 | Where: | ||
732 | <<emphasis>arch</emphasis>> is a string representing the target architecture: | ||
733 | i586, x86_64, ppc603e, mips, or armv5te. | ||
734 | |||
735 | <<emphasis>if</emphasis>> is a string representing an embedded application binary interface. | ||
736 | Not all setup scripts include this string. | ||
737 | </literallayout> | ||
738 | </para> | ||
739 | |||
740 | <para> | ||
741 | Finally, this command form invokes the QEMU emulator | ||
742 | <literallayout class='monospaced'> | ||
743 | $ runqemu <<emphasis>qemuarch</emphasis>> <<emphasis>kernel-image</emphasis>> <<emphasis>filesystem-image</emphasis>> | ||
744 | |||
745 | Where: | ||
746 | <<emphasis>qemuarch</emphasis>> is a string representing the target architecture: qemux86, qemux86-64, | ||
747 | qemuppc, qemumips, or qemuarm. | ||
748 | |||
749 | <<emphasis>kernel-image</emphasis>> is the architecture-specific kernel image. | ||
750 | |||
751 | <<emphasis>filesystem-image</emphasis>> is the .ext3 filesystem image. | ||
752 | |||
753 | </literallayout> | ||
754 | </para> | ||
755 | |||
756 | <para> | ||
757 | Continuing with the example, the following two commands setup the emulation | ||
758 | environment and launch QEMU. | ||
759 | This example assumes the root filesystem (<filename>.ext3</filename> file) and | ||
760 | the pre-built kernel image file both reside in your home directory. | ||
761 | The kernel and filesystem are for a 32-bit target architecture. | ||
762 | <literallayout class='monospaced'> | ||
763 | $ cd $HOME | ||
764 | $ source &YOCTO_ADTPATH_DIR;/environment-setup-i586-poky-linux | ||
765 | $ runqemu qemux86 bzImage-qemux86.bin \ | ||
766 | core-image-sato-qemux86.ext3 | ||
767 | </literallayout> | ||
768 | </para> | ||
769 | |||
770 | <para> | ||
771 | The environment in which QEMU launches varies depending on the filesystem image and on the | ||
772 | target architecture. | ||
773 | For example, if you source the environment for the ARM target | ||
774 | architecture and then boot the minimal QEMU image, the emulator comes up in a new | ||
775 | shell in command-line mode. | ||
776 | However, if you boot the SDK image, QEMU comes up with a GUI. | ||
777 | <note>Booting the PPC image results in QEMU launching in the same shell in | ||
778 | command-line mode.</note> | ||
779 | </para> | ||
780 | </section> | ||
781 | </section> | ||
782 | </section> | ||
783 | |||
784 | <section id='super-user'> | ||
785 | <title>Super User | ||
786 | </title> | ||
787 | |||
788 | <para> | ||
789 | This section | ||
790 | <footnote> | ||
791 | <para> | ||
792 | Kudos and thanks to Robert P. J. Day of | ||
793 | <ulink url='http://www.crashcourse.ca'>CrashCourse</ulink> for providing the basis | ||
794 | for this "expert" section with information from one of his | ||
795 | <ulink url='http://www.crashcourse.ca/wiki/index.php/Yocto_Project_Quick_Start'>wiki</ulink> | ||
796 | pages. | ||
797 | </para> | ||
798 | </footnote> | ||
799 | gives you a minimal description of how to use the Yocto Project to build images | ||
800 | for a BeagleBoard xM starting from scratch. | ||
801 | The steps were performed on a 64-bit Ubuntu 10.04 system. | ||
802 | </para> | ||
803 | |||
804 | <section id='getting-yocto'> | ||
805 | <title>Getting the Yocto Project</title> | ||
806 | |||
807 | <para> | ||
808 | Set up your <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink> | ||
809 | one of two ways: | ||
810 | <itemizedlist> | ||
811 | <listitem><para><emphasis>Tarball:</emphasis> | ||
812 | Use if you want the latest stable release: | ||
813 | <literallayout class='monospaced'> | ||
814 | $ wget &YOCTO_RELEASE_DL_URL;/&YOCTO_POKY_TARBALL; | ||
815 | $ tar xvjf &YOCTO_POKY_TARBALL; | ||
816 | </literallayout></para></listitem> | ||
817 | <listitem><para><emphasis>Git Repository:</emphasis> | ||
818 | Use if you want to work with cutting edge development content: | ||
819 | <literallayout class='monospaced'> | ||
820 | $ git clone git://git.yoctoproject.org/poky | ||
821 | </literallayout></para></listitem> | ||
822 | </itemizedlist> | ||
823 | The remainder of the section assumes the Git repository method. | ||
824 | </para> | ||
825 | </section> | ||
826 | |||
827 | <section id='setting-up-your-host'> | ||
828 | <title>Setting Up Your Host</title> | ||
829 | |||
830 | <para> | ||
831 | You need some packages for everything to work. | ||
832 | Rather than duplicate them here, look at the "<link linkend='packages'>The Packages</link>" | ||
833 | section earlier in this quick start. | ||
834 | </para> | ||
835 | </section> | ||
836 | |||
837 | <section id='initializing-the-build-environment'> | ||
838 | <title>Initializing the Build Environment</title> | ||
839 | |||
840 | <para> | ||
841 | From the parent directory your | ||
842 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>, | ||
843 | initialize your environment and provide a meaningful | ||
844 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink> | ||
845 | name: | ||
846 | <literallayout class='monospaced'> | ||
847 | $ source poky/&OE_INIT_FILE; mybuilds | ||
848 | </literallayout> | ||
849 | At this point, the <filename>mybuilds</filename> directory has been created for you | ||
850 | and it is now your current working directory. | ||
851 | If you don't provide your own directory name it defaults to <filename>build</filename>, | ||
852 | which is inside the Source Directory. | ||
853 | </para> | ||
854 | </section> | ||
855 | |||
856 | <section id='configuring-the-local.conf-file'> | ||
857 | <title>Configuring the local.conf File</title> | ||
858 | |||
859 | <para> | ||
860 | Initializing the build environment creates a <filename>conf/local.conf</filename> configuration file | ||
861 | in the Build Directory. | ||
862 | You need to manually edit this file to specify the machine you are building and to optimize | ||
863 | your build time. | ||
864 | Here are the minimal changes to make: | ||
865 | <literallayout class='monospaced'> | ||
866 | BB_NUMBER_THREADS = "8" | ||
867 | PARALLEL_MAKE = "-j 8" | ||
868 | MACHINE ?= "beagleboard" | ||
869 | </literallayout> | ||
870 | Briefly, set <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></ulink> | ||
871 | and <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></ulink> to | ||
872 | twice your host processor's number of cores. | ||
873 | </para> | ||
874 | |||
875 | <para> | ||
876 | A good deal that goes into a Yocto Project build is simply | ||
877 | downloading all of the source tarballs. | ||
878 | Maybe you have been working with another build system | ||
879 | (OpenEmbedded or Angstrom) for which you have built up a sizable | ||
880 | directory of source tarballs. | ||
881 | Or, perhaps someone else has such a directory for which you have | ||
882 | read access. | ||
883 | If so, you can save time by adding statements to your | ||
884 | configuration file so that the build process checks local | ||
885 | directories first for existing tarballs before checking the | ||
886 | Internet. | ||
887 | Here is an efficient way to set it up in your | ||
888 | <filename>local.conf</filename> file: | ||
889 | <literallayout class='monospaced'> | ||
890 | SOURCE_MIRROR_URL ?= "file:///home/you/your-download-dir/" | ||
891 | INHERIT += "own-mirrors" | ||
892 | BB_GENERATE_MIRROR_TARBALLS = "1" | ||
893 | # BB_NO_NETWORK = "1" | ||
894 | </literallayout> | ||
895 | </para> | ||
896 | |||
897 | <para> | ||
898 | In the previous example, the | ||
899 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_GENERATE_MIRROR_TARBALLS'><filename>BB_GENERATE_MIRROR_TARBALLS</filename></ulink> | ||
900 | variable causes the OpenEmbedded build system to generate tarballs | ||
901 | of the Git repositories and store them in the | ||
902 | <ulink url='&YOCTO_DOCS_REF_URL;#var-DL_DIR'><filename>DL_DIR</filename></ulink> | ||
903 | directory. | ||
904 | Due to performance reasons, generating and storing these tarballs | ||
905 | is not the build system's default behavior. | ||
906 | </para> | ||
907 | |||
908 | <para> | ||
909 | You can also use the | ||
910 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PREMIRRORS'><filename>PREMIRRORS</filename></ulink> | ||
911 | variable. | ||
912 | For an example, see the variable's glossary entry in the | ||
913 | Yocto Project Reference Manual. | ||
914 | </para> | ||
915 | </section> | ||
916 | |||
917 | <section id='building-the-image'> | ||
918 | <title>Building the Image</title> | ||
919 | |||
920 | <para> | ||
921 | At this point, you need to select an image to build for the BeagleBoard xM. | ||
922 | If this is your first build using the Yocto Project, you should try the smallest and simplest | ||
923 | image: | ||
924 | <literallayout class='monospaced'> | ||
925 | $ bitbake core-image-minimal | ||
926 | </literallayout> | ||
927 | Now you just wait for the build to finish. | ||
928 | </para> | ||
929 | |||
930 | <para> | ||
931 | Here are some variations on the build process that could be helpful: | ||
932 | <itemizedlist> | ||
933 | <listitem><para>Fetch all the necessary sources without starting the build: | ||
934 | <literallayout class='monospaced'> | ||
935 | $ bitbake -c fetchall core-image-minimal | ||
936 | </literallayout> | ||
937 | This variation guarantees that you have all the sources for that BitBake target | ||
938 | should you disconnect from the net and want to do the build later offline. | ||
939 | </para></listitem> | ||
940 | <listitem><para>Specify to continue the build even if BitBake encounters an error. | ||
941 | By default, BitBake aborts the build when it encounters an error. | ||
942 | This command keeps a faulty build going: | ||
943 | <literallayout class='monospaced'> | ||
944 | $ bitbake -k core-image-minimal | ||
945 | </literallayout></para></listitem> | ||
946 | </itemizedlist> | ||
947 | </para> | ||
948 | |||
949 | <para> | ||
950 | Once you have your image, you can take steps to load and boot it on the target hardware. | ||
951 | </para> | ||
952 | </section> | ||
953 | </section> | ||
954 | |||
955 | </article> | ||
956 | <!-- | ||
957 | vim: expandtab tw=80 ts=4 | ||
958 | --> | ||