mtd-utils flash_erase progress

Eric Kenny eric.kenny at gmail.com
Mon Jul 31 07:36:11 PDT 2023


There seems to be a problem with flash_erase in that it does not
update progress.  I believe this patch fixes it:

diff --git a/misc-utils/flash_erase.c b/misc-utils/flash_erase.c
index 49a880f..8cdefaf 100644
--- a/misc-utils/flash_erase.c
+++ b/misc-utils/flash_erase.c
@@ -53,8 +53,10 @@ int target_endian = __BYTE_ORDER;

 static void show_progress(off_t start, int eb, int eb_start, int
eb_cnt, int step)
 {
-       bareverbose(!quiet, "\rErasing %d Kibyte @ %llx -- %2i %% complete ",
-               step / 1024, (unsigned long long)start, ((eb -
eb_start) * 100) / eb_cnt);
+       printf("\rErasing %d Kibyte @ %"PRIxoff_t" -- %2.0f %% complete ",
+         mtd->eb_size / 1024,
+         (unsigned long long)start + (eb * mtd->eb_size),
+         ((float)(eb - eb_start)*100 / eb_cnt));
        fflush(stdout);
 }



More information about the linux-mtd mailing list