Skip to contentSkip to conversation

Pull request for branch yem-ext234

GIT PULL New Yann E. MORIN 3 participants 21 messages Feb 17, 2013 – Feb 21, 2013

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

Hello All!

This patch series enhances the ext2 fs backend to also build ext3 and ext4 filesystems, and differentiate between ext2 rev0 and ext2 rev1 filesystems.

Differentiating between ext2 rev0 and rev1 is needed for some bootloaders that do not understand ext2 rev0, which is what genext2fs generates.

It should be applied after the host-image-tools series recently posted:

    http://lists.busybox.net/pipermail/buildroot/2013-February/067478.html
    http://patchwork.ozlabs.org/patch/221106/

The following changes since commit e6ac892795f7d87405c23cdb7a429508b1149b62:

package/mtools: new host-package (2013-02-17 23:50:08 +0100)

are available in the git repository at:
git://gitorious.org/buildroot/buildroot.git yem-ext234

Yann E. MORIN (4):
fs/ext2: enclose the ext2 options in if...endif fs/ext2: add ability to build ext3/4 too
fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems fs/ext: add support for ext2 rev0 and rev1

 board/arm/foundation-v8/readme.txt          |    2 +-
 board/boundarydevices/nitrogen6x/readme.txt |    8 +-
 board/qemu/arm-versatile/readme.txt         |    2 +-
 board/qemu/arm-vexpress/readme.txt          |    2 +-
 board/qemu/mips-malta/readme.txt            |    2 +-
 board/qemu/mips64-malta/readme.txt          |    2 +-
 board/qemu/mipsel-malta/readme.txt          |    2 +-
 board/qemu/powerpc-g3beige/readme.txt       |    2 +-
 board/qemu/sh4-r2d/readme.txt               |    2 +-
 board/qemu/sparc-ss10/readme.txt            |    2 +-
 board/qemu/x86/readme.txt                   |    2 +-
 board/qemu/x86_64/readme.txt                |    2 +-
 configs/arm_foundationv8_defconfig          |    2 +-
 configs/beaglebone_defconfig                |    2 +-
 configs/mx53loco_defconfig                  |    2 +-
 configs/nitrogen6x_defconfig                |    2 +-
 configs/pandaboard_defconfig                |    2 +-
 configs/qemu_arm_versatile_defconfig        |    2 +-
 configs/qemu_arm_vexpress_defconfig         |    2 +-
 configs/qemu_mips64_malta_defconfig         |    2 +-
 configs/qemu_mips_malta_defconfig           |    2 +-
 configs/qemu_mipsel_malta_defconfig         |    2 +-
 configs/qemu_ppc_g3beige_defconfig          |    2 +-
 configs/qemu_sh4_r2d_defconfig              |    2 +-
 configs/qemu_sparc_ss10_defconfig           |    2 +-
 configs/qemu_x86_64_defconfig               |    2 +-
 configs/qemu_x86_defconfig                  |    2 +-
 fs/Config.in                                |    2 +-
 fs/ext/Config.in                            |   76 +++++++++++++++++++++
 fs/ext/ext.mk                               |   27 ++++++++
 fs/ext/genextfs.sh                          |   96 +++++++++++++++++++++++++++
 fs/ext2/Config.in                           |   49 --------------
 fs/ext2/ext2.mk                             |   27 --------
 fs/ext2/genext2fs.sh                        |   36 ----------
 34 files changed, 230 insertions(+), 143 deletions(-)
 create mode 100644 fs/ext/Config.in
 create mode 100644 fs/ext/ext.mk
 create mode 100755 fs/ext/genextfs.sh
 delete mode 100644 fs/ext2/Config.in
 delete mode 100644 fs/ext2/ext2.mk
 delete mode 100755 fs/ext2/genext2fs.sh

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.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/4 fs/ext2: enclose the ext2 options in if...endif

Use a 'if...endif' construct instead of repeating the 'depends on' for each symbols.

---
 fs/ext2/Config.in |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/ext2/Config.in +3 -4
index 2af44a8..cb4beed 100644
@@ -3,25 +3,23 @@ config BR2_TARGET_ROOTFS_EXT2
 	help
 	  Build an ext2 root filesystem
 
+if BR2_TARGET_ROOTFS_EXT2
+
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
 	int "size in blocks (leave at 0 for auto calculation)"
-	depends on BR2_TARGET_ROOTFS_EXT2
 	default 0
 
 config BR2_TARGET_ROOTFS_EXT2_INODES
 	int "inodes (leave at 0 for auto calculation)"
-	depends on BR2_TARGET_ROOTFS_EXT2
 	default 0
 
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	int "reserved blocks percentage"
-	depends on BR2_TARGET_ROOTFS_EXT2
 	default 0
 
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
-	depends on BR2_TARGET_ROOTFS_EXT2
 	help
 	  Select compressor for ext2 filesystem of the root filesystem
 
@@ -47,3 +45,4 @@ config BR2_TARGET_ROOTFS_EXT2_LZMA
 
 endchoice
 
+endif # BR2_TARGET_ROOTFS_EXT2
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 1/4 fs/ext2: enclose the ext2 options in if...endif

Quoted 4 lines · Yann E. MORIN

Use a 'if...endif' construct instead of repeating the 'depends on' for each symbols.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

In reply to Yann E. MORIN
---
 fs/ext2/Config.in    |   37 ++++++++++++++++++++++++++++++-------
 fs/ext2/ext2.mk      |    4 ++--
 fs/ext2/genext2fs.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 78 insertions(+), 11 deletions(-)
fs/ext2/Config.in +30 -7
index cb4beed..00f11a2 100644
@@ -1,10 +1,33 @@
 config BR2_TARGET_ROOTFS_EXT2
-	bool "ext2 root filesystem"
+	bool "ext2/3/4 root filesystem"
 	help
-	  Build an ext2 root filesystem
+	  Build an ext2/3/4 root filesystem
 
 if BR2_TARGET_ROOTFS_EXT2
 
+choice
+	bool "ext generation"
+	default BR2_TARGET_ROOTFS_EXT2_2
+
+config BR2_TARGET_ROOTFS_EXT2_2
+	bool "ext2"
+
+config BR2_TARGET_ROOTFS_EXT2_3
+	bool "ext3"
+	select BR2_PACKAGE_HOST_E2FSPROGS
+
+config BR2_TARGET_ROOTFS_EXT2_4
+	bool "ext4"
+	select BR2_PACKAGE_HOST_E2FSPROGS
+
+endchoice
+
+config BR2_TARGET_ROOTFS_EXT2_GEN
+	int
+	default 2 if BR2_TARGET_ROOTFS_EXT2_2
+	default 3 if BR2_TARGET_ROOTFS_EXT2_3
+	default 4 if BR2_TARGET_ROOTFS_EXT2_4
+
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
 	int "size in blocks (leave at 0 for auto calculation)"
 	default 0
@@ -21,27 +44,27 @@ choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_EXT2_NONE
 	help
-	  Select compressor for ext2 filesystem of the root filesystem
+	  Select compressor for ext2/3/4 filesystem of the root filesystem
 
 config BR2_TARGET_ROOTFS_EXT2_NONE
 	bool "no compression"
 	help
-	  Do not compress the ext2 filesystem.
+	  Do not compress the ext2/3/4 filesystem.
 
 config BR2_TARGET_ROOTFS_EXT2_GZIP
 	bool "gzip"
 	help
-	  Do compress the ext2 filesystem with gzip.
+	  Do compress the ext2/3/4 filesystem with gzip.
 
 config BR2_TARGET_ROOTFS_EXT2_BZIP2
 	bool "bzip2"
 	help
-	  Do compress the ext2 filesystem with bzip2.
+	  Do compress the ext2/3/4 filesystem with bzip2.
 
 config BR2_TARGET_ROOTFS_EXT2_LZMA
 	bool "lzma"
 	help
-	  Do compress the ext2 filesystem with lzma.
+	  Do compress the ext2/3/4 filesystem with lzma.
 
 endchoice
 
fs/ext2/ext2.mk +2 -2
index 7b71592..80ad93f 100644
@@ -18,10 +18,10 @@ ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
 endif
 
-ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
+ROOTFS_EXT2_DEPENDENCIES = host-genext2fs $(if $(BR2_PACKAGE_HOST_E2FSPROGS),host-e2fsprogs)
 
 define ROOTFS_EXT2_CMD
-	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) $@
+	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) -$(BR2_TARGET_ROOTFS_EXT2_GEN) $@
 endef
 
 $(eval $(call ROOTFS_TARGET,ext2))
fs/ext2/genext2fs.sh +46 -2

72 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#4 lore raw

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

Great feature addition!

Quoted 13 lines · Yann E. MORIN
---
  fs/ext2/Config.in    |   37 ++++++++++++++++++++++++++++++-------
  fs/ext2/ext2.mk      |    4 ++--
  fs/ext2/genext2fs.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
  3 files changed, 78 insertions(+), 11 deletions(-)
fs/ext2/Config.in +0 -0
index cb4beed..00f11a2 100644
@@ -1,10 +1,33 @@
  config BR2_TARGET_ROOTFS_EXT2

fs/ext2/Config.in line 9

Quoted 10 lines
fs/ext2/Config.in +4 -2
-	bool "ext2 root filesystem"
+	bool "ext2/3/4 root filesystem"
  	help
-	  Build an ext2 root filesystem
+	  Build an ext2/3/4 root filesystem
 
  if BR2_TARGET_ROOTFS_EXT2
 
+choice
+	bool "ext generation"

Given the way it appears in menuconfig, I think this will be hard to
understand for many users. Perhaps "ext generation (ext2, ext3 or ext4)".

fs/ext2/Config.in line 10

Quoted 1 line
fs/ext2/Config.in +1 -0
+	default BR2_TARGET_ROOTFS_EXT2_2

Although this matches the current default, doesn't it make more sense
to "bump" to ext4?

fs/ext2/Config.in line 17

Quoted 7 lines
fs/ext2/Config.in +7 -0
+
+config BR2_TARGET_ROOTFS_EXT2_2
+	bool "ext2"
+
+config BR2_TARGET_ROOTFS_EXT2_3
+	bool "ext3"
+	select BR2_PACKAGE_HOST_E2FSPROGS

We don't usually select the host package. On the other hand, the
support for user-selectable host packages is pretty recent, so we don't have a real tradition for this.

Peter?

Quoted 16 lines
fs/ext2/Config.in +13 -0
+
+config BR2_TARGET_ROOTFS_EXT2_4
+	bool "ext4"
+	select BR2_PACKAGE_HOST_E2FSPROGS
+
+endchoice
+
+config BR2_TARGET_ROOTFS_EXT2_GEN
+	int
+	default 2 if BR2_TARGET_ROOTFS_EXT2_2
+	default 3 if BR2_TARGET_ROOTFS_EXT2_3
+	default 4 if BR2_TARGET_ROOTFS_EXT2_4
+
  config BR2_TARGET_ROOTFS_EXT2_BLOCKS
  	int "size in blocks (leave at 0 for auto calculation)"
  	default 0

[snip]

fs/ext2/ext2.mk ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0) · line 21

Quoted 10 lines
fs/ext2/ext2.mk +1 -1
index 7b71592..80ad93f 100644
@@ -18,10 +18,10 @@ ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
  EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
  endif
 
-ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
+ROOTFS_EXT2_DEPENDENCIES = host-genext2fs $(if $(BR2_PACKAGE_HOST_E2FSPROGS),host-e2fsprogs)

Although this is correct, I think it looks confusing. I prefer a more
explicit

ifeq ($(BR2_TARGET_ROOTFS_EXT2_3)$(BR2_TARGET_ROOTFS_EXT2_4),y) ROOTFS_EXT2_DEPENDENCIES += host-e2fsprogs
endif

fs/ext2/ext2.mk ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0) · line 24

Quoted 4 lines
fs/ext2/ext2.mk +1 -1
  define ROOTFS_EXT2_CMD
-	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) $@
+	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) -$(BR2_TARGET_ROOTFS_EXT2_GEN) $@

Minor nit: I would prefer
EXT2_OPTS += -$(BR2_TARGET_ROOTFS_EXT2_GEN)

Quoted 32 lines
fs/ext2/ext2.mk +0 -0
  endef
 
  $(eval $(call ROOTFS_TARGET,ext2))
fs/ext2/genext2fs.sh +4 -1
index 7a518ae..fcbd43c 100755
@@ -1,19 +1,22 @@
  #!/bin/sh
  # genext2fs wrapper calculating needed blocks/inodes values if not specified
+set -e
 
  export LC_ALL=C
 
  CALC_BLOCKS=1
  CALC_INODES=1
 
-while getopts x:d:D:b:i:N:m:g:e:zfqUPhVv f
+while getopts x:d:D:b:i:N:m:g:e:zfqUPhVv234 f
  do
      case $f in
+	2|3|4) GEN=$f ;;
  	b) CALC_BLOCKS=0 ;;
  	N) CALC_INODES=0; INODES=$OPTARG ;;
  	d) TARGET_DIR=$OPTARG ;;
      esac
  done
+eval IMG="\"\${${OPTIND}}\""
 
  # calculate needed inodes
  if [ $CALC_INODES -eq 1 ];

fs/ext2/genext2fs.sh then · line 37

Quoted 5 lines
fs/ext2/genext2fs.sh +2 -0
@@ -30,7 +33,48 @@ then
      # we scale inodes / blocks with 10% to compensate for bitmaps size + slack
      BLOCKS=$(du -s -c -k $TARGET_DIR | grep total | sed -e "s/total//")
      BLOCKS=$(expr 500 + \( $BLOCKS + $INODES / 8 \) \* 11 / 10)
+    # we add 1081 blocks (a bit more than 1 MiB, assuming 1KiB blocks) for
+    # the journal if ext3/4

Is this based on anything? Could you add something like "This allows
filesystems up to 4GiB"?

fs/ext2/genext2fs.sh then · line 45

Quoted 9 lines
fs/ext2/genext2fs.sh +5 -1
+    if [ ${GEN} -ge 3 ]; then
+        BLOCKS=$(expr 1081 + $BLOCKS )
+    fi
      set -- $@ -b $BLOCKS
  fi
 
-exec genext2fs $@
+# Remove -{2,3,4} from the arguments, they are not recognised
+# by genext2fs and we handle them manually later

Wouldn't it be a lot simpler to pass the generation through the
environment instead?

Quoted 9 lines
fs/ext2/genext2fs.sh +9 -0
+first=1
+for o; do
+    case "${o}" in
+	-2|-3|-4)  ;;
+	*)  if [ ${first} -eq 1 ]; then
+		set --
+		first=0
+	    fi
+	    set -- "$@" "${o}"

fs/ext2/genext2fs.sh then · line 64

Quoted 10 lines
fs/ext2/genext2fs.sh +10 -0
+            ;;
+    esac
+done
+
+# Generate the base ext2 file system
+genext2fs "$@"
+
+# Upgrade to ext3 if needed
+if [ ${GEN} -ge 3 ]; then
+    tune2fs -j -J size=1 "${IMG}" >/dev/null

Ah, this is where the 1081 blocks come from. There should be a comment
pointing to that 1081 so it's easier to find this back if it is ever changed to a different value.

Why does it have to be >/dev/null? We don't usually do that...

In the script I used, I also added -c 0 (max mount count) and -i 0
(interval between checks). That's not for this patch of course, but I think it's something useful to have in general.

fs/ext2/genext2fs.sh then · line 71

Quoted 7 lines
fs/ext2/genext2fs.sh +7 -0
+fi
+
+# Upgrade to ext4 if needed
+if [ ${GEN} -ge 4 ]; then
+    tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
+    ret=0
+    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?

This fsck is needed for ext3 as well, just to set rev0 -> rev1. Of
course, patch 4/4 does that already.

You should add a comment why fsck is needed.

I would use e2fsck rather than fsck.ext4, but that's a minor thing.

fs/ext2/genext2fs.sh then · line 79

Quoted 8 lines
fs/ext2/genext2fs.sh +8 -0
+    # Exit codes 1 & 2 are OK, it means fs errors
+    # were successfully corrected
+    case ${ret} in
+	0|1|2) ;;
+	*)   exit 1;;
+    esac
+    # fsck.ext4 will force a UUID, which we do not want
+    tune2fs -U clear "${IMG}" >/dev/null

Why don't we want a UUID? We have it for other filesystems, e.g. ubifs...

Regards,
Arnout

Quoted 2 lines
fs/ext2/genext2fs.sh +1 -0
+fi
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 4 lines

fs/ext2/Config.in line 9

Quoted 4 lines

if BR2_TARGET_ROOTFS_EXT2

fs/ext2/Config.in +2 -0
+choice
+	bool "ext generation"

Arnout> Given the way it appears in menuconfig, I think this will be hard to Arnout> understand for many users. Perhaps "ext generation (ext2, ext3 or Arnout> ext4)".

Or simply ext variant?

Quoted 1 line

fs/ext2/Config.in line 10

Quoted 1 line
fs/ext2/Config.in +1 -0
+	default BR2_TARGET_ROOTFS_EXT2_2

Arnout> Although this matches the current default, doesn't it make Arnout> more sense to "bump" to ext4?

Possibly. It would break existing configs though.

Quoted 6 lines

fs/ext2/Config.in line 17

Quoted 6 lines
fs/ext2/Config.in +6 -0
+config BR2_TARGET_ROOTFS_EXT2_2
+	bool "ext2"
+
+config BR2_TARGET_ROOTFS_EXT2_3
+	bool "ext3"
+	select BR2_PACKAGE_HOST_E2FSPROGS

Arnout> We don't usually select the host package. On the other hand, the Arnout> support for user-selectable host packages is pretty recent, so we Arnout> don't have a real tradition for this.

Arnout> Peter?

I would argue that we should keep kconfig and makefiles consistent when possible, so when we have a user selectable host package (kconfig symbol), we should select it.

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

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

Quoted 13 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 4 lines

fs/ext2/Config.in line 9

Quoted 4 lines

if BR2_TARGET_ROOTFS_EXT2

fs/ext2/Config.in +2 -0
+choice
+	bool "ext generation"

Arnout> Given the way it appears in menuconfig, I think this will be hard to Arnout> understand for many users. Perhaps "ext generation (ext2, ext3 or Arnout> ext4)".

Quoted 8 lines

Or simply ext variant?

Quoted 1 line

fs/ext2/Config.in line 10

Quoted 1 line
fs/ext2/Config.in +1 -0
+	default BR2_TARGET_ROOTFS_EXT2_2

Arnout> Although this matches the current default, doesn't it make Arnout> more sense to "bump" to ext4?

Possibly. It would break existing configs though.

No it doesn't. It just _changes_ existing _defconfigs_. It is similar
to (though a bit more invasive than) bumping the default kernel version.

Quoted 12 lines
Quoted 7 lines

fs/ext2/Config.in line 17

Quoted 7 lines
fs/ext2/Config.in +6 -0
+config BR2_TARGET_ROOTFS_EXT2_2
+	bool "ext2"
+
+config BR2_TARGET_ROOTFS_EXT2_3
+	bool "ext3"
+	select BR2_PACKAGE_HOST_E2FSPROGS

Arnout> We don't usually select the host package. On the other hand, the Arnout> support for user-selectable host packages is pretty recent, so we Arnout> don't have a real tradition for this.

Quoted 5 lines

Arnout> Peter?

I would argue that we should keep kconfig and makefiles consistent when possible, so when we have a user selectable host package (kconfig symbol), we should select it.

OK. We probably have quite a few violations of this convention, but we
can look out for it when changes are made.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#7 lore raw

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

In reply to Arnout Vandecappelle

Arnout, All,

Quoted 1 line · On Tuesday 19 February 2013 Arnout Vandecappelle wrote:

Great feature addition!

:-)

Quoted 1 line · Yann E. MORIN

[--SNIP--]

Quoted 7 lines
Quoted 7 lines

config BR2_TARGET_ROOTFS_EXT2

fs/ext2/Config.in +2 -2
-	bool "ext2 root filesystem"
+	bool "ext2/3/4 root filesystem"
  	help
-	  Build an ext2 root filesystem
+	  Build an ext2/3/4 root filesystem
Quoted 7 lines

fs/ext2/Config.in line 9

Quoted 4 lines

if BR2_TARGET_ROOTFS_EXT2

fs/ext2/Config.in +2 -0
+choice
+	bool "ext generation"

Given the way it appears in menuconfig, I think this will be hard to
understand for many users. Perhaps "ext generation (ext2, ext3 or ext4)".

OK, will look at it.

Quoted 4 lines

fs/ext2/Config.in line 10

Quoted 1 line
fs/ext2/Config.in +1 -0
+	default BR2_TARGET_ROOTFS_EXT2_2

Although this matches the current default, doesn't it make more sense
to "bump" to ext4?

No. There are stuff that does have to be ext2 (mostly because of dumb bootloaders that can't read ext3/4).

Quoted 11 lines

fs/ext2/Config.in line 17

Quoted 7 lines
fs/ext2/Config.in +7 -0
+
+config BR2_TARGET_ROOTFS_EXT2_2
+	bool "ext2"
+
+config BR2_TARGET_ROOTFS_EXT2_3
+	bool "ext3"
+	select BR2_PACKAGE_HOST_E2FSPROGS

We don't usually select the host package. On the other hand, the
support for user-selectable host packages is pretty recent, so we don't have a real tradition for this.

OK, so only depend on e2fsprogs from the .mk, then.

[--SNIP--]

Quoted 9 lines

fs/ext2/ext2.mk ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0) · line 21

Quoted 2 lines
fs/ext2/ext2.mk +1 -1
-ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
+ROOTFS_EXT2_DEPENDENCIES = host-genext2fs $(if $(BR2_PACKAGE_HOST_E2FSPROGS),host-e2fsprogs)

Although this is correct, I think it looks confusing. I prefer a more
explicit

ifeq ($(BR2_TARGET_ROOTFS_EXT2_3)$(BR2_TARGET_ROOTFS_EXT2_4),y) ROOTFS_EXT2_DEPENDENCIES += host-e2fsprogs
endif

OK.

Quoted 6 lines

fs/ext2/ext2.mk ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0) · line 24

Quoted 3 lines

define ROOTFS_EXT2_CMD

fs/ext2/ext2.mk +1 -1
-	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) $@
+	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) -$(BR2_TARGET_ROOTFS_EXT2_GEN) $@

Minor nit: I would prefer
EXT2_OPTS += -$(BR2_TARGET_ROOTFS_EXT2_GEN)

Right.

Quoted 4 lines

fs/ext2/genext2fs.sh

Quoted 4 lines
fs/ext2/genext2fs.sh +0 -0
index 7a518ae..fcbd43c 100755

[--SNIP--]

Quoted 9 lines

fs/ext2/genext2fs.sh then · line 37

Quoted 6 lines
fs/ext2/genext2fs.sh +2 -0
@@ -30,7 +33,48 @@ then
      # we scale inodes / blocks with 10% to compensate for bitmaps size + slack
      BLOCKS=$(du -s -c -k $TARGET_DIR | grep total | sed -e "s/total//")
      BLOCKS=$(expr 500 + \( $BLOCKS + $INODES / 8 \) \* 11 / 10)
+    # we add 1081 blocks (a bit more than 1 MiB, assuming 1KiB blocks) for
+    # the journal if ext3/4

Is this based on anything? Could you add something like "This allows
filesystems up to 4GiB"?

I've "bisected" the number of blocks required to add a journal, and 1081 was the strict minimum. 1080 blocks, and tune2fs would yell.

This is a purely test-and-check process with two different ext2 filesystems, one ~10 MiBs, another 128MiB.

YMMV, as they use to say! ;-)

Quoted 6 lines
Quoted 6 lines
fs/ext2/genext2fs.sh +3 -0
+    if [ ${GEN} -ge 3 ]; then
+        BLOCKS=$(expr 1081 + $BLOCKS )
+    fi
      set -- $@ -b $BLOCKS
  fi
 
Quoted 6 lines

fs/ext2/genext2fs.sh then · line 45

Quoted 3 lines
fs/ext2/genext2fs.sh +2 -1
-exec genext2fs $@
+# Remove -{2,3,4} from the arguments, they are not recognised
+# by genext2fs and we handle them manually later

Wouldn't it be a lot simpler to pass the generation through the
environment instead?

I'd like to avoid 'scanning' .config if possible.
But I'll see what to do about it.

Quoted 15 lines
Quoted 15 lines
fs/ext2/genext2fs.sh +15 -0
+first=1
+for o; do
+    case "${o}" in
+	-2|-3|-4)  ;;
+	*)  if [ ${first} -eq 1 ]; then
+		set --
+		first=0
+	    fi
+	    set -- "$@" "${o}"
+            ;;
+    esac
+done
+
+# Generate the base ext2 file system
+genext2fs "$@"
Quoted 8 lines

fs/ext2/genext2fs.sh then · line 64

Quoted 4 lines
fs/ext2/genext2fs.sh +4 -0
+
+# Upgrade to ext3 if needed
+if [ ${GEN} -ge 3 ]; then
+    tune2fs -j -J size=1 "${IMG}" >/dev/null

Ah, this is where the 1081 blocks come from. There should be a comment
pointing to that 1081 so it's easier to find this back if it is ever changed to a different value.

OK.

Quoted 1 line

Why does it have to be >/dev/null? We don't usually do that...

I usually >/dev/null to only see errors, as I don't give a dime about the output when all goes well. I'll strip it off before I resend.

Quoted 3 lines

In the script I used, I also added -c 0 (max mount count) and -i 0
(interval between checks). That's not for this patch of course, but I think it's something useful to have in general.

Well, I'd rather leave that for a post-image script. I think it is highly context-specific whether you want time- or count-based checks, or not.

But that's trivial enough to add, so I'll give it a whirl.

Quoted 10 lines

fs/ext2/genext2fs.sh then · line 71

Quoted 7 lines
fs/ext2/genext2fs.sh +7 -0
+fi
+
+# Upgrade to ext4 if needed
+if [ ${GEN} -ge 4 ]; then
+    tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
+    ret=0
+    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?

This fsck is needed for ext3 as well, just to set rev0 -> rev1. Of
course, patch 4/4 does that already.

No, because *this* patch does not set rev1, and fsck is not needed after adding a journal. It's needed only when setting rev1, or upgrading to ext4.

Quoted 1 line

You should add a comment why fsck is needed.

I'll do.

Quoted 1 line

I would use e2fsck rather than fsck.ext4, but that's a minor thing.

Well, does e2fsck behave properly when called e2fsck, and not through its symlinks mkfs.extX ?

I'll check that.

Quoted 10 lines

fs/ext2/genext2fs.sh then · line 79

Quoted 8 lines
fs/ext2/genext2fs.sh +8 -0
+    # Exit codes 1 & 2 are OK, it means fs errors
+    # were successfully corrected
+    case ${ret} in
+	0|1|2) ;;
+	*)   exit 1;;
+    esac
+    # fsck.ext4 will force a UUID, which we do not want
+    tune2fs -U clear "${IMG}" >/dev/null

Why don't we want a UUID? We have it for other filesystems, e.g. ubifs...

Reproducible builds. The UUID added by e2fsck is random, so one can not reproduce the same images.

Explicitly adding a UUID can then be done in a post-image hook, but is context-specific.

Thanks for the review. :-)

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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 2/4 fs/ext2: add ability to build ext3/4 too

Arnout, All,

Quoted 1 line · On Tuesday 19 February 2013 Yann E. MORIN wrote:

On Tuesday 19 February 2013 Arnout Vandecappelle wrote:

[--SNIP--]

Quoted 8 lines
Quoted 5 lines

fs/ext2/genext2fs.sh then · line 45

Quoted 2 lines
fs/ext2/genext2fs.sh +2 -0
+# Remove -{2,3,4} from the arguments, they are not recognised
+# by genext2fs and we handle them manually later

Wouldn't it be a lot simpler to pass the generation through the
environment instead?

I'd like to avoid 'scanning' .config if possible.
But I'll see what to do about it.

Forget it, I've seen The Light! ;-)

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.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

In reply to Yann E. MORIN

Update defconfigs and boards readmes accordingly.

Signed-off-by yann.morin.1998 at free.fr
---
 board/arm/foundation-v8/readme.txt          |    2 +-
 board/boundarydevices/nitrogen6x/readme.txt |    8 +++---
 board/qemu/arm-versatile/readme.txt         |    2 +-
 board/qemu/arm-vexpress/readme.txt          |    2 +-
 board/qemu/mips-malta/readme.txt            |    2 +-
 board/qemu/mips64-malta/readme.txt          |    2 +-
 board/qemu/mipsel-malta/readme.txt          |    2 +-
 board/qemu/powerpc-g3beige/readme.txt       |    2 +-
 board/qemu/sh4-r2d/readme.txt               |    2 +-
 board/qemu/sparc-ss10/readme.txt            |    2 +-
 board/qemu/x86/readme.txt                   |    2 +-
 board/qemu/x86_64/readme.txt                |    2 +-
 configs/arm_foundationv8_defconfig          |    2 +-
 configs/beaglebone_defconfig                |    2 +-
 configs/mx53loco_defconfig                  |    2 +-
 configs/nitrogen6x_defconfig                |    2 +-
 configs/pandaboard_defconfig                |    2 +-
 configs/qemu_arm_versatile_defconfig        |    2 +-
 configs/qemu_arm_vexpress_defconfig         |    2 +-
 configs/qemu_mips64_malta_defconfig         |    2 +-
 configs/qemu_mips_malta_defconfig           |    2 +-
 configs/qemu_mipsel_malta_defconfig         |    2 +-
 configs/qemu_ppc_g3beige_defconfig          |    2 +-
 configs/qemu_sh4_r2d_defconfig              |    2 +-
 configs/qemu_sparc_ss10_defconfig           |    2 +-
 configs/qemu_x86_64_defconfig               |    2 +-
 configs/qemu_x86_defconfig                  |    2 +-
 fs/Config.in                                |    2 +-
 fs/{ext2 => ext}/Config.in                  |   38 +++++++++++++-------------
 fs/ext/ext.mk                               |   27 +++++++++++++++++++
 fs/{ext2/genext2fs.sh => ext/genextfs.sh}   |    0
 fs/ext2/ext2.mk                             |   27 -------------------
 32 files changed, 77 insertions(+), 77 deletions(-)
 rename fs/{ext2 => ext}/Config.in (55%)
 create mode 100644 fs/ext/ext.mk
 rename fs/{ext2/genext2fs.sh => ext/genextfs.sh} (100%)
 delete mode 100644 fs/ext2/ext2.mk
board/arm/foundation-v8/readme.txt +1 -1
index 7f419a0..9812fe0 100644
@@ -12,7 +12,7 @@ Finally, boot your system with:
 
  ${LOCATION_OF_FOUNDATIONV8_SIMULATOR}/Foundation_v8 \
     --image output/images/linux-system.axf \
-    --block-device output/images/rootfs.ext2 \
+    --block-device output/images/rootfs.ext \
     --network=nat
 
 You can get network access from within the simulated environment
board/boundarydevices/nitrogen6x/readme.txt +4 -4
index 6e9b95c..896228f 100644
@@ -6,11 +6,11 @@ Notice: U-Boot as shipped on the board has a bug reading rev 0 ext2
 file systems (which is what genext2fs generates). To convert it to rev
 1, do:
 
-tune2fs -O filetype output/images/rootfs.ext2
-e2fsck -a output/images/rootfs.ext2
+tune2fs -O filetype output/images/rootfs.ext
+e2fsck -a output/images/rootfs.ext
 
-To install, simply extract rootfs.ext2 to first partition of a uSD card:
+To install, simply extract rootfs.ext to first partition of a uSD card:
 
-sudo dd if=output/images/rootfs.ext2 of=/dev/sdX1
+sudo dd if=output/images/rootfs.ext of=/dev/sdX1
 
 Where 'sdX1' is the device node of the uSD partition.
board/qemu/arm-versatile/readme.txt +1 -1
index 51364c7..b2dc3c3 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-arm -M versatilepb -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=scsi -append "root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=smc91c111 -net user
+  qemu-system-arm -M versatilepb -kernel output/images/zImage -drive file=output/images/rootfs.ext,if=scsi -append "root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=smc91c111 -net user
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
board/qemu/arm-vexpress/readme.txt +1 -1
index c74bfcd..8a86a3d 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-arm -M vexpress-a9 -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=sd -append "console=ttyAMA0,115200 root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user
+  qemu-system-arm -M vexpress-a9 -kernel output/images/zImage -drive file=output/images/rootfs.ext,if=sd -append "console=ttyAMA0,115200 root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
board/qemu/mips-malta/readme.txt +1 -1
index d3d8446..af5e055 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext2 -append "root=/dev/hda"
+ qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext -append "root=/dev/hda"
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer. No keyboard support has been
board/qemu/mips64-malta/readme.txt +1 -1
index 1d6ff10..ba360c2 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext2 -append "root=/dev/hda"
+ qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext -append "root=/dev/hda"
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer. No keyboard support has been
board/qemu/mipsel-malta/readme.txt +1 -1
index 8dd4024..24be4a1 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext2 -append "root=/dev/hda"
+ qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext -append "root=/dev/hda"
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer. No keyboard support has been
board/qemu/powerpc-g3beige/readme.txt +1 -1
index 05aa380..e047c8e 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-ppc -M g3beige -kernel output/images/vmlinux -hda output/images/rootfs.ext2 -append "console=ttyS0 root=/dev/hdc" -serial stdio
+  qemu-system-ppc -M g3beige -kernel output/images/vmlinux -hda output/images/rootfs.ext -append "console=ttyS0 root=/dev/hdc" -serial stdio
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
board/qemu/sh4-r2d/readme.txt +1 -1
index 9ae7496..061e644 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide -append "root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio
+  qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext,if=ide -append "root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio
 
 The login prompt will appear in the terminal that started Qemu.
 The graphical window is the framebuffer.
board/qemu/sparc-ss10/readme.txt +1 -1
index 4290c55..2ad8edc 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext2 -append "root=/dev/sda console=ttyS0,115200" -serial stdio
+  qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext -append "root=/dev/sda console=ttyS0,115200" -serial stdio
 
 The login prompt will appear in the terminal that started Qemu.
 The graphical window is the framebuffer.
board/qemu/x86/readme.txt +1 -1
index 4342556..1e34972 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=ide -append root=/dev/sda
+  qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext,if=ide -append root=/dev/sda
 
 The login prompt will appear in the graphical window.
 
board/qemu/x86_64/readme.txt +1 -1
index 7d3c6c5..c044eba 100644
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=ide -append root=/dev/sda
+  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext,if=ide -append root=/dev/sda
 
 The login prompt will appear in the graphical window.
 
configs/arm_foundationv8_defconfig +1 -1
index 7a50b1a..f3bcb32 100644
@@ -1,7 +1,7 @@
 BR2_aarch64=y
 BR2_TOOLCHAIN_EXTERNAL=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_BOOT_WRAPPER_AARCH64=y
 BR2_TARGET_BOOT_WRAPPER_AARCH64_DTS="vexpress-foundation-v8"
configs/beaglebone_defconfig +1 -1
index e19cdcb..6fd9e4e 100644
@@ -6,7 +6,7 @@ BR2_TARGET_GENERIC_HOSTNAME="beaglebone"
 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"
 # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 # Lock down headers to avoid breaking with new defaults
 BR2_KERNEL_HEADERS_VERSION=y
configs/mx53loco_defconfig +1 -1
index ff3948b..504f506 100644
@@ -13,7 +13,7 @@ BR2_TARGET_UBOOT_CUSTOM_GIT_REPO_URL="git://git.freescale.com/imx/uboot-imx.git"
 BR2_TARGET_UBOOT_CUSTOM_GIT_VERSION="rel_imx_2.6.35_11.09.01"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 
 # Kernel
 BR2_LINUX_KERNEL=y
configs/nitrogen6x_defconfig +1 -1
index e3a78c7..492ed2c 100644
@@ -8,7 +8,7 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/boundarydevices/nitrogen6x/post-build.sh"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 
 # bootloader
 BR2_TARGET_UBOOT=y
configs/pandaboard_defconfig +1 -1
index 9496b7f..2fe2610 100644
@@ -8,7 +8,7 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyO2"
 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Kernel
configs/qemu_arm_versatile_defconfig +1 -1
index cbd7dd1..27b9f26 100644
@@ -7,7 +7,7 @@ BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_arm_vexpress_defconfig +1 -1
index 8ff5a46..8e80342 100644
@@ -11,7 +11,7 @@ BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
 
 # Filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_mips64_malta_defconfig +1 -1
index b8ca948..46642d3 100644
@@ -7,7 +7,7 @@ BR2_MIPS_NABI64=y
 BR2_PREFER_STATIC_LIB=y
 
 # Filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_mips_malta_defconfig +1 -1
index 6b034f6..35f9426 100644
@@ -3,7 +3,7 @@ BR2_mips=y
 BR2_mips_32r2=y
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_mipsel_malta_defconfig +1 -1
index adaaedd..95b1817 100644
@@ -3,7 +3,7 @@ BR2_mipsel=y
 BR2_mips_32r2=y
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_ppc_g3beige_defconfig +1 -1
index 080ee4d..a0c6637 100644
@@ -3,7 +3,7 @@ BR2_powerpc=y
 BR2_powerpc_750=y
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_sh4_r2d_defconfig +1 -1
index 4dfccd9..fc6910f 100644
@@ -7,7 +7,7 @@ BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttySC1"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Avoid 3.3+ headers
configs/qemu_sparc_ss10_defconfig +1 -1
index 906671b..2ba1e0e 100644
@@ -3,7 +3,7 @@ BR2_sparc=y
 BR2_sparc_v8=y
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_x86_64_defconfig +1 -1
index 74011fc..53d0e00 100644
@@ -6,7 +6,7 @@ BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="tty1"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
configs/qemu_x86_defconfig +1 -1
index 2734fdb..3756b07 100644
@@ -7,7 +7,7 @@ BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="tty1"
 
 # filesystem
-BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Lock to 3.7 headers to avoid breaking with newer kernels
fs/Config.in +1 -1
index da4c5ff..27c6586 100644
@@ -3,7 +3,7 @@ menu "Filesystem images"
 source "fs/cloop/Config.in"
 source "fs/cpio/Config.in"
 source "fs/cramfs/Config.in"
-source "fs/ext2/Config.in"
+source "fs/ext/Config.in"
 source "fs/initramfs/Config.in"
 source "fs/iso9660/Config.in"
 source "fs/jffs2/Config.in"
fs/ext/Config.in renamed from fs/ext2/Config.in +19 -19
similarity index 55%
rename from fs/ext2/Config.in
rename to fs/ext/Config.in
index 00f11a2..1a7a315 100644
@@ -1,71 +1,71 @@
-config BR2_TARGET_ROOTFS_EXT2
+config BR2_TARGET_ROOTFS_EXT
 	bool "ext2/3/4 root filesystem"
 	help
 	  Build an ext2/3/4 root filesystem
 
-if BR2_TARGET_ROOTFS_EXT2
+if BR2_TARGET_ROOTFS_EXT
 
 choice
 	bool "ext generation"
-	default BR2_TARGET_ROOTFS_EXT2_2
+	default BR2_TARGET_ROOTFS_EXT_EXT2
 
-config BR2_TARGET_ROOTFS_EXT2_2
+config BR2_TARGET_ROOTFS_EXT_EXT2
 	bool "ext2"
 
-config BR2_TARGET_ROOTFS_EXT2_3
+config BR2_TARGET_ROOTFS_EXT_EXT3
 	bool "ext3"
 	select BR2_PACKAGE_HOST_E2FSPROGS
 
-config BR2_TARGET_ROOTFS_EXT2_4
+config BR2_TARGET_ROOTFS_EXT_EXT4
 	bool "ext4"
 	select BR2_PACKAGE_HOST_E2FSPROGS
 
 endchoice
 
-config BR2_TARGET_ROOTFS_EXT2_GEN
+config BR2_TARGET_ROOTFS_EXT_GEN
 	int
-	default 2 if BR2_TARGET_ROOTFS_EXT2_2
-	default 3 if BR2_TARGET_ROOTFS_EXT2_3
-	default 4 if BR2_TARGET_ROOTFS_EXT2_4
+	default 2 if BR2_TARGET_ROOTFS_EXT_EXT2
+	default 3 if BR2_TARGET_ROOTFS_EXT_EXT3
+	default 4 if BR2_TARGET_ROOTFS_EXT_EXT4
 
-config BR2_TARGET_ROOTFS_EXT2_BLOCKS
+config BR2_TARGET_ROOTFS_EXT_BLOCKS
 	int "size in blocks (leave at 0 for auto calculation)"
 	default 0
 
-config BR2_TARGET_ROOTFS_EXT2_INODES
+config BR2_TARGET_ROOTFS_EXT_INODES
 	int "inodes (leave at 0 for auto calculation)"
 	default 0
 
-config BR2_TARGET_ROOTFS_EXT2_RESBLKS
+config BR2_TARGET_ROOTFS_EXT_RESBLKS
 	int "reserved blocks percentage"
 	default 0
 
 choice
 	prompt "Compression method"
-	default BR2_TARGET_ROOTFS_EXT2_NONE
+	default BR2_TARGET_ROOTFS_EXT_NONE
 	help
 	  Select compressor for ext2/3/4 filesystem of the root filesystem
 
-config BR2_TARGET_ROOTFS_EXT2_NONE
+config BR2_TARGET_ROOTFS_EXT_NONE
 	bool "no compression"
 	help
 	  Do not compress the ext2/3/4 filesystem.
 
-config BR2_TARGET_ROOTFS_EXT2_GZIP
+config BR2_TARGET_ROOTFS_EXT_GZIP
 	bool "gzip"
 	help
 	  Do compress the ext2/3/4 filesystem with gzip.
 
-config BR2_TARGET_ROOTFS_EXT2_BZIP2
+config BR2_TARGET_ROOTFS_EXT_BZIP2
 	bool "bzip2"
 	help
 	  Do compress the ext2/3/4 filesystem with bzip2.
 
-config BR2_TARGET_ROOTFS_EXT2_LZMA
+config BR2_TARGET_ROOTFS_EXT_LZMA
 	bool "lzma"
 	help
 	  Do compress the ext2/3/4 filesystem with lzma.
 
 endchoice
 
-endif # BR2_TARGET_ROOTFS_EXT2
+endif # BR2_TARGET_ROOTFS_EXT
fs/ext/ext.mk new file +27 -0
new file mode 100644
index 0000000..cdc22ba
@@ -0,0 +1,27 @@
+#############################################################
+#
+# Build the ext2/3/4 root filesystem image
+#
+#############################################################
+
+EXT_OPTS :=
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT_BLOCKS)),0)
+EXT_OPTS += -b $(BR2_TARGET_ROOTFS_EXT_BLOCKS)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT_INODES)),0)
+EXT_OPTS += -N $(BR2_TARGET_ROOTFS_EXT_INODES)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT_RESBLKS)),0)
+EXT_OPTS += -m $(BR2_TARGET_ROOTFS_EXT_RESBLKS)
+endif
+
+ROOTFS_EXT_DEPENDENCIES = host-genext2fs $(if $(BR2_PACKAGE_HOST_E2FSPROGS),host-e2fsprogs)
+
+define ROOTFS_EXT_CMD
+	PATH=$(TARGET_PATH) fs/ext/genextfs.sh -d $(TARGET_DIR) $(EXT_OPTS) -$(BR2_TARGET_ROOTFS_EXT_GEN) $@
+endef
+
+$(eval $(call ROOTFS_TARGET,ext))
fs/ext/genextfs.sh renamed from fs/ext2/genext2fs.sh +0 -0
similarity index 100%
rename from fs/ext2/genext2fs.sh
rename to fs/ext/genextfs.sh
fs/ext2/ext2.mk deleted +0 -27
deleted file mode 100644
index 80ad93f..0000000
@@ -1,27 +0,0 @@
-#############################################################
-#
-# Build the ext2 root filesystem image
-#
-#############################################################
-
-EXT2_OPTS :=
-
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
-EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
-endif
-
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
-EXT2_OPTS += -N $(BR2_TARGET_ROOTFS_EXT2_INODES)
-endif
-
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
-EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
-endif
-
-ROOTFS_EXT2_DEPENDENCIES = host-genext2fs $(if $(BR2_PACKAGE_HOST_E2FSPROGS),host-e2fsprogs)
-
-define ROOTFS_EXT2_CMD
-	PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) -$(BR2_TARGET_ROOTFS_EXT2_GEN) $@
-endef
-
-$(eval $(call ROOTFS_TARGET,ext2))
Signature · 1 line
1.7.2.5
#10 lore raw

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

Quoted 1 line · Yann E. MORIN

Update defconfigs and boards readmes accordingly.

I don't really like this. I think it falls in the category "yes it
would make things more consistent, but it's major API breakage that may make upgrading unnecessarily difficult". Peter decided to be more careful with that kind of changes, and rightly so.

That said, I would like it if the resulting image would be called
rootfs.ext3 instead of rootfs.ext2. However, the patch doesn't do that, and the infrastructure currently doesn't allow it. But we could redefine ROOTFS_TARGET:

define ROOTFS_TARGET
$(call ROOTFS_TARGET_INTERNAL,$(or $(2),$(1)),$(call UPPERCASE,$(1))) endef

and then call it with

$(call ROOTFS_TARGET,ext2,ext$(BR2_TARGET_ROOTFS_EXT2_GEN))

It would also be useful to convert some of the boards to ext4.

Quoted 36 lines
Signed-off-by yann.morin.1998 at free.fr
---
  board/arm/foundation-v8/readme.txt          |    2 +-
  board/boundarydevices/nitrogen6x/readme.txt |    8 +++---
  board/qemu/arm-versatile/readme.txt         |    2 +-
  board/qemu/arm-vexpress/readme.txt          |    2 +-
  board/qemu/mips-malta/readme.txt            |    2 +-
  board/qemu/mips64-malta/readme.txt          |    2 +-
  board/qemu/mipsel-malta/readme.txt          |    2 +-
  board/qemu/powerpc-g3beige/readme.txt       |    2 +-
  board/qemu/sh4-r2d/readme.txt               |    2 +-
  board/qemu/sparc-ss10/readme.txt            |    2 +-
  board/qemu/x86/readme.txt                   |    2 +-
  board/qemu/x86_64/readme.txt                |    2 +-
  configs/arm_foundationv8_defconfig          |    2 +-
  configs/beaglebone_defconfig                |    2 +-
  configs/mx53loco_defconfig                  |    2 +-
  configs/nitrogen6x_defconfig                |    2 +-
  configs/pandaboard_defconfig                |    2 +-
  configs/qemu_arm_versatile_defconfig        |    2 +-
  configs/qemu_arm_vexpress_defconfig         |    2 +-
  configs/qemu_mips64_malta_defconfig         |    2 +-
  configs/qemu_mips_malta_defconfig           |    2 +-
  configs/qemu_mipsel_malta_defconfig         |    2 +-
  configs/qemu_ppc_g3beige_defconfig          |    2 +-
  configs/qemu_sh4_r2d_defconfig              |    2 +-
  configs/qemu_sparc_ss10_defconfig           |    2 +-
  configs/qemu_x86_64_defconfig               |    2 +-
  configs/qemu_x86_defconfig                  |    2 +-
  fs/Config.in                                |    2 +-
  fs/{ext2 => ext}/Config.in                  |   38 +++++++++++++-------------
  fs/ext/ext.mk                               |   27 +++++++++++++++++++
  fs/{ext2/genext2fs.sh => ext/genextfs.sh}   |    0
  fs/ext2/ext2.mk                             |   27 -------------------
  32 files changed, 77 insertions(+), 77 deletions(-)
Quoted 3 lines

rename fs/{ext2 => ext}/Config.in (55%)
create mode 100644 fs/ext/ext.mk
rename fs/{ext2/genext2fs.sh => ext/genextfs.sh} (100%)

This rename is useful, though, and it shouldn't hurt anyone. If anyone
is using it, it will be pretty clear what happened, and it wil draw their attention to the new features of genextfs.sh.

Regards,
Arnout

Quoted 1 line

delete mode 100644 fs/ext2/ext2.mk

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#11 lore raw

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 1 line · Yann E. MORIN
Quoted 1 line

Update defconfigs and boards readmes accordingly.

Arnout> I don't really like this. I think it falls in the category "yes it Arnout> would make things more consistent, but it's major API breakage that Arnout> may make upgrading unnecessarily difficult". Peter decided to be more Arnout> careful with that kind of changes, and rightly so.

Agreed.

Arnout> This rename is useful, though, and it shouldn't hurt anyone. If Arnout> anyone is using it, it will be pretty clear what happened, and it wil Arnout> draw their attention to the new features of genextfs.sh.

Agreed.

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

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

Peter, Arnout, All,

Quoted 10 lines · On Tuesday 19 February 2013 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 1 line · Yann E. MORIN
Quoted 1 line

Update defconfigs and boards readmes accordingly.

Arnout> I don't really like this. I think it falls in the category "yes it Arnout> would make things more consistent, but it's major API breakage that Arnout> may make upgrading unnecessarily difficult". Peter decided to be more Arnout> careful with that kind of changes, and rightly so.

Quoted 7 lines

Agreed.

Arnout> This rename is useful, though, and it shouldn't hurt anyone. If Arnout> anyone is using it, it will be pretty clear what happened, and it wil Arnout> draw their attention to the new features of genextfs.sh.

Agreed.

OK, I'm puzzled. 8-/

Peter, you agreed on both points, which are the opposites one of the other. What should I conclude about this: do the change, or not do the change?

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.  |
'------------------------------^-------^------------------^--------------------'
#13 lore raw

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Peter, Arnout, All,

Quoted 2 lines · Yann> On Tuesday 19 February 2013 Peter Korsgaard wrote:
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 2 lines · Yann E. MORIN
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Update defconfigs and boards readmes accordingly.

Arnout> I don't really like this. I think it falls in the category "yes it Arnout> would make things more consistent, but it's major API breakage that Arnout> may make upgrading unnecessarily difficult". Peter decided to be more Arnout> careful with that kind of changes, and rightly so.

Quoted 3 lines
Quoted 3 lines

Agreed.

Arnout> This rename is useful, though, and it shouldn't hurt anyone. If Arnout> anyone is using it, it will be pretty clear what happened, and it wil Arnout> draw their attention to the new features of genextfs.sh.

Quoted 2 lines
Quoted 2 lines

Agreed.

Yann> OK, I'm puzzled. 8-/

Yann> Peter, you agreed on both points, which are the opposites one of Yann> the other. What should I conclude about this: do the change, or Yann> not do the change?

Huh, Arnout's first comment was about the defconfigs / BR2_TARGET_ROOTFS_EXT{2,} change, which we both dislike - And the 2nd was about the fs/ renames which should be transparent to the user.

Unless I'm confused, atleast.

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

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

Peter, Arnout, All,

Quoted 8 lines · On Tuesday 19 February 2013 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Peter, you agreed on both points, which are the opposites one of Yann> the other. What should I conclude about this: do the change, or Yann> not do the change?

Huh, Arnout's first comment was about the defconfigs / BR2_TARGET_ROOTFS_EXT{2,} change, which we both dislike - And the 2nd was about the fs/ renames which should be transparent to the user.

Ah, OK. So I drop the defocnfig changes, but keep the fs renames.

(Funny how I mis-understood the answer. And funny how I missed this reply two days ago... :-( )

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.  |
'------------------------------^-------^------------------^--------------------'
#15 lore raw

PATCH 3/4 fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems

In reply to Arnout Vandecappelle

Arnout, All,

Quoted 7 lines · On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
Quoted 1 line · Yann E. MORIN

Update defconfigs and boards readmes accordingly.

I don't really like this. I think it falls in the category "yes it
would make things more consistent, but it's major API breakage that may make upgrading unnecessarily difficult". Peter decided to be more careful with that kind of changes, and rightly so.

I'm not too fond of it either, but I'm more on the consistency line.

Quoted 5 lines

That said, I would like it if the resulting image would be called
rootfs.ext3 instead of rootfs.ext2. However, the patch doesn't do that, and the infrastructure currently doesn't allow it. But we could redefine ROOTFS_TARGET:

Quoted 7 lines

define ROOTFS_TARGET
$(call ROOTFS_TARGET_INTERNAL,$(or $(2),$(1)),$(call UPPERCASE,$(1))) endef

and then call it with

$(call ROOTFS_TARGET,ext2,ext$(BR2_TARGET_ROOTFS_EXT2_GEN))

Work for another patch, then. I'll queue.

Quoted 1 line

It would also be useful to convert some of the boards to ext4.

I am not able to decide whether a boards boot process would allow booting off ext4, so I won't change the defconfigs.

[--SNIP--]

Quoted 3 lines

This rename is useful, though, and it shouldn't hurt anyone. If anyone
is using it, it will be pretty clear what happened, and it wil draw their attention to the new features of genextfs.sh.

And it would warrant a entry in the legacy section, too.

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.  |
'------------------------------^-------^------------------^--------------------'
#16 lore raw

PATCH 4/4 fs/ext: add support for ext2 rev0 and rev1

In reply to Yann E. MORIN

Some bootloaders have a buggy ext2 support, and require ext2 rev1 instead of the traditional ext2 rev0 that genext2fs produces.

---
 fs/ext/Config.in   |   19 ++++++++++++-------
 fs/ext/genextfs.sh |   38 +++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 18 deletions(-)
fs/ext/Config.in +12 -7
index 1a7a315..be0ed9c 100644
@@ -7,10 +7,14 @@ if BR2_TARGET_ROOTFS_EXT
 
 choice
 	bool "ext generation"
-	default BR2_TARGET_ROOTFS_EXT_EXT2
+	default BR2_TARGET_ROOTFS_EXT_EXT2r0
 
-config BR2_TARGET_ROOTFS_EXT_EXT2
-	bool "ext2"
+config BR2_TARGET_ROOTFS_EXT_EXT2r0
+	bool "ext2 (rev0)"
+
+config BR2_TARGET_ROOTFS_EXT_EXT2r1
+	bool "ext2 (rev1)"
+	select BR2_PACKAGE_HOST_E2FSPROGS
 
 config BR2_TARGET_ROOTFS_EXT_EXT3
 	bool "ext3"
@@ -23,10 +27,11 @@ config BR2_TARGET_ROOTFS_EXT_EXT4
 endchoice
 
 config BR2_TARGET_ROOTFS_EXT_GEN
-	int
-	default 2 if BR2_TARGET_ROOTFS_EXT_EXT2
-	default 3 if BR2_TARGET_ROOTFS_EXT_EXT3
-	default 4 if BR2_TARGET_ROOTFS_EXT_EXT4
+	string
+	default 2.0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
+	default 2.1 if BR2_TARGET_ROOTFS_EXT_EXT2r1
+	default 3   if BR2_TARGET_ROOTFS_EXT_EXT3
+	default 4   if BR2_TARGET_ROOTFS_EXT_EXT4
 
 config BR2_TARGET_ROOTFS_EXT_BLOCKS
 	int "size in blocks (leave at 0 for auto calculation)"
fs/ext/genextfs.sh +27 -11
index fcbd43c..ef47a25 100755
@@ -6,11 +6,13 @@ export LC_ALL=C
 
 CALC_BLOCKS=1
 CALC_INODES=1
+EXT2_REV=0
 
 while getopts x:d:D:b:i:N:m:g:e:zfqUPhVv234 f
 do
     case $f in
-	2|3|4) GEN=$f ;;
+	2.*) GEN=2; EXT2_REV=${f#*.} ;;
+	3|4) GEN=$f ;;
 	b) CALC_BLOCKS=0 ;;
 	N) CALC_INODES=0; INODES=$OPTARG ;;
 	d) TARGET_DIR=$OPTARG ;;
@@ -56,25 +58,39 @@ for o; do
     esac
 done
 
+ext_fsck() {
+    gen="${1}"
+    img="${2}"
+    ret=0
+    fsck.ext${gen} -pDf "${img}" >/dev/null || ret=$?
+    # Exit codes 1 & 2 are OK, it means fs errors
+    # were successfully corrected
+    case ${ret} in
+	0|1|2) ;;
+	*)   exit 1;;
+    esac
+    # fsck.ext* will force a UUID, which we do not want
+    tune2fs -U clear "${img}" >/dev/null
+}
+
 # Generate the base ext2 file system
 genext2fs "$@"
 
+# Upgrade to ext2 rev1 if needed
+if [ ${EXT2_REV} -ge 1 -o ${GEN} -ge 3 ]; then
+    tune2fs -O filetype "${IMG}" >/dev/null
+    ext_fsck 2 "${IMG}"
+fi
+
 # Upgrade to ext3 if needed
 if [ ${GEN} -ge 3 ]; then
     tune2fs -j -J size=1 "${IMG}" >/dev/null
+    ext_fsck 3 "${IMG}"
 fi
 
 # Upgrade to ext4 if needed
 if [ ${GEN} -ge 4 ]; then
     tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
-    ret=0
-    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?
-    # Exit codes 1 & 2 are OK, it means fs errors
-    # were successfully corrected
-    case ${ret} in
-	0|1|2) ;;
-	*)   exit 1;;
-    esac
-    # fsck.ext4 will force a UUID, which we do not want
-    tune2fs -U clear "${IMG}" >/dev/null
+    NEED_FSCK=1
+    ext_fsck 4 "${IMG}"
 fi
Signature · 1 line
1.7.2.5
#17 lore raw

PATCH 4/4 fs/ext: add support for ext2 rev0 and rev1

Quoted 34 lines · Yann E. MORIN

Some bootloaders have a buggy ext2 support, and require ext2 rev1 instead of the traditional ext2 rev0 that genext2fs produces.

---
  fs/ext/Config.in   |   19 ++++++++++++-------
  fs/ext/genextfs.sh |   38 +++++++++++++++++++++++++++-----------
  2 files changed, 39 insertions(+), 18 deletions(-)
fs/ext/Config.in +7 -3
index 1a7a315..be0ed9c 100644
@@ -7,10 +7,14 @@ if BR2_TARGET_ROOTFS_EXT
 
  choice
  	bool "ext generation"
-	default BR2_TARGET_ROOTFS_EXT_EXT2
+	default BR2_TARGET_ROOTFS_EXT_EXT2r0
 
-config BR2_TARGET_ROOTFS_EXT_EXT2
-	bool "ext2"
+config BR2_TARGET_ROOTFS_EXT_EXT2r0
+	bool "ext2 (rev0)"
+
+config BR2_TARGET_ROOTFS_EXT_EXT2r1
+	bool "ext2 (rev1)"
+	select BR2_PACKAGE_HOST_E2FSPROGS
 
  config BR2_TARGET_ROOTFS_EXT_EXT3
  	bool "ext3"
@@ -23,10 +27,11 @@ config BR2_TARGET_ROOTFS_EXT_EXT4
  endchoice
 

fs/ext/Config.in config BR2_TARGET_ROOTFS_EXT_EXT4 · line 34

Quoted 10 lines
fs/ext/Config.in +5 -4
  config BR2_TARGET_ROOTFS_EXT_GEN
-	int
-	default 2 if BR2_TARGET_ROOTFS_EXT_EXT2
-	default 3 if BR2_TARGET_ROOTFS_EXT_EXT3
-	default 4 if BR2_TARGET_ROOTFS_EXT_EXT4
+	string
+	default 2.0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
+	default 2.1 if BR2_TARGET_ROOTFS_EXT_EXT2r1
+	default 3   if BR2_TARGET_ROOTFS_EXT_EXT3
+	default 4   if BR2_TARGET_ROOTFS_EXT_EXT4

I think it makes things simpler if you keep the GEN as it is, and
process the rev separately. Or perhaps set

config BR2_TARGET_ROOTFS_EXT_REV
int
default 0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
default 1

Quoted 23 lines
fs/ext/Config.in +0 -0
  config BR2_TARGET_ROOTFS_EXT_BLOCKS
  	int "size in blocks (leave at 0 for auto calculation)"
fs/ext/genextfs.sh +3 -1
index fcbd43c..ef47a25 100755
@@ -6,11 +6,13 @@ export LC_ALL=C
 
  CALC_BLOCKS=1
  CALC_INODES=1
+EXT2_REV=0
 
  while getopts x:d:D:b:i:N:m:g:e:zfqUPhVv234 f
  do
      case $f in
-	2|3|4) GEN=$f ;;
+	2.*) GEN=2; EXT2_REV=${f#*.} ;;
+	3|4) GEN=$f ;;
  	b) CALC_BLOCKS=0 ;;
  	N) CALC_INODES=0; INODES=$OPTARG ;;
  	d) TARGET_DIR=$OPTARG ;;

fs/ext/genextfs.sh for o; do · line 65

Quoted 8 lines
fs/ext/genextfs.sh +5 -0
@@ -56,25 +58,39 @@ for o; do
      esac
  done
 
+ext_fsck() {
+    gen="${1}"
+    img="${2}"
+    ret=0
+    fsck.ext${gen} -pDf "${img}" >/dev/null || ret=$?
  Don't bother with ${gen}, just use e2fsck.
Quoted 5 lines
fs/ext/genextfs.sh +5 -0
+    # Exit codes 1 & 2 are OK, it means fs errors
+    # were successfully corrected
+    case ${ret} in
+	0|1|2) ;;
+	*)   exit 1;;

fs/ext/genextfs.sh for o; do · line 80

Quoted 10 lines
fs/ext/genextfs.sh +7 -0
+    esac
+    # fsck.ext* will force a UUID, which we do not want
+    tune2fs -U clear "${img}" >/dev/null
+}
+
  # Generate the base ext2 file system
  genext2fs "$@"
 
+# Upgrade to ext2 rev1 if needed
+if [ ${EXT2_REV} -ge 1 -o ${GEN} -ge 3 ]; then

With BR2_TARGET_ROOTFS_EXT_REV this condition becomes simpler.

Quoted 14 lines
fs/ext/genextfs.sh +5 -1
+    tune2fs -O filetype "${IMG}" >/dev/null
+    ext_fsck 2 "${IMG}"
+fi
+
  # Upgrade to ext3 if needed
  if [ ${GEN} -ge 3 ]; then
      tune2fs -j -J size=1 "${IMG}" >/dev/null
+    ext_fsck 3 "${IMG}"
  fi
 
  # Upgrade to ext4 if needed
  if [ ${GEN} -ge 4 ]; then
      tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
-    ret=0

fs/ext/genextfs.sh for o; do · line 94

Quoted 10 lines
fs/ext/genextfs.sh +1 -9
-    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?
-    # Exit codes 1 & 2 are OK, it means fs errors
-    # were successfully corrected
-    case ${ret} in
-	0|1|2) ;;
-	*)   exit 1;;
-    esac
-    # fsck.ext4 will force a UUID, which we do not want
-    tune2fs -U clear "${IMG}" >/dev/null
+    NEED_FSCK=1

I guess you originally had just a single fsck and used this variable to
decide if it was needed. That's actually a good idea.

Regards,
Arnout

Quoted 3 lines
fs/ext/genextfs.sh +1 -0
+    ext_fsck 4 "${IMG}"
  fi
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#18 lore raw

PATCH 4/4 fs/ext: add support for ext2 rev0 and rev1

Arnout, All,

Quoted 3 lines · On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
Quoted 2 lines · Yann E. MORIN

Some bootloaders have a buggy ext2 support, and require ext2 rev1 instead of the traditional ext2 rev0 that genext2fs produces.

[--SNIP--]

Quoted 17 lines

fs/ext/Config.in config BR2_TARGET_ROOTFS_EXT_EXT4 · line 34

Quoted 13 lines
fs/ext/Config.in +5 -4
@@ -23,10 +27,11 @@ config BR2_TARGET_ROOTFS_EXT_EXT4
  endchoice
 
  config BR2_TARGET_ROOTFS_EXT_GEN
-	int
-	default 2 if BR2_TARGET_ROOTFS_EXT_EXT2
-	default 3 if BR2_TARGET_ROOTFS_EXT_EXT3
-	default 4 if BR2_TARGET_ROOTFS_EXT_EXT4
+	string
+	default 2.0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
+	default 2.1 if BR2_TARGET_ROOTFS_EXT_EXT2r1
+	default 3   if BR2_TARGET_ROOTFS_EXT_EXT3
+	default 4   if BR2_TARGET_ROOTFS_EXT_EXT4

I think it makes things simpler if you keep the GEN as it is, and
process the rev separately. Or perhaps set

Quoted 4 lines

config BR2_TARGET_ROOTFS_EXT_REV
int
default 0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
default 1

Not sure. ext2 rev1 is just that: a revision 1 ext2. ext3 or ext4 rev1 do not mean anything, AFAIK.

[--SNIP--]

Quoted 7 lines

fs/ext/genextfs.sh for o; do · line 65

Quoted 5 lines
fs/ext/genextfs.sh +5 -0
+ext_fsck() {
+    gen="${1}"
+    img="${2}"
+    ret=0
+    fsck.ext${gen} -pDf "${img}" >/dev/null || ret=$?
  Don't bother with ${gen}, just use e2fsck.

OK, I've just checked, and e2fsck's behavior does indeed not depend on its argv[0], so I'll use that.

[--SNIP--]

Quoted 4 lines

fs/ext/genextfs.sh for o; do · line 80

Quoted 2 lines
fs/ext/genextfs.sh +2 -0
+# Upgrade to ext2 rev1 if needed
+if [ ${EXT2_REV} -ge 1 -o ${GEN} -ge 3 ]; then

With BR2_TARGET_ROOTFS_EXT_REV this condition becomes simpler.

Yes, but as I said above, rev0/1 is only meaningfull for ext2, not ext3/4.

I'd rather keep the semantics clear. The ext filesystem can be:
- ext2 rev0
- ext2 rev1
- ext3
- ext4

And the fsck is only needed for ext2 rev1, ext3 or ext4.

But it is not stupid to always run the fsck anyway, so I'll simplify the code by always calling e2fsck, even if it is not strictly required. Doing so will also help catching badly generated ext2 rev0 filesystems, so it's a net gain (and does not cost too much, anyway).

Quoted 19 lines
Quoted 19 lines
fs/ext/genextfs.sh +5 -6
+    tune2fs -O filetype "${IMG}" >/dev/null
+    ext_fsck 2 "${IMG}"
+fi
+
  # Upgrade to ext3 if needed
  if [ ${GEN} -ge 3 ]; then
      tune2fs -j -J size=1 "${IMG}" >/dev/null
+    ext_fsck 3 "${IMG}"
  fi
 
  # Upgrade to ext4 if needed
  if [ ${GEN} -ge 4 ]; then
      tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
-    ret=0
-    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?
-    # Exit codes 1 & 2 are OK, it means fs errors
-    # were successfully corrected
-    case ${ret} in
-	0|1|2) ;;
Quoted 8 lines

fs/ext/genextfs.sh for o; do · line 94

Quoted 5 lines
fs/ext/genextfs.sh +1 -4
-	*)   exit 1;;
-    esac
-    # fsck.ext4 will force a UUID, which we do not want
-    tune2fs -U clear "${IMG}" >/dev/null
+    NEED_FSCK=1

I guess you originally had just a single fsck and used this variable to
decide if it was needed. That's actually a good idea.

Oh, I forgot to remove that variable. We can't run fsck once at the end. It has to be called after each tune2fs call.

Also, I'll rework the code as thus:

    ext_opts=""
    ext_opts_O=""
    if ! ext2rev0:
        ext_opts_O+="filetype"
    if ext3:
        ext_opts+="-j -J size=1"
    if ext4:
        ext_opts_O+="extents,uninit_bg,dir_index"
    if ext_opts_O != "":
        ext_opts+="-O ext_opts_O"
    tune2fs ext_opts img
    e2fsck img

That is even better, I think.

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.  |
'------------------------------^-------^------------------^--------------------'
#19 lore raw

PATCH 4/4 fs/ext: add support for ext2 rev0 and rev1

Quoted 24 lines · Yann E. MORIN

Arnout, All,

Quoted 3 lines · On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
Quoted 2 lines · Yann E. MORIN

Some bootloaders have a buggy ext2 support, and require ext2 rev1 instead of the traditional ext2 rev0 that genext2fs produces.

[--SNIP--]

Quoted 17 lines

fs/ext/Config.in config BR2_TARGET_ROOTFS_EXT_EXT4 · line 34

Quoted 13 lines
fs/ext/Config.in +5 -4
@@ -23,10 +27,11 @@ config BR2_TARGET_ROOTFS_EXT_EXT4
   endchoice
 
   config BR2_TARGET_ROOTFS_EXT_GEN
-	int
-	default 2 if BR2_TARGET_ROOTFS_EXT_EXT2
-	default 3 if BR2_TARGET_ROOTFS_EXT_EXT3
-	default 4 if BR2_TARGET_ROOTFS_EXT_EXT4
+	string
+	default 2.0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
+	default 2.1 if BR2_TARGET_ROOTFS_EXT_EXT2r1
+	default 3   if BR2_TARGET_ROOTFS_EXT_EXT3
+	default 4   if BR2_TARGET_ROOTFS_EXT_EXT4

I think it makes things simpler if you keep the GEN as it is, and
process the rev separately. Or perhaps set

Quoted 7 lines
Quoted 4 lines

config BR2_TARGET_ROOTFS_EXT_REV
int
default 0 if BR2_TARGET_ROOTFS_EXT_EXT2r0
default 1

Not sure. ext2 rev1 is just that: a revision 1 ext2. ext3 or ext4 rev1 do not mean anything, AFAIK.

They are partly independent - although ext4 is not possible with
rev0... And in practice you want rev1 for ext3 filesystems as well. Actually, you always want rev1, except when you have a stupid bootloader that doesn't support it.

So what I meant is: set revision to 1, except for ext2r0.

Quoted 80 lines

[--SNIP--]

Quoted 7 lines

fs/ext/genextfs.sh for o; do · line 65

Quoted 5 lines
fs/ext/genextfs.sh +5 -0
+ext_fsck() {
+    gen="${1}"
+    img="${2}"
+    ret=0
+    fsck.ext${gen} -pDf "${img}" >/dev/null || ret=$?
   Don't bother with ${gen}, just use e2fsck.

OK, I've just checked, and e2fsck's behavior does indeed not depend on its argv[0], so I'll use that.

[--SNIP--]

Quoted 4 lines

fs/ext/genextfs.sh for o; do · line 80

Quoted 2 lines
fs/ext/genextfs.sh +2 -0
+# Upgrade to ext2 rev1 if needed
+if [ ${EXT2_REV} -ge 1 -o ${GEN} -ge 3 ]; then

With BR2_TARGET_ROOTFS_EXT_REV this condition becomes simpler.

Yes, but as I said above, rev0/1 is only meaningfull for ext2, not ext3/4.

I'd rather keep the semantics clear. The ext filesystem can be:
- ext2 rev0
- ext2 rev1
- ext3
- ext4

And the fsck is only needed for ext2 rev1, ext3 or ext4.

But it is not stupid to always run the fsck anyway, so I'll simplify the code by always calling e2fsck, even if it is not strictly required. Doing so will also help catching badly generated ext2 rev0 filesystems, so it's a net gain (and does not cost too much, anyway).

Quoted 19 lines
Quoted 19 lines
fs/ext/genextfs.sh +5 -6
+    tune2fs -O filetype "${IMG}" >/dev/null
+    ext_fsck 2 "${IMG}"
+fi
+
   # Upgrade to ext3 if needed
   if [ ${GEN} -ge 3 ]; then
       tune2fs -j -J size=1 "${IMG}" >/dev/null
+    ext_fsck 3 "${IMG}"
   fi
 
   # Upgrade to ext4 if needed
   if [ ${GEN} -ge 4 ]; then
       tune2fs -O extents,uninit_bg,dir_index "${IMG}" >/dev/null
-    ret=0
-    fsck.ext4 -pDf "${IMG}" >/dev/null || ret=$?
-    # Exit codes 1 & 2 are OK, it means fs errors
-    # were successfully corrected
-    case ${ret} in
-	0|1|2) ;;
Quoted 8 lines

fs/ext/genextfs.sh for o; do · line 94

Quoted 5 lines
fs/ext/genextfs.sh +1 -4
-	*)   exit 1;;
-    esac
-    # fsck.ext4 will force a UUID, which we do not want
-    tune2fs -U clear "${IMG}" >/dev/null
+    NEED_FSCK=1

I guess you originally had just a single fsck and used this variable to
decide if it was needed. That's actually a good idea.

Oh, I forgot to remove that variable. We can't run fsck once at the end. It has to be called after each tune2fs call.

Also, I'll rework the code as thus:

     ext_opts=""
     ext_opts_O=""
     if ! ext2rev0:
         ext_opts_O+="filetype"
     if ext3:
         ext_opts+="-j -J size=1"
     if ext4:
         ext_opts_O+="extents,uninit_bg,dir_index"
     if ext_opts_O != "":
         ext_opts+="-O ext_opts_O"
     tune2fs ext_opts img
     e2fsck img
Quoted 1 line

That is even better, I think.

Agreed! Moving to Python is certainly better! :-)

BTW doesn't tune2fs support -O x -O y options?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#20 lore raw

PATCH 4/4 fs/ext: add support for ext2 rev0 and rev1

Arnout, All,

Quoted 1 line · On Wednesday 20 February 2013 Arnout Vandecappelle wrote:

On 19/02/13 19:10, Yann E. MORIN wrote:

[--SNIP--]

Quoted 8 lines
Quoted 2 lines

Not sure. ext2 rev1 is just that: a revision 1 ext2. ext3 or ext4 rev1 do not mean anything, AFAIK.

They are partly independent - although ext4 is not possible with
rev0... And in practice you want rev1 for ext3 filesystems as well. Actually, you always want rev1, except when you have a stupid bootloader that doesn't support it.

So what I meant is: set revision to 1, except for ext2r0.

Even ext3 is always rev1, anyway.

Anyway, I've reworked the code, and am doing some tests. On track for being pushed by the end of the week...

[--SNIP--]

Quoted 15 lines
Quoted 15 lines

Also, I'll rework the code as thus:

     ext_opts=""
     ext_opts_O=""
     if ! ext2rev0:
         ext_opts_O+="filetype"
     if ext3:
         ext_opts+="-j -J size=1"
     if ext4:
         ext_opts_O+="extents,uninit_bg,dir_index"
     if ext_opts_O != "":
         ext_opts+="-O ext_opts_O"
     tune2fs ext_opts img
     e2fsck img
Quoted 5 lines
Quoted 1 line

That is even better, I think.

Agreed! Moving to Python is certainly better! :-)

BTW doesn't tune2fs support -O x -O y options?

Yes, probably, that was just a quick-and-dirty pseudo code for the sake of illustration. ;-)

Regards,
Yann E. MORIN, going to sleep in a short while...

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.  |
'------------------------------^-------^------------------^--------------------'