• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root ** Init.D Scripts ** for Freedom Kernel

GameTheory

Android Expert
Init.D Scripts For Freedom Kernel

What is init.d support?

Init.D scripts only work with the latest versions of my Freedom Kernel in both Lite & Overclocked versions.

This thread will be for posting any init.d scripts and for troubleshooting them. There are many init.d scripts on the web. Just google these search terms, init.d tweaks or init.d scripts. You can tweak many aspects of the kernel and system with init.d scripts.

I wrote a script to get you started called 00cpu located in the new directory you will have after flashing the latest version of Freedom kernel (/system/etc/init.d). It will allow you to adjust the following...

  • Governor
  • CPU clock speed
  • Scheduler
  • Enable core 2 at all times
To enable an init.d script just place it in the init.d folder and reboot your phone. That's it!

You can edit the script on your phone with a text editor like the one in root explorer or on a PC (PC recommended). You can tweak this script how you like, kind of like your own profile.

Here's a look at the script I wrote that's in your init.d folder. The things that are in green can be edited to your liking. Make sure to read the directions within the script (do not skip directions)...

#!/system/bin/sh

# CPU Tweak Init.D Script by GameTheory
#
# You can tweak your CPU with this script the same as with a CPU app, but this script is recommended. This gives direct CPU tuning without the need for a CPU app. This would eliminate all chances of bugs that would come from a CPU app like settings not sticking on boot etc etc.
#
# INSTRUCTIONS - You can change any value within the two (" ") signs. For further instructions read the top line for each block of lines. At the bottom of this script I will list all the Clock frequencies, schedulers, and governors that are available to you in Freedom Kernel.

## GOVERNOR
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

## CLOCK MAX - Remove the (#) from next 6 lines to enable clock max control.
#chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#echo "1512000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
#chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
#echo "1512000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
#chmod 444 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq

## CLOCK MIN - Remove the (#) from next 6 lines to enable clock min control.
#chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
#echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
#chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
#chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
#echo "384000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
#chmod 444 /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq

## SCHEDULER - Remove the (#) from next 3 lines to enable scheduler control.
#chmod 666 /sys/block/mmcblk0/queue/scheduler
#echo "cfq" > /sys/block/mmcblk0/queue/scheduler
#chmod 644 /sys/block/mmcblk0/queue/scheduler

## CORE 2 - Remove the (#) from next 3 lines to enable 2nd core at all times.
#chmod 666 /sys/devices/system/cpu/cpu1/online
#echo "1" > /sys/devices/system/cpu/cpu1/online
#chmod 444 /sys/devices/system/cpu/cpu1/online

## All available clock frequencies for use in the lines above to set the clock min or max.
# 384000 432000 486000 540000 594000 648000 702000 756000 810000 864000 918000 972000 1026000 1080000 1134000 1188000 1242000 1296000 1350000 1404000 11458000 1512000 1600000 1700000 1800000

## All available governors for use in the lines above to set your default governor.
# msm-dcvs conservative ondemand userspace powersave interactive performance intellidemand smartassV2 superbad

## All available schedulers for use in the lines above to set your default scheduler.
# noop deadline cfq
After any script change you make reboot to enable changes.

Note:
If your using a CPU app then it will override the init.d script. That is ok though, this allows you to use the CPU app along with the script if you choose.
 
Here's just a few of the many things you can tweak and add with init.d scripts. I've seen all of these on the web...

  • add tethering
  • add apps to SD
  • strict minfree handler tweak
  • internet speed hack tweaks
  • kernel tweaks
  • vm management tweaks
  • battery tweaks
  • remove journalism
  • increases cache size and increase speed
  • SD card speed tweak
  • Defrags database files
  • Move dalvik-cache to cache partition
  • Disable normalize sleeper
It's as simple as placing the init.d script in the init.d folder and rebooting your phone to enable the script.
 
Nice :) It really is 'freedom' kernel; so many tweaks and stuff we can do with this phone and the kernel :)

Thanks!!
 
Anybody know if I need to remove "done" from this? I feel like it is not supposed to be there but I am not sure

Code:
#!/system/bin/sh

LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done

Edit: My download speeds dropped drastically after using this. This might work for others though.
 
Anybody know if I need to remove "done" from this? I feel like it is not supposed to be there but I am not sure

Code:
#!/system/bin/sh

LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
The word "done" belongs there. That script was written a few years ago by an XDA dev and has been confirmed to work. Just check the values of those files to see if they change after you apply the script.
 
Okay, thanks for your help GT. If they change then would it be bad? Sorry for dumb questions but I just want to be sure because I never mess with files like this
 
The script forces the rotational value to go from 1 to 0 and read ahead from 128 to 2048. Your phone shouldn't end up bootlooped or anything like that. You'll just have to see if you feel a difference in performance. If you don't like the results, just delete script and reboot and all goes back to normal.

What I do when testing a new script... I make a flashable delete zip. This way if I get into a bootloop or brick, then I button combo into recovery and flash the zip to delete said script which would allow me to boot again. Sshhhh don't tell anyone my secret lol. :rolleyes:
 
Now you're just showing off :D That is a smart trick, I honestly would have never thought of that. I usually end up just re-flashing the ROM if I am ever in a situation like that (I am a noob :D )
 
Internal SD to External SD Init.D Script

You must have the latest version of Freedom Kernel Overclocked or Lite.

Here it is. I've never used it, but seems pretty straight forward...

Make sure you read read read!!! Did I mention to read lol?

[SCRIPTS]CronMod-INT2EXT (updated 02/28) - xda-developers

Note:
You will need an EXT4 partition on your external SD. You need a ratio of 5 to 1, for example: If you have 1gb of internal SD space then you will need 5gb of external SD space in your EXT4 partition.

Here's a tutorial to help you partition your external SD... Link Here
 
I can't find the script
When you flash the latest version of Freedom kernel you will get a new directory to support the init.d feature in the kernel...

/system/etc/init.d

Any scripts you wish to use just place in there and set permissions to script to...

rwx
rwx
rwx
 
Back
Top Bottom