From patchwork Tue Feb 9 19:19:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Rae X-Patchwork-Id: 61591 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2228707lbl; Tue, 9 Feb 2016 11:19:42 -0800 (PST) X-Received: by 10.194.22.132 with SMTP id d4mr35839441wjf.174.1455045582570; Tue, 09 Feb 2016 11:19:42 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id kv9si50853156wjb.199.2016.02.09.11.19.42; Tue, 09 Feb 2016 11:19:42 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 571AEA74E4; Tue, 9 Feb 2016 20:19:41 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s31nXMU3Rb4s; Tue, 9 Feb 2016 20:19:41 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9FDB0A74D5; Tue, 9 Feb 2016 20:19:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DEFBCA74D5 for ; Tue, 9 Feb 2016 20:19:37 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2V8T7e8RsIm3 for ; Tue, 9 Feb 2016 20:19:37 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-irv-18.broadcom.com (5520-maca-inet1-outside.broadcom.com [216.31.211.11]) by theia.denx.de (Postfix) with ESMTP id 8B80BA74A8 for ; Tue, 9 Feb 2016 20:19:33 +0100 (CET) Received: from mail-irva-13.broadcom.com (mail-irva-13.broadcom.com [10.11.16.103]) by mail-irv-18.broadcom.com (Postfix) with ESMTP id A764D82035; Tue, 9 Feb 2016 11:19:31 -0800 (PST) Received: from VM-host64-64-A1.ric.broadcom.com (unknown [10.136.4.105]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id B1F2840FE5; Tue, 9 Feb 2016 11:19:25 -0800 (PST) From: Steve Rae To: u-boot@lists.denx.de Date: Tue, 9 Feb 2016 11:19:10 -0800 Message-Id: <1455045551-12971-1-git-send-email-srae@broadcom.com> X-Mailer: git-send-email 1.8.5 Cc: Steve Rae Subject: [U-Boot] [PATCH v2 1/2] fastboot: sparse: fix block addressing for don't care chunk type X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When 7bfc3b1 (sparse: Refactor chunk parsing function) was implemented, it dropped 9981945 (aboot: fix block addressing for don't care chunk type). This re-implements the required fix for the "don't care chunk type"... Signed-off-by: Steve Rae --- Changes in v2: Handle MMC device differently than the NAND device. common/image-sparse.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 1.8.5 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/common/image-sparse.c b/common/image-sparse.c index dffe844..ef0d232 100644 --- a/common/image-sparse.c +++ b/common/image-sparse.c @@ -330,9 +330,13 @@ int store_sparse_image(sparse_storage_t *storage, void *storage_priv, * and go on parsing the rest of the chunks */ if (chunk_header->chunk_type == CHUNK_TYPE_DONT_CARE) { - skipped += sparse_block_size_to_storage(chunk_header->chunk_sz, - storage, - sparse_header); + blkcnt = sparse_block_size_to_storage(chunk_header->chunk_sz, + storage, + sparse_header); +#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV + total_blocks += blkcnt; +#endif + skipped += blkcnt; continue; } @@ -380,7 +384,7 @@ int store_sparse_image(sparse_storage_t *storage, void *storage_priv, printf("........ wrote %d blocks to '%s'\n", total_blocks, storage->name); - if ((total_blocks + skipped) != + if (total_blocks != sparse_block_size_to_storage(sparse_header->total_blks, storage, sparse_header)) { printf("sparse image write failure\n");