summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor O'Brien <connoro@google.com>2016-11-18 21:16:53 +0100
committergitbuildkicker <android-build@google.com>2016-11-18 23:43:00 +0100
commitf019ab400a2745b69f9bbd32b0ac438e50addf2f (patch)
tree428491b485f1aea1bce01274253813d024ceda69
parentConvert update_verifier to boot HIDL HAL am: 86199a47e1 (diff)
downloadandroid_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar.gz
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar.bz2
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar.lz
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar.xz
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.tar.zst
android_bootable_recovery-f019ab400a2745b69f9bbd32b0ac438e50addf2f.zip
Diffstat (limited to '')
-rw-r--r--update_verifier/Android.mk5
-rw-r--r--update_verifier/update_verifier.cpp31
2 files changed, 15 insertions, 21 deletions
diff --git a/update_verifier/Android.mk b/update_verifier/Android.mk
index 5d118f873..c822999f3 100644
--- a/update_verifier/Android.mk
+++ b/update_verifier/Android.mk
@@ -24,10 +24,7 @@ LOCAL_SHARED_LIBRARIES := \
libbase \
libcutils \
libhardware \
- liblog \
- libutils \
- libhidl \
- android.hardware.boot@1.0
+ 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 <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <cutils/properties.h>
-#include <android/hardware/boot/1.0/IBootControl.h>
-
-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 <hardware/boot_control.h>
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<IBootControl> 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<int32_t>(is_successful);
+ boot_control_module_t* module = reinterpret_cast<boot_control_module_t*>(
+ const_cast<hw_module_t*>(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.";