gs-common: bootctrl: integrate blowAR() for gs101 & zuma
Common bootcontrol use zuma version for the base, and blowAR() can't be used by gs101. So we need to port ag/18743149 into common bootcontrol. Bug: 313615120 Change-Id: I25febde96a56279e6592a6d7740be9a2e385543b Signed-off-by: Jason Chiu <jasoncschiu@google.com>
This commit is contained in:
parent
2a201a74c2
commit
ec2a9a0c7a
2 changed files with 43 additions and 2 deletions
|
@ -50,6 +50,8 @@ namespace {
|
|||
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
||||
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
||||
|
||||
#define BLOW_AR_PATH "/sys/kernel/boot_control/blow_ar"
|
||||
|
||||
// slot flags
|
||||
#define AB_ATTR_PRIORITY_SHIFT 52
|
||||
#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT)
|
||||
|
@ -230,7 +232,7 @@ static int blow_otp_AR(bool secure) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool blowAR() {
|
||||
static bool blowAR_zuma() {
|
||||
int ret = blow_otp_AR(true);
|
||||
if (ret) {
|
||||
ALOGI("Blow secure anti-rollback OTP failed");
|
||||
|
@ -245,6 +247,25 @@ static bool blowAR() {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool blowAR_gs101() {
|
||||
android::base::unique_fd fd(open(BLOW_AR_PATH, O_WRONLY | O_DSYNC));
|
||||
return android::base::WriteStringToFd("1", fd);
|
||||
}
|
||||
|
||||
static bool blowAR() {
|
||||
char platform[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.boot.hardware.platform", platform, "");
|
||||
|
||||
if (std::string(platform) == "gs101") {
|
||||
return blowAR_gs101();
|
||||
} else if (std::string(platform) == "gs201" || std::string(platform) == "zuma") {
|
||||
return blowAR_zuma();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace {
|
|||
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
||||
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
||||
|
||||
#define BLOW_AR_PATH "/sys/kernel/boot_control/blow_ar"
|
||||
|
||||
// slot flags
|
||||
#define AB_ATTR_PRIORITY_SHIFT 52
|
||||
#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT)
|
||||
|
@ -227,7 +229,7 @@ static int blow_otp_AR(bool secure) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool blowAR() {
|
||||
static bool blowAR_zuma() {
|
||||
int ret = blow_otp_AR(true);
|
||||
if (ret) {
|
||||
ALOGI("Blow secure anti-rollback OTP failed");
|
||||
|
@ -243,6 +245,24 @@ static bool blowAR() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool blowAR_gs101() {
|
||||
::android::base::unique_fd fd(open(BLOW_AR_PATH, O_WRONLY | O_DSYNC));
|
||||
return ::android::base::WriteStringToFd("1", fd);
|
||||
}
|
||||
|
||||
static bool blowAR() {
|
||||
char platform[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.boot.hardware.platform", platform, "");
|
||||
|
||||
if (std::string(platform) == "gs101") {
|
||||
return blowAR_gs101();
|
||||
} else if (std::string(platform) == "gs201" || std::string(platform) == "zuma") {
|
||||
return blowAR_zuma();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static constexpr MergeStatus ToAIDLMergeStatus(HIDLMergeStatus status) {
|
||||
switch (status) {
|
||||
case HIDLMergeStatus::NONE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue