Dual-booting Android and Ubuntu Touch on the Nexus 7
Since I wrote a silly app in QML I’ve been keen to have a play around with Ubuntu’s developer preview for tablets (variously referred to as “Ubuntu Touch” and “phablet” (phone/tablet)). I have both a Nexus 7 tablet and a Nexus 4 phone which the images support. The trouble is, the images are designed to be run on “spare devices” – there’s no support for backing up and restoring an existing Android ROM. I’m not the kind of person who has a spare tablet or smartphone lying around, I use mine a lot, so I’ve been shying away from trying it out.
Note: The current Ubuntu Touch images are definitely a Developer Preview. Not much actually works other than the web browser, it’s just to give you a feel for the interface and let you try out apps you’re writing on a touch screen. If you’re hoping this blog post will tell you how to dual-boot 2 usable systems, I’m afraid you’ll be disappointed. Maybe in 6 months.
When we were discussing the phablet images on the Ubuntu Podcast, Alan Pope mentioned that there were people in the community who were playing around with getting devices to dual-boot. This seemed like a reasonable solution – I could boot into Ubuntu when I wanted to play around, then back in to Android when I actually needed to use my tablet.
It turns out the solution is called MultiROM. Using a modified version of the TWRP custom recovery system[1], you first flash a modified kernel into the stock Android ROM then flash the MultiROM interface that sits in the boot process before the init system is loaded and allows you to select a ROM to boot. The custom recovery system then has an extra option allowing you to flash alternative ROMs to your internal storage which can be selected through this interface, which can be selected in the MultiROM interface (it’s just a touch-screen menu).
I followed this How to install MultiROM video to install the custom recovery, MultiROM and modify the stock Android kernel[2]. I then followed this Ubuntu Touch Preview guide to download the Ubuntu Touch image and flash it to the device’s internal storage alongside the stock Android ROM. After this, you can choose between the Internal (Android) and quantal-preinstalled (Ubuntu) ROMs in the MultiROM menu when the device boots.
It looks like it’s possible to add other ROMs too – there’s an option for an Ubuntu Desktop image and CyanogenMod should work, but support for other ROMs is dependant on a MultiROM-compatible kernel being available.
[1] The installation of which requires unlocking your bootloader, which will factory reset your Android system and possibly void your warranty, so backup all your data first. I used Google Nexus 7 Toolkit to do my backup/unlock/restore. It’s Windows only but I had a hard time finding a Linux-based tool that’s as easy to use for doing the backups (I assume adb does it, but I didnt dig around enough). Holo Backup is a good cross-platform tool for doing backup/restore, and unlock instructions can be found on the Ubuntu Wiki
[2] Note that this video assumes your bootloader is already unlocked (see [1]). It also assumes you’re using Windows, but I just rebooted to the bootloader manually (Power Off, then hold Power Button+Volume Down) and used fastboot from the Nexus 7 Installer PPA on Ubuntu with no problem.