Merge "Revert "Convert update_verifier to boot HIDL HAL"" into nyc-mr1-dev-plus-aosp
This commit is contained in:
commit
692e95aa87
2 changed files with 15 additions and 25 deletions
|
@ -20,14 +20,7 @@ LOCAL_CLANG := true
|
||||||
LOCAL_SRC_FILES := update_verifier.cpp
|
LOCAL_SRC_FILES := update_verifier.cpp
|
||||||
|
|
||||||
LOCAL_MODULE := update_verifier
|
LOCAL_MODULE := update_verifier
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := libbase libcutils libhardware liblog
|
||||||
libbase \
|
|
||||||
libcutils \
|
|
||||||
libhardware \
|
|
||||||
liblog \
|
|
||||||
libutils \
|
|
||||||
libhidl \
|
|
||||||
android.hardware.boot@1.0
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
|
||||||
LOCAL_CFLAGS := -Werror
|
LOCAL_CFLAGS := -Werror
|
||||||
|
|
|
@ -45,12 +45,7 @@
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <android-base/unique_fd.h>
|
#include <android-base/unique_fd.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <android/hardware/boot/1.0/IBootControl.h>
|
#include <hardware/boot_control.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;
|
|
||||||
|
|
||||||
constexpr auto CARE_MAP_FILE = "/data/ota_package/care_map.txt";
|
constexpr auto CARE_MAP_FILE = "/data/ota_package/care_map.txt";
|
||||||
constexpr int BLOCKSIZE = 4096;
|
constexpr int BLOCKSIZE = 4096;
|
||||||
|
@ -147,18 +142,21 @@ int main(int argc, char** argv) {
|
||||||
LOG(INFO) << "Started with arg " << i << ": " << argv[i];
|
LOG(INFO) << "Started with arg " << i << ": " << argv[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<IBootControl> module = IBootControl::getService("bootctrl");
|
const hw_module_t* hw_module;
|
||||||
if (module == nullptr) {
|
if (hw_get_module("bootctrl", &hw_module) != 0) {
|
||||||
LOG(ERROR) << "Error getting bootctrl module.";
|
LOG(ERROR) << "Error getting bootctrl module.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t current_slot = module->getCurrentSlot();
|
boot_control_module_t* module = reinterpret_cast<boot_control_module_t*>(
|
||||||
BoolResult is_successful = module->isSlotMarkedSuccessful(current_slot);
|
const_cast<hw_module_t*>(hw_module));
|
||||||
LOG(INFO) << "Booting slot " << current_slot << ": isSlotMarkedSuccessful="
|
module->init(module);
|
||||||
<< static_cast<int32_t>(is_successful);
|
|
||||||
|
|
||||||
if (is_successful == BoolResult::FALSE) {
|
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 == 0) {
|
||||||
// The current slot has not booted successfully.
|
// The current slot has not booted successfully.
|
||||||
char verity_mode[PROPERTY_VALUE_MAX];
|
char verity_mode[PROPERTY_VALUE_MAX];
|
||||||
if (property_get("ro.boot.veritymode", verity_mode, "") == -1) {
|
if (property_get("ro.boot.veritymode", verity_mode, "") == -1) {
|
||||||
|
@ -177,10 +175,9 @@ int main(int argc, char** argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult cr;
|
int ret = module->markBootSuccessful(module);
|
||||||
module->markBootSuccessful([&cr](CommandResult result) { cr = result; });
|
if (ret != 0) {
|
||||||
if (!cr.success) {
|
LOG(ERROR) << "Error marking booted successfully: " << strerror(-ret);
|
||||||
LOG(ERROR) << "Error marking booted successfully: " << cr.errMsg;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Marked slot " << current_slot << " as booted successfully.";
|
LOG(INFO) << "Marked slot " << current_slot << " as booted successfully.";
|
||||||
|
|
Loading…
Reference in a new issue