[oe-commits] Ken Werner : image_types: add IMAGE_ROOTFS_ALIGNMENT

git at git.openembedded.org git at git.openembedded.org
Thu Mar 8 19:58:14 UTC 2012


Module: openembedded-core.git
Branch: master
Commit: 99128c209e3de3e9e175eacb3acf0f06857043fe
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=99128c209e3de3e9e175eacb3acf0f06857043fe

Author: Ken Werner <ken.werner at linaro.org>
Date:   Tue Mar  6 09:03:06 2012 -0800

image_types: add IMAGE_ROOTFS_ALIGNMENT

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.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 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 1bf59a5..8b82018 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -60,9 +60,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}/





More information about the Openembedded-commits mailing list