fs/ext2: use mkfs to generate rootfs image
authorSébastien Szymanski <sebastien.szymanski@armadeus.com>
Tue, 4 Jul 2017 14:47:26 +0000 (16:47 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 4 Jul 2017 22:39:38 +0000 (00:39 +0200)
mkfs is now capable of generating rootfs images. Use mkfs instead of
genext2fs.

If not set, we now let mkfs calculate the block size and the number of
inodes needed.

This change also adjusts the options to meet those of mkfs.

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

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[Thomas: don't pass PATH when calling mkfs.ext, just call it directly
from $(HOST_DIR)/usr/sbin, as suggested by Arnout.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
fs/ext2/Config.in
fs/ext2/ext2.mk

index ec1b5f2c55a52291b857450746afe3a3140ad939..9c58ac62ed1b9f79bc5b0c7995ea2d2bbf4a8475 100644 (file)
@@ -1,6 +1,6 @@
 config BR2_TARGET_ROOTFS_EXT2
        bool "ext2/3/4 root filesystem"
-       select BR2_PACKAGE_HOST_MKE2IMG
+       select BR2_PACKAGE_HOST_E2FSPROGS
        help
          Build an ext2/3/4 root filesystem
 
index 8a648dd66c73a3aef175f1b8a7bf15b30ea97cc5..ff04b78efbebb1193c2ed49ee6c179b9a272d0ad 100644 (file)
@@ -10,18 +10,18 @@ EXT2_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_LABEL))
 #" Syntax highlighting... :-/ )
 
 EXT2_OPTS = \
-       -G $(BR2_TARGET_ROOTFS_EXT2_GEN) \
-       -R $(BR2_TARGET_ROOTFS_EXT2_REV) \
-       -B 1024 \
-       -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS) \
-       -i $(BR2_TARGET_ROOTFS_EXT2_INODES) \
-       -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
-       -l "$(EXT2_LABEL)"
+       -d $(TARGET_DIR) \
+       -r $(BR2_TARGET_ROOTFS_EXT2_REV) \
+       -N $(BR2_TARGET_ROOTFS_EXT2_INODES) \
+       -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS) \
+       -L "$(EXT2_LABEL)"
 
-ROOTFS_EXT2_DEPENDENCIES = host-mke2img
+ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
 
 define ROOTFS_EXT2_CMD
-       PATH=$(BR_PATH) mke2img -d $(TARGET_DIR) $(EXT2_OPTS) -o $@
+       rm -f $@
+       $(HOST_DIR)/usr/sbin/mkfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN) $(EXT2_OPTS) $@ \
+                $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endef
 
 rootfs-ext2-symlink: