nand: Make 'nand dump.oob' actually work
PATCH 1/1 nand: Make 'nand dump.oob' actually work
Currently, "nand dump.oob" is a no-op.
This commit makes it functional.
Signed-off-by Jason McMullan <[email protected]>
--- common/cmd_nand.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
common/cmd_nand.c +27 -0
@@ -39,6 +39,33 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,static int nand_dump_oob (nand_info_t *nand,ulong off) { +int i; +size_t read_bytes; +u_char *buf, *p; + + buf =malloc (nand->oobsize); +if (!buf) { +puts ("No memory for oob buffer\n" ); +return 1 ; + } + off &= ~(nand->oobblock -1 ); + i = nand->read_oob (nand, off, nand->oobsize, &read_bytes, buf); +if (i <0 ) { +printf ("Error (%d) reading page %08x\n" , i, off); +free (buf); +return 1 ; + } +printf ("Page %08x OOB:\n" , off); + i = nand->oobsize >>3 ; + p = buf; +while (i--) { +printf ("\t%02x %02x %02x %02x %02x %02x %02x %02x\n" , + p[0 ], p[1 ], p[2 ], p[3 ], p[4 ], p[5 ], p[6 ], p[7 ]); + p +=8 ; + } +free (buf); + +return 0 ; }
Signature · 1 line
1.5.4.3