Difference between revisions of "Memory Tecnology Device (MTD)"

From DAVE Developer's Wiki
Jump to: navigation, search
(UBI)
(UBI)
Line 10: Line 10:
  
 
=== UBI ===
 
=== UBI ===
 +
 +
UBIFS can be considered as the next-generation of the JFFS2 file system. It is a new journaled flash file system which works on top of the UBI (Unsorted Block Images) subsystem, a wear-leveling and volume management system for raw flash devices. UBI volumes are higher level entities than MTD devices, which represents the raw flash devices (/dev/mtdX) and provide the interface to access flash chips. The following figure shows the involved subsystems:
  
 
[[File: Ubifs stack.png]]
 
[[File: Ubifs stack.png]]
 +
 +
The default MTD partition associated to the NAND flash is mapped as number 4. Let’s assume we run the kernel by using the net_nfs configuration. Since using UBIFS shares some points with using JFFS2, please refer to ... for further details.
 +
 +
To access and use UBIFS:
 +
# Add the ubi.mtd=X parameter to the kernel command line, where X is the number of the mtd partition
 +
# Erase the MTD partition:
 +
<shell>
 +
flash_eraseall /dev/mtdX
 +
</shell>
 +
# As an alternative to point 1, launch the following command:
 +
<shell>
 +
ubiattach /dev/ubi_ctrl -m X
 +
</shell>
 +
# The device /dev/ubi0 is now available. To create the UBI volume, launch the following command (-N sets the name and -s sets the size of the volume):
 +
<shell>
 +
ubimkvol /dev/ubi0 -N rootfs -s 128MiB
 +
</shell>
 +
# The device /dev/ubi0_0 is now available and can be mounted with one of the following comands:
 +
<shell>
 +
mount -t ubifs ubi0_0 /mnt/ubifs
 +
mount -t ubifs ubi0:rootfs /mnt/ubifs
 +
</shell>
 +
# To mount the UBI file system as root file system, the binding between MTD and UBI must be specified from the kernel command line, adding the following parameters:
 +
<shell>
 +
ubi.mtd=6 root=ubi0_0 rootfstype=ubifs rw
 +
</shell>
 +
 +
Please note that
 +
# the file system is formatted automatically the first time it is mounted
 +
# the mount command don't use the /dev/ prefix before ubi0_0 device
  
 
=== File system on MTD ===
 
=== File system on MTD ===

Revision as of 16:35, 11 May 2012

Info Box
Tux.png Applies to Linux


WorkInProgress.gif

Introduction[edit | edit source]

MTD Partitions[edit | edit source]

UBI[edit | edit source]

UBIFS can be considered as the next-generation of the JFFS2 file system. It is a new journaled flash file system which works on top of the UBI (Unsorted Block Images) subsystem, a wear-leveling and volume management system for raw flash devices. UBI volumes are higher level entities than MTD devices, which represents the raw flash devices (/dev/mtdX) and provide the interface to access flash chips. The following figure shows the involved subsystems:

Ubifs stack.png

The default MTD partition associated to the NAND flash is mapped as number 4. Let’s assume we run the kernel by using the net_nfs configuration. Since using UBIFS shares some points with using JFFS2, please refer to ... for further details.

To access and use UBIFS:

  1. Add the ubi.mtd=X parameter to the kernel command line, where X is the number of the mtd partition
  2. Erase the MTD partition:
flash_eraseall /dev/mtdX
  1. As an alternative to point 1, launch the following command:
ubiattach /dev/ubi_ctrl -m X
  1. The device /dev/ubi0 is now available. To create the UBI volume, launch the following command (-N sets the name and -s sets the size of the volume):
ubimkvol /dev/ubi0 -N rootfs -s 128MiB
  1. The device /dev/ubi0_0 is now available and can be mounted with one of the following comands:
mount -t ubifs ubi0_0 /mnt/ubifs
mount -t ubifs ubi0:rootfs /mnt/ubifs
  1. To mount the UBI file system as root file system, the binding between MTD and UBI must be specified from the kernel command line, adding the following parameters:
ubi.mtd=6 root=ubi0_0 rootfstype=ubifs rw

Please note that

  1. the file system is formatted automatically the first time it is mounted
  2. the mount command don't use the /dev/ prefix before ubi0_0 device

File system on MTD[edit | edit source]

JFFS2[edit | edit source]

UBIFS[edit | edit source]