-1
-rwxr-x---    1 root     root          3265 Jan  1  1970 init.class_main.sh
-rwxr-x---    1 root     root          1730 Jan  1  1970 init.mdm.sh
-rwxr-x---    1 root     root          3347 Jan  1  1970 init.mmi.boot.sh
-rwxr-x---    1 root     root           325 Jan  1  1970 init.mmi.dtv.sh
-rwxr-x---    1 root     root           562 Jan  1  1970 init.mmi.early_boot.sh
-rwxr-x---    1 root     root          6341 Jan  1  1970 init.mmi.touch.sh
-rwxr-x---    1 root     root          8592 Jan  1  1970 init.mmi.usb.sh
-rwxr-x---    1 root     root          7054 Jan  1  1970 init.qcom.class_core.sh
-rwxr-x---    1 root     root          6920 Jan  1  1970 init.qcom.early_boot.sh
-rwxr-x---    1 root     root          6987 Jan  1  1970 init.qcom.sh
-rwxr-x---    1 root     root          2962 Jan  1  1970 init.qcom.syspart_fixup.sh
-rwxr-x---    1 root     root          2844 Jan  1  1970 init.rc
-rwxr-x---    1 root     root          1327 Jan  1  1970 init.recovery.usb.rc
-rwxr-x---    1 root     root           683 Jan  1  1970 init.surnia.sh

These are all the files that begin with init.* in my /partition. In /system/etc I have some as well:

-rw-r--r--    1 root     root          2767 Mar 26  2015 init.ath3k.bt.sh
-rw-r--r--    1 root     root          1773 Mar 26  2015 init.crda.sh
-rw-r--r--    1 root     root          4987 Mar 26  2015 init.qcom.audio.sh
-rw-r--r--    1 root     root          9938 Mar 26  2015 init.qcom.bt.sh
-rw-r--r--    1 root     root          3651 Mar 26  2015 init.qcom.coex.sh
-rw-r--r--    1 root     root          3791 Mar 26  2015 init.qcom.debug.sh
-rw-r--r--    1 root     root          1725 Mar 26  2015 init.qcom.efs.sync.sh
-rw-r--r--    1 root     root          3083 Mar 26  2015 init.qcom.fm.sh
-rw-r--r--    1 root     root          4023 Mar 26  2015 init.qcom.modem_links.sh
-rw-r--r--    1 root     root         54877 Mar 26  2015 init.qcom.post_boot.sh
-rw-r--r--    1 root     root          2767 Mar 26  2015 init.qcom.sdio.sh
-rw-r--r--    1 root     root         19105 Mar 26  2015 init.qcom.wifi.sh

Are these similar to the init.d feature? How can I check if these init.* are run at boot? If so, how can I use this structure to add a custom script to run at boot?

  • 1
    You probably can't. Just because the files carry init in their names doesn't mean the device supports init.d – if it would, they'd rather be in /system/etc/init.d and not have the init in their names. If you want init.d support on a device not having it, check my list of init.d apps :) – Izzy Mar 8 '16 at 6:53
  • If I recall correctly, only the init.rc is executed at boot. I believe that, by further investigating the syntax, you could create a similar file, in the same location, that will have to be included by the init.rc. Please keep in mind that I never tested what I said. – Death Mask Salesman Mar 8 '16 at 7:54
  • 1
    I did a quick test. What I did, was to create a little file (init.dms.rc), which was meant to create a blank text file on /data by using touch. I then included the file into the main init.rc, with the syntax /include /init.dms.rc. After the reboot, not only had the blank file not been created, but all of my modifications (inclusion into init.rc and the whole init.dms.rc) were reverted. – Death Mask Salesman Mar 8 '16 at 8:59
0

There's no "easy way" in my scenario. My search found so far plenty of options:

Related: How can I run a script on boot?

http://forum.xda-developers.com/showthread.php?t=2287540

http://iamcmotc.blogspot.com.br/2015/04/android-how-to-run-script-or-system.html

Repacking boot images to add custom scripts: http://forum.xda-developers.com/showthread.php?t=443994

Boot process: http://bootloader.wikidot.com/linux:boot:android

The simpler way is to use an APK to emulate init.d: https://github.com/Androguide/Universal-init.d or https://github.com/Grarak/KernelAdiutor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.