1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
--- a/ubi-utils/ubinize.c
+++ b/ubi-utils/ubinize.c
@@ -70,6 +70,8 @@ static const char optionsstr[] =
" (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"
"-V, --version print program version";
@@ -79,7 +81,7 @@ static const char usage[] =
"\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"
+"\t\t[--eof-markers=<num>] [--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'";
@@ -125,6 +127,7 @@ static const struct option long_options[
{ .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' },
@@ -144,6 +147,7 @@ struct args {
uint32_t image_seq;
int verbose;
dictionary *dict;
+ int eof_markers;
};
static struct args args = {
@@ -162,7 +166,7 @@ static int parse_opt(int argc, char * co
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;
@@ -222,6 +226,12 @@ static int parse_opt(int argc, char * co
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;
@@ -599,6 +609,18 @@ int main(int argc, char * const argv[])
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);
|