Saturday, September 25, 2010

Change android system files [HTC Desire]

So I bought my HTC Desire and I wanted to change the hosts file in /etc
But you can;t change system files that easily. At first I had to download HTC Sync in my windows OS in order to be able to use adb usb drivers.
I downloaded android sdk, which it did its own stuff...

The really good part is where you get to open a cmd and then go to the tools directory. From there, one has to reboot into recovery mode. Mine was rooted, so I had to go to clockworkmod recovery->advanced->key
Then issue these commands:
adb shell mount /system #not sure if this worked
adb push [hosts] /etc


And then reboot. Not hard uh???

Edit: For the most bold and daring of you, why not try S-OFF??? Then you won't have to be in recovery mode. The phone can be on and still you will be able to alter your files.

2 comments:

  1. Thanks, it worked like a charm.

    The only change over your script I had to do was to replace the /system/etc/hosts file as well. Otherwise the /etc/hosts file gets replaced with default each time the device boots up.

    So the commands should go like this:

    adb shell mount /system
    adb push hosts /system/etc
    adb push hosts /etc

    ReplyDelete
  2. Actually /etc/hosts is a link to /system/etc/hosts!
    Quite frankly the whole directory of /etc is a link to /system/etc.

    I don't understand why you should access /system/etc since linking should have the same effect.
    Nevertheless, if you have S-OFF you can just issue those commands

    adb remount
    adb push hosts /system/etc

    ReplyDelete