You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

970 lines
45 KiB

<!DOCTYPE chapter 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='intro'>
<articleinfo>
<title>Yocto Project Quick Start</title>
<copyright>
<year>&COPYRIGHT_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 &amp; Wales</ulink> as published by Creative Commons.
</para>
<note>
Due to production processes, there could be differences between the Yocto Project
documentation bundled in the release tarball and the
<ulink url='&YOCTO_DOCS_QS_URL;'>Yocto Project Quick Start</ulink> on
the <ulink url='&YOCTO_HOME_URL;'>Yocto Project</ulink> website.
For the latest version of this manual, see the manual on the 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 Poky project
to construct complete Linux images.
The Poky project, in turn, draws from and contributes back to the OpenEmbedded project.
</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='http://www.yoctoproject.org/documentation/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 for the user
new to the Yocto Project but familiar with Linux build systems.</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 don't 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 in the Yocto Project environment:
</para>
<itemizedlist>
<listitem>
<para>A host system running a supported Linux distribution
(i.e. recent releases of Fedora, openSUSE, CentOS, Debian,
and Ubuntu).
If the host system supports multiple cores and threads, you can configure the
Yocto Project build system to decrease the time needed to build images
significantly.
</para>
</listitem>
<listitem>
<para>The right packages.</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.5 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.
Refer to
<ulink url='&OE_HOME_URL;/index.php?title=OEandYourDistro'>OE and Your Distro</ulink> and
<ulink url='&OE_HOME_URL;/index.php?title=Required_software'>Required Software</ulink>
for information for information about dependencies and
requirements.
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>
</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>
You can download the latest Yocto Project release by going to the
<ulink url="&YOCTO_HOME_URL;">Yocto Project website</ulink>
clicking "Downloads" in the navigation pane to the left to view all
available Yocto Project releases.
Current and archived releases are available for download to the
right.
Nightly and developmental builds are also maintained at
<ulink url="&YOCTO_AB_NIGHTLY_URL;"></ulink>.
However, for this document a released version of Yocto Project is used.
</para>
<para>
You can also get the Yocto Project files you need by setting up (cloning in Git 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>
</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:
</para>
<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>
<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.
</para>
<note><para>
The build process using Sato currently consumes about 50GB of disk space.
To allow for variations in the build process and for future package expansion, we
recommend having at least 100GB of free disk space.
</para></note>
<note><para>
By default, the build process searches for source code using a pre-determined order
through a set of locations.
If you encounter problems with the build process finding and downloading source code, see the
"<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>" in the Yocto Project Reference Manual.
</para></note>
<para>
<literallayout class='monospaced'>
$ wget &YOCTO_POKY_DL_URL;
$ tar xjf &YOCTO_POKY;.tar.bz2
$ cd &YOCTO_POKY;
$ 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>&YOCTO_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 retrieves the Yocto Project
release tarball from the source repositories using the
<filename>wget</filename> command.
Alternatively, you can go to the
<ulink url='&YOCTO_HOME_URL;'>Yocto Project website's</ulink>
"Downloads" page to retrieve the tarball.</para></listitem>
<listitem><para>The second command extracts the files from the tarball and places
them into a directory named <filename>&YOCTO_POKY;</filename> in the current
directory.</para></listitem>
<listitem><para>The third and fourth commands change the working directory to the
<ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
and run 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
Source Directory.
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 BitBake, 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>
Another couple of variables of interest are the
<ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></ulink> and the
<ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></ulink> variables.
By default, these variables are commented out.
However, if you have a multi-core CPU you might want to uncomment
the lines and set both variables equal to twice the number of your
host's processor cores.
Setting these variables can significantly shorten your build time.
</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'>Packaging - <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 or see the
"<ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>" section in
the Yocto Project Reference Manual.
<literallayout class='monospaced'>
$ bitbake -k core-image-sato
</literallayout>
<note><para>
BitBake requires Python 2.6 or 2.7. For more information on this requirement,
see the
<ulink url='&YOCTO_DOCS_REF_URL;#faq'>FAQ</ulink> in the Yocto Project Reference
Manual.
</para></note>
The final command runs the image:
<literallayout class='monospaced'>
$ runqemu qemux86
</literallayout>
<note><para>
Depending on the number of processors and cores, the amount or 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>
</para>
</section>
<section id='using-pre-built'>
<title>Using Pre-Built Binaries and QEMU</title>
<para>