Installing Multirom on Nexus7

This article outlines the steps that I did to install Multirom to a plain vanilla, un-rooted Nexus 7 2012 Wifi (Asus grouper).

The version of Android I used was Lollipop 5.1, the version of Multirom was v32, and the version of TWRP was 2.8.6. I used the TWRP from Multirom package which means it comes with multirom menu within it.

Installing Multirom is the pre-requisite to run FatdogArm on Nexus7.

Background

Skip directly to the steps.

Multirom is a boot-manager that enables us to run multiple operating systems (including multiple versions of Androids) on Nexus7 and its close variants.

Its purpose is a very close to KexecBootMenu which I wrote a couple of years ago, but it is a lot more polished and encompassing - not only it can boot Linux, it can also boot Android. Not only it acts as boot-manager, it also manages the images of the operating systems (aka "firmware" or "ROMs") that it uses for bootin: you can install and remove these operating systems with easy; from either Nexus7 internal MMC or from external USB OTG flash drive.

KexecBootMenu was not too successful because of one BIG problem: many ARM kernels are not compatible with Linux kexec system call. The kexec is effectively a warm-boot: the current kernel loads the new kernel, and then executes it; and hardware is NOT reset during the kernel switching. A lot of the devices on the ARM SoC does not like to be re-initialised for the second time, so when the new kernel starts it will immediately crash because of unexpected behaviour from the devices that is trying to initialise.

Nexus7 which uses Nvidia Tegra3 SoC is no exception. But Vojtěch Boček (tasssadar) - the author of Multirom - found a solution: instead of doing a warmboot, why not doing a cold boot (in his term - a "hard boot")? This will reset all the devices to their initial states, and the new kernel will have no problem re-initialising them later.

Of course, the really hard problem is figuring out how to keep the new kernel stay in memory during a hard boot :) A hard boot means you need to re-initialise the memory controller too, and during that period you can generally expect that memory contents will not be preserved.

Well, Vojtěch is a really smart person and he figured out in certain SoCs (e.g. in Nexus7) that some memory regions is preserved during such cycle. He used to knowledge to patch the Linux kernel kexec and reboot syscall to use that area and modified the warm-reboot process into a hard-reboot process, and you can find his announcement here. (kudos!). He even provided a guide on how to do that on other SoC too! Look here if you want details.

With Multirom, you can do a multi-boot various operating systems without having to permanently install them into Nexus7. You can install and uninstall OS images as you wish, and you can choose which one to use at boot time. It is the ideal choice to run FatdogArm - you can run it when you like it, and run the original Android on your Nexus7,

If you have a compatible device with Multirom, I recommend that you try it. Even if you don't plan to use FatdogArm or other operating system, you can at least try to boot multiple versions of Android ☺

Preparation

  1. Pre-requisites: Make sure you have adb version 1.0.32. Lollipop 5.1 does not accept earlier versions of adb. This version of adb comes with platform tools r22.

    You can either get this by downloading Android SDK and installing it and asking it to update the platform tools to the latest version, or download directly from here: https://dl-ssl.google.com/android/repository/platform-tools_r22-linux.zip

    Note that this contains 32-bit binaries, so you will need your 32-bit compatibilty libraries if you run 64-bit Linux.

    1. Get 3 sets of files from Multirom home page. You will need 4 files:
      1. Multirom itself (I call this as multirom-grouper.zip)
      2. TWRP recovery with multirom menus (I call this as twrp-multirom.zip)
      3. Kernel patched with kexec-hardboot patch (I call this as kernel.zip)
      4. Multirom application (I call this as multirom.apk)

      This guide for Lollipop 5.1, so the links given are for those, but the multirom homepage contains binaries for other versions of Androids too; as well as for devices other than Nexus7. You must make sure that you choose the right version for your device and the version of Android you're using. If you are using Cyanogen instead of stock android, he has supports for some versions too.

  2. Enable your device with developer options, and make sure that it is fully charged.

  3. Make sure you can access your "adb" and "fastboot" tool from the Android platform tools, and that they work.

  4. Connect your device to your PC with USB cable and test the adb, make sure that "adb devices" shows your Nexus7.

Installation

All done, now is the time to do the actual installation. It is quite straightforward really, just follow the steps:

  1. Copy all the 4 files into a working directory. Filenames given here are just representative of their types. Actual filenames may be different (e.g. have version numbers attached to it).

  2. adb push multirom-grouper.zip /sdcard/
  3. adb push kernel.zip /sdcard/

  4. Unlock the bootloader
    1. Reboot your device into fastboot mode
    2. adb reboot bootloader
    3. Wait until the device restarts and show the fastboot screen
    4. fastboot oem unlock#

  5. After the device reboot, adb reboot bootloader again.
  6. fastboot flash recovery twrp-multirom.zip
  7. Then press volume down button, choose "recovery", press power button to confirm
  8. You will see TWRP screen. From here, choose "install" and install multirom-grouper.zip that you pushed earlier.
  9. Also install kernel.zip.
  10. Reboot, if TWRP asked if you want to install supersu choose "yes".

  11. Reboot back to system, install supersu via playstore or TWRP (I chose TWRP).
  12. Reboot back to system, then adb install multirom.apk.

Done.

Then it's time to use Multirom to install FatdogArm or any other operating systems supported by Multirom.

This is not the only way to install Multirom, there are various ways to do it. One way is to root your Nexus7 first, and then install Multirom using the Multirom APK.

I did it this way so I can install Multirom directly from clean, un-rooted device.

Notes: