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 /init/init.cpp | |
| parent | 82bd278dc4ed6e62b0aebec84cb2bde793823b35 (diff) | |
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 'init/init.cpp')
| -rw-r--r-- | init/init.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/init/init.cpp b/init/init.cpp index 6c1c541282..181b18d0b4 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -1010,10 +1010,11 @@ static bool vboot_2_0_mount_partitions(const std::vector<fstab_rec*>& fstab_recs return false; } + setenv("INIT_AVB_VERSION", avb_handle->avb_version().c_str(), 1); for (auto rec : fstab_recs) { bool need_create_dm_device = false; if (fs_mgr_is_avb(rec)) { - if (avb_handle->AvbHashtreeDisabled()) { + if (avb_handle->hashtree_disabled()) { LOG(INFO) << "avb hashtree disabled for '" << rec->mount_point << "'"; } else if (avb_handle->SetUpAvb(rec, false /* wait_for_verity_dev */)) { need_create_dm_device = true; @@ -1362,12 +1363,14 @@ int main(int argc, char** argv) { property_set("ro.boottime.init.selinux", getenv("INIT_SELINUX_TOOK")); // Set libavb version for Framework-only OTA match in Treble build. - property_set("ro.boot.init.avb_version", std::to_string(AVB_MAJOR_VERSION).c_str()); + const char* avb_version = getenv("INIT_AVB_VERSION"); + if (avb_version) property_set("ro.boot.avb_version", avb_version); // Clean up our environment. unsetenv("INIT_SECOND_STAGE"); unsetenv("INIT_STARTED_AT"); unsetenv("INIT_SELINUX_TOOK"); + unsetenv("INIT_AVB_VERSION"); // Now set up SELinux for second stage. selinux_initialize(false); |
