From f0b32c7ba5136151a961c3a43c8ff430b33d7c33 Mon Sep 17 00:00:00 2001 From: Diego Ismirlian Date: Mon, 16 Aug 2021 21:38:02 -0300 Subject: 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 Signed-off-by: Diego Ismirlian Signed-off-by: David Oberhollenzer --- ubi-utils/Makemodule.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ubi-utils/Makemodule.am') diff --git a/ubi-utils/Makemodule.am b/ubi-utils/Makemodule.am index 7491a8a..7183ec3 100644 --- a/ubi-utils/Makemodule.am +++ b/ubi-utils/Makemodule.am @@ -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 -- cgit v1.2.3