[ROM][Treble][microG]LineageOS 16.0 for HUAWEI P9

Search This thread
Im actually looking to switch to Linux soon. Sounds great that stuff like adb works out of the box, but dont stuff like drivers still have to be installed since they're proprietary stuff? For the computer to detect them?
In fact, you need to install adb and fastboot as packages under Linux (similar, as you would download that famous "minimal fastboot and adb" thing for Windows). But as said, you don't need any drivers under Linux to connect to any mobile device. (Most probably, because Linux knows how to talk with Linux, and - OK, that's now a drastically simplified statement - Android also runs on Linux or "is Linux")
 
  • Like
Reactions: xHayashi

xHayashi

Member
Oct 26, 2020
27
0
Good - just a hint: When you come to the very last step of flashing the Stock recovery, make sure to flash the equivalent recovery as well, e.g. the Stock b552 recovery, when you have used the b552 firmware (and not the linked b540 recovery from the HWOTA thread, which is only valid for b540)


Sorry, can't help unfortunately with this question: I personally use Linux on my private PC, and not Windows. So I never had to deal with having to install USB drivers to be able to use adb and fastboot. Under Linux, this works out of the box without the need of installing additional drivers. But I am sure, others following this thread should be able to help.
Hey, I got EMUI 8 running successfully, but do I need to fix the network? cause the network patches he provided are for b540 instead of b522
 
Hey, I got EMUI 8 running successfully, but do I need to fix the network? cause the network patches he provided are for b540 instead of b522
The network fix from b540 is to be used, if needed. Depends on the region in the world, where you are: If the phone recognized your SIM card (if you are e.g. in China), you obviously don't need it. If your SIM wasn't found, you need it.
 
  • Like
Reactions: xHayashi

xHayashi

Member
Oct 26, 2020
27
0
The network fix from b540 is to be used, if needed. Depends on the region in the world, where you are: If the phone recognized your SIM card (if you are e.g. in China), you obviously don't need it. If your SIM wasn't found, you need it.
Gotcha. What about the part where it asks me to download playstore and any keyboard? Since Im doing this to degoogle, ideally I can avoid installing gapps and just toss smethg like openkeyboard into the phone instead?

And making sure Stock EMUI recovery comes with enabling OTA too I assume? Since the steps are bundled together. Im not sure how OTA works, but ideally I can severe the dependence on Huawei too. Will OTA be needed for your ROM and any downsides to not having it?
 
Last edited:
Gotcha. What about the part where it asks me to download playstore and any keyboard? Since Im doing this to degoogle, ideally I can avoid installing gapps and just toss smethg like openkeyboard into the phone instead?

And making sure Stock EMUI recovery comes with enabling OTA too I assume? Since the steps are bundled together. Im not sure how OTA works, but ideally I can severe the dependence on Huawei too. Will OTA be needed for your ROM and any downsides to not having it?
You need a keyboard app, the network patch also throws away a lot of Chinese bloat/spyware. You need the keyboard app only for the time you use the original Stock ROM, but you need it, so use Swiftkey and not Gboard. As you in fact target on flashing LineageOS, you obviously do not need Playstore and - besides the fact, that there most probably won't be any further OTA package offered by Huawei for this device - again, you are going to flash LineageOS at the end, so you don't need that either.
 

xHayashi

Member
Oct 26, 2020
27
0
You need a keyboard app, the network patch also throws away a lot of Chinese bloat/spyware. You need the keyboard app only for the time you use the original Stock ROM, but you need it, so use Swiftkey and not Gboard. As you in fact target on flashing LineageOS, you obviously do not need Playstore and - besides the fact, that there most probably won't be any further OTA package offered by Huawei for this device - again, you are going to flash LineageOS at the end, so you don't need that either.
Cool! I was wondering if Lineage OS and other roms would utilize the OTA function for their own rom updates as well. But Im not tech savvy enuf to know all these things haha Thanks for the clarification! Imma just grab like openboard or something.

Btw are you familiar with degoogling or privacy stuff on smartphones? I know privacy on smartphone is kinda a joke, but Id love to ask some of the questions I have if you're familiar with it. Probably in a dm since I dont wanna flood this thread with non-los relatrd stuff haha
 

xHayashi

Member
Oct 26, 2020
27
0
I forgot to ask, the rebrand guide told me to puy thr P9 Eva 8.0 Twrp v4 img into the hwota7> windows folder and flash it with adb. But what about the emui stock recovery? Do I use the same steps I did for flashing the twrp file, or somewhere else?
 
Cool! I was wondering if Lineage OS and other roms would utilize the OTA function for their own rom updates as well. But Im not tech savvy enuf to know all these things haha Thanks for the clarification! Imma just grab like openboard or something.
In general, LineageOS uses its own OTA mechanism. For other builds, which I offer, I am making use of that mechanism to offer OTA updates of my builds. However, this build for the P9 is a "treble" build - this means that only the /system partition is replaced and also updated. So whenever I publish an update, people willing to apply it have to flash it manually via fastboot.

Btw are you familiar with degoogling or privacy stuff on smartphones? I know privacy on smartphone is kinda a joke, but Id love to ask some of the questions I have if you're familiar with it. Probably in a dm since I dont wanna flood this thread with non-los relatrd stuff haha
Yes, I am. You can DM me.
 
  • Like
Reactions: xHayashi

xHayashi

Member
Oct 26, 2020
27
0
In general, LineageOS uses its own OTA mechanism. For other builds, which I offer, I am making use of that mechanism to offer OTA updates of my builds. However, this build for the P9 is a "treble" build - this means that only the /system partition is replaced and also updated. So whenever I publish an update, people willing to apply it have to flash it manually via fastboot.


Yes, I am. You can DM me.
Great! I messaged you through the XDA conversations/ dm. If you have telegram or smethg, that'd make chatting easier too. Btw, what should I do for the question above, on img files and flashing?
 
I forgot to ask, the rebrand guide told me to puy thr P9 Eva 8.0 Twrp v4 img into the hwota7> windows folder and flash it with adb. But what about the emui stock recovery? Do I use the same steps I did for flashing the twrp file, or somewhere else?
You flash the stock recovery at the end with the below fastboot command (assuming the file is called "recovery_ramdis.img" - alter the filename accordingly to reflect the real file name):
Code:
fastboot flash recovery_ramdisk recovery_ramdis.img
 

xHayashi

Member
Oct 26, 2020
27
0
In general, LineageOS uses its own OTA mechanism. For other builds, which I offer, I am making use of that mechanism to offer OTA updates of my builds. However, this build for the P9 is a "treble" build - this means that only the /system partition is replaced and also updated. So whenever I publish an update, people willing to apply it have to flash it manually via fastboot.


Yes, I am. You can DM me.
Hey, so i flashed the emui stock recovery file in adb with my phone in fastboot mode. I turned my phone off and held on the vol + and power button to see if it works. Now ny phone is stuck in "your phone is unlocked... your device is booting up" screen.
 

xHayashi

Member
Oct 26, 2020
27
0
I used twrp to flash the disable ota zip file. Booted the phone and everything was good. After that, I just booted into fastboot mode, ran cmd.exe and copy pasted the "fast flash recovery... emui recovery...img" command, with the img file in the directory. It took a few seconds and said it was done.

After that I forgot if I just held the power button while still in fastboot mode and then held the vol + and power button to try and see if i can boot up emui stock reocvery; OR i booted the system up first, powered it off, and held vol+ and power button to see if I can pull up stock emui recovery.

And either scenario just led to the phone being stuck on the "device is booting now" screen.
 

xHayashi

Member
Oct 26, 2020
27
0
New Update: After an ungodly amount of time being stuck on that screen, it shoes the EMUI logo screen and says software installation failed. However, it allowed me to reboot system and I can boot the phone up now lol

Erm given what I mentioned above, how do I make sure I dont get the same thing again? And if there's a way I can check if EMUI stock recovery was successfully installed? Cause I assume TWRP gets replaced by the EMUI stock recovery right, due to them sharing the same buttons when you pull em up?
 
New Update: After an ungodly amount of time being stuck on that screen, it shoes the EMUI logo screen and says software installation failed. However, it allowed me to reboot system and I can boot the phone up now lol

Erm given what I mentioned above, how do I make sure I dont get the same thing again? And if there's a way I can check if EMUI stock recovery was successfully installed? Cause I assume TWRP gets replaced by the EMUI stock recovery right, due to them sharing the same buttons when you pull em up?
Normally, if your phone is somehow stuck, you can force-switch-off with the fastboot key combo (power+vol down).
If you have flashed the recovery properly, it should boot up. Did you use the right file, as I have mentioned? So using the B552 recovery file, if you have used the b552 firmware?
To make sure, I have those recovery files here: https://sourceforge.net/projects/lin16-microg/files/treble_p9eva/EMUI8.0_Stock/
Also, important is the command "fastboot flash recovery-ramdisk <name of recovery file>" (impor,tant is to really say recovery-ramdisk and not simply recovery)
Before you flash the lineageos system.img file from this thread, it is important to have a properly working stock recovery.

I recommend to flash the recovery image again. Unfortunately, the only way to test the recovery is to boot into it.
It should look like here: https://www.hardreset.info/media/resetinfo/2016/114/4f1e525917414db39f6daa04b56ed2a4/huawei-p9.JPG
 

xHayashi

Member
Oct 26, 2020
27
0
Normally, if your phone is somehow stuck, you can force-switch-off with the fastboot key combo (power+vol down).
If you have flashed the recovery properly, it should boot up. Did you use the right file, as I have mentioned? So using the B552 recovery file, if you have used the b552 firmware?
To make sure, I have those recovery files here: https://sourceforge.net/projects/lin16-microg/files/treble_p9eva/EMUI8.0_Stock/
Also, important is the command "fastboot flash recovery-ramdisk <name of recovery file>" (impor,tant is to really say recovery-ramdisk and not simply recovery)
Before you flash the lineageos system.img file from this thread, it is important to have a properly working stock recovery.

I recommend to flash the recovery image again. Unfortunately, the only way to test the recovery is to boot into it.
It should look like here: https://www.hardreset.info/media/resetinfo/2016/114/4f1e525917414db39f6daa04b56ed2a4/huawei-p9.JPG
Ahhh I used the b540 file from the thread om this b552 firmware, I think that mightve been the problem *facepalm*. Ill grab your b552 recovery file and see what happens then.
 

xHayashi

Member
Oct 26, 2020
27
0
Normally, if your phone is somehow stuck, you can force-switch-off with the fastboot key combo (power+vol down).
If you have flashed the recovery properly, it should boot up. Did you use the right file, as I have mentioned? So using the B552 recovery file, if you have used the b552 firmware?
To make sure, I have those recovery files here: https://sourceforge.net/projects/lin16-microg/files/treble_p9eva/EMUI8.0_Stock/
Also, important is the command "fastboot flash recovery-ramdisk <name of recovery file>" (impor,tant is to really say recovery-ramdisk and not simply recovery)
Before you flash the lineageos system.img file from this thread, it is important to have a properly working stock recovery.

I recommend to flash the recovery image again. Unfortunately, the only way to test the recovery is to boot into it.
It should look like here: https://www.hardreset.info/media/resetinfo/2016/114/4f1e525917414db39f6daa04b56ed2a4/huawei-p9.JPG
Crap, I think the open kirin site is down, do you know of another set of instructions for installation? Id love to get this running soon, excited to revive this device haha

Update: Figured out I could use the wayback machine
 
Last edited:

xHayashi

Member
Oct 26, 2020
27
0
Normally, if your phone is somehow stuck, you can force-switch-off with the fastboot key combo (power+vol down).
If you have flashed the recovery properly, it should boot up. Did you use the right file, as I have mentioned? So using the B552 recovery file, if you have used the b552 firmware?
To make sure, I have those recovery files here: https://sourceforge.net/projects/lin16-microg/files/treble_p9eva/EMUI8.0_Stock/
Also, important is the command "fastboot flash recovery-ramdisk <name of recovery file>" (impor,tant is to really say recovery-ramdisk and not simply recovery)
Before you flash the lineageos system.img file from this thread, it is important to have a properly working stock recovery.

I recommend to flash the recovery image again. Unfortunately, the only way to test the recovery is to boot into it.
It should look like here: https://www.hardreset.info/media/resetinfo/2016/114/4f1e525917414db39f6daa04b56ed2a4/huawei-p9.JPG
Sorry for all the questions, but I have flashed the b552 stock recovery file and your rom.

But when I boot into EMUI stock recovery to try and factory reset, it keeps getting interrupted. It shows me that it's doing a factory reset but gets interrupted at 19% and asks me if I want to factory reset/ reboot system/ wipe cache partition again (it also asks me to enter yes and confirm everytime i select factory reset).

And the screen where it gives me the options has a huge red exclamation mark in the middle where the EMUI logo should be. Oddly enough when its actually trying to factory reset, it shoes the normal EMUI logo before stopping at about 19% again.

Should I just select reboot the system anyways?
 
Last edited:
Crap, I think the open kirin site is down, do you know of another set of instructions for installation? Id love to get this running soon, excited to revive this device haha
Ok, in short:
Prerequisite is, that you have a working Phone having EMUI 8.0, including ability to make phone calls, have mobile data, and a working Stock recovery.

If the prerequisite is fully met, flash the system image of my ROM (unzip before) with the command:
Code:
fastboot flash system <name of my ROM>.IMG

Afterwards, reboot to recovery! Do so e.g. by entering "fastboot reboot" and pressing power+vol up afterwards. It is important not to let the system boot normally, this won't work and you will end up in a boot loop.

In recovery, choose "Wipe data / Factory reset". Don't get fooled by any percentage shown less than 100% or by a red exclamation mark.
Once that step is done, choose "wipe cache". Once that is done as well, choose reboot.

The 1st time of reboot will in between even show an encryption screen and maybe another reboot. Don't worry.

Sorry for all the questions, but I have flashed the b552 stock recovery file and your rom.

But when I boot into EMUI stock recovery to try and factory reset, it keeps getting interrupted. It shows me that it's doing a factory reset but gets interrupted at 19% and asks me if I want to factory reset/ reboot system/ wipe cache partition again (it also asks me to enter yes and confirm everytime i select factory reset).

And the screen where it gives me the options has a huge red exclamation mark in the middle where the EMUI logo should be. Oddly enough when its actually trying to factory reset, it shoes the normal EMUI logo before stopping at about 19% again.

Should I just select reboot the system anyways?
See above :)
 

xHayashi

Member
Oct 26, 2020
27
0
Ok, in short:
Prerequisite is, that you have a working Phone having EMUI 8.0, including ability to make phone calls, have mobile data, and a working Stock recovery.

If the prerequisite is fully met, flash the system image of my ROM (unzip before) with the command:
Code:
fastboot flash system <name of my ROM>.IMG

Afterwards, reboot to recovery! Do so e.g. by entering "fastboot reboot" and pressing power+vol up afterwards. It is important not to let the system boot normally, this won't work and you will end up in a boot loop.

In recovery, choose "Wipe data / Factory reset". Don't get fooled by any percentage shown less than 100% or by a red exclamation mark.
Once that step is done, choose "wipe cache". Once that is done as well, choose reboot.

The 1st time of reboot will in between even show an encryption screen and maybe another reboot. Don't worry.


See above :)
Hmmm the weird thing is, it keeps stopping at 19%, goes into a screeb with a huge exclamation mark and asks me if I wanna reboot system, wipe data/ factory reset, wipe cache. If i select wipe data/ factory reset, Ill have to key in yes and select wipe data. It never goes past 19% before showing this screen again o.o

And I selected reboot system just now for a change. Like you said, the encryption screen showed up and it guided me through the set up process, and Lineage OS actually booted. But Im not sure will other issues show up later lol Is this considered a full factory reset? Id hate to still have huawei/ google spyware stuff in it.

I then tried factory resetting with EMUI recovery again, and its the same thing, stops at 19% when factory resetting. Am I supposed to keep repeating it for 10-20 times? Asking just to make sure cause I did 5 times at most iirc

Attached pics below to give you an idea.
 

Attachments

  • Imagepipe_3.jpg
    Imagepipe_3.jpg
    46.1 KB · Views: 16
  • Imagepipe_0.jpg
    Imagepipe_0.jpg
    50 KB · Views: 7
  • Imagepipe_2.jpg
    Imagepipe_2.jpg
    49.3 KB · Views: 7
  • Imagepipe_1.jpg
    Imagepipe_1.jpg
    55.8 KB · Views: 15
  • Imagepipe_4.jpg
    Imagepipe_4.jpg
    65.1 KB · Views: 15
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    New build with backported April '24 ASB patches available

    Hi all,

    a new build is available for download (update instructions, see OP):
    • Custom build release 2024-04-01
    Important note about Webview update:
    With the M122 release, webview again has significantly grown by ~30MB - this again exceeds the maximum /system partition size of the P9 device. Therefore, I have shipped again the previous version from the M121 release of last month. Please update therefore the Webview to M123 as explained in my previous post.

    Happy flashing!
    Regards, M.
    2
    Perhaps you can join hisi-oss group to build LineageOS 20.0 or 21
    Thanks for the proposal, but due to the below listed three reasons, my answer can only be no :
    1. The P9-EVA has got a 4.4 kernel, so there is no support for eBPF, which is a requirement for Android 12 and above, see e.g. here - yes, I know, there is an "ugly hack" patch to simply 'carve out' the entire packet filtering functionality and hence render the network manager void, but my build offers a firewall and Google/Facebook blocking or filtering functionality as a key feature - hence this is a solid KO criterion for me.

    2. We could already stop at item 1, but here comes another road block: I have already now in Android 9 severe issues with the small system partition size of the P9, so people have to manually update the webview (which is then saved on the /data partition), because I can only ship M121 with my build. I seriously doubt, that even a "Vanilla" Android 13 GSI fits on the system partition. And the /product partition size on the P9 - apart from better not messing around with that in treble builds - really is a joke!

    3. On top, and the P9 camera is also something VERY special which requires some extra attention - maybe for that piece there should somewhere be a solution, but not trivial.
    Whilst #3 should be solvable, I consider #2 and #1 a really substancial obstacle for the P9-EVA to get Android 13.
    1
    New build with backported April '24 ASB patches available

    Hi all,

    a new build is available for download (update instructions, see OP):
    • Custom build release 2024-04-01
    Important note about Webview update:
    With the M122 release, webview again has significantly grown by ~30MB - this again exceeds the maximum /system partition size of the P9 device. Therefore, I have shipped again the previous version from the M121 release of last month. Please update therefore the Webview to M123 as explained in my previous post.

    Happy flashing!
    Regards, M.
    Perhaps you can join hisi-oss group to build LineageOS 20.0 or 21
    1
    Perhaps you can join hisi-oss group to build LineageOS 20.0 or 21
    1
    Thanks for the proposal, but due to the below listed three reasons, my answer can only be no :
    1. The P9-EVA has got a 4.4 kernel, so there is no support for eBPF, which is a requirement for Android 12 and above, see e.g. here - yes, I know, there is an "ugly hack" patch to simply 'carve out' the entire packet filtering functionality and hence render the network manager void, but my build offers a firewall and Google/Facebook blocking or filtering functionality as a key feature - hence this is a solid KO criterion for me.

    2. We could already stop at item 1, but here comes another road block: I have already now in Android 9 severe issues with the small system partition size of the P9, so people have to manually update the webview (which is then saved on the /data partition), because I can only ship M121 with my build. I seriously doubt, that even a "Vanilla" Android 13 GSI fits on the system partition. And the /product partition size on the P9 - apart from better not messing around with that in treble builds - really is a joke!

    3. On top, and the P9 camera is also something VERY special which requires some extra attention - maybe for that piece there should somewhere be a solution, but not trivial.
    Whilst #3 should be solvable, I consider #2 and #1 a really substancial obstacle for the P9-EVA to get Android 13.
    The hisi-oss project provides a 4.4 kernel with a BPF upstream, I myself have a pra-lx1 under Android 13. Moreover, for the partition problem it is not a problem either because the oss replaces the vendor partitions , product, odm by only one partition dynamic (super.img)
  • 24
    This thread is dedicated to provide Lineage-OS 16.0 builds with microG included for the HUAWEI P9 with current security patches.

    It is a treble build, therefore it could also work on other devices, but I haven't tested. And yes, the camera works!
    (Although it is based on the work of phhusson's GSI builds, some specific adaptations have been made, so I guess, it is worth a try for further Huawei devices based on EMUI 8, but that's it...)

    Features of this ROM
    Download here
    • Pre-installed microG and F-Droid like the LineageOS for microG project (own fork)
    • Pre-installed AuroraStore see section "Space restrictions on the /system partition"
    • Root included (switch on in dev. settings)
    • Backported Audio balance (accessibility settings) from Android 10
    • Additional security hardening features listed below
    • Access to /proc/net blocked for user apps
    • Bundled netmonitor app to allow network monitoring
    • Enhanced Privacy Guard: Switches for motion sensors and other sensors
    • Cloudflare as default DNS (instead of Google)
    • Privacy-preferred default settings
    • Optional blocking of Facebook- and Google-Tracking
    • Optional disabling of captive portal detection
    • Firewall UI
    • No submission of IMSI/phone number to Google when GPS is in use
    • Default hosts file with many blocked ad/tracking sites
    • Privacy-enhanced Bromite SystemWebViewMulch Webview
    • Additional restrictions for secondary users
    • Increased password length
    • Hardened bionic lib and constified JNI method tables
    • Huawei Stock Camera

    Current release levels
    Custom build release 2024-04-01
    Security string: 2022-01-01
    AOSP tag: 9.0.0_r46
    Mulch System Webview: M121 *


    Source-code and build instructions
    Device config.: https://github.com/lin16-microg/device_phh_treble/tree/lin-16.0-eva-p9
    Build manifest: https://github.com/lin16-microg/local_manifests/tree/lin-16.0-treble


    Installation Instructions

    YOU ARE RESPONSIBLE SOLELY YOURSELF FOR ANY ACTIONS YOU DO WITH YOUR DEVICE !!!

    Please note - I won't explain any single aspect (e.g. how to install 'fastboot' on your PC or troubleshoot USB connectivity issues under Windows). Search the net and consult the search engine of your choice or look here in XDA, there is plenty of information available.

    Pre-Requisites
    • Have fastboot and adb installed on your PC and make sure, you can connect via USB to your device in fastboot mode and via adb
    • Know the key combinations to get your phone into fastboot mode and recovery mode
    • An unlocked bootloader
    • EMUI 8.0 firmware
    • Have the Huawei Stock recovery installed (not TWRP)

    ONLY, If the above pre-requisites are met, download and unpack the linked ZIP file, and flash the .img file via fastboot (EMUI 8.0 is the tricky pre-requisite - see further below).
    • Get your device into fastboot mode and connect to your PC via USB - the screen should look like below, indicating "PHONE Unlocked"
      P9_fastboot.png
    • Flash the ROM with the command fastboot flash system <name of the rom img file>.img
      fastboot-flash.png
    • Afterwards, enter the command fastboot reboot
    • Hold Power+Vol.Up to get into the Stock recovery:
      p9_stockRecovery.png
    • Choose the option "wipe data/factory reset"
      Don't 'panic' if the operation stops at a percentage significantly lower than 100% and you see a red exclamation mark, all is fine
    • Next, choose "wipe cache partition"
    • Finally choose "reboot system now"

    Some hints:
    • If you come from an EMUI 8.0 stock ROM or a different treble build (which means, you are already on EMUI 8.0), don't forget the factory reset as described.
    • If you update one of my builds from this thread, you don't need to wipe anything, so you can skip everything after the 'fastboot reboot' step!
    • On some (but not all) PCs, you may have to run fastboot as Admin (Windows) or root/sudo (Linux)

    If the above pre-requisites are NOT met, you will have some extra-rounds to perform, until you get there:
    Unlocked Bootloader
    Huawei has stopped providing unlock keys, so if you haven't got one, this thread, this link and/or of course the search-engine of your choice may be helpful. I was lucky enough to obtain an official unlock key on the last day of HUAWEI's unlock page, so I have no experience with the unofficial unlock methods - good luck!

    EMUI 8.0 firmware
    Get back to Stock ROM, if you use a Custom ROM. On Stock, if not yet done, apply all updates offered to you by the Stock ROM updater, until you are on the latest officially offered Android 7 (Nougat) EMUI 5.x release.
    Huawei has shut down however their update servers for older devices and older software releases, so this may become difficult, if you are e.g. still on Android 6 - I don't have a good advice for you in this case.
    Once you are on Android 7 (aka Nougat), please visit this thread, which really explains step-by-step, what needs to be done. Really carefully read everything and follow ALL the steps, especially, don't forget at the very end to flash the Stock EMUI recovery!
    IMPORTANT UPDATE:
    The linked thread, as well as the Openkirin documentation point - via a Russian firmware site - to the domain 'hicloud.com' for the firmware download, which seems to be down. As suggested by @zgfg you can try either
    his Mega link or e.g. https://androidhost.ru/search.html
    Update: See this post to obtain the firmware!
    Update 2: See also here

    You need your unlock key handy: During this process, the bootloader will be automatically locked several times, so you need the key a couple of times to unlock again!
    A hint for Linux users: The HWOTA tool is in fact a windows wrapper around Linux shell scripts, so there is no real need to use Windows, if you have a working Linux installation (however, make sure to replace the 'mkdir' commands in hwota_eng.sh with 'mkdir -p').


    Android 10, 11, 12 or 13 builds?

    Simple answer: There won't be any coming from my end (my aim is to provide daily-driver capable builds and not to boot an experimental GSI with lots of issues and a non-working camera) - so stop wasting everybody's time by repeatedly asking!

    Space restrictions on the /system partition

    The /system partition in the P9's partition scheme is quite small with ~ 1,88GB. (The original treble design of Stock OS has foreseen, that certain apps in fact land in the /product partition - this of course is not really feasible with a treble build, as we need to leave the "original" /vendor , /product, /odm, ... etc. partitions intact and have to concentrate only on the /system partition.) In order to gain back some space to be able to make the build, a couple of normally shipped apps are not packaged. They can easily be installed again as regular "user apps" - you can download and install the respective apk files from here:

    AuroraStore.apk
    Please download from its official source here: Install and choose "AuroraServices" as install method.

    eSpeakTTS.apk
    A simple Text-to-Speech app - was shipped before as part of the ROM.

    Exchange2.apk
    Was part of LineageOS shipment - if you need to connect to a Microsoft Exchange server to fetch e-mails. Pretty sure most of you won't even miss that one, but in case you really need it, here we go. Please note, that this apk file has been signed with this ROM's signature, recommended to be used only with this ROM.

    LockClock.apk
    The ROM still ships a simply desk clock widget. The LockClock app is the extended clock widget offering to show weather information (if you use a weather plugin) and calendar alerts. Please note, that LineageOS has in later releases abandonned its development. Nevertheless, if you still need/want it, you can simply install. Also not, that this app is signed with this ROM's signing key, so if you really want to use it, only use the linked apk.

    Webview updates *​

    Above space restrictions limit the shipped Webview to the M121 release. To update, please use the shipped F-Droid app and add the Divest-OS F-Droid repo.

    Bug reports:
    If you have a problem, please create a post with these informations:
    Build Date:
    And try to get log as described here
    Please note that I can't and won't support issues with builds using a different kernel or Xposed.
    In regards to microG, I will try my best to help when it is related to this ROM (I use it myself), but any questions of the type "the YXZ-app can't do <some sort of fancy xyz Google functionality> properly" are better asked in the respective microG forums.

    Credits
    AOSP project
    LineageOS project
    openkirin.net
    phhusson
    AndyYan
    Tecalote
    microG project
    Graphene OS project
    csagan5 (Bromite)
    WhyOrean (Aurora)
    zgfg (for very helpful contributions in this thread)


    XDA:DevDB Information
    [ROM][Treble][microG]LineageOS 16.0 for HUAWEI P9, ROM for the Huawei P9

    Contributors
    MSe1969
    Source Code: https://github.com/lin16-microg/device_phh_treble/tree/lin-16.0-eva-p9

    ROM OS Version: 9.x Pie
    ROM Kernel: Linux 4.x
    ROM Firmware Required: EMUI 8 firmware
    Based On: LineageOS

    Version Information
    Status:
    Stable
    Stable Release Date: 2024-04-11

    Created 2020-04-06
    Last Updated 2024-04-11
    9

    GAPPS installation​


    If you need, Gapps can be instaled. This rom is suitable for them.
    I install NikGapps. Also working are MindTheGapps - I only noticed old play store. Someone reported that bitGapps work for him – I did’t manage to install them successfully. Absolutely don’t aspect that any gapps package will work – I have tested myself all of them.


    First of all a comprehensive clean up is necessary. You need enough free space on /system partition and later install missing apps back from (play/aurora/fdroid) store.
    (Some apps are really useless and I recommend way better open surce alternative as Simple mobile tools, especially Simple gallery pro)


    Fresh instalation​

    At fresh install of this custom rom, flash the rom image and TWRP recovery for android 8 in same session.
    TWRP for Oreo P9-EVA-8.0.0-TWRP-v4.img: https://www.androidfilehost.com/?fid=1322778262903998750 (you used it when you rebrand and get phone on EMUI 8 firmware (https://xdaforums.com/t/rebrand-update-tool-hwota7-p9-eva.3820849/#post-77161313))
    Get device into fastboot mode.

    Code:
    fastboot flash system <name of the rom img file>.img
    fastboot flash recovery_ramdisk P9-EVA-8.0.0-TWRP-v4.img

    boot to TWRP with power + volume up.
    Go to Mount and mount /system partition and /external sd card. Then go to Advanced/File manager.
    Now you have to clean all traces of microG and free up additional space. Below is the list what I have deleted. (Ofcourse some bloatware bodered me) It's not neccessery all this but you have to provide enough free space, that's the point.

    Code:
    /system/app/AuroraStore/AuroraStore.apk
    /system/app/Calendar/Calendar.apk
    /system/app/Email/Email.apk
    /system/app/eSpeakTTS/eSpeakTTS.apk
    /system/app/GSFProxy/GSFProxy.apk
    /system/app/IchnaeaNlpBackend/IchnaeaNlpBackend.apk
    /system/app/messaging/messaging.apk
    /system/app/NominatimNlpBackend/NominatimNlpBackend.apk
    /system/app/privacy-friendly-netmonitor/privacy-friendly-netmonitor.apk
    
    /system/etc/permissions/privapp-permissions-com.android.vending.xml
    /system/etc/permissions/privapp-permissions-com.google.android.gms.xml
    
    /system/priv-app/AuroraServices/AuroraServices.apk
    /system/priv-app/Dialer/Dialer.apk
    /system/priv-app/FakeStore/FakeStore.apk
    /system/priv-app/Gallery2/Gallery2.apk (+ subfolder lib)
    /system/priv-app/GmsCore/GmsCore.apk
    /system/priv-app/Recorder/Recorder.apk

    Now you can instal NikGapps with TWRP. Wipe dalvik/cache at end.
    Get device into fastboot mode and flash stock recovery back. Download from here: https://www.androidfilehost.com/?fid=1395089523397898706

    Code:
    fastboot flash recovery_ramdisk EVA-b540-EMUI-RECOVERY_RAMDIS.img

    Get into stock recovery by press and hold Power+Vol.Up where you do the factory reset. Then boot to the system for first time.


    Update procedure​

    When you flash new build of this rom, you have to repeat all steps above. Only omit factory reset at the end.


    Gapps as Magisk module​

    Alternatively you can install Gapps as Magisk module.
    In this case for me only liteGapps were working. (lite package is smaller than core). I only noticed that contact sync wasn't working.
    I haven't tested, but should works if you install GoogleContactsSyncAdapter separately bevor. See my previous post how to do this. Do factory reset and then continue with Magisk and liteGapps.



    HWGSIpartitionKit to resize huawei system partition​

    Just to mention another alternative way. You can use HWGSIpartitionKit to resize huawei system partition.


    Thank you all for your help
    @MSe1969 , @Tecalote , @lo_ol , @zgfg , @AltairFR , @golvelliuscs , @Nicknackpaddywack101



    Some related things:​

    The same warning belongs also here. Most likely not, but sometimes things can go wrong. Since you are switching between TWRP and stock EMUI recovery, it is possible that you end up in boot loop. Backup your data!
    Just flash back stock recovery, do factory reset and working system is back.
    8
    New build with backported July '22 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):
    • Custom build release 2022-07-01
    Happy flashing!
    Regards, M.
    7
    New build with backported March '24 ASB patches available

    Hi all,

    a new build is available for download (update instructions, see OP):
    • Custom build release 2024-03-01

    Important note about Webview update:
    With the M122 release, webview again has significantly grown by ~30MB - this again exceeds the maximum /system partition size of the P9 device. Therefore, I have shipped again the previous version from the M121 release of last month.
    Please update therefore the Webview to M122 using one of the two below listed methods:

    a. If you have already manually added further repositories to the F-Droid app, please make sure to add the Divest-OS repository: "https://divestos.org/apks/official/fdroid/repo/ " - once added, it will offer you to update Mulch Webview

    b. Option a always works. If you haven't yet added any additional repository to F-Droid, the following option may even be easier: Go to Settings - Apps, choose the F-Droid app and purge its used memory. When you start F-Droid, it will update its repository list and afterwards offer you to update Mulch Webview.


    Happy flashing!
    Regards, M.
    7
    New build with backported January '24 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):
    • Custom build release 2024-01-01
    • Mulch System Webview 120.0.6099.210
    • Timezone DB 2023 updates

    Happy flashing!
    Regards, M.