| Submitter | Ken Werner |
|---|---|
| Date | March 1, 2012, 8:55 p.m. |
| Message ID | <1330635344-27411-1-git-send-email-ken.werner@linaro.org> |
| Download | mbox | patch |
| Permalink | /patch/22553/ |
| State | Accepted |
| Commit | 99128c209e3de3e9e175eacb3acf0f06857043fe |
| Headers | show |
Comments
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? Sau! > # Now create the needed compressed versions > cd ${DEPLOY_DIR_IMAGE}/
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}/
On 03/02/2012 09:10 AM, Ken Werner wrote: > 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. Of course I'm happy to put the OFMT back in if it's desired. Just let me know and I'll provide and updated patch. Regards, Ken
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} > # Now create the needed compressed versions > cd ${DEPLOY_DIR_IMAGE}/ Merged into OE-Core Your right about the modulo operation, I just missed that in my scan of the differences. Thanks Sau!
Patch
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} # Now create the needed compressed versions cd ${DEPLOY_DIR_IMAGE}/