Skip to content

Instantly share code, notes, and snippets.

@kacf
Created July 14, 2022 14:20
Show Gist options
  • Save kacf/0280bff9e9d8810335481deaf397cace to your computer and use it in GitHub Desktop.
Save kacf/0280bff9e9d8810335481deaf397cace to your computer and use it in GitHub Desktop.
diff --git a/mender-binary-delta1.md b/mender-binary-delta2.md
index 40c7435..f5406df 100644
--- a/mender-binary-delta1.md
+++ b/mender-binary-delta2.md
@@ -92,10 +92,22 @@ The content of the archive should be:
As you might have guessed, we have prepared binaries for the `armhf` and `x86_64` architectures. If your platform architecture does not match the provided binaries, please contact us and we should be able to compile binaries for your target.
-The `mender-binary-delta` binary is intended to be installed on the device on which you intend to perform delta updates on.
+The `mender-binary-delta` binary is intended to be installed on the device on which you intend to perform delta updates on. However, the Yocto integration works directly with the `.tar.xz` file, so we don't need the binary here.
The `mender-binary-delta-generator` is intended to be used on your development machine to generate deltas between two Mender Artifacts. You can use the `x86_64` `mender-binary-delta-generator` even if your device is `armhf`, the generator tool is architecture agnostic.
+We only need the generator, so copy it to `/usr/bin`:
+
+```
+sudo cp mender-binary-delta-1.4.0/x86_64/mender-binary-delta-generator /usr/bin
+```
+
+Then delete the rest of the unpacked files:
+
+```
+rm -rf mender-binary-delta-1.4.0
+```
+
## Integrating mender-binary-delta to an existing Yocto environment
It is assumed that you already have a Yocto Project environment configured using [meta-mender](https://github.com/mendersoftware/meta-mender) and that you are in the `build` directory.
@@ -114,18 +126,16 @@ 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_FEATURES:append = " read-only-rootfs"
-IMAGE_INSTALL_append = " mender-binary-delta"
-LICENSE_FLAGS_WHITELIST_append = " commercial_mender-binary-delta"
-FILESEXTRAPATHS_prepend_pn-mender-binary-delta := "${HOME}/mender-binary-delta-1.2.1/:"
+IMAGE_INSTALL:append = " mender-binary-delta"
+LICENSE_FLAGS_ACCEPTED:append = " commercial_mender-binary-delta"
+SRC_URI:pn-mender-binary-delta = "file://${HOME}/mender-binary-delta-1.4.0.tar.gz"
EOF
```
-**NOTE!** The trailing `:` in `FILESEXTRAPATHS_prepend_pn-mender-binary-delta` is intentional and important to have in place.
-
## Preparing images and artifacts
For the purpose of this tutorial you can set the `MENDER_ARTIFACT_NAME` to the following:
@@ -159,7 +169,7 @@ Please verify this before proceeding.
Save the generated Mender Artifact for later (will be used to generate a delta):
```
-cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/mender-binary-delta-1.2.1/x86_64/release-v.1.0.mender
+cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/release-v.1.0.mender
```
Generate a second Mender Artifact which can be used to test deploying delta updates. Start of with making a change to the image content, such as adding an ssh server (for diagnostics purposes):
@@ -187,20 +197,7 @@ bitbake ${TARGET_IMAGE}
Save the generated Mender Artifact for later (will be used to generate a delta):
```
-cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/mender-binary-delta-1.4.0/x86_64/release-v.2.0.mender
-```
-
-Change directory `mender-binary-delta`:
-
-```
-cd ${HOME}/mender-binary-delta-1.4.0/x86_64/
-```
-
-The content of this directory should be the following:
-
-```
-$ ls
-mender-binary-delta mender-binary-delta-generator release-v.1.0.mender release-v.2.0.mender
+cp tmp/deploy/images/${MACHINE}/${TARGET_IMAGE}-${MACHINE}.mender ${HOME}/release-v.2.0.mender
```
## Generating delta Artifacts
@@ -210,13 +207,13 @@ This tutorial assumes that Mender Enterprise is being used. If not, then depende
Generate delta for `v1.0 -> v2.0` update path:
```
-./mender-binary-delta-generator -o v2.0-deltafrom-v1.0.mender release-v.1.0.mender release-v.2.0.mender
+mender-binary-delta-generator -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:
```
-./mender-binary-delta-generator -o v1.0-deltafrom-v2.0.mender release-v.2.0.mender release-v.1.0.mender
+mender-binary-delta-generator -o v1.0-deltafrom-v2.0.mender release-v.2.0.mender release-v.1.0.mender
```
## Using the delta Mender Artifacts
@@ -240,6 +237,32 @@ Note that the very first update after provisioning a device is always a `rootfs-
If you want to verify that the mender-binary-delta Artifact is indeed being used, delete the rootfs-image from the one of the Releases in the UI, and then deploy that release.
+## Pre-kirkstone Yocto branches
+
+If you are using a Yocto branch older than kirkstone, such as dunfell or older, you need slightly altered steps to use mender-binary-delta. Two things are required:
+
+1. The `.tar.xz` file must be unpacked before it can be used, so make sure you keep it around, and don't delete the unpacked files.
+
+2. The build configuration is a little different. See the next section for details.
+
+### Set up the Yocto environment
+
+The environment is almost the same as for kirkstone, but you need to make these changes to the configuration:
+
+1. Remove the `SRC_URI` line that refers to the downloaded `.tar.xz` file.
+
+2. Add a line like below, and make sure the path points to where the `.tar.xz` file was unpacked:
+ ```
+ FILESEXTRAPATHS_prepend_pn-mender-binary-delta := "${HOME}/mender-binary-delta-1.4.0/:"
+ ```
+
+ **NOTE!** The trailing `:` in `FILESEXTRAPATHS_prepend_pn-mender-binary-delta` is intentional and important to have in place.
+
+3. The Yocto Project has renamed the variable `LICENSE_FLAGS_WHITELIST` to `LICENSE_FLAGS_ACCEPTED` in kirkstone and later branches, so make sure to use the former variant with dunfell and older branches.
+
+4. The Yocto Project has also changed the override syntax so, you need to make sure the configuration is using the old syntax with dunfell and older branches. More information about this change can be found in [the Yocto Project Manual](https://docs.yoctoproject.org/singleindex.html#override-syntax-changes).
+
+
## Troubleshooting
### Error message: `Artifact dependency "rootfs_image_checksum" not satisfied by currently installed artifact`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment