fs/ext2: use mkfs to generate rootfs image

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>
This commit is contained in:
Sébastien Szymanski 2017-07-04 16:47:26 +02:00 committed by Thomas Petazzoni
parent 235b6f17a0
commit 67aaa90d3b
2 changed files with 10 additions and 10 deletions

View 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

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