Different zlib CRC Algorithms

Phil Thompson phil at river-bank.demon.co.uk
Tue Feb 4 11:44:40 EST 2003

On Tuesday 04 February 2003 4:24 pm, Joakim Tjernlund wrote:
> > mkfs.jffs2 is linked against -lz but first links in crc32.o from the mtd
> > tree, ie. it seems to be using the kernel zlib not the userspace zlib (at
> > least for crc32()).
> >
> > I found this putting together my bootloader JFFS2 reader which I'm doing
> > first as a Linux application - and so using userspace zlib. I have to
> > calculate the CRC as follows...
> >
> > 	crc = (crc32(crc ^ 0xffffffff),buf,len) ^ 0xffffffff);
> >
> > ...otherwise all the CRC checks fail.
> What bootloader? If ppcboot/uboot I think you will find that
> ppcboot/uboot has 2 versions of crc32 and you are using the
> wrong one?

As I said above, at the moment I'm implementing it as a Linux application and 
so using the crc32() in userspace zlib which (I am suggesting) is different 
to the one in the kernel.

Why does ppcboot/uboot have two versions of crc32()? What's the difference 
between them?


More information about the linux-mtd mailing list