Can't add minfree script to init.d - General Questions and Answers

I want to add custom minfree values at boot, but init.d doesn't execute the script. init.d is working and other scripts (test ones) works, but they execute in /data. Minfree executes in /system. Would that matter?

Bump!
le : I installed minfree manager and tick 'set on boot'. The script in init.d was created but never executed. What happens?

Related

[Q] My init.d script does not work, why?

Hello,
I want to change my voodoo colors at boot, so I made a script in init.d folder:
Code:
#!/system/bin/sh
echo 2447339790 >/sys/devices/virtual/misc/voodoo_color/red_multiplier
echo 2159029280 >/sys/devices/virtual/misc/voodoo_color/green_multiplier
echo 2782492160 >/sys/devices/virtual/misc/voodoo_color/blue_multiplier
echo -14 >/sys/devices/virtual/misc/voodoo_color/red_v1_offset
echo -17 >/sys/devices/virtual/misc/voodoo_color/green_v1_offset
echo -18 >/sys/devices/virtual/misc/voodoo_color/blue_v1_offset
And here is my init.d folder : http://i.imgur.com/nhkdy.png , 99voodoo is my script.
When I paste this codes to android terminal emulator, it is working flawlessly.
But it does not work in init.d folder. Tried different roms which support init.d scripting, but no luck.
What is wrong with it? Can anyone help?
Thanks.
I had the same issue with couple of kernels not sure why im prety sure they even support (Eugene and glados)
you have to set full permissions on the script also but still didn't work for me
I gave up and just used ROM toolbox and made it run at startup works no problem
There must be a solution. What am I doing wrong!?
Do you have Busybox installed?
Hostile89 said:
Do you have Busybox installed?
Click to expand...
Click to collapse
Yes, preinstalled with the rom I've been using:
http://forum.xda-developers.com/showthread.php?t=1397358
features "root, busybox, zipalign, Bash, init.d scripts ... etc".
Any help? No solution?
What is your ROM and kernel combination?
I was using Aosp+ Rom and ICUP-Speedy-3 kernel.
Now, I have just flashed CyberGR rom. Comes with GLaDOS 2.7 kernel. Feature list says "Init.d scripts support", but no luck for me. My script doesn't work with this rom too. What is wrong with it :S
I found the solution.
I was trying to move my script to init.d folder manually via RootExplorer app.
But pushing the same file via adb just worked.
Thanks to this: http://forum.xda-developers.com/showthread.php?t=1424032

[Q] Init.d support

Can anyone confirm that UC V9 kernel has proper support for init.d scripts? I have tried several scripts and checked the values through terminal emulator and it seems that none of the scripts are executed. I'm on stock KPQ with UC V9 kernel.
Thanks a lot!
I can't test it because I'm not currently using UC kernel, but are you sure that those scripts are executable or that there aren't other scripts that override your settings? When I used it (an older version) they worked.
Code:
ls -l /etc/init.d
This will show a list all your scripts with their permissions. They should be
Code:
rwxr-xr-r
Or try to execute one of the scripts and see if the values you want to change effectively change.
UC kernel V9 has support for init.d scripts! As they said.
And, I did test it with a older version!
Sent from my I9100 using XDA app
I've tried repeatedly and finally I've realised that it was the scripts that were not working. UC V9 kernel supports scripts seemlessly via /system/etc/init.d.
Thank you guys for your replies!

[MOD] EZ InitD - init.d the EZ way !!

Root IS required !!
This mod will add init.d support to any rom even stock roms without editing the ramdisk. Instead it uses the post_boot.sh file that is in most if not all roms. It should work on most devices, if it does not work on yours please look in /system/etc and post the name of the file that contains "post_boot.sh".
This mod has been tested on the OneX and OneS.
To use just flash in recovery and add your favorite scripts to init.d.
For devs:
To add this method to your rom simply edit the post_boot.sh file and add this line at the bottom:
Code:
/system/etc/init.d/*
Easy right ? Suprised it hasn't been done before, well at least that i know of.
All files in init.d will be executed at boot just like regular init.d. You can also manually add the line and make it whatever directory you want.
Download:
http://goo.im/devs/smokin1337/Mods/EZ-InitD.zip
reserved.....
I did something similar to the Garminfone to give it init.d support. One question, have you considered using the runparts command (in busybox I believe) to execute the scripts. That is the standard way of doing it. You can also use logwrapper to have it output to logcat.

[Guide] {Noob friendly} How to create init.d scripts

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
Code:
#!/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
Code:
echo "smartassv2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
your script should look like this,
Code:
#!/system/bin/sh
echo "smartassv2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
To set deep sleep to 4 script should be,
Code:
#!/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://forum.xda-developers.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://forum.xda-developers.com/showthread.php?t=1369817
*************************************************** *************************************************** ***************************************************
RESERVED
Definitely useful. Thanks a lot..
Thanks for this tutorial !!!
Sent from my GT-I9070 using xda app-developers app
Good
:good::good: thank you, very helpful
anantttt said:
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
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
your script should look like this,
To set deep sleep to 4 script should be,
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://forum.xda-developers.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://forum.xda-developers.com/showthread.php?t=1369817
*************************************************** *************************************************** ***************************************************
Click to expand...
Click to collapse
I'm having a bit of trouble trying to figure out how into save a script for init.d..
Do I save it as a .sh script?
If you take a look at Step 2 you can read this:
"Remember, the script should not have any extentions like .txt or .sh. There should be no extentions."
:good
Those commands only changes a specific parameter, what if you want to add something to ie. build.prop. Would you still use echo?
ie. echo "something" >> /system/build.prop
fusk said:
Those commands only changes a specific parameter, what if you want to add something to ie. build.prop. Would you still use echo?
ie. echo "something" >> /system/build.prop
Click to expand...
Click to collapse
Yes, we have to use echo to add something to build.prop but not at every boot...
The lines in the build.prop are still available after boot too..
So only once we have to do that....
If they changes i.e., the line exists but prop value changes then we have to use
Code:
setprop <prop>=<prop_value>
HemanthJabalpuri said:
Yes, we have to use echo to add something to build.prop but not at every boot...
The lines in the build.prop are still available after boot too..
So only once we have to do that....
If they changes i.e., the line exists but prop value changes then we have to use
Code:
setprop <prop>=<prop_value>
Click to expand...
Click to collapse
Thanks.
I had issues getting it to stick after reboot, the line i added disappeared every time. Wanted to try an init.d script and see if that did the trick. I havn't used it before so wanted to be sure about the command. But i does not appear to have worked.

Universal Init.d

If you would like access to add init.d support which allows you to execute scripts upon bootup you can use "Universal Init.d" to do so. https://play.google.com/store/apps/details?id=com.androguide.universal.init.d&hl=en
Upon bootup any scripts in /etc/init.d will be executed.

Categories

Resources