Skip to content

OpenEmbedded Build Instructions

Herb Kuta edited this page Jun 11, 2019 · 6 revisions

OpenEmbedded Build Instructions

Revision: 6 Published: 2019-06-13

These instructions are for building ROS 2 crystal using OpenEmbedded morty on Ubuntu bionic.

Although recipes for dashing appear in meta-ros, it requires Python 3.6, which is not provided by morty. The migration to OpenEmbedded thud is expected to be completed by the end of 2019-06. When dashing builds using it, conf/ros2-dashing.mcf and conf/webos-dashing.mcf will be added and these instructions updated.

Additional information on meta-ros can be found in Superflore OE Recipe Generation Scheme.

Build Environment Setup

  • Setup bitbake and OE-Core using a separate disk for the build artifacts (~100GB required).

    # Prerequisites
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
            build-essential chrpath socat cpio python python3-pip python3-pexpect \
            xz-utils debianutils iputils-ping \
            g++-multilib locales lsb-release python3-distutils time
    sudo locale-gen en_US.utf8
    
    # The branch for OpenEmbedded "thud" is not yet available. In the meantime, use a draft of the branch for "morty".
    git clone -b morty-draft git@github.com:ros/meta-ros
    mkdir conf
    cp meta-ros/files/*.mcf conf/.
    
    # Clone the OpenEmbedded metadata layers. Select a configuration based on the DISTRO you wish to build:
    # cfg=ros2-crystal.mcf
    # cfg=webos-crystal.mcf
    meta-ros/scripts/mcf -f conf/$cfg
    
    # oe-init-build-env defaults to using "./build" as the build directory. Bitbake expects to find the "conf" subdirectory under
    # the build directory, so create a symlink there to where we've created it.
    mkdir build
    ln -snf ../conf build/.
    
    # By default, OpenEmbedded "morty" expects bitbake to be in a subdirectory of where oe-init-build-env resides. Fool it.
    ln -snf ../bitbake openembedded-core/.
    
    # Set up the shell environment for this build and create a conf/local.conf .
    source openembedded-core/oe-init-build-env
    
    # The current directory is now the build directory; return to the original.
    cd -
    
    # Create a common artifacts directory on the separate disk. The edits to conf/local.conf done below will set TMPDIR to be a
    # subdirectory of it.
    mkdir -p /absolute/path/to/directory/on/separate/disk
  • Add this to the bottom of conf/local.conf:

    #
    # Local additions
    #
    
    # Uncomment this if you configured with ros2-crystal.mcf:
    # DISTRO = "ros2"
    # Uncomment this if you configured with webos-crystal.mcf:
    # DISTRO = "webos"
    
    # Uncomment one:
    # MACHINE = "qemux86"
    # MACHINE = "raspberrypi3"
    
    ROS_COMMON_ARTIFACTS = "/absolute/path/to/directory/on/separate/disk"
    
    DL_DIR = "${ROS_COMMON_ARTIFACTS}/downloads"
    SSTATE_DIR = "${ROS_COMMON_ARTIFACTS}/sstate-cache"
    TMPDIR = "${ROS_COMMON_ARTIFACTS}/BUILD-${DISTRO}-${ROS_DISTRO}"
    # Don't add the libc variant suffix to TMPDIR.
    TCLIBCAPPEND := ""
    
    # As recommended by https://www.yoctoproject.org/docs/2.6.2/mega-manual/mega-manual.html#var-BB_NUMBER_THREADS
    # and https://www.yoctoproject.org/docs/2.6.2/mega-manual/mega-manual.html#var-PARALLEL_MAKE:
    BB_NUMBER_THREADS = "${@min(int(bb.utils.cpu_count()), 20)}"
    PARALLEL_MAKE = "-j ${BB_NUMBER_THREADS}"
    
    # Special setting for "pcl" -- see meta-ros/recipes-extended/pcl/pcl_1.8.1.bb
    PARALLEL_MAKE_pn-pcl = "-j <ROUND(<RAM-in-GB>/5)>"
    

Building Images

DISTRO = ros2 Images

core-image-ros-roscore

This image contains just the ROS "core".

source openembedded-core/oe-init-build-env
cd -
bitbake core-image-ros-roscore

core-image-ros-world

By default, this image contains all of the "non-optional" ROS packages. In the future, you will be able to include "optional" ones by setting DISTRO_FEATURES in conf/local.conf.

source openembedded-core/oe-init-build-env
cd -
bitbake core-image-ros-world

DISTRO = webos Images

webos-image-ros-roscore

This webOS OSE image contains just the ROS "core".

source openembedded-core/oe-init-build-env
cd -
bitbake webos-image-ros-roscore

webos-image-ros-world

By default, this webOS OSE image contains all of the "non-optional" ROS packages. In the future, you will be able to include "optional" ones by setting DISTRO_FEATURES in conf/local.conf.

source openembedded-core/oe-init-build-env
cd -
bitbake webos-image-ros-roscore

Usage Notes

  • These images default to being non-production: the root account has no password.

  • In order to run ROS commands, you must set up a ROS workspace by issuing:

    source ros_setup.sh
  • The *.mcf files do not pin the commit of meta-ros => to update it to its current head:

    # Select a configuration based on the value of DISTRO in conf/local.conf:
    # cfg=ros2-crystal.mcf
    # cfg=webos-crystal.mcf
    meta-ros/scripts/mcf -f conf/$cfg
    
    # If there happens to be a new version of $cfg in meta-ros, update conf/$cfg and rerun:
    diff meta-ros/files/$cfg conf/. || {
      cp meta-ros/files/$cfg conf/.
      meta-ros/scripts/mcf -f conf/$cfg
      # Update from revision 4 instructions:
      [ -d openembedded-core/bitbake ] && { rm -rf openembedded-core/bitbake; ln -snf ../bitbake openembedded-core/.; }
    }

Change Log

Revision 6

  • Problems have been observed when TMPDIR is shared between ROS_DISTRO-s => include -${ROS-DISTRO} in its value.
  • Fix typo.

Revision 5

  • Update the plans for dashing support.
  • Simpify and clarify the build setup instructions. Also make them more robust.
  • Add a note on to how update meta-ros.
  • Fix typos.

Revision 4

  • Revise for the inclusion of mcf in meta-ros.
  • Add support for using webOS OSE as the OpenEmbedded DISTRO.

Revision 3

  • Add a step to install the prerequisites.
  • Add instructions to build for Raspberry Pi.
  • Fix typo.

Revision 2

  • Drop setting SSTATE_MIRRORS because meta-ros adds global environment variables that invalidates even the shared state for native packages.
  • Specify a PARALLEL_MAKE_pn-pcl setting so that building pcl doesn't take nearly 3 hours.
  • Fix typos.

Revision 1

  • Initial publication.
You can’t perform that action at this time.