All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement
@ 2017-07-03 22:50 Samuel Martin
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto Samuel Martin
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:50 UTC (permalink / raw)
  To: buildroot

Hi all,

Here is a respin of the short 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.

This series is mostly about merging (pruning less features from Yann
than the previous round ;-]) and updating these 2 series into
a single one.

The 8 first patchs clean up and add few mke2img options.

The 9th patch makes the change using mkfs instead mke2img.

The 10th patch adds support for FS options.

And the last commit removes the no longer used mke2img package.


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 (7):
  package/mke2img: specifying zero inodes means auto
  fs/ext2: always pass the number of inodes
  fs/ext2: always pass the label option
  fs/ext2: allow reserving zero block for root
  fs/ext2: simplify code
  package/mke2img: add option to specify block size
  fs/ext2: add option to specify block size

 Config.in.legacy               |  25 ++++++
 DEVELOPERS                     |   1 -
 fs/ext2/Config.in              |  58 +++++++++---
 fs/ext2/ext2.mk                |  32 +++----
 package/Config.in.host         |   1 -
 package/mke2img/Config.in.host |  11 ---
 package/mke2img/mke2img        | 199 -----------------------------------------
 package/mke2img/mke2img.mk     |  13 ---
 8 files changed, 87 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
@ 2017-07-03 22:50 ` Samuel Martin
  2017-07-04  6:48   ` Thomas Petazzoni
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes Samuel Martin
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:50 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

Currently, leaving the number of inodes to be autocalculated requires
the user to not specify the -i option at all.

Also accept zero as meaning auto; this will help simplify the ext2.mk
code a little bit.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- reintroduce this change from Yann' series
---
 package/mke2img/mke2img | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/mke2img/mke2img b/package/mke2img/mke2img
index 758b6dee68..266df483aa 100755
--- a/package/mke2img/mke2img
+++ b/package/mke2img/mke2img
@@ -59,7 +59,7 @@ main() {
     esac
 
     # calculate needed inodes
-    if [ -z "${nb_inodes}" ]; then
+    if [ ${nb_inodes:-0} -eq 0 ]; then
         nb_inodes=$(find "${root_dir}" | wc -l)
         nb_inodes=$((nb_inodes+400))
     fi
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto Samuel Martin
@ 2017-07-03 22:50 ` Samuel Martin
  2017-07-04  6:48   ` Thomas Petazzoni
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option Samuel Martin
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:50 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

... since zero also means auto for the mke2img script, now.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- reintroduce this change from Yann' series
---
 fs/ext2/ext2.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 9d3e8fd666..3fc12d7499 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -8,9 +8,8 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
 EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
-endif
+
 EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto Samuel Martin
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes Samuel Martin
@ 2017-07-03 22:50 ` Samuel Martin
  2017-07-04  6:48   ` Thomas Petazzoni
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root Samuel Martin
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:50 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

... since passing an empty string is equivalent to not setting a label.

And fix the syntax highlighting in some editors...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- none

changes v1->v2:
- rebase
---
 fs/ext2/ext2.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 3fc12d7499..6a35b33117 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -19,9 +19,9 @@ 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))
-ifneq ($(EXT2_LABEL),)
+#" Syntax highlighting... :-/ )
+
 EXT2_OPTS += -l "$(EXT2_LABEL)"
-endif
 
 ROOTFS_EXT2_DEPENDENCIES = host-mke2img
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (2 preceding siblings ...)
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option Samuel Martin
@ 2017-07-03 22:50 ` Samuel Martin
  2017-07-04  6:49   ` Thomas Petazzoni
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code Samuel Martin
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:50 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

The previous default, zero, just meant "use the default value of the
filesystem generator", which happened to be 5% (the traditional value
for all ext-creating tools we've ever seen).

So, change the new default accordingly to 5%.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- none

changes v1->v2:
- rebase
- fix typos
---
 fs/ext2/Config.in | 7 ++++++-
 fs/ext2/ext2.mk   | 2 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index a1e3647a14..09ec87786f 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -65,7 +65,12 @@ config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
 
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	int "reserved blocks percentage"
-	default 0
+	default 5
+	help
+	  The number of blocks on the filesystem (as a percentage of the
+	  total number of blocksi), that are reserved for use by root.
+	  Traditionally, this has been 5%, and all ext-related tools still
+	  default to reserving 5% when creating a nez ext filesystem.
 
 choice
 	prompt "Compression method"
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 6a35b33117..57058b5fd2 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -12,9 +12,7 @@ EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
 
 EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
 
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
-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.
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (3 preceding siblings ...)
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04  6:51   ` Thomas Petazzoni
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size Samuel Martin
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

No option is conditional anymore, so just collate them into a single
assignment.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- reintroduce this change from Yann' series
---
 fs/ext2/ext2.mk | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 57058b5fd2..16e14777c3 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -4,22 +4,19 @@
 #
 ################################################################################
 
-EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
-
-EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
-
-EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
-
-EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
-
-EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
-
 # 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 += -l "$(EXT2_LABEL)"
+EXT2_OPTS = \
+	-G $(BR2_TARGET_ROOTFS_EXT2_GEN) \
+	-R $(BR2_TARGET_ROOTFS_EXT2_REV) \
+	-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)"
 
 ROOTFS_EXT2_DEPENDENCIES = host-mke2img
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (4 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04  6:51   ` Thomas Petazzoni
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 07/11] fs/ext2: " Samuel Martin
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

ext filesystems can use a block size of 1024, 2048, or 4096 bytes, the
former being interesting to store small files, while the latter being
more intersting to store bigger files.

So far, we were using the defualt, which was to use a 1024-byte block.
Continue doing so (for now...).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v2->v3:
- reintroduce change from Yann' series
---
 fs/ext2/ext2.mk         |  1 +
 package/mke2img/mke2img | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 16e14777c3..0d5fc7f118 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -12,6 +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_BLOCKS) \
 	-i $(BR2_TARGET_ROOTFS_EXT2_INODES) \
 	-I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES) \
diff --git a/package/mke2img/mke2img b/package/mke2img/mke2img
index 266df483aa..399012a2be 100755
--- a/package/mke2img/mke2img
+++ b/package/mke2img/mke2img
@@ -19,9 +19,10 @@ main() {
     rev=1
     nb_extra_inodes=0
 
-    while getopts :hb:i:I:r:d:o:G:R:l:u: OPT; do
+    while getopts :hB:b:i:I:r:d:o:G:R:l:u: OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
+        B)  block_size="${OPTARG}";;
         b)  nb_blocks=${OPTARG};;
         i)  nb_inodes=${OPTARG};;
         I)  nb_extra_inodes=${OPTARG};;
@@ -47,6 +48,11 @@ main() {
     if [ -z "${nb_blocks}" ]; then
         error "you must specify the size of the output image with '-b'\n"
     fi
+    case "${block_size}" in
+    1024|2048|4096) ;; # Sole valid values
+    '') error "you must specify the size of a block with -B\n";;
+    *)  error "invalid block size '%s' (valid: 1024. 2048, 4096)\n" "${block_size}";;
+    esac
     case "${gen}:${rev}" in
     2:0|2:1|3:1|4:1)
         ;;
@@ -91,7 +97,7 @@ main() {
     fi
 
     # Generate the filesystem
-    genext2fs_opts=( -z -b ${nb_blocks} -N ${nb_inodes} -d "${root_dir}" )
+    genext2fs_opts=( -z -B ${block_size} -b ${nb_blocks} -N ${nb_inodes} -d "${root_dir}" )
     if [ -n "${nb_res_blocks}" ]; then
         genext2fs_opts+=( -m ${nb_res_blocks} )
     fi
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 07/11] fs/ext2: add option to specify block size
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (5 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04 10:15   ` Arnout Vandecappelle
  2017-07-04 11:32   ` Arnout Vandecappelle
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option Samuel Martin
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
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(-)

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 09ec87786f..627294e17f 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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 od 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)"
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 0d5fc7f118..ec49caa3a5 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -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) \
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (6 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 07/11] fs/ext2: " Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04 10:35   ` Arnout Vandecappelle
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image Samuel Martin
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
changes v2->v3:
- new patch (Yann)
---
 Config.in.legacy  | 11 +++++++++++
 fs/ext2/Config.in |  8 --------
 fs/ext2/ext2.mk   |  1 -
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Config.in.legacy b/Config.in.legacy
index 453c5eb8b8..5efe0d1ba0 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -145,6 +145,17 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2017.08"
 
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+	int "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_STRIP_none
 	bool "Strip command 'none' has been removed"
 	select BR2_LEGACY
diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 627294e17f..0071ba2bec 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index ec49caa3a5..24643afeb9 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -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)"
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (7 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04  9:37   ` Samuel Martin
  2017-07-04 11:36   ` Arnout Vandecappelle
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option Samuel Martin
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 11/11] package/mke2img: remove package Samuel Martin
  10 siblings, 2 replies; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>

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).

Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
changes v2->v3:
- reword commit log

changes v1->v2:
- rebase
- add default size value
---
 Config.in.legacy  |  8 ++++++++
 fs/ext2/Config.in | 21 +++++++++++----------
 fs/ext2/ext2.mk   | 23 ++++++++++++++---------
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/Config.in.legacy b/Config.in.legacy
index 5efe0d1ba0..68275f9e0e 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -145,6 +145,14 @@ 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.
+
+# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS still reference in fs/ext2/Config.in
+
 config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
 	int "extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
 	default 0
diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 0071ba2bec..9850823e10 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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 od 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
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 24643afeb9..bc366bc689 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -4,24 +4,29 @@
 #
 ################################################################################
 
+EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
+ifeq ($(EXT2_SIZE),)
+$(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:
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (8 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04 11:38   ` Arnout Vandecappelle
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 11/11] package/mke2img: remove package Samuel Martin
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>

This option lets the user specify ext2/3/4 features.

Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
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(-)

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 9850823e10..123a4ad6a6 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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 nez 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
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index bc366bc689..ddf30ecd10 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -9,6 +9,8 @@ ifeq ($(EXT2_SIZE),)
 $(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
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 11/11] package/mke2img: remove package
  2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
                   ` (9 preceding siblings ...)
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option Samuel Martin
@ 2017-07-03 22:51 ` Samuel Martin
  2017-07-04 11:40   ` Arnout Vandecappelle
  10 siblings, 1 reply; 25+ messages in thread
From: Samuel Martin @ 2017-07-03 22:51 UTC (permalink / raw)
  To: buildroot

From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>

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.

Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
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

diff --git a/Config.in.legacy b/Config.in.legacy
index 68275f9e0e..130ad1b12e 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -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
diff --git a/DEVELOPERS b/DEVELOPERS
index d121bd8163..62172abcd0 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1779,7 +1779,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/
diff --git a/package/Config.in.host b/package/Config.in.host
index 0932b9f1f9..c5a852b858 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/mke2img/Config.in.host b/package/mke2img/Config.in.host
deleted file mode 100644
index b5bcb8455f..0000000000
--- a/package/mke2img/Config.in.host
+++ /dev/null
@@ -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/
diff --git a/package/mke2img/mke2img b/package/mke2img/mke2img
deleted file mode 100755
index 399012a2be..0000000000
--- a/package/mke2img/mke2img
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/usr/bin/env bash
-
-# Buildroot wrapper to the collection of ext2/3/4 filesystem tools:
-# - genext2fs, to generate ext2 filesystem images
-# - tune2fs, to modify an ext2/3/4 filesystem (possibly in an image file)
-# - e2fsck, to check and fix an ext2/3/4 filesystem (possibly in an image file)
-
-set -e
-
-main() {
-    local OPT OPTARG
-    local nb_blocks nb_inodes nb_res_blocks root_dir image gen rev label uuid
-    local -a genext2fs_opts
-    local -a tune2fs_opts
-    local tune2fs_O_opts
-
-    # Default values
-    gen=2
-    rev=1
-    nb_extra_inodes=0
-
-    while getopts :hB:b:i:I:r:d:o:G:R:l:u: OPT; do
-        case "${OPT}" in
-        h)  help; exit 0;;
-        B)  block_size="${OPTARG}";;
-        b)  nb_blocks=${OPTARG};;
-        i)  nb_inodes=${OPTARG};;
-        I)  nb_extra_inodes=${OPTARG};;
-        r)  nb_res_blocks=${OPTARG};;
-        d)  root_dir="${OPTARG}";;
-        o)  image="${OPTARG}";;
-        G)  gen=${OPTARG};;
-        R)  rev=${OPTARG};;
-        l)  label="${OPTARG}";;
-        u)  uuid="${OPTARG}";;
-        :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
-        \?) error "unknown option '%s'\n" "${OPTARG}";;
-        esac
-    done
-
-    # Sanity checks
-    if [ -z "${root_dir}" ]; then
-        error "you must specify a root directory with '-d'\n"
-    fi
-    if [ -z "${image}" ]; then
-        error "you must specify an output image file with '-o'\n"
-    fi
-    if [ -z "${nb_blocks}" ]; then
-        error "you must specify the size of the output image with '-b'\n"
-    fi
-    case "${block_size}" in
-    1024|2048|4096) ;; # Sole valid values
-    '') error "you must specify the size of a block with -B\n";;
-    *)  error "invalid block size '%s' (valid: 1024. 2048, 4096)\n" "${block_size}";;
-    esac
-    case "${gen}:${rev}" in
-    2:0|2:1|3:1|4:1)
-        ;;
-    3:0|4:0)
-        error "revision 0 is invalid for ext3 and ext4\n"
-        ;;
-    *)  error "unknown ext generation '%s' and/or revision '%s'\n" \
-               "${gen}" "${rev}"
-        ;;
-    esac
-
-    # calculate needed inodes
-    if [ ${nb_inodes:-0} -eq 0 ]; then
-        nb_inodes=$(find "${root_dir}" | wc -l)
-        nb_inodes=$((nb_inodes+400))
-    fi
-    nb_inodes=$((nb_inodes+nb_extra_inodes))
-
-    # Upgrade to rev1 if needed
-    if [ ${rev} -ge 1 ]; then
-        tune2fs_O_opts+=",filetype,sparse_super"
-    fi
-
-    # Add a journal for ext3 and above
-    if [ ${gen} -ge 3 ]; then
-        tune2fs_opts+=( -j -J size=1 )
-    fi
-
-    # Add ext4 specific features
-    if [ ${gen} -ge 4 ]; then
-        tune2fs_O_opts+=",extents,uninit_bg,dir_index"
-    fi
-
-    # Add our -O options (there will be at most one leading comma, remove it)
-    if [ -n "${tune2fs_O_opts}" ]; then
-        tune2fs_opts+=( -O "${tune2fs_O_opts#,}" )
-    fi
-
-    # Add the label if specified
-    if [ -n "${label}" ]; then
-        tune2fs_opts+=( -L "${label}" )
-    fi
-
-    # Generate the filesystem
-    genext2fs_opts=( -z -B ${block_size} -b ${nb_blocks} -N ${nb_inodes} -d "${root_dir}" )
-    if [ -n "${nb_res_blocks}" ]; then
-        genext2fs_opts+=( -m ${nb_res_blocks} )
-    fi
-    genext2fs "${genext2fs_opts[@]}" "${image}"
-
-    # genext2fs does not generate a UUID, but fsck will whine if one
-    # is missing, so we need to add a UUID.
-    # Of course, this has to happen _before_ we run fsck.
-    # Also, some ext4 metadata are based on the UUID, so we must
-    # set it before we can convert the filesystem to ext4.
-    # If the user did not specify a UUID, we generate a random one.
-    # Although a random UUID may seem bad for reproducibility, there
-    # already are so many things that are not reproducible in a
-    # filesystem: file dates, file ordering, content of the files...
-    tune2fs -U "${uuid:-random}" "${image}"
-
-    # Upgrade the filesystem
-    if [ ${#tune2fs_opts[@]} -ne 0 ]; then
-        tune2fs "${tune2fs_opts[@]}" "${image}"
-    fi
-
-    # After changing filesystem options, running fsck is required
-    # (see: man tune2fs). Running e2fsck in other cases will ensure
-    # coherency of the filesystem, although it is not required.
-    # 'e2fsck -pDf' means:
-    #  - automatically repair
-    #  - optimise and check for duplicate entries
-    #  - force checking
-    # Sending output to oblivion, as e2fsck can be *very* verbose,
-    # especially with filesystems generated by genext2fs.
-    # Exit codes 1 & 2 are OK, it means fs errors were successfully
-    # corrected, hence our little trick with $ret.
-    ret=0
-    e2fsck -pDf "${image}" >/dev/null || ret=$?
-    case ${ret} in
-       0|1|2) ;;
-       *)   errorN ${ret} "failed to run e2fsck on '%s' (ext%d)\n" \
-                   "${image}" ${gen}
-    esac
-    printf "\n"
-    trace "e2fsck was successfully run on '%s' (ext%d)\n" "${image}" ${gen}
-    printf "\n"
-
-    # Remove count- and time-based checks, they are not welcome
-    # on embedded devices, where they can cause serious boot-time
-    # issues by tremendously slowing down the boot.
-    tune2fs -c 0 -i 0 "${image}"
-}
-
-help() {
-    cat <<_EOF_
-NAME
-    ${my_name} - Create an ext2/3/4 filesystem image
-
-SYNOPSIS
-    ${my_name} [OPTION]...
-
-DESCRIPTION
-    Create ext2/3/4 filesystem image from the content of a directory.
-
-    -b BLOCKS
-        Create a filesystem of BLOCKS 1024-byte blocs. The default is to
-        compute the required number of blocks.
-
-    -i INODES
-        Create a filesystem with INODES inodes. The default is to compute
-        the required number of inodes.
-
-    -r RES_BLOCKS
-        Create a filesystem with RES_BLOCKS reserved blocks. The default
-        is to reserve 0 block.
-
-    -d ROOT_DIR
-        Create a filesystem, using the content of ROOT_DIR as the content
-        of the root of the filesystem. Mandatory.
-
-    -o FILE
-        Create the filesystem in FILE. Madatory.
-
-    -G GEN -R REV
-        Create a filesystem of generation GEN (2, 3 or 4), and revision
-        REV (0 or 1). The default is to generate an ext2 revision 1
-        filesystem; revision 0 is invalid for ext3 and ext4.
-
-    -l LABEL
-        Create a filesystem with label LABEL. The default is to not set
-        a label.
-
-    -u UUID
-        Create filesystem with uuid UUID. The default is to set a random
-        UUID.
-
-  Exit status:
-    0   if OK
-    !0  in case of error
-_EOF_
-}
-
-trace()  { local msg="${1}"; shift; printf "%s: ${msg}" "${my_name}" "${@}"; }
-warn()   { trace "${@}" >&2; }
-errorN() { local ret="${1}"; shift; warn "${@}"; exit ${ret}; }
-error()  { errorN 1 "${@}"; }
-
-my_name="${0##*/}"
-main "$@"
diff --git a/package/mke2img/mke2img.mk b/package/mke2img/mke2img.mk
deleted file mode 100644
index 9de387a3a3..0000000000
--- a/package/mke2img/mke2img.mk
+++ /dev/null
@@ -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))
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto Samuel Martin
@ 2017-07-04  6:48   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:50:56 +0200, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Currently, leaving the number of inodes to be autocalculated requires
> the user to not specify the -i option at all.
> 
> Also accept zero as meaning auto; this will help simplify the ext2.mk
> code a little bit.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v2->v3:
> - reintroduce this change from Yann' series
> ---
>  package/mke2img/mke2img | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes Samuel Martin
@ 2017-07-04  6:48   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:50:57 +0200, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ... since zero also means auto for the mke2img script, now.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v2->v3:
> - reintroduce this change from Yann' series
> ---
>  fs/ext2/ext2.mk | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to master, thanks.

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option Samuel Martin
@ 2017-07-04  6:48   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:50:58 +0200, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ... since passing an empty string is equivalent to not setting a label.
> 
> And fix the syntax highlighting in some editors...
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v2->v3:
> - none

Applied to master, thanks.

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root
  2017-07-03 22:50 ` [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root Samuel Martin
@ 2017-07-04  6:49   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:49 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:50:59 +0200, Samuel Martin wrote:

>  config BR2_TARGET_ROOTFS_EXT2_RESBLKS
>  	int "reserved blocks percentage"
> -	default 0
> +	default 5
> +	help
> +	  The number of blocks on the filesystem (as a percentage of the
> +	  total number of blocksi), that are reserved for use by root.
> +	  Traditionally, this has been 5%, and all ext-related tools still
> +	  default to reserving 5% when creating a nez ext filesystem.

Typo: nez -> new.

Fixed when applying to master. Thanks!

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code Samuel Martin
@ 2017-07-04  6:51   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:51:00 +0200, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> No option is conditional anymore, so just collate them into a single
> assignment.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v2->v3:
> - reintroduce this change from Yann' series
> ---
>  fs/ext2/ext2.mk | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)

Applied to master, thanks.

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size Samuel Martin
@ 2017-07-04  6:51   ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-07-04  6:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  4 Jul 2017 00:51:01 +0200, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ext filesystems can use a block size of 1024, 2048, or 4096 bytes, the
> former being interesting to store small files, while the latter being
> more intersting to store bigger files.
> 
> So far, we were using the defualt, which was to use a 1024-byte block.

defualt -> default

Applied with this fixed. Thanks!

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image Samuel Martin
@ 2017-07-04  9:37   ` Samuel Martin
  2017-07-04 11:36   ` Arnout Vandecappelle
  1 sibling, 0 replies; 25+ messages in thread
From: Samuel Martin @ 2017-07-04  9:37 UTC (permalink / raw)
  To: buildroot

All,

On Tue, Jul 4, 2017 at 12:51 AM, Samuel Martin <s.martin49@gmail.com> wrote:
> From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
>
> 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).
>
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
> ---
> changes v2->v3:
> - reword commit log
>
> changes v1->v2:
> - rebase
> - add default size value
> ---
>  Config.in.legacy  |  8 ++++++++
>  fs/ext2/Config.in | 21 +++++++++++----------
>  fs/ext2/ext2.mk   | 23 ++++++++++++++---------
>  3 files changed, 33 insertions(+), 19 deletions(-)
>
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 5efe0d1ba0..68275f9e0e 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -145,6 +145,14 @@ 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.
> +
> +# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS still reference in fs/ext2/Config.in
> +
>  config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
>         int "extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
>         default 0
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 0071ba2bec..9850823e10 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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 od 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
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index 24643afeb9..bc366bc689 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -4,24 +4,29 @@
>  #
>  ################################################################################
>
> +EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
> +ifeq ($(EXT2_SIZE),)

Here, a check on BR2_TARGET_ROOTFS_EXT is missing to prevent the size
check from failing when ext* rootfs is disabled.

> +$(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:
> --
> 2.13.2
>



-- 
Samuel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 07/11] fs/ext2: add option to specify block size
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 07/11] fs/ext2: " Samuel Martin
@ 2017-07-04 10:15   ` Arnout Vandecappelle
  2017-07-04 11:32   ` Arnout Vandecappelle
  1 sibling, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 10:15 UTC (permalink / raw)
  To: buildroot



On 04-07-17 00:51, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> 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(-)
> 
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 09ec87786f..627294e17f 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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 od 1024 bytes = 60MB, i.e usually small enough to fit
                 ^^of

 With that:

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> +# 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)"
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index 0d5fc7f118..ec49caa3a5 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -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) \
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option Samuel Martin
@ 2017-07-04 10:35   ` Arnout Vandecappelle
  0 siblings, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 10:35 UTC (permalink / raw)
  To: buildroot


On 04-07-17 00:51, Samuel Martin wrote:
> 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.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ---
> changes v2->v3:
> - new patch (Yann)
> ---
>  Config.in.legacy  | 11 +++++++++++
>  fs/ext2/Config.in |  8 --------
>  fs/ext2/ext2.mk   |  1 -
>  3 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 453c5eb8b8..5efe0d1ba0 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -145,6 +145,17 @@ endif
>  ###############################################################################
>  comment "Legacy options removed in 2017.08"
>  
> +config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
> +	int "extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0

 I was going to say that there should be no condition any more. Indeed, we want
this thing to show up whenever it appears in the old .config file. However, it's
in fact convenient for the user that this thing disappears as soon as he sets
BR2_TARGET_ROOTFS_EXT2_INODES to something, like he should. So OK.

 However, the prompt should clarify that this is about ext2. So:

	int "ext2 extra inodes has been removed"

> +	default 0

 You don't select BR2_LEGACY hear. You need to introduce an extra symbol, like
for BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS{,_WRAP}.


 Otherwise looks good to me :-)


 Regards,
 Arnout

> +	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_STRIP_none
>  	bool "Strip command 'none' has been removed"
>  	select BR2_LEGACY
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 627294e17f..0071ba2bec 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index ec49caa3a5..24643afeb9 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -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)"
>  
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 07/11] fs/ext2: add option to specify block size
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 07/11] fs/ext2: " Samuel Martin
  2017-07-04 10:15   ` Arnout Vandecappelle
@ 2017-07-04 11:32   ` Arnout Vandecappelle
  1 sibling, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 11:32 UTC (permalink / raw)
  To: buildroot

 Revisiting this...

On 04-07-17 00:51, Samuel Martin wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> 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(-)
> 
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 09ec87786f..627294e17f 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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.

 I don't think this option makes a whole lot of sense. Yes, you may want to tune
your generated ext2fs to death. But if it's for tuning purposes, it's better to
add an "additional mke2fs options" string.

 So in fact I'd drop this patch.


 Regards,
 Arnout

> +
> +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 od 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)"
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index 0d5fc7f118..ec49caa3a5 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -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) \
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image Samuel Martin
  2017-07-04  9:37   ` Samuel Martin
@ 2017-07-04 11:36   ` Arnout Vandecappelle
  1 sibling, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 11:36 UTC (permalink / raw)
  To: buildroot

 Can this patch be split up into

1/ use mkfs to generate rootfs image

2/ replace BR2_TARGET_ROOTFS_EXT2_BLOCKS with BR2_TARGET_ROOTFS_EXT2_SIZE

?

 The latter patch will also have to be combined with fixing up the 8 defconfigs
that use this option.

On 04-07-17 00:51, Samuel Martin wrote:
> From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> 
> 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).
> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ---
> changes v2->v3:
> - reword commit log
> 
> changes v1->v2:
> - rebase
> - add default size value
> ---
>  Config.in.legacy  |  8 ++++++++
>  fs/ext2/Config.in | 21 +++++++++++----------
>  fs/ext2/ext2.mk   | 23 ++++++++++++++---------
>  3 files changed, 33 insertions(+), 19 deletions(-)
> 
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 5efe0d1ba0..68275f9e0e 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -145,6 +145,14 @@ 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.

 Again BR2_LEGACY is not selected.

> +
> +# Note: BR2_TARGET_ROOTFS_EXT2_BLOCKS still reference in fs/ext2/Config.in
> +
>  config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
>  	int "extra inodes has been removed" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
>  	default 0
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 0071ba2bec..9850823e10 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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 od 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

 Admittedly this keeps things alphabetical, but I still think it makes more
sense to have size first and inodes afterwards.

> +	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',

 So actually, it is NOT the same as the legacy BR2_TARGET_ROOTFS_EXT2_BLOCKS
because that one was not kilobytes but blocks, and there was the option to use
2K or 4K blocks... Oh, but of course, for legacy purposes, it actually *was* 1K
blocks. So OK.


 Regards,
 Arnout


> +	  '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
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index 24643afeb9..bc366bc689 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -4,24 +4,29 @@
>  #
>  ################################################################################
>  
> +EXT2_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_EXT2_SIZE))
> +ifeq ($(EXT2_SIZE),)
> +$(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:
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option Samuel Martin
@ 2017-07-04 11:38   ` Arnout Vandecappelle
  0 siblings, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 11:38 UTC (permalink / raw)
  To: buildroot



On 04-07-17 00:51, Samuel Martin wrote:
> From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> 
> This option lets the user specify ext2/3/4 features.

 Again, instead of a features option, I'd give a string option for additional
arguments.


> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ---
> 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(-)
> 
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index 9850823e10..123a4ad6a6 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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 nez ext filesystem.
>  
> +config BR2_TARGET_ROOTFS_EXT2_FEATURES
> +	string "Filesystem features"
> +	default "^64bit"

 The commit message should mention why it is a good idea to default to this.

 Regards,
 Arnout

> +	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
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index bc366bc689..ddf30ecd10 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -9,6 +9,8 @@ ifeq ($(EXT2_SIZE),)
>  $(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
>  
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Buildroot] [PATCH v3 11/11] package/mke2img: remove package
  2017-07-03 22:51 ` [Buildroot] [PATCH v3 11/11] package/mke2img: remove package Samuel Martin
@ 2017-07-04 11:40   ` Arnout Vandecappelle
  0 siblings, 0 replies; 25+ messages in thread
From: Arnout Vandecappelle @ 2017-07-04 11:40 UTC (permalink / raw)
  To: buildroot



On 04-07-17 00:51, Samuel Martin wrote:
> From: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> 
> 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.
> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> 
> ---
> 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
> 
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 68275f9e0e..130ad1b12e 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -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
> diff --git a/DEVELOPERS b/DEVELOPERS
> index d121bd8163..62172abcd0 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1779,7 +1779,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/
> diff --git a/package/Config.in.host b/package/Config.in.host
> index 0932b9f1f9..c5a852b858 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -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"
> diff --git a/package/mke2img/Config.in.host b/package/mke2img/Config.in.host
> deleted file mode 100644
> index b5bcb8455f..0000000000
> --- a/package/mke2img/Config.in.host
> +++ /dev/null
> @@ -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/
> diff --git a/package/mke2img/mke2img b/package/mke2img/mke2img
> deleted file mode 100755
> index 399012a2be..0000000000
> --- a/package/mke2img/mke2img
> +++ /dev/null
> @@ -1,205 +0,0 @@
> -#!/usr/bin/env bash
> -
> -# Buildroot wrapper to the collection of ext2/3/4 filesystem tools:
> -# - genext2fs, to generate ext2 filesystem images
> -# - tune2fs, to modify an ext2/3/4 filesystem (possibly in an image file)
> -# - e2fsck, to check and fix an ext2/3/4 filesystem (possibly in an image file)
> -
> -set -e
> -
> -main() {
> -    local OPT OPTARG
> -    local nb_blocks nb_inodes nb_res_blocks root_dir image gen rev label uuid
> -    local -a genext2fs_opts
> -    local -a tune2fs_opts
> -    local tune2fs_O_opts
> -
> -    # Default values
> -    gen=2
> -    rev=1
> -    nb_extra_inodes=0
> -
> -    while getopts :hB:b:i:I:r:d:o:G:R:l:u: OPT; do
> -        case "${OPT}" in
> -        h)  help; exit 0;;
> -        B)  block_size="${OPTARG}";;
> -        b)  nb_blocks=${OPTARG};;
> -        i)  nb_inodes=${OPTARG};;
> -        I)  nb_extra_inodes=${OPTARG};;
> -        r)  nb_res_blocks=${OPTARG};;
> -        d)  root_dir="${OPTARG}";;
> -        o)  image="${OPTARG}";;
> -        G)  gen=${OPTARG};;
> -        R)  rev=${OPTARG};;
> -        l)  label="${OPTARG}";;
> -        u)  uuid="${OPTARG}";;
> -        :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
> -        \?) error "unknown option '%s'\n" "${OPTARG}";;
> -        esac
> -    done
> -
> -    # Sanity checks
> -    if [ -z "${root_dir}" ]; then
> -        error "you must specify a root directory with '-d'\n"
> -    fi
> -    if [ -z "${image}" ]; then
> -        error "you must specify an output image file with '-o'\n"
> -    fi
> -    if [ -z "${nb_blocks}" ]; then
> -        error "you must specify the size of the output image with '-b'\n"
> -    fi
> -    case "${block_size}" in
> -    1024|2048|4096) ;; # Sole valid values
> -    '') error "you must specify the size of a block with -B\n";;
> -    *)  error "invalid block size '%s' (valid: 1024. 2048, 4096)\n" "${block_size}";;
> -    esac
> -    case "${gen}:${rev}" in
> -    2:0|2:1|3:1|4:1)
> -        ;;
> -    3:0|4:0)
> -        error "revision 0 is invalid for ext3 and ext4\n"
> -        ;;
> -    *)  error "unknown ext generation '%s' and/or revision '%s'\n" \
> -               "${gen}" "${rev}"
> -        ;;
> -    esac
> -
> -    # calculate needed inodes
> -    if [ ${nb_inodes:-0} -eq 0 ]; then
> -        nb_inodes=$(find "${root_dir}" | wc -l)
> -        nb_inodes=$((nb_inodes+400))
> -    fi
> -    nb_inodes=$((nb_inodes+nb_extra_inodes))
> -
> -    # Upgrade to rev1 if needed
> -    if [ ${rev} -ge 1 ]; then
> -        tune2fs_O_opts+=",filetype,sparse_super"
> -    fi
> -
> -    # Add a journal for ext3 and above
> -    if [ ${gen} -ge 3 ]; then
> -        tune2fs_opts+=( -j -J size=1 )
> -    fi
> -
> -    # Add ext4 specific features
> -    if [ ${gen} -ge 4 ]; then
> -        tune2fs_O_opts+=",extents,uninit_bg,dir_index"
> -    fi
> -
> -    # Add our -O options (there will be at most one leading comma, remove it)
> -    if [ -n "${tune2fs_O_opts}" ]; then
> -        tune2fs_opts+=( -O "${tune2fs_O_opts#,}" )
> -    fi
> -
> -    # Add the label if specified
> -    if [ -n "${label}" ]; then
> -        tune2fs_opts+=( -L "${label}" )
> -    fi
> -
> -    # Generate the filesystem
> -    genext2fs_opts=( -z -B ${block_size} -b ${nb_blocks} -N ${nb_inodes} -d "${root_dir}" )
> -    if [ -n "${nb_res_blocks}" ]; then
> -        genext2fs_opts+=( -m ${nb_res_blocks} )
> -    fi
> -    genext2fs "${genext2fs_opts[@]}" "${image}"
> -
> -    # genext2fs does not generate a UUID, but fsck will whine if one
> -    # is missing, so we need to add a UUID.
> -    # Of course, this has to happen _before_ we run fsck.
> -    # Also, some ext4 metadata are based on the UUID, so we must
> -    # set it before we can convert the filesystem to ext4.
> -    # If the user did not specify a UUID, we generate a random one.
> -    # Although a random UUID may seem bad for reproducibility, there
> -    # already are so many things that are not reproducible in a
> -    # filesystem: file dates, file ordering, content of the files...
> -    tune2fs -U "${uuid:-random}" "${image}"
> -
> -    # Upgrade the filesystem
> -    if [ ${#tune2fs_opts[@]} -ne 0 ]; then
> -        tune2fs "${tune2fs_opts[@]}" "${image}"
> -    fi
> -
> -    # After changing filesystem options, running fsck is required
> -    # (see: man tune2fs). Running e2fsck in other cases will ensure
> -    # coherency of the filesystem, although it is not required.
> -    # 'e2fsck -pDf' means:
> -    #  - automatically repair
> -    #  - optimise and check for duplicate entries
> -    #  - force checking
> -    # Sending output to oblivion, as e2fsck can be *very* verbose,
> -    # especially with filesystems generated by genext2fs.
> -    # Exit codes 1 & 2 are OK, it means fs errors were successfully
> -    # corrected, hence our little trick with $ret.
> -    ret=0
> -    e2fsck -pDf "${image}" >/dev/null || ret=$?
> -    case ${ret} in
> -       0|1|2) ;;
> -       *)   errorN ${ret} "failed to run e2fsck on '%s' (ext%d)\n" \
> -                   "${image}" ${gen}
> -    esac
> -    printf "\n"
> -    trace "e2fsck was successfully run on '%s' (ext%d)\n" "${image}" ${gen}
> -    printf "\n"
> -
> -    # Remove count- and time-based checks, they are not welcome
> -    # on embedded devices, where they can cause serious boot-time
> -    # issues by tremendously slowing down the boot.
> -    tune2fs -c 0 -i 0 "${image}"
> -}
> -
> -help() {
> -    cat <<_EOF_
> -NAME
> -    ${my_name} - Create an ext2/3/4 filesystem image
> -
> -SYNOPSIS
> -    ${my_name} [OPTION]...
> -
> -DESCRIPTION
> -    Create ext2/3/4 filesystem image from the content of a directory.
> -
> -    -b BLOCKS
> -        Create a filesystem of BLOCKS 1024-byte blocs. The default is to
> -        compute the required number of blocks.
> -
> -    -i INODES
> -        Create a filesystem with INODES inodes. The default is to compute
> -        the required number of inodes.
> -
> -    -r RES_BLOCKS
> -        Create a filesystem with RES_BLOCKS reserved blocks. The default
> -        is to reserve 0 block.
> -
> -    -d ROOT_DIR
> -        Create a filesystem, using the content of ROOT_DIR as the content
> -        of the root of the filesystem. Mandatory.
> -
> -    -o FILE
> -        Create the filesystem in FILE. Madatory.
> -
> -    -G GEN -R REV
> -        Create a filesystem of generation GEN (2, 3 or 4), and revision
> -        REV (0 or 1). The default is to generate an ext2 revision 1
> -        filesystem; revision 0 is invalid for ext3 and ext4.
> -
> -    -l LABEL
> -        Create a filesystem with label LABEL. The default is to not set
> -        a label.
> -
> -    -u UUID
> -        Create filesystem with uuid UUID. The default is to set a random
> -        UUID.
> -
> -  Exit status:
> -    0   if OK
> -    !0  in case of error
> -_EOF_
> -}
> -
> -trace()  { local msg="${1}"; shift; printf "%s: ${msg}" "${my_name}" "${@}"; }
> -warn()   { trace "${@}" >&2; }
> -errorN() { local ret="${1}"; shift; warn "${@}"; exit ${ret}; }
> -error()  { errorN 1 "${@}"; }
> -
> -my_name="${0##*/}"
> -main "$@"
> diff --git a/package/mke2img/mke2img.mk b/package/mke2img/mke2img.mk
> deleted file mode 100644
> index 9de387a3a3..0000000000
> --- a/package/mke2img/mke2img.mk
> +++ /dev/null
> @@ -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))
> 

-- 
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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2017-07-04 11:40 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-03 22:50 [Buildroot] [PATCH v3 00/11] fs/ext2: cleanup and improvement Samuel Martin
2017-07-03 22:50 ` [Buildroot] [PATCH v3 01/11] package/mke2img: specifying zero inodes means auto Samuel Martin
2017-07-04  6:48   ` Thomas Petazzoni
2017-07-03 22:50 ` [Buildroot] [PATCH v3 02/11] fs/ext2: always pass the number of inodes Samuel Martin
2017-07-04  6:48   ` Thomas Petazzoni
2017-07-03 22:50 ` [Buildroot] [PATCH v3 03/11] fs/ext2: always pass the label option Samuel Martin
2017-07-04  6:48   ` Thomas Petazzoni
2017-07-03 22:50 ` [Buildroot] [PATCH v3 04/11] fs/ext2: allow reserving zero block for root Samuel Martin
2017-07-04  6:49   ` Thomas Petazzoni
2017-07-03 22:51 ` [Buildroot] [PATCH v3 05/11] fs/ext2: simplify code Samuel Martin
2017-07-04  6:51   ` Thomas Petazzoni
2017-07-03 22:51 ` [Buildroot] [PATCH v3 06/11] package/mke2img: add option to specify block size Samuel Martin
2017-07-04  6:51   ` Thomas Petazzoni
2017-07-03 22:51 ` [Buildroot] [PATCH v3 07/11] fs/ext2: " Samuel Martin
2017-07-04 10:15   ` Arnout Vandecappelle
2017-07-04 11:32   ` Arnout Vandecappelle
2017-07-03 22:51 ` [Buildroot] [PATCH v3 08/11] fs/ext2: deprecate BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES option Samuel Martin
2017-07-04 10:35   ` Arnout Vandecappelle
2017-07-03 22:51 ` [Buildroot] [PATCH v3 09/11] fs/ext2: use mkfs to generate rootfs image Samuel Martin
2017-07-04  9:37   ` Samuel Martin
2017-07-04 11:36   ` Arnout Vandecappelle
2017-07-03 22:51 ` [Buildroot] [PATCH v3 10/11] fs/ext2: Add BR2_TARGET_ROOTFS_EXT2_FEATURES option Samuel Martin
2017-07-04 11:38   ` Arnout Vandecappelle
2017-07-03 22:51 ` [Buildroot] [PATCH v3 11/11] package/mke2img: remove package Samuel Martin
2017-07-04 11:40   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.