[U-Boot] U-Boot fails to read NAND initialized by Linux

Ivan Bublikov ivanbublikov at yahoo.com
Thu Oct 12 21:24:46 UTC 2017


Hello,
It's probably just a simple case of misconfiguration of U-Boot or Linux, and someone with knowledgecould easily set me straight looking at the symptom. Many thanks in advance!

Summary:Linux can write and read NAND flash, but U-boot thinks all NAND blocks are bad.(Linux 4.1.15, U-boot 2015-04, 1Gbyte Micron NAND MT29F8G08ABBCA)
Details:Using Linux command line, I wrote and verified a Linux kernel at offset 64Mb.To do that, when I boot Linux, I tell it (on the kernel command line) that it hasa 64Mb partition at offset 0and another at offset 64Mb.I wrote data using commands:flash_erase /dev/mtd1 0 0nandwrite -p /dev/mtd1 -p zImageAnd verified bydd if=/dev/mtd1 of=testFrom Linux viewpoint the flash works just fine. I read the same data that I wrote.
BTW, While Linux boots, it prints:Bad block table found at page 262080, version 0x01Bad block table found at page 262016, version 0x01
Now I want to use U-Boot to load and start Linux from flash where it's written at offset 64Mb.==> nand read ${loadaddr} 4000000 2000000 // at offset 64Mb read 32MbAttempt to read outside the flash area0 bytes read: ERROR
I investigated a little by enabling debug output in U-boot - it appears that U-boot scans the entire flash for bad blocks, looking at the first byte on the OOB area - if that byte is not ff it thinks the block is bad. So I added a printf to print the bytes it finds, and found them to be:block# byte0    4e1    fe2    fe....(The flash spec says that "factory-bad" blocks are signified by 0 in those bytes)
I don't really know anything about MTD drivers. My working theory at the moment is that Linuxlegitimately marked the blocks like that, and U-boot should be using the "Bad block table" Linux created on the flash, instead of scanning all blocks. Apparently, U-boot doesn't understand what Linux has done to the flash.
 


More information about the U-Boot mailing list