Skip to content

Commit

Permalink
Use vbmeta digest to detect same-version upgrades
Browse files Browse the repository at this point in the history
When using Custota in conjunction with avbroot, there may be situations
where a new patched OTA has the same version as the currently running
OS. The most common example is updating Magisk.

With this commit, if the OTA's fingerprint matches the current OS
fingerprint, Custota will compare the vbmeta digest to determine if an
update is necessary. This should reliably detect every scenario where
the OTA's version is the same, but the partition contents differ.

The vbmeta digest is not readily accessible in an OTA, so custota-tool
will compute it when generating the csig file. This is an unfortunately
an expensive operation that requires extracting partitions from the OTA,
so it will slow down custota-tool a decent bit.

Because Custota's csig file parser is strict, the file format version
has been bumped to version 2. csig files generated by a new version of
custota-tool are incompatible with old versions of Custota. However, new
versions of Custota can continue to read old version 1 csig files. It
will fall back to the old behavior when encountering an old csig file.

Fixes: #38

Signed-off-by: Andrew Gunnerson <[email protected]>
  • Loading branch information
chenxiaolong committed Oct 14, 2024
1 parent 455bf0a commit 29304c8
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 127 deletions.
201 changes: 99 additions & 102 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 29304c8

Please sign in to comment.