This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: JFFS2 on big-endian system
On Montag, 24. November 2003 21:10, Gary Thomas wrote:
> On Mon, 2003-11-24 at 10:46, Roland Caßebohm wrote:
> > Hello,
> >
> > I try to use jffs2 on my big-endian system. First I had the problem, that
> > mkfs.jffs2 couldn't make big-andian images, even if -b was set. Now I
> > have a newer version which could do that.
> >
> > This is what I have done:
> >
> > Linux> mkfs.jffs2 -o jffs2_b.img -b -r experimental -e 0x10000
> >
> > RedBoot> load -r -b 0x40000 -h 192.168.1.36 jffs2_b.img
> > RedBoot> fis create -f 0x20c0000 -l 0x30000 jffs2
> >
> > It works except of mount() gave th following output:
> >
> > <4>Node at 0x00000c30 with length 0x000004d6 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 0x00000c38:
> > 0xde82 instead
> > <5>Further such events for this erase block will not be printed
> > <5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001000:
> > 0x7cba instead
> > <5>Further such events for this erase block will not be printed
> >
> > Does anybody know what could be wrong?
>
> Does your FLASH actually have an erase block size of 64K (0x10000)?
> This number is *critical* - if it's wrong, either too large or too
> small, the whole file system fails.
>
> Other than that, try turning on the low level debug messages. That may
> show you something.
I have tried something other, I've created an empty image:
RedBoot> fis create -f 0x20c0000 -l 0x30000 jffs2
Now mount() executes without any warnings and I can create and delete files,
but after the next reboot mount() gave the following warnings:
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000:
0x2003
instead
<5>Further such events for this erase block will not be printed
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001000:
0x2003
instead
<5>Further such events for this erase block will not be printed
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002000:
0x2003
instead
<5>Further such events for this erase block will not be printed
...
If I look at the FLASH image at offset for example 0x5000 I get:
RedBoot> x -b 0x20c5000
020C5000: 20 03 20 03 00 00 00 0C 81 24 4B 06 FF FF FF FF | . ......$K.....|
020C5010: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
So at the place of the magic bitmask is a copy of the node type.
With debugging I found out that my compiler seems to have problem making
such initialization as it is done in jffs2_mark_erased_block().
The attached change fixed it to me, but I think maybe it is a compiler bug?
Maybe the other problems I have if I save a ready filesystem image in FLASH
has similar reasons.
Roland
Index: fs/jffs2/current/src/erase.c
===================================================================
RCS file: /home/cassebohm/net/USERS/CVSROOT/VSprojects/ecos/packages/fs/jffs2/current/src/erase.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 erase.c
--- fs/jffs2/current/src/erase.c 29 Sep 2003 15:15:55 -0000 1.1.1.1
+++ fs/jffs2/current/src/erase.c 25 Nov 2003 15:40:08 -0000
@@ -361,15 +361,15 @@ static void jffs2_mark_erased_block(stru
jeb->free_size = c->sector_size;
jeb->used_size = 0;
jeb->dirty_size = 0;
jeb->wasted_size = 0;
} else {
- struct jffs2_unknown_node marker = {
- .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK),
- .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
- .totlen = cpu_to_je32(c->cleanmarker_size)
- };
+ struct jffs2_unknown_node marker;
+
+ marker.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
+ marker.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER);
+ marker.totlen = cpu_to_je32(c->cleanmarker_size);
marker.hdr_crc = cpu_to_je32(crc32(0, &marker, je32_to_cpu(marker.totlen) - 4));
ret = jffs2_flash_write(c, jeb->offset, je32_to_cpu(marker.totlen), &retlen, (char *)&marker);
if (ret) {
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss