Embedded Linux » Mounting JFFS2 Images in RAM

Mounting JFFS2 Images in RAM

Last modified by Marc Singer on 2011/07/06 16:15

The MTD subsystem includes a RAM driver that can be used to (sort-of) loopback mount a JFFS2 filesystem for testing. In order to use it you must load the mtdram and mtdblock modules. It is best to load mtdram when you need it so that you can set the proper total size and eraseblock size.

First, load the mtdram module. The total_size and erase_size parameters are in units of !KiB.

modprobe mtdram total_size=24576 erase_size=128

You can verify that it is loaded by looking in /proc.

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01800000 00020000 "mtdram test device"

Then load the mtdblock device, copy the jffs2 filesystem into it, and mount it.

modprobe mtdblock
dd if=filesystem.jffs2 of=/dev/mtdblock0
mount -t jffs2 /dev/mtdblock0 ./root
Tags:
Created by Marc Singer on 2011/07/06 16:11

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 3.1 - Documentation