Ok, I think I understand what needs to be done, but it is not working. >> $ mkdir synthbuild >> $ cd synthbuild >> $ ecosconfig new linux >> $ ecosconfig add posix fileio net freebsd_net eth_drivers linux_compat >> flash crc jffs2 > ^^^^^ > > As you added 'flash' package, the flash parts on the target will be > simulated via regular file (by default its name is 'synthv2.flash') In > fact you can create such file (=flash image) using mkfs.jffs2 with some > additional options (pad size, erase size, etc. for a reference look on > flash defaults in eCos config file).
Yep, I found 'synthv2.flash' in the eCos config file (ecos.ecc). I would like to believe that I could create that file on my host, but I am yet to be successful. According to the .ecc file: CYGNUM_FLASH_SYNTH_V2_BLOCKSIZE=65536 (erase block size) CYGNUM_FLASH_SYNTH_V2_NUMBLOCKS=15 CYGNUM_FLASH_SYNTH_V2_NUMBOOT_BLOCKS=8 CYGNUM_FLASH_SYNTH_V2_BOOT_BLOCKSIZE=8096 CYGNUM_FLASH_SYNTH_V2_BOOT_BLOCK_BOTTOM=1 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. From the above .ecc options, it would seem that the first (64K) block is subdivided into 8 smaller boot blocks. I have no way to recreate that with mkfs.jffs2. I think that this also implies that when the synthv2.flash created by eCos is mounted, that the first block is probably not looked at on an fopen(). 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? > > make -C fs/jffs2/currents tests > ./install/tests/fs/jffs2/current/tests/jffs2_1 -mw -io > > etc. > > Do jffs2 tests pass? If you can see 'synthv2.flash' creates itself on > the first test run. Look on the sources of tests and you will get a tip > how to manage your issue. In two words, Do not use file2c.tcl converter, > and use flash image file. When you port image to real target call about > an endianness. jffs2_1 and jffs2_2 pass, but jffs2_3 fails (more like, blows up). 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) "," stringify(CYGNUM_FS_JFFS2_TEST_LENGTH) That define evaluates to: JFFS2_TEST_DEV="/dev/flash/0/CYGNUM_FS_JFFS2_TEST_OFFSET,CYGNUM_FS_JFFS2_TEST_LENGTH" 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. 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. Snip of error messages: <4>Node at 0x00001830 with length 0x000008f5 would run over the end of the erase block <4>Perhaps the file system was created with the wrong erase size? <5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001834: 0x08f5 instead <5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001838: 0x835a instead My current state is that I am unable to get the mkfs.jffs2 to produce an image that jffs2 in eCos will work with. 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) - CYGNUM_FLASH_SYNTH_V2_NUMBOOT_BLOCKS=0 (disable boot blocks) Also, is the synthetic flash big endian or little endian? I haven't seen that documented anywhere yet. Thanks, -- Mike -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss