1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
<article id='yocto-project-qs-intro'>
<articleinfo>
<title>Yocto Project Quick Start</title>
<copyright>
<year>©RIGHT_YEAR;</year>
<holder>Linux Foundation</holder>
</copyright>
<legalnotice>
<para>
Permission is granted to copy, distribute and/or modify this document under
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.
</para>
<note>
For the latest version of this manual associated with this
Yocto Project release, see the
<ulink url='&YOCTO_DOCS_QS_URL;'>Yocto Project Quick Start</ulink>
from the Yocto Project website.
</note>
</legalnotice>
<abstract>
<imagedata fileref="figures/yocto-project-transp.png"
width="6in" depth="1in"
align="right" scale="25" />
</abstract>
</articleinfo>
<section id='welcome'>
<title>Welcome!</title>
<para>
Welcome to the Yocto Project!
The Yocto Project is an open-source collaboration project focused on
embedded Linux developers.
Among other things, the Yocto Project uses a build system based on the
OpenEmbedded (OE) project, which uses the
<ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink>
tool, to construct complete Linux images.
The BitBake and OE components are combined together to form
<ulink url='&YOCTO_DOCS_DEV_URL;#poky'>Poky</ulink>,
a reference build system.
</para>
<para>
If you don't have a system that runs Linux and you want to give the Yocto Project a test run,
you might consider using the Yocto Project Build Appliance.
The Build Appliance allows you to build and boot a custom embedded Linux image with the Yocto
Project using a non-Linux development system.
See the <ulink url='https://www.yoctoproject.org/tools-resources/projects/build-appliance'>Yocto
Project Build Appliance</ulink> for more information.
</para>
<para>
On the other hand, if you know all about open-source development, Linux development environments,
Git source repositories and the like and you just want some quick information that lets you try out
the Yocto Project on your Linux system, skip right to the
"<link linkend='super-user'>Super User</link>" section at the end of this quick start.
</para>
<para>
For the rest of you, this short document will give you some basic information about the environment and
let you experience it in its simplest form.
After reading this document, you will have a basic understanding of what the Yocto Project is
and how to use some of its core components.
This document steps you through a simple example showing you how to build a small image
and run it using the Quick EMUlator (QEMU emulator).
</para>
<para>
For more detailed information on the Yocto Project, you should check out these resources:
<itemizedlist>
<listitem><para><emphasis>Website:</emphasis> The <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>
provides the latest builds, breaking news, full development documentation, and a rich Yocto
Project Development Community into which you can tap.
</para></listitem>
<listitem><para><emphasis>FAQs:</emphasis> Lists commonly asked Yocto Project questions and answers.
You can find two FAQs: <ulink url='&YOCTO_WIKI_URL;/wiki/FAQ'>Yocto Project FAQ</ulink> on
a wiki, and the
"<ulink url='&YOCTO_DOCS_REF_URL;#faq'>FAQ</ulink>" chapter in
the Yocto Project Reference Manual.
</para></listitem>
<listitem><para><emphasis>Developer Screencast:</emphasis> The
<ulink url='http://vimeo.com/36450321'>Getting Started with the Yocto Project - New Developer Screencast Tutorial</ulink>
provides a 30-minute video created for users unfamiliar with
the Yocto Project but familiar with Linux build systems.
While this screencast is somewhat dated, the introductory
and fundamental concepts are useful for the beginner.
</para></listitem>
</itemizedlist>
</para>
</section>
<section id='yp-intro'>
<title>Introducing the Yocto Project Development Environment</title>
<para>
The Yocto Project through the OpenEmbedded build system provides an open source development
environment targeting the ARM, MIPS, PowerPC and x86 architectures for a variety of
platforms including x86-64 and emulated ones.
You can use components from the Yocto Project to design, develop, build, debug, simulate,
and test the complete software stack using Linux, the X Window System, GNOME Mobile-based
application frameworks, and Qt frameworks.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="figures/yocto-environment.png"
format="PNG" align='center' scalefit='1' width="100%"/>
</imageobject>
<caption>
<para>The Yocto Project Development Environment</para>
</caption>
</mediaobject>
<para>
Here are some highlights for the Yocto Project:
</para>
<itemizedlist>
<listitem>
<para>Provides a recent Linux kernel along with a set of system commands and libraries suitable for the embedded environment.</para>
</listitem>
<listitem>
<para>Makes available system components such as X11, GTK+, Qt, Clutter, and SDL
(among others) so you can create a rich user experience on devices
that have display hardware.
For devices that do not have a display or where you wish to use alternative UI
frameworks, these components need not be installed.</para>
</listitem>
<listitem>
<para>Creates a focused and stable core compatible with the OpenEmbedded
project with which you can easily and reliably build and develop.</para>
</listitem>
<listitem>
<para>Fully supports a wide range of hardware and device emulation through the QEMU
Emulator.</para>
</listitem>
</itemizedlist>
<para>
The Yocto Project can generate images for many kinds of devices.
However, the standard example machines target QEMU full-system emulation for x86, x86-64, ARM, MIPS,
and PPC-based architectures as well as specific hardware such as the
<trademark class='registered'>Intel</trademark> Desktop Board DH55TC.
Because an image developed with the Yocto Project can boot inside a QEMU emulator, the
development environment works nicely as a test platform for developing embedded software.
</para>
<para>
Another important Yocto Project feature is the Sato reference User Interface.
This optional GNOME mobile-based UI, which is intended for devices with
restricted screen sizes, sits neatly on top of a device using the
GNOME Mobile Stack and provides a well-defined user experience.
Implemented in its own layer, it makes it clear to developers how they can implement
their own user interface on top of a Linux image created with the Yocto Project.
</para>
</section>
<section id='yp-resources'>
<title>What You Need and How You Get It</title>
<para>
You need these things to develop projects in the Yocto Project
environment:
</para>
<itemizedlist>
<listitem><para>
A host system with a minimum of 50 Gbytes of free disk space that
is running a supported Linux distribution (i.e. recent releases
of Fedora, openSUSE, CentOS, Debian, or Ubuntu).
If the host system supports multiple cores and threads, you can
configure the Yocto Project build system to significantly
decrease the time needed to build images.
</para></listitem>
<listitem><para>
Appropriate packages installed on the system you are using for
builds.
</para></listitem>
<listitem><para>
A release of the Yocto Project.
</para></listitem>
</itemizedlist>
<section id='the-linux-distro'>
<title>The Linux Distribution</title>
<para>
The Yocto Project team is continually verifying more and more Linux
distributions with each release.
In general, if you have the current release minus one of the following
distributions you should have no problems.
<itemizedlist>
<listitem><para>Ubuntu</para></listitem>
<listitem><para>Fedora</para></listitem>
<listitem><para>openSUSE</para></listitem>
<listitem><para>CentOS</para></listitem>
<listitem><para>Debian</para></listitem>
</itemizedlist>
For a more detailed list of distributions that support the Yocto Project,
see the
"<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" section
in the Yocto Project Reference Manual.
</para>
<para>
The OpenEmbedded build system should be able to run on any modern
distribution that has the following versions for Git, tar, and
Python.
<itemizedlist>
<listitem><para>Git 1.7.8 or greater</para></listitem>
<listitem><para>tar 1.24 or greater</para></listitem>
<listitem><para>Python 2.7.3 or greater excluding Python
3.x, which is not supported.</para></listitem>
</itemizedlist>
Earlier releases of Python are known to not work and the
system does not support Python 3 at this time.
If your system does not meet any of these three listed
version requirements, you can
take steps to prepare the system so that you can still use the build
system.
See the
"<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</ulink>"
section in the Yocto Project Reference Manual for information.
</para>
<para>
This document assumes you are running one of the previously noted
distributions on your Linux-based host systems.
</para>
<note>
<para>
If you attempt to use a distribution not in the above list,
you may or may not have success.
Yocto Project releases are tested against the stable Linux
distributions listed in the
"<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>"
section of the Yocto Project Reference Manual.
If you encounter problems, please go to
<ulink url='&YOCTO_BUGZILLA_URL;'>Yocto Project Bugzilla</ulink>
and submit a bug.
We are interested in hearing about your experience.
</para>
</note>
</section>
<section id='packages'>
<title>The Packages</title>
<para>
Packages and package installation vary depending on your development system
and on your intent.
For example, if you want to build an image that can run
on QEMU in graphical mode (a minimal, basic build
requirement), then the number of packages is different than if you want to
build an image on a headless system or build out the Yocto Project
documentation set.
Collectively, the number of required packages is large
if you want to be able to cover all cases.
<note>In general, you need to have root access and then install the
required packages.
Thus, the commands in the following section may or may not work
depending on whether or not your Linux distribution has
<filename>sudo</filename> installed.</note>
</para>
<para>
The next few sections list, by supported Linux Distributions, the required
packages needed to build an image that runs on QEMU in graphical mode
(e.g. essential plus graphics support).
</para>
<para>
For lists of required packages for other scenarios, see the
"<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>"
section in the Yocto Project Reference Manual.
</para>
<section id='ubuntu'>
<title>Ubuntu and Debian</title>
<para>
The essential and graphical support packages you need for a
supported Ubuntu or Debian distribution are shown in the
following command:
<literallayout class='monospaced'>
$ sudo apt-get install &UBUNTU_HOST_PACKAGES_ESSENTIAL; libsdl1.2-dev xterm
</literallayout>
<note>
If your build system has the
<filename>oss4-dev</filename> package installed, you
might experience QEMU build failures due to the package
installing its own custom
<filename>/usr/include/linux/soundcard.h</filename> on
the Debian system.
If you run into this situation, either of the following
solutions exist:
<literallayout class='monospaced'>
$ sudo apt-get build-dep qemu
$ sudo apt-get remove oss4-dev
</literallayout>
</note>
</para>
</section>
<section id='fedora'>
<title>Fedora</title>
<para>
The essential and graphical packages you need for a supported
Fedora distribution are shown in the following command:
<literallayout class='monospaced'>
$ sudo yum install &FEDORA_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm
</literallayout>
</para>
</section>
<section id='opensuse'>
<title>OpenSUSE</title>
<para>
The essential and graphical packages you need for a supported
OpenSUSE distribution are shown in the following command:
<literallayout class='monospaced'>
$ sudo zypper install &OPENSUSE_HOST_PACKAGES_ESSENTIAL; libSDL-devel xterm
</literallayout>
</para>
</section>
<section id='centos'>
<title>CentOS</title>
<para>
The essential and graphical packages you need for a supported
CentOS distribution are shown in the following command:
<literallayout class='monospaced'>
$ sudo yum install &CENTOS_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm
</literallayout>
<note>Depending on the CentOS version you are using, other requirements
and dependencies might exist.
For details, you should look at the CentOS sections on the
<ulink url='https://wiki.yoctoproject.org/wiki/Poky/GettingStarted/Dependencies'>Poky/GettingStarted/Dependencies</ulink>
wiki page.</note>
</para>
</section>
</section>
<section id='releases'>
<title>Yocto Project Release</title>
<para>
It is recommended that you get the latest Yocto Project files
by setting up (cloning in
<ulink url='&YOCTO_DOCS_DEV_URL;#git'>Git</ulink> terms) a local
copy of the
<filename>poky</filename> Git repository on your host development
system.
Doing so allows you to contribute back to the Yocto Project project.
For information on how to get set up using this method, see the
"<ulink url='&YOCTO_DOCS_DEV_URL;#local-yp-release'>Yocto
Project Release</ulink>" item in the Yocto Project Development Manual.
</para>
<para>
You can also get the Yocto Project Files by downloading
Yocto Project releases from the
<ulink url="&YOCTO_HOME_URL;">Yocto Project website</ulink>.
From the website, you just click "Downloads" in the navigation pane
to the left to display all Yocto Project downloads.
Current and archived releases are available for download.
Nightly and developmental builds are also maintained at
<ulink url="&YOCTO_AB_NIGHTLY_URL;"></ulink>.
One final site you can visit for information on Yocto Project
releases is the
<ulink url='&YOCTO_WIKI_URL;/wiki/Releases'>Releases</ulink>
wiki.
However, for this document a released version of Yocto Project is used.
</para>
</section>
</section>
<section id='test-run'>
<title>A Quick Test Run</title>
<para>
Now that you have your system requirements in order, you can give
the Yocto Project a try.
This section presents some steps that let you do the following:
<itemizedlist>
<listitem><para>
Build an image and run it in the QEMU emulator.
</para></listitem>
<listitem><para>
Use a pre-built image and run it in the QEMU emulator.
</para></listitem>
</itemizedlist>
<note>
This section does not provide detail, but rather provides minimal,
working commands and examples designed to just get you started.
For more details, see the appropriate manuals in the
<ulink url='&YOCTO_HOME_URL;/documentation'>Yocto Project manual set</ulink>.
</note>
</para>
<section id='building-image'>
<title>Building an Image</title>
<para>
In the development environment you will need to build an image whenever you change hardware
support, add or change system libraries, or add or change services that have dependencies.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="figures/building-an-image.png" format="PNG" align='center' scalefit='1'/>
</imageobject>
<caption>
<para>Building an Image</para>
</caption>
</mediaobject>
<para>
Use the following commands to build your image.
The OpenEmbedded build process creates an entire Linux
distribution, including the toolchain, from source.
<note><title>Note about Network Proxies</title>
<para>
By default, the build process searches for source code
using a pre-determined order through a set of locations.
If you are working behind a firewall and your build system
is not set up for proxies, you could encounter problems
with the build process when fetching source code (e.g.
fetcher failures or Git failures).
</para>
<para>
If you do not know your proxy settings, consult your
local network infrastructure resources and get that
information.
A good starting point could also be to check your web
browser settings.
Finally, you can find more information on using the Yocto
Project behind a firewall in the Yocto Project Reference
Manual
<ulink url='&YOCTO_DOCS_REF_URL;#how-does-the-yocto-project-obtain-source-code-and-will-it-work-behind-my-firewall-or-proxy-server'>FAQ</ulink>
and on the
"<ulink url='https://wiki.yoctoproject.org/wiki/Working_Behind_a_Network_Proxy'>Working Behind a Network Proxy</ulink>"
wiki page.
</para>
</note>
</para>
<para>
<literallayout class='monospaced'>
$ git clone &YOCTO_GIT_URL;/git/poky
$ cd poky
$ git checkout -b &DISTRO_NAME; origin/&DISTRO_NAME;
$ source &OE_INIT_FILE;
</literallayout>
</para>
<tip>
<para>
To help conserve disk space during builds, you can add the
following statement to your project's configuration file,
which for this example is
<filename>poky/build/conf/local.conf</filename>.
Adding this statement deletes the work directory used for
building a package once the package is built.
<literallayout class='monospaced'>
INHERIT += "rm_work"
</literallayout>
</para>
</tip>
<itemizedlist>
<listitem><para>In the previous example, the first command uses
<ulink url='&YOCTO_DOCS_DEV_URL;#git'>Git</ulink> to create
a local repository named <filename>poky</filename> that is a
clone of the upstream Yocto Project
<filename>poky</filename> repository.</para></listitem>
<listitem><para>The third command checks out the current
Yocto Project release into a local branch whose name matches
the release (i.e. <filename>&DISTRO_NAME;</filename>).
The local branch tracks the upstream branch of the same name.
Creating your own branch based on the released branch ensures
you are using the latest files for that release.
</para></listitem>
<listitem><para>
The final command runs the Yocto Project
<ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>
environment setup script.
Running this script defines OpenEmbedded build environment
settings needed to complete the build.
The script also creates the
<ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>,
which is <filename>build</filename> in this case and is located
in the
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>.
After the script runs, your current working directory is set
to the Build Directory.
Later, when the build completes, the Build Directory contains
all the files created during the build.
<note>
For information on running a memory-resident
<ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>,
see the
<ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>
setup script.
</note></para></listitem>
</itemizedlist>
<para>
Take some time to examine your <filename>local.conf</filename> file
in your project's configuration directory, which is found in the Build Directory.
The defaults in that file should work fine.
However, there are some variables of interest at which you might look.
</para>
<para>
By default, the target architecture for the build is <filename>qemux86</filename>,
which produces an image that can be used in the QEMU emulator and is targeted at an
<trademark class='registered'>Intel</trademark> 32-bit based architecture.
To change this default, edit the value of the
<ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
variable in the configuration file before launching the build.
</para>
<para>
Three other variables of interest are the
<ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></ulink>,
<ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></ulink>,
and
<ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename></ulink>
variables.
By default, the OpenEmbedded build system sets these variables
based on the number of processor cores your build host uses.
Thus, you typically do not need to uncomment these variables in
your <filename>local.conf</filename> file to gain optimal build
times.
</para>
<para>
Another consideration before you build is the package manager used when creating
the image.
By default, the OpenEmbedded build system uses the RPM package manager.
You can control this configuration by using the
<filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></ulink></filename> variable.
For additional package manager selection information, see the
"<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-package'><filename>package*.bbclass</filename></ulink>"
section in the Yocto Project Reference Manual.
</para>
<para>
Continue with the following command to build an OS image for the
target, which is <filename>core-image-sato</filename> in this
example.
For information on the <filename>-k</filename> option use the
<filename>bitbake --help</filename> command, see the
"<ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>"
section in the Yocto Project Reference Manual, or see the
"<ulink url='&YOCTO_DOCS_BB_URL;#bitbake-user-manual-command'>BitBake Command</ulink>"
section in the BitBake User Manual.
For information on other targets, see the
"<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>"
chapter in the Yocto Project Reference Manual.
<literallayout class='monospaced'>
$ bitbake -k core-image-sato
</literallayout>
<note>
BitBake requires Python 2.7. For more information on
this requirement, see the
"<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-and-python-versions'>Required Git, tar, and Python</ulink>"
section in the Yocto Project Reference Manual.
</note>
The final command runs the image using the QEMU emulator:
<literallayout class='monospaced'>
$ runqemu qemux86
</literallayout>
<note>
<para>
Depending on the number of processors and cores, the amount
of RAM, the speed of your Internet connection and other
factors, the build process could take several hours the
first time you run it.
Subsequent builds run much faster since parts of the build
are cached.
</para>
</note>
If you want to learn more about running QEMU, see the
"<ulink url="&YOCTO_DOCS_DEV_URL;#dev-manual-qemu">Using the Quick EMUlator (QEMU)</ulink>"
chapter in the Yocto Project Development Manual.
</para>
<para>
For information on how to use a pre-built binary, continue reading
into the next section.
Otherwise, you might be interested in reading the early chapters
of the
<ulink url='&YOCTO_DOCS_DEV_URL;'>Yocto Project Development Manual</ulink>.
</para>
</section>
<section id='using-pre-built'>
<title>Using Pre-Built Binaries and QEMU</title>
<para>
If hardware, libraries and services are stable, you can get started by using a pre-built binary
of the filesystem image, kernel, and toolchain and run it using the QEMU emulator.
This scenario is useful for developing application software.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="figures/using-a-pre-built-image.png" format="PNG" align='center' scalefit='1'/>
</imageobject>
<caption>
<para>Using a Pre-Built Image</para>
</caption>
</mediaobject>
<para>
For this scenario, you need to do several things:
</para>
<itemizedlist>
<listitem><para>Install the appropriate stand-alone toolchain tarball.</para></listitem>
<listitem><para>Download the pre-built image that will boot with QEMU.
You need to be sure to get the QEMU image that matches your target machine’s
architecture (e.g. x86, ARM, etc.).</para></listitem>
<listitem><para>Download the filesystem image for your target machine's architecture.
</para></listitem>
<listitem><para>Set up the environment to emulate the hardware and then start the QEMU emulator.
</para></listitem>
</itemizedlist>
<section id='installing-the-toolchain'>
<title>Installing the Toolchain</title>
<para>
You can download a tarball installer, which includes the
pre-built toolchain, the <filename>runqemu</filename>
script, and support files from the appropriate directory under
<ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>.
Toolchains are available for 32-bit and 64-bit x86 development
systems from the <filename>i686</filename> and
<filename>x86_64</filename> directories, respectively.
The toolchains the Yocto Project provides are based off the
<filename>core-image-sato</filename> image and contain
libraries appropriate for developing against that image.
Each type of development system supports five or more target
architectures.
</para>
<para>
The names of the tarball installer scripts are such that a
string representing the host system appears first in the
filename and then is immediately followed by a string
representing the target architecture.
</para>
<literallayout class='monospaced'>
poky-glibc-<replaceable>host_system</replaceable>-<replaceable>image_type</replaceable>-<replaceable>arch</replaceable>-toolchain-<replaceable>release_version</replaceable>.sh
Where:
<replaceable>host_system</replaceable> is a string representing your development system:
i686 or x86_64.
<replaceable>image_type</replaceable> is a string representing the image you wish to
develop a Software Development Toolkit (SDK) for use against.
The Yocto Project builds toolchain installers using the
following BitBake command:
bitbake core-image-sato -c populate_sdk
<replaceable>arch</replaceable> is a string representing the tuned target architecture:
i586, x86_64, powerpc, mips, armv7a or armv5te
<replaceable>release_version</replaceable> is a string representing the release number of the
Yocto Project:
&DISTRO;, &DISTRO;+snapshot
</literallayout>
<para>
For example, the following toolchain installer is for a 64-bit
development host system and a i586-tuned target architecture
based off the SDK for <filename>core-image-sato</filename>:
<literallayout class='monospaced'>
poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh
</literallayout>
</para>
<para>
Toolchains are self-contained and by default are installed into
<filename>/opt/poky</filename>.
However, when you run the toolchain installer, you can choose an
installation directory.
</para>
<para>
The following command shows how to run the installer given a toolchain tarball
for a 64-bit x86 development host system and a 32-bit x86 target architecture.
You must change the permissions on the toolchain
installer script so that it is executable.
</para>
<para>
The example assumes the toolchain installer is located in <filename>~/Downloads/</filename>.
<note>
If you do not have write permissions for the directory into which you are installing
the toolchain, the toolchain installer notifies you and exits.
Be sure you have write permissions in the directory and run the installer again.
</note>
</para>
<para>
<literallayout class='monospaced'>
$ ~/Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh
</literallayout>
</para>
<para>
For more information on how to install tarballs, see the
"<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>" and
"<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.
</para>
</section>
<section id='downloading-the-pre-built-linux-kernel'>
<title>Downloading the Pre-Built Linux Kernel</title>
<para>
You can download the pre-built Linux kernel suitable for running in the QEMU emulator from
<ulink url='&YOCTO_QEMU_DL_URL;'></ulink>.
Be sure to use the kernel that matches the architecture you want to simulate.
Download areas exist for the five supported machine architectures:
<filename>qemuarm</filename>, <filename>qemumips</filename>, <filename>qemuppc</filename>,
<filename>qemux86</filename>, and <filename>qemux86-64</filename>.
</para>
<para>
Most kernel files have one of the following forms:
<literallayout class='monospaced'>
*zImage-qemu<replaceable>arch</replaceable>.bin
vmlinux-qemu<replaceable>arch</replaceable>.bin
Where:
<replaceable>arch</replaceable> is a string representing the target architecture:
x86, x86-64, ppc, mips, or arm.
</literallayout>
</para>
<para>
You can learn more about downloading a Yocto Project kernel in the
"<ulink url='&YOCTO_DOCS_DEV_URL;#local-kernel-files'>Yocto Project Kernel</ulink>"
bulleted item in the Yocto Project Development Manual.
</para>
</section>
<section id='downloading-the-filesystem'>
<title>Downloading the Filesystem</title>
<para>
You can also download the filesystem image suitable for your target architecture from
<ulink url='&YOCTO_QEMU_DL_URL;'></ulink>.
Again, be sure to use the filesystem that matches the architecture you want
to simulate.
</para>
<para>
The filesystem image has two tarball forms: <filename>ext3</filename> and
<filename>tar</filename>.
You must use the <filename>ext3</filename> form when booting an image using the
QEMU emulator.
The <filename>tar</filename> form can be flattened out in your host development system
and used for build purposes with the Yocto Project.
<literallayout class='monospaced'>
core-image-<replaceable>profile</replaceable>-qemu<replaceable>arch</replaceable>.ext3
core-image-<replaceable>profile</replaceable>-qemu<replaceable>arch</replaceable>.tar.bz2
Where:
<replaceable>profile</replaceable> is the filesystem image's profile:
lsb, lsb-dev, lsb-sdk, lsb-qt3, minimal, minimal-dev, sato,
sato-dev, or sato-sdk. For information on these types of image
profiles, see the "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>"
chapter in the Yocto Project Reference Manual.
<replaceable>arch</replaceable> is a string representing the target architecture:
x86, x86-64, ppc, mips, or arm.
</literallayout>
</para>
</section>
<section id='setting-up-the-environment-and-starting-the-qemu-emulator'>
<title>Setting Up the Environment and Starting the QEMU Emulator</title>
<para>
Before you start the QEMU emulator, you need to set up the emulation environment.
The following command form sets up the emulation environment.
<literallayout class='monospaced'>
$ source &YOCTO_ADTPATH_DIR;/environment-setup-<replaceable>arch</replaceable>-poky-linux-<replaceable>if</replaceable>
Where:
<replaceable>arch</replaceable> is a string representing the target architecture:
i586, x86_64, ppc603e, mips, or armv5te.
<replaceable>if</replaceable> is a string representing an embedded application binary interface.
Not all setup scripts include this string.
</literallayout>
</para>
<para>
Finally, this command form invokes the QEMU emulator
<literallayout class='monospaced'>
$ runqemu <replaceable>qemuarch</replaceable> <replaceable>kernel-image</replaceable> <replaceable>filesystem-image</replaceable>
Where:
<replaceable>qemuarch</replaceable> is a string representing the target architecture: qemux86, qemux86-64,
qemuppc, qemumips, or qemuarm.
<replaceable>kernel-image</replaceable> is the architecture-specific kernel image.
<replaceable>filesystem-image</replaceable> is the .ext3 filesystem image.
</literallayout>
</para>
<para>
Continuing with the example, the following two commands setup the emulation
environment and launch QEMU.
This example assumes the root filesystem (<filename>.ext3</filename> file) and
the pre-built kernel image file both reside in your home directory.
The kernel and filesystem are for a 32-bit target architecture.
<literallayout class='monospaced'>
$ cd $HOME
$ source &YOCTO_ADTPATH_DIR;/environment-setup-i586-poky-linux
$ runqemu qemux86 bzImage-qemux86.bin \
core-image-sato-qemux86.ext3
</literallayout>
</para>
<para>
The environment in which QEMU launches varies depending on the filesystem image and on the
target architecture.
For example, if you source the environment for the ARM target
architecture and then boot the minimal QEMU image, the emulator comes up in a new
shell in command-line mode.
However, if you boot the SDK image, QEMU comes up with a GUI.
<note>Booting the PPC image results in QEMU launching in the same shell in
command-line mode.</note>
</para>
</section>
</section>
<para>
For more detailed information on using the Yocto Project for
image and application develop, the best place to continue reading is
in the
<ulink url='&YOCTO_DOCS_DEV_URL;'>Yocto Project Development Manual</ulink>.
</para>
</section>
<section id='super-user'>
<title>Super User
</title>
<para>
This section provides minimal instruction for using the Yocto Project
to build an image for Beaglebone hardware and for building and
booting an image for the third-party
<ulink url='http://www.minnowboard.org/meet-minnowboard-max/'>MinnowBoard MAX</ulink>.
<note>
The steps used in this section were performed on a 64-bit
Ubuntu 14.10 system that has four cores.
</note>
</para>
<section id='building-beaglebone-from-scratch'>
<title>Building Beaglebone from Scratch</title>
<para>
This section
<footnote>
<para>
Kudos and thanks to Robert P. J. Day of
<ulink url='http://www.crashcourse.ca'>CrashCourse</ulink>
for providing the basis for this "expert" section with
information from one of his
<ulink url='http://www.crashcourse.ca/wiki/index.php/Yocto_Project_Quick_Start'>wiki</ulink>
pages.
</para>
</footnote>
gives you a minimal description of how to use the Yocto Project to
build images for Beaglebone hardware starting from scratch.
</para>
<section id='getting-yocto'>
<title>Getting the Yocto Project</title>
<para>
Set up your
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
by using Git to clone the <filename>poky</filename>
repository and then check out the release branch:
<literallayout class='monospaced'>
$ cd ~
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git checkout -b &DISTRO_NAME; origin/&DISTRO_NAME;
</literallayout>
</para>
</section>
<section id='setting-up-your-host'>
<title>Setting Up Your Host</title>
<para>
You need some packages for everything to work.
Rather than duplicate them here, look at the
"<link linkend='packages'>The Packages</link>"
section earlier in this quick start.
</para>
</section>
<section id='initializing-the-build-environment'>
<title>Initializing the Build Environment</title>
<para>
From the root directory of your
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>,
initialize your environment and provide a meaningful
<ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
name:
<literallayout class='monospaced'>
$ source &OE_INIT_FILE; mybuilds
</literallayout>
At this point, the <filename>mybuilds</filename> directory has
been created for you and it is now your current working directory.
If you do not provide your own directory name,
it defaults to <filename>build</filename>,
which is inside the Source Directory.
</para>
</section>
<section id='configuring-the-local.conf-file'>
<title>Configuring the local.conf File</title>
<para>
Initializing the build environment creates a
<filename>conf/local.conf</filename> configuration file
in the Build Directory.
You need to manually edit this file to specify the machine you
are building:
<literallayout class='monospaced'>
MACHINE ?= "beaglebone"
</literallayout>
</para>
<para>
A good deal that goes into a Yocto Project build is simply
downloading all of the source tarballs.
Steps exist that can help you be more efficient with gathering
source files.
For example, you can set up local mirrors that hold your
source tarballs or you can pre-fetch all your source without
initiating a build until later.
For more information, see the
"<ulink url='&YOCTO_DOCS_DEV_URL;#working-with-source-files'>Working with Source Files</ulink>"
section in the Yocto Project Development Manual.
</para>
</section>
<section id='building-the-image'>
<title>Building the Image</title>
<para>
At this point, you need to select an image to build for the
Beaglebone hardware.
If this is your first build using the Yocto Project, you should
try the smallest and simplest image:
<literallayout class='monospaced'>
$ bitbake core-image-minimal
</literallayout>
Now you just wait for the build to finish.
</para>
<para>
You might encounter various warning messages during the
build.
For example, if a source file fetch initially fails,
the OpenEmbedded build system notes that and attempts to
find the files using mirrors.
Another example could be values requested for but not
found in the final kernel <filename>.config</filename>
file.
For information on configuration warnings, see the
"<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#generating-configuration-files'>Generating Configuration Files</ulink>"
section in the Yocto Project Linux Kernel Development Manual.
</para>
<para>
By default, BitBake aborts when it encounters an error during
the build.
If you want to make sure the build continues even when BitBake
encounters an error, use this variation:
<literallayout class='monospaced'>
$ bitbake -k core-image-minimal
</literallayout>
</para>
<para>
Once you have your image, you can take steps to load and boot
it on the target hardware.
</para>
<para>
You can learn about BitBake in general by reading the
<ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
</para>
</section>
</section>
<section id='building-and-booting-minnowboard-max'>
<title>Building and Booting MinnowBoard MAX</title>
<para>
As of the Yocto Project 1.6 release, the MinnowBoard MAX is
supported by the Yocto Project and the
<filename>meta-intel</filename>
<filename>intel-corei7-64</filename> and
<filename>intel-core2-32</filename> Board Support Packages (BSPs).
<note>
The MinnowBoard MAX ships with 64-bit firmware.
If you want to use the board in 32-bit mode, you must
download the
<ulink url='http://firmware.intel.com/projects/minnowboard-max'>32-bit firmware</ulink>.
</note>
</para>
<section id='mm-getting-yocto-and-meta-intel'>
<title>Getting the Yocto Project and <filename>meta-intel</filename></title>
<para>
Set up your
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
and the <filename>meta-intel</filename> layer
by using Git to clone the <filename>poky</filename>
and <filename>meta-intel</filename> repositories.
These commands use the "&DISTRO_NAME;" branch:
<literallayout class='monospaced'>
$ cd ~
$ mkdir source
$ cd source
$ git clone -b &DISTRO_NAME; git://git.yoctoproject.org/poky
$ cd poky
$ git clone -b &DISTRO_NAME; git://git.yoctoproject.org/meta-intel
</literallayout>
</para>
</section>
<section id='mm-setting-up-your-host'>
<title>Setting Up Your Host</title>
<para>
You need some packages for everything to work.
Rather than duplicate them here, look at the
"<link linkend='packages'>The Packages</link>"
section earlier in this quick start.
</para>
</section>
<section id='mm-initializing-the-build-environment'>
<title>Initializing the Build Environment</title>
<para>
From the root directory of your
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>,
initialize your environment by running the build environment
initialization script:
<literallayout class='monospaced'>
$ source &OE_INIT_FILE;
</literallayout>
At this point, the <filename>build</filename> directory has
been created for you and it is now your current working
directory.
</para>
</section>
<section id='mm-configure-the-build'>
<title>Configure the Build</title>
<para>
To configure the build, you edit the
<filename>bblayers.conf</filename> and
<filename>local.conf</filename> files, both of which are
located in the <filename>build/conf</filename> directory.
</para>
<para>
Here is a quick way to make the edits.
The first command adds the <filename>meta-intel</filename>
branch, which contains the <filename>intel-core*</filename>
BSPs to the build.
The second command selects the BSP by setting the
<ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
variable.
<literallayout class='monospaced'>
$ echo 'BBLAYERS += "~/source/poky/meta-intel"' >> conf/bblayers.conf
$ echo 'MACHINE = "intel-corei7-64"' >> conf/local.conf
</literallayout>
<note><title>Notes</title>
<para>
If you want a 64-bit build, use the following:
<literallayout class='monospaced'>
$ echo 'MACHINE = "intel-corei7-64"' >> conf/local.conf
</literallayout>
</para>
<para>
If you want 32-bit images, use the following:
<literallayout class='monospaced'>
$ echo 'MACHINE = "intel-core2-32"' >> conf/local.conf
</literallayout>
</para>
</note>
</para>
</section>
<section id='mm-build-the-image'>
<title>Build the Image</title>
<para>
Use this command to build the minimal image for
MinnowBoard MAX:
<literallayout class='monospaced'>
$ bitbake core-image-minimal
</literallayout>
Once the build completes, the resulting basic console image
is located in the Build Directory here:
<literallayout class='monospaced'>
tmp/deploy/images/intel-corei7-64/core-image-minimal-intel-corei7-64.hddimg
</literallayout>
</para>
</section>
<section id='mm-write-the-image'>
<title>Write the Image</title>
<para>
You can write the image to a USB key, SATA drive, or SD card
by using the <filename>mkefidisk.sh</filename> script,
which is included in the <filename>poky</filename>
repository at <filename>scripts/contrib/mkefidisk.sh</filename>:
<literallayout class='monospaced'>
$ sudo $HOME/source/poky/scripts/contrib/mkefidisk.sh <replaceable>HOST_DEVICE</replaceable> \
tmp/deploy/images/intel-corei7-64/core-image-minimal-intel-corei7-64.hddimg <replaceable>TARGET_DEVICE</replaceable>
</literallayout>
In the previous command, <replaceable>HOST_DEVICE</replaceable>
is the device node on the build system (e.g.
<filename>/dev/sdc</filename> or
<filename>/dev/mmcblk0</filename>).
<replaceable>TARGET_DEVICE</replaceable> is the name of the
device as the MinnowBoard MAX sees it (e.g.
<filename>/dev/sda</filename> or
<filename>/dev/mmcblk0</filename>).
</para>
</section>
<section id='mm-boot-the-image'>
<title>Boot the Image</title>
<para>
With the boot device provisioned, you can insert the media into
the MinnowBoard MAX and boot the hardware.
The board should automatically detect the media and boot to
the bootloader and subsequently the operating system.
</para>
<para>
If the board does not boot automatically, you can boot it
manually from the EFI shell as follows:
<literallayout class='monospaced'>
Shell> connect -r
Shell> map -r
Shell> fs0:
Shell> bootx64
</literallayout>
<note>
For a 32-bit image use the following:
<literallayout class='monospaced'>
Shell> bootia32
</literallayout>
</note>
</para>
</section>
<section id='mm-next-steps'>
<title>Next Steps</title>
<para>
Now that you can build a basic image, you could experiment
by building some other example images:
<literallayout class='monospaced'>
$ bitbake core-image-sato
$ bitbake core-image-sato-sdk
</literallayout>
Another possibility is to experiment creating your own image
recipes that add packages to suit your needs.
For information on how to create recipes, see the
"<ulink url='&YOCTO_DOCS_DEV_URL;#new-recipe-writing-a-new-recipe'>Writing a New Recipe</ulink>"
section in the Yocto Project Development Manual.
</para>
</section>
</section>
</section>
</article>
<!--
vim: expandtab tw=80 ts=4
-->
|