[meta-oe] image_types_sparse: stop using ext2simg

Submitted by lumag on Aug. 18, 2021, 3:39 p.m. | Patch ID: 180090

Details

Message ID 20210818153932.3365328-1-dmitry.baryshkov@linaro.org
State Accepted
Commit fe90d2095326068cdc3744a3fe56762e3e4562ce
Headers show

Commit Message

lumag Aug. 18, 2021, 3:39 p.m.
Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's
android-tools-native). Stop using ext2simg and always use img2simg. This
results in bigger images, but without the risk of image corruption.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass
index 65d980fd913f..4263593a8dd1 100644
--- a/meta-oe/classes/image_types_sparse.bbclass
+++ b/meta-oe/classes/image_types_sparse.bbclass
@@ -2,15 +2,7 @@  inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"

Comments

Khem Raj Aug. 18, 2021, 6:22 p.m.
On Wed, Aug 18, 2021 at 8:39 AM Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:
>
> Under some conditions ext2simg can corrupt the file system (see
> https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
> This has been reproduced with the ext2simg currently found meta-oe's
> android-tools-native). Stop using ext2simg and always use img2simg. This
> results in bigger images, but without the risk of image corruption.

how big are the images ?

>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass
> index 65d980fd913f..4263593a8dd1 100644
> --- a/meta-oe/classes/image_types_sparse.bbclass
> +++ b/meta-oe/classes/image_types_sparse.bbclass
> @@ -2,15 +2,7 @@ inherit image_types
>
>  CONVERSIONTYPES += "sparse"
>  CONVERSION_CMD:sparse = " \
> -    case "${type}" in \
> -        ext*) \
> -            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> -                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> -            ;; \
> -        *) \
> -            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> -                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> -            ;; \
> -    esac \
> +    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> +             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
>  "
>  CONVERSION_DEPENDS_sparse = "android-tools-native"
> --
> 2.30.2
>
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#92654): https://lists.openembedded.org/g/openembedded-devel/message/92654
Mute This Topic: https://lists.openembedded.org/mt/84975068/3617530
Group Owner: openembedded-devel+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
lumag Aug. 20, 2021, 2:43 p.m.
ср, 18 авг. 2021 г. в 21:23, Khem Raj <raj.khem@gmail.com>:
>
> On Wed, Aug 18, 2021 at 8:39 AM Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:
> >
> > Under some conditions ext2simg can corrupt the file system (see
> > https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
> > This has been reproduced with the ext2simg currently found meta-oe's
> > android-tools-native). Stop using ext2simg and always use img2simg. This
> > results in bigger images, but without the risk of image corruption.
>
> how big are the images ?

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB.
Given that I got:
ext2simg - 518MB
img2simg - 655 MB

>
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
> >  1 file changed, 2 insertions(+), 10 deletions(-)
> >
> > diff --git a/meta-oe/classes/image_types_sparse.bbclass b/meta-oe/classes/image_types_sparse.bbclass
> > index 65d980fd913f..4263593a8dd1 100644
> > --- a/meta-oe/classes/image_types_sparse.bbclass
> > +++ b/meta-oe/classes/image_types_sparse.bbclass
> > @@ -2,15 +2,7 @@ inherit image_types
> >
> >  CONVERSIONTYPES += "sparse"
> >  CONVERSION_CMD:sparse = " \
> > -    case "${type}" in \
> > -        ext*) \
> > -            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > -                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> > -            ;; \
> > -        *) \
> > -            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > -                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> > -            ;; \
> > -    esac \
> > +    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > +             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> >  "
> >  CONVERSION_DEPENDS_sparse = "android-tools-native"
> > --
> > 2.30.2
> >
> >
> > 
> >
Khem Raj Aug. 20, 2021, 6:03 p.m.
On Fri, Aug 20, 2021 at 7:43 AM Dmitry Baryshkov <dbaryshkov@gmail.com>
wrote:

> ср, 18 авг. 2021 г. в 21:23, Khem Raj <raj.khem@gmail.com>:
> >
> > On Wed, Aug 18, 2021 at 8:39 AM Dmitry Baryshkov <dbaryshkov@gmail.com>
> wrote:
> > >
> > > Under some conditions ext2simg can corrupt the file system (see
> > >
> https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/
> ).
> > > This has been reproduced with the ext2simg currently found meta-oe's
> > > android-tools-native). Stop using ext2simg and always use img2simg.
> This
> > > results in bigger images, but without the risk of image corruption.
> >
> > how big are the images ?
>
> Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB.
> Given that I got:
> ext2simg - 518MB
> img2simg - 655 MB


Hmm so Choice is corrupted at times and small or big but not corrupted I
guess we should take the second option as it seems more stable

>
>
> >
> > >
> > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > ---
> > >  meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
> > >  1 file changed, 2 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/meta-oe/classes/image_types_sparse.bbclass
> b/meta-oe/classes/image_types_sparse.bbclass
> > > index 65d980fd913f..4263593a8dd1 100644
> > > --- a/meta-oe/classes/image_types_sparse.bbclass
> > > +++ b/meta-oe/classes/image_types_sparse.bbclass
> > > @@ -2,15 +2,7 @@ inherit image_types
> > >
> > >  CONVERSIONTYPES += "sparse"
> > >  CONVERSION_CMD:sparse = " \
> > > -    case "${type}" in \
> > > -        ext*) \
> > > -            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > > -
>  "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> > > -            ;; \
> > > -        *) \
> > > -            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > > -
>  "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> > > -            ;; \
> > > -    esac \
> > > +    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
> > > +             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
> > >  "
> > >  CONVERSION_DEPENDS_sparse = "android-tools-native"
> > > --
> > > 2.30.2
> > >
> > >
> > > 
> > >
>
>
>
> --
> With best wishes
> Dmitry
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#92699): https://lists.openembedded.org/g/openembedded-devel/message/92699
Mute This Topic: https://lists.openembedded.org/mt/84975068/3617530
Group Owner: openembedded-devel+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-