[ZTE Axon 7 Guides, News, & Discussion] Controllerboy:
<disclaimer> I take no credit for anything in this guide. A BIG Thanks goes out to [MENTION=7890973]tennear[/MENTION], [MENTION=4911249]Unjustified Dev[/MENTION], [MENTION=3044858]DrakenFX[/MENTION] and [MENTION=1150948]Starvirus[/MENTION]. They are the ones who figured out the process described below and provided the excellent LineageOS 14.1 ROM. I just wrote this all-in-one-guide because I think the information is way too cluttered and spread over these forums.</disclamer>

<disclaimer> If you're not 100% sure what you're about to do, please first scroll down to the bottom of this post to see a list of DON'T's, a few things you SHOULD ABSOLUTELY NOT DO if you want to keep using your device.</disclaimer>

After having had quite some phones (Moto Defy +, Oneplus One, Nexus 5x,...) and having flashed a lot of ROMs on them, I thought I had quite some experience in these matters. Alas. Unlike Oneplus, ZTE would rather not have users fiddling with their devices. There are also three versions of the Axon 7 called the A2017 (China), A2017G (Global) and A2017U (USA), each with some minute differences from the others. This makes unlocking BL, flashing a custom recovery and installing custom ROMs not so easy on this device.

The following guide describes how to go from a stock, not rooted, locked bootloader A2017G on Marshmallow Firmwares (B03 to B10) to an unlocked bootloader TWRP recovery LineageOS 14.1 A2017G. A2017U users, this guide should work for you too, but I hear there's an alternative, easier process exclusively for A2017U users.

A2017 users do not proceed

, this guide won't work for you.

Users on stock Nougat, do not proceed

, this guide won't work for you. You need to downgrade to Marshmallow first. Even A2017G or A2017U Marshmallow users must proceed with caution. There's always a tiny chance this process bricks your device. By following this guide, you will lose all your data on your internal memory. Please backup before proceeding. The data on your SD card should be safe.

A) Flashing TWRP Recovery to your device.

Q: Why do I need TWRP?

A: TWRP is a custom recovery system. It lets your backup your system in case anything goes wrong. It also lets you flash custom ROMs and zip files containing patches like viper4android or A.R.I.S.E. (audio) and root your device via SuperSU.

0) Boot up a windows computer with a 64bits processor. Verify your Axon 7 is charged at least 75%. Temporarily disable your antivirus software to allow axon7tool to work.

1) Backup all the data of your phone's internal memory that you don't want to lose. Copy it to your PC

2) Download the axon7tool from here: http://www.filedropper.com/axon7tool-15-win64

3) Download minimal adb and fastboot from here: https://www.androidfilehost.com/?fid=457095661767103465

4) Unzip the minimal adb and fastboot file, place the folder with the files in it somewhere you can easily find it

5) Place the axon7tool exe in the same folder as adb.exe and rename it to "axon7tool.exe" (it's easier to work with that way)

6) Download the TWRP .img and .bin files from here: https://drive.google.com/open?id=0B4UVMBVpYdVwcnlaZU1NRldoRjA

7) Place the TWRP .img file in the same folder as "adb.exe" and "axon7tool.exe", rename it to "recovery.img"

8) Make a copy of the "recovery.img" file and name it "recovery.bin". Leave it in the same folder

9) Go to settings in your phone and go to "About Phone". Tap "Build Number" 7 times to make the Developer Options available

10) Go to "Developers options" and tick "Allow OEM unlock" and "Android Debugging"

11) Connect your Axon 7 to your PC

12) Open a command window by holding shift and right-clicking in a blank space in the folder where the "adb.exe", " axon7tool.exe", "recovery.img" and "recovery.bin" files are located. Click "Open command window here"

13) Type "adb devices" and hit enter. You should see one device with some code listed

14) Type "adb reboot edl" and hit enter. Your device will reboot to EDL mode. It appears to be off, but it is in fact in EDL mode.

15) Go to Device Manager on your pc and verify your Axon 7 is listed as "QUSB_BULK"

16) In command, type "axon7tool -r gpt boot recovery" and hit enter

17) After it is executed, your phone will reboot. Wait until it has fully booted.

18) In command, type "adb reboot edl"

19) Verify you now have 3 backup files in your ADB folder for gpt, recovery and boot. These are backup files in case something goes wrong

20) In command, type "axon7tool -w recovery"

21) Wait until it finishes

22) Your phone should reboot

23) Shut down your phone and boot it to TWRP by holding both the power and volume up button to verify you have TWRP

24) TWRP might ask you for a password. If it does, simply tap cancel. It will ask you if you want to modify system. Swipe to agree

NOTE: if you have problems connecting to your phone as QUSB_BULK, download Zadig and replace your drivers with WinUSB ones. If axon7tool doesn't recignise your device even when connected as QUSB_BULK, try killing adb.exe via task manager before retrying.

B) Unlock the bootloader

Q: Why do I need to unlock the bootloader?

A: With an unlocked bootloader, you can install custom ROMs.

1) Go to https://mega.nz/#F!rcFCQZ7C!vn457hU1zDwc0uVpvm5otw and download the aboot.img file from there (1024Kb). Put it in the same folder you used in the previous process

2) Download this file: https://www.androidfilehost.com/?fid=529152257862665656

3) Unzip the file and copy/cut the file called "fastboot_unlock.img"

4) Paste that file in the folder where "adb.exe", "axon7tool.exe", "recovery.img", "recovery.bin" and "aboot.img" are located

5) If there's none open, open a new command window in that folder again (Shift + right-click and "open command window here")

6) Type "adb push aboot.img /sdcard/" and hit enter

7) Type "adb push fastboot_unlock.img /sdcard/" and hit enter

8) Type "adb shell dd if=/dev/block/bootdevice/by-name/fbop of=/sdcard/fbop_lock.img" and hit enter

9) Type "adb shell dd if=/dev/block/bootdevice/by-name/aboot of=/sdcard/aboot_lock.img" and hit enter

10) Type "adb pull /sdcard/fbop_lock.img" and hit enter

11) Type "adb pull /sdcard/aboot_lock.img" and hit enter

12) Type "adb shell dd if=/sdcard/fastboot_unlock.img of=/dev/block/bootdevice/by-name/fbop" and hit enter

13) Type "adb shell dd if=/sdcard/aboot.img of=/dev/block/bootdevice/by-name/aboot" and hit enter

14) Type "Adb reboot bootloader" and hit enter to go to the bootloader

15) Type "Fastboot oem unlock" and hit enter

16) Follow the instructions on your phone and use the volume and power buttons to confirm you want to unlock your bootloader

17) Boot into TWRP by holding both power and volume up button

18) Type "Wipe" and choose "Format Data"

NOTE: If you get a permissions denied issue, try doing these steps while your device is in TWRP.

C) Update bootstack, Install LineageOS 14.1 and update your TWRP to latest version

Q: Why do I need Lineage OS 14.1?

A: It's a custom ROM that's a lot smoother than any available stock rom for any of the Axon 7 versions. Aside from an audio bug (the speakers make a rattling noise when the volume is turned higher than 80-90%) it's perfect. You can however find quite some other decent ROMS here.

Q: Why do I need the latest TWRP?

A: Tenfar's signed TWRP version is the only one that will be accepted by a locked phone, so you need to flash that version first to unlock your bootloader. You should however not use it for backing up and restoring, since it contains fatal flaws that can lead to bricking your phone. Update it using the steps below.

1) Download the latest unofficial Lineage OS 14.1 ROM from here: https://www.androidfilehost.com/?fid=457095661767134540

2) Download the A2017G Nougat bootstack from here: https://www.androidfilehost.com/?fid=673368273298930583 (A2017U users: your bootstack is here

3) Download the latest TWRP .img from here: https://build.nethunter.com/twrp/zte/twrp-3.0.4-1-ailsa_ii.img

4) Download a Google Apps version from here: http://opengapps.org/?arch=arm64&api=7.1/ .You must use an ARM64 file since that is the type of the CPU in the Axon 7. You must use 7.1 Gapps since that's the android version Lineage OS 14.1. is based on. Which one you choose is up to you, the "smaller" you go the less google apps will be installed as stock. You can always download the ones you miss via the play store after having installed LineageOS

5) Put the bootstack, the LineageOS and the chosen Gapps zips on your MicroSD card. Also put the TWRP.img on there

6) Flash the A2017G Nougat bootstack: Flash -> select the bootstack file on the microSD card

7) Flash LineageOS 14.1, then flash the Gapps zip file (again via TWRP)

8) Update your TWRP recovery by choosing "Install" and then clicking "Install Image" (bottom right) and selecting the TWRP .img file

9) Wipe dalvik, cache and data

10) Reboot

11) Enjoy your phone

In the unlikely case that you're greeted by a screen that asks you for a password because your system is somehow encrypted, reboot to TWRP and format your data partition to ext4 instead of f2fs (wipe -> advanced)

If your phone doesn't pop up as QUSB_BULK in EDL, you probably installed the driver that came with the phone. The device will pop up below Ports (COM & LPT) on Device Manager as Qualcomm something-something USB device. Uninstall that driver and reinstall winUSB drivers through Zadig.

If axon7tool fails with a what() and STD-exception and whatnot - if you installed the Zadig driver

Go to Device Manager, right click QUSB__BULK and Uninstall, then use the "adb reboot edl" command. Install the winUSB driver via Zadig. Reboot the phone by holding the power button about 10 seconds. Enter the command adb reboot edl again. Enter "axon7tool -r gpt boot recovery" in command.

If LOS refuses to install and you get the error axon7.verify_trustzone, install the universal bootloader (A2017X_B15_UniversalBootloader) before the N Modem.

So, the steps after you get access to TWRO are: 1) Install univ. BL (A2017X_B15_... .zip); 2) Install A2017G_N_modem.zip; 3) Install LOS14.1 zip; 4) Optionally, install Gapps; 5) Flash TWRP img

DON'T's:

- DO NOT use the signed TWRP (3.0.2) to backup or restore, it might brick your device

- DO NOT use this guide when you're on locked stock nougat, you need to downgrade to Marshmallow first

- DO NOT flash the wrong N bootstack. There's a different version for G and U devices

- DO NOT use this guide if you're on an A2017 (Chinese) device

- DO NOT unplug your cable from your PC or Axon while axon7tool is doing it's magic

- DO NOT make a mistake or typo, it can be fatal

- DO NOT try flashing random zips or files or formatting this and that when your device doesn't act according to the guide, post your issue instead

- DO NOT wipe anything else than Data, Dalvik and Cache in TWRP

ADDITIONAL STEPS:

- You can opt to root your device by flashing the latest SuperSU zip file

- You can opt to upgrade your unofficial LineageOS to the latest official version to receive weekly OTA updates