root kernelsu android

How to Root Android Device via KernelSU [3 Methods]

In this guide, we will show you the steps to root your Android device via KernelSu. Up until now, you could gain administrative privileges by patching and flashing the boot.img/init_boot.img or directly flashing the Magisk ZIP via a custom recovery. Now there has been a newer approach to get this job done- and this involves taking the kernel route.

What is KernelSU

root kernelsu android

KernelSU is a root solution for Android devices that beholds a Generic Kernel Image, it works in kernel mode and grants root permission to applications directly in the kernel space. Similar to how you could flash a single GSI file to any project treble device, similarly you will be able to root your device via a generic kernel image.

There is just one requirement for this tweak to work- your device should have a GKI Kernel [we will show you how to check that as well]. Moroever, since this is kernel-based aka it works in kernel mode, so it can easily provide a kernel interface that will allow you to open floodgates to a plethora of tweaks such as adding a hardware breakpoint to any process in kernel mode

The Prerequisites to Root Android Device via KernelSU

Before proceeding ahead, please take a backup of all the data on your device. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.

STEP 1: Check if Device has GKI Kernel

  1. First off, verify if your device has a GKI Kernel or not.
  2. To do so, download and install the KernelSU app from GitHub. Then launch it.

    Root Android KernelSU
    Left: Yes | Right: No
  3. If it shows Not Installed, then you could root your device via KernelSU.
  4. However, if it shows Unsupported, then your device cannot be rooted via KernelSU.

STEP 2: Download Android SDK Platform Tools

install adb platform tools windows

Next up, you have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform tools folder, which will be used throughout this guide.

STEP 3: Enable USB Debugging and OEM Unlocking

Next up, you will also have to enable USB Debugging and OEM Unlocking on your device. The former will make your device recognizable by the PC in ADB mode. This will then allow you to boot your device to Fastboot Mode. On the other hand, OEM Unlocking is required to carry out the bootloader unlocking.

Root Pixel 7A

So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Developer Options > Enable USB Debugging and OEM Unlocking.

STEP 4: Find the Kernel Module Interface

First off, let’s find the kernel module interface for the kernel installed on your device. All the kernels that have the same KMI are cross-compatible [hence the term Generic in GKI Kernel].

  1. Launch the KernelSU app and check out the Kernel Version.Root Android KernelSU
  2. You could also verify the same from Settings > About Phone > Kernel version.
  3. It should be in the following format, where w.x-zzz-k will be the KMI version.
    KernelRelease :=
    Version.PatchLevel.SubLevel-AndroidRelease-KmiGeneration-suffix
    w .x .y -zzz -k -something
  4. For example, on my device, the Kernel Version is 5.10.149-android134-00003-gebdbc9fbe2e2.
  5. So the KMI version for my device will be 5.10-android13-4.

NOTE: The SubLevel in the kernel version is not part of the KMI. So 5.10.137-android13-4-gebdbc9fbe2e2 has the same KMI as 5.10.149-android13-4-gebdbc9fbe2e2.

Install KernelSU via TWRP and Root Android

The benefit of this method is that it’s quite easy to execute. But on the flip side, not every device has a working custom recovery like TWRP. If yours has one, then let’s get started.

  1. Download the AnyKernel3 ZIP that corresponds to your device’s KMI.
  2. For example, if your KMI is 5.10.149-android13-4, then download:
    AnyKernel3-android13-5.10.149_yyyy-mm.zip
  3. Once downloaded, transfer it to your device.
  4. Then open Command Prompt inside the platform-tools folder.
  5. Now type in the below command to boot your device to TWRP.
    adb reboot recovery
  6. Then go to Install, select the kernel.zip, and perform a right swipe to flash it.
    Root Android KernelSU
  7. Once done, go to Reboot and select System. Your device will boot to rooted OS.
    Root Android KernelSU

Install KernelSU via Boot.img and Root Android

This is the generic method of installing and rooting your Android device via KernelSU and is supported across all GKI kernels. On the flip side, it is the lengthiest and most technical method out of the three out there.

Automatic Approach

This is for those sets of users who are aware of the kernel compression format of your official boot.img [such as gz for Xiaomi devices]. if you are;t aware of this, then please try out the manual approach

  1. First off, download the already patched boot.img corresponding to your device’s GKI from here.
  2. For example, if your KMI is 5.10.149-android13-4, then download the one which corresponds to this format:
    android13-5.10.149_yyyy-MM.boot-<format>.img
  3. Here, the format is the kernel compression format of your official boot.img [for example, Xiaomi usually uses gz].
  4. Once you have got the boot.img, transfer it to the platform-tools folder.
  5. Now open CMD inside platform tools and type in the below command to boot your device to the Fastboot Mode
    adb reboot bootloader

    Root Android KernelSU

  6. Then execute the below command to temporary boot via the patched boot.img:
    fastboot boot boot.img
  7. If everything’s working well and good, then reboot your device to Fastboot Mode.
  8. If it’s not, then just do a normal restart, and your device will be booted to the OS.
  9. Now type in the below command to permanently flash this boot.img:
    fastboot flash boot boot.img
  10. Finally, type in the below command to boot your device to the rooted OS:
    fastboot reboot

    Root Android KernelSU

Manual Approach

If you are not sure of the format or if the patched boot.img is not available for your device [such as Pixel uses lz4_legacy, for which the boot.img is not present], then you’ll have to manually get this job done, as explained below:

  1. To begin with, extract the boot.img from the stock firmware.
    Root Android KernelSU
  2. Make sure it is the same version that is installed on your device.
  3. Then download and extract Android Image Kitchen on your PC.
    Root Android KernelSU
  4. Now transfer the stock boot.img inside the Android Image Kitchen folder.
    Root Android KernelSU
  5. Then download and extract AnyKernel3 ZIP file that corresponds to your KMI.
    Root Android KernelSU
  6. For example, if your KMI is 5.10.149-android13-4, then download the one which corresponds to this format:
    android13-5.10.149_yyyy-MM.boot-<format>.img
  7. Now open the CMD window inside the Android Image Kitchen folder and type in the below command to extract the boot.img
    unpackimg.bat boot.img

    Root Android KernelSU

  8. It will now unpack boot.img and you will get a couple of files. Replace boot.img-kernel in the split_img directory with the Image you extracted from AnyKernel3.
    Root Android KernelSU
  9. Make sure to rename the Image boot.img-kernel. Once done, type in the below command to repack the boot.img
    repackimg.bat

    Root Android KernelSU

  10. You’ll get image-new.img, and transfer it to the platform-tools folder. Then open the CMD window inside this folder.
    Root Android KernelSU
  11. Now type in the below command to boot your device to Fastboot Mode
    adb reboot bootloader
  12. Then execute the below command to temporary boot via the patched boot.img:
    fastboot boot image-new.img

    Root Android KernelSU

  13. If everything’s working well and good, then reboot your device to Fastboot Mode.
  14. If it’s not, then just do a normal restart, and your device will be booted to the OS.
  15. Now type in the below command to permanently flash this boot.img:
    fastboot flash boot image-new.img
  16. Finally, type in the below command to boot your device to the rooted OS:
    fastboot reboot

    Root Android KernelSU

Install KernelSU via Kernel Flasher and Root Android

The benefit of this method is that it’s extremely easy to carry out. However, its prerequisite is its biggest drawback- your device needs to eb rooted beforehand. So in what case will it come in handy? Well, if you have installed an older version of KernelSU and want to update it to the latest version, then this should be your go-to choice.

  1. Download and install Franko Kernel Manager from Play Store
  2. Then launch it and tap Grant in the Magisk pop-up.
  3. Now tap on Manual Flasher and select Flasher.
    Root Android KernelSU
  4. Then select the kernel.zip file and hit Flash & Reboot.
  5. The flashing will now begin. Once done, your device will boot to the rooted OS.

That’s it. These were the three different methods that should help you root your Android device via KernelSu. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


About Chief Editor

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.