Pixel devices are of the gold standard when it comes to security in the Android ecosystem. With each new release of security updates, Google makes it harder for us to tamper the system. As you know, it’s always been a cat and mouse game between Android updates and the renowned root tool Magisk. Thankfully, Magisk is still able to root Pixel devices till Android 10 and we’ll see how to root Pixel 4 and Pixel 4 here.
Needless to say, we’ll make use of the Magisk patched boot.img method to root the devices. It goes without saying, the method is similar for both Pixel 4 and 4 XL with the difference being only in the factory image that you should patch. Without any further ado, let’s dive into the tutorial.
How to root the Google Pixel 4 and Pixel 4 XL
1. Extract boot.img from the stock firmware
First and foremost, you need to get the boot image that matches the current software build your device is currently running. For that go to the software section and look for the build number. Then go to Google developers website and download the corresponding factory image of your device model and the current version.
Next, what you’ve to do is extract the factory image .zip file and then extract the image-devicecodename–version.zip (eg; coral-QD1A.190821.007.zip for the Pixel 4 XL) file. Find the boot.img file from the latter folder. Transfer this boot.img file to your phone.
2. Patch Boot Image Using Magisk Manager
With the boot image file on your phone, you need to download and install the latest Magisk Manager APK. This is the management app for Magisk that you will use to patch the boot image. Download the Magisk Manager from the download section.
Follow the below steps;
- Install Magisk Manager
- Open Magisk Manager, and click on the “Install” button next to the “Magisk is not installed” text.
- Select “Install” then “Select and Patch a file.”
- From the Android file manager, find and choose the boot.img you transferred from your PC and select that in Magisk Manager.
Magisk will then patch the boot image and save a file called “magisk_patched.img” in your Downloads folder. After that, you’ve to transfer this file back to your PC.
3. OEM Unlock/Unlock Bootloader
Important: Unlocking Bootloader wipes data. So don’t forget to back-up your files before proceeding.
Given you’ve patched the boot.img, the next step is to unlock the bootloader so that we can flash the patched boot.img.
- Enable USB Debugging and OEM Unlock on your device Developer options.
- After enabling OEM to unlock, turn off your phone.
- Hold both the volume up and power buttons to turn your phone back on and boot into the bootloader menu.
- Plug your phone into your PC. Open command prompt and input following commands.
fastboot flashing unlock
A screen warning you that you’re about to initiate the bootloader unlocking process will pop-up. Use the volume button to navigate and the power button to accept.
After unlocking the bootloader, it will reboot after a few minutes.
4. Flash Magsik patched boot.img
After your boot image is patched and the bootloader is unlocked, you may finally flash the patched boot image to install Magisk. All you’ve to do is turn off your phone. Boot back into the bootloader by holding the volume down and power buttons simultaneously.
Provided your device is connected to the PC via ADB/Fastboot; Input the below commands on command prompt.
fastboot flash boot path/to/magisk_patched.img
Upon you hit enter, the patched boot image will be flashed to your phone. Now all you’ve to do is enter “fastboot reboot,” for your device to boot to the system. The Magisk Manager app should appear on your home screen once you’ve successfully booted to the system, if it doesn’t, just install the Magisk Manager manually once again.