From: Sascha Hauer <s.hauer@pengutronix.de>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 10/10] commands: add ubiformat
Date: Tue, 11 Dec 2012 10:57:57 +0100 [thread overview]
Message-ID: <20121211095757.GS10369@pengutronix.de> (raw)
In-Reply-To: <1355127255-24797-11-git-send-email-w.sang@pengutronix.de>
On Mon, Dec 10, 2012 at 09:14:15AM +0100, Wolfram Sang wrote:
> Imported from mtd-utils and stripped down to needed functionality.
> Based on an older version (1.4.5.) since the newer do use MEMWRITE
> interfaces which we don't have in barebox (yet).
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> +
> + default:
> + fprintf(stderr, "Use -h for help\n");
> + return -1;
> + }
Oh no. I'm stuck in a loop. ubiformat -h tells me that this option
is not supported and I should try ubiformat -h. Luckily my head internal
watchdog triggered which allowed me to write this mail.
Please return COMMAND_ERROR_USAGE from ubiformat.
> +static int read_all(int fd, void *buf, size_t len)
> +{
> + while (len > 0) {
> + ssize_t l = read(fd, buf, len);
> + if (l == 0) {
> + return errmsg("eof reached; %zu bytes remaining", len);
> + } else if (l > 0) {
> + buf += l;
> + len -= l;
> + } else if (errno == EINTR || errno == EAGAIN) {
> + continue;
> + } else {
> + return sys_errmsg("reading failed; %zu bytes remaining", len);
> + }
> + }
> +
> + return 0;
> +}
We have read_full in barebox.
> +static const __maybe_unused char cmd_ubiformat_help[] =
> +" - a tool to format MTD devices and flash UBI images\n"
> +"\n"
> +"-s, --sub-page-size=<bytes> minimum input/output unit used for UBI\n"
> +" headers, e.g. sub-page size in case of NAND\n"
> +" flash (equivalent to the minimum input/output\n"
> +" unit size by default)\n"
> +"-O, --vid-hdr-offset=<offs> offset if the VID header from start of the\n"
> +" physical eraseblock (default is the next\n"
> +" minimum I/O unit or sub-page after the EC\n"
> +" header)\n"
> +"-n, --no-volume-table only erase all eraseblock and preserve erase\n"
> +" counters, do not write empty volume table\n"
> +"-f, --flash-image=<file> flash image file\n"
> +"-e, --erase-counter=<value> use <value> as the erase counter value for all\n"
> +" eraseblocks\n"
> +"-x, --ubi-ver=<num> UBI version number to put to EC headers\n"
> +" (default is 1)\n"
> +"-Q, --image-seq=<num> 32-bit UBI image sequence number to use\n"
> +" (by default a random number is picked)\n"
> +"-q, --quiet suppress progress percentage information\n"
> +"-v, --verbose be verbose\n"
> +"-h, -?, --help print help message\n"
> +"\n"
> +"Usage: " PROGRAM_NAME " <MTD device node file name> [-s <bytes>] [-O <offs>] [-n]\n"
> +"\t\t\t[-f <file>] [-e <value>] [-x <num>] [-y] [-q] [-v] [-h] [-v]\n"
> +"\t\t\t[--sub-page-size=<bytes>] [--vid-hdr-offset=<offs>] [--no-volume-table]\n"
> +"\t\t\t[--flash-image=<file>] [--image-size=<bytes>] [--erase-counter=<value>]\n"
> +"\t\t\t[--ubi-ver=<num>] [--quiet] [--verbose]\n\n"
> +"Example 1: " PROGRAM_NAME " /dev/mtd0 -y - format MTD device number 0 and do\n"
> +" not ask questions.\n"
> +"Example 2: " PROGRAM_NAME " /dev/mtd0 -q -e 0 - format MTD device number 0,\n"
> +" be quiet and force erase counter value 0.\n";
Long options are not supported in barebox, they shouldn't be mentioned
in the help text.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2012-12-11 9:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-10 8:14 [PATCH 00/10] add ubiformat command Wolfram Sang
2012-12-10 8:14 ` [PATCH 01/10] mtd: move is_power_of_2() to a public place Wolfram Sang
2012-12-11 9:22 ` Sascha Hauer
2012-12-11 14:57 ` Wolfram Sang
2012-12-10 8:14 ` [PATCH 02/10] ubi: consolidate ubi-media.h Wolfram Sang
2012-12-10 8:14 ` [PATCH 03/10] ubi: bump ubi-media.h to newest version Wolfram Sang
2012-12-11 9:24 ` Sascha Hauer
2012-12-11 15:17 ` Wolfram Sang
2012-12-10 8:14 ` [PATCH 04/10] devfs & mtd: add MEMERASE ioctl support Wolfram Sang
2012-12-10 8:14 ` [PATCH 05/10] mtd: utils: apply macros for message printouts Wolfram Sang
2012-12-10 8:14 ` [PATCH 06/10] lib: add ubiutils-common Wolfram Sang
2012-12-11 9:35 ` Sascha Hauer
2012-12-11 19:17 ` Wolfram Sang
2012-12-12 9:08 ` Sascha Hauer
2012-12-10 8:14 ` [PATCH 07/10] lib: add libscan Wolfram Sang
2012-12-10 8:14 ` [PATCH 08/10] lib: add libubigen Wolfram Sang
2012-12-10 8:14 ` [PATCH 09/10] lib: add barebox version of libmtd Wolfram Sang
2012-12-10 8:14 ` [PATCH 10/10] commands: add ubiformat Wolfram Sang
2012-12-11 9:57 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121211095757.GS10369@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=w.sang@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox