[U-Boot] How to create a JFFS2 image to use with U-Boot

David.Kondrad at onqlegrand.com David.Kondrad at onqlegrand.com
Wed Jan 14 15:09:06 CET 2009


Giuseppe,

> I think to use:
>  dd if=/dev/mtd4 of=/rootfs_jffs2.img

Yes, I think that should do it, but you'll end up with an image the size of
your partition.
If it's a small partition (say 16M) then I guess it's not an issue.

If you have access to an NFS rootfs, then you can boot using that and mount
JFFS2 partition.
Then you can use mkfs.jffs2 to extract only the data from the partition,
thus saving space with the image.

> After that, I can download this file from U-Boot running on the new
> board (by tftp or similar), erase the Flash sectors and copy the file
> to Flash (cp.b command).

Yes, you've got it. Just remember to unprotect the flash area first.

>It this procedure correct? I read somewhere (link omitted)
>that U-Boot, in certain cases, isn't able to write JFFS2 image
>files to Flash and could appear errors like:
>  "Empty flash at 0xXXXXXX

This is not an 'error' per se... according the linux mtd technical faq,
it's caused when blocks are partially used
or found to be erased without clean markers. I've found JFFS2 to be a
little nerve-wracking to use at times because
it's so verbose with messages... if you took most of them seriously, you'd
think that your rootfs is about to die.

For example, if you're creating an image from a tarball and you forget to
specify the '-j' option to flash_eraseall
you'll get a flood of those messages when you mount the partition until
every block has been used.

So, if you're not getting those messages now from rootfs mount, then you
won't get them from copying the flash.

Regards,
David

DAVID A. KONDRAD
Software Design Engineer
On-Q/Legrand
Telephone (800) 321-2343 x311
www.onqlegrand.com



More information about the U-Boot mailing list