ubifs on SPI NOR Flash with uniform 4k erase block size

John Parker John.Parker at lucyautomation.co.uk
Fri Jul 26 07:28:25 EDT 2013


Hi all

I'm trying to get ubifs to work optimally on an 2M SPI NOR flash which has a 4k erase block size. The device is correctly recognised by the m25p80 driver which specifies that it supports 4k sectors.

Mtd-utils is 1.5.0. Kernel is 2.6.31 but with a newer m25p80 driver to support the specific write commands for this particular flash device.

Mtdinfo reports it correctly
Ubiformat, ubiattach, and ubimkvol all work as expected and ubinfo reports that the device has a PEB of 4096 and LEB of 3968.

However, when I use mkfs.ubifs -v /dev/ubi0_0 it complains that the LEB is too small and should be a minimum of 15360 (UBIFS_MIN_LEB_SZ).

	Error: too small LEB sixe 3968, minimum is 15360

(note there is an error in mkfs.ubifs.c in that the validate_options() function reports c->min_io_size instead of c->leb_size if c->leb_size is less than UBIFS_MIN_LEB_SZ - confusing but easy to fix)

Where does the 15*1024 value for UBIFS_MIN_LEB_SZ come from in terms of the ubifs design? I know it's defined in ubifs-media.h - what I mean is why is it 15k?

Is it really a problem? If I take out the 4k sector capability from the device spec in the m25p80 driver and let it use the 64k block size I only get 32 PEBs but the mkfs.ubifs works and I can mount and use the filesystem.

There are a large number of these 4k uniform erase block devices out there so others must have hit this problem.

Any ideas?

Kind regards

John



More information about the linux-mtd mailing list