The mkefs utility uses instructions in its buildfile to build a flash filesystem image file.
The mkefs utility use a buildfile similar to the buildfile mkifs uses. A mkefs buildfile is a list of attributes and files to be included in the filesystem. Its syntax is similar to the mkifs buildfile syntax (see Buildfile syntax). However, mkefs supports a different set of attributes, including the following:
Here's a very simple example of a mkefs buildfile:
[block_size=128k spare_blocks=1 filter=deflate] /home/ejm/products/sp1/callp/imagedir
In this example, the attributes specify:
The only information you need to provide about the flash devices used in your system is the block size, which you specify withe the block_size attribute.
The value you should specify for the block_size attribute depends on the physical block size of the flash device (see the manufacturer's data sheet), and on how the flash device is configured in your hardware (specifically the interleave).
Use the following formula determine the value you should set for block_size:
For example, if you have a 16-bit flash interface, and are using a 16-bit flash device with a 64 KB block size, you should set block_size to 64000 (16 / 16 × 64000 = 64000).
The spare_blocks attribute indicates how many blocks should be left as spare. A value of 0 indicates a read/write (or write-once) flash filesystem, whereas a value greater than 0 indicates a read/write/reclaim filesystem.
The default is 1 (one), but the number of spare blocks you'll need depends on the amount of writing you'll do. You should specify an odd number of spare blocks, usually 1 or 3. QNX Neutrino allocates and recovers blocks two at a time. Specifying an odd number of spare blocks ensures that read and write activity is properly distributed across blocks.
The filesystem doesn't use a spare block until it's time to perform a reclaim operation. A non-spare block is then selected for reclamation, and the data contained in that block is coalesced into one contiguous region in the spare block. The non-spare block is then erased and becomes the new spare block. The former spare block takes the place of the reclaimed block.