Recover Files from Nandroid Backup

I recently flashed my Htc Desire with CyanogenMod 7.1 and I have to say it's great to be free of htc sense. Given the rigmarole around the official Gingerbread update for the Desire I don't think my next phone will be an htc one.

Anyhow, prior to installing CM 7.1 I'd carefully made a nandroid backup with ClockWorkMod recovery. Having set everything up I chose a ringtone + notification sound. Having lived with it for a bit I realised I miss the old sounds from the stock desire rom. To recover them I needed to mount extract the system.img file and then push the old audio files to the correct place.

Warning: Please follow these steps at your own risk!

Compiling unyaffs

To extract .img files you'll need unyaffs which can extract the files from a yaffs file system image. First copy the .img file into a directory. (For me the Nandroid img files were found in clockworkmod/backup/<date>/<foo>.img on the sdcard)

To compile unyaffs grab the unyaff.c and unyaffs.h from and compile it with:

gcc -o unyaffs unyaffs.c

Once you've done that and added it to your path (alternatively copy it to /usr/local/bin).

Navigate to the directory containing the yaff img and run:

./unyaffs system.img

This will un-pack the files into that directory.

Getting Files onto a Rooted Phone

Once you have the files the next step is to get them onto your phone. To do that you'll need the Android SDK to be installed and set-up.

When the SDK is there, connect your phone with the USB cable (with USB debugging enabled - Settings->Application->Development) run the following from the sdk's platform-tools directory.

./adb reboot recovery

When the phone reboots to recovery mount the system partition.

Next as an example here's the command I ran to copy the ringtones from the desire rom onto the phone:

./adb remount
./adb push /home/bungle/desire-system/media/audio/ringtones /system/media/audio/ringtones

This will copy all the files in the ringtones dir onto the phone.

Show Comments