[Honor 7X  Guides, News, & Discussion] gutogutarro:
Ramdisk from Huawei official firmware is required in order to patch Magisk and acquire root privelages in Openkirin LineageOS builds. Can't apply patches to rom from TWRP because TWRP doesn't support custom rom decryption in this case.

Since other people may be running into a similar issue I figured I would write down my process and share it for the reference of others. I do not plan to support this thread, I just wanted to share what I did that worked for me to remove some of the legwork for research.

Disclaimer:

This isn't, by any means, a recommended method to achieve this end.

Essentially, I ran into the predicament that Huawei and alternative sneaky Russian sites for hosting the firmware files for Huawei Devices are down as of writing this.

Namely:

Online firmware database ⋆ TEAM MT Developers

< PREVIOUS FIND MODEL NEXT > Дата изменения Полное название Файлы обновления Размер Тип G g v f 2021.11.09 MED-LGRP2-OVS 10.1.0.195 filelist 0 OTA 1458 104 519745 3 2021.11.08 patch01 filelist 0 OTA 1458 104 525603 1 2021.11.08 TAS-LGRP1-CHN 11.0.0.170 filelist 0 OTA 1458 104 525098 1 2021.11.08...

pro-teammt.ru

So I could no longer use the site to download the official firmware for my Honor 7X and extract the ramdisk from it in order to patch Magisk to that ramdisk image.

Well, against the wishes of the openkirin project, I installed a modified version of TWRP customer recovery in order to manually dump the ramdisk image already present inside of the Huawei (which, in my mind, should have been the same one from the OEM that would have been extracted from an official Huawei update). The TWRP recovery version that I used came from the P10 Lite TWRP test build 0.5 from the thread I listed below. Hacky as all hell, but it worked for what I needed.

To get the ramdisk you need to go into TWRP and do backup --> ramdisk. It will drop it in your phone. Likely underneath /sdcard/TWRP.

Dump command to send to Linux(what I'm using, should be same on windows):

adb pull /sdcard/TWRP TWRP

The ramdisk dumped itself as a `.win` filetype, so I simply renamed the file extension to `.img` so that Magisk would recognize it and apply the appropriate patch.

With this dumped ramdisk image I added it to my phone and used Magisk to patch magisk to that dumped ramdisk, which I then transferred back to my computer.

I then booted the phone into bootloader mode:

adb reboot bootloader

and then flashed the newly modified Magisk ramdisk:

fastboot flash ramdisk magisk_patched-23000_9FXew.img

Upon rebooting my Huawei:

fastboot reboot

was able to verify with Magisk that I now had both TWRP custom recovery without issue and access to root privelages inside of LineageOS (which is good and ignores the need for TWRP to be able to decrypt custom rom contents)

Since TWRP cannot decrypt the contents of a custom rom in this case, being able to use TWRP to dump the ramdisk was an essential step even though Openkirin does not support TWRP. I would have otherwise had no option for acquiring that factory ramdisk because Huawei took them all offline.

This is all mostly just to get ahold of the ramdisk without needing to use huawei official firmware and patch it for Magisk, which there are already guides for on XDA and on Openkirin's support site. There's probably some steps of this I left out. Best of luck to others.

Resources Used that explain some steps I left out (Like installing TWRP to recovery_ramdisk, etc etc):

[Openkirin Magisk Guide](https://openkirin.net/user_guide/how-to-install-magisk/)

[Openkirin Rom Installation Instructions](https://openkirin.net/user_guide/openkirin-rom-installation-instructions/)

[Converting a TWRP Backup into a Flashable zip](https://xdaforums.com/t/tutorial-create-flashable-zip-from-cwm-twrp-backup-mtk.2746044/)

[Huawei P10 Lite TWRP test build 0.5](https://xdaforums.com/t/recovery-emui-8-x-huawei-p10-lite-unofficial-twrp-3-2-1-0-28-04-2018.3783447/page-2)