X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_nand.c;h=f9ced9d74cb0a5ff207c25d470eb6a45655688b2;hb=24289208354c143967968755cff5c825a12e3f90;hp=a66f569a426134d42524feb395dc9bb37a4ded75;hpb=e40520b5b585c82d90e94c54cb3035b277e8280f;p=u-boot diff --git a/common/cmd_nand.c b/common/cmd_nand.c index a66f569a42..f9ced9d74c 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -77,18 +77,21 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat) goto free_all; } printf("Page %08lx dump:\n", off); - i = nand->writesize >> 4; - p = datbuf; - while (i--) { - if (!only_oob) + if (!only_oob) { + i = nand->writesize >> 4; + p = datbuf; + + while (i--) { printf("\t%02x %02x %02x %02x %02x %02x %02x %02x" " %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], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); - p += 16; + p += 16; + } } + puts("OOB:\n"); i = nand->oobsize >> 3; p = oobbuf; @@ -602,22 +605,16 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) opts.spread = spread; if (scrub) { - if (!scrub_yes) - puts(scrub_warn); - - if (scrub_yes) + if (scrub_yes) { opts.scrub = 1; - else if (getc() == 'y') { - puts("y"); - if (getc() == '\r') + } else { + puts(scrub_warn); + if (confirm_yesno()) { opts.scrub = 1; - else { + } else { puts("scrub aborted\n"); - return -1; + return 1; } - } else { - puts("scrub aborted\n"); - return -1; } } ret = nand_erase_opts(nand, &opts); @@ -901,7 +898,9 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, int r; char *s; size_t cnt; +#if defined(CONFIG_IMAGE_FORMAT_LEGACY) image_header_t *hdr; +#endif #if defined(CONFIG_FIT) const void *fit_hdr = NULL; #endif @@ -927,6 +926,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, bootstage_mark(BOOTSTAGE_ID_NAND_HDR_READ); switch (genimg_get_format ((void *)addr)) { +#if defined(CONFIG_IMAGE_FORMAT_LEGACY) case IMAGE_FORMAT_LEGACY: hdr = (image_header_t *)addr; @@ -935,6 +935,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, cnt = image_get_image_size (hdr); break; +#endif #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: fit_hdr = (const void *)addr;