Rooting an Android device, such as your Google Pixel 5, can provide you with elevated privileges and more control over the device’s software. However, it’s important to note that rooting your device comes with potential risks, including voiding warranties and making your device more vulnerable to security threats. Therefore, proceed with caution and be sure to fully understand the implications before proceeding. In this blog post, I’ll show you how to root an Android device, more specifically, a Google Pixel 5 device.
Android Flash Tool
As a prerequisite, install OEM USB drivers. Right-click android_winusb.inf and click install.
Link: https://flash.android.com/welcome
Then, on your phone, go to the settings section and scroll down to “about phone”, and then click “build number” seven times in order to activate the developer options. Therefore, you will see the “You are a developer” toast. Now navigate to the system tab, and then go to developer options.
Once you are in developer options, make sure that OEM unlocking is enabled and USB debugging is enabled, just like in the figures above.
Connect your phone to the computer through a USB cable. It pops up “Allow USB debugging"; select “Always allow from this computer”.
Unlocking the Bootloader
We use the Android Flash tool in order to disable verity verification and unlock the bootloader. I selected the Pixel 5 device and its proper configuration details. This will allow us to flash the patched image on Magisk later. Otherwise, we cannot flash the patched image.
On the phone, we see the figure below.
Choose “unlock the bootloader”. Finishing this process means we have successfully unlocked the bootloader.
Configure the Mobile Device
First, we need to check that the OEM unlocking button is disabled. If so, the operation that we just performed was executed successfully.
Now that we have disabled bootloader unlocking, it is time to download and configure Android platform tools that contain adb, fastboot among others.
Link: https://developer.android.com/tools/releases/platform-tools
Download magisk.apk
Link: https://github.com/topjohnwu/Magisk/releases
We need to get the Pixel factory system image.
Get it from: https://developers.google.com/android/images
Place Magisk.apk and boot.img in the download folder of the Android device. (Just drag and drop.)
On your phone, go to the Download folder. Tap Magisk.apk to install it.
Click the install button near Magisk and choose the boot.img. in order to patch it.
Select the boot.img and LET’S GO!
If the patching is executed without any error, we will see the “All done” toast.
Once it says “all done”, navigate to the download folder to see the patched image. We will install that patched system image.
Copy the newly patched image to your computer, and navigate to platform tools folder, then run the following commands in the order:
adb devices
adb devices
adb reboot bootloader
fastboot flash boot <patched_image.img>
fastboot reboot
We have successfully rooted our device. Enjoy the rest.
This work has been supported in part by the Energy Transition Fund of the FPS Economy of Belgium through the CYPRESS project, and in part by the VLAIO COOCK program through the IIoT-SBOM project.
Thanks for reading.
Can Özkan