Skip to contentSkip to conversation

fastboot: sparse: fix block addressing for don't care chunk type

PATCH New Steve Rae 4 participants 10 messages Feb 9, 2016 – Apr 12, 2016

lore
Share & tools
lore

Steve Rae

author
#0 lore raw

PATCH v2 1/2 fastboot: sparse: fix block addressing for don't care chunk type

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"...

---

Changes in v2:
Handle MMC device differently than the NAND device.

 common/image-sparse.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
common/image-sparse.c +8 -4
index dffe844..ef0d232 100644
@@ -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");
Signature · 1 line
1.8.5
author
#1 lore raw

PATCH v2 2/2 fastboot: sparse: remove unnecessary logging

remove logging of the 'skipped' blocks

---

Changes in v2: None

 common/image-sparse.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
common/image-sparse.c +2 -4
index ef0d232..737e8ea 100644
@@ -275,7 +275,6 @@ int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
 	sparse_buffer_t *buffer;
 	uint32_t start;
 	uint32_t total_blocks = 0;
-	uint32_t skipped = 0;
 	int i;
 
 	debug("=== Storage ===\n");
@@ -336,7 +335,6 @@ int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
 #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
 			total_blocks += blkcnt;
 #endif
-			skipped += blkcnt;
 			continue;
 		}
 
@@ -377,8 +375,8 @@ int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
 		sparse_put_data_buffer(buffer);
 	}
 
-	debug("Wrote %d blocks, skipped %d, expected to write %d blocks\n",
-	      total_blocks, skipped,
+	debug("Wrote %d blocks, expected to write %d blocks\n",
+	      total_blocks,
 	      sparse_block_size_to_storage(sparse_header->total_blks,
 					   storage, sparse_header));
 	printf("........ wrote %d blocks to '%s'\n", total_blocks,
Signature · 1 line
1.8.5
#2 lore raw

PATCH v2 2/2 fastboot: sparse: remove unnecessary logging

please, can this be accepted?

Quoted 48 lines · Steve Rae

remove logging of the 'skipped' blocks

---

Changes in v2: None

 common/image-sparse.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
common/image-sparse.c +0 -1
index ef0d232..737e8ea 100644
@@ -275,7 +275,6 @@ int store_sparse_image(sparse_storage_t *storage, void
 *storage_priv,
        sparse_buffer_t *buffer;
        uint32_t start;
        uint32_t total_blocks = 0;
-       uint32_t skipped = 0;
        int i;
 
        debug("=== Storage ===\n");
common/image-sparse.c +2 -3
@@ -336,7 +335,6 @@ int store_sparse_image(sparse_storage_t *storage, void
 *storage_priv,
 #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
                        total_blocks += blkcnt;
 #endif
-                       skipped += blkcnt;
                        continue;
                }
@@ -377,8 +375,8 @@ int store_sparse_image(sparse_storage_t *storage, void
 *storage_priv,
                sparse_put_data_buffer(buffer);
        }
 
-       debug("Wrote %d blocks, skipped %d, expected to write %d blocks\n",
-             total_blocks, skipped,
+       debug("Wrote %d blocks, expected to write %d blocks\n",
+             total_blocks,
              sparse_block_size_to_storage(sparse_header->total_blks,
                                           storage, sparse_header));
        printf("........ wrote %d blocks to '%s'\n", total_blocks,

--
1.8.5

#3 lore raw

PATCH v2 2/2 fastboot: sparse: remove unnecessary logging

In reply to Steve Rae
Quoted 3 lines · Steve Rae

remove logging of the 'skipped' blocks

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160309/dba9603d/attachment.sig>
#5 lore raw

PATCH v2 2/2 fastboot: sparse: remove unnecessary logging

In reply to Steve Rae
Quoted 4 lines · Steve Rae

remove logging of the 'skipped' blocks

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160411/60ed7743/attachment.sig>
#6 lore raw

PATCH v2 1/2 fastboot: sparse: fix block addressing for don't care chunk type

In reply to Steve Rae

please, can this be accepted?

Quoted 54 lines · Steve Rae

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"...

---

Changes in v2:
Handle MMC device differently than the NAND device.

 common/image-sparse.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
common/image-sparse.c +1 -3
index dffe844..ef0d232 100644
@@ -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,

common/image-sparse.c +7 -1
+                                                             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");

--
1.8.5

#7 lore raw

PATCH v2 1/2 fastboot: sparse: fix block addressing for don't care chunk type

In reply to Steve Rae
Quoted 6 lines · Steve Rae

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"...

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160309/7dc7e660/attachment.sig>
#8 lore raw

PATCH v2 1/2 fastboot: sparse: fix block addressing for don't care chunk type

Quoted 10 lines · Maxime Ripard
Quoted 6 lines · Steve Rae

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"...

Quoted 7 lines

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

can this be applied? Thanks

#9 lore raw

PATCH v2 1/2 fastboot: sparse: fix block addressing for don't care chunk type

In reply to Steve Rae
Quoted 7 lines · Steve Rae

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"...

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160411/b64aa96b/attachment.sig>