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

Detlev Zundel dzu at denx.de
Fri Apr 23 17:06:53 CEST 2010


Hi Stefano,

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

Thanks, but I have some doubts.  It is very hard to come up with good
defaults for the values we need here, so either we attach a big warning
at all options or default them to 0 and generate an error when trying to
generate the filesystem telling the user what he has to do to find the
correct values.

Specifiying arbitrary values here is a recipe for disaster.

What do you think?

> 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

So maybe add a comment that this parameter depends on the actual device
being used?  For nor-flash it is 1, for nand maybe add some comment that
the correct setting can be found by running "mtdinfo -u" on the target
system?

Maybe even include this URL:

http://www.linux-mtd.infradead.org/doc/ubi.html#L_min_io_unit

> +
> +config UBIFS_LEB_SIZE
> +       depends IMAGE_UBIFS
> +       int "Default ubi leb size"
> +       default 16384
> +       help
> +         Default leb size as reported by mtdinfo utility

Again, please add a comment that the default very likely is not correct.

> +
> +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)

Or include a 0 check here and throw an instruction on how to find the
parameters.....

Cheers
  Detlev

-- 
Zivilisation ist der Zaubertrick, der uns unsere wahre Natur verbirgt.
                                            -- Salman Rushdie
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the eldk mailing list