This is the mail archive of the ecos-discuss@sources.redhat.com 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: jffs2: "Magic bitmask" problem and solution (a BUG?)


We have seen a similar error with gcc 3.2 (cross compiling i386-mips).
This is fixed in 3.3.3 which we currently use.

Note: 3.3.3 places all .bss data in .data resulting in very large binary images.
My colleague found this solution to this: "The final solution is to remove -fdata-sections from all ecc files and our make files."


/David Marqvar
Thrane & Thrane


-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of liu hua
Sent: 6. oktober 2004 12:17
To: ecos-discuss@sources.redhat.com
Cc: andrew@lunn.ch
Subject: [ECOS] jffs2: "Magic bitmask" problem and solution (a BUG?)

When I test jffs2 ,I met a "mount" 
problem.(http://ecos.sourceware.org/ml/ecos-discuss/2004-10/msg00076.html)
When I install a new jffs2 image file from redboot,the first "mount" in application can run normally,but only this "mount" is normally,other "mount" report follow message:
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050004: 
0x000c
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050008: 
0xdc6d
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060000: 
0x2003
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060004: 
0x000c
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060008: 
0xdc6d
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070000: 
0x2003
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070004: 
0x000c
 instead
<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070008: 
0xdc6d
 instead

So,I debug and trace the source code ,found follow:
In the head of each block,the content is "0x20032003", i.e.
  addr.      content
 0x1020000  0x20031985
 0x1030000  0x20032003
 0x1040000  0x20032003
 ...
 0x1070000  0x20032003

I think that "0x20032003" should be "0x20031985" ,because the jffs2.h have
define:

#define JFFS2_MAGIC_BITMASK 0x1985
#define JFFS2_NODE_ACCURATE 0x2000
#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)

So,the JFFS2_NODETYPE_CLEANMARKER is 0x2003

But,when I trace to erae.c:
-----------------------------------
1  static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
2  {
3	...
4	/* Write the erase complete marker */	
5	D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", 
jeb->offset));
6	if (jffs2_cleanmarker_oob(c)) {
7	...
8	} else {
9		struct jffs2_unknown_node marker = {
10			.magic =	cpu_to_je16(JFFS2_MAGIC_BITMASK),
11			.nodetype =	cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
12			.totlen =	cpu_to_je32(c->cleanmarker_size)
13		};
14
15		marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct 
jffs2_unknown_node)-4));
16
17		/* We only write the header; the rest was noise or padding anyway */
18		ret = jffs2_flash_write(c, jeb->offset, sizeof(marker), &retlen, (char 
*)&marker);
	...
}
---------------------------------
I have found the problem is in line 10 and line 11, i.e.
			.magic =	cpu_to_je16(JFFS2_MAGIC_BITMASK),
			.nodetype =	cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
step by step,the "marker" first 4 bytes is "0x20032003",and it should be "0x20031985"!

So,I modifyed the two line as:
			.magic =	0x1985,//cpu_to_je16(JFFS2_MAGIC_BITMASK),
			.nodetype =	0x2003,//cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
Rebuild ecos and applicatoin,the "mount" is normally!But I have no more test for it.

I doubt that is a BUG.
Are there anther rather solution?

Thanks!

_________________________________________________________________
äçäçäæåççåéäççâ MSN Hotmailã  http://www.hotmail.com  


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



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