All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken Werner <ken.werner@linaro.org>
To: Saul Wold <sgw@linux.intel.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] image_types: add IMAGE_ROOTFS_ALIGNMENT
Date: Fri, 02 Mar 2012 09:10:44 +0100	[thread overview]
Message-ID: <4F508084.1010500@linaro.org> (raw)
In-Reply-To: <4F5017E5.1020501@linux.intel.com>

On 03/02/2012 01:44 AM, Saul Wold wrote:
> On 03/01/2012 12:55 PM, Ken Werner wrote:
>> Introduce a new variable called IMAGE_ROOTFS_ALIGNMENT that allows to
>> control
>> the aligment of the size of the rootfs. Its default value is set to
>> 1KiB so
>> that the existing behaviour is not changed. In case the SD card
>> emulation of
>> a QEMU system emulator gets used you may set the alignment to 2MiB.
>> ---
>> meta/classes/image_types.bbclass | 12 +++++++++++-
>> 1 files changed, 11 insertions(+), 1 deletions(-)
>>
>> diff --git a/meta/classes/image_types.bbclass
>> b/meta/classes/image_types.bbclass
>> index f756c39..314d6d1 100644
>> --- a/meta/classes/image_types.bbclass
>> +++ b/meta/classes/image_types.bbclass
>> @@ -55,9 +55,19 @@ def get_imagecmds(d):
>> cmds += "\n" + localdata.getVar("runimagecmd", True)
>> return cmds
>>
>> +# The default aligment of the size of the rootfs is set to 1KiB. In case
>> +# you're using the SD card emulation of a QEMU system simulator you may
>> +# set this value to 2048 (2MiB alignment).
>> +IMAGE_ROOTFS_ALIGNMENT ?= "1"
>> +
>> runimagecmd () {
>> # Image generation code for image type ${type}
>> - ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{base_size = ($1 *
>> ${IMAGE_OVERHEAD_FACTOR}); OFMT = "%.0f" ; print ((base_size>
>> ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) +
>> ${IMAGE_ROOTFS_EXTRA_SPACE}) }'`
>> + # The base_size gets calculated:
>> + # - initial size determined by `du -ks` of the IMAGE_ROOTFS
>> + # - then multiplied by the IMAGE_OVERHEAD_FACTOR
>> + # - then rounded up to IMAGE_ROOTFS_ALIGNMENT
>> + # - finally tested against IMAGE_ROOTFS_SIZE
>> + ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{base_size = $1 *
>> ${IMAGE_OVERHEAD_FACTOR} + ${IMAGE_ROOTFS_ALIGNMENT} - 1; base_size -=
>> base_size % ${IMAGE_ROOTFS_ALIGNMENT}; print ((base_size>
>> ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) +
>> ${IMAGE_ROOTFS_EXTRA_SPACE}) }'`
>> ${cmd}
> Is there a reason you removed the OFMT from this line?

Hi,

Thanks for reviewing!
I'm not too much into awk but I thought the fraction part of the result 
from the modulo operation equals the fraction part of the initial 
base_size. Since we subtract each other only the integer part remains.

Regards,
Ken

> Sau!
>> # Now create the needed compressed versions
>> cd ${DEPLOY_DIR_IMAGE}/




  reply	other threads:[~2012-03-02  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 20:55 [PATCH] image_types: add IMAGE_ROOTFS_ALIGNMENT Ken Werner
2012-03-02  0:44 ` Saul Wold
2012-03-02  8:10   ` Ken Werner [this message]
2012-03-08  8:45     ` Ken Werner
2012-03-13 16:24 ` Saul Wold

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=4F508084.1010500@linaro.org \
    --to=ken.werner@linaro.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=sgw@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.