From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] fs/f2fs: add support for creating a f2fs image
Date: Wed, 31 Oct 2018 22:42:09 +0100 [thread overview]
Message-ID: <20181031214209.GN28575@scaer> (raw)
In-Reply-To: <20181026200016.30856-3-grzegorz@blach.pl>
Grzegorz, All,
On 2018-10-26 22:00 +0200, Grzegorz Blach spake thusly:
> This patch makes possible to create rootfs image using f2fs filesystem.
>
> Signed-off-by: Grzegorz Blach <grzegorz@blach.pl>
> ---
[--SNIP--]
> diff --git a/fs/f2fs/Config.in b/fs/f2fs/Config.in
> new file mode 100644
> index 0000000000..d096057890
> --- /dev/null
> +++ b/fs/f2fs/Config.in
> @@ -0,0 +1,49 @@
> +config BR2_TARGET_ROOTFS_F2FS
> + bool "f2fs root filesystem"
> + select BR2_PACKAGE_HOST_F2FS_TOOLS
> + help
> + Build a f2fs root filesystem. If you enable this option, you
> + probably want to enable the f2fs-tools package too.
> +
> +if BR2_TARGET_ROOTFS_F2FS
> +
> +config BR2_TARGET_ROOTFS_F2FS_LABEL
> + string "filesystem label"
> +
> +config BR2_TARGET_ROOTFS_F2FS_SIZE
> + string "filesystem size"
> + default "100M"
> + help
> + The size of the filesystem image in bytes.
> + Suffix with K, M, G or T for power-of-two kilo-, mega-, giga-
> + or terabytes.
> +
> +config BR2_TARGET_ROOTFS_F2FS_COLD_FILES
> + string "extension list for cold files"
> + help
> + Specify a file extension list in order f2fs to treat them
> + as cold files. The default list includes most of multimedia
> + file extensions such as jpg, gif, mpeg, mkv, and so on.
I would prefer that we get a first patch that adds the bare minimal
needed to assemble an f2fs image, with further patches adding more
features one by one, as it is easier to review.
This "cold files" feature should be added in its own patch.
> +config BR2_TARGET_ROOTFS_F2FS_OVERPROVISION
> + int "size for overprovision area (0 for auto calculation)"
> + default 0
> + help
> + Specify the percentage over the volume size for overprovision
> + area. This area is hidden to users, and utilized by F2FS
> + cleaner. If not specified, the best number will be assigned
> + automatically accoring to the partition size.
May I suggest an alternative wording?
int "size for overprovision area"
default 0
help
The percentage over the volume size for overprovision area. This
area is hidden to users, and utilized by F2FS cleaner.
Leave at 0 for autocalculation.
But this feature should be added in its own patch.
> +config BR2_TARGET_ROOTFS_F2FS_FEATURES
> + string "filesystem features"
> + help
> + A feature list in order f2fs filesystem will supports.
> + e.g "encrypt" and so on.
Ditto, a separate patch. Also, this option being a plain string, I'd
prefer it goes last in the list of options, below the discard one.
> +config BR2_TARGET_ROOTFS_F2FS_DISCARD
> + bool "discard policy"
> + default y
> + help
> + Enable or disable discard policy.
Ditto, a separate patch for that one, please.
> +endif # BR2_TARGET_ROOTFS_F2FS
> diff --git a/fs/f2fs/f2fs.mk b/fs/f2fs/f2fs.mk
> new file mode 100644
> index 0000000000..19c0082d67
> --- /dev/null
> +++ b/fs/f2fs/f2fs.mk
> @@ -0,0 +1,46 @@
> +################################################################################
> +#
> +# Build the f2fs root filesystem image
> +#
> +################################################################################
> +
> +F2FS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_SIZE))
> +ifeq ($(BR2_TARGET_ROOTFS_F2FS)-$(F2FS_SIZE),y-)
> +$(error BR2_TARGET_ROOTFS_F2FS_SIZE cannot be empty)
> +endif
> +
> +F2FS_COLD_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_COLD_FILES))
> +F2FS_FEATURES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_FEATURES))
> +# qstrip results in stripping consecutive spaces into a single one. So the
> +# variable is not qstrip-ed to preserve the integrity of the string value.
> +F2FS_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_F2FS_LABEL))
> +# ")
> +
> +ifneq ($(BR2_TARGET_ROOTFS_F2FS_OVERPROVISION),0)
> +F2FS_OVERPROVISION=$(BR2_TARGET_ROOTFS_F2FS_OVERPROVISION)
> +endif
> +
> +ifeq ($(BR2_TARGET_ROOTFS_F2FS_DISCARD),y)
> +F2FS_DISCARD=1
> +else
> +F2FS_DISCARD=0
> +endif
> +
> +F2FS_OPTS = \
> + -f \
> + -l "$(F2FS_LABEL)" \
> + $(if $(F2FS_COLD_FILES),-e "$(F2FS_COLD_FILES)") \
> + $(if $(F2FS_OVERPROVISION),-o $(F2FS_OVERPROVISION)) \
> + $(if $(F2FS_FEATURES),-O "$(F2FS_FEATURES)") \
> + -t $(F2FS_DISCARD)
Conditional values should go last:
F2FS_OPTS = \
-f \
-l "$(F2FS_LABEL)" \
-t $(F2FS_DISCARD) \
$(if $(F2FS_COLD_FILES),-e "$(F2FS_COLD_FILES)") \
[...]
> +ROOTFS_F2FS_DEPENDENCIES = host-f2fs-tools
> +
> +define ROOTFS_F2FS_CMD
> + $(RM) -f $@
> + dd if=/dev/zero of=$@ bs=1 count=0 seek=$(F2FS_SIZE)
You mentionned in your cover letter that you were not sure using dd was
the best solution. It is acceptable, but usng truncate might be a better
option, and you can alsoirectly pass it the size value:
truncate -s '$(F2FS_SIZE)' $@
Otherwise, when using dd to achieve the same, I invert bs and seek:
(i.e. it is 1 bloc of N, not N blocs of 1).
dd if=/dev/zero of=$@ bs=$(F2FS_SIZE) count=0 seek=1
So, dd is acceptable, but I'd favour truncate.
Regards,
Yann E. MORIN.
> + $(HOST_DIR)/sbin/mkfs.f2fs $(F2FS_OPTS) $@
> + $(HOST_DIR)/sbin/sload.f2fs -f $(TARGET_DIR) $@
> +endef
> +
> +$(eval $(rootfs))
> --
> 2.17.2
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2018-10-31 21:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 20:00 [Buildroot] [PATCH 0/2] Creating a sparse file in ROOTFS_F2FS_CMD Grzegorz Blach
2018-10-26 20:00 ` [Buildroot] [PATCH 1/2] package/f2fs-tools: add host package Grzegorz Blach
2018-10-31 21:21 ` Yann E. MORIN
2018-11-03 14:45 ` Thomas Petazzoni
2018-11-03 14:37 ` Thomas Petazzoni
2018-10-26 20:00 ` [Buildroot] [PATCH 2/2] fs/f2fs: add support for creating a f2fs image Grzegorz Blach
2018-10-31 21:42 ` Yann E. MORIN [this message]
2018-11-03 14:48 ` Thomas Petazzoni
2018-11-04 16:48 ` Grzegorz Blach
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=20181031214209.GN28575@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/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