Hacking the Chromebook Part 2: Merging ChromeOS and Android



Google's Eric Schmidt recently said that they would not be merging Android and Chrome OS together. But they are both open source, so there's nothing stopping us from having a crack a it. Let's have a go, and see what we can do... This could be quite a nice combination for a touchscreen device such as the new Chromebook Pixel, as many have speculated. Before we can begin, we will need a ChromeOS device. Then we will need to take the red pill (i.e. flip the developer mode switch), as discussed in my previous post Hacking the Chromebook for Fun and Profit.


So where to start?  There are ChromeOS devices based on both ARM and Intel architectures, and whilst people will predominantly be familiar with Android running on ARM, the good folk at the Android-x86 project have been making sure that Android will also run nicely on Intel based machines too.  Our test machine is one of the original Intel based Samsung Chromebooks, so let's give this a whirl...
We'll use the Crouton chroot-ed Ubuntu distribution as before.  Now, we can grab a ready made Android ISO image from android-x86.org, but how are we going to run it on our Chromebook? In an ideal world, Android compatibility would be available as a build time option for ChromeOS (or rather, for ChromiumOS, the open source code that is packaged for general distribution as ChromeOS). We're a little way off that, but what we can do pretty easily as a first step is to run Android-x86 as a virtual machine under ChromeOS using a copy of qemu installed under our Ubuntu chroot environment...

root@localhost:~/Downloads# qemu-system-x86_64 -vga std -display vnc=127.0.0.1:5900 -net nic -net user -cdrom android-x86-4.0-RC1-eeepc.iso

I'm showing off a little here, by telling Android to use VNC for its output. This means that we can use the VNC Viewer Chrome extension to open up our Android session in a browser tab. Here's the end result, showing the Grub boot menu for the Android-x86 live image:


























For any readers inclined to try this at home, please note that I didn't have much luck with recent Android images, however the EeePC Android 4.0-RC1 iso shown in the screenshot above did happily boot up. I hit tab in the Grub menu and removed the "quiet" directive, so that all of the Linux boot messages would be displayed.

The next challenge was that Android booted to the Linux command line, as shown below - something I'll wager that virtually all of the 750 million Android users around the world have never seen. At this point one needs to type "start" and press return to bring up the familiar graphical environment, which you can see starting up in the screenshot at the head of this post.

























Now here we are, and Android is booting up in our virtual machine, VNC'd into our browser tab as shown in the screenshots. Lest we forget, the point of this exercise was that a) it would be really cool, and b) because ChromeOS and Android are open source, we can open them up and hack around.

But, we're not out of the woods yet, as our emulated Android installation crashed before it could start to do any useful work:



Why could this be? ChromeOS devices can also be quite pared back in terms of resources, so for example that 2GB of RAM on our test device may not be realistic to run two whole Linux instances. An alternative approach to getting something up and running would be to chroot Android in the same way that we are running Ubuntu chrooted. It should also be noted that ChromeOS doesn't come with Linux KVM (native virtualization) support built into its Linux kernel by default. To make a performant version of our Android VM we would need to rebuild ChromeOS with KVM support enabled in the kernel. 

So, not quite an unqualified success, but hopefully there are some useful pointers here for budding Chromebook hackers - if you have a play with this too, leave a comment and let me know how you get on!