Monday, January 25, 2016

Using Make for Easy Yocto Builds On Intel Edison

This documentation goes though the process of building a Yocto Linux image via simple make files for the Intel Edison board. The make file method for building Yocto images is much simpler than the manual build methods. The make files provided by Intel in the BSP Edison source package wrap the build process with scripts to make building an extremely simple process.

Most of the base steps found in this documentation were based on Intels Board Support Package (BSP) User Guide. The BSP User Guide can be found here.

Also note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.


Create a Directory for Building the Image

  • This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.

    mkdir -p ~/src/edison
    cd ~/src/edison

Download the Latest Edison Source Package

  • The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the source package downloads on this page.

  • Download the latest "Linux source files" on the page listed above. As of this documentation, the link was "Linux source files".

  • If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.

    curl -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz

Uncompress the Source Files

  • If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.

    tar xfvz edison-src-ww25.5-15.tgz

Install Build Dependancies

  • Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Yocto image.

    sudo apt-get install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib

(Optional) Speed Up The Build With Parallelization

  • Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling Yocto to build using parallelization. By default, the Edison Yocto configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.

  • Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build Yocto from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both parallel_make and bb_number_thread to a value of 40.

    export SETUP_ARGS="--parallel_make=8 --bb_number_thread=8"

Initialize the Build Environment

  • The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.

    cd edison-src
    make setup

Build the Yocto Image

  • Note, this step can take a very long time. When you are ready to kick off the build, run the following:

    make image

Flash the Yocto Image to the Edison Board.

  • Once the image is built, you can install it to the Edison board by running the following:

    sudo apt-get -i install dfu-util
    make flash

Summary

Hopefully this documentation proves useful in building Edison Yocto images via the simplified make file method. I find the make file build method is much less tedious than the manual Yocto build process. If you are interested in other make recipes provided by Intel, you can run:

make help

The next post will cover building Debian images for the Intel Edison board. Stay tuned for more...

1 comment:

  1. Thank for guide hackgnar, great help! Your guide more sutible for older sources than this one

    ReplyDelete