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

Search This thread
Thanks for great rom! I realized, that without google goes too.
Thanks for the positive feedback :)

My bank app claimed that weren't installed from playstore and therefore it closed for that reason. How bad, ugly bank!
Then I change the install method in Aurora store to Native installer (for older android versions) (Setting/Instalation/Instalation method). After reinstall bank app works for now.
What if maybe will need the playstore in future app versions?
Depends on "how" the app is bound to the PS. Right now, it only seems to be an installer flag, so you have worked around it. Some apps however use PS license verification - as explained in the Aurora FAQ, in such a case, you're lost. Same applies, if e.g. the "Safety net" api is used; this isn't related to the play sore, but the genuine Google Play services (I always call then "Spy services").

Some noob qustion. If some custom rom has latest security patches and updates like this one, does android version matter?
Phew... That's a complex question. The "short & easy" answer would be "no, it does not matter!", but that answer deserves some further elaboration, as it in fact is not that easy:

A ROM has got in fact four "components":
  • The device-independent android platform
  • The Linux-Kernel
  • The device hardware drivers (aka "vendor blobs"), which are closed source vendor delivered
  • The device configuration, which glues the above three together

Whilst the device-independent android-platform is usually very well maintained (or back-ported), the maintenance of the kernel and the updates of the vendor blobs is a different question and depends on the device maintainer / ROM builder.

The older the android version, the harder the backport and the bigger the "unknowns". Android 9 isn't officially supported any longer by Google, but so far, it has been pretty straight-forward to backport the ASB patches, so Android 9 I would still consider 'safe'. But I am also providing Android 7 based ROMs, where it starts to become very difficult and also a "grey area"...

This ROM here for the P9 of this thread is a "treble build", so only the device-independent android platform is updated, whilst kernel and device blobs stay "as is". (Unless Huawei surprisingly delivers another EMUI 8 update, which I severely doubt...)

So I would split the question into two different situations:

A.)
Q: For my device "ABC", there is only an Android 'n' build available, whilst the most recent Android release is meanwhile 'n + x'. Do I need to worry?
A: The available ROM is the "best", you can get for your device and for sure better than using the outdated stock ROM. So in the absence of a true alternative (other than getting a different, newer device) there is nothing to worry. I think that would describe the situation of the P9 quite well, I think. Having said so, if you fear being "professionally targeted", seek professional advice and aim at least for an "original" GrapheneOS device...

B.)
Q: For my device, there are Android 'n' as well as 'n +1' or even 'n + 2' builds available. What should I do?
A: First of all, the functionality counts. Is the build with the latest Android release really stable, has acceptable performance (the newer the Android release, the higher the hardware demands) and is really daily-driver capable and also offers the features, which are important to me? If the answer is no, rather stick with the current stable, fast and daily-driver proven build.
(Just some thoughts: ROMs, where e.g. SELinux has been deactivated in the kernel are experimental and unsafe, applying ASB patches to such a ROM is close to useless - such stuff may be nice as a temporary test, if you are interested to see the look and feel of a new version, but don't use that as "daily driver". Further, some ROM developers apply heavy downporting modifications to a modern Android version just to get it "somehow" running on a very old device - also not what I would consider a "daily driver" use. Another example: I used to offer LineageOS 17.1 builds for the Osprey device, and finally decided to stop it and offer again LineageOS 16.0 builds with recent ASB backports for it, as 17.1 simply was too laggy and slow)
If however there is really no difference, the more modern Android version is to be preferred; especially, if the device manufacturer still delivers updates, which means that even the vendor blobs can be updated.

Hope that could give you a better view on that topic.
 

P9_User

Senior Member
Oct 27, 2020
54
9
Hi there. Another user-question.

I am not shure if it has something to do with latest update, the 3D app fusion360 tells me WebGL is deactivated.
Now I dont know when it happened because I had that viewer working proppely for a while.

My P9 is running nice and only changes are weekly app-update and security patch once its released.

So I am not shure where this WebGl issue is coming from. Hope my request this is not too far away from this thread.
 

NPS-2750X

Member
Oct 17, 2021
29
11
This system image works well on my EVA-AL10(Chinese version), but there are still some bugs.

1. The most serious one is that I can't delete any photo in /DCIM/Camera , as the picture below shows. If I try to delete these photos in Gallery app , they would "disappear" but not really be deleted.

2. Sometimes , the device will immedietely turn black and then automatically reboot after taking a photo in stock camera.

3. When I use this system for the first time , it asked me for password . But I never set any password on this device and I used fastboot -w before flashing. In the end I ran factory reset in Recovery mode and it showed "Device is being encrypted" before booting into system.
Screenshot_20220805_151728.jpg
 

NPS-2750X

Member
Oct 17, 2021
29
11
Another problem is that if Magisk is installed , the CPU temperature would be really high (up to 64℃) and remain unchanged. At the same time , the internal Root settings would disappear. I had no choice but give up installing Magisk.

Besides , it seems that the camera problem can be solved by adjusting settings. If "Save photo to SD card" switch is turned on , camera will work normally. But I still can't delete any photo.

That's all the problems I've found until now.

Although there are bugs , this system is good and easy to use . Thanks to the developers , this old device comes to life again.
 
  • Like
Reactions: MSe1969
Hi there. Another user-question.

I am not shure if it has something to do with latest update, the 3D app fusion360 tells me WebGL is deactivated.
Now I dont know when it happened because I had that viewer working proppely for a while.

My P9 is running nice and only changes are weekly app-update and security patch once its released.

So I am not shure where this WebGl issue is coming from. Hope my request this is not too far away from this thread.
I have just installed this app for test purposes, but as you need an Autodesk account to start using that app, I didn't continue and de-installed it again. At least for the steps to get to the logon screen, there was no error...
Can you produce a log or so? Or, after updating to the next build (will be published soon), try again?
 
This system image works well on my EVA-AL10(Chinese version), but there are still some bugs.
Thanks for your feedback.

1. The most serious one is that I can't delete any photo in /DCIM/Camera , as the picture below shows. If I try to delete these photos in Gallery app , they would "disappear" but not really be deleted.
I can't reproduce this behavior on my own P9.

2. Sometimes , the device will immedietely turn black and then automatically reboot after taking a photo in stock camera.
Haven't experienced this so far on my own device. However, the P9 is not my primary device, so I am not a "power user" of it or its Camera...

3. When I use this system for the first time , it asked me for password . But I never set any password on this device and I used fastboot -w before flashing. In the end I ran factory reset in Recovery mode and it showed "Device is being encrypted" before booting into system.
As explained in the OP, when flashing this GSI the fisrt time (e.g. over stock EMUI 8.0), it is key to afterwards run a factory reset and afterwards a cache wipe in recovery. ('fastboot -w' may not be enough)
 
  • Like
Reactions: Tecalote
Another problem is that if Magisk is installed , the CPU temperature would be really high (up to 64℃) and remain unchanged. At the same time , the internal Root settings would disappear. I had no choice but give up installing Magisk.
In my tips & tricks section, there is also some information about Magisk. Please read that carefully - however, I don't use Magisk myself, so I can't give you any assurance, whether it works or not.
And yes, it is a "feature" of Magisk to remove/hide any other root solution...

Besides , it seems that the camera problem can be solved by adjusting settings. If "Save photo to SD card" switch is turned on , camera will work normally. But I still can't delete any photo.
Maybe something weird with your SD card? Have you tried deleting files via root shell, just to see, whether that would solve the issue or also throw any error? I has such a problem with a complete different device and SD card some years back, where at the end, I had to format the SD card to get rid of the issue...

That's all the problems I've found until now.

Although there are bugs , this system is good and easy to use . Thanks to the developers , this old device comes to life again.
Thanks again for your feedback.
 
  • Like
Reactions: Tecalote

NPS-2750X

Member
Oct 17, 2021
29
11
In my tips & tricks section, there is also some information about Magisk. Please read that carefully - however, I don't use Magisk myself, so I can't give you any assurance, whether it works or not.
And yes, it is a "feature" of Magisk to remove/hide any other root solution...


Maybe something weird with your SD card? Have you tried deleting files via root shell, just to see, whether that would solve the issue or also throw any error? I has such a problem with a complete different device and SD card some years back, where at the end, I had to format the SD card to get rid of the issue...


Thanks again for your feedback.
Thank you for answering my feedback.

In fact , whether the "Save photo to SD card" switch is turned on or not , photos are always saved to internal storage . And , of course , they can be deleted with Root , but can't be deleted by stock file manager and any kind of Gallery app. Besides , recently I found that screenshots can't be deleted , either .But if I copy the same photo or screenshot to external SD card , it can be deleted successfully .

I attached some videos here to show this problem . (p.s. I'm sorry for being nervous when recording these videos because speaking English is still a bit difficult for me. )
 

Attachments

  • VID_20220809_154317.mp4
    21.2 MB · Views: 0
  • VID_20220809_154402.mp4
    15.4 MB · Views: 0
  • VID_20220809_154429.mp4
    11.1 MB · Views: 0
  • VID_20220809_154523.mp4
    15 MB · Views: 0
Thank you for answering my feedback.

In fact , whether the "Save photo to SD card" switch is turned on or not , photos are always saved to internal storage .
That is true, I confirm this behavior. I am however not sure, what is the reason - in the German or English transaltion, it says "prefer saving to SD" (and not "save on SD" - so maybe there is some whatever kind of check in the stock camera app, which fails). I am afraid, I can't do anything here.

And , of course , they can be deleted with Root , but can't be deleted by stock file manager and any kind of Gallery app. Besides , recently I found that screenshots can't be deleted , either .But if I copy the same photo or screenshot to external SD card , it can be deleted successfully .
As explained before, I don't see this issue with my own phone, and I am sure, that if that was a general issue with the ROM, others would have complained as well. Is it possible for you to produce a log? Connect your phone via USB to your PC, enable debugging in the developer options, and call on your PC in a terminal/command window "adb logcat > mylogfile.txt". Now try to delete the file, and afterwards, stop the adb session with [Ctrl]+C key and provide me with the logfile. (You will find more information in the internet about the 'adb logcat' topic, if needed).

I attached some videos here to show this problem . (p.s. I'm sorry for being nervous when recording these videos because speaking English is still a bit difficult for me. )
No worries, the videos are very well understandable.
 

NPS-2750X

Member
Oct 17, 2021
29
11
That is true, I confirm this behavior. I am however not sure, what is the reason - in the German or English transaltion, it says "prefer saving to SD" (and not "save on SD" - so maybe there is some whatever kind of check in the stock camera app, which fails). I am afraid, I can't do anything here.


As explained before, I don't see this issue with my own phone, and I am sure, that if that was a general issue with the ROM, others would have complained as well. Is it possible for you to produce a log? Connect your phone via USB to your PC, enable debugging in the developer options, and call on your PC in a terminal/command window "adb logcat > mylogfile.txt". Now try to delete the file, and afterwards, stop the adb session with [Ctrl]+C key and provide me with the logfile. (You will find more information in the internet about the 'adb logcat' topic, if needed).


No worries, the videos are very well understandable.
Thank you again for your reply . Here's the logfile I got . I don't know if I did it correctly , but it does contain the "failed to delete" information .
-400325f239424b0b.jpg
 

Attachments

  • logfile.txt
    1.4 MB · Views: 7

P9_User

Senior Member
Oct 27, 2020
54
9
I have just installed this app for test purposes, but as you need an Autodesk account to start using that app, I didn't continue and de-installed it again. At least for the steps to get to the logon screen, there was no error...
Can you produce a log or so? Or, after updating to the next build (will be published soon), try again?
Hi. So I made August update but fusion app still not working. Browser based WebGL demos do run nicely.

Now I wanted to provide you screenshots and logs but somehow I am not abel to create logs via adb. Once a few month ago it already worked, so I am curious again.

This is my result, I still think adb is working but something still not running well : (


Code:
G:\android\fastboot>adb logcat > lc.txt
- waiting for device -

G:\android\fastboot>adb devices
List of devices attached

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached


G:\android\fastboot>adb logcat > lc.txt
- waiting for device -

G:\android\fastboot>adb logcat
- waiting for device -

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached

G:\android\fastboot>fastboot devices
MWS7N(number)           fastboot

G:\android\fastboot>adb logcat
- waiting for device -

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached


G:\android\fastboot>adb logcat > lc.txt
- waiting for device -
^C
G:\android\fastboot>fastboot reboot
rebooting...
 
Hi. So I made August update but fusion app still not working. Browser based WebGL demos do run nicely.

Now I wanted to provide you screenshots and logs but somehow I am not abel to create logs via adb. Once a few month ago it already worked, so I am curious again.

This is my result, I still think adb is working but something still not running well : (


Code:
G:\android\fastboot>adb logcat > lc.txt
- waiting for device -

G:\android\fastboot>adb devices
List of devices attached

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached


G:\android\fastboot>adb logcat > lc.txt
- waiting for device -

G:\android\fastboot>adb logcat
- waiting for device -

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached

G:\android\fastboot>fastboot devices
MWS7N(number)           fastboot

G:\android\fastboot>adb logcat
- waiting for device -

G:\android\fastboot>adb kill-server

G:\android\fastboot>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

G:\android\fastboot>adb devices
List of devices attached


G:\android\fastboot>adb logcat > lc.txt
- waiting for device -
^C
G:\android\fastboot>fastboot reboot
rebooting...
Did you enable debugging in the developer options AND also enable MTP (file transfer) for your USB connection?
 

P9_User

Senior Member
Oct 27, 2020
54
9
Yes, both are set on in developers optios.
Still no device number showing when adb devices

fastboot
do work, if it matters.

Could it be a driver issue? Any suggestion?


Edit: Did found something yesterday night. I can set USB to MTP (filetransfere) only within developers option. If I go to settings/search/usb the select screen is buggy and I can not set anything. Tried with deactivated developers options and still no chance to do changes.

Screenshots made here (sorry, did not switched to EN):

Screenshot_20220812-004445_Einstellungen.png
Screenshot_20220812-004504_Einstellungen.png
 
Last edited:

Eowieh

Member
Feb 14, 2020
6
0
Is the DynamicsProcessing library installed and configured with a commit (more info here)? If not, I kindly ask if you could do it, so that Wavelet can be used.

I enjoy the ROM. Gives new life to an older phone. I especially like that it already has root built in.
 
Thank you again for your reply . Here's the logfile I got . I don't know if I did it correctly , but it does contain the "failed to delete" information .
Thanks for the log. Unfortunately, the log does not tell any reason, so I guess it may come from the linux sub system. So could you please try the following:

Connect your phone via adb and type in a command window 'adb shell'. Let's take your example file IMG_20220807_155809.jpg from the log (feel free to use another file, if you like).
Within the shell, enter first cd /storage/emulated/0/DCIM/Camera/, then ls -la IMG_20220807_155809.jpg and show me the output. Afterwards ls -Z IMG_20220807_155809.jpg, then try to delete the file with
rm IMG_20220807_155809.jpg - does it work or do you get an error message ?
leave the adb shell session with exit
 
Yes, both are set on in developers optios.
Still no device number showing when adb devices

fastboot
do work, if it matters.

Could it be a driver issue? Any suggestion?


Edit: Did found something yesterday night. I can set USB to MTP (filetransfere) only within developers option. If I go to settings/search/usb the select screen is buggy and I can not set anything. Tried with deactivated developers options and still no chance to do changes.

Screenshots made here (sorry, did not switched to EN):
Normally, when you connect the phone via USB, you should have a message appearing, which you can "pull down", where you would jump into the screens, you were showing. And you would have to set "Dateiübertragung" as well to have a working adb.

If fastboot works, I don't think that you have a driver issue on your PC, but I don't want to exclude this, as adb is technically a different protocol compared to fastboot. When you say "driver issue' I would guess you have a Windows PC, so yes: try re-installing the USB drivers as a 1st step...
 
Is the DynamicsProcessing library installed and configured with a commit (more info here)? If not, I kindly ask if you could do it, so that Wavelet can be used.

I enjoy the ROM. Gives new life to an older phone. I especially like that it already has root built in.
I'll have a look next week... (need to see, from where the audio_effects. xml file is taken...)
 
  • Like
Reactions: kundifon and Eowieh

NPS-2750X

Member
Oct 17, 2021
29
11
Thanks for the log. Unfortunately, the log does not tell any reason, so I guess it may come from the linux sub system. So could you please try the following:

Connect your phone via adb and type in a command window 'adb shell'. Let's take your example file IMG_20220807_155809.jpg from the log (feel free to use another file, if you like).
Within the shell, enter first cd /storage/emulated/0/DCIM/Camera/, then ls -la IMG_20220807_155809.jpg and show me the output. Afterwards ls -Z IMG_20220807_155809.jpg, then try to delete the file with
rm IMG_20220807_155809.jpg - does it work or do you get an error message ?
leave the adb shell session with exit
Thank you. I tried this operation and it showed "owner died".
Screenshot_20220813-094020_.png
 

P9_User

Senior Member
Oct 27, 2020
54
9
Normally, when you connect the phone via USB, you should have a message appearing, which you can "pull down", where you would jump into the screens, you were showing. And you would have to set "Dateiübertragung" as well to have a working adb.

If fastboot works, I don't think that you have a driver issue on your PC, but I don't want to exclude this, as adb is technically a different protocol compared to fastboot. When you say "driver issue' I would guess you have a Windows PC, so yes: try re-installing the USB drivers as a 1st step...

Yes, Win10 PC. Now I think I made a big mess and even fastboot is not working anymore. I tried to reinstall any Android related drivers with no success. I had both (fastboot & adb) working already a while ago, kept the drivers and tools and thought I can easily re-install everything.

Is there any simple step-by-step list of which drivers I need to make the P9 work fine with windows? Best how to clean all old drivers and which new ones (also tools) are needed after.

This is where I am lost now...

devices_android.jpg


In bootload mode showing this.
devices_android_bootloader.jpg

devices_android_bootloader_02.jpg
 
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.