[Defy Android Development] Higgsy:
Ok so I Overclocked/undervolted via Milestone Overclock - no problems, however it got me thinking, all we are doing with this app is changing the maximum frequency and the maximum vsel.

I was looking for some extra oomph but also wanted to maximise battery life. My current set up is a 900mhz/46vsel maximum, but what about the other available frequencies - 600/300mhz - we ain't touching the vsel on these - are we getting the most out of this??

I did a bit of delving around so firstly I found the following when performing a cat /proc/overclock/mpu_opps with my overclock in place:

mpu_opps[3] rate=900000000 opp_id=3 vsel=46

mpu_opps[2] rate=600000000 opp_id=2 vsel=48

mpu_opps[1] rate=300000000 opp_id=1 vsel=33

So this is showing that the vsel for 600mhz is actually higher than 900mhz - not very economical! so how can we change this, well delving around various forums i got the jist of how to change this so here's a tutorial

IMPORTANT READ THIS!!! Disclaimer: I will not be held responsible for any damage to your phone, your PC or indeed your life from following this guide. The steps in this guide worked for me. Doing this kind of thing could affect your warranty and all that so have a long hard think about it before you go ahead. If anything goes wrong and your phone freezes or reboots spontaneously, remove the sdcard and boot the phone which will disable the overclock module and enable you to reverse whatever you did! As always I would always recommend a backup using Clockworkmod recovery. This is hacking and bad things can happen so be prepared. This is only tested on a stock/rooted 2.21 UK Generic/2.34 Deblur ROM with no apps removed - I have no idea if this works on other ROMs like JBoogie's (stock roms should be ok), because I don't know what changes/tweaks the Dev has done - If you try it and find it does/doesn't work then report back, but I can't offer any support for that

1) Create a setscaling.sh (I have attached mine as a base) script, this is what mine looks like. You can change frequencies/vsels, but it MUST stay in the format below.

echo 46 > /proc/overclock/max_vsel

echo 900000 > /proc/overclock/max_rate

echo 1 300000000 28 > /proc/overclock/mpu_opps

echo 2 600000000 38 > /proc/overclock/mpu_opps

echo 3 900000000 46 > /proc/overclock/mpu_opps

echo 0 900000 > /proc/overclock/freq_table

echo 1 600000 > /proc/overclock/freq_table

echo 2 300000 > /proc/overclock/freq_table

Lines 1/2 are your custom vsel/freq as loaded into Milestone Overclock

Lines 3/4/5 are your freq's and the custom vsels you want to use at those freq's (you can see they are much less than what they were originally!)

Lines 6/7/8 are your frequency table

I can't stress enough you must keep the format the same, and make sure you use the corect number of. It is possible to for example add an extra step/Frequency in - I haven't tested this so just be careful. Also bear in mind if you lower the vsels too much then you will cause the phone to fall over. However if you do get this just pull the SD card an it will boot the phone with the overclock module disabled

when you have set your setscaling.sh up you then need to do the following.

copy it to your sdcard, then via adb (you can also use root explorer)

su

mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system

cp /sdcard/setscaling.sh /system/xbin/setscaling.sh

chmod 755 /system/xbin/setscaling.sh

mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system

Then to after this to execute via adb you can just type:

setscaling.sh

Seriously though guys get root explorer as that will enable you to edit you setscaling.sh on the fly as you do your testing (finding optimum vsel), once edited you can then execute it by simply clicking on the file.

Once you have got your setscaling.sh just the way you want it, you can then get it to initialise automatically after boot - this had me stumpted for a while as the script was executing before the overclock module had loaded hence the settings weren't taking effect and I was having to start it manually. I'm more windows orientated and this actually turned out to be a really easy fix.

the key is another script called install-recovery.sh (again I have attached this to the post) and it contains the following info

#!/system/bin/sh

sleep 80

setscaling.sh

So what this does is it waits 80 secs before executing setscaling.sh - which gives the system more than enough time to boot up and load the overclock module. Intall this as per below after plaing on sdcard:

su

mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system

cp /sdcard/install-recovery.sh /system/etc/install-recovery.sh

chmod 755 /system/etc/install-recovery.sh

reboot

Once rebooted do a cat /proc/overclock/mpu_opps and check your setscaling.sh has applied ok (i.e it is displaying your custom vsels)

Jobs a good un - enjoy!

##If you are reporting problems with it not working please post the exact steps of what you have done, otherwise I won't be able to assist##