[Galaxy S I9000 Android Development] Mangus_U*RA:
just fyi, here's my scripts in init.d (corgar may be more exaustive as the rom creator :) )

_99ramset

#!/system/bin/sh
# This file is autogenerated - any changes will be overwritten. Edit /etc/ram.conf instead
echo 0,1,2,3,7,15 > /sys/module/lowmemorykiller/parameters/adj
echo 1024,2048,3072,4096,9216,12288 > /sys/module/lowmemorykiller/parameters/minfree
echo 90 > /proc/sys/vm/swappiness
echo 256 > /proc/sys/vm/lowmem_reserve_ratio

S01sysctl

#!/system/bin/sh
sysctl -p

S70zipalign

#!/system/xbin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Moved zipalign cache to dbdata to avoid apk corruption ( size > 27mb ) by Corgar

LOG_FILE=/data/zipalign.log
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;

echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /dbdata/$(basename $apk);
if [ -e /dbdata/$(basename $apk) ]; then
cp -f -p /dbdata/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /dbdata/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;

S95change_cache

#!/system/bin/sh

#
# stratosk - 27/07/2011
# Corgar - 28/07/2011 ( changed location of cache in dbdata for onenand i/o, decreased cache dimension to 50mb )
# Remount /cache partition with a larger one (64MB)

# create a file 54.5 MB
dd if=/dev/zero of=/dbdata/cache.img bs=1024 count=55808

# create ext4 filesystem
mke2fs -F -T ext2 /dbdata/cache.img

#unmounting old cache partition
umount /dev/block/stl11

# mount
losetup /dev/block/loop7 /dbdata/cache.img
mount -t ext2 /dev/block/loop7 /cache

chown system.cache /cache
chmod 770 /cache

S97screenstate_scaling

#!/system/bin/sh
#
# mod version V46
# screenstate_scaling - switch CPU frequency governor on screen state change
# florian.schaefer@gmail.com (FloHimself)
# modifications by zacharias.maladroit and 'well.heeled.man'
# modifications & ideas taken from: ckMod SSSwitch by voku1987 and "battery tweak" (collin_ph@xda)
# for Changelog and experimental settings: see bottom part of this file

# load the conservative governor
insmod /lib/modules/cpufreq_conservative.ko

# =========
# Memory tweaks for non-screenstate-scaling usage
# =========
# (currently none)
# =========

# =========
# Description, howto:
# =========

# for uncommenting settings remove the preceding diamond/rhomb-sign (#) at the beginning of the line
# and remember to comment the other settings otherwise they will fight with each other and you might
# see inconsistent results

# =========
# (4) ondemand #
# =========
# [default governor but tweaked in preparation for BFS usage, should be smooth
# scales through all frequencies and might consume equally or even less
# than conservative governor
# while screen is off - conservative governor]
# =========
AWAKE_GOVERNOR="ondemand"
SLEEP_GOVERNOR="conservative"

(while [ 1 ]
do

# ==============================================================
# ==============================================================
# ==============================================================
# settings for while the screen is on / usage
# ==============================================================
# ==============================================================
# ==============================================================

AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ $AWAKE = "awake" ]; then
sleep 2 && echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "50" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold # 50 # 76 # 76

# =========
# dirty_ratio & vfs_cache_pressure: too high (dirty_ratio) and too low values (vfs_cache_pressure) might fill up the RAM too much and end up triggering the OOM killer
# =========

#	echo 60 > /proc/sys/vm/swappiness; # 20
#	echo 10 > /proc/sys/vm/page-cluster;
#	echo 0 > /proc/sys/vm/laptop_mode;
echo 700 > /proc/sys/vm/dirty_expire_centisecs; # 2000
echo 500 > /proc/sys/vm/dirty_writeback_centisecs; # 1000
echo 5 > /proc/sys/vm/dirty_background_ratio; # 15
echo 80 > /proc/sys/vm/dirty_ratio; # 40
#	echo 20 > /proc/sys/vm/vfs_cache_pressure; # 100 while screen off # 200 # 50

# CPU scheduler;
#	if [ -e /proc/sys/kernel/rr_interval ];
#	then
#	# BFS;
#	echo 6 > /proc/sys/kernel/rr_interval;
#	echo 100 > /proc/sys/kernel/iso_cpu;
#	else
#	# CFS;
#	echo 1000000 > /proc/sys/kernel/sched_latency_ns;
#	echo 25000 > /proc/sys/kernel/sched_wakeup_granularity_ns;
#	echo 100000 > /proc/sys/kernel/sched_min_granularity_ns;
#	echo -1 > /proc/sys/kernel/sched_rt_runtime_us;
#	echo 100000 > /proc/sys/kernel/sched_rt_period_us;
#	echo 95000 > /proc/sys/kernel/sched_rt_runtime_us;
#	fi;

# log -p i -t screenstate_scaling "*** awake ***: switching CPU frequency governor to -> $AWAKE_GOVERNOR"
AWAKE=
fi

# ==============================================================
# ==============================================================
# ==============================================================
# settings for while the screen is off
# ==============================================================
# ==============================================================
# ==============================================================

SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
sleep 2 && echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# ==============================================================
# limiting the max/min frequencies [not used by default]
# ==============================================================
# =========
# set maximum & minimum frequency to 100 & 400 MHz - that should hopefully be enough for DSP effects & prevent buggy apps from draining the battery too much
# =========
#echo "400000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

# =========
# (2) interactive, (3) smartass, (4) ondemand, (5) conservative #
# =========

# =========
# Conservative settings [SavagedZen governor-like] (recommended when screen on, might consume more battery when screen off since it does not scale through all frequencies)
# settings for screen off (can be more aggressive)
# =========

echo "50" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold # 50 # 76 # 76 # screen off: # 90 (probably too high) # 76 (sound stuttering with EQ and some apps) ## 50
echo "35" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold # 35 # 12 # 30 (higher will lead to noticable lags) # 35 # screen off: # 50 ## 35
echo "5" > /sys/devices/system/cpu/cpufreq/conservative/freq_step # more aggressive ramping up (50) # screen off: # 10

# =========
# dirty_ratio & vfs_cache_pressure: too high (dirty_ratio) and too low values (vfs_cache_pressure) might fill up the RAM too much and end up triggering the OOM killer
# =========

#	echo 12 > /proc/sys/vm/page-cluster;
#	echo 70 > /proc/sys/vm/swappiness; # set this to 50 when compcache or frontswap is available
#	echo 0 > /proc/sys/vm/laptop_mode; # 1
echo 3000 > /proc/sys/vm/dirty_expire_centisecs;
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs;
echo 10 > /proc/sys/vm/dirty_background_ratio; # 50 # 10 (for zram & zcache)
echo 90 > /proc/sys/vm/dirty_ratio; # 60 # 20 (for zram & zcache)
#	echo 20 > /proc/sys/vm/vfs_cache_pressure;

# CPU scheduler;
#	if [ -e /proc/sys/kernel/rr_interval ];
#	then
#	# BFS;
#	echo 6 > /proc/sys/kernel/rr_interval;
#	echo 60 > /proc/sys/kernel/iso_cpu;
#	else
#	# CFS;
#	echo 20000000 > /proc/sys/kernel/sched_latency_ns;
#	echo 5000000 > /proc/sys/kernel/sched_wakeup_granularity_ns;
#	echo 4000000 > /proc/sys/kernel/sched_min_granularity_ns;
#	echo -1 > /proc/sys/kernel/sched_rt_runtime_us;
#	echo 1000000 > /proc/sys/kernel/sched_rt_period_us;
#	echo 950000 > /proc/sys/kernel/sched_rt_runtime_us;
#	fi;
# log -p i -t screenstate_scaling "*** sleeping ***: switching CPU frequency governor to -> $SLEEP_GOVERNOR"
SLEEPING=
fi
done &)

# ==============================================================
# ==============================================================
# ==============================================================
# Changelog
# ==============================================================
# ==============================================================
# ==============================================================

# CFS stuff commented out and moved to 89system_tweak; tweaks to conservative governor
# conservative governor with different values; tweaked conservative governor some more
# more conservative tweaks
# conservative for more power savings; behavior similar to SavagedZen governor
# more tweaking & testing
# One governor to rule them all; state-dependent memory tweaks (V22); disabled log; ramping at 10
#
# switch to ondemand governor (experience from users & me has shown that this one should be the optimal
# governor for fast frequency-switching and battery savings in usage)
#
# switched to smartass governor as default governor while screen is on - when 600 MHz is undervolted by -225 mV (where possible)
# idle comes at the same cost like 400 MHz so is acceptable
#
# tweak the conservative governor (while screen is off) a little to make it less aggressive with ramping up but higher threshold values
# V28: add min & max frequencies and tweak the conservative governor
# V29: remove the raised sampling rate for conservative governor (screen off) - since that potentially lead to lags
# while screen is on (less often polling - no sampling rate set - so the same like it was with screen off). Higher wasn't better in this case
# V30: tweaked conservative governor some more
# V31: switch to SavagedZen for default governor (while screen is on)
# V32: switched back to smartass for default
# V33: tweaks to smartass governor, added aggressive conservative powersaving options [uncommented - might lead to stuttering in sound playback]
# V34: tweak smartass governor previous tweaks were too conservative - non-smooth GUI
# V35: some minor tweaks to screen-off conservative governor
# V36: config for forked & optimized Talon Kernel
# V37: even more tweaks to memory settings & governors
# V38: reduce the waiting time to apply the governor to 2 seconds (from 5)
# V39: do some more tweaks to the page-cache & dirty_ratio [thanks to Juwe11 for some ideas on how to tweak it properly !]
# V40: working around the issue that PowerAmp and other players consume too much cpu power & sound lags (less min-max like behavior)
# V41: conservative governor (screen on) back to old (smoother) behavior
# V42: switched to ondemand governor (screen on)
# V43: moved stuff around and added some tags to make things more clear
# V44: added some more settings
# V45: some more descriptions
# V46: added explanation to powersave governor

S99complete

#!/system/bin/sh

sync;
setprop cm.filesystem.ready 1;