public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: John Smith <john.smith@arrows.demon.co.uk>
To: linux-mtd@lists.infradead.org
Subject: Re: UBI and OneNAND
Date: Tue, 7 Nov 2006 10:20:42 +0000 (UTC)	[thread overview]
Message-ID: <loom.20061107T110704-786@post.gmane.org> (raw)
In-Reply-To: 1162889433.5606.15.camel@localhost.localdomain

Frank Haverkamp <haver <at> vnet.ibm.com> writes:

> 
> Hi,
> 
> On Tue, 2006-11-07 at 02:35 +0000, 박경민 wrote:
> > Hi,
> > 
> > Sorry for changing subject. My mail program has some problem.
> > 
> > > > I think the following commands just worked:
> > > > 
> > > >   mkdir /mnt/nvm
> > > >   flash_eraseall /dev/mtd6
> > > >   mount -t jffs2 /dev/mtdblock6 /mnt/nvm 
> 
> I think there is a missunderstanding here. UBI acts as volume management
> system. The MTD you connect to UBI cannot be mounted. Instead you create
> a UBI volume (with ubimkvol) which has an associated mtd which can be
> used to host a jffs2. This can be mounted than.
> 
> > Umm. I think 'John' just mounts jffs2 without UBI.
> 
> Yes, I agree.

My original explanation was incomplete. Here is a fuller version.

The MTD code is compiled into the kernel, rather than as a kernel module.
The kernel command line includes:
   ubi.mtd=4
At boot time, the following is reported to the console:

Using static partition definition
Creating 2 MTD partitions on "Arrow 1504 Flash":
0x00000000-0x00c00000 : "BootLoader"
0x00c00000-0x01000000 : "OldCFE"
OneNAND 16MB 2.65/3.3V 16-bit (0x05)
Scanning device for bad blocks
Creating 4 MTD partitions on "Arrow-Onenand":
0x00000000-0x00100000 : "CFE"
0x00100000-0x00500000 : "Kernel"
0x00500000-0x00ff0000 : "rootfs"
0x00ff0000-0x01000000 : "CFE-NVM"
UBI: background thread "ubi_bgt0d" started, PID 14
UBI: mean erase counter:         1
UBI: attached mtd4 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            10 MB
UBI: physical eraseblock size:   65536 bytes (64 KB)
UBI: logical eraseblock size:    63488 bytes
UBI: number of good PEBs:        175
UBI: number of bad PEBs:         0
UBI: smallest flash I/O unit:    1024
UBI: VID header offset:          1024 (aligned 1024)
UBI: data offset:                2048
UBI: max. allowed volumes:       128
UBI: wear-levelling threshold:   4096
UBI: number of internal volumes: 2
UBI: number of user volumes:     1
UBI: available PEBs:             49
UBI: total number of reserved PEBs: 126
UBI: number of PEBs reserved for bad PEB handling: 1


##
## Then with the busybox shell I can list the MTD partitions
##

/ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00c00000 00020000 "BootLoader"    <<< Nor Flash
mtd1: 00400000 00020000 "OldCFE"        <<< Nor Flash
mtd2: 00100000 00010000 "CFE"           <<< OneNAND Flash
mtd3: 00400000 00010000 "Kernel"        <<< OneNAND Flash
mtd4: 00af0000 00010000 "rootfs"        <<< OneNAND Flash
mtd5: 00010000 00010000 "CFE-NVM"       <<< OneNAND Flash
mtd6: 00753800 0000f800 "Kernel"        <<< UBI Partition on mtd4:

##
## I ceate a new 2M byte UBI Volume
##
/ # ubimkvol -s 2000000 -N NVM -d 0

/ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00c00000 00020000 "BootLoader"
mtd1: 00400000 00020000 "OldCFE"
mtd2: 00100000 00010000 "CFE"
mtd3: 00400000 00010000 "Kernel"
mtd4: 00af0000 00010000 "rootfs"
mtd5: 00010000 00010000 "CFE-NVM"
mtd6: 00753800 0000f800 "Kernel"
mtd7: 001f0000 0000f800 "NVM"            <<< New UBI Partition

##
## Look at existing devices
##
/ # ls -l /dev/mtdblock?
brw-r-----    1 0        0         31,   0 Jan  1 00:00 /dev/mtdblock0
brw-r-----    1 0        0         31,   1 Jan  1 00:00 /dev/mtdblock1
brw-r-----    1 0        0         31,   2 Jan  1 00:00 /dev/mtdblock2
brw-r-----    1 0        0         31,   3 Jan  1 00:00 /dev/mtdblock3

##
## Create a new device for my new partition
## (I do not have the udev tools installed)
##
/ # mknod /dev/mtdblock7 b 31 7

##
## Mount my new JFFS2/UBI partition
## (Note the erase size is further confirmation that I have a UBI partition)
##
/ # mkdir /mnt/nvm
/ # mount -t jffs2 /dev/mtdblock7 /mnt/nvm
JFFS2 write-buffering enabled buffer (1024) erasesize (63488)


##
## Copy a file to the JFFS2 Partition
##
/ # cp /my_module.ko /mnt/nvm

##
## Check it
##
/ # md5sum /my_module.ko /mnt/nvm/my_module.ko
bbb66a91c259fe42290bfa2952b2265f  /my_module.ko
bbb66a91c259fe42290bfa2952b2265f  /mnt/nvm/my_module.ko

##
## Unmount the jffs2 partition
##
/ # umount /mnt/nvm

##
## Check the file has gone away
##
/mnt/nfs/ubi-tools # md5sum /my_module.ko /mnt/nvm/my_module.ko
bbb66a91c259fe42290bfa2952b2265f  /my_module.ko



##
## Power cycle, and let the box boot up again
##

Using static partition definition
Creating 2 MTD partitions on "Arrow 1504 Flash":
0x00000000-0x00c00000 : "BootLoader"
0x00c00000-0x01000000 : "OldCFE"
OneNAND 16MB 2.65/3.3V 16-bit (0x05)
Scanning device for bad blocks
Creating 4 MTD partitions on "Arrow-Onenand":
0x00000000-0x00100000 : "CFE"
0x00100000-0x00500000 : "Kernel"
0x00500000-0x00ff0000 : "rootfs"
0x00ff0000-0x01000000 : "CFE-NVM"
UBI: background thread "ubi_bgt0d" started, PID 14
UBI: mean erase counter:         1
UBI: attached mtd4 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            10 MB
UBI: physical eraseblock size:   65536 bytes (64 KB)
UBI: logical eraseblock size:    63488 bytes
UBI: number of good PEBs:        175
UBI: number of bad PEBs:         0
UBI: smallest flash I/O unit:    1024
UBI: VID header offset:          1024 (aligned 1024)
UBI: data offset:                2048
UBI: max. allowed volumes:       128
UBI: wear-levelling threshold:   4096
UBI: number of internal volumes: 2
UBI: number of user volumes:     2  <<< this time there is an extra partition
UBI: available PEBs:             17
UBI: total number of reserved PEBs: 158
UBI: number of PEBs reserved for bad PEB handling: 1


BusyBox v1.00 (2006.08.30-22:06+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00c00000 00020000 "BootLoader"  << Nor
mtd1: 00400000 00020000 "OldCFE"      << Nor
mtd2: 00100000 00010000 "CFE"         << OneNAND
mtd3: 00400000 00010000 "Kernel"      << OneNAND
mtd4: 00af0000 00010000 "rootfs"      << OneNAND
mtd5: 00010000 00010000 "CFE-NVM"     << OneNAND
mtd6: 001f0000 0000f800 "NVM"         << UBI on mtd4:
mtd7: 00753800 0000f800 "Kernel"      << UBI on mtd4:

/ # mknod /dev/mtdblock6 b 31 6
/ # mount -t jffs2 /dev/mtdblock6 /mnt/nvm
JFFS2 write-buffering enabled buffer (1024) erasesize (63488)

##
## Check the file in the jffs2 partition
##
/ # md5sum /mnt/nvm/my_module.ko
bbb66a91c259fe42290bfa2952b2265f  /mnt/nvm/my_module.ko
/ # md5sum /my_module.ko
bbb66a91c259fe42290bfa2952b2265f  /my_module.ko


So I am convinced. 
Of course, the credit belongs to all who wrote the code. 
Thanks,
John Smith

  reply	other threads:[~2006-11-07 10:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-07  2:35 UBI and OneNAND 박경민
2006-11-07  8:50 ` Frank Haverkamp
2006-11-07 10:20   ` John Smith [this message]
2006-11-07 11:39     ` Artem Bityutskiy
2006-11-07 11:47       ` Josh Boyer
2006-11-07 14:10         ` Artem Bityutskiy
2006-11-07 14:24           ` Josh Boyer
2006-11-07 14:39             ` Artem Bityutskiy
2006-11-07  9:16 ` Artem Bityutskiy
2006-11-08 16:03 ` Artem Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2006-11-07 12:52 Kyungmin Park
2006-11-08 16:09 ` Artem Bityutskiy
2006-11-04  8:22 UBI and OneNand John
2006-11-06  9:46 ` Frank Haverkamp
2006-11-06 13:18   ` Artem Bityutskiy
2006-11-06 20:16   ` John Smith
2006-11-06 20:54     ` Josh Boyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20061107T110704-786@post.gmane.org \
    --to=john.smith@arrows.demon.co.uk \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox