Active Topics

 


Reply
Thread Tools
Posts: 2 | Thanked: 25 times | Joined on Dec 2009
#1
How to mount or edit rootfs.jffs2 file?
Already tried via nandsim and mtdram - no luck. I can't mount ubifs filesystem. Wiki entry have only information about jffs2 and not ubifs.

Last edited by x86; 2009-12-01 at 17:54.
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#2
Well in theory you need recent kernel that supports ubifs and recent mtd-utils and follow stuff here
http://www.linux-mtd.infradead.org/d...tml#L_usptools
http://www.linux-mtd.infradead.org/doc/ubifs.html

I was trying to mount it too but didn't manage yet. Was also thinking that easier might be to simply flash it to NAND in my beagleboard and mount it there. But there shouldn't be problem with mtdram, just create mtdram device, use ubi tools to create/attach ubi volume and 'flash' image to it.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 

The Following 2 Users Say Thank You to fanoush For This Useful Post:
Posts: 2 | Thanked: 25 times | Joined on Dec 2009
#3
Here one solution to mount it:
Code:
# modprobe mtdblock

# modprobe ubi

# modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 10000000 00020000 "NAND simulator partition 0"

# ls -la /dev/mtd*
brw-r--r-- 1 root root 31, 0 2009-12-01 18:50 /dev/mtd0
brw-rw---- 1 root disk 31, 0 2009-12-01 19:06 /dev/mtdblock0

# dd if=rootfs.jffs2 of=/dev/mtdblock0 bs=2048
74688+0 records in
74688+0 records out
152961024 bytes (153 MB) copied, 5.87334 s, 26.0 MB/s

# ubiattach /dev/ubi_ctrl -m 0
UBI device number 0, total 2048 LEBs (264241152 bytes, 252.0 MiB), available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)

# ls -la /dev/ubi*
crw-rw---- 1 root root 252,  0 2009-12-01 19:06 /dev/ubi0
crw-rw---- 1 root root 252,  1 2009-12-01 19:06 /dev/ubi0_0
crw-rw---- 1 root root  10, 58 2009-12-01 19:05 /dev/ubi_ctrl
# mount -t ubifs ubi0_0 /mnt/n900/

# ls -la /mnt/n900 | head
total 4
drwxr-xr-x 22 root root 1504 2009-10-30 14:36 .
drwxr-xr-x  9 root root 4096 2009-10-25 20:02 ..
drwxr-xr-x  2 root root 3920 2009-10-30 14:31 bin
drwxr-xr-x  2 root root  232 2009-10-30 14:48 boot
drwxr-xr-x  2 root root  160 2009-10-30 14:28 cdrom
drwxr-xr-x  3 root root 3808 2009-10-30 14:37 dev
drwxr-xr-x  2 root root  160 2009-10-30 14:28 .dev
drwxr-xr-x 72 root root 7488 2009-10-30 14:48 etc
drwxr-xr-x  2 root root  160 2009-10-30 14:28 floppy

#
To pack back into ubifs do following:
Code:
# mkfs.ubifs -m 2048 -e 129024 -c 2047 -r /mnt/n900/ rootfs_ubifs.jffs2

# cat > cfg.ini
[rootfs]
mode=ubi
image=rootfs_ubifs.jffs2
vol_id=0
vol_size=160MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
vol_alignment=1

# ubinize -o rootfs_new.jffs2 -p 128KiB -m 2048 -s 512 cfg.ini

# ./flasher-3.5 -f -R -r rootfs_new.jffs2
Doing this please be careful, it was working for me, but you must check all parameters according with dmesg after mounting volume. Untested with image bigger than original.
Somebody please test this and add to wiki.

Last edited by x86; 2009-12-01 at 17:48.
 

The Following 25 Users Say Thank You to x86 For This Useful Post:
Posts: 46 | Thanked: 5 times | Joined on Sep 2009
#4
Doing this please be careful, it was working for me, but you must check all parameters according with dmesg after mounting volume. Untested with image bigger than original.
Somebody please test this and add to wiki.
This doesn't work for me, using the SDK VM.

Can anyone confirm the true filesystem type of the rootfs.jffs2 file, and possibly a working How To for mounting the image?

Last edited by techdork; 2010-01-04 at 09:52.
 
Posts: 77 | Thanked: 19 times | Joined on Jun 2010 @ Spain
#5
Originally Posted by x86 View Post
Here one solution to mount it:
I have suse 11.3 with kernel 2.6.34.7-0.3-desktop
i can't mount rootfs.jffs2
all commands works perfectly excepts when i run
Code:
modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15
the output is
[code]
crw------- 1 root root 90, 0 Oct 9 17:34 /dev/mtd0
crw------- 1 root root 90, 1 Oct 9 17:34 /dev/mtd0ro
brw-rw---- 1 root disk 31, 0 Oct 9 17:34 /dev/mtdblock0
[code]
Then i run
Code:
ubiattach /dev/ubi_ctrl -m 0
I get an error
Code:
ubiattach: error!: cannot attach mtd0
           error 30 (Read-only file system)
And of course, can't mount it
 
Posts: 284 | Thanked: 74 times | Joined on Mar 2010 @ Wigan, UK
#6
What is your result to:

Code:
cat /proc/mtd
?

I suspect your mtd0 is taken
 
Posts: 77 | Thanked: 19 times | Joined on Jun 2010 @ Spain
#7
cat /proc/mtd
Code:
dev:    size   erasesize  name
mtd0: 10000000 00020000 "NAND simulator partition 0"
 
Posts: 529 | Thanked: 194 times | Joined on Aug 2010 @ UK
#8
when using this command
Code:
dd if=rootfs.jffs2 of=/dev/mtdblock0 bs=2048
this is what i get in reply

Code:
dd if=rootfs.jffs2 of=/dev/mtdblock0 bs=2048
dd: opening `rootfs.jffs2': No such file or directory

many thanks ]
__________________
METASPLOIT INSTALL N900
Keep the forums clean
Dont forget to say thanks
 
Posts: 77 | Thanked: 19 times | Joined on Jun 2010 @ Spain
#9
put the full path to rootfs.jffs2

The above instructions only work for me on ubuntu 10.04 32bit.
In openSUSE don't work
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#10
Technically, they should work on all OSs assuming there's MTD block support in the kernel (afaik ubuntu got that in 10.04)
 
Reply


 
Forum Jump


All times are GMT. The time now is 09:31.