On Mon, Jan 04, 2016 at 01:49:49PM +0100, Ladislav Michl wrote: > Bare images (kernel, U-Boot, its environment) need to reside inside > static UBI volumes. Add read-only partition flag and use it for that > purpose. Also make partition's "image" voluntary as ubinize will yell > anyway. Once this behavior gets modified eventually, it will bring us > possibility to create empty volumes ready for runtime update. > > Signed-off-by: Ladislav Michl <la...@linux-mips.org>
Thanks, applied. Michael > > --- > genimage.c | 2 ++ > genimage.h | 1 + > image-ubi.c | 26 ++++++++++++++++---------- > 3 files changed, 19 insertions(+), 10 deletions(-) > > diff -ur genimage-8.orig/genimage.c genimage-8/genimage.c > --- genimage-8/genimage.c 2015-09-23 12:11:20.732052910 +0200 > +++ genimage-8/genimage.c 2016-01-04 03:55:17.304593713 +0100 > @@ -87,6 +87,7 @@ > CFG_STR("size", NULL, CFGF_NONE), > CFG_INT("partition-type", 0, CFGF_NONE), > CFG_BOOL("bootable", cfg_false, CFGF_NONE), > + CFG_BOOL("read-only", cfg_false, CFGF_NONE), > CFG_STR("image", NULL, CFGF_NONE), > CFG_BOOL("autoresize", 0, CFGF_NONE), > CFG_BOOL("in-partition-table", cfg_true, CFGF_NONE), > @@ -294,6 +295,7 @@ > part->offset = cfg_getint_suffix(partsec, "offset"); > part->partition_type = cfg_getint(partsec, "partition-type"); > part->bootable = cfg_getbool(partsec, "bootable"); > + part->read_only = cfg_getbool(partsec, "read-only"); > part->image = cfg_getstr(partsec, "image"); > part->autoresize = cfg_getbool(partsec, "autoresize"); > part->in_partition_table = cfg_getbool(partsec, > "in-partition-table"); > diff -ur genimage-8.orig/genimage.h genimage-8/genimage.h > --- genimage-8/genimage.h 2015-09-23 12:11:20.752052590 +0200 > +++ genimage-8/genimage.h 2016-01-04 03:55:17.304593713 +0100 > @@ -32,6 +32,7 @@ > unsigned char partition_type; > cfg_bool_t bootable; > cfg_bool_t extended; > + cfg_bool_t read_only; > const char *image; > struct list_head list; > int autoresize; > diff -ur genimage-8.orig/image-ubi.c genimage-8/image-ubi.c > --- genimage-8/image-ubi.c 2013-04-16 15:28:57.133432239 +0200 > +++ genimage-8/image-ubi.c 2016-01-04 03:55:17.308593713 +0100 > @@ -47,21 +47,27 @@ > } > > list_for_each_entry(part, &image->partitions, list) { > - struct image *child; > - child = image_get(part->image); > - if (!child) { > - image_error(image, "could not find %s\n", part->image); > - fclose(fini); > - ret = -EINVAL; > - goto err_free; > + struct image *child = NULL; > + unsigned long long size = part->size; > + if (part->image) > + child = image_get(part->image); > + if (!size) { > + if (!child) { > + image_error(image, "could not find %s\n", > part->image); > + fclose(fini); > + ret = -EINVAL; > + goto err_free; > + } > + size = child->size; > } > > fprintf(fini, "[%s]\n", part->name); > fprintf(fini, "mode=ubi\n"); > - fprintf(fini, "image=%s\n", imageoutfile(child)); > + if (child) > + fprintf(fini, "image=%s\n", imageoutfile(child)); > fprintf(fini, "vol_id=%d\n", i); > - fprintf(fini, "vol_size=%lld\n", child->size); > - fprintf(fini, "vol_type=dynamic\n"); > + fprintf(fini, "vol_size=%lld\n", size); > + fprintf(fini, "vol_type=%s\n", part->read_only ? "static" : > "dynamic"); > fprintf(fini, "vol_name=%s\n", part->name); > if (part->autoresize) > fprintf(fini, "vol_flags=autoresize\n"); > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de