BootControl: blow AR on boot complete am: 9ecd004e6b
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs101/+/18743149 Change-Id: Ia3afba597327e15cc669bcb802d293d19b390d03 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f19c6136b4
1 changed files with 18 additions and 1 deletions
|
@ -49,6 +49,8 @@ namespace {
|
||||||
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
||||||
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
||||||
|
|
||||||
|
#define BLOW_AR_PATH "/sys/kernel/boot_control/blow_ar"
|
||||||
|
|
||||||
// slot flags
|
// slot flags
|
||||||
#define AB_ATTR_PRIORITY_SHIFT 52
|
#define AB_ATTR_PRIORITY_SHIFT 52
|
||||||
#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT)
|
#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT)
|
||||||
|
@ -174,6 +176,11 @@ static void DevInfoInitSlot(devinfo_ab_slot_data_t &slot_data) {
|
||||||
slot_data.fastboot_ok = 0;
|
slot_data.fastboot_ok = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool blowAR() {
|
||||||
|
android::base::unique_fd fd(open(BLOW_AR_PATH, O_WRONLY | O_DSYNC));
|
||||||
|
return android::base::WriteStringToFd("1", fd);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
|
// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
|
||||||
|
@ -211,7 +218,17 @@ Return<void> BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) {
|
||||||
ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL);
|
ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
!ret ? _hidl_cb({false, "Failed to set successful flag"}) : _hidl_cb({true, ""});
|
if (!ret) {
|
||||||
|
_hidl_cb({false, "Failed to set successful flag"});
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!blowAR()) {
|
||||||
|
ALOGE("Failed to blow anti-rollback counter");
|
||||||
|
// Ignore the error, since ABL will re-trigger it on reboot
|
||||||
|
}
|
||||||
|
|
||||||
|
_hidl_cb({true, ""});
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue