How to Install a Treble ROM on Huawei Mate 9

The Huawei Mate 9 is a great mid-range phone from Huawei, but users may not always enjoy the EMUI design, especially as it tends to clash with the native Android Material Design. For that reason or others, some users may prefer a more native-Android experience on their Huawei phone – especially since the Huawei Mate 9 is actually Treble-compatible.

However, there are a few things worth knowing before continuing.

There are currently no entirely compatible TWRP versions for Kirin devices – typically they either work but cannot flash OpenGApps, or they simply do not work with Treble-based ROMs.

Huawei’s eRecovery does seem to work, so you may use either Huawei eRecovery or TWRP with stock EMUI, incase you want to create backups of your partitions in the event something goes terribly wrong.

You also want to be using stock kernel, ramdisk, and recovery_ramdisk – if you are not, you will want to flash those things before continuing.

Finally, following this guide requires an unlocked bootloader. Because Huawei stopped their bootloader unlocking program, you are pretty much out of luck if your Huawei device does not already have its bootloader unlocked.

Requirements:

You should begin by enabling OEM Unlocking in Developer Options. Go to Settings > About Phone > tap on Build Number 7 times until Developer Mode is activated.

Now go to Settings > Developer Options > enable OEM Unlock.

Now you need a good Treble-based ROM, we recommend the following:

These ROMs will be downloaded an IMG files, you need to place them in your primary ADB folder (example C:\platform-tools-latest-windows\platform-tools)

Note: Downloading ROMs can be a bit time-consuming, as they are fairly large files – put on a pot of coffee and maybe play some Shell Shockers or Moto X3M while you wait.

Now also download the Huawei Firmware Finder, and the Huawei Update Extractor (Windows). Use this version of the Update Extractor if you are using Mac or Linux. Save them on your desktop for later.

You should also download and save the Magisk Manager APK on your external SD card.

Alternatively, you can download this patched Ramdisk (patched_boot.img) which has Magisk included, thus you won’t need to download all of the above files. However it uses MHA-L29 8.0.0.370(C432) build number, so you are at risk for something going wrong if you do not have the same build number (Settings > About Phone > Build Number).

So now turn off your Huawei Mate 9, then connect it to your PC via USB while holding volume down button. You should get a screen that says you’re in Fastboot and Rescue Mode.

Now launch an ADB terminal (hold shift + right click in your main ADB folder and choose ‘Open a command prompt here’).

Now to make sure the ADB connection is recognized, type: fastboot devices

Now copy the Treble-based ROM to your main ADB folder, and type into the ADB terminal: fastboot flash system xxxx.img (replace xxxx with the filename)

Your ROM should start flashing with the message ‘target reported max download size of 494927872 bytes’, and the process should take about a minute.

Once the flashing process is finished, do not reboot your device yet. You need to reboot to recovery by turning off your phone (hold down power button for ~5 seconds) and holding volume up.

Once you are in the EMUI recovery, you need to wipe cache and wipe data/factory reset. This is important or else things could go really bad, such as recovery loops.

Once those have been wiped, you can reboot to system and go through the Android configuration wizard.

Rooting the Huawei Mate 9 on a Treble ROM

Your Treble ROM is not rooted by default. However, the Treble ROM will itself trigger the SafetyNet flag, which means even if your phone is not rooted, it is not certified. So it is obviously completely optional, but it is extremely recommended to install Magisk.

If you downloaded the patched_boot.img we provided, the install process will be extremely easy. It will install Magisk 16.7 (only Beta works with Treble right now). So all you have to do is:

Get to fastboot mode by turning off your phone, and then plugging it to your PC while holding volume down button. Then, type the following command in the same command prompt window: fastboot flash recovery_ramdisk patched_boot.img

This should be extremely quick. Once it is done, you can reboot your Huawei Mate 9 and then proceed to download Magisk Manager – however, SafetyNet will trip.

It should take around 5 seconds. Now you can reboot and download Magisk Manager. But Safetynet will still trigger (if it doesn’t, tell me). You’ll have to follow E. SAFETYNET.

If you did not use the patched_boot.img download, you need to perform a few more steps.

Check your phone Android version and build number. It is in Settings > About phone. Write it down, you’ll need it.

Install and launch Huawei Firmware Finder on your PC. Navigate to the ‘Common Base’ tab and type in your phone build number.

Find the matching build number in the list. Make sure its type is ‘FullOTA-MF’ and its size is around or more than 2 gigabytes.

Now click on the blue link in the ‘Filelist’ column. Copy paste the first (ending with ‘update.zip’) in your browser to download the zip file. It should take some time.

Once it’s downloaded, open it with 7Zip/WinRar and extract the file named ‘UPDATE.APP’.

Open Huawei Update Extractor, go to the Settings tab and untick everything.

Now, go to the Extract tab and click on the dots on the right and select your extracted ‘UPDATE.APP’. A ton of files should appear.

Right click on ‘RAMDISK’, and ‘Extract selected’. Put it somewhere on your PC, you’ll need it.

Plug your phone on your computer and put your RAMDISK.IMG in a folder on your phone.

On your phone, download and install Magisk Manager. If it prompts you to do so, do not install it. Then go to Settings tab and change ‘Update Channel’ to ‘Beta’.

Now go back and tap ‘Install’, then choose ‘Patch Boot Image File’ and select your RAMDISK.IMG that you transferred to your phone. Then let Magisk do its thing.

Once it’s done, on your PC, go to Your Phone/Internal Store/MagiskManager, and transfer the file ‘patched_boot.img’ to your Minimal ADB folder.

Turn off your phone and get to fastboot mode. You know how to do it now, don’t you ?

In the same command prompt on your PC, type: fastboot flash recovery_ramdisk patched_boot.img

It should take around 5 seconds. Now you can reboot and once you’re back in the Android system, you’re rooted. SafetyNet however will be triggered.

SafetyNet Procedure

Magisk may be installed, but with a Treble Rom, SafetyNet should trigger anyway. So you’ll have to do a few things.

In Magisk Manager, go to the Downloads tab and search for ‘MagiskHide Props Config’. Install it, then reboot your phone.

Once your phone is rebooted, download Terminal Emulator on the Play Store

Alternative method:

Go to developer options and enable ‘Local Terminal’.

Open your terminal, then type:

su

props

This should display a menu which you can navigate by entering the proper keys.

Type 1 (Edit device fingerprint), then f, then choose a vendor and a model by typing the right number, then press y. Don’t reboot yet (press n)

Type 6 (Script settings), then 1, then y. Now you can reboot (press y). Once it’s done, make sure that ‘boot stage’ is ‘currently post-fs-data’. Otherwise SafetyNet will still trigger.

Your phone should pass SafetyNet. You can check this by trying to search for the Netflix app on the Play Store or going into the Play Store settings and making sure your device is Certified’.

Tags

Kamil Anwar


A former British Computer Society Member with over 9 years of experience Configuring, Deploying and Managing Switches, Firewalls and Domain Controllers also an old-school still active on FreeNode.

Expert Tip

How to Install a Treble ROM on Huawei Mate 9

If the issue is with your Computer or a Laptop you should try using Reimage Plus which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Reimage by clicking the Download button below.

Download Now

I'm not interested

Close