:wc: relfile 00-WikiIndex

---3 Installing Multirom on Nexus7

%abs=
This article outlines the steps that I did to install 
[[http://forum.xda-developers.com/showthread.php?t=2011403] Multirom]
to a plain vanilla, un-rooted 
[[http://en.wikipedia.org/wiki/Nexus_7_%282012_version%29] 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.
%=



---4 Background

Skip directly to the [[#steps] 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 
[[http://man7.org/linux/man-pages/man2/kexec_load.2.html]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 
[[http://forum.xda-developers.com/showthread.php?t=2104706]you can find his announcement here].
(kudos!). He even provided a guide on how to do that on
other SoC too! 
[[https://github.com/Tasssadar/multirom/wiki/Porting-kexec-hardboot] 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 ☺

(:steps:)
---4 Preparation

    # 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.
      
    # Get 3 sets of files from 
      [[http://forum.xda-developers.com/showthread.php?t=2011403]Multirom home page].
      You will need 4 files:
     # [[http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_142886350814310&key=f0a7f91912ae2b52e0700f73990eb321&libId=i8eqt0t001000n4o000DAe5v31ui8&loc=http%3A%2F%2Fforum.xda-developers.com%2Fshowthread.php%3Ft%3D2011403&v=1&out=https%3A%2F%2Fs.basketbuild.com%2Ffiledl%2Fdevs%3Fdev%3DTassadar%26dl%3DTassadar%2F%2Fmultirom%2Fgrouper%2Fmultirom-20150407-v32a-grouper.zip&ref=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D2%26ved%3D0CCUQFjAB%26url%3Dhttp%253A%252F%252Fforum.xda-developers.com%252Fshowthread.php%253Ft%253D2011403%26ei%3D-q4qVe7WD8aOuASB8YCIDg%26usg%3DAFQjCNErpypMYVDkERph60MghMaf9Szx6g%26bvm%3Dbv.90491159%2Cd.c2E&title=%5BMOD%5D%5BAPR%2007%5D%20MultiROM%20v32a%20%7C%20Nexus%207%20%7C%20XDA%20Forums&txt=multirom-20150407-v32a-grouper.zip]Multirom itself] (I call this as multirom-grouper.zip)
     # [[http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_142886352081011&key=f0a7f91912ae2b52e0700f73990eb321&libId=i8eqt0t001000n4o000DAe5v31ui8&loc=http%3A%2F%2Fforum.xda-developers.com%2Fshowthread.php%3Ft%3D2011403&v=1&out=https%3A%2F%2Fs.basketbuild.com%2Ffiledl%2Fdevs%3Fdev%3DTassadar%26dl%3DTassadar%2F%2Fmultirom%2Fgrouper%2FTWRP_multirom_grouper_20150406.img&ref=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D2%26ved%3D0CCUQFjAB%26url%3Dhttp%253A%252F%252Fforum.xda-developers.com%252Fshowthread.php%253Ft%253D2011403%26ei%3D-q4qVe7WD8aOuASB8YCIDg%26usg%3DAFQjCNErpypMYVDkERph60MghMaf9Szx6g%26bvm%3Dbv.90491159%2Cd.c2E&title=%5BMOD%5D%5BAPR%2007%5D%20MultiROM%20v32a%20%7C%20Nexus%207%20%7C%20XDA%20Forums&txt=TWRP_multirom_grouper_20150406.img]TWRP recovery with multirom menus] (I call this as twrp-multirom.zip)
     # [[http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_142886353326212&key=f0a7f91912ae2b52e0700f73990eb321&libId=i8eqt0t001000n4o000DAe5v31ui8&loc=http%3A%2F%2Fforum.xda-developers.com%2Fshowthread.php%3Ft%3D2011403&v=1&out=https%3A%2F%2Fs.basketbuild.com%2Ffiledl%2Fdevs%3Fdev%3DTassadar%26dl%3DTassadar%2F%2Fmultirom%2Fgrouper%2Fkernel_kexec_grouper_510.zip&ref=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D2%26ved%3D0CCUQFjAB%26url%3Dhttp%253A%252F%252Fforum.xda-developers.com%252Fshowthread.php%253Ft%253D2011403%26ei%3D-q4qVe7WD8aOuASB8YCIDg%26usg%3DAFQjCNErpypMYVDkERph60MghMaf9Szx6g%26bvm%3Dbv.90491159%2Cd.c2E&title=%5BMOD%5D%5BAPR%2007%5D%20MultiROM%20v32a%20%7C%20Nexus%207%20%7C%20XDA%20Forums&txt=kernel_kexec_grouper_510.zip]Kernel patched with kexec-hardboot patch] (I call this as kernel.zip)
     # [[http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_142886374736416&key=f0a7f91912ae2b52e0700f73990eb321&libId=i8eqt0t001000n4o000DAe5v31ui8&loc=http%3A%2F%2Fforum.xda-developers.com%2Fshowthread.php%3Ft%3D2011403&v=1&out=https%3A%2F%2Fs.basketbuild.com%2Fdevs%2FTassadar%2Fmultirom%2Fmanager&ref=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D2%26ved%3D0CCUQFjAB%26url%3Dhttp%253A%252F%252Fforum.xda-developers.com%252Fshowthread.php%253Ft%253D2011403%26ei%3D-q4qVe7WD8aOuASB8YCIDg%26usg%3DAFQjCNErpypMYVDkERph60MghMaf9Szx6g%26bvm%3Dbv.90491159%2Cd.c2E&title=%5BMOD%5D%5BAPR%2007%5D%20MultiROM%20v32a%20%7C%20Nexus%207%20%7C%20XDA%20Forums&txt=link%20to%20APK]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.
     
   # Enable your device with developer options, and make sure that it
     is fully charged. 
     
   # Make sure you can access your "adb" and "fastboot" tool from the
     Android platform tools, and that they work.
     
   # Connect your device to your PC with USB cable and test the adb,
     make sure that "adb devices" shows your Nexus7.
   . 
   
   
---4 Installation
   
   All done, now is the time to do the actual installation.
   It is quite straightforward really, just follow the steps:
     
   # 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).
     
   # ==adb push multirom-grouper.zip /sdcard/==
   # ==adb push kernel.zip /sdcard/==
   
   # Unlock the bootloader
    # Reboot your device into fastboot mode
    # ==adb reboot bootloader==
    # Wait until the device restarts and show the fastboot screen
    # ==fastboot oem unlock==#
    .
       
   # After the device reboot, ==adb reboot bootloader== again.
   # ==fastboot flash recovery twrp-multirom.zip==
   # Then press volume down button, choose "recovery", press power button to confirm
   # You will see TWRP screen. From here, choose "install" and install
     multirom-grouper.zip that you pushed earlier.
   # Also install kernel.zip.
   # Reboot, if TWRP asked if you want to install supersu choose "yes".
   
   # Reboot back to system, install supersu via playstore or TWRP
     (I chose TWRP).
   # Reboot back to system, then ==adb install multirom.apk==.
   .
   
Done.

Then it's time to use Multirom to install FatdogArm or 
[[http://forum.xda-developers.com/showthread.php?t=2093797]any other operating systems supported by Multirom].

%notice=
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.
%=

---4 Notes:

   - Original article which I used as a guide when I did my first installation:
     http://www.linuxjournal.com/content/multi-booting-nexus-7-tablet
     
   - FatdogArm supports Nexus7 starting from beta3.
   .


