Currently we rely on disk usage to compute rootfs size that may vary
depending on build machine filesystem type.
Consider following case:
Build machine 1: ext4 filesystem:
$ du -ks
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
403024
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
Build machine 2: zfs filesystem:
$ du -ks
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
240353
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
So, this leads to build failures during ext4 image creation on build
machine 2 as allocated ext4 image size is less than what is actually
required.
In order to fix this we need to rely on "--apparent-size" option
provided by "du" utility that provides the actual size. See below usage
text:
$ du --help
<snip>
Mandatory arguments to long options are mandatory for short options too.
-0, --null end each output line with NUL, not newline
-a, --all write counts for all files, not just directories
--apparent-size print apparent sizes, rather than disk usage; although
the apparent size is usually smaller, it may be
larger due to holes in ('sparse') files, internal
fragmentation, indirect blocks, and the like
<snip>
With option "--apparent-size":
Build machine 1: ext4 filesystem:
$ du -ks --apparent-size
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
379576
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
Build machine 2: zfs filesystem:
$ du -ks --apparent-size
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
377455
tmp-rpb-glibc/work/qemuarm64-linaro-linux/rpb-console-image/1.0-r0/rootfs/
Although there is still little difference in actual reported size but
that can very well be covered by IMAGE_OVERHEAD_FACTOR.
Signed-off-by: Sumit Garg <[email protected]>
---
meta/classes/image.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3b5600e..bf0685f 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -516,7 +516,7 @@ def get_rootfs_size(d):
initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
- output = subprocess.check_output(['du', '-ks',
+ output = subprocess.check_output(['du', '-ks', '--apparent-size',
d.getVar('IMAGE_ROOTFS')])
size_kb = int(output.split()[0])
--
2.7.4
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#140897):
https://lists.openembedded.org/g/openembedded-core/message/140897
Mute This Topic: https://lists.openembedded.org/mt/75744368/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-