aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Maier <brandon.maier@collins.com>2022-11-02 17:47:56 -0500
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-11-07 08:24:44 +0100
commit7b5557499a5f2ef612a54014c4f4e8d368d35bd6 (patch)
tree5a32dc60b9a99b385bb65369d556c53773010f2f
parent92d826ac57e753da120a82cded354931b3fe8e76 (diff)
misc-utils: flashcp: verify data in --partition
The --partition mode is not verifying that data is being written successfully. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--misc-utils/flashcp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/misc-utils/flashcp.c b/misc-utils/flashcp.c
index 1dc0877..f4acba5 100644
--- a/misc-utils/flashcp.c
+++ b/misc-utils/flashcp.c
@@ -464,6 +464,15 @@ DIFF_BLOCKS:
/* write to device */
safe_lseek(dev_fd, current_dev_block, SEEK_SET, device);
safe_write(dev_fd,src,i,written,(unsigned long long)filestat.st_size,device);
+
+ /* read from device */
+ safe_lseek(dev_fd, current_dev_block, SEEK_SET, device);
+ safe_read (dev_fd,device,dest,i);
+
+ /* compare buffers for write success */
+ if (memcmp (src,dest,i))
+ log_failure("File does not seem to match flash data. First mismatch at 0x%.8zx-0x%.8zx\n",
+ written,written + i);
}
erase.start += i;