Skip to content

OpenEmbedded Build Instructions

Herb Kuta edited this page Apr 27, 2019 · 25 revisions

OpenEmbedded Build Instructions

Revision: 3 Published: 2019-04-29

NOTE: This page will eventually be merged into meta-ros/README.md.

These instructions are for building ROS 2 crystal using OpenEmbedded thud on Ubuntu 18.04.

Build Environment Setup

  • Setup bitbake and OE-Core using a separate disk for the Yocto build artifacts. Note that the upstream HEAD of the [thud] and [1.40] branches can be updated at any time.

    # Prerequisites from https://www.yoctoproject.org/docs/2.6.1/mega-manual/mega-manual.html#ubuntu-packages
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
         build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
         xz-utils debianutils iputils-ping
    R=$PWD
    git clone -b 1.40 git://git.openembedded.org/bitbake
    git clone -b thud git://git.openembedded.org/openembedded-core
    mkdir -p <YOCTO-ARTIFACTS-DISK>/BUILD
    ln -s <YOCTO-ARTIFACTS-DISK>/BUILD build
    source openembedded-core/oe-init-build-env
    # Current directory is now <YOCTO-ARTIFACTS-DISK>/BUILD .
    mv conf $R/.
    ln -s $R/conf .
    cd $R
  • Add this to the bottom of conf/bblayers.conf:

    BBLAYERS_FETCH_DIR = "${COREBASE}/.."
    
    ROS_DISTRO = "crystal"
  • Add the dependent layers from LAYERDEPENDS_ros-layer to conf/bblayers.conf:

    bitbake-layers layerindex-fetch -b thud meta-python    # Satisfies the meta-oe layer dependency
    bitbake-layers layerindex-fetch -b thud meta-qt5
    bitbake-layers show-layers
    layer                 path                                      priority
    ==========================================================================
    meta                  <$R>/openembedded-core/meta               5
    meta-oe               <$R>/meta-openembedded/meta-oe            6
    meta-python           <$R>/meta-openembedded/meta-python        7
    meta-qt5              <$R>/meta-qt5                             7
  • Fix up the checkouts of the repos (the -b flag to bitbake-layers is ineffectual):

    cd meta-openembedded; git checkout thud; cd -
    cd meta-qt5; git checkout thud; cd -
  • Clone lgsvl/meta-ros2[thud-superflore-crystal] and add it to BBLAYERS:

    git clone -b thud-superflore-crystal [email protected]:lgsvl/meta-ros2.git meta-ros
    bitbake-layers add-layer meta-ros

    (Until the commits have been finalized and merged into lgsvl/meta-ros2[thud-superflore-crystal], you should clone from the rebaseable branch herb-kuta-lge/meta-ros2[r.hk/thud-superflore-crystal].)

  • Add this to the bottom of conf/local.conf:

    ROS_YOCTO_ARTIFACTS = "<YOCTO-ARTIFACTS-DISK>"
    
    # BUILDHISTORY_DIR is kept under TOPDIR
    
    DL_DIR = "${ROS_YOCTO_ARTIFACTS}/downloads"
    SSTATE_DIR = "${ROS_YOCTO_ARTIFACTS}/sstate-cache"
    TMPDIR = "${ROS_YOCTO_ARTIFACTS}/BUILD/tmp"
    
    MACHINE = "qemuarm64"
    
    PARALLEL_MAKE_pn-pcl = "-j <ROUND(<RAM-in-GB>/5)>"

Build core-image-ros-roscore

cd -P build; bitbake core-image-ros-roscore

Build core-image-ros-world

cd -P build; bitbake core-image-ros-world

Building for Raspberry Pi

  • Add the Raspberry Pi meta layer and switch it to the correct branch (the -b flag to bitbake-layers is ineffectual):

    bitbake-layers layerindex-fetch -b thud meta-raspberrypi
    cd thud meta-raspberrypi; git checkout thud; cd -
  • Change the value of MACHINE in conf/local.conf:

    MACHINE = "raspberrypi3"

Change Log

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.
Clone this wiki locally