<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article id='intro'>
   <imagedata fileref="figures/yocto-project-transp.png" width="6in" depth="1in" align="right" scale="25" />

<section id='fake-title'>
    <title>Yocto Project Quick Start</title>
    <para>Copyright &copy; 2010-2011 Linux Foundation</para>
</section>

<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.
        Amongst other things, the Yocto Project uses the Poky build system to 
        construct complete Linux images.
    </para>
    <para>
        This short document will give you some basic information about the environment as well 
        as 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 QEMU emulator.
    </para>
    <para>
        For complete information on the Yocto Project, you should check out the 
        <ulink url='http://www.yoctoproject.org'>Yocto Project Website</ulink>.
        You can find the latest builds, breaking news, full development documentation, and a 
        rich Yocto Project Development Community into which you can tap.
    </para>
    <para>
        Finally, you might find the Frequently Asked Questions (FAQ) for the Yocto Project
        at <ulink url='https://wiki.yoctoproject.org/wiki/FAQ'>Yocto Project FAQ</ulink> and 
        the FAQ appendix located in the 
        <ulink url='http://www.yoctoproject.org/docs/poky-ref-manual/poky-ref-manual.html'>
        Yocto Project Reference Manual</ulink> helpful.
    </para>
    <note>
        Due to production processes, there could be differences between the Yocto Project
        documentation bundled in the release tarball and the 
        <ulink url='http://www.yoctoproject.org/docs/1.1/yocto-project-qs/yocto-project-qs.html'>
        Yocto Project Quick Start</ulink> on
        the <ulink url='http://www.yoctoproject.org'>Yocto Project</ulink> website.
        For the latest version of this manual, see the manual on the website.
    </note>
</section>

<section id='yp-intro'>
    <title>Introducing the Yocto Project Development Environment</title>
    <para>
        The Yocto Project through the Poky 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>

    <para></para>
    <para></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>
        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, Matchbox, GTK+, Pimlico, Clutter,
            GuPNP and Qt (among others) so you can create a richer user interface experience on 
            devices that use displays or have a GUI.
            For devices that don't have a GUI or display you simply would not employ these 
            components.</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, ARM, MIPS,
        and PPC-based architectures as well as specific hardware such as the Intel 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 UIs on top of Yocto Linux.
    </para>
</section>

<section id='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, Debian, and Ubuntu).
            <note>
                For notes about using the Yocto Project on development systems that use 
                older Linux distributions see 
                <ulink url='https://wiki.yoctoproject.org/wiki/BuildingOnRHEL4'></ulink>
            </note></para>
        </listitem>
        <listitem>
            <para>The right packages.</para>
        </listitem>
        <listitem>
            <para>A release of Yocto Project.</para>
        </listitem>
    </itemizedlist>

    <section id='the-linux-distro'>
        <title>The Linux Distribution</title>

        <para>
            The Yocto Project has been tested and is known to work on the current releases minus one
            of the following distributions. 
            Follow this <ulink url='https://wiki.pokylinux.org/wiki/Distro_Test'>link </ulink> for more 
            information on distribution testing.
            <itemizedlist>
                <listitem><para>Ubuntu</para></listitem>
                <listitem><para>Fedora</para></listitem>
                <listitem><para>openSUSE</para></listitem>
            </itemizedlist>
            </para>
        <para>
            The build system should be able to run on any modern distribution with Python 2.6 or 2.7.
            Earlier releases of Python are known to not work and the system does not support Python 3 at this time.
            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 - you 
            are venturing into untested territory.
            Refer to  
            <ulink url='http://openembedded.net/index.php?title=OEandYourDistro&amp;action=historysubmit&amp;diff=4309&amp;okdid=4225'>OE and Your Distro</ulink> and 
            <ulink url='http://openembedded.net/index.php?title=Required_software&amp;action=historysubmit&amp;diff=4311&amp;oldid=4251'>Required Software</ulink> 
            for information for other distributions used with the Open Embedded project, which might be
            a starting point for exploration.
            If you go down this path, you should expect problems.
            When you do, please go to <ulink url='http://bugzilla.yoctoproject.org'>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.  
            In general, you need to have root access and then install the required packages.
        </para>

        <note><para>
            If you are using a Fedora version prior to version 15 you will need to take some 
            extra steps to enable <filename>sudo</filename>.
            See <ulink url='https://fedoraproject.org/wiki/Configuring_Sudo'></ulink> for details.
        </para></note>

        <para>
            The packages you need for a Debian-based host are shown in the following command:
        </para>

            <literallayout class='monospaced'>
     $ sudo apt-get install sed wget cvs subversion git-core coreutils \
     unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk \
     python-pysqlite2 diffstat help2man make gcc build-essential \
     g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev \
     mercurial autoconf automake groff libtool
            </literallayout>

        <para>
            The packages you need for an RPM-based host like Fedora and openSUSE, 
            respectively, are as follows:
        </para>

            <literallayout class='monospaced'>
     $ sudo yum groupinstall "development tools"
     $ sudo yum install python m4 make wget curl ftp hg tar bzip2 gzip \
     unzip python-psyco perl texinfo texi2html diffstat openjade \
     docbook-style-dsssl sed docbook-style-xsl docbook-dtds \
     docbook-utils sed bc glibc-devel ccache pcre pcre-devel quilt \
     groff linuxdoc-tools patch linuxdoc-tools cmake help2man \
     perl-ExtUtils-MakeMaker tcl-devel gettext chrpath ncurses apr \
     SDL-devel mesa-libGL-devel mesa-libGLU-devel gnome-doc-utils \
     autoconf automake libtool
            </literallayout>

            <literallayout class='monospaced'>
     $ sudo zypper install python gcc gcc-c++ libtool \
     subversion git chrpath automake \
     help2man diffstat texinfo mercurial wget
            </literallayout>
 
    </section>

    <section id='releases'>
        <title>Yocto Project Release</title>
            
        <para>
            You can download the latest release images for the Yocto Project on the 
            <ulink url="http://yoctoproject.org/download">Yocto Project Download page</ulink>.
            Just go to the page and click the "Yocto Downloads" link found in the "Download"
            navigation pane to the right to view all available Yocto Project releases. 
            Then, click the "Yocto Release" link for the release you want from the list to 
            begin the download. 
            Nightly and developmental builds are also maintained at
            <ulink url="http://autobuilder.yoctoproject.org/nightly/"></ulink>.  
            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 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 emulator</para>
        </listitem>
        <listitem>
            <para>Or, use a pre-built image and run it in the 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 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 Yocto Project searches for source code using a pre-determined order
             through a set of locations.
             If you encounter problems with the Yocto Project finding and downloading source code, see
             the FAQ entry "How does Poky obtain source code and will it work behind my
             firewall or proxy server?" in the 
             <ulink url='http://www.yoctoproject.org/docs/poky-ref-manual/poky-ref-manual.html'>
             Yocto Project Reference Manual</ulink>.
         </para></note>

         <para>
             <literallayout class='monospaced'>
     $ wget http://www.yoctoproject.org/downloads/poky/poky-bernard-5.0.1.tar.bz2
     $ tar xjf poky-bernard-5.0.1.tar.bz2
     $ source poky-bernard-5.0.1/poky-init-build-env poky-5.0.1-build
             </literallayout>
         </para>

         <tip><para>
             To help conserve disk space during builds you can add the following statement
             to your <filename>local.conf</filename> file.  
             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>The first two commands extract the Yocto Project files from the 
             release tarball and place them into a subdirectory of your current directory.</para></listitem>
             <listitem><para>The <command>source</command> command creates the 
             <filename>poky-5.0.1-build</filename> directory and executes the <command>cd</command>
             command to make <filename>poky-5.0.1-build</filename> the working directory.
             The resulting build directory contains all the files created during the build.   
             By default the target architecture is qemux86.
             To change this default, edit the value of the MACHINE variable in the 
             <filename>conf/local.conf</filename> file.</para></listitem>
         </itemizedlist>
         <para>
             Take some time to examine your <filename>conf/local.conf</filename> file.  
             The defaults should work fine.  
             However, if you have a multi-core CPU you might want to set the variable
             BB_NUMBER_THREADS equal to twice the number of processor cores your system has.
             And, set the variable PARALLEL_MAKE equal to the number of processor cores.
             Setting these variables can significantly shorten your build time.
             By default, these variables are commented out.
         </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>&dash;k</filename> option use the 
             <filename>bitbake --help</filename> command or see
             <ulink url='http://www.yoctoproject.org/docs/poky-ref-manual/poky-ref-manual.html#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 FAQ appendix in the 
                 <ulink url='http://www.yoctoproject.org/docs/poky-ref-manual/poky-ref-manual.html'>
                 Yocto Project Reference Manual</ulink>.
             </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>
            If hardware, libraries and services are stable you can get started by using a pre-built binary 
            of the image, kernel and toolchain and run it using the emulator QEMU.  
            This scenario is useful for developing application software.
        </para>

        <para></para>
        <para></para>
        <para></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 stand-alone Yocto toolchain tarball.
                 </para>
             </listitem>
             <listitem>
                 <para>
                     Download the pre-built kernel 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 the pre-built toolchain, which includes the <filename>runqemu</filename> 
             script and support files, from 
             <ulink url='http://yoctoproject.org/downloads/yocto-1.0/toolchain/'></ulink>.  
             Toolchains are available for 32-bit and 64-bit development systems from the 
             <filename>i686</filename> and <filename>x86_64</filename> folders, respectively. 
             Each type of development system supports five target architectures.
             The tarball files are named 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'>
     yocto-eglibc&lt;<emphasis>host_system</emphasis>&gt;-&lt;<emphasis>arch</emphasis>&gt;-toolchain-gmae-&lt;<emphasis>release</emphasis>&gt;.tar.bz2

     Where:
         &lt;<emphasis>host_system</emphasis>&gt; is a string representing your development system: 
                i686 or x86_64.
       
         &lt;<emphasis>arch</emphasis>&gt; is a string representing the target architecture: 
                i586, x86_64, powerpc, mips, or arm.
       
         &lt;<emphasis>release</emphasis>&gt; is the version of Yocto Project.
         </literallayout>

         <para>       
             For example, the following toolchain tarball is for a 64-bit development 
             host system and a 32-bit target architecture:
         </para>

         <literallayout class='monospaced'>
     yocto-eglibc-x86_64-i586-toolchain-gmae-1.1.tar.bz2
         </literallayout>

         <para>
             The toolchain tarballs are self-contained and must be installed into <filename>/opt/poky</filename>.
             The following commands show how you install the toolchain tarball given a 64-bit development host system
             and a 32-bit target architecture.
             The example assumes the toolchain tarball is located in <filename>~/toolchains/</filename>:
         </para>

         <para>
             <literallayout class='monospaced'>
     $ cd /
     $ sudo tar -xvjf ~/toolchains/yocto-eglibc-x86_64-i586-toolchain-gmae-1.1.tar.bz2
             </literallayout>
         </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 and the filesystem image suitable for 
             running in the emulator QEMU from 
             <ulink url='http://yoctoproject.org/downloads/yocto-1.0/machines/qemu'></ulink>.
             Be sure to use the kernel and filesystem image 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:
         </para>

         <literallayout class='monospaced'>
     *zImage-&lt;<emphasis>kernel-rev</emphasis>&gt;-qemu&lt;<emphasis>arch</emphasis>&gt;-&lt;<emphasis>release</emphasis>&gt;*.bin
     vmlinux-&lt;<emphasis>kernel-rev</emphasis>&gt;-qemu&lt;<emphasis>arch</emphasis>&gt;-&lt;<emphasis>release</emphasis>&gt;*.bin

     Where:
         &lt;<emphasis>kernel-rev</emphasis>&gt; is the base Linux kernel revision 
                (e.g. 2.6.37).

         &lt;<emphasis>arch</emphasis>&gt; is a string representing the target architecture: 
                x86, x86-64, ppc, mips, or arm.

         &lt;<emphasis>release</emphasis>&gt; is the version of Yocto Project. 
         </literallayout>
         </section>

        <section id='downloading-the-filesystem'>
        <title>Downloading the Filesystem</title>
         <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 Yocto Project build purposes.
         </para>

          <literallayout class='monospaced'>
     yocto-image-&lt;<emphasis>profile</emphasis>&gt;-qemu&lt;<emphasis>arch</emphasis>&gt;-&lt;<emphasis>release</emphasis>&gt;.rootfs.ext3.bz2
     yocto-image-&lt;<emphasis>profile</emphasis>&gt;-qemu&lt;<emphasis>arch</emphasis>&gt;-&lt;<emphasis>release</emphasis>&gt;.rootfs.tar.bz2

     Where:
         &lt;<emphasis>profile</emphasis>&gt; is the filesystem image's profile:
                   lsb, lsb-dev, lsb-sdk, minimal, minimal-dev, sato, sato-dev, or sato-sdk.
                   For information on these types of image profiles, see
                   <ulink url='http://www.yoctoproject.org/docs/1.1/poky-ref-manual/poky-ref-manual.html#ref-images'>Reference: Images</ulink> in the Yocto Project Reference Manual.

         &lt;<emphasis>arch</emphasis>&gt; is a string representing the target architecture: 
                x86, x86-64, ppc, mips, or arm.

         &lt;<emphasis>release</emphasis>&gt; is the version of Yocto Project. 
          </literallayout>
         </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.
         </para>

         <literallayout class='monospaced'>
     $ source /opt/poky/1.1/environment-setup-&lt;<emphasis>arch</emphasis>&gt;-poky-linux-&lt;<emphasis>if</emphasis>&gt; 

     Where:
         &lt;<emphasis>arch</emphasis>&gt; is a string representing the target architecture: 
                i586, x86_64, ppc603e, mips, or armv5te.

         &lt;<emphasis>if</emphasis>&gt; is a string representing an embedded application binary interface.
              Not all setup scripts include this string.
         </literallayout>

         <para>
              Finally, this command form invokes the QEMU emulator 
         </para>

         <literallayout class='monospaced'>
     $ runqemu &lt;<emphasis>qemuarch</emphasis>&gt; &lt;<emphasis>kernel-image</emphasis>&gt; &lt;<emphasis>filesystem-image</emphasis>&gt;

     Where:
         &lt;<emphasis>qemuarch</emphasis>&gt; is a string representing the target architecture: qemux86, qemux86-64, 
                    qemuppc, qemumips, or qemuarm.

         &lt;<emphasis>kernel-image</emphasis>&gt; is the architecture-specific kernel image.

         &lt;<emphasis>filesystem-image</emphasis>&gt; is the .ext3 filesystem image.

         </literallayout>

         <para>
             Continuing with the example, the following two commands setup the emulation 
             environment and launch QEMU.
             This example assumes the root filesystem tarball has been downloaded and expanded, and 
             that the kernel and filesystem are for a 32-bit target architecture.
         </para>

         <literallayout class='monospaced'>
     $ source /opt/poky/1.1/environment-setup-i686-poky-linux 
     $ runqemu qemux86 bzImage-3.0-qemux86-1.1.bin \
     yocto-image-sato-qemux86-1.1.rootfs.ext3
         </literallayout>

         <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.
         </para>
 
         <note><para>
             Booting the PPC image results in QEMU launching in the same shell in command-line mode.
         </para></note>
         </section>     
    </section>
</section>

</article>
<!--
vim: expandtab tw=80 ts=4
-->
