diff mbox series

[2/3] image_types: use IMAGE_FILE_MAXSIZE variable for btrfs image types

Message ID 20230604123755.2541295-3-charles-antoine.couret@mind.be
State New
Headers show
Series image_types: use IMAGE_FILE_MAXSIZE variable to create fixed partition size | expand

Commit Message

Charles-Antoine Couret June 4, 2023, 12:37 p.m. UTC
If defined, this variable value overrides the size of btrfs partition file created by mkfs.
Otherwise previous logic based on ROOTFS_SIZE variable is used.

It should be set when the final file size would not be above a specific value due to fixed
partitionning for example.

Signed-off-by: Charles-Antoine Couret <charles-antoine.couret@mind.be>
---
 meta/classes-recipe/image_types.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass
index cebbb61545..f157a84b2e 100644
--- a/meta/classes-recipe/image_types.bbclass
+++ b/meta/classes-recipe/image_types.bbclass
@@ -110,6 +110,10 @@  IMAGE_CMD:ext4 = "oe_mkext234fs ext4 \"${IMAGE_FILE_MAXSIZE:ext4}\" ${EXTRA_IMAG
 MIN_BTRFS_SIZE ?= "16384"
 IMAGE_CMD:btrfs () {
 	size=${ROOTFS_SIZE}
+	if [ -n "${IMAGE_FILE_MAXSIZE:btrfs}" ]; then
+		size=${IMAGE_FILE_MAXSIZE:btrfs}
+	fi
+
 	if [ ${size} -lt ${MIN_BTRFS_SIZE} ] ; then
 		size=${MIN_BTRFS_SIZE}
 		bbwarn "Rootfs size is too small for BTRFS. Filesystem will be extended to ${size}K"