diff options
author | Richard Weinberger <richard@nod.at> | 2021-05-25 13:29:51 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-31 14:31:01 +0100 |
commit | 63b3c44d273d03fe3ac98d6f7c8e8475b468b44e (patch) | |
tree | c5146ab07d46bd7958ebf3790ba115ed948614be | |
parent | 40d3366bea8d2417e89a37c6f2d38e1542160342 (diff) | |
download | poky-63b3c44d273d03fe3ac98d6f7c8e8475b468b44e.tar.gz |
Add support for erofs filesystems
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
(From OE-Core rev: 41dead1ff8ccc49e6cd6e6f5d41a59d164693e0d)
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image_types.bbclass | 9 | ||||
-rw-r--r-- | meta/conf/distro/include/maintainers.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/erofs-utils/erofs-utils_1.2.1.bb | 21 | ||||
-rw-r--r-- | scripts/lib/wic/help.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/ksparser.py | 7 | ||||
-rw-r--r-- | scripts/lib/wic/partition.py | 16 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rawcopy.py | 6 |
7 files changed, 54 insertions, 7 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 8028691405..2a45d45c71 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 | |||
108 | IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" | 108 | IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" |
109 | IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" | 109 | IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" |
110 | 110 | ||
111 | IMAGE_CMD_erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}" | ||
112 | IMAGE_CMD_erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}" | ||
113 | IMAGE_CMD_erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}" | ||
114 | |||
115 | |||
111 | IMAGE_CMD_TAR ?= "tar" | 116 | IMAGE_CMD_TAR ?= "tar" |
112 | # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs | 117 | # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs |
113 | 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 ]" | 118 | 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" | |||
243 | do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot" | 248 | do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot" |
244 | do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot" | 249 | do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot" |
245 | do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot" | 250 | do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot" |
251 | do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot" | ||
252 | do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot" | ||
253 | do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot" | ||
246 | 254 | ||
247 | # This variable is available to request which values are suitable for IMAGE_FSTYPES | 255 | # This variable is available to request which values are suitable for IMAGE_FSTYPES |
248 | IMAGE_TYPES = " \ | 256 | IMAGE_TYPES = " \ |
@@ -261,6 +269,7 @@ IMAGE_TYPES = " \ | |||
261 | wic wic.gz wic.bz2 wic.lzma wic.zst \ | 269 | wic wic.gz wic.bz2 wic.lzma wic.zst \ |
262 | container \ | 270 | container \ |
263 | f2fs \ | 271 | f2fs \ |
272 | erofs erofs-lz4 erofs-lz4hc \ | ||
264 | " | 273 | " |
265 | 274 | ||
266 | # Compression is a special case of conversion. The old variable | 275 | # Compression is a special case of conversion. The old variable |
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 25d727a010..fa7eb9da0a 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -169,6 +169,7 @@ RECIPE_MAINTAINER_pn-ell = "Zang Ruochen <zangrc.fnst@fujitsu.com>" | |||
169 | RECIPE_MAINTAINER_pn-enchant2 = "Anuj Mittal <anuj.mittal@intel.com>" | 169 | RECIPE_MAINTAINER_pn-enchant2 = "Anuj Mittal <anuj.mittal@intel.com>" |
170 | RECIPE_MAINTAINER_pn-encodings = "Armin Kuster <akuster808@gmail.com>" | 170 | RECIPE_MAINTAINER_pn-encodings = "Armin Kuster <akuster808@gmail.com>" |
171 | RECIPE_MAINTAINER_pn-epiphany = "Alexander Kanavin <alex.kanavin@gmail.com>" | 171 | RECIPE_MAINTAINER_pn-epiphany = "Alexander Kanavin <alex.kanavin@gmail.com>" |
172 | RECIPE_MAINTAINER_pn-erofs-utils = "Richard Weinberger <richard@nod.at>" | ||
172 | RECIPE_MAINTAINER_pn-ethtool = "Changhyeok Bae <changhyeok.bae@gmail.com>" | 173 | RECIPE_MAINTAINER_pn-ethtool = "Changhyeok Bae <changhyeok.bae@gmail.com>" |
173 | RECIPE_MAINTAINER_pn-eudev = "Anuj Mittal <anuj.mittal@intel.com>" | 174 | RECIPE_MAINTAINER_pn-eudev = "Anuj Mittal <anuj.mittal@intel.com>" |
174 | RECIPE_MAINTAINER_pn-expat = "Yi Zhao <yi.zhao@windriver.com>" | 175 | RECIPE_MAINTAINER_pn-expat = "Yi Zhao <yi.zhao@windriver.com>" |
diff --git a/meta/recipes-devtools/erofs-utils/erofs-utils_1.2.1.bb b/meta/recipes-devtools/erofs-utils/erofs-utils_1.2.1.bb new file mode 100644 index 0000000000..6435fea68c --- /dev/null +++ b/meta/recipes-devtools/erofs-utils/erofs-utils_1.2.1.bb | |||
@@ -0,0 +1,21 @@ | |||
1 | SUMMARY = "Tools for erofs filesystems" | ||
2 | LICENSE = "GPLv2+" | ||
3 | SECTION = "base" | ||
4 | LIC_FILES_CHKSUM = "file://COPYING;md5=94fa01670a2a8f2d3ab2de15004e0848" | ||
5 | HOMEPAGE = "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/README" | ||
6 | |||
7 | SRCREV = "d1f4953edfcf4f51c71ba91586e21fc6ce9f6db9" | ||
8 | SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git" | ||
9 | |||
10 | S = "${WORKDIR}/git" | ||
11 | |||
12 | DEPENDS = "util-linux-libuuid" | ||
13 | |||
14 | inherit pkgconfig autotools | ||
15 | |||
16 | PACKAGECONFIG ??= "lz4" | ||
17 | PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" | ||
18 | |||
19 | EXTRA_OECONF = "${PACKAGECONFIG_CONFARGS} --disable-fuse" | ||
20 | |||
21 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index bd3a2b97df..991e5094bb 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -930,6 +930,7 @@ DESCRIPTION | |||
930 | ext4 | 930 | ext4 |
931 | btrfs | 931 | btrfs |
932 | squashfs | 932 | squashfs |
933 | erofs | ||
933 | swap | 934 | swap |
934 | 935 | ||
935 | --fsoptions: Specifies a free-form string of options to be | 936 | --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 3eb669da39..7a4cc83af5 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -157,7 +157,8 @@ class KickStart(): | |||
157 | part.add_argument('--fsoptions', dest='fsopts') | 157 | part.add_argument('--fsoptions', dest='fsopts') |
158 | part.add_argument('--fstype', default='vfat', | 158 | part.add_argument('--fstype', default='vfat', |
159 | choices=('ext2', 'ext3', 'ext4', 'btrfs', | 159 | choices=('ext2', 'ext3', 'ext4', 'btrfs', |
160 | 'squashfs', 'vfat', 'msdos', 'swap')) | 160 | 'squashfs', 'vfat', 'msdos', 'erofs', |
161 | 'swap')) | ||
161 | part.add_argument('--mkfs-extraopts', default='') | 162 | part.add_argument('--mkfs-extraopts', default='') |
162 | part.add_argument('--label') | 163 | part.add_argument('--label') |
163 | part.add_argument('--use-label', action='store_true') | 164 | part.add_argument('--use-label', action='store_true') |
@@ -229,6 +230,10 @@ class KickStart(): | |||
229 | err = "%s:%d: SquashFS does not support LABEL" \ | 230 | err = "%s:%d: SquashFS does not support LABEL" \ |
230 | % (confpath, lineno) | 231 | % (confpath, lineno) |
231 | raise KickStartError(err) | 232 | raise KickStartError(err) |
233 | # erofs does not support filesystem labels | ||
234 | if parsed.fstype == 'erofs' and parsed.label: | ||
235 | err = "%s:%d: erofs does not support LABEL" % (confpath, lineno) | ||
236 | raise KickStartError(err) | ||
232 | if parsed.fstype == 'msdos' or parsed.fstype == 'vfat': | 237 | if parsed.fstype == 'msdos' or parsed.fstype == 'vfat': |
233 | if parsed.fsuuid: | 238 | if parsed.fsuuid: |
234 | if parsed.fsuuid.upper().startswith('0X'): | 239 | if parsed.fsuuid.upper().startswith('0X'): |
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 76d144d12d..e0b2c5bdf2 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
@@ -141,9 +141,9 @@ class Partition(): | |||
141 | native_sysroot) | 141 | native_sysroot) |
142 | self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype) | 142 | self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype) |
143 | else: | 143 | else: |
144 | if self.fstype == 'squashfs': | 144 | if self.fstype in ('squashfs', 'erofs'): |
145 | raise WicError("It's not possible to create empty squashfs " | 145 | raise WicError("It's not possible to create empty %s " |
146 | "partition '%s'" % (self.mountpoint)) | 146 | "partition '%s'" % (self.fstype, self.mountpoint)) |
147 | 147 | ||
148 | rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label, | 148 | rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label, |
149 | self.lineno, self.fstype) | 149 | self.lineno, self.fstype) |
@@ -369,6 +369,16 @@ class Partition(): | |||
369 | (rootfs_dir, rootfs, extraopts) | 369 | (rootfs_dir, rootfs, extraopts) |
370 | exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) | 370 | exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) |
371 | 371 | ||
372 | def prepare_rootfs_erofs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir, | ||
373 | native_sysroot, pseudo): | ||
374 | """ | ||
375 | Prepare content for a erofs rootfs partition. | ||
376 | """ | ||
377 | extraopts = self.mkfs_extraopts or '' | ||
378 | erofs_cmd = "mkfs.erofs %s -U %s %s %s" % \ | ||
379 | (extraopts, self.fsuuid, rootfs, rootfs_dir) | ||
380 | exec_native_cmd(erofs_cmd, native_sysroot, pseudo=pseudo) | ||
381 | |||
372 | def prepare_empty_partition_ext(self, rootfs, oe_builddir, | 382 | def prepare_empty_partition_ext(self, rootfs, oe_builddir, |
373 | native_sysroot): | 383 | native_sysroot): |
374 | """ | 384 | """ |
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index 3c4997d8ba..fa7b1eb8ac 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py | |||
@@ -29,9 +29,9 @@ class RawCopyPlugin(SourcePlugin): | |||
29 | cmd = 'btrfs filesystem label %s %s' % (dst, label) | 29 | cmd = 'btrfs filesystem label %s %s' % (dst, label) |
30 | elif fstype == 'swap': | 30 | elif fstype == 'swap': |
31 | cmd = 'mkswap -L %s %s' % (label, dst) | 31 | cmd = 'mkswap -L %s %s' % (label, dst) |
32 | elif fstype == 'squashfs': | 32 | elif fstype in ('squashfs', 'erofs'): |
33 | raise WicError("It's not possible to update a squashfs " | 33 | raise WicError("It's not possible to update a %s " |
34 | "filesystem label '%s'" % (label)) | 34 | "filesystem label '%s'" % (fstype, label)) |
35 | else: | 35 | else: |
36 | raise WicError("Cannot update filesystem label: " | 36 | raise WicError("Cannot update filesystem label: " |
37 | "Unknown fstype: '%s'" % (fstype)) | 37 | "Unknown fstype: '%s'" % (fstype)) |