[BQ Aquaris X Pro Guides, News, & Discussion] luk.giak:
Introduction

I'm writing this thread to summarize useful information about the BQ Aquaris X2 pro such as:

preliminary actions (adb and fastboot configuration)

unlocking the bootloader

flash a factory image

root the device (currently without TWRP)

updating the device without losing root

relocking the bootloader

I own this phone since July 2018. I started writing my notes in August 2018 in the form of a Google document (link here). I shared this document with some telegram groups and some people I know.

Now I that I think it can be more useful to summarize all my notes here on XDA so that all interested people can access it.

DISCLAIMER:

By attempting any of the processes listed in this thread you accept full responsibility for your actions. I have no responsibility about your actions.​

1) Preliminary actions

1.1) Developer options, USB debugging and Unlock OEM

The first thing you need to do is to enable Developer options, USB debugging and Unlock OEM. Hence:

enable “Developer options” by hitting 7 times on the build number (Got to settings --> about phone)

enter the new menu “Developer options” and,

enable “USB debugging”

enable “Unlock OEM”

1.2) Download and configure abd and fastboot

All steps listed in this guide will require the use of Google Platform tools. I suggest the use of the one provided by Google here: https://developer.android.com/studio/releases/platform-tools.

Download the one for your operating system:

View attachment 4655394

Be sure that your terminal can access adb and fastboot from every position by configuring the PATH. I'm use to configure the PATH on the fly when I need it. As I said before, I work on Linux/macOS where you can set the PATH by:

opening a terminal and running:

export PATH=$PATH:path_to_platform_tools

2) Unlock the bootloader

Unlocking the booloader will wipe your phone. So backup your data first.

The good news here is that this phone can be handled like a Nexus/Pixel phone. Therefore, the procedure to unlock the bootloader is straightforward:

do all stuff at point 1.1 and 1.2

open a terminal

plug your phone to the PC

reboot into the bootloader

adb reboot bootloader

run the code:

fastboot flashing unlock

now you have to wait until your phone reboots. It takes a while, don't panic!!! When the phone is on the initial screen turn it off and reboot into the bottloader again by holing 'power + volume down'.

run the code:

fastboot flashing unlock_critical

it's done. Your bootloader is completely unlocked. Now, you only have to wait again for the reboot.

3) Flash a factory image

As you probably know, BQ releases a factory image at each update at this link factory images. Factory images are very useful to perform a very clean install. Are you experiencing some issues with your phone and none of the trick you tried solved it? If it is a software issue a clean flash with a factory image will likely remove the issue.

Keep in mind that by flashing a factory image you will wipe also the userdata partition. So backup your data first. Now let's see how to flash the factory image:

you need an unlocked bootloader (see previous sections)

download the factory image from this link

unzip the archive

open a terminal at this folder

be sure to have abd and fastboot properly configured (see previous sections)

run the script to flash all (*):

./sdm660_fastboot_all_images.sh

wait the end of the process. The phone will reboot.

(*) on Windows you have to deal with the file sdm660_fastboot_all_images.bat. I suppose it's similar but I've never done it on Windows.

4) Obtain ROOT privileges

Nowadays, the most common tool to obtain root privileges is Magisk. Many people here know very well what Magisk is and how to install it with TWRP. However, TWRP is not yet ready for BQ Aquaris X2 pro, hence, we must follow the procedure for installing it without the custom recovery.

When I wrote the document in August I find very informative this guide by [MENTION=6842057]nathanchance[/MENTION]. It's for the pixel 2XL but, as I told you before, it works perfectly also for the BQ Aquaris X2 pro (zangyapro). So here I summarize what [MENTION=6842057]nathanchance[/MENTION] already posted. All credits must go to him.

Here you have the steps:

Download the Magisk zip from the official thread and install the manager from the zip.

Grab a boot image to patch (either the one from the latest factory image or a custom kernel one) and push it to your device:

adb push <path_to_file> /sdcard/Download

Open Magisk Manager and click the Install button.

Click "Install" at the first prompt then choose "Patch Boot Image File". A file manager will pop up.

Select the boot image you want to patch and let Magisk Manager patch it.

Pull it off your device:

adb pull /sdcard/MagiskManager/patched_boot.img

Reboot into the bootloader:

adb reboot bootloader

Flash the boot image and reboot.

fastboot flash boot patched_boot.img
fastboot reboot

Open Magisk Manager and you should be rooted!

Please note that it exists also a specific thread where the author also provides the patched boot.img files for download. Hence, you can start from point 6 without patching the boot.img by yourself. Take care of selecting the right one. Here you have the thread link.

5) Update the ROM without loosing root

To the best of my knowledge, the only way to update keeping root is by using the factory images provided by BQ.

Download the factory image of the latest firmware (link)

Extract the file zip and upload the file boot.img on your phone

adb push <path_to_file> /sdcard/Download

Open Magisk Manager and click the Install button.

Click "Install" at the first prompt and then choose "Patch Boot Image File". A file manager will pop up.

Select the boot image you want to patch and let Magisk Manager patch it.

Pull it off your device:

adb pull /sdcard/MagiskManager/patched_boot.img

Place the file patched_boot.img in the folder of the BQ firmware unzipped at point 2

Make a copy of the file sdm660_fastboot_all_images (.sh in Mac/Liux and .bat on Windows).

Rename the file, I called it sdm660_fastboot_upgrade.sh

Change the following lines (this will preserve root privileges on your phone):

fastboot flash boot_a boot.img # <-- delete this line
fastboot flash boot_a patched_boot.img # <-- add this line

Delete the following line (this will prevent your data to be wiped):

fastboot flash userdata userdata.img # <-- delete this line

Run from your terminal

./sdm660_fastboot_upgrade.sh (or bat)

I think that one can also update using the OTA. This will make you lose the root privileges and therefore, you will have to repeat the procedure at section 4. I've never tested this so, if you decide to do it, you are on your own.

6) Relock the Bootloader

By relocking the bootloader you will lose all your data, hence, backup them first.

To relock the bootloader you only need the following commands:

fastboot flashing lock_critical
fastboot flashing lock

Each command will wipe your data and will reboot the phone. Be patient waiting for the reboot and do not panic.