mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] genimage: Add static UBI volumes support
Date: Tue, 12 Jan 2016 17:56:41 +0100	[thread overview]
Message-ID: <20160112165641.GJ18044@pengutronix.de> (raw)
In-Reply-To: <20160104124949.GA8261@localhost.localdomain>

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 <ladis@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

      reply	other threads:[~2016-01-12 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 12:49 Ladislav Michl
2016-01-12 16:56 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160112165641.GJ18044@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox