Android devices in the field can receive and install over-the-air (OTA) updates to the system and application software. OTA updates are designed to upgrade the underlying operating system and the read-only applications installed on the system partition. These updates do not affect applications installed by the user.

## OTA update packages

Android release tools can build two types of update packages:

• A full update package contains the entire final state of the device (system, boot, vendor, and recovery partitions).

• This update package size is bigger.

• The package can install the new version regardless of the current state of the device.

• An incremental update package contains several binary patches generated from the difference between an old build and the new one.

• Since these patches are applied to the data already on the device, the update packages may be smaller.

• You can only install an incremental update on devices running the old build used when the incremental update package was constructed.

• To generate an incremental package, you must use the release tools and the two build versions, the previous build (the one you want to update from) and the new one (the one you want to update to). This means you must keep the previous build version.

The Python tool `ota_from_target_files` (at `build/tools/releasetools`) can build full and incremental packages. The tool takes the `target_files` zip file as input:

• One `target_files` zip to generate a full update package.

• Two `target_files` zips (old and new versions) to generate an incremental update package. The tool compares new `target_files` zip with the one from last release, and generates binary differences in the incremental package.

## Create a full update package

To build a full update package for your platform based on Digi’s source code, follow these steps:

1. You must have created the `signed-target_files` zip (see Sign for release).

2. Change to the directory where the source code is installed.

``$cd dea-11.0-r2`` 3. Run the following command: ``````$ ota_from_target_files \
-k ~/android-certs/releasekey \
out/dist/signed-target-files.zip \
out/dist/full-ota-update.zip``````

The file `out/dist/full-ota-update.zip` is the update package to be installed in your ConnectCore 8X.

 To install the update package `out/dist/full-ota-update.zip` in your ConnectCore 8X, follow the steps in Update Android with OTA packages.
 To establish a secure environment where the access to the private key is restricted, see Release in a secure environment.

## Create an incremental update package

To build an incremental update package, use the `ota_from_target_files` tool with the `target_files` zip files of the old version (the one you want to update from) and the new one (the one you want to update to).

For example, to generate an incremental package to update from version A to version B:

1. You must have created the `signed-target_files` zip for version A, `A-signed-target_files.zip` and version B, `B-signed-target_files.zip`. See Sign for release.

2. Change to the directory where the source code is installed.

``$cd dea-11.0-r2`` 3. Run the following command: ``````$ ota_from_target_files \
-k ~/android-certs/releasekey \
-i A-signed-target_files.zip B-signed-target_files.zip \
A_to_B-incremental-ota-update.zip``````
 To install the update package `A_to_B-incremental-ota-update.zip` in your ConnectCore 8X, follow the steps in Update Android with OTA packages.

The incremental package is only applicable to devices running exactly the same previous build used as the incremental package’s starting point. In this example, the `A_to_B-incremental-ota-update.zip` can only be installed on a device that has A version.

 To establish a secure environment where the access to the private key is restricted, see Release in a secure environment.

## Update package with wipe data support

The `ota_from_target_files` tool includes several options for the generation of ota update packages. One of them is the possibility to wipe the user data partition when an ota package is installed.

Use the `--wipe_user_data` option of this tool to create an update package with wipe data partition support:

``````\$ ota_from_target_files \
--wipe_user_data out/dist/signed-target_files.zip \
out/dist/full-ota-update-wipe_data.zip``````