[Galaxy S II Original Android Development] droidphile:
See this post: http://xdaforums.com/showpost.php?p=19504531&postcount=10658

Beginner's Guide to init.d Scripts

init.d scripts has to be copied to /system/etc/init.d. All scripts in init.d are automatically executed after booting. (in Siyah, 30 seconds after booting)

I) How To:

1) In an editor such as notepad++, type #!/system/bin/sh

This should be the first line of all shell scripts. This invokes the compatible shell to execute our scripts.

2) From next line, type in your scripts line by line. After saving, push it to /system/etc/init.d using root explorer.

3) Use Script Manager from market to run the script as root to make sure there are no errors. (if you're confident of your script, then no need of script manager)

note: if you use editors such as wordpad to create a script, the carriage return leaves some 'invisible' illegal characters in the script and hence the script will fail to execute. So use editors such as notepad++, or use script manager itself to make the script.

4) If there are no errors when you run using script manager, then navigate to the script and set the following permissions:

owner: read,write

group: read

others: read

Also check 'set UID' and 'set GID'.

Now you're all good to go. Your script will be executed each time you reboot.

II) References:

We can use init.d scripts to perform a lot of things.

Refer post 2 from Q&A (courtesy kwerdenker)

http://xdaforums.com/showthread.php?t=1325831

Use this post as a reference on how to tweak or change Cpu Frequencies/Voltages, Gpu Frequencies/Voltages, Bus Speed, I/O Scheduler, Charge Current, etc.

Apart from these, you can also tweak sched_mc values, change backlight response curve, change upper and lower thresholds for second-core-active (for screen-on and screen-off), etc.

III) Examples:

1) sched_mc

Ex:

echo "1" > /sys/devices/system/cpu/sched_mc_power_savings

This cause filling cpu0 (1st core) first for long running threads and processes.

Valid values are 0, 1 and 2

2) Second Core Active Threshold

Ex 1:

echo "70" > /sys/module/pm_hotplug/parameters/loadh

echo "25" > /sys/module/pm_hotplug/parameters/loadl

During screen on, This causes cpu1 to kick-in only after the load on cpu0 reaches 70% and cpu1 to turn off when load is less than or equal to 25%

Ex 2:

echo "90" > /sys/module/pm_hotplug/parameters/loadh_scroff

echo "35" > /sys/module/pm_hotplug/parameters/loadl_scroff

During screen off, This causes cpu1 to kick-in only after the load on cpu0 reaches 90% and cpu1 to turn off when load is less than or equal to 35 %. Useful to control power drain when you're listening to music when screen off, etc.

3) Tweak brightness Response Curve

Ex:

echo "30" > /sys/class/misc/brightness_curve/min_bl

echo "24" > /sys/class/misc/brightness_curve/max_gamma

This means any brightness value below 30 will have 0 gamma and brightness level above 30 will be linearly mapped to [0:24] gamma levels.

30 & 24 are stock values. Beta 16 will have voodoo color support as well. Use Voodo Screen Tuning R&D app from market to experiment and play around with yur SAMOLED screen.

4) Tweak Governors

Ex:

echo "85" > sys/devices/system/cpu/cpufreq/ondemandx/up_threshold

This means when ondemandx is used, the polling function scales cpu up to next frequency when cpu is 85% loaded w.r.t current frequency.