misc.img is not needed

misc.img was needed by the uboot bootloader that microdroid is using.
The bootloader uses the partition to read the boot mode (normal,
recovery, and bootloader) that is set during the previous boot.

However, boot mode doesn't make sense for microdroid. So we delete it.

Unfortunately, deleting it is not trivial because uboot demands us to
anyway provide the location of the misc partition with the
`boot_android` command.

This change works around the restriction by letting the bootloader use
the first partition (which currently is the boot_a partition) as the
misc partition. We do that by giving only the disk number (0) and not
the partition name (as in 0#misc). Then uboot by default chooses the
first partition as the misc partition, and find that it is not a correct
misc partition. In that case, it falls back to the 'normal' boot which
we want.

Bug: 191131043
Test: atest MicrodroidHostTestCases
Change-Id: If2e49d1da9f75c805bc0d0f33e3f221b12dd220e
diff --git a/microdroid/README.md b/microdroid/README.md
index c2a65d5..ebf2244 100644
--- a/microdroid/README.md
+++ b/microdroid/README.md
@@ -53,10 +53,6 @@
     {
       "partitions": [
         {
-          "label": "misc",
-          "path": "/data/local/tmp/microdroid/misc.img"
-        },
-        {
           "label": "boot_a",
           "path": "/apex/com.android.virt/etc/fs/microdroid_boot-5.10.img"
         },
@@ -131,7 +127,6 @@
 ```sh
 $ adb root
 $ adb shell 'mkdir /data/local/tmp/microdroid'
-$ adb shell 'dd if=/dev/zero of=/data/local/tmp/microdroid/misc.img bs=4k count=256'
 $ adb push payload.json /data/local/tmp/microdroid/payload.json
 $ adb shell 'cd /data/local/tmp/microdroid; /apex/com.android.virt/bin/mk_payload payload.json payload.img'
 $ adb shell 'chmod go+r /data/local/tmp/microdroid/payload*'
diff --git a/microdroid/microdroid_cdisk.json b/microdroid/microdroid_cdisk.json
index e1ca826..5e3c9c5 100644
--- a/microdroid/microdroid_cdisk.json
+++ b/microdroid/microdroid_cdisk.json
@@ -1,10 +1,6 @@
 {
   "partitions": [
     {
-      "label": "misc",
-      "path": "/data/local/tmp/virt/misc.img"
-    },
-    {
       "label": "boot_a",
       "path": "/apex/com.android.virt/etc/fs/microdroid_boot-5.10.img"
     },
diff --git a/microdroid/uboot-env-x86_64.txt b/microdroid/uboot-env-x86_64.txt
index ffc0462..dfa6a98 100644
--- a/microdroid/uboot-env-x86_64.txt
+++ b/microdroid/uboot-env-x86_64.txt
@@ -1,7 +1,7 @@
 # Static u-boot environment variables for microdroid. See b/180481192
 
 # Boot the device following the Android boot procedure
-bootcmd=avb init virtio 0 && avb verify _a && boot_android virtio 0#misc
+bootcmd=avb init virtio 0 && avb verify _a && boot_android virtio 0
 
 bootdelay=0
 
diff --git a/microdroid/uboot-env.txt b/microdroid/uboot-env.txt
index 0bdc591..47b8f2c 100644
--- a/microdroid/uboot-env.txt
+++ b/microdroid/uboot-env.txt
@@ -1,7 +1,7 @@
 # Static u-boot environment variables for microdroid. See b/180481192
 
 # Boot the device following the Android boot procedure
-bootcmd=avb init virtio 0 && avb verify _a && boot_android virtio 0#misc
+bootcmd=avb init virtio 0 && avb verify _a && boot_android virtio 0
 
 bootdelay=0
 fdtaddr=0x80000000