diff --git a/Makefile b/Makefile index c6725a1..02c67a4 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,20 @@ TARGET = lfs +ifndef OS OS := $(shell uname -s) +endif +ifndef CC CC = cc +endif + +ifndef AR AR = ar +endif + +ifndef SIZE SIZE = size +endif SRC += $(wildcard *.c littlefs/*.c) OBJ := $(SRC:.c=.o) @@ -28,6 +38,10 @@ override CFLAGS += -DLFS_MULTIVERSION # enable migrate support in littlefs override CFLAGS += -DLFS_MIGRATE +ifdef DEFAULT_LFS_BLOCK_SIZE +override CFLAGS += -DDEFAULT_LFS_BLOCK_SIZE=$(DEFAULT_LFS_BLOCK_SIZE) +endif + override LFLAGS += -lfuse ifeq ($(OS), FreeBSD) diff --git a/lfs_fuse_bd.c b/lfs_fuse_bd.c index d01a21f..a58cb2e 100644 --- a/lfs_fuse_bd.c +++ b/lfs_fuse_bd.c @@ -30,6 +30,13 @@ int lfs_fuse_bd_create(struct lfs_config *cfg, const char *path) { } cfg->context = (void*)(intptr_t)fd; + // use sector size from build override +#ifdef DEFAULT_LFS_BLOCK_SIZE + if (!cfg->block_size) { + cfg->block_size = DEFAULT_LFS_BLOCK_SIZE; + } +#endif + // get sector size if (!cfg->block_size) { long ssize;