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.

Linux/AM3358: NAND boot error

Part Number: AM3358

Tool/software: Linux

Hi,

I am using am3358 processor on a custom board with NAND fitted.

U-boot and kernel were build with sdk 03.03.

When trying to boot MLO prints: The Expected Linux image was not found. Please check your NAND configuration.

Tracing through the code this is the place it is in:

if (header->ih_os == IH_OS_LINUX) {

/* happy - was a linux */
err = nand_spl_load_image(
CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
spl_image.size,
(void *)spl_image.load_addr);

nand_deselect();
return err;
} else {
puts("The Expected Linux image was not "
"found. Please check your NAND "
"configuration.\n");
puts("Trying to start u-boot now...\n");
}

The header it extracts is the top 64 bytes of Kernel partition:

typedef struct image_header {
__be32 ih_magic; /* Image Header Magic Number */
__be32 ih_hcrc; /* Image Header CRC Checksum */
__be32 ih_time; /* Image Creation Timestamp */
__be32 ih_size; /* Image Data Size */
__be32 ih_load; /* Data Load Address */
__be32 ih_ep; /* Entry Point Address */
__be32 ih_dcrc; /* Image Data CRC Checksum */
uint8_t ih_os; /* Operating System */
uint8_t ih_arch; /* CPU architecture */
uint8_t ih_type; /* Image Type */
uint8_t ih_comp; /* Compression Type */
uint8_t ih_name[IH_NMLEN]; /* Image Name */
} image_header_t;

Looking at binary view of my zImage I can see that 29th byte is 0 when MLO expects it to be 5.

Reading about linux image headers it looks like uImage has the Header and zImage is compressed version and does not have it.

Is this correct?

Do I have to have uImage for MLO to recognise the Kernel.

Kind regards,

Ugnius

  • Hi,

    Check this wiki: processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide and see if you have written the files in the correct locations. You should use zimage.
  • I have a bigger page nand and thus have different partition table:

    partition@0 { label = "NAND.SPL";                            reg = <0x00000000 0x00040000>;};
    partition@1 {label = "NAND.SPL.backup1";               reg = <0x00040000 0x00040000>;};
    partition@2 {label = "NAND.SPL.backup2";               reg = <0x00080000 0x00040000>;};
    partition@3 {label = "NAND.SPL.backup3";               reg = <0x000C0000 0x00040000>;};
    partition@4 {label = "NAND.u-boot-spl-os";                reg = <0x00100000 0x00080000>;};
    partition@5 {label = "NAND.u-boot";                          reg = <0x00180000 0x00100000>;};
    partition@6 {label = "NAND.u-boot-env";                   reg = <0x00280000 0x00040000>;};
    partition@7 {label = "NAND.u-boot-env.backup1";     reg = <0x002C0000 0x00040000>;};
    partition@8 {label = "NAND.kernel";                           reg = <0x00300000 0x00700000>;};
    partition@9 {label = "NAND.file-system";                   reg = <0x00a00000 0x1f600000>;};

    The check for linux kernel happens in MLO.

    The header of Zimage:

    The header of Uimage:

    Looking at these Uimage Has 5 at position 29 which is what MLO is expecting.

    I have a few questions:

    1. Why does MLO try to look for a kernel in the first place? I thought the sequence should be MLO -> U-boot -> kernel.

    2. Why does it try to look for a Linux OS marker which looks to be associated with Uimage.

    Kind regards,

    Ugnius

  • Hi Ugnius,

    Which NAND chip you are using? Note that up to 4k (4096) page size is supported.

    See also if the below links will be in help:

    processors.wiki.ti.com/.../Linux_Core_NAND_User's_Guide

    e2e.ti.com/.../1190972
    e2e.ti.com/.../289070

    Regards,
    Pavel
  • I have my kernel booting from NAND now.

    in uboot/include/configs/am335x_evm.h

    I replaced:

    "bootcmd_" #devtypel "=" \

    with:

    "bootcmd_nand0=" \

    because the print on the console was no boot arguments defined for device nand0.

    I dont know if the #devtypel is a define or something to make it more general, but it was now working with it for me.

    I found this solution here: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/557404/2041737

    The MLO is still trying to load UImage of Kernel:

    U-Boot SPL 2016.05-gaeedf80-dirty (Oct 26 2017 - 13:01:07)
    Trying to boot from NAND
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    Not sure why it is set up like this.

    The U-boot by default first tries to boot from SD card and checks ethernet:


    U-Boot 2016.05-gaeedf80-dirty (Oct 26 2017 - 13:01:07 +0100)

    CPU : AM335X-GP rev 2.1
    Model: TI AM335x EVM-SK
    Watchdog enabled
    DRAM: 256 MiB
    NAND: 1024 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Error - No Valid Environment Area found
    *** Warning - bad CRC, using default environment

    <ethaddr> not set. Validating first E-fuse MAC
    Net: Could not get PHY for ethernet@4a100000: addr 0
    eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in SROM is de:ad:be:ef:11:11
    Address in environment is 04:a3:11:fb:e1:10
    , eth1: usb_ether
    Press SPACE to abort autoboot in 2 seconds
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Card did not respond to voltage select!
    Booting from nand ...

    NAND read: device 0 offset 0x100000, size 0x80000
    524288 bytes read: OK

    NAND read: device 0 offset 0x300000, size 0x700000
    7340032 bytes read: OK

    Is there any way to disable this and only keep NAND?

    The method of using boot arguments that are set in different files is a bit confusing to go through.

    Is there any tutorial on this?

    Kind regards

    Ugnius

  • Hi Ugnius,

    Please go through the below e2e thread:

    e2e.ti.com/.../502276

    Let me know if you still have NAND boot questions.

    Regards,
    Pavel
  • Ugnius Subacius said:
    U-Boot SPL 2016.05-gaeedf80-dirty (Oct 26 2017 - 13:01:07)
    Trying to boot from NAND
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    This is most probably caused by file size mismatch and/or wrong offset. Refer to the below pointers for more info:

    Ugnius Subacius said:
    The U-boot by default first tries to boot from SD card and checks ethernet:

    Make sure your boot pins are configured for NAND boot first.

    Regards,
    Pavel

  • Hi Ugnius,

    What is your NAND size and change the NAND configuration as per your NAND size in "am335x_evm.h".

    #define CONFIG_SYS_NAND_PAGE_SIZE
    #define CONFIG_SYS_NAND_OOBSIZE
    #define CONFIG_SYS_NAND_BLOCK_SIZE
    #define CONFIG_SYS_NAND_ECCPOS
    #define CONFIG_SYS_NAND_ECCSIZE
    #define CONFIG_SYS_NAND_ECCBYTES
    #define CONFIG_NAND_OMAP_ECCSCHEME
    #define MTDPARTS_DEFAULT

    #define CONFIG_CMD_SPL_NAND_OFS ?? /* os parameters */
    #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS ??/* kernel offset */
    #define CONFIG_CMD_SPL_WRITE_SIZE ??

    Thanks,
    Anil