[Galaxy S Advance I9070 General] anantttt:
REFERENCE

Read everything. Everything in this thread is important to make init.d script.

I am not responsible for anything that happens to your phone.

****************************************************************

***************************************************

We have come accross this quite a few times. So what is init.d folder?

In simple words, whatever scripts you place in this folder will be executed when the device boots.

******************************************************************************************************

ORDER in which scripts are executed.

Init.d scripts are executed in alphabetical order. That is, any script, the name of which starts with the alphabet A, will be executed first and scripts, the name of which starts with Z will be executed at last.

Therefore the name of the script is really important.

For example, if we make a script with name A, to change the governor to smartassv2

AND

we make another script with the name Z , to change the governor to PegasusQ and place both of them in init.d folder, then the system will first execute script A and change the governor to smartassv2, and then it will execute script Z and change the governor to PegasusQ.

So if you use any mod by some other person, and if you don't know what's inside the script then you should name your script with alphabet z to make your settings stick.

*********************************************************************************************************************************************************

OK NOW enough of explanations, Let's see how to make an init.d script.

REQUIREMENTS :-

1. ROOTED PHONE

2. BUSYBOX INSTALLED

3. KERNEL THAT SUPPORTS INIT.D (like CoCore)

4. TEXT EDITOR.

I usually use solid explorer to do every thing. If you are editing on your computer, then use notepad++.

STEP 1

Set up init.d folder. Using your root explorer, browse to /system/etc and create a folder init.d. Now set the folder's permission to rwxrwxrwx or 0777. You can do this with TWRP recovery also.

STEP 2

1. Now this is the real part. Create a file with appropriate name (see above if you have not read).

Remember, the script should not have any extentions like .txt or .sh. There should be no extentions.

2. Long press the file using your root explorer and open the file as text.

3. NOW THE FIRST LINE OF YOUR SCRIPT SHOULD ALWAYS BE

#!/system/bin/sh

Do not leave any blank space in between or after the line. As soon as you write this, press enter to go to the next line.

4. Now write any script that you want. For example, if you want to change the governor to smartassv2, then you need to use echo command, followed by the name of the governor followed by the path of the file that needs to be changed like this

echo "smartassv2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

your script should look like this,

#!/system/bin/sh
echo "smartassv2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

To set deep sleep to 4 script should be,

#!/system/bin/sh
echo "4" > /d/cpuidle/deepest_state

STEP 4

Put this file inside init.d folder. Now long press the file using your root explorer and set the permission to 0777 and ownership to root 0 : root 0.

Reboot your device.

*************************************************** *************************************************** ***************************************************

THINGS TO REMEMBER :-

1. NEVER leave a blank space at end of any line otherwise the script won't work.

2. To know about more tweaks go to the cocore thread and see the second and third posts.

http://xdaforums.com/showthread.php?p=37782495

3. Download amd install script manager. Run the script through it. If it shows 0, then it means your script has no errors. If it returns any other number, it means the script has errors. (may be you left a blank space).

4. You can also tweak your governors. Read this thread to know various governor tweaks.

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

*************************************************** *************************************************** ***************************************************

;) :)