[Android General] HemanthJabalpuri:
*** Disclaimer
I am not responsible for any damage you made to your device.
You have been warned

See 2nd post for Rooting Android PC​

-What is Root?

A must read about root is at Wikipedia.

Here Root is not the bottom part of plant which is in soil;). Rooting is the process of gaining administrator permissions to tweak partitions that are read-only before.

-What are the prerequisites for Rooting?

Good understanding of what you are doing. A method to revert back all changes done if something goes wrong.

In most cases you need an unlocked bootloader to do so. I will tell you in which cases we don't need an unlocked bootloader.

-What I can do with Root privileges?

Main advantage of rooting your device is blocking ads in system wide. Other advantage include Use apps that only work with root and modify /system, /data partitions.

-Why not to Root?

In the process of rooting, if you misunderstand something and done something wrong, then it may lead soft/hard brick of your device. Your warranty may void according to your region policy.

-Should I really need to Root my device?

In recent years, many things are changed. Before, we need custom roms/root for many customizations to device like changing font, increasing battery life, boosting performance etc.,. But now devices are capable of performing these things without root.

For example you can do below things without root:-

-Blocking ads system wide, use FireWall with VPN

Eg:- TrackerControl, Karma Firewall, Orbot​

More info is at this guide or this​

-Removing bloatware with ADB

-Install Linux distro with PRoot.

-Is there anyway to experience Root without actually rooting device?

It is possible if you use apps like twoyi, VMOS, F1VM, x8sandbox etc., or use Android in PC(see 2nd post).

-How to Unlock Bootloader?

This is needed to flash custom partitions with fastboot or dd. Method to unlock differs from OEM to OEM. Google, OnePlus, Moto, Xiaomi, Realme has some unique methods.

Your device will factory reset automatically after you unlock bootloader, so make sure to backup your data before going.

More info about unlocking bootloader can be found at here and here

-How can I Root my android?

It depends on Android version of device you are going to root.

If it is Lollipop(5.x) or lower, then one-click root is far best and easy way to root your device without need of unlocked bootloader.

If your device not have above mentioned one, then you have to search Google like

How to Root your_device_name

and go through the steps mentioned in your device specific sites.

If searching didn't find anything, then you have to use PC(and some complicated steps in certain devices) to root. First you need to unlock bootloader of your device if it is locked. Then follow one of below method.

There are different methods for this.

Below methods require bootloader to be unlocked

- Using KernelSU kernel for GKI devices

-Patching boot.img/recovery.img with Magisk

Example of this, see here​

-Using a custom recovery and flashing root zip in it

Example of this, see here​

-Using a custom/GSI rom which is pre-rooted

Phh's AOSP GSI is an example of pre-rooted GSI​

-Using a custom kernel which is pre-rooted

Example of this, see here​

We only need this if Magisk can't patch boot.img(lower than Android 4.2(17) or unsupported format of boot.img) or Magisk doesn't work in the device for some reason​

-Using CF-Auto Root for Samsung

Example of this, see here​

Below methods does not need to have an unlocked bootloader

-Using an exploit like MTK-SU, DirtyCow, qu1ckr00t

Example usage of MTK-SU, see here​

Example usage of DirtyCow, see here, here​

-Using one-click root methods

Example of this, see here​

Examples of one-click root apps

=> Framaroot

=> Kingo ROOT (Recommended and will work in nearly all devices)

=> KingRoot (Will work in nearly all devices)

=> Towel Root

=> UniversalAndRoot

=> z4root

-What is a Custom Recovery and how I can root my device using it?

First we need to know about stock recovery.

-

What is a stock recovery?

The recovery that comes default with your device is stock recovery. Different OEMs have different stock recoveries. But the main theme and background process is same for all these.

-

Can I able to flash root solution in stock recovery?

No, stock recovery needs zip to be signed with OEM keys. Only OEM has that key. If you flash root zip in stock recovery, it will simply fails by showing Signature verification error. Some stock recoveries accept testkey signed flashable zips. But we need to create a edify based installer, since stock recovery may not have busybox in PATH.

-

What does a custom recovery will do?

The main thing that a custom recovery do is, it allows flashing of unsigned zips or zips that are signed with publicly available keys(google testkeys), so that we can do whatever we want.

-

How can I get custom recovery?

You need to port or compile it from your device and custom recovery sources. Alternatively, you can also use pre-compiled custom recovery for your device from different sites like XDA, 4pda, hovatek etc.,

-

How to flash custom recovery?

If your device manufacturer has flash tool then use it. Example Samsung's Odin, Xiaomi's MiFlash Tool. If your device does not have specific flash tool then you can use fastboot method to flash. If it also doesn't work then you have to use SoC(Mediatek, Qualcomm Snapdragon, Spreadtrum/Unisoc, RockChip) specific flash tools like SP Flash Tool, Research Download Tool.

If you are rooted and had unlocked bootloader, then you can flash recovery like dd if=custom_recovery.img of=<block_device_path_of_recovery>.

-

What are different custom recoveries?

CWM, TWRP are popular recoveries. These are exist for many number of devices. Others are mainly derivatives of these like PhilZ, PBRP etc.,

-

How can I root with custom recovery?

Simply choose one of the root solution that is compatible with your device from below and flash it in custom recovery.

Various custom recovery flashable root solutions

=> Magisk (Recommended for 6.0 and higher)

=> SuperSU (Recommended for 2.3 - 5.x)

=> Phh Superuser (Recommended for 5.x and higher)

=> Koush Superuser (For 2.2 - 4.4.x)

=> ChainsDD Superuser (For 1.5 - 2.2.x (3.2-RC3 will work in 2.0 - 4.1))

* Root solutions that are recommended for specific android version may also support other android versions, but it will work better in recommended versions.

References:-

XDA Developers Eg:- this

Wikipedia

Various others like this