[U-Boot-Users] U-Boot code checksum?
wd at denx.de
Tue Nov 25 16:43:53 CET 2003
In message <B64365CEC50FA74DB2B72D3F7A5D4C7D10AD30 at EPEXCH02.qlogic.org> you wrote:
> Does the U-Boot code generate and check a
> checksum or CRC on itself? I see code to verify
> CRC checksums on images that U-Boot loads into
> memory, but I do not see any code that checks the
> U-Boot image itself.
I'm not sure what you mean with "image" here. If you build a U-Boot
image (meaning using the "mkimage" tool to create an image out of the
"u-boot.bin" file) this _will_ have checksums included and checked.
The U-Boot code as stored in flash does compute or check a checksum.
> If there is a function that checks the U-Boot CRC or
> checksum, could someone point it out to me?
You can use the CRC command to compute a checksum, and store it at
location of your choice. Note however that with many board configu-
rations this will not work (especially with those that use an
> We burn the U-Boot code into a boot PROM and I need
> some way of verifying the boot PROM was burned correctly
> when the system powers up. I've written checksum generation
> and verification utilities in the past but would
> prefer to use the utilities that come with U-Boot if
> they exist.
You can use the existing CRC32 code in U-Boot for such a purpose, but
be aware that you have a chicken-and-egg problem here. If you assume
that the U-Boot image in the PROM is corrupted but still running god
enough that you can do _anything_ with it - what makes you believe
that it will calculate a valid checksum then? If the image is
corrupted, it might be exactly the part of the code that does the
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
"Why waste negative entropy on comments, when you could use the same
entropy to create bugs instead?" - Steve Elias
More information about the U-Boot