All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [pull request 'next'] Pull request for branch yem-ext234
@ 2013-02-17 23:10 Yann E. MORIN
  2013-02-17 23:10 ` [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif Yann E. MORIN
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-17 23:10 UTC (permalink / raw)
  To: buildroot

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

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

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

* [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif
  2013-02-17 23:10 [Buildroot] [pull request 'next'] Pull request for branch yem-ext234 Yann E. MORIN
@ 2013-02-17 23:10 ` Yann E. MORIN
  2013-02-18  7:30   ` Arnout Vandecappelle
  2013-02-17 23:10 ` [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too Yann E. MORIN
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-17 23:10 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/ext2/Config.in |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index 2af44a8..cb4beed 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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
-- 
1.7.2.5

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-17 23:10 [Buildroot] [pull request 'next'] Pull request for branch yem-ext234 Yann E. MORIN
  2013-02-17 23:10 ` [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif Yann E. MORIN
@ 2013-02-17 23:10 ` Yann E. MORIN
  2013-02-19  7:04   ` Arnout Vandecappelle
  2013-02-17 23:10 ` [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems Yann E. MORIN
  2013-02-17 23:10 ` [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1 Yann E. MORIN
  3 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-17 23:10 UTC (permalink / raw)
  To: buildroot

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/ext2/Config.in    |   37 ++++++++++++++++++++++++++++++-------
 fs/ext2/ext2.mk      |    4 ++--
 fs/ext2/genext2fs.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
index cb4beed..00f11a2 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext2/Config.in
@@ -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
 
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 7b71592..80ad93f 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -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))
diff --git a/fs/ext2/genext2fs.sh b/fs/ext2/genext2fs.sh
index 7a518ae..fcbd43c 100755
--- a/fs/ext2/genext2fs.sh
+++ b/fs/ext2/genext2fs.sh
@@ -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 ];
@@ -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
+    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
+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 "$@"
+
+# Upgrade to ext3 if needed
+if [ ${GEN} -ge 3 ]; then
+    tune2fs -j -J size=1 "${IMG}" >/dev/null
+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
+fi
-- 
1.7.2.5

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-17 23:10 [Buildroot] [pull request 'next'] Pull request for branch yem-ext234 Yann E. MORIN
  2013-02-17 23:10 ` [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif Yann E. MORIN
  2013-02-17 23:10 ` [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too Yann E. MORIN
@ 2013-02-17 23:10 ` Yann E. MORIN
  2013-02-19  7:20   ` Arnout Vandecappelle
  2013-02-17 23:10 ` [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1 Yann E. MORIN
  3 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-17 23:10 UTC (permalink / raw)
  To: buildroot

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

diff --git a/board/arm/foundation-v8/readme.txt b/board/arm/foundation-v8/readme.txt
index 7f419a0..9812fe0 100644
--- a/board/arm/foundation-v8/readme.txt
+++ b/board/arm/foundation-v8/readme.txt
@@ -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
diff --git a/board/boundarydevices/nitrogen6x/readme.txt b/board/boundarydevices/nitrogen6x/readme.txt
index 6e9b95c..896228f 100644
--- a/board/boundarydevices/nitrogen6x/readme.txt
+++ b/board/boundarydevices/nitrogen6x/readme.txt
@@ -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.
diff --git a/board/qemu/arm-versatile/readme.txt b/board/qemu/arm-versatile/readme.txt
index 51364c7..b2dc3c3 100644
--- a/board/qemu/arm-versatile/readme.txt
+++ b/board/qemu/arm-versatile/readme.txt
@@ -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.
diff --git a/board/qemu/arm-vexpress/readme.txt b/board/qemu/arm-vexpress/readme.txt
index c74bfcd..8a86a3d 100644
--- a/board/qemu/arm-vexpress/readme.txt
+++ b/board/qemu/arm-vexpress/readme.txt
@@ -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.
diff --git a/board/qemu/mips-malta/readme.txt b/board/qemu/mips-malta/readme.txt
index d3d8446..af5e055 100644
--- a/board/qemu/mips-malta/readme.txt
+++ b/board/qemu/mips-malta/readme.txt
@@ -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
diff --git a/board/qemu/mips64-malta/readme.txt b/board/qemu/mips64-malta/readme.txt
index 1d6ff10..ba360c2 100644
--- a/board/qemu/mips64-malta/readme.txt
+++ b/board/qemu/mips64-malta/readme.txt
@@ -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
diff --git a/board/qemu/mipsel-malta/readme.txt b/board/qemu/mipsel-malta/readme.txt
index 8dd4024..24be4a1 100644
--- a/board/qemu/mipsel-malta/readme.txt
+++ b/board/qemu/mipsel-malta/readme.txt
@@ -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
diff --git a/board/qemu/powerpc-g3beige/readme.txt b/board/qemu/powerpc-g3beige/readme.txt
index 05aa380..e047c8e 100644
--- a/board/qemu/powerpc-g3beige/readme.txt
+++ b/board/qemu/powerpc-g3beige/readme.txt
@@ -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.
diff --git a/board/qemu/sh4-r2d/readme.txt b/board/qemu/sh4-r2d/readme.txt
index 9ae7496..061e644 100644
--- a/board/qemu/sh4-r2d/readme.txt
+++ b/board/qemu/sh4-r2d/readme.txt
@@ -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.
diff --git a/board/qemu/sparc-ss10/readme.txt b/board/qemu/sparc-ss10/readme.txt
index 4290c55..2ad8edc 100644
--- a/board/qemu/sparc-ss10/readme.txt
+++ b/board/qemu/sparc-ss10/readme.txt
@@ -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.
diff --git a/board/qemu/x86/readme.txt b/board/qemu/x86/readme.txt
index 4342556..1e34972 100644
--- a/board/qemu/x86/readme.txt
+++ b/board/qemu/x86/readme.txt
@@ -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.
 
diff --git a/board/qemu/x86_64/readme.txt b/board/qemu/x86_64/readme.txt
index 7d3c6c5..c044eba 100644
--- a/board/qemu/x86_64/readme.txt
+++ b/board/qemu/x86_64/readme.txt
@@ -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.
 
diff --git a/configs/arm_foundationv8_defconfig b/configs/arm_foundationv8_defconfig
index 7a50b1a..f3bcb32 100644
--- a/configs/arm_foundationv8_defconfig
+++ b/configs/arm_foundationv8_defconfig
@@ -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"
diff --git a/configs/beaglebone_defconfig b/configs/beaglebone_defconfig
index e19cdcb..6fd9e4e 100644
--- a/configs/beaglebone_defconfig
+++ b/configs/beaglebone_defconfig
@@ -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
diff --git a/configs/mx53loco_defconfig b/configs/mx53loco_defconfig
index ff3948b..504f506 100644
--- a/configs/mx53loco_defconfig
+++ b/configs/mx53loco_defconfig
@@ -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
diff --git a/configs/nitrogen6x_defconfig b/configs/nitrogen6x_defconfig
index e3a78c7..492ed2c 100644
--- a/configs/nitrogen6x_defconfig
+++ b/configs/nitrogen6x_defconfig
@@ -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
diff --git a/configs/pandaboard_defconfig b/configs/pandaboard_defconfig
index 9496b7f..2fe2610 100644
--- a/configs/pandaboard_defconfig
+++ b/configs/pandaboard_defconfig
@@ -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
diff --git a/configs/qemu_arm_versatile_defconfig b/configs/qemu_arm_versatile_defconfig
index cbd7dd1..27b9f26 100644
--- a/configs/qemu_arm_versatile_defconfig
+++ b/configs/qemu_arm_versatile_defconfig
@@ -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
diff --git a/configs/qemu_arm_vexpress_defconfig b/configs/qemu_arm_vexpress_defconfig
index 8ff5a46..8e80342 100644
--- a/configs/qemu_arm_vexpress_defconfig
+++ b/configs/qemu_arm_vexpress_defconfig
@@ -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
diff --git a/configs/qemu_mips64_malta_defconfig b/configs/qemu_mips64_malta_defconfig
index b8ca948..46642d3 100644
--- a/configs/qemu_mips64_malta_defconfig
+++ b/configs/qemu_mips64_malta_defconfig
@@ -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
diff --git a/configs/qemu_mips_malta_defconfig b/configs/qemu_mips_malta_defconfig
index 6b034f6..35f9426 100644
--- a/configs/qemu_mips_malta_defconfig
+++ b/configs/qemu_mips_malta_defconfig
@@ -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
diff --git a/configs/qemu_mipsel_malta_defconfig b/configs/qemu_mipsel_malta_defconfig
index adaaedd..95b1817 100644
--- a/configs/qemu_mipsel_malta_defconfig
+++ b/configs/qemu_mipsel_malta_defconfig
@@ -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
diff --git a/configs/qemu_ppc_g3beige_defconfig b/configs/qemu_ppc_g3beige_defconfig
index 080ee4d..a0c6637 100644
--- a/configs/qemu_ppc_g3beige_defconfig
+++ b/configs/qemu_ppc_g3beige_defconfig
@@ -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
diff --git a/configs/qemu_sh4_r2d_defconfig b/configs/qemu_sh4_r2d_defconfig
index 4dfccd9..fc6910f 100644
--- a/configs/qemu_sh4_r2d_defconfig
+++ b/configs/qemu_sh4_r2d_defconfig
@@ -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
diff --git a/configs/qemu_sparc_ss10_defconfig b/configs/qemu_sparc_ss10_defconfig
index 906671b..2ba1e0e 100644
--- a/configs/qemu_sparc_ss10_defconfig
+++ b/configs/qemu_sparc_ss10_defconfig
@@ -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
diff --git a/configs/qemu_x86_64_defconfig b/configs/qemu_x86_64_defconfig
index 74011fc..53d0e00 100644
--- a/configs/qemu_x86_64_defconfig
+++ b/configs/qemu_x86_64_defconfig
@@ -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
diff --git a/configs/qemu_x86_defconfig b/configs/qemu_x86_defconfig
index 2734fdb..3756b07 100644
--- a/configs/qemu_x86_defconfig
+++ b/configs/qemu_x86_defconfig
@@ -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
diff --git a/fs/Config.in b/fs/Config.in
index da4c5ff..27c6586 100644
--- a/fs/Config.in
+++ b/fs/Config.in
@@ -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"
diff --git a/fs/ext2/Config.in b/fs/ext/Config.in
similarity index 55%
rename from fs/ext2/Config.in
rename to fs/ext/Config.in
index 00f11a2..1a7a315 100644
--- a/fs/ext2/Config.in
+++ b/fs/ext/Config.in
@@ -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
diff --git a/fs/ext/ext.mk b/fs/ext/ext.mk
new file mode 100644
index 0000000..cdc22ba
--- /dev/null
+++ b/fs/ext/ext.mk
@@ -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))
diff --git a/fs/ext2/genext2fs.sh b/fs/ext/genextfs.sh
similarity index 100%
rename from fs/ext2/genext2fs.sh
rename to fs/ext/genextfs.sh
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
deleted file mode 100644
index 80ad93f..0000000
--- a/fs/ext2/ext2.mk
+++ /dev/null
@@ -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))
-- 
1.7.2.5

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

* [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1
  2013-02-17 23:10 [Buildroot] [pull request 'next'] Pull request for branch yem-ext234 Yann E. MORIN
                   ` (2 preceding siblings ...)
  2013-02-17 23:10 ` [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems Yann E. MORIN
@ 2013-02-17 23:10 ` Yann E. MORIN
  2013-02-19  7:55   ` Arnout Vandecappelle
  3 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-17 23:10 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 fs/ext/Config.in   |   19 ++++++++++++-------
 fs/ext/genextfs.sh |   38 +++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/fs/ext/Config.in b/fs/ext/Config.in
index 1a7a315..be0ed9c 100644
--- a/fs/ext/Config.in
+++ b/fs/ext/Config.in
@@ -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)"
diff --git a/fs/ext/genextfs.sh b/fs/ext/genextfs.sh
index fcbd43c..ef47a25 100755
--- a/fs/ext/genextfs.sh
+++ b/fs/ext/genextfs.sh
@@ -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
-- 
1.7.2.5

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

* [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif
  2013-02-17 23:10 ` [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif Yann E. MORIN
@ 2013-02-18  7:30   ` Arnout Vandecappelle
  0 siblings, 0 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-18  7:30 UTC (permalink / raw)
  To: buildroot

On 18/02/13 00:10, Yann E. MORIN wrote:
> Use a 'if...endif' construct instead of repeating the
> 'depends on' for each symbols.
>
> Signed-off-by: "Yann E. MORIN"<yann.morin.1998@free.fr>

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

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

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-17 23:10 ` [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too Yann E. MORIN
@ 2013-02-19  7:04   ` Arnout Vandecappelle
  2013-02-19 12:03     ` Peter Korsgaard
  2013-02-19 17:33     ` Yann E. MORIN
  0 siblings, 2 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-19  7:04 UTC (permalink / raw)
  To: buildroot

  Great feature addition!

On 18/02/13 00:10, Yann E. MORIN wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>   fs/ext2/Config.in    |   37 ++++++++++++++++++++++++++++++-------
>   fs/ext2/ext2.mk      |    4 ++--
>   fs/ext2/genext2fs.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
>   3 files changed, 78 insertions(+), 11 deletions(-)
>
> diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
> index cb4beed..00f11a2 100644
> --- a/fs/ext2/Config.in
> +++ b/fs/ext2/Config.in
> @@ -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"

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

> +	default BR2_TARGET_ROOTFS_EXT2_2

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

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

> +
> +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]
> diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
> index 7b71592..80ad93f 100644
> --- a/fs/ext2/ext2.mk
> +++ b/fs/ext2/ext2.mk
> @@ -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

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

>   endef
>
>   $(eval $(call ROOTFS_TARGET,ext2))
> diff --git a/fs/ext2/genext2fs.sh b/fs/ext2/genext2fs.sh
> index 7a518ae..fcbd43c 100755
> --- a/fs/ext2/genext2fs.sh
> +++ b/fs/ext2/genext2fs.sh
> @@ -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 ];
> @@ -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"?

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

> +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 "$@"
> +
> +# 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.

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

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

> +fi
>


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

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-17 23:10 ` [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems Yann E. MORIN
@ 2013-02-19  7:20   ` Arnout Vandecappelle
  2013-02-19 12:41     ` Peter Korsgaard
  2013-02-19 17:54     ` Yann E. MORIN
  0 siblings, 2 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-19  7:20 UTC (permalink / raw)
  To: buildroot

On 18/02/13 00:10, Yann E. MORIN wrote:
> 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.

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

  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

>   delete mode 100644 fs/ext2/ext2.mk


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

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

* [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1
  2013-02-17 23:10 ` [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1 Yann E. MORIN
@ 2013-02-19  7:55   ` Arnout Vandecappelle
  2013-02-19 18:10     ` Yann E. MORIN
  0 siblings, 1 reply; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-19  7:55 UTC (permalink / raw)
  To: buildroot

On 18/02/13 00:10, Yann E. MORIN wrote:
> Some bootloaders have a buggy ext2 support, and require ext2 rev1
> instead of the traditional ext2 rev0 that genext2fs produces.
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>   fs/ext/Config.in   |   19 ++++++++++++-------
>   fs/ext/genextfs.sh |   38 +++++++++++++++++++++++++++-----------
>   2 files changed, 39 insertions(+), 18 deletions(-)
>
> diff --git a/fs/ext/Config.in b/fs/ext/Config.in
> index 1a7a315..be0ed9c 100644
> --- a/fs/ext/Config.in
> +++ b/fs/ext/Config.in
> @@ -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

  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

>
>   config BR2_TARGET_ROOTFS_EXT_BLOCKS
>   	int "size in blocks (leave at 0 for auto calculation)"
> diff --git a/fs/ext/genextfs.sh b/fs/ext/genextfs.sh
> index fcbd43c..ef47a25 100755
> --- a/fs/ext/genextfs.sh
> +++ b/fs/ext/genextfs.sh
> @@ -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=$?

  Don't bother with ${gen}, just use e2fsck.

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

  With BR2_TARGET_ROOTFS_EXT_REV this condition becomes simpler.

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

  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

> +    ext_fsck 4 "${IMG}"
>   fi
>


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

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-19  7:04   ` Arnout Vandecappelle
@ 2013-02-19 12:03     ` Peter Korsgaard
  2013-02-19 15:33       ` Arnout Vandecappelle
  2013-02-19 17:33     ` Yann E. MORIN
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Korsgaard @ 2013-02-19 12:03 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

Hi,

 >> if BR2_TARGET_ROOTFS_EXT2
 >> 
 >> +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?

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

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

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-19  7:20   ` Arnout Vandecappelle
@ 2013-02-19 12:41     ` Peter Korsgaard
  2013-02-19 18:14       ` Yann E. MORIN
  2013-02-19 17:54     ` Yann E. MORIN
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Korsgaard @ 2013-02-19 12:41 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 Arnout> On 18/02/13 00:10, Yann E. MORIN wrote:
 >> 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.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-19 12:03     ` Peter Korsgaard
@ 2013-02-19 15:33       ` Arnout Vandecappelle
  0 siblings, 0 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-19 15:33 UTC (permalink / raw)
  To: buildroot

On 19/02/13 13:03, Peter Korsgaard wrote:
>>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:
>
> Hi,
>
>   >> if BR2_TARGET_ROOTFS_EXT2
>   >>
>   >> +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?
>
>   >> +	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.


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

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

  Regards,
  Arnout


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

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-19  7:04   ` Arnout Vandecappelle
  2013-02-19 12:03     ` Peter Korsgaard
@ 2013-02-19 17:33     ` Yann E. MORIN
  2013-02-19 19:01       ` Yann E. MORIN
  1 sibling, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 17:33 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
>   Great feature addition!

:-)

> On 18/02/13 00:10, Yann E. MORIN wrote:
[--SNIP--]
> >   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"
> 
>   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.

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

> > +
> > +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--]
> > -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.

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

Right.

> > diff --git a/fs/ext2/genext2fs.sh b/fs/ext2/genext2fs.sh
> > index 7a518ae..fcbd43c 100755
> > --- a/fs/ext2/genext2fs.sh
> > +++ b/fs/ext2/genext2fs.sh
[--SNIP--]
> > @@ -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! ;-)

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

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

> > +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 "$@"
> > +
> > +# 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.

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

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

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

>   You should add a comment why fsck is needed.

I'll do.

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

> > +    # 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.

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

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-19  7:20   ` Arnout Vandecappelle
  2013-02-19 12:41     ` Peter Korsgaard
@ 2013-02-19 17:54     ` Yann E. MORIN
  1 sibling, 0 replies; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 17:54 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
> On 18/02/13 00:10, Yann E. MORIN wrote:
> > 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.

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

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

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

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

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

* [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1
  2013-02-19  7:55   ` Arnout Vandecappelle
@ 2013-02-19 18:10     ` Yann E. MORIN
  2013-02-19 23:40       ` Arnout Vandecappelle
  0 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 18:10 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
> On 18/02/13 00:10, Yann E. MORIN wrote:
> > Some bootloaders have a buggy ext2 support, and require ext2 rev1
> > instead of the traditional ext2 rev0 that genext2fs produces.
[--SNIP--]
> > @@ -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
> 
> 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--]
> > +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--]
> > +# 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).

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

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

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-19 12:41     ` Peter Korsgaard
@ 2013-02-19 18:14       ` Yann E. MORIN
  2013-02-19 20:48         ` Peter Korsgaard
  0 siblings, 1 reply; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 18:14 UTC (permalink / raw)
  To: buildroot

Peter, Arnout, All,

On Tuesday 19 February 2013 Peter Korsgaard wrote:
> >>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:
> 
>  Arnout> On 18/02/13 00:10, Yann E. MORIN wrote:
>  >> 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.

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.

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

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

* [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too
  2013-02-19 17:33     ` Yann E. MORIN
@ 2013-02-19 19:01       ` Yann E. MORIN
  0 siblings, 0 replies; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 19:01 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On Tuesday 19 February 2013 Yann E. MORIN wrote:
> On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
[--SNIP--]
> > > +# 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.

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

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-19 18:14       ` Yann E. MORIN
@ 2013-02-19 20:48         ` Peter Korsgaard
  2013-02-21 22:37           ` Yann E. MORIN
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Korsgaard @ 2013-02-19 20:48 UTC (permalink / raw)
  To: buildroot

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

 Yann> Peter, Arnout, All,
 Yann> On Tuesday 19 February 2013 Peter Korsgaard wrote:
 >> >>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:
 >> 
 Arnout> On 18/02/13 00:10, Yann E. MORIN wrote:
 >> >> 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.

 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.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1
  2013-02-19 18:10     ` Yann E. MORIN
@ 2013-02-19 23:40       ` Arnout Vandecappelle
  2013-02-19 23:47         ` Yann E. MORIN
  0 siblings, 1 reply; 21+ messages in thread
From: Arnout Vandecappelle @ 2013-02-19 23:40 UTC (permalink / raw)
  To: buildroot

On 19/02/13 19:10, Yann E. MORIN wrote:
> Arnout, All,
>
> On Tuesday 19 February 2013 Arnout Vandecappelle wrote:
>> On 18/02/13 00:10, Yann E. MORIN wrote:
>>> Some bootloaders have a buggy ext2 support, and require ext2 rev1
>>> instead of the traditional ext2 rev0 that genext2fs produces.
> [--SNIP--]
>>> @@ -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
>>
>> 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.

>
> [--SNIP--]
>>> +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--]
>>> +# 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).
>
>>> +    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
>>
>>    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.

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

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

  Regards,
  Arnout

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

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

* [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1
  2013-02-19 23:40       ` Arnout Vandecappelle
@ 2013-02-19 23:47         ` Yann E. MORIN
  0 siblings, 0 replies; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-19 23:47 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On Wednesday 20 February 2013 Arnout Vandecappelle wrote:
> On 19/02/13 19:10, Yann E. MORIN wrote:
[--SNIP--]
> > 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--]
> > 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.
> 
>   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...

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

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

* [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems
  2013-02-19 20:48         ` Peter Korsgaard
@ 2013-02-21 22:37           ` Yann E. MORIN
  0 siblings, 0 replies; 21+ messages in thread
From: Yann E. MORIN @ 2013-02-21 22:37 UTC (permalink / raw)
  To: buildroot

Peter, Arnout, All,

On Tuesday 19 February 2013 Peter Korsgaard wrote:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> 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.

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

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

end of thread, other threads:[~2013-02-21 22:37 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-17 23:10 [Buildroot] [pull request 'next'] Pull request for branch yem-ext234 Yann E. MORIN
2013-02-17 23:10 ` [Buildroot] [PATCH 1/4] fs/ext2: enclose the ext2 options in if...endif Yann E. MORIN
2013-02-18  7:30   ` Arnout Vandecappelle
2013-02-17 23:10 ` [Buildroot] [PATCH 2/4] fs/ext2: add ability to build ext3/4 too Yann E. MORIN
2013-02-19  7:04   ` Arnout Vandecappelle
2013-02-19 12:03     ` Peter Korsgaard
2013-02-19 15:33       ` Arnout Vandecappelle
2013-02-19 17:33     ` Yann E. MORIN
2013-02-19 19:01       ` Yann E. MORIN
2013-02-17 23:10 ` [Buildroot] [PATCH 3/4] fs/ext2: rename to 'ext' as it can now build ext2/3/4 filesystems Yann E. MORIN
2013-02-19  7:20   ` Arnout Vandecappelle
2013-02-19 12:41     ` Peter Korsgaard
2013-02-19 18:14       ` Yann E. MORIN
2013-02-19 20:48         ` Peter Korsgaard
2013-02-21 22:37           ` Yann E. MORIN
2013-02-19 17:54     ` Yann E. MORIN
2013-02-17 23:10 ` [Buildroot] [PATCH 4/4] fs/ext: add support for ext2 rev0 and rev1 Yann E. MORIN
2013-02-19  7:55   ` Arnout Vandecappelle
2013-02-19 18:10     ` Yann E. MORIN
2013-02-19 23:40       ` Arnout Vandecappelle
2013-02-19 23:47         ` Yann E. MORIN

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.