Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

How to use JFFS2?

I have tried to use jffs2 and I gotten it to work "somewhat". I write a sentence to a file and I just read the first word back. I would like to see a step-by-step guide to how to use jffs2. I haven't found anything good after some searchers on google.

This is want I want to do: I have mounted compact flash to / and I want to mount jffs2 to for example /jffs2. Or is it better to mount jffs2 to / and compact flash to for example /cf? Where can I see how much of the flash my program and the hardware design uses? I use the Nios Dev Kit, Cyclone Edition so I have 8 MB flash to play with. I need about 1 MB or I can settle with as little as 100 kB. I would like to configure and set up somewhere that for example from address 0x00200000 to 0x002FFFFF there's a jffs2 filesystem. The flash is locked to begin at 0x0. How do I make a filesystem there? I might have access to Linux if that's any help (as in mkfs.jffs2). Do I make a image that's 1 MB large and then burn it to flash?

Ole

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > How do I make a filesystem there? I might have access to Linux if that's

    > any help (as in mkfs.jffs2). Do I make a image that's 1 MB large and then

    > burn it to flash?

    Yes ... but if you erase the entire partition prior to writing it to flash,

    there's no need to pad your jffs2 image (since it'll be padded with 0xff).

    If your initial jffs2 image is small WRT the partition size, this can

    improve your download/programming time.

    Regards,

    --Scott
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Is the jffs2 filesystem resizeable? I made a image on my linux box with mkfs.jffs2 with one file and a folder in it. But I want to be able to create files in the jffs2 filesytem when eCos is running. Does the filesystem resize itself with regard to how much data that's written to it?

    Ole
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > Is the jffs2 filesystem resizeable?

    The filesystem is just the structures, attributes, rules etc applied to

    accessing inodes on a physical media. So it's the size of the media

    (or one of its partitions) that matters.

    > I want to be able to create files in the jffs2 filesytem when eCos is

    > running. Does the filesystem resize itself with regard to how much

    > data that's written to it?

    JFFS2 depends on mtd to determine the size of the flash device (or

    flash partition) that it's using. If space is available new files will be

    written to available sectors.

    Regards,

    --Scott