Part of the beauty of owning a Google Pixel phone comes through the proper availability of firmware images that can be used to return the device to a factory state. Even if you unlock the bootloader, root the phone, or tinker a bit too much, you may find yourself looking for a last resort to restore the stock configuration before taking the monthly security updates. While many hardcore Android fans will know exactly what to do, not everyone is as adept at getting their phone updated without losing root.
If you have access to a PC/Mac and are happy to take matters into your own hands, you can easily keep root access by performing a few extra steps in addition to sideloading the OTA update on your Google Pixel. In this tutorial, we’re going to show you how.
Navigate this article:
- How rooting affects the capability of installing OTA updates
- How to keep root and take OTA updates on your Pixel
- Verification
How rooting affects the capability of installing OTA updates
Rooting involves modifying parts of the Android boot image so as to gain superuser access. A regular monthly OTA or “over-the-air” update is incremental in nature, which means it can’t apply the delta patch to upgrade the stock boot image due to an obvious binary mismatch in a rooted environment. While opting for the full update package is a viable solution to this problem, it will eventually overwrite the bits and pieces required for root access from the boot partition.
So for those of you who plan to get dirty with your Pixel and may need a savior down the road, we thought we’d make sure you know how to keep root access across monthly security updates. The process isn’t difficult, but it does require a few ADB and Fastboot commands.
How to keep root and take OTA updates on your Pixel
Before starting, note that this tutorial assumes you have an unlocked bootloader and are already rooted with Magisk. Moreover, make sure that you have the latest ADB and Fastboot binaries installed on your PC/Mac and that the target device can be detected by these tools.
There are a few ways to get your Pixel update to the latest official Android build while keeping root. You can restore the stock boot image of the base version, wait until your phone gets a notification that will prompt you to download any waiting updates to your phone (or sideload the update manually), then patch the updated boot image and flash it. This is a bit slower but recommended method for beginners.
A relatively quicker method to get the very latest update on your Google Pixel while keeping root is to flash the official factory image with a pre-patched boot image. Keep in mind that both methods rely on access to a PC or Mac. None of them requires you to wipe the device, but it’s good practice to backup any irreplaceable data in case something goes wrong.
Recommended method
- Locate the exact version number of the currently installed software on your Google Pixel phone. Navigate to Settings > About phone and note down the text under the Build number section.
- Now we need to restore the untouched boot image corresponding to the installed build. As a precautionary measure, open Magisk, switch to the Modules tab, disable the active modules, and restart once before doing so.
- Depending on the method of patching, the Magisk app might keep a backup of the stock boot image. In that case, you should be able to restore them through the Restore Images option under the after the Uninstall menu of the Magisk app. Nonetheless, we recommend flashing the untouched boot.img from the factory image to avoid any unforeseen issue.
- Download the fastboot-flashable factory image corresponding to the current Android build number for your Google Pixel phone on your PC/Mac. It should be named as
<device codename>-<build number>-factory-<hash value snippet>.zip
.- Google hosts all of the official builds for each Pixel on its download portal. You can also take a look at our Android 13 download index for easy navigation.
- Open the factory image using your favorite archive manager, locate the
image-<device codename>-<build number>.zip
file (yes, there’s a ZIP within a ZIP), and extract the boot.img file from it.
- Install the stock boot.img for the current Android build number:
- Make sure USB debugging is enabled on the phone and the
adb devices
command on the computer returns the phone’s serial number. - Reboot to the phone to the bootloader mode:
adb reboot bootloader
- Flash the stock boot image:
fastboot flash boot <full patch of the stock boot.img>
- Reboot:
fastboot reboot
- Make sure USB debugging is enabled on the phone and the
- You can now force your phone to pull any waiting updates by heading to Settings > System > System update > Check for updates. Alternatively, download the latest recovery-flashable full OTA image for your model and sideload it manually.
- Don’t choose the latest factory image for upgrading, as the inbox flashing script will wipe the device by default.
- Now that you’re on the latest build, it’s time to patch the boot image with Magisk for regaining root access. We have a dedicated tutorial for how to install Magisk, so take a look at it if you need any help.
- Once your phone has rebooted after flashing back the patched boot image, you should be safely updated with the very latest OTA with root access.
Quick method
- Download the factory image corresponding to the latest update for your Pixel phone on your PC/Mac. You can either do it from Google’s download portal or from our Android 13 download index.
- Unpack the factory image using your favorite archive manager, locate the image-<device codename>-<build number>.zip file, and extract the boot.img file from it.
- Patch the stock boot image using Magisk, but don’t flash it on your phone yet.
- Copy the Magisk-patched boot image from your phone to your PC/Mac and rename it to boot.img.
- Open the
image-<device codename>-<build number>.zip
file from step 2 with the archive manager of your choice and replace the stock boot image file in it with the one from step 4.- Windows users are suggested to use 7-Zip, so that a simple drag-and-drop should be enough to push the patched file into the archive.
- Linux and macOS users can use the built-in
zip
utility to replace the stock boot image with the patched boot image in the factory firmware:zip image-<device codename>-<build number>.zip boot.img
- In order to remove the data wipe routine, modify the flashing script like the following:
- If you’re on Windows, then open the file named “flash-all.bat” with Notepad (or your favorite text editor), remove the “-w” parameter from the fastboot flashing segment, and save the file.
- For Linux and macOS, open the file named “flash-all.sh” with your favorite text editor, remove the “-w” parameter from the fastboot flashing segment, and save the file.
- If you’re on Windows, then open the file named “flash-all.bat” with Notepad (or your favorite text editor), remove the “-w” parameter from the fastboot flashing segment, and save the file.
- Reboot your Pixel phone to the bootloader mode and perform the flashing operation using Fastboot.
- If everything goes right, the phone should reboot automatically into the latest OS version — that too with a pre-rooted boot image.
Don’t have access to a computer? While it is possible to direct Magisk to install itself to the inactive slot before taking an incremental OTA and keep root after the update, you might stumble on some unexpected roadblocks in this process. Thus, we recommend patching the boot image yourself and flashing it using a PC.
Verification
A simple way to check if you have followed all of these steps correctly is to head to Settings > About phone > Android version. You should see the exact patch and build number that you have sideloaded on your Google Pixel device.
Next, open the Magisk app from app drawer and the Magisk build number should be listed beside the “Installed” parameter, indicating that you’ve successfully managed to complete the process.
If you have any questions regarding rooting your Google Pixel phone, make sure to leave them in the comment section below.
The post How to install OTA updates and keep root on your Google Pixel phone appeared first on XDA.
from XDA https://ift.tt/Jh1eblL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire