[Guide][init.d]How to run init.d scripts on boot + Best Battery Life

Search This thread

gershee

Senior Member
this is sick man! thanks so much to both sfhub and kobridge. gonna try out the script first cause I'm mobile.. thanks!

---------- Post added at 01:26 PM ---------- Previous post was at 12:34 PM ----------

not sure what i'm doing wrong...
i used sfhub's tool to add init.d support.
used the test script recommended in the OP to ensure it's working.
found the file in /data/local/tmp. so i thought i was all good..
added a script to mount /emmc/ to /external_sd/ using mount -o.
previously i was using smanager to auto run the script and the script works.
i verified this by checking before running it, nothing(no mount), and after, yes, mount work.
but when i put the script in /system/etc/init.d with 755 permission, when i reboot, the mount is not there.. i don't understand..
i even tried giving the file full permission in case i was messing up there, but nope.
then i run the script via smanager and my mounts show up..
anyone have any idea?
i even played with the filenaming but to no avail..
 
Last edited:

gershee

Senior Member
Try looking at your logcat, errors should have been sent there.

should i search for the name of the file? or do a search for init.d?
so sorry man but i've never actually used logcats, i do know what they are, but have never been in a situation that warranted perusing them.
should i reboot and just open the logcat as soon as the phone starts and just browse? maybe search for "/init.d"?

EDIT:
I've noticed this. the test script mentioned in the OP, while it does create the file in /data/local/tmp/, the file is blank. when I run the script through smanager(as su) the file has text in it. so it seems for some reason the script is not running properly? what am I doing wrong...
 
Last edited:

sfhub

Senior Member
Oct 23, 2008
5,350
7,231
added a script to mount /emmc/ to /external_sd/ using mount -o.
previously i was using smanager to auto run the script and the script works.
i verified this by checking before running it, nothing(no mount), and after, yes, mount work.
My goal was to make the Auto Root installed init.d support mirror as closely as possible the builtin init.d support in the repacked kernels.

Not all scripts that work from when Android is started up will necessarily work or work the same way when they are started as part of init.d because init.d runs much earlier in the boot process. If you try and mount or access something that isn't ready yet, then it can fail.

What you can compare to is whether something works with the builtin init.d support in the FD02+CWM-Rogue kernel vs the one from Auto Root. Those should perform the same or very similar because they are starting scripts at the same time during the boot cycle.
 

kobridge

Senior Member
Jan 10, 2012
1,710
3,460
Jacksonville, FL
Samsung Galaxy S22 Ultra
should i search for the name of the file? or do a search for init.d?
so sorry man but i've never actually used logcats, i do know what they are, but have never been in a situation that warranted perusing them.
should i reboot and just open the logcat as soon as the phone starts and just browse? maybe search for "/init.d"?

EDIT:
I've noticed this. the test script mentioned in the OP, while it does create the file in /data/local/tmp/, the file is blank. when I run the script through smanager(as su) the file has text in it. so it seems for some reason the script is not running properly? what am I doing wrong...

OK. I ran the test script as in my op section against init.d script and it ran ok.
(To make sure, I deleted previous output file). Just like I said in OP, you need to really careful when you create a file or edit. If you use the file editor from PC or use ES File explorer, there would be some special characters in the script file (hidden). This hidden characters are forgiven in SManager but not in shell script.
So, use some file editor something like root explorer text editor to create a shell script file.

For your convenience, I attached test script file that I just tested. Hope this help.
 

Attachments

  • 0test.zip
    223 bytes · Views: 34
  • Screenshot_2012-04-22-16-17-18.jpg
    Screenshot_2012-04-22-16-17-18.jpg
    27.6 KB · Views: 182
  • Screenshot_2012-04-22-16-17-42.jpg
    Screenshot_2012-04-22-16-17-42.jpg
    12.7 KB · Views: 169
  • Screenshot_2012-04-22-16-18-19.jpg
    Screenshot_2012-04-22-16-18-19.jpg
    8.7 KB · Views: 160
  • Like
Reactions: gershee

gershee

Senior Member
so i showed both my scripts. and the permissions.
and if you see the result of the test script, it does create a file, but 0kb with nothing in it.
and the other script does not mount.
when i run them through smanager they work(as su)..
i'm doing something simple that's wrong.. i tried reinstalling init.d support via sfhub's tool.. and reinstalled busybox..

6304ad96-70c3-9345.jpg

6304ad96-70d7-8424.jpg

6304ad96-70e3-6d2a.jpg

6304ad96-70ec-7481.jpg
 
Last edited:

kobridge

Senior Member
Jan 10, 2012
1,710
3,460
Jacksonville, FL
Samsung Galaxy S22 Ultra
To run the 0test script you don't need to run the sd mnt script. Move it to different location and try it again.

Edit : mine shows 108Byte file size. It means that you have one special character included in file (if you used the file in the zip file).
 
Last edited:

sfhub

Senior Member
Oct 23, 2008
5,350
7,231
there would be some special characters in the script file (hidden). This hidden characters are forgiven in SManager but not in shell script.
So, use some file editor something like root explorer text editor to create a shell script file.
The main issue is usually Windows uses CR-LF (Carriage Return + Line Feed) special characters to terminate a line.

Unix/Linux uses LF (Line Feed) to terminate lines.

Mac uses CR (Carriage Return) to terminate lines.

These special characters cause issues with scripts being interpreted properly. There is also a problem with certain versions where the native text is unicode, which is a multi-byte character set. These characters will look pretty messed up on a single-byte system.

I'm sure you've also taken unix log files and viewed them on windows and just seen a jumbled mess of characters. That is because the LF by itself is not seen as a signal for a newline in windows and basically the whole log file is one big line.

If you want to write your scripts on windows, I suggest you use a text editor which knows how to convert the CR-LF and LF or you use utilities that can convert. Personally I use emacs but I am very old school.

You can find the DOS2UNIX and UNIX2DOS utilities on this page:
http://www.bastet.com/

They will convert the CR-LF and LF so the files can be read properly.

Use DOS2UNIX if you write your script in notepad, then want to move it to Linux/Android. Use UNIX2DOS if you have a file generated on Linux/Android and you want to view it in Notepad.
 
Last edited:

gershee

Senior Member
The main issue is usually Windows uses CR-LF (Carriage Return + Line Feed) special characters to terminate a line.

Unix/Linux uses LF (Line Feed) to terminate lines.

Mac uses CR (Carriage Return) to terminalte lines.

These special characters cause issues with scripts being interpreted properly. There is also a problem with certain versions where the native text is unicode, which is a multi-byte character set. These characters will look pretty messed up on a single-byte system.

I'm sure you've also taken unix log files and viewed them on windows and just seen a jumbled mess of characters. That is because the LF by itself is not seen as a signal for a newline in windows and basically the whole log file is one big line.

If you want to write your scripts on windows, I suggest you use a text editor which knows how to convert the CR-LF and LF or you use utilities that can convert. Personally I use emacs but I am very old school.

You can find the DOS2UNIX and UNIX2DOS utilities on this page:
http://www.bastet.com/

They will convert the CR-LF and LF so the files can be read properly.

Use DOS2UNIX if you write your script in notepad, then want to move it to Linux/Android. Use UNIX2DOS if you have a file generated on Linux/Android and you want to view it in Notepad.

i've kind of used both mac - text edit and root explorer, so there could be some truth to this. i'll try using the above posted zip.. thanks guys.. appreciate the help.. just frustrating..
 

sfhub

Senior Member
Oct 23, 2008
5,350
7,231
so i showed both my scripts. and the permissions.
and if you see the result of the test script, it does create a file, but 0kb with nothing in it.
Can you use the 0test file kobridge attached to his post above? I verified that it has the proper LF for unix (and I ran it on my phone and received output)

One symptom of CR-LF and LF problems is when the first command runs but nothing after it will run because the shell interpreter thinks there is an error with the run-on line and the unexpected carriage return.

That might be what is happening in your case, because when you "touch" a file, you create a 0 length file if the file isn't present and if it is, it updates the time stamp. That seems to fit your symptoms.
 

gershee

Senior Member
OK. I ran the test script as in my op section against init.d script and it ran ok.
(To make sure, I deleted previous output file). Just like I said in OP, you need to really careful when you create a file or edit. If you use the file editor from PC or use ES File explorer, there would be some special characters in the script file (hidden). This hidden characters are forgiven in SManager but not in shell script.
So, use some file editor something like root explorer text editor to create a shell script file.

For your convenience, I attached test script file that I just tested. Hope this help.

OK. used your zip. extracted file. put in /system/etc/init.d and changed permissions to 755. rebooted. same thing..:what:
think I'm gonna wipe and start fresh. I dunna. I'm in codename with fd19 kernel.
here's screenies..
6304ad96-72eb-b9e7.jpg

6304ad96-72f5-e124.jpg


its weird. even when I delete the file in root explorer, if I refresh the directory it pops up with 0kb immedietly.. wth is going on..

---------- Post added at 05:09 PM ---------- Previous post was at 05:07 PM ----------

Can you use the 0test file kobridge attached to his post above? I verified that it has the proper LF for unix (and I ran it on my phone and received output)

One symptom of CR-LF and LF problems is when the first command runs but nothing after it will run because the shell interpreter thinks there is an error with the run-on line and the unexpected carriage return.

That might be what is happening in your case, because when you "touch" a file, you create a 0 length file if the file isn't present and if it is, it updates the time stamp. That seems to fit your symptoms.

ahhhhh!
just looked in /etc/init.d (not /system) and i found the file also!!
i must have tried doing this last night before bed!!
deleted the file and rebooting now..

EDIT:
nope same thing. guess the system/etc/init.d files are copied to /etc/init.d on boot..
 
Last edited:

sfhub

Senior Member
Oct 23, 2008
5,350
7,231
its weird. even when I delete the file in root explorer, if I refresh the directory it pops up with 0kb immedietly.. wth is going on..
Well either there is something recreating the file or the file is being prevented from being deleted. When the new file comes up, does it have the same timestamp or is it a newer timestamp?

If the former, then it is being prevented from being deleted. If the latter, then it could be recreated or there is some process that keeps touching the file.

---------- Post added at 09:12 PM ---------- Previous post was at 09:11 PM ----------

ahhhhh!
just looked in /etc/init.d (not /system) and i found the file also!!
i must have tried doing this last night before bed!!
deleted the file and rebooting now..
/etc is usually a symbolic link to /system/etc

so basically /etc/init.d is the same directory as /system/etc/init.d (I don't mean same as in a copy, I mean they are physically the same directory)

---------- Post added at 09:16 PM ---------- Previous post was at 09:12 PM ----------

BTW I think it is worth looking into why the file keeps reappearing. It could give some clues what is going on.

Is it possible both SManager and init.d are trying to run the same script and they are stomping on each other?
 
  • Like
Reactions: gershee

gershee

Senior Member
Well either there is something recreating the file or the file is being prevented from being deleted. When the new file comes up, does it have the same timestamp or is it a newer timestamp?

If the former, then it is being prevented from being deleted. If the latter, then it could be recreated or there is some process that keeps touching the file.

---------- Post added at 09:12 PM ---------- Previous post was at 09:11 PM ----------


/etc is usually a symbolic link to /system/etc

so basically /etc/init.d is the same directory as /system/etc/init.d (I don't mean same as in a copy, I mean they are physically the same directory)

1st, yes same timestamp. 22 apr 12 14:59:00
2nd, yes this makes sense.. i though it was something like this, i was just hoping i found the mistake i must have made..
3rd, at first i tried using the new script in the OP to run startup scripts, didn't work so i moved on to sfhub tool.. i'm on aosp rom, does that matter?
must have mucked something up.. everything was running so smoothly too just i'm too OCD to not get this working.. might have to wipe.. :(
 

kobridge

Senior Member
Jan 10, 2012
1,710
3,460
Jacksonville, FL
Samsung Galaxy S22 Ultra
OK. used your zip. extracted file. put in /system/etc/init.d and changed permissions to 755. rebooted. same thing..:what:
think I'm gonna wipe and start fresh. I dunna. I'm in codename with fd19 kernel.
here's screenies..
6304ad96-72eb-b9e7.jpg

6304ad96-72f5-e124.jpg


its weird. even when I delete the file in root explorer, if I refresh the directory it pops up with 0kb immedietly.. wth is going on..

---------- Post added at 05:09 PM ---------- Previous post was at 05:07 PM ----------



ahhhhh!
just looked in /etc/init.d (not /system) and i found the file also!!
i must have tried doing this last night before bed!!
deleted the file and rebooting now..

EDIT:
nope same thing. guess the system/etc/init.d files are copied to /etc/init.d on boot..

OK. Let me give you the last tweak on your 0test file. Open this file using root explorer text editor.
Pleace the cursor on every end of line. If there is a space between the last character of the line and cursor, remove the space between the last character and cursor (using backspace key). Move forward until last line and do the same thing. I believe this is simply the CR code inserted into your script.
Save the script and you will see the file size 108 Byte. Be sure that you remove the 0test.bak file from /system/etc/init.d directory.
 

sfhub

Senior Member
Oct 23, 2008
5,350
7,231
1st, yes same timestamp. 22 apr 12 14:59:00
2nd, yes this makes sense.. i though it was something like this, i was just hoping i found the mistake i must have made..
3rd, at first i tried using the new script in the OP to run startup scripts, didn't work so i moved on to sfhub tool.. i'm on aosp rom, does that matter?
must have mucked something up.. everything was running so smoothly too just i'm too OCD to not get this working.. might have to wipe.. :(
Is your AOSP using a repacked kernel or the stock kernel?

If the former, or you don't know, could you post the /init.rc file?
 

gershee

Senior Member
---------- Post added at 09:16 PM ---------- Previous post was at 09:12 PM ----------

[/COLOR]BTW I think it is worth looking into why the file keeps reappearing. It could give some clues what is going on.

Is it possible both SManager and init.d are trying to run the same script and they are stomping on each other?

i looked through smanager and tried to check make sure everything was disabled.. and i uninstallled it.. still nothing..
so weird.. something is fubar..
weird time stamp. constantly being created..
i dunna.. maybe have to wipe..
some small little mistake is screwing this up.. like stuck in a loop halfway through the script.. but where.. wtf!!
guess it doesn't matter.. ill just wipe when my gf leaves and i have some time.. frustrating when i can't stomp out this little biznatch problem...

---------- Post added at 05:26 PM ---------- Previous post was at 05:24 PM ----------

OK. Let me give you the last tweak on your 0test file. Open this file using root explorer text editor.
Pleace the cursor on every end of line. If there is a space between the last character of the line and cursor, remove the space between the last character and cursor (using backspace key). Move forward until last line and do the same thing. I believe this is simply the CR code inserted into your script.
Save the script and you will see the file size 108 Byte. Be sure that you remove the 0test.bak file from /system/etc/init.d directory.

i checked, it's 108Bytes, directly from your zip. just moved and changed permissions..

Is your AOSP using a repacked kernel or the stock kernel?

If the former, or you don't know, could you post the /init.rc file?

stock kernel. fd19, modified for aosp of course.. the one that came baked in..

it seems like somewhere early early on i messed up and something is looping recreating the same 0byte file. something is screwed..

---------- Post added at 05:30 PM ---------- Previous post was at 05:26 PM ----------

think i've wasted enough of both of you kind sirs time.
obviously it's a bug on my end and something small and clearly overlookable..
i'll just wipe this bad boy when i get a chance and start over i guess.. :/
 

Top Liked Posts

  • There are no posts matching your filters.
  • 27
    How to run init.d scripts on Boot- 4/26/12

    Before starting this guide, I'd like to say "thanks to many Devs" on this forum.

    [Update] sfhub just added init.d support function into his auto root tool at http://xdaforums.com/showthread.php?t=1342728
    If your kernel does not support init.d, then use his tool to add init.d support without flashing a new kernel.
    Just in case you only want to have a script which invoke the init.d scripts, check the second post in this thread.

    4/29/12 sfhub improved his auto root tool to support some other kernels, those are enabling init.d through different .xc files.
    Stock kernels and some repacked kernels are supporting init.d scripts through init.xc and/or install-recovery.sh but some other repacked kernels are supporting init.d scripts running through different .xc files. So, sfhub made some modification on his script. Because he's adding a new install-recovery.sh file into /system/etc folder, if there's a existing install-recovery.sh file at the same location, the existing install-recovery.sh file will be replaced by his previous version of Auto Root Tool. To prevent the replacing existing install-recovery.sh file with his same named install-recovery.sh file which supports the init.d scripts, his tool now creates a copy of old file and create a new one. Old install-recovery.sh file will be named as install-recovery-orig.sh.

    If you just want to simply enable init.d support without using sfhub's tool, then download the new-install-recovery.zip file from my second post and unzip it. If there's any existing install-recovery.sh file and it's not related to init.d support, then rename it to install-recovery-orig.sh and move the unzipped file to same directory (/system/etc). Assign the file permission 550 (r_xr_x___). New install-recovry.sh file will execute the init.d scripts (if it's there) and old install-recovery-orig.sh (if it's there) during the boot.
    4/30/12 I've modified his install-recovery.sh file (new-install-recovery.zip, attached) to use the default busybox command. If you don't have busybox installed on your phone, you will also need to download attached busybox.zip and unzip, place into /system/xbin folder with permission 755.


    Update2 I'm uploading my tweaks again. Based on my test, this tweak works much better and extended my battery life a lot more. In this battery tweak, the max cpu speed would set to 1000000, but normally it would run with 800000 or less. Based on my test, this works great and no fc, no random reboot. If you really want to extend your battery life, then test your battery life with this tweaks. (tweak file is attached in second post). My test was done under FD19 and FD24 Stock Roms

    Update3 Found that Camera app kept freezing, fc, and made system reboot if max CPU frequency is set to under 1Ghz. So because of this app, had to keep max cpu speed to 1Ghz when the phone is in awake mode. Uploading new tweak files.

    Upon his tools update, my guide in here would be only for some limited people who just want to test the scripts or want to selectively run the scripts during the boot. For example, if you have 10 scripts in init.d and just want to selectively run from those, you can use SManager.

    Issue: /system/etc/init.d scripts does not run automatically during the boot

    Details:
    Rogue Repacked Kernels are started supporting init.d scripts during the boot and many custom roms are now including the scripts in /system/etc/init.d. But usually repacked kernel is not ready when the new rom comes out and we need to use old version of repacked kernel to get the init.d support.

    How to test: (only applicable to the phones having Repacked Kernel and supporting init.d scripts. For the stock kernel, I’ll explain it later how to run it during the reboot)

    It seems like Rogue Repacked kernel allows the init.d script running thru /init.rc. init.rc file is part of bootimage and this file is over-written everytime when the system reboots. So, editing this file is not possible. Only the way editing this file would be by extracting bootimage and making modification, repact the kernel image.

    Running the init.d script from init.rc is,

    (FD02)
    # Run init.d scripts
    service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
    class main
    user root
    group shell
    oneshot

    (before FD02)
    # Run init.d scripts
    service sysinit /system/bin/logwrapper /sbin/run-parts /system/etc/init.d
    class main
    user root
    group shell
    oneshot

    So, if you are not sure whether a script in /system/etc/init.d is running on boot, you can simple add a script into this directory.
    Create a script using text editor in root explorer (don’t use ES File Explorer to edit the file). The character set used in es file explorer causes a problem to run the script. This is very important thing to remember. Even syntax and everything looks correct but the script would not run if it includes some hidden character which is not supported by shell. Be sure to use the editor supported by the shell.

    Example)
    Create a file 0test into /system/etc/init.d

    #!/system/bin/sh
    touch /data/local/tmp/initd_test.txt
    echo "Hello Android" > /data/local/tmp/initd_test.txt

    File permission is 755.
    If there’s some scripts in /system/etc/init.d, then backup those files to your sdcard for later use. Sometimes, it’s hard to find the script running result and that’s the reason why I’m testing it by simply writing a file.
    If you are done with creating a file, reboot your phone and go to the /data/local/temp directory.
    If the initd_test.txt file is there and content is “Hello Android”, then it means that any other scripts in the init.d directory will be executed during the boot and you don’t need to follow this guide any more.

    Workaround to run the init.d scripts during the boot:
    This workaround is nothing to do with Repacked or stock kernel. In another words, this workaround would work on both repacked and stock kernel.

    [Update] Again, if you don't need to test the scripts and only want to run someone else's tested script, then you can simply use sfhub's auto root tool to add the init.d support option.

    What you need:
    Download Script Manager – Smanager app from Google play store (it’s free) and install it.
    https://play.google.com/store/apps/details?id=os.tools.scriptmanager&hl=en
    You must have busybox installed and have su permission.

    Steps to test the existing scripts:
    1. run Script Manager and open 0test script. Click the su icon and run.
    2. SManager will show the ‘exit code’ and any messages from the script. Be sure that you got the exit code ‘0’.
    3. Go to the directory /data/local/temp and check if file is create and has ‘Hello Android” in it.

    SManager is a great tool to verify the script syntax or any errors during the run. So if you have any init.d scripts, you can test those scripts before you start to run during the boot (this may prevent any boot loop or any issue).

    How to run the scripts during the boot using SManager:

    Steps to run the scripts during the boot:
    1. Test the scripts out completely before start to run on boot.
    2. From the SManager tool, select su and boot icon. Exit the application and reboot the phone.
    3. If you did not change the SManger config, then you will see the SManager log after the boot. Check if everything is fine. If the scripts run OK many times without any issue, then you can uncheck the option showing SManager log after the boot.

    This tool is great because you can run the scripts on both stock and repacked kernel. Also, you don’t need to put the scripts into /system/etc/init.d. You can place those files in any locations.

    Using this tool, currently I’m running Calk’s init.d tweaks without any problems.
    Calk’s tweaks are included in his FD02 Rom.
    My current phone is
    D710 + FD19 Stock Kernel + FD19 Rom + FD19 Modem with init.d scripts running

    ** This is an initial version and I’m going to add some more stuff in this thread. If you like this info and if this info is helpful for you in any way, please leave your feedback and consider to buy me a beer! **:D:D
    ** Because of sfhub's great job, it seems like I'm done in here. I hope you had enough information that you wanted **
    11
    What makes your phone even better?

    If you use the stock kernel, then you may want to replace the build.prop and gps.conf files with attached files (unzip it).
    These files are based on Calkulin's and Agat's Rom. Because I modified the files based on my demand, you may also want to change the files based on your situation.
    Because these files are not changed after the reboot, you can replace these files with any tweaked files that you want to use.
    (these files won't be changed by Kernel change but flashing rom will replace all these files)
    You can use gps.conf and init.d scripts with any rom but build.prop is dependent on the rom. This build.prop is based on FD19. So, be sure that you need to modify it if it's used on different rom.

    Attached file also includes the init.d scripts. These scripts are also same as on Calk's FD02 init.d scripts. I only changed few default option based on my requirement. So, if you want to original init.d scripts, please download Calk's FD02 v1.4 rom and extract the init.d scripts.

    Again, all thanks should go to Calkulin and Agat if you use their tweaks.
    Update1: Many thanks to sfhub for his auto root tools including init.d support

    Update2: I've added one more script file (attached) which can be used alone with previous one or standalone. All these tweaks are tested on my phone and working version. If you need to edit, be sure that it's properly edited and tested before adding it to the init.d.

    Update3: If you just want to use the script which runs init.d scripts during the boot without running sfhub's auto root tool, you may download the third attached file in here. Download, unzip it. Place the install-recovery.sh file to /system/etc with permission 550. This script will be executed by init.rc during the boot if you are on the stock kernel and this script will run the init.d scripts. If you are on the repacked kernel, which supports the init.d, this install-recovery.sh wouldn't do anything (init.d script will be executed by init.rc instead of this install-recovery.sh)
    4/26/12 sfhub's auto root tool is updated. Check the updated information from top thread update section. http://xdaforums.com/showpost.php?p=25120371&postcount=1

    Update4:I've found that some attached tweaks is preventing the ondemand governer changes. So, until I find the issue and fix it, I dropped the attached files (you are still able to download the install-recovery.sh script).
    edit:4/24/12 I fished testing Calk's CPU governor scripts and reposting it with minor changes. Adding my tweaks back to this post.

    Update5: Extreme battery saver tweaks
    I added one more zip file which can be used to save the battery life a lot more. If you are really concerning about your battery life and want to extend it, try this new set of tweaks. It's based on Calk's tweaks (I modified the values) and some other tweaks. If you want to use this, I highly recommend you to back up your old init.d files and replace those with the tweak files in init.d.zip files (unzip and move the files to /system/etc/init.d).

    [Guide] How to mod Calk's 2cpufreq_governor
    2cpufreq_governor script is quite simple/handy tool and it could replace many CPU governing tools. 2cpufreq_governor script can be used to define the CPU governor and change the options on selected governor.

    1. The governor selected in this script works as a master governor to control the cpu.
    Select the governor which one you want to use. In here, I used 'ondemand' as a default (value "1"). Only one governor works as master governor. If you want to use different governor, change the governor's value from "0" to "1" and reset the old governor's value "0".

    2. Govenors
    Conservative (default governor on original Calk's tweak)
    This governor uses more power and faster than ondemand. Under this governor, the following values are set.

    SAMPLING_RATE="35000"
    UP_THRESHOLD="75"
    DOWN_THRESHOLD="35"
    FREQ_STEP="15"

    If your kernel does not support this governor, it won't be enabled.

    ondemand and lazy
    If one of these governors is selected then the following values will be set -
    SAMPLING_RATE="50000"
    UP_THRESHOLD="75"

    interactive Performance Powersave smartass govenors
    Just enables the governor. No value changes by these tweaks.

    So, for most of you, only the thing you can do with this script is, just selecting the governor whichone you are going to use. If you want to change the detailed options then you can make those changes using 3cpufreq_screestate_scaling script.

    [Guide] How to mod Calk's 3cpufreq_screenstate_scaling
    3cpufreq_screenstate_scaling script can be used to decide how you want to deal with different phone states. Basically your kernel automatically controls most of it but if you want, you can also have a control over it using this script.
    This script can be used as standalone or in conjunction with 2cpufreq_govenor script. The difference between these two scripts are , 2 works as a master governor and 3 is only based on the phone's state.

    The things that you need to decide or know before using this script:

    awake mode
    If the phone is on "awake" status then script uses the "ondemand" cpu governor and you can change the governor as you want (AWAKE_GOVERNOR). Battery save profile only can be used during this "awake" mode.
    If the BATTERY_PROFILES_ON is set to "1", then script will use the various governor based on the phone's state and battery level (remaining percentage). For the most of the user, don't need to change the Calk's default settings. But in attached Calk's script, I changed a little to use only ondemand governor for any battery level.
    This change would be benificial for the user who is frequently use the phones (not in sleep or lazy mode). If you want to use Calk's original script, you can extract the script from Calk's FD02 Tweaked rom.
    As Calkulin already mentioned on this thread, if you are already using any CPI Tweak app like ANDROID OC, Over Click widget, Quick Lock, or SETCPU, then this script won't do anything during the awake mode and sleep mode.

    Battery profile 1 and battery profile2 define how your phone reacts based on the battery level and I changed the script a little to use the same ondemand governor regardless the battery level. Regardless of battery level, this script will force to use the maximum 1000000 CPU frequencies.
    If you want to differenciate the governor, you can change the governors, max CPU speed, and battery level values based on your demand. Battery profile 1 defines which governor will be used when battery level is above the value in BATTERY_PROFILE_1. Battery profile 2 defines which governor will be used when the battery level is below the value in BATTERY_PROFILE_2.
    When the battery level is between BATTERY_PROFILE_1 and BATTERY_PROFILE_2, then the values defined in MAX_CPU_SPEED, MIN_CPU_SPEED and GPU_SPEED will be used.

    sleep mode
    When your phone goest to sleep mode, this script defines which CPU governor could be used. If you want to change the default CPU governor values during the sleep mode, keep the SLEEP_GOVERNOR_ON value to "1". Otherwise, set the value to "0" (this is Calk's default).
    In there, the CPU Max speed will be changed to 800000 to save the battery during the sleep mode. But if you have any issues during the sleep mode, your can increase the SLEEP_MAX_CPU_SPEED value. If you want to save more battery, then you can decrease this value and this is what I'm goint to test for the next experimental test.

    This is not a complete tutorial for Calk's CPU tweak but I just wanted to give you the idea how CPU tweak works. For any time, if this tweak does not work as you intended, you can change the values and/or increase/decrease the frequencies and threshold values.
    The attached tweaks work on FD19 stock rom and kernel without any issues so far. But I'm not sure if it works on any other repacked kernel and customized roms. Before applying any tweaks, I recommend you to make full nandroid backup and test it. The risk of using these tweaks would be minimal at least you stay on with the values those are already tested and proven.

    (attached snapshot shows the CPU times based on two modified Calk's tweaks)
    (the last two snapshots are based on my extreme battery saver tweaks - CPU time & battery usage over about 10 hours)
    6
    I included an Experimental feature, in the Auto Root package, to add init.d support to any stock kernel

    I was wondering if anyone could help test it out:
    e4gtauto-lite-sfx.exe

    You need to be rooted.

    Just choose Option E (extra options), then Option E (Add init.d support)

    I've tested it on FD19 and EL29 and stock ROMs.

    I have *not* tested on any ROMs other than stock. It doesn't modify your kernel, so I don't anticipate anything bad would happen.

    I've also tested it in the case where you start with stock kernel, add init.d support, then later install a repacked kernel with builtin init.d support. In that case this will defer to the builtin init.d support in the kernel so the init.d scripts are not run twice. What that means is you don't need to remove this if you should later switch from stock kernel to stock kernel+CWM. If you want to remove it, just choose Option F (Remove init.d support)

    If you install a new ROM, then you will need to re-run this option to add init.d support (if the included kernel does not have builtin init.d support)
    5
    I know that I threw a script in init.d and set permissions to rwx/rwx/rwx and it worked fine. I'm not all that savvy on what 666 and 755 translate to in the terms if rwx but if set to rxw on all three it works like a charm. Sfhub or OP. I know its a little off topic but since you seem to know. How is that translated from rwx to ###

    r w x (4 2 1)

    owner group other

    So if you wanted the owner to be able to read, write, and execute the file and everyone else have no permissions allowed, you would do "chmod 700" (that 7 is comprised of 4+2+1)

    If you wanted owner, group, other to have read,execute permission (but not write permission) "chmod 555" (5 being 4+1)

    755 would be rwxr-xr-x
    5
    Yes


    Yes


    The scripts you run should have "execute" permission set. run-parts in busybox will only run scripts with execute permission set. run-parts is what the repacked kernels are using, so this is not a new requirement

    I notice you set your scripts to "chmod 666" so that might be why they aren't running. Try changing to "chmod 755".


    Either
    1) the permissions on your scripts are not set to have "execute" permission
    2) you don't have busybox installed in /system/xbin/busybox
    3) you are not running a stock kernel nor stock+cwm nor stock+cwm-rogue

    My guess is 1 or 2.

    With some feedback with testing of custom ROMs, in the latest upload, I actually removed the requirement for busybox to be installed, so if that is your issue, just download the newer one (the link in the original post was updated but I'm providing it here for convenience)

    e4gtauto-lite-sfx.exe

    Working like a charm without the SManager app. Permission set to 755. I'll update my thread with this info.
    Thank you guys!