AVR32 Linux Development/How to make JFFS v2 file system

From AVRFreaks Wiki

Jump to: navigation, search

This how-to assumes you have mtd-tools installed on your computer. This tool is available from http://www.linux-mtd.infradead.org/.

Flash parameters

All flash devices have a given erase size and page size. These must be known because the filesystem will be built in blocks depending on these values.

The erase size is given by the size of an erase block and the page size is given by the page size for the device.

mkfs.jffs2 tool

In the mtd-tools software package there is a tool called mkfs.jffs2. This application is used to make an image from a given root directory.

mkfs.jffs2 should have the following parameters given when used:

  • --output, where to put the image.
  • --root, path to the root directory.
  • --big-endian or --little-endian, defines the endianess of the image. AVR32 uses --big-endian.
  • --pagesize, size of the pages on the flash, defaults to 4KiB.
  • --eraseblock, size of the erase blocks on the flash, defaults to 64KiB.

For more information about mkfs.jffs2, start the application with the --help parameter.

Making an image

Example of copying a file system on the host computer to the flash on the target:

  • mkfs.jffs2 --output=/home/user/images/rootfs.img --root=/home/user/target_root --big-endian --pagesize=4092 --eraseblock=65536

This implies that the made image should output to /home/user/images/rootfs.img and the directory /home/user/target_root will be used as the source for the image. The image will be made big endian and 64KiB erase block size and 4KiB page size.

This example conforms to a typical NOR flash, i.e. the AT49BV642D which is used on the ATSTK1000 and ATNGW100.

Static version created: 2007-03-07
Copyright (c) 2007 Atmel Corporation