• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [How To] unyaffs for decompiling nandroid (and other) .img files

AndroidKris

Android Enthusiast
Dec 20, 2010
385
75
I'm posting this here because I don't know where else to post it. I've googled all over the interwebz and found not one single "guide" to unyaffs. It's nothing fancy, just bare bones, step by step instructions based on my experience. Please feel free to correct or add to my guide and I will edit this post with the info.

These directions are only for "unyaffs" since I have had no reason to use "yaffs". If anyone has info on "yaffs" post it here and I'll check into it...possibly add it to this guide.

One more thing before I start. These instructions are for linux users, since I did it running Xubuntu 10.10, and I have no clue how to make it work for windows (I haven't touched windows in quite a while). If someone has useful input for windows instructions, post away.

Here goes.
1) go to unyaffs - unyaffs is a program to extract files from a yaffs image - Google Project Hosting
2) click the "download" link at the top
3) download all three "unyaffs", "unyaffs.c", and "unyaffs.h"
4) I put them in my /android-sdk-linux/tools directory, but you can put them wherever you want.
5)now open a terminal and cd to your directory containing the three "unyaffs" files
6) type "gcc -o unyaffs unyaffs.c"
7)once it's done doing it's thing, type "sudo chmod +x /complete/directory/path/to/unyaffs"
Now comes the tricky part
8)In terminal type "cd /complete/drectory/path/to/unyaffs"
9)Minimize your terminal and open your preferred file manager and browse to where your "unyaffs" file is, then copy and paste it in the same directory as your nandroid .img files
(Now "unyaffs" and your .img files are located in the same folder)
10)bring up the terminal again and (since you've already cd'd to the correct directory) type "./unyaffs system.img" (or data.img, or cache.img)


Notes:
1) this will decompile everything within the .img file directly to the same directory that unyaffs and the .img file are located.
2) This will only work on system.img, data.img, and cache.img. It will tell you "broken image file" if you try to use it on a recovery.img, and I have no idea what it will do to a boot.img.
3) You MUST make sure that your .img file and a copy of the unyaffs file are in the EXACT SAME directory.

Thank you for reading. Your feedback is most welcome and greatly appreciated. As I have said above, feel free to post additions, corrections, or alternatives. Hell, you can even let me know if I spelled something incorrectly or wrote a sentence grammatically incorrect.

Have a nice day.​
 
Awesome guide, I feel this deserves a bump.

I have been using unyaffs for a few months now and it makes things SO much easier.


Here is another little gem to add:

After you compile unyaffs with gcc you can copy it to your bin directory like so
Code:
[FONT="Fixedsys"][SIZE="4"][COLOR="Red"]sudo cp unyaffs /usr/bin/ && sudo chmod 777 /usr/bin/unyaffs[/COLOR][/SIZE][/FONT]

If for some reason your version of linux doesn't have a usr/bin you can cp it to /bin/ just change the command accordingly


After doing this you can run unyaffs from ANYWHERE in the terminal without typing the whole path, I do this all the time with little scripts I write for signing apks, building, etc I put them in a folder than symlink them to /usr/bin/ makes life much easier
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones