2011-06-20 04:47:02     Flash erase size for jffs2 in 2010 distribution

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-20 04:47:02     Flash erase size for jffs2 in 2010 distribution

Shyam sundar (INDIA)

Message: 101470   

 

Hello world,

 

I am trying use the jffs2file system for 2010 distribution,

 

My flash size is 16 MB and flash sector erase size is 4KB.

 

In the uclinux/2010R1/vendors/RITCoE/vendor.mak file, I have specified the erase size to be 4KB

 

AUDIO_ROMFS_BASE = $(IMAGEDIR)/audio

AUDIODIR=/home/shyam/Desktop/uc2010/uclinux/2010R1/messages

.PHONY: image.rootfs.jffs2 image.rootfs.jffs2.force

ERASE_SIZE ?= 4096

MKFS_JFFS2_FLAGS ?= -l -p -e $(ERASE_SIZE)

image.rootfs.jffs2.force:

    $(MKFS_JFFS2) $(MKFS_JFFS2_FLAGS) -d $(ROMFSDIR) -D $(DEVICE_TABLE) -o $(IMAGE_ROMFS_BASE).jffs2

    $(MKFS_JFFS2) $(MKFS_JFFS2_FLAGS) -d $(AUDIODIR) -D $(DEVICE_TABLE) -o $(AUDIO_ROMFS_BASE).jffs2

ifeq ($(CONFIG_JFFS2_FS),y)

image.rootfs.jffs2: image.rootfs.jffs2.force

endif

 

But during compiling the kernel i do get the following message.

 

make[4]: Entering directory `/home/shyam/Desktop/uc2010/uclinux/2010R1/vendors/RITCoE/BF531-DWAS'

mkdir -p /home/shyam/Desktop/uc2010/uclinux/2010R1/images

rm -rf /home/shyam/Desktop/uc2010/uclinux/2010R1/images/*

make image.rootfs.all

make[5]: Entering directory `/home/shyam/Desktop/uc2010/uclinux/2010R1/vendors/RITCoE/BF531-DWAS'

/bin/bash /home/shyam/Desktop/uc2010/uclinux/2010R1/linux-2.6.x/scripts/gen_initramfs_list.sh -u squash -g squash /home/shyam/Desktop/uc2010/uclinux/2010R1/romfs > /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs.contents

awk -f /home/shyam/Desktop/uc2010/uclinux/2010R1/tools/dev-table-to-cpio.awk device_table-min.txt >> /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs.contents

echo "slink /init /sbin/init 0755 0 0" >> /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs.contents

/home/shyam/Desktop/uc2010/uclinux/2010R1/linux-2.6.x/usr/gen_init_cpio /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs.contents > /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs

gzip -c -9 /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs > /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.initramfs.gz

/home/shyam/Desktop/uc2010/uclinux/2010R1/user/mtd-utils/mkfs.jffs2 -l -p -e 4096 -d /home/shyam/Desktop/uc2010/uclinux/2010R1/romfs -D device_table-min.txt -o /home/shyam/Desktop/uc2010/uclinux/2010R1/images/rootfs.jffs2

Erase size 0x1000 too small. Increasing to 8KiB minimum

/home/shyam/Desktop/uc2010/uclinux/2010R1/user/mtd-utils/mkfs.jffs2 -l -p -e 4096 -d /home/shyam/Desktop/uc2010/uclinux/2010R1/messages -D device_table-min.txt -o /home/shyam/Desktop/uc2010/uclinux/2010R1/images/audio.jffs2

Erase size 0x1000 too small. Increasing to 8KiB minimum

make[5]: Leaving directory `/home/shyam/Desktop/uc2010/uclinux/2010R1/vendors/RITCoE/BF531-DWAS'

 

When i try to mount the audio.jffs2 image in the specified partition,I do get message

 

Perhaps the file system was created with the wrong erase size?

 

What could be the problem?

QuoteReplyEditDelete

 

 

2011-06-20 11:54:41     Re: Flash erase size for jffs2 in 2010 distribution

Mike Frysinger (UNITED STATES)

Message: 101490   

 

this is how jffs2 has always operated

 

are you sure your flash actually has erase sizes of 4 KiB ?  base sector size doesn't matter if the flash cannot be erased on a per-sector basis.

 

what part # are you using exactly ?

QuoteReplyEditDelete

 

 

2011-06-20 12:58:02     Re: Flash erase size for jffs2 in 2010 distribution

Shyam sundar (INDIA)

Message: 101493   

 

Hello Mike,

 

I am using the W25Q128 serial flash from winbond.

 

The sector erase size is 4 KB.

 

The block erase size can be 64KB or 32 KB. As per the mtd driver, I do see the sector size for stmicro and spansion flashes correspond to 64KB. Also I dont see the block erase command being utilised in the winbond driver.

 

Need some right direction regarding this ! Also a small doubt, since the page size of the flash is 256 bytes,do I need to specify my page size as 256 in the flag option?

QuoteReplyEditDelete

 

 

2011-06-20 13:13:28     Re: Flash erase size for jffs2 in 2010 distribution

Mike Frysinger (UNITED STATES)

Message: 101494   

 

look at /proc/mtd once you've booted to see what it is declaring as the erase size

 

the mkfs.jffs2 code is easy to edit to remove the 8KiB check.  just remove the "if (erase_block_size < 0x2000)" code.

 

but i dont know if anyone has tested this, or if there are other fundamental assumptions in the jffs2 code.  i've never read jffs2 internals or design docs before.

QuoteReplyEditDelete

 

 

2011-06-21 03:36:16     Re: Flash erase size for jffs2 in 2010 distribution

Shyam sundar (INDIA)

Message: 101508   

 

Thanks Mike,

 

By commenting the following lines in the mkfs.jffs2.c file,

 

                          if (erase_block_size < 0x2000) {

                              fprintf(stderr, "Erase size 0x%x too small. Increasing to 8KiB minimum\n",

                                      erase_block_size);

                              erase_block_size = 0x2000;

                          }

and defining the following parameters in uclinux/2010R1/vendors/RITCoE/vendor.mak file

 

AUDIO_ROMFS_BASE = $(IMAGEDIR)/audio

AUDIODIR=/home/shyam/Desktop/uc2010/uclinux/2010R1/messages

.PHONY: image.rootfs.jffs2 image.rootfs.jffs2.force

ERASE_SIZE ?= 4096

PAGE_SIZE ?= 256

MKFS_JFFS2_FLAGS ?= -l -p -e $(ERASE_SIZE) -s $(PAGE_SIZE)

image.rootfs.jffs2.force:

    $(MKFS_JFFS2) $(MKFS_JFFS2_FLAGS) -d $(ROMFSDIR) -D $(DEVICE_TABLE) -o $(IMAGE_ROMFS_BASE).jffs2

    $(MKFS_JFFS2) $(MKFS_JFFS2_FLAGS) -d $(AUDIODIR) -D $(DEVICE_TABLE) -o $(AUDIO_ROMFS_BASE).jffs2

ifeq ($(CONFIG_JFFS2_FS),y)

image.rootfs.jffs2: image.rootfs.jffs2.force

endif

 

I was able to successfully mount the jffs2 image from the specified partition !

QuoteReplyEditDelete

 

 

2011-06-24 13:05:58     Re: Flash erase size for jffs2 in 2010 distribution

Mike Frysinger (UNITED STATES)

Message: 101664   

 

upstream says you dont want to use 4KiB as the overhead of jffs2 is incurred on a per-eraseblock basis.  at 4KiB, you're going to see a lot of wasted space.  so you'd best stick to 8KiB+.

QuoteReplyEditDelete

Attachments

    Outcomes