Skip to contentSkip to conversation

fs/ext2: cleanup and improvement

PATCH New Samuel Martin 5 participants 15 messages Jul 4, 2017 – Jul 5, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover fs/ext2: cleanup and improvement

Hi all,

Here is anothe 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 ext2/3/4 image support.

Regards,

Samuel Martin (2):
fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS ->
BR2_TARGET_ROOTFS_EXT2_SIZE

S?bastien Szymanski (3):
fs/ext2: use mkfs to generate rootfs image fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option package/mke2img: remove package

 Config.in.legacy                            |  32 +++++
 DEVELOPERS                                  |   1 -
 configs/at91sam9x5ek_mmc_dev_defconfig      |   2 +-
 configs/beaglebone_qt5_defconfig            |   2 +-
 configs/firefly_rk3288_demo_defconfig       |   2 +-
 configs/minnowboard_max-graphical_defconfig |   2 +-
 configs/nanopi_neo_defconfig                |   2 +-
 configs/pc_x86_64_bios_defconfig            |   2 +-
 configs/pc_x86_64_efi_defconfig             |   2 +-
 configs/raspberrypi3_64_defconfig           |   2 +-
 fs/ext2/Config.in                           |  40 ++++--
 fs/ext2/ext2.mk                             |  26 ++--
 package/Config.in.host                      |   1 -
 package/mke2img/Config.in.host              |  11 --
 package/mke2img/mke2img                     | 205 ----------------------------
 package/mke2img/mke2img.mk                  |  13 --
 16 files changed, 82 insertions(+), 263 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

#1 lore raw

PATCH v5 1/5 fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option

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_INODES option and recommend, in lieu, to set the total inode number, taking account of the extra ones if needed.

Cc S?bastien Szymanski <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
changes v4->v5:
- reword legacy option help text (Arnout)

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  | 15 +++++++++++++++
 fs/ext2/Config.in |  8 --------
 fs/ext2/ext2.mk   |  1 -
 3 files changed, 15 insertions(+), 9 deletions(-)
Config.in.legacy +15 -0
index 453c5eb8b8..8ea468b64a 100644
@@ -145,6 +145,21 @@ 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. 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.
+
+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
index 6f16dde17f..ec1b5f2c55 100644
@@ -55,14 +55,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
index 0d5fc7f118..8a648dd66c 100644
@@ -15,7 +15,6 @@ EXT2_OPTS = \
 	-B 1024 \
 	-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
#2 lore raw

PATCH v5 1/5 fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option

Quoted 11 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_INODES option and recommend, in lieu, to set the total inode number, taking account of the extra ones if needed.

Cc S?bastien Szymanski <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

Regards,
Arnout

Quoted 76 lines

---
changes v4->v5:
- reword legacy option help text (Arnout)

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  | 15 +++++++++++++++
 fs/ext2/Config.in |  8 --------
 fs/ext2/ext2.mk   |  1 -
 3 files changed, 15 insertions(+), 9 deletions(-)
Config.in.legacy +15 -0
index 453c5eb8b8..8ea468b64a 100644
@@ -145,6 +145,21 @@ 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. 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.
+
+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
index 6f16dde17f..ec1b5f2c55 100644
@@ -55,14 +55,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
index 0d5fc7f118..8a648dd66c 100644
@@ -15,7 +15,6 @@ EXT2_OPTS = \
 	-B 1024 \
 	-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
#3 lore raw

PATCH v5 1/5 fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option

In reply to Samuel Martin

Hello,

Quoted 8 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_INODES option and recommend, in lieu, to set the total inode number, taking account of the extra ones if needed.

Quoted 7 lines
Cc S?bastien Szymanski <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
changes v4->v5:
- reword legacy option help text (Arnout)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v5 2/5 fs/ext2: use mkfs to generate rootfs image

In reply to Samuel Martin

From: 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.

Notes:
* Passing a null inode number to mkfs triggers its automatic calculation.
* Passing a fs-size with no unit suffix to mkfs is interpreted as using 1K block size.

---
changes v4->v5:
- remove BR2_TARGET_ROOTFS_EXT2_BLOCKS renaming
- update commit log

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

---
 fs/ext2/Config.in |  2 +-
 fs/ext2/ext2.mk   | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
fs/ext2/Config.in +1 -1
index ec1b5f2c55..9c58ac62ed 100644
@@ -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
 
fs/ext2/ext2.mk +9 -9
index 8a648dd66c..bff442ff18 100644
@@ -10,18 +10,18 @@ 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 1024 \
-	-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) \
+	-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) $@ \
+		 $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endef
 
 rootfs-ext2-symlink:
Signature · 1 line
2.13.2
#5 lore raw

PATCH v5 2/5 fs/ext2: use mkfs to generate rootfs image

Quoted 71 lines · Samuel Martin

From: 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.

Notes:
* Passing a null inode number to mkfs triggers its automatic calculation.
* Passing a fs-size with no unit suffix to mkfs is interpreted as using 1K block size.

---
changes v4->v5:
- remove BR2_TARGET_ROOTFS_EXT2_BLOCKS renaming
- update commit log

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

---
 fs/ext2/Config.in |  2 +-
 fs/ext2/ext2.mk   | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
fs/ext2/Config.in +1 -1
index ec1b5f2c55..9c58ac62ed 100644
@@ -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
 
fs/ext2/ext2.mk +3 -7
index 8a648dd66c..bff442ff18 100644
@@ -10,18 +10,18 @@ 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 1024 \
-	-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) \
+	-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \

fs/ext2/ext2.mk EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL)) · line 23

Quoted 10 lines
fs/ext2/ext2.mk +5 -2
+	-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) $@ \

Now that we call mkfs.ext2 directly, we don't need to pass the updated PATH
anymore (mkfs.ext2 doesn't call out to anything else). So instead we could call $(HOST_DIR)/usr/bin/mkfs.extN.

But that could be fixed up later, so

Regards,
Arnout

Quoted 5 lines
fs/ext2/ext2.mk +1 -0
+		 $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endef
 
 rootfs-ext2-symlink:
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
#6 lore raw

PATCH v5 2/5 fs/ext2: use mkfs to generate rootfs image

In reply to Samuel Martin

Hello,

Quoted 15 lines · Samuel Martin

From: 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.

Notes:
* Passing a null inode number to mkfs triggers its automatic calculation.
* Passing a fs-size with no unit suffix to mkfs is interpreted as using 1K block size.

Quoted 8 lines

---
changes v4->v5:
- remove BR2_TARGET_ROOTFS_EXT2_BLOCKS renaming
- update commit log

I've made the minor improvement suggested by Arnout: passing PATH=$(BR_PATH) is no longer needed, and instead mkfs.ext is called directly using its $(HOST_DIR)/usr/sbin/ path.

Applied to master with this change. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v5 3/5 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

In reply to Samuel Martin

This change deprecates the ext2/3/4 rootfs size in blocks symbol in favor of one that mimic the fs-size argument behavior of mkfs (i.e. size in a human readable format accepting k, m, g or t suffix or their upper-case variants).

This change also updates the defconfigs that used to set BR2_TARGET_ROOTFS_EXT2_BLOCKS symbol.

---
changes v4->v5:
- new patch (Arnout)

---
 Config.in.legacy                            | 11 +++++++++++
 configs/at91sam9x5ek_mmc_dev_defconfig      |  2 +-
 configs/beaglebone_qt5_defconfig            |  2 +-
 configs/firefly_rk3288_demo_defconfig       |  2 +-
 configs/minnowboard_max-graphical_defconfig |  2 +-
 configs/nanopi_neo_defconfig                |  2 +-
 configs/pc_x86_64_bios_defconfig            |  2 +-
 configs/pc_x86_64_efi_defconfig             |  2 +-
 configs/raspberrypi3_64_defconfig           |  2 +-
 fs/ext2/Config.in                           | 13 ++++++++-----
 fs/ext2/ext2.mk                             |  8 ++++++--
 11 files changed, 33 insertions(+), 15 deletions(-)
Config.in.legacy +11 -0
index 8ea468b64a..a26869ac64 100644
@@ -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
configs/at91sam9x5ek_mmc_dev_defconfig +1 -1
index 0060111fca..1bf2983ee7 100644
@@ -81,7 +81,7 @@ BR2_PACKAGE_VIM=y
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"
 
 # Bootloaders
 BR2_TARGET_AT91BOOTSTRAP3=y
configs/beaglebone_qt5_defconfig +1 -1
index 34063739a2..fd408f5d09 100644
@@ -25,7 +25,7 @@ BR2_PACKAGE_TI_SGX_KM=y
 BR2_PACKAGE_TI_SGX_UM=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=126976
+BR2_TARGET_ROOTFS_EXT2_SIZE="126976K"
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
 BR2_TARGET_UBOOT_CUSTOM_VERSION=y
configs/firefly_rk3288_demo_defconfig +1 -1
index 0f4dd368c4..cd06aa784f 100644
@@ -25,7 +25,7 @@ BR2_PACKAGE_QT5BASE_EGLFS=y
 BR2_PACKAGE_MALI_T76X=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=250000
+BR2_TARGET_ROOTFS_EXT2_SIZE="250000K"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
configs/minnowboard_max-graphical_defconfig +1 -1
index 1a2cd33be2..855d257bc8 100644
@@ -68,6 +68,6 @@ BR2_PACKAGE_STARTUP_NOTIFICATION=y
 # Filesystem image
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"
 # BR2_TARGET_ROOTFS_TAR is not set
 
configs/nanopi_neo_defconfig +1 -1
index a22705269d..5fd08328f1 100644
@@ -31,7 +31,7 @@ BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
 # Build an sdcard image
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=32768
+BR2_TARGET_ROOTFS_EXT2_SIZE="32768K"
 BR2_TARGET_ROOTFS_EXT2_INODES=8192
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
configs/pc_x86_64_bios_defconfig +1 -1
index d64f09a1dc..b68e49919a 100644
@@ -17,7 +17,7 @@ BR2_TARGET_GRUB2=y
 # Filesystem / image
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh"
 
configs/pc_x86_64_efi_defconfig +1 -1
index ea2abc39be..400dcffa64 100644
@@ -20,7 +20,7 @@ BR2_TARGET_GRUB2_X86_64_EFI=y
 # Filesystem / image
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh"
 
configs/raspberrypi3_64_defconfig +1 -1
index 13a505b031..0ed9f6f708 100644
@@ -30,7 +30,7 @@ BR2_PACKAGE_HOST_MTOOLS=y
 # Filesystem / image
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
fs/ext2/Config.in +8 -5
index 9c58ac62ed..b2363940f0 100644
@@ -44,12 +44,15 @@ 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
-config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-	int "exact size in blocks"
-	default 61440
+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 "61440K" # default size
 	help
-	  Specify the file system size as a number of 1024-byte blocks.
+	  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_INODES
 	int "exact number of inodes (leave at 0 for auto calculation)"
fs/ext2/ext2.mk +6 -2
index bff442ff18..c8da9c4451 100644
@@ -4,6 +4,11 @@
 #
 ################################################################################
 
+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))
@@ -20,8 +25,7 @@ ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
 define ROOTFS_EXT2_CMD
 	rm -f $@
-	PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ \
-		 $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
+	PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ $(EXT2_SIZE)
 endef
 
 rootfs-ext2-symlink:
Signature · 1 line
2.13.2
#8 lore raw

PATCH v5 3/5 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

Quoted 7 lines · Samuel Martin

This change deprecates the ext2/3/4 rootfs size in blocks symbol in favor of one that mimic the fs-size argument behavior of mkfs (i.e. size in a human readable format accepting k, m, g or t suffix or their upper-case variants).

This change also updates the defconfigs that used to set BR2_TARGET_ROOTFS_EXT2_BLOCKS symbol.

So I tried this and it is in fact very annoying that it changes. Anyone who was
using ext2 will be hit by this legacy stuff...

Quoted 25 lines

---
changes v4->v5:
- new patch (Arnout)

---
 Config.in.legacy                            | 11 +++++++++++
 configs/at91sam9x5ek_mmc_dev_defconfig      |  2 +-
 configs/beaglebone_qt5_defconfig            |  2 +-
 configs/firefly_rk3288_demo_defconfig       |  2 +-
 configs/minnowboard_max-graphical_defconfig |  2 +-
 configs/nanopi_neo_defconfig                |  2 +-
 configs/pc_x86_64_bios_defconfig            |  2 +-
 configs/pc_x86_64_efi_defconfig             |  2 +-
 configs/raspberrypi3_64_defconfig           |  2 +-
 fs/ext2/Config.in                           | 13 ++++++++-----
 fs/ext2/ext2.mk                             |  8 ++++++--
 11 files changed, 33 insertions(+), 15 deletions(-)
Config.in.legacy +0 -0
index 8ea468b64a..a26869ac64 100644

Config.in.legacy endif · line 152

Quoted 8 lines
Config.in.legacy +5 -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.

Add:
It has been set automatically to the value you had before.

Config.in.legacy endif · line 156

Quoted 4 lines
Config.in.legacy +4 -0
+
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP
+	bool
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0

So this will hit legacy handling for anyone using the default value in 2017.05,
because there the default is 61440. And if we change it into != 61440, then it will hit anyone who upgrades from <2017.05. And if we add || != 61440, it will still hit anyone who changed the default.

So@the very least we should add || != 61440 so anyone who was using the
default before will not get hit by legacy.

Ideally we don't change the symbol name but then we can't change it from int to
string. So I guess we'll have to do this after all :-(

Config.in.legacy endif · line 158

Quoted 2 lines
Config.in.legacy +2 -0
+	select BR2_LEGACY
+

Add a comment that fs/ext2/Config.in refers this symbol.

configs/at91sam9x5ek_mmc_dev_defconfig BR2_PACKAGE_VIM=y · line 84

Quoted 13 lines
Config.in.legacy +0 -0
 config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
 	int "ext2 extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
 	default 0
configs/at91sam9x5ek_mmc_dev_defconfig +1 -1
index 0060111fca..1bf2983ee7 100644
@@ -81,7 +81,7 @@ BR2_PACKAGE_VIM=y
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
-BR2_TARGET_ROOTFS_EXT2_BLOCKS=120000
+BR2_TARGET_ROOTFS_EXT2_SIZE="120000K"

While you're at it, make it 120M instead. Not exactly the same but it's larger
so should be OK.

[snip]

Quoted 5 lines
fs/ext2/Config.in +0 -0
index 9c58ac62ed..b2363940f0 100644

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_REV · line 49

Quoted 10 lines
fs/ext2/Config.in +3 -4
@@ -44,12 +44,15 @@ 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
-config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-	int "exact size in blocks"
-	default 61440
+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

Make it instead "if BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP" - simpler.

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_REV · line 50

Quoted 1 line
fs/ext2/Config.in +1 -0
+	default "61440K" # default size

Use "60M" instead.

Quoted 14 lines
fs/ext2/Config.in +4 -1
 	help
-	  Specify the file system size as a number of 1024-byte blocks.
+	  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_INODES
 	int "exact number of inodes (leave at 0 for auto calculation)"
fs/ext2/ext2.mk +0 -0
index bff442ff18..c8da9c4451 100644

fs/ext2/ext2.mk line 8

Quoted 5 lines
fs/ext2/ext2.mk +2 -0
@@ -4,6 +4,11 @@
 #
 ################################################################################
 
+EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
+ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-)
                                ^2

fs/ext2/ext2.mk line 9

Quoted 1 line
fs/ext2/ext2.mk +1 -0
+$(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)

I wonder if it makes sense to check this explicitly. There are thousands of
ways it can be wrong, empty is just one of them. If it is empty, mke2fs will complain that the argument is missing.

fs/ext2/ext2.mk ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs · line 28

Quoted 12 lines
fs/ext2/ext2.mk +3 -2
+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))
@@ -20,8 +25,7 @@ ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
 define ROOTFS_EXT2_CMD
 	rm -f $@
-	PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ \
-		 $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
+	PATH=$(BR_PATH) mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ $(EXT2_SIZE)

Put quotes around EXT2_SIZE - a user may have added spaces there (which will
never work, but better let mke2fs give the appropriate error message).

Regards,
Arnout

Quoted 4 lines
fs/ext2/ext2.mk +0 -0
 endef
 
 rootfs-ext2-symlink:
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
#9 lore raw

PATCH v5 3/5 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

In reply to Samuel Martin
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Samuel" == Samuel Martin <[email protected]> writes:

This change deprecates the ext2/3/4 rootfs size in blocks symbol in favor of one that mimic the fs-size argument behavior of mkfs (i.e. size in a human readable format accepting k, m, g or t suffix or their upper-case variants).

+++ b/fs/ext2/ext2.mk

fs/ext2/ext2.mk line 10

Quoted 7 lines
fs/ext2/ext2.mk +4 -0
@@ -4,6 +4,11 @@
 #
 ################################################################################
 
+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

Hmm, shouldn't that be BR2_TARGET_ROOTFS_EXT2 instead of BR2_TARGET_ROOTFS_EXT?

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

PATCH v5 4/5 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

In reply to Samuel Martin

From: S?bastien Szymanski <[email protected]>

This option lets the user specify mke2fs options and/or ext2/3/4 features.

---
changes v4->v5:
- turn the options to accept any mke2fs options, not only ext2/3/4 features (Arnout)
- add explaination for the default value for this new option (Arnout)

changes v3->v4:
- none

changes v2->v3:
- none

changes v1->v2:
- rebase

---
 fs/ext2/Config.in | 17 +++++++++++++++++
 fs/ext2/ext2.mk   |  5 ++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
fs/ext2/Config.in +17 -0
index b2363940f0..9bbeb797a5 100644
@@ -67,6 +67,23 @@ 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_MKFS_OPTIONS
+	string "additional mke2fs options"
+	default "-O ^64bit"
+	help
+	  Specify a space-separated list of mke2fs options, including any
+	  ext2/3/4 filesystem features.
+
+	  For more information about the mke2fs option, see the manual page
+	  mke2fs(8).
+
+	  For more information about the ext2/3/4 features which can be set,
+	  see then manual page ext4(5).
+
+	  The defaults disables the 64bit ext2/3/4 filesystem support since
+	  its has been enable lately in 2017 in uboot, so most of the uboot
+	  versions do not support it yet.
+
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
fs/ext2/ext2.mk +4 -1
index c8da9c4451..a4c4a7b3d3 100644
@@ -9,6 +9,8 @@ ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-)
 $(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
 endif
 
+EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
+
 # 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))
@@ -19,7 +21,8 @@ EXT2_OPTS = \
 	-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
 	-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
 	-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-	-L "$(EXT2_LABEL)"
+	-L "$(EXT2_LABEL)" \
+	$(EXT2_MKFS_OPTS)
 
 ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
Signature · 1 line
2.13.2
#11 lore raw

PATCH v5 4/5 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

Quoted 34 lines · Samuel Martin

From: S?bastien Szymanski <[email protected]>

This option lets the user specify mke2fs options and/or ext2/3/4 features.

---
changes v4->v5:
- turn the options to accept any mke2fs options, not only ext2/3/4 features (Arnout)
- add explaination for the default value for this new option (Arnout)

changes v3->v4:
- none

changes v2->v3:
- none

changes v1->v2:
- rebase

---
 fs/ext2/Config.in | 17 +++++++++++++++++
 fs/ext2/ext2.mk   |  5 ++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
fs/ext2/Config.in +0 -0
index b2363940f0..9bbeb797a5 100644
@@ -67,6 +67,23 @@ config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	  Traditionally, this has been 5%, and all ext-related tools still

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_RESBLKS · line 77

Quoted 10 lines
fs/ext2/Config.in +8 -0
 	  default to reserving 5% when creating a new ext filesystem.
 
+config BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS
+	string "additional mke2fs options"
+	default "-O ^64bit"
+	help
+	  Specify a space-separated list of mke2fs options, including any
+	  ext2/3/4 filesystem features.
+
+	  For more information about the mke2fs option, see the manual page

Lines should be wrapped at 72 columns, where tab counts for 8, so 62
significant characters.

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_RESBLKS · line 85

Quoted 8 lines
fs/ext2/Config.in +8 -0
+	  mke2fs(8).
+
+	  For more information about the ext2/3/4 features which can be set,
+	  see then manual page ext4(5).
+
+	  The defaults disables the 64bit ext2/3/4 filesystem support since
+	  its has been enable lately in 2017 in uboot, so most of the uboot
+	  versions do not support it yet.

Replace:
The default is "-O ^64bit", i.e. disable the 64-bit filesystem. This is chosen because U-Boot versions before 2017.02 don't support that filesystem option, which may render the system unbootable if it is used.

BTW, on reading the ext4 man page, I doubt this is needed at all:

64bit
Enables the file system to be larger than 2^32 blocks. This
feature is set automatically, as needed, but it can be useful to specify this feature explicitly if the file system might need to be resized larger than 2^32 blocks, even if it was smaller than that threshold when it was originally created. Note that some older kernels and older versions of e2fsprogs will not support file systems with this ext4 feature enabled.

In other words, unless you create a filesystem larger than 4TB, this option wouldn't be set anyway...

But OK, it doesn't hurt to have this default I guess.

S?bastien, could you comment?

Regards,
Arnout

Quoted 28 lines
fs/ext2/Config.in +1 -0
+
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
fs/ext2/ext2.mk +4 -1
index c8da9c4451..a4c4a7b3d3 100644
@@ -9,6 +9,8 @@ ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-)
 $(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
 endif
 
+EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
+
 # 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))
@@ -19,7 +21,8 @@ EXT2_OPTS = \
 	-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
 	-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
 	-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-	-L "$(EXT2_LABEL)"
+	-L "$(EXT2_LABEL)" \
+	$(EXT2_MKFS_OPTS)
 
 ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
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
#12 lore raw

PATCH v5 4/5 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

Hi,

Quoted 76 lines · Arnout Vandecappelle
Quoted 34 lines · Samuel Martin

From: S?bastien Szymanski <[email protected]>

This option lets the user specify mke2fs options and/or ext2/3/4 features.

---
changes v4->v5:
- turn the options to accept any mke2fs options, not only ext2/3/4 features (Arnout)
- add explaination for the default value for this new option (Arnout)

changes v3->v4:
- none

changes v2->v3:
- none

changes v1->v2:
- rebase

---
 fs/ext2/Config.in | 17 +++++++++++++++++
 fs/ext2/ext2.mk   |  5 ++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
fs/ext2/Config.in +0 -0
index b2363940f0..9bbeb797a5 100644
@@ -67,6 +67,23 @@ config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	  Traditionally, this has been 5%, and all ext-related tools still

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_RESBLKS · line 77

Quoted 10 lines
fs/ext2/Config.in +8 -0
 	  default to reserving 5% when creating a new ext filesystem.
 
+config BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS
+	string "additional mke2fs options"
+	default "-O ^64bit"
+	help
+	  Specify a space-separated list of mke2fs options, including any
+	  ext2/3/4 filesystem features.
+
+	  For more information about the mke2fs option, see the manual page

Lines should be wrapped at 72 columns, where tab counts for 8, so 62
significant characters.

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_RESBLKS · line 85

Quoted 8 lines
fs/ext2/Config.in +8 -0
+	  mke2fs(8).
+
+	  For more information about the ext2/3/4 features which can be set,
+	  see then manual page ext4(5).
+
+	  The defaults disables the 64bit ext2/3/4 filesystem support since
+	  its has been enable lately in 2017 in uboot, so most of the uboot
+	  versions do not support it yet.

Replace:
The default is "-O ^64bit", i.e. disable the 64-bit filesystem. This is chosen because U-Boot versions before 2017.02 don't support that filesystem option, which may render the system unbootable if it is used.

BTW, on reading the ext4 man page, I doubt this is needed at all:

64bit
Enables the file system to be larger than 2^32 blocks. This
feature is set automatically, as needed, but it can be useful to specify this feature explicitly if the file system might need to be resized larger than 2^32 blocks, even if it was smaller than that threshold when it was originally created. Note that some older kernels and older versions of e2fsprogs will not support file systems with this ext4 feature enabled.

Quoted 6 lines

In other words, unless you create a filesystem larger than 4TB, this option wouldn't be set anyway...

But OK, it doesn't hurt to have this default I guess.

S?bastien, could you comment?

Since e2fsprogs 1.43 [1], the 64bit feature is enabled by default.

[1] http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.43

"Mke2fs will now create file systems with the metadata_csum and 64bit features enabled by default."

Regards,

Quoted 35 lines

Regards,
Arnout

Quoted 28 lines
fs/ext2/Config.in +1 -0
+
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
fs/ext2/ext2.mk +4 -1
index c8da9c4451..a4c4a7b3d3 100644
@@ -9,6 +9,8 @@ ifeq ($(BR2_TARGET_ROOTFS_EXT)-$(EXT2_SIZE),y-)
 $(error BR2_TARGET_ROOTFS_EXT2_SIZE cannot be empty)
 endif
 
+EXT2_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS))
+
 # 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))
@@ -19,7 +21,8 @@ EXT2_OPTS = \
 	-r $(BR2_TARGET_ROOTFS_EXT2_REV) \
 	-N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
 	-m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-	-L "$(EXT2_LABEL)"
+	-L "$(EXT2_LABEL)" \
+	$(EXT2_MKFS_OPTS)
 
 ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
Signature · 4 lines
S?bastien Szymanski
Software engineer, Armadeus Systems
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
#13 lore raw

PATCH v5 5/5 package/mke2img: remove package

In reply to Samuel Martin

From: 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 v4->v5:
- none

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
index a26869ac64..5081946a99 100644
@@ -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
index 209491aef7..4faa1a8b2e 100644
@@ -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
index 0932b9f1f9..c5a852b858 100644
@@ -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
deleted file mode 100644
index b5bcb8455f..0000000000
@@ -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
deleted file mode 100644
index 9de387a3a3..0000000000
@@ -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
#14 lore raw

PATCH v5 5/5 package/mke2img: remove package

Hello,

Quoted 5 lines · Samuel Martin

From: 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.

Quoted 8 lines

---
changes v4->v5:
- none

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com