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.

AM335x NAND boot issue

Hi, I'm warkap.

I have a AM335x-Reference-Board and I'm trying to boot it with the linux-kernel-4.4.12
But, it doesn't work well. When it boots, it is stuck(?) in stage of loading linux-kernel binary.
Would you give me some advice and answer to my question?

(1) 1st Step, Copying binaries from SD to Nand of the board.
- I put uEnv.txt, MLO, u-boot.img, uImage into SD.
- I insert the SD into the board and, power on with SD-Boot-Mode.
- then, I can see that copy is being done.
- I found useful similar commands in below site so I adopt them in uEnv.txt
(==> processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide)
    uenvcmd=nand erase.chip;
    load mmc 0 0x81000000 MLO;
    nand write 0x81000000 NAND.SPL;
    nand write 0x81000000 NAND.SPL.backup1;
    nand write 0x81000000 NAND.SPL.backup2;
    nand write 0x81000000 NAND.SPL.backup3;
    load mmc 0 0x81000000 u-boot.img;
    nand write 0x81000000 NAND.u-boot;
    load mmc 0 0x81000000 uImage; (==> I converted from zImgae to uImage)
    nand write 0x81000000 NAND.kernel;
    run findfdt;
    load mmc 0 0x81000000 $fdtfile;
    nand write 0x81000000 NAND.u-boot-spl-os;
    saveenv;

- these commands works well, all operations are done well.

(2) 2nd Step, Booting from Nand.
- After finishing copying, I power off and power on again with Nand-Boot-Mode.
- then, I can see that the board boots and u-boot's running.
- then, now is problem stage. It seems taht linux-kernel(uImage) doesn't run.
- There is any other error logs and kernel starting log.
- When I trace boot sequence of u-boot, it still stays in image_entry( ) of jump_to_image_linux( ).


Is there any missing command? or is there any command to be modified in uEnv.txt?
What is the problem in my case?
What should I do check?

  • The software team have been notified. They will respond here.
  • Hi,

    Could you share, why do you use uImage? SDK releases, that use kernel 4.4.x work with zImage...

    Also can you share the printenv output from the u-boot stage of your board? It is possible that findfdt did not specify the correct device tree file, or the bootfile is defined as zImage, which, as I said, is the default for 4.4 kernels.

    Best Regards,
    Yordan
  • Thank you for reply. Your reply became great help for me.

    When I use zImage, an error occurs like below.
    error message ==> "The Expected Linux image was not found. Please check your NAND configuration."
    Oppositely, when I use uImage, no erro occurs. So, I thought that we have to use uImage. (Actually I was wrong. oops)

    Anyway, as your reply, when I tried to adopt zImage, I can see uboot's autoboot screen.
    (when I use uImage, no error occured but uboot's autoboot screen was not seen.
    I mean that uboot's autoboot screen is "Press SPACE to abort autoboot in 2 seconds")

    In uboot's autoboot stage, when no pressing spacebar, nand-boot fail with a data abort like below.
    ================================================================================
    U-Boot SPL 2016.05-g691ce52-dirty (Nov 28 2016 - 15:30:52)
    Trying to boot from NAND
    The Expected Linux image was not found. Please check your NAND configuration.
    Trying to start u-boot now...

    U-Boot 2016.05-g691ce52-dirty (Nov 28 2016 - 15:30:52 +0900)

    Watchdog enabled
    I2C: ready
    DRAM: 1 GiB
    NAND: 256 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    MMC: no card present
    ** Bad device mmc 0 **
    Using default environment

    <ethaddr> not set. Validating first E-fuse MAC
    Net: eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in SROM is de:ad:be:ef:00:01
    Address in environment is d0:39:72:29:46:e4
    , eth1: usb_ether
    Press SPACE to abort autoboot in 2 seconds
    MMC: no card present
    MMC: no card present
    MMC: no card present
    MMC: no card present
    MMC: no card present
    data abort
    pc : [<bff73b48>] lr : [<bff72f9b>]
    reloc pc : [<8081db48>] lr : [<8081cf9b>]
    sp : bef2b698 ip : bff5ba95 fp : 00000003
    r10: bffb6848 r9 : bef35ed8 r8 : bef448f8
    r7 : bff5b61d r6 : bef3c388 r5 : bef3c400 r4 : 47810000
    r3 : bff73b39 r2 : 000012c3 r1 : bffa8309 r0 : bef3c400
    Flags: nZCv IRQs off FIQs on Mode SVC_32
    Resetting CPU ...

    resetting ...
    ================================================================================

    On the other hand, In uboot's autoboot stage, when I press space-key, it enters command mode.
    then, if I input "run nandboot" command, finally nand-boot goes well.

    So, I have another question.
    Although I already set the boot-swithch as NAND (#1,#3, #4 off), why the nand-boot fail?
    Is there any wrong-configuration about boot-device?
    What do I do check?
  • Sorry. I missed your request about printenv.
    So, I attach result of printenv on u-boot stage.
    Below is result of printenv when I press space-key.

    =====================================================================================
    Press SPACE to abort autoboot in 2 seconds
    => printenv
    arch=arm
    args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
    baudrate=115200
    board=am335x
    board_name=A33515BB
    board_rev=1.6A
    board_serial=36154P160397
    boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
    boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};elsebootefi ${kernel_addr_r} ${fdtcontroladdr};fi
    boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
    boot_fdt=try
    boot_net_usb_start=usb start
    boot_prefixes=/ /boot/
    boot_script_dhcp=boot.scr.uimg
    boot_scripts=boot.scr.uimg boot.scr
    boot_targets=mmc0 legacy_mmc0 mmc1 legacy_mmc1 nand0 pxe dhcp
    bootcmd=run findfdt; run init_console; run envboot; run distro_bootcmd
    bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi
    bootcmd_legacy_mmc0=setenv mmcdev 0; setenv bootpart 0:2 ; run mmcboot
    bootcmd_legacy_mmc1=setenv mmcdev 1; setenv bootpart 1:2 ; run mmcboot
    bootcmd_mmc0=setenv devnum 0; run mmc_boot
    bootcmd_mmc1=setenv devnum 1; run mmc_boot
    bootcmd_nand=run nandboot
    bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
    bootcount=1
    bootdelay=2
    bootdir=/boot
    bootenvfile=uEnv.txt
    bootfile=zImage
    bootm_size=0x10000000
    bootpart=0:2
    bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
    console=ttyO0,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc raw 0 3751936
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x400;spl-os-args.raw raw 0x80 0x80;spl-os-image.raw raw 0x900 0x2000;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_nand=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.backup3 part 0 4;u-boot part 0 5;u-boot-spl-os part 0 6;kernel part 0 8;rootfs part 0 9
    dfu_alt_info_ram=kernel ram 0x80200000 0xD80000;fdt ram 0x80F80000 0x80000;ramdisk ram 0x81000000 0x4000000
    distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
    efi_dtb_prefixes=/ /dtb/ /dtb/current/
    envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
    eth1addr=d0:39:72:29:46:e4
    ethaddr=d0:39:72:29:46:e2
    fdt_addr_r=0x88000000
    fdtaddr=0x88000000
    fdtcontroladdr=bef2bed8
    fdtfile=undefined
    findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = BBG1; then setenv fdtfile am335x-bonegreen.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $board_name = A335_ICE; then setenv fdtfile am335x-icev2.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
    finduuid=part uuid mmc 0:2 uuid
    importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
    init_console=if test $board_name = A335_ICE; then setenv console ttyO3,115200n8;else setenv console ttyO0,115200n8;fi;
    kernel_addr_r=0x82000000
    load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
    loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
    loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
    mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
    mmcboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};run envboot; if run loadimage; then run mmcloados;fi;fi;
    mmcdev=0
    mmcloados=run args_mmc; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
    mmcrootfstype=ext4 rootwait
    mtdids=nand0=nand.0
    mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
    nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
    nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-boot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
    nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
    nandrootfstype=ubifs rootwait=1
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
    netloadfdt=tftp ${fdtaddr} ${fdtfile}
    netloadimage=tftp ${loadaddr} ${bootfile}
    nfsopts=nolock
    partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
    pxefile_addr_r=0x80100000
    ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
    ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
    ramdisk_addr_r=0x88080000
    ramroot=/dev/ram0 rw
    ramrootfstype=ext2
    rdaddr=0x88080000
    rootpath=/export/rootfs
    scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
    scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
    scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
    scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
    scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
    scriptaddr=0x80000000
    soc=am33xx
    spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
    spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootz ${loadaddr}
    spibusno=0
    spiimgsize=0x362000
    spiroot=/dev/mtdblock4 rw
    spirootfstype=jffs2
    spisrcaddr=0xe0000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial@44e09000
    stdin=serial@44e09000
    stdout=serial@44e09000
    usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
    usbnet_devaddr=de:ad:be:ef:00:01
    vendor=ti
    ver=U-Boot 2016.05-g691ce52-dirty (Nov 28 2016 - 15:30:52 +0900)

    Environment size: 8151/131068 bytes
    =>
    =====================================================================================

    Thank you.
  • Because I found temporal solutions for Nand autoboot problem on EVM-board, I remain reply here for the record.
    I'm not sure this is right modification. but, I'm sure there is a bug in u-boot source code.
    please refer below changes.

    ======================================================================
    +++ b/include/configs/am335x_evm.h
    @@ -77,7 +77,7 @@
    #devtypel #instance " "

    #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
    - "bootcmd_" #devtypel "=" \
    + "bootcmd_" #devtypel #instance"=" \
    "run nandboot\0"

    #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
    @@ -86,17 +86,35 @@
    #define BOOT_TARGET_DEVICES(func) \
    func(MMC, mmc, 0) \
    func(LEGACY_MMC, legacy_mmc, 0) \
    - func(MMC, mmc, 1) \
    - func(LEGACY_MMC, legacy_mmc, 1) \
    func(NAND, nand, 0) \
    func(PXE, pxe, na) \
    func(DHCP, dhcp, na)
    ======================================================================

    (1) First change
    Nand-device is registered as "nand0" into boot_targets.
    But, bootcmd string was not "bootcmd_nand0" not "bootcmd_nand".
    They are mismatched because "instance" is not used.
    So, modification is needed.

    (2) Second change
    "data abort" problem happens when it boots with mmc1 device.
    So, I commented it out because I think we don't need mmc1.

    After applying above 2 changes, it(Nand autoboot) works well.
    Thank you.