Android-x86 is great open-source project to bring Google’s Android OS to x86/AMD64-based computers by combining the pure AOSP source with x86 specific patches For myself, it’s the perfect way to launch an Android emulator.
This is a project to port Android open source project to x86 platform, formerly known as “patch hosting for android x86 support“. The original plan is to host different patches for android x86 support from open source community. A few months after we created the project, we found out that we could do much more than just hosting patches. So we decide to create our code base to provide support on different x86 platforms, and set up a git server to host it.https://www.android-x86.org/ – Retrieved Feb 26, 2020
For my latest round of tinkering, I required the latest and greatest version of Android: 10.0 (Previously code named “Android Q)”. Side note: You may notice there’s no catchy dessert name here. Android 10 drops the long-standing tradition of naming major releases after desserts (previous releases included 9.0 “Pie”, 8.0 “Oreo”, 7.0 “Nougat”, 6.0 “Marshmallow”, etc).
Unfortunately, at the time of writing, the latest stable version of Android x86 is 8.1, with 9.0 in Release Candidate status. Fortunately, the source code for 10.0 is available. So the ingredients are gathered, we just need to make the cake, with the understanding that some of the ingredients might not be so fresh. Building the project from source isn’t that tricky. The Android-x86 provides clear instructions (note for Ubuntu 18.04 users, the required
xmllint package is actually
libxml2-utils). However, there was one problem I kept running into. Repetitively.
I wanted a fresh environment to work with, so I fired up a Ubuntu VM in Proxmox. For hardware, I handed it 4 CPU cores, a 50GB HDD, and 1024GB of RAM balloonable to 8096GB. From a minimal headless deployment I install the required software to compile the source and we were off. Or so I thought.
First hurdle: The source is huge. 50GB was nowhere near enough space, so I resized the drive to 80GB. Still too small. So I resized it again to 100GB. Success, we now had the Android 10 x86 source. Time to compile.
Second hurdle: Build error. After scanning through the logs, I located the culprit: Out of Memory. Ballooning the RAM works great for day-to-day activities, but compiling an OS was a bit too intense. After allocating the full 8096GB to the OS with ballooning off, it was back to compiling.
First hurdle – the second coming: Storage space issues return, with another trial-and-error session. With 135GB not enough, 150GB and 200GB not enough, I finally got the required space with 250GB allocated to the VM.
Second hurdle – the second coming: About 85% of the way done, another Out of Memory error. I probably could have temporarily added more resources, but I opted instead to increase the swap size.
Third hurdle: Almost 100% before getting hit with another error.
/bin/bash: mmd: command not found
/bin/bash: mcopy: command not found
/bin/bash: mdel: command not found
This was a quick one to solve by adding the
mtools package. And just 1 more error to tackle:
/bin/bash: genisoimage: command not found
sudo apt install genisoimage and… Success!
With the newly created Android 10 iso in hand, I am ready to head over to Proxmox and fired up a new VM. The process to get the iso wasn’t pretty, but you can’t argue with the results. Given the issues that caused the building process to start and stop repetitively, and the fact it’s a really alpha build of Android 10 x86, whether or not it boots into Android 10 is another story for a different day.
If there is one key lesson I can take away from this adventure, it would be “don’t be stingy on disk space”, especially when it’s a throwaway VM to begin with.