From 9184f2b445739b9ac21b179302323eafae71c782 Mon Sep 17 00:00:00 2001 From: Connor O'Brien Date: Fri, 18 Nov 2016 02:13:10 +0000 Subject: Revert "Convert update_verifier to boot HIDL HAL" This reverts commit 13716c29c9e222045eab1edcc944eb23c8198e6a. Change-Id: Ib8d23e3e7ab0e3870d1b007fa8abd91a3980c287 --- update_verifier/Android.mk | 9 +-------- update_verifier/update_verifier.cpp | 31 ++++++++++++++----------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/update_verifier/Android.mk b/update_verifier/Android.mk index 5d118f873..090db998b 100644 --- a/update_verifier/Android.mk +++ b/update_verifier/Android.mk @@ -20,14 +20,7 @@ LOCAL_CLANG := true LOCAL_SRC_FILES := update_verifier.cpp LOCAL_MODULE := update_verifier -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhardware \ - liblog \ - libutils \ - libhidl \ - android.hardware.boot@1.0 +LOCAL_SHARED_LIBRARIES := libbase libcutils libhardware liblog LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. LOCAL_CFLAGS := -Werror diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp index e97a3adba..93ac605b1 100644 --- a/update_verifier/update_verifier.cpp +++ b/update_verifier/update_verifier.cpp @@ -45,12 +45,7 @@ #include #include #include -#include - -using android::sp; -using android::hardware::boot::V1_0::IBootControl; -using android::hardware::boot::V1_0::BoolResult; -using android::hardware::boot::V1_0::CommandResult; +#include constexpr auto CARE_MAP_FILE = "/data/ota_package/care_map.txt"; constexpr int BLOCKSIZE = 4096; @@ -147,18 +142,21 @@ int main(int argc, char** argv) { LOG(INFO) << "Started with arg " << i << ": " << argv[i]; } - sp module = IBootControl::getService("bootctrl"); - if (module == nullptr) { + const hw_module_t* hw_module; + if (hw_get_module("bootctrl", &hw_module) != 0) { LOG(ERROR) << "Error getting bootctrl module."; return -1; } - uint32_t current_slot = module->getCurrentSlot(); - BoolResult is_successful = module->isSlotMarkedSuccessful(current_slot); - LOG(INFO) << "Booting slot " << current_slot << ": isSlotMarkedSuccessful=" - << static_cast(is_successful); + boot_control_module_t* module = reinterpret_cast( + const_cast(hw_module)); + module->init(module); + + unsigned current_slot = module->getCurrentSlot(module); + int is_successful= module->isSlotMarkedSuccessful(module, current_slot); + LOG(INFO) << "Booting slot " << current_slot << ": isSlotMarkedSuccessful=" << is_successful; - if (is_successful == BoolResult::FALSE) { + if (is_successful == 0) { // The current slot has not booted successfully. char verity_mode[PROPERTY_VALUE_MAX]; if (property_get("ro.boot.veritymode", verity_mode, "") == -1) { @@ -177,10 +175,9 @@ int main(int argc, char** argv) { return -1; } - CommandResult cr; - module->markBootSuccessful([&cr](CommandResult result) { cr = result; }); - if (!cr.success) { - LOG(ERROR) << "Error marking booted successfully: " << cr.errMsg; + int ret = module->markBootSuccessful(module); + if (ret != 0) { + LOG(ERROR) << "Error marking booted successfully: " << strerror(-ret); return -1; } LOG(INFO) << "Marked slot " << current_slot << " as booted successfully."; -- cgit v1.2.3