Thursday, March 01, 2012

Getting to files from a ClockworkMod backup in OSX

I use ClockworkMod to backup my EVO. It's nice because I have the space and backups are something everyone should do at some point, especially if you are rooted and like to play in the OS. This functionality is provided by ClockworkMod, which has all sorts of features which I will not go into here, but suffice to say it's worth it to install.

This bring up the question of retrieving information from the backups though. How does one go about this, especially in an OSX environment. Well we need to discuss a few things first, before diving into the solution. Android OS as well as ClockworkMod uses YAFFS (yet another flash file system). When clockworkMod backs up these files and directories, it saves them in the .IMG format. This is not to be confused with the NDIF files of old on Classic Mac OS. They will not mount directly. You will need to convert the file system first. Let's discuss this part now.

You will need to go to the following Google Code Site for UnYAFFS. Download the unyaffs.c; unyaffs.h, and unyaffs files. Save these files to your local drive somewhere (downloads will work fine). From here open up the terminal application and cd to your downloads directory (or the directory to which you saved your files).

From here you will need to gcc make the unyaffs application. This is simple enough but just for grins we will go through it. Type the following into the terminal command line interface.

sudo gcc -o unyaffs unyaffs.c

This created an executable in your folder. You will want to copy this to your /sbin directory (so that you can execute it without having to put in a full path). If you don't know how to get to your /sbin, you can use the finder and "Go to Folder" under the go menu, just type /sbin. Screen shot included.

Just drag and drop the unyaffs exec to the /sbin directory. Of course you can copy directly to the /sbin in command line if you wish. Now go back to terminal and navigate to your yaffs .img disk image. Use the following command structure to extract all the files in the disk image.

unyaffs diskImage.img

This will begin the extraction process. When you see a message in terminal "end of image", the extraction is complete. This was tested in OS X 10.7.2 and I assume it will work in most distros of Linux.