If you like your stock Desire ROM, you rooted it using unrEVOked or some other methods, you made some custom adjustment to it an you really don’t want to load a fully fledged third party ROM but still, you would like to tweak it a little bit more, you will quickly realize that you are going to need a working init.d system in order to start custom scripts on boot.
In this tutorial, I tried to explain how to add init.d support to your ROM, without needing to flash a new ROM and wipe everything, I just going to flash a new boot.img.
- Rooted HTC Desire
- New modified boot.img, supported firmware versions: 2.10.405.2, 2.29.405.2/5, check your firmware version here: (Settings -> About Phone -> Software information -> Software number)
- Download this one: boot_2.10.405.2.zip if your “Software number” is: 2.10.405.2
- Download this one: boot_2.29.405.2_5.zip if your “Software number” is: 2.29.405.2 or 2.29.405.5
- Make sure you download the one matching your “Software number”, the wrong one will cause boot loops and weird behaviors.
- ADB shell access
- flash_image binary, usually provided by unrEVOked under /data/local/flash_image but if you don’t have grab it here:
- busybox correctly installed under /system/xbin
Disclaimer: Best Android Blog should not be held responsible/liable for any damages that might occur to your device while following this rooting procedure. So, do everything at your own risk.
NOTE : If your desire is not S-OFF (meaning you can’t write to the /system directory), you’ll need to do the whole procedure in recovery mode.
1. Do a nandroid backup, this in order to save your current boot.img, and also because it is never a bad idea.
2. Make sure the nandroid backup went ok.
3. Then check your exact firmware version (Settings -> About Phone -> Software information -> Software number) and download the corresponding modified boot.img
4. Copy and unzip the downloaded boot.img to your SD card or wherever you like it.
5.Obtain adb shell access, become root (su) and wipe the existing boot image with:
cat /dev/zero > /dev/mtd/mtd2
ignore the “write: No space left on device, it’s normal”.
6. Flash the new boot image:
flash_image boot /sdcard/boot.img
where “/sdcard/boot.img” is the path where you copied the downloaded boot.img
7. Remount the /system partition read-write if you’re not in recovery mode:
mount -o remount,rw /system
or mount it if you are in recovery mode:
8. Create the init.d directory where all the custom boot scripts will be executed:
and set permissions:
chmod 755 /system/etc/init.d
9. Important: unzip and copy the 99complete.zip script to the newly created /system/etc/init.d/99complete, set permissions:
chmod 755 /system/etc/init.d/99complete
chown root.shell /system/etc/init.d/99complete
Failure to do so will cause a boot loops.
10. Cross your fingers and reboot! If anything goes wrong you can always boot into recovery and fix errors or you can restore the nandroid backup (you can just restore the boot.img if you don’t want to do a full restore).
From now on, every script you put inside /system/etc/init.d will be executed at boot before almost any other initializations. Make sure you set the correct permissions to your scripts (i.e. 755).