[G1 Android Development] huanyu:
The purpose of this script to allow user to define their own set of configuration in a easier way. You can play with the parameters (user.conf)

to find out what suits you best.

Please check the third post for change log and rom compatibility list

echo "Usage:"
echo "/system/sd/userinit.sh [-s|-c config.file|-i]"
echo
echo "Default:"
echo "Sets system configuration based on the paratermers"
echo "that listed in /system/sd/user.conf"
echo
echo " -s: check configuration status and cross"
echo " verifiction with user configurations "
echo " -c config.file: use user parameters that defined"
echo " in config.file "
echo " -i: Current system settings and info "

Install using ADB:

adb push userinit.sh /system/sd
adb shell chmod 755 /system/sd/userinit.sh
adb push user.conf /system/sd
adb shell chmod 755 /system/sd/user.conf
adb shell reboot

Install using terminal emulator

download the file and unzip it to your sdcard

su
mount -o remount,rw /dev/block/mtdblock3 /system
cp /sdcard/userinit.sh /system/sd
cp /sdcard/user.conf /system/sd
chmod 755 /system/sd/user.conf
chmod 755 /system/sd/userinit.sh
reboot

testing via ADB

adb shell sh /system/sd/userinit.sh -s

testing via terminal emulator

su
sh /system/sd/userinit.sh -s

Expected output for compcache 0.5

=== CompCache status ===
CompCache version 0.5
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)

=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 11
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 1
GoodCompress: 70 %
NoCompress: 0 %
PagesStored: 10
PagesUsed: 4
OrigDataSize: 40 kB
ComprDataSize: 10 kB
MemUsedTotal: 16 kB

the (system) beside the number means the value is gather from system and user means from user.conf

example out for compcache 0.6+

=== CompCache status ===
CompCache version 0.6+
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)

=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 3
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 100 %
NoCompress: 0 %
PagesStored: 3
PagesUsed: 1
OrigDataSize: 12 kB
ComprDataSize: 0 kB
MemUsedTotal: 4 kB

This is the default user.conf. By default, the 32MB of compcache is enabled.

# General parameters
general{
apps2sd=0	# this is useless here, require a modified a2sd script
CONF_FILE="/system/sd/user.conf"	#location of user.conf
media2sd=1	# moves the medias to sd if /system/sd/media exists
permission_fix=0 # perform permission fix at start up (this parameter sets to 0 after script is executed)
odex_auto=0	# perform auto create or del odex for applications installed or removed within 3 days
odex_apk=0	# creates odex for apk that does not have odex yet (this parameter sets to 0 after script is executed)
odex_all=0	# creates odexes for all apks (this parameter sets to 0 after script is executed)
}

#compcache related parameters
compcache{
compcache_en=1	# enable(1) or disable(0) compcache
cc_disksize=32	# Ram swap disksize - any number between 1 to 95 should work; default is 1/4 of the RAM (24)
cc_memlimit=16	# Limit the memory usage for backing swap (cc .5x known issue-defaults to 15% of total RAM)
cc_backingswap_en=0	# enable(1) or disable(0) backing swap
cc_backingswap=/dev/block/mmcblk0p3 # pointing to the backingswap partition device, swap
cc_swappiness= # default 60
}

#create swap file for compcache or linux swap
swap_file{
swap_file_en=0	# set to 1 to create swap file
# set to 0 to del the swap file
linux_swap_file_size=32	# swap file size in MB
linux_swap_file=/system/sd/swap.file	# pointing to the swap file location ( must be /system/sd/)
}

#Linux swap parameters
#
# linux swap can only be enabled if cc_backingswap_en is set to "0"
#
linux_swap{
linux_swap_en=0	# enable(1) or disable(0) linux swap
linux_swap_partition=/dev/block/mmcblk0p3 # swap partition device
swappiness=30 # default 60
}

#virtual memory
sys_vm{
sys_vm_en=0	# enable(1) or disable(0) virtual memory configurations
page_cluster=0	# default 3, (0 since CM3.9.6+)
laptop_mode=0	# default 0
dirty_expire_centisecs=3000	# default 3000
dirty_writeback_centisecs=500	# default 500
dirty_background_ratio=5	# default 5
dirty_ratio=10	# default 10
}

#cpu clock
proc_cpu{
proc_cpu_en=0	# enable(1) or disable(0) user cpu configurations
# freqency options
# 19200
# 122880
# 128000
# 245760
# 384000
# 528000
scaling_min_freq=245760	# default 245760
scaling_max_freq=528000	# default 528000
sampling_rate=2000000	# default 2000000 depending on kernel version
powersave_bias=200	# default 0, (200 since CM3.9.6+ )
up_threshold=40	# default 40, percent cpu usage before going up a speed step
}

# custom shell commands, these commands run last
custom_shells{
#echo "Hello!!!" # example
#echo "You can create your own cmmands here" # example
}

To enable linux swap

linux_swap_en=1

To enable virtual memory configurations

sys_vm_en=1

To enable CPU related configurations

proc_cpu_en=1

some sample configurations

Equivalent user.conf settings to CM 3.9.10+ compcache default settings

compcache_en=1
cc_disksize=24
cc_backingswap_en=0

Please do not use notepad to edit the user.conf or userinit.sh because you could end up some funny error due to format differences between unix and windows. A good example of unix format compatible editor for windows is notepad++

If you had any problem with the script please post the error log. This way its much easier to identify the problem

If there any other parameters/configurations that you wish to add, msg me! I will try to add them when i got time.