marksalpeter / yaffs2utils

Automatically exported from code.google.com/p/yaffs2utils
GNU General Public License v2.0
0 stars 1 forks source link

newer versions unable to extract img that older version can #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I recently had to extract the contents of a yaffs2 image file and found that 
none of the three revisions of yaffs2utils available could extract the image. 
This was caused a great distress with me as I've previously used an older 
revision of the software to extract an image. I tried all three "current 
downloads" versions (the initial release wouldn't compile) as both a regular 
user and as root. None extracted the file and all displayed error messages 
varying from a segmentation fault to almost no output. 

I was fortunate to find a binary of unyaffs that I had saved previously and 
could use it to successfully extract the image. The version that works is so 
old it doesn't take any option other than the path to the image file and 
extracts to the current working directory. Unfortunately I'm unable to find the 
version of the binary but I last modified it on 2010-12-03.

I should expect that the newer versions of yaffs2utils should be able to 
extract the image file where a previous version could. Please let me know what 
information I can provide to you in order to help troubleshoot this issue. Note 
that I won't provide the image file used as it contains private data but I'll 
be happy to provide any information about that file you wish.

Thanks,
Greg

Original issue reported on code.google.com by allright...@gmail.com on 18 May 2011 at 12:57

GoogleCodeExporter commented 8 years ago
Would you try to remove the "__HAVE_MMAP" option in the Makefile and try again?

The project unyaffs is another opensource project, but I will compare the 
different between us and try to find the root cause.

Since your image contains the private data,
would you provide me some information about : 
1. Which tool did you used to create the image?
2. Try to remove the "__HAVE_MMAP" option in the Makefile.
3. Using the option "-v" in the yaffs2utils-0.2 and send me the log on the 
terminal.

Thanks a lot.

Original comment by penguin.lin on 26 May 2011 at 2:35

GoogleCodeExporter commented 8 years ago
Dear:

Would you please provide me more information about this issue (log on terminal).
I notice that the tool from official yaffs2 did not write the ROOT object into 
the image, and the "unyaffs2" will show that "cannot find the root object, ..." 
and the extraction will NOT processed.

Original comment by penguin.lin on 8 Jun 2011 at 5:31

GoogleCodeExporter commented 8 years ago
Hi,

I missed your comment in May. My apologies for that. Here's the information 
you've requested:

1. The yaffs2 image was created as part of a backup by clockworkmod 
(http://www.addictivetips.com/mobile/what-is-clockworkmod-recovery-and-how-to-us
e-it-on-android-complete-guide/) and is an image of the /data partition (also 
yaffs2) of my phone.

2. Here's the output with "CFLAGS += -D_HAVE_MMAP" removed:

**
# ./src/unyaffs2 /home/greg.walters/android/data.img test/
unyaffs2-0.2.0: image extracting tool for YAFFS2
scanning image "/home/greg.walters/android/data.img"... [done]
scanning complete, total objects: 0
cannot find the root object, image broken?
building fs tree ... [done]
building complete, total valid objects: 0
extracting image into "test/"

modify files attributes... [done]
operation complete
files are extracted into test/
**

3. The "-v" option produces the same results.

Regarding comment #2 on this issue, it does look like the ROOT object is not 
part of the image. Is there a way to work around or correct this issue?

Thanks,
Greg

Original comment by allright...@gmail.com on 8 Jun 2011 at 12:47

GoogleCodeExporter commented 8 years ago
Also, your comment at #1 is correct. I had the projects confused. I've build 
the other unyaffs and found it to match the binary that I originally used. 

Thanks,
Greg

Original comment by allright...@gmail.com on 8 Jun 2011 at 12:52

GoogleCodeExporter commented 8 years ago
Dear:

Thanks for your reply. ^^.

I thinks this problem can be divide into two parts :

1. The ROOT object is NOT found.
I notice the official mkyaffs2image didn't write the ROOT object into the image 
for a long time. I will fix this issue.

2. "0" objects are scanned.
I thinks the oob layout in your image is differed from the default one in the 
"unyafs2". The oob layout in the official mkyaffs2image is different from the 
Linux MTD default settings. 

This problem can be solved by:
(1) Using the tool "unspare2" to dump the oob layout information from your NAND 
device, and the option "-o" can be used (unyaffs2) when you using unyaffs2 to 
extract the image.
(2) Modifying the default oob layout in yaffs2utils (file: "yaffs2utils_ecc.h")

Thanks a lot! 

Original comment by penguin.lin on 9 Jun 2011 at 2:41

GoogleCodeExporter commented 8 years ago
Thank you for your detailed workaround directions. Much appreciated. 

Original comment by allright...@gmail.com on 9 Jun 2011 at 1:59

GoogleCodeExporter commented 8 years ago
Dear:

In the "yaffs2utils-0.2_pre3", I  fixed the issue for "ROOT obj is NOT found".
The tool "unyaffs2" in this version will always ignore the ROOT object in the 
image and use a pseudo root object for its internal algorithm.

For your problem #2, I think the oob layout of your original image is different 
from the Linux MTD default (maybe I was wrong). 

If your image is generated by the official mkyaffs2image, I think you can try:
(1) Modifying "yaffs2utils_ecc.h" by the patch:
++++++++++ PATCH ++++++++++
--- src.old/yaffs2utils_ecc.h   2011-06-20 16:23:45.000000000 +0800
+++ src.new/yaffs2utils_ecc.h   2011-06-20 16:22:55.000000000 +0800
@@ -32,7 +32,8 @@
         .eccpos = {40, 41, 42, 43, 44, 45, 46, 47,
                    48, 49, 50, 51, 52, 53, 54, 55,
                    56, 57, 58, 59, 60, 61, 62, 63},
-        .oobfree = {{.offset = 2, .length = 38}},
+//        .oobfree = {{.offset = 2, .length = 38}},
+        .oobfree = {{.offset = 0, .length = 38}},
 };

 static struct nand_ecclayout nand_oob_user = {0};
---------- PATCH ----------

(2) Using the tool "unspare2" to dump the oob layout information from your NAND 
device (on the target), and the option "-o" can be used (unyaffs2) when you 
using unyaffs2 to extract the image.

I thinks your problem can be solved.

Original comment by penguin.lin on 20 Jun 2011 at 8:27

GoogleCodeExporter commented 8 years ago
For this open issue:
(1) For "ROOT obj is NOT found", it is fixed.
(2) For others, it will be "won't fix".

Original comment by penguin.lin on 7 Jul 2011 at 10:22

GoogleCodeExporter commented 8 years ago
Hi, I've met the same issue here, while trying to expand the system.img created 
with a generic AOSP build (2.3.6_r1):

------------------------------------
$ cd out/target/product/generic
$ mkdir sys
$ sudo unyaffs2 -o system.img sys
unyaffs2-0.2.4: image extracting tool for YAFFS2
scanning image 'system.img'... [done]
scanning complete, total objects: 0
building fs tree ... [done]
building complete, total valid objects: 0
extracting image into 'sys'

modify files attributes... [done]
operation complete
files are extracted into 'sys'
------------------------------------

Isn't unyaffs2 compatible with standard Android images?

 thanks a lot!
 Fabio

Original comment by ffum...@gmail.com on 23 Mar 2012 at 3:23

GoogleCodeExporter commented 8 years ago
Sorry... wrong copy/paste. The command I usd did NOT include -o:

------------------------------------
$ cd out/target/product/generic
$ mkdir sys
$ sudo unyaffs2 system.img sys
unyaffs2-0.2.4: image extracting tool for YAFFS2
scanning image 'system.img'... [done]
scanning complete, total objects: 0
building fs tree ... [done]
building complete, total valid objects: 0
extracting image into 'sys'

modify files attributes... [done]
operation complete
files are extracted into 'sys'
------------------------------------

Original comment by ffum...@gmail.com on 23 Mar 2012 at 3:27