This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 731a8a3ed system/fastboot: fix the sparse chunk walk
731a8a3ed is described below

commit 731a8a3ed6d1180325c4ee8ff07be510171c0bfc
Author: wangjianyu3 <[email protected]>
AuthorDate: Fri Oct 23 16:35:01 2026 +0800

    system/fastboot: fix the sparse chunk walk
    
    DONT_CARE must advance the output offset or later chunks land on earlier
    ones; CRC32 chunks carry 4 bytes to skip; FILL data is little-endian.
    
    Assisted-by: OpenCode:mimo-v2.6-pro
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/fastboot/fastboot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c
index cee92b20c..7a7635ea3 100644
--- a/system/fastboot/fastboot.c
+++ b/system/fastboot/fastboot.c
@@ -546,7 +546,7 @@ static int fastboot_flash_program(FAR struct fastboot_ctx_s 
*ctx, int fd)
             break;
           case FASTBOOT_CHUNK_FILL:
             {
-              uint32_t fill_data = be32toh(*(FAR uint32_t *)chunk_ptr);
+              uint32_t fill_data = le32toh(*(FAR uint32_t *)chunk_ptr);
               uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz;
 
               ret = ffastboot_flash_fill(fd, ctx->download_offset, fill_data,
@@ -561,7 +561,10 @@ static int fastboot_flash_program(FAR struct 
fastboot_ctx_s *ctx, int fd)
             }
             break;
           case FASTBOOT_CHUNK_DONT_CARE:
+            ctx->download_offset += chunk->chunk_sz * sparse->blk_sz;
+            break;
           case FASTBOOT_CHUNK_CRC32:
+            chunk_ptr += 4;
             break;
           default:
             fb_err("Error chunk type:%d, skip\n", chunk->chunk_type);

Reply via email to