* Flash paritioning and JFFS2
@ 2007-08-23 13:36 Mirek23
2007-08-23 16:08 ` Michael Brian Willis
0 siblings, 1 reply; 6+ messages in thread
From: Mirek23 @ 2007-08-23 13:36 UTC (permalink / raw)
To: linuxppc-embedded
Dear All,
I am running linux 2.6.21 (by Grant) on the ppc405 which is build in
Virtex-4 of Avnet (xlinx ml403 like) evaluation board. The Avnet board has
the 4 MB of NOR Flash (Intel TE28F640) . I just wanted to make use of the
Flash to store
u-boot, linux kernel and some config files.
To do so I wanted first to partition Flash to three partitions:
- U-Boot
- Linux-kernel
- JFFS2 (for some config files)
Could someone advice me how to configure Linux kernel to make use of the
Flash (with above mentioned partitions and JFFS2.
The information which I have collected is as following that I have to:
enable in kernel:
Device Drivers->Memory Technology Devices (MTD)
File Systems -> Miscellaneous file systems -> JFFS2
I do not know however which specific options to enable for MTD/JFFS2 since
it has many sub options.
I do not no also where to place:
-the partition information (which I have mentioned above)
-the start (0xFF800000) and end (0xFFBFFFFF) physical location of my Flash
memory.
My aim is to mount (after booting Linux) the JFFS2 partition to store some
config data.
Best Regards and thank you in advance for any hint on that
Mirek
--
View this message in context: http://www.nabble.com/Flash-paritioning-and-JFFS2-tf4317566.html#a12293748
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Flash paritioning and JFFS2
2007-08-23 13:36 Flash paritioning and JFFS2 Mirek23
@ 2007-08-23 16:08 ` Michael Brian Willis
2007-09-07 15:23 ` Mirek23
0 siblings, 1 reply; 6+ messages in thread
From: Michael Brian Willis @ 2007-08-23 16:08 UTC (permalink / raw)
To: Mirek23; +Cc: linuxppc-embedded
On Thu, 2007-08-23 at 06:36 -0700, Mirek23 wrote:
> Could someone advice me how to configure Linux kernel to make use of the
> Flash (with above mentioned partitions and JFFS2.
The Denx U-boot and Linux Guide (DULG) will tell you how to configure
the kernel for MTD devices and will give some good general information:
http://www.denx.de/wiki/view/DULG/FlashFilesystemsMTD
> I do not know however which specific options to enable for MTD/JFFS2 since
> it has many sub options.
The following post has some relevant information for your setup:
http://osdir.com/ml/linux.uclinux.devel/2005-12/msg00130.html
> I do not know also where to place:
> -the partition information (which I have mentioned above)
The partition information probably should go in a file that you create
for your board located at "drivers/mtd/maps/<your_file>.c"
> -the start (0xFF800000) and end (0xFFBFFFFF) physical location of my Flash
> memory.
I think this information just needs to be defined in your board's .h
file in u-boot. I don't think you need to specify this in any linux
config files.
I hope this info helps.
Regards,
Michael Willis
Applied Research Labs - University of Texas
willis@arlut.utexas.edu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Flash paritioning and JFFS2
2007-08-23 16:08 ` Michael Brian Willis
@ 2007-09-07 15:23 ` Mirek23
2007-09-07 15:55 ` Michael Brian Willis
0 siblings, 1 reply; 6+ messages in thread
From: Mirek23 @ 2007-09-07 15:23 UTC (permalink / raw)
To: linuxppc-embedded
Hi Michael,
>The partition information probably should go in a file that you create
>for your board located at "drivers/mtd/maps/<your_file>.c"
Thank you very much for your answer. I went through the links you
suggested.
I got a main concept how to setup the kernel to deal with Flash and JFFS2
but I do not know in which file
should be hardcoded the partition table and what should be its name. I have
the Flash memory which is CFI
compliant (Intel NOR Flash TE28F640 J3C120) so I presume that for it is a
default driver?
Do I have to create a specific file for it in drivers/mtd/maps/ ?
Best Regards
Mirek
--
View this message in context: http://www.nabble.com/Flash-paritioning-and-JFFS2-tf4317566.html#a12557406
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Flash paritioning and JFFS2
2007-09-07 15:23 ` Mirek23
@ 2007-09-07 15:55 ` Michael Brian Willis
2007-09-28 9:51 ` Mirek23
0 siblings, 1 reply; 6+ messages in thread
From: Michael Brian Willis @ 2007-09-07 15:55 UTC (permalink / raw)
To: Mirek23; +Cc: linuxppc-embedded
On Fri, 2007-09-07 at 08:23 -0700, Mirek23 wrote:
> I have the Flash memory which is CFI
> compliant (Intel NOR Flash TE28F640 J3C120) so I presume that for it is a
> default driver?
If the flash is CFI compliant, then a default driver will probably
work.
When the kernel boots up are you able to see a message saying that it
found your flash? You might have to play around with the kernel
configuration to get it to properly recognize your flash.
> Do I have to create a specific file for it in drivers/mtd/maps/ ?
Yes, at least this is the way I did it. For example, I used
drivers/mtd/maps/tqm85xx.c as a starting point for my board specific
file. (I am using the DENX kernel).
Regards,
Michael Willis
Applied Research Labs - University of Texas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Flash paritioning and JFFS2
2007-09-07 15:55 ` Michael Brian Willis
@ 2007-09-28 9:51 ` Mirek23
2007-09-28 21:09 ` Mirek23
0 siblings, 1 reply; 6+ messages in thread
From: Mirek23 @ 2007-09-28 9:51 UTC (permalink / raw)
To: linuxppc-embedded
Dear All,
Finally I have sorted out few problems with linux and u-boot and I have
tried to come back to the jffs2 and mtd partitioning issue.
I am using CFI driver and I pass partitioning information from command line
via u-boot.
This part works fine:
Unfortunatly I have the problem when accesing the flash partitions because
my Avnet evaluation board is designet in such a way that the data should be
accessed in the mode x16 (16 bits in each goal).
Linux CFI driver is able to detect the x16 mode but it does not handle it
correctly.
I will give you an example:
My mtd1 partition contains the u-boot environment. When I print the mtd1
contents with (busybox) hexdump I get:
00000000 eb 92 00 00 62 6f 00 00 61 72 00 00 3d 63 00 00
|....bo..ar..=c..|
00000010 73 6f 00 00 3d 74 00 00 55 4c 00 00 39 36 00 00
|so..=t..UL..96..|
00000020 20 72 00 00 74 3d 00 00 65 76 00 00 66 73 00 00 |
r..t=..ev..fs..|
00000030 77 20 00 00 73 72 00 00 74 3d 00 00 39 2e 00 00 |w
..sr..t=..9...|
00000040 39 2e 00 00 34 2e 00 00 33 3a 00 00 70 74 00 00
|9...4...3:..pt..|
00000050 6c 64 00 00 31 2f 00 00 63 5f 00 00 78 2c 00 00
|ld..1/..c_..x,..|
00000060 70 20 00 00 70 3d 00 00 3a 3a 00 00 72 74 00 00 |p
..p=..::..rt..|
00000070 34 2d 00 00 72 65 00 00 65 74 00 00 3a 64 00 00
|4-..re..et..:d..|
When I copy the contents of the /dev/mtd1 to the file by 2 bytes (bs=2) I
get correct
readout:
dd if=/dev/mtd1 of=./u-boot_Env.txt bs=2 count=128k
hexdump ./u-boot_Env.txt
00000000 eb 92 c9 6d 62 6f 6f 74 61 72 67 73 3d 63 6f 6e
|...mbootargs=con|
00000010 73 6f 6c 65 3d 74 74 79 55 4c 30 2c 39 36 30 30
|sole=ttyUL0,9600|
00000020 20 72 6f 6f 74 3d 2f 64 65 76 2f 6e 66 73 20 72 | root=/dev/nfs
r|
00000030 77 20 6e 66 73 72 6f 6f 74 3d 31 32 39 2e 31 32 |w
nfsroot=129.12|
00000040 39 2e 31 34 34 2e 31 31 33 3a 2f 6f 70 74 2f 65
|9.144.113:/opt/e|
00000050 6c 64 6b 34 31 2f 70 70 63 5f 34 78 78 2c 74 63
|ldk41/ppc_4xx,tc|
The real problems begin when I want to deal with jffs2 file system.
I have mtd3 partition which is intended to hold jffs2 fs.
To create the jffs2 fs I do:
./mkfs.jffs2 --pad=0xA0000 --eraseblock=0x20000 --root=/tmp/bin/mtd1/work/
--output=image2.jffs2
flash_erase /dev/mtd3
dd if=./image2.jffs2 of=/dev/mtd3 bs=2 count=655360
After that I have jffs2 fs under /dev/mtd3.
When I try to mount the jffs2 partition fun begins:
mount -t jffs2 /dev/mtdblock3 /mnt
[ 2828.462121] jffs2_scan_eraseblock(): Node at 0x00000000 {0x1985, 0x2003,
0x00000000) has invalid CRC 0xf0600000 (calculated 0xf9d690b3)
[ 2828.610485] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
0x00000008: 0xf060 instead
[ 2828.719326] jffs2_scan_eraseblock(): Node at 0x0000000c {0x1985, 0xe001,
0x00000000) has invalid CRC 0xc3200000 (calculated 0x92fedd67)
[ 2828.870047] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
0x00000014: 0xc320 instead
[ 2828.979854] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
0x00000024: 0x46fc instead
.
.
.
.
[ 2834.858103] Further such events for this erase block will not be printed
[ 2835.029913] Cowardly refusing to erase blocks on filesystem with no valid
JFFS2 nodes
[ 2835.124378] empty_blocks 0, bad_blocks 0, c->nr_blocks 5
mount: mounting /dev/mtdblock3 on /mnt failed
I have examined carefully the above output and what I see is that linux does
not properly access the flash memory:
I did the hexdump on the image2.jffs2 (which is placed in /dev/mtd3) and
compared it with the jffs2 mount messages:
hexdump -C image2.jffs2
00000000 19 85 20 03 00 00 00 0c f0 60 dc 98 19 85 e0 01 |..
......`......|
00000010 00 00 00 31 c3 20 dd 5d 00 00 00 01 00 00 00 00 |...1.
.]........|
jffs2_scan_eraseblock(): Node at 0x00000000 {0x1985, 0x2003, 0x00000000) has
invalid CRC 0xf0600000 (calculated 0xf9d690b3)
The linux mount complains about wrong CRC (invalid CRC 0xf0600000) but in
the memory it is
f0 60 dc 98 (so it means that it was read in byte by byte mode but not in
x16 (2 bytes) mode).
Does somebody know how to fix this problem?
Best Regards
Mirek
--
View this message in context: http://www.nabble.com/Flash-paritioning-and-JFFS2-tf4317566.html#a12937526
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Flash paritioning and JFFS2
2007-09-28 9:51 ` Mirek23
@ 2007-09-28 21:09 ` Mirek23
0 siblings, 0 replies; 6+ messages in thread
From: Mirek23 @ 2007-09-28 21:09 UTC (permalink / raw)
To: linuxppc-embedded
I when through the jffs2 driver code and I have noticed that during the jffs2
initialization It is a problem to access the flash memory (of my board) in
32 bit mode. All what refers to the 32 bit access gets from Flash only 16
(Most significant) bits. The remaining 16 (less significant) bits are simply
filled with 0.
I have noticed that there are two sets of functions which are used to access
Flash memory:
#define cpu_to_je32(x) ((jint32_t){x})
#define je32_to_cpu(x) ((x).v32)
#define cpu_to_je16(x) ((jint16_t){x})
#define je16_to_cpu(x) ((x).v16)
These functions which refer to 16 bits access are working fine in my case
but those which refer to 32 access do not work properly. Does anybody have
some idea how to change those functions which deal with 32 bits to force
them to access the Flash memory in two steps to get twice 16 bits numbers
and at the end form 32 bits value?
Best Regards
Mirek
Mirek23 wrote:
>
> Dear All,
>
> Finally I have sorted out few problems with linux and u-boot and I have
> tried to come back to the jffs2 and mtd partitioning issue.
>
> I am using CFI driver and I pass partitioning information from command
> line via u-boot.
>
> This part works fine:
>
> Unfortunatly I have the problem when accesing the flash partitions because
> my Avnet evaluation board is designet in such a way that the data should
> be accessed in the mode x16 (16 bits in each goal).
>
> Linux CFI driver is able to detect the x16 mode but it does not handle it
> correctly.
>
> I will give you an example:
>
> My mtd1 partition contains the u-boot environment. When I print the mtd1
> contents with (busybox) hexdump I get:
>
> 00000000 eb 92 00 00 62 6f 00 00 61 72 00 00 3d 63 00 00
> |....bo..ar..=c..|
> 00000010 73 6f 00 00 3d 74 00 00 55 4c 00 00 39 36 00 00
> |so..=t..UL..96..|
> 00000020 20 72 00 00 74 3d 00 00 65 76 00 00 66 73 00 00 |
> r..t=..ev..fs..|
> 00000030 77 20 00 00 73 72 00 00 74 3d 00 00 39 2e 00 00 |w
> ..sr..t=..9...|
> 00000040 39 2e 00 00 34 2e 00 00 33 3a 00 00 70 74 00 00
> |9...4...3:..pt..|
> 00000050 6c 64 00 00 31 2f 00 00 63 5f 00 00 78 2c 00 00
> |ld..1/..c_..x,..|
> 00000060 70 20 00 00 70 3d 00 00 3a 3a 00 00 72 74 00 00 |p
> ..p=..::..rt..|
> 00000070 34 2d 00 00 72 65 00 00 65 74 00 00 3a 64 00 00
> |4-..re..et..:d..|
>
> When I copy the contents of the /dev/mtd1 to the file by 2 bytes (bs=2) I
> get correct
> readout:
>
> dd if=/dev/mtd1 of=./u-boot_Env.txt bs=2 count=128k
>
> hexdump ./u-boot_Env.txt
> 00000000 eb 92 c9 6d 62 6f 6f 74 61 72 67 73 3d 63 6f 6e
> |...mbootargs=con|
> 00000010 73 6f 6c 65 3d 74 74 79 55 4c 30 2c 39 36 30 30
> |sole=ttyUL0,9600|
> 00000020 20 72 6f 6f 74 3d 2f 64 65 76 2f 6e 66 73 20 72 |
> root=/dev/nfs r|
> 00000030 77 20 6e 66 73 72 6f 6f 74 3d 31 32 39 2e 31 32 |w
> nfsroot=129.12|
> 00000040 39 2e 31 34 34 2e 31 31 33 3a 2f 6f 70 74 2f 65
> |9.144.113:/opt/e|
> 00000050 6c 64 6b 34 31 2f 70 70 63 5f 34 78 78 2c 74 63
> |ldk41/ppc_4xx,tc|
>
> The real problems begin when I want to deal with jffs2 file system.
>
> I have mtd3 partition which is intended to hold jffs2 fs.
> To create the jffs2 fs I do:
>
> ./mkfs.jffs2 --pad=0xA0000 --eraseblock=0x20000 --root=/tmp/bin/mtd1/work/
> --output=image2.jffs2
> flash_erase /dev/mtd3
> dd if=./image2.jffs2 of=/dev/mtd3 bs=2 count=655360
>
> After that I have jffs2 fs under /dev/mtd3.
>
> When I try to mount the jffs2 partition fun begins:
>
> mount -t jffs2 /dev/mtdblock3 /mnt
>
> [ 2828.462121] jffs2_scan_eraseblock(): Node at 0x00000000 {0x1985,
> 0x2003, 0x00000000) has invalid CRC 0xf0600000 (calculated 0xf9d690b3)
> [ 2828.610485] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> 0x00000008: 0xf060 instead
> [ 2828.719326] jffs2_scan_eraseblock(): Node at 0x0000000c {0x1985,
> 0xe001, 0x00000000) has invalid CRC 0xc3200000 (calculated 0x92fedd67)
> [ 2828.870047] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> 0x00000014: 0xc320 instead
> [ 2828.979854] jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> 0x00000024: 0x46fc instead
>
> .
> .
> .
> .
>
> [ 2834.858103] Further such events for this erase block will not be
> printed
> [ 2835.029913] Cowardly refusing to erase blocks on filesystem with no
> valid JFFS2 nodes
> [ 2835.124378] empty_blocks 0, bad_blocks 0, c->nr_blocks 5
> mount: mounting /dev/mtdblock3 on /mnt failed
>
>
> I have examined carefully the above output and what I see is that linux
> does not properly access the flash memory:
>
> I did the hexdump on the image2.jffs2 (which is placed in /dev/mtd3) and
> compared it with the jffs2 mount messages:
>
> hexdump -C image2.jffs2
>
> 00000000 19 85 20 03 00 00 00 0c f0 60 dc 98 19 85 e0 01 |..
> ......`......|
> 00000010 00 00 00 31 c3 20 dd 5d 00 00 00 01 00 00 00 00 |...1.
> .]........|
>
> jffs2_scan_eraseblock(): Node at 0x00000000 {0x1985, 0x2003, 0x00000000)
> has invalid CRC 0xf0600000 (calculated 0xf9d690b3)
>
> The linux mount complains about wrong CRC (invalid CRC 0xf0600000) but in
> the memory it is
> f0 60 dc 98 (so it means that it was read in byte by byte mode but not in
> x16 (2 bytes) mode).
>
> Does somebody know how to fix this problem?
>
> Best Regards
>
> Mirek
>
>
>
>
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Flash-paritioning-and-JFFS2-tf4317566.html#a12948521
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-09-28 21:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23 13:36 Flash paritioning and JFFS2 Mirek23
2007-08-23 16:08 ` Michael Brian Willis
2007-09-07 15:23 ` Mirek23
2007-09-07 15:55 ` Michael Brian Willis
2007-09-28 9:51 ` Mirek23
2007-09-28 21:09 ` Mirek23
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).