After we did all the analysis of initrd.img for Android-x86, we can build a similar one for the Android emulator now. Be aware that this can work only with ranchu, but not with goldfish. The goldfish emulator uses an older version of QEMU and it doesn't support the additional storage devices for the emulator. To support the boot from initrd.img, we have to change the layout of the filesystem. It is not good to change the original filesystem image in AOSP. We will create another file image to be used for the boot with initrd.img.
In the ranchu emulator, the images are emulated as virtio block devices. After we start the emulator, we can inspect the mount points, as shown in the following screenshot. We can see that system.img is mounted as /dev/block/vda, userdata.img as /dev/block/vdb, and cache.img as /dev/block/vdc:
All partitions...