mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-27 15:33:28 +08:00
f023810f04
btrfs will happily use an existing destination file if it already exists, increasing its size if needed. Hoever, it will never decrease the size, even if the requested size is smaller than the existing file. So, remove any previously existing destination file before generating the new filesystem. Note: the original submission by Robert did that, but as this case was not obvious, the removal was dropped by a refactoring when the patch was initially applied. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Robert J. Heywood <robert.heywood@codethink.co.uk> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [Thomas: use $@ instead of $(@), use $(RM) instead of rm.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
37 lines
1.2 KiB
Makefile
37 lines
1.2 KiB
Makefile
################################################################################
|
|
#
|
|
# Build the btrfs root filesystem image
|
|
#
|
|
################################################################################
|
|
|
|
BTRFS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE))
|
|
ifeq ($(BR2_TARGET_ROOTFS_BTRFS)-$(BTRFS_SIZE),y-)
|
|
$(error BR2_TARGET_ROOTFS_BTRFS_SIZE cannot be empty)
|
|
endif
|
|
|
|
BTRFS_SIZE_NODE = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE_NODE))
|
|
BTRFS_SIZE_SECTOR = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_SIZE_SECTOR))
|
|
BTRFS_FEATURES = $(call qstrip,$(BR2_TARGET_ROOTFS_BTRFS_FEATURES))
|
|
# 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.
|
|
BTRFS_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_BTRFS_LABEL))
|
|
# ")
|
|
|
|
BTRFS_OPTS = \
|
|
-f \
|
|
-r '$(TARGET_DIR)' \
|
|
-L '$(BTRFS_LABEL)' \
|
|
--byte-count '$(BTRFS_SIZE)' \
|
|
$(if $(BTRFS_SIZE_NODE),--nodesize '$(BTRFS_SIZE_NODE)') \
|
|
$(if $(BTRFS_SIZE_SECTOR),--sectorsize '$(BTRFS_SIZE_SECTOR)') \
|
|
$(if $(BTRFS_FEATURES),--features '$(BTRFS_FEATURES)')
|
|
|
|
ROOTFS_BTRFS_DEPENDENCIES = host-btrfs-progs
|
|
|
|
define ROOTFS_BTRFS_CMD
|
|
$(RM) -f $@
|
|
$(HOST_DIR)/bin/mkfs.btrfs $(BTRFS_OPTS) $@
|
|
endef
|
|
|
|
$(eval $(rootfs))
|