All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH] Add support for erofs filesystems
@ 2021-05-25 11:04 Richard Weinberger
  2021-05-25 11:04 ` [bitbake][PATCH] Add support for erofs image types Richard Weinberger
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Richard Weinberger @ 2021-05-25 11:04 UTC (permalink / raw)
  To: openembedded-core, bitbake-devel, docs; +Cc: Richard Weinberger

Since Linux 5.4 a new read-only filesystem is available, erofs.
Compared to squashfs it offers much better read performance with and
without compression enabled.
It suppports two optional compressors, lz4 and lz4hc.

From the mkfs.erofs man page:
EROFS is a new enhanced lightweight linux read-only filesystem with
modern designs (eg. no buffer head, reduced metadata, inline
xattrs/data, etc.) for scenarios which need high-performance read-only
requirements, e.g. Android OS for smartphones and LIVECDs.
It also provides fixed-sized output compression support, which improves
storage density, keeps relatively higher compression ratios, which is
more useful to achieve high performance for embedded devices with
limited  memory since it has unnoticable memory overhead and page cache
thrashing.

This commit adds support for three new filesystem targets:
erofs: erofs without compression
erofs-lz4: erofs with lz4 compresssion enabled
erofs-lz4hc: erofs with lz4hc compression enabled

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 meta/classes/image_types.bbclass               |  9 +++++++++
 .../erofs-utils/erofs-utils_git.bb             | 18 ++++++++++++++++++
 scripts/lib/wic/help.py                        |  1 +
 scripts/lib/wic/ksparser.py                    |  7 ++++++-
 scripts/lib/wic/partition.py                   | 16 +++++++++++++---
 scripts/lib/wic/plugins/source/rawcopy.py      |  6 +++---
 6 files changed, 50 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils_git.bb

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8028691405a7..4e95e0e2935e 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -108,6 +108,11 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME
 IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
 IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
 
+IMAGE_CMD_erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}"
+IMAGE_CMD_erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}"
+IMAGE_CMD_erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}"
+
+
 IMAGE_CMD_TAR ?= "tar"
 # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
 IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
@@ -243,6 +248,9 @@ do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
 do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
 do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot"
+do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot"
+do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot"
+do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
@@ -261,6 +269,7 @@ IMAGE_TYPES = " \
     wic wic.gz wic.bz2 wic.lzma wic.zst \
     container \
     f2fs \
+    erofs \
 "
 
 # Compression is a special case of conversion. The old variable
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
new file mode 100644
index 000000000000..6d35d3f2fa6d
--- /dev/null
+++ b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Tools for erofs filesystems"
+LICENSE = "GPLv2"
+SECTION = "base"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94fa01670a2a8f2d3ab2de15004e0848"
+
+PV = "1.2.1"
+SRCREV = "d1f4953edfcf4f51c71ba91586e21fc6ce9f6db9"
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "util-linux-libuuid lz4"
+
+inherit pkgconfig autotools
+
+EXTRA_OECONF = "--enable-lz4 --disable-fuse"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index bd3a2b97dfaf..991e5094bb84 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -930,6 +930,7 @@ DESCRIPTION
              ext4
              btrfs
              squashfs
+             erofs
              swap
 
          --fsoptions: Specifies a free-form string of options to be
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 3eb669da39ca..7a4cc83af556 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -157,7 +157,8 @@ class KickStart():
         part.add_argument('--fsoptions', dest='fsopts')
         part.add_argument('--fstype', default='vfat',
                           choices=('ext2', 'ext3', 'ext4', 'btrfs',
-                                   'squashfs', 'vfat', 'msdos', 'swap'))
+                                   'squashfs', 'vfat', 'msdos', 'erofs',
+                                   'swap'))
         part.add_argument('--mkfs-extraopts', default='')
         part.add_argument('--label')
         part.add_argument('--use-label', action='store_true')
@@ -229,6 +230,10 @@ class KickStart():
                                 err = "%s:%d: SquashFS does not support LABEL" \
                                        % (confpath, lineno)
                                 raise KickStartError(err)
+                        # erofs does not support filesystem labels
+                        if parsed.fstype == 'erofs' and parsed.label:
+                            err = "%s:%d: erofs does not support LABEL" % (confpath, lineno)
+                            raise KickStartError(err)
                         if parsed.fstype == 'msdos' or parsed.fstype == 'vfat':
                             if parsed.fsuuid:
                                 if parsed.fsuuid.upper().startswith('0X'):
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 76d144d12d30..e0b2c5bdf29b 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -141,9 +141,9 @@ class Partition():
                                             native_sysroot)
                 self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
             else:
-                if self.fstype == 'squashfs':
-                    raise WicError("It's not possible to create empty squashfs "
-                                   "partition '%s'" % (self.mountpoint))
+                if self.fstype in ('squashfs', 'erofs'):
+                    raise WicError("It's not possible to create empty %s "
+                                   "partition '%s'" % (self.fstype, self.mountpoint))
 
                 rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                              self.lineno, self.fstype)
@@ -369,6 +369,16 @@ class Partition():
                        (rootfs_dir, rootfs, extraopts)
         exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
 
+    def prepare_rootfs_erofs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
+                             native_sysroot, pseudo):
+        """
+        Prepare content for a erofs rootfs partition.
+        """
+        extraopts = self.mkfs_extraopts or ''
+        erofs_cmd = "mkfs.erofs %s -U %s %s %s" % \
+                       (extraopts, self.fsuuid, rootfs, rootfs_dir)
+        exec_native_cmd(erofs_cmd, native_sysroot, pseudo=pseudo)
+
     def prepare_empty_partition_ext(self, rootfs, oe_builddir,
                                     native_sysroot):
         """
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 3c4997d8ba5e..fa7b1eb8ac75 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -29,9 +29,9 @@ class RawCopyPlugin(SourcePlugin):
             cmd = 'btrfs filesystem label %s %s' % (dst, label)
         elif fstype == 'swap':
             cmd = 'mkswap -L %s %s' % (label, dst)
-        elif fstype == 'squashfs':
-            raise WicError("It's not possible to update a squashfs "
-                           "filesystem label '%s'" % (label))
+        elif fstype in ('squashfs', 'erofs'):
+            raise WicError("It's not possible to update a %s "
+                           "filesystem label '%s'" % (fstype, label))
         else:
             raise WicError("Cannot update filesystem label: "
                            "Unknown fstype: '%s'" % (fstype))
-- 
2.26.2


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

* [bitbake][PATCH] Add support for erofs image types
  2021-05-25 11:04 [OE-core][PATCH] Add support for erofs filesystems Richard Weinberger
@ 2021-05-25 11:04 ` Richard Weinberger
  2021-05-25 11:04 ` [yocto-docs][PATCH] Document erofs filesystem targets Richard Weinberger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Weinberger @ 2021-05-25 11:04 UTC (permalink / raw)
  To: openembedded-core, bitbake-devel, docs; +Cc: Richard Weinberger

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 lib/toaster/orm/models.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 7f7e922adecc..517774baa0b1 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -968,9 +968,10 @@ class Target_Image_File(models.Model):
         'btrfs', 'container', 'cpio', 'cpio.gz', 'cpio.lz4', 'cpio.lzma',
         'cpio.xz', 'cramfs', 'ext2', 'ext2.bz2', 'ext2.gz', 'ext2.lzma',
         'ext3', 'ext3.gz', 'ext4', 'ext4.gz', 'f2fs', 'hddimg', 'iso', 'jffs2',
-        'jffs2.sum', 'multiubi', 'squashfs', 'squashfs-lz4', 'squashfs-lzo',
-        'squashfs-xz', 'tar', 'tar.bz2', 'tar.gz', 'tar.lz4', 'tar.xz', 'ubi',
-        'ubifs', 'wic', 'wic.bz2', 'wic.gz', 'wic.lzma'
+        'jffs2.sum', 'multiubi', 'erofs', 'erofs-lz4', 'erofs-lz4hc',
+        'squashfs', 'squashfs-lz4', 'squashfs-lzo', 'squashfs-xz', 'tar',
+        'tar.bz2', 'tar.gz', 'tar.lz4', 'tar.xz', 'ubi', 'ubifs', 'wic',
+        'wic.bz2', 'wic.gz', 'wic.lzma'
     }
 
     target = models.ForeignKey(Target, on_delete=models.CASCADE)
-- 
2.26.2


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

* [yocto-docs][PATCH] Document erofs filesystem targets
  2021-05-25 11:04 [OE-core][PATCH] Add support for erofs filesystems Richard Weinberger
  2021-05-25 11:04 ` [bitbake][PATCH] Add support for erofs image types Richard Weinberger
@ 2021-05-25 11:04 ` Richard Weinberger
  2021-05-25 21:17   ` [docs] " Quentin Schulz
  2021-05-25 11:11 ` [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems Konrad Weihmann
  2021-05-25 21:15 ` [docs] " Quentin Schulz
  3 siblings, 1 reply; 8+ messages in thread
From: Richard Weinberger @ 2021-05-25 11:04 UTC (permalink / raw)
  To: openembedded-core, bitbake-devel, docs; +Cc: Richard Weinberger

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 documentation/ref-manual/kickstart.rst | 2 ++
 documentation/ref-manual/variables.rst | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/documentation/ref-manual/kickstart.rst b/documentation/ref-manual/kickstart.rst
index 8308ffff5b72..2c8b724ff9ac 100644
--- a/documentation/ref-manual/kickstart.rst
+++ b/documentation/ref-manual/kickstart.rst
@@ -116,6 +116,8 @@ the ``part`` and ``partition`` commands:
 
    -  ``squashfs``
 
+   -  ``erofs``
+
    -  ``swap``
 
 -  ``--fsoptions``: Specifies a free-form string of options to be used
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index df6413b68ae9..d4ea4f399921 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -3293,6 +3293,9 @@ system and gives an overview of their function and contents.
       - jffs2
       - jffs2.sum
       - multiubi
+      - erofs
+      - erofs-lz4
+      - erofs-lz4hc
       - squashfs
       - squashfs-lz4
       - squashfs-lzo
-- 
2.26.2


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

* Re: [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems
  2021-05-25 11:04 [OE-core][PATCH] Add support for erofs filesystems Richard Weinberger
  2021-05-25 11:04 ` [bitbake][PATCH] Add support for erofs image types Richard Weinberger
  2021-05-25 11:04 ` [yocto-docs][PATCH] Document erofs filesystem targets Richard Weinberger
@ 2021-05-25 11:11 ` Konrad Weihmann
  2021-05-25 11:24   ` Richard Weinberger
  2021-05-25 21:15 ` [docs] " Quentin Schulz
  3 siblings, 1 reply; 8+ messages in thread
From: Konrad Weihmann @ 2021-05-25 11:11 UTC (permalink / raw)
  To: Richard Weinberger, openembedded-core, bitbake-devel, docs



On 25.05.21 13:04, Richard Weinberger wrote:
> Since Linux 5.4 a new read-only filesystem is available, erofs.
> Compared to squashfs it offers much better read performance with and
> without compression enabled.
> It suppports two optional compressors, lz4 and lz4hc.
> 
>  From the mkfs.erofs man page:
> EROFS is a new enhanced lightweight linux read-only filesystem with
> modern designs (eg. no buffer head, reduced metadata, inline
> xattrs/data, etc.) for scenarios which need high-performance read-only
> requirements, e.g. Android OS for smartphones and LIVECDs.
> It also provides fixed-sized output compression support, which improves
> storage density, keeps relatively higher compression ratios, which is
> more useful to achieve high performance for embedded devices with
> limited  memory since it has unnoticable memory overhead and page cache
> thrashing.
> 
> This commit adds support for three new filesystem targets:
> erofs: erofs without compression
> erofs-lz4: erofs with lz4 compresssion enabled
> erofs-lz4hc: erofs with lz4hc compression enabled
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>   meta/classes/image_types.bbclass               |  9 +++++++++
>   .../erofs-utils/erofs-utils_git.bb             | 18 ++++++++++++++++++
>   scripts/lib/wic/help.py                        |  1 +
>   scripts/lib/wic/ksparser.py                    |  7 ++++++-
>   scripts/lib/wic/partition.py                   | 16 +++++++++++++---
>   scripts/lib/wic/plugins/source/rawcopy.py      |  6 +++---
>   6 files changed, 50 insertions(+), 7 deletions(-)
>   create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
> 
> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
> index 8028691405a7..4e95e0e2935e 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -108,6 +108,11 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME
>   IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
>   IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
>   
> +IMAGE_CMD_erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}"
> +IMAGE_CMD_erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}"
> +IMAGE_CMD_erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}"
> +
> +
>   IMAGE_CMD_TAR ?= "tar"
>   # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
>   IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
> @@ -243,6 +248,9 @@ do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
>   do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
>   do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
>   do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot"
> +do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot"
> +do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot"
> +do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot"
>   
>   # This variable is available to request which values are suitable for IMAGE_FSTYPES
>   IMAGE_TYPES = " \
> @@ -261,6 +269,7 @@ IMAGE_TYPES = " \
>       wic wic.gz wic.bz2 wic.lzma wic.zst \
>       container \
>       f2fs \
> +    erofs \
>   "
>   
>   # Compression is a special case of conversion. The old variable
> diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
> new file mode 100644
> index 000000000000..6d35d3f2fa6d
> --- /dev/null
> +++ b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
> @@ -0,0 +1,18 @@
> +SUMMARY = "Tools for erofs filesystems"
> +LICENSE = "GPLv2"
> +SECTION = "base"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=94fa01670a2a8f2d3ab2de15004e0848"
> +
> +PV = "1.2.1"
> +SRCREV = "d1f4953edfcf4f51c71ba91586e21fc6ce9f6db9"
> +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git"
> +
> +S = "${WORKDIR}/git"
> +
> +DEPENDS = "util-linux-libuuid lz4"
> +
> +inherit pkgconfig autotools
> +
> +EXTRA_OECONF = "--enable-lz4 --disable-fuse"

In the commit message it's mentioned that compression is optional, still 
here lz4 is enabled by default - I would rather see these compression 
switches configurable via PACKAGECONFIG

> +
> +BBCLASSEXTEND = "native nativesdk"
> diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
> index bd3a2b97dfaf..991e5094bb84 100644
> --- a/scripts/lib/wic/help.py
> +++ b/scripts/lib/wic/help.py
> @@ -930,6 +930,7 @@ DESCRIPTION
>                ext4
>                btrfs
>                squashfs
> +             erofs
>                swap
>   
>            --fsoptions: Specifies a free-form string of options to be
> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
> index 3eb669da39ca..7a4cc83af556 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -157,7 +157,8 @@ class KickStart():
>           part.add_argument('--fsoptions', dest='fsopts')
>           part.add_argument('--fstype', default='vfat',
>                             choices=('ext2', 'ext3', 'ext4', 'btrfs',
> -                                   'squashfs', 'vfat', 'msdos', 'swap'))
> +                                   'squashfs', 'vfat', 'msdos', 'erofs',
> +                                   'swap'))
>           part.add_argument('--mkfs-extraopts', default='')
>           part.add_argument('--label')
>           part.add_argument('--use-label', action='store_true')
> @@ -229,6 +230,10 @@ class KickStart():
>                                   err = "%s:%d: SquashFS does not support LABEL" \
>                                          % (confpath, lineno)
>                                   raise KickStartError(err)
> +                        # erofs does not support filesystem labels
> +                        if parsed.fstype == 'erofs' and parsed.label:
> +                            err = "%s:%d: erofs does not support LABEL" % (confpath, lineno)
> +                            raise KickStartError(err)
>                           if parsed.fstype == 'msdos' or parsed.fstype == 'vfat':
>                               if parsed.fsuuid:
>                                   if parsed.fsuuid.upper().startswith('0X'):
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index 76d144d12d30..e0b2c5bdf29b 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -141,9 +141,9 @@ class Partition():
>                                               native_sysroot)
>                   self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
>               else:
> -                if self.fstype == 'squashfs':
> -                    raise WicError("It's not possible to create empty squashfs "
> -                                   "partition '%s'" % (self.mountpoint))
> +                if self.fstype in ('squashfs', 'erofs'):
> +                    raise WicError("It's not possible to create empty %s "
> +                                   "partition '%s'" % (self.fstype, self.mountpoint))
>   
>                   rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
>                                                self.lineno, self.fstype)
> @@ -369,6 +369,16 @@ class Partition():
>                          (rootfs_dir, rootfs, extraopts)
>           exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
>   
> +    def prepare_rootfs_erofs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
> +                             native_sysroot, pseudo):
> +        """
> +        Prepare content for a erofs rootfs partition.
> +        """
> +        extraopts = self.mkfs_extraopts or ''
> +        erofs_cmd = "mkfs.erofs %s -U %s %s %s" % \
> +                       (extraopts, self.fsuuid, rootfs, rootfs_dir)
> +        exec_native_cmd(erofs_cmd, native_sysroot, pseudo=pseudo)
> +
>       def prepare_empty_partition_ext(self, rootfs, oe_builddir,
>                                       native_sysroot):
>           """
> diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
> index 3c4997d8ba5e..fa7b1eb8ac75 100644
> --- a/scripts/lib/wic/plugins/source/rawcopy.py
> +++ b/scripts/lib/wic/plugins/source/rawcopy.py
> @@ -29,9 +29,9 @@ class RawCopyPlugin(SourcePlugin):
>               cmd = 'btrfs filesystem label %s %s' % (dst, label)
>           elif fstype == 'swap':
>               cmd = 'mkswap -L %s %s' % (label, dst)
> -        elif fstype == 'squashfs':
> -            raise WicError("It's not possible to update a squashfs "
> -                           "filesystem label '%s'" % (label))
> +        elif fstype in ('squashfs', 'erofs'):
> +            raise WicError("It's not possible to update a %s "
> +                           "filesystem label '%s'" % (fstype, label))
>           else:
>               raise WicError("Cannot update filesystem label: "
>                              "Unknown fstype: '%s'" % (fstype))
> 
> 
> 
> 
> 

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

* Re: [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems
  2021-05-25 11:11 ` [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems Konrad Weihmann
@ 2021-05-25 11:24   ` Richard Weinberger
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Weinberger @ 2021-05-25 11:24 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: openembedded-core, bitbake-devel, docs

Konrad,

----- Ursprüngliche Mail -----
> Von: "Konrad Weihmann" <kweihmann@outlook.com>
>> +EXTRA_OECONF = "--enable-lz4 --disable-fuse"
> 
> In the commit message it's mentioned that compression is optional, still
> here lz4 is enabled by default - I would rather see these compression
> switches configurable via PACKAGECONFIG

Good point! Will send a v2 in a jiffy.

Thanks,
//richard

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

* Re: [docs] [OE-core][PATCH] Add support for erofs filesystems
  2021-05-25 11:04 [OE-core][PATCH] Add support for erofs filesystems Richard Weinberger
                   ` (2 preceding siblings ...)
  2021-05-25 11:11 ` [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems Konrad Weihmann
@ 2021-05-25 21:15 ` Quentin Schulz
  2021-05-25 21:22   ` Richard Weinberger
  3 siblings, 1 reply; 8+ messages in thread
From: Quentin Schulz @ 2021-05-25 21:15 UTC (permalink / raw)
  To: docs, Richard Weinberger, openembedded-core, bitbake-devel

Hi Richard,

On May 25, 2021 11:04:27 AM UTC, Richard Weinberger <richard@nod.at> wrote:
>Since Linux 5.4 a new read-only filesystem is available, erofs.
>Compared to squashfs it offers much better read performance with and
>without compression enabled.
>It suppports two optional compressors, lz4 and lz4hc.
>
>>From the mkfs.erofs man page:
>EROFS is a new enhanced lightweight linux read-only filesystem with
>modern designs (eg. no buffer head, reduced metadata, inline
>xattrs/data, etc.) for scenarios which need high-performance read-only
>requirements, e.g. Android OS for smartphones and LIVECDs.
>It also provides fixed-sized output compression support, which improves
>storage density, keeps relatively higher compression ratios, which is
>more useful to achieve high performance for embedded devices with
>limited  memory since it has unnoticable memory overhead and page cache
>thrashing.
>
>This commit adds support for three new filesystem targets:
>erofs: erofs without compression
>erofs-lz4: erofs with lz4 compresssion enabled
>erofs-lz4hc: erofs with lz4hc compression enabled
>
>Signed-off-by: Richard Weinberger <richard@nod.at>
>---
> meta/classes/image_types.bbclass               |  9 +++++++++
> .../erofs-utils/erofs-utils_git.bb             | 18 ++++++++++++++++++
> scripts/lib/wic/help.py                        |  1 +
> scripts/lib/wic/ksparser.py                    |  7 ++++++-
> scripts/lib/wic/partition.py                   | 16 +++++++++++++---
> scripts/lib/wic/plugins/source/rawcopy.py      |  6 +++---
> 6 files changed, 50 insertions(+), 7 deletions(-)
> create mode 100644 meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
>
>diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
>index 8028691405a7..4e95e0e2935e 100644
>--- a/meta/classes/image_types.bbclass
>+++ b/meta/classes/image_types.bbclass
>@@ -108,6 +108,11 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME
> IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
> IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
> 
>+IMAGE_CMD_erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}"
>+IMAGE_CMD_erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}"
>+IMAGE_CMD_erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}"
>+
>+
> IMAGE_CMD_TAR ?= "tar"
> # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
> IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
>@@ -243,6 +248,9 @@ do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
> do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
> do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
> do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot"
>+do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot"
>+do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot"
>+do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot"
> 
> # This variable is available to request which values are suitable for IMAGE_FSTYPES
> IMAGE_TYPES = " \
>@@ -261,6 +269,7 @@ IMAGE_TYPES = " \
>     wic wic.gz wic.bz2 wic.lzma wic.zst \
>     container \
>     f2fs \
>+    erofs \

I think you're supposed to have erofs erofs-lz4 erofs-lz4hc here.

> "
> 
> # Compression is a special case of conversion. The old variable
>diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
>new file mode 100644
>index 000000000000..6d35d3f2fa6d
>--- /dev/null
>+++ b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb

Any reason for using _git over _1.2.1?

>@@ -0,0 +1,18 @@
>+SUMMARY = "Tools for erofs filesystems"
>+LICENSE = "GPLv2"

GPL-2.0-or-later actually.

Thanks for the patch,
Cheers,
Quentin

>+SECTION = "base"
>+LIC_FILES_CHKSUM = "file://COPYING;md5=94fa01670a2a8f2d3ab2de15004e0848"
>+
>+PV = "1.2.1"
>+SRCREV = "d1f4953edfcf4f51c71ba91586e21fc6ce9f6db9"
>+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git"
>+
>+S = "${WORKDIR}/git"
>+
>+DEPENDS = "util-linux-libuuid lz4"
>+
>+inherit pkgconfig autotools
>+
>+EXTRA_OECONF = "--enable-lz4 --disable-fuse"
>+
>+BBCLASSEXTEND = "native nativesdk"
>diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
>index bd3a2b97dfaf..991e5094bb84 100644
>--- a/scripts/lib/wic/help.py
>+++ b/scripts/lib/wic/help.py
>@@ -930,6 +930,7 @@ DESCRIPTION
>              ext4
>              btrfs
>              squashfs
>+             erofs
>              swap
> 
>          --fsoptions: Specifies a free-form string of options to be
>diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
>index 3eb669da39ca..7a4cc83af556 100644
>--- a/scripts/lib/wic/ksparser.py
>+++ b/scripts/lib/wic/ksparser.py
>@@ -157,7 +157,8 @@ class KickStart():
>         part.add_argument('--fsoptions', dest='fsopts')
>         part.add_argument('--fstype', default='vfat',
>                           choices=('ext2', 'ext3', 'ext4', 'btrfs',
>-                                   'squashfs', 'vfat', 'msdos', 'swap'))
>+                                   'squashfs', 'vfat', 'msdos', 'erofs',
>+                                   'swap'))
>         part.add_argument('--mkfs-extraopts', default='')
>         part.add_argument('--label')
>         part.add_argument('--use-label', action='store_true')
>@@ -229,6 +230,10 @@ class KickStart():
>                                 err = "%s:%d: SquashFS does not support LABEL" \
>                                        % (confpath, lineno)
>                                 raise KickStartError(err)
>+                        # erofs does not support filesystem labels
>+                        if parsed.fstype == 'erofs' and parsed.label:
>+                            err = "%s:%d: erofs does not support LABEL" % (confpath, lineno)
>+                            raise KickStartError(err)
>                         if parsed.fstype == 'msdos' or parsed.fstype == 'vfat':
>                             if parsed.fsuuid:
>                                 if parsed.fsuuid.upper().startswith('0X'):
>diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
>index 76d144d12d30..e0b2c5bdf29b 100644
>--- a/scripts/lib/wic/partition.py
>+++ b/scripts/lib/wic/partition.py
>@@ -141,9 +141,9 @@ class Partition():
>                                             native_sysroot)
>                 self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
>             else:
>-                if self.fstype == 'squashfs':
>-                    raise WicError("It's not possible to create empty squashfs "
>-                                   "partition '%s'" % (self.mountpoint))
>+                if self.fstype in ('squashfs', 'erofs'):
>+                    raise WicError("It's not possible to create empty %s "
>+                                   "partition '%s'" % (self.fstype, self.mountpoint))
> 
>                 rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
>                                              self.lineno, self.fstype)
>@@ -369,6 +369,16 @@ class Partition():
>                        (rootfs_dir, rootfs, extraopts)
>         exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
> 
>+    def prepare_rootfs_erofs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
>+                             native_sysroot, pseudo):
>+        """
>+        Prepare content for a erofs rootfs partition.
>+        """
>+        extraopts = self.mkfs_extraopts or ''
>+        erofs_cmd = "mkfs.erofs %s -U %s %s %s" % \
>+                       (extraopts, self.fsuuid, rootfs, rootfs_dir)
>+        exec_native_cmd(erofs_cmd, native_sysroot, pseudo=pseudo)
>+
>     def prepare_empty_partition_ext(self, rootfs, oe_builddir,
>                                     native_sysroot):
>         """
>diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
>index 3c4997d8ba5e..fa7b1eb8ac75 100644
>--- a/scripts/lib/wic/plugins/source/rawcopy.py
>+++ b/scripts/lib/wic/plugins/source/rawcopy.py
>@@ -29,9 +29,9 @@ class RawCopyPlugin(SourcePlugin):
>             cmd = 'btrfs filesystem label %s %s' % (dst, label)
>         elif fstype == 'swap':
>             cmd = 'mkswap -L %s %s' % (label, dst)
>-        elif fstype == 'squashfs':
>-            raise WicError("It's not possible to update a squashfs "
>-                           "filesystem label '%s'" % (label))
>+        elif fstype in ('squashfs', 'erofs'):
>+            raise WicError("It's not possible to update a %s "
>+                           "filesystem label '%s'" % (fstype, label))
>         else:
>             raise WicError("Cannot update filesystem label: "
>                            "Unknown fstype: '%s'" % (fstype))
>-- 
>2.26.2
>

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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

* Re: [docs] [yocto-docs][PATCH] Document erofs filesystem targets
  2021-05-25 11:04 ` [yocto-docs][PATCH] Document erofs filesystem targets Richard Weinberger
@ 2021-05-25 21:17   ` Quentin Schulz
  0 siblings, 0 replies; 8+ messages in thread
From: Quentin Schulz @ 2021-05-25 21:17 UTC (permalink / raw)
  To: docs, Richard Weinberger, openembedded-core, bitbake-devel

Hi Richard,

On May 25, 2021 11:04:29 AM UTC, Richard Weinberger <richard@nod.at> wrote:
>Signed-off-by: Richard Weinberger <richard@nod.at>
>---
> documentation/ref-manual/kickstart.rst | 2 ++
> documentation/ref-manual/variables.rst | 3 +++
> 2 files changed, 5 insertions(+)
>
>diff --git a/documentation/ref-manual/kickstart.rst b/documentation/ref-manual/kickstart.rst
>index 8308ffff5b72..2c8b724ff9ac 100644
>--- a/documentation/ref-manual/kickstart.rst
>+++ b/documentation/ref-manual/kickstart.rst
>@@ -116,6 +116,8 @@ the ``part`` and ``partition`` commands:
> 
>    -  ``squashfs``
> 
>+   -  ``erofs``
>+
>    -  ``swap``
> 

Please order alphabetically.

> -  ``--fsoptions``: Specifies a free-form string of options to be used
>diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
>index df6413b68ae9..d4ea4f399921 100644
>--- a/documentation/ref-manual/variables.rst
>+++ b/documentation/ref-manual/variables.rst
>@@ -3293,6 +3293,9 @@ system and gives an overview of their function and contents.
>       - jffs2
>       - jffs2.sum
>       - multiubi
>+      - erofs
>+      - erofs-lz4
>+      - erofs-lz4hc

Ditto.

Thanks for the patch,
Cheers,
Quentin

>       - squashfs
>       - squashfs-lz4
>       - squashfs-lzo
>-- 
>2.26.2
>

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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

* Re: [docs] [OE-core][PATCH] Add support for erofs filesystems
  2021-05-25 21:15 ` [docs] " Quentin Schulz
@ 2021-05-25 21:22   ` Richard Weinberger
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Weinberger @ 2021-05-25 21:22 UTC (permalink / raw)
  To: Quentin Schulz; +Cc: docs, openembedded-core, bitbake-devel

Quentin,

----- Ursprüngliche Mail -----
> Von: "Quentin Schulz" <foss@0leil.net>
>> IMAGE_TYPES = " \
>>@@ -261,6 +269,7 @@ IMAGE_TYPES = " \
>>     wic wic.gz wic.bz2 wic.lzma wic.zst \
>>     container \
>>     f2fs \
>>+    erofs \
> 
> I think you're supposed to have erofs erofs-lz4 erofs-lz4hc here.

Oh yes. You're right.
 
>> "
>> 
>> # Compression is a special case of conversion. The old variable
>>diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
>>b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
>>new file mode 100644
>>index 000000000000..6d35d3f2fa6d
>>--- /dev/null
>>+++ b/meta/recipes-devtools/erofs-utils/erofs-utils_git.bb
> 
> Any reason for using _git over _1.2.1?

TBH, I used meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb as template. :-)
It fetches also via git and sets PV.

>>@@ -0,0 +1,18 @@
>>+SUMMARY = "Tools for erofs filesystems"
>>+LICENSE = "GPLv2"
> 
> GPL-2.0-or-later actually.

Will fix!

Thanks,
//richard

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

end of thread, other threads:[~2021-05-25 21:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 11:04 [OE-core][PATCH] Add support for erofs filesystems Richard Weinberger
2021-05-25 11:04 ` [bitbake][PATCH] Add support for erofs image types Richard Weinberger
2021-05-25 11:04 ` [yocto-docs][PATCH] Document erofs filesystem targets Richard Weinberger
2021-05-25 21:17   ` [docs] " Quentin Schulz
2021-05-25 11:11 ` [bitbake-devel] [OE-core][PATCH] Add support for erofs filesystems Konrad Weihmann
2021-05-25 11:24   ` Richard Weinberger
2021-05-25 21:15 ` [docs] " Quentin Schulz
2021-05-25 21:22   ` Richard Weinberger

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.