[Huawei P9 Guides, News, & Discussion] Tecalote:
2022-06-21: This Post is under construction - please wait until the update is ready

Enable Root Access

Instructions for root access

Root is not required, but if you still wish, here is the guide:​

Due to the fact TWRP cannot access the encrypted data partition, you cannot JUST flash Magisk!!

→ A) But you can flash Magisk with TWRP using a workaround

→ B) Alternatively it is possible to flash a Magisk patched ramdisk.img in Fastboot mode

A) Workaround for flashing Magisk with TWRP – for Advanced Users:

1) Download the favorite Magisk version from here (all releases): https://github.com/topjohnwu/Magisk/releases

The actual and newest stable version you can get always from here too: https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

2) Copy the flashable Magisk-vXX.zip and Magisk Manager apk to external SD – and make sure, you have Developer options with 1) ADB Debugging and 2) USB Debugging (in this order) enabled.

3) Reboot device to TWRP, cancle Password, allow system-modification (swipe to confirm)

4) On the main menu go first to "Mount" - down left click on "Select storage" and choose "Micro SD"

5) Go back to main menu and open "Advanced" and open "Terminal"

NOTE:

If you have got a OTA-Firmware Update with “Patch02” or “Patch01” before flashing the Network Patch (after Network Patch, you will not see this in "About phone"!) or if you don’t remember, then use following both Lines in Terminal, but if you are sure, you have only Firmware without Patch 01 or Patch02, then use just "Keep Force encrypt" Line. Write the Lines in TWRP/Terminal exactly.

6) Write following code with Terminal:

echo KEEPVERITY=true>>/cache/.magisk
echo KEEPFORCEENCRYPT=true>>/cache/.magisk

→ Confirm each Line with blue/white checkmark on keyboard, before writing the next Line and confirm also the second Line (if you use two)

7) Go back to the main menu to "Install" and flash Magisk - after that reboot phone without wipe of Dalvik/Cache!

8) Search for Magisk Manager on Homescreen - if it is not installed, just install the Magisk Manager apk

9) Open Magisk Manager → everything should be okay

10) Open normal settings /apps & notifications /Magisk Manager /permissions and make sure Magisk Manager has permission for storage.

11) From Magisk Manager menu above left, section “Downloads” – download and install directly “Busybox for Android NDK” by osmosis – save log and reboot phone.

→ If Magisk get a major update, uninstall first Magisk from Magisk Manager and use “uninstall” button. “Uninstall complete” The phone restarts automatically. After that you can flash the new Magisk and reflash the modules.

B) Flashing Magisk with patched ramdisk.img in Fastboot mode:

If you don’t want flash Magisk with the TWRP workaround – you can use a Magisk patched ramdisk.img instead.

1) You can patch ramdiks.img from update.app by yourself, with following method:

Extract the update.zip of the current installed Firmware, because we need the UPDATE.APP.

Download Huawei Extractor v0.9.9.5 from here: https://xdaforums.com/showthread.php?t=2433454

In the settings of the Huawei Extractor disable "verify header checksum" - then put with drag and drop the UDPATE.APP into Huawei Extractor and extract by right click the RAMDISK.img (on earlier Android Versions it would be: BOOT.img)

2) Copy the original RAMDISK.img to your phone to the internal storage in the folder: Download

3) Install the latest Magisk Manager: https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

4) Open Magisk Manager, Magisk Manager ask you "Install Magisk-vx.zip?" - first click on: no thanks

5) Since internal storage is encrypted by default, you must first enable the checkbox: "Preserve force encryption"

5) If you have installed a OTA-Firmware Update with Patch01 or Patch02 – then enable additional the checkbox "Preserve AVB 2.0/dm-verity" in Magisk Manager.

6) Then click on "Install" - "You want to install Magisk-v1x.zip now?" - Install - Patch Boot Image File...

7) Navigate to Download folder, and choose RAMDISK.img

8) Magisk will now patch the RAMDISK.img and and once that's done, Magisk will save the patched ramdisk.img with the new name: patched_boot.img in the "Download" folder on internal storage.

→ Do not be confused - this is just named “patched_boot.img, but it is in fact the patched ramdisk.img !

9) Go to Settings /Apps & notifications/Apps and uninstall Magisk Manager

10) Now you must flash the “patched_boot.img” – Reboot your phone into Fastboot mode

Android 8:

fastboot flash ramdisk patched_boot.img

10) Reboot phone, install again newest Magisk Manager, open it and you will be asked: "Requires Additional setup - to you want to proceed now" Yes. → This step is required for to work properly.

2) Instead of doing yourself – you can use the already patched ramdisk.img:.

→ important: the right patched ramdisk img must be used for the right Firmware version (example: b540)

Magisk patched ramdisk.img you can download always from @zgfg MEGA folder:

https://mega.nz/#F!JwkVyRya!Rb7OUE0z3PEpXBRxGOM-vQ

And you can download also from my folder: https://www.androidfilehost.com/?w=files&flid=290471

Current version:

→ depending if you have b540 with OTA-Patch02 or b540 without Patch02 (you must know, because after flashing Network Patch you cannot see it in Settings /System /About phone !)

Magisk 18.1 patched ramdisk.img for b540 without OTA-Patch02:

https://www.androidfilehost.com/?fid=1395089523397898715

Magisk 18.1 patched ramdisk.img for b540 Firmware with OTA-Patch02:

https://www.androidfilehost.com/?fid=1395089523397898717

→ if you don’t remember, if you have OTA-Patch02 installed, then use the one for Patch02

Installing patched ramdisk.img:

Reboot your Phone into Fastboot mode and flash the patched ramdisk.img with following command → depending on which version you install:

fastboot flash ramdisk EVA-b540_Magisk_v18.1_Encrypt-Ramdisk.img

fastboot flash ramdisk EVA-b540_Patch02-Magisk_v18.1_Encrypt_AVB-Ramdisk.img

Google Playstore certification

You can try it with method by @zgfg:

https://xdaforums.com/showpost.php?p=79070144&postcount=1574

→ If it does not work you can try advanced method:

1) Set your phone into Flight Mode (no network should be connected)

2) Open Settings/Apps & notification/Apps and down right in the dot menu click on: show systemprocessing

3) Go step by step into following Apps (if there): Google - Google Play Store - Google Play Services - Google-Service-Framework - each has the entry: storage - delete ONLY cache /not data

4) Open with Mixplorer the directory:

/data/data/com.android.vending/shared_prefs - search for the xml file: finsky.xml

5) Open finsky.xml with TEXT Mixplorer Text Editor

6) Search inside finsky.xml for: <boolean name="device-google-certified"value="false" - change it to:

<boolean name="device-google-certified"value="true"

- means, you change only "false" to: "true"

7) click on the save symbol to save the changes! - close Mixplorer and everything in the Background

8) Disable Flight Mode (so Phone search for network connections)

9) Reboot your Phone

10) Open Playstore menu /settings/ =certified

If you have problems with current version of Magisk and using Gpay (Google Pay), try following workaround:

https://xdaforums.com/showpost.php?p=79028818&postcount=5

How to uninstall Magisk:

A) Before you doing an OTA Update, it is required to uninstall Magisk → and also make sure, to have Stock EMUI Recovery installed (instead of TWRP).

B) In case for a “major” Magisk update it is also sometimes necessary to uninstall Magisk before installing the new version, because with directly update the phone could get a Bootloop. (But normally Magisk updates can be done directly and without uninstalling Magisk before).

C) If your device can not boot into system due to an incompatible Magisk Module.

a + b) If you can boot normally to system, you can uninstall Magisk from Magisk Manager - just use the "Uninstall" button “Uninstall complete”. Magisk will be uninstalled and Magisk files deleted from /data directory. Thereafter, the P9 is restarted automatically.

c) If your device can not boot into system due to an incompatible Magisk Module, you can flash the original EMUI Stock ramdisk.img (which is not patched with Magisk)

→ ramdisk.img must match the Firmware version of your device

For the current Firmware EVA-AL10 b540 you can download the original ramdisk.img here:

EVA-b540-RAMDISK.img:

https://www.androidfilehost.com/?fid=1395089523397898709

You can flash it in Fastboot Mode:

fastboot flash ramdisk EVA-b540-RAMDISK.img

Alternatively, you can flash the image with TWRP.

In this case you flash the img with TWRP by using: "flash img" - but important is, you must flash it to: ramdisk (and NOT to recovery_ramdisk !!)

Soon you have installed the EMUI ramdisk.img, the device can boot to system again and Magisk is disabled.

Enjoy :cowboy::cool:

Credits:

@osm0sis Busybox for Android NDK

@Didgeridoohan MagiskHidePropsConfig module

@topjohnwu Magisk root