UnixCommands: Difference between revisions
From University of Washington - Ubicomp Research Page
Jump to navigationJump to search
mNo edit summary |
mNo edit summary |
||
Line 43: | Line 43: | ||
mknod /dev/mtdblock5 b 31 5</bash> | mknod /dev/mtdblock5 b 31 5</bash> | ||
</ul> | </ul> | ||
=== Mounting Script === | |||
<ul> | |||
Modified from Ed Bartosh's script ([http://lists.debian.org/debian-embedded/2005/10/msg00038.html here]): | |||
<bash> | |||
# JFFS2 image location: | |||
JFFSIMG=”~/myImage.jffs2” | |||
# Directory to mount the image on: | |||
MP="/mnt/myMountDest" | |||
# Loop back device to use: | |||
LOOP="/dev/loop1" | |||
if [ ! -b /dev/mtdblock0 ] ; then | |||
mknod /dev/mtdblock0 b 31 0 || exit 1 | |||
fi | |||
if [ ! -b /dev/loop0 ] ; then | |||
mknod /dev/mtdblock0 b 7 0 || exit 1 | |||
fi | |||
losetup $LOOP $JFFSIMG || exit 1 | |||
sleep 1 | |||
modprobe blkmtd device=$LOOP || exit 1 | |||
sleep 1 | |||
mount -t jffs2 /dev/mtdblock0 $MP || exit 1</bash> | |||
</ul> | |||
<ul> | <ul> |
Revision as of 20:26, 11 December 2006
Mounting a JFFS2 Image
The JFFS2 filesystem is intended to be used with a flash based filesystem and not a block filesystem like a harddrive (or a USB stick which emulates a block filesystem). Because of this you cannot simply mount a .jffs2 image using the loopback device. Instead you need to use a flash emulator (blkmtd in this case) which reads the .jffs2 image via a loopback device (remember since we need the emulation there's no way to mount the loopback directly).
- Connect a free loop device to the .jffs2 image: <bash>losetup /dev/loop0 ~/fs.jffs2</bash>
- Connect the blkmtd emulator module to the loopback device: <bash>modprobe blkmtd device=/dev/loop0</bash>
- Mount the mtdblock device blkmtd attached to <bash>mount /dev/mtdblock0 /mnt/jffs2Image</bash>
- JFFS2 image location:
- Directory to mount the image on:
- Loop back device to use:
Quick Start
-
The basic steps are (you will need to be root to mount and load modules):
All together that would be (where you would need to change ~/fs.jffs2 to point to where your image is and /mnt/jffs2Image to your chosen mount point). <bash>losetup /dev/loop0 ~/fs.jffs2 modprobe blkmtd device=/dev/loop0 mount /dev/mtdblock0 /mnt/jffs2Image</bash>
Creating missing devices
-
If you're missing loop devices here are the mknod commands to create loop0-loop5:
<bash>mknod /dev/loop0 b 7 0
mknod /dev/loop1 b 7 1
mknod /dev/loop2 b 7 2
mknod /dev/loop3 b 7 3
mknod /dev/loop4 b 7 4
mknod /dev/loop5 b 7 5</bash>
And here's how to create the mtdblock devices:
<bash>mknod /dev/mtdblock0 b 31 0
mknod /dev/mtdblock1 b 31 1
mknod /dev/mtdblock2 b 31 2
mknod /dev/mtdblock3 b 31 3
mknod /dev/mtdblock4 b 31 4
mknod /dev/mtdblock5 b 31 5</bash>
Mounting Script
-
Modified from Ed Bartosh's script (here):
<bash>