LightBlog

mercredi 19 octobre 2022

How to unlock the bootloader and root the Google Pixel 7 or Pixel 7 Pro with Magisk

Some people can’t imagine using Android without root access. While the Google Pixel smartphones are among the easiest devices to unlock the bootloader, root, and install aftermarket software, it might come as a surprise that the typical boot image patching technique is no longer applicable to the latest Pixel 7 series.

If you bought the Pixel 7 or the Pixel 7 Pro and want to learn how to root it, we’ll show you how in this tutorial. You’ll need to have your PC handy and know your way around ADB.

Google Pixel 7 XDA Forums || Google Pixel 7 Pro XDA Forums

  • You need an unlocked bootloader to root the Google Pixel 7 or 7 Pro.
  • Unlocking the bootloader will wipe your Pixel 7/7 Pro.
  • Instead of the boot image, you have to patch the init_boot image with Magisk for root access.

Navigate this article:

Google Pixel 7 Pro in hand


How to root the Google Pixel 7 and 7 Pro

Before we get into how to root the Pixel 7, remember to take an off-device backup. That’s because the rooting process requires wiping all the data on your phone, including the files on the internal storage.

Step 1 – Get the stock init_boot image for the Pixel 7/7 Pro

For devices launching with Android 13 like the Pixel 7 series, the generic ramdisk is removed from the boot image and placed in a separate place called “init_boot.” The boot.img only holds the Generic Kernel Image (GKI).

As a result, patching the boot.img for root access won’t work for these devices. Rather, we need to get our hands on the image corresponding to the init_boot partition that matches the current software build the phone is running.

Fortunately, we don’t need any specialized tool to rip the init_boot image from the target device. It can be easily extracted from the Google-published factory image for the Pixel 7/7 Pro.

To make sure you download the right factory image, you need to check which software version your phone is currently running. To check this, go to Settings > About phone. At the bottom, look for the Build number section. Find the matching build number on the factory image download page and download that file.

Download Android 13 for Google Pixel phones

Next, unpack the factory image ZIP file. Locate the image-[device codename]-[version].zip file (yes, there’s a ZIP within a ZIP) and extract the init_boot.img file from it. This is the file that you need to transfer to your phone’s internal storage for patching.

Google Pixel 7 Pro factory image stock init_boot image

Step 2 – Patch the stock init_boot image using Magisk

Now that we have our hands on the init_boot image, we can easily patch it with Magisk. In fact, you can patch it on a different Android device than the Pixel 7, but you need to install the Magisk app on the secondary device as well.

While the current stable version of Magisk can patch the Pixel 7’s init_boot image, you might want to opt for the bleeding edge Canary build of Magisk for additional fixes.

Download Magisk: Stable || Canary

After installing the Magisk APK, open the app, and locate the Install button on the topmost card. Choose Select and Patch a File under Method, and select the stock init_boot image. This will open the Android file picker. Go ahead and find the init_boot.img you transferred from your PC and select that. The Magisk app will patch the image to the Download folder on the phone. You must transfer this patched file (should be named “magisk_patched_[random_strings].img”) back to your PC because next, we’re going to unlock the bootloader which will wipe all data as we warned previously.

Notably, if you browse the XDA Forums for the Pixel 7 or 7 Pro, you may be lucky enough to find a pre-patched init_boot image. That being so, we always recommend grabbing the official firmware and patching the stock boot image yourself to avoid unforeseen glitches due to image version mismatch.

Step 3 – Enable OEM unlocking and unlock the bootloader

In order to flash third-party software on the Pixel 7, we have to unlock the bootloader. To do so, go to Settings > About phone > Build number and tap on this entry 7 times to enable Developer options. After enabling it, go back to the main settings page and tap on System, then go to Developer options. From there, toggle the OEM unlocking option. Keep in mind that you need to enter your password/pattern/PIN to validate some of the actions.

It is important to note that some US carriers like Verizon don’t allow bootloader unlocking at all, making it impossible to root your phone. Sometimes, though, people find unofficial workarounds, and we’ll let you know if any are found.

After enabling OEM unlock, turn off your phone. Hold both the Volume down and Power buttons to turn your phone back on and boot into the bootloader menu. Assuming you have the latest ADB and Fastboot binaries installed already, you can also use the following command to reboot to the bootloader mode directly from Android.

adb reboot bootloader

Make sure to keep your phone plugged into your PC/Mac/Chromebook. Next, in a terminal window, type:

fastboot flashing unlock

You will see a screen telling you that you are about to initiate the bootloader unlocking process. Use the volume button to navigate and the power button to accept. Again, this will wipe all the data on your phone, so make sure you have your data backed up before proceeding.

Step 4 – Flash Magisk-patched init_boot image

After the bootloader of your Pixel 7 (or 7 Pro) is unlocked and the init_boot image is patched, you are just one step away from root.

As soon as the bootloader unlocking process completes, the phone will boot back up after a few minutes. Skip the setup wizard at this stage and turn off the phone. You now want to boot back into the bootloader by holding the volume down and power buttons again. Once you are there, connect the phone to your PC/Mac/Chromebook and execute the following command:

fastboot flash init_boot path/to/magisk_patched.img

As soon as you hit Enter, the patched init_boot image will be flashed to your phone. Next, reboot using fastboot reboot and the Magisk app should appear on your home screen and/or app drawer. If it doesn’t (e.g. you can only see a stub icon), just install the Magisk APK manually. You’re now rooted!

Google Pixel 7 Pro rooted

Screenshot courtesy: XDA Member edcsxz

Keep in mind that you’ll have to repeat steps 1, 2, and 4 every time you update your phone because the init_boot image changes with each update. To know more, take a look at our tutorial on how to install OTA updates and keep root on your Google Pixel phone.


What’s next?

Once your Pixel 7 is rooted, you open up the device to some interesting modifications such as Magisk modules and Xposed modules. Of course, there are already a ton of things you can do without root on Google devices, but having root access is an added benefit nonetheless, especially if you consider the best root apps.

    Google Pixel 7
    The vanilla Google Pixel 7 is very similar to the high-end Pro model but it's $300 cheaper and offers more value for money.
    Google Pixel 7 Pro
    The high-end Pixel 7 Pro has a better display higher resolution and refresh rate, a bigger battery, and an additional telephoto lens at the back.

The post How to unlock the bootloader and root the Google Pixel 7 or Pixel 7 Pro with Magisk appeared first on XDA.



from XDA https://ift.tt/L2IHYhr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire