# How to do delta updates with Raspberry Pi 3

**URL:** <https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122>\
**Category:** Mender\
**Created:** [October 7, 2019, 9:32pm UTC](https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122 "2019-10-07T21:32:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farshadt](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@farshadt](https://hub.mender.io/u/farshadt)\
**Post date:** [October 7, 2019, 9:32pm UTC](https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122/1 "2019-10-07T21:32:08Z")

</div>

## Introduction

Using binary deltas for applying updates is a more efficient mechanism for updating software over-the-air (OTA) which enables faster downloads and bandwidth cost saving for metered networks. When using cellular networks (e.g. 4G/LTE) or other bandwidth constrained networks, the impact is even greater. Mender offers the ability to generate and only deploy the binary difference (delta) between the software version already on the devices and the new version.

Mender offers binary delta updates as a commercial feature, using dual A/B partitions, providing the same robust update and atomic rollbacks that have been available with Mender since our initial release.

This tutorial will illustrate how to do a binary delta update with Raspberry Pi 3 utilizing the Yocto Project.

## Prerequisites

- A [Raspberry Pi 3 Model B](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) or [B+](https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/) with 8 GB of microSD as a storage medium.
- A supported Linux distribution and dependencies installed on your workstation/laptop as described in the [Yocto Mega Manual](https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#detailed-supported-distros)
  - NOTE. Instructions depend on which Yocto version you intend to use.

- Google repo tool [installed](https://hub.mender.io/t/google-repo/58/2) and in your `PATH`.

## Step 1 Initial setup of the Yocto Project environment

Set the Yocto Project branch you are building for:

```auto
export BRANCH="warrior"

```

Create a directory for your mender-raspberrypi setup to live in and clone the meta information.

```auto
mkdir mender-raspberrypi && cd mender-raspberrypi

```

Initialize repo manifest:

```auto
repo init \
    -u https://github.com/mendersoftware/meta-mender-community \
    -m meta-mender-raspberrypi/scripts/manifest-raspberrypi.xml \
    -b ${BRANCH}

```

Fetch layers in manifest:

```auto
repo sync

```

Setup the build environment:

```auto
source setup-environment raspberrypi

```

## Step 2 Unpacking mender-binary-delta

You should have received a tar archive named mender-binary-delta-1.0.tar.xz which contains the binaries needed to generate and apply deltas. The content of the archive should be:

```auto
├── aarch64
│ ├── mender-binary-delta
│ └── mender-binary-delta-generator
├── arm
│ ├── mender-binary-delta
│ └── mender-binary-delta-generator
└── x86_64
    ├── mender-binary-delta
    └── mender-binary-delta-generator

```

Change directory to `$HOME`:

```auto
cd ${HOME}

```

Unpack the `mender-binary-delta-1.0.0b1.tar.xz` in your home directory:

```auto
tar xvf mender-binary-delta-1.0.0b1.tar.xz

```

## Step 3 Integrating mender-binary-delta into the Yocto Project environment

Add the meta-mender-commerical layer to your Yocto environment:

```auto
bitbake-layers add-layer ../sources/meta-mender/meta-mender-commercial

```

Run the following to modify `local.conf` to include `mender-binary-delta` in your build:

```auto
cat <<EOF >> conf/local.conf
# Customizations for Mender delta-update support
# This will not impact your image if you already have this enabled
IMAGE_FEATURES_append = " read-only-rootfs"
IMAGE_INSTALL_append = " mender-binary-delta"
LICENSE_FLAGS_WHITELIST = "commercial_mender-binary-delta"
FILESEXTRAPATHS_prepend_pn-mender-binary-delta := "${HOME}/mender-binary-delta-1.0.0b1/:"
EOF

```

## Step 4 Generating images, artifacts and deltas

For the purpose of this tutorial you can set the MENDER\_ARTIFACT\_NAME to the following:

```auto
MENDER_ARTIFACT_NAME = "release-v.1.0"

```

Set helper variables:

```auto
TARGET_IMAGE="core-image-base"
MACHINE="raspberrypi3"

```

Build an image (target image might differ in your environment):

```auto
bitbake ${TARGET_IMAGE}

```

Use the output of the build to provision your device with e.g with the provided disk image (e.g .sdimg) file. The result should be that you have a device that has booted and has the following file installed:

```auto
# ls /usr/share/mender/modules/v3/mender-binary-delta -alh
-rwxr-xr-x 1 root root 98.2K Aug 19 08:52 /usr/share/mender/modules/v3/mender-binary-delta

```

Please verify this before proceeding. Save the generated Mender Artifact for later as it will be used to generate the delta:

```auto
cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/mender-binary-delta-0.1.0/x86_64/release-v.1.0.mender

```

Generate a second Mender Artifact which can be used to test deploying delta updates. Start off by making a change to the image content, e.g add an application:

```auto
cat <<EOF >> conf/local.conf
IMAGE_INSTALL_append = " vim"
EOF

```

Update the MENDER\_ARTIFACT\_NAME to the following:

```auto
MENDER_ARTIFACT_NAME = "release-v.2.0"

```

Build the new image:

```auto
bitbake ${TARGET_IMAGE}

```

Save the generated Mender Artifact for later (will be used to generate a delta):

```auto
cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/mender-binary-delta-0.1.0/x86_64/release-v.2.0.mender

```

Change directory `mender-binary-delta`:

```auto
cd ${HOME}/mender-binary-delta-0.1.0/x86_64/

```

The content of this directory should be the following:

```auto
$ ls
mender-binary-delta mender-binary-delta-generator release-v.1.0.mender release-v.2.0.mender

```

Generate delta for `v1.0 -> v2.0` update path:

```auto
./mender-binary-delta-generator -n v2.0-deltafrom-v1.0 -o v2.0-deltafrom-v1.0.mender release-v.1.0.mender release-v.2.0.mender

```

Generate delta for v2.0 -\> v1.0 update path:

```auto
./mender-binary-delta-generator -n v1.0-deltafrom-v2.0 -o v1.0-deltafrom-v2.0.mender release-v.2.0.mender release-v.1.0.mender

```

We now have the Mender Artifacts ready to be uploaded to the Mender server. The uploaded files are:

- release-v.1.0.mender (rootfs-image)
- release-v.2.0.mender (rootfs-image)
- v1.0-deltafrom-v2.0.mender (mender-binary-delta)
- v2.0-deltafrom-v1.0.mender (mender-binary-delta)

If you have followed this tutorial your provisioned device should be running `release-v1.0` which was provisioned using a disk image (e.g `sdimg`).

## Step 5 Deploy delta updates

Now, you can deploy either of the mender-binary-delta updates to your target system. Take careful note of the version currently running on your Raspberry Pi 3 device to ensure you select the appropriate image for installation.

- v1.0-deltafrom-v2.0.mender
- v2.0-deltafrom-v1.0.mender

## Conclusion

In this tutorial we covered building and configuring a Raspberry Pi 3 board to deploy a robust delta update with rootfs rollback capability.

* * *

_If this tutorial was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!_

---

<div class="post-metadata">

**Author:** ![anishmonachan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/anishmonachan/32/802_2.png) [@anishmonachan](https://hub.mender.io/u/anishmonachan)\
**Post date:** [September 29, 2020, 11:04am UTC](https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122/4 "2020-09-29T11:04:47Z")

</div>

I’ve been following this tutorial with my jetson tx2. But I had my own image and mender artifacts.  
I have created delta using this tutorial but while updating I’ve ended up with an error `No compatible artifact found`.

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [September 29, 2020, 1:57pm UTC](https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122/5 "2020-09-29T13:57:34Z")

</div>

Hi @anishmonachan have you seen the [troubleshooting steps here](https://hub.mender.io/t/robust-delta-update-rootfs/1144)?

Most likely you are seeing a known issue that is [discussed here](https://tracker.mender.io/browse/MEN-2582).

---

<div class="post-metadata">

**Author:** ![anishmonachan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/anishmonachan/32/802_2.png) [@anishmonachan](https://hub.mender.io/u/anishmonachan)\
**Post date:** [September 29, 2020, 3:41pm UTC](https://hub.mender.io/t/how-to-do-delta-updates-with-raspberry-pi-3/1122/6 "2020-09-29T15:41:57Z")

</div>

Thanks for your reply.

[Robust delta update rootfs](https://hub.mender.io/t/robust-delta-update-rootfs/1144)?

from the tutorial above, I understood following points

1. first update must always be an full rootfs update
2. I’m using Mender v2.2.0 which doesn’t support delta update.
