On Fri, 3 Jun 2016 07:43:40 +0200
Bernhard Nortmann <[email protected]> wrote:

> Am 02.06.2016 um 17:33 schrieb Boris Brezillon:
> > Add explanations on where the options to pass to the tool should be
> > extracted from, and add two examples to illustrate this explanation.
> >
> > Signed-off-by: Boris Brezillon <[email protected]>
> > ---
> > Changes since v1:
> > - use shorter option names
> > - rework the help context
> > ---
> >   nand-image-builder.c | 67 
> > ++++++++++++++++++++++++++++++++++++----------------
> >   1 file changed, 47 insertions(+), 20 deletions(-)  
> 
> Hi Boris!
> 
> I already like this version of the usage help much more than the previous
> one - thanks for reworking it. If it was my patch however, I'd still take
> it further. Doing away with the TABs and using SPACEs instead, and with
> some lines even more terse, it could look like this:

Agreed. I'll squash your changes into this patch.

Thanks,

Boris

> 
> diff --git a/nand-image-builder.c b/nand-image-builder.c
> index 98c0a82..043d679 100644
> --- a/nand-image-builder.c
> +++ b/nand-image-builder.c
> @@ -920,44 +920,44 @@ static void display_help(int status)
>           "\n"
>           "Creates a raw NAND image that can be read by the sunxi NAND 
> controller.\n"
>           "\n"
> -        " -h            --help            Display this help and exit\n"
> -        " -c <strength>/<step> --ecc=<strength>/<step>    ECC config\n"
> -        "                        Valid strengths: 16, 24, 28, 32, 40, 
> 48, 56, 60 and 64\n"
> -        "                        Valid steps: 512 and 1024\n"
> -        " -p <size>        --page=<size>        Page size\n"
> -        " -o <size>        --oob=<size>        OOB size\n"
> -        " -u <size>        --usable=<size> Usable page size. Only 
> needed for boot0 mode\n"
> -        " -e <size>        --eraseblock=<size>    Erase block size\n"
> -        " -b            --boot0            Build a boot0 image.\n"
> -        " -s            --scramble        Scramble data\n"
> -        " -a <offset>        --address        Where the image will be 
> programmed.\n"
> +        "-h               --help               Display this help and 
> exit\n"
> +        "-c <str>/<step> --ecc=<str>/<step>   ECC config\n"
> +        "                         Valid strengths: 16, 24, 28, 32, 40, 
> 48, 56, 60 and 64\n"
> +        "                         Valid steps: 512 and 1024\n"
> +        "-p <size>        --page=<size>        Page size\n"
> +        "-o <size>        --oob=<size>         OOB size\n"
> +        "-u <size>        --usable=<size>      Usable page size. Only 
> needed for --boot0\n"
> +        "-e <size>        --eraseblock=<size>  Erase block size\n"
> +        "-b               --boot0              Build a boot0 image.\n"
> +        "-s               --scramble           Scramble data\n"
> +        "-a <offset>      --address=<offset>   Where the image will be 
> programmed.\n"
>           "\n"
>           "Notes:\n"
> -        " All the information you need to pass to this tool should be 
> part of the NAND datasheet.\n"
> +        "All the information you need to pass should be part of the 
> NAND datasheet.\n"
>           "\n"
> -        " If you are building a boot0 image, you'll have specify extra 
> options.\n"
> -        " These options should be chosen based on the layouts described 
> here:\n"
> +        "If you are building a boot0 image, you'll have specify extra 
> options.\n"
> +        "These options should be chosen based on the layouts described 
> here:\n"
>           " http://linux-sunxi.org/NAND#More_information_on_BROM_NAND\n";
>           "\n"
> -        "    --usable should be assigned the 'Hardware page' value\n"
> -        "    --ecc should be assigned the 'ECC capacity'/'ECC page' 
> values\n"
> -        "    --usable should be smaller than --page\n"
> +        "  --usable  should be assigned the 'Hardware page' value\n"
> +        "  --usable  should be smaller than --page\n"
> +        "  --ecc     should be assigned the 'ECC capacity'/'ECC page' 
> values\n"
>           "\n"
> -        " The --address option is only required for non-boot0 images 
> that are meant to be\n"
> -        " programmed at a non eraseblock aligned offset.\n"
> +        "The --address option is only required for non-boot0 images 
> that are\n"
> +        "meant to be programmed at a non eraseblock aligned offset.\n"
>           "\n"
>           "Examples:\n"
> -        " The H27UCG8T2BTR-BC NAND exposes\n"
> +        "  The H27UCG8T2BTR-BC NAND exposes\n"
>           "  * 16k pages\n"
>           "  * 1280 OOB bytes per page\n"
>           "  * 4M eraseblocks\n"
>           "  * requires data scrambling\n"
>           "  * expects a minimum ECC of 40bits/1024bytes\n"
>           "\n"
> -        " A boot0 image can be generated with the following command\n"
> -        "    sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s 
> -b -u 4096 -c 64/1024\n"
> -        " A normal image can be generated with\n"
> -        "    sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s 
> -c 40/1024\n"
> +        "  A normal image can be generated with\n"
> +        "    sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s 
> -c 40/1024\n"
> +        "  A boot0 image can be generated with the following command\n"
> +        "    sunxi-nand-image-builder -p 16384 -o 1280 -e 0x400000 -s 
> -c 64/1024 -b -u 4096\n"
>           );
>       exit(status);
>   }
> 
> The resulting usage help almost everywhere satisfies the 'classic'
> 80 chars per line limit, with the last line being an exceptions (which
> I find acceptable though).
> 
> I've also reordered the example invocations: The "normal" invocation now
> comes first, and the "boot0" cases has the parameters reordered, to make
> it visually clearer where they differ.
> 
> Regards, B. Nortmann



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to