Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Minionguyjpro/16251d55f6344ae8ad400a807c3f77ac to your computer and use it in GitHub Desktop.
Save Minionguyjpro/16251d55f6344ae8ad400a807c3f77ac to your computer and use it in GitHub Desktop.
The Generic Guide to Rooting Android 6.0+ Devices - Get Back Control!

THIS GUIDE IS WORK IN PROGRESS!

The Generic Guide to Rooting Android 6.0+ Devices

Hello, great freely living person! I'm here to give you a nice little guide to root ANY Android device running Android 6.0 or later. If you'd like to get the most out of your device and feel like you're in the need of getting back full control about your device, then this guide is for you! Do note that there are some catches though. Everything else you need to know and do is below!

Note that this process will wipe your data, if the bootloader hasn't been unlocked yet! Be prepared to make backups before, so you don't lose any valuable data from your device. Good luck!

Prerequisites

  • An Android device running Android 6.0 or later - Any common architecture like ARM, ARM64/AArch64, x86 and x86_64/AMD64 should work.
  • A functional USB cable to connect your device to your computer - Install drivers if necessary.
  • A copy of the firmware for your device - It needs to include at least the boot image.
  • The program Odin when using Windows or Heimdall when using either Windows, Linux or MacOS (X)
  • Google's Platform Tools that include ADB and Fastboot
  • Experience with installing and using software

Device specific issues can exist, so please mind those and do the steps required so you're able to flash (e.g. downgrading of the bootloader is needed in some cases where possible). If you meet all those prerequisites, then you're ready to follow the guide! Go on!

First Steps: Unlocking the Bootloader

We are going to begin with unlocking your bootloader. This process may be different depending on your device. The most general steps to be able to unlock the bootloader are:

  1. Power on your to-be-rooted device.
  2. Go into the settings.
  3. Go to the About or Info section.
  4. Find the Build Number button/part.
  5. Tap on it five up to eight (probably seven) times until it says You are now a developer!.
  6. Go back to find the Developer Options section. It's either in the main page of the settings or in the About/Info section.
  7. Find here the option OEM Unlocking. It should be disabled if you haven't unlocked the bootloader before. If so, enable it and follow the steps to enable it. If you did or it is still enabled, then there is no need to do anything. You can keep it on.
  8. A data wipe may happen at this point, depending on the phone. If it does, go through the setup again and check whether OEM unlocking is still enabled by doing the same steps as above. If it is, go on!

Further Steps: Patching the Boot Image

  1. Install the Magisk APK from here. Just download it and open, and give it the permissions it wants to allow it to install. After that, just install and open it.
  2. Copy the boot image from your firmware to your device. Open Magisk Manager, click on the Install button at the Magisk section. Select Directly patch an image and select any options you wish.
  3. A new boot image in the layout of magisk_patched-MGVER_ONEID.img. This is the image you should copy to your computer, somewhere to be able to flash it back to your device later on.

Final Steps: The Exciting Flashing and Rooting Process!

  1. Enable USB Debugging in the Developer Options section. Allow your computer to use it when it prompts to.
  2. Run adb usb on your computer in a command prompt or the terminal to initialize the device correctly in USB mode.
  3. Run adb reboot bootloader to reboot your device into either Fastboot, Fastbootd or Download mode.
  4. If needed, do the final steps to unlock your bootloader here. I can't help you with this, but these steps are pretty much the same for every device with the same manufacturer. So it's probably not too hard.
  5. Steps for flashing below:
    • For fastboot/fastbootd: On your terminal or command prompt, make sure your fastboot command is runnable and make sure to copy the atched boot image to the same directory as the fastboot binary/executable is in (or just in the directory with the patched boot image, if fastboot and/or adb are in the PATH environment variable so it can be ran from anywhere). To flash the new boot image with the Magisk root inside it, run fastboot flash boot <NAMEOFMAGISKPATCHEDBOOTIMG> (where you replace `with the filename of the patched boot image by Magisk). Let it do its thing, and it should reboot the device automatically into the system. If not, runfastboot reboot``.
    • For Odin: Rename your patched boot image to boot.img. Then use something like 7-Zip to make the boot.img into a .tar archive. Open Odin, and flash the newly created .tar in the AP slot. After it has finished, it should reboot into the system.
    • For Heimdall: This process is pretty comparable to fastboot, but a little different. Again make sure you are in the directory that contains the patched boot image. Then run heimdall flash --BOOT <NAMEOFMAGISKPATCHEDBOOTIMG>, wait and the device should reboot into the system.

You've finished! If the system boots properly, then root should now work! Re-open the Magisk app to check. It may have to do a final reboot to get things finished. If not, then please reflash the Magisk boot image once, otherwise reflash the stock image and it should be back to booting properly. If you have issues, let me know below! You may need to do some more research for it to work and know what to do.

As usual, be careful with those supercow powers! It can do anything to modify your system, which is good but it could have a security vulnerability! That's why you should be extra careful once you've gained superuser or root access on your device. Make sure to install modules from the official repository where possible and verify modules outside of the official Magisk modules repository. And know your apps: if they need root, know why they need root! If you can't imagine why, just reject!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment