• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: HOWTO mount JFFS2 image on Linux host without NAND flash  (Read 45790 times)
alexbez
Newbie
*

Karma: 0
Posts: 7


View Profile
« on: April 14, 2009, 01:41:57 AM »

I have found a document, which explains how to mount a jffs2 image using block device emulating MTD:

https://wiki.maemo.org/Modifying_the_root_image

Maemo is a Linux-based platform, which Nokia uses in their Internet Tablet devices. These devices also use NAND flash memory, so the tools they are using are good for SheevaPlug as well. Some Nokia Maemo folks are, actually, standing behind the jffs2 filesystem development.

You need to copy the script from the section "Shell script to mount/unmount JFFS2 using block device emulating MTD" and to fix two errors in it (lines 27 and 35: replace '[' by ']').
Now you can mount your Sheeva jffs2 image and play with it any way you want :-)

Please read "Modifying the copy of the image" attentively - it might save you some troubles in the future!

Indeed, Maemo flasher script is NOT applicable for SheevaPlug. Do not try it!

Note: Do NOT use "Shell script to mount/unmount JFFS2 using kernel memory emulating MTD" method, as it is only usable for small (< 64MB) images, otherwise you get "out of memory" error.

Hope this information is helpful.
Logged

----------------------------------
"Everybody is entitled to be stupid,
but some people just abuse the privilege"

porkupan
Newbie
*

Karma: 0
Posts: 6



View Profile
« Reply #1 on: April 15, 2009, 07:46:33 PM »

Actually, you can use the kernel memory emulating MTD as well.  You just need to allocate more kernel memory. Smiley

modprobe mtdram total_size=XXXXX erase_size=256

where XXXXX is the size of the JFFS2 image in KB. 

Worked for me.
Logged

alexbez
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #2 on: April 15, 2009, 10:25:51 PM »

Actually, you can use the kernel memory emulating MTD as well.  You just need to allocate more kernel memory. Smiley

It will only work for relatively small images. On my box, which has 1GB RAM, the maximum size of the image I can mount is about 63K. Mounting it over mtdblock would work much slower, but there is no size limitation. Well, almost no limitation  Wink
Logged

----------------------------------
"Everybody is entitled to be stupid,
but some people just abuse the privilege"

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #3 on: April 15, 2009, 10:40:37 PM »

I gave this a try, and the file mounts OK, but it doesn't contain any files. Additionally, my dmesg is filled with this stuff:

Code:
[137378.064209] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e0c: 0xecf3 instead
[137378.064211] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e10: 0xc02d instead
[137378.064214] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e14: 0x6c7a instead
[137378.064216] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e18: 0x77c7 instead
[137378.064219] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e1c: 0x3116 instead
[137378.064221] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e20: 0x703d instead
[137378.064223] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e24: 0x351e instead
[137378.064226] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e28: 0x974c instead
[137378.064228] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e2c: 0x1b95 instead
[137378.064231] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00068e30: 0x5c6f instead
[137378.064233] Further such events for this erase block will not be printed

What i get at the end is a bunch of directories (/etc, /home/ etc..) but no files in them.

Suspecting an incorrect erase-size, I have also tried specifying some module options to block2mtd module:
Code:
     modprobe ${BLKMTD} block2mtd=${LOOP},256|| exit 1

No luck there either.

Any ideas?

-tmk
Logged

alexbez
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #4 on: April 15, 2009, 11:13:49 PM »

I gave this a try, and the file mounts OK, but it doesn't contain any files.
What i get at the end is a bunch of directories (/etc, /home/ etc..) but no files in them.
Any ideas?

-tmk

Did you try it with ubuntu-9.0.5.Release.jffs2 image, taken from the site? That one is broken...
I tried 9.0.4 image, available from "Downloads" section of this site and it mounts OK and shows all the right stuff available.
Also jffs2 image from the companion CD worked for me.
Logged

----------------------------------
"Everybody is entitled to be stupid,
but some people just abuse the privilege"

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #5 on: April 15, 2009, 11:43:46 PM »

argh. broken from the website.

I even downloaded it again, thinking it might have gotten corrupt in the transfer

Ah well, i'll try with a known-good one next time, thanks.

-tmk
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #6 on: April 16, 2009, 07:06:03 AM »

Don't know if it helps, but here is what I do to mount a JFFS2-Image on my Debian-Box:
Code:
linBox:/home/kaibo# modprobe mtdblock
linBox:/home/kaibo# modprobe jffs2
linBox:/home/kaibo# modprobe mtdram total_size=200000
linBox:/home/kaibo# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 0c350000 00020000 "mtdram test device"
linBox:/home/kaibo# dd if=/usr/src/sheeva/Image/ubuntu.jffs2 of=/dev/mtdblock0
278272+0 records in
278272+0 records out
142475264 bytes (142 MB) copied, 2.59761 s, 54.8 MB/s
linBox:/home/kaibo# mount -t jffs2 /dev/mtdblock0 /mnt
linBox:/home/kaibo# ls /mnt
bin   dev  home  media opt   root  selinux  sys  usr
boot  etc  lib mnt proc  sbin  srv      tmp  var

And yes, all files are there - not only the directories.
Logged

porkupan
Newbie
*

Karma: 0
Posts: 6



View Profile
« Reply #7 on: April 16, 2009, 08:55:41 AM »

The ubuntu-9.0.5.Release.jffs2 loaded from Globalscale Tech. site worked fine for me.

I was not able to allocate sufficient storage for MTDRAM on my 2.6.9 box (actually, 139136 KB is needed), but could allocate the required amount on both a 2.6.18 and a 2.6.25 Fedora boxes, so the allocation limit may have something to do with the kernel version.  The block2mtd method didn't work for me on a 2.6.9 box either (I guess, I was added in later releases), but it worked in newer kernels. 

I saw all of Ubuntu rootfs 9.0.5 via both methods. 
Logged

dsmith_sre3
Guest
« Reply #8 on: April 23, 2009, 03:10:49 PM »

Here is how I got it to work in Ubuntu 8.10:

sudo apt-get install mtd-tools
sudo modprobe -v mtd
sudo modprobe -v jffs2
sudo modprobe -v mtdram total_size=256000 erase_size=256
sudo modprobe -v mtdchar
sudo modprobe -v mtdblock
sudo dd if=ubuntu-9.0.5.Release.jffs2 of=/dev/mtd0
sudo mount -t jffs2 /dev/mtdblock0 ~/Documents/plugpc/image
Logged

marrydavidson101
Guest
« Reply #9 on: April 09, 2010, 12:12:53 AM »

thanks for sharing such a nice information with us i am really thankful to you
Logged

Pages: [1]
Print
Jump to: