Muffinresearch Labs by Stuart Colville

Recover Files from Nandroid Backup | 1 Comment

Posted in Code, Mobile on 27th October 2011, 10:42 pm by

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 http://code.google.com/p/unyaffs/downloads/list 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.

Post Tools

  • Puneet

    thanks buddy for the info

Insert a tab character in vim when expand tabs is on|(0)

I have vim set-up to use spaces in place of tabs. Sometimes you need to use an actual tab e.g. editing a Makefile. Now whilst it’s possible to change settings so that tabs are used for specific files, a quick tip to remember is to simply type in insert mode:

Ctrl+v tab

That is Ctrl and “V” and hit the tab key, et voila you’ve entered an actual tab.

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Photos on Flickr

© Copyright 2004-13 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.546s.