Yocto 工程调整 rootfs 的空间大小
Resize the rootfs space of the Yocto project
————————————————————
Yocto 构建系统时,对于 rootfs 可用容量是有大小限制的,默认的rootfs大小是设置的1.3倍。官网的说明如下:
官网说明
Defines a multiplier that the build system applies to the initial image size for cases when the multiplier times the returned disk usage value for the image is greater than the sum of IMAGE_ROOTFS_SIZE
and IMAGE_ROOTFS_EXTRA_SPACE
. The result of the multiplier applied to the initial image size creates free disk space in the image as overhead. By default, the build process uses a multiplier of 1.3 for this variable. This default value results in 30% free disk space added to the image when this method is used to determine the final generated image size. You should be aware that post install scripts and the package management system uses disk space inside this overhead area. Consequently, the multiplier does not produce an image with all the theoretical free disk space. See IMAGE_ROOTFS_SIZE
for information on how the build system determines the overall image size.
The default 30% free disk space typically gives the image enough room to boot and allows for basic post installs while still leaving a small amount of free disk space. If 30% free space is inadequate, you can increase the default value. For example, the following setting gives you 50% free space added to the image:
IMAGE_OVERHEAD_FACTOR = "1.5"
Alternatively, you can ensure a specific amount of free disk space is added to the image by using the IMAGE_ROOTFS_EXTRA_SPACE
variable.
修改方法
Q: How do I create images with more free space?
A: By default, the OpenEmbedded build system creates images that are 1.3 times the size of the populated root filesystem. To affect the image size, you need to set various configurations:
Image Size: The OpenEmbedded build system uses the IMAGE_ROOTFS_SIZE
variable to define the size of the image in Kbytes. The build system determines the size by taking into account the initial root filesystem size before any modifications such as requested size for the image and any requested additional free disk space to be added to the image.
Overhead: Use the IMAGE_OVERHEAD_FACTOR
variable to define the multiplier that the build system applies to the initial image size, which is 1.3 by default.
Additional Free Space: Use the IMAGE_ROOTFS_EXTRA_SPACE
variable to add additional free space to the image. The build system adds this space to the image after it determines its IMAGE_ROOTFS_SIZE
.
中文简述
需要修改构建image的配方,因人而异:
vim ~/yocto-project/LS46-OEM-TEST/meta-ETEK/recipes-leee/images/nxp-image-real-time-edge.bbappend
修改这个参数:
IMAGE_ROOTFS_SIZE = "1048576"
最终会分配 IMAGE_OVERHEAD_FACTOR
✖ IMAGE_ROOTFS_SIZE
个KB大小的空间。
或者使用这个参数:
IMAGE_ROOTFS_EXTRA_SPACE :保证系统富余的额外空间
温馨提示: 这个大小配置关系到构建得到的系统镜像文件的大小,正相关。