Advanced phone customization/Installing your custom ROM

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Now that we've the pre-requistics ready, let's start!

Flashing recovery[edit]

A recovery is a type of bootloader which allows you to flash custom ROMs, back up the current OS (including apps) of your phone and wipe the phone if desired. Since most phone bootloaders are far too limited in their capability, we need to flash a custom one.

For this guide, we'll use Team Win Recovery Project (TWRP).

Download TWRP for your device from here. Then enter download mode. How to access it depends on your device. Once in there, flash it and immediately boot to recovery (hint: the combination is most likely different!). If you do not boot immediately to recovery, you'll most likely find that the original bootloader is still present; repeat the process if that happens.

Once you are in recovery, it's fine to restart; you'll see your stock OS. This is normal as you haven't overwritten the OS yet, only the recovery.

Installing your custom OS[edit]

  1. Go to Wipe and wipe off the system and data partitions.
  2. Go to Advanced and wipe off the Dalvik cache.
  3. If the ROM is already present on your phone, go to Install and select the ROM to install. If not, you need to download the Andriod SDK. Launch adb, and use the adb send and adb push to install the ROM, whose file should be in your hard drive.
  4. Flash GApps. You must do this before leaving the recovery (Android 6+). If the phone boots, restart the process, as the phone will misbehave if GApps is installed after the phone first boots.
  5. Restart the phone and complete the first boot process.

If you get an error like Failed to mount '/data' (invalid argument), then your phone partition is most likely encrypted. In that case, go to Format, and select the option to format data. You will lose all of your data in your internal storage.

Logs[edit]

1. On the computer side: Here's the log from adb:

F:\Program Files\Android\android-sdk\platform-tools>adb sideload F:\Users\<username>\Downloads\RR-O-v6.1.0-20180619-zero-common-Official.zip 
loading: 'F:\Users\<username>\Downloads\RR-O-v6.1.0-20180619-zero-common-Official.zip'* daemon not running. starting it now on port 5037 * 
* daemon started successfully * 
Total xfer: 0.95x

F:\Program Files\Android\android-sdk\platform-tools>adb sideload F:\Users\<username>\Downloads\open_gapps-arm64-8.1-nano-20180812.zip
loading: 'F:\Users\<username>\Downloads\open_gapps-arm64-8.1-nano-20180812.zip'
error: closed 

F:\Program Files\Android\android-sdk\platform-tools>adb sideload F:\Users\<username>\Downloads\open_gapps-arm64-8.1-nano-20180812.zip
Total xfer: 1.19x

The error on the second part occurred because I forgot to set the phone to adb sideload again.