NAND flash (i.MX31)

Aus BECOM Systems Support
Zur Navigation springen Zur Suche springen

Kernel Configuration

The kernel configuration settings for the NAND device can be found in

Device Drivers -> Memory Technology Device Support -> NAND Device Support -> MXC NAND Support

This driver is needed for the hardware related layer. Everything on top is already built into the linux distribution.

Using the NAND Flash

To see which partitions are available, change the appropriate kernel settings as indicated above, then run the following command. You should see an output similar to the one below.

mx31# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "Bootloader"
mtd1: 00080000 00020000 "Bootloader env"
mtd2: 00200000 00020000 "Kernel"
mtd3: 01d00000 00020000 "rootfs"

mtd4: 00040000 00020000 "IPL-SPL"
mtd5: 00400000 00020000 "nand.kernel"
mtd6: 01600000 00020000 "nand.rootfs"
mtd7: 065c0000 00020000 "nand.userfs"

The output will show both NAND and NOR devices. Typically the NAND devices start with the IPL_SPL, so most likely the partitions behind that one will be NAND partitions.

We will now erase one partition and create a file system on top of it, then mount it.

/* Erase partition #7 */
flash_eraseall -j /dev/mtd/7

/* Create a filesystem from a directory (/etc) and write to a (temporary) file
mkfs.jffs2 -n -d /etc -o etc.jffs2

/* Write the filesystem onto the partition */
nandwrite -a -p /dev/mtd/7 etc.jffs2

/* Create a mount point for the partition/fs */
mx31# mkdir /mnt/mtd7a

/* Mount the file filesystem */
mx31# mount -t jffs2 /dev/mtdblock/7 /mnt/mtd7a

/* Display the contents of the filesystem*/
mx31# ls /mnt/mtd7a

Note: You should see the same files that are in /etc

Files you will copy to the NAND Filesystem will be available even after you reboot or switch off/on the device.