dumpimage: fix handling of StarFive SPL too long
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 4 Mar 2025 16:04:03 +0000 (17:04 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 18 Mar 2025 14:17:32 +0000 (08:17 -0600)
commit15ba2b7356af035bc7dfd5c279e9658291fc7cf3
treeda0e1123a476b50ab2061629d96699b92c420b27
parent301c2ab729447b0f7c602e054c3f22a5a9df1b24
dumpimage: fix handling of StarFive SPL too long

The header of the StarFive U-Boot SPL file u-boot-spl.normal.out has a
field indicating the payload size. When copying U-Boot SPL from a
partition the copied file might be too long.

Currently in this situation a misleading error message 'Incorrect CRC32' is
written.

We must use the payload size and not the file size when calculating the
CRC32.

Write a warning if the file is too long indicating the correct size. This
enables the user to truncate the file accordingly.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
tools/sfspl.c