maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Editing n900's rootfs.jffs2 (https://talk.maemo.org/showthread.php?t=35554)

joerg_rw 2011-07-30 01:51

Re: Editing n900's rootfs.jffs2
 
writing to mtd with dd is prone to fail, as dd doesn't know about bad block management in mtd, and mtd is a *raw* device where you eventually will run into an occasional bad block.

There are tools that are specifically built to deal with bad blocks on mtd, e.g mtd_debug is one of them I'd assume, available in fremantle.

/j

pali 2013-02-25 13:39

Re: Editing n900's rootfs.jffs2
 
Correct way how to erase/flash rootfs partition (on which is ubi) is to use ubiformat utility.

Before using ubiformat utility, first any mounted ubifs volume must be umounted and ubi device deattached from mtd partition.

Code:

$ umount ubi:rootfs
$ ubidetach /dev/ubi_ctrl -d 0

Erasing mtd partition on with is ubi:

Code:

$ ubiformat /dev/<mtd_rootfs>
Erasing & Flashing new ubi image (with volumes) on mtd partition:

Code:

$ ubiformat /dev/<mtd_rootfs> -s 512 -O 512 -f <image.ubi>
After flashing new ubi image to mtd, ubi can be attached to mtd device again:

Code:

$ ubiattach /dev/ubi_ctrl -p /dev/<mtd_rootfs>
And then available ubifs volume in ubi can be mounted
Code:

$ mount ubi:rootfs </mountpoint> -t ubifs

pali 2013-02-25 13:40

Re: Editing n900's rootfs.jffs2
 
So correct way how to mount N900 rootfs on computer using nandsim is:
(this will use ubiformat instead mtdblock and dd as in #3rd post)

1. Load nandsim module (which emulate nand mtd device) with same layout as has N900:
Code:

$ modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15 parts=1,3,2,16,16,2010
2. Load ubi and ubifs modules:
Code:

$ modprobe ubi
$ modprobe ubifs

3. Flash rootfs ubi image to emulated nand mtd device:
Code:

$ ubiformat /dev/mtd5 -s 512 -O 512 -f <rootfs_image>
4. Attach mtd device to ubi:
Code:

$ ubiattach /dev/ubi_ctrl -p /dev/mtd5
5. Mount rootfs volume (ubifs image) from ubi to /mnt/n900:
Code:

$ mkdir -p /mnt/n900
$ mount ubi:rootfs /mnt/n900 -t ubifs

And then rootfs image should be mounted to /mnt/n900

Umounting & cleaning:
Code:

$ umount /mnt/n900
$ ubidetach /dev/ubi_ctrl -d 0
$ rmmod ubifs
$ rmmod ubi
$ rmmod nandsim



All times are GMT. The time now is 11:08.

vBulletin® Version 3.8.8