wufuyue / yaffs2utils

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

Support unyaffs of yaffs2 img made from mkyaffs2image #22

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When I do a build of the Android 2.3.7b1 with make sdk I get a system.img for 
the emulator.

yaffs2utils command unyaffs sees 0 objects in it.

The unyaffs project, however, will correctly extract all the files and folders. 
 http://code.google.com/p/unyaffs/

yaffs2utils should also support the given system.img.

Original issue reported on code.google.com by contac...@rodneybeede.com on 30 Nov 2011 at 1:26

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I made some mistakes in the previous reply...

If your image is made from the official mkyaffs2image, the OOB organization 
will be different from the default value in the unyaffs2. READ file already 
told that the image made from the official mkyaffs2img cannot be run on the 
Linux kernel, since their OOB layout is different from the Linux MTD default.

To extract a image made from the official mkyaffs2image, there are two method:
1. Using the -o option to specify a OOB image file which may be available by 
using the tool unspare2.
2. Modify the "src/yaffs2utils_ecc.h", you can modify the "oobfree" in the 
struct "nand_oob_XX", these space are used to store the filesystem OOB layout 
by default, and its value must be as same as your target system.

If these method cannot solve your problem,
Would you kindly provide me some information:
1) the unyaffs2 version.
2) the error message.
3) A sample image.

I will be grateful for any replies.

BRs

By Luen-Yung 

Original comment by penguin.lin on 30 Nov 2011 at 7:56

GoogleCodeExporter commented 8 years ago
Dear:

What followed are some discussion which is similar with your problem.
http://code.google.com/p/yaffs2utils/issues/detail?id=13#c7

Best Regards

By Luen-Yung

Original comment by penguin.lin on 30 Nov 2011 at 2:14

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Dear :

Is it solved or any reply!?

Thanks a lot.

Original comment by penguin.lin on 8 Dec 2011 at 5:54

GoogleCodeExporter commented 8 years ago
That answered the question.  I don't have a way to use unspare2 on an emulator 
image.  If anyone knows how to get the OOB it would be nice to bundle it with 
the source.

Original comment by contac...@rodneybeede.com on 8 Dec 2011 at 1:36

GoogleCodeExporter commented 8 years ago
Dear:

If your emulator has a shell, what followed are the steps to dump the OOB 
layout:
1) cross-compile the unspare2 tool.
2) upload it to the emulater.
3) execute unspare2 on the emulater.
4) download the result from the emulater and use -o option of unyaffs2.

If not....
Since you don't have a target device, I think the patch in #13 (comment 3) can 
help you to solve the problem.

++++++++++ 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 ----------

After applying this patch, your image could be extracted correctly, and you can 
also make a new image for your target system (emulator).

By Linux default, the first two bytes in oobfree area are used to determine 
whether a block is bad. In my opinion, I don't think this problem should be fix 
on Linux. If this patch can solve your problem, I will set this issue as "won't 
fix".

But I think it is a good idea to write a note in the README file.

Original comment by penguin.lin on 9 Dec 2011 at 2:07

GoogleCodeExporter commented 8 years ago
A note in the README will work fine.  Please mark this issue as closed.

Original comment by contac...@rodneybeede.com on 9 Dec 2011 at 3:02

GoogleCodeExporter commented 8 years ago
A section "Compatibility" will be added in the README.

Compatibility
-------------
As the discussion in the previous section "yaffs2utils", an image made by the
official YAFFS2 tools (mkyaffs2image) can not be run on the native Linux,
because its oob layout is different from the default one in the Linux MTD
subsystem. For an image is requested to be created/extracted with the
compatibilities of the one made by the official YFFS2 tool (mkyaffs2image)
by using the "yaffs2uitls" package, some methods are described:

1. Use "-o" option to specify the oob image, which can be available by using the
   tool "unspare2" on the target device, while creating/extracting the image.

2. Modify the default the oob layout in the source by the following 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};
--------------------------------------------------------------------

Original comment by penguin.lin on 20 Jan 2012 at 7:03

GoogleCodeExporter commented 8 years ago

Original comment by penguin.lin on 20 Jan 2012 at 7:12

GoogleCodeExporter commented 8 years ago
Issue 25 has been merged into this issue.

Original comment by penguin.lin on 10 Mar 2012 at 2:09

GoogleCodeExporter commented 8 years ago
Confrmed. But the following workaround works for me (a 64 bit host and the 
android-sdks/system-images/android-15/x86/system.img):

unyaffs2 -s 64 --yaffs-ecclayout system.img

Original comment by j...@softace.dk on 19 Dec 2012 at 1:32