The reason it does not work properly is this:
The init.rc
script resides in within the RAMDisk attached to the boot image.
Hence the init.rc
script that was edited and pushed across is now overwritten by the boot image's own script upon reboot - effectively changes are lost!
You need to extract the boot image, using every boot image has the kernel and the RAMDisk. The tools available to do this can be found here.
Extracting
When invoking the script split_bootimg.pl
on a boot image it will recreate the following:
- boot.kernel
- boot.ramdisk.gz
The two files are obviously self-explanatory. To extract the ramdisk, create a directory called RAMDisk and from that directory, invoke this: gzip -dc | cpio -i
, to recreate the directory structure that is used in the RAMDisk which gets flipped over to the live file-system upon boot. In there, the file that is of pertinent information is init.rc
. Now that can be modified to your heart's content.
Putting it back together
Go back up a directory level, and issue this - mkbootfs ***RAMDisk*** | gzip > my_custom_ramdisk.gz
.
Then, to "attach" the original kernel to the boot image, issue the following: mkbootimg -base 0x.... -kernel boot.kernel -ramdisk my_custom_ramdisk.gz -o my_custom_boot.img
.
At this point now, a boot image has been constructed, then that boot image will now have to be flashed via fastboot flash boot my_custom_boot.img
.
TL;DR
Changes are lost upon re-boot because the script is not properly edited which required extracting the boot image and modifying it and re-packing it. Once re-packed and then the boot image is re-flashed, the changes will be permanent.
This is done every-time the changes are needed.