I modified the original rookeemod-oxygen script, so that you can supply limits in array form, eg:
LIMITS=( [10]=384000 [30]=691200 [50]=806400 [75]=998400)
It is attached to this post
First time i used bash, so if it isnt correct, please correct me.
I tested it and it works
Credits go to original creators, see copyright notice.
Code:
#!/system/bin/sh
#
# screenstate_scaling - switch CPU frequency governor on screen state change
# originally by [email protected] (FloHimself)
# mod teppic74 / xda - 12/10/2010
# Changelog:
# * Test for battery charging/full - if so, use alternative settings.
# * Allow for alternative frequencies when battery is below 30, 20 and 10%
# Modified by twicejr / xda - 15/01/2011 - made alternative frequencies work with an array, for more dynamic configurability.
# Modifications Copyright 2010
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
# ( note: options for freqs: 245000 384000 422400 460800 499200 537600 576000 614400 652800 691200 729600 768000 806400 844800 883200 921600 960000 998400 1036800 1075200 1113600 )
AWAKE_GOVERNOR="interactive"
AWAKE_GOVERNOR_FREQENCY_MAX="1113600"
AWAKE_GOVERNOR_FREQENCY_MIN="245000"
AWAKE_SAMPLING_RATE="40000"
AWAKE_CHARGING_GOVERNOR="interactive"
AWAKE_GOVERNOR_CHARGING_MAX="1113600"
AWAKE_GOVERNOR_CHARGING_MIN="499200"
SLEEP_GOVERNOR="interactive"
# irrelevant max for powersave
SLEEP_GOVERNOR_FREQENCY_MAX="245000"
SLEEP_GOVERNOR_FREQENCY_MIN="245000"
#LIMITS=( [10]=384000 [20]=460800 [30]=614400 [40]=729600 [50]=768000 [60]=806400 [70]=883200 [80]=998400 )
LIMITS=( [10]=384000 [30]=691200 [50]=806400 [75]=998400 )
SETCPU="com.mhuang.overclocking"
(while [ 1 ]
do
LIMIT_REACHED="0"
AWAKE=`cat /sys/power/wait_for_fb_wake`
BSTAT=`cat /sys/class/power_supply/battery/status`
if [ "$BSTAT" = "Charging" ] || [ "$BSTAT" = "Full" ] && [ ! "`pidof $SETCPU`" ]; then
echo $AWAKE_GOVERNOR_CHARGING_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $AWAKE_GOVERNOR_CHARGING_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $AWAKE_CHARGING_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
log -p i -t screenstate_scaling "*** awake ***: $BSTAT - switching CPU frequency governor to -> $AWAKE_CHARGING_GOVERNOR"
elif [ $AWAKE = "awake" ] && [ ! "`pidof $SETCPU`" ]; then
echo $AWAKE_GOVERNOR_FREQENCY_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
BATT=`cat /sys/class/power_supply/battery/capacity`
for PERCENTAGE in ${!LIMITS[@]} ;
do
if [ $BATT -lt $PERCENTAGE ]; then
echo ${LIMITS[$PERCENTAGE]} > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
LIMIT_REACHED="1"
break
fi
done
if [ $LIMIT_REACHED = "0"]
echo $AWAKE_GOVERNOR_FREQENCY_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi
if [ $AWAKE_GOVERNOR = "ondemand" ]; then
echo $AWAKE_SAMPLING_RATE > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
fi
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" ] && [ ! "`pidof $SETCPU`" ]; then
echo $SLEEP_GOVERNOR_FREQENCY_MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $SLEEP_GOVERNOR_FREQENCY_MAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
log -p i -t screenstate_scaling "*** sleeping ***: switching CPU frequency governor to -> $SLEEP_GOVERNOR"
SLEEPING=
fi
done &)
i dont want to sound silly, but isnt it "easier" to simply use SetCPU?
waebi said:
i dont want to sound silly, but isnt it "easier" to simply use SetCPU?
Click to expand...
Click to collapse
Yes it is, but i think that in oxygen clean rom is more important
I find it better than having yet another app boot up at start.
Wont the handset be sluggish to wake from 245MHZ and powersave governor?!
Jagdish84 said:
Wont the handset be sluggish to wake from 245MHZ and powersave governor?!
Click to expand...
Click to collapse
I dunno, I set it to interactive: SLEEP_GOVERNOR="interactive"
.
I just think that interactive in combination with scaling down is just as "power-saving" as ondemand in the end, and it feels faster
twicejr said:
I dunno, I set it to interactive: SLEEP_GOVERNOR="interactive"
.
I just think that interactive in combination with scaling down is just as "power-saving" as ondemand in the end, and it feels faster
Click to expand...
Click to collapse
I agree, i got mixed up didnt notice you were using interactive
i would give it a shot but i aint using oxygen rom and ssts aint lying in init.d...
nice script nontheless
Related
Hello Everyone,
First, I did search. That is how I figured out how to disable compcache and enable the swap. It's working great, however since I am no longer using compcache, I would like to make available the RAM that it is using. Here are my free commands:
BEFORE:
# free
free
total used free shared buffers
Mem: 97928 96356 1572 0 8164
Swap: 24476 15516 8960
Total: 122404 111872 10532
AFTER:
# free
free
total used free shared buffers
Mem: 97928 96416 1512 0 300
Swap: 31768 3092 28676
Total: 129696 99508 30188
Notice that the Physical Memory is still the same number, despite compcache being disabled (well, atleast swapoff'd) Here is my userinit and you can see that it's just enabling the swap.
#!/system/bin/sh
##adb push userinit.sh /system/sd/
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
#insmod=/system/bin/insmod
#$insmod $moddir/compcache/xvmalloc.ko;
#$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768;
#$insmod $moddir/compcache/ramzswap.ko backing_swap=/dev/block/mmcblk0p3;
#mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
# Experimental settings
#echo 1 > /proc/sys/vm/page-cluster; # default: 3 Changes Page clustering from 8 to 2.
#echo 5 > /proc/sys/vm/laptop_mode; # default: 0 Helps keep SSD from getting worn.
#echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
#echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
#echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
#echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
#
#swapon /dev/ramzswap0;
swapon /dev/block/mmcblk0p3;
#Over Clock CPU when in use, puts at lower freq when idol. # if you don't want it.
#echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
#echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
QUESTION: Is there any way to re-allocate the compcache section of my physical RAM to be used again? There is that 24476b that I cannot use, as I'm using a swap.
Thanks for your time.
andjohn said:
Hello Everyone,
First, I did search. That is how I figured out how to disable compcache and enable the swap. It's working great, however since I am no longer using compcache, I would like to make available the RAM that it is using. Here are my free commands:
BEFORE:
# free
free
total used free shared buffers
Mem: 97928 96356 1572 0 8164
Swap: 24476 15516 8960
Total: 122404 111872 10532
AFTER:
# free
free
total used free shared buffers
Mem: 97928 96416 1512 0 300
Swap: 31768 3092 28676
Total: 129696 99508 30188
Notice that the Physical Memory is still the same number, despite compcache being disabled (well, atleast swapoff'd) Here is my userinit and you can see that it's just enabling the swap.
#!/system/bin/sh
##adb push userinit.sh /system/sd/
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
#insmod=/system/bin/insmod
#$insmod $moddir/compcache/xvmalloc.ko;
#$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768;
#$insmod $moddir/compcache/ramzswap.ko backing_swap=/dev/block/mmcblk0p3;
#mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
# Experimental settings
#echo 1 > /proc/sys/vm/page-cluster; # default: 3 Changes Page clustering from 8 to 2.
#echo 5 > /proc/sys/vm/laptop_mode; # default: 0 Helps keep SSD from getting worn.
#echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
#echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
#echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
#echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
#
#swapon /dev/ramzswap0;
swapon /dev/block/mmcblk0p3;
#Over Clock CPU when in use, puts at lower freq when idol. # if you don't want it.
#echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
#echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
QUESTION: Is there any way to re-allocate the compcache section of my physical RAM to be used again? There is that 24476b that I cannot use, as I'm using a swap.
Thanks for your time.
Click to expand...
Click to collapse
hahaha, compcache doesn't take up your physical RAM.
ccyrowski said:
hahaha, compcache doesn't take up your physical RAM.
Click to expand...
Click to collapse
Ok, so where is it taking from? I understood that compcache is a Compression Swap that runs in RAM. Is that incorrect?
This does not belong in this area plz post questions like this in the Q&A area.
Prod1702 said:
This does not belong in this area plz post questions like this in the Q&A area.
Click to expand...
Click to collapse
Sorry, Mods please close. Reposting in QA
This kernel module allows you to run any official Froyo kernel image from HTC with reduced CPU voltages at each frequency. Reducing voltage decreases the power consumed by the CPU (dissipated as heat).
INSTALL:
You need root or an unrestricted recovery image (e.g ClockworkMod) to install this. The default settings decrease voltage by 75-100 mV which seems stable on my device. Just download the attached file and select it from recovery or ROM Manager.
I've built "update.zip" files for the Desire with Linux kernel versions 2.6.32.15-gf9c0527, 2.6.32.15-gd96f2c0, and 2.6.32.15-g6a358a9. You can check your kernel version in Settings->About phone->Software information.
Other HTC devices running Froyo are supported. If you have a different device, please give me the full version number and I can add an update.zip for it.
Undervolt driver for the EVO 4G
Added undervolt-2.6.32.15-gd96f2c0-20100907.zip.
Added undervolt-2.6.32.15-g6a358a9-20100907.zip.
Added undervolt-2.6.32.15-gf5a401c-20100907.zip.
USAGE:
Read the instructions above first. If you are happy with the default settings, you don't need to read this unless you're curious
To load the driver, use an init script like this one (included):
Code:
#!/system/bin/sh
#
# Load undervolt for htc-kernel
addr=`awk '$3 == "acpuclk_set_rate" { print "0x"$1; }' /proc/kallsyms`
if [ -n "$addr" ]; then
insmod /system/lib/modules/undervolt.ko "acpuclk_set_rate_addr=$addr"
if [ $? -eq 0 ]; then
echo '-75' > /proc/undervolt
echo '1225 1125' > /proc/undervolt
echo '1250 1150' > /proc/undervolt
echo '1275 1175' > /proc/undervolt
echo '1300 1200' > /proc/undervolt
echo '1' > /proc/undervolt
echo "+++ undervolt enabled"
exit 0
fi
fi
echo "+++ undervolt could not be enabled
The driver adds a "/proc/undervolt" knob to make voltage changes, reading from it prints the current default and adjusted voltages in mV for every CPU frequency, e.g.:
Code:
cat /proc/undervolt
1050 975 19200
1050 975 128000
...
1300 1200 960000
1300 1200 998400
Write a space-separated pair of default and adjusted voltages in mV to change the values in the table, e.g. to undervolt stock freqs using 1500 mV to 1000mV):
Code:
echo '1050 1000' > /proc/undervolt
.
Write '+' or '-' followed by a single number to adjust *all* voltages by that amount in mV:
Code:
echo '-25' > /proc/undervolt
The changes are NOT applied until you write the number 1:
Code:
echo '1' > /proc/undervolt
Writing the number 0 reverts all voltages to the default. This also happens when you unload the module with rmmod.
BACKGROUND:
I figured it would be possible to locate and modify acpu_freq_tbl on the stock HTC kernel with a LKM (since /dev/kmem isn't available), and I was right, although it involved peeking at the ARM opcodes. The method should also work for other HTC kernel images on recent devices (anything with a "Scorpion" CPU): Nexus One, Droid Incredible, EVO 4G. Overclocking will be possible with a bit more work.
This also disables the voltage constraints set by the board-specific configuration (e.g. in board-bravo.c or board-incrediblec.c). This was done by y patching the regulator_set_voltage function to simply ignore the constraints. The remaining limits are imposed by the driver for the regulator IC. The TPS65023 driver defines these for VDCDC1: min_uV = 800000, max_uV = 1600000.
KNOWN BUGS:
There is a vdd_undervolt parameter to set the default undervolt, but it is ignored (by insmod?), use +/- instead.
Very nice work!
That is, in fact, fantastic work
Of course it will be obsoleted when HTC decides to release their source but you know that
I assume you verified these actually work?
ok...this is nice i think!
i don't know much about kernel so...can i use the update.zip to install this kernel in my actual sense rom ?
just, install this and that's it? it starts working undervolted?
Did you account for the fact the stock kernel has board files to constrain the minimum
and maximum voltage?
eg, board-bravo.c:
.min_uV = 1000000
.max_uV = 1300000
The same goes for overclocking, the upper limit for the clock is set, hardcoded,
so you would need to change that as well.
sounds interesting!! I`ll try it very soon.
ieftm said:
Did you account for the fact the stock kernel has board files to constrain the minimum
and maximum voltage?
eg, board-bravo.c:
.min_uV = 1000000
.max_uV = 1300000
The same goes for overclocking, the upper limit for the clock is set, hardcoded,
so you would need to change that as well.
Click to expand...
Click to collapse
Yikes, I didn't know about that, is that in bravo_fixup (which I hope is in the .init section like acpu_freq_tbl_fixup)? Is board-bravo.c in the incrediblec or vanilla Android kernel trees? I'm using the supersonic source atm.
Thanks!
-Albert
ieftm said:
That is, in fact, fantastic work
Of course it will be obsoleted when HTC decides to release their source but you know that
I assume you verified these actually work?
Click to expand...
Click to collapse
Thanks, I haven't hacked on the Linux kernel in ages and wasted a lot of time targeting acpu_freq_tbl_fixup originally (as you might have noticed in the comments).
The idea is that this should work with the stock kernel images of multiple devices without reflashing, and in future releases with only minor changes.
I didn't take a multimeter to the board, if that's what you mean... but acpu_freq_tbl is canonical list of voltages (unless something in board-bravo.c rewrites it after initialisation, which seems unlikely) and this is able to read and write to the table. The actual CPU frequencies are duplicated in another structure (which is why I haven't tried overclocking yet) but the voltages are read directly from the table and scaled to microvolts for the governor.
Thanks alot for your work. Does anybody have ' proof ' this script works on a Desire running standard HTC Froyo ?
There is no way to check is there, except having better battery life?
What kind of energy saving is possible with this method?
Thanks
Seems to work....but not below 1000mV, so like you say, isn't there ways to check it....
Ne0, you are on the Dutch television as we speak (the matrix revolutions)
At what mV is the desire standard doing ? Going to flash you 7.6 now
knights191 said:
Ne0, you are on the Dutch television as we speak (the matrix revolutions)
At what mV is the desire standard doing ? Going to flash you 7.6 now
Click to expand...
Click to collapse
haha
1300mV at max speed.
UPDATED 2010-09-07
This also disables the voltage constraints set by the board-specific configuration (e.g. in board-bravo.c or board-incrediblec.c). This was done by y patching the regulator_set_voltage function to simply ignore the constraints. The remaining limits are imposed by the driver for the regulator IC. The TPS65023 driver defines these for VDCDC1: min_uV = 800000, max_uV = 1600000. I'll probably work on overclocking next.
Thanks for the advice, folks. I've confirmed that the voltage changes are pushed to the regulator (the previous version had trouble applying table changes sometimes, but the regulator code would print a message when you exceeded the board configuration voltage constraints).
Are there other kernel versions or devices people want me to support? It's mostly a matter of changing the vermagic string in the file at this point.
thanks, installed on R8 Paul's (Modaco) ROM kernel 2.6.32.15-gf9c0527
it's working!
# uname -r
2.6.32.15-gf9c0527
# lsmod
tun 10734 0 - Live 0xbf049000
bcm4329 202947 0 - Live 0xbf015000
cpufreq_powersave 668 1 - Live 0xbf012000
cpufreq_interactive 2368 0 - Live 0xbf00c000
undervolt 2644 0 - Live 0xbf006000
perflock_disable 752 0 - Live 0xbf000000
# cat /proc/undervolt
1050 975 19200
1050 975 128000
1050 975 245000
1050 975 384000
1050 975 422400
1050 975 460800
1075 1000 499200
1100 1025 537600
1100 1025 576000
1125 1050 614400
1150 1075 652800
1175 1100 691200
1200 1125 729600
1200 1125 768000
1225 1125 806400
1250 1150 844800
1275 1175 883200
1300 1200 921600
1300 1200 960000
1300 1200 998400
# echo '-25' > /proc/undervolt
# echo '1' > /proc/undervolt
# cat /proc/undervolt
1050 925 19200
1050 925 128000
1050 925 245000
1050 925 384000
1050 925 422400
1050 925 460800
1075 950 499200
1100 975 537600
1100 975 576000
1125 1000 614400
1150 1025 652800
1175 1050 691200
1200 1075 729600
1200 1075 768000
1225 1075 806400
1250 1100 844800
1275 1125 883200
1300 1150 921600
1300 1150 960000
1300 1150 998400
# echo '-25' > /proc/undervolt
# cat /proc/undervolt
1050 900 19200
1050 900 128000
1050 900 245000
1050 900 384000
1050 900 422400
1050 900 460800
1075 925 499200
1100 950 537600
1100 950 576000
1125 975 614400
1150 1000 652800
1175 1025 691200
1200 1050 729600
1200 1050 768000
1225 1050 806400
1250 1075 844800
1275 1100 883200
1300 1125 921600
1300 1125 960000
1300 1125 998400
Click to expand...
Click to collapse
So how low can you go until you have problems? Is it safe to go bellow maxV=1000?
ANY value on ANY freq below 1000mV freezes device so, min value still being 1000mV
If you put any value below 1000 in init script, at my case, device freezes when load with -1.
iscaela said:
This driver allows you to run any stock Froyo HTC Linux kernel with lowered CPU voltages. It modifies the voltage table at runtime.
I've built update.zip files for the Desire 2.6.32.15-gf9c0527 and 2.6.32.15-gd96f2c0 that applies a 75-100 mV undervolt which seems stable for me. Just download and install the files in recovery.
Click to expand...
Click to collapse
What can we expect from that modification ?
A lower heat of the processor (not sure regarding the difference) and a longer battery life ?
If I read that correctly, looks as a very interesting stuff.
(might be a stupid question, if so apologize)
Thank you.
is it usable on cm 6.0 stable?
anybody tried that?
Confirmed, don't go with any kernel below 1000mV without freeze.
can anyone explain how to install and to enable it? just run the update.zip and that's it???
can you feel different battery usage?
Yes, rom cooking with any kitchen is easy enough for anyone to start with but I think it's better to have a clear tutorial for the newbie like me. As I've tried searching for sometimes, I came up with this post. It may not be a perfect guide but at least, it's better than start from nothing.
This guide is made in Thailand, that's why I add the Thai keyboard.
Sorry, if I made any mistakes, and please tell me to fix.
Thanks: pj from droidsans, eRobot from pdamobiz (these two guys are Thai dev who help me so much)
For dsixda, your kitchen is amazing, love it so much.
For what?
GoLauncherEX -> default(ADWLauncher)
There are many reasons why I would say GoLauncherEX is better than ADWLauncher; having task manager and uninstaller within itself prevent us from wating any more space on the applications. GoLauncherEX also provide a lot of FREE widgets, while some other launchers may ask you yo pay extra, and the best characteristic of all is "this-thing-flows-fluently" you may not believe how small of RAM it is consuming.
MIUI music player -> default(Music)
MIUI (Me-U-I) is one of the most popular chinese ROM as you can see from Andriod phone recently, what imprest me the most in MIUI is the music player, it allows you to shuffle the music my just shaking a phone (as you have seen in many apple products) and provide playlist function which I found very convienient.
Gallery2D -> default(Gallery3D)
To be honest with you, the Gallery3D is not going to be use in this article. Due to the beautiful effects from this program (which has not done any good but being beautiful) which consume a lot of resources and took you for-ever to load the pictures, this issue brings me down to Gallery2D, with the same abilities except for the affected effects.
DroidSansThaiKeyboard -> default
Another sweetener in the recipe from Thai Andriod developer. Custom rom usually does not provide Thai keyboard indeed, and since I am cooking my own rom right now, I decided to drop it in!
CPU 19,710 smartassV2 -> default(264, 518)
Kernel that I use is called "flykernel-13" many versions has been released and this guy has never disappoint me. We are going to overclock at the speed of 19-710 MHz., I use smartassV2 as a CPU governor. The reason why I choose smartassV2 instead of ondemand is because; smartassV2 is not running at the maximum speed or minimum speed all the time, it has the ideal frequencies that store two CPU value, it is set for 518 and 352 for scree on and off sequentially.
Minimum free memory optimization
Theoritically, Andriod is going to clear and retrieve the memory automatically, but this operation is too slow sometime. What we can do is, change the minimum and maximim limits of the CPU before Andriod will recall to use ram. Unfortunately, HTC hero has such a tiny memory capacity comparing to recent Andriod phones, therefore, the background application should be terminate inorder to save memory for the currently using application.
Let’s get is started, shall we?
Prepare ingredients
Base rom: Mine is Elelinux-7.1.0-RC1-Hero-v3.5-Light
Android SDK: Just in case we have to use the ADB
dsixda Android kitchen:
Other packages such as .apk application and kernel (in case you want to change it))
Set up the kitchen
First of all, you can download dsixda kitchen from here:
http://forum.xda-developers.com/showthread.php?t=633246v
Although the owner of dsixda has stopped developing this guy a while ago, dsixda is still very popular among the developers. So far I haven’t seen any kitchen work as easy as this one.
Steps of installation here, works well on windows, linux and mac:
http://forum.xda-developers.com/showpost.php?p=5626300&postcount=3
Find your base rom
Before cooking, we need to prepare the ingredients, and the most important thing in this process is base rom. I suggest that you should find some base rom to work with, but if not, this kitchen is able to work with official rom and nandriod backup. The instruction of importing rom into the kitchen should be at the bottom of the forum. (http://forum.xda-developers.com/showpost.php?p=5626300&postcount=3)
Extract the base rom
After you have import the base rom into the kitchen, unzip the file and follow these steps:
open the terminal, go to directory of kitchen image we have created previously by using command:
cd /Volumes/kitchen
then type:
./menu
to activate the kitchen, the sceen will be as shown below.
{
"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"
}
insert 1 and press Enter, kitchen will ask about setuo WORKING folder, follow the provided instructions and default. At the end, we are going to have a folder named WORKING_*****_***** which contain our rom inside, every configurations will be done in here.
Add more applications
We have two choices for adding applications in rom; one is to add it before the installation (which means it will become part of the system application, note that you won’t be able to uninstall the application unless you use titanium backup to take out the root access and uninstall from that), second is to install it as a user application (which is able to uninstall later on).
System applications
In WORKING_xxx, go to folder system > app you will see many .apk files, these are base applications in your phone; Settings.apk, Calendar.apk, etc.
Erase .apk files that you don’t want it to be in rom (caution: you many erase some important base applpications, so pick out the one you really know, and leave out all the rest.)
Copy .apk from other sources in here, if I was going to add GoLauncherEX, I’m going to browse for WORKING_xxx > system > app and erase a file name Launcher2.apk (this is the default launcher that comes with my base rom) then insert GoLaunherEX.apk into this folder (haven’t got the GoLauncherEX file? Google it!)
User applications
Open kitchen at the main menu.
type 0 to get to the Advanced options
type 13 to Enable /data/app
Follow the instructions of System applications except for the path, change it to:
WORKING_xxx > data > app
Minfree memory scripting
There are many applications in Andriod market that is able to work with this part, but since we are going to build your own rom, it make more sense to manage it before we flash the rom, it may be complicate, but I guarantee this is worth to do.
Kitchen has a function to do this for us, but it’s kind of mess up for me, somehow after you restart the phone, every setup is running back to default, so I decided to write them a script to make it actually work even after we restart the machine.
We are going to add the script in the system/etc/init.d/02memcputweak, if you couldn’t find a file name 02memcputeak, then create one of your own.
We are going to use the script from Juwe11 from XDA to be a default of minfree memory (http://forum.xda-developers.com/showthread.php?t=1111145) according to the link, you will see a script like this:
Code:
#!/system/bin/sh
# Copyright© 2011 Juwe11
# 13.8.2011 Updated VM values - Thanks to [Kalis] for help
# 18.8.2011 Added oom_adj values
# 19.9.2011 Updated VM and LMK values
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,5632,10240,11776,14848" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi
if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi
if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi
if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "500" > /proc/sys/vm/dirty_writeback_centisecs
fi
if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "15" > /proc/sys/vm/dirty_ratio
fi
if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "3" > /proc/sys/vm/dirty_background_ratio
fi
Let’s take a look at this part.
Code:
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,5632,10240,11776,14848" > /sys/module/lowmemorykiller/parameters/minfree
fi
There are 6 sets of number, each one response to different part of work, which are
position 1 : 2560 -> foreground app ; applications that is now currently using.
position 2 : 4096 -> visible app ; applications that is not currently using, but haven’t finish the execution
position 3 : 5632 -> Secondary server ; service of the Operation Systems that applications needed to use.
position 4 : 10240 -> hidden app ; service that applications may needed to use, but not right now
position 5 : 11776 -> content provider ; connections between applications and the content
position 6 : 14848 -> empty app ; applications that are purposely left out in ram, in case you are going to use it again.
*FYI: number you above are the amount of page, if you want it in MB, multiply by 4 and divvided by 1024 (or X*4/1024) i.e. foreground app is 2560; 2560*4/1024 = 10 MB means that, if the free ram in total is less than 10MB, the foreground application will be terminated.
Next problem is, how are we going to manage
Code:
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "1536,4096,4096,25000,25000,25000" > /sys/module/lowmemorykiller/parameters/minfree
fi
position 1 : 1536 -> foreground app ; applications which are being used right now, pour out some more ram please.
position 2 : 4096 -> visible app ; applications that haven’t stop working, so leave them alone.
position 3 : 4096 -> Secondary server ; service that still in use and should not be terminate. ชุดที่ 4 : 25000 -> hidden app ; service that applications may or may not use, we are not going to keep this one for too long.
position 5 : 25000 -> content provider ; we haven’t use much content from other applications.
position 6 : 25000 -> empty app ; applications that may be left out, just in case we are going to use it, which we occasionally do.
OC memory scripting
We are still going to mess with file 02memcputweak. After we have prepared the memory part, we are further going to manipulate the speed and the governor of CPU. The scripts within this part are easy scripts that will go to configuration file of the kernel during the OS boosting.
Code:
#!/system/bin/sh
#
echo 19200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 710400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 0755 /system/etc/init.d/*
Set the value of 19200 in /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq to be a minimum frequency, as well as the value of 710400 in /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq to be the maximum frequency.
After we adjust the speed of CPU, we are going to adjust the govenor as well. For the best performance, I pick smartassV2 and put it in:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Then set the permission of files in init.d by using a command:
chmod 0755 /system/etc/init.d/*
Now we are eventually done with 02memcputweak.
Code:
#!/system/bin/sh
#
# Copyright© 2011 Juwe11
# 13.8.2011 Updated VM values - Thanks to [Kalis] for help
# 18.8.2011 Added oom_adj values
# 19.9.2011 Updated VM and LMK values
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "1536,4096,4096,25000,25000,25000" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /proc/sys/vm/swappiness ]; then
echo "20" > /proc/sys/vm/swappiness
fi
if [ -e /proc/sys/vm/vfs_cache_pressure ]; then
echo "70" > /proc/sys/vm/vfs_cache_pressure
fi
if [ -e /proc/sys/vm/dirty_expire_centisecs ]; then
echo "3000" > /proc/sys/vm/dirty_expire_centisecs
fi
if [ -e /proc/sys/vm/dirty_writeback_centisecs ]; then
echo "500" > /proc/sys/vm/dirty_writeback_centisecs
fi
if [ -e /proc/sys/vm/dirty_ratio ]; then
echo "15" > /proc/sys/vm/dirty_ratio
fi
if [ -e /proc/sys/vm/dirty_background_ratio ]; then
echo "3" > /proc/sys/vm/dirty_background_ratio
fi
echo 19200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 710400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo smartassV2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 0755 /system/etc/init.d/*
Last steps, to make our script works in boot stage of Andriod, we have to insert
service script /system/etc/init.d/02memcputweak
oneshot
into file init.rc, which is located in WORKING_xxx > system > etc, the file will look similar to the text below::
Code:
# CyanogenMod Extras
# Compcache - handle at boot
service compcache /system/bin/handle_compcache
user root
group root
oneshot
service script /system/etc/init.d/02memcputweak
oneshot
Build rom from working directory
Back in the kitchen again, we are now going to pack rom back to .zip file so we could further test it.
In main menu of kitchen, there are options what to do with rom, type 99 to build the rom
After you have chosen a build option, change yourself to be an Interactive Mode (better for the new cooker).
Continue pressing Enter, throughout the process zipalign for optimize to reduce ram usage, and writting updater-script into rom (this part is the one who work with recovery and tell what to do in flashing.)
After every process is finished, we will get our rom in the folder OUTPUT_ZIP.
The next thing you have to do is flash and test the rom, enjoy.
can i use it to built a rom for lg p690
This is killer man. You're no noob.
Sent from my SGH-I727R using Tapatalk 2
sample rom
Can u give me the sample of rom?bcoz i dont want to use other base rom to cook
Hello,
New here at XDA, I've done a lot of reading here and found the site extremely useful in the past, so I thought I'd join up. Thanks for all the help you have provided!
Anyway, I am wondering if anybody knows of an Android equivalent to 'cpulimit' for Linux.
I am looking for a way to limit maximum CPU usage for a single process.
Thank you.
Bryan
Well, I have come to the conclusion there is no CPU limiter for Android, unless cpulimit could be compiled for it, which I have not tried.
However, this solution seems to work. If anybody is interested, I figured I'd update my thread.
Use the renice cmd.
Negative number raises scheduling priority, positive lowers it. From -20 to 20, 0 being the base priority.
I found that a value of even 5 limits the CPU usage of a process greatly when another processes is demanding a lot of CPU ad the same time, the one with base priority will receive much more attention.
Using Opera Mini as example:
# ps | grep opera
ps | grep opera
app_94 30814 93 114260 16956 ffffffff afd0c53c S com.opera.mini.android
Found PID of 30814
# ps -p 30814
ps -p 30814
USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN PC NAME
app_94 30814 93 114260 16956 20 0 0 0 ffffffff afd0c53c S com.opera.mini.android
Now we see NICE value is 0 - base
# renice -1 30814
renice -1 30814
renice process to -1, increase priority slightly
# ps -p 30814
ps -p 30814
USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN PC
NAME
app_94 30814 93 114260 16956 19 -1 0 0 ffffffff afd0c53c S com.opera.mini.android
This shows new NICE value worked, and is now -1.
It can also change priority for processes started by a particular user or group.
There is kind of an extra step in there.
ps -p | grep opera
Could use this to see pid and nice value all at once.
Sent from my Samsung
So I had been having problems with my GPS getting a fix when using Maps etc. It was getting fix with High Accuracy mode but with Device Only mode it wasn't working.
So I tried to tinker with the gps.conf file located in /system/etc/
You need root access for this.
Make a backup of /system/etc/gps.conf file
Go to http://www.pool.ntp.org/en/ and get the address of the server nearest to you. E.g. Mine is pk.pool.ntp.org for Pakistan.
Using your favorite text editor, open the file gps.conf
Code:
#Uncommenting these urls would only enable
#the power up auto injection and force injection(test case).
#XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
#XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
#XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
#
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra2.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra2.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra2.bin
# Error Estimate
# _SET = 1
# _CLEAR = 0
ERR_ESTIMATE=0
#Test
NTP_SERVER=time.gpsonextra.net
#Asia
[color=blue] # NTP_SERVER=asia.pool.ntp.org[/color]
#Europe
# NTP_SERVER=europe.pool.ntp.org
#North America
# NTP_SERVER=north-america.pool.ntp.org
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 2
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
# supl version 1.0
SUPL_VER=0x10000
# Emergency SUPL, 1=enable, 0=disable
SUPL_ES=1
# GPS Capabilities bit mask
# SCHEDULING = 0x01
# MSB = 0x02
# MSA = 0x04
# ON_DEMAND_TIME = 0x10
# GEOFENCE = 0x20
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
CAPABILITIES=0x37
# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
# ACCURACY_THRES=5000
################################
##### AGPS server settings #####
################################
# FOR SUPL SUPPORT, set the following
# SUPL_HOST=supl.host.com or IP
# SUPL_PORT=1234
# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234
####################################
# LTE Positioning Profile Settings
####################################
# 0: Enable RRLP on LTE(Default)
# 1: Enable LPP_User_Plane on LTE
# 2: Enable LPP_Control_Plane
# 3: Enable both LPP_User_Plane and LPP_Control_Plane
LPP_PROFILE = 0
################################
# EXTRA SETTINGS
################################
# NMEA provider (1=Modem Processor, 0=Application Processor)
NMEA_PROVIDER=0
# Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE)
SGLTE_TARGET=0
##################################################
# Select Positioning Protocol on A-GLONASS system
##################################################
# 0x1: RRC CPlane
# 0x2: RRLP UPlane
# 0x4: LLP Uplane
A_GLONASS_POS_PROTOCOL_SELECT = 0
Remove the # symbol at the start of the blue line and replace asia.pool.ntp.org with the nearest country server address.
reboot and the GPS should fix faster.
Sent from my A0001 using Tapatalk
can you make an app like FasterGPS?
I use it to add Pakistan quickly, but issue is it only adds pk.pool.ntp.org, pool.NTP.org servers and removes all gpsonextra.net servers
---------- Post added at 01:54 PM ---------- Previous post was at 01:32 PM ----------
can you make an app for this like FasterGPS?
issue with fasterGPS app is, it removes all timeonextra.net servers
i want to use it for Pakistan as well