diff options
-rw-r--r-- | 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 1bf59a5e3e..8b820182e2 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -60,9 +60,19 @@ def get_imagecmds(d): | |||
60 | cmds += "\n" + localdata.getVar("runimagecmd", True) | 60 | cmds += "\n" + localdata.getVar("runimagecmd", True) |
61 | return cmds | 61 | return cmds |
62 | 62 | ||
63 | # The default aligment of the size of the rootfs is set to 1KiB. In case | ||
64 | # you're using the SD card emulation of a QEMU system simulator you may | ||
65 | # set this value to 2048 (2MiB alignment). | ||
66 | IMAGE_ROOTFS_ALIGNMENT ?= "1" | ||
67 | |||
63 | runimagecmd () { | 68 | runimagecmd () { |
64 | # Image generation code for image type ${type} | 69 | # Image generation code for image type ${type} |
65 | 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}) }'` | 70 | # The base_size gets calculated: |
71 | # - initial size determined by `du -ks` of the IMAGE_ROOTFS | ||
72 | # - then multiplied by the IMAGE_OVERHEAD_FACTOR | ||
73 | # - then rounded up to IMAGE_ROOTFS_ALIGNMENT | ||
74 | # - finally tested against IMAGE_ROOTFS_SIZE | ||
75 | 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}) }'` | ||
66 | ${cmd} | 76 | ${cmd} |
67 | # Now create the needed compressed versions | 77 | # Now create the needed compressed versions |
68 | cd ${DEPLOY_DIR_IMAGE}/ | 78 | cd ${DEPLOY_DIR_IMAGE}/ |