Revert^2 "Boot VM without bootloader - using init ramdisk"
Remove ABL from the boot flow of VMs. Virtualization service uses
microdroid.json to construct the appropriate vm_config.
Partitions:
1. Boot related partitions (boot/init_boot/vendor_boot) are no more
required. kernel & init ramdisk is directly passed via crosvm command
line.
2. uboot_env is obsolete without ABL
3. bootconfig partition is no more required because we are attaching the
bootconfigs to initrd image.
This reverts commit 0f71596bd5333f08d07ed33dbb5425390dd8aa79
Bug: 240235424
Test: atest MicrodroidTestCase
Change-Id: I1b4c3ec792db9898093c4ccd3c037657c50a934f
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 3b75df9..b35f8da 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -632,7 +632,7 @@
vm_config.numCpus = config.numCpus;
vm_config.taskProfiles = config.taskProfiles.clone();
- // Microdroid requires an additional payload disk image and the bootconfig partition.
+ // Microdroid requires an additional init ramdisk & payload disk image
if os_name == "microdroid" {
add_microdroid_images(
config,
diff --git a/virtualizationservice/src/payload.rs b/virtualizationservice/src/payload.rs
index 675ca50..06b9716 100644
--- a/virtualizationservice/src/payload.rs
+++ b/virtualizationservice/src/payload.rs
@@ -360,6 +360,21 @@
vm_payload_config: &VmPayloadConfig,
vm_config: &mut VirtualMachineRawConfig,
) -> Result<()> {
+ let debug_suffix = match config.debugLevel {
+ DebugLevel::NONE => "normal",
+ DebugLevel::APP_ONLY => "app_debuggable",
+ DebugLevel::FULL => "full_debuggable",
+ _ => return Err(anyhow!("unsupported debug level: {:?}", config.debugLevel)),
+ };
+ let initrd = format!("/apex/com.android.virt/etc/microdroid_initrd_{}.img", debug_suffix);
+ vm_config.initrd = Some(open_parcel_file(Path::new(&initrd), false)?);
+
+ let instance_img = Partition {
+ label: "vm-instance".to_owned(),
+ image: Some(ParcelFileDescriptor::new(instance_file)),
+ writable: true,
+ };
+ vm_config.disks.push(DiskImage { image: None, partitions: vec![instance_img], writable: true });
vm_config.disks.push(make_payload_disk(
config,
apk_file,
@@ -368,34 +383,6 @@
temporary_directory,
)?);
- vm_config.disks[1].partitions.push(Partition {
- label: "vbmeta".to_owned(),
- image: Some(open_parcel_file(
- Path::new("/apex/com.android.virt/etc/fs/microdroid_vbmeta_bootconfig.img"),
- false,
- )?),
- writable: false,
- });
- let bootconfig_image = "/apex/com.android.virt/etc/fs/microdroid_bootconfig.".to_owned()
- + match config.debugLevel {
- DebugLevel::NONE => "normal",
- DebugLevel::APP_ONLY => "app_debuggable",
- DebugLevel::FULL => "full_debuggable",
- _ => return Err(anyhow!("unsupported debug level: {:?}", config.debugLevel)),
- };
- vm_config.disks[1].partitions.push(Partition {
- label: "bootconfig".to_owned(),
- image: Some(open_parcel_file(Path::new(&bootconfig_image), false)?),
- writable: false,
- });
-
- // instance image is at the second partition in the second disk.
- vm_config.disks[1].partitions.push(Partition {
- label: "vm-instance".to_owned(),
- image: Some(ParcelFileDescriptor::new(instance_file)),
- writable: true,
- });
-
Ok(())
}