All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] image_types: add IMAGE_ROOTFS_ALIGNMENT
@ 2012-03-01 20:55 Ken Werner
  2012-03-02  0:44 ` Saul Wold
  2012-03-13 16:24 ` Saul Wold
  0 siblings, 2 replies; 5+ messages in thread
From: Ken Werner @ 2012-03-01 20:55 UTC (permalink / raw)
  To: openembedded-core

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}/
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-13 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-03-08  8:45     ` Ken Werner
2012-03-13 16:24 ` Saul Wold

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.