Forum Discussion

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

How do I creat a jffs2 image?

I have a Microtronix uKit development board. I want to use jffs2 instead of romfs for my primary filesystem.

Does anyone know how to create a jffs2 image from within the Windows NIOS II IDE?

If I was on a Linux box, I would download the latest mtd snapshot, build the tools, install them, then use the appropriate utilities to create the image based on a target directory. I'm not sure how to accomplish all of this under the NIOS II IDE.

Also, can all of this be performed on the host system, or should some or all of it be performed on the target system? I have accidentally blown away my Linux kernel and filesystem that pre-existed on the board. Therefore, I do not have a working target to use for development.

Can anyone help me through this?

4 Replies

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

    > Does anyone know how to create a jffs2 image from within the Windows

    > NIOS II IDE?

    You'll need to port mkfs.jffs2 to cygwin -- I have a version laying around

    somewhere ... if I can find it, I'll post it somewhere appropriate for download.

    > If I was on a Linux box, I would download the latest mtd snapshot, build the

    > tools, install them, then use the appropriate utilities to create the image based

    > on a target directory. I'm not sure how to accomplish all of this under the NIOS II IDE.

    I didn't build the jffs2 filesystem via the IDE -- I just used the shell and mkfs.jffs2.

    It should be relatively straight forward to setup a simple make file that invokes

    mkfs.jffs2 via the IDE though.

    A few things to keep in mind: the IDE linux filesystem utilities do some handy

    conversions for you ... like removing .exe extensions, and setting up device

    inode [major,minor] numbers (based on the device filename -- you can

    look at your target /dev to see what I mean). When using mkfs.jffs2, I just used

    the -D, --devtable option.

    > Also, can all of this be performed on the host system, or should some or all of it be

    > performed on the target system?

    Yes, all can be performed on the host under cygwin -- once you have mkfs.jffs2.

    But you'll need the native gcc -- which isn't (wasn't) part of the Nios-II tools. When

    I installed the Microtronix linux, native gcc was included (presumably to support

    menu config, etc.) -- which BTW is really great to have :-) -- kudos to Microtronix!

    A final note: if you're using the "standard" AMD AM29LV065D flash, you may experience

    some problems with the cfi chip driver -- I'm not sure if this has been resolved in the

    2.6 kernel sources yet.

    Regards,

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

    Thank you for your help. As far as the IDE goes, I'm perfectly happy to use the command line environment. Its just that I'm not familiar with cygwin, nios2 ide, or the nios2 command line tools.

    If you can find your port, that would be great. It would at least provide me with validation for my own effort. In the meantime, I've copied the mtd code over to my cygwin environment and am trying to port it over also.

    Does the porting mostly involve redirecting library and include directories, or is there custom coding involved?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > Does the porting mostly involve redirecting library and include directories,

    > or is there custom coding involved?

    It's mostly getting the proper include files setup and defining a few macros

    that are not normally present in the cygwin headers.

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

    Source code is available at:

    http://www.psyent.com/download (http://www.psyent.com/download)

    The file you want is flashfs.tar.gz.

    To build, open Nios-II shell, then:

    1. Un-tar

    2. In both subdirectories: just 'make'

    3. Copy the .exe to your /usr/local/bin

    Enjoy,

    --Scott

    PS - if you find any bugs/problems, please feel free to send me

    a patch -- I'll update so everyone can get the fixes.