• XDA Forums have been migrated to XenForo. To discuss, report bugs and other issues, use this thread.

HUAWEI Y7 PRIME (2018)/NOVA 2 LITE/LDN-LX2/LDN-L21/LDN-TL10 General Discussion

Proseph

New member
Jul 23, 2018
11
3
0
If you decompile ramdisk.img, you will got /split_img/ramdisk.img-cmdline with ending:
... androidboot.selinux=enforcing buildvariant=user you could change it to androidboot.selinux=permissive buildvariant=userdebug
and recompile it.
I tried it and flashed it, but the SELinux status is still enforcing :(
 

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
I tried it and flashed it, but the SELinux status is still enforcing :(
What is manifestation of enforced SELinux? I have not enough knowledge about it.
SELinuxModeChanger said about gone permissive, but went on enforcing on next start.
https://forum.xda-developers.com/apps/magisk/selinux-mode-inverter-t3775271 Magisk module also does not work.

Next module, let me change type from user to userdebug, but can not add ro.build.selinux to prop.default (manually add also not helping).
https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228

UPDATE: If change ro.debuggable=1, ro.secure=0, ro.build.type=userdebug, also can't add/change selinux.
UPDATE2: Kernel recompile is needing! Change CONFIG_SECURITY_SELINUX=y to n.
 
Last edited:

Proseph

New member
Jul 23, 2018
11
3
0
What is manifestation of enforced SELinux? I have not enough knowledge about it.
SELinuxModeChanger said about gone permissive, but went on enforcing on next start.
https://forum.xda-developers.com/apps/magisk/selinux-mode-inverter-t3775271 Magisk module also does not work.

Next module, let me change type from user to userdebug, but can not add ro.build.selinux to prop.default (manually add also not helping).
https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228

UPDATE: If change ro.debuggable=1, ro.secure=0, ro.build.type=userdebug, also can't add/change selinux.
UPDATE2: Kernel recompile is needing! Change CONFIG_SECURITY_SELINUX=y to n.
How to recompile kernel? And where to find CONFIG_SECURITY_SELINUX?
 

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
2 more ports of TWRP, but still not completed. Just proof of concept :)

* TWRP 3.2.1 using TWRP autoporter + TWRP 3.2.3 for Y7 2017 =
got TWRP with working sideload, mounts, adb,terminal, but no otg (32bit vs 64bit conflict), no mtp and no data decrypting
https://www.androidfilehost.com/?fid=11410963190603893360

* TWRP 3.2.1 using TWRP for P10 Lite (with Kirin 6280 cpu) + ported TWRP for Y7
= got TWRP with working OTG and mounts, but no adb, no mtp, no sideload and no data decrypting
https://www.androidfilehost.com/?fid=11410963190603892656

Encrypted files in /data can not be copied = no /data backup.
Still can not combine these two for fully working twrp...Any help?!
 
Last edited:

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
New, better port of TWRP 3.2.1 for Y7 (Prime) 2018 / LDN-L21
https://www.androidfilehost.com/?fid=11410963190603893514

Working:
mounts all partitions, mount usb_otg, adb, sideload, flashing, wiping, terminal, reboot to system/recovery/bootloader/turn off...

Not working:
mtp, decrypting /data files, backup of /data

UPDATE: At least, /data_image (emmc) can be backed up on 32GB+ external sd and/or usb drive and on PC via adb with:
adb exec-out dd if=/dev/block/mmcblk0p55 > data-emmc-backup.img (about 25GB)
 
Last edited:

Proseph

New member
Jul 23, 2018
11
3
0
New, better port of TWRP 3.2.1 for Y7 (Prime) 2018 / LDN-L21
https://www.androidfilehost.com/?fid=11410963190603893514

Working:
mounts all partitions, mount usb_otg, adb, sideload, flashing, wiping, terminal, reboot to system/recovery/bootloader/turn off...

Not working:
mtp, decrypting /data files, backup of /data
Hey, can you kindly upload stock recovery ramdisk? My drive got corrupted and I don't want to download full firmware just to pull it..

---------- Post added at 01:43 PM ---------- Previous post was at 01:37 PM ----------

Planning to build a permissive kernel for Huawei Y7 Prime (LDN-LX2), I just need to setup my Linux machine.

We need permissive kernel in order to successfully boot Android Pie GSIs since only HavocOS and phhuson's Pie GSIs work with enforcing kernel. It is also needed to fix backlight bug when running 8.1 or 9.0 GSIs
 
  • Like
Reactions: adeii

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
Hey, can you kindly upload stock recovery ramdisk? My drive got corrupted and I don't want to download full firmware just to pull it..

---------- Post added at 01:43 PM ---------- Previous post was at 01:37 PM ----------

Planning to build a permissive kernel for Huawei Y7 Prime (LDN-LX2), I just need to setup my Linux machine.

We need permissive kernel in order to successfully boot Android Pie GSIs since only HavocOS and phhuson's Pie GSIs work with enforcing kernel. It is also needed to fix backlight bug when running 8.1 or 9.0 GSIs
Sure! https://www.androidfilehost.com/?fid=11410963190603879155 stock rec_ramdisk
and stock with adb.secure=0 at https://www.androidfilehost.com/?fid=11410963190603853321
Good luck with building!
 
Last edited:

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
New, better port of TWRP 3.2.x for Y7 (Prime) 2018 / LDN-L21
https://www.androidfilehost.com/?fid=11410963190603909865
Ported from TWRP for Honor 7C / LDN-L29

Working:
mounts all partitions, mount usb_otg, adb, mtp, sideload, flashing, wiping, terminal, reboot to system/recovery/bootloader/turn off,
backing up of data_image

Not working:
decrypting /data files, backup of /data, screencapture
 
  • Like
Reactions: EzzUsesAndroid

Nathorakain

New member
Jan 29, 2019
1
0
0
New, better port of TWRP 3.2.x for Y7 (Prime) 2018 / LDN-L21

Ported from TWRP for Honor 7C / LDN-L29

Working:
mounts all partitions, mount usb_otg, adb, mtp, sideload, flashing, wiping, terminal, reboot to system/recovery/bootloader/turn off,
backing up of data_image

Not working:
decrypting /data files, backup of /data, screencapture
Hi, just wondering before i download and try if this is compatible with LDN-LX2 (nova 2 lite dual sim) it will be my first time venturing into this side of things with android devices so not sure if there's any differences or concerns
 

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
Hi, just wondering before i download and try if this is compatible with LDN-LX2 (nova 2 lite dual sim) it will be my first time venturing into this side of things with android devices so not sure if there's any differences or concerns
Theoretically, it is same telephone (msm8937, emui 8.0, treble) just make sure that you have unlocked bootloader (since june 2018. you must pay about 4$ for service) and backed up stock recovery_ramdisk partition (it is /dev/block/mmcblk0p43 on LDN-L21B or /dev/block/bootdevice/by-name/recovery_ramdisk or /dev/block/platform/soc/7824900.sdhci/by-name/recovery_ramdisk) or got it extracted from stock rom's UPDATE.APP.

Also, you need for restore stock ramdisk and recovery_ramdisk for every upgrade.
 
Last edited:

EzzUsesAndroid

New member
Jul 18, 2017
27
14
0
Petaling Jaya
First post of this thread got link to LDN kernel sourcecode. Default config is: arch/arm64/configs/merge_msm8937_64_defconfig.
I guess it is similar to https://github.com/adeii/kernel_huawei_msm8937 and set london_se_defconfig as config.
I followed the manual, but I can not finish compiling.
@adeii,
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 :).
 
Last edited:
  • Like
Reactions: adeii

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
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.
 
  • Like
Reactions: EzzUsesAndroid

EzzUsesAndroid

New member
Jul 18, 2017
27
14
0
Petaling Jaya
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.
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.
 
Last edited:

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
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.
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.

THEORY - Kernel does finish the initialization process, but fails to load the android system.[/HIDE]
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.
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.
 

EzzUsesAndroid

New member
Jul 18, 2017
27
14
0
Petaling Jaya
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.
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


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.
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.
 
Last edited:
  • Like
Reactions: adeii

adeii

New member
Nov 11, 2013
319
82
0
Sajlent Hil
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.
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:
Code:
#!/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
Code:
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?
 

EzzUsesAndroid

New member
Jul 18, 2017
27
14
0
Petaling Jaya
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:
Code:
#!/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
Code:
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?
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
 
Last edited:
  • Like
Reactions: adeii

EzzUsesAndroid

New member
Jul 18, 2017
27
14
0
Petaling Jaya
After a bunch more testing....

If you want the kernel.img, here it is:
Enforcing Kernel
Permissive Kernel
CC: @adeii

Ok, I’ve tested the permissive kernel and it works fine on @phhusson’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:
Code:
fastboot erase system
fastboot flash system (phhtreble GSI)
fastboot reboot
Then, do the initial setup. After finishing, reboot to fastboot and do this:
Code:
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 @phhusson 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
 
  • Like
Reactions: Proseph and adeii
Our Apps
Get our official app! (coming soon)
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone