Files
buildroot/fs/xfs/xfs.mk
Julien Olivain ffaccc4ccc fs/xfs: add support for generating a xfs image
mkfs.xfs is able to populate a filesystem from a directory since
upstream commit [1], included since v6.17.

With this option, it is now possible to create XFS rootfs in
Buildroot. This commit adds this new feature.

[1] https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=8a4ea72724930cfe262ccda03028264e1a81b145

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2026-03-13 23:30:02 +01:00

34 lines
1.0 KiB
Makefile

################################################################################
#
# Build the xfs root filesystem image
#
################################################################################
ROOTFS_XFS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_XFS_SIZE))
ifeq ($(BR2_TARGET_ROOTFS_XFS)-$(ROOTFS_XFS_SIZE),y-)
$(error BR2_TARGET_ROOTFS_XFS_SIZE cannot be empty)
endif
ROOTFS_XFS_MKFS_OPTS = $(call qstrip,$(BR2_TARGET_ROOTFS_XFS_MKFS_OPTIONS))
# qstrip results in stripping consecutive spaces into a single one. So the
# variable is not qstrip-ed to preserve the integrity of the string value.
ROOTFS_XFS_LABEL = $(subst ",,$(BR2_TARGET_ROOTFS_XFS_LABEL))
#" comment to balance quotes/parenthesis for syntax highlighting)
ROOTFS_XFS_OPTS = \
-f \
-p '$(TARGET_DIR)' \
-L '$(ROOTFS_XFS_LABEL)' \
$(ROOTFS_XFS_MKFS_OPTS)
ROOTFS_XFS_DEPENDENCIES = host-xfsprogs
define ROOTFS_XFS_CMD
$(RM) -f $@
truncate -s $(ROOTFS_XFS_SIZE) $@
$(HOST_DIR)/sbin/mkfs.xfs $(ROOTFS_XFS_OPTS) $@
endef
$(eval $(rootfs))