Enable pkvm based on the relevant sysprop rather than /dev/kvm am: 4ff69cacdf
Original change: https://android-review.googlesource.com/c/device/google/gs101/+/3128013 Change-Id: I7ceeb6d178b83f9029bcc4fd3e28fc33c8ce56e9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
34a69be411
2 changed files with 7 additions and 18 deletions
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <log/log.h>
|
||||
|
||||
#define KVM_DEVICE "/dev/kvm"
|
||||
#define MISC_WRITER "/vendor/bin/misc_writer"
|
||||
|
||||
int main() {
|
||||
|
@ -33,22 +32,7 @@ int main() {
|
|||
pid_t pid;
|
||||
int ret, wstatus;
|
||||
|
||||
/* Check whether KVM device exists. */
|
||||
ret = access(KVM_DEVICE, F_OK);
|
||||
|
||||
/* If KVM device exists, return SUCCESS to continue booting. */
|
||||
if (ret == 0) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (ret != -ENOENT) {
|
||||
ALOGW("Unexpected error from access(): %d", ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* If KVM device does not exist, run misc_writer and return FAILURE
|
||||
* to force a reboot.
|
||||
*/
|
||||
/* Run misc_writer and return FAILURE to force a reboot. */
|
||||
pid = fork();
|
||||
if (pid == -1) {
|
||||
ALOGE("Could not fork: %d", errno);
|
||||
|
|
|
@ -2,5 +2,10 @@ service pkvm_enabler /vendor/bin/pkvm_enabler
|
|||
reboot_on_failure reboot,pkvm-not-enabled
|
||||
user root
|
||||
|
||||
on early-init
|
||||
# Old bootloaders do not set the protected_vm sysprop when pkvm is disabled
|
||||
on early-init && property:ro.boot.hypervisor.protected_vm.supported=
|
||||
exec_start pkvm_enabler
|
||||
|
||||
# New bootloaders set the protected_vm sysprop to 0 when pkvm is disabled
|
||||
on early-init && property:ro.boot.hypervisor.protected_vm.supported=0
|
||||
exec_start pkvm_enabler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue