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.

NAND Flash Booting for AM335x problem

hi,
i am new to the NAND-Booting: We are taken Sitara EVM-starter kit as reference to our custom board with AM335x.
Linux version 3.14 and u-boot is 2014 / downloaded for git given in the ti-wiki only.
We are unable to boot fron NAND -
1. Sitara EVM-SK is not having option for NAND. which is given NAND Guide in the wiki.

1# quest is : U-boot is detecting NAND - which is same one using in sitara-EVM-256MB(MT29F2G08ABAEAWP)- 2GBIT.
So as NAND is detecing by U-Boot - Is it possible to boot from NAND with U-Boot commands.
we went through u-boot code:
/board/ti/am335x/board.c  /mux.c nd etc., and here in the makefile added the CONFIG_NAND and CONFIG_NAND_BOOT
/arch/arm/cpu/armv7/am33xx/board.c

nand_init function is there in /driver/mtd/nand/am335x_spl_bch.c
How nand chip details will get to the nand_chip strucutre


2# quest is: in the kernel for NAND we updated in the DTS file with pin mux and etc from am335x-evm about nand to
am335x-evmsk.dts: is it work is my doubt becoz the filesystem is ext-4 for SDcard boot.
So here do we need to use different filesystem for NAND like UBIFS/JFFS/YFFS etc.

GPMC- pins in starter kit is using for MMC1 and RGMI_INT -- so those IO mux we changed in dts file.

Please any one guide me in this.

Regards,

Viswanath K

  • Hi Viswanath,

    VISWANATH KONDAPALLI said:
    So as NAND is detecing by U-Boot - Is it possible to boot from NAND with U-Boot commands.

     

    Yes it is possible to write MLO, u-boot & kernel in NAND flash, using u-boot commands. See the following two guides for reference:
     http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User's_Guide#NAND_2 

    Or JFFS: http://elinux.org/BeagleBoardNAND#File_system 

  • Hi,
    In addition to Yordan suggestion,

    Firstly, try to boot your board completely (u-boot,kernel and filesystem) through SD card.
    1) Then check, NAND was able detected by every stage, u-boot,kernel and able to access the NAND partitions in filesystem too through "flash_eraseall /dev/mtd1" command etc.,

    2) Try to read the kernel from NAND and boot
    3) Try to boot mount the filesystem in any one of the NAND's partition
    4) Now, try to boot the u-boot from NAND by modifying the u-boot,MLO code and set boot jumper to NAND boot mode (GPMC)
  • Thank you Yordan and Titus. I need an urgent help :
    As i given NAND(erase,write,read) U-boot commands and i forgot to create UBIFS filesystem -- so it is loading from NAND trying linux kernel image and which we are not given so it is stopping there.
    i given commands:

    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 0x82000000 MLO
    U-Boot# nand erase 0x0 0x20000
    U-Boot# nand write 0x82000000 0x0 0x20000
    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 0x82000000 u-boot.img
    U-Boot# nand erase 0x80000 0x40000
    U-Boot# nand write 0x82000000 0x80000 0x40000
    U-Boot# saveenv
    U-Boot# boot
    and also given these:
    For booting from NAND:

    U-Boot# setenv nand_src_addr 0x00280000
    U-Boot# setenv nand_img_siz 0x170000
    U-Boot# setenv initrd_src_addr 0x00780000
    U-Boot# setenv initrd_img_siz 0x320000
    U-Boot# setenv bootcmd 'nand read ${kloadaddr} ${nand_src_addr} ${nand_img_siz};nand read ${loadaddr} ${initrd_src_addr} ${initrd_img_siz};bootm ${kloadaddr}'


    so that we got these Logs:

    U-Boot#
    U-Boot SPL 2014.07-00107-gd28f2b9-dirty (Apr 10 2015 - 15:43:47)
    Enabling I2C 1 , Sanju
    Timed out in wait_for_event: status=0000
    Check if pads/pull-ups of bus 0 are properly configured
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    there it is stopped.

    1# we need to recovery the booting to SD card (to load filesystem(UBIFS) and zImage))
    here i need U-boot commands to change parameters to SD CARD in the U-boot.

    Please help me in this

    I saw this commands in the same wiki ---: will it work ??? : BUT we are not having uImage and u-boot.bin

    in our sd card we are having MLO and u-boot.img and zImage and dtb file in roofts/boot.

    SD (Secured Digital card):
    This section gives an overview of the SD support in U-Boot Read and execute uImage from SD card

    Please note that the following commands are being executed from the 2nd stage. List files on a FAT32 formatted SD card

    U-Boot# mmc rescan
    U-Boot# fatls mmc 0

    Booting kernel image from the SD card

    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 0x82000000 uImage
    U-Boot# bootm 0x82000000

    Read and execute u-boot from SD card

    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 0x82000000 u-boot.bin
    U-Boot# go 0x82000000

    regards,

    Viswanath K.
  • Thank you Yordan and Titus for the reply.

    As per the Titus and Yordan suggestions:

    1. YES it is booting from SD CARD.
    2. From U-boot prompt we given nand erase/write/read commands from U-boot. NAND Read we didnt checked properly once writed MLO
    and u-boot.img.
    YES as you said -- we might read and to check -- write is happen proper or not.

    3. In the kernel we didnt tested NAND Detection. -- Need to check.
    Here --we tried as per Yordan suggestions with u-boot commands -- after given commands we faced few issues with booting.
    In our hardware we are having option to boot SDcard(say SYSBOOT IOs) , if we are doing that for NAND it is showing as "0" bytes.
    there we blocked again.

    4. NAND Partitions: is there any difference in partitions with UBIFS to JFFS and YFFS.
    nand partitions we copied from AM335x_EVM dts: we are in confusion to choose the partitions
    partition@0 {
    label = "NAND.SPL";
    reg = <0x00000000 0x000020000>;
    };
    partition@1 {
    label = "NAND.SPL.backup1";
    reg = <0x00020000 0x00020000>;
    };
    partition@2 {
    label = "NAND.SPL.backup2";
    reg = <0x00040000 0x00020000>;
    };
    partition@3 {
    label = "NAND.SPL.backup3";
    reg = <0x00060000 0x00020000>;
    };
    partition@4 {
    label = "NAND.u-boot-spl-os";
    reg = <0x00080000 0x00040000>;
    };
    partition@5 {
    label = "NAND.u-boot";
    reg = <0x000C0000 0x00100000>;
    };
    partition@6 {
    label = "NAND.u-boot-env";
    reg = <0x001C0000 0x00020000>;
    };
    partition@7 {
    label = "NAND.u-boot-env.backup1";
    reg = <0x001E0000 0x00020000>;
    };
    partition@8 {
    label = "NAND.kernel";
    reg = <0x00200000 0x00800000>;
    };
    partition@9 {
    label = "NAND.file-system";
    reg = <0x00A00000 0x0F600000>;
    };

    and in the wiki for UBIFS:
    +------------+-->0x00000000-> SPL start (SPL copy on 1st block)
    | |
    | |-->0x0001FFFF-> SPL end
    | |-->0x00020000-> SPL.backup1 start (SPL copy on 2nd block)
    | |
    | |-->0x0003FFFF-> SPL.backup1 end
    | |-->0x00040000-> SPL.backup2 start (SPL copy on 3rd block)
    | |
    | |-->0x0005FFFF-> SPL.backup2 end
    | |-->0x00060000-> SPL.backup3 start (SPL copy on 4th block)
    | |
    | |-->0x0007FFFF-> SPL.backup3 end
    | |-->0x00080000-> U-Boot start
    | |
    | |-->0x002BFFFF-> U-Boot end
    | |-->0x00260000-> ENV start
    | |
    | |
    | |-->0x0027FFFF-> ENV end
    | |-->0x00280000-> Linux Kernel start
    | |
    | |
    | |
    | |
    | |-->0x0077FFFF-> Linux Kernel end
    | |-->0x00780000-> File system start
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    +------------+-->0x10000000-> NAND end (Free end)
  • Finally we recovered the SD CARD back but we are facing new issue. we recovered from back to SDCARD Mode -- we enable and add few macros -- as given in the ti-wiki -- like adding cmd- macros for nand and CONFIG_NAND and NANDBOOT in makefile

    with image NAND is detected and we erased the NAND so again it is booting with SD-Card.

    While we are writing zimage to nand these error logs was came and then started restarting.

    U-Boot# fatls mmc 0
    79596 mlo
    572284 u-boot.img
    4302208 zimage

    3 file(s), 0 dir(s)

    U-Boot# mmc rescan
    U-Boot# fatload mmc 0 0x82000000 zimage
    reading zimage +-----------------------------+
    4302208 bytes read in 578 ms (7| |
    U-Boot# nand erase 0x00280000 0| Cannot open /dev/ttyUSB0! |
    | |
    NAND erase: device 0 offset 0x2+-----------------------------+
    Erasing at 0x680000 -- 100% complete.
    OK
    U-Boot# nand write 0x82000000 0x00280000 0x41FFFF

    NAND write: device 0 offset 0x280000, size 0x41ffff
    WARNING in ../drivers/mtd/nand/nand_base.c line 1072
    WARNING in ../drivers/mtd/nand/nand_base.c line 1072
    WARNING in ../drivers/mtd/nand/nand_base.c line 1072
    BUG: failure at ../drivers/mtd/nand/nand_base.c:242/nand_select_chip()!
    BUG!
    resetting ...

    // from here onwards why it is restarting --- not able to understand

    U-Boot SPL 2015.04-rc1-dirty (May 13 2015 - 21:44:29)
    Timed out in wait_for_event: status=0000
    Check if pads/pull-ups of bus 0 are properly configured
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2015.04-rc1-dirty (May 13 2015 - 21:44:29)
    Timed out in wait_for_event: status=0000
    Check if pads/pull-ups of bus 0 are properly configured
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...
  • This has been fixed due to wrong offsets of u-boot and Kernel.. as per the update of the U-boot version the partitions we have to choose.
    and the final update is mentioned in the this link:
    This has been fixed in the post :
    e2e.ti.com/.../423771

    Please close this ticket also.
    regards,
    Viswanath K
  • Sounds good.
    Thanks for your update.