[GUIDE] [EMUI9] P20 Lite Basics

Search This thread

Frax3r

Senior Member
May 18, 2016
71
53
Huawei P20 Lite

Special key combos:​

  • Power + Vol+ = Recovery Mode
  • While USB connected, Power + Vol+ = Erecovery Mode
  • While USB connected, Vol- = Fastboot
  • Plug USB while holding down Vol+ + Vol- = Download Mode
  • Power + Vol+ + Vol- = Force Dload

Flashing Any GSI

Note:​

Phh is "retiring". Community of builders created trebledroid initiative to keep his work alive. Don't expect same level of quality for a while.
  • Use vndklite variants.
  • At no point you need to wipe /data or any other partition. Just do factory reset.
  • If you want to backup via twrp you need to have encryption disabled.
  • Almost all chromium based browsers including chrome freeze after few minute of use. That is caused by DRM not working as intended in gsis. To fix it flash DRM fix.
  • Permissive kernel shouldn't be used daily. Please only use it for debugging purposes.

Prerequisites:​

  • ADB and Fastboot Installed (1)
  • Any Arm64 AB GSI image (1) (2) (3) (4) (5)
  • Google apps package (Optional) (1) (2) (3) (4)
  • TWRP
  • Unlocked Bootloader
  1. Tick "Enable OEM Unlock" from developer options
  2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  3. Flash gsi image: fastboot flash system drag & drop img file to console
  4. Flash Stock Recovery: fastboot flash recovery_ramdisk and drag & drop img file to console
  5. Boot into recovery: power + vol+ while NOT connected to pc
  6. Factory reset: Factory Reset > Type yes > Press power
  7. Boot into system
  1. Tick "Enable OEM Unlock" from developer options
  2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  3. Flash gsi image: fastboot flash system drag & drop img file to console
  4. Flash Phenix Kernel (Optional): fastboot flash kernel and drag & drop img file to console
  5. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
  6. Boot into recovery: power + vol+ while NOT connected to pc
  7. Factory reset: Wipe > Swipe Factory Reset
  8. Resize system: Wipe > Advanced Wipe > Tick System > Repair or Change File System > Swipe Resize File System
    if it fails issue these commands from your computer:
    adb shell "/sbin/e2fsck -fp /dev/block/platform/hi_mci.0/by-name/system"
    adb shell "/sbin/resize2fs /dev/block/platform/hi_mci.0/by-name/system"
  9. Encrypt or Decrypt /Data (Optional): Mount > Tick Vendor > adb push drag & drop fstab file to console /vendor/etc
  10. Flash DRM fix (Optional): ''
  11. Flash NFC fix (Optional / Might not Work): ''
  12. Flash Gapps Zip (Optional): ''
  13. Boot into system: Reboot > System
  1. Tick "Enable OEM Unlock" from developer options
  2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  3. Flash gsi image: fastboot flash system drag & drop img file to console
  4. Flash one of these kernel (Optional): fastboot flash kernel and drag & drop img file to console
  5. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
  6. Boot into recovery: power + vol+ while NOT connected to pc
  7. Factory reset: Wipe > Swipe Factory Reset
  8. Flash this AIO fix : Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
  9. Flash Gapps Zip (Optional): ''
  10. Boot into system: Reboot > System
Flash over to erecovery:
  1. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  2. Flash one of these (1) (2) twrp images: fastboot flash recovery_ramdisk and drag & drop img file to console
  3. Boot into twrp: power + vol+ while NOT connected to pc
  4. Push twrp to /cache: adb push drag & drop img file to console /cache
  5. Flash twrp to erecovery: Install > Install Image > Select twrp image from /cache folder > Pick erecovery_ramdisk partition > Swipe
After you set up your phone and made sure you don't need stock recovery, flash magisk:
  1. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  2. Flash magisk patched image: fastboot flash recovery_ramdisk and drag & drop img file to console
From now on this is how you boot:
  • No keypress: System (Long yellow warning)
  • Power & Vol+ before Yellow Warning : System with magisk (Short yellow warning)
  • Vol+ on Yellow Warning : TWRP
If you want to return to stock erecovery, do these:
  1. Boot into twrp
  2. Push erecovery image to /cache: adb push drag & drop img file to console /cache
  3. Flash erecovery to erecovery: Install > Install Image > Select erecovery image from /cache folder > Pick erecovery_ramdisk partition > Swipe
Keep in mind that Safetynet is deprecated and Google is encouraging developers to switch to Play Integrity API. To pass safetynet you need to have 3 checkmarks, as such you'll need to follow all 3 instructions I'm about to give you.
Disable "Spoof Pixel 5" & Enable Safetynet in phh options then reboot.
Download YASNAC from play store and check for "Evaluation Type" from result.
If it says Basic and others fail you can skip this part.

If test fails or doesn't finish do these:
Install Magisk
Enable Zygisk & Enforce denylist
Install Universal SafetyNet Fix module by kdrag0n
Now check YASNAC again. It should finish test and say Basic in evaluation type.
This happens because root is detected most of the time.
If your GSI has Dynamic Root, uncheck root from phh settings.
If your GSI has SU, securize from phh settings.
If you had to flash magisk because of evaluation type, tick google play and google play services in denylist.

If those didn't fix, contact GSI maintainer.
This happens because build fingerprint is not play certified.

Make sure you have safetynet option ticked in phh settings and do these:
Edit /data/adb/phh/secure
Add these 2 lines to bottom:
resetprop_phh ro.build.fingerprint HUAWEI/ANE-LX1/HWANE:9/HUAWEIANE-L01/9.1.0.368C432:user/release-keys
resetprop_phh ro.build.version.security_patch 2020-08-01
Reboot and test again.

Everytime you untick safetynet you have to edit this file again. You can also pick any other fingerprint from here should you choose to. You need both fingerprint and patch date. If you want to simulate other devices add following lines:
resetprop_phh ro.product.brand HUAWEI
resetprop_phh ro.product.device HWANE
resetprop_phh ro.product.manufacturer HUAWEI
resetprop_phh ro.product.model ANE-LX1
resetprop_phh ro.product.name ANE-LX1
If you want to pass it you're going to have to read this wall of text. I can't shorten it.

What is Play Integrity:
Google enforces Play Inregrity once your api level is set to 33 (android 13). I currently don't have enough information about it other than apps can decide which checks to perform on your device. One of those checks is called strong integrity. We can't pass strong integrity because it requires hardware backed checks which our device lack. However you can still fool some apps that don't enforce strong integrity.

How you can fool it:
Ever since magisk retired magiskhide, some forks have been made to keep it maintained and improved. One of those forks is Magisk Delta. Before you head over to it's github and install it, you still need to install a valid CTS fingerprint. Then you can install Magisk Delta.

Steps:
Disable Spoof Pixel 5 & Enable Safetynet from phh settings if they exist.
Add these 2 lines to bottom of /data/adb/phh/secure (create if it doesnt exist) & Reboot
resetprop_phh ro.build.fingerprint HUAWEI/ANE-LX1/HWANE:9/HUAWEIANE-L01/9.1.0.368C432:user/release-keys
resetprop_phh ro.build.version.security_patch 2020-08-01

If you have magisk :
- Download Magisk Delta apk
- Change .apk to .zip
- Install it as magisk module
If you don't have magisk :
- Download & install Magisk Delta apk
- Patch recovery_ramdisk & flash it via fastboot

Enable Zygisk and MagiskHide from Magisk Delta App
Install this module : https://github.com/HuskyDG/safetynet-integrity-fix/releases
MAKE SURE GMS IS NOT IN HIDELIST
Reboot and test safetynet. (Feel free to link any app that tests for Play Integrity)
That happens because EMUI stores it's themes and few stock apps in /data/hw_init folder. When you factory reset with stock recovery, they are preserved. But when you use twrp to factory reset they are removed. Doing factory reset once from twrp is enough to make EMUI think it's corrupted, in acuality it isn't. To fix it you can either let EMUI update from system settings or you can download this, extract hw_init folder and push folder to /data from twrp with this command :
adb push drag & drop hw_init folder to console /data

Flashing LineageOS 16.0

Note:​

Stock kernel from EMUI .300> have trouble with wifi. Use Phenix 4.9.319 or above to fix it.

Prerequisites:​

  • ADB and Fastboot Installed (1)
  • Google apps package (Pick Pie or 9.0 editions) (1) (2) (3) (4)
  • LineageOS Zip (From Archive or From Mega)
  • Phenix Kernel (Else you won't have wi-fi)
  • TWRP (3.4.0 is needed for factory reset functionality)
  • Unlocked Bootloader
  1. Tick "Enable OEM Unlock" from developer options
  2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
  3. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
  4. Flash Phenix Kernel (Required for Wi-Fi): fastboot flash kernel and drag & drop img file to console
  5. Boot into twrp: power + vol+ while NOT connected to pc
  6. Flash lineage zip: Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
  7. Factory reset: Wipe > Swipe Factory Reset
  8. Boot into Vanilla LineageOS or Keep following to flash gapps

  9. Encrypt or Decrypt /Data (Optional): Mount > Tick Vendor > adb push drag & drop fstab file to console /vendor/etc
  10. Flash gapps zip: Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
  11. Boot into system: Reboot > System

Getting Stock Firmware Files And Downgrading

Sources:​

Firmware finder has been revived and you can use that to get your prefered cust or build.
If you need only one image not the whole build, I uploaded each one you'd typically need below.

CUST.img
DTS.img
ERECOVERY_KERNE.img
ERECOVERY_RAMDI.img
ERECOVERY_VBMET.img
ERECOVERY_VENDO.img
FASTBOOT.img
KERNEL.img
ODM.img
PRODUCT.img
RECOVERY_RAMDIS.img
RECOVERY_VBMETA.img
RECOVERY_VENDOR.img
SYSTEM.img
VBMETA.img
VENDOR.img
XLOADER.img

They are from .401 c432.
If you wiped /data once you probably won't have emui themes etc if you go back to emui. To fix that you can push hw_init folder (in data.7z) to /data. Not the contents of it, just put the folder in root of /data. It should be like this: /data/hw_init
Connect your phone to pc and open up hisuite. Check for updates and if it finds one it'll download following files update_full_base.zip, update_full_ANE-L01_hw_eu.zip and update_full_cust_ANE-L01_hw_eu.zip to your documents folder. update_full_base.zip file contains main UPDATE.APP. You can extract images from it with Huawei Update Extractor
Flash magisk patched image from quick links. After you get root in EMUI allow system updater to do its job and update. It'll ask to reboot, allow it. It will throw you back to system after reboot because recovery is not stock. Get a file manager that allows root access. Allow system updater to download again. But this time do not allow it to reboot. First one downloaded OTA, second one downloaded FullOTA. Which is better for archival purposes. After download is done go to /data/update with a root file explorer. Copy HwOUC folder to internal storage and from there to your pc. There should be 3 folders with numbers. You can find our main update_full_base.zip in one of them.

Get files of your prefered build. I recommend build .278. Extract SYSTEM.IMG from UPDATE.APP via huawei update extractor and flash it with fastboot flash system . Factory reset with stock recovery then flash any TWRP except for the official ones. Official TWRPs freezes when wiping /data which is what we need to do. After wiping /data boot into system. You should have aosp background with square app icons if you did correctly. Check for system updates and it should find your current build. Download and install.
BOOTLOADER WILL RELOCK, DON'T DO THIS IF YOU DON't HAVE YOUR BL CODE
For this you need to have a sd card that is formated as exfat. Fat32 doesn't allow >4gb files so exfat is required. Download your prefered build from Androidhost.ru or mega link above. Inside the zip file you'll find a folder named dload. Extract this folder to somewhere and transfer it to your sd card. Folder structure should look like below. Hw_eu and L01/L21 will depend on your region and single/dual sim status. After this unplug your phone and shut it down. Start pressing vol- vol+ and power all at the same time. Different kind of yellow warning will appear and a screen with blue progress bar over black background will appear. If you downloaded correct variant for your phone it'll start progressing. After process is done you'll boot into stock emui with NO yellow warning. This is because your bootloader is locked. Do whatever you want at this point but remember, unlocking bootloader again will low level factory reset your phone.

-/storage/AAAA-BBBB/dload
---/update_sd
---/ANE-L01_hw_eu
---/ANE-L21_hw_eu
If I recall correctly there is only one way to do this. You can't dload between emui versions. You also need to be on stock emui for hisuite to function. Some people say a specific hisuite version is required but it wasn't the case for me. Plug your phone to pc, hisuite should show up beside your phone in drives section. Install it and open it. Do whatever it instructs you to function correctly. After you see your phone in app click Update button. Then click on "Earlier Versions". It'll show version 8.0.0.167 along with some warnings. Rest it pretty straightforward. Follow along and it'll return you back to emui 8. But if you're doing this to unlock your bootloader, build .167 is not enough. Exploit that dc-unlocker uses is patched in this version. So you have to roll back further. I had success with .125 build but up until .150 could work. Link to .125 build.

edit ? : Revised guide
 
Last edited:
Jul 19, 2021
26
3
Hello there! Alive parts of this forum is still filled with simple help requests so I decided to put together a simple all-in-one thread that basically covers most stuff. I don't wanna get into bootloader unlocking because right now only free way to do so is with potatoNV which I do not know how to use. Dc-unlocker is an option too but it is 4€ so pick your poison.​

Special key combos:​

  • Power + Vol+ = Recovery Mode​
  • While USB connected, Power + Vol+ = Erecovery Mode​
  • While USB connected, Vol- = Fastboot​
  • Plug USB while holding down Vol+ + Vol- = Download Mode​
  • Power + Vol+ + Vol- = Force Dload​

Flashing LineageOS 16.0​

Prerequisites:​

  • Emui Version below 9.1.0.300
  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Los16 zip
  • Official TWRP
  • Stock recovery_ramdis.img
  • Your choice of gapps zip

Steps:​

  1. Get the Prerequisites
  2. I recommend sending los 16 zip, recovery_ramdis.img and gapps zip to sd card if possible
  3. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  4. Connect phone to PC and allow debugging from phone
  5. Send adb reboot bootloader command from console
  6. After restart write fastboot flash recovery_ramdisk to console and drag twrp-3.5.2_9-0-anne.img over to console and press enter
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. Allow modifications
  10. Press Install and select los 16 zip file
  11. If you want to disable encryption do it now
  12. Press Install and press Install Image
  13. Select and flash stock recovery_ramdis.img to recovery_ramdisk partition
  14. Press Reboot and select shut down
  15. Press and hold power + vol+ buttons until short yellow warning shows up
  16. Select factory reset and type yes, while it is doing that plug the phone to pc
  17. After factory reset is complete select reboot option and hold down vol- until you're at fastboot
  18. Repeat step 6-7-8
  19. Los 16 don't need to be resized so go to install and select gapps zip
  20. Reboot to system

Flashing Any GSI​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • GSI image (1) (2)
  • Official TWRP
  • Stock recovery_ramdis.img
  • Your choice of gapps zip (Optional)

Notes:​

If you're gonna use Phh's AOSP11 and anything that based on it (with the exception of @eremitein's stuff), use arm64-ab-vndklite variant. For anything else use full vndk version. Full vndk version of Phh's AOSP11 does not allow you to resize system on any twrp.

Steps for gapps versions:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. Send adb reboot bootloader command from console
  5. After restart write fastboot flash system to console and drag gsi .img over to console and press enter
  6. After flash is complete unplug phone and shut it down by long pressing power button
  7. Press and hold power + vol+ buttons until short yellow warning shows up
  8. You should be at stock recovery_ramdisk, do a factory reset
  9. You're good to boot up the system

Steps for vanilla versions with custom gapps:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. If you want to disable encryption do it now
  5. Send adb reboot bootloader command from console
  6. After restart write fastboot flash system to console and drag gsi .img over to console and press enter
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. You should be at stock recovery_ramdisk, do a factory reset
  10. Plug your phone back and press reboot from screen
  11. While booting press and hold vol- button until you're at fastboot
  12. Write fastboot flash recovery_ramdisk to console and drag twrp-3.5.2_9-0-anne.img over to console and press enter
  13. After flash is complete unplug phone and shut it down by long pressing power button
  14. Press and hold power + vol+ buttons until short yellow warning shows up
  15. Allow modifications
  16. Press Wipe, press Advanced Wipe, select System, press Repair or Change File System, press Resize File System, swipe to resize
  17. Press Install, select and flash gapps zip
  18. Reboot to system

Disable Encryption​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Official TWRP
  • Stock recovery_ramdis.img

Notes:​

You can disable encryption at any step, even after booting, but in order to disable it you have to do a factory reset from stock recovery_ramdis. Because of this I recommend doing between flashing gsi and flashing gapps.

Steps:​

  1. Get the Prerequisites
  2. Boot to TWRP (power + vol+ after shutting down)
  3. Allow modifications
  4. Press Mount, select Vendor
  5. Connect phone to PC
  6. You can do next part 2 ways, if you're good with command line interface use steps 7 through 11, if not skip to step 12

  7. Type adb shell and press enter
  8. Type nano /vendor/etc/fstab.hi6250 and press enter
  9. Remove fileencryption=aes-256-xts:aes-256-cts part from 16th line, make sure there's only one comma between check and reservedsize
  10. Press Ctrl + X then Y and press enter
  11. Go to step 18

  12. Type adb pull /vendor/etc/fstab.hi6250 and press enter
  13. If you have adb in your $PATH go to your user profile folder, if not go to folder where adb.exe resides
  14. Open fstab.hi6250 via a text editor (please use notepad++)
  15. Remove fileencryption=aes-256-xts:aes-256-cts part from 16th line, make sure there's only one comma between check and reservedsize
  16. Save file and open a command prompt
  17. Send this command adb push ./fstab.hi6250 /vendor/etc/fstab.hi6250

    View attachment 5422531
  18. Now you need to do a factory reset with stock recovery_ramdis.img, if you have it installed go to step 21 if not do 19 or 20 first
  19. If you have TWRP installed, press Install and press Install Image then select and flash stock recovery_ramdis.img to recovery_ramdisk partition
  20. If not shut down phone, connect it to pc and hold down vol- until you're at fastboot, then write this command fastboot flash recovery_ramdisk and drag recovery_ramdis.img over to console then press enter
  21. Shut down phone and unplug it from pc
  22. Press and hold power+ vol+ until you see short yellow warning
  23. Press Factory Reset and type yes
  24. You've successfully decrypted your phone and you're good to boot up or flash gapps

Getting Stock Firmware Files And Downgrading​

Prerequisites:​

Getting stock files are problematic because of huawei. Least shadiest way to get them are the hardest so bear with me.

Androidhost.ru : Click the EMUI9 from prerequisites and search p20 lite. You should get a wide variety of versions to pick from. Make sure to match the Cust in the file to yours if you don't know what you're doing. C432 for Europe for example. After you download the zip file open it up and find the dload folder. You can either get this folder and paste it right into your sd card to force dload or you can open this folder and extract update_sd.zip. Inside update_sd.zip you'll find a file named UPDATE.APP. Use Huawei Update Extractor to open this file and there you'll see all the partitions you need. If HUE gives error while opening it, go to settings and untick "Verify file checksum". You can extract .img files by right clicking and selecting extract option on each partition. Normally you can't open these .img files but after pushing them through simg2img you'll be able to explore them too. But lets be real if you need guides for this, all you need is recovery_ramdis.img.

Using Dload Folder : Your sd card can't be FAT32 for this. FAT32 by nature don't allow files larger than 4gb so you can't get this folder to your sd card. Format it to ExFat via any guide on the internet then copy the dload folder to your sd card's root. It can't be inside any folders. Then shut your phone and press Power + Vol+ + Vol- all at the same time. It'll boot to erecovery which'll check the integrity of files then install them regardless of your EMUI version. So it is a good way to downgrade. Keep in mind tho you can't dload back to emui 8 from emui 9. And any successful dload will lock your bootloader back.

Hisuite : You can actually get firmware files pretty easily with hisuite but it requires real work. You see, hisuite downloads firmware files right into your documents folder. Connect your phone to pc and open up hisuite. Check for updates and if it finds one it'll download following files update_full_base.zip, update_full_ANE-L01_hw_eu.zip and update_full_cust_ANE-L01_hw_eu.zip. It might not get all 3 files most of the time so you have to copy each of them and update a few versions consecutively to get them. Keep in mind, it deletes each update file after it is successful so make sure to make a copy of them some place else. I recommend reverting back to EMUI8 through hisuite and then updating it to latest one to get all files. It is tidious but you need to do this once. It doesnt update you to .370 from .132. It'll send you .132 then .200 then .368 then latest whatever. You can actually use these files with HuRu updater or HwOTA to manually update. Or you can get the UPDATE.APP inside them and extract images with Huawei Update Extractor.

Erecovery : This one requires some network knowledge and it'll only get you the latest version so I don't think it worth the hassle. You need a router that allows you to change dns address for DHCP clients. Which most of them do these days. Now you need to create and run a dns server on your pc. I recommend adguard home. Pihole works too. Use Windows Subsystem For Linux or Docker to install either of them. Once you get them up and working set them to log dns requests. I believe you know where this is going. Open your router's interface and enter adguard home/pihole ip address which maps back to your pc's local address. Check if it works or not by opening up few sites on your phone which should be connected to your wifi and isn't set up to use a different dns server. If all is good open up erecovery on your phone and connect to your wifi. If you set it up correctly it should get the latest version from huawei which will show up on your log. Use that url to download it to your pc and extract it same as others. There was a paid service that used this method to send specific versions to your erecovery.

EMUI's System Updater : This is tricky and my favorite. Get the official TWRP .img and patch it with magisk manager. Then flash it via fastboot. I know, "twrp and magisk? wtf?" just do it. It takes a long time to boot but it works don't question me right now. After you get root in EMUI allow system updater to do its job and update. It'll ask to reboot, allow it. It will throw you back to system after reboot cuz recovery is hijacked. duh. Get a file manager that allows root access. Allow system updater to download again. But this time do not allow it to reboot. First one downloaded OTA, second one downloaded FullOTA. Which is better for archival purposes. After download is done search for a folder named HwOUC in /system. Copy it to internal storage and from there to your pc. You can find our main UPDATE.APP inside update_full_base.zip. Other zips include cust and all that which HuRu and HwOTA requires.

Magisk​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Stock recovery_ramdis.img

Notes:​

Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses. But hey it is still working without modifications unlike a-only devices so that's a win. As a foot note, you CAN use twrp image instead of stock recovery_ramdis.img but it'll take longer to boot. Using .380's recovery_ramdis.img on .278 build will not work. Make sure to match your EMUI build with ramdisk you're flashing. Ask me how I know.

Steps to install older version:​

  1. Get the Prerequisites
  2. No, I mean literally just get the Prerequisites and thats it
  3. Open up your browser and find a bin service (pastebin will suffice)
  4. Create a paste with following
    Code:
    {
      "app": {
        "version": "8.0.7",
        "versionCode": "4834",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/MagiskManager-v8.0.7.apk",
        "note": "https://cdn.jsdelivr.net/gh/topjohnwu/[email protected]/app/src/main/res/raw/changelog.md"
      },
      "stub": {
        "versionCode": "18",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/stub-release.apk"
      },
      "uninstaller": {
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-uninstaller-20210117.zip"
      },
      "magisk": {
        "version": "v21.4",
        "versionCode": "21400",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-v21.4.zip",
        "note": "https://topjohnwu.github.io/Magisk/releases/21400.md",
        "md5": "ee6dd05579776e7de3a6077087846e53"
      }
    }
  5. Get the paste's raw url
  6. Take the recovery_ramdis.img to internal storage
  7. Install magisk manager 8.0.7
  8. Open it's settings and select custom channel
  9. Write the raw url you just created
  10. Allow it to check for updates and it'll find that 21.4 is the latest version
  11. Click install and select recovery_ramdis.img
  12. After it finishes patching get the magisk_patched.img to your pc
  13. Get your phone to fastboot mode
  14. After connecting to pc, write this fastboot flash recovery_ramdisk to console and drag magisk_patched.img over to console and press enter
  15. Now if you enter recovery it'll boot to android with magisk but if you boot normally it will not detect magisk so each time you restart you have to use Power + Vol+ combo in order to get magisk
Remember to switch custom channel to stable channel if you want to receive updates.




I know that you can pretty much reduce the amount of flashing and restarting by flashing twrp to erecovery but since erecovery is a lifeline for most people here I decided not to get into that. But for those who are interested check this thread.​


Edit: Grammar
I wish good luck to those who will use your guide ☺️.
 

-Alf-

Senior Member
Sep 28, 2017
2,224
743
Huawei P9 Lite
Huawei P10 Lite
Among other things, the HwOTA and HuRupdater methods have not worked since February (unless someone has the necessary files stored on the disk). Huawei changed servers and Firmware Finder is dead.

EMUI 8 firmware download doesn't work for the same reasons .
 
Last edited:
  • Like
Reactions: Frax3r

Fjord1

Member
Jan 20, 2020
37
2
Hello there! Alive parts of this forum is still filled with simple help requests so I decided to put together a simple all-in-one thread that basically covers most stuff. I don't wanna get into bootloader unlocking because right now only free way to do so is with potatoNV which I do not know how to use. Dc-unlocker is an option too but it is 4€ so pick your poison.​

Special key combos:​

  • Power + Vol+ = Recovery Mode​
  • While USB connected, Power + Vol+ = Erecovery Mode​
  • While USB connected, Vol- = Fastboot​
  • Plug USB while holding down Vol+ + Vol- = Download Mode​
  • Power + Vol+ + Vol- = Force Dload​

Flashing LineageOS 16.0​

Prerequisites:​

  • Emui Version below 9.1.0.300
  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Los16 zip
  • Official TWRP
  • Stock recovery_ramdis.img
  • Your choice of gapps zip

Steps:​

  1. Get the Prerequisites
  2. I recommend sending los 16 zip, recovery_ramdis.img and gapps zip to sd card if possible
  3. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  4. Connect phone to PC and allow debugging from phone
  5. Send adb reboot bootloader command from console
  6. After restart write fastboot flash recovery_ramdisk to console and drag twrp-3.5.2_9-0-anne.img over to console and press enter
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. Allow modifications
  10. Press Install and select los 16 zip file
  11. If you want to disable encryption do it now
  12. Press Install and press Install Image
  13. Select and flash stock recovery_ramdis.img to recovery_ramdisk partition
  14. Press Reboot and select shut down
  15. Press and hold power + vol+ buttons until short yellow warning shows up
  16. Select factory reset and type yes, while it is doing that plug the phone to pc
  17. After factory reset is complete select reboot option and hold down vol- until you're at fastboot
  18. Repeat step 6-7-8
  19. Los 16 don't need to be resized so go to install and select gapps zip
  20. Reboot to system

Flashing Any GSI​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • GSI image (1) (2)
  • Official TWRP
  • Stock recovery_ramdis.img
  • Your choice of gapps zip (Optional)

Notes:​

If you're gonna use Phh's AOSP11 and anything that based on it (with the exception of @eremitein's stuff), use arm64-ab-vndklite variant. For anything else use full vndk version. Full vndk version of Phh's AOSP11 does not allow you to resize system on any twrp.

Steps for gapps versions:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. Send adb reboot bootloader command from console
  5. After restart write fastboot flash system to console and drag gsi .img over to console and press enter
  6. After flash is complete unplug phone and shut it down by long pressing power button
  7. Press and hold power + vol+ buttons until short yellow warning shows up
  8. You should be at stock recovery_ramdisk, do a factory reset
  9. You're good to boot up the system

Steps for vanilla versions with custom gapps:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. Send adb reboot bootloader command from console
  5. After restart write fastboot flash system to console and drag gsi .img over to console and press enter
  6. If you want to disable encryption do it now
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. You should be at stock recovery_ramdisk, do a factory reset
  10. Plug your phone back and press reboot from screen
  11. While booting press and hold vol- button until you're at fastboot
  12. Write fastboot flash recovery_ramdisk to console and drag twrp-3.5.2_9-0-anne.img over to console and press enter
  13. After flash is complete unplug phone and shut it down by long pressing power button
  14. Press and hold power + vol+ buttons until short yellow warning shows up
  15. Allow modifications
  16. Press Wipe, press Advanced Wipe, select System, press Repair or Change File System, press Resize File System, swipe to resize
  17. Press Install, select and flash gapps zip
  18. Reboot to system

Disable Encryption​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Official TWRP
  • Stock recovery_ramdis.img

Notes:​

You can disable encryption at any step, even after booting, but in order to disable it you have to do a factory reset from stock recovery_ramdis. Because of this I recommend doing between flashing gsi and flashing gapps.

Steps:​

  1. Get the Prerequisites
  2. Boot to TWRP (power + vol+ after shutting down)
  3. Allow modifications
  4. Press Mount, select Vendor
  5. Connect phone to PC
  6. You can do next part 2 ways, if you're good with command line interface use steps 7 through 11, if not skip to step 12

  7. Type adb shell and press enter
  8. Type nano /vendor/etc/fstab.hi6250 and press enter
  9. Remove fileencryption=aes-256-xts:aes-256-cts part from 16th line, make sure there's only one comma between check and reservedsize
  10. Press Ctrl + X then Y and press enter
  11. Go to step 18

  12. Type adb pull /vendor/etc/fstab.hi6250 and press enter
  13. If you have adb in your $PATH go to your user profile folder, if not go to folder where adb.exe resides
  14. Open fstab.hi6250 via a text editor (please use notepad++)
  15. Remove fileencryption=aes-256-xts:aes-256-cts part from 16th line, make sure there's only one comma between check and reservedsize
  16. Save file and open a command prompt
  17. Send this command adb push ./fstab.hi6250 /vendor/etc/fstab.hi6250

    View attachment 5422531
  18. Now you need to do a factory reset with stock recovery_ramdis.img, if you have it installed go to step 21 if not do 19 or 20 first
  19. If you have recovery_ramdis.img in your sd card, press Install and press Install Image then select and flash stock recovery_ramdis.img to recovery_ramdisk partition
  20. If not shut down phone, connect it to pc and hold down vol- until you're at fastboot, then write this command fastboot flash recovery_ramdisk and drag recovery_ramdis.img over to console then press enter
  21. Shut down phone and unplug it from pc
  22. Press and hold power+ vol+ until you see short yellow warning
  23. Press Factory Reset and type yes
  24. You've successfully decrypted your phone and you're good to boot up or flash gapps

Getting Stock Firmware Files And Downgrading​

Prerequisites:​

Getting stock files are problematic because of huawei. Least shadiest way to get them are the hardest so bear with me.

Androidhost.ru : Click the "Firmware Zips" from prerequisites and search p20 lite. You should get a wide variety of versions to pick from. Make sure to match the Cust in the file to yours. C432 for Europe for example. After you download the zip file open it up and find a folder named "dload". You can either get this folder and paste it right into your sd card to force dload or you can open this folder and extract update_sd.zip. Inside update_sd.zip you'll find a file named UPDATE.APP. Use Huawei Update Extractor to open this file and there you'll see all the partitions you need. If HUE gives error while opening it, go to settings and untick "Verify file checksum". You can extract .img files by right clicking and selecting extract option on each partition. Normally you can't open these .img files but after pushing them through simg2img you'll be able to explore them too. But lets be real if you need guides for this, all you need is recovery_ramdis.img.

Using Dload Folder : Your sd card can't be FAT32 for this. FAT32 by nature don't allow files larger than 4gb so you can't get this folder to your sd card. Format it to ExFat via any guide on the internet then copy the dload folder to your sd card's root. It can't be inside any folders. Then shut your phone and press Power + Vol+ + Vol- all at the same time. It'll boot to erecovery which'll check the integrity of files then install them regardless of your EMUI version. So it is a good way to downgrade. Keep in mind tho you can't dload back to emui 8 from emui 9. And any successful dload will lock your bootloader back.

Hisuite : You can actually get firmware files pretty easily with hisuite but it requires real work. You see, hisuite downloads firmware files right into your documents folder. Connect your phone to pc and open up hisuite. Check for updates and if it finds one it'll download following files update_full_base.zip, update_full_ANE-L01_hw_eu.zip and update_full_cust_ANE-L01_hw_eu.zip. You only need update_full_base.zip file, others are used to work on HuRUpdater and HwOTA but they are deprecated since February. Inside update_full_base.zip you'll find UPDATE.APP which you can extract images from with Huawei Update Extractor.

Erecovery : This one requires some network knowledge and it'll only get you the latest version so I don't think it worth the hassle. You need a router that allows you to change dns address for DHCP clients. Which most of them do these days. Now you need to create and run a dns server on your pc. I recommend adguard home. Pihole works too. Use Windows Subsystem For Linux or Docker to install either of them. Once you get them up and working set them to log dns requests. I believe you know where this is going. Open your router's interface and enter adguard home/pihole ip address which maps back to your pc's local address. Check if it works or not by opening up few sites on your phone which should be connected to your wifi and isn't set up to use a different dns server. If all is good open up erecovery on your phone and connect to your wifi. If you set it up correctly it should get the latest version from huawei which will show up on your log. Use that url to download it to your pc and extract it same as others. There was a paid service that used this method to send specific versions to your erecovery.

EMUI's System Updater : This is tricky and my favorite. Get the official TWRP .img and patch it with magisk manager. Then flash it via fastboot. I know, "twrp and magisk? wtf?" just do it. It takes a long time to boot but it works don't question me right now. After you get root in EMUI allow system updater to do its job and update. It'll ask to reboot, allow it. It will throw you back to system after reboot cuz recovery is hijacked. duh. Get a file manager that allows root access. Allow system updater to download again. But this time do not allow it to reboot. First one downloaded OTA, second one downloaded FullOTA. Which is better for archival purposes. After download is done search for a folder named HwOUC in /system. Copy it to internal storage and from there to your pc. You can find our main UPDATE.APP inside update_full_base.zip. Other zips include cust and all that which HuRu and HwOTA used to require.

Magisk​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Stock recovery_ramdis.img

Notes:​

Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses. But hey it is still working without modifications unlike a-only devices so that's a win. As a foot note, you CAN use twrp image instead of stock recovery_ramdis.img but it'll take longer to boot. Using .380's recovery_ramdis.img on .278 build will not work. Make sure to match your EMUI build with ramdisk you're flashing. Ask me how I know.

Steps to install older version:​

  1. Get the Prerequisites
  2. No, I mean literally just get the Prerequisites and thats it
  3. Open up your browser and find a bin service (pastebin will suffice)
  4. Create a paste with following
    Code:
    {
      "app": {
        "version": "8.0.7",
        "versionCode": "4834",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/MagiskManager-v8.0.7.apk",
        "note": "https://cdn.jsdelivr.net/gh/topjohnwu/[email protected]/app/src/main/res/raw/changelog.md"
      },
      "stub": {
        "versionCode": "18",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/stub-release.apk"
      },
      "uninstaller": {
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-uninstaller-20210117.zip"
      },
      "magisk": {
        "version": "v21.4",
        "versionCode": "21400",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-v21.4.zip",
        "note": "https://topjohnwu.github.io/Magisk/releases/21400.md",
        "md5": "ee6dd05579776e7de3a6077087846e53"
      }
    }
  5. Get the paste's raw url
  6. Take the recovery_ramdis.img to internal storage
  7. Install magisk manager 8.0.7
  8. Open it's settings and select custom channel
  9. Write the raw url you just created
  10. Allow it to check for updates and it'll find that 21.4 is the latest version
  11. Click install and select recovery_ramdis.img
  12. After it finishes patching get the magisk_patched.img to your pc
  13. Get your phone to fastboot mode
  14. After connecting to pc, write this fastboot flash recovery_ramdisk to console and drag magisk_patched.img over to console and press enter
  15. Now if you enter recovery it'll boot to android with magisk but if you boot normally it will not detect magisk so each time you restart you have to use Power + Vol+ combo in order to get magisk
Remember to switch custom channel to stable channel if you want to receive updates.




I know that you can pretty much reduce the amount of flashing and restarting by flashing twrp to erecovery but since erecovery is a lifeline for most people here I decided not to get into that. But for those who are interested check this thread.​


Edit: Grammar
Edit 2: Update about HwOTA and HuRUpdate
Oh, man! Are you serious? :oops:
 

Frax3r

Senior Member
May 18, 2016
71
53
Huawei P20 Lite
I don't know what anyone expects from a guide... Is it better to just repeat the same thing over and over again? "Flash system with fastboot, factory reset with stock recovery, flash and boot twrp, resize system, flash gapps" is literally the summary of this. That summary is what you'll get as an answer if you ask for help on any telegram group. Instead of saying flash twrp, I wrote how you can flash twrp. Thats why it's so long. This guide is for "how" not "what".
 

-Alf-

Senior Member
Sep 28, 2017
2,224
743
Huawei P9 Lite
Huawei P10 Lite
I don't know what anyone expects from a guide... Is it better to just repeat the same thing over and over again? "Flash system with fastboot, factory reset with stock recovery, flash and boot twrp, resize system, flash gapps" is literally the summary of this. That summary is what you'll get as an answer if you ask for help on any telegram group. Instead of saying flash twrp, I wrote how you can flash twrp. Thats why it's so long. This guide is for "how" not "what".
I would say that even so far, people have managed to install GSI, Magisk, etc. :) .
Btw, Recovery and eRecovery are the same for all models and build numbers . They are even compatible with LLD and BND models.
 
Jul 19, 2021
26
3
Thats why it's so long
It is long because because of procedures that are too complicated, e.g. chapter "Disable Encryption" .
It is long because of duplicate procedures, e.g. chapter "Flashing Any GSI".
Sorry but Chapter "Magisk" is useless. Nowadays nobody needs to install the old Magisk. Rather focus on some of the nuances of installing Magisk on EMUI 9.1 that would be helpful.
Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses.
No comment...
Get the official TWRP .img and patch it with magisk manager
No comment...
Have a good day!
 
Last edited:
  • Haha
Reactions: Frax3r

-Alf-

Senior Member
Sep 28, 2017
2,224
743
Huawei P9 Lite
Huawei P10 Lite
Hello there! Alive parts of this forum is still filled with simple help requests so I decided to put together a simple all-in-one thread that basically covers most stuff. I don't wanna get into bootloader unlocking because right now only free way to do so is with potatoNV which I do not know how to use. Dc-unlocker is an option too but it is 4€ so pick your poison.

I have uploaded all my resources for this device to here. Inside EMUI folder you'll find some of the versions that I archived with the methods I explained on getting firmwares section. You can find recovery_ramdis.img from each of these version inside RECOVERY_RAMDISK folder as well.

Special key combos:​

  • Power + Vol+ = Recovery Mode​
  • While USB connected, Power + Vol+ = Erecovery Mode​
  • While USB connected, Vol- = Fastboot​
  • Plug USB while holding down Vol+ + Vol- = Download Mode​
  • Power + Vol+ + Vol- = Force Dload​

Flashing LineageOS 16.0​

Prerequisites:​

  • Emui Version below 9.1.0.300
  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Los16 zip
  • Official TWRP
  • Stock recovery_ramdis.img
  • Your choice of gapps zip

Steps:​

  1. Get the Prerequisites
  2. I recommend sending los 16 zip, recovery_ramdis.img and gapps zip to sd card if possible
  3. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  4. Connect phone to PC and allow debugging from phone
  5. Send this command from pc : adb reboot bootloader
  6. When you're at fastboot write fastboot flash recovery_ramdisk to console and drag & drop twrp-3.5.2_9-0-anne.img over to console and press enter
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. Allow modifications
  10. Press Install and select los 16 zip file
  11. If you want to disable encryption do it now
  12. Press Install and press Install Image
  13. Select and flash stock recovery_ramdis.img to recovery_ramdisk partition
  14. Press Reboot and select Recovery
  15. Press Factory Reset and type yes, while it is doing that plug the phone to pc
  16. Press Reboot and when screen is off start holding down vol- until you're at fastboot
  17. Repeat step 6-7-8
  18. Los 16 don't need to be resized so press Install and select gapps zip
  19. Press Reboot System

Flashing Any GSI​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • GSI image (1) (2)
  • Official TWRP
  • Stock recovery_ramdis.img in recovery_ramdisk partition
  • Your choice of gapps zip (Optional)

Notes:​

If you're gonna use Phh's AOSP11 and anything that based on it (with the exception of @eremitein's stuff), use arm64-ab-vndklite variant. For anything else use full vndk version. Full vndk version of Phh's AOSP11 does not allow you to resize system on any twrp.

Steps for gapps versions:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. Send this command from pc : adb reboot bootloader
  5. When you're at fastboot write fastboot flash system to console and drag & drop gsi .img over to console and press enter
  6. After flash is complete unplug phone and shut it down by long pressing power button
  7. Press and hold power + vol+ buttons until short yellow warning shows up
  8. Press Factory Reset and type yes
  9. When it is done press Reboot

Steps for vanilla versions with custom gapps:​

  1. Get the Prerequisites
  2. On current rom/gsi go to developer options and enable usb debug while you're at it enable "Enable OEM Unlock"
  3. Connect phone to PC and allow debugging from phone
  4. Send this command from pc : adb reboot bootloader
  5. When you're at fastboot write fastboot flash system to console and drag & drop gsi .img over to console and press enter
  6. If you want to disable encryption do it now
  7. After flash is complete unplug phone and shut it down by long pressing power button
  8. Press and hold power + vol+ buttons until short yellow warning shows up
  9. Press Factory Reset and type yes, while it is doing that plug the phone to pc
  10. Press Reboot and when screen is off start holding down vol- until you're at fastboot
  11. Write fastboot flash recovery_ramdisk to console and drag & drop twrp-3.5.2_9-0-anne.img over to console and press enter
  12. After flash is complete unplug phone and shut it down by long pressing power button
  13. Press and hold power + vol+ buttons until short yellow warning shows up
  14. Allow modifications
  15. Press Wipe, press Advanced Wipe, select System, press Repair or Change File System, press Resize File System, swipe to resize then go back to main screen
  16. Press Install, select and flash gapps zip
  17. Press Reboot System

Disable Encryption​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Official TWRP
  • Stock recovery_ramdis.img

Notes:​

You can disable encryption at any step, even after booting, but in order to disable it you have to do a factory reset from stock recovery_ramdis. Because of this I recommend doing between flashing gsi and flashing gapps.

Steps:​

  1. Get the Prerequisites
  2. Flash and boot TWRP
  3. Allow modifications
  4. Press Mount, select Vendor
  5. Connect phone to PC
  6. You can do next part 2 ways, if you're good with command line interface use steps 7 through 11, if not skip to step 12

  7. Type adb shell and press enter
  8. Type nano /vendor/etc/fstab.hi6250 and press enter
  9. Remove fileencryption=aes-256-xts:aes-256-cts from 16th line, make sure there's only one comma between check and reservedsize
  10. Press Ctrl + X then Y and press enter
  11. Go to step 18

  12. Type adb pull /vendor/etc/fstab.hi6250 and press enter
  13. If you have adb in your $PATH go to your user profile folder, if not go to folder where adb.exe is
  14. Open fstab.hi6250 via a text editor (please use notepad++)
  15. Remove fileencryption=aes-256-xts:aes-256-cts from 16th line, make sure there's only one comma between check and reservedsize
  16. Save file and open a command prompt
  17. Send this command adb push ./fstab.hi6250 /vendor/etc/fstab.hi6250

    View attachment 5422531
  18. Now you need to do a factory reset with stock recovery_ramdis.img

    If you have recovery_ramdis.img in your sd card, press Install and press Install Image then select recovery_ramdis.img and pick recovery_ramdisk partition

    If you don't have recovery_ramdis.img in your sd card, shut down phone, connect it to pc and hold down vol- until you're at fastboot, then write this command fastboot flash recovery_ramdisk and drag recovery_ramdis.img over to console then press enter

  19. Shut down your phone and unplug it from pc
  20. Press and hold power+ vol+ until you see short yellow warning
  21. Press Factory Reset and type yes
  22. You've successfully decrypted your phone and you're good to boot up or flash gapps

Getting Stock Firmware Files And Downgrading​

Prerequisites:​

Getting stock files are problematic because of huawei. Least shadiest way to get them are the hardest so bear with me.

Androidhost.ru : Click the "Firmware Zips" from prerequisites and search p20 lite. You should get a wide variety of versions to pick from. Make sure to match the Cust in the file to yours. C432 for Europe for example. After you download the zip file open it up and find a folder named "dload". You can either get this folder and paste it right into your sd card to force dload or you can open this folder and extract update_sd.zip. Inside update_sd.zip you'll find a file named UPDATE.APP. Use Huawei Update Extractor to open this file and there you'll see all the partitions you need. If HUE gives error while opening it, go to settings and untick "Verify file checksum". You can extract .img files by right clicking and selecting extract option on each partition. Normally you can't open these .img files but after pushing them through simg2img you'll be able to explore them too. But lets be real if you need guides for this, all you need is recovery_ramdis.img.

Using Dload Folder : Your sd card can't be FAT32 for this. FAT32 by nature don't allow files larger than 4gb so you can't get this folder to your sd card. Format it to ExFat via any guide on the internet then copy the dload folder to your sd card's root. It can't be inside any folders. Then shut your phone and press Power + Vol+ + Vol- all at the same time. It'll boot to erecovery which'll check the integrity of files then install them regardless of your EMUI version. So it is a good way to downgrade. Keep in mind tho you can't dload back to emui 8 from emui 9. And any successful dload will lock your bootloader back.

Hisuite : You can actually get firmware files pretty easily with hisuite but it requires real work. You see, hisuite downloads firmware files right into your documents folder. Connect your phone to pc and open up hisuite. Check for updates and if it finds one it'll download following files update_full_base.zip, update_full_ANE-L01_hw_eu.zip and update_full_cust_ANE-L01_hw_eu.zip. You only need update_full_base.zip file, others are used to work on HuRUpdater and HwOTA but they are deprecated since February. Inside update_full_base.zip you'll find UPDATE.APP which you can extract images from with Huawei Update Extractor.

Erecovery : This one requires some network knowledge and it'll only get you the latest version so I don't think it worth the hassle. You need a router that allows you to change dns address for DHCP clients. Which most of them do these days. Now you need to create and run a dns server on your pc. I recommend adguard home. Pihole works too. Use Windows Subsystem For Linux or Docker to install either of them. Once you get them up and working set them to log dns requests. I believe you know where this is going. Open your router's interface and enter adguard home/pihole ip address which maps back to your pc's local address. Check if it works or not by opening up few sites on your phone which should be connected to your wifi and isn't set up to use a different dns server. If all is good open up erecovery on your phone and connect to your wifi. If you set it up correctly it should get the latest version from huawei which will show up on your log. Use that url to download it to your pc and extract it same as others. There was a paid service that used this method to send specific versions to your erecovery.

EMUI's System Updater : This is tricky and my favorite. Get the official TWRP .img and patch it with magisk manager. Then flash it via fastboot. I know, "twrp and magisk? wtf?" just do it. It takes a long time to boot but it works don't question me right now. After you get root in EMUI allow system updater to do its job and update. It'll ask to reboot, allow it. It will throw you back to system after reboot cuz recovery is hijacked. duh. Get a file manager that allows root access. Allow system updater to download again. But this time do not allow it to reboot. First one downloaded OTA, second one downloaded FullOTA. Which is better for archival purposes. After download is done search for a folder named HwOUC in /system. Copy it to internal storage and from there to your pc. You can find our main UPDATE.APP inside update_full_base.zip. Other zips include cust and all that which HuRu and HwOTA used to require.

Magisk​

Prerequisites:​

  • Unlocked Bootloader and FRP
  • adb and fastboot installed on pc
  • Stock recovery_ramdis.img

Notes:​

Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses. But hey it is still working without modifications unlike a-only devices so that's a win. New installer for magisk kinda broken for our device, because of that I recommend installing and booting an older version. It's safe to update it afterwards from magisk manager. As a foot note, you CAN use twrp image instead of stock recovery_ramdis.img but it'll take longer to boot. Using .380's recovery_ramdis.img on .278 build will not work. Make sure to match your EMUI build with ramdisk you're flashing. Ask me how I know.

Steps to install older version:​

  1. Get the Prerequisites
  2. No, I mean literally just get the Prerequisites and thats it
  3. Open up your browser and find a bin service (pastebin will suffice)
  4. Create a paste with following
    Code:
    {
      "app": {
        "version": "8.0.7",
        "versionCode": "4834",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/MagiskManager-v8.0.7.apk",
        "note": "https://cdn.jsdelivr.net/gh/topjohnwu/[email protected]/app/src/main/res/raw/changelog.md"
      },
      "stub": {
        "versionCode": "18",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.7/stub-release.apk"
      },
      "uninstaller": {
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-uninstaller-20210117.zip"
      },
      "magisk": {
        "version": "v21.4",
        "versionCode": "21400",
        "link": "https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-v21.4.zip",
        "note": "https://topjohnwu.github.io/Magisk/releases/21400.md",
        "md5": "ee6dd05579776e7de3a6077087846e53"
      }
    }
  5. Get the paste's raw url
  6. Take the recovery_ramdis.img to internal storage
  7. Install magisk manager 8.0.7
  8. Open it's settings and select custom channel
  9. Write the raw url you just created
  10. Allow it to check for updates and it'll find that 21.4 is the latest version
  11. Click install and select recovery_ramdis.img
  12. After it finishes patching get the magisk_patched.img to your pc
  13. Get your phone to fastboot mode
  14. After connecting to pc, write this fastboot flash recovery_ramdisk to console and drag magisk_patched.img over to console and press enter
  15. Now if you enter recovery it'll boot to android with magisk but if you boot normally it will not detect magisk so each time you restart you have to use Power + Vol+ combo in order to get magisk
Remember to switch custom channel to stable channel if you want to receive updates.




I know that you can pretty much reduce the amount of flashing and restarting by flashing twrp to erecovery but since erecovery is a lifeline for most people here I decided not to get into that. But for those who are interested check this thread.​


Edit: Grammar
Edit 2: Update about HwOTA and HuRUpdate
Edit 3: Simplify some steps and add my own mega.nz archive
Only now I have time to read your instructions carefully, what is this nonsense ???
Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses. But hey it is still working without modifications unlike a-only devices so that's a win. New installer for magisk kinda broken for our device, because of that I recommend installing and booting an older version.
I'll give you some advice if I may - don't write about things you don't understand! And this applies not only to Magisk.
 

Frax3r

Senior Member
May 18, 2016
71
53
Huawei P20 Lite
It is long because because of procedures that are too complicated, e.g. chapter "Disable Encryption" .
Is it better to just link decryption zip or write what that decryption zip does?

It is long because of duplicate procedures, e.g. chapter "Flashing Any GSI".
People use gapps versions because they don't want to waste time by flashing zips. That's why it's 2 part. Gapps one is shorter.

Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses.
Magisk-in-recovery as in "magisk hijacking recovery" not "installing magisk using recovery". You can't even find huawei section in it's installation instructions. Look here and here. As for the nuance you asked, installing magisk in EMUI is literally same as installing it in GSI or LOS. You patch the image, flash the image, boot the image.

As a foot note, you CAN use twrp image instead of stock recovery_ramdis.img but it'll take longer to boot. Using .380's recovery_ramdis.img on .278 build will not work. Make sure to match your EMUI build with ramdisk you're flashing. Ask me how I know.​
I added "ask me how I know" part for a reason. I tried. You CAN patch official twrp with magisk and it WILL boot. If a person unlocks their bootloader for the first time how is he supposed to get stock recovery_ramdis.img? Get the mmcblock of recovery_ramdisk? How is he supposed to do that if he flashes twrp over to recovery_ramdisk partition? We can't use "fastboot boot" so that's out of option. Use a different recovery_ramdis.img you might say. I TRIED. .380's recovery_ramdis.img patched with latest magisk won't boot if you're at .278. I created a folder where I patched .380 recovery with each different version of magisk starting from 20.4 up to latest version and none of them booted on los 16 which was installed upon .278. It is not universal as you might think.

Only now I have time to read your instructions carefully, what is this nonsense ???

I'll give you some advice if I may - don't write about things you don't understand! And this applies not only to Magisk.
Care to elaborate? I am open to constructive criticism. As for what I know, I do know that you won't find yourself bootlooping if you follow these steps by the letter. I saw your instructions on los 16 and other threads too. Here's a criticism for you, do not tell people to wipe /data or factory reset with twrps and especially do not expect them to flash twrp over to erecovery. Wiping /data or factory reset from twrp always resulted in phone freezing for me. I guess twrp in erecovery could fix freezing but there's a reason why they are asking for help and you expect them to overwrite their only lifeline. 1-2 extra rebooting and flashing won't hurt anyone. When you wipe /data or factory reset with most twrps, including official one, some folders that needs to be untouched (huawei am i right) gets deleted. So you have to use stock recovery_ramdis.img or an advanced twrp which compansates it. Check the tishserg's twrp for example. I use that not the official twrp for these things. And it can write to erecovery which is exactly why I didn't advocate on using it in this guide. Have a good day...
 
Last edited:

-Alf-

Senior Member
Sep 28, 2017
2,224
743
Huawei P9 Lite
Huawei P10 Lite
Here's a criticism for you, do not tell people to wipe /data or factory reset with twrps and especially do not expect them to flash twrp over to erecovery. Wiping /data or factory reset from twrp always resulted in phone freezing for me.
Use recommended TWRP, not 3.4.0. and above, which is not fully compatible with hi6250 devices (including official one). Did you know? :)
Btw, I never advised anyone to do a factory reset in TWRP, on the contrary
https://forum.xda-developers.com/t/...twrp-3-2-1-0-12-05-2018.3789306/post-85472227
;)
New installer for magisk kinda broken for our device, because of that I recommend installing and booting an older version.
Everyone knows that it is possible to install the latest version right away...
 

Frax3r

Senior Member
May 18, 2016
71
53
Huawei P20 Lite
Use recommended TWRP, not 3.4.0. and above, which is not fully compatible with hi6250 devices (including official one). Did you know? :)
Btw, I never advised anyone to do a factory reset in TWRP, on the contrary
https://forum.xda-developers.com/t/...twrp-3-2-1-0-12-05-2018.3789306/post-85472227
;)

Everyone knows that it is possible to install the latest version right away...
Yes you said that here. However my own experience says otherwise. Before my current los 16 installation I used official 3.5.2. Flashed los, flashed stock recovery, flashed phenix kernel, flashed gapps all from it. I even used nano from adb shell to edit fstab.hi6250. I used backup and restore only on kernel partition but it was successful anyway. What that incompatibility be? Is it boot override thing? If you have twrp in recovery and send reboot to recovery from android it just keeps booting to twrp in each reboot even tho you select otherwise from twrp's reboot menu. BTW tishserg's twrp have an option to remove that override if you find yourself in that loop. As for factory reset part, you said format /data here. We had a discussion here because of that. My bad on reading wrong. While writing this I realised incompatibility is probably about formating /data on twrp 3.4.0 and above. If that is the case I'll update the post. Good thing I didn't tell people to format /data from twrp. My steps might be long but they are correct. It is wrong to call all this a nonsense.

Everyone might know it is possible to install latest magisk but not everyone knows how to install an older version now that magisk's future is uncertain. After magisk removes magiskhide from its code people are gonna wanna go back to latest version that worked while waiting for module version of it. Patching twrp image with magisk is highlight of this post but it is literally what flashing magisk.zip (.apk to .zip) from twrp does with the latest version. If patching twrp is bad then why is my guide to installing an older version, which allows you to select which image to patch, is the target? + With that .json, you can make magisk manager patch the image with your own modified version of magisk should you upload it somewhere and change the links.
 

aribk

Member
Mar 12, 2011
21
2
LG G4
Hi,

I'm building trying to port Ubuntu Touch to this device and I'm running into a few challenges. I have already reverted to stock 2 times and re-unlocked the bootloader (starting from EMUI 9). So far I have only flashed recovery_ramdisk with twrp as I was worried I might not be able to revert to stock if I flashed erecovery.
Question 1: Is this correct or a misunderstanding?

Installing Ubuntu Touch requires the data partition to be formatted to ext4. I can do that from twrp, but someone (maybe you) wrote that wiping the data partition with twrp was liable to create trouble.
Q2: Same question as above.

I understand Huawei requires the kernel and ramdisk to reside in separate images on separate partitions. So I have used this guide (https://wiki.postmarketos.org/wiki/Huawei_P10_Lite_(huawei-warsaw)) to separate the boot.img produced in my build, and then flashed these two image files to the kernel and recovery_ramdisk partitions respectively. However, examining the LOS 16.0 rom that can be installed, I see that it contains a "boot.img".
Q3: Can I flash my boot.img without separating into kernel and ramdisk first, and if so, which partition should I flash?

Q4: After flashing the image files I built (kernel.img and ramdisk.img along with system.img), do I need to reboot to a recovery (if so, which?) and wipe something (if so, what?) before rebooting?
 

Frax3r

Senior Member
May 18, 2016
71
53
Huawei P20 Lite
Hi,

Question 1: Is this correct or a misunderstanding?

Q2: Same question as above.

Q3: Can I flash my boot.img without separating into kernel and ramdisk first, and if so, which partition should I flash?

Q4: After flashing the image files I built (kernel.img and ramdisk.img along with system.img), do I need to reboot to a recovery (if so, which?) and wipe something (if so, what?) before rebooting?
Hello,
If I understood you correctly you're asking if you can flash stock erecovery after you've modified it. Answer is yes, you can flash twrp on it and when you're done you can flash stock erecovery image over it. Fastboot won't allow you to flash anything on erecovery partition tho. So you need to use certain twrps that are capable of flashing over erecovery. s_mak and tishserg twrps should allow that iirc. First flash any one of those twrps to recovery_ramdisk then boot into it afterwards flash same twrp image to erecovery partition from inside the twrp.

Yes, if you look at last few replies in this thread that was exactly the conversation. However that is only the case with official twrp. If you use s_mak or tishserg's twrps from the mega link in the thread you should be able to wipe without a problem.

Last 2 questions are beyond me I'm afraid. PostparketOS and Ubuntu Touch are inherently very different to android and they could require some stuff that are unique to them. However I would imagine you wouldn't need to wipe anything after flashing those images.
 
  • Like
Reactions: aribk

-Alf-

Senior Member
Sep 28, 2017
2,224
743
Huawei P9 Lite
Huawei P10 Lite
Hi,

I'm building trying to port Ubuntu Touch to this device and I'm running into a few challenges. I have already reverted to stock 2 times and re-unlocked the bootloader (starting from EMUI 9). So far I have only flashed recovery_ramdisk with twrp as I was worried I might not be able to revert to stock if I flashed erecovery.
Question 1: Is this correct or a misunderstanding?

Installing Ubuntu Touch requires the data partition to be formatted to ext4. I can do that from twrp, but someone (maybe you) wrote that wiping the data partition with twrp was liable to create trouble.
Q2: Same question as above.

I understand Huawei requires the kernel and ramdisk to reside in separate images on separate partitions. So I have used this guide (https://wiki.postmarketos.org/wiki/Huawei_P10_Lite_(huawei-warsaw)) to separate the boot.img produced in my build, and then flashed these two image files to the kernel and recovery_ramdisk partitions respectively. However, examining the LOS 16.0 rom that can be installed, I see that it contains a "boot.img".
Q3: Can I flash my boot.img without separating into kernel and ramdisk first, and if so, which partition should I flash?

Q4: After flashing the image files I built (kernel.img and ramdisk.img along with system.img), do I need to reboot to a recovery (if so, which?) and wipe something (if so, what?) before rebooting?
So far I have only flashed recovery_ramdisk with twrp as I was worried I might not be able to revert to stock if I flashed erecovery.
Question 1: Is this correct or a misunderstanding?
Misunderstanding. You can revert to stock via eRecovery & wi-fi.
Huawei has Recovery and eRecovery, each has different functions.
You can use the following combinations in your phone:
- Recovery + eRecovery (stock FW)
- TWRP instead of Recovery + eRecovery
- Recovery + TWRP instead of eRecovery
wiping the data partition with twrp was liable to create trouble.
Q2: Same question as above.
Same answer as above. Formatting (not wiping) data with TWRP 3.4+ is dangerous (running stock EMUI).

Q3: All this only works on EMUI 8 as far as I know.

Q4: follow the instructions, imo.

P.S.: as you can see, mobile Linux projects such as Ubuntu Touch, postmarketOS or Sailfish OS work only partially on Hua/Ho phones,but we already talked about that :).
 
  • Like
Reactions: aribk

aribk

Member
Mar 12, 2011
21
2
LG G4
Same answer as above. Formatting (not wiping) data with TWRP 3.4+ is dangerous (running stock EMUI).
Re-reading your answer above, I see I'd like to double check: Is this dangerous only if you are running stock EMUI, or would it also be dangerous to use TWRP 3.4+ to format the data partition when you wish to run a different system on the device, as in my case?
 

Abdelhay.ali

Member
Oct 9, 2022
41
30
Huawei P20 Lite
Thank you for the update.

I have modified Phenix_4.9.235-phenix-1.0 rebased on Harmonyos to make it permissive which make most A13 GSIs boot normally on my phone. I have attached the updated one.
 

Attachments

  • Phenix_4.9.235-phenix-1.0-Permissive-30102022.img
    12 MB · Views: 36
Last edited:
  • Like
Reactions: Frax3r

Top Liked Posts

  • There are no posts matching your filters.
  • 3

    Special key combos:​

    • Power + Vol+ = Recovery Mode
    • While USB connected, Power + Vol+ = Erecovery Mode
    • While USB connected, Vol- = Fastboot
    • Plug USB while holding down Vol+ + Vol- = Download Mode
    • Power + Vol+ + Vol- = Force Dload

    Flashing Any GSI

    Note:​

    Phh is "retiring". Community of builders created trebledroid initiative to keep his work alive. Don't expect same level of quality for a while.
    • Use vndklite variants.
    • At no point you need to wipe /data or any other partition. Just do factory reset.
    • If you want to backup via twrp you need to have encryption disabled.
    • Almost all chromium based browsers including chrome freeze after few minute of use. That is caused by DRM not working as intended in gsis. To fix it flash DRM fix.
    • Permissive kernel shouldn't be used daily. Please only use it for debugging purposes.

    Prerequisites:​

    • ADB and Fastboot Installed (1)
    • Any Arm64 AB GSI image (1) (2) (3) (4) (5)
    • Google apps package (Optional) (1) (2) (3) (4)
    • TWRP
    • Unlocked Bootloader
    1. Tick "Enable OEM Unlock" from developer options
    2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    3. Flash gsi image: fastboot flash system drag & drop img file to console
    4. Flash Stock Recovery: fastboot flash recovery_ramdisk and drag & drop img file to console
    5. Boot into recovery: power + vol+ while NOT connected to pc
    6. Factory reset: Factory Reset > Type yes > Press power
    7. Boot into system
    1. Tick "Enable OEM Unlock" from developer options
    2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    3. Flash gsi image: fastboot flash system drag & drop img file to console
    4. Flash Phenix Kernel (Optional): fastboot flash kernel and drag & drop img file to console
    5. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
    6. Boot into recovery: power + vol+ while NOT connected to pc
    7. Factory reset: Wipe > Swipe Factory Reset
    8. Resize system: Wipe > Advanced Wipe > Tick System > Repair or Change File System > Swipe Resize File System
      if it fails issue these commands from your computer:
      adb shell "/sbin/e2fsck -fp /dev/block/platform/hi_mci.0/by-name/system"
      adb shell "/sbin/resize2fs /dev/block/platform/hi_mci.0/by-name/system"
    9. Encrypt or Decrypt /Data (Optional): Mount > Tick Vendor > adb push drag & drop fstab file to console /vendor/etc
    10. Flash DRM fix (Optional): ''
    11. Flash NFC fix (Optional / Might not Work): ''
    12. Flash Gapps Zip (Optional): ''
    13. Boot into system: Reboot > System
    1. Tick "Enable OEM Unlock" from developer options
    2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    3. Flash gsi image: fastboot flash system drag & drop img file to console
    4. Flash one of these kernel (Optional): fastboot flash kernel and drag & drop img file to console
    5. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
    6. Boot into recovery: power + vol+ while NOT connected to pc
    7. Factory reset: Wipe > Swipe Factory Reset
    8. Flash this AIO fix : Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
    9. Flash Gapps Zip (Optional): ''
    10. Boot into system: Reboot > System
    Flash over to erecovery:
    1. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    2. Flash one of these (1) (2) twrp images: fastboot flash recovery_ramdisk and drag & drop img file to console
    3. Boot into twrp: power + vol+ while NOT connected to pc
    4. Push twrp to /cache: adb push drag & drop img file to console /cache
    5. Flash twrp to erecovery: Install > Install Image > Select twrp image from /cache folder > Pick erecovery_ramdisk partition > Swipe
    After you set up your phone and made sure you don't need stock recovery, flash magisk:
    1. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    2. Flash magisk patched image: fastboot flash recovery_ramdisk and drag & drop img file to console
    From now on this is how you boot:
    • No keypress: System (Long yellow warning)
    • Power & Vol+ before Yellow Warning : System with magisk (Short yellow warning)
    • Vol+ on Yellow Warning : TWRP
    If you want to return to stock erecovery, do these:
    1. Boot into twrp
    2. Push erecovery image to /cache: adb push drag & drop img file to console /cache
    3. Flash erecovery to erecovery: Install > Install Image > Select erecovery image from /cache folder > Pick erecovery_ramdisk partition > Swipe
    Keep in mind that Safetynet is deprecated and Google is encouraging developers to switch to Play Integrity API. To pass safetynet you need to have 3 checkmarks, as such you'll need to follow all 3 instructions I'm about to give you.
    Disable "Spoof Pixel 5" & Enable Safetynet in phh options then reboot.
    Download YASNAC from play store and check for "Evaluation Type" from result.
    If it says Basic and others fail you can skip this part.

    If test fails or doesn't finish do these:
    Install Magisk
    Enable Zygisk & Enforce denylist
    Install Universal SafetyNet Fix module by kdrag0n
    Now check YASNAC again. It should finish test and say Basic in evaluation type.
    This happens because root is detected most of the time.
    If your GSI has Dynamic Root, uncheck root from phh settings.
    If your GSI has SU, securize from phh settings.
    If you had to flash magisk because of evaluation type, tick google play and google play services in denylist.

    If those didn't fix, contact GSI maintainer.
    This happens because build fingerprint is not play certified.

    Make sure you have safetynet option ticked in phh settings and do these:
    Edit /data/adb/phh/secure
    Add these 2 lines to bottom:
    resetprop_phh ro.build.fingerprint HUAWEI/ANE-LX1/HWANE:9/HUAWEIANE-L01/9.1.0.368C432:user/release-keys
    resetprop_phh ro.build.version.security_patch 2020-08-01
    Reboot and test again.

    Everytime you untick safetynet you have to edit this file again. You can also pick any other fingerprint from here should you choose to. You need both fingerprint and patch date. If you want to simulate other devices add following lines:
    resetprop_phh ro.product.brand HUAWEI
    resetprop_phh ro.product.device HWANE
    resetprop_phh ro.product.manufacturer HUAWEI
    resetprop_phh ro.product.model ANE-LX1
    resetprop_phh ro.product.name ANE-LX1
    If you want to pass it you're going to have to read this wall of text. I can't shorten it.

    What is Play Integrity:
    Google enforces Play Inregrity once your api level is set to 33 (android 13). I currently don't have enough information about it other than apps can decide which checks to perform on your device. One of those checks is called strong integrity. We can't pass strong integrity because it requires hardware backed checks which our device lack. However you can still fool some apps that don't enforce strong integrity.

    How you can fool it:
    Ever since magisk retired magiskhide, some forks have been made to keep it maintained and improved. One of those forks is Magisk Delta. Before you head over to it's github and install it, you still need to install a valid CTS fingerprint. Then you can install Magisk Delta.

    Steps:
    Disable Spoof Pixel 5 & Enable Safetynet from phh settings if they exist.
    Add these 2 lines to bottom of /data/adb/phh/secure (create if it doesnt exist) & Reboot
    resetprop_phh ro.build.fingerprint HUAWEI/ANE-LX1/HWANE:9/HUAWEIANE-L01/9.1.0.368C432:user/release-keys
    resetprop_phh ro.build.version.security_patch 2020-08-01

    If you have magisk :
    - Download Magisk Delta apk
    - Change .apk to .zip
    - Install it as magisk module
    If you don't have magisk :
    - Download & install Magisk Delta apk
    - Patch recovery_ramdisk & flash it via fastboot

    Enable Zygisk and MagiskHide from Magisk Delta App
    Install this module : https://github.com/HuskyDG/safetynet-integrity-fix/releases
    MAKE SURE GMS IS NOT IN HIDELIST
    Reboot and test safetynet. (Feel free to link any app that tests for Play Integrity)
    That happens because EMUI stores it's themes and few stock apps in /data/hw_init folder. When you factory reset with stock recovery, they are preserved. But when you use twrp to factory reset they are removed. Doing factory reset once from twrp is enough to make EMUI think it's corrupted, in acuality it isn't. To fix it you can either let EMUI update from system settings or you can download this, extract hw_init folder and push folder to /data from twrp with this command :
    adb push drag & drop hw_init folder to console /data

    Flashing LineageOS 16.0

    Note:​

    Stock kernel from EMUI .300> have trouble with wifi. Use Phenix 4.9.319 or above to fix it.

    Prerequisites:​

    • ADB and Fastboot Installed (1)
    • Google apps package (Pick Pie or 9.0 editions) (1) (2) (3) (4)
    • LineageOS Zip (From Archive or From Mega)
    • Phenix Kernel (Else you won't have wi-fi)
    • TWRP (3.4.0 is needed for factory reset functionality)
    • Unlocked Bootloader
    1. Tick "Enable OEM Unlock" from developer options
    2. Boot into fastboot: Hold vol- while usb connected and phone rebooting
    3. Flash this TWRP: fastboot flash recovery_ramdisk and drag & drop img file to console
    4. Flash Phenix Kernel (Required for Wi-Fi): fastboot flash kernel and drag & drop img file to console
    5. Boot into twrp: power + vol+ while NOT connected to pc
    6. Flash lineage zip: Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
    7. Factory reset: Wipe > Swipe Factory Reset
    8. Boot into Vanilla LineageOS or Keep following to flash gapps

    9. Encrypt or Decrypt /Data (Optional): Mount > Tick Vendor > adb push drag & drop fstab file to console /vendor/etc
    10. Flash gapps zip: Advanced > ADB Sideload > Swipe to Start Sideload > Write adb sideload and drag & drop zip file to console
    11. Boot into system: Reboot > System

    Getting Stock Firmware Files And Downgrading

    Sources:​

    Firmware finder has been revived and you can use that to get your prefered cust or build.
    If you need only one image not the whole build, I uploaded each one you'd typically need below.

    CUST.img
    DTS.img
    ERECOVERY_KERNE.img
    ERECOVERY_RAMDI.img
    ERECOVERY_VBMET.img
    ERECOVERY_VENDO.img
    FASTBOOT.img
    KERNEL.img
    ODM.img
    PRODUCT.img
    RECOVERY_RAMDIS.img
    RECOVERY_VBMETA.img
    RECOVERY_VENDOR.img
    SYSTEM.img
    VBMETA.img
    VENDOR.img
    XLOADER.img

    They are from .401 c432.
    If you wiped /data once you probably won't have emui themes etc if you go back to emui. To fix that you can push hw_init folder (in data.7z) to /data. Not the contents of it, just put the folder in root of /data. It should be like this: /data/hw_init
    Connect your phone to pc and open up hisuite. Check for updates and if it finds one it'll download following files update_full_base.zip, update_full_ANE-L01_hw_eu.zip and update_full_cust_ANE-L01_hw_eu.zip to your documents folder. update_full_base.zip file contains main UPDATE.APP. You can extract images from it with Huawei Update Extractor
    Flash magisk patched image from quick links. After you get root in EMUI allow system updater to do its job and update. It'll ask to reboot, allow it. It will throw you back to system after reboot because recovery is not stock. Get a file manager that allows root access. Allow system updater to download again. But this time do not allow it to reboot. First one downloaded OTA, second one downloaded FullOTA. Which is better for archival purposes. After download is done go to /data/update with a root file explorer. Copy HwOUC folder to internal storage and from there to your pc. There should be 3 folders with numbers. You can find our main update_full_base.zip in one of them.

    Get files of your prefered build. I recommend build .278. Extract SYSTEM.IMG from UPDATE.APP via huawei update extractor and flash it with fastboot flash system . Factory reset with stock recovery then flash any TWRP except for the official ones. Official TWRPs freezes when wiping /data which is what we need to do. After wiping /data boot into system. You should have aosp background with square app icons if you did correctly. Check for system updates and it should find your current build. Download and install.
    BOOTLOADER WILL RELOCK, DON'T DO THIS IF YOU DON't HAVE YOUR BL CODE
    For this you need to have a sd card that is formated as exfat. Fat32 doesn't allow >4gb files so exfat is required. Download your prefered build from Androidhost.ru or mega link above. Inside the zip file you'll find a folder named dload. Extract this folder to somewhere and transfer it to your sd card. Folder structure should look like below. Hw_eu and L01/L21 will depend on your region and single/dual sim status. After this unplug your phone and shut it down. Start pressing vol- vol+ and power all at the same time. Different kind of yellow warning will appear and a screen with blue progress bar over black background will appear. If you downloaded correct variant for your phone it'll start progressing. After process is done you'll boot into stock emui with NO yellow warning. This is because your bootloader is locked. Do whatever you want at this point but remember, unlocking bootloader again will low level factory reset your phone.

    -/storage/AAAA-BBBB/dload
    ---/update_sd
    ---/ANE-L01_hw_eu
    ---/ANE-L21_hw_eu
    If I recall correctly there is only one way to do this. You can't dload between emui versions. You also need to be on stock emui for hisuite to function. Some people say a specific hisuite version is required but it wasn't the case for me. Plug your phone to pc, hisuite should show up beside your phone in drives section. Install it and open it. Do whatever it instructs you to function correctly. After you see your phone in app click Update button. Then click on "Earlier Versions". It'll show version 8.0.0.167 along with some warnings. Rest it pretty straightforward. Follow along and it'll return you back to emui 8. But if you're doing this to unlock your bootloader, build .167 is not enough. Exploit that dc-unlocker uses is patched in this version. So you have to roll back further. I had success with .125 build but up until .150 could work. Link to .125 build.

    edit ? : Revised guide
    1
    Among other things, the HwOTA and HuRupdater methods have not worked since February (unless someone has the necessary files stored on the disk). Huawei changed servers and Firmware Finder is dead.

    EMUI 8 firmware download doesn't work for the same reasons .
    1
    Thats why it's so long
    It is long because because of procedures that are too complicated, e.g. chapter "Disable Encryption" .
    It is long because of duplicate procedures, e.g. chapter "Flashing Any GSI".
    Sorry but Chapter "Magisk" is useless. Nowadays nobody needs to install the old Magisk. Rather focus on some of the nuances of installing Magisk on EMUI 9.1 that would be helpful.
    Officially speaking magisk support for our device is dead. Magisk decided to retire magisk-in-recovery method which our phone uses.
    No comment...
    Get the official TWRP .img and patch it with magisk manager
    No comment...
    Have a good day!
    1
    Hi,

    Question 1: Is this correct or a misunderstanding?

    Q2: Same question as above.

    Q3: Can I flash my boot.img without separating into kernel and ramdisk first, and if so, which partition should I flash?

    Q4: After flashing the image files I built (kernel.img and ramdisk.img along with system.img), do I need to reboot to a recovery (if so, which?) and wipe something (if so, what?) before rebooting?
    Hello,
    If I understood you correctly you're asking if you can flash stock erecovery after you've modified it. Answer is yes, you can flash twrp on it and when you're done you can flash stock erecovery image over it. Fastboot won't allow you to flash anything on erecovery partition tho. So you need to use certain twrps that are capable of flashing over erecovery. s_mak and tishserg twrps should allow that iirc. First flash any one of those twrps to recovery_ramdisk then boot into it afterwards flash same twrp image to erecovery partition from inside the twrp.

    Yes, if you look at last few replies in this thread that was exactly the conversation. However that is only the case with official twrp. If you use s_mak or tishserg's twrps from the mega link in the thread you should be able to wipe without a problem.

    Last 2 questions are beyond me I'm afraid. PostparketOS and Ubuntu Touch are inherently very different to android and they could require some stuff that are unique to them. However I would imagine you wouldn't need to wipe anything after flashing those images.
    1
    Hi,

    I'm building trying to port Ubuntu Touch to this device and I'm running into a few challenges. I have already reverted to stock 2 times and re-unlocked the bootloader (starting from EMUI 9). So far I have only flashed recovery_ramdisk with twrp as I was worried I might not be able to revert to stock if I flashed erecovery.
    Question 1: Is this correct or a misunderstanding?

    Installing Ubuntu Touch requires the data partition to be formatted to ext4. I can do that from twrp, but someone (maybe you) wrote that wiping the data partition with twrp was liable to create trouble.
    Q2: Same question as above.

    I understand Huawei requires the kernel and ramdisk to reside in separate images on separate partitions. So I have used this guide (https://wiki.postmarketos.org/wiki/Huawei_P10_Lite_(huawei-warsaw)) to separate the boot.img produced in my build, and then flashed these two image files to the kernel and recovery_ramdisk partitions respectively. However, examining the LOS 16.0 rom that can be installed, I see that it contains a "boot.img".
    Q3: Can I flash my boot.img without separating into kernel and ramdisk first, and if so, which partition should I flash?

    Q4: After flashing the image files I built (kernel.img and ramdisk.img along with system.img), do I need to reboot to a recovery (if so, which?) and wipe something (if so, what?) before rebooting?
    So far I have only flashed recovery_ramdisk with twrp as I was worried I might not be able to revert to stock if I flashed erecovery.
    Question 1: Is this correct or a misunderstanding?
    Misunderstanding. You can revert to stock via eRecovery & wi-fi.
    Huawei has Recovery and eRecovery, each has different functions.
    You can use the following combinations in your phone:
    - Recovery + eRecovery (stock FW)
    - TWRP instead of Recovery + eRecovery
    - Recovery + TWRP instead of eRecovery
    wiping the data partition with twrp was liable to create trouble.
    Q2: Same question as above.
    Same answer as above. Formatting (not wiping) data with TWRP 3.4+ is dangerous (running stock EMUI).

    Q3: All this only works on EMUI 8 as far as I know.

    Q4: follow the instructions, imo.

    P.S.: as you can see, mobile Linux projects such as Ubuntu Touch, postmarketOS or Sailfish OS work only partially on Hua/Ho phones,but we already talked about that :).