If you are like me and you like your stock Desire rom, you rooted it using unrEVOked or some other methods, you made some custom adjustment to it and you really don't want to load a fully fledged 3rd party rom but still, you'd like to tweak it a little bit more, you'll quickly realize that you are going to need a working init.d system in order to start custom scripts on boot.
This thread will try to explain how to add init.d support to your rom, without needing to flash a new rom and wipe everything, we're just going to flash a new boot.img.
Requirements
HOW-TO
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.
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).
Thanks to: teppic74 for providing stock roms with init.d support (thread) where I extracted the boot images.
This thread will try to explain how to add init.d support to your rom, without needing to flash a new rom and wipe everything, we're just going to flash a new boot.img.
Requirements
- 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: View attachment boot_2.10.405.2.zip if your "Software number" is: 2.10.405.2
Download this one: View attachment 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: View attachment flash_image.zip
- busybox correctly installed under /system/xbin
HOW-TO
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.
- Do a nandroid backup, this in order to save your current boot.img, and also because it's never a bad idea
- Make sure the nandroid backup went ok
- Check your exact firmware version (Settings -> About Phone -> Software information -> Software number) and download the corresponding modified boot.img
- Copy and unzip the downloaded boot.img to your sdcard or wherever you like it
- Obtain adb shell access, become root (su) and wipe the existing boot image with:
Code:cat /dev/zero > /dev/mtd/mtd2
- Flash the new boot image:
Code:flash_image boot /sdcard/boot.img
- Remount the /system partition read-write if you're not in recovery mode:
Code:
mount -o remount,rw /system
Code:mount /system
- Create the init.d directory where all the custom boot scripts will be executed:
Code:mkdir /system/etc/init.d
Code:chmod 755 /system/etc/init.d
- Important: unzip and copy the View attachment 99complete.zip script to the newly created /system/etc/init.d/99complete, set permissions:
Code:chmod 755 /system/etc/init.d/99complete
Code:chown root.shell /system/etc/init.d/99complete
- 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).
Thanks to: teppic74 for providing stock roms with init.d support (thread) where I extracted the boot images.
Last edited: