Dump the root digest of hashtree for dm-verity partitions
It's requested by the partner engineering team to uniquely
identify a partition.
Bug: 197973981
Test: boot the device and check props
Change-Id: I0f7aa34dd0087f0698fe90b9df6c0eae06fc4f5d
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 7633d9c..994eed9 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -894,9 +894,11 @@
std::string partition = entry.mount_point == "/" ? "system" : Basename(entry.mount_point);
SetProperty("partition." + partition + ".verified", std::to_string(mode));
- std::string hash_alg = fs_mgr_get_hashtree_algorithm(entry);
- if (!hash_alg.empty()) {
- SetProperty("partition." + partition + ".verified.hash_alg", hash_alg);
+ auto hashtree_info = fs_mgr_get_hashtree_info(entry);
+ if (hashtree_info) {
+ SetProperty("partition." + partition + ".verified.hash_alg", hashtree_info->algorithm);
+ SetProperty("partition." + partition + ".verified.root_digest",
+ hashtree_info->root_digest);
}
}