fs/ext2: cleanup and improvement
v4 cover fs/ext2: cleanup and improvement
Hi all,
Here is a respin of the remaining patchs of (so even shorter) series based on 2 series initially sent early last May by S?bastien Szymanski and Yann E. Morin, refactoring and improving the ext* image support.
Regards,
Samuel Martin (1):
fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option
S?bastien Szymanski (3):
fs/ext2: use mkfs to generate rootfs image fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option package/mke2img: remove package
Yann E. MORIN (1):
fs/ext2: add option to specify block size
Config.in.legacy | 33 +++++++ DEVELOPERS | 1 - fs/ext2/Config.in | 51 +++++++--- fs/ext2/ext2.mk | 27 ++++-- package/Config.in.host | 1 - package/mke2img/Config.in.host | 11 --- package/mke2img/mke2img | 205 ----------------------------------------- package/mke2img/mke2img.mk | 13 --- 8 files changed, 89 insertions(+), 253 deletions(-) delete mode 100644 package/mke2img/Config.in.host delete mode 100755 package/mke2img/mke2img delete mode 100644 package/mke2img/mke2img.mk
--
2.13.2
PATCH v4 1/5 fs/ext2: add option to specify block size
From: "Yann E. MORIN" <[email protected]>
---
changes v3->v4:
- fix typos (Arnout)
changes v2->v3:
- reintroduce change from Yann' series
--- fs/ext2/Config.in | 28 ++++++++++++++++++++++++++-- fs/ext2/ext2.mk | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +26 -2
@@ -44,12 +44,36 @@ config BR2_TARGET_ROOTFS_EXT2_REV config BR2_TARGET_ROOTFS_EXT2_LABEL string "filesystem label" -# 61440 = 60MB, i.e usually small enough to fit on a 64MB media +choice + bool "block size" + help + The size, in bytes, of a block. + +config BR2_TARGET_ROOTFS_EXT2_BLOCK_1024 + bool "1024" + +config BR2_TARGET_ROOTFS_EXT2_BLOCK_2048 + bool "2048" + +config BR2_TARGET_ROOTFS_EXT2_BLOCK_4096 + bool "4096" + +endchoice + +config BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE + int + default 1024 if BR2_TARGET_ROOTFS_EXT2_BLOCK_1024 + default 2048 if BR2_TARGET_ROOTFS_EXT2_BLOCK_2048 + default 4096 if BR2_TARGET_ROOTFS_EXT2_BLOCK_4096 + +# 61440 block of 1024 bytes = 60MB, i.e usually small enough to fit +# on a 64MB media config BR2_TARGET_ROOTFS_EXT2_BLOCKS int "exact size in blocks" default 61440 help - Specify the file system size as a number of 1024-byte blocks. + Specify the file system size as a number of blocks, which + size is specified above. config BR2_TARGET_ROOTFS_EXT2_INODES int "exact number of inodes (leave at 0 for auto calculation)"
fs/ext2/ext2.mk +1 -1
@@ -12,7 +12,7 @@ EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL)) EXT2_OPTS = \ -G $(BR2_TARGET_ROOTFS_EXT2_GEN) \ -R $(BR2_TARGET_ROOTFS_EXT2_REV) \ - -B 1024 \ + -B $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \ -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \ -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES) \
Signature · 1 line
2.13.2
PATCH v4 2/5 fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option
In reply to Samuel MartinSoon, the ext{2,3,4} rootfs image will no longer be generated with genext2fs, but using mke2fs instead which has no support for the extra inode number option.
So, deprecate the BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option and recommend, in lieu, to set the total inode number, taking account of the extra ones if needed.
---
changes v3->v4:
- rename deprecate prompt in Config.in.legacy (Arnout)
- introduce a _WRAP symbol to actually select BR2_LEGACY when needed (Arnout)
changes v2->v3:
- new patch (Yann)
--- Config.in.legacy | 16 ++++++++++++++++ fs/ext2/Config.in | 8 -------- fs/ext2/ext2.mk | 1 - 3 files changed, 16 insertions(+), 9 deletions(-)
Config.in.legacy +16 -0
@@ -145,6 +145,22 @@ endif ############################################################################### comment "Legacy options removed in 2017.08" +config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES + int "ext2 extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 + default 0 + help + Buildroot now uses mkfs.ext2/3/4 to generate ext2/3/4 images. So + let mkfs automatically selects the number of inodes needed. Set + this option to 0. + Note that, the number of inodes can still be set and passed to + mkfs; so if extra inodes are needed, prefer setting + BR2_TARGET_ROOTFS_EXT2_INODES taking account of them. + +config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES_WRAP + bool + default y if BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES != 0 + select BR2_LEGACY + config BR2_STRIP_none bool "Strip command 'none' has been removed" select BR2_LEGACY
fs/ext2/Config.in +0 -8
@@ -79,14 +79,6 @@ config BR2_TARGET_ROOTFS_EXT2_INODES int "exact number of inodes (leave at 0 for auto calculation)" default 0 -config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES - int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 - default 0 - help - Enter here the number of extra free inodes you want on - your filesystem. By default, Buildroot will not leave - many free inodes. - config BR2_TARGET_ROOTFS_EXT2_RESBLKS int "reserved blocks percentage" default 5
fs/ext2/ext2.mk +0 -1
@@ -15,7 +15,6 @@ EXT2_OPTS = \ -B $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \ -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \ - -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES) \ -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ -l "$(EXT2_LABEL)"
Signature · 1 line
2.13.2
PATCH v4 2/5 fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option
Quoted 34 lines · Samuel Martin
Soon, the ext{2,3,4} rootfs image will no longer be generated with genext2fs, but using mke2fs instead which has no support for the extra inode number option.
So, deprecate the
BR2_TARGET_ROOTFS_EXT2_EXTRA_INODESoption and recommend, in lieu, to set the total inode number, taking account of the extra ones if needed.Signed-off-by Samuel Martin <[email protected]>Cc S?bastien Szymanski <[email protected]>Cc "Yann E. MORIN" <[email protected]>---
changesv3->v4:
- rename deprecate prompt in Config.in.legacy (Arnout)
- introduce a_WRAPsymbol to actually selectBR2_LEGACYwhen needed (Arnout)changes
v2->v3:
- new patch (Yann)--- Config.in.legacy | 16 ++++++++++++++++ fs/ext2/Config.in | 8 -------- fs/ext2/ext2.mk | 1 - 3 files changed, 16 insertions(+), 9 deletions(-)Config.in.legacy +0
-0@@ -145,6 +145,22 @@ endif ############################################################################### comment "Legacy options removed in 2017.08"
Config.in.legacy endif · line 157
Quoted 10 lines
Config.in.legacy +10
-0+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES + int "ext2 extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 + default 0 + help + Buildroot now uses mkfs.ext2/3/4 to generate ext2/3/4 images. So + let mkfs automatically selects the number of inodes needed. Set + this option to 0. + Note that, the number of inodes can still be set and passed to + mkfs; so if extra inodes are needed, prefer setting + BR2_TARGET_ROOTFS_EXT2_INODES taking account of them.
Buildroot now uses mkfs.ext2/3/4 to generate ext2/3/4 images. It now automatically selects the number of inodes based on the image size. The extra number of inodes can no longer be provided; instead, provide the total number of inodes needed in BR2_TARGET_ROOTFS_EXT2_INODES.
Regards,
Arnout
Quoted 41 lines
Config.in.legacy +6
-0+ +config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES_WRAP + bool + default y if BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES != 0 + select BR2_LEGACY + config BR2_STRIP_none bool "Strip command 'none' has been removed" select BR2_LEGACYfs/ext2/Config.in +0
-8@@ -79,14 +79,6 @@ config BR2_TARGET_ROOTFS_EXT2_INODES int "exact number of inodes (leave at 0 for auto calculation)" default 0 -config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES - int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 - default 0 - help - Enter here the number of extra free inodes you want on - your filesystem. By default, Buildroot will not leave - many free inodes. - config BR2_TARGET_ROOTFS_EXT2_RESBLKS int "reserved blocks percentage" default 5fs/ext2/ext2.mk +0
-1@@ -15,7 +15,6 @@ EXT2_OPTS = \ -B $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \ -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \ - -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES) \ -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ -l "$(EXT2_LABEL)"
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v4 3/5 fs/ext2: use mkfs to generate rootfs image
In reply to Samuel MartinFrom: S?bastien Szymanski <[email protected]>
mkfs is now capable of generating rootfs images. Use mkfs instead of genext2fs.
If not set, we now let mkfs calculate the block size and the number of inodes needed.
This change also adjusts the options to meet those of mkfs. Note that passing a null inode number to mkfs triggers its automatic calculation.
The BR2_TARGET_ROOTFS_EXT2_BLOCKS symbol is ranamed as well, into BR2_TARGET_ROOTFS_EXT2_SIZE, since it now accepts the same values as the mkfs' fs-size argument (i.e. with k, m, g or t suffix).
---
changes v3->v4:
- disable the size check when ext* rootfs is disabled
- remove unneeded comment
- introduce a _WRAP symbol to actually select BR2_LEGACY when needed (Arnout)
changes v2->v3:
- reword commit log
changes v1->v2:
- rebase
- add default size value
--- Config.in.legacy | 11 +++++++++++ fs/ext2/Config.in | 21 +++++++++++---------- fs/ext2/ext2.mk | 23 ++++++++++++++--------- 3 files changed, 36 insertions(+), 19 deletions(-)
Config.in.legacy +11 -0
@@ -145,6 +145,17 @@ endif ############################################################################### comment "Legacy options removed in 2017.08" +config BR2_TARGET_ROOTFS_EXT2_BLOCKS + int "exact size in blocks has been removed" + default 0 + help + This option has been removed in favor of BR2_TARGET_ROOTFS_EXT2_SIZE. + +config BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP + bool + default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0 + select BR2_LEGACY + config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES int "ext2 extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0 default 0
fs/ext2/Config.in +11 -10
@@ -1,6 +1,6 @@ config BR2_TARGET_ROOTFS_EXT2 bool "ext2/3/4 root filesystem" - select BR2_PACKAGE_HOST_MKE2IMG + select BR2_PACKAGE_HOST_E2FSPROGS help Build an ext2/3/4 root filesystem
@@ -66,19 +66,20 @@ config BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE default 2048 if BR2_TARGET_ROOTFS_EXT2_BLOCK_2048 default 4096 if BR2_TARGET_ROOTFS_EXT2_BLOCK_4096 -# 61440 block of 1024 bytes = 60MB, i.e usually small enough to fit -# on a 64MB media -config BR2_TARGET_ROOTFS_EXT2_BLOCKS - int "exact size in blocks" - default 61440 - help - Specify the file system size as a number of blocks, which - size is specified above. - config BR2_TARGET_ROOTFS_EXT2_INODES int "exact number of inodes (leave at 0 for auto calculation)" default 0 +config BR2_TARGET_ROOTFS_EXT2_SIZE + string "exact size" + default BR2_TARGET_ROOTFS_EXT2_BLOCKS if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0 # legacy 2017.08 + default "60M" # default size + help + The size of the filesystem image. If it does not have a suffix, it is + interpreted as power-of-two kilobytes. If it is suffixed by 'k', 'm', + 'g', 't' (either upper-case or lower-case), then it is interpreted in + power-of-two kilobytes, megabytes, gigabytes, terabytes, etc. + config BR2_TARGET_ROOTFS_EXT2_RESBLKS int "reserved blocks percentage" default 5
fs/ext2/ext2.mk +14 -9
@@ -4,24 +4,29 @@ # ################################################################################ +EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE)) +ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-) +$(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty) +endif + # 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. EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL)) #" Syntax highlighting... :-/ ) EXT2_OPTS = \ - -G $(BR2_TARGET_ROOTFS_EXT2_GEN) \ - -R $(BR2_TARGET_ROOTFS_EXT2_REV) \ - -B $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ - -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \ - -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \ - -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ - -l "$(EXT2_LABEL)" + -d $(TARGET_DIR) \ + -r $(BR2_TARGET_ROOTFS_EXT2_REV) \ + -b $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ + -N $(BR2_TARGET_ROOTFS_EXT2_INODES) \ + -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ + -L "$(EXT2_LABEL)" -ROOTFS_EXT2_DEPENDENCIES = host-mke2img +ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs define ROOTFS_EXT2_CMD - PATH=$(BR_PATH) mke2img -d $(TARGET_DIR) $(EXT2_OPTS) -o $@ + rm -f $@ + PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ $(EXT2_SIZE) endef rootfs-ext2-symlink:
Signature · 1 line
2.13.2
PATCH v4 4/5 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option
In reply to Samuel MartinFrom: S?bastien Szymanski <[email protected]>
This option lets the user specify ext2/3/4 features.
---
changes v3->v4:
- none
changes v2->v3:
- none
changes v1->v2:
- rebase
--- fs/ext2/Config.in | 10 ++++++++++ fs/ext2/ext2.mk | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-)
fs/ext2/Config.in +10 -0
@@ -89,6 +89,16 @@ config BR2_TARGET_ROOTFS_EXT2_RESBLKS Traditionally, this has been 5%, and all ext-related tools still default to reserving 5% when creating a new ext filesystem. +config BR2_TARGET_ROOTFS_EXT2_FEATURES + string "Filesystem features" + default "^64bit" + help + Specify a comma-separated list of ext2/3/4 features. + For more information about this option, see the mkefs' -O option in + the manual page mke2fs(8). + For more information about the features which can be set, see then + manual page ext4(5). + choice prompt "Compression method" default BR2_TARGET_ROOTFS_EXT2_NONE
fs/ext2/ext2.mk +4 -1
@@ -9,6 +9,8 @@ ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-) $(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty) endif +EXT2_FEATURES = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_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. EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
@@ -20,7 +22,8 @@ EXT2_OPTS = \ -b $(BR2_TARGET_ROOTFS_EXT2_BLOCK_SIZE) \ -N $(BR2_TARGET_ROOTFS_EXT2_INODES) \ -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \ - -L "$(EXT2_LABEL)" + -L "$(EXT2_LABEL)" \ + $(if $(EXT2_FEATURES),-O "$(EXT2_FEATURES)") ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
Signature · 1 line
2.13.2
PATCH v4 5/5 package/mke2img: remove package
In reply to Samuel MartinFrom: S?bastien Szymanski <[email protected]>
Now that we use mkfs to generate ext2/3/4 filesystem image by calling mkfs directly from fs/ext2/ext2.mk, we can remove this package.
---
changes v3->v4:
- none
changes v2->v3:
- none
changes v1->v2:
- rebase
--- Config.in.legacy | 6 ++ DEVELOPERS | 1 - package/Config.in.host | 1 - package/mke2img/Config.in.host | 11 --- package/mke2img/mke2img | 205 ----------------------------------------- package/mke2img/mke2img.mk | 13 --- 6 files changed, 6 insertions(+), 231 deletions(-) delete mode 100644 package/mke2img/Config.in.host delete mode 100755 package/mke2img/mke2img delete mode 100644 package/mke2img/mke2img.mk
Config.in.legacy +6 -0
@@ -145,6 +145,12 @@ endif ############################################################################### comment "Legacy options removed in 2017.08" +config BR2_PACKAGE_HOST_MKE2IMG + bool "host mke2img has been removed" + select BR2_LEGACY + help + We now call mkfs directly to generate ext2/3/4 filesystem image. + config BR2_TARGET_ROOTFS_EXT2_BLOCKS int "exact size in blocks has been removed" default 0
DEVELOPERS +0 -1
@@ -1783,7 +1783,6 @@ F: package/libiscsi/ F: package/libseccomp/ F: package/linux-tools/ F: package/mesa3d-headers/ -F: package/mke2img/ F: package/nbd/ F: package/nut/ F: package/nvidia-driver/
package/Config.in.host +0 -1
@@ -24,7 +24,6 @@ menu "Host utilities" source "package/lpc3250loader/Config.in.host" source "package/lttng-babeltrace/Config.in.host" source "package/mfgtools/Config.in.host" - source "package/mke2img/Config.in.host" source "package/mkpasswd/Config.in.host" source "package/mtd/Config.in.host" source "package/mtools/Config.in.host"
package/mke2img/Config.in.host deleted +0 -11
@@ -1,11 +0,0 @@ -config BR2_PACKAGE_HOST_MKE2IMG - bool "host mke2img" - select BR2_PACKAGE_HOST_E2FSPROGS - select BR2_PACKAGE_HOST_GENEXT2FS - help - Easily create filesystems of the extend familly: ext2/3/4. - - This tool is bundled by, and specific to Buildroot. However, it can - be used from post-images scripts is needed. - - https://code.google.com/p/mke2img/
package/mke2img/mke2img deleted +0 -205
205 lines not on this page · raw message
package/mke2img/mke2img.mk deleted +0 -13
@@ -1,13 +0,0 @@ -################################################################################ -# -# mke2img -# -################################################################################ - -HOST_MKE2IMG_DEPENDENCIES = host-genext2fs host-e2fsprogs - -define HOST_MKE2IMG_INSTALL_CMDS - $(INSTALL) -D -m 0755 package/mke2img/mke2img $(HOST_DIR)/usr/bin/mke2img -endef - -$(eval $(host-generic-package))
Signature · 1 line
2.13.2