I would like to edit the init.rc in an i9300. I understand that editing the file as-is will not work as the file is reloaded from the boot image's ramdisk upon every bootup. After some googling, I read that I have to unpack, edit and repack the boot image. I came across the following link: http://android-dls.com/wiki/index.php?title=HOWTO%3a_Unpack,_Edit,_and_Re-Pack_Boot_Images

However, upon trying out the first command "cat /proc/mtd", I realize that my i9300 doesn't even have a /proc/mtd, so I'm wondering if any of the instructions there apply to this device.

/dev/block shows mmcblk0p1 to mmcblk0p12, but I'm not sure which one is the boot image. From my googling it seems that mmcblk0p6 is the recovery image though.

How can I edit the init.rc in this device?


  • 1
    What do you want to achieve by doing this? If you want to mount another thing or remount a filesystem, you can use init.d script support. Thats far more easy and will let you execute scripts on boot.
    – Peter
    Feb 15 '13 at 8:27
  • I wish to start a native service at boot, which is a cross compiled ARM binary. Feb 20 '13 at 2:19

You have two choices here:

  1. Edit the stock kernel (or the kernel you're using) to enable init.d support or edit the init.rc
  2. Use a custom kernel with init.d support already enabled.

I would suggest the second option as is far more easier to achieve. Once flashed a kernel with init.d support, you can add all the scripts you want to the folder that will be executed at boot time. The folder is located in /etc/init.d and all scripts inside that folder will be executed in order.

For example, if you have:

  • /etc/init.d/10-startup-daemon
  • /etc/init.d/50-mount-extra-partition

They will be executed in the same order I've typed them. You can change the order by changing the number at the begining of the file.

  • Thanks. I ended up unpacking/modifying/repacking the ramdisk in order to modify the init.rc to start the service I wanted. Feb 21 '13 at 7:21

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.