summaryrefslogtreecommitdiff
path: root/ubi-utils/src
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-24 13:17:24 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-24 13:17:24 +0200
commit6b424c2dd3576e0938762365411f75042e41b6b8 (patch)
tree078f4bea056e869b085db87fea632bdc92cbe726 /ubi-utils/src
parent7c3f709388d1fcecad658d4166a4b16845fc4451 (diff)
ubinize: add autoresize flag support
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src')
-rw-r--r--ubi-utils/src/libubigen.c1
-rw-r--r--ubi-utils/src/ubinize.c35
2 files changed, 26 insertions, 10 deletions
diff --git a/ubi-utils/src/libubigen.c b/ubi-utils/src/libubigen.c
index 9cbd1b7..83cea91 100644
--- a/ubi-utils/src/libubigen.c
+++ b/ubi-utils/src/libubigen.c
@@ -132,6 +132,7 @@ int ubigen_add_volume(const struct ubigen_info *ui,
vtbl_rec->vol_type = vi->type;
tmp = ui->leb_size % vi->alignment;
vtbl_rec->data_pad = __cpu_to_be32(tmp);
+ vtbl_rec->flags = vi->flags;
memcpy(vtbl_rec->name, vi->name, vi->name_len);
vtbl_rec->name[vi->name_len] = '\0';
diff --git a/ubi-utils/src/ubinize.c b/ubi-utils/src/ubinize.c
index e36c3ba..86a18eb 100644
--- a/ubi-utils/src/ubinize.c
+++ b/ubi-utils/src/ubinize.c
@@ -90,15 +90,16 @@ static const char *ini_doc = "INI-file format.\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\" and alignment 1. The \"image=../jffs2.img\" line tells\n"
-"the utility to take the contents of the volume from the \"../jffs2.img\"\n"
-"file. The size of the image file has to be less or equivalent to the volume\n"
-"size (30MiB). The \"mode=ubi\" line is mandatory and just tells that the\n"
-"section describes an UBI volume - other section modes may be added in\n"
-"future.\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"
@@ -108,7 +109,7 @@ static const char *ini_doc = "INI-file format.\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.\n";
+" UBI image file.";
struct option long_options[] = {
{ .name = "output", .has_arg = 1, .flag = NULL, .val = 'o' },
@@ -253,8 +254,8 @@ static int parse_opt(int argc, char * const argv[])
case 'h':
ubiutils_print_text(stderr, doc, 80);
- fprintf(stderr, "\n%s\n", ini_doc);
- fprintf(stderr, "\n\n%s\n\n", usage);
+ fprintf(stderr, "\n%s\n\n", ini_doc);
+ fprintf(stderr, "%s\n", usage);
fprintf(stderr, "%s\n", optionsstr);
exit(EXIT_SUCCESS);
@@ -465,6 +466,20 @@ int read_section(const char *sname, struct ubigen_vol_info *vi,
verbose(args.verbose, "volume alignment: %d", vi->alignment);
+ /* Fetch volume flags */
+ sprintf(buf, "%s:vol_flags", sname);
+ p = iniparser_getstring(args.dict, buf, NULL);
+ if (p) {
+ if (!strcmp(p, "autoresize")) {
+ verbose(args.verbose, "autoresize flags found");
+ vi->flags |= UBI_VTBL_AUTORESIZE_FLG;
+ } else {
+ errmsg("unknown flags \"%s\" in section \"%s\"",
+ p, sname);
+ return -1;
+ }
+ }
+
return 0;
}
@@ -588,7 +603,7 @@ int main(int argc, char * const argv[])
}
verbose(args.verbose, "writing volume %d", vi.id);
- verbose(args.verbose, "image file: %s", img);
+ verbose(args.verbose, "image file: %s", img);
err = ubigen_write_volume(&ui, &vi, st.st_size, f, args.fp_out);
fclose(f);