summaryrefslogtreecommitdiffstats
path: root/update_verifier
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@google.com>2017-05-08 19:41:28 +0200
committerDavid Zeuthen <zeuthen@google.com>2017-06-23 00:04:26 +0200
commit336cbce2526e4ce6990aed5b98d39814e6456ea2 (patch)
treef9dbc8f18918c8a1a2f6e3d0bf20c915dd3c1b6e /update_verifier
parentFix "No file_contexts" warning (diff)
downloadandroid_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar.gz
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar.bz2
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar.lz
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar.xz
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.tar.zst
android_bootable_recovery-336cbce2526e4ce6990aed5b98d39814e6456ea2.zip
Diffstat (limited to 'update_verifier')
-rw-r--r--update_verifier/Android.mk4
-rw-r--r--update_verifier/update_verifier.cpp21
2 files changed, 19 insertions, 6 deletions
diff --git a/update_verifier/Android.mk b/update_verifier/Android.mk
index 37d9bfed3..33c5fe9e7 100644
--- a/update_verifier/Android.mk
+++ b/update_verifier/Android.mk
@@ -39,6 +39,10 @@ ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
LOCAL_CFLAGS += -DPRODUCT_SUPPORTS_VERITY=1
endif
+ifeq ($(BOARD_AVB_ENABLE),true)
+LOCAL_CFLAGS += -DBOARD_AVB_ENABLE=1
+endif
+
include $(BUILD_STATIC_LIBRARY)
# update_verifier (executable)
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index fdbcfde56..d3a5185b8 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -99,12 +99,21 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
std::string content;
if (!android::base::ReadFileToString(path, &content)) {
PLOG(WARNING) << "Failed to read " << path;
- } else if (android::base::Trim(content) == partition) {
- dm_block_device = DEV_PATH + std::string(namelist[n]->d_name);
- while (n--) {
- free(namelist[n]);
+ } else {
+ std::string dm_block_name = android::base::Trim(content);
+#ifdef BOARD_AVB_ENABLE
+ // AVB is using 'vroot' for the root block device but we're expecting 'system'.
+ if (dm_block_name == "vroot") {
+ dm_block_name = "system";
+ }
+#endif
+ if (dm_block_name == partition) {
+ dm_block_device = DEV_PATH + std::string(namelist[n]->d_name);
+ while (n--) {
+ free(namelist[n]);
+ }
+ break;
}
- break;
}
free(namelist[n]);
}
@@ -229,7 +238,7 @@ int update_verifier(int argc, char** argv) {
if (is_successful == BoolResult::FALSE) {
// The current slot has not booted successfully.
-#ifdef PRODUCT_SUPPORTS_VERITY
+#if defined(PRODUCT_SUPPORTS_VERITY) || defined(BOARD_AVB_ENABLE)
std::string verity_mode = android::base::GetProperty("ro.boot.veritymode", "");
if (verity_mode.empty()) {
LOG(ERROR) << "Failed to get dm-verity mode.";