Search code examples
yocto

How to set explicit rootfs size in yocto


I want to explicitly set rootfs size to 4GB for update compatibility reasons. If I set IMAGE_OVERHEAD_FACTOR = "1", IMAGE_ROOTFS_SIZE = "4194304" and IMAGE_ROOTFS_EXTRA_SPACE = "0", rootfs partition has 5.1 GB. If I print these variables on do_rfs_postprocess step, IMAGE_ROOTFS_EXTRA_SPACE has value 0 + 102400. But I don't know, where the additional gigabyte came from. How can I set rootfs part size exactly to 4 GB, no matter what? EDIT: I have found, that WIC has default 30% extra space, when building SD image. This was the extra gigabyte.


Solution

  • So I have found, when Yocto builds SD card image, this is build by WIC. WIC takes each filesystem image file and by default adds 30% overhead, so each partition is 30% larger, than configured in yocto recipe. This can be solved by using --overhead-factor 1 or --fixed-size 4G in .wks file.

    I still haven't found, where that + 102400 in IMAGE_ROOTFS_EXTRA_SPACE came from, but I can live with that.