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.

U-boot loading from NAND.



Hi,

How is the u-boot image loaded by the MLO(1st stage bootloader) from the NAND. Does the 1st stage bootloader has a fixed address to look for in the NAND or is it looks for particular header of the u-boot ?

For a fail safe machine I want to flash 2 u-boot  images into the NAND what is the best option to do that ?

Thanks & Regards,

Mike

  • Mike,

    We have several options to flash u-boot (1st stage and 2nd stage) in NAND:

    1. Using CCS/JTAG flash tool - http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_Flashing_Tools_Guide#Burning_images_to_NAND_Flash_.28using_CCS.29

    2. From u-boot stage - we can flash through UART or MMC/SD card

    3. From linux kernel - http://processors.wiki.ti.com/index.php/UBIFS_BCH8_Implementation#Flashing_from_Kernel

    4. Using script - setup-nand-images.sh

    See the below links for more info:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/333020.aspx

    Regards,
    Pavel

  • Hi Pavel,

    In our product we want to have full proof booting, in case of NAND bad block's.

    There is no issue with 1st stage boot loader as RBL will automatically look/try for 4 NAND block's looking for the header and load the image and execute it.

    I am more concerned about the 2nd stage boot loader, how does the 1st stage bootloader look for the 2nd stage bootloader? is the address of second stage boot loader hardcoded into 1st stage bootloader ? Or is it something similar what RBL does for 1st stage bootloader(look for the header and then load) , if so what is the header format ?

    For example: Say in my product I am updating my u-boot from kernel nandwrite -p /dev/mtd0 u-boot.min.nand, and suddenly the power is gone so (In that case I need two copies of uboot) to restore the board to booting state at the customer.

    Also in this link http://processors.wiki.ti.com/index.php/UBIFS_BCH8_Implementation#Flashing_U-boot_from_Kernel  it says "Flashing U-boot from Kernel" but here 1st stage bootloader is flashed if I am not wrong, second stage bootloader is present in mtd1 partition.

    Thanks & Regards,

    Mike

  • Mike,

    mike A said:
    There is no issue with 1st stage boot loader as RBL will automatically look/try for 4 NAND block's looking for the header and load the image and execute it.

    As you using DM814x device? Are you sure you are not messing DM814x with AM335x?

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide#NAND_Layout

    http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#NAND_Layout

    mike A said:
    I am more concerned about the 2nd stage boot loader, how does the 1st stage bootloader look for the 2nd stage bootloader?

    See the below wiki page:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide

    mike A said:
    Also in this link http://processors.wiki.ti.com/index.php/UBIFS_BCH8_Implementation#Flashing_U-boot_from_Kernel  it says "Flashing U-boot from Kernel" but here 1st stage bootloader is flashed if I am not wrong, second stage bootloader is present in mtd1 partition.

    You can use the same approach to flash 2nd stage bootloader (u-boot.bin) in mtd1

    Regards,
    Pavel

  • Hi Pavel,

    Pavel said:
    As you using DM814x device? Are you sure you are not messing DM814x with AM335x?


    Yes I am referring to DM8148, as mentioned in the reference manual (Reference Manual sprugz8e.pdf) Page 1020

    section Bad block verification, here it is mentioned that , ROM code looks for the image in first four blocks.

    Let me put it simple: I have a product at the customer place, for which I want to update the 2nd stage u-boot, say while updating there is a power cut and board is turned off where writing to NAND was still happening, In that case the customer has a product which he cannot boot up (I know I can flash it back  from MMC/CCS) so to avoid this I want to have 2 copies of u-boot say while updating one if other one gets corrupted there is at least an option available for 1st stage bootloader to look   for. so my question is how does the 1st stage bootloader search for 2nd stage bootloader ?

    Thanks & Regards,

    Mike

  • Hi Mike,

    so my question is how does the 1st stage bootloader search for 2nd stage bootloader ?

     

    The 1st stage bootloader  is nothing but similar to u-boot, but it is minimal, In case of DM814x bootloader there is no header or something (may be you were referring to earlier TI's UBL images which had headers).

    The RBL looks for the 1st stage bootloader and then it loads second stage bootloader, coming to your query as how it loads , it just executes nand read at particular offset you can check the u-boot/include/configs/ti8148_evm.h file in source and search for,

    "bootcmd=nand read 0x81000000 0x20000 0x40000; go 0x81000000\0"

    And the similar is done for different boot modes. So probably you can have 2 or more copies of u-boot and have nand read command appropriately, may be you can check for return value of nand read as well to check for corrupt images aswell.

    Hope that helps!

    I am not sure about how you can have multiple copies of 1st stage boatloader.

    Thanks,

    --Prabhakar Lad

  • Hi Lad,

    Thanks for the response I was looking for this!. but how do I program to read 1st stage bootloader to read from 2 locations ?

    Thanks & Regards

    MIke