[prev in list] [next in list] [prev in thread] [next in thread] 

List:       yaffs
Subject:    Re: [Yaffs] Accessing a YAFFS linux MTD partition from u-boot
From:       Michel Benoit <murpme () gmail ! com>
Date:       2012-11-21 16:17:02
Message-ID: CAGw2PGGEpkaz7ifPp8p-Bs5NOm4yC=uOoyPCZ5DdNBbfZMFXNQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

Thanks for the tips. I've made some progress.

>
> >
> > It seems that YAFFS is mounting on top of RAM instead of on the NAND
> chip.
> > Do I have to specify mtd parts in u-boot order to access the NAND?
> > Is there a u-boot config define for selecting NAND or RAM for YAFFS2
> > support?
>
> Why do you think it is writing to RAM?
>

I suspected that it was being written to RAM because the files were
disappearing when I powered off the device.
This is no longer the case when I am testing now


> A few things to try:
> 1. Try turning on tracing and seeing if you get any further info.
> 2. What happens if you save a file under u-boot then reboot back into
> u-boot.
> Is the file still there?
>
> These problems are almost always due to incompatibilities between the mtd
> in
> u-boot and Linux.
>

This comment got me thinking about what I have changed in linux mtd/nand!
The board I am using has a NAND chip that stores bad block info at offsets
0 and 5 in OOB.
The oobfree offset and length have been adjusted accordingly in the linux
MTD nand driver (offest e= 6 instead of 2 and length = 34 instead of 38).
When I make the same change in u-boot mtd / nand I now am able to mount
existing linux yaffs partitions in u-boot

However when I create files in u-boot they get size 0.
They are visible from linux (also with size 0) and can be erased.
Trying to read files from u-boot seems to freeze up.

U-Boot> yls -l /rfs
home                               2048   645 directory
var                                2048   675 directory
usr                                2048   294 directory
sbin                               2048   564 directory
tmp                                2048   522 directory
media                              2048   275 directory
dev                                2048   284 directory
mnt                                2048   290 directory
lib                                2048   529 directory
opt                                2048   534 directory
sys                                2048   544 directory
linuxrc                              11   554 symlink
bin                                2048   847 directory
proc                               2048   879 directory
root                               2048   797 directory
etc                                2048   889 directory
lost+found                         2048     2 directory

U-Boot> ywr /rfs/test.txt 0x30 10
Writing value (30) 10 times to /rfs/test.txt... done

U-Boot> yls -l /rfs
test.txt                              0  1026 regular file
home                               2048   645 directory
var                                2048   675 directory
usr                                2048   294 directory
sbin                               2048   564 directory
tmp                                2048   522 directory
media                              2048   275 directory
dev                                2048   284 directory
mnt                                2048   290 directory
lib                                2048   529 directory
opt                                2048   534 directory
sys                                2048   544 directory
linuxrc                              11   554 symlink
bin                                2048   847 directory
proc                               2048   879 directory
root                               2048   797 directory
etc                                2048   889 directory
lost+found                         2048     2 directory

U-Boot> yrd /rfs/test.txt
Reading file /rfs/test.txt
<freeze>

Created files are present after reboots but always unreadable.
u-boot freezes even when reading files created from linux.

Any hints as to where to look to figure out why reading and writing from
u-boot aren't working?

Do the versions of YAFFS2 in linux and u-boot need to be indentical?
Should u-boot/yaffs read out the and use the time and date from the real
time clock?
Would a Bbad or incompatible ECC give this kind of result?

> My ultimate goal is to read out the linux kernel image from the rootfs
> > (YAFFS), copy it to RAM and boot.
>
> That is a most achievable goal.
>

One step closer :)

[Attachment #5 (text/html)]

<div>Hi,</div><div><br></div><div>Thanks for the tips. I&#39;ve made some \
progress.</div><br><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> &gt;<br>
&gt;<br>
&gt; It seems that YAFFS is mounting on top of RAM instead of on the NAND chip.<br>
&gt; Do I have to specify mtd parts in u-boot order to access the NAND?<br>
&gt; Is there a u-boot config define for selecting NAND or RAM for YAFFS2<br>
&gt; support?<br>
<br>
Why do you think it is writing to RAM?<br></blockquote><div><br></div><div>I \
suspected that it was being written to RAM because the files were disappearing when I \
powered off the device.</div><div>This is no longer the case when I am testing \
now</div> <div> </div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> A few things to try:<br>
1. Try turning on tracing and seeing if you get any further info.<br>
2. What happens if you save a file under u-boot then reboot back into u-boot.<br>
Is the file still there?<br>
<br>
These problems are almost always due to incompatibilities between the mtd in<br>
u-boot and Linux.<br></blockquote><div><br></div><div>This comment got me thinking \
about what I have changed in linux mtd/nand!</div><div>The board I am using has a \
NAND chip that stores bad block info at offsets 0 and 5 in OOB.</div> <div>The \
oobfree offset and length have been adjusted accordingly in the linux MTD nand driver \
(offest e= 6 instead of 2 and length = 34 instead of 38).</div><div>When I make the \
same change in u-boot mtd / nand I now am able to mount existing linux yaffs \
partitions in u-boot</div> <div><br></div><div>However when I create files in u-boot \
they get size 0.</div><div>They are visible from linux (also with size 0) and can be \
erased.</div><div>Trying to read files from u-boot seems to freeze up.  </div> \
<div><br></div><div><div>U-Boot&gt; yls -l /rfs</div><div>home                        \
2048   645 directory</div><div>var                                2048   675 \
directory</div><div>usr                                2048   294 directory</div> \
<div>sbin                               2048   564 directory</div><div>tmp            \
2048   522 directory</div><div>media                              2048   275 \
directory</div><div>dev                                2048   284 directory</div> \
<div>mnt                                2048   290 directory</div><div>lib            \
2048   529 directory</div><div>opt                                2048   534 \
directory</div><div>sys                                2048   544 directory</div> \
<div>linuxrc                              11   554 symlink</div><div>bin              \
2048   847 directory</div><div>proc                               2048   879 \
directory</div><div>root                               2048   797 directory</div> \
<div>etc                                2048   889 directory</div><div>lost+found     \
2048     2 directory</div><div><br></div><div>U-Boot&gt; ywr /rfs/test.txt 0x30 \
10</div><div>Writing value (30) 10 times to /rfs/test.txt... done</div> \
<div><br></div><div>U-Boot&gt; yls -l /rfs</div><div>test.txt                         \
0  1026 regular file</div><div>home                               2048   645 \
directory</div><div>var                                2048   675 directory</div> \
<div>usr                                2048   294 directory</div><div>sbin           \
2048   564 directory</div><div>tmp                                2048   522 \
directory</div><div>media                              2048   275 directory</div> \
<div>dev                                2048   284 directory</div><div>mnt            \
2048   290 directory</div><div>lib                                2048   529 \
directory</div><div>opt                                2048   534 directory</div> \
<div>sys                                2048   544 directory</div><div>linuxrc        \
11   554 symlink</div><div>bin                                2048   847 \
directory</div><div>proc                               2048   879 directory</div> \
<div>root                               2048   797 directory</div><div>etc            \
2048   889 directory</div><div>lost+found                         2048     2 \
directory</div><div><br></div><div>U-Boot&gt; yrd /rfs/test.txt</div> <div>Reading \
file /rfs/test.txt</div></div><div>&lt;freeze&gt;</div><div><br></div><div>Created \
files are present after reboots but always unreadable.</div><div>u-boot freezes even \
when reading files created from linux.</div> <div><br></div><div>Any hints as to \
where to look to figure out why reading and writing from u-boot aren&#39;t \
working?</div><div><br></div><div>Do the versions of YAFFS2 in linux and u-boot need \
to be indentical?</div><div> Should u-boot/yaffs read out the and use the time and \
date from the real time clock?</div><div>Would a Bbad or incompatible ECC give this \
kind of result?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 \
0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

&gt; My ultimate goal is to read out the linux kernel image from the rootfs<br>
&gt; (YAFFS), copy it to RAM and boot.<br>
<br>
That is a most achievable goal.<br></blockquote><div><br></div><div>One step closer \
:) </div><div><br></div><div><br></div><div><br></div><div><br></div><div> \
</div></div>



_______________________________________________
yaffs mailing list
yaffs@lists.aleph1.co.uk
http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic