poky.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander Kanavin" <alex.kanavin@gmail.com>
To: anna-lena.marx@inovex.de
Cc: poky@lists.yoctoproject.org
Subject: Re: [poky] [PULL][PATCH 1/1] wic: Add support for F2FS in WIC rootfs plugin
Date: Thu, 23 Feb 2023 13:28:25 +0100	[thread overview]
Message-ID: <CANNYZj_SX4m1Fty01CPsvmj8AMbAY88qtNbcMD1VK=G5tkiQ5Q@mail.gmail.com> (raw)
In-Reply-To: <447adb5dc9f54eb3f697810b83dd9d049a76b0b3.1677071966.git.anna-lena.marx@inovex.de>

Hello Anna-Lena,

the correct mailing list is openembedded-core. Also, if you add
features to wic, you should also included tests for those features -
you can find existing tests in meta/lib/oeqa/selftest/cases/wic.py

Alex

On Thu, 23 Feb 2023 at 13:12, Anna-Lena Marx via
lists.yoctoproject.org
<anna-lena.marx=inovex.de@lists.yoctoproject.org> wrote:
>
> Building F2FS rootfs is supported in Yocto - see
> image_types.bbclass, but not in WIC.
> This adds it as a nice convenience feature.
>
> F2FS needs a minimum size of ~500M to operate correctly due to
> an overprovision functionality.
>
> Signed-off-by: Anna-Lena Marx <anna-lena.marx@inovex.de>
> ---
>  meta/classes-recipe/image_types_wic.bbclass |  2 +-
>  meta/recipes-core/meta/wic-tools.bb         |  2 +-
>  scripts/lib/wic/help.py                     |  1 +
>  scripts/lib/wic/ksparser.py                 |  2 +-
>  scripts/lib/wic/misc.py                     |  1 +
>  scripts/lib/wic/partition.py                | 32 ++++++++++++++++++++-
>  6 files changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
> index c339b9bdfb..8ae5ecca4d 100644
> --- a/meta/classes-recipe/image_types_wic.bbclass
> +++ b/meta/classes-recipe/image_types_wic.bbclass
> @@ -89,7 +89,7 @@ do_image_wic[recrdeptask] += "do_deploy"
>  do_image_wic[deptask] += "do_image_complete"
>
>  WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}'
> -WKS_FILE_DEPENDS_DEFAULT += "bmap-tools-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native"
> +WKS_FILE_DEPENDS_DEFAULT += "bmap-tools-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native f2fs-tools-native"
>  # Unified kernel images need objcopy
>  WKS_FILE_DEPENDS_DEFAULT += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
>  WKS_FILE_DEPENDS_BOOTLOADERS = ""
> diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
> index 9282d36a4d..d30ce66b56 100644
> --- a/meta/recipes-core/meta/wic-tools.bb
> +++ b/meta/recipes-core/meta/wic-tools.bb
> @@ -7,7 +7,7 @@ DEPENDS = "\
>             mtools-native bmap-tools-native grub-native cdrtools-native \
>             btrfs-tools-native squashfs-tools-native pseudo-native \
>             e2fsprogs-native util-linux-native tar-native erofs-utils-native \
> -           virtual/${TARGET_PREFIX}binutils \
> +           f2fs-tools-native virtual/${TARGET_PREFIX}binutils \
>             "
>  DEPENDS:append:x86 = " syslinux-native syslinux grub-efi systemd-boot"
>  DEPENDS:append:x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
> diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
> index 73e3380cde..0094065931 100644
> --- a/scripts/lib/wic/help.py
> +++ b/scripts/lib/wic/help.py
> @@ -931,6 +931,7 @@ DESCRIPTION
>               btrfs
>               squashfs
>               erofs
> +             f2fs
>               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 d1e546b12d..e10ce6581d 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -159,7 +159,7 @@ class KickStart():
>          part.add_argument('--fstype', default='vfat',
>                            choices=('ext2', 'ext3', 'ext4', 'btrfs',
>                                     'squashfs', 'vfat', 'msdos', 'erofs',
> -                                   'swap', 'none'))
> +                                   'f2fs', 'swap', 'none'))
>          part.add_argument('--mkfs-extraopts', default='')
>          part.add_argument('--label')
>          part.add_argument('--use-label', action='store_true')
> diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
> index 2b90821b30..dc84a37423 100644
> --- a/scripts/lib/wic/misc.py
> +++ b/scripts/lib/wic/misc.py
> @@ -41,6 +41,7 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools",
>                    "mkfs.ext3": "e2fsprogs",
>                    "mkfs.ext4": "e2fsprogs",
>                    "mkfs.vfat": "dosfstools",
> +                  "mkfs.f2fs": "f2fs-tools",
>                    "mksquashfs": "squashfs-tools",
>                    "mkswap": "util-linux",
>                    "mmd": "mtools",
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index 382afa44bc..6adcaa041f 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -208,7 +208,7 @@ class Partition():
>          Prepare content for a rootfs partition i.e. create a partition
>          and fill it from a /rootfs dir.
>
> -        Currently handles ext2/3/4, btrfs, vfat and squashfs.
> +        Currently handles ext2/3/4, btrfs, vfat, squashfs and f2fs.
>          """
>
>          rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
> @@ -351,6 +351,36 @@ class Partition():
>               self.mkfs_extraopts, self.fsuuid, rootfs)
>          exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
>
> +    def prepare_rootfs_f2fs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
> +                            native_sysroot, pseudo):
> +        """
> +        Prepare content for a f2fs rootfs partition.
> +        """
> +        du_cmd = "du -ks %s" % rootfs_dir
> +        out = exec_cmd(du_cmd)
> +        actual_rootfs_size = int(out.split()[0])
> +
> +        min_f2fs_size = 524288
> +        rootfs_size = self.get_rootfs_size(actual_rootfs_size)
> +        if rootfs_size < min_f2fs_size:
> +            rootfs_size = min_f2fs_size
> +
> +        with open(rootfs, 'w') as sparse:
> +            os.ftruncate(sparse.fileno(), rootfs_size * 1024)
> +
> +        extraopts = self.mkfs_extraopts or "-O extra_attr,compression"
> +
> +        label_str = ""
> +        if self.label:
> +            label_str = "-l %s" % self.label
> +
> +        mkfs_f2fs_cmd = "mkfs.f2fs %s %s %s" % \
> +                        (label_str, extraopts, rootfs)
> +        exec_native_cmd(mkfs_f2fs_cmd, native_sysroot, pseudo=pseudo)
> +
> +        sload_f2fs_cmd = "sload.f2fs -f %s %s" % (rootfs_dir, rootfs)
> +        exec_native_cmd(sload_f2fs_cmd, native_sysroot, pseudo=pseudo)
> +
>      def prepare_rootfs_msdos(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
>                               native_sysroot, pseudo):
>          """
> --
> 2.39.2
>
>
> 
>

      reply	other threads:[~2023-02-23 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 12:11 [PULL][PATCH 0/1] wic: Add support for F2FS in WIC rootfs plugin Anna-Lena Marx
2023-02-23 12:11 ` [PULL][PATCH 1/1] " Anna-Lena Marx
2023-02-23 12:28   ` Alexander Kanavin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANNYZj_SX4m1Fty01CPsvmj8AMbAY88qtNbcMD1VK=G5tkiQ5Q@mail.gmail.com' \
    --to=alex.kanavin@gmail.com \
    --cc=anna-lena.marx@inovex.de \
    --cc=poky@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).