Adding Your Own Recipe to Ref-OS-IoT

It is 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 is a real project that you can download from http://ftp.gnu.org/gnu/hello/hello-2.7.tar.gz.

The Ref-OS-IoT will not allow new recipes to be part of the build unless SUPPORTED_RECIPES_CHECK is properly handled.

SUPPORTED_RECIPES_CHECK

Perform one of the following three methods to successfully customize your recipe:

  1. Disable the check with SUPPORTED_RECIPES_CHECK = "" in local.conf.

OR

  1. Create a new file which lists the unsupported recipes and extend SUPPORTED_RECIPES:

       SUPPORTED_RECIPES_append = " <path>/recipes-supported-by-me.txt"

OR

  1. Add the unsupported recipes to ./meta-ref-os-iot/conf/distro/distro-include/ref-os-supported-recipes.txt file.

Create Your Own Recipe for Hello

 For example: as meta-ref-os-iot/recipes-support/hello/hello_2.7.bb

 

    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

Include hello in the image by adding the following line to the full image conf for the compute module as follows:

In file meta-ref-os-iot/meta-edison/recipes-core/images/full-image.bb

          IMAGE_INSTALL_append = "\
         ${MACHINE_EXTRA_RRECOMMENDS} \
         hello \
     "

OR         

In file meta-ref-os-iot/recipes-image/image/full-image.bb

     IMAGE_INSTALL_append = "\
     ${MACHINE_EXTRA_RRECOMMENDS} \
         hello \
 "

You can now build the image following the instructions in OS_build_process.

Add an Intel IOT RefKit Recipe to Ref-OS-IoT

Syslog is a standard method of adding system log. Syslog is not included in the Ref-OS-IoT by default. But it can be enabled as follows.

In file meta-ref-os-iot/meta-edison/recipes-core/images/full-image.bb

     IMAGE_INSTALL_append = "\
         ${MACHINE_EXTRA_RRECOMMENDS} \
         sysklogd \
     "

In file meta-ref-os-iot/conf/distro/distro-include/ref-os-supported-recipes.txt add

sysklogd@core

OR

Disable SUPPORTED_RECIPES_CHECK as instructed in Supported Recipes Check.

Build and flash the image. Default configuration will start syslogd upon booting. Syslogd can be manually started with command:

systemctl start syslogd.service

Compile and run the sample program to test syslog.

#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
int main(void) {
 openlog("slog", LOG_PID|LOG_CONS, LOG_USER);
 syslog(LOG_INFO, "Hello from ref-os-iot syslog… ");
 closelog();
 return 0;
}

Add Robot OS (ROS) to Ref-OS-IoT

Robot OS (ROS – see http://wiki.ros.org/) features are supported by Ref-OS-IoT but not included in the official image by default. These can be included in your own build of Ref-OS-IoT by making the following changes to build/conf/local.conf before building the image:

IMAGE_FEATURES += "ros"
SUPPORTED_RECIPES_CHECK = ""

 

For more complete information about compiler optimizations, see our Optimization Notice.