Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>,
	Otavio Salvador <otavio@ossystems.com.br>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] wic: use kB for the partitions size
Date: Wed, 4 Feb 2015 11:29:23 +0100	[thread overview]
Message-ID: <20150204102923.GA3901@localhost.localdomain> (raw)
In-Reply-To: <1423006826-10627-1-git-send-email-alexandre.belloni@free-electrons.com>

On 02/04 00:40, Alexandre Belloni wrote:
> Use kB instead of MB for the partition size to get a better granularity.
>
> This is needed on some SoC (i.mx, omap) where it is necessary to create
> partitions as small as 64kB.
>
> Keep the backward compatibility by assuming MB when no unit is provided.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  .../wic/3rdparty/pykickstart/commands/partition.py |  4 +--
>  scripts/lib/wic/3rdparty/pykickstart/options.py    | 21 ++++++++++++-
>  scripts/lib/wic/kickstart/__init__.py              |  2 +-
>  .../lib/wic/kickstart/custom_commands/partition.py | 36 +++++++++++-----------
>  scripts/lib/wic/plugins/source/bootimg-efi.py      |  2 +-
>  scripts/lib/wic/plugins/source/bootimg-pcbios.py   |  2 +-
>  scripts/lib/wic/utils/partitionedfs.py             |  4 +--
>  7 files changed, 45 insertions(+), 26 deletions(-)
>
> diff --git a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py
> index 56b91aa9d9a4..b564b1a7abb9 100644
> --- a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py
> +++ b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py
> @@ -78,7 +78,7 @@ class FC3_PartData(BaseData):
>          if self.recommended:
>              retval += " --recommended"
>          if self.size and self.size != 0:
> -            retval += " --size=%s" % self.size
> +            retval += " --size=%sk" % self.size
>          if hasattr(self, "start") and self.start != 0:
>              retval += " --start=%s" % self.start
>
> @@ -216,7 +216,7 @@ class FC3_Partition(KickstartCommand):
>                        callback=part_cb, nargs=1, type="string")
>          op.add_option("--recommended", dest="recommended", action="store_true",
>                        default=False)
> -        op.add_option("--size", dest="size", action="store", type="int",
> +        op.add_option("--size", dest="size", action="store", type="size",
>                        nargs=1)
>          op.add_option("--start", dest="start", action="store", type="int",
>                        nargs=1)
> diff --git a/scripts/lib/wic/3rdparty/pykickstart/options.py b/scripts/lib/wic/3rdparty/pykickstart/options.py
> index 341c5d7298b0..7bbe6a85a156 100644
> --- a/scripts/lib/wic/3rdparty/pykickstart/options.py
> +++ b/scripts/lib/wic/3rdparty/pykickstart/options.py
> @@ -143,6 +143,24 @@ def _check_string(option, opt, value):
>      else:
>          return value
>
> +def _check_size(option, opt, value):
> +    # Former default was MB
> +    if (value.isdigit()):
> +        return int(value) * 1024L
> +
> +    mapping = {"opt": opt, "value": value}
> +    if (not value[0:len(value)-1].isdigit()):

You might want to replace value[0:len(value)-1] with value[:-1] here and
in int(...) below.

Other than that, the patch looks ok for me. I've built a couple of
images with different sizes (with and without suffix), all worked fine.

Tested-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>

--
Maciej Borzęcki
Senior Software Developer at Open-RnD Sp. z o.o., Poland
www.open-rnd.pl
mobile: +48 889 117 365, fax: +48 42 657 9079


Niniejsza wiadomość wraz z załącznikami może
zawierać chronione prawem lub poufne informacje i została
wysłana wyłącznie do wiadomości i użytku osób, do których
została zaadresowana. Jeśli wiadomość została otrzymana
przypadkowo zabrania się jej kopiowania lub rozsyłania do osób
trzecich. W takim przypadku uprasza się o natychmiastowe
zniszczenie wiadomości oraz poinformowanie nadawcy o
zaistniałej sytuacji za pomocą wiadomości zwrotnej.
Dziękujemy.

This message, including any attachments hereto,
may contain privileged or confidential information and is sent
solely for the attention and use of the intended addressee(s).
If you are not an intended addressee, you may neither use this
message nor copy or deliver it to anyone. In such case, you
should immediately destroy this message and kindly notify the
sender by reply email. Thank you.


  reply	other threads:[~2015-02-04 10:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 23:40 [PATCH] wic: use kB for the partitions size Alexandre Belloni
2015-02-04 10:29 ` Maciej Borzecki [this message]
2015-02-04 10:53   ` Alexandre Belloni
2015-02-04 18:32 ` Tom Zanussi
2015-02-04 18:42   ` Alexandre Belloni

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=20150204102923.GA3901@localhost.localdomain \
    --to=maciej.borzecki@open-rnd.pl \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=otavio@ossystems.com.br \
    --cc=tom.zanussi@linux.intel.com \
    /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