This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to incorporate a file system image when building eCos app

On Wed, 16 Feb 2011, Michael Bergandi wrote:

> Ok, I think I understand what needs to be done, but it is not working.


> I studied the mkfs.jffs2 documentation and came up with the closest
> command line I could to achieve a flash image comparable to
> synthv2.flash. From the above, I need to set the erase block size to
> 64K and pad out the image to 1MB (total size of main and boot blocks).
> $ mkfs.jffs2 -r myfs -e 65536 -p 1048576 -o synthv2.flash
> The result is a synthv2.flash with a size of 65536... Umm, where is my
> padding??? This essentially means I have a 1 block image.
Hm, maybe mtd-tools version? ...or (I guess) its usage?

% mkfs.jffs2 -V
mkfs.jffs2: revision 1.60

% mkdir -p foo && touch foo/bar
mkfs.jffs2 --faketime --squash --pad=0x100000 --eraseblock=0x10000 --root foo --output image.jffs2

% dd if=image.jffs2 of=/dev/null
2048+0 records in
2048+0 records out
1048576 bytes (1.0 MB) copied, 0.00294158 s, 356 MB/s
                    | what you wanted

Well, '--faketime' && '--squash' are optional.

TIP: Sometime, I do not use any compression if I use jffs2 on the slow
targets, adding '--compression-mode=none' or '-m none' to command-line,
but this should be no issue for synthetic target.


> I think I will need to disable boot blocks in the config to get around
> that part.


> > Ok, and what's about fs/jffs2 eCos tests?


> jffs2_1 and jffs2_2 pass, but jffs2_3 fails (more like, blows up).
                            I think some things were misconfigured.

> synthv2.flash does get created when I run jffs2_1.

> Yes, I did look over the jffs2 tests. They did provide insight as to
> what is going on. The test simply tries to mount the jffs2 file system
> on JFFS2_TEST_DEV at "/". During the mount, jffs2 fs code looks for
> synthv2.flash. If it is not found, the file is created. One thing that
> really bugs me is the JFFS2_TEST_DEV use:
> <<fs/jffs2/current/tests/jffs2_1.c>>
> # define JFFS2_TEST_DEV "/dev/flash/0/"
> stringify(CYGNUM_FS_JFFS2_TEST_OFFSET) ","
> That define evaluates to:
> I verified it in gdb. CYGNUM_FS_JFFS2_TEST_OFFSET and
> CYGNUM_FS_JFFS2_TEST_LENGTH are not defined _anywhere_ in the ecos
> tree. Since the image gets mounted successfully in the test, I assume
> that the offset and length are just ignored if they aren't numbers.

Hm, in a fact default test values should be placed in a component
placed under CYGPKG_IO_FLASH_TESTS component), but, CYGPKG_FS_JFFS2_TESTS
is just an option. It seems to me this should be fixed.  Fortunately,
it is not issue for the tests on the eCos synthetic target.

> Since the above was working for the test, I got rid of my MTAB_ENTRY
> and went with using 'mount' EXACTLY as the test did. My image does get
> mounted, but it complains about the size, since it doesn't match the
> config parameters.

Config/adjust/sync eCos synthv2 flash parameters via CDL (eCos app)
and mkfs.jffs2 (host side).

> Snip of error messages:
> <5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> 0x00001838: 0x835a instead

I cannot mount JFFS2 and see "Magic bitmask 0x1985 not found" messages
This is the famous Q (with answers!) from

> My current state is that I am unable to get the mkfs.jffs2 to produce
> an image that jffs2 in eCos will work with.

Try my options (see above).

> I am going to try adjusting the config options for the synthetic flash
> device to get them as close as I can to the output of what mkfs.jffs2
> is generating, since I can't seem to make it do what it is supposed
> to.
>     - CYGNUM_FLASH_SYNTH_V2_NUMBLOCKS=1 (single block)
                                        ^^^^^^^^^^^^^^^^ Why ?!

>     - CYGNUM_FLASH_SYNTH_V2_NUMBOOT_BLOCKS=0 (disable boot blocks)
                                               ^^^^^^^^^^^^^^^^^^^^ OK

Just now I ran all 3 jffs2 tests on synthetic target with minimal import

cdl_configuration eCos {
    template    default ;
    package CYGPKG_IO_FLASH current ;
    package CYGPKG_IO_FILEIO current ;
    package CYGPKG_CRC current ;
    package CYGPKG_COMPRESS_ZLIB current ;
    package CYGPKG_LINUX_COMPAT current ;
    package CYGPKG_FS_JFFS2 current ;
    user_value 256
    user_value 0

As you can see I used 10M "flash" without boot blocks.

> Also, is the synthetic flash big endian or little endian? I haven't
> seen that documented anywhere yet.

The same as CPU (x86, x86-64 are yours, I hope), so it is little-endian.



Before posting, please read the FAQ:
and search the list archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]