marksalpeter / yaffs2utils

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

err:image size (318665764) is NOT a mutiple of 2048 + 64 #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I use newest svn version of unyaffs on a android image,but failed:
$ sudo unyaffs2 system.img android
unyaffs2-0.2.4: image extracting tool for YAFFS2
image size (318665764) is NOT a mutiple of 2048 + 64

operation incomplete
files contents may be broken

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by zhangchu...@gmail.com on 16 Mar 2012 at 5:45

GoogleCodeExporter commented 8 years ago
Is your image directly dumped from the device!?

Original comment by penguin.lin on 16 Mar 2012 at 7:43

GoogleCodeExporter commented 8 years ago
Nope,I tried it on a img build from android source,maybe this tools can not use 
with this kind of img?
Thanks.

Original comment by zhangchu...@gmail.com on 16 Mar 2012 at 8:00

GoogleCodeExporter commented 8 years ago
What the tool did you use to create the YAFFS2 image, mkyaffs2image!?

Original comment by penguin.lin on 16 Mar 2012 at 8:58

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

Any response!?
Or I cannot duplicate this issue.

Thanks

Original comment by penguin.lin on 22 Mar 2012 at 1:25

GoogleCodeExporter commented 8 years ago
Yes,it is mkyaffs2image
But I am not sure if the vendor have modify this tool.

Original comment by zhangchu...@gmail.com on 22 Mar 2012 at 7:03

GoogleCodeExporter commented 8 years ago
Basically, a image created by mkyaffs2 or mkyaffs2image should be the page 
aligement, so the image size should be the multiple of 2048(page size) + 
64(spare size). 
I will check  the latest implementation of the official mkyaffs2image, and try 
duplicating this issue by the official release.

Original comment by penguin.lin on 22 Mar 2012 at 1:26

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

On my local machine, the unyaffs2 can extract the image made from the official 
release dated 20120311.

Does the image contain any header!?

I will verify it again by the latest official release tomorrow morning.

Original comment by penguin.lin on 22 Mar 2012 at 2:53

GoogleCodeExporter commented 8 years ago
Would you kindly provide the NAND flash spec - only page and spare size are 
required.

Thanks a lot.

Original comment by penguin.lin on 12 Apr 2012 at 5:50

GoogleCodeExporter commented 8 years ago
Dear  zhangchunlin:

I am trying adding supports of various NAND layout for yaffs2utils.
Would you kindly provide me your NAND flash model (or page and spare size).

Thanks a lot!

Original comment by penguin.lin on 13 Apr 2012 at 4:16

GoogleCodeExporter commented 8 years ago
How can I obtain the NAND flash model?To see the driver code?

Original comment by zhangchu...@gmail.com on 14 Apr 2012 at 4:37

GoogleCodeExporter commented 8 years ago
Dear  zhangchunlin:

NAND flash model would be available from the datasheet :D

Original comment by penguin.lin on 16 Apr 2012 at 6:17

GoogleCodeExporter commented 8 years ago
Dear  zhangchunlin:

Any repose?

The latest version on the trunk add supports to specify not only page size but 
spare size for both "mkyaffs2" and "unyaffs2". If your flash information cannot 
be published, please use the latest version and specify the page and spare size 
to extract the image.

ps. The page and spare size for your flash may be available from
    1.  flash datasheet, 
    2. mkyaffs2image source

Thanks a lot.

Original comment by penguin.lin on 17 Apr 2012 at 8:30

GoogleCodeExporter commented 8 years ago
Dear  zhangchunlin:

I found that "mtd_utils" can help you to get the page and spare size for your 
NAND.
such as "mtd_debug info $DEV_NODE":

Original comment by penguin.lin on 20 Apr 2012 at 6:46

GoogleCodeExporter commented 8 years ago
I read a datasheet of one MCP we use:
<NAND Flash>
• Page Read Operation
  - Page Size :  (2K + 64)Word
  - Random Read : 60μs(Max.) (TBD)
  - Serial  Access : 42ns(Min.) 

But can not find spare size

Original comment by zhangchu...@gmail.com on 20 Apr 2012 at 7:05

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
According to the display, I think your flash is 2K page with 64 bytes spare.
I can send you a patch to skip the size checking, but I cannot provide any 
guarantee.
On my local machine, the unyaffs2 can extract the image made from the official 
"mkyaffs2image".
If you can provide your mkyaffs2image, I will be glad to try solving this 
problem.

Original comment by penguin.lin on 27 Jun 2012 at 9:33

GoogleCodeExporter commented 8 years ago
Hi, penguin.lin:
  I have use another tool: https://github.com/ehlers/unyaffs.git,and found it can extract my image with no error.

Original comment by zhangchu...@gmail.com on 27 Jun 2012 at 1:08

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

Would you kindly help me test the current implementation?
I skip the size check and simply show a warning.

Thanks a lot.

Original comment by penguin.lin on 6 Jul 2012 at 2:57

GoogleCodeExporter commented 8 years ago
Now my local git is in the version of newest 
2cd89fbb0c3e03c923fb90370bec157979bd2be2,but still got err output:
'''
➜  target_bin  unyaffs2 system.img system
unyaffs2 0.2.9: image extracting tool for YAFFS2.
warning: non-root users.

image size (397292988) is NOT a mutiple of 2048 + 64
scanning image 'system.img'... [done]
scanning complete, total objects: 1

building fs tree ... [done]
building complete, total objects: 19

extracting image into 'system'
[======                                                                         
                                               ]  1/19   5%
object 163708932: [????] '' (FAILED).
object 59539655: [????] '' (FAILED).
[=============                                                                  
                                               ]  2/19  10%
object 76391026: [????] '' (FAILED).
[==========================                                                     
                                               ]  4/19  21%
object 49657374: [????] '' (FAILED).
[=================================                                              
                                               ]  5/19  26%
object 230484786: [????] '' (FAILED).
object 255912867: [????] '' (FAILED).
[=======================================                                        
                                               ]  6/19  31%
object 102567487: [????] '' (FAILED).
object 134872648: [????] '' (FAILED).
object 10522194: [????] '' (FAILED).
[==============================================                                 
                                               ]  7/19  36%
object 45793172: [????] '' (FAILED).

modify files attributes... [*]operation incomplete,
files contents may be broken!!!
➜  target_bin  l system
总用量 1
drwxr-xr-x 2 zhangclb zhangclb 200 2012-07-09 09:07 .
drwx------ 4 zhangclb zhangclb 704 2012-07-09 09:07 ..
--w------- 1 zhangclb zhangclb   0 2031-09-27 13:45 ?'?
-rwx--x--t 1 zhangclb zhangclb   0 2076-05-22 17:22 ???????????
---x-ws--x 1 zhangclb zhangclb   0 1971-03-14 16:00 ???
---------- 1 zhangclb zhangclb   0 1970-01-01 08:03 ?1?
--w--wxrw- 1 zhangclb zhangclb   0 1978-01-02 15:10 ??2
-rwxrw---- 1 zhangclb zhangclb   0 2023-05-26 19:19 ?b?
➜  target_bin  

'''

Original comment by zhangchu...@gmail.com on 9 Jul 2012 at 1:10

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

Thanks a lot.
If a testing image can be provided, I will appreciate your kindly help!

Original comment by penguin.lin on 9 Jul 2012 at 1:50

GoogleCodeExporter commented 8 years ago
How can I transfer a big file to you?

Original comment by zhangchu...@gmail.com on 9 Jul 2012 at 2:39

GoogleCodeExporter commented 8 years ago
Send it directly to me
penguin.lin dot gmail.com     (dot -> @)

Thanks a lot :D

Original comment by penguin.lin on 9 Jul 2012 at 2:58

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

This URL will show "Connection timed out".
I will try it again later.

Thanks for your kindly help :D

Original comment by penguin.lin on 9 Jul 2012 at 4:15

GoogleCodeExporter commented 8 years ago
Pls try now.

Original comment by zhangchu...@gmail.com on 9 Jul 2012 at 6:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Dear zhangchunlin,

I got the file, thanks a lot.

For private, I will delete your previous comments that contain URL message.
I will start to analysis the image tonight. 

Thanks a lot! :D

Original comment by penguin.lin on 10 Jul 2012 at 6:07

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

The image has the format:
chunk size = 4096
spare size = 128
ECC layout = yaffs-ecclayout

The testing image can be extracted by the command:
"unyaffs2 -p 4096 -s 128 --yaffs-ecclayout userdata.img test".

Please confirm that at your side.

The unyaffs-ehlers has the capacity to detect the image layout,
and it can extract the image without any options.

Thanks a lot. :D

Original comment by penguin.lin on 13 Jul 2012 at 6:31

GoogleCodeExporter commented 8 years ago
Hi,
I tried your tool on a image created by mkyaffs2img(android 4.0.3).
*by run:
`../yaffs2utils-0.2.9/unyaffs2 /opt/a4-imgs/system.img system`
No error occured, but I got nothing in directory `system`
*bu if I run
`../yaffs2utils-0.2.9/unyaffs2 --yaffs-ecclayout /opt/a4-imgs/system.img system`
I can get the right content in directory system.

page size: 2KB
spare size: 64B
Maybe there is bug there.

BTW, 
I don't know much about yaffs, so I don't whether the image need 
--yaffs-ecclayout until I saw this issue.
Does all images created by mkyaffs2img have ecc? Do you think it's a good idea 
to add a option like '--mkyaffs2img' to trigger --yaffs-ecclayout.

Original comment by ybzhao1...@gmail.com on 18 Jul 2012 at 1:52

GoogleCodeExporter commented 8 years ago
Maybe changing "--yaffs-ecclayout" to "yaffs-oobscheme" will be more clear.

Simply saying, the oob scheme used by official tool "mkyaffs2image" is 
different from the default one used by the "yaffs2utils". README can be 
referenced  for more information:

By default, the oob scheme used by native Linux is different from the one used
by the official "mkyaffs2image" tool. In Linux MTD subsystem, it use the first
two byte in the oob free area to mark the bad block, but the official tool
"mkyaffs2image" use all of the free area to record YAFFS2 private data (it has
its own bad block marker mechanism). If a image is requested to be created
compatibly with the one made from the official "mkyaffs2image" tool, the option
'--yaffs-ecclayout' has to be specified. It will create a image that use the
full free space in the oob area without shifting the first two byte for the bad
block marker by Linux MTD subsystem default.

Original comment by penguin.lin on 18 Jul 2012 at 2:50

GoogleCodeExporter commented 8 years ago
I use on another file and got error:
➜  unyaffs2 -p 4096 -s 128 --yaffs-ecclayout system.img test
unyaffs2 0.2.9: image extracting tool for YAFFS2.
warning: non-root users.

scanning image 'system.img'... [done]
scanning complete, total objects: 754

building fs tree ... [done]
building complete, total objects: 861

extracting image into 'test'
[=============================================                                  
                                             ] 314/861  36%
object 570: [????] 'etc/firmware/MTK_MT6620_DUMMY_Patch.nb0' (FAILED).
[===============================================================================
============================================ ] 860/861  99%

modify files attributes... [*]

operation incomplete,
files contents may be broken!!!

Original comment by zhangchu...@gmail.com on 18 Jul 2012 at 3:22

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin

I will be glad to try solving your problem if you can send the image to me.
Or, please enable DEBUG flag in Makefile to see what's wrong.

Original comment by penguin.lin on 18 Jul 2012 at 3:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This is a bug while creating an empty file.

What attached is the patch to fix this bug.
Please patch it and try again. :D

Original comment by penguin.lin on 18 Jul 2012 at 5:15

Attachments:

GoogleCodeExporter commented 8 years ago
If I have read the README before I use unyaffs, I won't forget to use that 
option for ecc/oob.

Original comment by ybzhao1...@gmail.com on 18 Jul 2012 at 5:48

GoogleCodeExporter commented 8 years ago
I want a file in the factory image of Nexus S.
So, I downloaded this file: 
https://dl.google.com/dl/android/aosp/soju-imm76d-factory-ca4ae9ee.tgz
But, when trying to extract the content of system.img, I got the similar error 
as zhangchunlin's.
I tried option: -e, -p xxxx or --yaffs-ecclayout, none works.

Original comment by ybzhao1...@gmail.com on 18 Jul 2012 at 6:08

GoogleCodeExporter commented 8 years ago
Dear ybzhao1989:

Is it a pure YAFFS2 image?
(not a rfs/ext4/yffs4 mixed image)

Original comment by penguin.lin on 18 Jul 2012 at 8:09

GoogleCodeExporter commented 8 years ago
Dear zhangchunlin:

Did the patch solve your problem?

Original comment by penguin.lin on 18 Jul 2012 at 8:10

GoogleCodeExporter commented 8 years ago
Penguin.lin,
  This patch works!

Original comment by zhangchu...@gmail.com on 18 Jul 2012 at 8:17

GoogleCodeExporter commented 8 years ago
Actually, I don't know the image type of it.
Maybe some fs type used by samsung.

Original comment by ybzhao1...@gmail.com on 20 Jul 2012 at 5:10

GoogleCodeExporter commented 8 years ago
Some guy on stackoverflow said that Nexus S uses ext4.
http://stackoverflow.com/a/5171224/1061357
but I can't mount the system.img by:
sudo mount -t ext4  -oloop system.img mnt
or
sudo mount -t ext3  -oloop system.img mnt

`dmesg | tail` shows me:
[74051.826048] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[74985.976639] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[75032.785766] EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0.

Do you have any idea about the filesystem of that image?
Though it's not related to yaffs2, I will greatly appreciate that if you can 
give me some help.

Original comment by ybzhao1...@gmail.com on 20 Jul 2012 at 5:27

GoogleCodeExporter commented 8 years ago
hi, penguin.lin
Thanks for your tips about the type of the image.

I have mounted system.img successfully
This article helped me:
http://andwise.net/?p=403

Original comment by ybzhao1...@gmail.com on 20 Jul 2012 at 5:55

GoogleCodeExporter commented 8 years ago
Dear ybzhao1989:

It is a good news, congratulations.
I didn't help much., you find the answer yourself. XD

Original comment by penguin.lin on 20 Jul 2012 at 6:17

GoogleCodeExporter commented 8 years ago
hi,I hava the same problem .help me?I don't konw how to get the image file 
format????

Original comment by lilei198...@gmail.com on 22 Apr 2013 at 2:57

GoogleCodeExporter commented 8 years ago
Hi,

I have still an image where I didn't get any results from the Tools.
Neither from yaffs2 nor from yaffs2 by ehlers.
I also tried 
unyaffs2 -p 4096 -s 128
with no hope. 
It extracted to an empty folder.

./unyaffs-ehl -d boot.img
Detected flash layout(s):
-- none --

./unyaffs-ehl -b -v boot.img boot-folder/
Can't determine flash layout, perhaps not a yaffs2 image

Magic Number of this file is:
ANDROID!x

Any Ideas, would be very appriciated!
Thanks in advance!

Original comment by gruenbla...@gmail.com on 9 Feb 2014 at 9:20