Impossible to get the init.d support in ramdisk - Nexus 5 Q&A, Help & Troubleshooting

Hello guys!
I am not new in the Android and Nexus world but at this time I need some help.
I am used to root any Nexus phone in this way:
1. Put su, daemonsu, busybox on /system/xbin/ path;
2. Create the init.d folder in /system/etc/ path;
3. Add a script file to start the superuser daemon at the boot;
4. Edit the kernel ramdisk adding the sysinit script to add the init.d support at the boot;
5. Edit the updated-script for the right permissions to the new init.d folder (and its content) and to the su binary file.
I never had problems with Galaxy Nexus and LG Nexus 4 but today I am having troubles with the Nexus 5.
Is this a common issue?
I hope to get answers,
regards,
kalo86

kalo86 said:
Hello guys!
I am not new in the Android and Nexus world but at this time I need some help.
I am used to root any Nexus phone in this way:
1. Put su, daemonsu, busybox on /system/xbin/ path;
2. Create the init.d folder in /system/etc/ path;
3. Add a script file to start the superuser daemon at the boot;
4. Edit the kernel ramdisk adding the sysinit script to add the init.d support at the boot;
5. Edit the updated-script for the right permissions to the new init.d folder (and its content) and to the su binary file.
I never had problems with Galaxy Nexus and LG Nexus 4 but today I am having troubles with the Nexus 5.
Is this a common issue?
I hope to get answers,
regards,
kalo86
Click to expand...
Click to collapse
fastboot oem unlock
flash custom recovery
flash SuperSU in recovery

Of course I have unlocked the bootloder but the init.d script does not work.
Neither a test script works...
This is the test script that I am using to verify if the init.d support is working. The file 00test is placed in /system/etc/init.d/.
Code:
#!/system/bin/sh
#Init.d Test
busybox mount -o remount,rw -t auto /system
if [ -e /system/Test.log ]; then
rm /system/Test.log
fi
echo "kalo86 @ XDA 2014" > /system/Test.log
echo "Init.d is working !!!" >> /system/Test.log

kalo86 said:
Of course I have unlocked the bootloder but the init.d script does not work.
Neither a test script works...
This is the test script that I am using to verify if the init.d support is working. The file 00test is placed in /system/etc/init.d/.
Code:
#!/system/bin/sh
#Init.d Test
busybox mount -o remount,rw -t auto /system
if [ -e /system/Test.log ]; then
rm /system/Test.log
fi
echo "kalo86 @ XDA 2014" > /system/Test.log
echo "Init.d is working !!!" >> /system/Test.log
Click to expand...
Click to collapse
You're making it way too difficult. Just flash supersu in a custom recovery
Sent from my Nexus 5 using XDA Free mobile app

You could install an application such as Universal init.d from the playstore. It works for me on both my Nexus 5 and 10. Initially works without issue.
Sent from my Nexus 10 using XDA Premium HD app

jd1639 said:
You're making it way too difficult. Just flash supersu in a custom recovery
Sent from my Nexus 5 using XDA Free mobile app
Click to expand...
Click to collapse
Why difficult? This is the same identical mechanism that Chainfire uses to root your phone but I like to share a rooted-ROM ready to use.
The init.d folder is not supported at the moment. This is the truth.
And I don't want a workaround since the init.d support is very useful also for other stuff which is not only root access.

Related

[APP] Zipalign binary and script - Optimize installed applications

Hey everyone,
wesgarner said:
Zip Align reduces the amount of RAM used during processing running for a major speed increase in running the apps: http://developer.android.com/guide/developing/tools/zipalign.html
Click to expand...
Click to collapse
I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).
I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.
To "install" this, just adb push the two files in the zip below onto your phone with:
Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks /system/sd/zipalign_apks.sh
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell sh /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1
ZipAlign
senab said:
Hey everyone,
I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).
I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.
To "install" this, just adb push the two files in the zip below onto your phone with:
Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks.sh /system/sd
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1
Click to expand...
Click to collapse
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Sweet... Thanks...
I was surprised that more than half of the Apps I have were already ZipAligned...
LucidREM said:
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Click to expand...
Click to collapse
APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more efficient wrt memory access.
You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.com/2009/09/zipalign-easy-optimization.html
Vermithrax said:
Sweet... Thanks...
I was surprised that more than half of the Apps I have were already ZipAligned...
Click to expand...
Click to collapse
Since the 1.6 SDK was released, the ADT does this automatically on APK export. Therefore any app which has been updated since ~September (and was developed using the ADT Eclipse plugin) will be zipalign'd. I was more surprised that 12 out of the 43 apps on my phone weren't aligned!
ZipAlign
senab said:
APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more much efficient wrt memory access.
You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.com/2009/09/zipalign-easy-optimization.html
Click to expand...
Click to collapse
that's awesome .. thanks for the link .. i hadn't read about that
Thanks much for this!
Here is a simple gscript to install zipalign after a wipe or new build flash.
You must first create directory /sdcard/zipalign and place zipalign from the zip in the OP there. Path to the file should now be /sdcard/zipalign/zipalign.
Place this script in your gscript folder (after removing .txt from the name) and load it in gscript with su permissions.
I also find it easier to run the script in the zip from the OP in Gscript as well. Instead of placing it in /system/sd run this (assumes zipalign_apks.sh is at root of C:\)
Code:
adb remount
adb push C:\zipalign_apks.sh /sdcard/gscript/zipalign_apks.sh
Then just load it into Gsrcipt with su permissions as with the other script.
Easiest of all may just be to use the commands within Lucid's script. But, I'm comfortable with Gscript, and I can make it 2 clicks away.
EDIT: First execution, you may want to run the original way, because guess what? Gscript isn't zipaligned. But it worked fine just the same.
worked great thanks.
Thanks. I didn't want to flash whole ROM to zipalign apps, so script was very handy.
Actually I've zipaligned only 2 apps, one of them was everybody loved Linda
so anyone wanna bless me with a terminal code to install the script?
garz said:
so anyone wanna bless me with a terminal code to install the script?
Click to expand...
Click to collapse
Read, its on the first post....xD
ZipAlign
garz said:
so anyone wanna bless me with a terminal code to install the script?
Click to expand...
Click to collapse
# lucid -z
yeah so su? then #lucid -z? cause that did nothing for me...
LucidREM said:
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Click to expand...
Click to collapse
I put a quick explanation of my script on my ROM page: here ya go (rough explanation)
Zip Align reduces the amount of RAM used during processing running for a major speed increase in dex-opt and running the apps, along with the RAM hack and a CC (or your userinit) boots speeds incredibly and better usability of apps (boot and system) in Android: http://developer.android.com/guide/d.../zipalign.html
Most developers have not used this yet (CM does ZipAlign his apps), but this does for the system apps provided from the now old Google Apps
Click to expand...
Click to collapse
senab said:
Since the 1.6 SDK was released, the ADT does this automatically on APK export. Therefore any app which has been updated since ~September (and was developed using the ADT Eclipse plugin) will be zipalign'd. I was more surprised that 12 out of the 43 apps on my phone weren't aligned!
Click to expand...
Click to collapse
Agreed. The Market won't let non-zipaligned apps be uploaded.
AndroidAppCritic said:
Agreed. The Market won't let non-zipaligned apps be uploaded.
Click to expand...
Click to collapse
it will really, it doesn't detect the diff
Also, SDK4 didn't really include an enforced ZipAlign like SDK5 (eclair) does
Plus I built the ZipAlign from source from eclair - so this script may not update them all perfectly
garz said:
yeah so su? then #lucid -z? cause that did nothing for me...
Click to expand...
Click to collapse
Unzip the files to your SD Card, then:
Code:
su
mount -o remount,rw /system
mv /sdcard/zipalign /system/bin
mv /sdcard/zipalign_apks /system/sd/zipalign_apks.sh
chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
mount -o remount,ro /system
Post deleted becoz it was redundant
can someone make a script for windows or a bat file that can zipalign a batch of apks? I am not that ofay with line commands and when i create a new theme (which i often do), i then have to go and zipalign every single apk i have altered 1 at a time..... i do:
Code:
zipalign -f -v 4 E:\app\theapp.apk E:\app\theapp.apk.out
senab said:
Unzip the files to your SD Card, then:
Code:
su
mount -o remount,rw /system
cp /sdcard/zipalign /system/bin
cp /sdcard/zipalign_apks.sh /system/sd
chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
mount -o remount,ro /system
Click to expand...
Click to collapse
This isnt working for me bc of the .sh after zipalign_apks .. do i rename the zipalign_apks to zipalign_apks.sh after unzipping?
edit:that worked THANKS!

Better integrating Busybox (2012-11-17)

Most Android ROMs use toolbox as primary binary with symlinks in /system/bin and /system/xbin. The problem with toolbox is that it sucks. On some ROMs it's even so limited that it does not even allow for --prefix
Busybox is a great replacement for toolbox, but in order to use it, you have to call it using 'busybox cmd'. I would much rather use it by calling 'cmd' but this would execute toolbox instead of busybox.
Most would think the command 'busybox --install' would fix this, but it does'nt. It tries to install links at /bin and /sbin.
The script below will replace any toolbox links in /system/bin and /system/xbin that is supported by the busybox version installed on the Android device running the script. This will make busybox the default binary when executing regular commands without adding 'busybox' at the beginning of the command.
For an example 'ls' instead of 'busybox ls'
Download as an update.zip
v1.3.0 (Nov 17, 2012) (MD5: c233964f0f62a16d7376739041e8b250) - busybox_installer.zip (Only for ArmV7 devices)
v1.3.0 (Nov 17, 2012) (MD5: e921a6c4119644a18d4feea565824ab1) - busybox_installer-nobin (Without binaries)
busybox.sh
Code:
#!/sbin/sh
for cmd in test find basename readlink ln rm; do
eval export "_$cmd=\"/sbin/busybox $cmd\""
done
_busybox=$($_find /system -type f -name "busybox")
_toolbox=$($_find /system -type f -name "toolbox")
if $_test -e "$_busybox" && $_test -e "$_toolbox"; then
sToolboxList="watchprops wipe vmstat date uptime reboot getevent getprop setprop id iftop ioctl ionice log lsof nandread newfs_msdos notify ps r schedtop sendevent setconsole setprop sleep smd start stop top"
sBusyboxList="`$_busybox --list`"
for applet in $sBusyboxList; do
if $_test -L /system/bin/$applet; then
if $_test "`$_basename $($_readlink -f /system/bin/$applet)`" = "toolbox"; then
$_ln -sf $_busybox /system/bin/$applet
if $_test -L /system/xbin/$applet; then
$_rm -rf /system/xbin/$applet
fi
fi
elif $_test -L /system/xbin/$applet; then
if $_test "`$_basename $($_readlink -f /system/xbin/$applet)`" = "toolbox"; then
$_ln -sf $_busybox /system/xbin/$applet
fi
elif ! $_test -e /system/bin/$applet && ! $_test -e /system/xbin/$applet; then
$_ln -sf $_busybox /system/bin/$applet
fi
done
for applet in $sToolboxList; do
$_ln -sf $_toolbox /system/bin/$applet
done
fi
Toolbox install links
watchprops, wipe, vmstat, date, uptime, reboot, getevent, getprop, setprop, id, iftop, ioctl, ionice, log, lsof, nandread, newfs_msdos, notify, ps, r, su, schedtop, sendevent, setconsole, setprop, sleep, smd, start, stop, top
Busybox install links
Whatever the currently installed busybox supports that is not in the list of toolbox install links
Change log
Dec 10 2011, 21:39 UTC:
The script will now leave skip replacing /system/bin/reboot as it needs to be pointed at toolbox
Dec 11 2011, 10:08 UTC:
Added an update zip that will configure busybox and it provides an extended 1.4MB binary instead of the regular 480KB most ROM's provide
Dec 12 2011, 09:25 UTC:
Added new busybox build (1.20.0.git 2011-12-11) since there was problem with the old one for some people
Added more busybox search dirs (/system/sbin and /sbin)
Added Toolbox install to make sure that some android specific links uses toolbox instead of busybox. See list above.
Jun 27 2012, 13:45 UTC:
Better Busybox and Toolbox search
Added symlink check to make sure that busybox only replaces toolbox links and not things like "sh -> mksh"
Nov 17 2012, 10:30 UTC:
Added a custom toolbox binary to the ArmV7 installer
Added latest CM9 busybox binary to the ArmV7 binary
Added an auto search function to locate the binaries on the device
Fixed both installers to work with newer devices that uses EXT4 file system
Thanks, dk_zero-cool. I've been looking for a guide to installing BusyBox, since I can only find an add-supported installer in the Android Market.
Thanks, nice job!!
Ran the script, worked and did fine....ONE BIG ISSUE....now if you have any script or app that relies on the "reboot" function, it no longer works. For example, rom manager & bootstrapper will not boot into recovery. I even open up terminal and typed:
Code:
$ su
# reboot
...and nothing...does the reboot in /bin need to not be linked to busybox?
KMDonlon said:
Ran the script, worked and did fine....ONE BIG ISSUE....now if you have any script or app that relies on the "reboot" function, it no longer works. For example, rom manager & bootstrapper will not boot into recovery. I even open up terminal and typed:
Code:
$ su
# reboot
...and nothing...does the reboot in /bin need to not be linked to busybox?
Click to expand...
Click to collapse
Try to relink it back to toolbox and then I will update the script to leave reboot alone.
1: mount -o remount,rw /system
2: rm -r /system/bin/reboot
3: ln -s /system/bin/toolbox /system/bin/reboot
Great! Will try again!
Cool... can I steal this?
I'd implement it with a busybox install script
I'm not a super expert on the subject but is /system/sbin a possible location?
zeppelinrox said:
Cool... can I steal this?
I'd implement it with a busybox install script
I'm not a super expert on the subject but is /system/sbin a possible location?
Click to expand...
Click to collapse
You can use this as you like.
And you can type "echo $PATH" in an adb shell, if /system/sbin is there, then it will work. But why? /system/xbin is usually the default dir for placing busybox, otherwise /system/bin. And you will have to change the script since it will only check in /system/bin and /system/xbin
All times in my scripts report UTC time instead of system time, I am sure there is one other applet in /bin that was linked to toolbox that is now linked to busybox and reporting the date wrong or at least the date/time that busybox says (UTC time).
KMDonlon said:
All times in my scripts report UTC time instead of system time, I am sure there is one other applet in /bin that was linked to toolbox that is now linked to busybox and reporting the date wrong or at least the date/time that busybox says (UTC time).
Click to expand...
Click to collapse
Do the same as before, only this time replace 'reboot' with 'date'
This must be a setting in the busybox compile menu. A new binary might fix this because busybox should be able to display system time. But for now point date back to toolbox and it will work for you.
Yup, did what you just said and all is fine. Thanks! Is there a way you can implement the reboot and date applet ignore in the script within the .zip you made.... I think it will save users some headaches.
dk_zero-cool said:
You can use this as you like.
And you can type "echo $PATH" in an adb shell, if /system/sbin is there, then it will work. But why? /system/xbin is usually the default dir for placing busybox, otherwise /system/bin. And you will have to change the script since it will only check in /system/bin and /system/xbin
Click to expand...
Click to collapse
Well bb is sometimes installed elsewhere.
At first SuperCharger only looked in those 2 locations and stopped when it wasn't found.
What would happen if there was a second version elsewhere?
I suppose it wouldn't matter because of the symlinks.
KMDonlon said:
Yup, did what you just said and all is fine. Thanks! Is there a way you can implement the reboot and date applet ignore in the script within the .zip you made.... I think it will save users some headaches.
Click to expand...
Click to collapse
The reboot fix is already in the zip file.
The date fix I don't want in it, I would much rather fix busybox to work properly.
I'm currently looking at that.
zeppelinrox said:
Well bb is sometimes installed elsewhere.
At first SuperCharger only looked in those 2 locations and stopped when it wasn't found.
What would happen if there was a second version elsewhere?
I suppose it wouldn't matter because of the symlinks.
Click to expand...
Click to collapse
No that does not mater because of the symlinks.
That's why I referrer to the complete path, f.eks, "/system/xbin/busybox" and not just the binary name "busybox".
I am going to try your binary for Busybox and see, I am currently using JRummy's BB installer which installed v1.19.3 which is about 1.06MB....
EDIT: Just flashed the .zip, my phone will not boot past the logo....did a battery pull several times and can't get into CWR....SBF time
KMDonlon said:
I am going to try your binary for Busybox and see, I am currently using JRummy's BB installer which installed v1.19.3 which is about 1.06MB....
EDIT: Just flashed the .zip, my phone will not boot past the logo....did a battery pull several times and can't get into CWR....SBF time
Click to expand...
Click to collapse
Put in your USB cable, open a terminal/console on your computer and try "adb logcat" to see what it says when it stops booting.
You must of cause have adb installed on your computer, and USB drivers if you use windows, which I don't and cant help with.
Already reflashed phone back....sorry, no logcat....
Do it again...
C'mon take one for the team... hehe...
LMFAO!!!! Sorry dude, I ain't gonna do it....will let some other poor soul ....I got honey do's today, it's Sunday!!
Whatever it was I can't recreate it. Works fine when I flash the damn thing.
Here's a thought.....make a script that reverses the toolbox links, I can undo it and try to flash again....I was unable to manually install your busybox version so I think some other toolbox applet is causing me trouble.....

[Q] Desperately need help running CWM Shell scripts

I need help figuring out why one script runs and another does and it doesn't help with the fact that I'm still quite new to Shell Scripting, let alone running them in CWM on Android devices.
Here's my problem:
This works:
Code:
#!/sbin/sh
busybox echo "#BlahBlahBlah" >> /system/build.prop
This will not:
Code:
#!/sbin/sh
busybox sed -e '/#BlahBlahBlah/d' /system/build.prop > /system/build.prop.bak
Yet, the above WILL run inside the OS. If I boot up fully and use something like Script Manager or Busybox Installer (the script running function) and run the above... it works.
But, in CWM, it doesn't.
I'm trying to use this to make an uninstaller for certain mods that write to the build.prop. So far, my only method for doing this is to copy over a new, unmodded build.prop, which is not very elegant and only works for one type of phone.
Any help would be greatly appreciated
Kryten2k35 said:
I need help figuring out why one script runs and another does and it doesn't help with the fact that I'm still quite new to Shell Scripting, let alone running them in CWM on Android devices.
Here's my problem:
This works:
Code:
#!/sbin/sh
busybox echo "#BlahBlahBlah" >> /system/build.prop
This will not:
Code:
#!/sbin/sh
busybox sed -e '/#BlahBlahBlah/d' /system/build.prop > /system/build.prop.bak
Yet, the above WILL run inside the OS. If I boot up fully and use something like Script Manager or Busybox Installer (the script running function) and run the above... it works.
But, in CWM, it doesn't.
I'm trying to use this to make an uninstaller for certain mods that write to the build.prop. So far, my only method for doing this is to copy over a new, unmodded build.prop, which is not very elegant and only works for one type of phone.
Any help would be greatly appreciated
Click to expand...
Click to collapse
Same problem here; have you found a solution?

[GUIDE] How To Add Init.d Support to Your Kernel & Rom

What is init.d ?
Init.d is a feature which allows you to run brunch of scripts at boot . Thats really useful while you want to set values which reset at boot or run/do any thing at every boot or install tweaks , engines and....
There are some ways to add this feature to you rom but always best way is to add init.d support directly by your kernel . I want to help you to do this
Requirements
1- Ability to unpack boot.img & ramdisk
2- Some basic linux shell knowloedge
3- Having Busybox located in /system/bin/busybox at your rom
Step 1: Making kernel ready
1- Unpack kernel then ramdisk
2- Open Init.rc with a text editor
3- Add this codes at the end , before the paragraph which there is "stop bootanim" command in it :
Code:
service sysinit /system/bin/sysinit
oneshot
4- Save , Exit and repack ramdisk and boot.img
Step 2 : Making Rom Ready !
1- Open /system/bin/sysinit
2- Add this codes :
Code:
#!/system/bin/sh
export PATH=${PATH}:/system/bin:/system/xbin
chmod 777 /system/etc/init.d/*
logwrapper busybox run-parts /system/etc/init.d/
3- Set permissions of sysinit to 777 or 755 ( rwxrwxr-x | rwxrwxrwx )
4- Make a directory at system/etc and name it init.d
Now you have init.d support !
Bull*hit. JUST INSTALL pimpmyrom and finish ..Easy.:victory:
Someone had to document this ^^, good job
RobyRc said:
Bull*hit. JUST INSTALL pimpmyrom and finish ..Easy.:victory:
Click to expand...
Click to collapse
Pimp uses one of the worst method to add this feature to your ROM ! it doesn't effect on kernel so : 1- running init.d is slower 2- init.d is not stable at all 3- not usable for ones want to add this feature to his/her kernel 4- not run init.d at end of boot so some script which needs some binaries that are not loaded yet doesn't work 5- Can not be used for room devs
This method is the official method which is used on most famous kernels such as brood kernel . and best for devs and users
any way that depends on users idea that this is good or not
RobyRc said:
Bull*hit. JUST INSTALL pimpmyrom and finish ..Easy.:victory:
Click to expand...
Click to collapse
Why are you so rude?
There are ways and ways to express own opinions... And alireza has just explained you why this method is better then PIMPMYROM.
Sent from my AriesVe using xda premium
alireza7991 said:
Pimp uses one of the worst method to add this feature to your ROM ! it doesn't effect on kernel so : 1- running init.d is slower 2- init.d is not stable at all 3- not usable for ones want to add this feature to his/her kernel 4- not run init.d at end of boot so some script which needs some binaries that are not loaded yet doesn't work 5- Can not be used for room devs
This method is the official method which is used on most famous kernels such as brood kernel . and best for devs and users
any way that depends on users idea that this is good or not
Click to expand...
Click to collapse
You are wrong.
RobyRc said:
You are wrong.
Click to expand...
Click to collapse
well, if he is wrong you can explain why, he explained why according to him is better this way, you could explain why not
What happens if your ROM doesn't have /system/bin/sysinit?
vMAC said:
What happens if your ROM doesn't have /system/bin/sysinit?
Click to expand...
Click to collapse
* Your rom has sysinit -> You have already init.d support and no need to this guide
* Your rom has'nt it -> You need to do my guide to get init.d support
alireza7991 said:
* Your rom has sysinit -> You have already init.d support and no need to this guide
* Your rom has'nt it -> You need to do my guide to get init.d support
Click to expand...
Click to collapse
And is it possible to create sysinit and init.d folder with an updater script?
GT-af said:
And is it possible to create sysinit and init.d folder with an updater script?
Click to expand...
Click to collapse
sure but do'nt forget :
1- your kernel must support init.d ( look at first post step 1)
2- do step 2 at fist post on sys init or you wo'nt have init.d support !
I have MTK 6577 device this will work ?
andrman1 said:
I have MTK 6577 device this will work ?
Click to expand...
Click to collapse
all android devices are supported
alireza7991 said:
all android devices are supported
Click to expand...
Click to collapse
In init.rc file I haven't code "stop bootanim" why and where I put this code ?
And I haven't in /system/bin file "sysinit" ?
andrman1 said:
In init.rc file I haven't code "stop bootanim" why and where I put this code ?
And I haven't in /system/bin file "sysinit" ?
Click to expand...
Click to collapse
Place those codes on the middle of init.rc ; the only difference is execute order . if you put it at first init.d wont execute becuase we have'nt system mounted still and if you put it at the end you will stop at your homescreen for a few secound so its better to execute it while you are seeing bootanimation
make new file name it sysinit and put codes siad in OP inside it .
Step 2 : Making Rom Ready !
1- Open /system/bin/sysinit
2- Add this codes :
Code:
#!/system/bin/sh
export PATH=${PATH}:/system/bin:/system/xbin
chmod 777 /system/etc/init.d/*
logwrapper busybox run-parts /system/etc/init.d/
Is this needed?
I've seen some ROMs not having /system/bin/sysinit but init.d kernel support, and I've tested a ROM myself not having this file, but the
99test init.d script gave some output to /data/tmp. So I guess it was executed properly.
t-ryder said:
Step 2 : Making Rom Ready !
1- Open /system/bin/sysinit
2- Add this codes :
Code:
#!/system/bin/sh
export PATH=${PATH}:/system/bin:/system/xbin
chmod 777 /system/etc/init.d/*
logwrapper busybox run-parts /system/etc/init.d/
Is this needed?
I've seen some ROMs not having /system/bin/sysinit but init.d kernel support, and I've tested a ROM myself not having this file, but the
99test init.d script gave some output to /data/tmp. So I guess it was executed properly.
Click to expand...
Click to collapse
There are many ways to get init.d working , you may include sysinit in init.rc or you may completely remove it and use a direct code in init.rc to execute init.d scripts or ....
Here in this method , I used sysinit in user-space to let init.d be dynamicly modifed or removed without repacking the kernel
alireza7991 said:
There are many ways to get init.d working , you may include sysinit in init.rc or you may completely remove it and use a direct code in init.rc to execute init.d scripts or ....
Here in this method , I used sysinit in user-space to let init.d be dynamicly modifed or removed without repacking the kernel
Click to expand...
Click to collapse
So just the file
Code:
#!/system/bin/sh
export PATH=${PATH}:/system/bin:/system/xbin
chmod 777 /system/etc/init.d/*
logwrapper busybox run-parts /system/etc/init.d/
would make it run (having busybox in /xbin) without having to mess around in the kernel using e.g. virtous ten studio?
t-ryder said:
So just the file
Code:
#!/system/bin/sh
export PATH=${PATH}:/system/bin:/system/xbin
chmod 777 /system/etc/init.d/*
logwrapper busybox run-parts /system/etc/init.d/
would make it run (having busybox in /xbin) without having to mess around in the kernel using e.g. virtous ten studio?
Click to expand...
Click to collapse
there are many strange and not suggested methods which add init.d without repacking kernel but the best method is using init.rc .
But I have some ideas on getting init.d working withouy messing around kernel . I am going to test them ;
alireza7991 said:
there are many strange and not suggested methods which add init.d without repacking kernel but the best method is using init.rc .
But I have some ideas on getting init.d working withouy messing around kernel . I am going to test them ;
Click to expand...
Click to collapse
Hi; I googled for a while to find a way to add init.d to my ROM and found your thread. Can you also explain how to adjust the source tree before compilation that I get the init.d? I am compiling AOSP with the stock kernel. I saw a few posts before that this method just works for a kernel which supports init.d. I have no clue if the stock kernel does. Thanks

INIT.D SUPPORT Kernel method *adds INIT.D folder*

HI guys
I just discovered a way to make init.d work on my rom and it should work on other roms as long as everything is followed down to the T
Basically there are 5 things you need to do
1: BootImageExtractor *links to follow* need to get it from my other laptop
2: Notepad++ *ask google*
3: Rashr *or any other apps that can flash kernels I just use this one*
4: Rooted Device
5: Rootexplorer *or any apps that let you dig deep into the root of THE android*
Ok lets start
First up is to unpack your boot.img and you should see your RAMDISK folder
now go ahead and look for init.rc and open it with notepad++ now add this code either at the very top or below the import scripts.
Code:
import /init.d.sh
You can use any name really as long as you have the same import script and name of the sh file
Now on to the next step which is to create a .sh file
Open up notepad++ and add this code in
Code:
#!/system/bin/sh
on property:sys.boot_completed=1
start sysinit
service sysinit /sbin/sysinit.sh
oneshot
class late_start
user root
group root
disabled
Now save as and use all types and name it init.d.sh and be sure its in the ramdisk folder
Having fun yet?
now last but not the least the sysinit.sh file!
same method as above but with a different code and is saved in the sbin folder
Code:
#!/system/bin/sh
mount -o remount,rw /;
mount -o rw,remount /system
# init.d support
if [ ! -e /system/etc/init.d ]; then
mkdir /system/etc/init.d
chown -R root.root /system/etc/init.d
chmod -R 755 /system/etc/init.d
fi
# start init.d
for FILE in /system/etc/init.d/*; do
sh $FILE >/dev/null
done;
And there you have it folks!
I would like to credit where I got the idea from but alas the guy who gave me the boot.img says he got it from another site and got it randomly.... so would like to thank my buddy Car *actually a human not a machine*
I already tried using the 00test script by Ryuinferno to see if it works and after two reboots I found the test log file in /data
I am new at this so please be gentle and I am still working on this because I want to integrate the scripts of Ryuinferno into the kernel *scripts being the 00test and the 00setperm* he will allow me to use them.
Again thanks XDA! my new home
Feedback please ^_^
Reserved
Where is the difference to the easy to use apps from other devs?
-CALIBAN666- said:
Where is the difference to the easy to use apps from other devs?
Click to expand...
Click to collapse
This is just an alternate method
and there are some phones who cant get init.d to work even with the universal init.d app * i know cause my device has that problem*
I am not saying those apps are not working, infact I use those when I help mates with their phones performance *its easier yes*
and this is something like kernel injection so just flashing a kernel will add init.d and would/could be useful for some devs or guys who just want to know how things tick *like me*
Ok,cool,thanx for answer bro.greeetz!
Working...
Thanks

Categories

Resources