This module adds to the kernel the possibility of using the 'conservative' scaling governor. It may be a little less responsive than other governors, but may also result in better battery life overall.
This is from the kernel documentation:
"The CPUfreq governor "conservative", much like the "ondemand" governor, sets the CPU depending on the current usage. It differs in behaviour in that it gracefully increases and decreases the CPU speed rather than jumping to max speed the moment there is any load on the CPU. This behaviour more suitable in a battery powered environment."
By default it will try to increase or decrease the CPU in 5% steps, and will tend to raise relatively slowly under load but decrease very quickly when idle. This means the CPU is likely to spend much more time at the lowest frequency (245MHz unless changed), but will offer the highest frequency when required for a longer period (like watching video).
The module in the attached files is compiled for the 2.6.32.15-g6a358a9 HTC kernel (released with 2.10.405.2) and the -gf9c0527 kernel (2.09.405.8).
To load, copy the module in recovery to /system/lib/modules and run:
insmod /system/lib/modules/cpufreq_conservative.ko
And to select run:
echo "conservative" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
The attached update files will either load the module only, or load and select the module (active version).
Source is unmodified from the original, and thus is GPL compliant.
Hmm, great . On leedroid , waiting for yur flashable file
Sent from LeeDroid powered by HTC Sense using XDA App!
Thanks for sharing, it's great
Thanks..will try it
with kind regards...Alex
Tested and it runs fine for me. Sure enough you can see the CPU go up and down gradually as expected if you monitor it.
I've added a version for the -gf9c0527 kernel too. 'Active' versions will select this governor if flashed - custom ROMs may override this, so check your ROM.
I have added it for version g1fc4045, .ko only
cpufreq_conservative_gd96f2c0
added for version gd96f2c0, .ko only
How about g1fc4045?
SkilletDesire said:
How about g1fc4045?
Click to expand...
Click to collapse
Here it is.
How can i make this module to work with screenstate_scaling module?
screenstate_scaling script:
Code:
#!/system/bin/sh
#
# screenstate_scaling - switch CPU frequency governor on screen state change
# by [email protected] (FloHimself) - and modded NeoPhyTe
IWCONFIG=/system/xbin/iwconfig
AWAKE_GOVERNOR="ondemand"
SLEEP_GOVERNOR="ondemand"
(while [ 1 ]
do
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ $AWAKE = "awake" ]; then
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "998400" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "245000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "2" > /proc/sys/vm/dirty_background_ratio
echo "5" > /proc/sys/vm/dirty_ratio
echo "3" > /proc/sys/vm/laptop_mode
echo "10000000" > /proc/sys/kernel/sched_latency_ns
echo "4000000" > /proc/sys/kernel/sched_min_granularity_ns
echo "760000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "5150" > /proc/sys/kernel/threads-max
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo "400000" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias
echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load
echo "4000" > /proc/sys/vm/dirty_expire_centisecs
echo "9000" > /proc/sys/vm/dirty_writeback_centisecs
$IWCONFIG eth0 txpower 100mW
log -p i -t screenstate_scaling "*** awake ***: switching CPU frequency governor to -> $AWAKE_GOVERNOR"
AWAKE=
fi
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "245000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "245000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "2" > /proc/sys/vm/dirty_background_ratio
echo "5" > /proc/sys/vm/dirty_ratio
echo "5" > /proc/sys/vm/laptop_mode
echo "6000000" > /proc/sys/kernel/sched_latency_ns
echo "4000000" > /proc/sys/kernel/sched_min_granularity_ns
echo "4000000" > /proc/sys/kernel/sched_wakeup_granularity_ns
echo "4096" > /proc/sys/kernel/threads-max
echo "35" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo "350" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias
echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load
echo "40000" > /proc/sys/vm/dirty_expire_centisecs
echo "60000" > /proc/sys/vm/dirty_writeback_centisecs
$IWCONFIG eth0 txpower 10mW
log -p i -t screenstate_scaling "*** sleeping ***: switching CPU frequency governor to -> $SLEEP_GOVERNOR"
SLEEPING=
fi
done &)
i want to make that when the phone is awake 'conservative' scaling governor will run.
Thanks.
You'd have to change AWAKE_GOVERNOR="ondemand" to "conservative". But that is a heavily hacked script and may not work ideally.
how can i test if the module is working?
Hi
I upgraded my phone to the latest OTA (FPS fix) with a vanilla ROM.
The kernel version my phone is running is: 2.6.32.15-ge2fb08e [email protected] #11
Currently from what SetCPU tells me, my only supported governors are:
ondemand, userspace and performance.
Any way for me to add conservative to my kernel for use with SetCPU?
Thanks
Sheldon
Anyone can make the mod for the 2.6.32.15-g5d39305 kernel? (AuraxTSense_7.8.1)
Thanks!
PLEASE!
or at least anyone can explain to me how do i make it myself? Thanks.
please help me make this file.
2.6.32.15-gf5a401c kernel from 2.29.405.2 update
is there conservative goverenor for 2.6.32.15-gf5a401c kernel from 2.29.405.2 official HTC Desire update ?
Tnx.
i'm running dj droid rom 2.29 based, and it has conservative.
Related
Hey guys,
I switched from my HD2 to a Sensation, now running Energy ROM with latest bricked beta kernel and I am very pleased with it.
I want to controll the cpu by writting my own init.d script, like I did eith my hd2, but as the sensation has 2 cores I'm not quite sure what to do.
What I got so far is this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
now I have 2 quesions:
1.) Do I need to do the same for cpu1? like this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 192000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
2.) I found this in bricked kernel thread:
Overclocking the second CPU is currently not supported by many apps. (They can't overclock what they can't see, aSMP)
To enforce this with Bricked:
Code:
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1782000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
CPU1 will shutdown after it is sure that it is not needed anymore. But you can also do:
Code:
echo 0 > /sys/devices/system/cpu/cpu1/online
Right after the both commands above. Then CPU1 will fall asleep.
Click to expand...
Click to collapse
what exactly does cpu1/online =1 do? can't I just set clocks and governor for cpu1 like in my code aboth or shold my script look like this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 192000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu1/online
thanks for your help in advance!
Alganon said:
Hey guys,
I switched from my HD2 to a Sensation, now running Energy ROM with latest bricked beta kernel and I am very pleased with it.
I want to controll the cpu by writting my own init.d script, like I did eith my hd2, but as the sensation has 2 cores I'm not quite sure what to do.
What I got so far is this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
now I have 2 quesions:
1.) Do I need to do the same for cpu1? like this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 192000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
2.) I found this in bricked kernel thread:
what exactly does cpu1/online =1 do? can't I just set clocks and governor for cpu1 like in my code aboth or shold my script look like this:
Code:
echo 192000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 192000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 1188000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu1/online
thanks for your help in advance!
Click to expand...
Click to collapse
There has been much discussion about the aSMP architecture and the fact that CPU1 will try to be off line (0) if possible and wake up when needed (1). I know someone played with:
echo 1 > /sys/devices/system/cpu/cpu1/online
followed by a (or similar chmod):
chmod 400 /sys/devices/system/cpu/cpu1/online
The latter was to try to stop the system switching it off again. TBH I don't know where that technique ended up.
Most folks just use O/C Daemon, FauxClock, SetCPU.... or even the one built into CM7.
You'd be better off asking in the Bricked or Energy forums, I'm sure folks there have tried and/or implmented something similar.
thx for the answer,
I've already postetd a link to this thread in bricked thread, but I didn't want to spam this thread with discussing something that's not kernel or rom related.
i'm fine with cpu1 being oflline when not needed. In fact I like the idea of conserving energy that way.
the quesions is, what happens when cpu1 kicks in? what scalings an governor does it use? the way I see it, the apps you mentioned, can only handle cpu0. and if cpu1 automagically uses the same settings as cpu0 I'm fine with that. But I wanted to make sure of it, so I thought the easiest way of knowing how this stuff is handled, is by writing the app/script that handles cpu myself...
Have a look at FauxClock, the sources are on Github. I use it with the Faux Kernel but I'm not certain how portable it is :-(( I'm sure I had it running when I tried the Bricked kernel, not 100% confident though.
One comment I noticed on his page was:
"- cpu1 does not want to stick. The app is doing it's job and writing the correct values, but for some reason it seems to get bumped back up to the highest frequency after a few seconds. I think this is more on the kernel side. More investigating needs to be done."
http://rootzwiki.com/topic/4550-app09-beta-snapdragon-dual-core-oc-control/
It might be of help, or then again....
I actually have this implemented in my own ROM...
What I did using dxixda's kitchen:
1) Unpack boot.img (option 20) using option "w" (kernel+ramdisk)
2) Open bootcomplete.rc and add this line to the end of the file:
Code:
for x in /system/etc/init.d/*.sh ; do /system/bin/sh $x ; done
3) Save the file
4) Recompile boot.img using option "b"
5) Flash boot.img via fastboot (fastboot flash boot boot.img)
Now you have to throw your commands in a text file and rename it to "script_name.sh", then chmod 777 the init.d folder and all the scripts within. Say, you want cpu0 to boot at 1.512GHZ.. the script will look like this:
Code:
!/system/bin/sh
echo 1512000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Make sure that your scripts in the init.d folder have the .sh extension or this won't work!!
Hope this answers your question
thx, sounds promising. Unfornunately I'm currently on a business trip, so it might take some days before I can actually test this...
This is, i´m reeally noob, and do it just for fun and have muy sensation the way I like, so I want to know just the basics to do that.
Just added stock frequencies to init.post_boot.sh of faux kernel, and I wondering, how to control the transitions or steps of the frecuency scaling, I found this lines, but really don´t know if they will work. Some of them are already in my file. But I don´t know whats the function of sampling_rate, up_threshold, and sampling_down_factor, and if they will work on intellidemand governor.
echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 40000 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
echo "60000" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate
echo "60000" > /sys/devices/system/cpu/cpu1/cpufreq/conservative/sampling_rate
echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 80 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold
echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/up_threshold
echo "95" > /sys/devices/system/cpu/cpu1/cpufreq/conservative/up_threshold
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "20" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
chown system /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
echo "192000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
chown system /sys/devices/system/cpu/cpu0/online
chown system /sys/devices/system/cpu/cpu1/online
chown system /sys/power/perflock
Thanks!
Control CPU without any custom application via Init.d :victory:
Disclaimer :
Code:
Please Note : You are solely responsible for what you do to your phone. I nor XDA are responsible for damage you may cause to your device if you mess up something
Here i present you a technique to control CPU and Dyn Fsync, Vibration on supported kernels & also Voltage.
I have attached the Init.d script you can change vdd, Turn on/off Dynamic Fsync, Change CPU Scaling levels.
Detailed Guide on how to use this is coming soon
Download the attached file rename it to just 99init no extension and save it give it 755 permission. & Restart and see i have edited this for my use and am on my personal build of Phoenix Kernel so experience and usage might change on other kernels.
Detailed Guide
echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_dig
echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_mem
echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/suspend_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled
•>> Enables suspend and sleep modules.( i think so.. :silly: )
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
•>> This tweak sets ondemand as default governor.
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
•>> Sets advanced options of ondemand Gov
echo 1188000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1188000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
•>> Sets Min/Max frequencies respectively. for both the CPU's
chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
chown root.system /sys/devices/system/cpu/mfreq
chmod 220 /sys/devices/system/cpu/mfreq
chown root.system /sys/devices/system/cpu/cpu1/online
chown root.system /sys/devices/system/cpu/cpu2/online
chmod 664 /sys/devices/system/cpu/cpu1/online
chmod 664 /sys/devices/system/cpu/cpu2/online
•>> Sets Permissions
echo 18 > /sys/devices/virtual/timed_output/vibrator/level
•>> Vibration Control on supported kernels, Supported in Phoenix Kernel
vdd=-62500
echo ${vdd} > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "All voltages changed by ${vdd}" > /data/local/tmp/vdd.txt
•>> Voltage Control Script, It has been set to max UV by defaule i.e. -62 mV
Note : As the Name suggests its init.d script saved in etc/init.d folder set the permission of the script to 755.
Added Detailed info
I have added detailed info on each individual script :good: , All of the above scripts have been tested on my Sony Xperia L C2104 running my personal build of Phoenix Kernel
you don't mention where to save it on the phone....
Its init.d script
getochkn said:
you don't mention where to save it on the phone....
Click to expand...
Click to collapse
Actually as the Name suggests its init.d script saved in etc/init.d folder set the permission of the script to 755.
Gonna try this!
Sent from my C2105 using XDA Premium 4 mobile app
try it
abielzuliom said:
Gonna try this!
Sent from my C2105 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Try it and report back
first we have to enable init.d dude with universal init.d app
yep
yash989 said:
first we have to enable init.d dude with universal init.d app
Click to expand...
Click to collapse
Yep if you are on a kernel that doesnt have init.d support which might be weird :silly:
I'm trying to make a script for my kernel settings on boot but can't seem to get them to apply it only applies the GPU clock, the max frequency, and voltage table. The CPU boost speeds, the go hispeed load value, and my I/o settings don't however. Is there something I'm doing wrong? At the end of the script I even have a line for it to create a text file verifying that the script ran but it in fact does not. There is no other kernel apps set to run at boot, and I've tried editing a vomertweaks zip with my settings and it won't apply either. Can anyone give me some tips?
Code:
#!/system/bin/sh
# CPU
echo 1267200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1267200 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 1267200 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 1267200 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
# GPU
echo 330000000 > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/max_gpuclk
# CPU Boost
echo 1036800 > /sys/module/cpu_boost/parameters/input_boost_freq
echo 960000 > /sys/module/cpu_boost/parameters/sync_threshold
# Governor
echo 120000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 97 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 93 > /sys/devices/system/cpu/cpufreq/interactive/target_loads
# Hotplug
echo 95 > /sys/devices/virtual/misc/mako_hotplug_control/load_threshold
# I/O Scheduler
echo row > /sys/block/mmcblk0/queue/scheduler
echo 1024 > /sys/block/mmcblk0/queue/read_ahead_kb
# Vibration
echo 20 > /sys/devices/virtual/timed_output/vibrator/vtg_level
# DISABLED:
# FSYNC System Call
#echo N > /sys/module/sync/parameters/fsync_enabled
#
# Voltage
echo "700 700 700 700 710 720 730 750 760 790 800 830 875 935 970" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table
#
echo " ~ franco Tweaks Applied! ~ " > /sdcard/FKU.txt;
I wrote this program because Android's init process on Qualcomm phones is absolutely terrible. It's full of things like the following hidden code segment:
Code:
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/f9967000.i2c/i2c-0/0-0072/enable_irq ]; then
echo 1 > /sys/devices/f9967000.i2c/i2c-0/0-0072/enable_irq
else
echo "doesn't find slimport enable_irq"
fi
case "$soc_id" in
"208" | "211" | "214" | "217" | "209" | "212" | "215" | "218" | "194" | "210" | "213" | "216")
for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
do
echo "cpubw_hwmon" > $devfreq_gov
done
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
#echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
#echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 20 > /sys/module/cpu_boost/parameters/boost_ms
#echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
#echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
#Set LGE Interactive-Grid parameters for G3 models
echo "20000 1100000:40000 1500000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo "85 1500000:90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 960000 > /sys/module/cpu_boost/parameters/sync_threshold
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/is_grid
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/above_optimal_max_freq_delay
echo 960000 > /sys/devices/system/cpu/cpufreq/interactive/optimal_max_freq
echo 7 > /sys/devices/system/cpu/cpufreq/interactive/middle_grid_step
echo 37 > /sys/devices/system/cpu/cpufreq/interactive/middle_grid_load
echo 14 > /sys/devices/system/cpu/cpufreq/interactive/high_grid_step
echo 46 > /sys/devices/system/cpu/cpufreq/interactive/high_grid_load
echo 1000 > /sys/class/devfreq/g3-display.0/polling_interval
setprop ro.qualcomm.perf.cores_online 2
;;
*)
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
# even if scaling_max_freq go down because of themal mitigation, input_boost frequency does not go down.
# echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
#Set LGE Ondemand-Grid parameters for msm8974aa
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_max_freq
echo 7 > /sys/devices/system/cpu/cpufreq/ondemand/middle_grid_step
echo 40 > /sys/devices/system/cpu/cpufreq/ondemand/middle_grid_load
echo 14 > /sys/devices/system/cpu/cpufreq/ondemand/high_grid_step
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/high_grid_load
;;
esac
What is $soc_id equal to? Now we have to audit trail to see what and when $soc_id has been set to, which will open up another can of worms to see when it was initialized to, and what are the implications of having $soc_id set to a certain value, rather than another further down in the init process? Why can't we just extract all of the actual information to the boot process and leave the other junk (support for CPUs which are 5+ years old, unused features, etc) behind?
Enter Ideal Init. What Ideal Init is, consists of some changes to your device's stock kernel, and some changes to your device's stock ramdisk. Once you make the changes to the kernel and ramdisk, you create a boot.img with the new and updated kernel and ramdisk, and flash it to your device. The changes you just made to the kernel and ramdisk now allow the system calls made by your device's init.*.rc scripts and init shell scripts to be logged and dumped for later use.
From there you can dump your device's logs using the dmesg command, and run the ideal_init program on your computer to interpret these intercepted system calls and output a single valid init.<device>.rc. Then you can revert back to your original setup.
Basically, this program turns all of these init scripts and these init shell scripts and extracts only the information that was actually used in the boot process to create something like this
Check out the README for detailed instructions
https://github.com/JackpotClavin/Ideal-Init
Hope this helps the device bringup for future ROMs