* [PATCH] fastboot: fix CRC32 chunk size checking
@ 2023-09-25 10:37 Wojciech Nizinski
2023-10-02 7:44 ` Mattijs Korpershoek
2023-10-31 13:44 ` Mattijs Korpershoek
0 siblings, 2 replies; 3+ messages in thread
From: Wojciech Nizinski @ 2023-09-25 10:37 UTC (permalink / raw)
To: u-boot; +Cc: Wojciech Nizinski, Mattijs Korpershoek
genimage create android-sparse file with CRC32 chunk at end. When
U-Boot's fastboot receives this chunk it returns error message:
`Fail Bogus chunk size for chunk type Dont Care`
According to reference implementation of Android's sparse file format:
<https://android.googlesource.com/platform/system/core/+/refs/heads/main/
libsparse/output_file.cpp#513>
the chunk_header.total_sz is CHUNK_HEADER_LEN + 4 (CRC32 size).
Signed-off-by: Wojciech Nizinski <niziak@spox.org>
---
lib/image-sparse.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/image-sparse.c b/lib/image-sparse.c
index 8f8a67e158..323aad981c 100644
--- a/lib/image-sparse.c
+++ b/lib/image-sparse.c
@@ -289,8 +289,8 @@ int write_sparse_image(struct sparse_storage *info,
case CHUNK_TYPE_CRC32:
if (chunk_header->total_sz !=
- sparse_header->chunk_hdr_sz) {
- info->mssg("Bogus chunk size for chunk type Dont Care",
+ sparse_header->chunk_hdr_sz + sizeof(uint32_t)) {
+ info->mssg("Bogus chunk size for chunk type CRC32",
response);
return -1;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fastboot: fix CRC32 chunk size checking
2023-09-25 10:37 [PATCH] fastboot: fix CRC32 chunk size checking Wojciech Nizinski
@ 2023-10-02 7:44 ` Mattijs Korpershoek
2023-10-31 13:44 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2023-10-02 7:44 UTC (permalink / raw)
To: Wojciech Nizinski, u-boot; +Cc: Wojciech Nizinski
Hi Wojciech,
Thank you for your patch.
On lun., sept. 25, 2023 at 12:37, Wojciech Nizinski <niziak@spox.org> wrote:
> genimage create android-sparse file with CRC32 chunk at end. When
> U-Boot's fastboot receives this chunk it returns error message:
> `Fail Bogus chunk size for chunk type Dont Care`
I could not reproduce this, probably because my sparse images don't have
crc32 chunks.
>
> According to reference implementation of Android's sparse file format:
>
> <https://android.googlesource.com/platform/system/core/+/refs/heads/main/
> libsparse/output_file.cpp#513>
>
> the chunk_header.total_sz is CHUNK_HEADER_LEN + 4 (CRC32 size).
>
> Signed-off-by: Wojciech Nizinski <niziak@spox.org>
However, the change looks fine to me.
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
I also tested by reflashing a super image from aosp/main on the vim3 board.
Base commit: 2173c4a99066 ("Merge tag 'u-boot-at91-fixes-2023.10-b' of https://source.denx.de/u-boot/custodians/u-boot-at91")
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
> ---
>
> lib/image-sparse.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/image-sparse.c b/lib/image-sparse.c
> index 8f8a67e158..323aad981c 100644
> --- a/lib/image-sparse.c
> +++ b/lib/image-sparse.c
> @@ -289,8 +289,8 @@ int write_sparse_image(struct sparse_storage *info,
>
> case CHUNK_TYPE_CRC32:
> if (chunk_header->total_sz !=
> - sparse_header->chunk_hdr_sz) {
> - info->mssg("Bogus chunk size for chunk type Dont Care",
> + sparse_header->chunk_hdr_sz + sizeof(uint32_t)) {
> + info->mssg("Bogus chunk size for chunk type CRC32",
> response);
> return -1;
> }
> --
> 2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fastboot: fix CRC32 chunk size checking
2023-09-25 10:37 [PATCH] fastboot: fix CRC32 chunk size checking Wojciech Nizinski
2023-10-02 7:44 ` Mattijs Korpershoek
@ 2023-10-31 13:44 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2023-10-31 13:44 UTC (permalink / raw)
To: u-boot, Wojciech Nizinski
Hi,
On Mon, 25 Sep 2023 12:37:15 +0200, Wojciech Nizinski wrote:
> genimage create android-sparse file with CRC32 chunk at end. When
> U-Boot's fastboot receives this chunk it returns error message:
> `Fail Bogus chunk size for chunk type Dont Care`
>
> According to reference implementation of Android's sparse file format:
>
> <https://android.googlesource.com/platform/system/core/+/refs/heads/main/
> libsparse/output_file.cpp#513>
>
> [...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] fastboot: fix CRC32 chunk size checking
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/355aab94d1f675ec1118906e1f88dfdf6a3582eb
--
Mattijs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-31 13:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 10:37 [PATCH] fastboot: fix CRC32 chunk size checking Wojciech Nizinski
2023-10-02 7:44 ` Mattijs Korpershoek
2023-10-31 13:44 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox