[Letux-kernel] gta04 - reading nand from u-boot

H. Nikolaus Schaller hns at goldelico.com
Fri Jul 20 18:04:20 CEST 2018


Hi,

> Am 20.07.2018 um 17:49 schrieb Josua Mayer <josua.mayer at jm0.eu>:
> 
> Hi everybody,
> 
> my experiments have reached a point where I want to use nand, so I
> started by setting it up from within linux, and then tried to boot.
> And I was greeted by a ton of errors on the serial console:
> fallback to NAND kernel
> 
> NAND read: device 0 offset 0x280000, size 0x5c0000
> Error: Bad compare! failed
> ^^ This line keeps repeating seemingly endless.
> 
> So I notice two things:
> - read starts at 0x280000: this matches the start of the kernel
> partition as declared in devicetree.
> - trying to read 0x5c0000 bytes: This should be enoufg for my kernel
> image which is only 3.3MB, but maybe it should be as much as the kernel
> partition size 0x400000.
> 
> So what is going wrong? Nothing obvious. So I started playing with the
> nand read command:
> 
> nand read 0x82000000 0x0 0x240000
> 2359296 bytes read: OK
> 
> nand read 0x82000000 0x0 0x260000
> 2490368 bytes read: OK
> 
> nand read 0x82000000 0x0 0x280000
> 2621440 bytes read: OK
> 
> nand read 0x82000000 0x240000 0x20000
> 131072 bytes read: OK
> 
> nand read 0x82000000 0x280000 0x1   
> NAND read: device 0 offset 0x280000, size 0x1
> Error: Bad compare! failed
> Error: Bad compare! failed
> Error: Bad compare! failed
> Error: Bad compare! failed
> NAND read from offset 280000 failed -74
>  0 bytes read: ERROR
> 
> ^^ So I can't read beyond 0x27ffff
> 
> Has anyone seen this?
> @Nikolaus does this work for you?

Yes. Probably it is because you can't read single bytes
(size 0x1). Depending on NAND type it must be 0x10000
or 0x20000.

The next thing to consider is ECC. AFAIR you
can only write kernel and rootfs from Linux
but not U-Boot and MLO. They use a different ECC
scheme.

I am not sure if the Bad compare! failed comes from
ECC. Sometimes it helps to erase the NAND (section)
from U-Boot console.

Therefore we have these "production images" with
MLO and U-Boot and automatic reflashing if you
have a newer "production image".

In general it is very very fragile to get a working
setup... (and this is why I almost never touch this
running system :).

Hope this helps.

BR,
Nikolaus



More information about the Letux-kernel mailing list