Table of Contents
Prerequisites
Before we get started, make sure you’ve got everything ready:
- TWRP Recovery: You’ll need this to flash the kernel. Download it here.
- Custom Kernel File: Ensure it’s compatible with your phone model.
- Magisk: For rooting purposes, if necessary. Download the latest version.
- USB Debugging: Make sure it’s turned on in your Developer Options.
- Minimal ADB and Fastboot: Get it here.
Compatibility: These steps are suitable for most Android phones with TWRP or Fastboot, including models from brands like Xiaomi, OnePlus, and Google Pixel. Make sure the kernel matches your device.
Flashing a Custom Kernel Using TWRP
Using TWRP is one of the easiest ways to flash a custom kernel. Let’s walk through the process.
Backup Boot Partition
Before doing anything else, it’s a good idea to back up your boot partition. If something goes wrong, this backup will help you restore your phone to its previous state.
- Boot your phone into TWRP Recovery: Power off your phone, then press and hold Power + Volume Up until you see the TWRP screen.
- In TWRP, select Backup, choose the Boot option, and swipe to confirm.
This will save your current boot partition, just in case.
Flash the Custom Kernel
Now that your backup is done, it’s time to flash the custom kernel.
- In TWRP, go to Install.
- Locate the kernel ZIP file you downloaded and select it.
- Swipe to confirm the flash.
Boom, the custom kernel is now installed on your phone!
Wipe Cache and Dalvik
To make sure everything works smoothly, wipe your phone’s cache and Dalvik cache.
- In TWRP, go to Wipe, and select Cache and Dalvik Cache.
- Swipe to confirm.
This step helps avoid any issues that could cause your phone to not boot properly.
Reboot System
You’re almost there! Now, it’s time to reboot your phone and see the new kernel in action.
- In TWRP, tap Reboot > System.
Your phone will now start up with the new kernel, giving you better performance or longer battery life.
Flashing a Custom Kernel via Fastboot
If you’re comfortable with using Fastboot, this method gives you more control. Let’s get started.
Extract Kernel Image
Before flashing via Fastboot, you need to extract the boot.img file from the kernel ZIP.
- Use a tool like WinRAR or 7-Zip to extract the boot.img file.
Boot into Fastboot Mode
To flash the kernel, you need to enter Fastboot mode on your phone.
- Power off your phone.
- Press and hold Power + Volume Down until you see the Fastboot screen.
Flash the Custom Kernel
Now that you’re in Fastboot mode, it’s time to flash the kernel.
-
- Connect your phone to your PC via USB.
- Open a command prompt or terminal on your PC.
- Type this command:
fastboot flash boot boot.img
- Press Enter, and this command will flash the new kernel to your phone’s boot partition.
Reboot Device
Once the flash is done, reboot your phone.
-
- Type the following command:
fastboot reboot
Your phone will restart, and the custom kernel will be running.
Flashing Back to Stock Kernel
If you ever feel like returning to the stock experience, flashing back to the original kernel is pretty straightforward.
Backup Custom Kernel (Optional)
It’s always good to back up your current custom kernel in case you want to use it again later.
-
-
- Boot into TWRP.
- Go to Backup, choose Boot, and swipe to confirm.
-
Flash Stock Kernel
To go back to stock, you need the original boot.img file, which you can often find in your device’s stock firmware.
-
-
- Download the stock boot image for your phone model (for example, Pixel 7 stock image).
- In TWRP, go to Install, select the boot.img, and swipe to flash.
-
Reboot System
Once the stock kernel is flashed, reboot your phone.
-
-
- Tap Reboot System in TWRP’s main menu.
-
Your phone will now be back to its original state.
Flashing Custom Kernels Without Root
Don’t want to root your phone? No problem! You can still flash a custom kernel using the sideload method.
Boot into Recovery Mode
First, you need to get into recovery mode on your phone.
-
-
- Power off your phone.
- Hold Power + Volume Up to boot into recovery.
-
Sideload Kernel
Once in recovery mode, you can use ADB sideload to flash the kernel.
-
-
- Connect your phone to your PC.
- On your PC, open a command prompt or terminal and type:
-
adb sideload kernel.zip
This will flash the custom kernel to your device.
Reboot Device
After sideloading the kernel, reboot your phone.
-
-
-
- In recovery, choose Reboot System Now.
-
-
And there you have it! Flashing a custom kernel is easier than you might think. Whether you’re looking for better performance, improved battery life, or just a new experience, this guide has all the steps you need. Just remember to back up your data and follow the steps carefully, and you’ll have your phone running better in no time!