Skip to contentSkip to conversation

fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

PATCH Superseded Samuel Martin 4 participants 7 messages Jul 5, 2017

Subsystems (3)

v6 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/2 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

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 v5->v6:
- rebase
- fix typo (Peter)
- add comments in legacy (Arnout)
- quote EXT2_SIZE usage (Arnout)
- use more human-friendly size (defaults + defconfigs) (Arnout)
- trigger legacy when using the deprecated valid (Arnout)

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

---
 Config.in.legacy                            | 15 +++++++++++++++
 configs/at91sam9x5ek_mmc_dev_defconfig      |  2 +-
 configs/beaglebone_qt5_defconfig            |  2 +-
 configs/firefly_rk3288_demo_defconfig       |  2 +-
 configs/minnowboard_max-graphical_defconfig |  3 +--
 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                             |  7 ++++++-
 11 files changed, 37 insertions(+), 15 deletions(-)
Config.in.legacy +15 -0
index 12362da6f..853e2f913 100644
@@ -152,6 +152,21 @@ config BR2_PACKAGE_HOST_MKE2IMG
 	  We now call mkfs directly to generate ext2/3/4 filesystem
 	  image, so mke2img is no longer necessary.
 
+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.
+	  It has been set automatically to the value you had before.
+
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP
+	bool
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 61440 # deprecated default value
+	select BR2_LEGACY
+
+# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP still reference in fs/ext2/Config.in
+
 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 0060111fc..d704b8152 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="120M"
 
 # Bootloaders
 BR2_TARGET_AT91BOOTSTRAP3=y
configs/beaglebone_qt5_defconfig +1 -1
index 34063739a..4135f718e 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="124M"
 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 0f4dd368c..d394ede30 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="250M"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
configs/minnowboard_max-graphical_defconfig +1 -2
index 1a2cd33be..3540f9fa8 100644
@@ -68,6 +68,5 @@ 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="120M"
 # BR2_TARGET_ROOTFS_TAR is not set
-
configs/nanopi_neo_defconfig +1 -1
index a22705269..aa464917b 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="32M"
 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 d64f09a1d..7e852f365 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="120M"
 # 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 ea2abc39b..f558c3e8c 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="120M"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh"
 
configs/raspberrypi3_64_defconfig +1 -1
index 13a505b03..23db9ccb0 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="120M"
 # 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 9c58ac62e..aeee91748 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_WRAP # legacy 2017.08
+	default "60M" # 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 -1
index ff04b78ef..b609d36ae 100644
@@ -4,6 +4,11 @@
 #
 ################################################################################
 
+EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
+ifeq ($(BR2_TARGET_ROOTFS_EXT2)-$(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))
@@ -21,7 +26,7 @@ ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 define ROOTFS_EXT2_CMD
 	rm -f $@
 	$(HOST_DIR)/usr/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ \
-		 $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
+		"$(EXT2_SIZE)"
 endef
 
 rootfs-ext2-symlink:
Signature · 1 line
2.13.0
#1 lore raw

PATCH v6 2/2 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

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

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

---
changes v5->v6:
- wrap help text at 70 chars. (Arnout)
- reword default value explainations (Arnout)

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 | 18 ++++++++++++++++++
 fs/ext2/ext2.mk   |  5 ++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
fs/ext2/Config.in +18 -0
index aeee91748..5aec21078 100644
@@ -67,6 +67,24 @@ 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 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.
+
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
fs/ext2/ext2.mk +4 -1
index b609d36ae..06970f0ee 100644
@@ -9,6 +9,8 @@ ifeq ($(BR2_TARGET_ROOTFS_EXT2)-$(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.0
#5 lore raw

PATCH v6 1/2 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

In reply to Samuel Martin

Hi Samuel,

Quoted 40 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.

---
changes v5->v6:
- rebase
- fix typo (Peter)
- add comments in legacy (Arnout)
- quote EXT2_SIZE usage (Arnout)
- use more human-friendly size (defaults + defconfigs) (Arnout)
- trigger legacy when using the deprecated valid (Arnout)

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

---
 Config.in.legacy                            | 15 +++++++++++++++
 configs/at91sam9x5ek_mmc_dev_defconfig      |  2 +-
 configs/beaglebone_qt5_defconfig            |  2 +-
 configs/firefly_rk3288_demo_defconfig       |  2 +-
 configs/minnowboard_max-graphical_defconfig |  3 +--
 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                             |  7 ++++++-
 11 files changed, 37 insertions(+), 15 deletions(-)
Config.in.legacy +0 -0
index 12362da6f..853e2f913 100644

Config.in.legacy config BR2_PACKAGE_HOST_MKE2IMG · line 157

Quoted 6 lines
Config.in.legacy +3 -0
@@ -152,6 +152,21 @@ config BR2_PACKAGE_HOST_MKE2IMG
 	  We now call mkfs directly to generate ext2/3/4 filesystem
 	  image, so mke2img is no longer necessary.
 
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS
+	int "exact size in blocks has been removed"
+	default 0

Missing BR2_LEGACY.

Config.in.legacy config BR2_PACKAGE_HOST_MKE2IMG · line 168

Quoted 11 lines
Config.in.legacy +11 -0
+	help
+	  This option has been removed in favor of BR2_TARGET_ROOTFS_EXT2_SIZE.
+	  It has been set automatically to the value you had before.
+
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP
+	bool
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 61440 # deprecated default value
+	select BR2_LEGACY
+
+# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP still reference in fs/ext2/Config.in

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH v6 2/2 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

In reply to Samuel Martin

Hi Samuel,

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

Quoted 4 lines · Samuel Martin
fs/ext2/Config.in +4 -0
+	  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.

Maybe also mention that this option is only useful for 2TB+ filesystems.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH v6 2/2 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

Baruch, All,

On 2017-07-05 16:09 +0300, Baruch Siach spake thusly:

Quoted 9 lines

Hi Samuel,

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

Quoted 4 lines · Samuel Martin
fs/ext2/Config.in +4 -0
+	  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.

Maybe also mention that this option is only useful for 2TB+ filesystems.

As S?bastien said, this is no longer true since release 1.43:

    http://lists.busybox.net/pipermail/buildroot/2017-July/197007.html

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v6 2/2 fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS option

Hi Yann,

Quoted 11 lines · Yann E. MORIN

On 2017-07-05 16:09 +0300, Baruch Siach spake thusly:

Quoted 7 lines · Samuel Martin

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

Quoted 4 lines
fs/ext2/Config.in +4 -0
+	  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.

Maybe also mention that this option is only useful for 2TB+ filesystems.

As S?bastien said, this is no longer true since release 1.43:

    http://lists.busybox.net/pipermail/buildroot/2017-July/197007.html

As far as I can see S?bastien only said that 64bit is enabled by default since 1.43. That does not mean that the 64bit feature is useful for smaller (and much more common) filesystems.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#6 lore raw

PATCH v6 1/2 fs/ext2: rename BR2_TARGET_ROOTFS_EXT2_BLOCKS -> BR2_TARGET_ROOTFS_EXT2_SIZE

In reply to Baruch Siach

Hello,

Quoted 5 lines · Baruch Siach

Config.in.legacy config BR2_PACKAGE_HOST_MKE2IMG · line 157

Quoted 3 lines
Config.in.legacy +3 -0
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS
+	int "exact size in blocks has been removed"
+	default 0  

Missing BR2_LEGACY.

No, because it's an int option. It's the ..._WRAP option below that selects BR2_LEGACY.

Quoted 11 lines

Config.in.legacy config BR2_PACKAGE_HOST_MKE2IMG · line 168

Quoted 11 lines
Config.in.legacy +11 -0
+	help
+	  This option has been removed in favor of BR2_TARGET_ROOTFS_EXT2_SIZE.
+	  It has been set automatically to the value you had before.
+
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP
+	bool
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 0
+	default y if BR2_TARGET_ROOTFS_EXT2_BLOCKS != 61440 # deprecated default value
+	select BR2_LEGACY
+
+# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS_WRAP still reference in fs/ext2/Config.in  

See the big comment at the top of Config.in.legacy for details about why we're doing it like that.

Thanks,

Thomas

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