Intel® Edison Board Support Package

Published: 09/25/2015, Last Updated: 09/25/2015

Introduction

This document is for software and system engineers who are building and customizing images, kernels, and native SDKs for the Intel® Edison Development Platform. Precompiled versions of the BSP are available on the Intel website. Users who don’t want to modify the default images don’t need to read this document.

The Intel® Edison Board Support Package offers these features:

  • Kernel image based on Linux* kernel 3.10.17
  • U-boot second stage bootloader
  • Connectivity via Bluetooth® technology and Wi-Fi
  • Intel cloud connectivity middleware
  • Many base Linux packages provided by the Yocto Project*

1.1 The Yocto Project*

The standard Linux* OS shipped on the Intel® Edison platform is based on Yocto. The Yocto Project is an open source collaboration project that provides templates, tools, and methods to help you create custom Linux-based systems for embedded products.

Building an Image
Figure 1. Building an Image

The Intel® Edison BSP source package is the set of Yocto source files necessary to generate a Linux image ready to run on the Intel® Edison board. It contains:

  • The set of Yocto recipes describing the process for building a Linux kernel, a bootloader, and a rootfs, which together form the bootable images ready to flash on a device.
  • The set of Yocto recipes necessary for creating a Software Developer Kit (SDK) and a cross-compiling tool chain that developers can use to create native applications for the Intel® Edison board.

For details on the Yocto project, consult the documentation on the Yocto website.)

1.2 References

Reference Name
331188 Intel® Edison Board Support Package User Guide (This document)
331189 Intel® Edison Compute Module Hardware Guide
331190 Intel® Edison Breakout Board Hardware Guide
331191 Intel® Edison Kit for Arduino* Hardware Guide
331192 Intel® Edison Native Application Guide
329686 Intel® Galileo and Intel® Edison Release Notes
332032 Intel® Edison Software Release Notes
[GSG] Intel® Edison Getting Started Guide
Windows* 64-bit
Windows 32-bit
Mac*
Linux
331438 Intel® Edison Wi-Fi Guide
331704 Intel® Edison Bluetooth® Guide
332434 Intel® Edison Audio Setup Guide
[YPQSG] Yocto Project Quick Start Guide
[YDM] Yocto Developer Manual
[YKDM] Yocto Kernel Developer Manual

1.3 Terminology

Term Definition
SSH Secure Shell
FTP File Transfer Protocol
GDB GNU Debugger

Build an Intel® Edison Board Image Using Bitbake

Building a standard Intel® Edison image requires downloading and installing several prerequisite packages. These instructions are valid for a recent Ubuntu Linux* distribution and should be valid for other distributions with minor changes.

Make sure your working directory is not part of an encrypted file system, such as eCryptFS. Because encrypted file systems restrict file length, the build will fail.

To build a standard Intel® Edison image, do the following:

  1. Install the prerequisite packages with the following command:

    sudo apt-get install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib
  2. Download the BSP source package iot-devkit-yp-poky-edison-20160606.zip (29 MB). The package includes the full Yocto Project* environment, and Intel® Edison-specific Yocto recipes to build the image (including the Linux kernel), a bootloader, and all necessary packages. Download the BSP source package to your working directory and decompress it.

    unzip iot-devkit-yp-poky-edison-20160606.zip
    cd iot-devkit-yp-poky-edison-20160606/poky/
  3. Run the following commands to build the Intel® Edison board image:

    source oe-init-build-env ../build_edison/
    bitbake edison-image u-boot
  4. When the bitbake process completes, images to flash are created in the edison-src/build/tmp/deploy/images/edison directory. To simplify the flash procedure, run the script below to copy the necessary files to the build/toFlash directory:

    ../poky/meta-intel-edison/utils/flash/postBuild.sh .

    then:

    zip -r toFlash.zip toFlash

2.1 Build the Intel® Edison native SDK

To cross-compile native applications for your image, you must generate an SDK containing a cross-compiler toolchain and sysroot. You can generate a full SDK for the Intel® Edison Development Board with the following command:

bitbake edison-image -c populate_sdk

This bitbake command creates the SDK installer script:

ls tmp/deploy/sdk
poky-edison-eglibc-x86_64-edison-image-core2-32-toolchain-1.6.1.sh

Creating Custom Intel® Edison Board Images

This section explains how to customize standard Linux* images for the Intel® Edison platform.

3.1 Adding standard Yocto* packages in the image

Yocto comes with a large set of recipes allowing you to simply add packages to our image. The available packages are on OpenEmbedded Layer Index. In order to add a package to our image, you simply need to add it to the IMAGE_INSTALL variable. For example, if you want to add the lib PNG to the image, add the following line to the edison-src /meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image.bb file:

IMAGE_INSTALL += "libpng"

Rebuild the image to have libpng included in it.

If you need to add patches to existing upstream sources, consult the Yocto documentation [YDM].

3.2 Excluding packages from the image

To exclude unnecessary packages from the image, remove the matching entry from the IMAGE_INSTALL variable or add the package name to the PACKAGE_EXCLUDE variable in the build/conf/local.conf file.

PACKAGE_EXCLUDE = "package1 package2"

3.3 Add third-party packages to the image

If Yocto does not provide a package you need, chances are good that someone else has created a Yocto recipe for it. In this section, we will add a set of Yocto recipes (from meta-openembedded, a third-party Yocto layer) to the Intel® Edison source. The recipes contained in this layer allow you to add many packages in a custom Intel® Edison image. Download the meta-openembedded layer. As an example, the opencv library will be added to the image. The example assumes a standard image has been created by running the setup.sh script and bitbake edison-image as described in the previous sections.

  1. Get the OpenEmbedded Yocto layer collection from GitHub. We use the "daisy" branch matching the version of Yocto that is used by the Intel® Edison software.

    cd edison-src/meta-intel-edison
    git clone https://github.com/openembedded/meta-openembedded.git
    cd meta-openembedded
    git checkout daisy
  2. Tell bitbake to look for recipes contained in the new meta-openembedded layer. Edit the edison-src /build/conf/bblayers.conf file and append the path to the new layer into the BBLAYERS variable:

    BBLAYERS ?= " \
    [..]
    Full/path/to/edison-src/meta-intel-edison/meta-openembedded/
    meta-openembedded \ "
  3. You now can add any recipe provided by the new meta-oe layer to your image. As in section 3.1, to add opencv to the image, add it to the IMAGE_INSTALL variable. You can do this in the edison-src /meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image.bb file, for example. In the particular case of opencv, to avoid bringing too many dependencies, you should also redefine a specific variable so that the library is built without gtk support:

    IMAGE_INSTALL += "opencv"
    PACKAGECONFIG_pn-opencv="eigen jpeg libav png tiff v4l"
  4. Save the file and rebuild the image as follows:

    cd edison-src
    source poky/oe-init-build-env
    bitbake edison-image

3.4 Write a Yocto recipe from scratch

It is also possible to create your own Yocto recipes from scratch and add them to the image. This section describes the required steps to add a hello_world C program to our image. The GNU hello_world (586 KB) is a real project that you can download.

  1. The first step is to tell bitbake where to download the code, and how to build the package. This is done by adding a new recipe (.bb) file in the right directory. To do this, create the recipe file hello_2.7.bb in the edison-src/meta-intel-edison/meta-intel-edison-distro/recipes-support/hello directory, with the following content:

    DESCRIPTION = "GNU Helloworld application"
    LICENSE = "GPLv3+"
    LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
    SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz"
    SRC_URI[md5sum] = "fc01b05c7f943d3c42124942a2a9bb3a"
    inherit autotools gettext

    As the hello_world project makes use of the autotools, it is enough to inherit the autotool Yocto class to tell bitbake how to configure and build the project. Refer to the [YDM] for details on the .bb syntax.

  2. The hello world recipe is ready, but you still need to add it to your image. To do so, add the following line to the edison-src /meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image.bb file:

    IMAGE_INSTALL += "hello"
  3. Then rebuild the image:

    bitbake edison-image

3.5 Add a recipe for a systemd service

Developers may choose to add their own application as a service to Intel® Edison. On the Intel® Edison platform, services are special applications that run in the background. They are managed by systemd, a system and service manager for Linux*.

A systemd service is described by a .service file that needs to be deployed on the Intel® Edison board usually in /lib/systemd/system. This service file contains information on how and when to start the service, which are its dependencies, etc.

Refer to systemd documentation for an overview of the base systemd concepts, and a description of the associated tools.

The Intel® Edison BSP source includes a sample recipe for creating a systemd service application using Yocto. The sample is in the edison-src/meta-intel-edison/meta-intel-edison-distro/recipes-support/watchdog-sample folder.

A system service is described by a .service file. Refer to the sample file watchdog-sample.service found in the systemd.service man page.

To deploy the service from a Yocto recipe, you need to inherit the Yocto systemd class. Refer to the documentation for systemd.bbclass.

Customizing the Linux* Kernel

This chapter contains a brief overview of making kernel modifications. Customizing the kernel is important on embedded systems for making new devices and sensors. For more detailed information, see [YKDM]. Check it out for additional ways of configuring the kernel, for example through using more compact and modular configuration fragments. The approach described here is good for ad-hoc modifications while config fragments are shorter than full kernel configuration, and it allows you to create and distribute your own Yocto recipes for modifying specific kernel features.

The base kernel config file is delivered with edison-src.tar.gz and is located in the edison-src/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/files/defconfig file.

The menuconfig tool provides an easy interactive method with which to define kernel configurations. For general information on menuconfig, see the menuconfig Wikipedia entry. The following command opens the menuconfig terminal for configurations:

bitbake virtual/kernel -c menuconfig

Building an Image
Figure 2. Linux kernel configuration

When the configuration is completed, replace defconfig with .config, then rename it back to defconfig. We also suggest taking a backup of the defconfig file. Force bitbake to copy the modified defconfig file to the actual build directory. Then the new image with modified kernel is ready to build.

cp <path_to_edison-src>/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17+gitAUTOINC+6ad20f049a_c03195ed6e-r0/linux-edison-standard-build/.config <path_to_edison-src>/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/files/defconfig

We can also change the Intel® Edison kernel configuration (i386_edison_defconfig) file and overwrite with customized kernel configuration by doing following:

cp <path_to_edison-src>/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17+gitAUTOINC+6ad20f049a_c03195ed6e-r0/linux-edison-standard-build/.config <path_to_edison-src>/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17+gitAUTOINC+6ad20f049a_c03195ed6e-r0/linux/arch/x86/configs/i386_edison_defconfig
bitbake  virtual/kernel –c configure –f –v
bitbake  edison-image

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804