[Motorola Milestone Android Development] dateno1:
hmm i think my overclock script is better

it for XT720's but i think if you change something it will run on milestone

#!/system/xbin/bash

#############################################################

# Parameters

#############################################################

# cpu polices. 0: ondemand, 1: interactive, 2: conservative, 3: performance, 4: smartass

scaling=1

# clock unit: MHz

max_clk=1000

max_vsel=60

clk4=720

vsel4=54

clk3=550

vsel3=48

clk2=250

vsel2=32

clk1=125

vsel1=28

# scaling range: 1-5. 5=max, 4-1=clk4-1, 4=clk4...

scaling_min=1

scaling_max=5

#############################################################

# chek linux version

#############################################################

LVER=`uname -r | awk '{split($0,a,"-"); print a[1]}'`

#module path

MODPATH="/system/lib/modules/$LVER"

#############################################################

# Address

#############################################################

cpufreq_table=`busybox grep omap2_clk_init_cpufreq_table /proc/kallsyms|busybox sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`

stats_update=`busybox grep cpufreq_stats_update /proc/kallsyms|busybox sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`

nr_running=`busybox grep nr_running /proc/kallsyms|busybox sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`

# parameters for conservative governor

# sampling_rate unit: us, freq_step unit: %

con_sampling_rate=125000

con_freq_step=25

# parameters for interactive governor

int_min_sample_time=5000

#############################################################

# Overclock

#############################################################

# load module

insmod "$MODPATH/cpufreq_stats.ko"

insmod "$MODPATH/symsearch.ko"

insmod "$MODPATH/overclock.ko" "omap2_clk_init_cpufreq_table_addr=0x$cpufreq_table"

# set cpufreq_stats_update_addr

echo 0x$stats_update > /proc/overclock/cpufreq_stats_update_addr

if [ -f /system/persistent/orbootstrap/.overclock ]; then

# set clock_table

echo $max_vsel > /proc/overclock/max_vsel

echo "${max_clk}000" > /proc/overclock/max_rate

echo "1 ${clk4}000" > /proc/overclock/freq_table

echo "4 ${clk4}000000 $vsel4" > /proc/overclock/mpu_opps

echo "2 ${clk3}000" > /proc/overclock/freq_table

echo "3 ${clk3}000000 $vsel3" > /proc/overclock/mpu_opps

echo "3 ${clk2}000" > /proc/overclock/freq_table

echo "2 ${clk2}000000 $vsel2" > /proc/overclock/mpu_opps

if [ $scaling_min == 1 ]; then

echo "4 ${clk1}000" > /proc/overclock/freq_table

echo "1 ${clk1}000000 $vsel1" > /proc/overclock/mpu_opps

fi

# set scaling_range

if [ $scaling_min = 1 ]; then

echo "${clk1}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 2 ]; then

echo "${clk2}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 3 ]; then

echo "${clk3}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 4 ]; then

echo "${clk4}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 5 ]; then

echo "${max_clk}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_max = 1 ]; then

echo "${clk1}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 2 ]; then

echo "${clk2}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 3 ]; then

echo "${clk3}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 4 ]; then

echo "${clk4}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 5 ]; then

echo "${max_clk}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

fi

#############################################################

# Activate CPU polices

#############################################################

# activate interactive

insmod "$MODPATH/cpufreq_interactive.ko" "nr_running_addr=0x$nr_running"

echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo $int_min_sample_time > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time

# activate conservative

insmod "$MODPATH/cpufreq_conservative.ko"

echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo $con_sampling_rate > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate

echo $con_freq_step > /sys/devices/system/cpu/cpu0/cpufreq/conservative/freq_step

# activate smartass

insmod "$MODPATH/cpufreq_smartass.ko"

echo smartass > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

#############################################################

# Set CPU polices

#############################################################

#ondemand

if [ $scaling = 0 ]; then

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#interactive

if [ $scaling = 1 ]; then

echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#conservative

if [ $scaling = 2 ]; then

echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#performance

if [ $scaling = 3 ]; then

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#smartass

if [ $scaling = 4 ]; then

echo smartass > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#############################################################

# Overclock Profile

#############################################################

mount -t rootfs -o rw,remount rootfs /

mkdir /overclock

/system/xbin/busybox mount /dev/block/mmcblk0p1 /sdcard

cp /sdcard/OpenRecovery/overclock/* /overclock

chmod 755 /overclock/*

chown 0.0 /overclock/*

/system/xbin/busybox umount /sdcard

mount -t rootfs -o ro,remount rootfs /

it support multi kernel version auto select, cpu goverment option and auto get address and en/disable option for overclock and overclock profile function

en/disable funtion is my XT720's recovery only but you can easy add option menu for all recovery (just touch or rm /system/persistent/orbootstrap/.overclock) (it safe guard for edit script)

and if you want to change current clock profile you just run sh on /overclock by root explorer :D (but it will need this type script on /sdcard/OpenRecovery/overclock)

#!/system/bin/sh

#############################################################

# Parameters

#############################################################

# cpu polices. 0: ondemand, 1: interactive, 2: conservative, 3: performance, 4: smartass

scaling=1

# clock unit: MHz

max_clk=1000

max_vsel=60

clk4=720

vsel4=54

clk3=550

vsel3=48

clk2=250

vsel2=32

clk1=125

vsel1=28

# scaling range: 1-5. 5=max, 4-1=clk4-1, 4=clk4...

scaling_min=2

scaling_max=5

#############################################################

# parameters for governor

#############################################################

# parameters for conservative governor

# sampling_rate unit: us, freq_step unit: %

con_sampling_rate=125000

con_freq_step=25

# parameters for interactive governor

int_min_sample_time=5000

#############################################################

# Overclock

#############################################################

if [ -f /system/persistent/orbootstrap/.overclock ]; then

# set clock_table

echo $max_vsel > /proc/overclock/max_vsel

echo "${max_clk}000" > /proc/overclock/max_rate

echo "1 ${clk4}000" > /proc/overclock/freq_table

echo "4 ${clk4}000000 $vsel4" > /proc/overclock/mpu_opps

echo "2 ${clk3}000" > /proc/overclock/freq_table

echo "3 ${clk3}000000 $vsel3" > /proc/overclock/mpu_opps

echo "3 ${clk2}000" > /proc/overclock/freq_table

echo "2 ${clk2}000000 $vsel2" > /proc/overclock/mpu_opps

if [ $scaling_min == 1 ]; then

echo "4 ${clk1}000" > /proc/overclock/freq_table

echo "1 ${clk1}000000 $vsel1" > /proc/overclock/mpu_opps

fi

# set scaling_range

if [ $scaling_min = 1 ]; then

echo "${clk1}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 2 ]; then

echo "${clk2}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 3 ]; then

echo "${clk3}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 4 ]; then

echo "${clk4}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_min = 5 ]; then

echo "${max_clk}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

fi

if [ $scaling_max = 1 ]; then

echo "${clk1}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 2 ]; then

echo "${clk2}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 3 ]; then

echo "${clk3}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 4 ]; then

echo "${clk4}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

if [ $scaling_max = 5 ]; then

echo "${max_clk}000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

fi

fi

#############################################################

# Activate CPU polices

#############################################################

# activate interactive

echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo $int_min_sample_time > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time

# activate conservative

echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo $con_sampling_rate > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate

echo $con_freq_step > /sys/devices/system/cpu/cpu0/cpufreq/conservative/freq_step

# activate smartass

echo smartass > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

#############################################################

# Set CPU polices

#############################################################

#ondemand

if [ $scaling = 0 ]; then

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#interactive

if [ $scaling = 1 ]; then

echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#conservative

if [ $scaling = 2 ]; then

echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#performance

if [ $scaling = 3 ]; then

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi

#smartass

if [ $scaling = 4 ]; then

echo smartass > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

fi