aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ubi-utils/src/bin2nand.c24
-rw-r--r--ubi-utils/src/config.h4
-rw-r--r--ubi-utils/src/mkbootenv.c19
-rw-r--r--ubi-utils/src/nand2bin.c12
-rw-r--r--ubi-utils/src/pddcustomize.c22
-rw-r--r--ubi-utils/src/pfi2bin.c9
-rw-r--r--ubi-utils/src/pfiflash.c2
-rw-r--r--ubi-utils/src/ubigen.c35
-rw-r--r--ubi-utils/src/ubimirror.c17
-rw-r--r--ubi-utils/src/ubimkvol.c16
-rw-r--r--ubi-utils/src/ubirmvol.c11
-rw-r--r--ubi-utils/src/ubiupdatevol.c2
-rw-r--r--ubi-utils/src/unubi.c4
13 files changed, 114 insertions, 63 deletions
diff --git a/ubi-utils/src/bin2nand.c b/ubi-utils/src/bin2nand.c
index df838af..4bab1ad 100644
--- a/ubi-utils/src/bin2nand.c
+++ b/ubi-utils/src/bin2nand.c
@@ -22,10 +22,11 @@
* Create a flashable NAND image from a binary image
*
* History:
- * 1.0: Initial release (tglx)
- * 1.1: Understands hex and dec input parameters (tglx)
- * 1.2: Generates separated OOB data, if needed. (oloh)
- * 1.3: Padds data/oob to a given size. (oloh)
+ * 1.0 Initial release (tglx)
+ * 1.1 Understands hex and dec input parameters (tglx)
+ * 1.2 Generates separated OOB data, if needed. (oloh)
+ * 1.3 Padds data/oob to a given size. (oloh)
+ * 1.4 Removed argp because we want to use uClibc.
*/
#include <unistd.h>
@@ -44,6 +45,8 @@
#include "config.h"
#include "nandecc.h"
+#define PROGRAM_VERSION "1.4"
+
#define CHECK_ENDP(option, endp) do { \
if (*endp) { \
fprintf(stderr, \
@@ -65,7 +68,7 @@ typedef enum action_t {
extern char *optarg;
extern int optind;
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\tBuilt on "
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
"\n"
"bin2nand - a tool for adding OOB information to a "
@@ -153,11 +156,13 @@ parse_opt(int argc, char **argv, myargs *args)
switch (key) {
case 'p': /* pagesize */
- args->pagesize = (size_t) ustrtoull(optarg, &endp, 0);
+ args->pagesize = (size_t)
+ ustrtoull(optarg, &endp, 0);
CHECK_ENDP("p", endp);
break;
case 'j': /* padding */
- args->padding = (size_t) ustrtoull(optarg, &endp, 0);
+ args->padding = (size_t)
+ ustrtoull(optarg, &endp, 0);
CHECK_ENDP("j", endp);
break;
case 'o': /* output */
@@ -172,7 +177,7 @@ parse_opt(int argc, char **argv, myargs *args)
exit(0);
break;
case 'V':
- printf("%s\n", PACKAGE_VERSION);
+ printf("%s\n", PROGRAM_VERSION);
exit(0);
break;
case 'c':
@@ -187,7 +192,8 @@ parse_opt(int argc, char **argv, myargs *args)
if (optind < argc) {
args->fp_in = fopen(argv[optind++], "rb");
if ((args->fp_in) == NULL) {
- err_quit("Cannot open file %s for input\n", argv[optind++]);
+ err_quit("Cannot open file %s for input\n",
+ argv[optind++]);
}
}
diff --git a/ubi-utils/src/config.h b/ubi-utils/src/config.h
index b5bbd5b..8c4dd54 100644
--- a/ubi-utils/src/config.h
+++ b/ubi-utils/src/config.h
@@ -20,8 +20,8 @@
* Author: Frank Haverkamp
*/
-#define PACKAGE_VERSION "1.1"
-#define PACKAGE_BUGREPORT "haver@vnet.ibm.com, dedekind@linutronix.de, or tglx@linutronix.de"
+#define PACKAGE_BUGREPORT \
+ "haver@vnet.ibm.com, dedekind@linutronix.de, or tglx@linutronix.de"
#define __unused __attribute__((unused))
diff --git a/ubi-utils/src/mkbootenv.c b/ubi-utils/src/mkbootenv.c
index a556939..c05f4e2 100644
--- a/ubi-utils/src/mkbootenv.c
+++ b/ubi-utils/src/mkbootenv.c
@@ -18,6 +18,8 @@
* Author: Oliver Lohmann
*
* Create boot-parameter/pdd data from an ASCII-text input file.
+ *
+ * 1.2 Removed argp because we want to use uClibc.
*/
#include <stdio.h>
@@ -32,10 +34,12 @@
#include "bootenv.h"
#include "error.h"
+#define PROGRAM_VERSION "1.2"
+
extern char *optarg;
extern int optind;
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\tBuilt on "
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
"\n"
"mkbootenv - processes bootenv text files and convertes "
@@ -91,19 +95,20 @@ parse_opt(int argc, char **argv, myargs *args)
case 'o':
args->fp_out = fopen(optarg, "wb");
if ((args->fp_out) == NULL) {
- fprintf(stderr,
- "Cannot open file %s for output\n", optarg);
+ fprintf(stderr, "Cannot open file %s "
+ "for output\n", optarg);
exit(1);
}
break;
case '?': /* help */
printf("%s", doc);
printf("%s", optionsstr);
- printf("\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ printf("\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- printf("%s\n", PACKAGE_VERSION);
+ printf("%s\n", PROGRAM_VERSION);
exit(0);
break;
default:
@@ -115,8 +120,8 @@ parse_opt(int argc, char **argv, myargs *args)
if (optind < argc) {
args->fp_in = fopen(argv[optind++], "rb");
if ((args->fp_in) == NULL) {
- fprintf(stderr,
- "Cannot open file %s for input\n", argv[optind]);
+ fprintf(stderr, "Cannot open file %s for input\n",
+ argv[optind]);
exit(1);
}
}
diff --git a/ubi-utils/src/nand2bin.c b/ubi-utils/src/nand2bin.c
index a9b68bd..34cce40 100644
--- a/ubi-utils/src/nand2bin.c
+++ b/ubi-utils/src/nand2bin.c
@@ -18,7 +18,10 @@
* Author: Frank Haverkamp
*
* An utility to decompose NAND images and strip OOB off. Not yet finished ...
+ *
+ * 1.2 Removed argp because we want to use uClibc.
*/
+
#include <config.h>
#include <errno.h>
#include <fcntl.h>
@@ -36,6 +39,8 @@
#include "config.h"
#include "nandecc.h"
+#define PROGRAM_VERSION "1.2"
+
#define MAXPATH 1024
#define MIN(x,y) ((x)<(y)?(x):(y))
@@ -60,7 +65,7 @@ static struct args myargs = {
.options = NULL,
};
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\t"
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\t"
BUILD_OS" "BUILD_CPU" at "__DATE__" "__TIME__"\n"
"\nSplit data and OOB.\n";
@@ -147,12 +152,13 @@ parse_opt(int argc, char **argv, struct args *args)
printf("Usage: nand2bin [OPTION...] input.mif\n");
printf("%s", doc);
printf("%s", optionsstr);
- printf("\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ printf("\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- printf("%s\n", PACKAGE_VERSION);
+ printf("%s\n", PROGRAM_VERSION);
exit(0);
break;
diff --git a/ubi-utils/src/pddcustomize.c b/ubi-utils/src/pddcustomize.c
index 5d1864a..5c2a5f0 100644
--- a/ubi-utils/src/pddcustomize.c
+++ b/ubi-utils/src/pddcustomize.c
@@ -23,6 +23,8 @@
* if the system is updated and one must be able to modify them when
* the system has booted the first time. This tool is intended to do
* PDD modification.
+ *
+ * 1.3 Removed argp because we want to use uClibc.
*/
#include <stdio.h>
@@ -41,6 +43,8 @@
#include "libubi.h"
#include "ubimirror.h"
+#define PROGRAM_VERSION "1.3"
+
typedef enum action_t {
ACT_NORMAL = 0,
ACT_LIST,
@@ -59,7 +63,7 @@ typedef enum action_t {
extern char *optarg;
extern int optind;
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\tBuilt on "
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
"\n"
"pddcustomize - customize bootenv and pdd values.\n";
@@ -160,7 +164,8 @@ parse_opt(int argc, char **argv, myargs *args)
while (1) {
int key;
- key = getopt_long(argc, argv, "clbxs:i:o:?V", long_options, NULL);
+ key = getopt_long(argc, argv, "clbxs:i:o:?V",
+ long_options, NULL);
if (key == -1)
break;
@@ -182,8 +187,9 @@ parse_opt(int argc, char **argv, myargs *args)
args->side = get_update_side(optarg);
if (args->side < 0) {
err_msg("Unsupported seqnum: %d.\n"
- "Supported seqnums are '0' and '1'\n",
- args->side, optarg);
+ "Supported seqnums are "
+ "'0' and '1'\n",
+ args->side, optarg);
ERR_ARGP;
}
break;
@@ -194,14 +200,16 @@ parse_opt(int argc, char **argv, myargs *args)
args->file_out = optarg;
break;
case '?': /* help */
- err_msg("Usage: pddcustomize.orig [OPTION...] [key=value] [...]");
+ err_msg("Usage: pddcustomize.orig [OPTION...] "
+ "[key=value] [...]");
err_msg("%s", doc);
err_msg("%s", optionsstr);
- err_msg("\nReport bugs to %s", PACKAGE_BUGREPORT);
+ err_msg("\nReport bugs to %s",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- err_msg("%s", PACKAGE_VERSION);
+ err_msg("%s", PROGRAM_VERSION);
exit(0);
break;
default:
diff --git a/ubi-utils/src/pfi2bin.c b/ubi-utils/src/pfi2bin.c
index 044fa24..9265fd5 100644
--- a/ubi-utils/src/pfi2bin.c
+++ b/ubi-utils/src/pfi2bin.c
@@ -22,6 +22,8 @@
* chips in a manufacturing step where the flashes are written before
* being soldered onto the hardware. For NAND images another step is
* required to add the right OOB data to the binary image.
+ *
+ * 1.3 Removed argp because we want to use uClibc.
*/
#include <stdlib.h>
@@ -42,7 +44,7 @@
#include "peb.h"
#include "crc32.h"
-#define PROGRAM_VERSION "1.2"
+#define PROGRAM_VERSION "1.3"
#define MAX_FNAME 255
#define DEFAULT_ERASE_COUNT 0 /* Hmmm.... Perhaps */
@@ -157,12 +159,13 @@ parse_opt(int argc, char **argv, myargs *args)
printf("pfi2bin [OPTION...] pfifile\n");
printf("%s", doc);
printf("%s", optionsstr);
- printf("\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ printf("\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- printf("%s\n", PACKAGE_VERSION);
+ printf("%s\n", PROGRAM_VERSION);
exit(0);
break;
diff --git a/ubi-utils/src/pfiflash.c b/ubi-utils/src/pfiflash.c
index 259a647..63487b9 100644
--- a/ubi-utils/src/pfiflash.c
+++ b/ubi-utils/src/pfiflash.c
@@ -193,7 +193,7 @@ parse_opt(int argc, char **argv, myargs *args)
exit(0);
break;
case 'V':
- err_msg("%s", PACKAGE_VERSION);
+ err_msg("%s", PROGRAM_VERSION);
exit(0);
break;
default:
diff --git a/ubi-utils/src/ubigen.c b/ubi-utils/src/ubigen.c
index 226834f..877f469 100644
--- a/ubi-utils/src/ubigen.c
+++ b/ubi-utils/src/ubigen.c
@@ -21,6 +21,7 @@
*
* 1.0 Initial version
* 1.1 Different CRC32 start value
+ * 1.2 Removed argp because we want to use uClibc.
*/
#include <stdlib.h>
@@ -34,6 +35,8 @@
#include "ubigen.h"
#include "config.h"
+#define PROGRAM_VERSION "1.2"
+
typedef enum action_t {
ACT_NORMAL = 0x00000001,
ACT_BROKEN_UPDATE = 0x00000002,
@@ -42,7 +45,7 @@ typedef enum action_t {
extern char *optarg;
extern int optind;
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\tBuilt on "
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
"\n"
"ubigen - a tool for adding UBI information to a binary input file.\n";
@@ -187,16 +190,16 @@ parse_opt(int argc, char **argv, myargs *args)
case 'o': /* output */
args->fp_out = fopen(optarg, "wb");
if ((args->fp_out) == NULL) {
- fprintf(stderr, "Cannot open file %s for output\n",
- optarg);
+ fprintf(stderr, "Cannot open file %s "
+ "for output\n", optarg);
exit(1);
}
break;
case 'i': /* input */
args->fp_in = fopen(optarg, "rb");
if ((args->fp_in) == NULL) {
- fprintf(stderr, "Cannot open file %s for input\n",
- optarg);
+ fprintf(stderr, "Cannot open file %s "
+ "for input\n", optarg);
exit(1);
}
break;
@@ -205,23 +208,26 @@ parse_opt(int argc, char **argv, myargs *args)
break;
case 'B': /* eb_size */
- args->eb_size = (uint32_t) ustrtoul(optarg, &endp, 0);
+ args->eb_size =
+ (uint32_t)ustrtoul(optarg, &endp, 0);
CHECK_ENDP("B", endp);
break;
case 'E': /* erasecount */
- args->ec = (uint64_t) strtoul(optarg, &endp, 0);
+ args->ec = (uint64_t)strtoul(optarg, &endp, 0);
CHECK_ENDP("E", endp);
break;
case 'I': /* id */
- args->id = (uint16_t) strtoul(optarg, &endp, 0);
+ args->id = (uint16_t)strtoul(optarg, &endp, 0);
CHECK_ENDP("I", endp);
break;
case 'T': /* type */
- args->type = (uint16_t) strtoul(optarg, &endp, 0);
+ args->type =
+ (uint16_t)strtoul(optarg, &endp, 0);
CHECK_ENDP("T", endp);
break;
case 'X': /* versionnr */
- args->version = (uint8_t) strtoul(optarg, &endp, 0);
+ args->version =
+ (uint8_t)strtoul(optarg, &endp, 0);
CHECK_ENDP("X", endp);
break;
case 'O': /* offset for volume hdr */
@@ -241,12 +247,13 @@ parse_opt(int argc, char **argv, myargs *args)
fprintf(stderr, "Usage: ubigen [OPTION...]\n");
fprintf(stderr, "%s", doc);
fprintf(stderr, "%s", optionsstr);
- fprintf(stderr, "\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ fprintf(stderr, "\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- fprintf(stderr, "%s\n", PACKAGE_VERSION);
+ fprintf(stderr, "%s\n", PROGRAM_VERSION);
exit(0);
break;
@@ -260,8 +267,8 @@ parse_opt(int argc, char **argv, myargs *args)
if (!args->fp_in) {
args->fp_in = fopen(argv[optind++], "rb");
if ((args->fp_in) == NULL) {
- fprintf(stderr,
- "Cannot open file %s for input\n", argv[optind]);
+ fprintf(stderr, "Cannot open file %s for "
+ "input\n", argv[optind]);
exit(1);
}
}
diff --git a/ubi-utils/src/ubimirror.c b/ubi-utils/src/ubimirror.c
index 1b1d0be..533a0ee 100644
--- a/ubi-utils/src/ubimirror.c
+++ b/ubi-utils/src/ubimirror.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Oliver Lohmann
+ *
+ * 1.2 Removed argp because we want to use uClibc.
*/
#include <stdio.h>
@@ -32,6 +34,8 @@
#include "example_ubi.h"
#include "ubimirror.h"
+#define PROGRAM_VERSION "1.2"
+
typedef enum action_t {
ACT_NORMAL = 0,
ACT_ARGP_ABORT,
@@ -51,7 +55,7 @@ typedef enum action_t {
extern char *optarg;
extern int optind;
-static char doc[] = "\nVersion: " PACKAGE_VERSION "\n\tBuilt on "
+static char doc[] = "\nVersion: " PROGRAM_VERSION "\n\tBuilt on "
BUILD_CPU" "BUILD_OS" at "__DATE__" "__TIME__"\n"
"\n"
"ubimirror - mirrors ubi volumes.\n";
@@ -122,19 +126,22 @@ parse_opt(int argc, char **argv, myargs *args)
args->side = get_update_side(optarg);
if (args->side < 0) {
err_msg("Unsupported seqnum: %s.\n"
- "Supported seqnums are '0' and '1'\n", optarg);
+ "Supported seqnums are '0' "
+ "and '1'\n", optarg);
ERR_ARGP;
}
break;
case '?': /* help */
- err_msg("Usage: ubimirror [OPTION...] <source> <destination>\n");
+ err_msg("Usage: ubimirror [OPTION...] "
+ "<source> <destination>\n");
err_msg("%s", doc);
err_msg("%s", optionsstr);
- err_msg("\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ err_msg("\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- err_msg("%s", PACKAGE_VERSION);
+ err_msg("%s", PROGRAM_VERSION);
exit(0);
break;
default:
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index 7d510eb..e878d70 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -26,6 +26,7 @@
* 1.1 Does not support erase blocks anymore. This is replaced by
* the number of bytes.
* 1.2 Reworked the user-interface to use argp.
+ * 1.3 Removed argp because we want to use uClibc.
*/
#include <stdio.h>
@@ -38,7 +39,7 @@
#include <config.h>
#include <libubi.h>
-#define PROGRAM_VERSION "1.2"
+#define PROGRAM_VERSION "1.3"
extern char *optarg;
extern int optind;
@@ -179,10 +180,12 @@ parse_opt(int argc, char **argv, struct args *args)
break;
case 'n': /* --volid=<volume id> */
args->vol_id = strtoul(optarg, &endp, 0);
- if (*endp != '\0' || endp == optarg ||
- (args->vol_id < 0 && args->vol_id != UBI_DYNAMIC_VOLUME)) {
+ if (*endp != '\0' ||
+ endp == optarg ||
+ (args->vol_id < 0 &&
+ args->vol_id != UBI_DYNAMIC_VOLUME)) {
fprintf(stderr, "Bad volume ID: "
- "\"%s\"\n", optarg);
+ "\"%s\"\n", optarg);
goto out;
}
break;
@@ -199,12 +202,13 @@ parse_opt(int argc, char **argv, struct args *args)
fprintf(stderr, "Usage: ubimkvol [OPTION...]\n");
fprintf(stderr, "%s", doc);
fprintf(stderr, "%s", optionsstr);
- fprintf(stderr, "\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ fprintf(stderr, "\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- fprintf(stderr, "%s\n", PACKAGE_VERSION);
+ fprintf(stderr, "%s\n", PROGRAM_VERSION);
exit(0);
break;
diff --git a/ubi-utils/src/ubirmvol.c b/ubi-utils/src/ubirmvol.c
index 69e4d0e..04ec085 100644
--- a/ubi-utils/src/ubirmvol.c
+++ b/ubi-utils/src/ubirmvol.c
@@ -23,6 +23,7 @@
* Frank Haverkamp <haver@vnet.ibm.com>
*
* 1.1 Reworked the userinterface to use argp.
+ * 1.2 Removed argp because we want to use uClibc.
*/
#include <stdio.h>
@@ -35,7 +36,7 @@
#include <config.h>
#include <libubi.h>
-#define PROGRAM_VERSION "1.1"
+#define PROGRAM_VERSION "1.2"
extern char *optarg;
extern int optind;
@@ -123,7 +124,8 @@ parse_opt(int argc, char **argv, struct args *args)
case 'n': /* --volid=<volume id> */
args->vol_id = strtoul(optarg, &endp, 0);
if (*endp != '\0' || endp == optarg ||
- (args->vol_id < 0 && args->vol_id != UBI_DYNAMIC_VOLUME)) {
+ (args->vol_id < 0 &&
+ args->vol_id != UBI_DYNAMIC_VOLUME)) {
fprintf(stderr, "Bad volume ID: "
"\"%s\"\n", optarg);
goto out;
@@ -136,11 +138,12 @@ parse_opt(int argc, char **argv, struct args *args)
fprintf(stderr, "Usage: ubirmvol [OPTION...]\n");
fprintf(stderr, "%s", doc);
fprintf(stderr, "%s", optionsstr);
- fprintf(stderr, "\nReport bugs to %s\n", PACKAGE_BUGREPORT);
+ fprintf(stderr, "\nReport bugs to %s\n",
+ PACKAGE_BUGREPORT);
exit(0);
break;
case 'V':
- fprintf(stderr, "%s\n", PACKAGE_VERSION);
+ fprintf(stderr, "%s\n", PROGRAM_VERSION);
exit(0);
break;
default:
diff --git a/ubi-utils/src/ubiupdatevol.c b/ubi-utils/src/ubiupdatevol.c
index 753ad61..011d532 100644
--- a/ubi-utils/src/ubiupdatevol.c
+++ b/ubi-utils/src/ubiupdatevol.c
@@ -154,7 +154,7 @@ parse_opt(int argc, char **argv, struct args *args)
break;
case 'V':
- fprintf(stderr, "%s\n", PACKAGE_VERSION);
+ fprintf(stderr, "%s\n", PROGRAM_VERSION);
exit(0);
break;
diff --git a/ubi-utils/src/unubi.c b/ubi-utils/src/unubi.c
index f8045d8..0f8945f 100644
--- a/ubi-utils/src/unubi.c
+++ b/ubi-utils/src/unubi.c
@@ -19,6 +19,8 @@
/*
* Authors: Frank Haverkamp, haver@vnet.ibm.com
* Drake Dowsett, dowsett@de.ibm.com
+ *
+ * 1.2 Removed argp because we want to use uClibc.
*/
/*
@@ -51,7 +53,7 @@
#define EXEC "unubi"
#define CONTACT "haver@vnet.ibm.com"
-#define VERSION "0.9"
+#define VERSION "1.0"
extern char *optarg;
extern int optind;