Re: how to use jff2 on UBI layer?

Frank Haverkamp
2006-07-10T13:01:28Z

Hi,

On Mon, 2006-07-10 at 10:50 +0800, Marteo Tim wrote:
> I'm interesting in UBI, which is the new flash management layer. I
> have also get the newest UBI sources from git.
> My question is: how can i use jff2 on UBI layer? In UBI's source, i
> can not find block device relating codes. After load UBI module, i
> found /dev/ubi0, but it is a char device.
> Thanks.

the code which enables you to run JFFS2 on a UBI volume is currently
under discussion between Joern, Thomas Gleixer and Artem. We have
a working prototype, but we think, that it needs some reworks. That is
why it is not yet published. I am trying to make the folks hurry
up, but they are currently busy.

I will try to describe what you need to do to run JFFS2 although we
need to wait for the code still.

/dev/ubi0 is the UBI device, you cannot run JFFS2 on it. To run JFFS2,
you need to create a dynamic UBI volume first. You can do that in three
ways:

1. Use the UBI toolchain to create a binary image containing UBI
volumes. mtd-utils.git/ubi-utils/scripts/test.cfg shows a configuration
file where you specify the volumes you want to have and the binary input
you want to put into them. The JFFS2 volume needs to be a dynamic UBI
volume, because you want to write single pages or subpages if mtd allows
it. The pfi file is processed by pfi2bin and bin2nand to form an image
for your flash. See the example Makefile in that directory too. In
bin2nand you might want add your specific ECC layout in the OOB data if
the existing one is not valid for your hardware. The resulting data you
can flash - bad block aware - into your NAND flash. For NOR you ommit
the bin2nand step and take the binary directly. This can be done by a
JTAG utility or by nandwrite. The output will contain a UBI volume
information table and when you attach your mtd device to UBI, it will
generate all the volumes you defined automatically.

2. Use the UBI tools on the system itself create, delete and update UBI
volumes. ubimkvol creates volumes, ubiupdatevol will push data into them
and with ubirmvol you can remove them (use ubiupdatevol ... -t to
truncate them, otherwise UBI will not let you delete them).

3. Use the pfi file generated by mkpfi and the tool pfiflash on the
target system to automatically update your flash. This tool is intended
to easily allow UBI volume update. The pfi contains the UBI volume
parameters and if the volume is not existing it will be created
automatically by the tool.

Option 2 is good for trying it out. Option 1. is more for a
manufacturing kind of process. Option 3. can be used for updating UBI
volumes which are not in use (if you have a rootfs, or mounted fs in a
UBI volume it is in use and cannot be updated that way of course).

If you have the dynamic volumes for your JFFS2 created you could mount
them like this:

mount -t jffs2 mtd:rootfs_0 /mnt/
^
|
name of UBI volume (specified in the cfg file or with ubimkvol

The last step would work if the mtd->ubi translation layer, which we
call gluebi (glue/UBI) would be available. I hope that this issue is
solved soon.

Regards,

Frank