How to mount a jffs2 enigma2 image on a Linux PC
This guide can be used for mounting a linux or enigma2 image just to check its contents.
Obviously, using an altered image via this procedure to flash a box, is a little dangerous !!!
1. Create the mounting point dir.
sudo mkdir /media/jffs2
2. Create the following script.
Remember to change permissions with :
chmod +x /usr/local/bin/mount_jffs2.sh
/usr/local/bin/mount_jffs2.sh :
#!/bin/bash if [ -z "$1" ]; then echo "Loop mount an JFFS2 image to /media/jffs2." echo "Using a block device emulating a Memory Technology Device (MTD) via block2mtd." echo "" echo "Usage : sudo $0 /path/to/image.jffs2 [unmount]" exit 1 fi # ORIGINAL SCRIPT is FROM : # https://wiki.maemo.org/Modifying_the_root_image JFFSIMG=$1 # jffs image LOOP="/dev/loop1" # loop device MP="/media/jffs2" # mount point MTDBLOCK="/tmp/mtdblock0" # MTD device file KVER="2.6" BLKMTD="block2mtd" BLKMTDERASESIZE="0x20000" # mtd eraseblock bytes size in hex (131072 bytes, 128.0 KiB) BLKMTDOPTIONS="block2mtd=${LOOP},${BLKMTDERASESIZE}" # module params UMNT="" echo "$0" | grep unmount_ >/dev/null 2>&1 [ $? -eq 0 ] && UMNT=1 if [ $# -gt 1 -a x"$2"x = x"unmount"x ]; then UMNT=1 fi uname -r | egrep '^2\.6' >/dev/null 2>&1 if [ $? -ne 0 ]; then KVER="2.4" BLKMTD=blkmtd fi #### mount ###### if [ x"${UMNT}"x = x""x ]; then if [ ! -b ${MTDBLOCK} ] ; then mknod ${MTDBLOCK} b 31 0 || exit 1 fi lsmod | grep loop >/dev/null 2>&1 if [ $? -ne 0 ]; then modprobe loop [ $? -ne 0 ] && echo "loopback module loading failed" && exit 1 sleep 1 fi losetup ${LOOP} ${JFFSIMG} || exit 1 sleep 1 modprobe mtdblock if [ x"${KVER}"x = x"2.4"x ]; then modprobe ${BLKMTD} device=${LOOP} erasesz={BLKMTDERASESIZE} || exit 1 else modprobe ${BLKMTD} ${BLKMTDOPTIONS} || exit 1 ## next is useless #echo "${LOOP},{BLKMTDERASESIZE}" > /sys/module/block2mtd/parameters/block2mtd fi sleep 1 ## test cat /proc/mtd mtdinfo -a modprobe jffs2 [ ! -d ${MP} ] && mkdir -p ${MP} mount -t jffs2 ${MTDBLOCK} ${MP} || exit 1 else #### ummount ###### umount ${MP} if [ $? -ne 0 ]; then modprobe -r jffs2 modprobe -r ${BLKMTD} modprobe -r mtdblock sleep 1 losetup -d ${LOOP} /bin/rm -f ${MTDBLOCK} echo "Cannot unmount JFFS2 at $MP" && exit 1 fi modprobe -r jffs2 modprobe -r ${BLKMTD} modprobe -r mtdblock sleep 1 losetup -d ${LOOP} /bin/rm -f ${MTDBLOCK} fi
3. Create nautilus scripts
In order to mount/umount directly from nautilus you need to have the following
scripts in your ~/.gnome2/nautilus-scripts/ folder.
Mount_jffs2 :
#!/bin/bash # mount gksudo -k /bin/echo "got r00t?" BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .jffs2` if sudo /usr/local/bin/mount_jffs2.sh $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS then zenity --info --title "JFFS2 Mounter" --text "$BASENAME Successfully Mounted on /media/jffs2" #nautilus /media/jffs2 --no-desktop exit 0 else zenity --error --title "JFFS2 Mounter" --text "Cannot mount $BASENAME!" exit 1 fi
UnMount_jffs2 :
#!/bin/bash # unmount gksudo -k /bin/echo "got r00t?" BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .jffs2` if sudo /usr/local/bin/mount_jffs2.sh $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS unmount then zenity --info --title "JFFS2 Mounter" --text "Successfully unmounted $BASENAME on /media/jffs2" exit 0 else zenity --error --title "JFFS2 Mounter" --text "Cannot unmount $BASENAME!" exit 1 fi
Remember to change permissions with :
chmod +x ~/.gnome2/nautilus-scripts/*
To mount the image right click on image filename and go to Scripts-> Mount_jffs2. To umount the image go to Scripts -> UnMount_jffs2 (on the same file).
Back to the PLiĀ® Wiki : DM500 : DM500+ : DM56xx : DM600 : DM7000 : DM7020 : DM7025 : DM800 : DM8000