Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/miscutils/nandwrite.c

    r2725 r3232  
    99 */
    1010
    11 //applet:IF_NANDWRITE(APPLET(nandwrite, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
    12 //applet:IF_NANDWRITE(APPLET_ODDNAME(nanddump, nandwrite, _BB_DIR_USR_SBIN, _BB_SUID_DROP, nanddump))
    13 
    14 //kbuild:lib-$(CONFIG_NANDWRITE) += nandwrite.o
    15 //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o
    16 
    1711//config:config NANDWRITE
    1812//config:   bool "nandwrite"
    19 //config:   default n
    20 //config:   depends on PLATFORM_LINUX
     13//config:   default y
     14//config:   select PLATFORM_LINUX
    2115//config:   help
    2216//config:     Write to the specified MTD device, with bad blocks awareness
     
    2418//config:config NANDDUMP
    2519//config:   bool "nanddump"
    26 //config:   default n
    27 //config:   depends on PLATFORM_LINUX
     20//config:   default y
     21//config:   select PLATFORM_LINUX
    2822//config:   help
    2923//config:     Dump the content of raw NAND chip
     24
     25//applet:IF_NANDWRITE(APPLET(nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP))
     26//applet:IF_NANDWRITE(APPLET_ODDNAME(nanddump, nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP, nanddump))
     27
     28//kbuild:lib-$(CONFIG_NANDWRITE) += nandwrite.o
     29//kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o
    3030
    3131//usage:#define nandwrite_trivial_usage
     
    3333//usage:#define nandwrite_full_usage "\n\n"
    3434//usage:    "Write to the specified MTD device\n"
    35 //usage:     "\nOptions:"
    3635//usage:     "\n    -p  Pad to page size"
    3736//usage:     "\n    -s ADDR Start address"
     
    4039//usage:    "[-o] [-b] [-s ADDR] [-f FILE] MTD_DEVICE"
    4140//usage:#define nanddump_full_usage "\n\n"
    42 //usage:    "Dump the sepcified MTD device\n"
    43 //usage:     "\nOptions:"
    44 //usage:     "\n    -o  Omit oob data"
     41//usage:    "Dump the specified MTD device\n"
     42//usage:     "\n    -o  Dump oob data"
    4543//usage:     "\n    -b  Omit bad block from the dump"
    4644//usage:     "\n    -s ADDR Start address"
     
    132130    }
    133131
    134     fd = xopen(argv[0], O_RDWR);
     132    fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY);
    135133    xioctl(fd, MEMGETINFO, &meminfo);
    136134
     
    165163        if (tmp != blockstart) {
    166164            /* bad block(s), advance mtdoffset */
    167             if (IS_NANDDUMP & !(opts & OPT_b)) {
     165            if (IS_NANDDUMP && !(opts & OPT_b)) {
    168166                int bad_len = MIN(tmp, end_addr) - mtdoffset;
    169                 dump_bad(&meminfo, bad_len, !(opts & OPT_o));
     167                dump_bad(&meminfo, bad_len, opts & OPT_o);
    170168            }
    171169            mtdoffset = tmp;
     
    185183            if (IS_NANDWRITE)
    186184                printf("Writing at 0x%08x\n", mtdoffset);
    187             else if (mtdoffset > blockstart) {
     185            else if (mtdoffset > blockstart && !(opts & OPT_b)) {
    188186                int bad_len = MIN(mtdoffset, limit) - blockstart;
    189                 dump_bad(&meminfo, bad_len, !(opts & OPT_o));
     187                dump_bad(&meminfo, bad_len, opts & OPT_o);
    190188            }
    191189            if (mtdoffset >= limit)
     
    213211        xwrite(output_fd, filebuf, meminfo_writesize);
    214212
    215         if (IS_NANDDUMP && !(opts & OPT_o)) {
     213        if (IS_NANDDUMP && (opts & OPT_o)) {
    216214            /* Dump OOB data */
    217215            oob.start = mtdoffset;
Note: See TracChangeset for help on using the changeset viewer.