Difference between revisions of "JFFS2 images over UBI layer"
m (1 revision(s)) |
(→Kernel support) |
||
Line 3: | Line 3: | ||
== Kernel support == | == Kernel support == | ||
− | In order to get UBI and UBI GLUE driver working you need to enable them in kernel configuration. In kernel configuration choose '''"Device Drivers -> Memory Technology Device (MTD) support -> UBI - Unsorted block images"''' menu and enable '''"Enable UBI"''' and '''" | + | In order to get UBI and UBI GLUE driver working you need to enable them in kernel configuration. In kernel configuration choose '''"Device Drivers -> Memory Technology Device (MTD) support -> UBI - Unsorted block images"''' menu and enable '''"Enable UBI"''' and '''"MTD devices emulation driver"''' options. |
<pre> | <pre> | ||
┌─────────────────────────────────── UBI - Unsorted block images ────────────────────────────────────┐ | ┌─────────────────────────────────── UBI - Unsorted block images ────────────────────────────────────┐ | ||
Line 12: | Line 12: | ||
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ | │ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ | ||
│ │ <*> Enable UBI │ │ | │ │ <*> Enable UBI │ │ | ||
− | │ │ (4096) UBI wear-leveling threshold | + | │ │ (4096) UBI wear-leveling threshold │ │ |
− | │ │ (1) Percentage of reserved eraseblocks for bad eraseblocks handling | + | │ │ (1) Percentage of reserved eraseblocks for bad eraseblocks handling │ │ |
− | │ │ | + | │ │ <*> MTD devices emulation driver (gluebi) │ │ |
│ │ *** UBI debugging options *** │ │ | │ │ *** UBI debugging options *** │ │ | ||
− | │ │ [ ] UBI debugging | + | │ │ [ ] UBI debugging │ │ |
│ │ │ │ | │ │ │ │ | ||
│ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │ | │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │ | ||
Line 49: | Line 49: | ||
'''root=/dev/mtdblockY''' and add '''ubi.mtd=X,2048''' parameter, so the MTD partition containing the new UBI volume will be attached on kernel boot prior to root filesystem mount. | '''root=/dev/mtdblockY''' and add '''ubi.mtd=X,2048''' parameter, so the MTD partition containing the new UBI volume will be attached on kernel boot prior to root filesystem mount. | ||
− | == JFFS2 image eraseblock size == | + | == UBI logical eraseblock size and JFFS2 image eraseblock size == |
− | UBI layer is using some part of NAND's ''physical'' erase block for it's own needs (e.g. bad blocks handling), therefore it provides a ''logical'' eraseblock for filesystem use. The logical eraseblock size is smaller than the physical, so when you construct the JFFS2 image, as described in section [[Linux_Development_for_XScale_modules#JFFS2_images|JFFS2 images]], you should set the {{parameter|eraseblock}} parameter to UBI's logical eraseblock size. <br> | + | UBI layer is using some part of NAND's ''physical'' erase block for it's own needs (e.g. bad blocks handling), therefore it provides a ''logical'' eraseblock for filesystem use. The logical eraseblock size is smaller than the physical, so when you construct the JFFS2/UBIFS image, as described in section [[Linux_Development_for_XScale_modules#JFFS2_images|JFFS2 images]] and [[Linux_Development_for_XScale_modules#UBIFS_images|UBIFS images]], you should set the {{parameter|eraseblock}} (JFFS2) and {{parameter|leb-size}} (UBIFS) parameter to UBI's logical eraseblock size. <br> |
The UBI logical eraseblock size can be obtained by invoking the command: | The UBI logical eraseblock size can be obtained by invoking the command: | ||
<pre> | <pre> |
Revision as of 14:23, 22 November 2009
On this page we assume, that you have MTD utils installed as described in Linux Development for XScale modules article.
Contents
Kernel support
In order to get UBI and UBI GLUE driver working you need to enable them in kernel configuration. In kernel configuration choose "Device Drivers -> Memory Technology Device (MTD) support -> UBI - Unsorted block images" menu and enable "Enable UBI" and "MTD devices emulation driver" options.
┌─────────────────────────────────── UBI - Unsorted block images ────────────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted letters are hotkeys. │ │ Pressing <Y> includes, <N> excludes, <M> modularizes features. Press <Esc><Esc> to exit, <?> for │ │ Help, </> for Search. Legend: [*] built-in [ ] excluded <M> module < > module capable │ │ │ │ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ <*> Enable UBI │ │ │ │ (4096) UBI wear-leveling threshold │ │ │ │ (1) Percentage of reserved eraseblocks for bad eraseblocks handling │ │ │ │ <*> MTD devices emulation driver (gluebi) │ │ │ │ *** UBI debugging options *** │ │ │ │ [ ] UBI debugging │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────────────────────────────┘
Now you can build the kernel with UBI support including the UBI GLUE driver.
User space tools
In this section we will use X as the MTD partition number attached to UBI, Y as the emulated MTD partition number and we assume that there were no MTD partitions attached to UBI before.
To prepare the NAND for use with UBI, you should take the following steps:
- Erase the MTD partition that will be used for UBI volume(s):
> flash_eraseall /dev/mtdX
- Attach the MTD partition to UBI:
> ubiattach /dev/ubi_ctrl -m X -O 2048
- Create UBI volume:
> ubimkvol /dev/ubi0 -m -N <ubi volume name>
- Update the new UBI volume with JFFS2 image:
> ubiupdatevol /dev/ubi0_0 <path to JFFS2 image>
If you want to use the new UBI volume as the root filesystem on your device, you should change the root parameter of kernel command line to boot from emulated MTD partition Y (which is UBI volume): root=/dev/mtdblockY and add ubi.mtd=X,2048 parameter, so the MTD partition containing the new UBI volume will be attached on kernel boot prior to root filesystem mount.
UBI logical eraseblock size and JFFS2 image eraseblock size
UBI layer is using some part of NAND's physical erase block for it's own needs (e.g. bad blocks handling), therefore it provides a logical eraseblock for filesystem use. The logical eraseblock size is smaller than the physical, so when you construct the JFFS2/UBIFS image, as described in section JFFS2 images and UBIFS images, you should set the eraseblock (JFFS2) and leb-size (UBIFS) parameter to UBI's logical eraseblock size.
The UBI logical eraseblock size can be obtained by invoking the command:
> cat /sys/class/ubi/ubiX/eraseblock_size
Where X is the UBI device number.