[OE-core] [oe-core][PATCHv3] image_types.bbclass: add optional size to ubi vols

Tobias Olausson TOl at hms.se
Tue Jun 19 08:25:18 UTC 2018


>From 320acd93c7ff9e76bf8321e4bf8c735cdc70b173 Mon Sep 17 00:00:00 2001
From: Tobias Olausson <tol at hms.se>
Date: Mon, 18 Jun 2018 15:01:53 +0200
Subject: [oe-core][PATCHv3] image_types.bbclass: add optional size to ubi vols

Instead of hard coding the ubi volume to be just large enough to fit the
root file system, one can use a variable to set a preferred size.

Signed-off-by: Tobias Olausson <tol at hms.se>
---
 meta/classes/image_types.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 00a00d318f..99d49dbe7a 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -164,10 +164,22 @@ multiubi_mkfs() {
 		local vname="_$3"
 	fi
 
+	# Set UBI_VOL_SIZE (for regular ubi) or UBI_VOL_SIZE_vname for multiubi
+	if [ -n "${vname}" ]; then
+		local ubi_vol_size=${UBI_VOL_SIZE}
+	else
+		eval local ubi_vol_size=\"\$UBI_VOL_SIZE${vname}\"
+	fi
+
 	echo \[ubifs\] > ubinize${vname}-${IMAGE_NAME}.cfg
 	echo mode=ubi >> ubinize${vname}-${IMAGE_NAME}.cfg
 	echo image=${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs >> ubinize${vname}-${IMAGE_NAME}.cfg
 	echo vol_id=0 >> ubinize${vname}-${IMAGE_NAME}.cfg
+
+	if [ -n "${ubi_vol_size}" ]; then
+		echo "vol_size=${ubi_vol_size}" >> ubinize${vname}-${IMAGE_NAME}.cfg
+	fi
+
 	echo vol_type=dynamic >> ubinize${vname}-${IMAGE_NAME}.cfg
 	echo vol_name=${UBI_VOLNAME} >> ubinize${vname}-${IMAGE_NAME}.cfg
 	echo vol_flags=autoresize >> ubinize${vname}-${IMAGE_NAME}.cfg
-- 
2.17.1



More information about the Openembedded-core mailing list