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