mount a jffs2 file in Ubuntu

sysinfo

$ uname -a
Linux b50 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
$ mkimage -l rootfs_h20

Image Name:   0.1.4-beta2-hi3518-rootfs
Created:      Mon Jul 10 15:10:18 2017
Image Type:   ARM Linux Filesystem Image (uncompressed)
Data Size:    956424 Bytes = 934.01 kB = 0.91 MB
Load Address: 00000000
Entry Point:  00000000

modprobe
– jffs2
– mtdram (1)
– mtdblock

(1) params needed
$ modinfo mtdram
– total_size=
– erase_size=

total_size needs to be more than 5 times bigger than erase_size

http://lists.infradead.org/pipermail/linux-mtd/2013-January/045492.html

trouble shooting:

$ cat /proc/mtd
$ dmesg | tail

Error: jffs2: Too few erase blocks (4) ==>> See (1)

if mounted:
$ sudo umount mnt/

trying different mtdram params:
first remove the kernel module
$ sudo modprobe -r mtdram

Source:

ranf@b50:~/yicam$ cat sudo_mnt_jffs2.sh 

#!/bin/sh
set -e
if [ -z "$1" ]; then
    echo usage: $0 jffs2_image directory
    exit
fi

if [ -z "$2" ]; then
    echo usage: $0 jffs2_image directory
    exit
fi

# modprobe mtdcore
modprobe jffs2

SIZE=$(du -h -k $1 | cut -f 1)
SIZE=8192 # 65536
ESIZE=$(( $SIZE / 6))
BUFS=512
modprobe mtdram \
 total_size=$SIZE \
 erase_size=${ESIZE} \
# writebuf_size=$BUFS

# modprobe mtdchar
modprobe mtdblock

sleep .25

dd if=$1 of=/dev/mtd0

mount -t jffs2 /dev/mtdblock0 $2

Links:
http://wiki.openmoko.org/wiki/Qtopia#Copy_the_jffs2_root_file_system_to_the_microSD_card

TBD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s