Add support for multiple GKI versions on VM
virt apex can now have multiple GKI versions for microdroid. Here are
behavior changes.
- OS name with "microdroid_gki-{ver}" is used to specify GKI.
- vm info shows available versions.
- gki option of vm tool gets a parameter, e.g. "--gki 6.1".
Some codes are refactored.
- Android.bp: defaults modules are added for deduplication.
- sign_virt_apex.py: gki_versions are added to remove hard-coded
version (6.1).
Bug: 302465542
Test: vm info, vm run-microdroid --gki 6.1
Test: sign_virt_apex_test
Change-Id: I443a9e5a98d20d3c9337f2c13156590b4538c90b
diff --git a/virtualizationmanager/src/aidl.rs b/virtualizationmanager/src/aidl.rs
index 6ae3bbd..600c912 100644
--- a/virtualizationmanager/src/aidl.rs
+++ b/virtualizationmanager/src/aidl.rs
@@ -66,6 +66,7 @@
use log::{debug, error, info, warn};
use microdroid_payload_config::{OsConfig, Task, TaskType, VmPayloadConfig};
use nix::unistd::pipe;
+use regex::Regex;
use rpcbinder::RpcServer;
use rustutils::system_properties;
use semver::VersionReq;
@@ -101,8 +102,6 @@
const MICRODROID_OS_NAME: &str = "microdroid";
-const MICRODROID_GKI_OS_NAME: &str = "microdroid_gki";
-
const UNFORMATTED_STORAGE_MAGIC: &str = "UNFORMATTED-STORAGE";
/// Roughly estimated sufficient size for storing vendor public key into DTBO.
@@ -115,6 +114,8 @@
pub static ref GLOBAL_SERVICE: Strong<dyn IVirtualizationServiceInternal> =
wait_for_interface(BINDER_SERVICE_IDENTIFIER)
.expect("Could not connect to VirtualizationServiceInternal");
+ static ref MICRODROID_GKI_OS_NAME_PATTERN: Regex =
+ Regex::new(r"^microdroid_gki-\d+\.\d+$").expect("Failed to construct Regex");
}
fn create_or_update_idsig_file(
@@ -698,12 +699,12 @@
fn is_valid_os(os_name: &str) -> bool {
if os_name == MICRODROID_OS_NAME {
- return true;
+ true
+ } else if cfg!(vendor_modules) && MICRODROID_GKI_OS_NAME_PATTERN.is_match(os_name) {
+ PathBuf::from(format!("/apex/com.android.virt/etc/{}.json", os_name)).exists()
+ } else {
+ false
}
- if cfg!(vendor_modules) && os_name == MICRODROID_GKI_OS_NAME {
- return true;
- }
- false
}
fn load_app_config(