All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] image_types.bbclass: add optional size to ubi vols
@ 2018-06-18 13:14 Tobias Olausson
  2018-06-18 22:10 ` Andre McCurdy
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Olausson @ 2018-06-18 13:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Magnus Olsson

From 6bd1c95cc26aebe820e3d83a97601e4057ef8db5 Mon Sep 17 00:00:00 2001
From: Tobias Olausson <tol@hms.se>
Date: Mon, 18 Jun 2018 15:01:53 +0200
Subject: [oe-core][PATCHv2] 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@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..c53fb1fce4 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2] image_types.bbclass: add optional size to ubi vols
  2018-06-18 13:14 [PATCHv2] image_types.bbclass: add optional size to ubi vols Tobias Olausson
@ 2018-06-18 22:10 ` Andre McCurdy
  0 siblings, 0 replies; 2+ messages in thread
From: Andre McCurdy @ 2018-06-18 22:10 UTC (permalink / raw)
  To: Tobias Olausson; +Cc: Magnus Olsson, openembedded-core

On Mon, Jun 18, 2018 at 6:14 AM, Tobias Olausson <TOl@hms.se> wrote:
> From 6bd1c95cc26aebe820e3d83a97601e4057ef8db5 Mon Sep 17 00:00:00 2001
> From: Tobias Olausson <tol@hms.se>
> Date: Mon, 18 Jun 2018 15:01:53 +0200
> Subject: [oe-core][PATCHv2] 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@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..c53fb1fce4 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

You need to quote ${vname} here, otherwise the test will always return true:

 $ [ -n ] && echo true
 true

 $ [ -n foo ] && echo true
 true

Wondering how much testing this patch has actually had ?

> +               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
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-18 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 13:14 [PATCHv2] image_types.bbclass: add optional size to ubi vols Tobias Olausson
2018-06-18 22:10 ` Andre McCurdy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.