4

I'm working with the firmware of SIP phone. I extracted the JFFS2 file system image from the firmware and mounted it using modprobe ike this:

sudo modprobe mtdram total_size=36360
sudo modprobe mtdblock 
sudo modprobe jffs2
sudo modprobe block2mtd
sudo dd if=~/1C6A83.jffs2  of=/dev/mtdblock0
sudo mount -t jffs2 /dev/mtdblock0 ~/mnt

However when I try to change files on the mounted device I get an error "No space left on device". What am I doing wrong? May be my device mtdblock0 is protected from writing?

3
  • Try to mount -o rw and access the files using root user. If that doesn't work, immediately after the mount command look at the last lines of the kernel message log (tail /var/log/messages or dmesg | tail
    – Yotamz
    Apr 21 '20 at 7:22
  • Thanks a lot, but unfortunately, it doesn't work. cp: cannot create regular file '/home/main/fs/voip/logo.png': No space left on device
    – JMLabs
    Apr 26 '20 at 22:19
  • Here are my actions step by step $ sudo modprobe -v mtdram total_size=36360 $ sudo modprobe -v mtdblock $ sudo modprobe -v jffs2 $ sudo modprobe -v block2mtd $ sudo dd if=~/st.extracted/1C6A83.jffs2 of=/dev/mtdblock0 72718+1 records in 72718+1 records out 37232064 bytes (37 MB, 36 MiB) copied, 1,09873 s, 33,9 MB/s $ sudo mount -o rw -t jffs2 /dev/mtdblock0 ~/fs
    – JMLabs
    Apr 26 '20 at 22:23
1

I wanted to do the same thing, and did not get the no space left on device (I read somewhere that that error may be because of an incomplete image...), but I could not figure out how to update the image. md5sum of the original file did not change, and running sync as suggested after googling was unsuccessful as well...

I went the way of extracting the jffs2 image and then repacking the jffs2 file system.
I put everything on github, but here is the essence:

This will unpack a .jffs2 file system to /my/target/dir and repack to mtd_root.sum.bin

Unpacking

mount -t jffs2 -o ro /tmp/mtdblock0 /tmp/e2jffs2
(cd /tmp/e2jffs2; tar cf - .) | (cd "/my/target/dir" ; tar xpf -)
umount /tmp/e2jffs2

Repacking

mount -t jffs2 -o ro /tmp/mtdblock0 /tmp/e2jffs2
mkfs.jffs2 --root=/tmp/e2jffs2/ --output=/tmp/mtd_root.bin --eraseblock=128KiB --pad --no-cleanmarkers
sumtool  --pad --eraseblock=128KiB --input=/tmp/mtd_root.bin --output=$(dirname "/my/target/dir")/mtd_root.sum.bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.