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.

Port MLO, U-boot, UImage and root files system to ARM335x Nand Flash

HI,


We are using AM335x EVM, in that i want to use NAND Flash booting, can any one please tell me steps, how to flash MLO, U-Boot, uImage and rootfs in to NAND flash.

  • Hi,

    Thanks for the reply,

    I have used kermet to flash MLO, u-boot, uImage and rootfs in the NAND flash, and flashed the MLO, u-boot and uImage files in the NAND flash that are same in the SD-Card provided by the TI with the EVM

    the u-boot shows the nand partitions as

    #mtdparts

    device nand0 <omap2-nand.0>, # parts = 8
     #: name                size            offset          mask_flags
     0: SPL                 0x00020000      0x00000000      0
     1: SPL.backup1         0x00020000      0x00020000      0
     2: SPL.backup2         0x00020000      0x00040000      0
     3: SPL.backup3         0x00020000      0x00060000      0
     4: u-boot              0x001e0000      0x00080000      0
     5: u-boot-env          0x00020000      0x00260000      0
     6: kernel              0x00500000      0x00280000      0
     7: rootfs              0x0f880000      0x00780000      0

    I have flashed "MLO" in SPL, "u-boot.img" in u-boot,  "uImage" to kernel and "arago-base-tisdk-image-am335x-evm.ubi" to rootfs respective partitions.

    I have placed the SW3 to NAND flash booting mode(on the EVM the switch was placed reverse).

    and it shows the error message as..


    U-Boot SPL 2011.09 (Apr 08 2012 - 18:29:14)
    Texas Instruments Revision detection unimplemented
    spl: ERROR: This bootmode is not implemented - hanging### ERROR ### Please RESET the board ###

    can any one please tell me where i am going wrong.

  • Everything looks correct. Can you verify that both SW3 and SW4 look like this:

    Best regards,
    Miroslav

  • The SW3 switch was i have placed was correct please find below..  

  • Your version of U-Boot is very old. Please try using a newer version of the SDK or at least just a newer version of U-Boot? For example: http://software-dl.ti.com/sitara_linux/esd/AM335xSDK/06_00_00_00/index_FDS.html

    This should fix your issue.

    Best regards,
    Miroslav

  • I have downloaded "ti-sdk-am335x-evm-07.00.00.00" with in that i have compiled u-boot using the commands

    $ [ -d ./am335x ] && rm -rf ./am335x
    $ make O=am335x CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm am335x_evm

    with in the am335x folder i found u-boot.img and MLO files and i flashed these two files int NAND flash and i got continuous messages like


    U-Boot SPL 2013.10-00189-g78d8ebd (May 13 2014 - 03:13:51)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2013.10-00189-g78d8ebd (May 13 2014 - 03:13:51)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2013.10-00189-g78d8ebd (May 13 2014 - 03:13:51)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2013.10-00189-g78d8ebd (May 13 2014 - 03:13:51)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2013.10-00189-g78d8ebd (May 13 2014 - 03:13:51)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

  • Did you follow the expected NAND layout as shown in the following link? http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#NAND_Layout

    Can you try this with the pre-built images inside <sdk_dir>/board-support/prebuilt-images/ ?

    Best regards,
    Miroslav

  • I have the same NAND layout in the EVM, and i have also tried the pre-build images in the SDK but the same error as

    U-Boot SPL 2013.10-g78d8ebd (Mar 30 2014 - 20:46:34)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot SPL 2013.10-g78d8ebd (Mar 30 2014 - 20:46:34)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

  • Now that I checked, I found that in SDK 07.00.00.00, the CONFIG_SPL_OS_BOOT option is enabled by default (it isn't in SDK 06.00.00.00). What this causes is, when booting from NAND, the SPL will try to load U-Boot (if there is a 'c' character on the serial line) and if it fails it will try to directly load the linux kernel (check the spl_nand_load_image() function inside <u-boot_dir>/common/spl/spl_nand.c). This is absolutely fine, except that the NAND offsets have changed in the latest SDK.

    Here are the U-Boot and Linux kernel offsets from SDK 07.00.00.00:

    #define CONFIG_SYS_NAND_U_BOOT_OFFS		0x000C0000
    
    #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	0x00A00000 /* kernel offset */

    Please use these offsets when flashing the NAND and your board should boot. I just tried this.

    Best regards,
    Miroslav

  • Hi,

    what you said was correct,

    I came to know that the problem was due to not standardized offset address in the u-boot versions of SDK 7 and SDK 5.

    I have ported the according to the offset address of SDK 7 version and able to boot u-boot but unable to boot Kernel and it shows error as

    U-Boot SPL 2013.10-00189-g78d8ebd-dirty (May 14 2014 - 22:29:38)
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...



    U-Boot 2013.10-00189-g78d8ebd-dirty (May 14 2014 - 22:29:38)

    I2C:   ready
    DRAM:  512 MiB
    NAND:  256 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - bad CRC, using default environment

    Net:   <ethaddr> not set. Validating first E-fuse MAC
    cpsw, usb_ether
    Hit any key to stop autoboot:  0
    Card did not respond to voltage select!
    mmc0(part 0) is current device
    Scanning mmc 0...
    Card did not respond to voltage select!
    ** Bad device mmc 0 **
    Card did not respond to voltage select!
    mmc0(part 0) is current device
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    mmc1(part 0) is current device
    Card did not respond to voltage select!
    Booting from nand ...

    NAND read: device 0 offset 0x80000, size 0x40000
     262144 bytes read: OK

    NAND read: device 0 offset 0x200000, size 0x800000
     8388608 bytes read: OK
    Bad Linux ARM zImage magic!
    U-Boot#

     

    can you please tell me any suggestions regarding this error.

  • Hi,

    Build and use uImage, which contains a header that will be recognized by U-Boot:

    <linux_dir># make tisdk_am335x-evm_defconfig
    <linux_dir># make uImage

    The generated uImage can be found in <linux_dir>/arch/arm/boot.

    Your other option is to generate uImage from zImage using the mkimage tool, which can be found in <u-boot_dir>/tools/mkimage:

    <linux_dir># mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 'Linux' -d arch/arm/boot/zImage arch/arm/boot/uImage

    Best regards,
    Miroslav

  • Hi,

    I have tried both the options but the error persists, is there any other cause for this error?

  • Are you sure you are writing your kernel to NAND offset 0xA00000 ?

    Please post the steps you follow to write the binaries to NAND.

    Best regards,
    Miroslav

  • Hi,

    The mtd partitions in the u-boot witch is provided with SDK 7.0 was


    device nand0 <nand.0>, # parts = 10
     #: name                size            offset          mask_flags
     0: NAND.SPL            0x00020000      0x00000000      0
     1: NAND.SPL.backup1    0x00020000      0x00020000      0
     2: NAND.SPL.backup2    0x00020000      0x00040000      0
     3: NAND.SPL.backup3    0x00020000      0x00060000      0
     4: NAND.u-boot-spl-os  0x00040000      0x00080000      0
     5: NAND.u-boot         0x00100000      0x000c0000      0
     6: NAND.u-boot-env     0x00020000      0x001c0000      0
     7: NAND.u-boot-env.backup10x00020000   0x001e0000      0
     8: NAND.kernel         0x00800000      0x00200000      0
     9: NAND.rootfs         0x0f600000      0x00a00000      0

    I have tried two types of flashing kernel

    1. According to the mtd partition table i have burned MLO, u-boot.img, uImage to nand by the following way

        #nand erase.chip

       #loadb ---> using kermet i transfer files to RAM location 0x80200000 and it shows

                       U-Boot# loadb
                      ## Ready for binary (kermit) download to 0x80200000 at 115200 bps...
                      ## Total Size      = 0x003ed4a0 = 4117664 Bytes
                      ## Start Addr      = 0x80200000

       #nand write.e 0x80200000 NAND.SPL <file size which shows above>   for MLO file

      # loadb  --> transferring u-boot

      # nand write.e 0x80200000 NAND.u-boot <file size>    for u-boot

      # loadb  ---> transferring kernel

      # nand write.e 0x80200000 NAND.kernel  <file size>

       

    After restarting it shows error as

    NAND read: device 0 offset 0x80000, size 0x40000
     262144 bytes read: OK

    NAND read: device 0 offset 0x200000, size 0x800000
     8388608 bytes read: OK
    Bad Linux ARM zImage magic!


    2. Just like above but the uImage file was placed in 0x00a00000 location as bellow

      #loadb

      # nand write.e 0x80200000 0x00A00000 <file size>

    and when i restarts the board it was struck at just a message showing like bellow

    U-Boot SPL 2013.10-00189-g78d8ebd-dirty (May 15 2014 - 01:05:57)

     

  • Hi,

    Below you can find my successful steps to flash the NAND on the AM335x GP EVM and boot kernel from NAND. The only difference is that I load the binaries from the SD card, not from UART. I am using the binaries from SDK 07.00.00.00.

    U-Boot#nand erase.chip
    U-Boot# fatload mmc 0 0x81000000 MLO
    U-Boot# cp.b 0x81000000 0x81020000 20000
    U-Boot# cp.b 0x81000000 0x81040000 20000
    U-Boot# cp.b 0x81000000 0x81060000 20000                                     
    U-Boot# nand write 0x81000000 0x0 0x80000
    U-Boot# fatload mmc 0 0x81000000 u-boot.img
    U-Boot# nand write 0x81000000 0xc0000 0x200000
    U-Boot# fatload mmc 0 0x81000000 uImage
    U-Boot# nand write 0x81000000 0xa00000 0x500000

    After these commands, I changed the boot switches to NAND boot mode and booted the board. Since the CONFIG_SPL_OS_BOOT option is enabled by default in the SPL, it will first try to directly load the kernel from NAND offset 0xA00000 unless interrupted with the 'c' character.

    In both cases, when I hold the 'c' character in order to start U-Boot, and when I don't in order to directly start the kernel, the boot is successful.

    I haven't tried flashing an UBI file system but I guess that if you follow the layout that is incorporated inside the device tree file you will have no problem.

    Best regards,
    Miroslav

  • hi,

    I have tried above commands and its working fine, but i dint understand was that by using the same memory offsets i have flashed using kermit it dint worked, but by using mmc card its booting kernel and that's fine,

    but you are flashing kernel image in to the file system partition address i.e  0xa00000 according to the mtd partitions in the u-boot, now the problem is where i have to flash the rootfs.ubi file (i.e at which offset address).

  • Hi,

    I have also observed another issue that,

    If i power on the board after changing the boot pins and let it boot its directing booting the kernel and its running fine, but

    if i press c after power on it starts u-boot, and it will halt at "U-Boot#", if i enter command "boot", it shows booting from nand and same problem repeats as below

    U-Boot# boot
    mmc0 is current device
    Scanning mmc 0...
    ** File not found /boot/zImage **
    mmc0 is current device
    SD/MMC found on device 0
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    ** File not found /boot/zImage **
    Card did not respond to voltage select!
    mmc1(part 0) is current device
    Card did not respond to voltage select!
    Booting from nand ...

    NAND read: device 0 offset 0x80000, size 0x40000
     262144 bytes read: OK

    NAND read: device 0 offset 0x200000, size 0x800000
     8388608 bytes read: OK
    Bad Linux ARM zImage magic!
    U-Boot#

    I think the problem is that SPL has one uImage's offset and where as u-boots mtd partition has other offset

  • Hi Miroslav,

     I am also trying to port Images (MLO, u boot, uImage and .ubi ) into NAND using SD card.

    1) I prepared uImage. copy that on SD card roofts/boot partition.

    2) Then followed below steps

    U-Boot#nand erase.chip
    U-Boot# fatload mmc 0 0x81000000 MLO
    U-Boot# cp.b 0x81000000 0x81020000 20000
    U-Boot# cp.b 0x81000000 0x81040000 20000
    U-Boot# cp.b 0x81000000 0x81060000 20000                                     
    U-Boot# nand write 0x81000000 0x0 0x80000
    U-Boot# fatload mmc 0 0x81000000 u-boot.img
    U-Boot# nand write 0x81000000 0xc0000 0x200000

    when I am giving below command, I am getting message

    U-Boot# fatload mmc 0 0x81000000 uImage.

    reading uImage                                                                 

    ** Unable to read file uImage **                                              

    what other changes I have to made or where I have to kept uImage??

    How to flash UBI file system??

    Please guide me.

    Regard,

    Vishal Rana

  • Is this SDK v7?

    The flashing procedure is almost the same as with SDK v6, but some of the offsets are different and uImage is no longer used by default. zImage is used instead. You need to copy the zImage and the needed .dtb file from your SD card's /root/boot/ folder to your SD card's /boot partition, also copy the .ubi image from the SDK, then follow these steps:

    U-Boot# nand erase.chip

    NAND erase.chip: device 0 whole chip
    Erasing at 0xffe0000 -- 100% complete.
    OK
    U-Boot# mmc rescan
    U-Boot# fatls mmc 0
       107920   mlo
       389768   u-boot.img
           13   .ipaddr
        41564   devicetree-zimage-am335x-evm.dtb
      4117616   zimage
     32768000   arago-base-tisdk-image-am335x-evm.ubi

    6 file(s), 0 dir(s)

    U-Boot# fatload mmc 0 0x81000000 MLO
    reading MLO
    107920 bytes read in 10 ms (10.3 MiB/s)
    U-Boot# cp.b 0x81000000 0x81020000 20000; cp.b 0x81000000 0x81040000 20000; cp.b 0x81000000 0x81060000 20000
    U-Boot# fatload mmc 0 0x81080000 devicetree-zimage-am335x-evm.dtb
    reading devicetree-zimage-am335x-evm.dtb
    41564 bytes read in 8 ms (5 MiB/s)
    U-Boot# fatload mmc 0 0x810c0000 u-boot.img
    reading u-boot.img
    389768 bytes read in 28 ms (13.3 MiB/s)
    U-Boot# fatload mmc 0 0x81200000 zImage
    reading zImage
    4117616 bytes read in 258 ms (15.2 MiB/s)
    U-Boot# fatload mmc 0 0x81a00000 arago-base-tisdk-image-am335x-evm.ubi
    reading arago-base-tisdk-image-am335x-evm.ubi
    32768000 bytes read in 2039 ms (15.3 MiB/s)
    U-Boot# nand write 0x81000000 0x0 0x2950000

    NAND write: device 0 offset 0x0, size 0x2950000
     43319296 bytes written: OK

    Best regards,
    Miroslav

  • Hi,

    I followed the above steps to boot the system via NAND. I have changed the kernel offfset to 0xa00000 then it is booting till kernel image. how to load the ubi.img to nand and how to boot the file system.

    Thanks
  • Hi,
    Please create a new post for your problem with mentioning SDK details and what procedure you followed since this post seems to be old so other people may not get intervene on this.
    Thanks for your understanding.