mkfs.ubifs gives corrupt images/crc errors

Leo Barnes barnes.leo at gmail.com
Thu Sep 2 13:28:02 EDT 2010


> I cannot reproduce this. Does this still happen for you? Does cloning
> the mtd-utils git tree anew help?
>

Hello!

Sorry for not answering earlier, I was on vacation without internet
access. I have not tested the absolutely latest commits, but I have
now identified the problem.

In commit 2d40ed7b415bcb6a358c9f221160c4a419f01f19, the
crc-calculation function changed from being an inline function to a
linked function called crc32. There already exists a crc32 function
with the same arguments in ZLIB, which does not seem to give the same
checksums as the mtd-utils crc-function. After the mentioned commit,
mkfs.ubifs seems to use the ZLIB crc32-function instead of the
mtd-utils version which is what gives the faulty checksums.

I managed to fix this in two simple ways:
1. Change the order of linking in the makefile so that libmtd comes
before libz. This might possibly break ZLIB (I have not tried this
when using ZLIB).
2. Change the name of the mtd-utils crc32 function.

Changing the name of the function is probably the preferred option.

Best regards,
//Leo



More information about the linux-mtd mailing list