tool provided in
build/make/tools/releasetools can build two types
of package: full and incremental. This applies both to devices using
A/B system updates and
non-A/B system updates. The tool takes
.zip file produced by the Android build
system as input.
A full update is one where the entire final state of the device (system, boot, and recovery partitions) is contained in the package. As long as the device is capable of receiving and applying the package, the package can install the desired build regardless of the current state of the device.
Example: Using the release tools to build a full update for the hypothetical tardis device:
# first, build the target-files .zip
. build/envsetup.sh && lunch tardis-eng
make dist DIST_DIR=dist_output
.zip contains everything needed to construct
./build/make/tools/releasetools/ota_from_target_files \ dist_output/tardis-target_files.zip \ ota_update.zip
ota_update.zip is now ready to be sent to test devices
(everything is signed with the test key). For user devices, generate and use
your own private keys as detailed in
Signing builds for release.
An incremental update contains a set of binary patches to be applied to the data already on the device. This can result in considerably smaller update packages:
- Files that have not changed don't need to be included.
- Files that have changed are often very similar to their previous versions, so the package need only contain an encoding of the differences between the two files.
You can install the incremental update package only on a device that has the
old or source build used when constructing the package. To build an incremental
update, you need the target_files
.zip from the previous build (the
one you want to update from) as well as the target_files
.zip from the new build.
./build/make/tools/releasetools/ota_from_target_files \ -i PREVIOUS-tardis-target_files.zip \ dist_output/tardis-target_files.zip \ incremental_ota_update.zip # make incremental from the older version
This build is very similar to the previous build, and the incremental update package is much smaller than the corresponding full update (about 1 MB instead of 60 MB).
Distribute an incremental package only to devices running exactly the same
previous build used as the incremental package's starting point. You must flash
the images in
PREVIOUS-tardis-img.zip (both built with
make dist, to
be flashed with
fastboot update), instead of the ones under the
PRODUCT_OUT directory (built with
make, which will be
fastboot flashall). Attempting to install the
incremental package on a device with some other build results in an installation
error. When the install fails, the device will remain in the same working state
(running the old system); the package verifies the previous state of all the
files it updates before touching them, so the device shouldn't be left in a half
upgraded state if this occurs.