2015-05-26 09:25:30 +00:00
|
|
|
--- a/ubi-utils/ubinize.c
|
|
|
|
+++ b/ubi-utils/ubinize.c
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -60,6 +60,8 @@ static const char optionsstr[] =
|
2013-11-07 19:53:01 +00:00
|
|
|
" (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"
|
|
|
|
+"-E, --eof-markers=<num> number of eof-markers to put at the end of the\n"
|
|
|
|
+" output image\n"
|
|
|
|
"-v, --verbose be verbose\n"
|
|
|
|
"-h, --help print help message\n"
|
2018-04-15 17:25:17 +00:00
|
|
|
"-V, --version print program version\n\n";
|
|
|
|
@@ -79,6 +81,7 @@ static const struct option long_options[
|
2013-11-07 19:53:01 +00:00
|
|
|
{ .name = "erase-counter", .has_arg = 1, .flag = NULL, .val = 'e' },
|
|
|
|
{ .name = "ubi-ver", .has_arg = 1, .flag = NULL, .val = 'x' },
|
|
|
|
{ .name = "image-seq", .has_arg = 1, .flag = NULL, .val = 'Q' },
|
|
|
|
+ { .name = "eof-markers", .has_arg = 1, .flag = NULL, .val = 'E' },
|
|
|
|
{ .name = "verbose", .has_arg = 0, .flag = NULL, .val = 'v' },
|
|
|
|
{ .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
|
|
|
|
{ .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -98,6 +101,7 @@ struct args {
|
2013-11-07 19:53:01 +00:00
|
|
|
uint32_t image_seq;
|
|
|
|
int verbose;
|
|
|
|
dictionary *dict;
|
|
|
|
+ int eof_markers;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct args args = {
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -116,7 +120,7 @@ static int parse_opt(int argc, char * co
|
2013-11-07 19:53:01 +00:00
|
|
|
int key, error = 0;
|
|
|
|
unsigned long int image_seq;
|
|
|
|
|
|
|
|
- key = getopt_long(argc, argv, "o:p:m:s:O:e:x:Q:vhV", long_options, NULL);
|
|
|
|
+ key = getopt_long(argc, argv, "o:p:m:s:O:e:x:Q:E:vhV", long_options, NULL);
|
|
|
|
if (key == -1)
|
|
|
|
break;
|
|
|
|
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -176,6 +180,12 @@ static int parse_opt(int argc, char * co
|
2013-11-07 19:53:01 +00:00
|
|
|
args.image_seq = image_seq;
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case 'E':
|
|
|
|
+ args.eof_markers = simple_strtoul(optarg, &error);
|
|
|
|
+ if (error)
|
|
|
|
+ return errmsg("bad number of eof-markers: \"%s\"", optarg);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
case 'v':
|
|
|
|
args.verbose = 1;
|
|
|
|
break;
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -559,6 +569,18 @@ int main(int argc, char * const argv[])
|
2013-11-07 19:53:01 +00:00
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (args.eof_markers) {
|
|
|
|
+ verbose(args.verbose, "writing %d eof-marker blocks",
|
|
|
|
+ args.eof_markers);
|
|
|
|
+
|
|
|
|
+ err = ubigen_write_eof_markers(&ui, args.ec, args.eof_markers,
|
|
|
|
+ args.out_fd);
|
|
|
|
+ if (err) {
|
|
|
|
+ errmsg("cannot write eof-marker blocks");
|
|
|
|
+ goto out_free;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
verbose(args.verbose, "writing layout volume");
|
|
|
|
|
|
|
|
err = ubigen_write_layout_vol(&ui, 0, 1, args.ec, args.ec, vtbl, args.out_fd);
|