Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vbmeta digest to detect same-version upgrades #92

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

chenxiaolong
Copy link
Owner

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

@chenxiaolong chenxiaolong self-assigned this Oct 14, 2024
@chenxiaolong
Copy link
Owner Author

This depends on avbroot 3.8.0's new feature for computing vbmeta digests: chenxiaolong/avbroot#363.

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]>
chenxiaolong added a commit that referenced this pull request Oct 14, 2024
Signed-off-by: Andrew Gunnerson <[email protected]>
@chenxiaolong chenxiaolong merged commit 29304c8 into master Oct 14, 2024
6 checks passed
@chenxiaolong chenxiaolong deleted the vbmeta-digest branch October 14, 2024 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trying to install an update via file path, getting "OS already up to date" message
1 participant