yashsingh1/xdaforums huggingface dataset:
[General Topics] ProgrammingPleb:
[MENTION=5540721]adeii[/MENTION],

Hey, just bought the LDN-LX2 (Huawei Nova 2 Lite) a few months ago and saw that you guys were compiling the kernel for compatibility with Pie GSIs. I thought I could help so this is the result, https://github.com/EzzPrograms/huawei_kernel_msm8937 (This one is based on the latest open source files on Huawei's website). I fixed the include file errors so it should compile fine. Now, the only thing I'm still stuck at is that the GSI (even Oreo) does not boot. If anyone knows how to debug this so I could see the source of the problem, let me know.

Image.gz-dtb is here if you guys are curious: https://drive.google.com/file/d/1wHyQjzhrbDpvrBvynt4UzXRtbS2ANMjx/view?usp=drivesdk

Oops, accidentally removed that one and I don't have a copy:eek:. Sorry!

If I helped you guys, let me know. Maybe we could figure out what to do :).
[General Topics] adeii:
Thats a nice news, Ezz, about kernel compiling. Thank you a lot! Does it boot with stock oreo 8.x. rom?!

You have to add more files to make full kernel.img.

fastboot boot image.gz-dtb works and boot to system.

Try to flash this full kernel with

fastboot flash kernel kernel-LDN-LX2.img and boot to stock rom.

This is theoretical, not yet tested by me:

I guess that GSI needs empty and decrypted /data and no dm-verity check.

There is no fstab in /kernel nor /ramdisk partition, but in /vendor/etc.

There are fstab.qcom and recovery.fstab and I guess you need to delete all ",verify" attributes and replace all "fileencryption=aes-256-xts:aes-256-cts" attributes with nothing / or "encryptable" / or "encryptable=footer" attribute.

You can do it on rooted (stock) system or in TWRP by flashing this. And then wipe/format userdata with fastboot or in TWRP and then flash gsi.img.
[General Topics] ProgrammingPleb:
Hey, thanks for the response! Will try the kernel image as soon as I get access to a computer here.

Also, can you link/share a tutorial on creating the kernel image? Pretty much sure it's not the zImage replacement method since you gave a kernel image instead of a ramdisk one. (Sorry, just moved from the Oppo F1 which did not have this new treble partition format :confused: so yeah)

I'm gonna try the fstab trick first to see if encryption is not enabled by default. Will get back to you on either Monday or Tuesday (12am UTC). Hoping this works. :)

Updates:

[SOLVED] fstab Update:

The phone now does not decrypt the /data partition. We can now say that this part of the problem is solved.

[ONGOING] Kernel Update:

THEORY - Kernel does finish the initialization process, but fails to load the android system.

Update Details:

[fstab]:

17/2/2019: No encryption on /data is confirmed. Considering this as SOLVED.

17/2/2019: Lost access to my phone since the OS doesn't know it's encrypted. RIP my phone data.

[Kernel]:

17/2/2019: Hmm, it boots straight to eRecovery. Something must not be right in the Image.gz-dtb. Searching for the possible answer as to why. For now, I'm going to use the stock kernel since this phone is a daily driver for me.
[General Topics] adeii:
I use Win32 version of Android Image Kitchen by osm0sis, for repacking images.

Since Oreo,

boot.img

is splited to

kernel.img

and

ramdisk.img

.

Also

recovery.img

is splited to (the same)

kernel.img

and

recovery_ramdisk.img

.

Also

system.img

is splited to common, google/android part

system.img

and vendor (this time huawei) part

vendor.img

.

Pre-Oreo boot.img could be unpacked to 2 folders (ramdisk and split_img) using command unpackimg.bat boot.img

If you unpackimg.bat kernel.img , you will got empty ramdisk folder and split_img folder following files:

kernel.img-ramdiskcomp (replace text "empty" to "gzip" or you can not repack), kernel.img-ramdiskoff, kernel.img-tagsoff, kernel.img-kerneloff, kernel.img-pagesize, kernel.img-base, kernel.img-board, kernel.img-cmdline, kernel.img-zImage (that is kernel.dtb file that you had successfuly compiled!!) and kernel.img-ramdisk.cpio (filesize 0, since no files in ramdisk folder).

So I replace stock kernel.dtb with yours and rename it as kernel.img-zImage and execute repack.bat to got full kernel.img (I guess cmdline for LX2 is as same as for L21).

If you unpackimg.bat ramdisk.img or unpackimg.bat recovery_ramdisk.img on the other hand, you will got ramdisk folder with many, many files and split_img with the same files but kernel.img-zImage will got filesize 0.

How do you change vendor/etc/fstab.qcom? Do you tried stock or custom rom? Stock rom should work if you set flag "encryptable" for /data partition. Some sources said that we need to restore folder /data/hw_init (from stock rom) after wipe/format data. Or, you need to reboot to TWRP after formating /data in TWRP and then flash GSI and reboot.
[General Topics] ProgrammingPleb:
Oh, I was looking at the wrong partition:eek:. Ok, I'm gonna test some variants of the zImage which I'm gonna list down below. Currently finding a way to get kernel logs since /proc/last_kmsg or /sys/fs/pstore/console-ramoops does not exist on the device after a kernel panic (I guess). Disabling CONFIG_SECURITY_SELINUX makes android non-bootable since selinux is required on Android 4.4 and above. This commit shows that CONFIG_SECURITY_SELINUX_DEVELOP actually enables the "setenforce" command to be used.

I'm currently building the kernel to see if this works. Will update post when it's done.

UPDATE: It works! The "setenforce" command actually works and changes the selinux state. Now, the only problem is that every time the device restarts, the selinux state changes back to enforcing. Searching the repo to see as to why this happens.

Kernel.img is here: https://drive.google.com/file/d/1AH21vYn9B0rlAaoWZoE1-B3O-wormycs/view?usp=drivesdk .

Config Tests:

[Original config]: SUCCESS

[Config with selinux disabled]: KERNEL PANIC

1. I copied both files to my computer, edited them, then copied them back to the phone.

2. Haven't tested on stock rom, but proven to work on the RR 8.1 GSI.

3. I did put the encryptable flag on /data.

4. Hmm, I did format data after modifying the fstab and I recall that it works.
[General Topics] adeii:
Excellent news. Well if "setenforce 0" set selinux to permissive, you can:

1 - edit file in kernel.img and ramdisk.img - *.img-cmdline, replace part "androidboot.selinux=enforcing" with "androidboot.selinux=permissive", should works, not work on stock kernel.

or

2 - make file /sbin/permissive.sh with text:

#!/sbin/sh
# We use this shell script because the script will follow symlinks and
# different trees will use different binaries to supply the setenforce
# tool. Before M we use toolbox, M and beyond will use toybox. The init
# binary and init.rc will not follow symlinks.
setenforce 0

and add line to init.rc or /system/init.d/00somename

service set_permissive /sbin/permissive.sh
oneshot
seclabel u:r:recovery:s0

or

3 - add some Magisk module about toggling SELinux permission.

So, RR 8.1 works OK with custom kernel and formated /data?
[General Topics] ProgrammingPleb:
After having some few tests, I can confirm that after changing androidboot.selinux to permissive, the kernel starts in permissive mode, but changed back into Enforcing due to RR/any other rom changing that back.

This can be proven by actually running “getenforce” in TWRP terminal. It will give back a response saying that it’s running in permissive mode.

I will check if Android Pie roms do work with this kernel. Will update as soon as I get back to my computer.

If you want the kernel.img, here it is:

Enforcing Kernel

Permissive Kernel
[General Topics] ProgrammingPleb:
After a bunch more testing....

CC: [MENTION=5540721]adeii[/MENTION]

Ok, I’ve tested the permissive kernel and it works fine on [MENTION=1915408]phhusson[/MENTION]’s Android Pie GSI. What I’m weirded out is that it doesn’t want to boot any other GSI out there.:eek:

Resurrection Remix needs to be flashed over phhtreble to actually boot, but the kernel init stage takes TOO MUCH TIME.

If you want to try, this is the method:

fastboot erase system
fastboot flash system (phhtreble GSI)
fastboot reboot

Then, do the initial setup. After finishing, reboot to fastboot and do this:

fastboot -u flash (RROS 7 GSI)
fastboot reboot

The -u is needed to flash over phhtreble system files, more accurately merge them both.

Be careful: This results in ADB and SD Card not working, and the kernel init slowness. (This is not all the bugs I found since I quickly reverted back into phhtreble)

Luckily, I might have a solution to the problem. The main problem would be that the vendor HALs (the piece of android code used to communicate with /vendor code) that are present in any other GSIs support Huawei’s EMUI 9 vendor HAL but not EMUI 8 vendor HAL. One proof that this might be true would be this repo by [MENTION=1915408]phhusson[/MENTION] himself which contains a folder called “Huawei-8.1” which the latest commit (as of writing) labelling it as EMUI 8.1 HALs. What’s convenient about this repo is that it has an automatic GSI builder with device patches which enable booting on other devices (in this case, the LDN device line). I’ll fire up my android build server and see if this method works.

If you want a build of these GSIs below, let me know. I’ll build one for you.

- AOSP 9

- RROS 7

- Pixel Experience Pie

- AOSP Extended

- Havoc OS

I’ll build with this configuration: arm64-aonly-vanilla-nosu . This means no GAPPs installed and no superuser. If you want a custom config, also let me know.

This list is not complete though, so if you have another GSI in mind, give me the GitHub link to the source code and I’ll see if I can modify the auto-builder code.

I’ll do some further testing, will be back with you guys in about 3-4 days of tireless backups and tests. Feel free to send me PMs if you want, I’m in the forum in like 7am - 9am, 12pm - 2pm, and 10pm - 11pm (all times are in UTC btw). See ya!

Screenshots of phone running Android P:

https://imgur.com/a/JH9VFQt

https://streamable.com/vavpm
[General Topics] phoenix4447:
y 7 pro 2018

how can i root it !
[General Topics] adeii:
Very nice, Ezz! Thanks for tests and for TUTORIAL about PIE roms. I"ll try these in the future, when stock rom become slow and useless.

What is feel like in Pie roms? Better battery life, more fluid work? No problem with camera or wifi?

I still trying to mount decrypted data in twrp as priority.

UPDATE: After flashing RR over GSI, you can make system image and compare new system.img and rr.img to see what is missing ;) And you can make flashable zip to patch RR to be bootable...or something in /data cause bootloop, since to have to configure GSI and then flash RR.

If you fastboot flash system GSI.img and fastboot -u flash system RR.img, does phone boot to system?

---------- Post added at 05:28 PM ---------- Previous post was at 05:18 PM ----------

I used Ministry of Solution site to got bootloader unlock code (please, back up ALL data from phone!). After unlocking, install Magisk Manager (7.0 is latest version) and flash patched ramdisk.img in fastboot mode.

Kingroot, kingoroot, supersu methods do not work on our phones. *Maybe SuperSU works, but you need custom recovery (TWRP for now) to flashing and formated /data also.

MoS do it for 4$, you need to install FlexyHub, TeamViewer and Huawei HiSuit before unlocking. There are few more sites like FunkyHuawei or program DC-Unlocker, but I guess, demand more money.
[General Topics] adeii:
If someone want to make screenshots in TWRP, you can do it via PC and ADB. Just execute screenshot.bat

It pulls framebufer and converts it to png.

p.s. Pressing Power + VolumeDown should works, but since /sdcard/Pictures are encrypted, no saves.

twrp-screenshot
[General Topics] joelh:
Does anyone have a TWRP backup of the stock EMUI 8 ROM for this device?
[General Topics] adeii:
What partitions do you need? Data still can not be backed up.... but /data/hm_init (and some more dir) should be needed for complited boot, but as flashable not backup.

I can upload /system, /ramdisk, patched /ramdisk, /recovery_ramdisk, /recovery_vendor, /kernel,...maybe /vendor. ver.8.0.0.139.
[General Topics] joelh:
That would be wonderful if you can back up those partitions. I'm interested in using blobs from system and vendor for another Huawei device, so what you're able to back up should be all I need. Thank you!
[General Topics] adeii:
You are welcome, coldhan(d)s. We just need another tread for that.

https://xdaforums.com/android/general/huawei-y7-prime-2018-ldn-l21-stock-rom-t3909178

Please flash twrp...all.img first, then backup/restore all partitions (or needed ones).

With command ss.sh on ADB shell, you can make screenshots to root of external sd.
[General Topics] Proseph:
Can you build this GSI please? Descendant
[General Topics] adeii:
But, what is wrong with already built image at bit.ly/2EVhQjo ?!

UPDATE1 - Maybe, PIE GSI needs 3 POST-sGSI files to be flash to boots normally according to https://androidfilehost.com/?w=files&flid=280192

UPDATE2 - This toolkit can unpack/repack PIE GSIs https://xdaforums.com/android/software/tool-turkdevs-image-kitchen-t3816395 so combining phh GSI + Descendant at once could works...

This is merged aosp 9.0 phh + descendant 2.0 gsi, for 2,1Gb partition @ mega.nz. Not tested.

Try flashing data/hw_init dir @ mega.nz thru TWRP and/or tweak /vendor/etc/fstub.com
[General Topics] adeii:
Update: simple flashing kernel (adb flash kernel *.img) does bootloop to stock rom (very long init time) and forced restart.

Even repacked stock kernel.img, even with no "verify" and wiped cache can not help to finish boot.

Maybe wipe data or changing encryption flag works, but not tested yet. * Maybe to extract and append *.dtb to zImage ?!

Update2: this could be answer for enforcing selinux https://github.com/Ante0/BKL_OREO_EMUI8/commit/e9f91888c4f449be56d07947cd6287c146e2252e or problem could be \init https://github.com/jcadduono/android_external_dirtycow/issues/2#issuecomment-266217155

Update3: It works! Using this method 1 modify-oreo-kernels, unpack your permissive kernel and see that os patch is 2019-01, change it in command line to 2018-11 (for installed 8.0.0.139) and it finally boots.

p.s. I changed /vendor/etc/fstab.qcom by deleting all ",verify" flags.

fstab

Permissive kernel for EMUI 8.0.0.139
[General Topics] Sadokazou:
Hi , does this phone gonna get android update or not?
[General Topics] adeii:
If you mean EMUI 8.1/9.0, I dont know. Huawei should release 8.1 in autumn 2018. but still no upgrade.

Latest stock rom is 8.0.0.142 with february 2019. security patches and Huawei would (I guess) releases updates every mount just because google's security patches.

If you mean on custom roms, there are few GSI roms (8.1 and 9.0) that already working on this phone like LineageOS 15.x/16, RR 7.... Search for phh, treble, gsi, a-only 64bit roms...etc.
[General Topics] Sadokazou:
thank you mate , last question please .. is lineage roms full stable ? do you recommend it
[General Topics] adeii:
Honestly, I don_t know/haven_t tested it yet. Ask [MENTION=8420194]EzzUsesAndroid[/MENTION] for suggestions.
[General Topics] ProgrammingPleb:
Sorry for replying late! Had some few examinations to go through before continuing some android development. I'll answer some questions since my last visit here.

I'll see what I can do about that. Meanwhile, feel free to use [MENTION=5540721]adeii[/MENTION] 's solution here.

That might be a good solution to the boot-up failure we've been getting on Pie GSIs.

Also, I need your favor, since you're still on stock rom (and most probably rooted), could you upload framework-res.apk from /system/framework? The max brightness on my GSI is literally the minimum brightness on the stock EMUI rom. I need the file to create and overlay file(which has info about the true minimum and maximum brightness for the device). If you wanna know more about what I mean, here it is.

Hmm, I would recommend phh-treble by [MENTION=1915408]phhusson[/MENTION] if you're upgrading to a Pie GSI. And this is the ONLY GSI that would work on the device as of today's testing.

For Oreo GSIs, you're better off with any GSI you'd like since I tried 5 and they all would boot.

Just make sure you've done:

- Filesystem modifications (would ease some installs on TWRP/remove forced encryption)

- The permissive kernel I made. (Since GSIs need a permissive SELinux to boot)

- a full wipe (system, userdata, cache)
[General Topics] adeii:
This flashable will remove forced encryption, but you have to reboot to recovery and format /data...once for all.

I guess we do not need /data/hw_init folder, since mine system works without it. But I flashed update_data_full_public.zip and update_full_LDN-L21B_hw_eu.zip, ignore error 7 etc, works fine.

I am curious, what will happen if you switch Oreo 8.1/Pie 9.0 to Oreo Go/Pie Go edition? All you need to do is to add "ro.config.low_ram=true" in /system/build.prop.

Also, no need to flash GSI via fastboot and PC, use TWRP - Install > Flash image > select GSI and flash to /System.
[General Topics] Proseph:
Give me a few hours, I can upload it once I get home, I also have that bug in any GSI that I install. Also, there is a bug where the battery only shows 1000mAh via Kernel Adiutor, is it just a visual bug or is the GSI only using 1000mAh?

---------- Post added at 01:51 PM ---------- Previous post was at 12:56 PM ----------

Here it is, framework-res.apk
[General Topics] ProgrammingPleb:
Sorry for replying late again! I forgot to install the XDA Labs app again so I didn't even get a notification of you guys replying.

Also, I was curing my anime addiction.Yes, I'm a weaboo.Don't judge me thank you:D

Hmm, odd. The TWRP build I have gives a blank screen on "Flash Image".

Can you give me a link to a working build? Also, the screenshots are saved to the external SD card on my phone's build of TWRP.

I think it's the overlay file's fault since the default that came with the GSI is a generic one. That's why I needed a stock ROM's framework-res.apk since the guide to make the overlay file clearly says that this thing contains auto-brightness/brightness, battery usage data etc.

If this is from the stock ROM, thanks! I'll start working on the overlay file and keep you guys updated on this.
[General Topics] adeii:
This should be the last version of TWRP with all partitions, rename extension to .img for TWRP to see it.

https://mega.nz/#!tlZRVAqa!BKcl6RAdUgJfll4ouSpLB6r6hp6PwjfUtMgJk3-VfJs

I am sure that it has following lines in etc/recovery.fstab:

/recovery_ramdisk emmc /dev/block/bootdevice/by-name/recovery_ramdisk flags=display="Recovery_RamDisk";backup=1;flashimg

/system_image	emmc	/dev/block/mmcblk0p54	flags=display="System Image";backup=1;flashimg

/vendor_image	emmc	/dev/block/mmcblk0p51 flags=display="Vendor Image";backup=1;flashimg

if still not work, it should change /dev/block/bootdevice/by-name/<name> with /dev/block/mmcblk0p<no>.
[General Topics] ProgrammingPleb:
Odd, the file you gave me was a stock recovery, not TWRP (or the file you gave me was in an unsupported format). I'm guessing the file you were supposed to give me was named "recovery_ramdisk.emmc.win"? I'm not even sure that would work though.

If the folder you gave was a backup of your phone, try doing this instead:

1. Get a terminal or do adb shell on your computer.

2. Get root access ("su")

3. Do this

dd if=/dev/block/mmcblk0p43 of=/sdcard/twrp.img

This should extract the current TWRP image in your phone to your internal storage. Then, upload the twrp.img located in your internal storage. That should do the trick.

[MENTION=9322052]Proseph[/MENTION] , I got the battery shows 3000 mAh which is the right battery data. Now, I got to find out about the brightness problem though. This thing is just straight up hell to do. Anyways, you can use this now to fix the wrong battery measurement.
[General Topics] Proseph:
Thanks, I think the brightness problem can be solved using this solution. Although I haven't tried it yet since I'm still on stock ROM.
[General Topics] adeii:
Sorry, wrong link. twrp-ldn-64bit-all.img

This one got working MTP, but something else is not working (adb I guess).

*.emmc.win is ext4 image, same format as *.img.
[General Topics] adeii:
New TWRP v.3.3.0-0 for London. Mirror on AFH.

Works: Backup, restore, install zip/img, MTP, OTG, ADB, Sideload, format, wipe, etc.

Not work: FBE (suggestion: remove dm-verity and forced encryption).

Tipatched TWRP to include Internal SD in backup/restore/wipe/format: @ AFH

All drivers could be found in HiSuite 9.1.0.300_ove (latest).
[General Topics] ProgrammingPleb:
[MENTION=5540721]adeii[/MENTION] , can you make a new backup for "firmware-modem"? Made a restore using the files from one of your threads and now EMUI doesn't even want to recognize the sim card slots due to "Failed to enable SIM Card slot". Also, rip my OEMinfo partition.

UPDATE 1: RIP GSIs don't even recognize the SIM card slot :crying:

Just fyi, the firmware-modem failed the flashing due to it failing to extract the backup which was firmware.vfat.win.

UPDATE 2: I think it was something else, does anyone have a clue on what's happening? Looks like I have to stick with Wi-fi and no mobile data :crying:
[General Topics] adeii:
Not a problem. New back up with FW-ddumper and TWRP 3.3.0.0.

fwdd-backup

twrp-backup

Maybe some partitions have bad definition:

/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware-modem"
/modem emmc /dev/block/mmcblk0p37 flags=display="Modem";backup=1;flashimg
/oeminfo emmc /dev/block/mmcblk0p30 flags=display="OEMinfo";backup=1;flashimg
/modemst1 emmc /dev/block/mmcblk0p32 flags=display="Modemst1";backup=1;flashimg
/modemst2 emmc /dev/block/mmcblk0p33 flags=display="Modemst2";backup=1;flashimg

Online system list does not have /firmware, but it has /modem, /modemst1, /modemst2 as defined as above. Firmware line is sufficient!

So, ignore to restore /firmware but restore /modem. Since it is in emmc format, it should be full "image" to flash, not just files.

About SIM card: I use EU region, firmware C432, dual SIM.
[General Topics] ProgrammingPleb:
Well, just got this message after sending my device to the service center. Looks like I’m gonna wait for the device for about two days. Good thing it’s still under warranty (even though I unlocked the bootloader).
[General Topics] adeii:
Sorry to hear it. Did you try to restore it with eRecovery or HiSuite by yourself ?!
[General Topics] ProgrammingPleb:
eRecovery died. Couldn't get to recovery and bootloader was FRP locked so no way of getting to device.

Good thing this device was under warranty. In return they changed the whole motherboard of the device. Meaning that IMEI and SN was changed.

Looks like I'm going to wait for a week before paying MOS to unlock my bootloader again.
[General Topics] adeii:
[MENTION=8420194]EzzUsesAndroid[/MENTION]

Does you wide-focus rear camera (2 MPx) work on Permissive-kernel in stock Camera app ?!

I have lost that option, all I got is Beautify on both front and rear camera.

UPDATE: Restored backup from april, everything works fine.

Diffs in defconfig between L21 and LX2 are:

CONFIG_HZ=300 vs 100

CONFIG_HUAWEI_PROC_SMAPS_SIMPLE=y . . . . vs . . . . . n\a

CONFIG_FRAME_POINTER=y . . . . vs . . . . . n\a

CONFIG_WBT=y . . . . vs . . . . . n\a
[General Topics] gearrys:
Think this is true

https://www.******************/huawei-nova-lite-2-receiving-emui-9-1-update/

---------- Post added at 09:02 PM ---------- Previous post was at 09:02 PM ----------

Android 9 update for y7 prime 2018. I found it on Huawei central
[General Topics] adeii:
No new updates after 8.0.0.144, HiCare said. Some regions got 8.0.0.150.

Nova 3, Y5/6/9 2019 models will get EMUI 9.1 according to

9to5google(dot)com/2019/06/26/huawei-emui-9-1-more-devices/
[General Topics] Arsam javed:
Can anyone please provide ma stock recovery of huawei y7 prime LDN-L21 C185 CUSTC185D1

I am in a great problem as i format data by twrp and it had deletes some files of OS now huawei is giving update but due to unavailability of stock recovery i am unable to install it. Kindly provide ma stock recovery of Huaeei LDN-L21C185 CUSTC185D1