aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/f2fs.mk
blob: 558cddf233259bb2a30beae18ab7ba0139ef8f6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
################################################################################
#
# Build the f2fs root filesystem image
#
################################################################################

F2FS_SIZE = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_SIZE))
ifeq ($(BR2_TARGET_ROOTFS_F2FS)-$(F2FS_SIZE),y-)
$(error BR2_TARGET_ROOTFS_F2FS_SIZE cannot be empty)
endif

# 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.
F2FS_LABEL := $(subst ",,$(BR2_TARGET_ROOTFS_F2FS_LABEL))
# ")
F2FS_COLD_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_F2FS_COLD_FILES))

ifneq ($(BR2_TARGET_ROOTFS_F2FS_OVERPROVISION),0)
F2FS_OVERPROVISION = $(BR2_TARGET_ROOTFS_F2FS_OVERPROVISION)
endif

ifeq ($(BR2_TARGET_ROOTFS_F2FS_DISCARD),y)
F2FS_DISCARD = 1
else
F2FS_DISCARD = 0
endif

F2FS_OPTS = \
	-f \
	-l "$(F2FS_LABEL)" \
	-t $(F2FS_DISCARD) \
	$(if $(F2FS_COLD_FILES),-e "$(F2FS_COLD_FILES)") \
	$(if $(F2FS_OVERPROVISION),-o $(F2FS_OVERPROVISION))

ROOTFS_F2FS_DEPENDENCIES = host-f2fs-tools

define ROOTFS_F2FS_CMD
	$(RM) -f $@
	truncate -s $(F2FS_SIZE) $@
	$(HOST_DIR)/sbin/mkfs.f2fs $(F2FS_OPTS) $@
	$(HOST_DIR)/sbin/sload.f2fs -f $(TARGET_DIR) $@
endef

$(eval $(rootfs))