diff options
Diffstat (limited to 'ubi-utils/ubinize.c')
-rw-r--r-- | ubi-utils/ubinize.c | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c index 60bbd9a..b5ebadc 100644 --- a/ubi-utils/ubinize.c +++ b/ubi-utils/ubinize.c @@ -39,15 +39,6 @@ #include "common.h" #include "ubiutils-common.h" -static const char doc[] = PROGRAM_NAME " version " VERSION -" - a tool to generate UBI images. An UBI image may contain one or more UBI " -"volumes which have to be defined in the input configuration ini-file. The " -"ini file defines all the UBI volumes - their characteristics and the " -"contents, but it does not define the characteristics of the flash the UBI " -"image is generated for. Instead, the flash characteristics are defined via " -"the command-line options. Note, if not sure about some of the command-line " -"parameters, do not specify them and let the utility use default values."; - static const char optionsstr[] = "-o, --output=<file name> output file name\n" "-p, --peb-size=<bytes> size of the physical eraseblock of the flash\n" @@ -72,49 +63,13 @@ static const char optionsstr[] = " (by default a random number is picked)\n" "-v, --verbose be verbose\n" "-h, --help print help message\n" -"-V, --version print program version"; +"-V, --version print program version\n\n"; static const char usage[] = -"Usage: " PROGRAM_NAME " [-o filename] [-p <bytes>] [-m <bytes>] [-s <bytes>] [-O <num>] [-e <num>]\n" -"\t\t[-x <num>] [-Q <num>] [-v] [-h] [-V] [--output=<filename>] [--peb-size=<bytes>]\n" -"\t\t[--min-io-size=<bytes>] [--sub-page-size=<bytes>] [--vid-hdr-offset=<num>]\n" -"\t\t[--erase-counter=<num>] [--ubi-ver=<num>] [--image-seq=<num>] [--verbose] [--help]\n" -"\t\t[--version] ini-file\n" -"Example: " PROGRAM_NAME " -o ubi.img -p 16KiB -m 512 -s 256 cfg.ini - create UBI image\n" -" 'ubi.img' as described by configuration file 'cfg.ini'"; - -static const char ini_doc[] = "INI-file format.\n" -"The input configuration ini-file describes all the volumes which have to\n" -"be included to the output UBI image. Each volume is described in its own\n" -"section which may be named arbitrarily. The section consists on\n" -"\"key=value\" pairs, for example:\n\n" -"[jffs2-volume]\n" -"mode=ubi\n" -"image=../jffs2.img\n" -"vol_id=1\n" -"vol_size=30MiB\n" -"vol_type=dynamic\n" -"vol_name=jffs2_volume\n" -"vol_flags=autoresize\n" -"vol_alignment=1\n\n" -"This example configuration file tells the utility to create an UBI image\n" -"with one volume with ID 1, volume size 30MiB, the volume is dynamic, has\n" -"name \"jffs2_volume\", \"autoresize\" volume flag, and alignment 1. The\n" -"\"image=../jffs2.img\" line tells the utility to take the contents of the\n" -"volume from the \"../jffs2.img\" file. The size of the image file has to be\n" -"less or equivalent to the volume size (30MiB). The \"mode=ubi\" line is\n" -"mandatory and just tells that the section describes an UBI volume - other\n" -"section modes may be added in the future.\n" -"Notes:\n" -" * size in vol_size might be specified kilobytes (KiB), megabytes (MiB),\n" -" gigabytes (GiB) or bytes (no modifier);\n" -" * if \"vol_size\" key is absent, the volume size is assumed to be\n" -" equivalent to the size of the image file (defined by \"image\" key);\n" -" * if the \"image\" is absent, the volume is assumed to be empty;\n" -" * volume alignment must not be greater than the logical eraseblock size;\n" -" * one ini file may contain arbitrary number of sections, the utility will\n" -" put all the volumes which are described by these section to the output\n" -" UBI image file."; +"Usage: " PROGRAM_NAME " [options] <ini-file>\n\n" +"Generate UBI images. An UBI image may contain one or more UBI volumes which\n" +"have to be defined in the input configuration ini-file. The flash\n" +"characteristics are defined via the command-line options.\n\n"; static const struct option long_options[] = { { .name = "output", .has_arg = 1, .flag = NULL, .val = 'o' }, @@ -227,10 +182,10 @@ static int parse_opt(int argc, char * const argv[]) break; case 'h': - ubiutils_print_text(stdout, doc, 80); - printf("\n%s\n\n", ini_doc); - printf("%s\n\n", usage); - printf("%s\n", optionsstr); + fputs(usage, stdout); + fputs(optionsstr, stdout); + printf("For more information see `man 8 %s`\n\n", + PROGRAM_NAME); exit(EXIT_SUCCESS); case 'V': @@ -238,7 +193,8 @@ static int parse_opt(int argc, char * const argv[]) exit(EXIT_SUCCESS); default: - fprintf(stderr, "Use -h for help\n"); + fputs(usage, stderr); + fputs("Use -h for help\n\n", stderr); return -1; } } |