diff options
author | Bowgo Tsai <bowgotsai@google.com> | 2017-04-13 21:17:48 +0800 |
---|---|---|
committer | Bowgo Tsai <bowgotsai@google.com> | 2017-04-15 09:47:31 +0800 |
commit | 1a898c25f96150787b39d9a08ebdb9ab6fcb3846 (patch) | |
tree | bbbd06698ef825c1fbf58b3fa3cf0cf1d39cf42c /fs_mgr | |
parent | 82bd278dc4ed6e62b0aebec84cb2bde793823b35 (diff) | |
download | system_core-1a898c25f96150787b39d9a08ebdb9ab6fcb3846.tar.gz system_core-1a898c25f96150787b39d9a08ebdb9ab6fcb3846.tar.bz2 system_core-1a898c25f96150787b39d9a08ebdb9ab6fcb3846.zip |
Set libavb version into system property for Treble OTA
Set ro.boot.avb_version to "AVB_VERSION_MAJOR.AVB_VERSION_MINOR".
During Treble OTA match, the major version must be the same as that in
the avb metadata on disk, while the minor version can be equal or
greater to that in the avb metadata on disk.
See how avb versioning work on the following link:
https://android-review.googlesource.com/#/c/342757/
Also renames AvbHashtreeDisabled() -> hashtree_disabled().
Bug: 35322304
Test: Early mount with AVB, checks [ro.boot.avb_version]: [1.0] exists.
Test: Not enable AVB, checks [ro.boot.avb_version] doesn't exists.
Change-Id: I5aaf476ca53c4fe817779518ba14b68ebcfdc6d6
Diffstat (limited to 'fs_mgr')
-rw-r--r-- | fs_mgr/fs_mgr_avb.cpp | 4 | ||||
-rw-r--r-- | fs_mgr/include/fs_mgr_avb.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fs_mgr/fs_mgr_avb.cpp b/fs_mgr/fs_mgr_avb.cpp index 7c82bb1e6..83bf8a778 100644 --- a/fs_mgr/fs_mgr_avb.cpp +++ b/fs_mgr/fs_mgr_avb.cpp @@ -493,6 +493,10 @@ FsManagerAvbUniquePtr FsManagerAvbHandle::Open(const std::string& device_file_by return nullptr; } + // Sets the MAJOR.MINOR for init to set it into "ro.boot.avb_version". + avb_handle->avb_version_ = + android::base::StringPrintf("%d.%d", AVB_VERSION_MAJOR, AVB_VERSION_MINOR); + // Verifies vbmeta images against the digest passed from bootloader. if (!avb_verifier->VerifyVbmetaImages(*avb_handle->avb_slot_data_)) { LERROR << "VerifyVbmetaImages failed"; diff --git a/fs_mgr/include/fs_mgr_avb.h b/fs_mgr/include/fs_mgr_avb.h index 526a5ce06..a66ff42cc 100644 --- a/fs_mgr/include/fs_mgr_avb.h +++ b/fs_mgr/include/fs_mgr_avb.h @@ -72,7 +72,8 @@ class FsManagerAvbHandle { // Otherwise, returns false. bool SetUpAvb(fstab_rec* fstab_entry, bool wait_for_verity_dev); - bool AvbHashtreeDisabled() { return status_ == kFsManagerAvbHandleHashtreeDisabled; } + bool hashtree_disabled() const { return status_ == kFsManagerAvbHandleHashtreeDisabled; } + const std::string& avb_version() const { return avb_version_; } FsManagerAvbHandle(const FsManagerAvbHandle&) = delete; // no copy FsManagerAvbHandle& operator=(const FsManagerAvbHandle&) = delete; // no assignment @@ -92,6 +93,7 @@ class FsManagerAvbHandle { private: AvbSlotVerifyData* avb_slot_data_; FsManagerAvbHandleStatus status_; + std::string avb_version_; }; #endif /* __CORE_FS_MGR_AVB_H */ |