Skip to contentSkip to conversation

Add ubiscan utility

PATCH Applied Diego Ismirlian 2 participants 2 messages Aug 17, 2021 – Sep 6, 2021 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ubiscan utility

ubiscan will scan the PEBs in a specific MTD device and print a summary of the PEB erase counters and (optionally) details about each PEB's status.

Example output:

# ./ubiscan /dev/mtd6
Summary
=========================================================
mtd    : 6
type   : nand
size   : 110362624 bytes (105.2 MiB)
PEBs   : 842
min I/O: 2048 bytes

PEB erase counters
=========================================================
valid : 834
empty : 0
corrupted: 0
alien : 0
bad : 8

Histogram
=========================================================
from to count min avg max
---------------------------------------------------------

0        ..        9:       55        1        4        9
10       ..       99:      174       10       48       99
100      ..      999:      514      103      287      987
1000     ..     9999:       91     1004     1880     2251
10000    ..    99999:        0        0        0        0
100000   ..      inf:        0        0        0        0

---------------------------------------------------------
Total : 834 1 392 2251

If the --verbose switch is given, ubiscan will print PEB details:

# ./ubiscan --verbose /dev/mtd6

[... same output as before ...]

Details
=========================================================
PEB 0: 253
PEB 1: 1489
PEB 2: 1
PEB 3: 1
PEB 4: 1
PEB 5: 1
PEB 6: 1
PEB 7: 1
PEB 8: 1
PEB 9: 1
PEB 10: 1
...
PEB 832: 1225
PEB 833: 252
PEB 834: 111
PEB 835: 298
PEB 836: 1264
PEB 837: 11
PEB 838: EB_BAD
PEB 839: EB_BAD
PEB 840: EB_BAD
PEB 841: EB_BAD

---
 ubi-utils/Makemodule.am |   5 +-
 ubi-utils/ubiscan.c     | 318 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 322 insertions(+), 1 deletion(-)
 create mode 100644 ubi-utils/ubiscan.c
ubi-utils/Makemodule.am +4 -1
index 7491a8a..7183ec3 100644
@@ -25,6 +25,9 @@ ubinize_LDADD = libubi.a libubigen.a libmtd.a libiniparser.a
 ubiformat_SOURCES = ubi-utils/ubiformat.c include/mtd_swab.h
 ubiformat_LDADD = libubi.a libubigen.a libmtd.a libscan.a
 
+ubiscan_SOURCES = ubi-utils/ubiscan.c include/mtd_swab.h
+ubiscan_LDADD = libubi.a libubigen.a libscan.a libmtd.a
+
 ubirename_SOURCES = ubi-utils/ubirename.c
 ubirename_LDADD = libmtd.a libubi.a
 
@@ -44,7 +47,7 @@ endif
 
 sbin_PROGRAMS += \
 	ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
-	ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock
+	ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock ubiscan
 
 if WITH_GETRANDOM
 sbin_PROGRAMS += ubihealthd
ubi-utils/ubiscan.c new file +318 -0

318 lines not on this page · raw message

Signature · 6 lines
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw

Hi,

this does sound like a useful utility to me. Sorry to leave you hanging there, I was also hoping to maybe get some other feedback as well before applying it.

Applied to mtd-utils.git master.

Thanks,

David

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/