[Q] How to set-up and troubleshoot init.d scripts? - Android Q&A, Help & Troubleshooting

I have a Nexus 4, running CM10.1 and Faux123's latest kernel. I want to use an init.d script to set the governor, tuneables, and other things instead of an app (all of the apps I've tried have an issue with permissions/settings not sticking, plus I take any opportunity to eliminate 3d party apps when possible).
Running into some issues getting this to work right, hoping someone can help --
My init.d script successfully applies the following on boot: stop mpdecision, choose FIOPS as the I/O scheduler, put the GPU clock max at 400 mHz. However, any commands I have in the script that are related to the CPU governor, parameters, and eco mode/snake charmer do not work.
I thought I had put my script (named "userinit.sh", placed in /data/local) in the wrong place or something, but like I said it successfully stops mpdecision on boot, sets the i/o to FIOPS and makes the read-ahead 2048kb, and sets the GPU max to 400 mHz -- none of the other commands work though. Any ideas?
Running Cyanogenmod 10.1 nightlies with 002b6 faux kernel. I've also set the permissions of the file to 755 (rwxr-xr-x), is that right?
My script looks like this (the ones in green work fine, the rest in red don't work):
#!/system/bin/sh
su
stop mpdecision
echo "intellidemand" > /sys/devices/system/cpu/cpu0/scaling_governor
echo 594000 > /sys/devices/system/cpu/cpu0/scaling_min_freq
echo 1350000 > /sys/devices/system/cpu/cpu0/scaling_max_freq
echo 1 > /sys/devices/system/cpu/cpufreq/intellidemand/eco_mode
echo 1350000 > /sys/devices/system/cpu/cpufreq/intellidemand/lmf_active_max_freq
echo 1026000 > /sys/devices/system/cpu/cpufreq/intellidemand/lmf_inactive_max_freq
echo 1350000 > /sys/kernel/msm_cpufreq_limit/cpufreq_limit
echo "fiops" > /sys/block/mmcblk0/queue/scheduler
echo 2048 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 400000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
I would love any advice on what steps I need to take to get this working correctly, as well as any info about init.d scripts generally, I threw this one together after some Googling but who knows if its even in the right format. Thanks!

Related

[Q] Problem to install interactive governor

Hello,
i use stock rom 2.3.3 and i've tried to install interactive governor. I've extracted cpufreq_interactive.ko to system/lib/modules, edited install-recovery.sh and added in it :
#modules
insmod /system/lib/modules/cpufreq_interactive.ko
#cpufreq governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_maxspeed_load
echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
after reboot, nothing happens, no "interactive" in the menu of setcpu.
Thanks for the solution.
gravia said:
Hello,
i use stock rom 2.3.3 and i've tried to install interactive governor. I've extracted cpufreq_interactive.ko to system/lib/modules, edited install-recovery.sh and added in it :
#modules
insmod /system/lib/modules/cpufreq_interactive.ko
#cpufreq governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_maxspeed_load
echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
after reboot, nothing happens, no "interactive" in the menu of setcpu.
Thanks for the solution.
Click to expand...
Click to collapse
With some custom kernels interactive does not work ex.Zkernel
But i'm under official kernel (stock rom SE)
Sent from my X10i using XDA App
gravia said:
Hello,
i use stock rom 2.3.3 and i've tried to install interactive governor. I've extracted cpufreq_interactive.ko to system/lib/modules, edited install-recovery.sh and added in it :
#modules
insmod /system/lib/modules/cpufreq_interactive.ko
#cpufreq governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_maxspeed_load
echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
after reboot, nothing happens, no "interactive" in the menu of setcpu.
Thanks for the solution.
Click to expand...
Click to collapse
did u follow instrcutions exactly from here? http://forum.xda-developers.com/showthread.php?t=1221425
sofir786 said:
did u follow instrcutions exactly from here? http://forum.xda-developers.com/showthread.php?t=1221425
Click to expand...
Click to collapse
Thanks to help me but i'm newbie in the use of SDK.
For each code of this thread, i must use SDK or another tool ?
sorry, no one for help ?

new to init.d - guide?

Just starting to look into writing my own init.d (for use with perseus kernel for example.)
can any one point me in the right direction for a beginners guide to init.d?
I have searched but it is mainly linux in general that comes up - nothing specific to Android or the GSIII.
thanks
found this, which seems a very good start.
Beginner's Guide to init.d Scripts
init.d scripts has to be copied to /system/etc/init.d. All scripts in init.d are automatically executed after booting. (in Siyah, 30 seconds after booting)
I) How To:
1) In an editor such as notepad++, type #!/system/bin/sh
This should be the first line of all shell scripts. This invokes the compatible shell to execute our scripts.
2) From next line, type in your scripts line by line. After saving, push it to /system/etc/init.d using root explorer.
3) Use Script Manager from market to run the script as root to make sure there are no errors. (if you're confident of your script, then no need of script manager)
note: if you use editors such as wordpad to create a script, the carriage return leaves some 'invisible' illegal characters in the script and hence the script will fail to execute. So use editors such as notepad++, or use script manager itself to make the script.
4) If there are no errors when you run using script manager, then navigate to the script and set the following permissions:
owner: read,write
group: read
others: read
Also check 'set UID' and 'set GID'.
Now you're all good to go. Your script will be executed each time you reboot.
II) References:
We can use init.d scripts to perform a lot of things.
Refer post 2 from Q&A (courtesy kwerdenker)
http://forum.xda-developers.com/show....php?t=1325831
Use this post as a reference on how to tweak or change Cpu Frequencies/Voltages, Gpu Frequencies/Voltages, Bus Speed, I/O Scheduler, Charge Current, etc.
Apart from these, you can also tweak sched_mc values, change backlight response curve, change upper and lower thresholds for second-core-active (for screen-on and screen-off), etc.
III) Examples:
1) sched_mc
Ex:
echo "1" > /sys/devices/system/cpu/sched_mc_power_savings
This cause filling cpu0 (1st core) first for long running threads and processes.
Valid values are 0, 1 and 2
2) Second Core Active Threshold
Ex 1:
echo "70" > /sys/module/pm_hotplug/parameters/loadh
echo "25" > /sys/module/pm_hotplug/parameters/loadl
During screen on, This causes cpu1 to kick-in only after the load on cpu0 reaches 70% and cpu1 to turn off when load is less than or equal to 25%
Ex 2:
echo "90" > /sys/module/pm_hotplug/parameters/loadh_scroff
echo "35" > /sys/module/pm_hotplug/parameters/loadl_scroff
During screen off, This causes cpu1 to kick-in only after the load on cpu0 reaches 90% and cpu1 to turn off when load is less than or equal to 35 %. Useful to control power drain when you're listening to music when screen off, etc.
3) Tweak brightness Response Curve
Ex:
echo "30" > /sys/class/misc/brightness_curve/min_bl
echo "24" > /sys/class/misc/brightness_curve/max_gamma
This means any brightness value below 30 will have 0 gamma and brightness level above 30 will be linearly mapped to [0:24] gamma levels.
30 & 24 are stock values. Beta 16 will have voodoo color support as well. Use Voodo Screen Tuning R&D app from market to experiment and play around with yur SAMOLED screen.
4) Tweak Governors
Ex:
echo "85" > sys/devices/system/cpu/cpufreq/ondemandx/up_threshold
This means when ondemandx is used, the polling function scales cpu up to next frequency when cpu is 85% loaded w.r.t current frequency.
Many thanks to droidphile

[Kernel][CM12.1/AOSP]3.4.112_x_kernel_v1.5 (18/05/2016)

x_kernel
Introduction, Credits & Thanks
Hey guys,
i finished building a basic kernel for the Moto X. As far as i can see this kernel would be ready to release. I cannot encounter any bugs atm and the kernel is running stable and fast. Though, my main focus is not to distinguish myself, rather i am interested i some collaboration.
So this thread is dedicated to @tdhite @skiwong20 @zwliew @Gustavo_s @Megatron007 @##W4TCH0UT## @cyril279 @athulele ,.. which all did some great work in developing some roms and kernels already. I am sure i missed someone, feel included as well and i like to invite you to take the source, build the kernel and bring in your experience in testing, debugging, discussion and further improving. Together with arm-eabi-4.8 the kernel compiles without any errors and warnings.
Summary
But first let me summarize the status of my work and explain what i have done so far:
Based on the motorola source i updated the kernel to Linux Version 3.4.110.
During this process i had to adapt many commits to match the moto source. Also some patches needed to be excluded completely, because some stuff differed to much to merge the updates on top. A detailed description you find in this commit: Squashed update of cm-12.1 kernel to Linux 3.4.110
Second i examined the codeaurora LA.AF.1.1_rb1.18 branch and picked most of for our device left, relevant and working commits as well. Among others these includes patches for kgsl/gpu, camera, audio, net and wlan. Some stuff needed to be adapted too. Tag: LA.AF.1.1_rb1.18-extract
Main Features
- Linux Kernel 3.4.112 updates
- Codeaurora LA.AF.1.1_rb1.18 branch updates
- IoScheduler: Fiops, Sio, Vr, Zen
- Smartmax Governor and the changes by @tdhite
- IntelliActive Governor -> changed frequencies to match msm8960dt
- Intellidemand Governor-> changed frequencies to match msm8960dt
- Interactive Governor -> updates from the razrqcom-dev-team git and much more
- Faux's simple GPU governor
- Faux's IntelliPlug, IntelliThermal, Soundcontrol and USB Fastcharge adaption
- Vibration Strength Control
- Userspace LUT tuning & Colour Calibration, thx to @Gustavo_s
- Zram, Zsmallox, Zcache, Frontswap -> complete Linux Kernel 3.17 backport, a lot of credits goes to the razrqcom-dev-team
- Lz4 compression/decompression
- Kernel Mode Neon + Crypto SHA512 support
- complete lowmemorykiller backport with adaption to vmpressure and many other tweaks
- Rewritten overclocking capabilities up to 1890Mhz, thx to @faux123 fot his initial coding
- Kernel underclocking with a lower frequency of 189 Mhz, thx to @zwliew
- Customizable voltage table / Voltage regulator
- Kernel Samepage Merging tweaks
- disabled sparsemem
- WQ_POWER_EFFICIENT for power oriented workqueues
- LoUIS API for cache maintenance ops
- Scheduler updates
- RCU_FAST_NO_HZ enabled
- massive update regarding kernel's memory managment
- many many more stuff
- init.d script tweaks, see second post
Leftovers
Tweaks discarded for now or to be reviewed and reimplement:
- lib/string & lib/memcopy glibc version -> It is just a placebo maybe
- frandom -> may be incompatible with lollipop and can cause problems
- unaligned access -> can cause problems with a optimized toolchain
- adreno idler -> needs the implementation of powersuspend which we dont have atm
- vnswap, zswap,.. -> does anybody know a proper and up-to-date backport?
- optimizations flags to compile with linaro or uber
- more hotplug driver
Thats all from my side for now.
If there is any stuff which should be reverted, something that may cause problems, feel free to report.
If you have some recommendations, for example what hotplug driver to check and bring in tell me.
Whatever, every feedback is welcome.
Credits and Thanks to:
CyanogenMod, Kernel.org, Code Aurora Forum, Google, razrqcom-dev-team and everyone who is involved in developing for the moto x. Check out the commits author in my git.
Disclaimer: You're installing this at your own risk. Please, make nandroid backups before installing any of these kernels. I take no responsibility for damaging your phone.
XDA:DevDB Information
x_kernel, Kernel for the Moto X
Contributors
tycoo
Source Code: https://github.com/tycoo/moto_x_kernel
Kernel Special Features:
Version Information
Status: Stable
Current Stable Version: v1.5
Stable Release Date: 2016-05-18
Created 2015-12-15
Last Updated 2016-05-18
Reserved
Important notes / Init Script
I added an init.d script named "x_kernel_init" to tweak some settings, which is pushed into the root folder /system/etc/init.d during the installation of the kernel. Sometimes this script is not completely executed after booting the device. To be sure, that the tweaks are applied and if you want to, start the script manually via the app Kernel Adiutor (downloadable via google play or the corresponding thread here at xda).
All kernel supported settings are tweakable within this app as well, so i strongly recommend to check this out.
At the moment zram isn't enabled via the script anymore, so if you need it, you have to enable it on your own.
If you don't want any of the tweaks to be applied, just delete the script and reboot.
x_kernel_init:
Code:
#!/system/bin/sh
echo "Applying 3.4.112_x_kernel init tweaks"
echo "..."
sleep 1
#cpu interactive
if [ -d /sys/devices/system/cpu/cpufreq/interactive ]; then
echo "50" /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo "918000" /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "60000" /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo "80" /sys/devices/system/cpu/cpufreq/interactive/target_load
fi;
#cpu
if [ -d /sys/devices/system/cpu/cpu0/cpufreq/ ]; then
echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1728000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi;
if [ -d /sys/devices/system/cpu/cpu1/cpufreq/ ]; then
echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1728000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
fi;
if [ -d /sys/module/cpu_boost/parameters/ ]; then
echo "918000" /sys/module/cpu_boost/parameters/input_boost_freq
sleep 1
#cpu screen off frequency limit
if [ -d /sys/module/intelli_plug/parameters ]; then
echo "1728000" > /sys/module/intelli_plug/parameters/screen_off_max
fi;
sleep 1
#kernel samepage merging
if [ -d /sys/kernel/mm/ksm ]; then
echo "Disable kernel samepage merging"
echo 0 > /sys/kernel/mm/ksm/deferred_timer
echo 0 > /sys/kernel/mm/ksm/run
fi;
sleep 5
#VM
if [ -d /proc/sys/vm ]; then
echo "Virtual Memory settings:"
echo "Dirty Ratio = 10"
echo "Dirty Background Ratio = 75"
echo "Dirty Expire Centisecs = 380"
echo "Dirty WriteBack Centisecs = 950"
echo "Swappiness = 20"
echo "Vfs Cache Pressure = 90"
echo "10" > /proc/sys/vm/dirty_background_ratio
echo "75" > /proc/sys/vm/dirty_ratio
echo "380" > /proc/sys/vm/dirty_expire_centisecs
echo "950" > /proc/sys/vm/dirty_writeback_centisecs
echo "20" > /proc/sys/vm/swappiness
echo "90" > /proc/sys/vm/vfs_cache_pressure
fi;
sleep 1
#lowmemorykiller
if [ -d /sys/module/lowmemorykiller/parameters ]; then
echo "Enabling adaptive LowMemoryKiller"
echo "530592" > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo "Setting LowMemoryKiller Minfree to Aggressive"
echo "0,20,50,100,250,500" > /sys/module/lowmemorykiller/parameters/adj
echo "2048,4096,8192,16834,24576,32768" > /sys/module/lowmemorykiller/parameters/minfree
fi;
sleep 1
#zram
#SIZE=270
#swapoff /dev/block/zram0
#echo "Setup Zram swap device with a size of 270MB"
#echo 1 > /sys/block/zram0/reset
#echo "Set Zram max compressions streams to 8"
#echo 8 > /sys/block/zram0/max_comp_streams
#sleep 1
#if [ $SIZE -ne 0 ]; then
# echo $(($SIZE*1024*1024)) > /sys/block/zram0/disksize
# mkswap /dev/block/zram0
# swapon /dev/block/zram0
#fi;
#sleep 1
echo "...finished"
sleep 3
exit
Reserved
Changelog:
v1.5 https://github.com/tycoo/moto_x_kernel/commits/x_v1.5
- added some tweaks from teammex's kernel
- added many commits regarding RCU_FAST_NO_HZ, Scheduler and smpboot from zwliew's kernel
thx to @zwliew & @TeamMex
v1.4 https://github.com/tycoo/moto_x_kernel/commits/x_v1.4
- update to Linux Kernel 3.4.112
v1.3 https://github.com/tycoo/moto_x_kernel/commits/x_v1.3
- underclocking & overclocking implemented by default
- finally fixed mpdecision/thermal daemon breaking the user set frequency limits.
Benefits: - phone doesnt boot at overclocking frequency anymore, this was especially an issue on core 2.
- gov smartmax is usable together with mpdecision
- disabled sparsemem
- added faux simple gpu governor
- sweep to sleep properly working
- added WQ_POWER_EFFICIENT for power oriented workqueues
- massive memory management updates
- a lot of cpu, cpufreq and gov interactive related updates
v1.2.1 UC/OC experimental https://github.com/tycoo/moto_x_kernel/commits/x_v1.2.11
- added underclock 189Mhz frequency and overclocking capabilities up to 1890Mhz
- added cpu voltage control
- added a init script to disable ksm, tweak vm & lmk and setup zram
Install and proceed with caution:
- changing the clocks and voltages to higher or lower values can cause instabilities and in the worst case damage your phone
- changing, limiting and setting the cpu frequencies only works with intelli plug hotplug driver selected! Strongly advise to select intelli plug first after boot.
As already mentioned in the Kernel Aduitor options, Mpdecision can cause issues.
- also the max screen off frequency has to be set to avoid higher frequency during screen off
v1.2 https://github.com/tycoo/moto_x_kernel/commits/x_v1.2
- applied latest cyanogenmod cm-12.1 changes from Dec 22: https://github.com/tycoo/moto_x_kernel/commits/cm-12.1
- enabled fast charge
v1.1:
- implement LoUIS API for cache maintenance ops
- rbtree updates
- lowmemorykiller updates with the latest adaption to vmpressure, rbtree, ...
..
Great.
Let´s try it. Our moto x deserve this.
Congratulations about this job.
Good job!
Running very well on my phone with SlimLP.
Was the download link removed?
Sent from my ghost using Tapatalk 2
good working
infectedorganism said:
Was the download link removed?
Click to expand...
Click to collapse
In the tab downloads
UrielGT-X said:
In the tab downloads
Click to expand...
Click to collapse
Thanks. I couldn't see that on Tapatalk.
Sent from my ghost using Tapatalk 2
Thanks for a new Kernel @tycoo
Could F2FS support be also added at some stage ?
orky87 said:
Thanks for a new Kernel @tycoo
Could F2FS support be also added at some stage ?
Click to expand...
Click to collapse
F2FS should be in already. Intervigilium merged the motorola f2fs driver into the cm-12.1 branch before.
Nice job...will test within the next few days with Mokee Rom.
Sent from my Moto X using Tapatalk
tycoo said:
F2FS should be in already. Intervigilium merged the motorola f2fs driver into the cm-12.1 branch before.
Click to expand...
Click to collapse
Applying F2FS causes infinite boot for me not sure whats causing it but could you verify that it works..
orky87 said:
Applying F2FS causes infinite boot for me not sure whats causing it but could you verify that it works..
Click to expand...
Click to collapse
I'm using this kernel with /cache and /data formatted for f2fs.
Flash this kernel first, then flash the file linked below. It should work.
Credits to @chaoslimits for the fix.
https://www.dropbox.com/s/sko06ob7qja8f8p/ghost_F2FS_enable_v1.zip?dl=0
Also, a BIG thanks to @tycoo for the kernel. Everything is running smooth and stable thus far.
Sent from my ghost using Tapatalk 2
Nice fix @chaoslimits & thx @infectedorganism for sharing
Didn't know about that. My kernel uses Anykernel atm, which grabs the ramdisk of the previous rom or kernel installation during the flashing procedure.
So the good thing is, once you flashed the provided fix and it doesn't matter when, if you are staying with a kernel with Anykernel afterwards you never have to install the fix again.
Small update to x_kernel_v1.1
- implement LoUIS API for cache maintenance ops
- rbtree updates
- lowmemorykiller updates with the latest adaption to vmpressure, rbtree, ...
https://github.com/tycoo/moto_x_kernel/commits/v1.1
Lets see how this goes
Error while flashing... No MD5 and it's 138mb? So confused can someone mirror this?
Sent from my Moto X using Tapatalk
tycoo said:
Small update to x_kernel_v1.1
- implement LoUIS API for cache maintenance ops
- rbtree updates
- lowmemorykiller updates with the latest adaption to vmpressure, rbtree, ...
https://github.com/tycoo/moto_x_kernel/commits/v1.1
Lets see how this goes
Click to expand...
Click to collapse
add new features included underclockin and fast charger?
tchula said:
add new features included underclockin and fast charger?
Click to expand...
Click to collapse
no underclocking yet, fastcharge is in but is not activated in defconfig
Still don't get this...
Sent from my XT1055 using Tapatalk

[Ramdisk Kernel Mod] LateAutumn zImage + Zetsubou init tweak for Lineage OS 14.1

This is just a proof of concept for "if we like a Kernel but don't like the default setting and too lazy to use kernel adiutor to apply the desirable setting" ​
Basically I just changed the Late Autumn installer zip using the goodies from Zetsubou. So this is a Late Autumn kernel with my modifications to ramdisk.
Here's the difference:
1. Enable doubletap2wake by default
2. Set CPU maximum frequency to 1401600
3. Set CPU minimum frequency to 200000
4. Set GPU maximum frequency to 550000
5. Set GPU minimum frequency to 100000
6. Enable MSM CPU hotplug by default
7. Disable GPU Adreno idle by default
Warning:
Only tested on lineage-14.1-20170126-nightly-wt88047 !!
Make sure to install this kernel on top of that rom stock kernel...
And make sure to clear the kernel adiutor setting too... You can set the others later, I did a dirty trick to let the CPU minimum frequency goes to 200 with interactive governor. I don't know if others got this weird problem, in my device set min freq to 200 didn't work with interactive governor.
How to install:
- Make sure you have lineage-14.1-20170126-nightly-wt88047 rom with the stock kernel
- Flash from TWRP like usual
Download:
https://drive.google.com/file/d/0B3ue12JCB2NgbVo3ODkxeVN1Ylk/view?usp=drivesdk
Credits:
@nicknitewolf for the awesome lineage official build
@iamsubhranil for the amazing stable kernel
@Ashish94 for the various genius tweaks
My modifications details:
1. In anykernel.sh file
Code:
# begin ramdisk changes
# add zetsubou initialization script
insert_line init.rc "import /init.zetsubou.rc" after "import /init.environ.rc" "import /init.zetsubou.rc";
# adb secure
backup_file default.prop;
replace_string default.prop "ro.adb.secure=0" "ro.adb.secure=1" "ro.adb.secure=0";
replace_string default.prop "ro.secure=0" "ro.secure=1" "ro.secure=0";
# change CPU
backup_file init.qcom.power.rc;
replace_string init.qcom.power.rc "scaling_min_freq 200000" "scaling_min_freq 800000" "scaling_min_freq 200000";
replace_string init.qcom.power.rc "1 200000:85" "1 800000:85" "1 200000:85";
# end ramdisk changes
2. Add file init.zetsubou.rc :
Code:
on boot
#S2W
write /sys/android_touch/sweep2wake 0
#DT2W
write /sys/android_touch/doubletap2wake 1
#S2S
write /sys/android_touch/sweep2sleep 0
on property:sys.boot_completed=1
#a53 max
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1401600
#GPU
write /sys/class/kgsl/kgsl-3d0/devfreq/min_freq 100000000
write /sys/class/kgsl/kgsl-3d0/max_gpuclk 550000000
write /sys/module/adreno_idler/parameters/adreno_idler_active N
# Enable MSM Hotplug
write /sys/module/msm_hotplug/msm_enabled 1
Will try it over RR and let u know if it is working or not.
Thanx
Wow, another indonesian devs. try it asap :highfive:

Speed Mod for the Lgv20 Stock Oreo & image retention fix + Boeffla Wakelock blocker (root only)

STANDARD DISCLAIMER: I am not responsible for any damages caused to your phone. Use the mod at your own risk there is no warranty or guarantee.
I made this mod to speed up the phone. Thermal throttling is enabled. This mod runs post boot before Stock Oreo get's loaded. No need for Kernel Adiutor, The speed mod will make all the tweaks for the Lgv20 to run at it's maximum performance & prolong the battery life.
Note: Flashing this mod when running the Lemon_Drop rom, will remove Zram. To fix just flash the latest version of Auto_Debloat again. I made this page before the Speed Mod was included in Auto_Debloat.
Updated on 12-27-22
You can just flash on top of older versions to update
This twrp mod only touches two files:
"/system/vendor/bin/init.qcom.post_boot.sh" permissions are 0 2000 0755
"/system/media/display/calib.cfg" permissions are 0 0 0644
You can back them up before install, or just flash the latest uninstaller.
Requirements:
TWRP
Lgv20 msm8996 aka Qualcomm Snapdragon 820
Stock Oreo 8.0
ezV2020 Kernel Stock Oreo 8.0 Kernel, This is what makes this Speed Mod possible
Uninstall Kernel Adiutor
How to install?
Download the version you want to use. If your not sure what version you want, v4.2 is good. It is the speed mod and will fix the image retention issue on the Lgv20 phone, on start up.
You may also want Boeffla_Wakelock_blocker_readme.zip with v5.4, instructions on how to use the Boeffla Wakelock blocker.
Flash in twrp wipe dalvik cache and reboot.
All the versions have the latest speed mod. Flash on top of older versions to update.
v3.28 Speed mod only
v4.28 speed mod + image retention fix lgv20
v5.28 speed mod + image retention fix lgv20 + Boeffla Wakelock blocker
Update notes
New v3.28
change GPU governor to msm-adreno-tz with default 133mhz
New 3.27
Removed the GPU tweaks and adjusted the idle timer that should speed up the GPU also with out the battery drain I was experiencing.
New v3.26
Adjusted the GPU tweaks so they do not use too much power but still provide a performance boost.
New v3.25
Added some GPU tweaks
New v3.24
Fixed a type in last speed mod.
New v3.23
Changed the rq_affinity to number 2. That should speed up the eMMC drive and sdcard.
New v3.22
All new interactive governor settings.
New v3.21
Tweaked the interactive governor settings.
New v3.20
Changed governor to interactive, increased speed & increased battery life.
New v3.19
Fixed some things with the TCP Speed mod
New v3.18
Added a TCP speed mod to speed up internet.
New v3.17
Changed the TCP Algorithm to cubic. May speed up internet and make it more stable. I have an issue with Wifi Calling where the voice will cut in and out sometimes. This may fix that issue.
New v3.16
Changed GPU Governor to Simple_Ondmand reduced the power level to save battery power.
New v3.15
Trying to save a little bit of battery life without sacrificing speed.
New v3.14
Added disk scheduler to noop for micro sdcard.
New v3.13
fixed image retention issue on v4.13 and v5.13 it's the best I can fix.
New v3.12
Change disk scheduler to noop. Some other tweaks to improve speed and battery life.
New v3.11
This should speed up the phone a little bit more. Should also save battery life. I tweaked the sched_upmigrate and sched_downmigrate. The up is set to 95% and down is set to 90%. So if a task is using more that 95% of cpu it will go the big cpu and vice versa.
New v3.10
Tweaked the Entropy tweak a little bit.
New v3.9
Added an entropy tweak. This should improve the speed of the phone and prevent lag.
New v3.8
Changed the disk speed tweaks. Much faster now.
New v3.7
Some tweaks, some fixes. haha lazy to note it should be faster that other versions.
New v3.6
Some more kernel tweaks, and an internet kernel speed tweak. I think it's faster.
New v3.5 Speed Mod
It's faster, changed the cpu sample rate to 19000 that seems to be in the butter zone. What's odd is, my music sounds amazing with this version. I think I am keeping this one.
New v3.4 Speed Mod
Changed disk scheduler from noop to deadline, deadline prioritises reads over writes so it should improve performance a little bit.
As for the Auto Brightness fix, I made it more sensitive. If you are in the house and set a brightness to say 30, then go out side in direct sun light it will change to 100, but if you go back into the house it should change back to 30 or what ever setting you have chosen.
You need the latest version of the Uninstaller to uninstall this version.
New v3.3 Speed Mod
Changed ondemand governor back to 95% on cpu usage before it kicks up to full speed, might save a little battery power.
v4.3 & v5.3 found stock calib.cfg that file will fix the Auto Brightness issue on the Lgv20 running stock Oreo, aka Assertive Display.
What is a Sunlight or Assertive Display? - Gary explains
You need the latest uninstaller to uninstall this version. Flash on top of older versions to update. enjoy
New v3.2 Speed Mod
Tweaked disk cache settings, it's faster than v3.1. I updated v4.2 and v5.2 changed the KCAL settings, drastically improved contrast and colors & no image retention. Flash on top of older versions to update.
Red = 250
Green = 250
Blue = 235
Minimum = 35
Saturation = 27
Hue = 1520
Value = 112
Contract = 132
New v3.1 speed mod
Changed the ondemand governor sample rate 20000. Took me awhile to find the perfect sample rate, but I found it. Also Increased the read ahead on microsd card to 512k. This is the most well optimized version I have ever made. Good battery life and increased speed.
New v2.6 speed mod
Changed the Sample rate of the Ondemand Governor. Should extend battery life.
New v2.5 version of speed mod
Changed the read ahead to 256k for all drives. Tweaked the speed of the eMMC drive a little. It should be faster than v2.4.
New v2.4 version of speed mod.
I was able to increase the speed of the eMMC drive so apps load quicker. Also increased battery life. Sometimes I update this speed mod like once a month, so you may want to check back to see if there is an update.
Credits, A Special Thank You
@ezzony - for the ezV2020 kernel. XDA
@askermk2000 - for the MK2000 kernel. XDA
@helf for the KCAL settings in v4.2 & v5.2 XDA
@rawe_etc for the TCP Speed mod XDA
at MiguelNdeCarvalho for the Stock calib.cfg aka auto brightness fix github
at Gary Sims over at androidauthority.com on what Assertive Display is.
at amitwh for the interactive governor settings for the msm8996 Github
And everyone else that I may have missed that helped with the Lgv20.
Thank you all, for helping make the Lgv20 phone one of the best rooted phones of all time.
What does The Speed Mod look like?
#Speed Mod 3.28
# configure governor settings for little cluster
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
echo 729600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
echo 79000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
# online CPU2
echo 1 > /sys/devices/system/cpu/cpu2/online
# configure governor settings for big cluster
echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_sched_load
echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_migration_notif
echo "19000 1400000:39000 1700000:19000 2100000:79000" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay
echo 90 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/go_hispeed_load
echo 20000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/timer_rate
echo 1248000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/hispeed_freq
echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/io_is_busy
echo "85 1500000:90 1800000:70 2100000:95" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads
echo 19000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/min_sample_time
echo 79000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis
echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif
# GPU change governor to msm-adreno-tz with default 133mhz
echo msm-adreno-tz > /sys/class/kgsl/kgsl-3d0/devfreq/governor
echo 6 > /sys/class/kgsl/kgsl-3d0/default_pwrlevel
# re-enable thermal and BCL hotplug
echo 1 > /sys/module/msm_thermal/core_control/enabled
echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode
echo $bcl_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_mask
echo $bcl_soc_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask
echo -n enable > /sys/devices/soc/soc:qcom,bcl/mode
# recover offlined_mask in thermal.
echo 0 > /sys/module/msm_thermal/core_control/force_unmask
# Set the eMMC drive scheduler to noop
echo noop | tee /sys/block/sd*/queue/scheduler >/dev/null
echo 0 | tee /sys/block/sd*/queue/add_random >/dev/null
echo 256 | tee /sys/block/sd*/queue/read_ahead_kb >/dev/null
echo 0 | tee /sys/block/sd*/queue/rotational >/dev/null
echo 64 | tee /sys/block/sd*/queue/nr_requests >/dev/null
echo 1 | tee /sys/block/sd*/queue/iostats >/dev/null
echo 2 | tee /sys/block/sd*/queue/rq_affinity >/dev/null
# Set sdcard scheduler to noop
echo noop > /sys/block/mmcblk0/queue/scheduler
echo 0 > /sys/block/mmcblk0/queue/add_random
echo 256 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 0 > /sys/block/mmcblk0/queue/rotational
echo 64 > /sys/block/mmcblk0/queue/nr_requests
echo 1 > /sys/block/mmcblk0/queue/iostats
echo 2 > /sys/block/mmcblk0/queue/rq_affinity
# Enable LPM D3
echo N > /sys/module/lpm_levels/parameters/sleep_disabled
# Disable Adaptive LMK
echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
#echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
# Disable sync wakee policy tunable
echo 0 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
# Kernel based tweaks
echo 0 > /proc/sys/kernel/compat-log
echo 0 > /proc/sys/kernel/panic
echo 0 > /proc/sys/kernel/panic_on_oops
echo 0 > /proc/sys/kernel/perf_cpu_time_max_percent
echo 10 > /proc/sys/fs/lease-break-time
echo 3 > /proc/sys/kernel/sched_spill_nr_run
echo 15 > /proc/sys/kernel/sched_init_task_load
echo 1 > /proc/sys/net/ipv4/tcp_ecn
echo 3 > /proc/sys/net/ipv4/tcp_fastopen
echo 95 > /proc/sys/kernel/sched_upmigrate
echo 0 > /proc/sys/kernel/sched_upmigrate_min_nice
echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill
echo 90 > /proc/sys/kernel/sched_downmigrate
echo 5 > /proc/sys/kernel/sched_small_wakee_task_load
echo 30 > /proc/sys/kernel/sched_big_waker_task_load
echo 1 > /proc/sys/kernel/sched_enable_thread_grouping
# Limit kernel printk console log
echo "0 0 0 0" > /proc/sys/kernel/printk
# Disable exception-trace logs
echo 0 > /proc/sys/debug/exception-trace
# Entropy speed tweaks
echo 64 > /proc/sys/kernel/random/read_wakeup_threshold
echo 3072 > /proc/sys/kernel/random/write_wakeup_threshold
echo 60 > /proc/sys/kernel/random/urandom_min_reseed_secs
# Enable Dynamic Fsync for increased performance
echo 1 > /sys/kernel/dyn_fsync/Dyn_fsync_active
# TCP speed tweaks
echo "2097152" > /proc/sys/fs/file-max
echo "cubic" > /proc/sys/net/ipv4/tcp_congestion_control
echo "60000" > /proc/sys/net/ipv4/tcp_max_orphans
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "1" > /proc/sys/net/ipv4/tcp_timestamps
echo "1" > /proc/sys/net/ipv4/tcp_sack
echo "10240" > /proc/sys/net/ipv4/tcp_max_syn_backlog
echo "1" > /proc/sys/net/ipv4/tcp_mtu_probing
echo "2" > /proc/sys/net/ipv4/tcp_synack_retries
echo "1024 65535" > /proc/sys/net/ipv4/ip_local_port_range
echo "1" > /proc/sys/net/ipv4/tcp_rfc1337
echo "15" > /proc/sys/net/ipv4/tcp_fin_timeout
echo "1024" > /proc/sys/net/core/somaxconn
echo "65536" > /proc/sys/net/core/netdev_max_backlog
echo "6291456" > /proc/sys/net/core/optmem_max
echo "65536 131072 262144" > /proc/sys/net/ipv4/tcp_mem
echo "65536 131072 262144" > /proc/sys/net/ipv4/udp_mem
echo "6291456" > /proc/sys/net/core/rmem_default
echo "6291456" > /proc/sys/net/core/rmem_max
echo "16384" > /proc/sys/net/ipv4/udp_rmem_min
echo "1572864" > /proc/sys/net/core/wmem_default
echo "1572864" > /proc/sys/net/core/wmem_max
echo "16384" > /proc/sys/net/ipv4/udp_wmem_min
echo "1440000" > /proc/sys/net/ipv4/tcp_max_tw_buckets
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
#End of speed mod 3.28
Got 1.4 done. My phone runs so much faster now, it's like having a brand new phone. Version 1.4 should be the final version. Recommended: Everyone that downloaded the previous versions install the new v1.4
Hey everyone, I had fun making theses. Enjoy
v1.5 Speed mod only
v1.6 speed mod + image retention fix lgv20
v1.7 speed mod + image retention fix lgv20 + Google quick search wakelock block.
v1.8 speed mod + image retention fix lgv20 + Ultimate Battery savings mode
Just flashed 1.7.1. Will report back once I get to use it for a bit. Thanks!
Finally there is a solution of image retention for non-root v20, I only unlock BL and have TWRP, flashed it then reboot and never see the image retention again.
Very appreciate for your development!!!
H990DS 8.0 V20B+ezV2020+This Mod v4.2
stvc said:
Finally there is a solution of image retention for non-root v20, I only unlock BL and have TWRP, flashed it then reboot and never see the image retention again.
Very appreciate for your development!!!
H990DS 8.0 V20B+ezV2020+This Mod v4.2
Click to expand...
Click to collapse
Your welcome, glad you like it.
Hey everyone I just got done with speed mod 2.1 Tweaked Ondemand governor for faster performance.
Updated all the speed mods v2.5
New v2.6 speed mod
Changed the Sample rate of the Ondemand Governor. Should extend battery life.
to upgrade, just flash over older versions, wipe dalvik cache & reboot.
New v3.2 Speed Mod
Tweaked disk cache settings, it's faster than v3.1. I updated v4.2 and v5.2 changed the KCAL settings, drastically improved contrast and colors & no image retention. Flash on top of older versions to update.
Red = 250
Green = 250
Blue = 235
Minimum = 35
Saturation = 27
Hue = 1520
Value = 112
Contract = 132
New v3.3 Speed Mod
Changed ondemand governor back to 95% on cpu usage before it kicks up to full speed, might save a little battery power.
v4.3 & v5.3 found stock calib.cfg that file will fix the Auto Brightness issue on the Lgv20 running stock Oreo, aka Assertive Display.
What is a Sunlight or Assertive Display? - Gary explains
You need the latest uninstaller to uninstall this version. Flash on top of older versions to update. enjoy
I am still working on the Auto Brightness fix, I think it needs to be more sensitive. So there will be updates. Just letting everyone know I am working on this.
New v3.4 Speed Mod
Changed disk scheduler from noop to deadline, deadline prioritises reads over writes so it should improve performance a little bit.
As for the Auto Brightness fix, I made it a lot more sensitive. If you are in the house and set a brightness to say 30, then go out side in direct sun light it will change to 100, but if you go back into the house it should change back to 30 or what ever setting you have chosen.
You need the latest version of the Uninstaller to uninstall this version.
Thanks for the mods. I've got a newly rooted VS995 and just loaded v3.4 but noticed my Antutu CPU score dropped by a decent amount. I'm charging up the phone to re-run the benchmark to see if it was a fluke. Did you happen to benchmark before/after numbers?
nickb2b said:
Thanks for the mods. I've got a newly rooted VS995 and just loaded v3.4 but noticed my Antutu CPU score dropped by a decent amount. I'm charging up the phone to re-run the benchmark to see if it was a fluke. Did you happen to benchmark before/after numbers?
Click to expand...
Click to collapse
Your welcome, I had fun making them.
No I didn't run any benchmarks, It just seems like it's faster to me.
nickb2b said:
Thanks for the mods. I've got a newly rooted VS995 and just loaded v3.4 but noticed my Antutu CPU score dropped by a decent amount. I'm charging up the phone to re-run the benchmark to see if it was a fluke. Did you happen to benchmark before/after numbers?
Click to expand...
Click to collapse
You got me thanking now lol. I will run that test on my phone and see if I can duplicate your issue. The speed mod is still a work in progress. I can try a different cpu governor also and see if that helps. Rite now I am using Ondemand. Thank you for bringing this to my attention. I will look into this.
nickb2b said:
Thanks for the mods. I've got a newly rooted VS995 and just loaded v3.4 but noticed my Antutu CPU score dropped by a decent amount. I'm charging up the phone to re-run the benchmark to see if it was a fluke. Did you happen to benchmark before/after numbers?
Click to expand...
Click to collapse
The thing with benchmark programs that there is just so many variables to take into consideration.
But this is what I found out with GeekBench 5
With Speed Mod v5.5
I made some changes have not uploaded it yet.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This is stock with a lower battery count also.
As you can see they are almost the same. But the Lgv20 phone is not a fast phone to start with. But I think the speed mods do help even if it's just a little bit.
New v3.5 Speed Mod
It's faster, changed the cpu sample rate to 19000 that seems to be in the butter zone.
Thanks, I'll dl geekbench and give it a shot.

Categories

Resources