Skip to main content.

Topic FlashFilesystemsUBIFS not in WebOrder UBI and UBIFS file systems

UBIFS is a flash filesystem, which work on top of the Linux MTD layer. UBI itself is a software layer which basically is a volume management and wear-leveling layer. It provides so called UBI volumes which is a higher level abstraction than a MTD device.

For more documentation about UBI/UBIFS see:

This document illustrates the usage of UBI/UBIFS for the canyonlands board.

Topic FlashFilesystemsUBIFS not in WebOrder Create Device Files

First we have to create some device files, which are necessary for using UBI/UBIFS:

Note: Included topic DULGData_canyonlands.LinuxUbiCreateDeviceFiles? does not exist yet

Topic FlashFilesystemsUBIFS not in WebOrder Creating UBIFS File System Images

Topic FlashFilesystemsUBIFS not in WebOrder Determining the Parameters of the used Flash Types:

The "mkfs.ubifs" requires a few parameters that describe the specific features of the underlying flash chips. The easiest way to determine these parameters is to run the "mtdinfo" utility on a running Linux system.:

Note: Included topic DULGData_canyonlands.LinuxUbiMTDInfo? does not exist yet

The interesting parameters are:

- min-io-size:  corresponds to "Minimum input/output unit size"
- max-leb-cnt:  corresponds to "Amount of eraseblocks"

One more needed parameter from the "ubinfo -a" command:

- leb-size:     corresponds to "Logical eraseblock size"

Topic FlashFilesystemsUBIFS not in WebOrder Create some Test File System Hierarchy

Note: Included topic DULGData_canyonlands.LinuxUbiCreateTestFS? does not exist yet

Create UBIFS Images for "%UBI_NAND_NAME%" (NAND)

Note: Included topic DULGData_canyonlands.LinuxUbiCreateImageNand? does not exist yet

Topic FlashFilesystemsUBIFS not in WebOrder Installing UBIFS images into existing UBI Volume:

Note: Included topic DULGData_canyonlands.LinuxUbiInstallUbifsImageNand? does not exist yet

Topic FlashFilesystemsUBIFS not in WebOrder Installing UBI images (if no UBI Volumes exist):

If the UBI device is not already formatted to contain suitable volumes, we have to generate UBI images. An UBI image may contain one or more UBI volumes, which in turn may be used to store an UBIFS file system. This is done using the "ubinize" tool, which unfortunately is a bit weird to use: an input configuration ini-file defines all the UBI volumes - their characteristics and the contents, but it does not define the characteristics of the flash flash device - these have to be specified as command-line options.

Also, we should keep in mind that we should no longer use "flash_eraseall" to erase the MTD device, as this has no knowledge about the UBI erase counters. Instead, we should use "ubiformat" to erase the flash and install a new UBI image.

Unmount and detach previously used UBI devices:

Note: Included topic DULGData_canyonlands.LinuxUbiUmountVolumeNand? does not exist yet

Create UBI ini-file and create UBI images:

Note: for the volume sizes we use the byte count previously determined by running "ubinfo -a" above.

Note: Included topic DULGData_canyonlands.LinuxUbiIniFileNand? does not exist yet

Note that for the NAND device we must pass the "-s 2048" option to ubinize; if we don't, an attempt to attach the created UBI device will result in error messages like these:

Note: Included topic DULGData_canyonlands.LinuxUbiAttachErrorNand? does not exist yet

For background information please see http://www.linux-mtd.infradead.org/faq/ubi.html#L_vid_offset_mismatch

Erase MTD partitions and install UBI images:

Note: Included topic DULGData_canyonlands.LinuxUbiFormatNand? does not exist yet

Verify that it worked:

Note: Included topic DULGData_canyonlands.LinuxUbiFormatVerifyNand? does not exist yet