[ROM][Android 8/9/10][Unofficial] LineageOS for Mi-4c/Mi-4s

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
What version system does the landlord use to compile? I am using Ubuntu 16.04 LTS. Did the landlord encounter such a problem during compilation ?
I'm using Ubuntu 19.10, and build the rom in "user" variant.
If you're building "userdebug", there should not be errors that caused by "-Werror" flag (it means to regard all warnings as errors). As for a solution, whenever you met such problems, just add cflags "-Wno-[warning type]" (eg. "-Wno-incompatible-pointer-types") to Android.mk besides the source files.

Example #0
before:
LOCAL_CFLAGS += -O3 -g0 -Wall -Werror
after:
LOCAL_CFLAGS += -O3 -g0 -Wall
or:
LOCAL_CFLAGS += -O3 -g0 -Wall -Wno-[warning type]
 
Last edited:
  • Like
Reactions: Spartach

hkdg009

Member
Oct 16, 2018
11
1
0
I'm using Ubuntu 19.10, and build the rom in "user" variant.
If you're building "userdebug", there should not be errors that caused by "-Werror" flag (it means to regard all warnings as errors). As for a solution, whenever you met such problems, just add cflags "-Wno-[warning type]" (eg. "-Wno-incompatible-pointer-types") to Android.mk besides the source files.

Example #0
before:
LOCAL_CFLAGS += -O3 -g0 -Wall -Werror
after:
LOCAL_CFLAGS += -O3 -g0 -Wall
or:
LOCAL_CFLAGS += -O3 -g0 -Wall -Wno-[warning type]
Userdebug was built by default before,and I tried to build with the user variable to see if the same problem persisted. if the problem persists, I then try to modify the source file to build.
 

tengteng906

Member
Apr 26, 2018
5
0
0
I have two 4C. After installing LineageOS, the mac address is the same 00-A0-C6-EB-5C-6F. Now I cannot connect to wifi at the same time. Is there any solution?
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
I have two 4C. After installing LineageOS, the mac address is the same 00-A0-C6-EB-5C-6F. Now I cannot connect to wifi at the same time. Is there any solution?
Just found the MAC on my device is the same as yours, seems the real address is not loaded at all. It should be fixed in the next version.

Update #1
Extract file "readmac" from the attachment, then put it into "/system/vendor/bin". Set file group to 2000 (chgrp 2000 ./readmac), permission to 755 (chmod 755 ./readmac), restore sepolicy (restorecon ./readmac), then reboot the device.
This issue was fixed in this way on my device.
 

Attachments

Last edited:
  • Like
Reactions: corwinux

tengteng906

Member
Apr 26, 2018
5
0
0
Just found the MAC on my device is the same as yours, seems the real address is not loaded at all. It should be fixed in the next version.

Update #1
Extract file "readmac" from the attachment, then put it into "/system/vendor/bin". Set file group to 2000 (chgrp 2000 ./readmac), permission to 755 (chmod 755 ./readmac), restore sepolicy (restorecon ./readmac), then reboot the device.
This issue was fixed in this way on my device.
not solved:哭泣:
Still repeating mac, my steps are in the picture below.The 17.1 version of Mac is normal, but there are some sound issues, so I installed 16
 

Attachments

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
not solved:哭泣:
Still repeating mac, my steps are in the picture below.The 17.1 version of Mac is normal, but there are some sound issues, so I installed 16
The file name of "readmac" should not be "readmac.bin" but "readmac", that's why it didn't work. It was fixed in the new verison of 17.1 today.
For the sound issue, only some specific music files would play out of volume control, and I haven't found out the real reason yet. If there is no such issue in other Android 10 roms like Havoc, or not in my lineage-16.0 roms, it may help me to locate the problem.
 

Smile31768

Member
Feb 17, 2016
8
1
0
Hey, WJXXBSH
Although the Lineage17 now is almostly no bug, I found a deficiency in it. When I'm using my libra in the dark. I felt it's sooo bright! Even I pull the backlight to the darkest. But I can use Lanthanum system toolbox (I download it from coolapk site) to set the backlight level to 1. It seems much darker than I set it in the system. That means the lowest backlight level isn't the real lowest in this devices. So I hope you can fix it in the next version. Thank you!

---------- Post added at 12:30 PM ---------- Previous post was at 12:24 PM ----------

Hey, WJXXBSH
Although the Lineage17 now is almostly no bug, I found a deficiency in it. When I'm using my libra in the dark. I felt it's sooo bright! Even I pull the backlight to the darkest. But I can use Lanthanum system toolbox (I download it from coolapk site) to set the backlight level to 1. It seems much darker than I set it in the system. That means the lowest backlight level isn't the real lowest in this devices. So I hope you can fix it in the next version. Thank you!
Oh I forget one thing. The toolbox seems cannot be used in Android Q. I test it in Lineage16. Now I haven't installed it.
 

hkdg009

Member
Oct 16, 2018
11
1
0
sepolicy error

I have many sepolicy errors when compiling. I tried to modify the related .te file, and there are still some that cannot be resolved. How do I solve the following?
Log:
 

Attachments

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
I have many sepolicy errors when compiling. I tried to modify the related .te file, and there are still some that cannot be resolved. How do I solve the following?
Log:
Go to check my changes to prebuilt sepolicy:
https://github.com/WJXXBSH/useful_android_scripts/blob/master/repo/repo_17.diff#L1503

Obviously, the sepolicy in the device tree is conflict with the "never allow" rules, so I always remove those checks to make it work on user build variant (on userdebug, less change should work).
Also, if you modify "*.te" in "sepolicy/prebuilts/api/*/public", you should also apply the same changes to "sepolicy/public" (private policy should be the same).
If you just want to keep selinux permissive, the only change to prebuilt sepolicy is "Android.mk":

Code:
diff --git a/Android.mk b/Android.mk
index dadd7b0a..1c922225 100644
--- a/Android.mk
+++ b/Android.mk [user=8295344]@@[/user] -81,10 +81,12 [user=8295344]@@[/user] ifndef BOARD_SEPOLICY_VERS
 BOARD_SEPOLICY_VERS := $(PLATFORM_SEPOLICY_VERSION)
 endif

-NEVERALLOW_ARG :=
+# Hacks to keep SELinux permissive in user builds
+SELINUX_IGNORE_NEVERALLOWS := true
+
 ifeq ($(SELINUX_IGNORE_NEVERALLOWS),true)
 ifeq ($(TARGET_BUILD_VARIANT),user)
-$(error SELINUX_IGNORE_NEVERALLOWS := true cannot be used in user builds)
+$(warning SELINUX_IGNORE_NEVERALLOWS := true cannot be used in user builds)
 endif
 $(warning Be careful when using the SELINUX_IGNORE_NEVERALLOWS flag. \
           It does not work in user builds and using it will \ [user=8295344]@@[/user] -980,10 +982,9 [user=8295344]@@[/user] $(built_sepolicy_neverallows)
 	$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze [email protected] permissive > [email protected]
 	$(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s [email protected] ]; then \
 		echo "==========" 1>&2; \
-		echo "ERROR: permissive domains not allowed in user builds" 1>&2; \
+		echo "WARNING: permissive domains not allowed in user builds" 1>&2; \
 		echo "List of invalid domains:" 1>&2; \
 		cat [email protected] 1>&2; \
-		exit 1; \
 		fi
 	$(hide) mv [email protected] [email protected]
 [user=8295344]@@[/user] -1034,10 +1035,9 [user=8295344]@@[/user] $(LOCAL_BUILT_MODULE): $(sepolicy.recovery.conf) $(HOST_OUT_EXECUTABLES)/checkpo
 	$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze [email protected] permissive > [email protected]
 	$(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s [email protected] ]; then \
 		echo "==========" 1>&2; \
-		echo "ERROR: permissive domains not allowed in user builds" 1>&2; \
+		echo "WARNING: permissive domains not allowed in user builds" 1>&2; \
 		echo "List of invalid domains:" 1>&2; \
 		cat [email protected] 1>&2; \
-		exit 1; \
 		fi
 	$(hide) mv [email protected] [email protected]
 
Last edited:

tormie

Member
Apr 9, 2011
46
4
8
I installed Fgapps and Magisk. Nevermind, I just only wanted to revive an old phone that I keep as a backup. I installed another Android 10 rom that warked flawlessly. Thank you.
 

Smile31768

Member
Feb 17, 2016
8
1
0
Hey,
Maybe I had found a problem in the kernel. The big core hardly ever work even though I just open an app. Then I feel the phone is very slow at that time. Is the scheduler's problem?
Here is screen record:
HTML:
https://hytk-my.sharepoint.com/:v:/g/personal/smile31768_od5_me/ETSiIS-RP5JJgrg6xPO1xs8Bq_Atd6GJ_8x9vRsxW6ISrg?e=sCuWml
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
Hey,
Maybe I had found a problem in the kernel. The big core hardly ever work even though I just open an app. Then I feel the phone is very slow at that time. Is the scheduler's problem?
Here is screen record:
HTML:
https://hytk-my.sharepoint.com/:v:/g/personal/smile31768_od5_me/ETSiIS-RP5JJgrg6xPO1xs8Bq_Atd6GJ_8x9vRsxW6ISrg?e=sCuWml
The EAS scheduler (sched/schedutil) prefer to use an energy efficient way to schedule tasks from different CPU cores. The little cores of msm8992 take less energy than the big cores (even in heavy loads), that's why the scheduler usually use 4x little cores rather than 2x big cores. Therefore, I think there is no problem in the CPU scheduler.
Bilibili App works well on my device (except hardware video decoding in some versions), I never found such slow situations like yours. However, I saw the ram usage was always 100% at that time, is that true? If it's really 100%, the performance bottleneck should be "heavy RAM usage" rather than the CPU, no matter if ZRAM is enabled (zram may make things worse in that situation).
The "boot.img" (compressed 2 times, sorry for the inconvenience caused by the file size limit) in attachment is the kernel I used on my device (you may have a try), as I didn't found such problems for now. If you changed some parameters of the kernel or something else (magisk modules?), please also tell me.
 

Attachments

Last edited:

Smile31768

Member
Feb 17, 2016
8
1
0
The EAS scheduler (sched/schedutil) prefer to use an energy efficient way to schedule tasks from different CPU cores. The little cores of msm8992 take less energy than the big cores (even in heavy loads), that's why the scheduler usually use 4x little cores rather than 2x big cores. Therefore, I think there is no problem in the CPU scheduler.
Bilibili App works well on my device (except hardware video decoding in some versions), I never found such slow situations like yours. However, I saw the ram usage was always 100% at that time, is that true? If it's really 100%, the performance bottleneck should be "heavy RAM usage" rather than the CPU, no matter if ZRAM is enabled (zram may make things worse in that situation).
The "boot.img" (compressed 2 times, sorry for the inconvenience caused by the file size limit) in attachment is the kernel I used on my device (you may have a try), as I didn't found such problems for now. If you changed some parameters of the kernel or something else (magisk modules?), please also tell me.
OK, I'll have a try. And, here is my daily RAM usage. Seems it didn't have something unusual, I have turned on the LMK already, but I haven't make other change in kernel parameters, even magisk modules

And, in my magisk, I installed Busybox, Dolby atmos, nano GApps, a Bootanimation, QuickSwitch, GMS Doze, Mi Push and a Chinese font (because I delete the Noto CJK font). Should I change the gapps version to pico?
 
Last edited:

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
OK, I'll have a try. And, here is my daily RAM usage. Seems it didn't have something unusual, I have turned on the LMK already, but I haven't make other change in kernel parameters, even magisk modules

And, in my magisk, I installed Busybox, Dolby atmos, nano GApps, a Bootanimation, QuickSwitch, GMS Doze, Mi Push and a Chinese font (because I delete the Noto CJK font). Should I change the gapps version to pico?
You may have a try, as GApps usually use a lot of ram (that's why I don't install it on my device). If the magisk modules never cause other problems, just keep them as you will. By the way, my device is a 3GB version, so I may not know the ram usage on 2GB verison exactly.
 

Smile31768

Member
Feb 17, 2016
8
1
0
You may have a try, as GApps usually use a lot of ram (that's why I don't install it on my device). If the magisk modules never cause other problems, just keep them as you will. By the way, my device is a 3GB version, so I may not know the ram usage on 2GB verison exactly.
Yes. I just switch the version to pico, and set the swappiness to 100. Now I can open 5 apps at the same time, or I can have 200MB usable RAM. Even I still feel slow. It's much better! Thank you!
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
Yes. I just switch the version to pico, and set the swappiness to 100. Now I can open 5 apps at the same time, or I can have 200MB usable RAM. Even I still feel slow. It's much better! Thank you!
You're welcome.
I recommend to keep less apps in background on a 2GB device, as ZRAM is only an assistance measure. Also be careful to set swappiness to 100, as ZRAM will take lots of CPU time to move pages in and out. Today's app takes more ram than it was in 2015 (the release time of Mi-4c), that's why some new devices has up to 16GB ram (the more ram most devices have, the more ram most app developers will take, which isn't friendly enough for legacy devices).
 

Smile31768

Member
Feb 17, 2016
8
1
0
You're welcome.
I recommend to keep less apps in background on a 2GB device, as ZRAM is only an assistance measure. Also be careful to set swappiness to 100, as ZRAM will take lots of CPU time to move pages in and out. Today's app takes more ram than it was in 2015 (the release time of Mi-4c), that's why some new devices has up to 16GB ram (the more ram most devices have, the more ram most app developers will take, which isn't friendly enough for legacy devices).
Yes, of course. But even though I set swappiness to 100. It still only left around 500mb when I just start my phone. And it seems 100 swappiness doesn't use so much CPU in my phone. So maybe you can improve the swappiness for the 2GB devices in the next version
 
Our Apps
Get our official app!
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