Enable debug mode
When the debug mode is enabled, an extra bootconfig partition for the
debug mode is used. The bootconfig partition currently disables Selinux.
Bug: 185211964
Test: vm /data/local/tmp/MicrodroidTestApp.apk
/data/local/tmp/MicrodroidApp.apk.idsig assets/config.json --debug
Change-Id: I25a20b75b6d216395fe7579729a61bcbdb8dd395
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 5c0c3b8..dc22e99 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -44,7 +44,7 @@
use std::os::unix::io::AsRawFd;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, Weak};
-use vmconfig::VmConfig;
+use vmconfig::{VmConfig, Partition};
use zip::ZipArchive;
pub const BINDER_SERVICE_IDENTIFIER: &str = "android.system.virtualizationservice";
@@ -319,7 +319,7 @@
let vm_config_file = File::open(vm_config_path)?;
let mut vm_config = VmConfig::load(&vm_config_file)?;
- // Microdroid requires additional payload disk image
+ // Microdroid requires additional payload disk image and the bootconfig partition
if os_name == "microdroid" {
let mut apexes = vm_payload_config.apexes.clone();
apexes.extend(
@@ -335,6 +335,16 @@
&apexes,
temporary_directory,
)?);
+
+ if config.debug {
+ vm_config.disks[1].partitions.push(Partition {
+ label: "bootconfig".to_owned(),
+ paths: vec![PathBuf::from(
+ "/apex/com.android.virt/etc/microdroid_bootconfig.debug",
+ )],
+ writable: false,
+ });
+ }
}
vm_config.to_parcelable()