[U-Boot] Two CRC32 implementation in U-Boot, why?

Bin Meng bmeng.cn at gmail.com
Wed Aug 1 12:13:16 UTC 2018


Hi,

Currently it seems that we have two CRC32 implementation in U-Boot.
Two headers files are provided.

1. include/linux/crc32.h
The implementation is drivers/mtd/ubi/crc32.c.
Codes that use this implementation include:

drivers/mtd/ubi/*
drivers/mtd/ubispl/*
fs/ubifs/*

2. include/u-boot/crc.h
The implementation is lib/crc32.c
Codes that use this implementation include:

fs/btrfs/hash.c
tools/*
common/hash.c
common/image.c
common/image-fit.c
lib/efi_loader/efi_boottime.c

It looks that include/linux/crc32.h was originally imported from Linux
kernel's include/linux/crc32.h, but the implementation in Linux
kernel's lib/crc32.c was not imported to U-Boot's lib/crc32.c but to
drivers/mtd/ubi/crc32.c. Why?

Somehow U-Boot lib/crc32.c uses another different implementation from zlib.

This is a mess. For example if I include both headers in one C file,
it won't compile.

Can we clean this up?

Regards,
Bin


More information about the U-Boot mailing list