Jffs2

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(How to mount jffs2 image - worked on my fc8 machine 'out of the box')
 
(Mounting a JFFS2 image: Skrip added)
Line 14: Line 14:
  
 
Make a mount point for the file system
 
Make a mount point for the file system
mkdir /mnt/jffs2
+
  mkdir /mnt/jffs2
  
 
Mount the file system
 
Mount the file system
 
  mount -t jffs2 /dev/mtdblock0 /mnt/jffs2/
 
  mount -t jffs2 /dev/mtdblock0 /mnt/jffs2/
 +
 +
An alternative way is used in the following script:
 +
if test `id -u` != 0
 +
then echo "Must be root"; exit 2
 +
fi
 +
if test $# != 2 -o ! -d $2
 +
then echo Usage: $0 image.jffs2 directory; exit 2
 +
fi
 +
rmmod mtdram
 +
modprobe mtdcore
 +
modprobe mtdblock
 +
modprobe mtdchar
 +
modprobe jffs2
 +
s=$(ls -s $1)
 +
s=${s% *}
 +
echo modprobe mtdram total_size=$s
 +
modprobe mtdram total_size=$s
 +
dd if=$1 of=/dev/mtd0
 +
mount -t jffs2 /dev/mtdblock0 $2

Revision as of 19:33, 28 January 2009

Mounting a JFFS2 image

Make the MTD block device

mknod /dev/mtdblock0 b 31 0 

Associate the jffs2 file with a loopback device

losetup /dev/loop0 /path/to/jffs2/file/eg/Om200Y.MM-gtaNN-YYYYMMDD.rootfs.jffs2

Load the block2mtd module

modprobe block2mtd 

Tell the module which loopback device to use

echo /dev/loop0 >/sys/module/block2mtd/parameters/block2mtd

Make a mount point for the file system

 mkdir /mnt/jffs2

Mount the file system

mount -t jffs2 /dev/mtdblock0 /mnt/jffs2/

An alternative way is used in the following script:

if test `id -u` != 0
then echo "Must be root"; exit 2
fi
if test $# != 2 -o ! -d $2
then echo Usage: $0 image.jffs2 directory; exit 2
fi
rmmod mtdram
modprobe mtdcore
modprobe mtdblock
modprobe mtdchar
modprobe jffs2
s=$(ls -s $1)
s=${s% *}
echo modprobe mtdram total_size=$s
modprobe mtdram total_size=$s
dd if=$1 of=/dev/mtd0
mount -t jffs2 /dev/mtdblock0 $2
Personal tools

Mounting a JFFS2 image

Make the MTD block device

mknod /dev/mtdblock0 b 31 0 

Associate the jffs2 file with a loopback device

losetup /dev/loop0 /path/to/jffs2/file/eg/Om200Y.MM-gtaNN-YYYYMMDD.rootfs.jffs2

Load the block2mtd module

modprobe block2mtd 

Tell the module which loopback device to use

echo /dev/loop0 >/sys/module/block2mtd/parameters/block2mtd

Make a mount point for the file system

mkdir /mnt/jffs2

Mount the file system

mount -t jffs2 /dev/mtdblock0 /mnt/jffs2/