Unlock Bootloader and Root Google Pixel 2 and Pixel 2 XL

0

Devices from Google are not only great at official software support but also have just as great unofficial support. It’s a fact almost every Android enthusiast probably knows. While official software support is great, many of us still feel the need to mod it. Mostly because stock Android is just a little too bland. Luckily, the Google Pixel 2 and Pixel 2 XL, being so modder-friendly can easily be rooted. Before you can root them, or install a custom recovery or ROM, you’ll need to unlock the bootloader. Fortunately, it is just as easy to unlock bootloader on the Pixel 2 and Pixel 2 XL.

In case you’re not aware, the bootloader is a piece of software that loads up the OS and acts as an OS. It’s a thin interactive layer between the hardware and the OS, much like the BIOS on a Windows PC. The bootloader is locked by default to only load up official software from the hardware manufacturer. Which is why it becomes necessary to unlock the bootloader in order to install a custom recovery and thus a custom ROM. In this case, it is necessary to even root.

Requirements

Warning

Unlocking the bootloader and rooting your phone will void your warranty. Worst case scenario, you may even end up with a non-usable device. DroidViews cannot be held responsible for your actions. Proceed at your own risk.

How to unlock bootloader on Google Pixel 2 and Pixel 2 XL

Unlike other OEMs, unlocking the bootloader on these devices does not require an unlock key from the OEM. All it takes is a simple adb command.

  1. Launch the adb interface on your PC. On a Windows PC, you can do this by going to the adb installation folder and typing cmd in the address bar. Hit Enter and a command prompt window will open up in the adb folder. On a Mac or Linux system, simply launch the terminal.
  2. Now reboot your Pixel 2 or Pixel 2 XL into fastboot mode and connect it to your PC. To enter fastboot mode, restart your phone then press and hold the Volume down button as soon as the screen goes black. You’ll soon see the fastboot menu appear on the screen. Alternatively, you can connect your phone to the PC first, allow USB debugging from the pop-up dialog that appears and then use the following adb command.
    adb reboot bootloader Unlock Bootloader And Root Google Pixel 2 and Pixel 2 XL
  3. Once your phone is connected to the PC in fastboot mode, unlock the bootloader by issuing one of the following two commands.
    fastboot flashing unlock

    OR

    fastboot flashing unlock_critical

    On some devices, a critical unlock might be required in order to flash bootloader files. In general, if you have a Pixel 2 XL, try the critical unlock command.

  4. On your phone, use the Volume keys to highlight Unlock the bootloader and press the Power key to select it. If you used the critical unlock command before, you will have to now push the standard to unlock command.
    fastboot flashing unlock
  5. On your phone, highlight Start using the Volume keys if it is not already and press the Power button. Your device will then wipe itself clean and the bootloader will be unlocked.

How to root Google Pixel 2 and Pixel 2 XL

  1. Download the MagiskManager-v5.4.1.apk and install it on your device. You’ll need to enable Unknown sources in Settings > Security to install an APK.
  2. Get the boot image from the factory image for your device and transfer it to your device. You can use the MTP connection or the following adb command. Using the command will push the boot image file to the Download folder on your device’s internal storage.
    adb push <path to file> /sdCard/Download
  3. Open Magisk Manager and wait a few seconds while it checks for root. When it’s not detected, a pop-up will appear, tap on INSTALLUnlock Bootloader And Root Google Pixel 2 and Pixel 2 XL
  4. Then select Patch Boot Image File and a file manager will open.
  5. Navigate to and select the boot image you just transferred to your device and Magisk will patch it.
  6. The patched boot image can be found in the MagiskManager folder on your device’s internal storage. Copy it to your adb installation folder over the MTP connection or use the following adb command.
    adb pull /sdcard/MagiskManager/patched_boot.img
  7. Reboot your phone into fastboot mode again.
    adb reboot bootloader
  8. Flash the patched boot image with this command.
    fastboot flash boot patched_boot.img
  9. Disconnect and reboot your device.

You should have a rooted device when it turns back on.

source:  nathanchance (xda)