Clone and Build Poky

[My Host = Ubuntu 16.04LTS] [My Target = QEMUARM]

Our first step is to validate our host installation and general capabilities, in regard to working with OpenEmbedded and Yocto.

Your host has to have certain basic packages installed to work as a build machine for OE/Yocto.  See Section 3.2 of the Yocto Project Mega Manual for suggested package lists for various Linux hosts.

Create a sandbox directory and clone Poky:

git clone git://git.yoctoproject.org/poky

Which branch to use is easy, start with the latest as you don’t want to stumble on build issues that were solved months or years ago.  See this Q/A link for description of release cycle.  I checked out morty.

git checkout morty

Setup build environment by sourcing a script

cd <sandbox>

source poky/oe-init-build-env

You can view the script if you want the gory details, suffice to say some environment variables are initialized and a build tree is created with a conf sub-directory.  You end up in the build directory, where you want to be to do a build.  This shell is now pathed in to bitbake.  You will want to edit local.conf to specify a machine, these lines are already in the file and commented out.  Select a machine, e.g. qemuarm and uncomment this line.  There are other lines you can uncomment, but this is only one you need to bother with immediately.

You can now use bitbake to build (or re-build) individual recipes, but for an initial build this is hundreds if not thousands of packages, so better to start with an image that is self-contained.

cd <sandbox>/poky

ls meta*/recipe*/images/*.bb

First thing to note is that a bitbake recipes file ends in .bb.  The above ls command does not list all of the recipe files.  On my system, within poky there are 885 bitbake recipe files

<sandbox>/poky$ find . -name “*.bb” -print | wc
885 885 46070

When you select an image recipe to build some subset of the total number of recipe files will actually be invoked by bitbake to fulfill your request to build an image.  We will explore an image file later, but for now don’t be surprised if the selected image file only contains a few lines and yet hundreds of recipes are referenced.