This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to boot from kernel stored in NAND Flash

Hi,

We have downloaded the latest stock standard kernel (uImage-dm365-evm.bin) from http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dvsdk/DVSDK_3_10/latest/index_FDS.html. We have successfully tftpbooted using this but are having issues loading it now onto the NAND. The error seems to be that the kernel is larger than a single page and as a result cannot be copied across. Attempting to write over a page boundary isn't working for us either. 

Kindly take a look at our logic below:

  • The below is the default printout at bootup to 'uBoot halt'

Jumping to entry point at 0x81080000.

 LSP 2.10 BETA RELEASE
 VERSION: 2.10.008.02

U-Boot 1.3.4 (Mar  2 2009 - 11:50:39)

I2C:   ready
DRAM:  128 MB
NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit)
Bad block table found at page 524096, version 0x01
Bad block table found at page 524032, version 0x01
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit)
Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x3ffe0000, version 0x01
Bad block table written to 0x3ffc0000, version 0x01
2048 MiB
In:    serial
Out:   serial
Err:   serial
Ethernet PHY: GENERIC @ 0x00
Hit any key to stop autoboot:  0

  • We load the kernel from TFTP into RAM & note its exact size.

DM365 EVM :>tftp 0x80700000 uImage-dm365-evm.bin
TFTP from server 10.0.0.10; our IP address is 10.0.0.9
Filename 'uImage-dm365-evm.bin'.
Load address: 0x80700000
Loading: #################################################################
         #################################################################
         ##############
done
Bytes transferred = 2108492 (202c4c hex)

DM365 EVM :>nand erase 0x400000 0x200000
NAND erase: device 0 offset 0x400000, size 0x200000
Erasing at 0x5e0000 -- 100% complete.
OK


DM365 EVM :>nand write 0x80700000 0x400000 0x200000
NAND write: device 0 offset 0x400000, size 0x200000
 2097152 bytes written: OK


DM365 EVM :>nboot 0x80700000 0 0x400000
Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
   Image Name:   Arago/2.6.31+2.6.32-rc1-r35+gitr
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2108428 Bytes =  2 MB
   Load Address: 80008000
   Entry Point:  80008000
DM365 EVM :>bootm
## Booting kernel from Legacy Image at 80700000 ...
   Image Name:   Arago/2.6.31+2.6.32-rc1-r35+gitr
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2108428 Bytes =  2 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!

  • It was here that we noticed that the kernel was larger than 0x200000 bytes(0x202c4c as per the tftpboot output from above). So we try to do this erase and flash again using these revised figures noting 105% as rather interesting?

DM365 EVM :>nand erase 0x400000 0x202c4c
NAND erase: device 0 offset 0x400000, size 0x202c4c
Erasing at 0x600000 -- 105% complete.
OK


DM365 EVM :>nand write 0x80700000 0x400000 0x202c4c
NAND write: device 0 offset 0x400000, size 0x202c4c
Attempt to write non page aligned data
 2108492 bytes written: ERROR

  • Although it was obvious at this point we would not have much luck booting; we tried anyway with the following result.

DM365 EVM :>nboot 0x80700000 0 0x400000
Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
** Unknown image type

Is the kernel larger than it should be? Does uBoot need to be upgraded to support writing larger kernel images? Is the limitation the page size of the flash (we are working however with the original NAND supplied with the Rev E DM365 dvevm). Where are we going wrong?

Many thanks in advance.

Sincerely,
NickA

  • Hi NickA,

    NickAllen said:

    DM365 EVM :>nand erase 0x400000 0x202c4c
    NAND erase: device 0 offset 0x400000, size 0x202c4c
    Erasing at 0x600000 -- 105% complete.
    OK


    DM365 EVM :>nand write 0x80700000 0x400000 0x202c4c
    NAND write: device 0 offset 0x400000, size 0x202c4c
    Attempt to write non page aligned data
     2108492 bytes written: ERROR

    The erase issue (105%) is due to not providing erase block (128K) aligned size. The write issue is due to non page (2K) aligned size. So, you can increase the size parameter to the next 128K boundary.

    Also, the older U-Boot versions require a '.e' extension (nboot.e, nand write.e, nand read.e etc) to do bad block aware operation. Please use  .e extension commands instead. It is safe to do so even on newer U-Boots.

    Thanks,

    Sekhar

  • Hi Sekhar,

    Thank you for your response. You were on the money about the block size and page size & we are now booting the kernel from NAND! What determines this block (128K) & page (2K) aligned size? Is it the NAND structure (and consequently specific to various NANDs) or is it uBoot defined? In playing around I get some interesting responses:

    • What I do understand:

    NAND erase 0x400000 0x200000 results in 100% : This is the usual & from your explanation I realize that it is a multiple of 128K blocks

    NAND erase 0x400000 0x220000 results in 100% : This now includes the next 128K block & is what we are now successfully using.

    • Now the experimenting:

    NAND erase 0x400000 0x210000 results in 103% : Why 3%? Is this not 50% the way to 0x220000

    NAND erase 0x400000 0x1F0000 results in 103% :This should make sense once I understand the above.

    • Another intriguing one

    NAND erase 0x400000 0x200001 results in 106% : Why 6%?

    Thank you for the .e information. Is there any major benefit of upgrading from uBoot 1.3.4 to the latest version?

    Sincerely,
    NickA

    0000

  • Hi NickA,

    NickAllen said:

    NAND erase 0x400000 0x200000 results in 100% : This is the usual & from your explanation I realize that it is a multiple of 128K blocks

    NAND erase 0x400000 0x220000 results in 100% : This now includes the next 128K block & is what we are now successfully using.

    • Now the experimenting:

    NAND erase 0x400000 0x210000 results in 103% : Why 3%? Is this not 50% the way to 0x220000

    NAND erase 0x400000 0x1F0000 results in 103% :This should make sense once I understand the above.

    • Another intriguing one

    NAND erase 0x400000 0x200001 results in 106% : Why 6%?

    Not sure why the code is behaving in the said manner. The print is coming from generic U-Boot code in drivers/mtd/nand/nand_util.c.

    NickAllen said:

    Thank you for the .e information. Is there any major benefit of upgrading from uBoot 1.3.4 to the latest version?

    I rememeber seeing some recent patches to increase NAND throughput. There are other visible facilities like command history. May be others can add further.

    Thanks,

    Sekhar

     

  • Hi Sekhar,

    Thanks for the response. Ta, we will take a look at drivers/mtd/nand/nand_util.c .


    Do you have any idea re the 128KB / 2KB query? I am also involved in a thread @ http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/t/48003.aspx in which I am querying the 128KB / 2KB . I am fundamentally missing something. Any input would be appreciated!

    Sincerely,
    NickA

     

     

  • Hi NickA

    NickAllen said:
    Do you have any idea re the 128KB / 2KB query?

    Nand flash is divided into pages and blocks. A page is a minimum write unit and a block is the minimum erase unit. A block consists of multiple pages. This geometry is dictated by the NAND flash manufacturer not the TI device.

    The 'small page' NAND devices typically have page size equal to 512 bytes and have 32 pages per block. The 'large page' NAND devices have a 2K byte page size and 64 pages per block (128K block). There are newer devices now appearing which have a 4K byte page (I have personally not worked with these).

    The NAND code in Linux kernel and U-Boot is written to support multiple variants of NAND flash from different manufacturers.

    Hope that clarifies.

    Thanks,

    Sekhar

     

  • It does indeed! Thank you for your help!
    You guys really are very informative and vigilant monitoring these forums; it is very much appreciated!

    Thanks again,
    Nick