[ELDK] [PATCH RFSB] Add generation of ubifs image

Stefano Babic sbabic at denx.de
Fri Apr 23 13:11:00 CEST 2010


Add generation of a ubifs image. The resulting image
can be copied into the flash using the u-boot
"ubi writevol" command.

Signed-off-by: Stefano Babic <sbabic at denx.de>
---
 Config.in |   28 ++++++++++++++++++++++++++++
 Makefile  |   13 +++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/Config.in b/Config.in
index 8aed288..d4f8bf8 100644
--- a/Config.in
+++ b/Config.in
@@ -128,6 +128,34 @@ config JFFS2_ERASE_BLOCKSIZE
          going to be used on.  On NOR flashes nowadays this is usally
          greater than 64k, whereas NAND usually has 16k today.
 
+config IMAGE_UBIFS
+       bool "Create UBIFS image"
+       default n
+       help
+         Create a UBIFS image
+
+config UBIFS_MIN_IO_SIZE
+       depends IMAGE_UBIFS
+       int "minimum I/O unit size"
+       default 2048
+       help
+         Minimum I/O size for the MTD device
+
+config UBIFS_LEB_SIZE
+       depends IMAGE_UBIFS
+       int "Default ubi leb size"
+       default 16384
+       help
+         Default leb size as reported by mtdinfo utility
+
+config UBIFS_MAX_LEB_COUNT
+       depends IMAGE_UBIFS
+       int "Max number leb"
+       default 512
+       help
+         This option defines the maximum file-system size
+	 (more strictly, maximum UBI volume size)
+
 config IMAGE_CRAMFS
        bool "Create CRamFS image"
        default n
diff --git a/Makefile b/Makefile
index 347f7d8..ebed54a 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ BUILD_RFS         := $(BUILD)/rootfs
 EXT2_FILE         := $(BUILD)/images/image.ext2
 URAMDISK_FILE     := $(BUILD)/images/uRamdisk
 JFFS2_FILE        := $(BUILD)/images/image.jffs2
+UBIFS_FILE        := $(BUILD)/images/image.ubifs
 CRAMFS_FILE       := $(BUILD)/images/image.cramfs
 SQFS_DEV_TAB      := $(BUILD)/images/squashfs_devices.tab
 SQUASHFS_FILE     := $(BUILD)/images/image.squashfs
@@ -95,7 +96,7 @@ ifeq ($(strip $$($(2))),y)
 endif
 endef
 image_targets = 
-IMAGE_CONFIGS = EXT2 URAMDISK JFFS2 CRAMFS SQUASHFS
+IMAGE_CONFIGS = EXT2 URAMDISK JFFS2 CRAMFS SQUASHFS UBIFS
 $(foreach img,$(IMAGE_CONFIGS),$(eval $(call ADD_CONDITIONAL,image_targets,IMAGE_$(img),$$($(img)_FILE))))
 $(info Current target list is $(image_targets))
 
@@ -246,7 +247,7 @@ pkgs_clean:	$(TARGETS_CLEAN)
 ############################################################
 # Image targets below
 ############################################################
-.PHONY:	image_ext2 image_jffs2 image_uramdisk image_cramfs
+.PHONY:	image_ext2 image_jffs2 image_uramdisk image_cramfs ubifs_image
 
 image_ext2:	$(EXT2_FILE)
 
@@ -263,6 +264,14 @@ $(JFFS2_FILE):	$(STAMP_ROOTFS)
 	mkfs.jffs2 $(JFFS2_FLAGS) -d $(BUILD_RFS) -e $(JFFS2_ERASE_BLOCKSIZE) -D $(DEV_TAB) \
 	 -o $(JFFS2_FILE)
 
+image_ubifs:	$(UBIFS_FILE)
+
+$(UBIFS_FILE):	$(STAMP_ROOTFS)
+	@echo Generating UBIFS image
+	mkfs.ubifs $(UBIFS_FLAGS) --root=$(BUILD_RFS) --leb-size=$(UBIFS_LEB_SIZE) \
+		--min-io-size=$(UBIFS_MIN_IO_SIZE) \
+		--max-leb-cnt=$(UBIFS_MAX_LEB_COUNT) -o $(UBIFS_FILE)
+
 image_uramdisk:	$(URAMDISK_FILE)
 
 $(URAMDISK_FILE):	$(EXT2_FILE)
-- 
1.6.3.3



More information about the eldk mailing list