OTA Connect Developer Guide

Build a Raspberry Pi image

HERE OTA Connect lets you easily manage OTA updates to embedded devices running custom-built Yocto images. This is a guide for building a simple Yocto image for the Raspberry Pi Model 3. You can use it as a base image for another project, or as a template for how to get started. The whole process only takes about 3 minutes of your time.


You’ll need a build machine with the following:

  • A x86-64 Linux distro supported by the Yocto project with the required packages installed.

    • On a Debian-based system, you should be able to install all the required packages with the following command:

      sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect python-dev xz-utils debianutils iputils-ping cpu-checker default-jre parted
    • Many/most distros that aren’t on the officially supported list will still work just fine—​feel free to give it a try with whatever you’re running.

    • Although the Yocto project as a whole does support architectures other than x86-64 for the build machine, one of the layers we’ll be using only supports x86-64.

    • You can run this all inside a VM, but a Yocto build is a pretty resource-intensive process, so generally we don’t recommend it. Make sure your VM meets the following requirements:

      • At least 6GB of RAM

      • At least 150GB of disk space.

  • 100GB of free disk space

  • repo

    • Download the latest version directly from Google, or

    • install it from your distro’s packages if available (sudo apt-get install repo)

Also, make sure that you’ve generated your provisioning credentials first.

Create your Yocto build environment

First, clone a manifest file for the quickstart project:

mkdir myproject
cd myproject
repo init -u https://github.com/advancedtelematic/updater-repo.git
repo sync

This downloads the basic Yocto layers you need.

What is this actually doing?

Yocto is a set of tools, templates and methods for building Linux systems from scratch. Most Yocto-built systems use a common set of base layers. The Yocto project maintains a reference distribution called Poky; we include that as a base layer, then add layers containing hardware support for specific boards (in this case the Raspberry Pi Model 3). Finally, we include the meta-updater layer, which contains the platform-independent software the device and build system need to work with OTA Connect, and meta-updater-raspberrypi for the device-specific code—​mostly the specialized bootloader code.

All of these layers are assembled into a built Linux system by Bitbake, the build tool of the Yocto Project, based on the instructions in the recipes inside the layers.

Now you can run the following script to get the environment set up:

source meta-updater/scripts/envsetup.sh raspberrypi3

Customize your build

The environment setup script will have created a build directory and placed you in it. It also generates a configuration file, located at conf/local.conf. This file is where we’ll make our modifications to the base config.

To connect with your HERE OTA Connect account, you’ll need the provisioning credentials bundle you downloaded earlier. Add the following line to your local.conf to supply those credentials to the build:

SOTA_PACKED_CREDENTIALS = "/path/to/your/credentials.zip"

Optional configuration keys

  • Set image name

When you build a filesystem image, it gets automatically uploaded to OTA Connect. By default, the image will be named raspberrypi3-ota, and you’ll see the various versions of the image under that name. You can also choose to set your own name as follows:

OSTREE_BRANCHNAME = "my-super-great-project"
  • Persistent Yocto shared state cache and download directory

Yocto caches its build artefacts to speed up future builds. By default, these are stored under the build directory of the current project. However, if you’re planning to build several different projects that have some shared base files, you might want them to share their cache directories, both to save space and speed up your builds. You can do that as follows:

SSTATE_DIR = "/path/to/your/shared-sstate"
DL_DIR = "/path/to/your/shared-download"
  • Add extra packages

There are quite a lot of packages available to install that aren’t installed by default. You can add extra packages to your image with IMAGE_INSTALL_append; for example, this will install vim:

IMAGE_INSTALL_append = " vim " (1)
1 Note the spaces before and after the package name. This option dumbly appends a string to an install list, so we wrap it in spaces to make sure we don’t alter the list in unexpected ways.

You can get a list of all the available packages in the layers you have configured with bitbake-layers show-recipes


Now you’re ready to build an image.

bitbake rpi-basic-image

This step will take a while. If you used the build mirror, it might be as little as 10-15 minutes. Building everything from scratch, it will likely take a few hours.

Put the built image on an SD card

The build process creates disk images as an artefact. The one you need to write to the disk is located under your build directory at tmp/deploy/images/raspberrypi3/rpi-basic-image-raspberrypi3.wic. We provide a script to write the image and resize it to fit your SD card:

sudo ../meta-updater-raspberrypi/scripts/flash-image.sh <device> (1)
1 <device> is the name of the the device you want to write to. For example, sdb.
You can also write the image using dd, but since the wrong kind of typo in a dd command is so dangerous, we don’t recommend it. If you really want to do it that way, though, inspect the shell script to find the required commands.

Now, put the card into your Pi, plug it into a wired internet connection, and power it on. You should see it come online in a minute or two. It will generate a random name for itself during autoprovisioning; you can change the name later.